feat: add multi-session export and selective content flags#309
Closed
sunnypatneedi wants to merge 9 commits intoentireio:mainfrom
Closed
feat: add multi-session export and selective content flags#309sunnypatneedi wants to merge 9 commits intoentireio:mainfrom
sunnypatneedi wants to merge 9 commits intoentireio:mainfrom
Conversation
Adds structured export functionality to the explain command for creating
portfolio-ready showcases of AI sessions with privacy-safe redaction.
Key additions:
- Export flags: --export, --showcase, --format (json/markdown), -o/--output
- Showcase redaction: pattern-based + structural + blocklist redaction
- Settings integration: showcase config in strategy_options
- Formatters: JSON and Markdown output formats
- Integration tests: full export workflow coverage
The showcase redaction applies aggressive privacy filters including:
- Pattern-based: URLs, IPs, DB strings, emails, JWTs, PEM keys, ARNs
- Structural: project-relative paths, project name normalization
- Blocklist: user-defined terms (company names, codenames)
- Entropy-based: existing secret detection
Configuration example in .entire/settings.json:
{
"strategy_options": {
"showcase": {
"redact_paths": true,
"redact_usernames": true,
"redact_project_info": true,
"allowed_paths": ["src/", "lib/"],
"custom_blocklist": ["company-name"]
}
}
}
Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
…dback) Fixed all 7 issues reported by Cursor Bugbot: High Severity (4 issues): 1. Default format value breaks non-export explain command - Changed validation to use cmd.Flags().Changed() instead of checking empty string 2. AllowedDomains broken by unconditional email redaction - Moved email redaction from redactPatterns() to redactUsernames() 3. Glob wildcard greedy matching - Changed * expansion from .* to [\w-]* to stay within token boundaries 4. Summary fields bypass showcase redaction - Added redaction for all Summary struct fields (Intent, Outcome, Learnings, Friction, OpenItems) Medium Severity (3 issues): 5. Path redaction drops leading slash - Changed replacement from [PATH] to /[PATH] to preserve leading slash 6. Overly broad HTTPS URL pattern - Made GCP pattern more specific to require known resource types 7. AWS account pattern fails with space - Added separator capture group to preserve colons/spaces in replacement Also: - Fixed test failures caused by invalid checkpoint IDs (12-hex-char format) - Updated glob test to document Go regex limitation (no lookahead support) - Reordered redaction layers: paths → patterns → git remotes → emails → blocklist - Made AWS ARN pattern support optional account IDs (S3 ARNs) Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
Adds a new `entire insights` command that provides analytics and metrics across all sessions and checkpoints. Features: - Session statistics: count, duration, token usage aggregates - Top contributors by checkpoint count - Most active files across all sessions - Checkpoint distribution by strategy - Time-based analytics (sessions per day/week) - Filtering by date range, strategy, and file path - Multiple output formats: table, JSON, CSV - Caching for improved performance Usage: entire insights # Show all insights entire insights --sessions # Session statistics only entire insights --files # File activity only entire insights --format json # JSON output entire insights --since "7 days ago" # Filter by date entire insights --strategy manual-commit # Filter by strategy Implementation: - insights.go: Main command and CLI interface - insights_analytics.go: Core analytics calculations - insights_cache.go: Caching layer for performance - insights_filters.go: Filtering logic - insights_formatters.go: Output formatting (table/JSON/CSV) - insights_test.go: Unit tests - integration_test/insights_test.go: Integration tests Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
- Added json tags to all structs for proper marshaling - Fixed redefinition of built-in 'max' function (renamed to maxCount) - Converted if-else chain to switch statement in barChar - Added nolint comments for intentional patterns: * unparam: error returns kept for consistency * maintidx: high complexity acceptable for HTML formatting * gosec G602: safe array access with bounded loop * nilerr: intentional error ignoring in fallback logic - Fixed constant usage throughout insights.go (replaced string literals) - Fixed boolean expression in insights_test.go for better readability - Updated Long description and examples to match actual flag values - Removed duplicate unknownStrategyName constant declaration All lint checks now pass with 0 issues. Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
- Renamed --formatJSON flag to --json for consistency with integration tests
- Updated error message to match flag name change
- Fixed integration test expectations:
* Changed expected JSON field names from PascalCase to snake_case
(to match the json tags: total_sessions, total_checkpoints, etc.)
* Updated mutually exclusive error check to accept Cobra's default
error message format
All integration tests now pass.
Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
- Renamed unused parameters to _ in formatExportJSON and formatExportMarkdown - Wrapped json.MarshalIndent error for proper error handling - Removed unnecessary string() conversions (Context is already string) - Added nolint comment for unparam in formatExportMarkdown All new lint issues resolved (0 new issues compared to main). Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
Implements two major enhancements to the explain command's export functionality: 1. Multi-session export with --all flag: - Export all checkpoints at once with `--all` - Filter by session using `--session` with `--all` - JSON array output format for multiple checkpoints - Markdown sections format for multiple checkpoints 2. Selective content export flags: - --no-prompts: Exclude prompts from export - --no-context: Exclude context.md from export - --no-transcript: Exclude transcript from export - --include-tool-calls: Extract and include tool calls separately - --include-file-diffs: Placeholder for future file diff inclusion Key changes: - Added exportOptions struct to control export content - Implemented extractToolCalls() to parse JSONL transcripts - Updated all formatters to respect content preferences - Added validation for conflicting flags - All unit tests pass Example usage: entire explain --export --all --session 2026-01-13 --showcase -o output.json entire explain -c abc123 --export --no-prompts --include-tool-calls -o output.json Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com> Entire-Checkpoint: 48304b2e0d3c
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
This PR implements two major enhancements to the
explaincommand's export functionality:1. Multi-session Export (
--allflag)--all--sessionwith--all2. Selective Content Export Flags
--no-prompts: Exclude prompts from export--no-context: Exclude context.md from export--no-transcript: Exclude transcript from export--include-tool-calls: Extract and include tool calls separately--include-file-diffs: Placeholder for future file diff inclusionKey Changes
exportOptionsstruct to control export content preferencesextractToolCalls()to parse JSONL transcripts and extract tool_use entriesformatExportJSON,formatExportMarkdown,formatExportMultipleJSON,formatExportMultipleMarkdown) to respect content preferences--no-transcriptwith--include-tool-calls)exportOptionsparameterExample Usage
Testing
All unit tests pass:
mise run testRelated
This PR addresses requirements from the Discord discussion about sharing checkpoints publicly, specifically:
Note: This builds on top of PR #230's showcase redaction feature.