Repository navigation
Add optional sightmap corpus setup to the install flow #30
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Open
nrodd
wants to merge
7
commits into
main
Choose a base branch
from
sightmap-setup
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from all commits
Commits
Show all changes
7 commits
Select commit
Hold shift + click to select a range
98c0738
Add optional sightmap corpus setup to the install flow
nrodd 5921837
Merge remote-tracking branch 'origin/main' into sightmap-setup
nrodd 6e92561
Print the sightmap prompt under --print-prompt instead of skipping it
nrodd b698831
Move the sightmap offer to the end of phase 2, not right after install
nrodd 1620af3
Allow the sightmap CLI's authoring commands under Claude Code's headl…
nrodd dca4288
Add --stub-agent, a testing flag that skips the agent run but keeps s…
nrodd 055cbd6
Reword the sightmap install prompt to explain its value
nrodd File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,5 @@ | ||
| --- | ||
| "@subtextdev/subtext-wizard": minor | ||
| --- | ||
|
|
||
| Offer to build a sightmap component corpus after the install. When setup finishes, the wizard can install the `@sightmap/sightmap` CLI and have your coding agent seed a `.sightmap/` corpus from the codebase — so future Subtext session reviews name your UI components instead of showing raw selectors. Optionally deepens coverage against a running dev server. Offered interactively by default; opt in for unattended runs with `--sightmap`. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,54 @@ | ||
| import fs from 'node:fs'; | ||
| import { packageRootPath } from '../paths.js'; | ||
| import type { PromptMode } from './build.js'; | ||
|
|
||
| export interface BuildSightmapPromptInput { | ||
| mode: PromptMode; | ||
| /** Dev-server URL for the live-coverage pass, or undefined to seed from code only. */ | ||
| appUrl?: string; | ||
| } | ||
|
|
||
| const HEADLESS_MODE_SECTION = `## Mode: autonomous (headless) | ||
|
|
||
| You are running non-interactively inside the Subtext setup CLI. The user cannot answer questions mid-run. Apply your best judgment, keep the corpus small and accurate rather than exhaustive, and record what you built (plus anything you'd have asked) in \`./sightmap-setup-report.md\`. Never block waiting for input.`; | ||
|
|
||
| const INTERACTIVE_MODE_SECTION = `## Mode: interactive | ||
|
|
||
| Work through the steps with the user in this conversation. Show them the components you intend to define before writing large batches, and let them steer which surfaces matter most.`; | ||
|
|
||
| /** The live-coverage pass only appears when the user gave us a dev-server URL. */ | ||
| function liveSection(appUrl: string): string { | ||
| return `## Step 4: Deepen coverage against the running app | ||
|
|
||
| A dev server is running at ${appUrl}. Use it to find components you couldn't see from the code alone. | ||
|
|
||
| 1. Start a browser session: \`sightmap browser start --url '${appUrl}'\`. | ||
| 2. For each meaningful route, take a coverage snapshot — \`sightmap snapshot --coverage --url '<route-url>'\` — and read which on-screen elements have no component mapped yet. | ||
| 3. Add sightmap components for the uncovered elements that a person would name, using \`sightmap sel-probe\` to confirm a selector matches before you commit it. | ||
| 4. Re-run \`sightmap validate\` and \`sightmap lint\` until clean. | ||
|
|
||
| If the \`sightmap-browser\` skill is available, use it to drive this loop.`; | ||
| } | ||
|
|
||
| export function buildSightmapPrompt(input: BuildSightmapPromptInput): string { | ||
| const template = fs.readFileSync(packageRootPath('templates', 'sightmap-prompt.md'), 'utf8'); | ||
| const headless = input.mode === 'headless'; | ||
| const live = Boolean(input.appUrl); | ||
|
|
||
| const replacements: Record<string, string> = { | ||
| MODE_SECTION: headless ? HEADLESS_MODE_SECTION : INTERACTIVE_MODE_SECTION, | ||
| LIVE_SECTION: live ? liveSection(input.appUrl!) : '', | ||
| // The live pass is Step 4, so the report becomes Step 5 when it's present. | ||
| REPORT_STEP: live ? '5' : '4', | ||
| REPORT_VERB: headless ? 'Record' : 'Tell the user', | ||
| REPORT_LOCATION: headless | ||
| ? 'Put this in `./sightmap-setup-report.md`.' | ||
| : '', | ||
| }; | ||
|
|
||
| let prompt = template; | ||
| for (const [key, value] of Object.entries(replacements)) { | ||
| prompt = prompt.replaceAll(`{{${key}}}`, value); | ||
| } | ||
| return prompt.replace(/\n{3,}/g, '\n\n').trim() + '\n'; | ||
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Sightmap docs fetch is blocked
Medium Severity
The authoring prompt tells Claude Code to fetch
https://docs.sightmap.org/start/quickstartwhen thesightmap-authoringskill is missing, butALLOWED_TOOLSstill scopesWebFetchto the two Fullstory domains. That fallback cannot run, so a failedskills installleaves the agent without the format reference the prompt calls the source of truth.Additional Locations (1)
templates/sightmap-prompt.md#L8-L9Reviewed by Cursor Bugbot for commit 1620af3. Configure here.