Skip to content

feat: add multi-session export and selective content flags#309

Closed
sunnypatneedi wants to merge 9 commits intoentireio:mainfrom
sunnypatneedi:main
Closed

feat: add multi-session export and selective content flags#309
sunnypatneedi wants to merge 9 commits intoentireio:mainfrom
sunnypatneedi:main

Conversation

@sunnypatneedi
Copy link

Summary

This PR implements two major enhancements to the explain command's export functionality:

1. Multi-session Export (--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 preferences
  • Implemented extractToolCalls() to parse JSONL transcripts and extract tool_use entries
  • Updated all formatters (formatExportJSON, formatExportMarkdown, formatExportMultipleJSON, formatExportMultipleMarkdown) to respect content preferences
  • Added validation to prevent conflicting flags (e.g., --no-transcript with --include-tool-calls)
  • Updated all tests to include the new exportOptions parameter
  • All unit tests pass ✅

Example Usage

# Export all sessions with showcase redaction and session filter
entire explain --export --all --session 2026-01-13 --showcase -o sessions.json

# Export single checkpoint without prompts, but with extracted tool calls
entire explain -c abc123 --export --no-prompts --include-tool-calls -o output.json

# Export multiple sessions as markdown with minimal content
entire explain --export --all --no-transcript --no-context --format markdown -o sessions.md

Testing

All unit tests pass:

mise run test

Related

This PR addresses requirements from the Discord discussion about sharing checkpoints publicly, specifically:

  • ✅ Multi-session export (pick all sessions)
  • ✅ Selective content export (pick what to include/exclude)
  • ✅ Tool call extraction

Note: This builds on top of PR #230's showcase redaction feature.

sunnypatneedi and others added 9 commits February 10, 2026 15:23
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
@sunnypatneedi sunnypatneedi requested a review from a team as a code owner February 12, 2026 18:58
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Development

Successfully merging this pull request may close these issues.

1 participant