diff --git a/.github/actions/setup/action.yml b/.github/actions/setup/action.yml new file mode 100644 index 0000000..12973f5 --- /dev/null +++ b/.github/actions/setup/action.yml @@ -0,0 +1,18 @@ +name: Set up +description: Node 22 with the npm cache, the locked dependencies (npm ci) and, on request, Playwright's Chromium. +inputs: + chromium: + description: Install Chromium for the headless-browser checks. + default: 'false' +runs: + using: composite + steps: + - uses: actions/setup-node@949feb2413d6458794dcd2491c4babbbce0c15c1 # v7.1.0 + with: + node-version: 22 + cache: npm + - run: npm ci + shell: bash + - if: ${{ inputs.chromium == 'true' }} + run: npx playwright install --with-deps chromium + shell: bash diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index ad29446..8436032 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -1,9 +1,12 @@ name: CI +# The one list of what gates a change: pull requests and main run it, and the release workflow calls it before it +# publishes. Not here: test:checktour and test:podcast (screenshot drivers to look at), test:grader (needs a model). on: push: branches: [main] pull_request: + workflow_call: # One run per branch or pull request; a newer push cancels the older run. concurrency: @@ -15,22 +18,23 @@ permissions: jobs: test: - name: Build, unit tests, VS Code tests + name: Build, lint, unit tests, VS Code tests runs-on: ubuntu-latest timeout-minutes: 30 steps: - uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1 - - uses: actions/setup-node@949feb2413d6458794dcd2491c4babbbce0c15c1 # v7.1.0 - with: - node-version: 22 - cache: npm - - run: npm ci + - uses: ./.github/actions/setup - run: npm run build + - name: Generated files are up to date (cli/understanding.mjs) + run: git diff --exit-code + - name: Lint (ESLint, layers and import cycles) + run: npm run lint - name: Unit tests run: npm test - - name: Skill scripts + - name: Skill scripts, and the example journey still matches the example code run: | python3 skills/code-journey/scripts/journey.py help all > /dev/null + python3 skills/code-journey/scripts/journey.py check examples/shop place-order quiet node skills/understanding-check/scripts/questions.mjs > /dev/null - name: Tests in a real VS Code run: npm run test:integration @@ -49,12 +53,9 @@ jobs: timeout-minutes: 30 steps: - uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1 - - uses: actions/setup-node@949feb2413d6458794dcd2491c4babbbce0c15c1 # v7.1.0 + - uses: ./.github/actions/setup with: - node-version: 22 - cache: npm - - run: npm ci - - run: npx playwright install --with-deps chromium + chromium: 'true' - run: npm run build - name: Panel layout and clicks run: npm run test:panel diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index 38fc236..5490f04 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -2,6 +2,7 @@ name: Release # Push a tag v that matches package.json to publish that version: # npm version minor (edits package.json and CHANGELOG is yours to write) → git push --follow-tags +# The tag runs the whole CI (ci.yml) and publishes the package that CI built. on: push: tags: ['v[0-9]+.[0-9]+.[0-9]+'] @@ -14,73 +15,59 @@ permissions: contents: read jobs: - build: - name: Test and package + version: + name: The tag is the version, and the changelog has it runs-on: ubuntu-latest - timeout-minutes: 30 + timeout-minutes: 5 outputs: version: ${{ steps.version.outputs.version }} steps: - uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1 - - uses: actions/setup-node@949feb2413d6458794dcd2491c4babbbce0c15c1 # v7.1.0 - with: - node-version: 22 - cache: npm - - name: The tag is the version in package.json - id: version + - id: version run: | version=$(node -p "require('./package.json').version") if [ "v$version" != "$GITHUB_REF_NAME" ]; then echo "::error::tag $GITHUB_REF_NAME does not match package.json version $version"; exit 1 fi - if ! grep -q "^## $version" CHANGELOG.md; then - echo "::error::CHANGELOG.md has no section for $version"; exit 1 - fi + node scripts/release-notes.mjs "$version" > /dev/null || { echo "::error::CHANGELOG.md has no section for $version"; exit 1; } echo "version=$version" >> "$GITHUB_OUTPUT" - - run: npm ci - - run: npm run build - - run: npm test - - run: npm run test:integration - - run: npm run package -- --out "code-notes-${{ steps.version.outputs.version }}.vsix" - - name: Release notes from the changelog - run: awk -v v="${{ steps.version.outputs.version }}" '$0 ~ "^## "v {on=1; next} on && /^## / {exit} on' CHANGELOG.md > notes.md - - uses: actions/upload-artifact@cf430e030ddbb5b0abf93d22962f4752f3646cd9 # v7.0.2 - with: - name: release - path: | - code-notes-*.vsix - notes.md - if-no-files-found: error + + ci: + name: CI + needs: version + uses: ./.github/workflows/ci.yml publish: name: Publish - needs: build + needs: [version, ci] runs-on: ubuntu-latest timeout-minutes: 15 # The secrets live in this environment; add required reviewers to it to approve each release by hand. environment: marketplace permissions: contents: write # the GitHub release + env: + VSIX: code-notes-${{ needs.version.outputs.version }}.vsix steps: - uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1 - - uses: actions/setup-node@949feb2413d6458794dcd2491c4babbbce0c15c1 # v7.1.0 - with: - node-version: 22 - cache: npm - - run: npm ci + - uses: ./.github/actions/setup - uses: actions/download-artifact@9000827ccba6bdab643e8b6fd33ac0654aef8333 # v8.0.2 with: - name: release + name: code-notes-vsix + - name: The package CI built, named for the version, and its notes from the changelog + run: | + mv code-notes.vsix "$VSIX" + node scripts/release-notes.mjs "${{ needs.version.outputs.version }}" > notes.md - name: Visual Studio Marketplace env: VSCE_PAT: ${{ secrets.VSCE_PAT }} - run: npx vsce publish --packagePath "code-notes-${{ needs.build.outputs.version }}.vsix" + run: npx vsce publish --packagePath "$VSIX" - name: Open VSX (only when its token is set) env: OVSX_PAT: ${{ secrets.OVSX_PAT }} if: ${{ env.OVSX_PAT != '' }} - run: npx --yes ovsx publish "code-notes-${{ needs.build.outputs.version }}.vsix" + run: npx --yes ovsx@1.4.0 publish "$VSIX" - name: GitHub release env: GH_TOKEN: ${{ github.token }} - run: gh release create "$GITHUB_REF_NAME" "code-notes-${{ needs.build.outputs.version }}.vsix" --title "$GITHUB_REF_NAME" --notes-file notes.md --verify-tag + run: gh release create "$GITHUB_REF_NAME" "$VSIX" --title "$GITHUB_REF_NAME" --notes-file notes.md --verify-tag diff --git a/.vscode/launch.json b/.vscode/launch.json index 1dc2c88..aa03552 100644 --- a/.vscode/launch.json +++ b/.vscode/launch.json @@ -1,7 +1,7 @@ { // Press F5: a second window (the "Extension Development Host") opens on the example workspace (examples/shop), // running Code Notes straight from this folder: nothing is installed. While it runs, the extension is rebuilt on - // every save and that window reloads itself (src/devReload.ts). + // every save and that window reloads itself (src/platform/devReload.ts). "version": "0.2.0", "configurations": [ { diff --git a/.vscode/tasks.json b/.vscode/tasks.json index dcb8154..50be1cb 100644 --- a/.vscode/tasks.json +++ b/.vscode/tasks.json @@ -4,7 +4,7 @@ { "label": "code-notes: watch", "type": "shell", - "command": "npm run -s vendor && npm run -s pages && npx tsc -w -p .", + "command": "npm run -s watch", "isBackground": true, "problemMatcher": "$tsc-watch", "presentation": { "reveal": "never" } diff --git a/CHANGELOG.md b/CHANGELOG.md index 97618ab..7aa7496 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -2,165 +2,35 @@ ## 0.26.0 -- **Journey podcasts (prototype).** A journey with an audio episode next to it (`.podcast.json` and its - audio, [docs/podcast-format.md](docs/podcast-format.md)) gets a ▶ on its row and a player at the bottom of the - journey panel: play and pause, back and forward 15 s, previous and next step, speed (1×, 1.25×, 1.5×), and a - timeline marked by step (hover names the step; click or drag to go there). The walk follows the voice: steps open - and animations move beat by beat, exactly as when you walk them; any seek puts the walk where it is at that time, - backwards too. Next, Previous, a step or a beat you pick moves the audio to its part. The audio goes on while the - panel is behind another tab or VS Code is in the background. Ctrl+' Space plays and pauses from anywhere, Ctrl+' ← → - skip; the status bar shows where it is. - - Seeking works in VS Code for the web and remote windows too: the panel loads the audio whole, and the walk, the - player and the status bar always show where the audio actually is (a seek that can't get there is said and - logged). One clock: the status bar shows the player's second. - - Where you were is kept per journey: another journey, ending the walk, closing the panel, a reload, or saving the - podcast file again (the same moment of the same segment) keep it, and ▶ goes on from there. - - A step the podcast skips: the walk stays on it, the audio pauses and says so, and ▶ goes on after that step. - - A beat whose code is in another file opens that file directly; a part on the map closes the walk's code tab. - - Space and K play and pause anywhere in the panel, also after clicking the animation's ‹ ›. An audio that can't - play stays paused and says why. -- **Listen: the podcast player, reworked.** Podcasts are called **Listen** now: ▶ Listen on the row, **Code Notes: - Listen to Journey**, **Listen: Play/Pause**, **Back 15 s**, **Forward 15 s**, **Previous Step**, **Next Step** - (new, Ctrl+' Shift+← →). The command ids and the `.podcast.json` format are unchanged. - - The audio lives in a new **Listen** view (Code Notes side bar): closing the journey panel, or a layout that hides - it, no longer stops the episode. The panel's player and the status bar are remotes; the status bar says - **Listening · 6:58** / **Paused · 6:58** (the glyph shows the state), its tooltip lists the actions with their - keys, and its click opens the journey's map, whose player shows where the audio is. - - ▶ starts the sound where you pressed it: no second ▶ to find in the Listen view. VS Code lets a webview play - audio only after a click or a key in that webview, so ▶ in the journey panel plays the audio in the panel (the - Listen view follows it, and takes the audio over when the panel closes, once it has been clicked too). A start - from a row, the palette or a key before any click in either player opens the panel with its ▶ focused: Space or - one click there plays it, and later starts play at once. - - The caption is the sentence being said, two lines at most and never cut (a long sentence in parts), with the - speaker's name when the voice changes. A segment may give its own sentence times (`sentences`, checked when - present); else they are estimated from the text. - - The timeline: the player's whole width, a mark per step with its number (at least 8 px to hit), the playhead - always shown, hover says the time and the step in full and goes when the pointer leaves, the part a cut-off audio - can't reach greyed. The ±15 s buttons are gone (the keys stay); a narrow panel keeps ▶ ⏮ ⏭ first. Speed is a menu - from 0.75× to 2× (< > too); mute (M) is new; both are remembered. K works by its place on the keyboard. A seek - after the end plays on; the end offers Replay, Walk it yourself and Next journey. - - The storyline is the chapter list: start times, ♪ on the step being said, "not narrated" on a skipped step, ▶ per - step (plays that step and stops), a transcript per step (current sentence marked, click to go there, found by - Ctrl+F when shut). While it plays the panel's header is one line ("Step 6 of 14 · …"), and the animation's own - sentence and the code snippet give way to the caption; the panel scrolls to a step the voice moves to. - - Rows mark journeys with a podcast ("♪ 12:47"; "♪ Listening", "♪ Paused at 3:38"), with ⏸ / Resume on the row and a - tooltip line; the journey being walked is listed once (not again under "In this file"); Open Journey… and the - panel's journey list mark podcasts too. The scene's beat shows as dots. - - Accessibility: the timeline is an ARIA slider (↑ ↓ Home End Page Up/Down) whose value text gives the time, the - total and the step; step changes are announced once; controls have names and keys. Media keys and the system's - "now playing" work (Media Session). -- **Listen: the panel, calmer.** One player: while the journey panel shows the episode the Listen view is one line - (the journey, ⏸ / ▶, the time). While it plays the panel is the one-line header and the step's animation alone, in - the same box every step (the map where there is none, names only at the intro and the recap); the chapter list - comes back on pause, as number and title (▶ on hover) with one **Transcript** switch. The header stays one line - until the episode ends. The player: plain ⏸, ticks for the steps (hover "Step 6 · title · 5:23"), a "1×" that - cycles 1×–2×, no mute button (M stays), neutral greys; the end is Replay · Walk it yourself · Next journey only. - Beside the code the panel is 360–420 px while an episode is on. A caption or transcript sentence no longer splits - at the dot inside `repo.ReadTestFile`; the animation draws no wire stub to an actor out of view. -- **Listen: the side bar, the status bar and the palette, quieter.** The Listen view is there only while a journey is - listened to (playing or paused), with no empty-state text. A Journeys row says "♪ 12:47" and nothing more (no - "Listening", no "Paused at", no step, no speaker icon); its ▶ shows unless it plays (paused, ▶ goes on), with no ⏸ or - Resume row action and no podcast line in the tooltip unless the podcast can't play (then no ▶: the tooltip says - why). Open Journey… marks a podcast with a ♪ after the title, and the journey listened to says "listening" without a - ▶. The status item shows only while the journey panel is off screen ("Listening · 6:58", a one-line tooltip), is - gone after the end, and the walk's "3/14" item steps aside meanwhile. No status-bar flashes (resume, the follow - lock, a note being written, a removed step): the output logs them. The transport commands are in the palette only - while a journey is listened to (**Listen: Pause/Play**, **Listen: Open the Map**). The panel's notice is one line, - "⚠ 3 problems · Show why", counting what the Problems view lists; a bad beat is said by the step ("Step 1: no beat 99 - (it has 5); showing the whole step") and its marks aren't reported again; "Code changed since recording: steps 2, 5, - 9". A journey panel closed while VS Code was restoring it no longer fails the extension's activation. -- **Listen: the editor while it plays.** The editor is calmer: a view is held at least 8 s (a shorter part in - another file stays in the view before; beats in the same file just move the highlight). Scroll or click in the - narrated code and it stops following until the next step; **Follow along** on the step card snaps back. While it - plays the step card is one line ("narrating · beat 2/6", ⏸, ⏮ ⏭) and its ⏮ ⏭, Ctrl+' A / D and the player's are one - transport (⏮ is always the part before; in the Intro and Recap the keys move the episode). The Intro and Recap close - the walk's code so the map has the editor; the code comes back in one group beside the panel, never on your own - unsaved or untitled file. The first play says "The walk follows the voice: code opens beside the map". A note or a - question being written pauses it (closing the panel does not: the audio is in the Listen view). The panel no longer changes width on its own: focusing it, ‹ Journeys and the row - of the journey you're in keep its width (VS Code widening a panel focused at its minimum is undone), a reload never - closes it, and the journey you're in is focused, not reopened; Ctrl+' V gives a narrow panel room for the map. A - journey edited under the podcast keeps the step (by id); a removed step shows what the podcast says at its time; - quick ⏭ ⏭ open only the last target; a beat it doesn't narrate pauses it; End Journey ends the listening (▶ says - where it goes on); Ctrl+' Space in a journey without a podcast says so instead of starting another one. Reopened, - the panel shows the beat it was at; the output logs plays, pauses and stops with why. -- **Listen: marks, highlights as the words are said.** A segment may carry `marks`: while the voice says "requires a - model", that check lights, down to the characters (`match`, its `nth`); on "right there", the line that rejects it. - The newest mark is a strong tint (whole lines: one tinted block with a bar on the left, no lines between rows), the - segment's earlier ones stay, lighter, over the beat's own line; - the next segment clears them. A mark lights 0.12 s before its word; marks with the same phrase light together; at - any time (a seek, paused too) exactly the marks said by then show. Code that moved is found within 20 lines (said - once in the output), else the whole lines light. An off-screen mark is scrolled to, never under a reader who is - looking around; a mark in another file opens it only after the view hold (8 s). The check (extension and - `journey.py podcast`) says marks that can't be used, phrases not in the text, marks out of order, and, reading the - code, a missing file, lines past its end, or a `match` not where it says (and whether it is found nearby). -- **Listen: camera moves give you time to read.** When the next mark, beat or step is out of view, a cue at the - editor's edge says where the code goes ("↓ 340", "↑ 212", "→ main.ts") 0.8 s before; the code moves only once what - was just lit has been on screen 2.5 s (`codeNotes.listen.readBeforeMove`), and the audio then waits 0.8 s with the - new mark lit (`codeNotes.listen.settleAfterMove`). A wait is not a pause: the player, the status bar, the Journeys - row and the step card stay as they are; the cue is all that shows it. No waits when the code is on screen, under the - follow lock, after your own seeks, or on the map. The walk never lags the voice: if the audio doesn't stop for a - wait (checked against the audio's own time), or you play on or scroll during one, the wait is dropped and the code - goes to what is being said now; waits then stay off for 30 s. -- **Listen: the player and the walk keep time with the audio.** The panel's player (a remote of the Listen view) - counts from when the audio said its time, not from when the message arrived, so a busy extension never puts its - caption behind the voice; a run of time reports that piled up is applied once, its newest. Captions of a long - sentence change part when its words are said (the marks' phrases are word-timed) instead of by character count. -- **Listen: a quieter editor while it plays.** The step card is its header line ("3/14 · title", and Follow along - while you read on your own) above the function the step is in; the full card comes back on pause. The newest mark - is the one colour on the code (its own theme colour, `codeNotes.markBackground`; no bar, no scrollbar ticks); the - step's lines keep a thin grey bar, and the beat's box, value hints and note bars wait for the pause. -- **Listen: the follow lock sees the reader.** A slow scroll in small steps now counts (measured from where the - extension left the code), and the step card growing or shrinking on pause and play no longer counts as the reader - scrolling. A mark brought on screen keeps column 1 in view; the code scrolls right only when the mark starts past - the right edge. -- **Listen: more checks of the podcast file.** A step the journey doesn't have is said once with its segments and times; a beat written - as a string, a reused segment id (with both times), and narration in another order than the journey's are warnings; - a podcast recorded for an older commit whose steps' code changed since gets a quiet note; a podcast file not named - after its journey says in the output why it's ignored. `journey.py podcast` stays in step. -- **Podcasts: broken files are explained.** One check of the podcast file, with errors (it can't be played) and - warnings (a part is not what the file says: a step or beat the journey doesn't have, overlapping or out-of-order - times, an end before its start or past the audio, a cut-off audio, written for another journey). Every problem is - in the Problems view on the `.podcast.json` and in the output at warning level. A podcast that can't be played - keeps a greyed ▶ on its row (the tooltip says why) and a "Podcast unavailable · Show why" line in the panel; one - with warnings says them in one short line. A file that breaks while it plays keeps the last good version playing; - the status item goes with its podcast; putting the audio file back brings the podcast back. `audio` outside the - journeys folder is refused at load. `journey.py podcast` (the code-journey skill) runs the same checks, and - `journey.py check` runs them too. Segments may carry other fields, e.g. `say`, the spoken form (ignored). - [docs/podcast-format.md](docs/podcast-format.md) ships with the extension. -- **Understanding check: a tour of the change.** Right after the questions, Claude writes a short journey of the change - (6-10 steps through the changed code and the code it depends on), each question placed after the step that shows - its answer. Check my understanding (or **Walk the tour** in the Check view) walks it in the journey panel: the - questions are rows of the storyline, Next stops at each open one and opens its thread, a pass walks on. Rows of the - Check view say their step and go there. The tour is stored in the check file (`journey`); a top-up adds steps for - the new part. The grader may point at a step; the merge request comment gets one line about the tour. A question, - and the tour's last step, may say "See also" a journey of the repository that walks the same code. -- **Faster over Remote-SSH and on big repositories.** The understanding check reads git on a worker thread: the - extension host (shared with every other extension, and over Remote-SSH with the editor) never waits for git. It - reads again only when something it shows can have changed: another `git status` (the Git view, a terminal, an agent) - no longer makes it refresh, and a burst of triggers is one refresh. A code link, Back, the next or previous step, a - link from a chat and opening a question each wait for at most one call into the window (fixed waits and repeated - context keys, decorations and lens refreshes are gone), so they slow down less with the network's latency. -- **Remote-SSH: files are read where they are.** Notes, journeys and step files are read and written with Node's fs - instead of through the window (a round trip each): opening a folder with many notes and journeys no longer takes a - round trip per file. A quick Next, Next, Next ends on the last step asked for, with its file and card. A reply, a - note or an answer sent twice with a quick double Ctrl+Enter is saved once, and shows at once ("Checking…" for an - answer). Links from a Claude Code chat are recognised on newer VS Code versions too. A code link's Back names its - step and goes away once the walk moves on. Copied link text has no hidden zero-width spaces. -- **Fixes.** The sidebar no longer logs "Failed to resolve tree node" (a reveal waits until the view holds the row, - and redraws are spaced so the window applies each). Undo of Mark All Read makes resolves and reopens unread again. - Notes queued for Claude no longer stay "Queued…" when the Claude Code CLI isn't found. A note on a file that shrank - no longer fails to place. A notes-folder setting like `notes\` or `./notes` works. Step text: a bare `file#L9` ref - links to its line, `#L` and range labels move with the code, a sentence ref is hidden only when every place it names - is on screen, a gone ref names where it was looked for, and a step link opens the journey of its own folder. The - CLI places notes exactly as the extension does, and reads a removed `-- comment` line as code, not a file header. - Commit & push sees an unsaved fix behind a `git:` diff view. The default branch is one rule everywhere: origin/HEAD - when known, else main or master, plus the compared-with branch. With reduced motion, journey scenes don't animate - at all. A question id with a quote no longer stops the Check view drawing; a status or screen named like - `constructor` no longer breaks a scene. -- **Internals:** the extension's code is split into small modules by area (`src/ask`, `check`, `notes`, `tour`, - `journeys`, `sidebar`, `write`, `webview`); the CLI's source is modules under `cli/understanding/`, bundled into - `cli/understanding.mjs`; tests are one test per behaviour, in a file per module. Behaviour is unchanged apart from - the fixes above. +### Added + +- **Listen to a journey.** A journey with an audio episode next to it (`.podcast.json`) gets ▶ Listen on its + row: the walk follows the voice step by step and beat by beat, with captions, a chapter list and a timeline marked + by step. Code highlights as the words are said (`marks`), and the editor gives you time to read before it moves + (`codeNotes.listen.readBeforeMove`, `codeNotes.listen.settleAfterMove`). The audio plays in the new **Listen** view, + so closing the journey panel doesn't stop it. Keys: Ctrl+' Space, Ctrl+' ← →, Ctrl+' Shift+← →. How it works and + the file format: [docs/podcast-format.md](docs/podcast-format.md). +- **Podcast checks.** A podcast file that can't be played, or doesn't match its journey, says why in the Problems view + and on its row; `journey.py podcast` and `journey.py check` run the same checks. +- **Understanding check: a tour of the change.** After the questions, Claude writes a short journey through the + change, each question placed after the step that shows its answer. **Walk the tour** in the Check view walks it. + +### Changed + +- **Faster over Remote-SSH and on big repositories.** Notes, journeys and step files are read with Node's fs instead + of through the window, and the understanding check reads git on a worker thread and only when something it shows + can have changed. + +### Fixed + +- The sidebar no longer logs "Failed to resolve tree node"; notes queued for Claude no longer stay "Queued…" when the + Claude Code CLI isn't found; a note on a file that shrank is placed again. +- Step text: a bare `file#L9` ref links to its line, line labels move with the code, and a step link opens the journey + of its own folder. +- A reply or an answer sent twice with a quick double Ctrl+Enter is saved once; a quick Next, Next, Next ends on the + last step asked for. +- With reduced motion, journey scenes don't animate; a question id with a quote no longer stops the Check view + drawing. ## 0.24.0 diff --git a/README.md b/README.md index 8db99de..b764800 100644 --- a/README.md +++ b/README.md @@ -67,112 +67,11 @@ the repository's copy wins. ## Understanding check -**Code Notes: Check my understanding** (or **Understanding: start** in the status bar) has Claude Code read your -branch's change and ask a few questions about it (1 for a small change, documentation or a removal, up to 5 for a big one): how a part behaves, why -it is built this way, how it fails. The first question opens as a thread on its lines; the list is the **Check** view -in the Code Notes sidebar. Answer in 1-3 sentences and press Ctrl+Enter: Claude checks the answer against the code and -replies in the thread, naming the code it means as links you can click. A miss gets a hint and a second try; a second -miss gets the explanation, which you may say back in one sentence (a right one counts as passed). Ctrl+' D goes to -the next open question. You can also answer in the Check view: the selected question has a box there (Ctrl+Enter -sends, Esc goes back to the code). - -Right after the questions, Claude writes a **tour of the change**: a short journey through the changed code and the code -it depends on, in the order things happen, with each question placed after the step that shows its answer (2-3 steps -for a few lines, documentation or a removal). The questions -can be answered while it is written (about 3 minutes). **Walk the tour** in the Check view (or Check my understanding) -opens it in the journey panel: Next walks the steps and stops at each open question, with its thread on the code. The -Check view's rows say which step a question belongs to and go straight there. Walking it is optional. - -Questions and answers are saved in `understanding/.json`. The rule, shown the same way everywhere: answer all -questions, and enough must pass (60 % by default). Then **Commit & push** in the Check view commits the file and -pushes; the first check in a repository also adds the `.gitattributes` line that folds check files in GitLab and GitHub -diffs (the button's line says so). When the grader finds a problem in the code itself, the thread offers **Suggest a fix**, **Add TODO** and **Flag for -reviewer** (flagged ones go on the merge request). When you push a branch that has no check yet, its questions are written in the background -(the status bar says "3 questions ready"; setting `codeNotes.understanding.background`). - -Everything runs on your machine. The merge request check only verifies the file: it belongs to this change, every -question is done, the recorded verdicts meet the threshold. It calls no model and needs no key. Once the check is done -it posts the questions and answers on the merge request for the reviewer (while it is in progress, only "2 of 4 done"). It is easy to cheat by editing the file; it is there to -make you look, not to police. - -- **Every change with code** gets a check; only code lines count (not comments or blank lines). Files that should - never count go in `exempt` (none by default). -- **The change grew** by more than 40 code lines since the questions: run the command again; it adds 1-2 questions - about the new part only. Merging the target branch in doesn't count. -- **Skip it:** label the merge request `skip-understanding`. Any approval by someone other than the author waives the - check (re-run the job after the approval; on GitHub the review re-runs it). -- **Settings** for a repository (a merge request is judged by its target branch's): `understanding/config.json`, e.g. - `{ "exempt": ["docs/**", "*.md", "package-lock.json"], "passRatio": 0.6, "maxDrift": 40, "skipLabel": "skip-understanding", "mrComment": true }`. - -Only the final answer to each question is kept in the file; earlier tries keep their verdict, not their text. - -**Without VS Code**, teammates use [Claude Code](https://claude.com/claude-code): `/understanding-check` asks the -questions one at a time in the chat, grades each answer with the same rules, records it in the same file and commits -it. Run `node cli/understanding.mjs init` once and commit what it prints: it puts the skill in -`.claude/skills/understanding-check/`, adds `understanding/*.json gitlab-generated linguist-generated` to -`.gitattributes` (collapsed in GitLab and GitHub diffs; `understanding/config.json` stays visible) and `understanding/` -to `.ignore` (skipped by ripgrep and VS Code's search), never twice. - -The command line, [cli/understanding.mjs](cli/understanding.mjs) (Node 18+, no dependencies): `status`, `validate`, -`grade` (local; Claude Code or `ANTHROPIC_API_KEY`), `next`, `flag`, `commit`, `init` and `ci`. Design: [docs/understanding-check.md](docs/understanding-check.md). - -### In CI - -GitLab (`.gitlab-ci.yml`). `GITLAB_TOKEN`: a project access token with `api` scope (CI/CD variable, masked), used to -read labels and approvals and to write the comment. Without it the check still runs, without the comment and the skip -label. - -```yaml -understanding: - image: node:22 - stage: .post # the last stage, so a missing check never skips lint or tests - needs: [] # but it starts at once: a failing test never skips it either - rules: - - if: $CI_PIPELINE_SOURCE == "merge_request_event" - variables: - GIT_DEPTH: "0" - allow_failure: - exit_codes: [3] # advisory mode: "passed with warnings", never blocks - script: - - curl -fsSL https://raw.githubusercontent.com/tomeyer97/code-notes/v0.24.0/cli/understanding.mjs -o /tmp/understanding.mjs - - node /tmp/understanding.mjs ci -``` - -GitHub Actions (`.github/workflows/understanding.yml`); an approving review re-runs it by itself: - -```yaml -name: Understanding check -on: - pull_request: - types: [opened, synchronize, reopened, labeled, unlabeled] - pull_request_review: - types: [submitted] -permissions: - contents: read - pull-requests: write -jobs: - understanding: - runs-on: ubuntu-latest - steps: - - uses: actions/checkout@v4 - with: - fetch-depth: 0 - - uses: actions/setup-node@v4 - with: - node-version: 22 - - run: | - curl -fsSL https://raw.githubusercontent.com/tomeyer97/code-notes/v0.24.0/cli/understanding.mjs -o /tmp/understanding.mjs - node /tmp/understanding.mjs ci - env: - GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} -``` - -**Advisory first.** Start with `"mode": "advisory"` in `understanding/config.json` for a month, then switch to -`"required"` (the default; `UNDERSTANDING_MODE` overrides the file). In advisory mode the job and the merge request -comment work as usual, but a failure doesn't block: on GitLab the job exits 3 and shows "passed with warnings" (the -`allow_failure` above); on GitHub, where a step can't allow one exit code, it adds a warning annotation and passes. - -To review the script once and keep it, commit a copy (e.g. `tools/understanding.mjs`) and run that instead. +**Code Notes: Check my understanding** has Claude Code ask a few questions about your branch's change. You answer +them next to the code, Claude grades each answer, and a short tour of the change walks you through the code that holds +the answers. The answers are saved in `understanding/.json`; a CI job on GitLab or GitHub (no model, no key) +checks that file on the merge request. How to use it, its settings and the CI recipes: +[docs/understanding-check.md](docs/understanding-check.md). ## Keys @@ -211,12 +110,26 @@ too. The extension turns on smooth editor scrolling by default, so the editor glides between a journey's steps. Set `editor.smoothScrolling` to `false` to switch that off. All other settings are under **Code Notes** in the Settings -editor. +editor, named by what they are about: + +| Prefix | About | +|---|---| +| `codeNotes.*` (no group) | notes: your name, their folder and git, how they show in the editor | +| `codeNotes.claude.*` | the Claude Code CLI that answers notes: on or off, its path, model and skills | +| `codeNotes.claudeLinks` | code links in a Claude Code chat | +| `codeNotes.journeys.*` | journeys: their folder, the code lens, author mode, the model that writes them | +| `codeNotes.listen.*` | listening to a journey: how long the code waits for you | +| `codeNotes.understanding.*` | the understanding check: the model that writes and grades it, background questions | + +The settings that choose what runs (the CLI, the models, the skills) are taken only from your user settings in a +workspace you have not trusted. ## Development ```sh npm ci +npm run build # the extension, the CLI bundle and the pages (scripts/build.mjs) +npm run lint # ESLint, and the layers of src/ and their import cycles (scripts/check-layers.mjs) npm test # unit tests, golden tests included (test/README.md) npm run test:goldens # only the golden tests; UPDATE_GOLDENS=1 rewrites them npm run test:integration # the extension in a real VS Code (needs a display, or xvfb) diff --git a/cli/understanding.mjs b/cli/understanding.mjs index a477eee..b27b187 100755 --- a/cli/understanding.mjs +++ b/cli/understanding.mjs @@ -64,7 +64,7 @@ const cliName = (repo) => { // Running git: `git`/`gitOk` (synchronous, for reading), `gitRun` (asynchronous, for commit and push: no credential // prompt, a timeout); the branch, its base, a stack's parent, a stash. The extension has its own runner for its own -// git calls (src/git.ts); what it reads through this file runs these on a worker thread (src/check/cliWorker.ts). +// git calls (src/platform/git.ts); what it reads through this file runs these on a worker thread (src/check/cliWorker.ts). export function git(repo, args, opts = {}) { return execFileSync('git', args, { cwd: repo, encoding: 'utf8', maxBuffer: 64 << 20, stdio: ['ignore', 'pipe', 'pipe'], ...opts }) @@ -1129,7 +1129,7 @@ export function stamp(check, cfg) { // ---------- anchors.mjs ---------- // Compact anchors: a question's lines found again after the code moved. The same format and rules as the -// extension's src/compact.ts (written in another language; test/compact.test.ts and test/cli check each side). +// extension's src/core/anchors/compact.ts (written in another language; test/compact.test.ts and test/cli check each side). const norm = (s) => s.replace(/\s+/g, '').replace(/['`]/g, '"').replace(/[;,]+$/, '') const blank = (s) => norm(s) === '' @@ -1170,7 +1170,7 @@ function backward(lines, e, want, floor) { } /** * Where a compact anchor's code is now (0-based `{ start, end, fresh }`), or undefined when it is gone. `hint`: where - * it was. The rules of the extension's findCompact (src/compact.ts): head and tail found in order, an exact hash + * it was. The rules of the extension's findCompact (src/core/anchors/compact.ts): head and tail found in order, an exact hash * first, then the closest length, then the context lines, then the nearest place. Both sides run the same cases * (test/fixtures/compact-cases.json). */ @@ -1600,7 +1600,7 @@ const GRADER_MAX_TOKENS = 4000 const GRADER_TIMEOUT_MS = 300_000 /** - * The `claude` to run: UNDERSTANDING_CLAUDE, else `claude` on PATH. The extension finds its own (src/claudeCli.ts: + * The `claude` to run: UNDERSTANDING_CLAUDE, else `claude` on PATH. The extension finds its own (src/platform/agent/claudeCli.ts: * the codeNotes.claude.path setting, else the newest install on PATH and the usual places) and grades with it; this one * is for `grade` in a terminal, so the two can differ when several are installed. This file has no dependencies and * reads no VS Code setting, so it doesn't share the extension's search. diff --git a/cli/understanding/anchors.mjs b/cli/understanding/anchors.mjs index a76b7be..a88bcef 100644 --- a/cli/understanding/anchors.mjs +++ b/cli/understanding/anchors.mjs @@ -1,5 +1,5 @@ // Compact anchors: a question's lines found again after the code moved. The same format and rules as the -// extension's src/compact.ts (written in another language; test/compact.test.ts and test/cli check each side). +// extension's src/core/anchors/compact.ts (written in another language; test/compact.test.ts and test/cli check each side). import { createHash } from 'node:crypto' import fs from 'node:fs' import path from 'node:path' @@ -43,7 +43,7 @@ function backward(lines, e, want, floor) { } /** * Where a compact anchor's code is now (0-based `{ start, end, fresh }`), or undefined when it is gone. `hint`: where - * it was. The rules of the extension's findCompact (src/compact.ts): head and tail found in order, an exact hash + * it was. The rules of the extension's findCompact (src/core/anchors/compact.ts): head and tail found in order, an exact hash * first, then the closest length, then the context lines, then the nearest place. Both sides run the same cases * (test/fixtures/compact-cases.json). */ diff --git a/cli/understanding/git.mjs b/cli/understanding/git.mjs index 3441dcc..ffa17e3 100644 --- a/cli/understanding/git.mjs +++ b/cli/understanding/git.mjs @@ -1,6 +1,6 @@ // Running git: `git`/`gitOk` (synchronous, for reading), `gitRun` (asynchronous, for commit and push: no credential // prompt, a timeout); the branch, its base, a stack's parent, a stash. The extension has its own runner for its own -// git calls (src/git.ts); what it reads through this file runs these on a worker thread (src/check/cliWorker.ts). +// git calls (src/platform/git.ts); what it reads through this file runs these on a worker thread (src/check/cliWorker.ts). import { execFileSync, spawn } from 'node:child_process' import { DIR } from './constants.mjs' import { isHex } from './validate.mjs' diff --git a/cli/understanding/graderBackends.mjs b/cli/understanding/graderBackends.mjs index 1160376..ae059b0 100644 --- a/cli/understanding/graderBackends.mjs +++ b/cli/understanding/graderBackends.mjs @@ -13,7 +13,7 @@ const GRADER_MAX_TOKENS = 4000 const GRADER_TIMEOUT_MS = 300_000 /** - * The `claude` to run: UNDERSTANDING_CLAUDE, else `claude` on PATH. The extension finds its own (src/claudeCli.ts: + * The `claude` to run: UNDERSTANDING_CLAUDE, else `claude` on PATH. The extension finds its own (src/platform/agent/claudeCli.ts: * the codeNotes.claude.path setting, else the newest install on PATH and the usual places) and grades with it; this one * is for `grade` in a terminal, so the two can differ when several are installed. This file has no dependencies and * reads no VS Code setting, so it doesn't share the extension's search. diff --git a/docs/journey-list.md b/docs/journey-list.md index bf979eb..e6c2645 100644 --- a/docs/journey-list.md +++ b/docs/journey-list.md @@ -46,7 +46,7 @@ the panel home at 320/600/1000 px and the sidebar; measure overflow/clipping; ca ## As built (0.24.0) -- Model: `src/journeyList.ts` (`buildList`): rows with `area`, `age`, `here`, `meta`, search hits; the panel's +- Model: `src/core/list/journeyList.ts` (`buildList`): rows with `area`, `age`, `here`, `meta`, search hits; the panel's `sections` and the sidebar's `groups` come from the same call. Search: every word must match (title, question, summary, step titles, file paths; title hits weigh most; a light stem lets "retry" find "retries"). - On the panel each row is listed once: Continue, In , Checks and New come first; the area sections hold the @@ -94,7 +94,7 @@ the panel home at 320/600/1000 px and the sidebar; measure overflow/clipping; ca replaces the journey file and a notice offers **Show changes** (a diff). No note is written and nothing is said in the reader's name. From the preview or the row it refreshes that journey; the command's picker preselects only the journey in front (the walk, the panel's), never the first in the list. -- **Lenses:** one per function. Functions come from `src/codeBlocks.ts`: the language's symbols (functions, +- **Lenses:** one per function. Functions come from `src/core/codeBlocks.ts`: the language's symbols (functions, methods, classes; never what is nested in a function, so a destructuring or a callback is part of it), else the text (indentation and braces) while a language server is still starting. A step on the comment just above a function belongs to it; a file's top-level consts share one lens. The picker lists one row per journey. diff --git a/docs/understanding-check.md b/docs/understanding-check.md index 6c73f94..eb5ebc4 100644 --- a/docs/understanding-check.md +++ b/docs/understanding-check.md @@ -9,6 +9,57 @@ Goal: about 30 % more understanding of the code that gets merged, not 100 %. It expert asking good questions about code you are about to own), not like an exam. If it is annoying, people will find a way around it, so every design choice below favours little friction. +## Using it + +**Code Notes: Check my understanding** (or **Understanding: start** in the status bar) has Claude Code read your +branch's change and ask a few questions about it (1 for a small change, documentation or a removal, up to 5 for a big one): how a part behaves, why +it is built this way, how it fails. The first question opens as a thread on its lines; the list is the **Check** view +in the Code Notes sidebar. Answer in 1-3 sentences and press Ctrl+Enter: Claude checks the answer against the code and +replies in the thread, naming the code it means as links you can click. A miss gets a hint and a second try; a second +miss gets the explanation, which you may say back in one sentence (a right one counts as passed). Ctrl+' D goes to +the next open question. You can also answer in the Check view: the selected question has a box there (Ctrl+Enter +sends, Esc goes back to the code). + +Right after the questions, Claude writes a **tour of the change**: a short journey through the changed code and the code +it depends on, in the order things happen, with each question placed after the step that shows its answer (2-3 steps +for a few lines, documentation or a removal). The questions +can be answered while it is written (about 3 minutes). **Walk the tour** in the Check view (or Check my understanding) +opens it in the journey panel: Next walks the steps and stops at each open question, with its thread on the code. The +Check view's rows say which step a question belongs to and go straight there. Walking it is optional. + +Questions and answers are saved in `understanding/.json`. The rule, shown the same way everywhere: answer all +questions, and enough must pass (60 % by default). Then **Commit & push** in the Check view commits the file and +pushes; the first check in a repository also adds the `.gitattributes` line that folds check files in GitLab and GitHub +diffs (the button's line says so). When the grader finds a problem in the code itself, the thread offers **Suggest a fix**, **Add TODO** and **Flag for +reviewer** (flagged ones go on the merge request). When you push a branch that has no check yet, its questions are written in the background +(the status bar says "3 questions ready"; setting `codeNotes.understanding.background`). + +Everything runs on your machine. The merge request check only verifies the file: it belongs to this change, every +question is done, the recorded verdicts meet the threshold. It calls no model and needs no key. Once the check is done +it posts the questions and answers on the merge request for the reviewer (while it is in progress, only "2 of 4 done"). It is easy to cheat by editing the file; it is there to +make you look, not to police. + +- **Every change with code** gets a check; only code lines count (not comments or blank lines). Files that should + never count go in `exempt` (none by default). +- **The change grew** by more than 40 code lines since the questions: run the command again; it adds 1-2 questions + about the new part only. Merging the target branch in doesn't count. +- **Skip it:** label the merge request `skip-understanding`. Any approval by someone other than the author waives the + check (re-run the job after the approval; on GitHub the review re-runs it). +- **Settings** for a repository (a merge request is judged by its target branch's): `understanding/config.json`, e.g. + `{ "exempt": ["docs/**", "*.md", "package-lock.json"], "passRatio": 0.6, "maxDrift": 40, "skipLabel": "skip-understanding", "mrComment": true }`. + +Only the final answer to each question is kept in the file; earlier tries keep their verdict, not their text. + +**Without VS Code**, teammates use [Claude Code](https://claude.com/claude-code): `/understanding-check` asks the +questions one at a time in the chat, grades each answer with the same rules, records it in the same file and commits +it. Run `node cli/understanding.mjs init` once and commit what it prints: it puts the skill in +`.claude/skills/understanding-check/`, adds `understanding/*.json gitlab-generated linguist-generated` to +`.gitattributes` (collapsed in GitLab and GitHub diffs; `understanding/config.json` stays visible) and `understanding/` +to `.ignore` (skipped by ripgrep and VS Code's search), never twice. + +The command line, [cli/understanding.mjs](../cli/understanding.mjs) (Node 18+, no dependencies): `status`, `validate`, +`grade` (local; Claude Code or `ANTHROPIC_API_KEY`), `next`, `flag`, `commit`, `init` and `ci`. + ## Principles 1. **Few, good questions.** Every change with code gets a check; the count follows its size in code lines: 1 under @@ -396,7 +447,66 @@ check (GitLab approvals API; GitHub reviews API). The feature relies on good fai comment record "waived (approved by @bob)". GitLab doesn't re-run the job on an approval: the message says to re-run it (GitHub's recipe re-runs on the review). -## CI recipes (in the README) +## In CI + +The recipes below download the CLI of the release they were written for (`v0.26.0`, this version); +test/docs.test.ts keeps that tag and the actions' pins in step with the repository. + +GitLab (`.gitlab-ci.yml`). `GITLAB_TOKEN`: a project access token with `api` scope (CI/CD variable, masked), used to +read labels and approvals and to write the comment. Without it the check still runs, without the comment and the skip +label. + +```yaml +understanding: + image: node:22 + stage: .post # the last stage, so a missing check never skips lint or tests + needs: [] # but it starts at once: a failing test never skips it either + rules: + - if: $CI_PIPELINE_SOURCE == "merge_request_event" + variables: + GIT_DEPTH: "0" + allow_failure: + exit_codes: [3] # advisory mode: "passed with warnings", never blocks + script: + - curl -fsSL https://raw.githubusercontent.com/tomeyer97/code-notes/v0.26.0/cli/understanding.mjs -o /tmp/understanding.mjs + - node /tmp/understanding.mjs ci +``` + +GitHub Actions (`.github/workflows/understanding.yml`); an approving review re-runs it by itself: + +```yaml +name: Understanding check +on: + pull_request: + types: [opened, synchronize, reopened, labeled, unlabeled] + pull_request_review: + types: [submitted] +permissions: + contents: read + pull-requests: write +jobs: + understanding: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1 + with: + fetch-depth: 0 + - uses: actions/setup-node@949feb2413d6458794dcd2491c4babbbce0c15c1 # v7.1.0 + with: + node-version: 22 + - run: | + curl -fsSL https://raw.githubusercontent.com/tomeyer97/code-notes/v0.26.0/cli/understanding.mjs -o /tmp/understanding.mjs + node /tmp/understanding.mjs ci + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} +``` + +**Advisory first.** Start with `"mode": "advisory"` in `understanding/config.json` for a month, then switch to +`"required"` (the default; `UNDERSTANDING_MODE` overrides the file). In advisory mode the job and the merge request +comment work as usual, but a failure doesn't block: on GitLab the job exits 3 and shows "passed with warnings" (the +`allow_failure` above); on GitHub, where a step can't allow one exit code, it adds a warning annotation and passes. + +To review the script once and keep it, commit a copy (e.g. `tools/understanding.mjs`) and run that instead. GitLab: a job on `merge_request_event` that runs on its own (`stage: .post`, `needs: []`) with plain `node` (no LLM CLI, no model key); `GITLAB_TOKEN` (project token, `api` scope) for labels/approvals/comment; `allow_failure: { exit_codes: [3] }`. The last stage, because GitLab skips every later stage after a failed job: in `.pre`, diff --git a/eslint.config.mjs b/eslint.config.mjs new file mode 100644 index 0000000..e5e4aa5 --- /dev/null +++ b/eslint.config.mjs @@ -0,0 +1,69 @@ +// npm run lint: ESLint over the extension (src/), the tests (test/), the CLI sources (cli/) and the build scripts +// (scripts/). The webview pages (media/) are not linted yet. The layer and cycle rule is scripts/check-layers.mjs. +import js from '@eslint/js' +import tseslint from 'typescript-eslint' + +/** Node's globals for the .mjs/.js scripts (written out: no extra dependency for them). */ +const NODE = Object.fromEntries(['process', 'console', 'Buffer', 'URL', 'URLSearchParams', 'setTimeout', 'clearTimeout', + 'setInterval', 'clearInterval', 'setImmediate', 'queueMicrotask', 'structuredClone', 'fetch', 'AbortController', + 'AbortSignal', 'TextEncoder', 'TextDecoder', 'require', 'module', 'exports', '__dirname', '__filename', 'performance', +].map((g) => [g, 'readonly'])) + +// From a remote extension host every vscode.workspace.fs call is a round trip through the window: the extension's own +// files go through platform/workspaceFs.ts (Node's fs for file: URIs) instead. +const WORKSPACE_FS = { + selector: "MemberExpression[property.name='fs']:matches([object.name='workspace'], [object.property.name='workspace'])", + message: 'Read and write files through platform/workspaceFs.ts, not vscode.workspace.fs.', +} +// The step paths (code links, value hints) read a file's lines through platform/documents.ts, not by opening it as a +// document. +const OPEN_DOCUMENT = { + selector: "MemberExpression[property.name='openTextDocument']", + message: 'Code links and value hints read lines without opening a document.', +} + +export default tseslint.config( + { ignores: ['out/**', 'node_modules/**', '.vscode-test/**', 'media/**', 'examples/**', 'skills/**', 'cli/understanding.mjs'] }, + js.configs.recommended, + ...tseslint.configs.recommended, + { + // The code carries disable comments for rules that are off below; they come back into use as the rules go on. + linterOptions: { reportUnusedDisableDirectives: 'off' }, + rules: { + // Recommended rules the code does not pass yet, off until the slice owning the code fixes it: + '@typescript-eslint/no-explicit-any': 'off', // ~56 `any` casts, mostly at the vscode API and in tests + '@typescript-eslint/no-unused-vars': 'off', // ~15 unused names in the CLI and its tests + '@typescript-eslint/no-require-imports': 'off', // the CommonJS fixtures (fake claude, fake grader) and a lazy require + '@typescript-eslint/no-unused-expressions': 'off', // one `c ? f() : g()` statement in the notes filter + 'no-useless-assignment': 'off', // 6 initial values that later code overwrites before reading + 'no-control-regex': 'off', // the answer linkifier marks kept spans with NUL characters on purpose + 'no-irregular-whitespace': 'off', // text.ts's right-to-left character range holds U+FEFF literally + 'no-regex-spaces': 'off', // one regex in a CLI test matches aligned output + }, + }, + { + files: ['**/*.ts'], + languageOptions: { parserOptions: { projectService: true, tsconfigRootDir: import.meta.dirname } }, + rules: { + // Off until the ~186 un-awaited promises are handled (each awaited, or marked `void` with a reason): the + // platform slice turns it on. + '@typescript-eslint/no-floating-promises': 'off', + }, + }, + { + files: ['src/**/*.ts'], + ignores: ['src/platform/workspaceFs.ts'], + rules: { 'no-restricted-syntax': ['error', WORKSPACE_FS] }, + }, + { + files: ['src/codeLinks/codeLinks.ts', 'src/codeLinks/valueHints.ts'], + rules: { 'no-restricted-syntax': ['error', WORKSPACE_FS, OPEN_DOCUMENT] }, + }, + { files: ['**/*.mjs', '**/*.js'], languageOptions: { globals: NODE } }, + { + // The screenshot drivers and harness pages run code in the browser (page.evaluate, diff --git a/media/journey-home.js b/media/journey-home.js index c2c4c9d..23fef1c 100644 --- a/media/journey-home.js +++ b/media/journey-home.js @@ -1,6 +1,6 @@ // The journey panel's home: every journey of the workspace, to find one and walk it (docs/journey-list.md). Search, // filter chips, sections, a preview of the selected journey (beside the list when wide, unfolded under its row when -// narrow). The extension computes the list (src/journeyList.ts) with this home's search, filter and sort; we draw it. +// narrow). The extension computes the list (src/core/list/journeyList.ts) with this home's search, filter and sort; we draw it. // Needs common.js; styles in journey-home.css. Made by journey-map.js, which draws it in place of the journey while it // is in front: // const home = JourneyHome({ app, post(m), render(), walk(key), hasJourney(), isTutorialUp() }) @@ -10,7 +10,7 @@ ;(function () { const { el, button, baseName, runKey, itemAt, rovingKeys } = window.common - /** The orders the list can be sorted in (src/journeyList.ts sorts); `best` only while searching. */ + /** The orders the list can be sorted in (src/core/list/journeyList.ts sorts); `best` only while searching. */ const SORTS = [ ['best', 'Best match'], ['area', 'By area'], @@ -82,7 +82,7 @@ /** In front (the list over the journey), or not. */ let on = false - /** The list's model (src/journeyList.ts) and the journeys as the tour message lists them (`here`: the one open). */ + /** The list's model (src/core/list/journeyList.ts) and the journeys as the tour message lists them (`here`: the one open). */ let model let list = [] /** The query and filter chip, sent to the extension, which answers with a new model. */ diff --git a/media/journey-layout.js b/media/journey-layout.js index 229b64a..b4df0f8 100644 --- a/media/journey-layout.js +++ b/media/journey-layout.js @@ -8,8 +8,8 @@ // ancestors(byId, id), titleEl(n), leafEl(n, nums), samples(edge), pathD(points), curveD(bez), verb(label) } ;(function () { const { el, overlapArea, edgesOf } = window.common - // out/src/journeyModel.js is a CommonJS module the page loads as a plain script: it fills the `exports` object the - // page declares, also named JourneyModel (src/journeys/mapPanel.ts, test/journey-map/harness.html). + // out/src/core/format/journeyModel.js is a CommonJS module the page loads as a plain script: it fills the `exports` + // object the page declares, also named JourneyModel (src/journeys/mapPanel.ts, test/journey-map/harness.html). const JourneyModel = window.JourneyModel // ---------- an arrow's label: a plain verb phrase ---------- diff --git a/package-lock.json b/package-lock.json index c1ac648..2e8e416 100644 --- a/package-lock.json +++ b/package-lock.json @@ -12,12 +12,15 @@ "elkjs": "0.10.0" }, "devDependencies": { + "@eslint/js": "10.0.1", "@types/node": "^22.0.0", "@types/vscode": "1.100.0", "@vscode/test-electron": "^3.1.0", "@vscode/vsce": "^3.9.2", + "eslint": "10.15.0", "playwright": "^1.65.0", - "typescript": "^5.6.0" + "typescript": "^5.6.0", + "typescript-eslint": "8.74.0" }, "engines": { "vscode": "^1.100.0" @@ -244,6 +247,272 @@ "node": ">=6.9.0" } }, + "node_modules/@cacheable/memory": { + "version": "2.2.0", + "resolved": "https://registry.npmjs.org/@cacheable/memory/-/memory-2.2.0.tgz", + "integrity": "sha512-CTLKqLItRCEixEAewD3/j9DB3/o96gpTPD4eJ1v+DGOlxZRZncRQkGYqqnAGCscYd6RNeXfGeiuCphsPtqyIfQ==", + "dev": true, + "license": "MIT", + "dependencies": { + "@cacheable/utils": "^2.5.0", + "@keyv/bigmap": "^1.3.1", + "hookified": "^1.15.1", + "keyv": "^5.6.0" + } + }, + "node_modules/@cacheable/utils": { + "version": "2.5.0", + "resolved": "https://registry.npmjs.org/@cacheable/utils/-/utils-2.5.0.tgz", + "integrity": "sha512-buipgOVDkkPXNR5+xBpDw7Zk2n1EvU7qBJCNUcL7rhQ//kfpOXPAvQ511Os0vpLYJ1pZnvudNytkQt2hst3wqA==", + "dev": true, + "license": "MIT", + "dependencies": { + "hashery": "^1.5.1", + "keyv": "^5.6.0" + } + }, + "node_modules/@eslint-community/eslint-utils": { + "version": "4.10.1", + "resolved": "https://registry.npmjs.org/@eslint-community/eslint-utils/-/eslint-utils-4.10.1.tgz", + "integrity": "sha512-cuadcxVFE8sDK6iWJbs8Sn0av2Nrh2QSGQhVlBW9AaAHqHwjWsZHT8LJ4hFGPh7ASBV2deFdM7H/DPjulmh8rg==", + "dev": true, + "license": "MIT", + "dependencies": { + "eslint-visitor-keys": "^3.4.3" + }, + "engines": { + "node": "^12.22.0 || ^14.17.0 || >=16.0.0" + }, + "funding": { + "url": "https://opencollective.com/eslint" + }, + "peerDependencies": { + "eslint": "^6.0.0 || ^7.0.0 || >=8.0.0" + } + }, + "node_modules/@eslint-community/eslint-utils/node_modules/eslint-visitor-keys": { + "version": "3.4.3", + "resolved": "https://registry.npmjs.org/eslint-visitor-keys/-/eslint-visitor-keys-3.4.3.tgz", + "integrity": "sha512-wpc+LXeiyiisxPlEkUzU6svyS1frIO3Mgxj1fdy7Pm8Ygzguax2N3Fa/D/ag1WqbOprdI+uY6wMUl8/a2G+iag==", + "dev": true, + "license": "Apache-2.0", + "engines": { + "node": "^12.22.0 || ^14.17.0 || >=16.0.0" + }, + "funding": { + "url": "https://opencollective.com/eslint" + } + }, + "node_modules/@eslint-community/regexpp": { + "version": "4.12.3", + "resolved": "https://registry.npmjs.org/@eslint-community/regexpp/-/regexpp-4.12.3.tgz", + "integrity": "sha512-R76UKbvsqI68DJJVTVyqFKqU98CN4+B+acxNfEA2IFarSzP0SjtKf/3+fFiXzTyv5Fj3PxLkGHe2wnVWWMxobQ==", + "dev": true, + "license": "MIT", + "engines": { + "node": "^12.0.0 || ^14.0.0 || >=16.0.0" + } + }, + "node_modules/@eslint/config-array": { + "version": "0.23.6", + "resolved": "https://registry.npmjs.org/@eslint/config-array/-/config-array-0.23.6.tgz", + "integrity": "sha512-WrTH7nioI9QPY4NZGnsywmecswJdgeq4BCM76qok9VgjTO29ZgUzUvcuJLVPYVQM4uDbaPBU0M33R9DIxI8X3w==", + "dev": true, + "license": "Apache-2.0", + "dependencies": { + "@eslint/object-schema": "^3.0.5", + "debug": "^4.3.1", + "minimatch": "^11.0.5" + }, + "engines": { + "node": "^20.19.0 || ^22.13.0 || >=24" + } + }, + "node_modules/@eslint/config-array/node_modules/minimatch": { + "version": "11.0.9", + "resolved": "https://registry.npmjs.org/minimatch/-/minimatch-11.0.9.tgz", + "integrity": "sha512-KCFkfyjqerNlSstjlhIGNXIKZGA/6O4V4RlhZ+Dsr621SPPw0mzlypE9D9ZOoPiVefHID+j7/XuMMlqfD/F60Q==", + "dev": true, + "license": "BlueOak-1.0.0", + "dependencies": { + "@isaacs/nonrecursive-glob-match": "^1.1.0", + "brace-expansion": "^5.0.12" + }, + "engines": { + "node": "20 || >=22" + }, + "funding": { + "url": "https://github.com/sponsors/isaacs" + } + }, + "node_modules/@eslint/config-helpers": { + "version": "0.7.0", + "resolved": "https://registry.npmjs.org/@eslint/config-helpers/-/config-helpers-0.7.0.tgz", + "integrity": "sha512-DObd/KKUsU+FaFv4PLxSRenpXfQWmPXXP3pPZ6/K1PCrMu2vQpMDMuQe/BqYeoLcz8ro0bVDF1RxOJgfVEdhUw==", + "dev": true, + "license": "Apache-2.0", + "dependencies": { + "@eslint/core": "^1.2.1" + }, + "engines": { + "node": "^20.19.0 || ^22.13.0 || >=24" + } + }, + "node_modules/@eslint/core": { + "version": "1.2.1", + "resolved": "https://registry.npmjs.org/@eslint/core/-/core-1.2.1.tgz", + "integrity": "sha512-MwcE1P+AZ4C6DWlpin/OmOA54mmIZ/+xZuJiQd4SyB29oAJjN30UW9wkKNptW2ctp4cEsvhlLY/CsQ1uoHDloQ==", + "dev": true, + "license": "Apache-2.0", + "dependencies": { + "@types/json-schema": "^7.0.15" + }, + "engines": { + "node": "^20.19.0 || ^22.13.0 || >=24" + } + }, + "node_modules/@eslint/js": { + "version": "10.0.1", + "resolved": "https://registry.npmjs.org/@eslint/js/-/js-10.0.1.tgz", + "integrity": "sha512-zeR9k5pd4gxjZ0abRoIaxdc7I3nDktoXZk2qOv9gCNWx3mVwEn32VRhyLaRsDiJjTs0xq/T8mfPtyuXu7GWBcA==", + "dev": true, + "license": "MIT", + "engines": { + "node": "^20.19.0 || ^22.13.0 || >=24" + }, + "funding": { + "url": "https://eslint.org/donate" + }, + "peerDependencies": { + "eslint": "^10.0.0" + }, + "peerDependenciesMeta": { + "eslint": { + "optional": true + } + } + }, + "node_modules/@eslint/object-schema": { + "version": "3.0.5", + "resolved": "https://registry.npmjs.org/@eslint/object-schema/-/object-schema-3.0.5.tgz", + "integrity": "sha512-vqTaUEgxzm+YDSdElad6PiRoX4t8VGDjCtt05zn4nU810UIx/uNEV7/lZJ6KwFThKZOzOxzXy48da+No7HZaMw==", + "dev": true, + "license": "Apache-2.0", + "engines": { + "node": "^20.19.0 || ^22.13.0 || >=24" + } + }, + "node_modules/@eslint/plugin-kit": { + "version": "0.7.3", + "resolved": "https://registry.npmjs.org/@eslint/plugin-kit/-/plugin-kit-0.7.3.tgz", + "integrity": "sha512-IkO+/KEUvwbVpiURZg+P7zF74z5Jxe0UgJxVni+RtoHQ6IZieXaO02kmadomap/q+l6bc/jdPGGqTjhuZnuz1Q==", + "dev": true, + "license": "Apache-2.0", + "dependencies": { + "@eslint/core": "^1.2.1", + "levn": "^0.4.1" + }, + "engines": { + "node": "^20.19.0 || ^22.13.0 || >=24" + } + }, + "node_modules/@humanfs/core": { + "version": "0.19.2", + "resolved": "https://registry.npmjs.org/@humanfs/core/-/core-0.19.2.tgz", + "integrity": "sha512-UhXNm+CFMWcbChXywFwkmhqjs3PRCmcSa/hfBgLIb7oQ5HNb1wS0icWsGtSAUNgefHeI+eBrA8I1fxmbHsGdvA==", + "dev": true, + "license": "Apache-2.0", + "dependencies": { + "@humanfs/types": "^0.15.0" + }, + "engines": { + "node": ">=18.18.0" + } + }, + "node_modules/@humanfs/node": { + "version": "0.16.8", + "resolved": "https://registry.npmjs.org/@humanfs/node/-/node-0.16.8.tgz", + "integrity": "sha512-gE1eQNZ3R++kTzFUpdGlpmy8kDZD/MLyHqDwqjkVQI0JMdI1D51sy1H958PNXYkM2rAac7e5/CnIKZrHtPh3BQ==", + "dev": true, + "license": "Apache-2.0", + "dependencies": { + "@humanfs/core": "^0.19.2", + "@humanfs/types": "^0.15.0", + "@humanwhocodes/retry": "^0.4.0" + }, + "engines": { + "node": ">=18.18.0" + } + }, + "node_modules/@humanfs/types": { + "version": "0.15.0", + "resolved": "https://registry.npmjs.org/@humanfs/types/-/types-0.15.0.tgz", + "integrity": "sha512-ZZ1w0aoQkwuUuC7Yf+7sdeaNfqQiiLcSRbfI08oAxqLtpXQr9AIVX7Ay7HLDuiLYAaFPu8oBYNq/QIi9URHJ3Q==", + "dev": true, + "license": "Apache-2.0", + "engines": { + "node": ">=18.18.0" + } + }, + "node_modules/@humanwhocodes/module-importer": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/@humanwhocodes/module-importer/-/module-importer-1.0.1.tgz", + "integrity": "sha512-bxveV4V8v5Yb4ncFTT3rPSgZBOpCkjfK0y4oVVVJwIuDVBRMDXrPyXRL988i5ap9m9bnyEEjWfm5WkBmtffLfA==", + "dev": true, + "license": "Apache-2.0", + "engines": { + "node": ">=12.22" + }, + "funding": { + "type": "github", + "url": "https://github.com/sponsors/nzakas" + } + }, + "node_modules/@humanwhocodes/retry": { + "version": "0.4.3", + "resolved": "https://registry.npmjs.org/@humanwhocodes/retry/-/retry-0.4.3.tgz", + "integrity": "sha512-bV0Tgo9K4hfPCek+aMAn81RppFKv2ySDQeMoSZuvTASywNTnVJCArCZE2FWqpvIatKu7VMRLWlR1EazvVhDyhQ==", + "dev": true, + "license": "Apache-2.0", + "engines": { + "node": ">=18.18" + }, + "funding": { + "type": "github", + "url": "https://github.com/sponsors/nzakas" + } + }, + "node_modules/@isaacs/nonrecursive-glob-match": { + "version": "1.1.0", + "resolved": "https://registry.npmjs.org/@isaacs/nonrecursive-glob-match/-/nonrecursive-glob-match-1.1.0.tgz", + "integrity": "sha512-GPm/Dbvk5RLmhRnxXIa7nTpK0xtl4E0wj0MslsuNiJ1FIROU+2+9lgUC/dgF7Ey4QCWhfEsgxilMRMCdHPfDfw==", + "dev": true, + "license": "BlueOak-1.0.0" + }, + "node_modules/@keyv/bigmap": { + "version": "1.3.1", + "resolved": "https://registry.npmjs.org/@keyv/bigmap/-/bigmap-1.3.1.tgz", + "integrity": "sha512-WbzE9sdmQtKy8vrNPa9BRnwZh5UF4s1KTmSK0KUVLo3eff5BlQNNWDnFOouNpKfPKDnms9xynJjsMYjMaT/aFQ==", + "dev": true, + "license": "MIT", + "dependencies": { + "hashery": "^1.4.0", + "hookified": "^1.15.0" + }, + "engines": { + "node": ">= 18" + }, + "peerDependencies": { + "keyv": "^5.6.0" + } + }, + "node_modules/@keyv/serialize": { + "version": "1.1.1", + "resolved": "https://registry.npmjs.org/@keyv/serialize/-/serialize-1.1.1.tgz", + "integrity": "sha512-dXn3FZhPv0US+7dtJsIi2R+c7qWYiReoEh5zUntWCf4oSpMNib8FDhSoed6m3QyZdx5hK7iLFkYk3rNxwt8vTA==", + "dev": true, + "license": "MIT" + }, "node_modules/@nodelib/fs.scandir": { "version": "2.1.5", "resolved": "https://registry.npmjs.org/@nodelib/fs.scandir/-/fs.scandir-2.1.5.tgz", @@ -555,6 +824,27 @@ "@textlint/ast-node-types": "15.8.0" } }, + "node_modules/@types/esrecurse": { + "version": "4.3.1", + "resolved": "https://registry.npmjs.org/@types/esrecurse/-/esrecurse-4.3.1.tgz", + "integrity": "sha512-xJBAbDifo5hpffDBuHl0Y8ywswbiAp/Wi7Y/GtAgSlZyIABppyurxVueOPE8LUQOxdlgi6Zqce7uoEpqNTeiUw==", + "dev": true, + "license": "MIT" + }, + "node_modules/@types/estree": { + "version": "1.0.10", + "resolved": "https://registry.npmjs.org/@types/estree/-/estree-1.0.10.tgz", + "integrity": "sha512-lTyOMnOcmRBzdCv6/4zUZCrEhV0xrqQiUZBZtVcbmLHBXKLnN8q89v/wKRF/Q0HbwVsqbIG3o5HDoFl9sduM+g==", + "dev": true, + "license": "MIT" + }, + "node_modules/@types/json-schema": { + "version": "7.0.15", + "resolved": "https://registry.npmjs.org/@types/json-schema/-/json-schema-7.0.15.tgz", + "integrity": "sha512-5+fP8P8MFNC+AyZCDxrB2pkZFPGzqQWUzpSeuuVLvm8VMcorNYavBqoFcxK8bQz4Qsbn4oUEEem4wDLfcysGHA==", + "dev": true, + "license": "MIT" + }, "node_modules/@types/node": { "version": "22.20.5", "resolved": "https://registry.npmjs.org/@types/node/-/node-22.20.5.tgz", @@ -586,6 +876,249 @@ "dev": true, "license": "MIT" }, + "node_modules/@typescript-eslint/eslint-plugin": { + "version": "8.74.0", + "resolved": "https://registry.npmjs.org/@typescript-eslint/eslint-plugin/-/eslint-plugin-8.74.0.tgz", + "integrity": "sha512-z3KXk1+Vm+d82ZRplOoC89ho4Rf1da5ju6sx8//92GnN532U62DGPjECXkkVqtYzIv0zoJlpO39SX2Z9tk6LVw==", + "dev": true, + "license": "MIT", + "dependencies": { + "@eslint-community/regexpp": "^4.12.2", + "@typescript-eslint/scope-manager": "8.74.0", + "@typescript-eslint/type-utils": "8.74.0", + "@typescript-eslint/utils": "8.74.0", + "@typescript-eslint/visitor-keys": "8.74.0", + "ignore": "^7.0.5", + "natural-compare": "^1.4.0", + "ts-api-utils": "^2.5.0" + }, + "engines": { + "node": "^18.18.0 || ^20.9.0 || >=21.1.0" + }, + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/typescript-eslint" + }, + "peerDependencies": { + "@typescript-eslint/parser": "^8.74.0", + "eslint": "^8.57.0 || ^9.0.0 || ^10.0.0", + "typescript": ">=4.8.4 <6.1.0" + } + }, + "node_modules/@typescript-eslint/parser": { + "version": "8.74.0", + "resolved": "https://registry.npmjs.org/@typescript-eslint/parser/-/parser-8.74.0.tgz", + "integrity": "sha512-ecr8AYdig7avVkxaHdQvxHnIJ/mOyliO4Gv/uWF8q69vBew/z3sexqBwHUZX5Vql+Ns0w4sH6gBLkICGbOvJkA==", + "dev": true, + "license": "MIT", + "dependencies": { + "@typescript-eslint/scope-manager": "8.74.0", + "@typescript-eslint/types": "8.74.0", + "@typescript-eslint/typescript-estree": "8.74.0", + "@typescript-eslint/visitor-keys": "8.74.0", + "debug": "^4.4.3" + }, + "engines": { + "node": "^18.18.0 || ^20.9.0 || >=21.1.0" + }, + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/typescript-eslint" + }, + "peerDependencies": { + "eslint": "^8.57.0 || ^9.0.0 || ^10.0.0", + "typescript": ">=4.8.4 <6.1.0" + } + }, + "node_modules/@typescript-eslint/project-service": { + "version": "8.74.0", + "resolved": "https://registry.npmjs.org/@typescript-eslint/project-service/-/project-service-8.74.0.tgz", + "integrity": "sha512-z/mymuE+JlEeSFIv3Mo70EvgG1Zz74Hl0IDfExfXutARAP834bt+MppTD7mVAwmZO0GdxdOAi0jbTam749eH6g==", + "dev": true, + "license": "MIT", + "dependencies": { + "@typescript-eslint/tsconfig-utils": "^8.74.0", + "@typescript-eslint/types": "^8.74.0", + "debug": "^4.4.3" + }, + "engines": { + "node": "^18.18.0 || ^20.9.0 || >=21.1.0" + }, + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/typescript-eslint" + }, + "peerDependencies": { + "typescript": ">=4.8.4 <6.1.0" + } + }, + "node_modules/@typescript-eslint/scope-manager": { + "version": "8.74.0", + "resolved": "https://registry.npmjs.org/@typescript-eslint/scope-manager/-/scope-manager-8.74.0.tgz", + "integrity": "sha512-kpOdpu4CpWN5U38ox3f727DwWRBtUAVhyUJtqTBYe5gf2wYoxac7PgKP14txrxN7ICVtcjlLdzjqfRgpSnDKvQ==", + "dev": true, + "license": "MIT", + "dependencies": { + "@typescript-eslint/types": "8.74.0", + "@typescript-eslint/visitor-keys": "8.74.0" + }, + "engines": { + "node": "^18.18.0 || ^20.9.0 || >=21.1.0" + }, + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/typescript-eslint" + } + }, + "node_modules/@typescript-eslint/tsconfig-utils": { + "version": "8.74.0", + "resolved": "https://registry.npmjs.org/@typescript-eslint/tsconfig-utils/-/tsconfig-utils-8.74.0.tgz", + "integrity": "sha512-p07wAuaS6BjCYgOSXKJi4YhvTnAf7fiG37e9THcpnYaQEt2QiTTYZWKwUFNgeRiywiMudazhzgddAirZ0GgHtQ==", + "dev": true, + "license": "MIT", + "engines": { + "node": "^18.18.0 || ^20.9.0 || >=21.1.0" + }, + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/typescript-eslint" + }, + "peerDependencies": { + "typescript": ">=4.8.4 <6.1.0" + } + }, + "node_modules/@typescript-eslint/type-utils": { + "version": "8.74.0", + "resolved": "https://registry.npmjs.org/@typescript-eslint/type-utils/-/type-utils-8.74.0.tgz", + "integrity": "sha512-CV3Y3la8l3F9ANfxcfpgSSiQgJTe4IeLEoZV4O/gcW86Ugp8X6SKiQ0vm+QegXaRIbbDMokZZSF3A1CgiU/kPw==", + "dev": true, + "license": "MIT", + "dependencies": { + "@typescript-eslint/types": "8.74.0", + "@typescript-eslint/typescript-estree": "8.74.0", + "@typescript-eslint/utils": "8.74.0", + "debug": "^4.4.3", + "ts-api-utils": "^2.5.0" + }, + "engines": { + "node": "^18.18.0 || ^20.9.0 || >=21.1.0" + }, + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/typescript-eslint" + }, + "peerDependencies": { + "eslint": "^8.57.0 || ^9.0.0 || ^10.0.0", + "typescript": ">=4.8.4 <6.1.0" + } + }, + "node_modules/@typescript-eslint/types": { + "version": "8.74.0", + "resolved": "https://registry.npmjs.org/@typescript-eslint/types/-/types-8.74.0.tgz", + "integrity": "sha512-MpnMrJCVNpP1iVL8NiHkQZgQqIMBH5ewDGUPBh1pqQXwFtMFjsl1M03QcYPXmv6stCKEiF0PN7CGbU1ZbXFzEA==", + "dev": true, + "license": "MIT", + "engines": { + "node": "^18.18.0 || ^20.9.0 || >=21.1.0" + }, + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/typescript-eslint" + } + }, + "node_modules/@typescript-eslint/typescript-estree": { + "version": "8.74.0", + "resolved": "https://registry.npmjs.org/@typescript-eslint/typescript-estree/-/typescript-estree-8.74.0.tgz", + "integrity": "sha512-wL348k6l92DNG+kPP5rVpKwNBoz7a3xRZy3TPKc1uymQttd7u7gcMv3eENmcuh4CjC4mO3FTM0DYstFXMyDLuw==", + "dev": true, + "license": "MIT", + "dependencies": { + "@typescript-eslint/project-service": "8.74.0", + "@typescript-eslint/tsconfig-utils": "8.74.0", + "@typescript-eslint/types": "8.74.0", + "@typescript-eslint/visitor-keys": "8.74.0", + "debug": "^4.4.3", + "minimatch": "^11.0.1", + "semver": "^7.7.3", + "tinyglobby": "^0.2.15", + "ts-api-utils": "^2.5.0" + }, + "engines": { + "node": "^18.18.0 || ^20.9.0 || >=21.1.0" + }, + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/typescript-eslint" + }, + "peerDependencies": { + "@typescript/native": "npm:typescript@>=7.1.0-dev.20261009.1 || >=7.1.0-beta <7.1.0-dev", + "typescript": ">=4.8.4 <6.1.0" + }, + "peerDependenciesMeta": { + "@typescript/native": { + "optional": true + } + } + }, + "node_modules/@typescript-eslint/typescript-estree/node_modules/minimatch": { + "version": "11.0.9", + "resolved": "https://registry.npmjs.org/minimatch/-/minimatch-11.0.9.tgz", + "integrity": "sha512-KCFkfyjqerNlSstjlhIGNXIKZGA/6O4V4RlhZ+Dsr621SPPw0mzlypE9D9ZOoPiVefHID+j7/XuMMlqfD/F60Q==", + "dev": true, + "license": "BlueOak-1.0.0", + "dependencies": { + "@isaacs/nonrecursive-glob-match": "^1.1.0", + "brace-expansion": "^5.0.12" + }, + "engines": { + "node": "20 || >=22" + }, + "funding": { + "url": "https://github.com/sponsors/isaacs" + } + }, + "node_modules/@typescript-eslint/utils": { + "version": "8.74.0", + "resolved": "https://registry.npmjs.org/@typescript-eslint/utils/-/utils-8.74.0.tgz", + "integrity": "sha512-IpWXPxXXomzxyTcvjhZJexgdvtTR1TooLAPpuxzaGqQ8BHll1lf4Ysp/BTE/l0U5TJ+x1j7B4bEM8pLRrvY+XA==", + "dev": true, + "license": "MIT", + "dependencies": { + "@eslint-community/eslint-utils": "^4.9.1", + "@typescript-eslint/scope-manager": "8.74.0", + "@typescript-eslint/types": "8.74.0", + "@typescript-eslint/typescript-estree": "8.74.0" + }, + "engines": { + "node": "^18.18.0 || ^20.9.0 || >=21.1.0" + }, + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/typescript-eslint" + }, + "peerDependencies": { + "eslint": "^8.57.0 || ^9.0.0 || ^10.0.0", + "typescript": ">=4.8.4 <6.1.0" + } + }, + "node_modules/@typescript-eslint/visitor-keys": { + "version": "8.74.0", + "resolved": "https://registry.npmjs.org/@typescript-eslint/visitor-keys/-/visitor-keys-8.74.0.tgz", + "integrity": "sha512-XSZmOtMUbWCBIM+2BK134FyMFxmll1mW2mPLk/PSwYQYzGIPMgJAqL929U4qXVizLv7Xq5b7r41/o7Ombuwk0g==", + "dev": true, + "license": "MIT", + "dependencies": { + "@typescript-eslint/types": "8.74.0", + "eslint-visitor-keys": "^5.0.0" + }, + "engines": { + "node": "^18.18.0 || ^20.9.0 || >=21.1.0" + }, + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/typescript-eslint" + } + }, "node_modules/@typespec/ts-http-runtime": { "version": "0.3.10", "resolved": "https://registry.npmjs.org/@typespec/ts-http-runtime/-/ts-http-runtime-0.3.10.tgz", @@ -848,6 +1381,29 @@ "win32" ] }, + "node_modules/acorn": { + "version": "8.19.0", + "resolved": "https://registry.npmjs.org/acorn/-/acorn-8.19.0.tgz", + "integrity": "sha512-oJlA3XiRm7Cyk6qFD2Jn8ak9B7jSy0qy00ADO3+8dpT0LSjFihQYv4C02LFCSYJV3Q37xYwwRy5m+IpIiUzqWw==", + "dev": true, + "license": "MIT", + "bin": { + "acorn": "bin/acorn" + }, + "engines": { + "node": ">=0.4.0" + } + }, + "node_modules/acorn-jsx": { + "version": "5.3.2", + "resolved": "https://registry.npmjs.org/acorn-jsx/-/acorn-jsx-5.3.2.tgz", + "integrity": "sha512-rq9s+JNhf0IChjtDXxllJ7g41oZk5SlXtp0LHwyA5cejwn7vKmKp4pPri6YEePv2PU65sAsegbXtIinmDFDXgQ==", + "dev": true, + "license": "MIT", + "peerDependencies": { + "acorn": "^6.0.0 || ^7.0.0 || ^8.0.0" + } + }, "node_modules/agent-base": { "version": "9.0.0", "resolved": "https://registry.npmjs.org/agent-base/-/agent-base-9.0.0.tgz", @@ -1115,6 +1671,20 @@ "url": "https://github.com/sponsors/sindresorhus" } }, + "node_modules/cacheable": { + "version": "2.5.0", + "resolved": "https://registry.npmjs.org/cacheable/-/cacheable-2.5.0.tgz", + "integrity": "sha512-60cyAOytib/OzBw1JNSoSV/boK1AtHryDIjvVBk7XbN4ugfkM3+Sry7fEjNgPMGgOjuaZPAp8ruZ0Cxafwyq9g==", + "dev": true, + "license": "MIT", + "dependencies": { + "@cacheable/memory": "^2.2.0", + "@cacheable/utils": "^2.5.0", + "hookified": "^1.15.0", + "keyv": "^5.6.0", + "qified": "^0.10.1" + } + }, "node_modules/call-bind-apply-helpers": { "version": "1.0.2", "resolved": "https://registry.npmjs.org/call-bind-apply-helpers/-/call-bind-apply-helpers-1.0.2.tgz", @@ -1304,6 +1874,21 @@ "dev": true, "license": "MIT" }, + "node_modules/cross-spawn": { + "version": "7.0.6", + "resolved": "https://registry.npmjs.org/cross-spawn/-/cross-spawn-7.0.6.tgz", + "integrity": "sha512-uV2QOWP2nWzsy2aMp8aRibhi9dlzF5Hgh5SHaB9OiTGEyDTiJJyx0uy51QXdyWbtAHNua4XJzUKca3OzKUd3vA==", + "dev": true, + "license": "MIT", + "dependencies": { + "path-key": "^3.1.0", + "shebang-command": "^2.0.0", + "which": "^2.0.1" + }, + "engines": { + "node": ">= 8" + } + }, "node_modules/css-select": { "version": "5.2.2", "resolved": "https://registry.npmjs.org/css-select/-/css-select-5.2.2.tgz", @@ -1380,6 +1965,13 @@ "node": ">=4.0.0" } }, + "node_modules/deep-is": { + "version": "0.1.4", + "resolved": "https://registry.npmjs.org/deep-is/-/deep-is-0.1.4.tgz", + "integrity": "sha512-oIPzksmTg4/MriiaYGO+okXDT7ztn/w3Eptv/+gSIdMdKsJo0u4CfYNFJPy+4SKMuCqGw2wxnA+URMg3t8a/bQ==", + "dev": true, + "license": "MIT" + }, "node_modules/default-browser": { "version": "5.5.1", "resolved": "https://registry.npmjs.org/default-browser/-/default-browser-5.5.1.tgz", @@ -1658,6 +2250,238 @@ "node": ">= 0.4" } }, + "node_modules/escape-string-regexp": { + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/escape-string-regexp/-/escape-string-regexp-4.0.0.tgz", + "integrity": "sha512-TtpcNJ3XAzx3Gq8sWRzJaVajRs0uVxA2YAkdb1jm2YkPz4G6egUFAyA3n5vtEIZefPk5Wa4UXbKuS5fKkJWdgA==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">=10" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, + "node_modules/eslint": { + "version": "10.15.0", + "resolved": "https://registry.npmjs.org/eslint/-/eslint-10.15.0.tgz", + "integrity": "sha512-+5Wg4p+ze3sG1WErYgUO/3H1IQIfFBymVUA0Fo/XTeBOLS6UQIUekpSJ8sdRkn7O7wjh84b55w/roqavH2aScg==", + "dev": true, + "license": "MIT", + "workspaces": [ + "packages/*" + ], + "dependencies": { + "@eslint-community/eslint-utils": "^4.8.0", + "@eslint-community/regexpp": "^4.12.2", + "@eslint/config-array": "^0.23.6", + "@eslint/config-helpers": "^0.7.0", + "@eslint/core": "^1.2.1", + "@eslint/plugin-kit": "^0.7.3", + "@humanfs/node": "^0.16.8", + "@humanwhocodes/module-importer": "^1.0.1", + "@humanwhocodes/retry": "^0.4.2", + "@types/estree": "^1.0.6", + "ajv": "^6.14.0", + "cross-spawn": "^7.0.6", + "debug": "^4.3.2", + "escape-string-regexp": "^4.0.0", + "eslint-scope": "^9.1.2", + "eslint-visitor-keys": "^5.0.1", + "espree": "^11.2.0", + "esquery": "^1.7.0", + "esutils": "^2.0.2", + "fast-deep-equal": "^3.1.3", + "file-entry-cache": "11.1.5 || >11.1.6 <12", + "find-up": "^5.0.0", + "glob-parent": "^6.0.2", + "ignore": "^5.2.0", + "imurmurhash": "^0.1.4", + "is-glob": "^4.0.0", + "json-stable-stringify-without-jsonify": "^1.0.1", + "minimatch": "^11.0.5", + "natural-compare": "^1.4.0", + "optionator": "^0.9.3" + }, + "bin": { + "eslint": "bin/eslint.js" + }, + "engines": { + "node": "^20.19.0 || ^22.13.0 || >=24" + }, + "funding": { + "url": "https://eslint.org/donate" + }, + "peerDependencies": { + "jiti": "*" + }, + "peerDependenciesMeta": { + "jiti": { + "optional": true + } + } + }, + "node_modules/eslint-scope": { + "version": "9.1.2", + "resolved": "https://registry.npmjs.org/eslint-scope/-/eslint-scope-9.1.2.tgz", + "integrity": "sha512-xS90H51cKw0jltxmvmHy2Iai1LIqrfbw57b79w/J7MfvDfkIkFZ+kj6zC3BjtUwh150HsSSdxXZcsuv72miDFQ==", + "dev": true, + "license": "BSD-2-Clause", + "dependencies": { + "@types/esrecurse": "^4.3.1", + "@types/estree": "^1.0.8", + "esrecurse": "^4.3.0", + "estraverse": "^5.2.0" + }, + "engines": { + "node": "^20.19.0 || ^22.13.0 || >=24" + }, + "funding": { + "url": "https://opencollective.com/eslint" + } + }, + "node_modules/eslint-visitor-keys": { + "version": "5.0.1", + "resolved": "https://registry.npmjs.org/eslint-visitor-keys/-/eslint-visitor-keys-5.0.1.tgz", + "integrity": "sha512-tD40eHxA35h0PEIZNeIjkHoDR4YjjJp34biM0mDvplBe//mB+IHCqHDGV7pxF+7MklTvighcCPPZC7ynWyjdTA==", + "dev": true, + "license": "Apache-2.0", + "engines": { + "node": "^20.19.0 || ^22.13.0 || >=24" + }, + "funding": { + "url": "https://opencollective.com/eslint" + } + }, + "node_modules/eslint/node_modules/ajv": { + "version": "6.15.0", + "resolved": "https://registry.npmjs.org/ajv/-/ajv-6.15.0.tgz", + "integrity": "sha512-fgFx7Hfoq60ytK2c7DhnF8jIvzYgOMxfugjLOSMHjLIPgenqa7S7oaagATUq99mV6IYvN2tRmC0wnTYX6iPbMw==", + "dev": true, + "license": "MIT", + "dependencies": { + "fast-deep-equal": "^3.1.1", + "fast-json-stable-stringify": "^2.0.0", + "json-schema-traverse": "^0.4.1", + "uri-js": "^4.2.2" + }, + "funding": { + "type": "github", + "url": "https://github.com/sponsors/epoberezkin" + } + }, + "node_modules/eslint/node_modules/glob-parent": { + "version": "6.0.2", + "resolved": "https://registry.npmjs.org/glob-parent/-/glob-parent-6.0.2.tgz", + "integrity": "sha512-XxwI8EOhVQgWp6iDL+3b0r86f4d6AX6zSU55HfB4ydCEuXLXc5FcYeOu+nnGftS4TEju/11rt4KJPTMgbfmv4A==", + "dev": true, + "license": "ISC", + "dependencies": { + "is-glob": "^4.0.3" + }, + "engines": { + "node": ">=10.13.0" + } + }, + "node_modules/eslint/node_modules/ignore": { + "version": "5.3.2", + "resolved": "https://registry.npmjs.org/ignore/-/ignore-5.3.2.tgz", + "integrity": "sha512-hsBTNUqQTDwkWtcdYI2i06Y/nUBEsNEDJKjWdigLvegy8kDuJAS8uRlpkkcQpyEXL0Z/pjDy5HBmMjRCJ2gq+g==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">= 4" + } + }, + "node_modules/eslint/node_modules/json-schema-traverse": { + "version": "0.4.1", + "resolved": "https://registry.npmjs.org/json-schema-traverse/-/json-schema-traverse-0.4.1.tgz", + "integrity": "sha512-xbbCH5dCYU5T8LcEhhuh7HJ88HXuW3qsI3Y0zOZFKfZEHcpWiHU/Jxzk629Brsab/mMiHQti9wMP+845RPe3Vg==", + "dev": true, + "license": "MIT" + }, + "node_modules/eslint/node_modules/minimatch": { + "version": "11.0.9", + "resolved": "https://registry.npmjs.org/minimatch/-/minimatch-11.0.9.tgz", + "integrity": "sha512-KCFkfyjqerNlSstjlhIGNXIKZGA/6O4V4RlhZ+Dsr621SPPw0mzlypE9D9ZOoPiVefHID+j7/XuMMlqfD/F60Q==", + "dev": true, + "license": "BlueOak-1.0.0", + "dependencies": { + "@isaacs/nonrecursive-glob-match": "^1.1.0", + "brace-expansion": "^5.0.12" + }, + "engines": { + "node": "20 || >=22" + }, + "funding": { + "url": "https://github.com/sponsors/isaacs" + } + }, + "node_modules/espree": { + "version": "11.2.0", + "resolved": "https://registry.npmjs.org/espree/-/espree-11.2.0.tgz", + "integrity": "sha512-7p3DrVEIopW1B1avAGLuCSh1jubc01H2JHc8B4qqGblmg5gI9yumBgACjWo4JlIc04ufug4xJ3SQI8HkS/Rgzw==", + "dev": true, + "license": "BSD-2-Clause", + "dependencies": { + "acorn": "^8.16.0", + "acorn-jsx": "^5.3.2", + "eslint-visitor-keys": "^5.0.1" + }, + "engines": { + "node": "^20.19.0 || ^22.13.0 || >=24" + }, + "funding": { + "url": "https://opencollective.com/eslint" + } + }, + "node_modules/esquery": { + "version": "1.7.0", + "resolved": "https://registry.npmjs.org/esquery/-/esquery-1.7.0.tgz", + "integrity": "sha512-Ap6G0WQwcU/LHsvLwON1fAQX9Zp0A2Y6Y/cJBl9r/JbW90Zyg4/zbG6zzKa2OTALELarYHmKu0GhpM5EO+7T0g==", + "dev": true, + "license": "BSD-3-Clause", + "dependencies": { + "estraverse": "^5.1.0" + }, + "engines": { + "node": ">=0.10" + } + }, + "node_modules/esrecurse": { + "version": "4.3.0", + "resolved": "https://registry.npmjs.org/esrecurse/-/esrecurse-4.3.0.tgz", + "integrity": "sha512-KmfKL3b6G+RXvP8N1vr3Tq1kL/oCFgn2NYXEtqP8/L3pKapUA4G8cFVaoF3SU323CD4XypR/ffioHmkti6/Tag==", + "dev": true, + "license": "BSD-2-Clause", + "dependencies": { + "estraverse": "^5.2.0" + }, + "engines": { + "node": ">=4.0" + } + }, + "node_modules/estraverse": { + "version": "5.3.0", + "resolved": "https://registry.npmjs.org/estraverse/-/estraverse-5.3.0.tgz", + "integrity": "sha512-MMdARuVEQziNTeJD8DgMqmhwR11BRQ/cBP+pLtYdSTnf3MIO8fFeiINEbX36ZdNlfU/7A9f3gUw49B3oQsvwBA==", + "dev": true, + "license": "BSD-2-Clause", + "engines": { + "node": ">=4.0" + } + }, + "node_modules/esutils": { + "version": "2.0.3", + "resolved": "https://registry.npmjs.org/esutils/-/esutils-2.0.3.tgz", + "integrity": "sha512-kVscqXk4OCp68SZ0dkgEKVi6/8ij300KBWTJq32P/dYeWTSwK41WyTxalN1eRmA5Z9UU/LX9D7FWSmV9SAYx6g==", + "dev": true, + "license": "BSD-2-Clause", + "engines": { + "node": ">=0.10.0" + } + }, "node_modules/expand-template": { "version": "2.0.3", "resolved": "https://registry.npmjs.org/expand-template/-/expand-template-2.0.3.tgz", @@ -1693,6 +2517,20 @@ "node": ">=8.6.0" } }, + "node_modules/fast-json-stable-stringify": { + "version": "2.1.0", + "resolved": "https://registry.npmjs.org/fast-json-stable-stringify/-/fast-json-stable-stringify-2.1.0.tgz", + "integrity": "sha512-lhd/wF+Lk98HZoTCtlVraHtfh5XYijIjalXck7saUtuanSDyLMxnHhSXEDJqHxD7msR8D0uCmqlkwjCV8xvwHw==", + "dev": true, + "license": "MIT" + }, + "node_modules/fast-levenshtein": { + "version": "2.0.6", + "resolved": "https://registry.npmjs.org/fast-levenshtein/-/fast-levenshtein-2.0.6.tgz", + "integrity": "sha512-DCXu6Ifhqcks7TZKY3Hxp3y6qphY5SJZmrWMDrKcERSOXWQdMhU9Ig/PYrzyw/ul9jOIyh0N4M0tbC5hodg8dw==", + "dev": true, + "license": "MIT" + }, "node_modules/fast-uri": { "version": "3.1.9", "resolved": "https://registry.npmjs.org/fast-uri/-/fast-uri-3.1.9.tgz", @@ -1720,6 +2558,16 @@ "reusify": "^1.0.4" } }, + "node_modules/file-entry-cache": { + "version": "11.1.5", + "resolved": "https://registry.npmjs.org/file-entry-cache/-/file-entry-cache-11.1.5.tgz", + "integrity": "sha512-+PFTHITI08JIGhnNpGNI8T8inUpgZfk3GNEqfT9R2zZV2iFXg3CvqzSl/uEhs7TSGujYRELEANyDvS8Fj7+S7Q==", + "dev": true, + "license": "MIT", + "dependencies": { + "flat-cache": "^6.1.23" + } + }, "node_modules/fill-range": { "version": "7.1.1", "resolved": "https://registry.npmjs.org/fill-range/-/fill-range-7.1.1.tgz", @@ -1733,6 +2581,42 @@ "node": ">=8" } }, + "node_modules/find-up": { + "version": "5.0.0", + "resolved": "https://registry.npmjs.org/find-up/-/find-up-5.0.0.tgz", + "integrity": "sha512-78/PXT1wlLLDgTzDs7sjq9hzz0vXD+zn+7wypEe4fXQxCmdmqfGsEPQxmiCSQI3ajFV91bVSsvNtrJRiW6nGng==", + "dev": true, + "license": "MIT", + "dependencies": { + "locate-path": "^6.0.0", + "path-exists": "^4.0.0" + }, + "engines": { + "node": ">=10" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, + "node_modules/flat-cache": { + "version": "6.1.23", + "resolved": "https://registry.npmjs.org/flat-cache/-/flat-cache-6.1.23.tgz", + "integrity": "sha512-f++BY9pTk+983xK1FLzlLpmM0i0z+jHmx3QESGkURMXujQZz1k5wzwX6hjnQ8goaD0B+sYnDK1yZ6MTyZfUaqA==", + "dev": true, + "license": "MIT", + "dependencies": { + "cacheable": "^2.5.0", + "flatted": "^3.4.2", + "hookified": "^1.15.0" + } + }, + "node_modules/flatted": { + "version": "3.4.4", + "resolved": "https://registry.npmjs.org/flatted/-/flatted-3.4.4.tgz", + "integrity": "sha512-5+ybhBZANEJxaH3X5evAFatUxLfEHSr7n6kYJ+1Qd0mUqr4eu9gIf6GDbWHf8RJijHrjjO8G+la14SlL2SeS1Q==", + "dev": true, + "license": "ISC" + }, "node_modules/form-data": { "version": "4.0.6", "resolved": "https://registry.npmjs.org/form-data/-/form-data-4.0.6.tgz", @@ -1954,6 +2838,19 @@ "url": "https://github.com/sponsors/ljharb" } }, + "node_modules/hashery": { + "version": "1.5.1", + "resolved": "https://registry.npmjs.org/hashery/-/hashery-1.5.1.tgz", + "integrity": "sha512-iZyKG96/JwPz1N55vj2Ie2vXbhu440zfUfJvSwEqEbeLluk7NnapfGqa7LH0mOsnDxTF85Mx8/dyR6HfqcbmbQ==", + "dev": true, + "license": "MIT", + "dependencies": { + "hookified": "^1.15.0" + }, + "engines": { + "node": ">=20" + } + }, "node_modules/hasown": { "version": "2.0.4", "resolved": "https://registry.npmjs.org/hasown/-/hasown-2.0.4.tgz", @@ -1967,6 +2864,13 @@ "node": ">= 0.4" } }, + "node_modules/hookified": { + "version": "1.15.1", + "resolved": "https://registry.npmjs.org/hookified/-/hookified-1.15.1.tgz", + "integrity": "sha512-MvG/clsADq1GPM2KGo2nyfaWVyn9naPiXrqIe4jYjXNZQt238kWyOGrsyc/DmRAQ+Re6yeo6yX/yoNCG5KAEVg==", + "dev": true, + "license": "MIT" + }, "node_modules/hosted-git-info": { "version": "4.1.0", "resolved": "https://registry.npmjs.org/hosted-git-info/-/hosted-git-info-4.1.0.tgz", @@ -2095,6 +2999,16 @@ "dev": true, "license": "MIT" }, + "node_modules/imurmurhash": { + "version": "0.1.4", + "resolved": "https://registry.npmjs.org/imurmurhash/-/imurmurhash-0.1.4.tgz", + "integrity": "sha512-JmXMZ6wuvDmLiHEml9ykzqO6lwFbof0GG4IkcGaENdCRDDmMVnny7s5HsIgHCbaq0w2MyPhDqkhTUgS2LU2PHA==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">=0.8.19" + } + }, "node_modules/index-to-position": { "version": "1.2.0", "resolved": "https://registry.npmjs.org/index-to-position/-/index-to-position-1.2.0.tgz", @@ -2263,6 +3177,13 @@ "dev": true, "license": "MIT" }, + "node_modules/isexe": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/isexe/-/isexe-2.0.0.tgz", + "integrity": "sha512-RHxMLp9lnKHGHRng9QFhRCMbYAcVpn69smSGcq3f36xjgVVWThj4qqLbTLlq7Ssj8B+fIQ1EuCEGI2lKsyQeIw==", + "dev": true, + "license": "ISC" + }, "node_modules/istextorbinary": { "version": "9.5.0", "resolved": "https://registry.npmjs.org/istextorbinary/-/istextorbinary-9.5.0.tgz", @@ -2318,6 +3239,13 @@ "dev": true, "license": "MIT" }, + "node_modules/json-stable-stringify-without-jsonify": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/json-stable-stringify-without-jsonify/-/json-stable-stringify-without-jsonify-1.0.1.tgz", + "integrity": "sha512-Bdboy+l7tA3OGW6FjyFHWkP5LuByj1Tk33Ljyq0axyzdk9//JSi2u3fP1QSmd1KNwq6VOKYGlAu87CisVir6Pw==", + "dev": true, + "license": "MIT" + }, "node_modules/json5": { "version": "2.2.3", "resolved": "https://registry.npmjs.org/json5/-/json5-2.2.3.tgz", @@ -2456,6 +3384,16 @@ "prebuild-install": "^7.0.1" } }, + "node_modules/keyv": { + "version": "5.6.0", + "resolved": "https://registry.npmjs.org/keyv/-/keyv-5.6.0.tgz", + "integrity": "sha512-CYDD3SOtsHtyXeEORYRx2qBtpDJFjRTGXUtmNEMGyzYOKj1TE3tycdlho7kA1Ufx9OYWZzg52QFBGALTirzDSw==", + "dev": true, + "license": "MIT", + "dependencies": { + "@keyv/serialize": "^1.1.1" + } + }, "node_modules/leven": { "version": "3.1.0", "resolved": "https://registry.npmjs.org/leven/-/leven-3.1.0.tgz", @@ -2466,6 +3404,20 @@ "node": ">=6" } }, + "node_modules/levn": { + "version": "0.4.1", + "resolved": "https://registry.npmjs.org/levn/-/levn-0.4.1.tgz", + "integrity": "sha512-+bT2uH4E5LGE7h/n3evcS/sQlJXCpIp6ym8OWJ5eV6+67Dsql/LaaT7qJBAt2rzfoa/5QBGBhxDix1dMt2kQKQ==", + "dev": true, + "license": "MIT", + "dependencies": { + "prelude-ls": "^1.2.1", + "type-check": "~0.4.0" + }, + "engines": { + "node": ">= 0.8.0" + } + }, "node_modules/lie": { "version": "3.3.0", "resolved": "https://registry.npmjs.org/lie/-/lie-3.3.0.tgz", @@ -2496,6 +3448,22 @@ "uc.micro": "^2.0.0" } }, + "node_modules/locate-path": { + "version": "6.0.0", + "resolved": "https://registry.npmjs.org/locate-path/-/locate-path-6.0.0.tgz", + "integrity": "sha512-iPZK6eYjbxRu3uB4/WZ3EsEIMJFMqAoopl3R+zuq0UjcAm/MO6KCweDgPfP3elTztoKP3KtnVHxTn2NHBSDVUw==", + "dev": true, + "license": "MIT", + "dependencies": { + "p-locate": "^5.0.0" + }, + "engines": { + "node": ">=10" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, "node_modules/lodash": { "version": "4.18.1", "resolved": "https://registry.npmjs.org/lodash/-/lodash-4.18.1.tgz", @@ -2807,6 +3775,13 @@ "license": "MIT", "optional": true }, + "node_modules/natural-compare": { + "version": "1.4.0", + "resolved": "https://registry.npmjs.org/natural-compare/-/natural-compare-1.4.0.tgz", + "integrity": "sha512-OWND8ei3VtNC9h7V60qff3SVobHr996CTwgxubgyQYEpg290h9J0buyECNNJexkFm5sOajh5G116RYA1c8ZMSw==", + "dev": true, + "license": "MIT" + }, "node_modules/node-abi": { "version": "3.101.0", "resolved": "https://registry.npmjs.org/node-abi/-/node-abi-3.101.0.tgz", @@ -2952,6 +3927,24 @@ "url": "https://github.com/sponsors/sindresorhus" } }, + "node_modules/optionator": { + "version": "0.9.4", + "resolved": "https://registry.npmjs.org/optionator/-/optionator-0.9.4.tgz", + "integrity": "sha512-6IpQ7mKUxRcZNLIObR0hz7lxsapSSIYNZJwXPGeF0mTVqGKFIXj1DQcMoT22S3ROcLyY/rz0PWaWZ9ayWmad9g==", + "dev": true, + "license": "MIT", + "dependencies": { + "deep-is": "^0.1.3", + "fast-levenshtein": "^2.0.6", + "levn": "^0.4.1", + "prelude-ls": "^1.2.1", + "type-check": "^0.4.0", + "word-wrap": "^1.2.5" + }, + "engines": { + "node": ">= 0.8.0" + } + }, "node_modules/ora": { "version": "8.2.0", "resolved": "https://registry.npmjs.org/ora/-/ora-8.2.0.tgz", @@ -3014,6 +4007,38 @@ "url": "https://github.com/sponsors/sindresorhus" } }, + "node_modules/p-limit": { + "version": "3.1.0", + "resolved": "https://registry.npmjs.org/p-limit/-/p-limit-3.1.0.tgz", + "integrity": "sha512-TYOanM3wGwNGsZN2cVTYPArw454xnXj5qmWF1bEoAc4+cU/ol7GVh7odevjp1FNHduHc3KZMcFduxU5Xc6uJRQ==", + "dev": true, + "license": "MIT", + "dependencies": { + "yocto-queue": "^0.1.0" + }, + "engines": { + "node": ">=10" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, + "node_modules/p-locate": { + "version": "5.0.0", + "resolved": "https://registry.npmjs.org/p-locate/-/p-locate-5.0.0.tgz", + "integrity": "sha512-LaNjtRWUBY++zB5nE/NwcaoMylSPk+S+ZHNB1TzdbMJMny6dynpAGt7X/tl/QYq3TIeE6nxHppbo2LGymrG5Pw==", + "dev": true, + "license": "MIT", + "dependencies": { + "p-limit": "^3.0.2" + }, + "engines": { + "node": ">=10" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, "node_modules/p-map": { "version": "7.1.1", "resolved": "https://registry.npmjs.org/p-map/-/p-map-7.1.1.tgz", @@ -3125,6 +4150,26 @@ "url": "https://github.com/fb55/entities?sponsor=1" } }, + "node_modules/path-exists": { + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/path-exists/-/path-exists-4.0.0.tgz", + "integrity": "sha512-ak9Qy5Q7jYb2Wwcey5Fpvg2KoAc/ZIhLSLOSBmRmygPsGwkVVt0fZa0qrtMz+m6tJTAHfZQ8FnmB4MG4LWy7/w==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">=8" + } + }, + "node_modules/path-key": { + "version": "3.1.1", + "resolved": "https://registry.npmjs.org/path-key/-/path-key-3.1.1.tgz", + "integrity": "sha512-ojmeN0qd+y0jszEtoY48r0Peq5dwMEkIlCOu6Q5f41lfkswXuKtYrhgoTpLnyIcHm24Uhqx+5Tqm2InSwLhE6Q==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">=8" + } + }, "node_modules/path-scurry": { "version": "2.0.2", "resolved": "https://registry.npmjs.org/path-scurry/-/path-scurry-2.0.2.tgz", @@ -3273,6 +4318,16 @@ "node": ">=10" } }, + "node_modules/prelude-ls": { + "version": "1.2.1", + "resolved": "https://registry.npmjs.org/prelude-ls/-/prelude-ls-1.2.1.tgz", + "integrity": "sha512-vkcDPrRZo1QZLbn5RLGPpg/WmIQ65qoWWhcGKf/b5eplkkarX0m9z8ppCat4mlOqUsWpyNuYgO3VRyrYHSzX5g==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">= 0.8.0" + } + }, "node_modules/process-nextick-args": { "version": "2.0.1", "resolved": "https://registry.npmjs.org/process-nextick-args/-/process-nextick-args-2.0.1.tgz", @@ -3310,6 +4365,16 @@ "once": "^1.3.1" } }, + "node_modules/punycode": { + "version": "2.3.1", + "resolved": "https://registry.npmjs.org/punycode/-/punycode-2.3.1.tgz", + "integrity": "sha512-vYt7UD1U9Wg6138shLtLOvdAu+8DsC/ilFtEVHcH+wydcSpNE20AfSOduf6MkRFahL5FY7X1oU7nKVZFtfq8Fg==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">=6" + } + }, "node_modules/punycode.js": { "version": "2.3.1", "resolved": "https://registry.npmjs.org/punycode.js/-/punycode.js-2.3.1.tgz", @@ -3320,6 +4385,26 @@ "node": ">=6" } }, + "node_modules/qified": { + "version": "0.10.1", + "resolved": "https://registry.npmjs.org/qified/-/qified-0.10.1.tgz", + "integrity": "sha512-+Owyggi9IxT1ePKGafcI87ubSmxol6smwJ+RAHDQlx9+9cPwFWDiKFFCPuWhr9ignlGpZ9vDQLw67N4dcTVFEA==", + "dev": true, + "license": "MIT", + "dependencies": { + "hookified": "^2.1.1" + }, + "engines": { + "node": ">=20" + } + }, + "node_modules/qified/node_modules/hookified": { + "version": "2.2.0", + "resolved": "https://registry.npmjs.org/hookified/-/hookified-2.2.0.tgz", + "integrity": "sha512-p/LgFzRN5FeoD3DLS6bkUapeye6E4SI6yJs6KetENd18S+FBthqYq2amJUWpt5z0EQwwHemidjY5OqJGEKm5uA==", + "dev": true, + "license": "MIT" + }, "node_modules/qs": { "version": "6.17.1", "resolved": "https://registry.npmjs.org/qs/-/qs-6.17.1.tgz", @@ -3605,6 +4690,29 @@ "dev": true, "license": "MIT" }, + "node_modules/shebang-command": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/shebang-command/-/shebang-command-2.0.0.tgz", + "integrity": "sha512-kHxr2zZpYtdmrN1qDjrrX/Z1rR1kG8Dx+gkpK1G4eXmvXswmcE1hTWBWYUzlraYw1/yZp6YuDY77YtvbN0dmDA==", + "dev": true, + "license": "MIT", + "dependencies": { + "shebang-regex": "^3.0.0" + }, + "engines": { + "node": ">=8" + } + }, + "node_modules/shebang-regex": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/shebang-regex/-/shebang-regex-3.0.0.tgz", + "integrity": "sha512-7++dFhtcx3353uBaq8DDR4NuxBetBzC7ZQOhmTQInHEd6bSrXdiEyzCvG07Z44UYdLShWUyXt5M/yhz8ekcb1A==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">=8" + } + }, "node_modules/side-channel": { "version": "1.1.1", "resolved": "https://registry.npmjs.org/side-channel/-/side-channel-1.1.1.tgz", @@ -4050,6 +5158,54 @@ "url": "https://bevry.me/fund" } }, + "node_modules/tinyglobby": { + "version": "0.2.17", + "resolved": "https://registry.npmjs.org/tinyglobby/-/tinyglobby-0.2.17.tgz", + "integrity": "sha512-wXR/dYpcqKmfWpEdZjiKJOwCNFndD0DMnrW/cYjVGttEkBfVgcLFHoNrlj47mjOVic9yyNu65alsgF4NQyTa2g==", + "dev": true, + "license": "MIT", + "dependencies": { + "fdir": "^6.5.0", + "picomatch": "^4.0.4" + }, + "engines": { + "node": ">=12.0.0" + }, + "funding": { + "url": "https://github.com/sponsors/SuperchupuDev" + } + }, + "node_modules/tinyglobby/node_modules/fdir": { + "version": "6.5.0", + "resolved": "https://registry.npmjs.org/fdir/-/fdir-6.5.0.tgz", + "integrity": "sha512-tIbYtZbucOs0BRGqPJkshJUYdL+SDH7dVM8gjy+ERp3WAUjLEFJE+02kanyHtwjWOnwrKYBiwAmM0p4kLJAnXg==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">=12.0.0" + }, + "peerDependencies": { + "picomatch": "^3 || ^4" + }, + "peerDependenciesMeta": { + "picomatch": { + "optional": true + } + } + }, + "node_modules/tinyglobby/node_modules/picomatch": { + "version": "4.0.7", + "resolved": "https://registry.npmjs.org/picomatch/-/picomatch-4.0.7.tgz", + "integrity": "sha512-qcJu88Q2IWqJsDD529JKMdwGm/dvInW4HvQnRwiH9JtihJvzGOscDtHE3x1pBKeUOTysQ8kVmLnJ2kJu7yhcGA==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">=12" + }, + "funding": { + "url": "https://github.com/sponsors/jonschlinkert" + } + }, "node_modules/tmp": { "version": "0.2.7", "resolved": "https://registry.npmjs.org/tmp/-/tmp-0.2.7.tgz", @@ -4073,6 +5229,19 @@ "node": ">=8.0" } }, + "node_modules/ts-api-utils": { + "version": "2.5.0", + "resolved": "https://registry.npmjs.org/ts-api-utils/-/ts-api-utils-2.5.0.tgz", + "integrity": "sha512-OJ/ibxhPlqrMM0UiNHJ/0CKQkoKF243/AEmplt3qpRgkW8VG7IfOS41h7V8TjITqdByHzrjcS/2si+y4lIh8NA==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">=18.12" + }, + "peerDependencies": { + "typescript": ">=4.8.4" + } + }, "node_modules/tslib": { "version": "2.9.1", "resolved": "https://registry.npmjs.org/tslib/-/tslib-2.9.1.tgz", @@ -4104,6 +5273,19 @@ "node": "*" } }, + "node_modules/type-check": { + "version": "0.4.0", + "resolved": "https://registry.npmjs.org/type-check/-/type-check-0.4.0.tgz", + "integrity": "sha512-XleUoc9uwGXqjWwXaUTZAmzMcFZ5858QA2vvx1Ur5xIcixXIP+8LnFDgRplU30us6teqdlskFfu+ae4K79Ooew==", + "dev": true, + "license": "MIT", + "dependencies": { + "prelude-ls": "^1.2.1" + }, + "engines": { + "node": ">= 0.8.0" + } + }, "node_modules/type-fest": { "version": "4.41.0", "resolved": "https://registry.npmjs.org/type-fest/-/type-fest-4.41.0.tgz", @@ -4143,6 +5325,30 @@ "node": ">=14.17" } }, + "node_modules/typescript-eslint": { + "version": "8.74.0", + "resolved": "https://registry.npmjs.org/typescript-eslint/-/typescript-eslint-8.74.0.tgz", + "integrity": "sha512-OsWQlsedt1ZpZXfZZMNK3m4SoQONFFcy4h/uRznsCeRfVuEic3gh4KGUs2pJJ5o0Jj0Jr7keUHQGN1Ns9aDw7Q==", + "dev": true, + "license": "MIT", + "dependencies": { + "@typescript-eslint/eslint-plugin": "8.74.0", + "@typescript-eslint/parser": "8.74.0", + "@typescript-eslint/typescript-estree": "8.74.0", + "@typescript-eslint/utils": "8.74.0" + }, + "engines": { + "node": "^18.18.0 || ^20.9.0 || >=21.1.0" + }, + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/typescript-eslint" + }, + "peerDependencies": { + "eslint": "^8.57.0 || ^9.0.0 || ^10.0.0", + "typescript": ">=4.8.4 <6.1.0" + } + }, "node_modules/uc.micro": { "version": "2.1.0", "resolved": "https://registry.npmjs.org/uc.micro/-/uc.micro-2.1.0.tgz", @@ -4197,6 +5403,16 @@ "node": ">= 10.0.0" } }, + "node_modules/uri-js": { + "version": "4.4.1", + "resolved": "https://registry.npmjs.org/uri-js/-/uri-js-4.4.1.tgz", + "integrity": "sha512-7rKUyy33Q1yc98pQ1DAmLtwX109F7TIfWlW1Ydo8Wl1ii1SeHieeh0HHfPeL2fMXK6z0s8ecKs9frCuLJvndBg==", + "dev": true, + "license": "BSD-2-Clause", + "dependencies": { + "punycode": "^2.1.0" + } + }, "node_modules/url-join": { "version": "4.0.1", "resolved": "https://registry.npmjs.org/url-join/-/url-join-4.0.1.tgz", @@ -4259,6 +5475,32 @@ "node": ">=18" } }, + "node_modules/which": { + "version": "2.0.2", + "resolved": "https://registry.npmjs.org/which/-/which-2.0.2.tgz", + "integrity": "sha512-BLI3Tl1TW3Pvl70l3yq3Y64i+awpwXqsGBYWkkqMtnbXgrMD+yj7rhW0kuEDxzJaYXGjEW5ogapKNMEKNMjibA==", + "dev": true, + "license": "ISC", + "dependencies": { + "isexe": "^2.0.0" + }, + "bin": { + "node-which": "bin/node-which" + }, + "engines": { + "node": ">= 8" + } + }, + "node_modules/word-wrap": { + "version": "1.2.5", + "resolved": "https://registry.npmjs.org/word-wrap/-/word-wrap-1.2.5.tgz", + "integrity": "sha512-BN22B5eaMMI9UMtjrGd5g5eCYPpCPDUy0FJXbYsaT5zYxjFOckS53SQDE3pWkVoWpHXVb3BrYcEN4Twa55B5cA==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">=0.10.0" + } + }, "node_modules/wrappy": { "version": "1.0.2", "resolved": "https://registry.npmjs.org/wrappy/-/wrappy-1.0.2.tgz", @@ -4337,6 +5579,19 @@ "dependencies": { "buffer-crc32": "~0.2.3" } + }, + "node_modules/yocto-queue": { + "version": "0.1.0", + "resolved": "https://registry.npmjs.org/yocto-queue/-/yocto-queue-0.1.0.tgz", + "integrity": "sha512-rVksvsnNCdJ/ohGc6xgPwyN8eheCxsiLM8mxuE/t/mOVqJewPuO1miLpTHQiRgTKCLexL4MeAFVagts7HmNZ2Q==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">=10" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } } } } diff --git a/package.json b/package.json index 85611a8..4cf4635 100644 --- a/package.json +++ b/package.json @@ -505,12 +505,12 @@ }, { "command": "codeNotes.gradeCheck", - "title": "Grade the answer again", + "title": "Grade the Answer Again", "category": "Code Notes" }, { "command": "codeNotes.checkConcern", - "title": "Act on a concern found during the check", + "title": "Act on a Concern Found During the Check", "category": "Code Notes" }, { @@ -1646,16 +1646,15 @@ } }, "scripts": { - "build": "tsc -p . && npm run -s cli && npm run -s vendor && npm run -s pages", + "build": "node scripts/build.mjs", + "watch": "node scripts/build.mjs --watch", + "lint": "eslint . && node scripts/check-layers.mjs", "cli": "node cli/bundle.mjs", - "vendor": "node -e \"const f=require('fs');f.mkdirSync('out/vendor',{recursive:true});f.copyFileSync('node_modules/elkjs/lib/elk.bundled.js','out/vendor/elk.bundled.js');f.copyFileSync('node_modules/elkjs/LICENSE.md','out/vendor/elk-LICENSE.md')\"", - "pages": "node -e \"const f=require('fs');f.mkdirSync('out/src/webview',{recursive:true});for(const n of f.readdirSync('src/webview'))if(n.endsWith('.html'))f.copyFileSync('src/webview/'+n,'out/src/webview/'+n)\"", "test": "tsc -p . && node --import ./test/hermetic.mjs --test out/test/*.test.js test/cli/*.test.mjs", "package": "vsce package --no-dependencies", "test:integration": "npm run -s build && env -u ELECTRON_RUN_AS_NODE xvfb-run -a node out/test/integration/run.js", "test:scenes": "node test/journey-scene/check.mjs test/journey-scene/sample.json", "test:panel": "node test/journey-map/shoot.mjs", - "test:cli": "node --test test/cli/*.test.mjs", "test:goldens": "tsc -p . && node --import ./test/hermetic.mjs --test out/test/golden-*.test.js test/cli/golden-*.test.mjs", "test:checkpanel": "node test/check-panel/shoot.mjs", "test:checktour": "node test/check-tour/shoot.mjs", @@ -1664,12 +1663,15 @@ "test:grader": "node test/grader/eval.mjs" }, "devDependencies": { + "@eslint/js": "10.0.1", "@types/node": "^22.0.0", "@types/vscode": "1.100.0", "@vscode/test-electron": "^3.1.0", "@vscode/vsce": "^3.9.2", + "eslint": "10.15.0", "playwright": "^1.65.0", - "typescript": "^5.6.0" + "typescript": "^5.6.0", + "typescript-eslint": "8.74.0" }, "capabilities": { "untrustedWorkspaces": { @@ -1680,7 +1682,9 @@ "codeNotes.claude.model", "codeNotes.claude.mode", "codeNotes.claude.skills", - "codeNotes.journeys.model" + "codeNotes.journeys.model", + "codeNotes.understanding.model", + "codeNotes.understanding.background" ] }, "virtualWorkspaces": false diff --git a/scripts/build.mjs b/scripts/build.mjs new file mode 100644 index 0000000..909c970 --- /dev/null +++ b/scripts/build.mjs @@ -0,0 +1,23 @@ +// npm run build: compiles the extension and its tests (tsc -p .), then runs every scripts/build/*.mjs in name order, +// each one build target (the CLI bundle, the vendored libraries, the webview pages). +// npm run watch (the F5 task in .vscode/tasks.json): the same targets once, then tsc in watch mode. +import { spawnSync } from 'node:child_process' +import fs from 'node:fs' +import path from 'node:path' +import { createRequire } from 'node:module' +import { fileURLToPath } from 'node:url' + +const root = path.resolve(path.dirname(fileURLToPath(import.meta.url)), '..') +const tsc = createRequire(import.meta.url).resolve('typescript/bin/tsc') +const watch = process.argv.includes('--watch') + +/** Runs `node ` in the repository root; exits with its status when it fails. */ +function node(...args) { + const r = spawnSync(process.execPath, args, { cwd: root, stdio: 'inherit' }) + if (r.status !== 0) process.exit(r.status ?? 1) +} + +if (!watch) node(tsc, '-p', '.') +const dir = path.join(root, 'scripts', 'build') +for (const step of fs.readdirSync(dir).filter((n) => n.endsWith('.mjs')).sort()) node(path.join(dir, step)) +if (watch) node(tsc, '-w', '-p', '.') diff --git a/scripts/build/cli.mjs b/scripts/build/cli.mjs new file mode 100644 index 0000000..e62663c --- /dev/null +++ b/scripts/build/cli.mjs @@ -0,0 +1,9 @@ +// The understanding CLI: cli/understanding.mjs, one file bundled from cli/understanding/ (committed; CI recipes +// download it by URL). +import { spawnSync } from 'node:child_process' +import path from 'node:path' +import { fileURLToPath } from 'node:url' + +const root = path.resolve(path.dirname(fileURLToPath(import.meta.url)), '../..') +const r = spawnSync(process.execPath, [path.join(root, 'cli/bundle.mjs')], { cwd: root, stdio: 'inherit' }) +process.exit(r.status ?? 1) diff --git a/scripts/build/pages.mjs b/scripts/build/pages.mjs new file mode 100644 index 0000000..02c32ca --- /dev/null +++ b/scripts/build/pages.mjs @@ -0,0 +1,10 @@ +// The webview pages' HTML (src/webview/*.html) next to the compiled page.ts that reads them (out/src/webview/). +import fs from 'node:fs' +import path from 'node:path' +import { fileURLToPath } from 'node:url' + +const root = path.resolve(path.dirname(fileURLToPath(import.meta.url)), '../..') +const from = path.join(root, 'src/webview') +const to = path.join(root, 'out/src/webview') +fs.mkdirSync(to, { recursive: true }) +for (const n of fs.readdirSync(from)) if (n.endsWith('.html')) fs.copyFileSync(path.join(from, n), path.join(to, n)) diff --git a/scripts/build/vendor.mjs b/scripts/build/vendor.mjs new file mode 100644 index 0000000..b736407 --- /dev/null +++ b/scripts/build/vendor.mjs @@ -0,0 +1,10 @@ +// The libraries the webview pages load from out/vendor/: ELK (the map's layout) and its licence. +import fs from 'node:fs' +import path from 'node:path' +import { fileURLToPath } from 'node:url' + +const root = path.resolve(path.dirname(fileURLToPath(import.meta.url)), '../..') +const out = path.join(root, 'out/vendor') +fs.mkdirSync(out, { recursive: true }) +fs.copyFileSync(path.join(root, 'node_modules/elkjs/lib/elk.bundled.js'), path.join(out, 'elk.bundled.js')) +fs.copyFileSync(path.join(root, 'node_modules/elkjs/LICENSE.md'), path.join(out, 'elk-LICENSE.md')) diff --git a/scripts/check-layers.mjs b/scripts/check-layers.mjs new file mode 100644 index 0000000..44f81d3 --- /dev/null +++ b/scripts/check-layers.mjs @@ -0,0 +1,178 @@ +// npm run lint's second half: the import rule between the layers of src/ (scripts/layers.json) and the size of the +// largest import cycle. Known violations are listed per src/ folder in scripts/layer-exceptions/.txt; a new +// violation, a listed one that is gone, or a larger cycle fails. Run: node scripts/check-layers.mjs [--write] +// (--write rewrites the exception files from today's violations, keeping their max-scc headers). +import fs from 'node:fs' +import path from 'node:path' +import { createRequire } from 'node:module' +import { fileURLToPath, pathToFileURL } from 'node:url' + +const ts = createRequire(import.meta.url)('typescript') + +/** The module specifiers a source file imports: import/export ... from, import(), require(), import x = require(). */ +export function importsOf(file, text) { + const sf = ts.createSourceFile(file, text, ts.ScriptTarget.Latest, false, ts.ScriptKind.TS) + const out = [] + const visit = (n) => { + if ((ts.isImportDeclaration(n) || ts.isExportDeclaration(n)) && n.moduleSpecifier && ts.isStringLiteral(n.moduleSpecifier)) out.push(n.moduleSpecifier.text) + else if (ts.isImportEqualsDeclaration(n) && ts.isExternalModuleReference(n.moduleReference) && ts.isStringLiteral(n.moduleReference.expression)) out.push(n.moduleReference.expression.text) + else if (ts.isCallExpression(n) && n.arguments.length === 1 && ts.isStringLiteralLike(n.arguments[0]) + && (n.expression.kind === ts.SyntaxKind.ImportKeyword || (ts.isIdentifier(n.expression) && n.expression.text === 'require'))) out.push(n.arguments[0].text) + ts.forEachChild(n, visit) + } + visit(sf) + return out +} + +const walk = (d) => fs.readdirSync(d, { withFileTypes: true }).flatMap((e) => e.isDirectory() ? walk(path.join(d, e.name)) : [path.join(d, e.name)]) +const posix = (p) => p.split(path.sep).join('/') + +/** The import graph of `src`: file (relative to root, posix) -> files it imports, plus the bare modules it imports. */ +export function importGraph(root, src = 'src') { + const files = walk(path.join(root, src)).filter((f) => f.endsWith('.ts') && !f.endsWith('.d.ts')) + const known = new Set(files.map((f) => posix(path.relative(root, f)))) + const graph = new Map() + const bare = new Map() + for (const f of files) { + const rel = posix(path.relative(root, f)) + const deps = new Set() + const mods = new Set() + for (const spec of importsOf(f, fs.readFileSync(f, 'utf8'))) { + if (!spec.startsWith('.')) { mods.add(spec); continue } + const base = posix(path.relative(root, path.resolve(path.dirname(f), spec))).replace(/\.js$/, '') + const hit = [`${base}.ts`, `${base}/index.ts`].find((c) => known.has(c)) + if (hit) deps.add(hit) + } + graph.set(rel, [...deps].sort()) + bare.set(rel, [...mods].sort()) + } + return { graph, bare } +} + +/** Strongly connected components (Tarjan), each a sorted list of files; only cycles (size > 1 or a self-import). */ +export function cycles(graph) { + let index = 0 + const idx = new Map(), low = new Map(), on = new Set(), stack = [], out = [] + const strong = (v) => { + idx.set(v, index); low.set(v, index); index++ + stack.push(v); on.add(v) + for (const w of graph.get(v) ?? []) { + if (!idx.has(w)) { strong(w); low.set(v, Math.min(low.get(v), low.get(w))) } + else if (on.has(w)) low.set(v, Math.min(low.get(v), idx.get(w))) + } + if (low.get(v) === idx.get(v)) { + const scc = [] + let w + do { w = stack.pop(); on.delete(w); scc.push(w) } while (w !== v) + if (scc.length > 1 || (graph.get(v) ?? []).includes(v)) out.push(scc.sort()) + } + } + for (const v of [...graph.keys()].sort()) if (!idx.has(v)) strong(v) + return out.sort((a, b) => b.length - a.length) +} + +/** The src/ folder a file is in (its first segment under src/), or '' for the files at the root of src/. */ +export const folderOf = (file, src = 'src') => { + const parts = file.slice(src.length + 1).split('/') + return parts.length > 1 ? parts[0] : '' +} + +/** The layer of a file by the rules: its folder's layer, or the root file's layer; undefined when unassigned. */ +export function layerOf(file, rules) { + const src = rules.src ?? 'src' + const folder = folderOf(file, src) + const key = folder || file.slice(src.length + 1) + return rules.layers.findIndex((l) => l.members.includes(key) || (!folder && l.members.includes('*.ts'))) +} + +/** Every import that breaks the rules, as ` -> ` (or ` -> ` for a forbidden module). */ +export function violations(graph, bare, rules) { + const out = [] + const shared = new Set(rules.shared ?? []) + const src = rules.src ?? 'src' + for (const [from, deps] of graph) { + const lf = layerOf(from, rules) + for (const to of deps) { + if (shared.has(folderOf(to, src))) continue + const lt = layerOf(to, rules) + if (lt > lf) out.push(`${from} -> ${to}`) + } + const forbidden = rules.layers[lf]?.forbid ?? [] + for (const m of bare.get(from) ?? []) if (forbidden.includes(m)) out.push(`${from} -> ${m}`) + } + return out.sort() +} + +/** The exception files: folder -> { lines, maxScc (the `# max-scc: N` header, if any) }. */ +export function readExceptions(dir) { + const out = new Map() + if (!fs.existsSync(dir)) return out + for (const name of fs.readdirSync(dir).filter((n) => n.endsWith('.txt'))) { + const text = fs.readFileSync(path.join(dir, name), 'utf8') + const head = /^#\s*max-scc:\s*(\d+)\s*$/m.exec(text) + const lines = text.split('\n').map((l) => l.trim()).filter((l) => l && !l.startsWith('#')) + out.set(name.replace(/\.txt$/, ''), { lines, maxScc: head ? Number(head[1]) : undefined }) + } + return out +} + +/** The whole check. Returns the problems (empty when it passes) and what it measured. */ +export function check(root, { rulesFile = 'scripts/layers.json', exceptionsDir = 'scripts/layer-exceptions' } = {}) { + const rules = JSON.parse(fs.readFileSync(path.join(root, rulesFile), 'utf8')) + const src = rules.src ?? 'src' + const { graph, bare } = importGraph(root, src) + const problems = [] + for (const f of graph.keys()) if (layerOf(f, rules) < 0 && !(rules.shared ?? []).includes(folderOf(f, src))) problems.push(`${f}: in no layer (add its folder to ${rulesFile})`) + const found = violations(graph, bare, rules) + const exceptions = readExceptions(path.join(root, exceptionsDir)) + const listed = new Set([...exceptions.values()].flatMap((e) => e.lines)) + for (const v of found) if (!listed.has(v)) problems.push(`${v}: imports a higher layer (scripts/layers.json)`) + const foundSet = new Set(found) + for (const [folder, e] of exceptions) for (const l of e.lines) if (!foundSet.has(l)) problems.push(`${exceptionsDir}/${folder}.txt: "${l}" is fixed: remove the line`) + const sccs = cycles(graph) + const largest = sccs[0]?.length ?? 0 + const ceilings = [rules.maxScc, ...[...exceptions.values()].map((e) => e.maxScc)].filter((n) => n !== undefined) + const ceiling = ceilings.length ? Math.min(...ceilings) : Infinity + if (largest > ceiling) problems.push(`the largest import cycle has ${largest} files, more than the ceiling ${ceiling}: ${sccs[0].join(', ')}`) + for (const [folder, max] of Object.entries(rules.maxSccIn ?? {})) { + const inside = new Map([...graph].filter(([f]) => folderOf(f, src) === folder).map(([f, d]) => [f, d.filter((t) => folderOf(t, src) === folder)])) + const n = cycles(inside)[0]?.length ?? 0 + if (n > max) problems.push(`the largest import cycle inside ${src}/${folder} has ${n} files, more than the ceiling ${max}`) + } + return { problems, violations: found, largest, ceiling, rules } +} + +/** Rewrites the exception files from today's violations, one file per folder, keeping each file's header comments. */ +export function writeExceptions(root, found, { exceptionsDir = 'scripts/layer-exceptions', src = 'src' } = {}) { + const dir = path.join(root, exceptionsDir) + fs.mkdirSync(dir, { recursive: true }) + const byFolder = new Map() + for (const v of found) { + const folder = folderOf(v.split(' -> ')[0], src) || 'root' + byFolder.set(folder, [...(byFolder.get(folder) ?? []), v]) + } + const names = new Set([...fs.readdirSync(dir).filter((n) => n.endsWith('.txt')).map((n) => n.slice(0, -4)), ...byFolder.keys()]) + for (const folder of names) { + const file = path.join(dir, `${folder}.txt`) + const old = fs.existsSync(file) ? fs.readFileSync(file, 'utf8') : '' + const head = old.split('\n').filter((l) => l.startsWith('#')) + const lines = byFolder.get(folder) ?? [] + if (!lines.length && !head.some((l) => /max-scc/.test(l))) { if (old) fs.rmSync(file); continue } + const header = head.length ? head : [`# Imports from ${src}/${folder}/ that break the layer rule today; remove a line when you fix it.`] + fs.writeFileSync(file, [...header, ...lines, ''].join('\n')) + } +} + +if (process.argv[1] && import.meta.url === pathToFileURL(path.resolve(process.argv[1])).href) { + const root = path.resolve(path.dirname(fileURLToPath(import.meta.url)), '..') + const result = check(root) + if (process.argv.includes('--write')) { + writeExceptions(root, result.violations, { src: result.rules.src ?? 'src' }) + console.log(`wrote ${result.violations.length} known violations; largest cycle ${result.largest}`) + } else if (result.problems.length) { + for (const p of result.problems) console.error(p) + process.exit(1) + } else { + console.log(`layers: ${result.violations.length} known violations; largest import cycle ${result.largest} files (ceiling ${result.ceiling})`) + } +} diff --git a/scripts/keymap.mjs b/scripts/keymap.mjs new file mode 100644 index 0000000..2483b56 --- /dev/null +++ b/scripts/keymap.mjs @@ -0,0 +1,48 @@ +// The chord scheme, as data: package.json's contributes.keybindings is generated from it (every chord on both prefixes, +// with Ctrl released or still held for the second key). After editing: node scripts/keymap.mjs --write +// test/keybindings.test.ts fails while package.json is not up to date with this table. +import fs from 'node:fs' +import path from 'node:path' +import { fileURLToPath, pathToFileURL } from 'node:url' + +/** The second key of a chord -> the command it runs. */ +export const CHORDS = { + c: 'codeNotes.add', + r: 'codeNotes.resolveNext', + d: 'codeNotes.next', + a: 'codeNotes.previous', + v: 'codeNotes.showMap', + p: 'codeNotes.toggleAnimation', + j: 'codeNotes.searchJourneys', + // Listening (the journey podcast): play / pause, back and forward 15 s, previous and next step (src/podcast/player.ts). + space: 'codeNotes.podcastToggle', + left: 'codeNotes.podcastBack', + right: 'codeNotes.podcastForward', + 'shift+left': 'codeNotes.podcastPrevStep', + 'shift+right': 'codeNotes.podcastNextStep', +} + +/** The two prefixes: Ctrl+< by scan code (the ISO key, whatever the layout) and Ctrl+'; `arg` tells the command which. */ +export const PREFIXES = [{ key: 'ctrl+[IntlBackslash]', arg: '<' }, { key: "ctrl+'", arg: "'" }] + +/** Bindings outside the chord scheme. */ +export const OTHERS = [ + { command: 'codeNotes.cancelMove', key: 'escape', when: 'codeNotes.moving && editorTextFocus && !suggestWidgetVisible && !findWidgetVisible' }, +] + +/** + * The keybindings as package.json lists them. A chord has no `when` (always consumed: it never types into the code). + * The plain chord comes last for each command: VS Code shows a command's last binding ("Ctrl+' D"). + */ +export function keybindings() { + const chords = PREFIXES.flatMap((p) => Object.entries(CHORDS).flatMap(([k, command]) => + [`ctrl+${k}`, k].map((second) => ({ command, key: `${p.key} ${second}`, args: { prefix: p.arg } })))) + return [...chords, ...OTHERS] +} + +if (process.argv[1] && import.meta.url === pathToFileURL(path.resolve(process.argv[1])).href && process.argv.includes('--write')) { + const file = path.join(path.dirname(fileURLToPath(import.meta.url)), '..', 'package.json') + const pkg = JSON.parse(fs.readFileSync(file, 'utf8')) + pkg.contributes.keybindings = keybindings() + fs.writeFileSync(file, `${JSON.stringify(pkg, null, 2)}\n`) +} diff --git a/scripts/layer-exceptions/README.md b/scripts/layer-exceptions/README.md new file mode 100644 index 0000000..a46fcc7 --- /dev/null +++ b/scripts/layer-exceptions/README.md @@ -0,0 +1,24 @@ +# Layer exceptions + +`npm run lint` runs `scripts/check-layers.mjs`, which checks the imports between the layers of `src/` +(`scripts/layers.json`, lowest first): + +| layer | folders | +|---|---| +| core | `core/` (pure: no `vscode`) | +| platform | `platform/` (the vscode and Node adapters) | +| features | `notes/`, `threads/`, `journeys/`, `tour/`, `podcast/`, `marks/`, `ask/`, `write/`, `check/`, `codeLinks/` | +| ui | `sidebar/`, `webview/` | +| composition | the files at the root of `src/` (`extension.ts`, …) | + +A file may import its own layer and the layers below it; `protocol/` is open to every layer. + +Each `.txt` here lists the imports from that `src/` folder that break the rule today, one +` -> ` per line. A new violation fails the lint; so does a listed one that is gone (remove the line when you +fix it). Each file belongs to the work that owns its folder. + +The check also measures the largest import cycle (strongly connected component). It may not grow past `maxScc` in +`scripts/layers.json`; when your change shrinks it, write the new size as a `# max-scc: N` line at the top of your +folder's file (the smallest of all of them counts). `maxSccIn` caps the cycles inside one folder the same way. + +`node scripts/check-layers.mjs --write` rewrites the lists from the code (review the diff: it lists new violations too). diff --git a/scripts/layer-exceptions/ask.txt b/scripts/layer-exceptions/ask.txt new file mode 100644 index 0000000..2d1dd0b --- /dev/null +++ b/scripts/layer-exceptions/ask.txt @@ -0,0 +1,6 @@ +# Imports from src/ask/ that break the layer rule today; remove a line when you fix it. +src/ask/commands.ts -> src/app.ts +src/ask/run.ts -> src/app.ts +src/ask/run.ts -> src/refresh.ts +src/ask/settings.ts -> src/app.ts +src/ask/trust.ts -> src/app.ts diff --git a/scripts/layer-exceptions/check.txt b/scripts/layer-exceptions/check.txt new file mode 100644 index 0000000..ac041f2 --- /dev/null +++ b/scripts/layer-exceptions/check.txt @@ -0,0 +1,5 @@ +# Imports from src/check/ that break the layer rule today; remove a line when you fix it. +src/check/view.ts -> src/webview/page.ts +src/check/wiring.ts -> src/app.ts +src/check/wiring.ts -> src/refresh.ts +src/check/wiring.ts -> src/sidebar/journeysTree.ts diff --git a/scripts/layer-exceptions/codeLinks.txt b/scripts/layer-exceptions/codeLinks.txt new file mode 100644 index 0000000..08924c8 --- /dev/null +++ b/scripts/layer-exceptions/codeLinks.txt @@ -0,0 +1,2 @@ +# Imports from src/codeLinks/ that break the layer rule today; remove a line when you fix it. +src/codeLinks/codeLinkClick.ts -> src/app.ts diff --git a/scripts/layer-exceptions/core.txt b/scripts/layer-exceptions/core.txt new file mode 100644 index 0000000..8a0a0f6 --- /dev/null +++ b/scripts/layer-exceptions/core.txt @@ -0,0 +1,4 @@ +# Imports from src/core/ that break the layer rule today; remove a line when you fix it. +src/core/linkifyAnswer.ts -> src/journeys/textFormat.ts +src/core/text.ts -> src/notes/store.ts +src/core/writing.ts -> src/platform/agent/claude.ts diff --git a/scripts/layer-exceptions/journeys.txt b/scripts/layer-exceptions/journeys.txt new file mode 100644 index 0000000..f2bdead --- /dev/null +++ b/scripts/layer-exceptions/journeys.txt @@ -0,0 +1,2 @@ +# Imports from src/journeys/ that break the layer rule today; remove a line when you fix it. +src/journeys/mapPanel.ts -> src/webview/page.ts diff --git a/scripts/layer-exceptions/notes.txt b/scripts/layer-exceptions/notes.txt new file mode 100644 index 0000000..56a10f8 --- /dev/null +++ b/scripts/layer-exceptions/notes.txt @@ -0,0 +1,50 @@ +# Imports from src/notes/ that break the layer rule today; remove a line when you fix it. +src/notes/broken.ts -> src/app.ts +src/notes/broken.ts -> src/sidebar/nodes.ts +src/notes/changedOnDisk.ts -> src/app.ts +src/notes/changedOnDisk.ts -> src/refresh.ts +src/notes/changedOnDisk.ts -> src/sidebar/nodes.ts +src/notes/commentRanges.ts -> src/app.ts +src/notes/create.ts -> src/app.ts +src/notes/create.ts -> src/refresh.ts +src/notes/decorations.ts -> src/app.ts +src/notes/decorations.ts -> src/sidebar/notesFilter.ts +src/notes/find.ts -> src/app.ts +src/notes/find.ts -> src/sidebar/nodes.ts +src/notes/folder.ts -> src/app.ts +src/notes/folder.ts -> src/refresh.ts +src/notes/folder.ts -> src/sidebar/notesTree.ts +src/notes/identity.ts -> src/app.ts +src/notes/location.ts -> src/app.ts +src/notes/location.ts -> src/refresh.ts +src/notes/move.ts -> src/app.ts +src/notes/move.ts -> src/refresh.ts +src/notes/pages.ts -> src/app.ts +src/notes/prompt.ts -> src/app.ts +src/notes/prompt.ts -> src/sidebar/notesFilter.ts +src/notes/reply.ts -> src/app.ts +src/notes/reply.ts -> src/refresh.ts +src/notes/reveal.ts -> src/app.ts +src/notes/reveal.ts -> src/sidebar/journeyRows.ts +src/notes/reveal.ts -> src/sidebar/nodes.ts +src/notes/reveal.ts -> src/sidebar/notesFilter.ts +src/notes/reveal.ts -> src/sidebar/notesTree.ts +src/notes/seen.ts -> src/app.ts +src/notes/seen.ts -> src/refresh.ts +src/notes/sessions.ts -> src/app.ts +src/notes/sessions.ts -> src/refresh.ts +src/notes/sessions.ts -> src/sidebar/nodes.ts +src/notes/sessions.ts -> src/sidebar/notesFilter.ts +src/notes/status.ts -> src/app.ts +src/notes/status.ts -> src/refresh.ts +src/notes/status.ts -> src/sidebar/notesFilter.ts +src/notes/status.ts -> src/sidebar/notesTree.ts +src/notes/suggestion.ts -> src/app.ts +src/notes/suggestion.ts -> src/refresh.ts +src/notes/undo.ts -> src/app.ts +src/notes/unread.ts -> src/app.ts +src/notes/unread.ts -> src/refresh.ts +src/notes/unread.ts -> src/sidebar/nodes.ts +src/notes/unread.ts -> src/sidebar/notesFilter.ts +src/notes/which.ts -> src/app.ts +src/notes/which.ts -> src/sidebar/nodes.ts diff --git a/scripts/layer-exceptions/platform.txt b/scripts/layer-exceptions/platform.txt new file mode 100644 index 0000000..264e14c --- /dev/null +++ b/scripts/layer-exceptions/platform.txt @@ -0,0 +1,2 @@ +# Imports from src/platform/ that break the layer rule today; remove a line when you fix it. +src/platform/checkout.ts -> src/notes/store.ts diff --git a/scripts/layer-exceptions/podcast.txt b/scripts/layer-exceptions/podcast.txt new file mode 100644 index 0000000..49a342f --- /dev/null +++ b/scripts/layer-exceptions/podcast.txt @@ -0,0 +1,6 @@ +# Imports from src/podcast/ that break the layer rule today; remove a line when you fix it. +src/podcast/listenView.ts -> src/app.ts +src/podcast/listenView.ts -> src/webview/page.ts +src/podcast/load.ts -> src/app.ts +src/podcast/player.ts -> src/app.ts +src/podcast/player.ts -> src/sidebar/journeysTree.ts diff --git a/scripts/layer-exceptions/sidebar.txt b/scripts/layer-exceptions/sidebar.txt new file mode 100644 index 0000000..c7f8360 --- /dev/null +++ b/scripts/layer-exceptions/sidebar.txt @@ -0,0 +1,9 @@ +# Imports from src/sidebar/ that break the layer rule today; remove a line when you fix it. +src/sidebar/journeyRows.ts -> src/app.ts +src/sidebar/journeysTree.ts -> src/app.ts +src/sidebar/listModel.ts -> src/app.ts +src/sidebar/nodes.ts -> src/app.ts +src/sidebar/notesFilter.ts -> src/app.ts +src/sidebar/notesFilter.ts -> src/refresh.ts +src/sidebar/notesTree.ts -> src/app.ts +src/sidebar/rowItems.ts -> src/app.ts diff --git a/scripts/layer-exceptions/threads.txt b/scripts/layer-exceptions/threads.txt new file mode 100644 index 0000000..cbc77e1 --- /dev/null +++ b/scripts/layer-exceptions/threads.txt @@ -0,0 +1,6 @@ +# Imports from src/threads/ that break the layer rule today; remove a line when you fix it. +src/threads/comments.ts -> src/app.ts +src/threads/comments.ts -> src/sidebar/journeyRows.ts +src/threads/sync.ts -> src/app.ts +src/threads/sync.ts -> src/sidebar/journeyRows.ts +src/threads/sync.ts -> src/sidebar/notesFilter.ts diff --git a/scripts/layer-exceptions/tour.txt b/scripts/layer-exceptions/tour.txt new file mode 100644 index 0000000..01623c4 --- /dev/null +++ b/scripts/layer-exceptions/tour.txt @@ -0,0 +1,29 @@ +# Imports from src/tour/ that break the layer rule today; remove a line when you fix it. +src/tour/askStep.ts -> src/app.ts +src/tour/askStep.ts -> src/refresh.ts +src/tour/card.ts -> src/app.ts +src/tour/card.ts -> src/sidebar/journeyRows.ts +src/tour/checkTour.ts -> src/app.ts +src/tour/checkTour.ts -> src/sidebar/listModel.ts +src/tour/commands.ts -> src/app.ts +src/tour/commands.ts -> src/chords.ts +src/tour/commands.ts -> src/sidebar/journeyRows.ts +src/tour/commands.ts -> src/sidebar/notesTree.ts +src/tour/instances.ts -> src/app.ts +src/tour/lenses.ts -> src/app.ts +src/tour/mapMessages.ts -> src/app.ts +src/tour/mapMessages.ts -> src/sidebar/journeyRows.ts +src/tour/mapMessages.ts -> src/sidebar/journeysTree.ts +src/tour/mapMessages.ts -> src/sidebar/listModel.ts +src/tour/panelLayout.ts -> src/app.ts +src/tour/pick.ts -> src/app.ts +src/tour/pick.ts -> src/sidebar/nodes.ts +src/tour/provenance.ts -> src/sidebar/listModel.ts +src/tour/refs.ts -> src/app.ts +src/tour/stepMarks.ts -> src/app.ts +src/tour/stepNotes.ts -> src/app.ts +src/tour/stepNotes.ts -> src/sidebar/journeyRows.ts +src/tour/tutorial.ts -> src/app.ts +src/tour/walk.ts -> src/app.ts +src/tour/walk.ts -> src/sidebar/journeyRows.ts +src/tour/walk.ts -> src/sidebar/notesTree.ts diff --git a/scripts/layer-exceptions/write.txt b/scripts/layer-exceptions/write.txt new file mode 100644 index 0000000..f446a5c --- /dev/null +++ b/scripts/layer-exceptions/write.txt @@ -0,0 +1,10 @@ +# Imports from src/write/ that break the layer rule today; remove a line when you fix it. +src/write/clarify.ts -> src/app.ts +src/write/clarify.ts -> src/webview/page.ts +src/write/claudeRun.ts -> src/app.ts +src/write/rank.ts -> src/app.ts +src/write/refreshJourney.ts -> src/app.ts +src/write/refreshJourney.ts -> src/sidebar/journeysTree.ts +src/write/refreshJourney.ts -> src/sidebar/listModel.ts +src/write/requests.ts -> src/app.ts +src/write/writeJourney.ts -> src/app.ts diff --git a/scripts/layers.json b/scripts/layers.json new file mode 100644 index 0000000..bdf173a --- /dev/null +++ b/scripts/layers.json @@ -0,0 +1,13 @@ +{ + "src": "src", + "layers": [ + { "name": "core", "members": ["core"], "forbid": ["vscode"] }, + { "name": "platform", "members": ["platform"] }, + { "name": "features", "members": ["notes", "threads", "journeys", "tour", "podcast", "marks", "ask", "write", "check", "codeLinks"] }, + { "name": "ui", "members": ["sidebar", "webview"] }, + { "name": "composition", "members": ["*.ts"] } + ], + "shared": ["protocol"], + "maxScc": 55, + "maxSccIn": { "check": 9 } +} diff --git a/scripts/release-notes.mjs b/scripts/release-notes.mjs new file mode 100644 index 0000000..4b783ee --- /dev/null +++ b/scripts/release-notes.mjs @@ -0,0 +1,23 @@ +// The release notes of one version: its section of CHANGELOG.md, from its `## ` heading to the next `## `. +// Run by the release workflow: node scripts/release-notes.mjs [CHANGELOG.md] > notes.md +// Exits 1 when the changelog has no section for the version (a release needs one). +import fs from 'node:fs' +import path from 'node:path' +import { pathToFileURL } from 'node:url' + +/** The lines under `## ` (e.g. "## 0.26.0" or "## 0.26.0 (2026-11-02)"), or undefined when there is none. */ +export function releaseNotes(changelog, version) { + const lines = changelog.split('\n') + const start = lines.findIndex((l) => l.startsWith(`## ${version}`) && !/^[\w.-]/.test(l.slice(3 + version.length))) + if (start < 0) return undefined + const end = lines.findIndex((l, i) => i > start && l.startsWith('## ')) + return lines.slice(start + 1, end < 0 ? undefined : end).join('\n').replace(/^\n+/, '').replace(/\n*$/, '\n') +} + +if (process.argv[1] && import.meta.url === pathToFileURL(path.resolve(process.argv[1])).href) { + const [version, file = 'CHANGELOG.md'] = process.argv.slice(2) + if (!version) { console.error('usage: node scripts/release-notes.mjs [CHANGELOG.md]'); process.exit(2) } + const notes = releaseNotes(fs.readFileSync(file, 'utf8'), version) + if (notes === undefined) { console.error(`${file} has no section for ${version} (a "## ${version}" line)`); process.exit(1) } + process.stdout.write(notes) +} diff --git a/skills/code-journey/scripts/journey.py b/skills/code-journey/scripts/journey.py index eb86f7d..e4357d1 100755 --- a/skills/code-journey/scripts/journey.py +++ b/skills/code-journey/scripts/journey.py @@ -1517,7 +1517,7 @@ def check_ref(repo, ref): return '', [(a, ls[a - 1].strip()[:90])] + ([(b, ls[b - 1].strip()[:90])] if b > a else []) -# --- finding a step again after the code moved: the same rules as the extension (src/anchor.ts; +# --- finding a step again after the code moved: the same rules as the extension (src/core/anchors/anchor.ts; # keep the two in step). Lines compare without whitespace, with one quote style and no trailing ; or , (`norm`). def norm(s): return re.sub(r'[;,]+$', '', re.sub(r"['`]", '"', re.sub(r'\s+', '', s))) @@ -1532,7 +1532,7 @@ def weak(s): # `}` or `);` says nothing about where code is: # --- compact anchors (v3), as in docs/journey-format.md ("In the repo"); the extension does the same in -# src/compact.ts (keep the two in step). +# src/core/anchors/compact.ts (keep the two in step). def text_hash(text_lines, blanks=False): """sha1 of the non-blank lines through `norm`, joined by "\n" (compact.ts blockHash): a blank line added or removed is not a change. blanks=True: the other reading (every line, blank ones as ""), accepted when read.""" @@ -1919,7 +1919,7 @@ def repeat_warning(k, s): return '' -# --- step extras (format: media/journey-scene.js, src/codeLinkText.ts, src/valueHints.ts): a step's +# --- step extras (format: media/journey-scene.js, src/core/codeLinkText.ts, src/codeLinks/valueHints.ts): a step's # animation (`scene`), its code links (`links`: phrases of the lead/details that open the lines doing that part) and # its value hints (`values`: what a variable holds in the example run, above its line). Every line is read from the # source by the commands below; the author never types a line's text. diff --git a/src/app.ts b/src/app.ts index e12f53e..ef6300d 100644 --- a/src/app.ts +++ b/src/app.ts @@ -2,16 +2,16 @@ // `provide`), the settings, and a few small helpers. Read anywhere; set only through `provide` and `setKey`. import * as vscode from 'vscode' -import { Beats } from './beats' +import { Beats } from './codeLinks/beats' import { CheckController } from './check/controller' -import { ClaudeLinks } from './claudeChatLinks' -import { CodeLinks } from './codeLinks' +import { ClaudeLinks } from './codeLinks/claudeChatLinks' +import { CodeLinks } from './codeLinks/codeLinks' import { Journeys } from './journeys/journeys' import { MapPanel } from './journeys/mapPanel' -import { Store } from './store' +import { Store } from './notes/store' import { TourItems } from './tour/walk' -import { TutorialSpot } from './tutorialSpot' -import { ValueHints } from './valueHints' +import { TutorialSpot } from './tour/tutorialSpot' +import { ValueHints } from './codeLinks/valueHints' /** The notes, and the stored state of this workspace (`state`) and of every workspace (`gstate`). */ export let store: Store diff --git a/src/ask/prompts.ts b/src/ask/prompts.ts index 9eef294..61c9a76 100644 --- a/src/ask/prompts.ts +++ b/src/ask/prompts.ts @@ -1,8 +1,8 @@ // What Claude is told when it answers a note: the note and its conversation, the rules, and the hints for a step's // question, an understanding check and the skills it may use. Only text: ask/run.ts sends it. -import { me } from '../identity' -import { Note } from '../store' +import { me } from '../notes/identity' +import { Note } from '../notes/store' import { UPDATE_ASK } from '../tour/askStep' /** How Claude works on a note and answers. */ diff --git a/src/ask/run.ts b/src/ask/run.ts index 8f1d53a..9f9812f 100644 --- a/src/ask/run.ts +++ b/src/ask/run.ts @@ -3,15 +3,15 @@ import * as vscode from 'vscode' import { byId, cfg, firstFolder, log, now, state, store, understanding } from '../app' -import { Ask, AskResult, modelProblem } from '../claude' +import { Ask, AskResult, modelProblem } from '../platform/agent/claude' import { shape, shapeOf } from '../notes/changedOnDisk' import { createNote } from '../notes/create' import { docUri, linesOfUri } from '../notes/location' import { reveal } from '../notes/reveal' import { refreshAll } from '../refresh' -import { markRead } from '../seen' -import { Note } from '../store' -import { plural } from '../text' +import { markRead } from '../notes/seen' +import { Note } from '../notes/store' +import { plural } from '../core/text' import { revealed, syncThread } from '../threads/sync' import { walk } from '../tour/instances' import { checkHint, claudePrompt, stepAskHint } from './prompts' diff --git a/src/ask/settings.ts b/src/ask/settings.ts index 28d88e3..188dcfd 100644 --- a/src/ask/settings.ts +++ b/src/ask/settings.ts @@ -3,7 +3,7 @@ import * as vscode from 'vscode' import { cfg, setCtx } from '../app' -import { findCli, findCliAsync } from '../claudeCli' +import { findCli, findCliAsync } from '../platform/agent/claudeCli' export const claudeMode = () => cfg().get('claude.mode', 'button') diff --git a/src/check/cliThread.ts b/src/check/cliThread.ts index 4da7516..e1c0c08 100644 --- a/src/check/cliThread.ts +++ b/src/check/cliThread.ts @@ -3,7 +3,7 @@ // Remote-SSH: the editor too) would wait with it. No vscode here: unit tests use it as is. import { Worker } from 'worker_threads' import * as path from 'path' -import { READ_ONLY_GIT } from '../git' +import { READ_ONLY_GIT } from '../platform/git' /** A call that takes longer than this is given up (a git that hangs): the worker is stopped, the next call starts a new one. */ const TIMEOUT_MS = 120_000 diff --git a/src/check/cliWorker.ts b/src/check/cliWorker.ts index 55ab591..2ea1f7c 100644 --- a/src/check/cliWorker.ts +++ b/src/check/cliWorker.ts @@ -7,7 +7,7 @@ import * as fs from 'fs' import * as os from 'os' import * as path from 'path' import { createHash } from 'crypto' -import { statusBranch, statusPaths } from '../git' +import { statusBranch, statusPaths } from '../platform/git' import { importCli } from './importCli' import type { RefreshResult } from './types' diff --git a/src/check/concern.ts b/src/check/concern.ts index bc42b44..99c6e6d 100644 --- a/src/check/concern.ts +++ b/src/check/concern.ts @@ -2,12 +2,12 @@ // can do about it: Suggest a fix (a note asked to Claude), Add TODO (a comment above the lines), Flag for review (on // the merge request), Dismiss (with a reason, or "I fixed it"). import * as vscode from 'vscode' -import type { Note } from '../store' +import type { Note } from '../notes/store' import { Check, Question } from './types' import { concernOf, samePerson, settledConcern, whoOf } from './concernState' import { commentMark, todoLines, todoPlace } from './todoComment' -import { gitOut } from '../git' -import { docLines } from '../documents' +import { gitOut } from '../platform/git' +import { docLines } from '../platform/documents' import type { CheckController } from './controller' export type ConcernAction = 'fix' | 'todo' | 'flag' | 'dismiss' | 'fixed' diff --git a/src/check/controller.ts b/src/check/controller.ts index c2aaad8..98d2ea5 100644 --- a/src/check/controller.ts +++ b/src/check/controller.ts @@ -14,14 +14,14 @@ import * as vscode from 'vscode' import * as fs from 'fs' import * as path from 'path' -import type { Note } from '../store' +import type { Note } from '../notes/store' import { Check, Cli, Link, notDone, QState, Question, RefreshResult, Status, Who, Words } from './types' import { linksAt, gradeMessageAt, gradedAttempts } from './threadText' import { concernOf } from './concernState' import { CheckView, checkView, definedOnly, runAction, statusText } from './viewModel' import { gradeFailure } from './failures' -import { Coalesced } from '../coalesced' -import { plural } from '../text' +import { Coalesced } from '../core/coalesced' +import { plural } from '../core/text' import { BackgroundQuestions } from './background' import { CliThread } from './cliThread' import { Concerns, ConcernAction, VIEW_CONCERN_ACTIONS } from './concern' @@ -39,7 +39,7 @@ import { CheckThreads } from './threads' import { CheckViewProvider } from './view' import type { CheckViewMessage, CheckViewMessageOf, CheckViewRequest } from './viewMessages' import { Writer } from './writer' -import { baseName } from '../paths' +import { baseName } from '../core/paths' export type { CheckHost } from './host' export { SESSION } from './constants' diff --git a/src/check/failures.ts b/src/check/failures.ts index 12821c6..7a1d5be 100644 --- a/src/check/failures.ts +++ b/src/check/failures.ts @@ -1,6 +1,6 @@ // What went wrong, in the Check view's plain words: writing the questions, grading an answer (by cause), a check file // that isn't JSON (where). No vscode API here (unit-tested in test/checkModel.test.ts). -import type { AskErrorKind } from '../claude' +import type { AskErrorKind } from '../platform/agent/claude' /** Where the engine's JSON error is, when it says so: "… (line 3 column 5)" (newer V8) or "… at position 42". */ const JSON_LINE_COL = /line (\d+) column (\d+)/ diff --git a/src/check/grading.ts b/src/check/grading.ts index 6ad63ca..a86feb5 100644 --- a/src/check/grading.ts +++ b/src/check/grading.ts @@ -2,8 +2,8 @@ // read-only; the verdict is written into the file and reaches the thread through the threads' sync. import * as vscode from 'vscode' import * as path from 'path' -import { Ask, AskErrorKind, AskResult } from '../claude' -import type { Note } from '../store' +import { Ask, AskErrorKind, AskResult } from '../platform/agent/claude' +import type { Note } from '../notes/store' import type { Attempt, Cli, Question } from './types' import { sameQuestion } from './threadLink' import { costOf } from './log' diff --git a/src/check/host.ts b/src/check/host.ts index 34a2b36..348020f 100644 --- a/src/check/host.ts +++ b/src/check/host.ts @@ -1,7 +1,7 @@ // What the understanding check needs from the rest of the extension (src/check/wiring.ts provides it), and the parts // of VS Code's git extension API it listens to. import * as vscode from 'vscode' -import type { Note, Store } from '../store' +import type { Note, Store } from '../notes/store' import type { Check } from './types' /** @@ -33,7 +33,7 @@ export interface NotesHost { /** Claude Code (writer.ts, grading.ts). */ export interface ClaudeHost { - /** The `claude` CLI (Claude Code; src/claudeCli.ts findCli), or undefined. Not the understanding CLI (controller's `cli`). */ + /** The `claude` CLI (Claude Code; src/platform/agent/claudeCli.ts findCli), or undefined. Not the understanding CLI (controller's `cli`). */ cli(): string | undefined /** Claude may run here (a trusted folder); says why not otherwise. */ allowed(what: string): boolean diff --git a/src/check/park.ts b/src/check/park.ts index 449ff8b..2ea7a4a 100644 --- a/src/check/park.ts +++ b/src/check/park.ts @@ -3,7 +3,7 @@ import * as vscode from 'vscode' import * as fs from 'fs' import * as path from 'path' -import { gitOut } from '../git' +import { gitOut } from '../platform/git' import { RESTORED_OPEN_MS } from './constants' import type { CheckController } from './controller' diff --git a/src/check/prompts.ts b/src/check/prompts.ts index 178eea2..bfb1fe5 100644 --- a/src/check/prompts.ts +++ b/src/check/prompts.ts @@ -1,7 +1,7 @@ // What Claude is asked when it writes the check: the prompt for the questions, the prompt for the tour, and the // phase shown while it works (from its last tool call). No vscode API here (unit-tested in test/checkModel.test.ts). -import { READ_ONLY_TOOLS } from '../claude' -import type { ToolCall } from '../claude' +import { READ_ONLY_TOOLS } from '../platform/agent/claude' +import type { ToolCall } from '../platform/agent/claude' /** The prompt for `claude -p` that writes (or tops up) the questions with the understanding-check skill. */ export function checkPrompt(o: { skill: string; branch: string; baseRef: string; base: string; topUp: boolean; bundled: boolean; head?: string }): string { diff --git a/src/check/push.ts b/src/check/push.ts index 784ad8d..800e533 100644 --- a/src/check/push.ts +++ b/src/check/push.ts @@ -6,7 +6,7 @@ import * as path from 'path' import { concernOf, settledConcern } from './concernState' import { unsavedIn } from './unsaved' import { CommitPlan } from './viewModel' -import { gitOut } from '../git' +import { gitOut } from '../platform/git' import { PUSHED_MESSAGE_MS, REPO_FILES } from './constants' import type { CheckController } from './controller' diff --git a/src/check/threadLink.ts b/src/check/threadLink.ts index c8b9db2..617a94b 100644 --- a/src/check/threadLink.ts +++ b/src/check/threadLink.ts @@ -1,7 +1,7 @@ // A check thread's link to its question (in the note's `extra.check`): which check file, which question, and a hash // of the question's text when the thread was made. import { createHash } from 'crypto' -import type { Note } from '../store' +import type { Note } from '../notes/store' import { Question } from './types' import { questionBody } from './threadText' diff --git a/src/check/threadText.ts b/src/check/threadText.ts index fd86eed..a48ab4e 100644 --- a/src/check/threadText.ts +++ b/src/check/threadText.ts @@ -1,7 +1,7 @@ // A question's thread as text: the question (with the code it also depends on), the grader's replies, the code links // of each message, and the messages a thread is missing. No vscode API here (unit-tested in test/checkModel.test.ts). import type { Attempt, Link, Question, Range } from './types' -import { baseName } from '../paths' +import { baseName } from '../core/paths' /** The question as the first message of its thread; unchanged code it depends on (not linked from its words) below it. */ export function questionBody(q: Question): string { diff --git a/src/check/threads.ts b/src/check/threads.ts index 7a8eaf6..86ed3c2 100644 --- a/src/check/threads.ts +++ b/src/check/threads.ts @@ -3,9 +3,9 @@ // changed or went is removed (a thread never stands for a question it didn't show). import * as fs from 'fs' import * as path from 'path' -import { findCompact } from '../compact' -import { captureAnchor, type NoteData } from '../noteModel' -import type { Note } from '../store' +import { findCompact } from '../core/anchors/compact' +import { captureAnchor, type NoteData } from '../core/format/noteModel' +import type { Note } from '../notes/store' import { Attempt, Check, notDone, Question } from './types' import { gradeBody, missingMessages, questionBody, showsGrade } from './threadText' import { AUTHOR, SESSION } from './constants' diff --git a/src/check/viewModel.ts b/src/check/viewModel.ts index 0600ed4..9f8e781 100644 --- a/src/check/viewModel.ts +++ b/src/check/viewModel.ts @@ -1,12 +1,12 @@ // The Check view's model (what media/check.js and media/checkAnswer.js draw): where the check stands in the CLI's words, // the questions as rows, one button, the selected question's answer box, the tour; and the status bar item's text. // No vscode API here (unit-tested in test/checkModel.test.ts). -import { clock } from '../writing' +import { clock } from '../core/writing' import { concernOf, samePerson } from './concernState' import { SAY_IT_BACK, retryText } from './threadText' import { notDone } from './types' import type { Attempt, Kind, QState, Question, Range, Status, Who, Words } from './types' -import { baseName } from '../paths' +import { baseName } from '../core/paths' export const KIND_LABEL: Record = { how: 'How', why: 'Why', failure: 'Failure', edge: 'Edge case', change: 'Change' } diff --git a/src/check/wiring.ts b/src/check/wiring.ts index 384f4e0..cc7b227 100644 --- a/src/check/wiring.ts +++ b/src/check/wiring.ts @@ -6,15 +6,15 @@ import { byId, cfg, log, mapPanel, notes, now, provide, state, store, understand import { askAbout } from '../ask/run' import { claudeCli } from '../ask/settings' import { claudeAllowed } from '../ask/trust' -import { me } from '../identity' +import { me } from '../notes/identity' import { shape, shapeOf } from '../notes/changedOnDisk' import { newId } from '../notes/create' import { addReply } from '../notes/reply' import { focusReply, reveal } from '../notes/reveal' import { refreshAll } from '../refresh' -import { markRead, setSeen, unread } from '../seen' +import { markRead, setSeen, unread } from '../notes/seen' import { journeysTree } from '../sidebar/journeysTree' -import { Note } from '../store' +import { Note } from '../notes/store' import { noteOfThread, revealed } from '../threads/sync' import { currentTour, openCheckpoint, tourChanged } from '../tour/checkTour' import { walkJourney } from '../tour/commands' diff --git a/src/check/writer.ts b/src/check/writer.ts index 6bda93f..e8c4a84 100644 --- a/src/check/writer.ts +++ b/src/check/writer.ts @@ -5,9 +5,9 @@ import * as vscode from 'vscode' import * as fs from 'fs' import * as os from 'os' import * as path from 'path' -import { Ask, AskResult } from '../claude' -import { gitOut, statusPaths } from '../git' -import { clock } from '../writing' +import { Ask, AskResult } from '../platform/agent/claude' +import { gitOut, statusPaths } from '../platform/git' +import { clock } from '../core/writing' import { DEFAULT_MODEL_LABEL, ORPHAN_MAX_MS, SKILL, TICK_MS, WRITING_KEY } from './constants' import type { CheckController } from './controller' import { writeFailure } from './failures' diff --git a/src/chords.ts b/src/chords.ts index 971e9da..2f748b0 100644 --- a/src/chords.ts +++ b/src/chords.ts @@ -5,7 +5,7 @@ import { gstate, KEY, mapPanel, notes, PREFIX_KEY, setKey, understanding } from import { resolve } from './notes/status' import { stepUnread } from './notes/unread' import { pickNotes } from './notes/which' -import { unread } from './seen' +import { unread } from './notes/seen' import { checkStepping } from './check/wiring' import { walk } from './tour/instances' diff --git a/src/beats.ts b/src/codeLinks/beats.ts similarity index 94% rename from src/beats.ts rename to src/codeLinks/beats.ts index c33e5d5..bd0ee8d 100644 --- a/src/beats.ts +++ b/src/codeLinks/beats.ts @@ -1,11 +1,11 @@ import * as vscode from 'vscode' -import { setDecorations } from './decorations' -import { JBeat } from './journeyModel' -import { findLine } from './lineFollow' -import { TrackedLine, TrackedLines } from './followEdits' -import { showInCodeGroup, stepFileUri } from './journeys/codeGroup' -import { docLines } from './documents' -import { marksIn } from './marks/model' +import { setDecorations } from '../platform/decorations' +import { JBeat } from '../core/format/journeyModel' +import { findLine } from '../core/anchors/lineFollow' +import { TrackedLine, TrackedLines } from '../platform/followEdits' +import { showInCodeGroup, stepFileUri } from '../journeys/codeGroup' +import { docLines } from '../platform/documents' +import { marksIn } from '../marks/model' // A step's animation: the beat on screen lights the one line that does what it shows, nothing else // (values are the step's value hints: valueHints.ts). A beat with marks (tour/stepMarks.ts) leaves its line unboxed: diff --git a/src/claudeChatLinks.ts b/src/codeLinks/claudeChatLinks.ts similarity index 99% rename from src/claudeChatLinks.ts rename to src/codeLinks/claudeChatLinks.ts index d6372ae..08296d4 100644 --- a/src/claudeChatLinks.ts +++ b/src/codeLinks/claudeChatLinks.ts @@ -1,5 +1,5 @@ import * as vscode from 'vscode' -import { setDecorations } from './decorations' +import { setDecorations } from '../platform/decorations' // Links from a chat with Claude Code to code ("[names what it commits](src/check.ts#L812-L830)"): the lines they open // are lit the way a journey's code links are, with "← Back" above them to where the reader was. diff --git a/src/codeLinkClick.ts b/src/codeLinks/codeLinkClick.ts similarity index 93% rename from src/codeLinkClick.ts rename to src/codeLinks/codeLinkClick.ts index 5fd8afc..f1f8766 100644 --- a/src/codeLinkClick.ts +++ b/src/codeLinks/codeLinkClick.ts @@ -1,11 +1,11 @@ // A code link clicked in a step card or a check thread: its code lit (the keyboard stays where the click was), and the // way back to the step or the question. (codeLinks.ts lights the code; codeLinkText.ts marks the phrases.) -import { codeLinks } from './app' -import { docUri } from './notes/location' -import { cardLine, stepUri } from './tour/stepPlace' -import { card, tourState, walk } from './tour/instances' -import { backToQuestion, checkLinkNote } from './check/wiring' +import { codeLinks } from '../app' +import { docUri } from '../notes/location' +import { cardLine, stepUri } from '../tour/stepPlace' +import { card, tourState, walk } from '../tour/instances' +import { backToQuestion, checkLinkNote } from '../check/wiring' /** After a click on a step's link, the cursor moving there for this long is the link's doing, not the person reading. */ const LINK_CURSOR_MS = 1500 diff --git a/src/codeLinks.ts b/src/codeLinks/codeLinks.ts similarity index 97% rename from src/codeLinks.ts rename to src/codeLinks/codeLinks.ts index 2c02a9f..ca75997 100644 --- a/src/codeLinks.ts +++ b/src/codeLinks/codeLinks.ts @@ -1,10 +1,10 @@ import * as vscode from 'vscode' -import { setDecorations } from './decorations' -import { fileLines } from './documents' -import type { StepLink } from './journeyModel' -import { findLine } from './lineFollow' -import { TrackedLine, TrackedLines } from './followEdits' -import { showInCodeGroup, stepFileUri } from './journeys/codeGroup' +import { setDecorations } from '../platform/decorations' +import { fileLines } from '../platform/documents' +import type { StepLink } from '../core/format/journeyModel' +import { findLine } from '../core/anchors/lineFollow' +import { TrackedLine, TrackedLines } from '../platform/followEdits' +import { showInCodeGroup, stepFileUri } from '../journeys/codeGroup' // Code links: a click on a linked phrase of the step's card lights that phrase's lines and brings them // into view. Nothing is marked before a click (VS Code tells an extension nothing about hovering a link in a comment, diff --git a/src/valueHints.ts b/src/codeLinks/valueHints.ts similarity index 91% rename from src/valueHints.ts rename to src/codeLinks/valueHints.ts index bfa570b..28bce39 100644 --- a/src/valueHints.ts +++ b/src/codeLinks/valueHints.ts @@ -1,11 +1,11 @@ import * as vscode from 'vscode' -import { fileLines } from './documents' -import { findLine } from './lineFollow' -import { capValue } from './journeys/textFormat' -import { TrackedLine, TrackedLines } from './followEdits' -import { stepFileUri } from './journeys/codeGroup' -import type { ValueHint } from './journeyModel' -import { baseName } from './paths' +import { fileLines } from '../platform/documents' +import { findLine } from '../core/anchors/lineFollow' +import { capValue } from '../journeys/textFormat' +import { TrackedLine, TrackedLines } from '../platform/followEdits' +import { stepFileUri } from '../journeys/codeGroup' +import type { ValueHint } from '../core/format/journeyModel' +import { baseName } from '../core/paths' // Value hints: while a step is open, a faint line right above the code where a value is declared or used // says what it holds in the example run: `objs = [Secret run-…, Pod run-…]`. Like a debugger's inline values, but diff --git a/src/anchor.ts b/src/core/anchors/anchor.ts similarity index 98% rename from src/anchor.ts rename to src/core/anchors/anchor.ts index bcdb964..3eef6f3 100644 --- a/src/anchor.ts +++ b/src/core/anchors/anchor.ts @@ -54,7 +54,7 @@ const DISTINCT = 25 /** * Where the anchor text occurs now. A candidate needs matching context, unless the anchor is substantial (2+ * non-blank lines, or one long line) and occurs exactly once: a short line like `return null` elsewhere is not the - * same code, but a unique `import { a, b } from './x.js'` that moved on its own (import sorting) is. + * same code, but a unique `import { a, b } from '../../x.js'` that moved on its own (import sorting) is. */ export function relocate(lines: string[], anchor: string[], before: string[], after: string[], hint: number): number | undefined { if (!anchor.length || anchor.every(blank)) return undefined diff --git a/src/compact.ts b/src/core/anchors/compact.ts similarity index 100% rename from src/compact.ts rename to src/core/anchors/compact.ts diff --git a/src/lineFollow.ts b/src/core/anchors/lineFollow.ts similarity index 100% rename from src/lineFollow.ts rename to src/core/anchors/lineFollow.ts diff --git a/src/staleDiff.ts b/src/core/anchors/staleDiff.ts similarity index 100% rename from src/staleDiff.ts rename to src/core/anchors/staleDiff.ts diff --git a/src/coalesced.ts b/src/core/coalesced.ts similarity index 100% rename from src/coalesced.ts rename to src/core/coalesced.ts diff --git a/src/codeBlocks.ts b/src/core/codeBlocks.ts similarity index 100% rename from src/codeBlocks.ts rename to src/core/codeBlocks.ts diff --git a/src/codeLinkText.ts b/src/core/codeLinkText.ts similarity index 98% rename from src/codeLinkText.ts rename to src/core/codeLinkText.ts index 77ad974..556323d 100644 --- a/src/codeLinkText.ts +++ b/src/core/codeLinkText.ts @@ -1,6 +1,6 @@ // Code links: a phrase of a step's text that is a link to the lines doing what it says. Pure, unit-tested. What a link // is in the journey file (StepLink, readLinks) is journeyModel.ts. -import type { StepLink } from './journeyModel' +import type { StepLink } from './format/journeyModel' import { baseName } from './paths' /** A markdown link (`[text](target)`) or a code span: a phrase inside one is left alone. */ diff --git a/src/journeyModel.ts b/src/core/format/journeyModel.ts similarity index 100% rename from src/journeyModel.ts rename to src/core/format/journeyModel.ts diff --git a/src/noteModel.ts b/src/core/format/noteModel.ts similarity index 98% rename from src/noteModel.ts rename to src/core/format/noteModel.ts index 6eb3c6d..3b3129a 100644 --- a/src/noteModel.ts +++ b/src/core/format/noteModel.ts @@ -3,7 +3,7 @@ // files themselves is store.ts. The README written for agents beside the notes is media/notes-README.md (agentReadme). import * as fs from 'fs' import * as path from 'path' -import { isAbsolutePath, slashPath } from './paths' +import { isAbsolutePath, slashPath } from '../paths' export type Role = 'human' | 'agent' export interface Message { author: string; body: string; at?: string; role?: Role } @@ -213,7 +213,7 @@ export function parseNote(raw: string, id: string): NoteData | string { } /** media/notes-README.md: the README with `${person}` and `${folder}` where agentReadme puts them. */ -const README_TEMPLATE = path.join(__dirname, '..', '..', 'media', 'notes-README.md') +const README_TEMPLATE = path.join(__dirname, '..', '..', '..', '..', 'media', 'notes-README.md') let readme: string | undefined /** The README the extension writes into the notes folder (named `folder`): the note format, for agents, naming `person`. */ diff --git a/src/linkUri.ts b/src/core/linkUri.ts similarity index 100% rename from src/linkUri.ts rename to src/core/linkUri.ts diff --git a/src/linkifyAnswer.ts b/src/core/linkifyAnswer.ts similarity index 98% rename from src/linkifyAnswer.ts rename to src/core/linkifyAnswer.ts index 35d47db..66535f7 100644 --- a/src/linkifyAnswer.ts +++ b/src/core/linkifyAnswer.ts @@ -2,7 +2,7 @@ // "(…)" and lists; absolute paths are shown repo-relative (never the home folder). No vscode API here (unit-tested in // test/answerLinks.test.ts). -import { PATH } from './journeys/textFormat' +import { PATH } from '../journeys/textFormat' const esc = (s: string) => s.replace(/[.*+?^${}()|[\]\\]/g, '\\$&') diff --git a/src/journeyList.ts b/src/core/list/journeyList.ts similarity index 99% rename from src/journeyList.ts rename to src/core/list/journeyList.ts index 1624db4..fb9f24b 100644 --- a/src/journeyList.ts +++ b/src/core/list/journeyList.ts @@ -3,7 +3,7 @@ // No vscode API (the panel's tests load the compiled file as is): unit-tested in test/journeyList.test.ts. The search's // word matching is match.ts. import { matchScore, queryWords } from './match' -import { baseName } from './paths' +import { baseName } from '../paths' /** Only journeys are listed ('review': nothing makes one yet). 'check' is not listed: a check lives in the Check view. */ export type ListKind = 'journey' | 'check' | 'review' diff --git a/src/match.ts b/src/core/list/match.ts similarity index 100% rename from src/match.ts rename to src/core/list/match.ts diff --git a/src/panelWidth.ts b/src/core/panelWidth.ts similarity index 100% rename from src/panelWidth.ts rename to src/core/panelWidth.ts diff --git a/src/paths.ts b/src/core/paths.ts similarity index 100% rename from src/paths.ts rename to src/core/paths.ts diff --git a/src/text.ts b/src/core/text.ts similarity index 98% rename from src/text.ts rename to src/core/text.ts index 8ed0d0e..0c0b074 100644 --- a/src/text.ts +++ b/src/core/text.ts @@ -1,7 +1,7 @@ // Text as the lists, threads and messages show it: one line of markdown as plain text, a note's title and lines, // counts of things, ages, shortened questions. -import type { Note } from './store' +import type { Note } from '../notes/store' /** Links and images as their text: "[text](url)" -> "text". */ const stripLinks = (s: string) => s.replace(/!?\[([^\]]*)\]\([^)]*\)/g, '$1') diff --git a/src/writing.ts b/src/core/writing.ts similarity index 98% rename from src/writing.ts rename to src/core/writing.ts index 48afbb3..351db49 100644 --- a/src/writing.ts +++ b/src/core/writing.ts @@ -1,6 +1,6 @@ // Writing a journey with Claude: the prompt, the plain phase shown while it works, the clock. // No vscode API here (unit-tested in test/writing.test.ts). -import type { ToolCall } from './claude' +import type { ToolCall } from '../platform/agent/claude' /** "1:05" */ export function clock(ms: number): string { diff --git a/src/extension.ts b/src/extension.ts index 222b1a9..7b6f9ae 100644 --- a/src/extension.ts +++ b/src/extension.ts @@ -7,14 +7,14 @@ import { beats, cfg, claudeLinks, codeLinks, controller, extVersion, gstate, jou import { askClaudeCommand, cancelClaudeCommand } from './ask/commands' import { askStatusItem, createAskStatusItem, loadAskErrors } from './ask/run' import { watchClaudeCli } from './ask/settings' -import { Beats } from './beats' +import { Beats } from './codeLinks/beats' import { answerCheck, checkConcern, createUnderstanding, gradeCheck } from './check/wiring' import { next, prefixUsed, previous, resolveNext } from './chords' -import { ClaudeLinks } from './claudeChatLinks' -import { codeLinkBack, openCodeLink } from './codeLinkClick' -import { CodeLinks } from './codeLinks' -import { devReload } from './devReload' -import { initIdentity, me, rememberMe } from './identity' +import { ClaudeLinks } from './codeLinks/claudeChatLinks' +import { codeLinkBack, openCodeLink } from './codeLinks/codeLinkClick' +import { CodeLinks } from './codeLinks/codeLinks' +import { devReload } from './platform/devReload' +import { initIdentity, me, rememberMe } from './notes/identity' import { Journeys } from './journeys/journeys' import { MapPanel } from './journeys/mapPanel' import { openBroken, restoreBroken } from './notes/broken' @@ -36,11 +36,11 @@ import { undo } from './notes/undo' import { markAllRead, markUnread, stepUnread } from './notes/unread' import { pickNotes } from './notes/which' import { refreshAll } from './refresh' -import { markJourneysSeen, migrateSeen } from './seen' +import { markJourneysSeen, migrateSeen } from './notes/seen' import { createJourneysView, searchJourneys, journeysHereAll, sortJourneys } from './sidebar/journeysTree' import { groupByFile, groupBySession, hideResolvedNotes, loadGroupMode, pickFilter, showResolvedNotes } from './sidebar/notesFilter' import { createNotesView, rowsSelected, treeView } from './sidebar/notesTree' -import { Store } from './store' +import { Store } from './notes/store' import { testApi } from './testApi' import { collapseThread, expandThread } from './threads/comments' import { askStep, askUpdate } from './tour/askStep' @@ -51,8 +51,8 @@ import { registerRefPages } from './tour/refs' import { createCard, createTourItems, stepDetails, walk } from './tour/instances' import { podcasts } from './podcast/player' import { tutorial } from './tour/tutorial' -import { TutorialSpot } from './tutorialSpot' -import { ValueHints } from './valueHints' +import { TutorialSpot } from './tour/tutorialSpot' +import { ValueHints } from './codeLinks/valueHints' import { reloadAll, watchBranches, watchEditors, watchEdits, watchFiles, watchJourneys } from './watch' import { refreshJourney } from './write/refreshJourney' import { askQuestion, watchRequests } from './write/requests' diff --git a/src/journeys/codeGroup.ts b/src/journeys/codeGroup.ts index b70fd72..f0b99d4 100644 --- a/src/journeys/codeGroup.ts +++ b/src/journeys/codeGroup.ts @@ -1,5 +1,5 @@ import * as vscode from 'vscode' -import { ownSelection } from '../claudeChatLinks' +import { ownSelection } from '../codeLinks/claudeChatLinks' // A step's code in the editor group beside the panel (the code group): where a file a step names is now, and showing // it there. Used by code links (codeLinks.ts), the beat's line (beats.ts) and value hints (valueHints.ts). diff --git a/src/journeys/journeys.ts b/src/journeys/journeys.ts index 270c6fe..61faae5 100644 --- a/src/journeys/journeys.ts +++ b/src/journeys/journeys.ts @@ -1,10 +1,10 @@ import * as vscode from 'vscode' -import { wfs } from '../workspaceFs' -import { isOldFormat, parseJourney } from '../journeyModel' -import { folderName, folderSetting } from '../store' -import { jsonFilesIn, jsonName, readText, watchJsonFiles } from '../jsonFolder' +import { wfs } from '../platform/workspaceFs' +import { isOldFormat, parseJourney } from '../core/format/journeyModel' +import { folderName, folderSetting } from '../notes/store' +import { jsonFilesIn, jsonName, readText, watchJsonFiles } from '../platform/jsonFolder' import { LoadedJourney, carryPositions, posKey, writtenAt } from './steps' -import { pathIn, settingFolder } from '../paths' +import { pathIn, settingFolder } from '../core/paths' import { StepTracker } from './tracker' import { isPodcastFile } from '../podcast/model' diff --git a/src/journeys/mapPanel.ts b/src/journeys/mapPanel.ts index b5ae086..5e7c464 100644 --- a/src/journeys/mapPanel.ts +++ b/src/journeys/mapPanel.ts @@ -1,11 +1,11 @@ import * as vscode from 'vscode' -import type { ListKind, ListModel, Sort } from '../journeyList' +import type { ListKind, ListModel, Sort } from '../core/list/journeyList' import type { StepCard } from '../tour/card' import { escapeHtml, webviewPage } from '../webview/page' -import { fileName } from '../jsonFolder' +import { fileName } from '../platform/jsonFolder' import { LoadedJourney } from './steps' import { journeysFolderName } from './journeys' -import { folderName } from '../store' +import { folderName } from '../notes/store' // The journey panel: one journey's map and storyline (or the Journeys list) in a webview beside the editor, and the // messages between it and media/journey-map.js. @@ -367,7 +367,7 @@ export class MapPanel implements vscode.Disposable { inline: 'var exports = {}; var JourneyModel = exports', // In this order: each of media/ needs the ones before it (its header says which). scripts: [ - file('out', 'src', 'journeyModel.js'), file('out', 'vendor', 'elk.bundled.js'), + file('out', 'src', 'core', 'format', 'journeyModel.js'), file('out', 'vendor', 'elk.bundled.js'), ...[ 'common', 'journey-layout', 'journey-farnames', 'journey-graph', 'code-paint', 'journey-scene', 'journey-scene-app', 'journey-home', 'journey-splitter', 'journey-tutorial', 'journey-podcast', 'journey-map', diff --git a/src/journeys/steps.ts b/src/journeys/steps.ts index 1b8d94f..668ad97 100644 --- a/src/journeys/steps.ts +++ b/src/journeys/steps.ts @@ -1,9 +1,9 @@ import type * as vscode from 'vscode' -import type { Journey, JStep } from '../journeyModel' -import { anchor } from '../anchor' -import { staleKind } from '../staleDiff' -import { AnyAnchor, compactOf, findCompact, isCompact, toCompact } from '../compact' -import { captureAnchor } from '../noteModel' +import type { Journey, JStep } from '../core/format/journeyModel' +import { anchor } from '../core/anchors/anchor' +import { staleKind } from '../core/anchors/staleDiff' +import { AnyAnchor, compactOf, findCompact, isCompact, toCompact } from '../core/anchors/compact' +import { captureAnchor } from '../core/format/noteModel' // A loaded journey and where its steps' code is now. No vscode API at run time (unit-tested in test/journeySteps.test.ts): // the tracker (tracker.ts) reads the files and keeps state; these say where a step is in the lines it got. diff --git a/src/journeys/tracker.ts b/src/journeys/tracker.ts index c0260a1..aceb392 100644 --- a/src/journeys/tracker.ts +++ b/src/journeys/tracker.ts @@ -1,13 +1,13 @@ import * as vscode from 'vscode' -import { fileLines, docLines } from '../documents' -import { JStep } from '../journeyModel' -import { Loc } from '../anchor' -import { LineEdit, shift, swallows } from '../lineFollow' -import { lineEdits } from '../followEdits' -import { AnyAnchor, CompactAnchor, Found, compactOf, findCompact, toCompact } from '../compact' -import { GitRenameCache } from '../gitRenames' -import { dirPath, pathIn } from '../paths' -import { Kept } from '../memento' +import { fileLines, docLines } from '../platform/documents' +import { JStep } from '../core/format/journeyModel' +import { Loc } from '../core/anchors/anchor' +import { LineEdit, shift, swallows } from '../core/anchors/lineFollow' +import { lineEdits } from '../platform/followEdits' +import { AnyAnchor, CompactAnchor, Found, compactOf, findCompact, toCompact } from '../core/anchors/compact' +import { GitRenameCache } from '../platform/gitRenames' +import { dirPath, pathIn } from '../core/paths' +import { Kept } from '../platform/memento' import { LoadedJourney, StepAt, atOf, captureStepAnchor, fileOf, isEmptyAnchor, placeStep, sameStepAt, stepOf, } from './steps' diff --git a/src/marks/lights.ts b/src/marks/lights.ts index 965a121..1127154 100644 --- a/src/marks/lights.ts +++ b/src/marks/lights.ts @@ -4,8 +4,8 @@ // is the one coloured thing on the code (codeNotes.markBackground); the marks before it a lighter, grey tint. import * as vscode from 'vscode' -import { setDecorations } from '../decorations' -import { docLines } from '../documents' +import { setDecorations } from '../platform/decorations' +import { docLines } from '../platform/documents' import { CodeMark, findMark, MarkSpot } from './model' /** What is lit in one document: ranges within lines, and whole lines, in each style. */ diff --git a/src/notes/broken.ts b/src/notes/broken.ts index 05aac83..8fdb121 100644 --- a/src/notes/broken.ts +++ b/src/notes/broken.ts @@ -3,9 +3,9 @@ import * as vscode from 'vscode' import { store } from '../app' -import { serialize } from '../noteModel' +import { serialize } from '../core/format/noteModel' import { Node } from '../sidebar/nodes' -import { wfs } from '../workspaceFs' +import { wfs } from '../platform/workspaceFs' /** Where in the file the problem `why` (store.ts's words) is: a field's name, the end (bad JSON), or the top. */ function problemAt(doc: vscode.TextDocument, why: string): vscode.Position { diff --git a/src/notes/changedOnDisk.ts b/src/notes/changedOnDisk.ts index 5b469c1..db33dae 100644 --- a/src/notes/changedOnDisk.ts +++ b/src/notes/changedOnDisk.ts @@ -2,11 +2,11 @@ // recorded, then everything refreshed and the notes re-anchored. import { log, notes, store } from '../app' -import { isAgent, mine } from '../identity' -import { Message, NoteEvent } from '../noteModel' +import { isAgent, mine } from './identity' +import { Message, NoteEvent } from '../core/format/noteModel' import { refreshAll } from '../refresh' import { lastMessage } from '../sidebar/nodes' -import { Note } from '../store' +import { Note } from './store' import { card, tourState, walk } from '../tour/instances' import { reanchorAll } from './location' import { addEvent, statusEvent } from './status' diff --git a/src/notes/create.ts b/src/notes/create.ts index 9010391..93b5e00 100644 --- a/src/notes/create.ts +++ b/src/notes/create.ts @@ -1,18 +1,18 @@ // New notes: on lines (the editor's comment box, or a one-line box), on a whole file or folder. import * as vscode from 'vscode' -import { Loc } from '../anchor' +import { Loc } from '../core/anchors/anchor' import { KEY, log, now, showError, store } from '../app' import { askClaude } from '../ask/run' import { askAlways, askOnQuestion } from '../ask/settings' -import { me } from '../identity' +import { me } from './identity' import { refreshAll } from '../refresh' -import { setSeen } from '../seen' -import { captureAnchor, NoteData } from '../noteModel' -import { folderName, Note } from '../store' +import { setSeen } from './seen' +import { captureAnchor, NoteData } from '../core/format/noteModel' +import { folderName, Note } from './store' import { anchorAt, inNotesFolder, otherAnchor, rangeLines, relPath, selectedLines } from './location' -import { diskLines, docLines } from '../documents' -import { wfs } from '../workspaceFs' +import { diskLines, docLines } from '../platform/documents' +import { wfs } from '../platform/workspaceFs' import { shape, shapeOf } from './changedOnDisk' import { allowComments } from './commentRanges' import { reveal } from './reveal' diff --git a/src/notes/decorations.ts b/src/notes/decorations.ts index 338d6f3..3ce1296 100644 --- a/src/notes/decorations.ts +++ b/src/notes/decorations.ts @@ -1,12 +1,12 @@ // How notes mark their lines in the editor: a bar for open and stale notes, the exact text a note is about, unread -// in the scrollbar. (src/decorations.ts sends each editor's decorations; the step card draws its own: tour/card.ts.) +// in the scrollbar. (src/platform/decorations.ts sends each editor's decorations; the step card draws its own: tour/card.ts.) import * as vscode from 'vscode' import { cfg } from '../app' -import { setDecorations } from '../decorations' -import { unread } from '../seen' +import { setDecorations } from '../platform/decorations' +import { unread } from './seen' import { hiddenInEditor } from '../sidebar/notesFilter' -import { Note } from '../store' +import { Note } from './store' import { card } from '../tour/instances' import { lineNotesFor } from './location' diff --git a/src/notes/find.ts b/src/notes/find.ts index 2c214c0..b567b3d 100644 --- a/src/notes/find.ts +++ b/src/notes/find.ts @@ -2,13 +2,13 @@ import * as vscode from 'vscode' import { notes } from '../app' -import { unread } from '../seen' +import { unread } from './seen' import { lastMessage, order } from '../sidebar/nodes' -import { Note } from '../store' -import { noteTitle, plain } from '../text' +import { Note } from './store' +import { noteTitle, plain } from '../core/text' import { reveal } from './reveal' -import { pickOne } from '../quickPick' -import { baseName } from '../paths' +import { pickOne } from '../platform/quickPick' +import { baseName } from '../core/paths' /** What a note's words are searched in: its file, session, and every message's author and text. */ const haystack = (n: Note) => [n.data.file, n.data.session ?? '', ...n.data.messages.flatMap((m) => [m.author, m.body])].join('\n').toLowerCase() diff --git a/src/notes/folder.ts b/src/notes/folder.ts index 3ef21ab..e76e043 100644 --- a/src/notes/folder.ts +++ b/src/notes/folder.ts @@ -4,10 +4,10 @@ import * as vscode from 'vscode' import { cfg, gstate, journeys, notes, showError, store } from '../app' import { refreshAll } from '../refresh' import { treeView } from '../sidebar/notesTree' -import { folderProblem } from '../noteModel' -import { DEFAULT_FOLDER, folderName } from '../store' -import { plural } from '../text' -import { wfs } from '../workspaceFs' +import { folderProblem } from '../core/format/noteModel' +import { DEFAULT_FOLDER, folderName } from './store' +import { plural } from '../core/text' +import { wfs } from '../platform/workspaceFs' /** The notes folder as last set (a change offers to move the notes). */ let currentFolder = DEFAULT_FOLDER diff --git a/src/identity.ts b/src/notes/identity.ts similarity index 94% rename from src/identity.ts rename to src/notes/identity.ts index 4a0c80a..75adee0 100644 --- a/src/identity.ts +++ b/src/notes/identity.ts @@ -3,9 +3,9 @@ import * as vscode from 'vscode' import * as os from 'os' -import { cfg, state } from './app' -import { git } from './checkout' -import { Message, NoteEvent } from './noteModel' +import { cfg, state } from '../app' +import { git } from '../platform/checkout' +import { Message, NoteEvent } from '../core/format/noteModel' import { Note } from './store' let gitName: string | undefined diff --git a/src/notes/location.ts b/src/notes/location.ts index 154835b..188f414 100644 --- a/src/notes/location.ts +++ b/src/notes/location.ts @@ -2,14 +2,14 @@ // the small helpers about workspace paths and a document's lines that go with that. import * as vscode from 'vscode' -import { anchor, Loc } from '../anchor' +import { anchor, Loc } from '../core/anchors/anchor' import { log, notes, store } from '../app' -import { commitInfo, otherBranch } from '../checkout' +import { commitInfo, otherBranch } from '../platform/checkout' import { refreshAll } from '../refresh' -import { captureAnchor, NoteData } from '../noteModel' -import { folderName, Note } from '../store' -import { diskLines, docLines } from '../documents' -import { wfs } from '../workspaceFs' +import { captureAnchor, NoteData } from '../core/format/noteModel' +import { folderName, Note } from './store' +import { diskLines, docLines } from '../platform/documents' +import { wfs } from '../platform/workspaceFs' import { folderPage } from './pages' type Anchor = NoteData['anchor'] diff --git a/src/notes/move.ts b/src/notes/move.ts index f3bf18d..4cc27f8 100644 --- a/src/notes/move.ts +++ b/src/notes/move.ts @@ -3,10 +3,10 @@ import * as vscode from 'vscode' import { byId, setCtx, store } from '../app' import { refreshAll } from '../refresh' -import { Note } from '../store' -import { noteTitle, rangeLabel } from '../text' +import { Note } from './store' +import { noteTitle, rangeLabel } from '../core/text' import { anchorAt, docUri, markPlaced, missing, pastEnd, reanchorAll, relPath, saveIfClean, selectedLines, toLoc, withinLines } from './location' -import { docLines } from '../documents' +import { docLines } from '../platform/documents' import { partialSelection } from './create' import { offerUndo, snapshot } from './undo' import { notesFrom } from './which' diff --git a/src/notes/pages.ts b/src/notes/pages.ts index 448ad5a..5d463c9 100644 --- a/src/notes/pages.ts +++ b/src/notes/pages.ts @@ -3,10 +3,10 @@ import * as vscode from 'vscode' import { byId } from '../app' -import { Note } from '../store' -import { plain, rangeLabel } from '../text' -import { wfs } from '../workspaceFs' -import { baseName } from '../paths' +import { Note } from './store' +import { plain, rangeLabel } from '../core/text' +import { wfs } from '../platform/workspaceFs' +import { baseName } from '../core/paths' /** A folder note's thread lives on a read-only page about the folder (there is no document to put it on). */ const FOLDER_SCHEME = 'code-notes-folder' diff --git a/src/notes/prompt.ts b/src/notes/prompt.ts index cc28f09..0281386 100644 --- a/src/notes/prompt.ts +++ b/src/notes/prompt.ts @@ -3,12 +3,12 @@ import * as vscode from 'vscode' import { byId, log, notes } from '../app' -import { me, waitingForAgent } from '../identity' +import { me, waitingForAgent } from './identity' import { checked } from '../sidebar/notesFilter' -import { folderName, Note } from '../store' -import { plural, rangeLabel } from '../text' +import { folderName, Note } from './store' +import { plural, rangeLabel } from '../core/text' import { notesFrom } from './which' -import { fileName } from '../jsonFolder' +import { fileName } from '../platform/jsonFolder' /** The prompt's words; `dir`: the notes folder. No frozen timestamp: a prompt pasted an hour later must not date replies in the past. */ const PROMPT = { diff --git a/src/notes/reply.ts b/src/notes/reply.ts index 13e79ad..23ccef0 100644 --- a/src/notes/reply.ts +++ b/src/notes/reply.ts @@ -5,11 +5,11 @@ import * as vscode from 'vscode' import { log, now, store } from '../app' import { askClaude } from '../ask/run' import { askAlways } from '../ask/settings' -import { me } from '../identity' +import { me } from './identity' import { refreshAll } from '../refresh' -import { markRead } from '../seen' -import { Note } from '../store' -import { noteTitle } from '../text' +import { markRead } from './seen' +import { Note } from './store' +import { noteTitle } from '../core/text' import { noteOfThread, revealed, syncThread } from '../threads/sync' import { shape, shapeOf } from './changedOnDisk' import { addEvent, setStatus, statusEvent, undoResolveEvent } from './status' diff --git a/src/notes/reveal.ts b/src/notes/reveal.ts index 2f084c7..6912875 100644 --- a/src/notes/reveal.ts +++ b/src/notes/reveal.ts @@ -3,19 +3,19 @@ import * as vscode from 'vscode' import { byId, log, mapPanel, showError } from '../app' -import { ownSelection } from '../claudeChatLinks' -import { markRead, visitFrom } from '../seen' +import { ownSelection } from '../codeLinks/claudeChatLinks' +import { markRead, visitFrom } from './seen' import { journeyOfNote } from '../sidebar/journeyRows' import { Node, noteNode } from '../sidebar/nodes' import { matchesFilter } from '../sidebar/notesFilter' import { tree, treeView } from '../sidebar/notesTree' -import { Note } from '../store' +import { Note } from './store' import { threadRange } from '../threads/comments' import { editorSettling, editorShownAt, setCollapse, settling } from '../threads/settle' import { expandWhenMade, revealed, syncThread, threads } from '../threads/sync' import { openRef } from '../tour/refs' import { walk } from '../tour/instances' -import { wfs } from '../workspaceFs' +import { wfs } from '../platform/workspaceFs' import { rangesAskedAt, waitUntil } from './commentRanges' import { clampLines, docUri, missing, notesFor } from './location' import { startMove } from './move' diff --git a/src/seen.ts b/src/notes/seen.ts similarity index 97% rename from src/seen.ts rename to src/notes/seen.ts index a2137d2..2a21181 100644 --- a/src/seen.ts +++ b/src/notes/seen.ts @@ -1,10 +1,10 @@ // What the person has read: per note, how many of its messages and status changes they have seen; per journey, whether // it was there when they last looked. Kept in the workspace state, out of the shared note and journey files. -import { journeys, notes, state } from './app' +import { journeys, notes, state } from '../app' import { evMine, mine } from './identity' -import { LoadedJourney, posKey } from './journeys/steps' -import { refreshAll } from './refresh' +import { LoadedJourney, posKey } from '../journeys/steps' +import { refreshAll } from '../refresh' import { Note } from './store' const SEEN_KEY = 'codeNotes.seenCount' // note id -> how many of its messages the person has seen diff --git a/src/notes/sessions.ts b/src/notes/sessions.ts index 3af91d4..3eec76a 100644 --- a/src/notes/sessions.ts +++ b/src/notes/sessions.ts @@ -5,7 +5,7 @@ import { notes, state } from '../app' import { refreshAll } from '../refresh' import { Node, sessionOf } from '../sidebar/nodes' import { HIDDEN_KEY, hiddenSessions, setSessionHidden } from '../sidebar/notesFilter' -import { folderName } from '../store' +import { folderName } from './store' import { resolve, trash } from './status' /** The session a command is about: its row's, the only one, or the one picked ('' is the notes without a session). */ diff --git a/src/notes/status.ts b/src/notes/status.ts index bb6f760..15c33ca 100644 --- a/src/notes/status.ts +++ b/src/notes/status.ts @@ -2,14 +2,14 @@ import * as vscode from 'vscode' import { byId, notes, now, store } from '../app' -import { evMine, me } from '../identity' +import { evMine, me } from './identity' import { refreshAll } from '../refresh' -import { markRead, seenCount, setSeen, unread } from '../seen' +import { markRead, seenCount, setSeen, unread } from './seen' import { checked, matchesFilter } from '../sidebar/notesFilter' import { treeView } from '../sidebar/notesTree' -import { NoteEvent } from '../noteModel' -import { folderName, Note } from '../store' -import { describeNotes, noteTitle, plural } from '../text' +import { NoteEvent } from '../core/format/noteModel' +import { folderName, Note } from './store' +import { describeNotes, noteTitle, plural } from '../core/text' import { revealed } from '../threads/sync' import { shape, shapeOf } from './changedOnDisk' import { offerUndo, snapshot } from './undo' diff --git a/src/store.ts b/src/notes/store.ts similarity index 98% rename from src/store.ts rename to src/notes/store.ts index f536c73..73f3563 100644 --- a/src/store.ts +++ b/src/notes/store.ts @@ -1,11 +1,11 @@ import * as vscode from 'vscode' -import { wfs } from './workspaceFs' +import { wfs } from '../platform/workspaceFs' import * as fs from 'fs' import * as path from 'path' -import { placeFile, settingFolder } from './paths' -import { fileName, jsonFilesIn, jsonName, readText, watchJsonFiles } from './jsonFolder' -import { NoteData, agentReadme, folderProblem, merge, parseNote, serialize, titleOf } from './noteModel' -import { SaveFailures } from './saveFailures' +import { placeFile, settingFolder } from '../core/paths' +import { fileName, jsonFilesIn, jsonName, readText, watchJsonFiles } from '../platform/jsonFolder' +import { NoteData, agentReadme, folderProblem, merge, parseNote, serialize, titleOf } from '../core/format/noteModel' +import { SaveFailures } from '../platform/saveFailures' // One JSON file per note in //.json. One file per note so an agent and // the extension never overwrite each other's notes. A note IS its file: the file name is its identity (an "id" diff --git a/src/notes/suggestion.ts b/src/notes/suggestion.ts index 200f7e6..c08ce01 100644 --- a/src/notes/suggestion.ts +++ b/src/notes/suggestion.ts @@ -4,9 +4,9 @@ import * as vscode from 'vscode' import { byId, showError, understanding } from '../app' import { refreshAll } from '../refresh' import { anchorAt, docUri, missing, noAnchor, otherAnchor, pastEnd } from './location' -import { rangeLabel } from '../text' +import { rangeLabel } from '../core/text' import { suggestionOf } from '../threads/comments' -import { docLines } from '../documents' +import { docLines } from '../platform/documents' /** Apply on an agent's ```suggestion block: replaces the note's lines; the editor's Undo takes it back. */ export async function applySuggestion(id: string, mi: number, k: number): Promise { diff --git a/src/notes/undo.ts b/src/notes/undo.ts index 4c0925d..f159aa7 100644 --- a/src/notes/undo.ts +++ b/src/notes/undo.ts @@ -3,8 +3,8 @@ import * as vscode from 'vscode' import { setCtx } from '../app' -import { NoteData } from '../noteModel' -import { Note } from '../store' +import { NoteData } from '../core/format/noteModel' +import { Note } from './store' /** The last undoable action: the toast's Undo, and "Code Notes: Undo" after the toast is gone. */ let lastUndo: { what: string; run: () => Promise } | undefined diff --git a/src/notes/unread.ts b/src/notes/unread.ts index 06ac27e..dd6eeb7 100644 --- a/src/notes/unread.ts +++ b/src/notes/unread.ts @@ -2,12 +2,12 @@ import * as vscode from 'vscode' import { firstFolder, mapPanel, notes } from '../app' -import { mine } from '../identity' -import { markRead, restoreSeen, seenSnapshot, setSeen, unread, visitFrom } from '../seen' +import { mine } from './identity' +import { markRead, restoreSeen, seenSnapshot, setSeen, unread, visitFrom } from './seen' import { order, sessionOf } from '../sidebar/nodes' import { hiddenSessions } from '../sidebar/notesFilter' -import { Note } from '../store' -import { plural } from '../text' +import { Note } from './store' +import { plural } from '../core/text' import { revealed } from '../threads/sync' import { refreshAll } from '../refresh' import { notesFor, relPath } from './location' diff --git a/src/notes/which.ts b/src/notes/which.ts index 0293e94..70329b2 100644 --- a/src/notes/which.ts +++ b/src/notes/which.ts @@ -3,8 +3,8 @@ import * as vscode from 'vscode' import { byId } from '../app' import { Node, order } from '../sidebar/nodes' -import { Note } from '../store' -import { noteTitle, rangeLabel } from '../text' +import { Note } from './store' +import { noteTitle, rangeLabel } from '../core/text' import { notesAtLine } from './location' import { noteOfThread, revealed } from '../threads/sync' diff --git a/src/claude.ts b/src/platform/agent/claude.ts similarity index 100% rename from src/claude.ts rename to src/platform/agent/claude.ts diff --git a/src/claudeCli.ts b/src/platform/agent/claudeCli.ts similarity index 100% rename from src/claudeCli.ts rename to src/platform/agent/claudeCli.ts diff --git a/src/checkout.ts b/src/platform/checkout.ts similarity index 97% rename from src/checkout.ts rename to src/platform/checkout.ts index d004500..084c7bb 100644 --- a/src/checkout.ts +++ b/src/platform/checkout.ts @@ -3,7 +3,7 @@ import * as vscode from 'vscode' import { gitOut } from './git' -import { Note } from './store' +import { Note } from '../notes/store' /** Identity and branch reads are quick: a git that hangs longer than this is given up. */ const QUICK_GIT_TIMEOUT_MS = 3000 diff --git a/src/decorations.ts b/src/platform/decorations.ts similarity index 100% rename from src/decorations.ts rename to src/platform/decorations.ts diff --git a/src/devReload.ts b/src/platform/devReload.ts similarity index 100% rename from src/devReload.ts rename to src/platform/devReload.ts diff --git a/src/documents.ts b/src/platform/documents.ts similarity index 100% rename from src/documents.ts rename to src/platform/documents.ts diff --git a/src/followEdits.ts b/src/platform/followEdits.ts similarity index 98% rename from src/followEdits.ts rename to src/platform/followEdits.ts index 82aa977..53dea24 100644 --- a/src/followEdits.ts +++ b/src/platform/followEdits.ts @@ -1,5 +1,5 @@ import * as vscode from 'vscode' -import { LineEdit, followLine, shiftLine } from './lineFollow' +import { LineEdit, followLine, shiftLine } from '../core/anchors/lineFollow' import { docLines } from './documents' // Lines remembered by text (a beat's line, a code link's lines, value hints) follow edits to their file in two moves: diff --git a/src/git.ts b/src/platform/git.ts similarity index 100% rename from src/git.ts rename to src/platform/git.ts diff --git a/src/gitRenames.ts b/src/platform/gitRenames.ts similarity index 100% rename from src/gitRenames.ts rename to src/platform/gitRenames.ts diff --git a/src/jsonFolder.ts b/src/platform/jsonFolder.ts similarity index 98% rename from src/jsonFolder.ts rename to src/platform/jsonFolder.ts index b1212b2..7440179 100644 --- a/src/jsonFolder.ts +++ b/src/platform/jsonFolder.ts @@ -1,6 +1,6 @@ import * as vscode from 'vscode' import { wfs } from './workspaceFs' -import { baseName } from './paths' +import { baseName } from '../core/paths' // Folders of JSON files the extension reads one file per item from (notes, journeys): watched for changes, read once // at load, and what a file's name says. diff --git a/src/memento.ts b/src/platform/memento.ts similarity index 100% rename from src/memento.ts rename to src/platform/memento.ts diff --git a/src/quickPick.ts b/src/platform/quickPick.ts similarity index 100% rename from src/quickPick.ts rename to src/platform/quickPick.ts diff --git a/src/saveFailures.ts b/src/platform/saveFailures.ts similarity index 100% rename from src/saveFailures.ts rename to src/platform/saveFailures.ts diff --git a/src/symbolBlocks.ts b/src/platform/symbolBlocks.ts similarity index 99% rename from src/symbolBlocks.ts rename to src/platform/symbolBlocks.ts index 4d9854e..3e9993b 100644 --- a/src/symbolBlocks.ts +++ b/src/platform/symbolBlocks.ts @@ -2,7 +2,7 @@ // part), cached per document version. Used by the code lenses and the Journeys view's "In this file" ranking. import * as vscode from 'vscode' -import { Block, blocksFromSymbols, blocksFromText, Sym } from './codeBlocks' +import { Block, blocksFromSymbols, blocksFromText, Sym } from '../core/codeBlocks' import { docLines } from './documents' /** The blocks per document. Symbols not ready yet (a language server still starting) are not kept for long: the diff --git a/src/workspaceFs.ts b/src/platform/workspaceFs.ts similarity index 100% rename from src/workspaceFs.ts rename to src/platform/workspaceFs.ts diff --git a/src/podcast/listenView.ts b/src/podcast/listenView.ts index df97e9a..10b195b 100644 --- a/src/podcast/listenView.ts +++ b/src/podcast/listenView.ts @@ -11,7 +11,7 @@ import * as vscode from 'vscode' import { webviewPage } from '../webview/page' import { journeysFolderName } from '../journeys/journeys' -import { folderName } from '../store' +import { folderName } from '../notes/store' import { setCtx } from '../app' export const LISTEN_VIEW = 'codeNotes.listen' diff --git a/src/podcast/load.ts b/src/podcast/load.ts index c072d2a..b80f1fb 100644 --- a/src/podcast/load.ts +++ b/src/podcast/load.ts @@ -7,10 +7,10 @@ import * as vscode from 'vscode' import { journeys, log } from '../app' import { stepFileUri } from '../journeys/codeGroup' -import { git } from '../checkout' +import { git } from '../platform/checkout' import { fileOf, LoadedJourney } from '../journeys/steps' -import { readText } from '../jsonFolder' -import { wfs } from '../workspaceFs' +import { readText } from '../platform/jsonFolder' +import { wfs } from '../platform/workspaceFs' import { isPodcastFile, podcastFileOf, PodcastProblem } from './model' import { audioPathProblem, lineCol, locate, markFileNames, validatePodcast, Validation } from './validate' diff --git a/src/podcast/player.ts b/src/podcast/player.ts index dec9ff3..785e302 100644 --- a/src/podcast/player.ts +++ b/src/podcast/player.ts @@ -31,7 +31,7 @@ import { calmViews, clock, Episode, LatestWins, markTimes, planMarks, podcastFil import { MarkLights, PlannedMark } from './marks' import { Camera, CUE_LEAD_S, cueText } from './camera' import { showInCodeGroup, stepFileUri } from '../journeys/codeGroup' -import { baseName } from '../paths' +import { baseName } from '../core/paths' import { podcastReports, PodcastRead, readPodcast, strayPodcasts } from './load' import { afterStep, remapTime, resumeTime } from './resume' import { brokenLinks, playNotice } from './validate' diff --git a/src/refresh.ts b/src/refresh.ts index c938d04..e54082c 100644 --- a/src/refresh.ts +++ b/src/refresh.ts @@ -5,11 +5,11 @@ import { journeys, notes, setCtx, store, understanding } from './app' import { refreshAskStatus } from './ask/run' import { refreshDecorations } from './notes/decorations' import { notesAtLine } from './notes/location' -import { unread } from './seen' +import { unread } from './notes/seen' import { sessionOf } from './sidebar/nodes' import { checked, filter, FILTERS, groupMode, hiddenSessions, matchesFilter } from './sidebar/notesFilter' import { tree, treeView } from './sidebar/notesTree' -import { plural } from './text' +import { plural } from './core/text' import { syncThreads } from './threads/sync' import { walk } from './tour/instances' diff --git a/src/sidebar/journeyRows.ts b/src/sidebar/journeyRows.ts index 6c1a2cb..ff2a9ae 100644 --- a/src/sidebar/journeyRows.ts +++ b/src/sidebar/journeyRows.ts @@ -3,12 +3,12 @@ import * as vscode from 'vscode' import { gstate, journeys, notes } from '../app' -import { mine } from '../identity' -import { ListModel } from '../journeyList' +import { mine } from '../notes/identity' +import { ListModel } from '../core/list/journeyList' import { LoadedJourney } from '../journeys/steps' -import { isNewJourney, unread } from '../seen' -import { Note } from '../store' -import { isolate, plural } from '../text' +import { isNewJourney, unread } from '../notes/seen' +import { Note } from '../notes/store' +import { isolate, plural } from '../core/text' import { isUpdateRequest } from '../tour/askStep' import { provenance } from '../tour/provenance' import { tourState, walk } from '../tour/instances' @@ -17,7 +17,7 @@ import { journeysTree, journeysView } from './journeysTree' import { activeRel, listModel, listState, staleCount, staleLine } from './listModel' import { badJourneyNodes, cached, jgroupNode, journeyNode, journeyRowNode, Node, noteNode, order } from './nodes' import { matchesFilter } from './notesFilter' -import { fileName } from '../jsonFolder' +import { fileName } from '../platform/jsonFolder' import { podcasts } from '../podcast/player' import { clock } from '../podcast/model' diff --git a/src/sidebar/journeysTree.ts b/src/sidebar/journeysTree.ts index c96f56c..f834002 100644 --- a/src/sidebar/journeysTree.ts +++ b/src/sidebar/journeysTree.ts @@ -3,8 +3,8 @@ import * as vscode from 'vscode' import { journeys, mapPanel, state } from '../app' -import { Group, SORTS } from '../journeyList' -import { pickOne } from '../quickPick' +import { Group, SORTS } from '../core/list/journeyList' +import { pickOne } from '../platform/quickPick' import { walkJourney } from '../tour/commands' import { badJourneyNodes, jgroupNode, jmoreNode, journeyRowNode, Node } from './nodes' import { journeyQuestionRows, questionRows, revealHereGroup } from './journeyRows' diff --git a/src/sidebar/listModel.ts b/src/sidebar/listModel.ts index 3d448da..aed251a 100644 --- a/src/sidebar/listModel.ts +++ b/src/sidebar/listModel.ts @@ -3,11 +3,11 @@ import * as vscode from 'vscode' import { journeys, state } from '../app' -import { blockAt } from '../codeBlocks' -import { blocksOf } from '../symbolBlocks' -import { buildList, ListItem, ListKind, ListModel, Sort } from '../journeyList' +import { blockAt } from '../core/codeBlocks' +import { blocksOf } from '../platform/symbolBlocks' +import { buildList, ListItem, ListKind, ListModel, Sort } from '../core/list/journeyList' import { LoadedJourney, posKey } from '../journeys/steps' -import { isNewJourney } from '../seen' +import { isNewJourney } from '../notes/seen' import { relPath } from '../notes/location' import { tourState, walk } from '../tour/instances' import { refreshing } from '../write/refreshJourney' diff --git a/src/sidebar/nodes.ts b/src/sidebar/nodes.ts index cd9c003..6c198b3 100644 --- a/src/sidebar/nodes.ts +++ b/src/sidebar/nodes.ts @@ -3,10 +3,10 @@ import * as vscode from 'vscode' import { journeys, notes } from '../app' -import { Group } from '../journeyList' +import { Group } from '../core/list/journeyList' import { LoadedJourney } from '../journeys/steps' -import { Severity } from '../noteModel' -import { Note } from '../store' +import { Severity } from '../core/format/noteModel' +import { Note } from '../notes/store' import { matchesFilter } from './notesFilter' export type Node = diff --git a/src/sidebar/notesFilter.ts b/src/sidebar/notesFilter.ts index fc03748..3758873 100644 --- a/src/sidebar/notesFilter.ts +++ b/src/sidebar/notesFilter.ts @@ -4,8 +4,8 @@ import * as vscode from 'vscode' import { byId, notes, setCtx, state, understanding } from '../app' import { refreshAll } from '../refresh' -import { unread } from '../seen' -import { Note } from '../store' +import { unread } from '../notes/seen' +import { Note } from '../notes/store' import { setCollapse } from '../threads/settle' import { revealed, threads } from '../threads/sync' import { journeyOfNote } from './journeyRows' diff --git a/src/sidebar/notesTree.ts b/src/sidebar/notesTree.ts index edcf500..f4a61cb 100644 --- a/src/sidebar/notesTree.ts +++ b/src/sidebar/notesTree.ts @@ -2,8 +2,8 @@ import * as vscode from 'vscode' import { notes, setCtx, store } from '../app' -import { unread } from '../seen' -import { Note } from '../store' +import { unread } from '../notes/seen' +import { Note } from '../notes/store' import { journeyOfNote, journeyQuestionRows, journeyRows, questionRows } from './journeyRows' import { journeysTree } from './journeysTree' import { fileNode, Node, noteNode, rowOrder, sessionNode, sessionOf } from './nodes' diff --git a/src/sidebar/rowItems.ts b/src/sidebar/rowItems.ts index eb666a2..8946e58 100644 --- a/src/sidebar/rowItems.ts +++ b/src/sidebar/rowItems.ts @@ -4,17 +4,17 @@ import * as vscode from 'vscode' import { notes, store } from '../app' import { askErrors, asking } from '../ask/run' -import { mine } from '../identity' -import { unread } from '../seen' -import { Note } from '../store' -import { ago, isolate, plain, plural, rangeLabel } from '../text' +import { mine } from '../notes/identity' +import { unread } from '../notes/seen' +import { Note } from '../notes/store' +import { ago, isolate, plain, plural, rangeLabel } from '../core/text' import { missing } from '../notes/location' import { tourState, walk } from '../tour/instances' import { badJourneyItem, journeyItem, journeyOfNote, questionsItem, showIntro, stepLinkOf } from './journeyRows' import { listState } from './listModel' import { lastMessage, Node, sessionOf, SEV_ICON } from './nodes' import { hiddenSessions, ownRow } from './notesFilter' -import { baseName } from '../paths' +import { baseName } from '../core/paths' /** The row of each kind of node. */ const ITEMS: { [K in Node['kind']]: (node: Extract) => vscode.TreeItem } = { diff --git a/src/testApi.ts b/src/testApi.ts index edea227..be80c39 100644 --- a/src/testApi.ts +++ b/src/testApi.ts @@ -4,10 +4,10 @@ import * as vscode from 'vscode' import { beats, claudeLinks, codeLinks, gstate, journeys, KEY, mapPanel, notes, state, store, tourItems, tutorialSpot, understanding, valueHints } from './app' import { askErrors, asking } from './ask/run' -import { me } from './identity' -import { Note } from './store' +import { me } from './notes/identity' +import { Note } from './notes/store' import { applySuggestion } from './notes/suggestion' -import { unread } from './seen' +import { unread } from './notes/seen' import { journeysTree } from './sidebar/journeysTree' import { journeyItem } from './sidebar/journeyRows' import { listModel } from './sidebar/listModel' diff --git a/src/threads/comments.ts b/src/threads/comments.ts index 06463eb..313ae13 100644 --- a/src/threads/comments.ts +++ b/src/threads/comments.ts @@ -3,26 +3,26 @@ import * as vscode from 'vscode' import * as os from 'os' -import { lineDiff } from '../staleDiff' -import { linkify } from '../linkifyAnswer' +import { lineDiff } from '../core/anchors/staleDiff' +import { linkify } from '../core/linkifyAnswer' import { alsoAllow, BANNER_COMMANDS, byId, cmdLink, MESSAGE_COMMANDS, systemMarkdown, titledCmdLink, trustedMarkdown, understanding } from '../app' import { askErrors, asking } from '../ask/run' import type { ThreadStatus } from '../check/controller' -import { codeLinkMarkup, linkPhrases, PH, PH_RE } from '../codeLinkText' -import { otherBranch } from '../checkout' -import { isAgent, mine } from '../identity' +import { codeLinkMarkup, linkPhrases, PH, PH_RE } from '../core/codeLinkText' +import { otherBranch } from '../platform/checkout' +import { isAgent, mine } from '../notes/identity' import { escapeTags } from '../journeys/textFormat' -import { seenCount, visitFrom } from '../seen' +import { seenCount, visitFrom } from '../notes/seen' import { journeyOfNote, stepLinkOf } from '../sidebar/journeyRows' -import { NoteEvent } from '../noteModel' -import { Note } from '../store' -import { plural, rangeLabel } from '../text' +import { NoteEvent } from '../core/format/noteModel' +import { Note } from '../notes/store' +import { plural, rangeLabel } from '../core/text' import { questionDone } from '../check/types' import { seeAlsoLink } from '../tour/checkTour' import { tourState, walk } from '../tour/instances' import { docUri, missing, openDoc, pastEnd } from '../notes/location' import { syncThread } from './sync' -import { docLines } from '../documents' +import { docLines } from '../platform/documents' export function threadRange(n: Note): vscode.Range { return new vscode.Range(n.data.range.start - 1, 0, n.data.range.end - 1, 0) diff --git a/src/threads/sync.ts b/src/threads/sync.ts index 8413595..740bc3c 100644 --- a/src/threads/sync.ts +++ b/src/threads/sync.ts @@ -3,13 +3,13 @@ import * as vscode from 'vscode' import { byId, cfg, controller, notes, understanding } from '../app' import { askErrors, asking } from '../ask/run' -import { otherBranch } from '../checkout' +import { otherBranch } from '../platform/checkout' import { docUri, missing, openDoc, pastEnd } from '../notes/location' -import { seenCount, unread, visitFrom } from '../seen' +import { seenCount, unread, visitFrom } from '../notes/seen' import { stepLinkOf } from '../sidebar/journeyRows' import { hiddenInEditor } from '../sidebar/notesFilter' -import { Note } from '../store' -import { labelSafe, shortQ } from '../text' +import { Note } from '../notes/store' +import { labelSafe, shortQ } from '../core/text' import { tourState, walk } from '../tour/instances' import { commentsOf, expanded, threadRange } from './comments' import { afterEditorSettles, newThread, setThread, settling, whenSettled } from './settle' diff --git a/src/tour/askStep.ts b/src/tour/askStep.ts index f2d2006..78e264e 100644 --- a/src/tour/askStep.ts +++ b/src/tour/askStep.ts @@ -8,7 +8,7 @@ import { fileOf, LoadedJourney } from '../journeys/steps' import { createNote } from '../notes/create' import { reveal } from '../notes/reveal' import { refreshAll } from '../refresh' -import { Note } from '../store' +import { Note } from '../notes/store' import { card, tourState, walk } from './instances' import { podcasts } from '../podcast/player' diff --git a/src/tour/card.ts b/src/tour/card.ts index aacea7e..4892d4a 100644 --- a/src/tour/card.ts +++ b/src/tour/card.ts @@ -2,17 +2,17 @@ // has no code to sit on; the bar on the step's lines and the ref opened from the card. import * as vscode from 'vscode' import { beats, cmdLink, codeLinks, journeys, KEY, mapPanel, titledCmdLink, valueHints } from '../app' -import { codeLinkMarkup, linkPhrases, PH, PH_RE } from '../codeLinkText' -import { setDecorations } from '../decorations' -import { readLinks, readValues } from '../journeyModel' +import { codeLinkMarkup, linkPhrases, PH, PH_RE } from '../core/codeLinkText' +import { setDecorations } from '../platform/decorations' +import { readLinks, readValues } from '../core/format/journeyModel' import { escapeTags } from '../journeys/textFormat' import { fileOf, LoadedJourney } from '../journeys/steps' import { Asked, askedOf, askedText } from '../sidebar/journeyRows' import { refreshDecorations as refreshNoteDecorations } from '../notes/decorations' import { linesOfUri } from '../notes/location' import { MarkPainter } from '../marks/lights' -import { blocksOf } from '../symbolBlocks' -import { labelSafe } from '../text' +import { blocksOf } from '../platform/symbolBlocks' +import { labelSafe } from '../core/text' import { afterEditorSettles, newThread, setThread, settling, whenSettled } from '../threads/settle' import { nextStop, seeAlsoLink } from './checkTour' import { TourState } from './state' diff --git a/src/tour/checkTour.ts b/src/tour/checkTour.ts index 9a8d5bb..862a91a 100644 --- a/src/tour/checkTour.ts +++ b/src/tour/checkTour.ts @@ -3,7 +3,7 @@ import * as vscode from 'vscode' import { cmdLink, journeys, mapPanel, understanding } from '../app' import { Check, questionDone } from '../check/types' -import { seeAlso } from '../journeyList' +import { seeAlso } from '../core/list/journeyList' import { LoadedJourney } from '../journeys/steps' import { listItems } from '../sidebar/listModel' import { endJourney } from './commands' diff --git a/src/tour/commands.ts b/src/tour/commands.ts index e6534f0..67862ca 100644 --- a/src/tour/commands.ts +++ b/src/tour/commands.ts @@ -6,7 +6,7 @@ import { beats, codeLinks, gstate, journeys, log, mapPanel, state, valueHints } import { prefixUsed } from '../chords' import { MAP_VIEW } from '../journeys/mapPanel' import { fileOf, journeyById, LoadedJourney, posKey } from '../journeys/steps' -import { markJourneysSeen } from '../seen' +import { markJourneysSeen } from '../notes/seen' import { INTRO_KEY, showIntro } from '../sidebar/journeyRows' import { tree } from '../sidebar/notesTree' import { cardOnly, codeGetsMoreRoom, keepWidthOnFocus, noteLayout, panelFits, roomForMap } from './panelLayout' diff --git a/src/tour/lenses.ts b/src/tour/lenses.ts index 723b7ee..f3e5de1 100644 --- a/src/tour/lenses.ts +++ b/src/tour/lenses.ts @@ -3,9 +3,9 @@ import * as vscode from 'vscode' import { cfg, journeys, understanding } from '../app' -import { Block, blockAt, groupSteps } from '../codeBlocks' +import { Block, blockAt, groupSteps } from '../core/codeBlocks' import { fileOf } from '../journeys/steps' -import { blocksOf } from '../symbolBlocks' +import { blocksOf } from '../platform/symbolBlocks' import { inNotesFolder, notesFor, relPath } from '../notes/location' import { card, tourState, walk } from './instances' diff --git a/src/tour/mapMessages.ts b/src/tour/mapMessages.ts index e017003..0361f07 100644 --- a/src/tour/mapMessages.ts +++ b/src/tour/mapMessages.ts @@ -3,8 +3,8 @@ import * as vscode from 'vscode' import { beats, byId, cfg, gstate, journeys, KEY, log, mapPanel, state, understanding } from '../app' -import { git } from '../checkout' -import { ageOf } from '../journeyList' +import { git } from '../platform/checkout' +import { ageOf } from '../core/list/journeyList' import { LEGEND_HIDDEN_KEY, MapMessage, TourInfo } from '../journeys/mapPanel' import { fileOf, LoadedJourney } from '../journeys/steps' import { reveal } from '../notes/reveal' @@ -12,7 +12,7 @@ import { askedOf } from '../sidebar/journeyRows' import { journeysTree } from '../sidebar/journeysTree' import { listModel, listState, SORT_KEY } from '../sidebar/listModel' import { relPath } from '../notes/location' -import { wfs } from '../workspaceFs' +import { wfs } from '../platform/workspaceFs' import { refreshJourney } from '../write/refreshJourney' import { askStep, askUpdate } from './askStep' import { openCheckpoint } from './checkTour' diff --git a/src/tour/panelLayout.ts b/src/tour/panelLayout.ts index f3521df..2faea06 100644 --- a/src/tour/panelLayout.ts +++ b/src/tour/panelLayout.ts @@ -4,7 +4,7 @@ import * as vscode from 'vscode' import { gstate, KEY, log, mapPanel } from '../app' import { MAP_VIEW } from '../journeys/mapPanel' -import { listeningShare, panelShare } from '../panelWidth' +import { listeningShare, panelShare } from '../core/panelWidth' import { walk } from './instances' /** The panel's width as the reader left it (a share of the editor area), every journey. */ diff --git a/src/tour/pick.ts b/src/tour/pick.ts index 3ffd997..646990d 100644 --- a/src/tour/pick.ts +++ b/src/tour/pick.ts @@ -3,7 +3,7 @@ import * as vscode from 'vscode' import { journeys } from '../app' import { LoadedJourney, posKey } from '../journeys/steps' -import { pickOne } from '../quickPick' +import { pickOne } from '../platform/quickPick' import { Node } from '../sidebar/nodes' import { writeJourney } from '../write/writeJourney' import { journeyModel, modelLabel } from '../write/claudeRun' diff --git a/src/tour/refs.ts b/src/tour/refs.ts index 12ff07f..c8a40e8 100644 --- a/src/tour/refs.ts +++ b/src/tour/refs.ts @@ -3,10 +3,10 @@ import * as vscode from 'vscode' import { showError } from '../app' -import { setDecorations } from '../decorations' +import { setDecorations } from '../platform/decorations' import { fileOf, LoadedJourney } from '../journeys/steps' import { clampLines } from '../notes/location' -import { wfs } from '../workspaceFs' +import { wfs } from '../platform/workspaceFs' import { cardLine } from './stepPlace' import { card, tourState, walk } from './instances' diff --git a/src/tour/stepText.ts b/src/tour/stepText.ts index dcb9ec4..83efaef 100644 --- a/src/tour/stepText.ts +++ b/src/tour/stepText.ts @@ -5,10 +5,10 @@ // where it is now (`relocate`), drop the refs already on screen (`onScreen`), and say each as a link or a struck-out // name (`label`). `stepText` composes them. import { fileOf, LoadedJourney } from '../journeys/steps' -import type { JStep } from '../journeyModel' -import { readLinks } from '../journeyModel' +import type { JStep } from '../core/format/journeyModel' +import { readLinks } from '../core/format/journeyModel' import { DIR, FILE_NAME, REF_IN_TEXT } from '../journeys/textFormat' -import { baseName } from '../paths' +import { baseName } from '../core/paths' /** A link in a step's text: where it goes now (renames, moved lines), and how it reads. */ export interface StepRef { label: string; file: string; line: number; end: number; gone: boolean; stale: boolean } diff --git a/src/tutorialSpot.ts b/src/tour/tutorialSpot.ts similarity index 97% rename from src/tutorialSpot.ts rename to src/tour/tutorialSpot.ts index 306b5e1..8fb7d49 100644 --- a/src/tutorialSpot.ts +++ b/src/tour/tutorialSpot.ts @@ -1,5 +1,5 @@ import * as vscode from 'vscode' -import { setDecorations } from './decorations' +import { setDecorations } from '../platform/decorations' // The tutorial's card about the step card (the tutorial shows things in the editor too): while it is up, the // step's lines in the editor are boxed, so the eyes land on the card that sits right above them. An extension can't diff --git a/src/tour/walk.ts b/src/tour/walk.ts index c3b83ca..13ed121 100644 --- a/src/tour/walk.ts +++ b/src/tour/walk.ts @@ -2,14 +2,14 @@ // the status bar item, and where each journey was left. import * as vscode from 'vscode' import { beats, codeLinks, journeys, log, mapPanel, now, setCtx, state, tourItems } from '../app' -import { ownSelection } from '../claudeChatLinks' +import { ownSelection } from '../codeLinks/claudeChatLinks' import { fileOf, LoadedJourney, posKey } from '../journeys/steps' import { checkLinkNote } from '../check/wiring' import { revealJourneyRow } from '../sidebar/journeyRows' import { tree } from '../sidebar/notesTree' import { editorSettling } from '../threads/settle' import { refreshDecorations } from '../notes/decorations' -import { wfs } from '../workspaceFs' +import { wfs } from '../platform/workspaceFs' import type { StepCard } from './card' import { openCheckpoint, stopBy } from './checkTour' import { panelFits } from './panelLayout' @@ -18,7 +18,7 @@ import { pickJourney } from './pick' import { MAP_KEY, POS_KEY, ShownAt, TOUR_KEY, TourState } from './state' import { foldNotesOverlapping, syncStepNotes } from './stepNotes' import { cardLine, stepUri, wroteAt } from './stepPlace' -import { baseName } from '../paths' +import { baseName } from '../core/paths' import { stepFileUri } from '../journeys/codeGroup' type Pos = { step: number; id?: string; at: string } diff --git a/src/watch.ts b/src/watch.ts index 83677f3..713588c 100644 --- a/src/watch.ts +++ b/src/watch.ts @@ -2,15 +2,15 @@ // journey steps follow their code. import * as vscode from 'vscode' -import { Loc } from './anchor' -import { shift, swallows } from './lineFollow' +import { Loc } from './core/anchors/anchor' +import { shift, swallows } from './core/anchors/lineFollow' import { journeys, mapPanel, notes, store } from './app' -import { refreshBranch } from './checkout' -import { authorChanged } from './identity' +import { refreshBranch } from './platform/checkout' +import { authorChanged } from './notes/identity' import { fileOf } from './journeys/steps' import { applyIgnoreInGit, changeFolder, rewriteReadmes } from './notes/folder' import { refreshAll, updateCursorContext } from './refresh' -import { markRead, unread } from './seen' +import { markRead, unread } from './notes/seen' import { journeysTree } from './sidebar/journeysTree' import { findMovedFile, followMovedFiles, followRename, inNotesFolder, lineNotesFor, notesAtLine, notesFor, pathUri, reanchor, reanchorAll, recentCreates, relPath, toLoc } from './notes/location' import { noteVisibleEditors } from './threads/settle' @@ -18,8 +18,8 @@ import { refreshDecorations } from './notes/decorations' import { syncThread, threads } from './threads/sync' import { keepOffMap } from './tour/panelLayout' import { card, tourState, walk } from './tour/instances' -import { docLines } from './documents' -import { wfs } from './workspaceFs' +import { docLines } from './platform/documents' +import { wfs } from './platform/workspaceFs' /** Steps whose file was renamed or deleted on disk: follow the code into a file created just now, or go stale. */ async function followJourneyFiles(): Promise { diff --git a/src/webview/page.ts b/src/webview/page.ts index 0061bcd..d142806 100644 --- a/src/webview/page.ts +++ b/src/webview/page.ts @@ -1,8 +1,8 @@ // Webview pages, in one place: text escaped for HTML, a nonce for their scripts, and the page around a view's own files // (webviewPage), with its Content-Security-Policy (contentSecurityPolicy: the extension's styles and fonts, only the // scripts carrying the nonce). A page's markup may be kept as a .html file next to this one (copied to out/ by -// `npm run pages`) and filled in where it says {{name}} (pageBody). cli/understanding.mjs builds no webview, so it -// needs none of this. +// scripts/build/pages.mjs) and filled in where it says {{name}} (pageBody). cli/understanding.mjs builds no webview, +// so it needs none of this. import * as fs from 'fs' import * as path from 'path' diff --git a/src/write/claudeRun.ts b/src/write/claudeRun.ts index a7a0c85..845f183 100644 --- a/src/write/claudeRun.ts +++ b/src/write/claudeRun.ts @@ -8,9 +8,9 @@ import * as os from 'os' import * as path from 'path' import { cfg, extUri, showError } from '../app' import { claudeCli } from '../ask/settings' -import { Ask, AskOptions, AskResult, modelProblem } from '../claude' -import { folderName } from '../store' -import { clock, phaseOf } from '../writing' +import { Ask, AskOptions, AskResult, modelProblem } from '../platform/agent/claude' +import { folderName } from '../notes/store' +import { clock, phaseOf } from '../core/writing' import { Writing, writingChanged, writingNow } from './inProgress' /** The model a journey is written with (a request's `model`, the settings), and how it is named. */ diff --git a/src/write/inProgress.ts b/src/write/inProgress.ts index 76b6eb6..727dca9 100644 --- a/src/write/inProgress.ts +++ b/src/write/inProgress.ts @@ -1,8 +1,8 @@ // The journeys Claude is writing (or refreshing) now: never listed half-made; one row each while they are. import * as vscode from 'vscode' -import { Ask } from '../claude' -import { clock } from '../writing' +import { Ask } from '../platform/agent/claude' +import { clock } from '../core/writing' /** A journey being written: "Writing: · 1:20", its phase, the model, and the run (to cancel it). */ export interface Writing { id: string; question: string; started: number; phase: string; model: string; ask?: Ask } diff --git a/src/write/rank.ts b/src/write/rank.ts index 4155f7e..4068d54 100644 --- a/src/write/rank.ts +++ b/src/write/rank.ts @@ -3,9 +3,9 @@ import * as vscode from 'vscode' import { journeys } from '../app' import { LoadedJourney } from '../journeys/steps' -import { scoreJourney } from '../match' -import { pickOne } from '../quickPick' -import { shortQ } from '../text' +import { scoreJourney } from '../core/list/match' +import { pickOne } from '../platform/quickPick' +import { shortQ } from '../core/text' import { questionBesidesTitle } from '../tour/pick' import { journeyModel, modelLabel } from './claudeRun' diff --git a/src/write/refreshJourney.ts b/src/write/refreshJourney.ts index 8e24973..761bf10 100644 --- a/src/write/refreshJourney.ts +++ b/src/write/refreshJourney.ts @@ -6,14 +6,14 @@ import * as os from 'os' import * as path from 'path' import { journeys, log, mapPanel, showError } from '../app' import { claudeAllowed } from '../ask/trust' -import { AskResult } from '../claude' +import { AskResult } from '../platform/agent/claude' import { LoadedJourney } from '../journeys/steps' -import { pickOne } from '../quickPick' +import { pickOne } from '../platform/quickPick' import { journeysTree } from '../sidebar/journeysTree' import { staleCount, staleLine, staleSteps } from '../sidebar/listModel' -import { plural, shortQ } from '../text' +import { plural, shortQ } from '../core/text' import { walk } from '../tour/instances' -import { clock } from '../writing' +import { clock } from '../core/writing' import { bundledSkill, cliOrClipboard, journeyPy, modelLabel, runJourneySkill, skillAndModel, Staging, stagingFolder } from './claudeRun' import { startWriting, Writing } from './inProgress' diff --git a/src/write/requests.ts b/src/write/requests.ts index ae17e0a..667276a 100644 --- a/src/write/requests.ts +++ b/src/write/requests.ts @@ -3,13 +3,13 @@ import * as fs from 'fs' import * as path from 'path' import { claudeLinks, extVersion, journeys, log, mapPanel, showError, state } from '../app' import { claudeAllowed, trusted } from '../ask/trust' -import { modelProblem } from '../claude' -import { linkTarget } from '../linkUri' +import { modelProblem } from '../platform/agent/claude' +import { linkTarget } from '../core/linkUri' import { posKey } from '../journeys/steps' import { walkJourney } from '../tour/commands' import { walk } from '../tour/instances' import { MAP_KEY } from '../tour/state' -import { wfs } from '../workspaceFs' +import { wfs } from '../platform/workspaceFs' import { chooseJourney, confirmWrite, matchJourneys } from './rank' import { writeJourney } from './writeJourney' import { journeyModel, modelLabel } from './claudeRun' diff --git a/src/write/writeJourney.ts b/src/write/writeJourney.ts index 30f45bf..d021b79 100644 --- a/src/write/writeJourney.ts +++ b/src/write/writeJourney.ts @@ -7,14 +7,14 @@ import * as os from 'os' import * as path from 'path' import { journeys, log, showError } from '../app' import { claudeAllowed } from '../ask/trust' -import { AskResult } from '../claude' +import { AskResult } from '../platform/agent/claude' import { LoadedJourney } from '../journeys/steps' import { journeysFolderName } from '../journeys/journeys' -import { shortQ } from '../text' +import { shortQ } from '../core/text' import { relPath } from '../notes/location' import { walkJourney } from '../tour/commands' import { walk } from '../tour/instances' -import { clock, journeyPrompt, journeyRules, minutes } from '../writing' +import { clock, journeyPrompt, journeyRules, minutes } from '../core/writing' import { showClarify } from './clarify' import { bundledSkill, cliOrClipboard, journeyPy, modelLabel, runJourneySkill, skillAndModel, Staging, stagingFolder } from './claudeRun' import { startWriting, Writing } from './inProgress' diff --git a/test/README.md b/test/README.md index abd1825..d03b513 100644 --- a/test/README.md +++ b/test/README.md @@ -4,8 +4,14 @@ | --- | --- | | `npm test` | the TypeScript unit tests (`test/*.test.ts`, compiled to `out/test/`) and the CLI's (`test/cli/*.test.mjs`), golden tests included | | `npm run test:goldens` | only the golden tests (a few seconds) | +| `npm run lint` | ESLint (`eslint.config.mjs`) and the layer and import-cycle check (`scripts/check-layers.mjs`, rules in `scripts/layers.json`) | | `npm run test:integration` | the extension in a real VS Code | -| `npm run test:panel`, `test:scenes`, `test:checkpanel`, `test:journeylist`, `test:podcast` | the webviews in a headless browser | +| `npm run test:panel`, `test:scenes`, `test:checkpanel`, `test:journeylist` | the webviews in a headless browser, with checks (CI runs these) | +| `npm run test:checktour`, `test:podcast` | screenshot drivers to look at (not in CI) | +| `npm run test:grader` | the grader on real cases (needs a model; not in CI) | + +CI (`.github/workflows/ci.yml`) is the one list of what gates a change; the release workflow runs it before it +publishes. Every unit test runs with `test/hermetic.mjs` loaded first: the CI job's own variables never reach the code under test. @@ -19,10 +25,17 @@ What is pinned: | File | Area (`test/goldens/…`) | What | | --- | --- | --- | -| `test/golden-journey.test.ts` | `journey/` | Every fixture journey as `parseJourney` reads it (and the old-format files it refuses), crafted journeys that break the rules (the refusal or the problems), anchors, code links, value hints and marks as read, marks found in code and their problems, code-link markup, paths in step text, each step card's text (as written, moved, stale, renamed and gone files), the shop journey's steps placed in its code after edits, search words and scores, the Journeys list model (sorts, searches, chips, the active file), and the pure parts of the map's layout (`media/journey-layout.js`) | +| `test/golden-journey.test.ts` | `journey/` | Every fixture journey as `parseJourney` reads it (and the old-format files it refuses), crafted journeys that break the rules (the refusal or the problems), anchors, code links, value hints and marks as read, marks found in code and their problems | +| `test/golden-codelinks.test.ts` | `journey/` | The code links in each step of the shop journey, and their markup | +| `test/golden-steps.test.ts` | `journey/` | Paths in step text (linked, shortened, asides dropped, tags escaped), the shop journey's steps placed in its code after edits | +| `test/golden-tour.test.ts` | `journey/` | Each step card's text (as written, moved, stale, renamed and gone files) | +| `test/golden-list.test.ts` | `journey/` | Search words and scores, the Journeys list model (sorts, searches, chips, the active file) | +| `test/golden-layout.test.ts` | `journey/` | The pure parts of the map's layout (`media/journey-layout.js`) | | `test/golden-podcast.test.ts` | `podcast/` | The full check of every case in `test/fixtures/podcast/cases.json` (problems, messages, paths, places in the file, the episode), the sample podcast's episode (what the panel is sent), its timing (views, chapters, jumps, calm views, resume) and its marks | | `test/golden-notes.test.ts` | `notes/` | Real and crafted note files read and written back (the JSON the extension writes), notes that are refused and why, the three-way merge, the agents' README, v2 anchors and v3 compact anchors found again after edits, the stale diff | -| `test/golden-check.test.ts` | `check-model/` | The prompts that write a check and its tour, failures in plain words, TODO comments, the Check view's names and the requests its page may send | +| `test/golden-check-agent.test.ts` | `check-model/` | The prompts that write a check and its tour, the phase shown while Claude works, failures in plain words | +| `test/golden-check.test.ts` | `check-model/` | TODO comments | +| `test/golden-check-view.test.ts` | `check-model/` | The Check view's names and the requests its page may send, text at code links, its thread texts | | `test/cli/golden-understanding.test.mjs` | `check/` | The understanding check end to end on the refunds change of `test/fixtures/grader-cases`: the skill's script output and the check file it writes, every CLI command's output and `status --json`, the Check view (`checkView`, what the view is sent) at each stage, each question's thread, grading replies (and refused ones), the CI job and its merge request comment, broken check files and what `validate` says, drift / conflicts / the default branch, and the CLI's pure helpers | Not pinned (not pure enough): the messages built inside vscode-dependent classes — the journey panel's `tour` / @@ -38,7 +51,8 @@ is not on `main` yet, so it has no goldens. pinned), with what JSON can't say spelled out: `"[undefined]"`, `{ "[Map]": [...] }`, `{ "[Set]": [...] }`, `"[NaN]"`. A missing golden fails the test. The CLI's goldens replace what changes from run to run before comparing: temporary paths (``, ``), ISO times (`