@davmash/bygone 0.7.1 → 0.8.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -0,0 +1,124 @@
1
+ # Product surface overview
2
+
3
+ This is the internal map of Bygone's user-facing product. Update it whenever a
4
+ command, launch form, comparison mode, tour scene, or release artifact is added
5
+ or materially changed.
6
+
7
+ ## Product boundaries
8
+
9
+ - **Explore — desktop:** open-ended file, directory, history, revision,
10
+ multi-panel, and branch-change investigation.
11
+ - **Present — desktop/browser:** generated and authored tours with narrative,
12
+ exact source evidence, and an independent changed-files rail.
13
+ - **VS Code companion:** contextual file comparison and file history near the
14
+ current editor. Repository-, directory-, multi-panel-, and tour-scale work
15
+ should hand off to desktop.
16
+ - **CLI and agent tools:** launch automation plus tour context, authoring,
17
+ validation, compilation, schema, and coverage.
18
+ - **Development only:** fixtures, smoke/capture modes, generated screenshots,
19
+ and developer tools. These must not appear in production menus or packages.
20
+
21
+ The shared Monaco renderer supplies diff semantics and presentation. Sharing a
22
+ renderer does not make every workflow appropriate in every host.
23
+
24
+ ## Standalone Explore
25
+
26
+ | User question | Discovery and launch | Session/source | Mutability and lifecycle | Maturity | Verification |
27
+ | --- | --- | --- | --- | --- | --- |
28
+ | Start without source material | CLI `bygone` outside Git; blank startup | Blank multi-diff | Writable untitled panels; normal undo and dirty state | Core | `testBlankMultiDiffStartsWithTwoEditablePanels` |
29
+ | Compare files | File → Compare Files; drag/drop; `bygone left right`; `--diff` | Files, two-way or multi-diff | Files are writable; save, reload, refresh, and external-change policy apply | Core | standalone smoke and multi-diff tests |
30
+ | Compare directories | File → Compare Directories; drag/drop; two or more directory arguments | Directory comparison | Directory rows are read-only; writable file drill-down depends on source/review state | Core | directory smoke and directory-diff tests |
31
+ | Follow one file or directory through Git | Git → View File or Directory History; one path; `--history` | Git commits plus supported index/worktree states | Commits are read-only; worktree/index provenance is explicit | Core | Git history and directory-history tests |
32
+ | Compare named revisions | `bygone --git-diff <refs…>` | Git blobs/revisions | Read-only snapshots | Secondary; CLI discovery needs improvement | Git comparison tests |
33
+ | Explore the current branch change | Git → Explore Current Branch Change; `bygone review` | Merge-base-to-tip branch inventory | Read-only review snapshots; dirty state is reported, not silently included | Core | branch comparison and review-path tests |
34
+ | Search comparison code | Edit → Find or Search Comparison | Active, visible, all loaded panels, unopened changed text snapshots, or one file's Git history | Search is read-only; history distinguishes content occurrence from introduction/removal; Replace requires the active writable model | Core | find, comparison-search, change-set-search, and history-search tests |
35
+ | Search or safely replace in a filesystem tree | Edit → Search in Files; explicit directory root | System ripgrep 14+ with include/exclude, hidden, ignore, and result-limit controls | Search is read-only and cancellable; completed case-sensitive literal searches can build an exclusion-aware, revalidated, atomic replacement preview with guarded undo | Optional system capability | repository search/replace contracts, benchmark, and host-protocol tests |
36
+ | Move through a multi-panel comparison | Strip buttons, panel headers, gutters, wheel, or `Alt+Arrow` | Active panel and adjacent pair | Does not change source identity | Core | focused-strip controller and standalone smoke tests |
37
+ | Search an authored tour | Presenter search or `Cmd/Ctrl+Shift+F` | Authored narrative plus compiled base/head code snapshots | Read-only; narrative hits navigate scenes/steps and code hits preserve Return to tour | Core | tour-search and presenter-host tests |
38
+
39
+ The File menu owns sources and persistence; Edit owns focused text operations;
40
+ Git owns historical/revision questions; Present changes product area; Navigate
41
+ owns movement within the current session; View owns display preferences; Window
42
+ owns native window lifecycle. Developer fixtures appear only when Electron is
43
+ not packaged.
44
+
45
+ ## Standalone Present and browser presenter
46
+
47
+ | User question | Discovery and launch | Identity/provenance | Mutability | Maturity | Verification |
48
+ | --- | --- | --- | --- | --- | --- |
49
+ | Explain the current branch automatically | Present → Present Current Branch; `bygone present` | Committed merge-base-to-tip range | Read-only | Core | presentation launch and generated-tour tests |
50
+ | Open an authored walkthrough | Present → Open Authored Tour; `bygone present --tour`; VS Code hand-off | Manifest range, scene, step, exact source anchor | Read-only | Core | reproducible example and tour validation tests |
51
+ | Explain a real stack | `stacked-diff` scene | Exact real Git revisions per panel | Read-only | Advanced | `examples/stacked-diff.bygone` |
52
+ | Explain a change in conceptual stages | `deconstructed-diff` scene | Explicitly labeled synthetic explanation stages backed by exact hunk IDs | Read-only | Advanced/experimental authoring | `examples/deconstructed-diff.bygone` |
53
+ | Browse away from the narration | Files rail, change navigation | Browsed file versus active tour focus remain distinct | Read-only; Return to Tour restores narrative focus | Core | tour focus and persistent-anchor tests |
54
+
55
+ Tour authoring remains file/CLI/agent driven. The desktop UI opens and presents
56
+ tours but does not attempt to duplicate schema-aware authoring forms.
57
+
58
+ ## VS Code companion
59
+
60
+ | Command | Intended ownership | Current state | Editing contract | Follow-up |
61
+ | --- | --- | --- | --- | --- |
62
+ | Compare Active File With / Compare Selected Files / Compare With Selected | VS Code contextual comparison | Independent, restorable editor-area tabs | Trusted local panes use `TextDocument` and `WorkspaceEdit`; non-local panes are read-only | Core |
63
+ | View Active File History | VS Code contextual history | Implemented in the editor area | Historical content is read-only; an open unsaved worktree buffer is preserved | Core |
64
+ | Open This Comparison in Desktop | Desktop hand-off | Implemented for active local file pairs | No source content crosses the boundary | Core |
65
+ | Explore Current Branch in Desktop | Desktop hand-off | Implemented for a local configured executable | No source content crosses the boundary | Disabled for untrusted, remote, and virtual workspaces |
66
+ | Present Current Branch in Desktop | Desktop hand-off | Implemented | Read-only presentation | Same launch-contract hardening |
67
+ | Open Authored Tour in Desktop | Desktop hand-off | Implemented | Read-only presentation | Same launch-contract hardening |
68
+ | Compare Directories / Three or More Files in Desktop | Desktop hand-off | Implemented with local multi-selection | Desktop owns the comparison and writable lifecycle | Keep contextual visibility narrow |
69
+ | Legacy in-extension directory, N-panel, and branch-review commands | Desktop-owned | Removed from production contributions | Parallel extension state is not the target product | Internal compatibility code can be removed with the deferred host rewrite |
70
+ | Install or Open Desktop App | Setup fallback | Implemented | Not applicable | Opens settings or release downloads when no executable is configured |
71
+
72
+ The production extension does not contribute test fixtures. The VSIX is checked
73
+ against an explicit runtime-file allowlist. VS Code repository search should use
74
+ VS Code's native Search rather than another bundled ripgrep process.
75
+
76
+ ## CLI and authoring tools
77
+
78
+ | Surface | Purpose | Mutability/maturity |
79
+ | --- | --- | --- |
80
+ | `bygone`, paths, `--diff`, `--history`, `--git-diff`, `review` | Launch Explore sessions | Core launcher; desktop owns writes |
81
+ | `present` and `present --tour` | Launch Present sessions | Core, read-only presentation |
82
+ | `tour context` | Produce a bounded provider-neutral change dossier | Authoring support, read-only |
83
+ | `tour validate`, `compile`, `schema`, and coverage options | Validate exact evidence and build portable manifests | Advanced authoring, read-only except explicit output files |
84
+ | `completion` | Generate shell completions from the shared command specification | Supporting tooling |
85
+
86
+ ## Provenance and mutability vocabulary
87
+
88
+ Use these labels consistently:
89
+
90
+ - **Writable file:** filesystem/worktree content participating in dirty, undo,
91
+ save, reload, watcher, and refresh behavior.
92
+ - **Read-only snapshot:** committed Git, history, tour, or supplied content that
93
+ cannot be replaced or saved over a source file.
94
+ - **INDEX** and **WORKTREE:** repository work states; do not describe them as
95
+ commits.
96
+ - **Explanation stage:** synthetic deconstructed content; never imply that it
97
+ is a real commit.
98
+ - **Real revision:** a panel resolved from an exact Git object identity.
99
+
100
+ Paths and labels are descriptive; object IDs, source descriptors, and compiled
101
+ tour locators are authoritative identities.
102
+
103
+ ## Artifacts and production boundary
104
+
105
+ | Artifact | Intended contents | Exclusions/check |
106
+ | --- | --- | --- |
107
+ | VSIX | Extension manifest, extension bundle, shared renderer assets/workers, public docs and icon | `scripts/check-vsix-contents.mjs` rejects unexpected files |
108
+ | Desktop packages | Electron host, shared renderer, presenter, runtime assets | Production menus hide fixtures and DevTools |
109
+ | npm CLI package | Launcher, CLI/tour runtime, required desktop support | Dry-run package-content validation |
110
+ | Compiled tour | Bounded manifest plus exact referenced source evidence | Validation, reproducibility, and coverage checks |
111
+
112
+ Only open-source Bygone fixtures may be committed to tests, examples,
113
+ benchmarks, screenshots, tours, or release artifacts. Do not derive fixtures
114
+ from proprietary repositories even if names and paths are removed.
115
+
116
+ ## Update checklist
117
+
118
+ When changing the product surface:
119
+
120
+ 1. Add or revise the applicable row above.
121
+ 2. State the owning host, source identity, mutability, and lifecycle behavior.
122
+ 3. Link a representative automated test or checked-in example.
123
+ 4. Update command help, menus, package contributions, and user docs together.
124
+ 5. Verify production packages contain no development or proprietary material.
@@ -0,0 +1,67 @@
1
+ # Repository search prototype
2
+
3
+ Bygone exposes a read-only desktop **Edit → Search in Files…** workflow backed
4
+ by the host-side `rg --json` adapter. Choose an explicit root, enter a query,
5
+ and run the search; results stream into a bounded panel and open as read-only
6
+ single-panel source views at the exact matched line.
7
+
8
+ After a complete case-sensitive literal search, enter replacement text and
9
+ choose **Preview Replace**. The preview groups occurrences by file and allows
10
+ individual files to be excluded. Bygone confirms the selected totals, hashes
11
+ and revalidates every file before writing, uses atomic same-directory writes,
12
+ rolls back completed writes if a later write fails, and offers immediate Undo.
13
+ Undo is rejected if any replaced file changed afterward. Regex and
14
+ case-insensitive Replace in Files are intentionally unavailable because their
15
+ match semantics must not diverge from ripgrep search results.
16
+
17
+ ## Current contract
18
+
19
+ - The host passes an absolute root and structured options.
20
+ - The adapter spawns an executable with an argument array and `shell: false`.
21
+ - JSON lines are validated at runtime before becoming normalized matches.
22
+ - Result paths must remain inside the selected root.
23
+ - Result and stderr sizes are bounded.
24
+ - Cancellation and truncation terminate the child process.
25
+ - A superseding query cancels the previous process and stale batches are ignored.
26
+ - Result navigation accepts only identities emitted by the active search,
27
+ rechecks root containment and file type, and rejects files modified after
28
+ the search began.
29
+ - Unsaved editors, Git blobs, index content, tours, and synthetic stages are
30
+ outside this filesystem adapter and require their owning source adapters.
31
+
32
+ ## Distribution decision
33
+
34
+ Bygone currently requires a detected system `rg`. It
35
+ requires ripgrep 14 or newer, uses `BYGONE_RG_PATH` as an explicit executable
36
+ override, and exposes **Help → Repository Search Status…**. **Search in Files…**
37
+ routes to that status when the capability is unavailable. Missing,
38
+ unparseable, and unsupported versions are explicit capability states. Bygone
39
+ does not silently use a different regex/search engine.
40
+
41
+ This keeps desktop packages small and makes availability explicit; repository
42
+ search is therefore an optional system capability rather than a zero-setup
43
+ core feature. The alternatives remain:
44
+
45
+ 1. Bundle verified, signed ripgrep binaries for every supported desktop target
46
+ and maintain their license/provenance/security updates.
47
+ 2. Require a system executable and provide clear capability, version, setup,
48
+ and unsupported-state guidance.
49
+ 3. Add a compatible fallback only with tests proving its regex, ignore, hidden,
50
+ symlink, binary, Unicode, and cancellation behavior matches the advertised
51
+ contract.
52
+
53
+ Silent fallback to a different search language remains unacceptable.
54
+
55
+ ## Open-source benchmark
56
+
57
+ Run:
58
+
59
+ ```bash
60
+ npm run compile
61
+ npm run perf:search
62
+ ```
63
+
64
+ The benchmark creates a temporary synthetic tree, searches literal and regex
65
+ queries, reports elapsed time and match counts, and deletes the tree. Adjust
66
+ its scale with `BYGONE_SEARCH_BENCH_FILES`. It must not be pointed at or seeded
67
+ from proprietary repositories for committed evidence.
package/docs/search.md ADDED
@@ -0,0 +1,56 @@
1
+ # Search scopes and semantics
2
+
3
+ Bygone uses the engine that owns each source. This keeps unsaved editor text,
4
+ filesystem state, Git snapshots, and compiled tours accurate without pretending
5
+ that their regex dialects or lifecycle rules are identical.
6
+
7
+ | Scope | Engine/source | Options | Limit and freshness | Result behavior |
8
+ | --- | --- | --- | --- | --- |
9
+ | Active pane | Monaco model | Monaco Find options | Current in-memory model | Selects in the active pane; Replace only when writable |
10
+ | Visible or all panels | Monaco models | Literal/regex, case | 500 current in-memory matches | Selects the exact loaded panel and range |
11
+ | Current change set | Materialized session snapshots | Literal/JavaScript regex, case | 500 matches per request; rebuilt on request | Opens the changed file comparison and exact side |
12
+ | File Git history | Materialized Git parent/commit blobs | Literal/JavaScript regex, case; content or introduction/removal | 500 matches per request; tied to loaded history | Opens the exact revision pair and base/head side |
13
+ | Search in Files | System ripgrep 14+ | Literal/ripgrep regex, case, whole word, include/exclude globs, hidden and ignore policy | User-selected 100–5,000; cancellable; file revalidated before open | Opens a read-only source panel at the exact working-tree line |
14
+ | Authored tour | Compiled manifest narrative and base/head snapshots | Case-insensitive literal; narrative/code scope | 300 manifest matches | Opens the exact scene/step or code side and preserves Return to tour |
15
+
16
+ ## Deliberate differences
17
+
18
+ - Broad JavaScript-backed snapshot searches are line-oriented. Their regular
19
+ expressions do not span lines. Zero-length matches advance safely.
20
+ - Search in Files uses ripgrep syntax and ignore behavior; Bygone does not
21
+ silently substitute JavaScript regular expressions when ripgrep is missing.
22
+ - Tour search is intentionally literal and case-insensitive so presenter
23
+ navigation stays lightweight and predictable.
24
+ - Whole-word matching is currently a ripgrep/Monaco capability, not a promise
25
+ made by every snapshot adapter.
26
+ - Replace in Files is narrower than Search in Files: only completed,
27
+ case-sensitive literal searches can produce a preview. This lets the write
28
+ core reproduce exact matches without claiming regex-dialect compatibility.
29
+ - Binary contents, OCR, submodules, remote workspaces, Git blobs outside the
30
+ loaded history, and unsaved Monaco text are not filesystem-search inputs.
31
+
32
+ ## Provenance and stale results
33
+
34
+ Every scope keeps the identity needed by its owner: panel and range, changed
35
+ file side, history entry and revision side, filesystem path and coordinates,
36
+ or tour scene/step/file side. Filesystem result paths must remain within the
37
+ selected real root, must have been emitted by the active request, and are
38
+ rejected if the file changed after the search began. Superseding or closing a
39
+ filesystem search cancels the ripgrep process and ignores late batches.
40
+ Replacement previews additionally retain before/after hashes and bytes,
41
+ revalidate all selected files before any write, roll back on write failure,
42
+ and permit undo only while the after-hashes still match.
43
+
44
+ ## Performance fixtures
45
+
46
+ All committed fixtures are generated locally from Bygone-owned text. Run:
47
+
48
+ ```bash
49
+ npm run perf:search
50
+ npm run perf:search-adapters
51
+ ```
52
+
53
+ The repository benchmark covers 4,000 generated files. The adapter benchmark
54
+ covers 120 change-set snapshots, 250 history revisions, and a 120-file tour.
55
+ Each in-memory adapter has a deliberately generous 1,000 ms regression budget,
56
+ overridable with `BYGONE_SEARCH_ADAPTER_BUDGET_MS` for profiling.
@@ -0,0 +1,49 @@
1
+ version: 1
2
+ title: Explain persistent tour markers in conceptual stages
3
+ range:
4
+ base: d040a442657547340e5fa4dcc58bfc0d233ab989
5
+ head: b05ecc2c8998aa7569934dc7914c2e9924f7d0be
6
+ anchors: {}
7
+ connections: []
8
+ chapters:
9
+ - id: explanation-order
10
+ title: Synthetic explanation stages
11
+ scenes:
12
+ - id: persistent-markers
13
+ kind: deconstructed-diff
14
+ title: Separate persistent markers from active emphasis
15
+ summary: Reorder one real commit into synthetic cumulative stages for teaching.
16
+ bullets:
17
+ - The source contract first permits several annotations.
18
+ - The presenter then marks every anchor and identifies the active one.
19
+ - The renderer finally separates persistent gutter markers from active text emphasis.
20
+ tags: [tours, explanation, synthetic]
21
+ takeaway: These panels are explanation stages, not historical commits.
22
+ base: d040a442657547340e5fa4dcc58bfc0d233ab989
23
+ target: b05ecc2c8998aa7569934dc7914c2e9924f7d0be
24
+ stages:
25
+ - id: contract
26
+ title: Carry every anchor
27
+ narration: Expand the host contract from one annotation to an active-marked collection.
28
+ changes:
29
+ - file: src/webviewMessages.ts
30
+ hunks: [hunk-64e041c7407c, hunk-f81ce869a41a]
31
+ - id: presentation
32
+ title: Build persistent and active annotations
33
+ narration: The tour host emits all anchors for the file and marks the current step active.
34
+ changes:
35
+ - file: web/host.js
36
+ hunks: [hunk-baa2982f00b2, hunk-a11ba6c61eab, hunk-c32fa33b08c9, hunk-3d642f820720, hunk-34282593627a]
37
+ - id: rendering
38
+ title: Emphasize only the active anchor
39
+ narration: The renderer gives every anchor a gutter decoration while reserving the text class and reveal target for the active one.
40
+ changes:
41
+ - file: media/script.js
42
+ hunks: [hunk-7ab25ee9fe44, hunk-229ff9b95257, hunk-208bf1e2739a, hunk-195c64e7ce9d, hunk-ca648f8b7f6d, hunk-0a640980b9b7, hunk-d005d43f28c8, hunk-814c1fb6cdf3, hunk-208dd701b2db, hunk-cd8f327f0940, hunk-9f54024f461a, hunk-56e6f514f9ae, hunk-45626d68d23d]
43
+ - file: test/runTests.js
44
+ hunks: [hunk-69f71617ff01, hunk-55f5ba472e6c]
45
+ exclusions:
46
+ - file: web/web-host.js
47
+ reason: Generated browser bundle; the source host is assigned above.
48
+ - file: web/web-host.js.map
49
+ reason: Generated source map; it carries no independent product behavior.
@@ -0,0 +1,55 @@
1
+ version: 1
2
+ title: Real revisions build the tour system
3
+ range:
4
+ base: 23aa253d130338096a28860498bee67f7727636b
5
+ head: 7a6d000203a25410e44fac0f2393fb4ef4b6b9d1
6
+ anchors: {}
7
+ connections: []
8
+ chapters:
9
+ - id: revision-stack
10
+ title: Follow real Git milestones
11
+ scenes:
12
+ - id: tour-capabilities
13
+ kind: stacked-diff
14
+ title: Grow the authored-tour contract
15
+ summary: Each panel is a real immutable revision in Bygone's open-source history.
16
+ bullets:
17
+ - The inventory establishes stable changed units.
18
+ - Coverage maps authored evidence onto those units.
19
+ - Stacked scenes then expose selected revisions as adjacent panels.
20
+ tags: [git, tours, history]
21
+ takeaway: Use stacked diffs only when the real revisions are meaningful milestones.
22
+ stack:
23
+ - id: baseline
24
+ ref: f66275c808b3dedca74f95cb355e3693287eeedd
25
+ label: Before tour inventory
26
+ - id: inventory
27
+ ref: fa61c9e7be161792531e6568db774a03c2fba3ba
28
+ label: Stable inventory
29
+ - id: coverage
30
+ ref: a532c60c2e44335efcee5c2d3bafa77bfd5628c4
31
+ label: Coverage reporting
32
+ - id: stacked
33
+ ref: 7a6d000203a25410e44fac0f2393fb4ef4b6b9d1
34
+ label: Stacked tours
35
+ files:
36
+ - src/changeTour.ts
37
+ steps:
38
+ - id: inventory-stage
39
+ title: Establish change identity
40
+ body: The first selected revision gives later authored evidence a stable change model.
41
+ file: src/changeTour.ts
42
+ pair: [baseline, inventory]
43
+ side: right
44
+ - id: coverage-stage
45
+ title: Connect evidence to coverage
46
+ body: The next real revision makes explanation depth and omitted work measurable.
47
+ file: src/changeTour.ts
48
+ pair: [inventory, coverage]
49
+ side: right
50
+ - id: stacked-stage
51
+ title: Present the historical sequence
52
+ body: The final revision compiles these real milestones into adjacent panels.
53
+ file: src/changeTour.ts
54
+ pair: [coverage, stacked]
55
+ side: right