@sightmap/sightmap 0.7.1 → 0.9.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/README.md CHANGED
@@ -193,7 +193,7 @@ npx @sightmap/sightmap init
193
193
  This detects your framework (React/Next/Vite/RR7), the coding-agent
194
194
  harness(es) in use (Claude Code, Codex, Cursor, OpenCode), and any
195
195
  Sightmap-aware browser MCP already installed (Subtext today). It then runs
196
- framework setup (adapter install, `<SightmapProvider>` codemod, codegen) and
196
+ framework setup (adapter install + `<SightmapProvider>` codemod) and
197
197
  offers two install paths:
198
198
 
199
199
  - **Plugin** (recommended): two copy-paste commands per host. Skills, hooks,
@@ -207,7 +207,6 @@ Pass `--yes` to skip all prompts and accept defaults. Other flags:
207
207
  --host <names> Comma-separated: claude-code,codex,cursor,opencode
208
208
  --with-browser Force bundled Playwright + sightmap_* browser tools
209
209
  --curate-only Force curation-only MCP
210
- --no-codegen Skip sightmap-react gen
211
210
  --no-provider Skip <SightmapProvider> codemod
212
211
  ```
213
212
 
package/dist/cli/index.js CHANGED
@@ -2137,6 +2137,37 @@ function hasGroup(groups, candidate) {
2137
2137
  );
2138
2138
  }
2139
2139
 
2140
+ // src/cli/init/hooks-setup/settings-hooks.ts
2141
+ function buildLintHooks(opts) {
2142
+ const matcher = "Write|Edit|MultiEdit";
2143
+ return {
2144
+ PreToolUse: [
2145
+ {
2146
+ matcher,
2147
+ hooks: [
2148
+ {
2149
+ type: "command",
2150
+ command: `${opts.cliCommand} check --json`,
2151
+ timeout: 5e3
2152
+ }
2153
+ ]
2154
+ }
2155
+ ],
2156
+ PostToolUse: [
2157
+ {
2158
+ matcher,
2159
+ hooks: [
2160
+ {
2161
+ type: "command",
2162
+ command: `${opts.cliCommand} audit --json`,
2163
+ timeout: 8e3
2164
+ }
2165
+ ]
2166
+ }
2167
+ ]
2168
+ };
2169
+ }
2170
+
2140
2171
  // src/cli/init/skills-copy.ts
2141
2172
  async function copyPluginAssets(opts) {
2142
2173
  const targets = resolveTargets(opts.host, opts.projectDir);
@@ -2178,8 +2209,10 @@ async function installHooksIntoSettings(opts) {
2178
2209
  } catch {
2179
2210
  }
2180
2211
  const merged = mergeHooksIntoSettings(existing, rewritten);
2212
+ const lintHooks = buildLintHooks({ cliCommand: "npx @sightmap/sightmap" });
2213
+ const finalMerged = mergeHooksIntoSettings(merged, lintHooks);
2181
2214
  await mkdir3(resolve20(opts.settingsPath, ".."), { recursive: true });
2182
- await writeFile6(opts.settingsPath, JSON.stringify(merged, null, 2) + "\n", "utf8");
2215
+ await writeFile6(opts.settingsPath, JSON.stringify(finalMerged, null, 2) + "\n", "utf8");
2183
2216
  }
2184
2217
  async function installLegacyHooksJson(opts) {
2185
2218
  const srcRaw = JSON.parse(
@@ -2478,30 +2511,6 @@ async function installAdapter(opts) {
2478
2511
  });
2479
2512
  }
2480
2513
 
2481
- // src/cli/init/framework-setup/codegen.ts
2482
- import { spawn as spawn3 } from "child_process";
2483
- var REACT_FRAMEWORKS = ["react-vite", "react-cra", "next-app", "next-pages", "react-router-7"];
2484
- var EXEC_VERB = {
2485
- pnpm: ["exec"],
2486
- yarn: ["exec"],
2487
- npm: ["exec", "--"],
2488
- bun: ["x"]
2489
- };
2490
- function buildCodegenCommand(opts) {
2491
- if (!REACT_FRAMEWORKS.includes(opts.framework)) return null;
2492
- return {
2493
- command: opts.packageManager,
2494
- args: [...EXEC_VERB[opts.packageManager], "sightmap-react", "gen", "--router=auto"]
2495
- };
2496
- }
2497
- async function runCodegen(cwd, cmd) {
2498
- await new Promise((resolveP, reject) => {
2499
- const child = spawn3(cmd.command, cmd.args, { cwd, stdio: "inherit" });
2500
- child.on("error", reject);
2501
- child.on("exit", (code) => code === 0 ? resolveP() : reject(new Error(`codegen exited ${code}`)));
2502
- });
2503
- }
2504
-
2505
2514
  // src/cli/init/framework-setup/provider-codemod.ts
2506
2515
  import * as recast from "recast";
2507
2516
  import * as parser from "@babel/parser";
@@ -2637,7 +2646,7 @@ function formatExistingCorpusReport(input) {
2637
2646
  }
2638
2647
 
2639
2648
  // src/cli/init/index.ts
2640
- var REACT_FRAMEWORKS2 = ["react-vite", "react-cra", "next-app", "next-pages", "react-router-7"];
2649
+ var REACT_FRAMEWORKS = ["react-vite", "react-cra", "next-app", "next-pages", "react-router-7"];
2641
2650
  async function runInit(opts) {
2642
2651
  intro2();
2643
2652
  let detect = {
@@ -2714,7 +2723,7 @@ async function runInit(opts) {
2714
2723
  return 0;
2715
2724
  }
2716
2725
  async function runFreshFrameworkSetup(opts, detect) {
2717
- if (!REACT_FRAMEWORKS2.includes(detect.framework)) {
2726
+ if (!REACT_FRAMEWORKS.includes(detect.framework)) {
2718
2727
  await mkdir4(resolve22(opts.cwd, ".sightmap"), { recursive: true });
2719
2728
  await writeFile7(
2720
2729
  resolve22(opts.cwd, ".sightmap/app.yaml"),
@@ -2733,14 +2742,9 @@ views: []
2733
2742
  if (!opts.noProvider) {
2734
2743
  await runProviderStep(opts, detect);
2735
2744
  }
2736
- if (!opts.noCodegen) {
2737
- const cmd = buildCodegenCommand({ framework: detect.framework, packageManager: pm });
2738
- if (cmd) {
2739
- spinner3.start("Running sightmap-react gen");
2740
- await runCodegen(opts.cwd, cmd);
2741
- spinner3.stop("Scaffolded .sightmap/");
2742
- }
2743
- }
2745
+ clack3.log.info(
2746
+ "Sightmap runtime installed. Run `/sightmap:bootstrap` from your agent (after starting `pnpm dev` in another terminal) to populate `.sightmap/` from the live app."
2747
+ );
2744
2748
  }
2745
2749
  async function runProviderStep(opts, detect) {
2746
2750
  const entry = await findAppEntry(opts.cwd, detect.framework);
@@ -2959,7 +2963,7 @@ program.command("fmt [path]").description("Canonicalize .sightmap/*.yaml files (
2959
2963
  process.exit(code);
2960
2964
  }
2961
2965
  );
2962
- program.command("init").description("Initialize Sightmap in this project (detects framework + coding agent, writes config).").option("--yes", "accept all defaults (non-interactive)").option("--plugin", "force plugin install path").option("--manual", "force manual install path").option("--host <names>", "comma-separated hosts: claude-code,codex,cursor,opencode").option("--with-browser", "force bundled Playwright + browser tools").option("--curate-only", "force curation-only (skip browser tools)").option("--no-codegen", "skip sightmap-react gen").option("--no-provider", "skip <SightmapProvider> codemod").option("--no-smoke", "skip the MCP launch smoke test (CI / headless use)").action(async (opts) => {
2966
+ program.command("init").description("Initialize Sightmap in this project (detects framework + coding agent, writes config).").option("--yes", "accept all defaults (non-interactive)").option("--plugin", "force plugin install path").option("--manual", "force manual install path").option("--host <names>", "comma-separated hosts: claude-code,codex,cursor,opencode").option("--with-browser", "force bundled Playwright + browser tools").option("--curate-only", "force curation-only (skip browser tools)").option("--no-provider", "skip <SightmapProvider> codemod").option("--no-smoke", "skip the MCP launch smoke test (CI / headless use)").action(async (opts) => {
2963
2967
  const code = await runInit({
2964
2968
  cwd: program.opts().cwd,
2965
2969
  yes: opts.yes === true,
@@ -2968,7 +2972,6 @@ program.command("init").description("Initialize Sightmap in this project (detect
2968
2972
  ...opts.host !== void 0 ? { hosts: opts.host.split(",").map((s) => s.trim()) } : {},
2969
2973
  ...opts.withBrowser ? { withBrowser: true } : {},
2970
2974
  ...opts.curateOnly ? { curateOnly: true } : {},
2971
- ...opts.codegen === false ? { noCodegen: true } : {},
2972
2975
  ...opts.provider === false ? { noProvider: true } : {},
2973
2976
  ...opts.smoke === false ? { noSmoke: true } : {}
2974
2977
  });