@squadbase/vantage 0.6.1-dev.90c1a41 → 0.6.1-dev2.04fa7f3
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/dist/add-EISGSZAH.js +6 -0
- package/dist/add-EISGSZAH.js.map +1 -0
- package/dist/{build-JB4VOMUI.js → build-O5TVNH4E.js} +3 -3
- package/dist/{build-JB4VOMUI.js.map → build-O5TVNH4E.js.map} +1 -1
- package/dist/{check-ZJYK6RLG.js → check-WFBEDHDR.js} +3 -3
- package/dist/{check-ZJYK6RLG.js.map → check-WFBEDHDR.js.map} +1 -1
- package/dist/{chunk-QI3XQKHS.js → chunk-3G43C6OL.js} +3 -39
- package/dist/chunk-3G43C6OL.js.map +1 -0
- package/dist/{chunk-U2M6HGKQ.js → chunk-QDZA5JSL.js} +3 -3
- package/dist/{chunk-U2M6HGKQ.js.map → chunk-QDZA5JSL.js.map} +1 -1
- package/dist/cli.js +11 -14
- package/dist/cli.js.map +1 -1
- package/dist/{dev-FCEC3UKQ.js → dev-NZRLOQCL.js} +6 -17
- package/dist/dev-NZRLOQCL.js.map +1 -0
- package/dist/{docs-EJJ3BECT.js → docs-ZGDJUHJI.js} +3 -3
- package/dist/{docs-EJJ3BECT.js.map → docs-ZGDJUHJI.js.map} +1 -1
- package/dist/{doctor-WHZXPERA.js → doctor-VFKEMR54.js} +4 -4
- package/dist/doctor-VFKEMR54.js.map +1 -0
- package/dist/{preview-OGMCNQUO.js → preview-QDCIVVSR.js} +4 -12
- package/dist/preview-QDCIVVSR.js.map +1 -0
- package/dist/{routes-GTFO5PUF.js → routes-RHP5FVGD.js} +3 -3
- package/dist/{routes-GTFO5PUF.js.map → routes-RHP5FVGD.js.map} +1 -1
- package/dist/{search-6Y422SV6.js → search-RFBELGY7.js} +3 -3
- package/dist/{search-6Y422SV6.js.map → search-RFBELGY7.js.map} +1 -1
- package/dist/{upgrade-AL4KZZR4.js → upgrade-GF2P67M6.js} +4 -4
- package/dist/{upgrade-AL4KZZR4.js.map → upgrade-GF2P67M6.js.map} +1 -1
- package/docs/en/changelog.md +0 -13
- package/docs/en/cli-reference.md +0 -30
- package/docs/ja/changelog.md +0 -13
- package/docs/ja/cli-reference.md +0 -29
- package/package.json +1 -1
- package/skills/vantage-design/SKILL.md +13 -3
- package/skills/vantage-design/references/presets.md +39 -11
- package/dist/add-DY4AXANK.js +0 -6
- package/dist/add-DY4AXANK.js.map +0 -1
- package/dist/chunk-QI3XQKHS.js.map +0 -1
- package/dist/dev-FCEC3UKQ.js.map +0 -1
- package/dist/doctor-WHZXPERA.js.map +0 -1
- package/dist/preview-OGMCNQUO.js.map +0 -1
|
@@ -2,7 +2,7 @@ import { runDiagnostics } from './chunk-BCE22JSM.js';
|
|
|
2
2
|
import './chunk-JGRMRXXZ.js';
|
|
3
3
|
import './chunk-KLEIVDUV.js';
|
|
4
4
|
import { scanProject } from './chunk-ZVANIULZ.js';
|
|
5
|
-
import { printJson, frameworkVersion, log } from './chunk-
|
|
5
|
+
import { printJson, frameworkVersion, log } from './chunk-3G43C6OL.js';
|
|
6
6
|
import './chunk-C2CX6GLX.js';
|
|
7
7
|
import fs from 'fs';
|
|
8
8
|
import path from 'path';
|
|
@@ -19,7 +19,7 @@ async function doctor(root, args) {
|
|
|
19
19
|
});
|
|
20
20
|
const pkgPath = path.join(root, "package.json");
|
|
21
21
|
facets.push({ name: "package.json", ok: fs.existsSync(pkgPath), detail: fs.existsSync(pkgPath) ? "found" : "missing" });
|
|
22
|
-
const lockfiles = ["
|
|
22
|
+
const lockfiles = ["pnpm-lock.yaml", "package-lock.json", "yarn.lock"];
|
|
23
23
|
const lock = lockfiles.find((f) => fs.existsSync(path.join(root, f)) || fs.existsSync(path.join(root, "..", f)) || fs.existsSync(path.join(root, "..", "..", f)));
|
|
24
24
|
facets.push({ name: "lockfile", ok: Boolean(lock), detail: lock ?? "none found" });
|
|
25
25
|
let installedVantage = "not installed";
|
|
@@ -54,5 +54,5 @@ async function doctor(root, args) {
|
|
|
54
54
|
}
|
|
55
55
|
|
|
56
56
|
export { doctor };
|
|
57
|
-
//# sourceMappingURL=doctor-
|
|
58
|
-
//# sourceMappingURL=doctor-
|
|
57
|
+
//# sourceMappingURL=doctor-VFKEMR54.js.map
|
|
58
|
+
//# sourceMappingURL=doctor-VFKEMR54.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../src/cli/doctor.ts"],"names":["require"],"mappings":";;;;;;;;;;;AAcA,eAAsB,MAAA,CAAO,MAAc,IAAA,EAAmC;AAC5E,EAAA,MAAM,SAAkB,EAAC;AAEzB,EAAA,MAAM,SAAA,GAAY,OAAO,OAAA,CAAQ,QAAA,CAAS,KAAK,KAAA,CAAM,GAAG,CAAA,CAAE,CAAC,CAAC,CAAA;AAC5D,EAAA,MAAA,CAAO,IAAA,CAAK;AAAA,IACV,IAAA,EAAM,MAAA;AAAA,IACN,IAAI,SAAA,IAAa,EAAA;AAAA,IACjB,MAAA,EAAQ,IAAI,OAAA,CAAQ,QAAA,CAAS,IAAI,CAAA,EAAG,SAAA,IAAa,EAAA,GAAK,EAAA,GAAK,mBAAmB,CAAA;AAAA,GAC/E,CAAA;AAED,EAAA,MAAM,OAAA,GAAU,IAAA,CAAK,IAAA,CAAK,IAAA,EAAM,cAAc,CAAA;AAC9C,EAAA,MAAA,CAAO,KAAK,EAAE,IAAA,EAAM,cAAA,EAAgB,EAAA,EAAI,GAAG,UAAA,CAAW,OAAO,CAAA,EAAG,MAAA,EAAQ,GAAG,UAAA,CAAW,OAAO,CAAA,GAAI,OAAA,GAAU,WAAW,CAAA;AAEtH,EAAA,MAAM,SAAA,GAAY,CAAC,gBAAA,EAAkB,mBAAA,EAAqB,WAAW,CAAA;AACrE,EAAA,MAAM,IAAA,GAAO,SAAA,CAAU,IAAA,CAAK,CAAC,CAAA,KAAM,EAAA,CAAG,UAAA,CAAW,IAAA,CAAK,IAAA,CAAK,IAAA,EAAM,CAAC,CAAC,KAA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MAAA,KAAW,IAAI,oBAAA,GAAuB,CAAA,EAAG,OAAO,MAAM,CAAA,iCAAA;AAAA,GACtE,CAAA;AAED,EAAA,MAAM,QAAQ,MAAA,CAAO,KAAA,CAAM,CAAC,CAAA,KAAM,EAAE,EAAE,CAAA;AAEtC,EAAA,IAAI,IAAA,CAAK,MAAM,IAAA,EAAM;AACnB,IAAA,SAAA,CAAU,EAAE,EAAA,EAAI,KAAA,EAAO,KAAK,gBAAA,EAAiB,EAAG,QAAQ,CAAA;AACxD,IAAA,OAAO,QAAQ,CAAA,GAAI,CAAA;AAAA,EACrB;AAEA,EAAA,GAAA,CAAI,KAAA,CAAM,CAAA,aAAA,EAAgB,gBAAA,EAAkB,CAAA,CAAA,CAAG,CAAA;AAC/C,EAAA,KAAA,MAAW,KAAK,MAAA,EAAQ;AACtB,IAAA,MAAM,IAAA,GAAO,GAAG,CAAA,CAAE,IAAA,CAAK,OAAO,EAAE,CAAC,CAAA,CAAA,EAAI,CAAA,CAAE,MAAM,CAAA,CAAA;AAC7C,IAAA,IAAI,CAAA,CAAE,EAAA,EAAI,GAAA,CAAI,EAAA,CAAG,IAAI,CAAA;AAAA,SAChB,GAAA,CAAI,MAAM,IAAI,CAAA;AAAA,EACrB;AACA,EAAA,OAAO,QAAQ,CAAA,GAAI,CAAA;AACrB","file":"doctor-VFKEMR54.js","sourcesContent":["import fs from \"node:fs\"\nimport path from \"node:path\"\nimport { createRequire } from \"node:module\"\nimport { runDiagnostics } from \"../core/diagnostics\"\nimport { scanProject } from \"../core/scan\"\nimport { frameworkVersion, log, printJson, type ParsedArgs } from \"./util\"\n\ninterface Facet {\n name: string\n ok: boolean\n detail: string\n}\n\n/** `vantage doctor` — environment and installation health checks. */\nexport async function doctor(root: string, args: ParsedArgs): Promise<number> {\n const facets: Facet[] = []\n\n const nodeMajor = Number(process.versions.node.split(\".\")[0])\n facets.push({\n name: \"node\",\n ok: nodeMajor >= 20,\n detail: `v${process.versions.node}${nodeMajor >= 20 ? \"\" : \" (requires >= 20)\"}`,\n })\n\n const pkgPath = path.join(root, \"package.json\")\n facets.push({ name: \"package.json\", ok: fs.existsSync(pkgPath), detail: fs.existsSync(pkgPath) ? \"found\" : \"missing\" })\n\n const lockfiles = [\"pnpm-lock.yaml\", \"package-lock.json\", \"yarn.lock\"]\n const lock = lockfiles.find((f) => fs.existsSync(path.join(root, f)) || fs.existsSync(path.join(root, \"..\", f)) || fs.existsSync(path.join(root, \"..\", \"..\", f)))\n facets.push({ name: \"lockfile\", ok: Boolean(lock), detail: lock ?? \"none found\" })\n\n let installedVantage = \"not installed\"\n let vantageOk = false\n try {\n const require = createRequire(path.join(root, \"noop.js\"))\n const p = require.resolve(\"@squadbase/vantage/package.json\")\n installedVantage = (JSON.parse(fs.readFileSync(p, \"utf8\")) as { version: string }).version\n vantageOk = true\n } catch {\n /* not resolvable */\n }\n facets.push({ name: \"@squadbase/vantage\", ok: vantageOk, detail: installedVantage })\n\n const model = scanProject(root)\n const errors = runDiagnostics(root, model).filter((d) => d.severity === \"error\")\n facets.push({\n name: \"project\",\n ok: errors.length === 0,\n detail: errors.length === 0 ? \"no blocking errors\" : `${errors.length} error(s) (run \\`vantage check\\`)`,\n })\n\n const allOk = facets.every((f) => f.ok)\n\n if (args.flags.json) {\n printJson({ ok: allOk, cli: frameworkVersion(), facets })\n return allOk ? 0 : 1\n }\n\n log.brand(`doctor (cli v${frameworkVersion()})`)\n for (const f of facets) {\n const line = `${f.name.padEnd(22)} ${f.detail}`\n if (f.ok) log.ok(line)\n else log.error(line)\n }\n return allOk ? 0 : 1\n}\n"]}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { log, resolvePortOptions,
|
|
1
|
+
import { log, resolvePortOptions, reportPortInUse } from './chunk-3G43C6OL.js';
|
|
2
2
|
import './chunk-C2CX6GLX.js';
|
|
3
3
|
import fs from 'fs';
|
|
4
4
|
import path from 'path';
|
|
@@ -18,11 +18,6 @@ async function preview(root, args) {
|
|
|
18
18
|
return 1;
|
|
19
19
|
}
|
|
20
20
|
const { port, strictPort } = ports;
|
|
21
|
-
const hosts = resolveHostOptions(args.flags);
|
|
22
|
-
if (!hosts.ok) {
|
|
23
|
-
log.error(hosts.error);
|
|
24
|
-
return 1;
|
|
25
|
-
}
|
|
26
21
|
if (manifest.mode === "fullstack") {
|
|
27
22
|
const serverPath = path.join(root, "dist", "server", "index.mjs");
|
|
28
23
|
if (!fs.existsSync(serverPath)) {
|
|
@@ -30,9 +25,6 @@ async function preview(root, args) {
|
|
|
30
25
|
return 1;
|
|
31
26
|
}
|
|
32
27
|
if (!strictPort) log.info(" --no-strict-port has no effect on a fullstack preview");
|
|
33
|
-
if (Object.keys(hosts.options).length) {
|
|
34
|
-
log.info(" --host / --allowed-hosts have no effect on a fullstack preview");
|
|
35
|
-
}
|
|
36
28
|
log.brand(`preview (fullstack) \u2192 http://localhost:${port}`);
|
|
37
29
|
const child = spawn(process.execPath, [serverPath], {
|
|
38
30
|
stdio: "inherit",
|
|
@@ -52,7 +44,7 @@ async function preview(root, args) {
|
|
|
52
44
|
configFile: false,
|
|
53
45
|
root,
|
|
54
46
|
build: { outDir: path.join(root, "dist", "client") },
|
|
55
|
-
preview: { port, strictPort
|
|
47
|
+
preview: { port, strictPort }
|
|
56
48
|
});
|
|
57
49
|
} catch (err) {
|
|
58
50
|
if (reportPortInUse(err, port, strictPort)) return 1;
|
|
@@ -65,5 +57,5 @@ async function preview(root, args) {
|
|
|
65
57
|
}
|
|
66
58
|
|
|
67
59
|
export { preview };
|
|
68
|
-
//# sourceMappingURL=preview-
|
|
69
|
-
//# sourceMappingURL=preview-
|
|
60
|
+
//# sourceMappingURL=preview-QDCIVVSR.js.map
|
|
61
|
+
//# sourceMappingURL=preview-QDCIVVSR.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../src/cli/preview.ts"],"names":[],"mappings":";;;;;;;AAMA,eAAsB,OAAA,CAAQ,MAAc,IAAA,EAAmC;AAC7E,EAAA,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,CAAA;AAAE,KAC3C,CAAA;AACD,IAAA,OAAO,IAAI,OAAA,CAAgB,CAAC,OAAA,KAAY;AACtC,MAAA,KAAA,CAAM,GAAG,MAAA,EAAQ,CAAC,SAAS,OAAA,CAAQ,IAAA,IAAQ,CAAC,CAAC,CAAA;AAC7C,MAAA,MAAM,IAAA,GAAO,MAAM,KAAA,CAAM,IAAA,CAAK,QAAQ,CAAA;AACtC,MAAA,OAAA,CAAQ,EAAA,CAAG,UAAU,IAAI,CAAA;AACzB,MAAA,OAAA,CAAQ,EAAA,CAAG,WAAW,IAAI,CAAA;AAAA,IAC5B,CAAC,CAAA;AAAA,EACH;AAGA,EAAA,MAAM,EAAE,OAAA,EAAS,WAAA,EAAY,GAAI,MAAM,OAAO,MAAM,CAAA;AACpD,EAAA,IAAI,MAAA;AACJ,EAAA,IAAI;AACF,IAAA,MAAA,GAAS,MAAM,WAAA,CAAY;AAAA,MACzB,UAAA,EAAY,KAAA;AAAA,MACZ,IAAA;AAAA,MACA,KAAA,EAAO,EAAE,MAAA,EAAQ,IAAA,CAAK,KAAK,IAAA,EAAM,MAAA,EAAQ,QAAQ,CAAA,EAAE;AAAA,MACnD,OAAA,EAAS,EAAE,IAAA,EAAM,UAAA;AAAW,KAC7B,CAAA;AAAA,EACH,SAAS,GAAA,EAAK;AACZ,IAAA,IAAI,eAAA,CAAgB,GAAA,EAAK,IAAA,EAAM,UAAU,GAAG,OAAO,CAAA;AACnD,IAAA,MAAM,GAAA;AAAA,EACR;AACA,EAAA,GAAA,CAAI,MAAM,eAAe,CAAA;AACzB,EAAA,MAAA,CAAO,SAAA,EAAU;AACjB,EAAA,OAAO,IAAI,QAAgB,MAAM;AAAA,EAAC,CAAC,CAAA;AACrC","file":"preview-QDCIVVSR.js","sourcesContent":["import fs from \"node:fs\"\nimport path from \"node:path\"\nimport { spawn } from \"node:child_process\"\nimport { log, reportPortInUse, resolvePortOptions, type ParsedArgs } from \"./util\"\n\n/** `vantage preview` — run the production build locally. */\nexport async function preview(root: string, args: ParsedArgs): Promise<number> {\n const manifestPath = path.join(root, \"dist\", \"vantage-manifest.json\")\n if (!fs.existsSync(manifestPath)) {\n log.error(\"No build found. Run `vantage build` first.\")\n return 1\n }\n const manifest = JSON.parse(fs.readFileSync(manifestPath, \"utf8\")) as { mode: string }\n const ports = resolvePortOptions(args.flags, 4173)\n if (!ports.ok) {\n log.error(ports.error)\n return 1\n }\n const { port, strictPort } = ports\n\n if (manifest.mode === \"fullstack\") {\n const serverPath = path.join(root, \"dist\", \"server\", \"index.mjs\")\n if (!fs.existsSync(serverPath)) {\n log.error(\"Server bundle missing. Re-run `vantage build`.\")\n return 1\n }\n // The production Node server binds exactly one port and exits on EADDRINUSE,\n // so a fullstack preview is always strict — there is no walk to opt out of.\n if (!strictPort) log.info(\" --no-strict-port has no effect on a fullstack preview\")\n log.brand(`preview (fullstack) → http://localhost:${port}`)\n const child = spawn(process.execPath, [serverPath], {\n stdio: \"inherit\",\n env: { ...process.env, PORT: String(port) },\n })\n return new Promise<number>((resolve) => {\n child.on(\"exit\", (code) => resolve(code ?? 0))\n const stop = () => child.kill(\"SIGINT\")\n process.on(\"SIGINT\", stop)\n process.on(\"SIGTERM\", stop)\n })\n }\n\n // SPA-only preview via Vite's static preview server.\n const { preview: vitePreview } = await import(\"vite\")\n let server: Awaited<ReturnType<typeof vitePreview>>\n try {\n server = await vitePreview({\n configFile: false,\n root,\n build: { outDir: path.join(root, \"dist\", \"client\") },\n preview: { port, strictPort },\n })\n } catch (err) {\n if (reportPortInUse(err, port, strictPort)) return 1\n throw err\n }\n log.brand(\"preview (spa)\")\n server.printUrls()\n return new Promise<number>(() => {})\n}\n"]}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { extractPageSpec, extractApiSpec } from './chunk-JGRMRXXZ.js';
|
|
2
2
|
import './chunk-KLEIVDUV.js';
|
|
3
3
|
import { scanProject } from './chunk-ZVANIULZ.js';
|
|
4
|
-
import { printJson } from './chunk-
|
|
4
|
+
import { printJson } from './chunk-3G43C6OL.js';
|
|
5
5
|
import './chunk-C2CX6GLX.js';
|
|
6
6
|
import pc from 'picocolors';
|
|
7
7
|
|
|
@@ -124,5 +124,5 @@ async function routes(root, args) {
|
|
|
124
124
|
}
|
|
125
125
|
|
|
126
126
|
export { routes };
|
|
127
|
-
//# sourceMappingURL=routes-
|
|
128
|
-
//# sourceMappingURL=routes-
|
|
127
|
+
//# sourceMappingURL=routes-RHP5FVGD.js.map
|
|
128
|
+
//# sourceMappingURL=routes-RHP5FVGD.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/cli/routes.ts"],"names":[],"mappings":";;;;;;;;AAYA,IAAM,YAAA,GAAe,EAAA;AACrB,IAAM,YAAA,GAAe,CAAA;AAGrB,SAAS,UAAA,CAAW,MAAA,EAAgB,KAAA,EAAe,KAAA,EAAqB;AACtE,EAAA,OAAA,CAAQ,GAAA,CAAI,CAAA,EAAG,MAAM,CAAA,EAAG,EAAA,CAAG,GAAA,CAAI,KAAA,CAAM,MAAA,CAAO,YAAY,CAAC,CAAC,CAAA,EAAG,KAAK,CAAA,CAAE,CAAA;AACtE;AAGA,SAAS,aAAa,MAAA,EAA8B;AAClD,EAAA,OAAO,OAAO,GAAA,CAAI,CAAC,CAAA,KAAO,CAAA,CAAE,SAAS,UAAA,GAAa,CAAA,CAAA,EAAI,CAAA,CAAE,IAAI,KAAK,CAAA,CAAA,EAAI,CAAA,CAAE,IAAI,CAAA,CAAG,CAAA,CAAE,KAAK,IAAI,CAAA;AAC3F;AAEA,SAAS,WAAW,IAAA,EAAoC;AACtD,EAAA,OAAO,MAAM,MAAA,GAAS,CAAA,GAAA,EAAM,KAAK,IAAA,CAAK,IAAI,CAAC,CAAA,EAAA,CAAA,GAAO,EAAA;AACpD;AAEA,SAAS,cAAc,IAAA,EAAsB;AAC3C,EAAA,MAAM,MAAA,GAAS,QAAA;AACf,EAAA,IAAI,KAAK,KAAA,EAAO,UAAA,CAAW,MA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AAA,CAAQ,QAAQ,KAAA,CAAM,KAAA;AAGtB,MAAA,OAAA,CAAQ,WAAW,KAAA,CAAM,QAAA;AAAA,IAC3B;AACA,IAAA,IAAI,QAAA,EAAU;AACZ,MAAA,OAAA,CAAQ,IAAA,GAAO,MAAM,IAAA,CAAK,GAAA,CAAI,CAAC,CAAA,KAAM,OAAA,CAAQ,CAAA,EAAG,MAAM,CAAC,CAAA;AACvD,MAAA,OAAA,CAAQ,YAAY,KAAA,CAAM,SAAA;AAAA,IAC5B;AACA,IAAA,SAAA,CAAU,OAAO,CAAA;AACjB,IAAA,OAAO,CAAA;AAAA,EACT;AAEA,EAAA,IAAI,SAAA,EAAW,UAAA,CAAW,KAAA,EAAO,MAAM,CAAA;AAEvC,EAAA,IAAI,aAAa,KAAA,CAAM,SAAA,IAAa,QAAA,CAAA,EAAW,SAAA,CAAU,OAAO,MAAM,CAAA;AACtE,EAAA,OAAA,CAAQ,IAAI,EAAE,CAAA;AACd,EAAA,OAAO,CAAA;AACT","file":"routes-GTFO5PUF.js","sourcesContent":["import pc from \"picocolors\"\nimport {\n extractApiSpec,\n extractPageSpec,\n type ApiMethodSpec,\n type PageSpec,\n type RouteParam,\n} from \"../core/route-spec\"\nimport { scanProject } from \"../core/scan\"\nimport type { ApiRoute, PageRoute, RouteModel } from \"../core/types\"\nimport { printJson, type ParsedArgs } from \"./util\"\n\nconst ROUTE_COLUMN = 28\nconst LABEL_COLUMN = 9\n\n/** Print an indented `label value` line under a route. */\nfunction detailLine(indent: string, label: string, value: string): void {\n console.log(`${indent}${pc.dim(label.padEnd(LABEL_COLUMN))}${value}`)\n}\n\n/** Render params as `:id`, `*rest`. */\nfunction formatParams(params: RouteParam[]): string {\n return params.map((p) => (p.kind === \"catchall\" ? `*${p.name}` : `:${p.name}`)).join(\", \")\n}\n\nfunction formatKeys(keys: string[] | undefined): string {\n return keys?.length ? ` { ${keys.join(\", \")} }` : \"\"\n}\n\nfunction printPageSpec(spec: PageSpec): void {\n const indent = \" \"\n if (spec.title) detailLine(indent, \"title\", spec.title)\n if (spec.navLabel) detailLine(indent, \"nav\", spec.navLabel)\n if (spec.description) detailLine(indent, \"desc\", spec.description)\n if (spec.params.length) detailLine(indent, \"params\", formatParams(spec.params))\n}\n\nfunction printApiMethodSpec(method: ApiMethodSpec, params: RouteParam[]): void {\n const indent = \" \"\n console.log(` ${pc.bold(method.method)}`)\n if (params.length) detailLine(indent, \"path\", formatParams(params))\n if (method.query.length) detailLine(indent, \"query\", method.query.join(\", \"))\n if (method.body) detailLine(indent, \"body\", method.body.format + formatKeys(method.body.keys))\n for (const res of method.responses) {\n const parts = [String(res.status), res.contentType].filter(Boolean).join(\" \")\n detailLine(indent, \"response\", parts + formatKeys(res.keys))\n }\n for (const err of method.errors) {\n detailLine(indent, \"error\", `${err.status}${err.message ? ` \"${err.message}\"` : \"\"}`)\n }\n}\n\n/**\n * How a page is rendered, when it is not the plain case. Without this a\n * `.slide.tsx` and a `.tsx` that resolve to the same URL look identical here,\n * and the whole point of `routes` is to show what the scan understood.\n */\nfunction pageBadge(page: PageRoute): string {\n if (page.kind === \"file\") return pc.magenta(` (${(page.fileExt ?? \"\").slice(1)})`)\n if (page.variant) return pc.magenta(` (${page.variant})`)\n return \"\"\n}\n\nfunction printPages(model: RouteModel, detail: boolean): void {\n console.log(pc.bold(\"\\nPages\"))\n if (model.pages.length === 0) console.log(pc.dim(\" (none)\"))\n for (const p of model.pages) {\n console.log(` ${pc.green(p.routePath.padEnd(ROUTE_COLUMN))} ${pc.dim(p.file)}${pageBadge(p)}`)\n if (detail) printPageSpec(extractPageSpec(p))\n }\n\n if (model.layouts.length || model.notFound || model.error) {\n console.log(pc.bold(\"\\nSpecial\"))\n for (const l of model.layouts) {\n const label = \"layout \" + (l.dir === \"\" ? \"/\" : \"/\" + l.dir)\n console.log(` ${pc.cyan(label.padEnd(ROUTE_COLUMN))} ${pc.dim(l.file)}`)\n }\n if (model.notFound) console.log(` ${pc.cyan(\"404\".padEnd(ROUTE_COLUMN))} ${pc.dim(model.notFound)}`)\n if (model.error) console.log(` ${pc.cyan(\"error\".padEnd(ROUTE_COLUMN))} ${pc.dim(model.error)}`)\n }\n}\n\nfunction printApis(model: RouteModel, detail: boolean): void {\n console.log(pc.bold(\"\\nAPI\"))\n if (!model.hasServer) {\n console.log(pc.dim(\" (none — this project has no server/ directory)\"))\n return\n }\n if (model.apis.length === 0) console.log(pc.dim(\" (none)\"))\n for (const a of model.apis) {\n console.log(` ${pc.yellow(a.routePath.padEnd(ROUTE_COLUMN))} ${pc.dim(a.file)}`)\n if (!detail) continue\n const spec = extractApiSpec(a)\n if (spec.methods.length === 0) console.log(` ${pc.dim(\"(no HTTP method handler exported)\")}`)\n for (const method of spec.methods) printApiMethodSpec(method, spec.params)\n }\n}\n\nfunction pageJson(p: PageRoute, detail: boolean) {\n return {\n route: p.routePath,\n file: p.file,\n dynamic: p.dynamic,\n kind: p.kind,\n ...(p.fileExt ? { fileExt: p.fileExt } : {}),\n ...(p.variant ? { variant: p.variant } : {}),\n ...(detail ? { spec: extractPageSpec(p) } : {}),\n }\n}\n\nfunction apiJson(a: ApiRoute, detail: boolean) {\n return {\n route: a.routePath,\n file: a.file,\n params: a.params,\n ...(detail ? { spec: extractApiSpec(a) } : {}),\n }\n}\n\n/**\n * `vantage routes` — show the page and API URL map.\n * `--pages` / `--apis` narrow the map to one side; `--detail` adds the static\n * spec of each route (page path params + definePage meta, API methods with\n * their request input and response shape).\n */\nexport async function routes(root: string, args: ParsedArgs): Promise<number> {\n const model = scanProject(root)\n const onlyPages = Boolean(args.flags.pages)\n const onlyApis = Boolean(args.flags.apis)\n // Neither flag (or both) means \"everything\", so the two are never exclusive.\n const showPages = onlyPages || !onlyApis\n const showApis = onlyApis || !onlyPages\n const detail = Boolean(args.flags.detail)\n\n if (args.flags.json) {\n const payload: Record<string, unknown> = {}\n if (showPages) {\n payload.pages = model.pages.map((p) => pageJson(p, detail))\n payload.layouts = model.layouts.map((l) => ({ dir: l.dir === \"\" ? \"/\" : l.dir, file: l.file }))\n payload.notFound = model.notFound\n payload.error = model.error\n // Files the scan skipped. `check` explains them; listing them here means\n // an agent reading `routes --json` sees them without a second command.\n payload.unrouted = model.unrouted\n }\n if (showApis) {\n payload.apis = model.apis.map((a) => apiJson(a, detail))\n payload.hasServer = model.hasServer\n }\n printJson(payload)\n return 0\n }\n\n if (showPages) printPages(model, detail)\n // Without --apis, an API-less project stays silent (nothing to say about it).\n if (showApis && (model.hasServer || onlyApis)) printApis(model, detail)\n console.log(\"\")\n return 0\n}\n"]}
|
|
1
|
+
{"version":3,"sources":["../src/cli/routes.ts"],"names":[],"mappings":";;;;;;;;AAYA,IAAM,YAAA,GAAe,EAAA;AACrB,IAAM,YAAA,GAAe,CAAA;AAGrB,SAAS,UAAA,CAAW,MAAA,EAAgB,KAAA,EAAe,KAAA,EAAqB;AACtE,EAAA,OAAA,CAAQ,GAAA,CAAI,CAAA,EAAG,MAAM,CAAA,EAAG,EAAA,CAAG,GAAA,CAAI,KAAA,CAAM,MAAA,CAAO,YAAY,CAAC,CAAC,CAAA,EAAG,KAAK,CAAA,CAAE,CAAA;AACtE;AAGA,SAAS,aAAa,MAAA,EAA8B;AAClD,EAAA,OAAO,OAAO,GAAA,CAAI,CAAC,CAAA,KAAO,CAAA,CAAE,SAAS,UAAA,GAAa,CAAA,CAAA,EAAI,CAAA,CAAE,IAAI,KAAK,CAAA,CAAA,EAAI,CAAA,CAAE,IAAI,CAAA,CAAG,CAAA,CAAE,KAAK,IAAI,CAAA;AAC3F;AAEA,SAAS,WAAW,IAAA,EAAoC;AACtD,EAAA,OAAO,MAAM,MAAA,GAAS,CAAA,GAAA,EAAM,KAAK,IAAA,CAAK,IAAI,CAAC,CAAA,EAAA,CAAA,GAAO,EAAA;AACpD;AAEA,SAAS,cAAc,IAAA,EAAsB;AAC3C,EAAA,MAAM,MAAA,GAAS,QAAA;AACf,EAAA,IAAI,KAAK,KAAA,EAAO,UAAA,CAAW,MAAA,EAAQ,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,QAAQ,KAAA,CAAM,KAAA;AAGtB,MAAA,OAAA,CAAQ,WAAW,KAAA,CAAM,QAAA;AAAA,IAC3B;AACA,IAAA,IAAI,QAAA,EAAU;AACZ,MAAA,OAAA,CAAQ,IAAA,GAAO,MAAM,IAAA,CAAK,GAAA,CAAI,CAAC,CAAA,KAAM,OAAA,CAAQ,CAAA,EAAG,MAAM,CAAC,CAAA;AACvD,MAAA,OAAA,CAAQ,YAAY,KAAA,CAAM,SAAA;AAAA,IAC5B;AACA,IAAA,SAAA,CAAU,OAAO,CAAA;AACjB,IAAA,OAAO,CAAA;AAAA,EACT;AAEA,EAAA,IAAI,SAAA,EAAW,UAAA,CAAW,KAAA,EAAO,MAAM,CAAA;AAEvC,EAAA,IAAI,aAAa,KAAA,CAAM,SAAA,IAAa,QAAA,CAAA,EAAW,SAAA,CAAU,OAAO,MAAM,CAAA;AACtE,EAAA,OAAA,CAAQ,IAAI,EAAE,CAAA;AACd,EAAA,OAAO,CAAA;AACT","file":"routes-RHP5FVGD.js","sourcesContent":["import pc from \"picocolors\"\nimport {\n extractApiSpec,\n extractPageSpec,\n type ApiMethodSpec,\n type PageSpec,\n type RouteParam,\n} from \"../core/route-spec\"\nimport { scanProject } from \"../core/scan\"\nimport type { ApiRoute, PageRoute, RouteModel } from \"../core/types\"\nimport { printJson, type ParsedArgs } from \"./util\"\n\nconst ROUTE_COLUMN = 28\nconst LABEL_COLUMN = 9\n\n/** Print an indented `label value` line under a route. */\nfunction detailLine(indent: string, label: string, value: string): void {\n console.log(`${indent}${pc.dim(label.padEnd(LABEL_COLUMN))}${value}`)\n}\n\n/** Render params as `:id`, `*rest`. */\nfunction formatParams(params: RouteParam[]): string {\n return params.map((p) => (p.kind === \"catchall\" ? `*${p.name}` : `:${p.name}`)).join(\", \")\n}\n\nfunction formatKeys(keys: string[] | undefined): string {\n return keys?.length ? ` { ${keys.join(\", \")} }` : \"\"\n}\n\nfunction printPageSpec(spec: PageSpec): void {\n const indent = \" \"\n if (spec.title) detailLine(indent, \"title\", spec.title)\n if (spec.navLabel) detailLine(indent, \"nav\", spec.navLabel)\n if (spec.description) detailLine(indent, \"desc\", spec.description)\n if (spec.params.length) detailLine(indent, \"params\", formatParams(spec.params))\n}\n\nfunction printApiMethodSpec(method: ApiMethodSpec, params: RouteParam[]): void {\n const indent = \" \"\n console.log(` ${pc.bold(method.method)}`)\n if (params.length) detailLine(indent, \"path\", formatParams(params))\n if (method.query.length) detailLine(indent, \"query\", method.query.join(\", \"))\n if (method.body) detailLine(indent, \"body\", method.body.format + formatKeys(method.body.keys))\n for (const res of method.responses) {\n const parts = [String(res.status), res.contentType].filter(Boolean).join(\" \")\n detailLine(indent, \"response\", parts + formatKeys(res.keys))\n }\n for (const err of method.errors) {\n detailLine(indent, \"error\", `${err.status}${err.message ? ` \"${err.message}\"` : \"\"}`)\n }\n}\n\n/**\n * How a page is rendered, when it is not the plain case. Without this a\n * `.slide.tsx` and a `.tsx` that resolve to the same URL look identical here,\n * and the whole point of `routes` is to show what the scan understood.\n */\nfunction pageBadge(page: PageRoute): string {\n if (page.kind === \"file\") return pc.magenta(` (${(page.fileExt ?? \"\").slice(1)})`)\n if (page.variant) return pc.magenta(` (${page.variant})`)\n return \"\"\n}\n\nfunction printPages(model: RouteModel, detail: boolean): void {\n console.log(pc.bold(\"\\nPages\"))\n if (model.pages.length === 0) console.log(pc.dim(\" (none)\"))\n for (const p of model.pages) {\n console.log(` ${pc.green(p.routePath.padEnd(ROUTE_COLUMN))} ${pc.dim(p.file)}${pageBadge(p)}`)\n if (detail) printPageSpec(extractPageSpec(p))\n }\n\n if (model.layouts.length || model.notFound || model.error) {\n console.log(pc.bold(\"\\nSpecial\"))\n for (const l of model.layouts) {\n const label = \"layout \" + (l.dir === \"\" ? \"/\" : \"/\" + l.dir)\n console.log(` ${pc.cyan(label.padEnd(ROUTE_COLUMN))} ${pc.dim(l.file)}`)\n }\n if (model.notFound) console.log(` ${pc.cyan(\"404\".padEnd(ROUTE_COLUMN))} ${pc.dim(model.notFound)}`)\n if (model.error) console.log(` ${pc.cyan(\"error\".padEnd(ROUTE_COLUMN))} ${pc.dim(model.error)}`)\n }\n}\n\nfunction printApis(model: RouteModel, detail: boolean): void {\n console.log(pc.bold(\"\\nAPI\"))\n if (!model.hasServer) {\n console.log(pc.dim(\" (none — this project has no server/ directory)\"))\n return\n }\n if (model.apis.length === 0) console.log(pc.dim(\" (none)\"))\n for (const a of model.apis) {\n console.log(` ${pc.yellow(a.routePath.padEnd(ROUTE_COLUMN))} ${pc.dim(a.file)}`)\n if (!detail) continue\n const spec = extractApiSpec(a)\n if (spec.methods.length === 0) console.log(` ${pc.dim(\"(no HTTP method handler exported)\")}`)\n for (const method of spec.methods) printApiMethodSpec(method, spec.params)\n }\n}\n\nfunction pageJson(p: PageRoute, detail: boolean) {\n return {\n route: p.routePath,\n file: p.file,\n dynamic: p.dynamic,\n kind: p.kind,\n ...(p.fileExt ? { fileExt: p.fileExt } : {}),\n ...(p.variant ? { variant: p.variant } : {}),\n ...(detail ? { spec: extractPageSpec(p) } : {}),\n }\n}\n\nfunction apiJson(a: ApiRoute, detail: boolean) {\n return {\n route: a.routePath,\n file: a.file,\n params: a.params,\n ...(detail ? { spec: extractApiSpec(a) } : {}),\n }\n}\n\n/**\n * `vantage routes` — show the page and API URL map.\n * `--pages` / `--apis` narrow the map to one side; `--detail` adds the static\n * spec of each route (page path params + definePage meta, API methods with\n * their request input and response shape).\n */\nexport async function routes(root: string, args: ParsedArgs): Promise<number> {\n const model = scanProject(root)\n const onlyPages = Boolean(args.flags.pages)\n const onlyApis = Boolean(args.flags.apis)\n // Neither flag (or both) means \"everything\", so the two are never exclusive.\n const showPages = onlyPages || !onlyApis\n const showApis = onlyApis || !onlyPages\n const detail = Boolean(args.flags.detail)\n\n if (args.flags.json) {\n const payload: Record<string, unknown> = {}\n if (showPages) {\n payload.pages = model.pages.map((p) => pageJson(p, detail))\n payload.layouts = model.layouts.map((l) => ({ dir: l.dir === \"\" ? \"/\" : l.dir, file: l.file }))\n payload.notFound = model.notFound\n payload.error = model.error\n // Files the scan skipped. `check` explains them; listing them here means\n // an agent reading `routes --json` sees them without a second command.\n payload.unrouted = model.unrouted\n }\n if (showApis) {\n payload.apis = model.apis.map((a) => apiJson(a, detail))\n payload.hasServer = model.hasServer\n }\n printJson(payload)\n return 0\n }\n\n if (showPages) printPages(model, detail)\n // Without --apis, an API-less project stays silent (nothing to say about it).\n if (showApis && (model.hasServer || onlyApis)) printApis(model, detail)\n console.log(\"\")\n return 0\n}\n"]}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { loadCatalog, isDocLang, DOC_LANGS, DEFAULT_DOC_LANG, docsForLang, readDoc } from './chunk-2KRCGXBY.js';
|
|
2
|
-
import { log, printJson } from './chunk-
|
|
2
|
+
import { log, printJson } from './chunk-3G43C6OL.js';
|
|
3
3
|
import './chunk-C2CX6GLX.js';
|
|
4
4
|
import pc from 'picocolors';
|
|
5
5
|
|
|
@@ -321,5 +321,5 @@ async function search(_root, args) {
|
|
|
321
321
|
}
|
|
322
322
|
|
|
323
323
|
export { search };
|
|
324
|
-
//# sourceMappingURL=search-
|
|
325
|
-
//# sourceMappingURL=search-
|
|
324
|
+
//# sourceMappingURL=search-RFBELGY7.js.map
|
|
325
|
+
//# sourceMappingURL=search-RFBELGY7.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/cli/search-index.ts","../src/cli/search.ts"],"names":[],"mappings":";;;;;;;;AAiBA,IAAM,aAAA,GAAgB,EAAE,IAAA,EAAM,CAAA,EAAG,OAAO,CAAA,EAAG,WAAA,EAAa,CAAA,EAAG,IAAA,EAAM,CAAA,EAAE;AAGnE,IAAM,EAAA,GAAK,GAAA;AACX,IAAM,CAAA,GAAI,IAAA;AAOV,IAAM,QAAA,GAAW,yBAAA;AACjB,IAAM,QAAA,GAAW,aAAA;AAEjB,IAAM,gBAAA,GAAmB,4BAAA;AACzB,IAAM,MAAA,GAAS,aAA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CAAO,CAAC,KAAA,KAAU,KAAA,CAAM,eAAe,KAAK,CAAA;AAEvE,EAAA,MAAM,KAAA,GAAQ,UAAA,CAAW,IAAA,CAAK,KAAA,CAAM,OAAO,aAAa,CAAA;AACxD,EAAA,MAAM,IAAA,GAAO,OAAA,CAAQ,IAAA,CAAK,KAAA,CAAM,IAAI,CAAA;AACpC,EAAA,OAAO,IAAA,CAAK,KAAA,CAAM,KAAA,GACd,QAAA,CAAS,YAAY,KAAA,EAAO,IAAA,EAAM,KAAA,EAAO,IAAI,IAC7C,SAAA,CAAU,UAAA,EAAY,KAAA,EAAO,IAAA,EAAM,OAAO,IAAI,CAAA;AACpD","file":"search-6Y422SV6.js","sourcesContent":["import { readDoc, type DocEntry } from \"./docs-catalog\"\n\n/**\n * A tiny BM25F ranker over the bundled documentation. The corpus is the catalog\n * `docs-catalog.ts` exposes — the same one `vantage docs` prints, so search never\n * creates a second source of truth.\n *\n * The index is built at run time: 65 pages per language (~300 KB) tokenize in a\n * few milliseconds, which is cheaper than shipping and version-locking a\n * prebuilt index alongside the docs bundle.\n */\n\n/**\n * Field weights. A name or a title match says far more about relevance than one\n * more occurrence in a long body, and BM25F models that as a weighted term\n * frequency (and a matching weighted document length).\n */\nconst FIELD_WEIGHTS = { slug: 3, title: 3, description: 2, body: 1 } as const\n\n/** Standard BM25 constants: term-frequency saturation and length normalization. */\nconst K1 = 1.2\nconst B = 0.75\n\n/**\n * Latin/digit runs, or runs of Japanese script (kana + CJK ideographs). CJK\n * punctuation (U+3000–U+303F, 。and 、) is deliberately outside the ranges, so\n * runs break at sentence boundaries.\n */\nconst TOKEN_RE = /[a-z0-9]+|[-ヿ㐀-䶿一-鿿]+/g\nconst LATIN_RE = /^[a-z0-9]+$/\n/** `TOKEN_RE`, but before lowercasing — for text that is not being indexed. */\nconst TOKEN_RE_ANYCASE = /[a-zA-Z0-9]+|[-ヿ㐀-䶿一-鿿]+/g\nconst CJK_RE = /[-ヿ㐀-䶿一-鿿]/\n\n/**\n * One run of a single script: hiragana (U+3041–U+309F), katakana (U+30A0–U+30FF,\n * so ー stays inside テーブル), or kanji. Japanese writes content words in\n * katakana and kanji and the grammatical glue between them in hiragana, so\n * cutting at every script change segments 「テーブルにページングを付けたい」into\n * テーブル · に · ページング · を · 付 · けたい without a morphological analyser.\n */\nconst SCRIPT_RE = /[ぁ-ゟ]+|[゠-ヿ]+|[㐀-䶿一-鿿]+/g\nconst HIRAGANA_RE = /^[ぁ-ゟ]$/\n\n/** Plural forms, so `colors` finds `color` and `queries` finds `query`. */\nfunction singular(word: string): string {\n if (word.length >= 5 && word.endsWith(\"ies\")) return `${word.slice(0, -3)}y`\n if (word.length >= 4 && word.endsWith(\"s\") && !/(ss|us|is)$/.test(word)) return word.slice(0, -1)\n return word\n}\n\n/**\n * Split text into index terms. Latin runs become words (`DataTable` splits into\n * `data` + `table`, so a two-word query finds it). Japanese runs are segmented\n * by script change; each segment is indexed whole *and* as character bigrams,\n * so an exact word scores high while a near miss (ページング / ページネーション)\n * still shares enough terms to be found.\n */\nexport function tokenize(text: string): string[] {\n const normalized = text\n .normalize(\"NFKC\")\n .replace(/([a-z0-9])([A-Z])/g, \"$1 $2\")\n .toLowerCase()\n const tokens: string[] = []\n for (const match of normalized.matchAll(TOKEN_RE)) {\n const run = match[0]!\n if (LATIN_RE.test(run)) {\n tokens.push(singular(run))\n continue\n }\n for (const segment of run.match(SCRIPT_RE) ?? []) {\n // A lone hiragana is a particle (を, に, が …): it appears in every page\n // and would make every page a match.\n if (segment.length === 1 && HIRAGANA_RE.test(segment)) continue\n // A 2-character segment is its own only bigram — pushing both would\n // double-count it.\n if (segment.length <= 2) {\n tokens.push(segment)\n continue\n }\n tokens.push(segment)\n for (let i = 0; i < segment.length - 1; i++) tokens.push(segment.slice(i, i + 2))\n }\n }\n return tokens\n}\n\n/**\n * The words a snippet should highlight: whole words and whole Japanese\n * segments as the user typed them, without the derived bigrams (highlighting\n * those would paint most of a Japanese line yellow) and without the singular\n * rewrite (which no longer appears verbatim in the text).\n */\nexport function queryPhrases(query: string): string[] {\n const phrases: string[] = []\n for (const match of query.normalize(\"NFKC\").matchAll(TOKEN_RE_ANYCASE)) {\n const run = match[0]!\n if (!CJK_RE.test(run)) {\n phrases.push(run)\n continue\n }\n for (const segment of run.match(SCRIPT_RE) ?? []) {\n if (segment.length === 1 && HIRAGANA_RE.test(segment)) continue\n phrases.push(segment)\n }\n }\n return [...new Set(phrases)]\n}\n\n/** One ranked document, with the body kept for snippet extraction. */\nexport interface SearchHit {\n entry: DocEntry\n score: number\n /** Query terms that were looked up — the input for `snippet()`. */\n terms: string[]\n body: string\n}\n\ninterface IndexedDoc {\n entry: DocEntry\n body: string\n /** Weighted term frequency across all fields. */\n tf: Map<string, number>\n /** Weighted document length. */\n length: number\n}\n\nexport interface SearchIndex {\n /** Every document with a non-zero score, best first. */\n search(query: string): SearchHit[]\n}\n\n/** Build the index for one language's catalog entries. */\nexport function buildIndex(entries: DocEntry[]): SearchIndex {\n const docs: IndexedDoc[] = entries.map((entry) => {\n const body = readDoc(entry)\n const tf = new Map<string, number>()\n let length = 0\n const add = (text: string, weight: number) => {\n for (const token of tokenize(text)) {\n tf.set(token, (tf.get(token) ?? 0) + weight)\n length += weight\n }\n }\n add(entry.slug, FIELD_WEIGHTS.slug)\n add(entry.title, FIELD_WEIGHTS.title)\n add(entry.description, FIELD_WEIGHTS.description)\n add(body, FIELD_WEIGHTS.body)\n return { entry, body, tf, length }\n })\n\n const df = new Map<string, number>()\n for (const doc of docs) {\n for (const term of doc.tf.keys()) df.set(term, (df.get(term) ?? 0) + 1)\n }\n const total = docs.length\n const avgLength = total ? docs.reduce((sum, doc) => sum + doc.length, 0) / total : 1\n\n return {\n search(query: string): SearchHit[] {\n const terms = [...new Set(tokenize(query))]\n if (terms.length === 0) return []\n\n const hits: SearchHit[] = []\n for (const doc of docs) {\n let score = 0\n for (const term of terms) {\n const tf = doc.tf.get(term)\n if (!tf) continue\n const n = df.get(term) ?? 0\n const idf = Math.log(1 + (total - n + 0.5) / (n + 0.5))\n const norm = 1 - B + (B * doc.length) / avgLength\n score += idf * ((tf * (K1 + 1)) / (tf + K1 * norm))\n }\n if (score > 0) hits.push({ entry: doc.entry, score, terms, body: doc.body })\n }\n hits.sort((a, b) => b.score - a.score || a.entry.slug.localeCompare(b.entry.slug))\n return hits\n },\n }\n}\n\n/** How much of a line to show around the first matched term. */\nconst SNIPPET_LENGTH = 150\n\n/**\n * Pick the passage that best covers the query terms. Lines are compared\n * lowercased only (no NFKC, no camelCase splitting) so offsets stay aligned\n * with the text that is printed.\n */\nexport function snippet(body: string, terms: string[], length = SNIPPET_LENGTH): string {\n let best = \"\"\n let bestHits = 0\n let bestIndex = 0\n let bestIsHeading = true\n\n // The first line is the page's own `# Title`, which the caller already shows.\n for (const raw of body.split(\"\\n\").slice(1)) {\n const line = raw.replace(/^\\s*[-*]\\s+/, \"\").replace(/\\s+/g, \" \").trim()\n if (!line || /^(```|~~~|\\|\\s*-{2,})/.test(line)) continue\n const haystack = line.toLowerCase()\n const heading = line.startsWith(\"#\")\n let hits = 0\n let first = -1\n for (const term of terms) {\n const at = haystack.indexOf(term)\n if (at === -1) continue\n hits++\n if (first === -1 || at < first) first = at\n }\n // Equal coverage: prose says more than a heading does.\n if (hits > bestHits || (hits === bestHits && hits > 0 && bestIsHeading && !heading)) {\n best = line\n bestHits = hits\n bestIndex = first\n bestIsHeading = heading\n }\n }\n\n if (!bestHits) return \"\"\n if (best.length <= length) return best\n\n const start = Math.max(0, bestIndex - Math.floor(length / 4))\n const text = best.slice(start, start + length).trim()\n return `${start > 0 ? \"…\" : \"\"}${text}${start + length < best.length ? \"…\" : \"\"}`\n}\n","import pc from \"picocolors\"\nimport {\n DEFAULT_DOC_LANG,\n DOC_LANGS,\n docsForLang,\n isDocLang,\n loadCatalog,\n readDoc,\n type DocEntry,\n type DocLang,\n} from \"./docs-catalog\"\nimport { buildIndex, queryPhrases, snippet, type SearchHit } from \"./search-index\"\nimport { log, printJson, type ParsedArgs } from \"./util\"\n\n/** Results shown when `--limit` is absent. */\nconst DEFAULT_LIMIT = 10\n\n/** Matching lines printed per page in regex mode (the count is always exact). */\nconst MAX_REGEX_LINES = 3\n\n/** Parse `--limit`, falling back silently — an off result list is not a failure. */\nfunction parseLimit(value: string | boolean | undefined, fallback: number): number {\n if (typeof value === \"string\") {\n const n = Number(value)\n if (Number.isInteger(n) && n > 0) return n\n }\n return fallback\n}\n\nfunction escapeRegExp(value: string): string {\n return value.replace(/[.*+?^${}()|[\\]\\\\]/g, \"\\\\$&\")\n}\n\n/** Dim a line, with every match of `re` picked out. Piped output stays plain. */\nfunction paintMatches(text: string, re: RegExp): string {\n if (!process.stdout.isTTY) return text\n let out = \"\"\n let last = 0\n for (const match of text.matchAll(re)) {\n const at = match.index ?? 0\n if (!match[0]) continue // zero-length match: nothing to highlight\n out += pc.dim(text.slice(last, at)) + pc.yellow(match[0])\n last = at + match[0].length\n }\n return out + pc.dim(text.slice(last))\n}\n\n/** Same, for the words of a natural-language query. */\nfunction paintTerms(text: string, words: string[]): string {\n if (!process.stdout.isTTY) return text\n if (words.length === 0) return pc.dim(text)\n return paintMatches(text, new RegExp(words.map(escapeRegExp).join(\"|\"), \"gi\"))\n}\n\nfunction header(count: number, query: string, lang: DocLang, mode: string): void {\n const label = `${count} result${count === 1 ? \"\" : \"s\"} for \"${query}\"`\n console.log(\"\")\n console.log(pc.bold(label) + pc.dim(` ${lang} · ${mode}`))\n console.log(\"\")\n}\n\nfunction footer(total: number, shown: number, lines: string[]): void {\n if (total > shown) {\n console.log(\"\")\n console.log(pc.dim(` ${total - shown} more — raise --limit to see them`))\n }\n console.log(\"\")\n for (const line of lines) console.log(pc.dim(line))\n}\n\nfunction noResults(query: string): void {\n log.warn(`Nothing matches \"${query}\".`)\n console.log(pc.dim(\" Try fewer or more general words, or run `vantage docs --list` to browse every page.\"))\n}\n\nfunction meta(entry: DocEntry) {\n return {\n slug: entry.slug,\n title: entry.title,\n description: entry.description,\n section: entry.section,\n sectionTitle: entry.sectionTitle,\n command: `vantage docs ${entry.slug}`,\n }\n}\n\n/** Default mode: rank the corpus with BM25 and show the best passage of each hit. */\nfunction runRanked(entries: DocEntry[], query: string, lang: DocLang, limit: number, json: boolean): number {\n const hits = buildIndex(entries).search(query)\n const shown = hits.slice(0, limit)\n const passage = (hit: SearchHit) => snippet(hit.body, hit.terms)\n\n if (json) {\n printJson({\n query,\n mode: \"bm25\",\n lang,\n count: hits.length,\n results: shown.map((hit) => ({\n ...meta(hit.entry),\n score: Math.round(hit.score * 1000) / 1000,\n snippet: passage(hit),\n })),\n })\n return 0\n }\n\n if (hits.length === 0) {\n noResults(query)\n return 0\n }\n\n const words = queryPhrases(query)\n const width = Math.max(...shown.map((hit) => hit.entry.slug.length))\n header(hits.length, query, lang, \"bm25\")\n for (const hit of shown) {\n const title = `${hit.entry.title}${pc.dim(` · ${hit.entry.sectionTitle}`)}`\n console.log(` ${pc.cyan(hit.entry.slug.padEnd(width))} ${title}`)\n const text = passage(hit)\n if (text) console.log(` ${\" \".repeat(width)} ${paintTerms(text, words)}`)\n }\n footer(hits.length, shown.length, [\n \"vantage docs <name> open one result --regex treat the query as a regular expression\",\n \"vantage search --json machine-readable --limit max results (default 10)\",\n ])\n return 0\n}\n\n/** `--regex` mode: scan names, titles and bodies for a regular expression. */\nfunction runRegex(entries: DocEntry[], query: string, lang: DocLang, limit: number, json: boolean): number {\n let scan: RegExp\n let probe: RegExp\n try {\n scan = new RegExp(query, \"gi\")\n probe = new RegExp(query, \"i\")\n } catch (err) {\n log.error(err instanceof Error ? err.message : `Invalid regular expression: ${String(err)}`)\n return 1\n }\n\n const results: { entry: DocEntry; matchCount: number; matches: { line: number; text: string }[] }[] = []\n for (const entry of entries) {\n const lines = readDoc(entry).split(\"\\n\")\n const matches: { line: number; text: string }[] = []\n let matchCount = 0\n for (let i = 0; i < lines.length; i++) {\n const found = [...lines[i]!.matchAll(scan)]\n if (found.length === 0) continue\n matchCount += found.length\n if (matches.length < MAX_REGEX_LINES) {\n matches.push({ line: i + 1, text: lines[i]!.replace(/\\s+/g, \" \").trim() })\n }\n }\n const inMeta = probe.test(entry.slug) || probe.test(entry.title) || probe.test(entry.description)\n if (matchCount === 0 && !inMeta) continue\n results.push({ entry, matchCount, matches })\n }\n // Stable sort: pages with more matches first, catalog order within ties.\n results.sort((a, b) => b.matchCount - a.matchCount)\n const shown = results.slice(0, limit)\n\n if (json) {\n printJson({\n query,\n mode: \"regex\",\n lang,\n count: results.length,\n results: shown.map((result) => ({\n ...meta(result.entry),\n matchCount: result.matchCount,\n matches: result.matches,\n })),\n })\n return 0\n }\n\n if (results.length === 0) {\n noResults(query)\n return 0\n }\n\n header(results.length, query, lang, \"regex\")\n for (const result of shown) {\n // A page can match on its name, title or description alone — with no body line to show.\n const count = pc.dim(\n result.matchCount ? ` ${result.matchCount} match${result.matchCount === 1 ? \"\" : \"es\"}` : \" name match\",\n )\n console.log(` ${pc.cyan(result.entry.slug)} ${result.entry.title}${count}`)\n for (const match of result.matches) {\n console.log(` ${pc.dim(String(match.line).padStart(4))} ${paintMatches(match.text, scan)}`)\n }\n }\n footer(results.length, shown.length, [\n \"vantage docs <name> open one result --limit max results (default 10)\",\n \"vantage search --json machine-readable --lang ja | en\",\n ])\n return 0\n}\n\n/** `vantage search <query> [--regex] [--limit n] [--json] [--lang ja|en]` */\nexport async function search(_root: string, args: ParsedArgs): Promise<number> {\n const query = args.positionals.slice(1).join(\" \").trim()\n if (!query) {\n log.error(\"Usage: vantage search <query> [--regex] [--limit <n>] [--lang ja|en] [--json]\")\n return 1\n }\n\n const catalog = loadCatalog()\n if (!catalog) {\n log.error(\"The bundled documentation is missing. Reinstall @squadbase/vantage, or run `pnpm build` in the framework repo.\")\n return 1\n }\n\n const langFlag = args.flags.lang\n if (langFlag !== undefined && !isDocLang(langFlag)) {\n log.error(`Unknown --lang \"${String(langFlag)}\". Available: ${DOC_LANGS.join(\", \")}`)\n return 1\n }\n const lang: DocLang = isDocLang(langFlag) ? langFlag : DEFAULT_DOC_LANG\n\n const entries = docsForLang(catalog, lang)\n if (entries.length === 0) {\n log.error(`No documentation bundled for \"${lang}\".`)\n return 1\n }\n\n // Pages that opted out with `search: false` (e.g. the changelog) are still\n // reachable via `vantage docs` but never surface here.\n const searchable = entries.filter((entry) => entry.searchable !== false)\n\n const limit = parseLimit(args.flags.limit, DEFAULT_LIMIT)\n const json = Boolean(args.flags.json)\n return args.flags.regex\n ? runRegex(searchable, query, lang, limit, json)\n : runRanked(searchable, query, lang, limit, json)\n}\n"]}
|
|
1
|
+
{"version":3,"sources":["../src/cli/search-index.ts","../src/cli/search.ts"],"names":[],"mappings":";;;;;;;;AAiBA,IAAM,aAAA,GAAgB,EAAE,IAAA,EAAM,CAAA,EAAG,OAAO,CAAA,EAAG,WAAA,EAAa,CAAA,EAAG,IAAA,EAAM,CAAA,EAAE;AAGnE,IAAM,EAAA,GAAK,GAAA;AACX,IAAM,CAAA,GAAI,IAAA;AAOV,IAAM,QAAA,GAAW,yBAAA;AACjB,IAAM,QAAA,GAAW,aAAA;AAEjB,IAAM,gBAAA,GAAmB,4BAAA;AACzB,IAAM,MAAA,GAAS,aAAA;AASf,IAAM,SAAA,GAAY,0BAAA;AAClB,IAAM,WAAA,GAAc,SAAA;AAGpB,SAAS,SAAS,IAAA,EAAsB;AACtC,EAAA,IAAI,IAAA,CAAK,MAAA,IAAU,CAAA,IAAK,IAAA,CAAK,QAAA,CAAS,KAAK,CAAA,EAAG,OAAO,CAAA,EAAG,IAAA,CAAK,KAAA,CAAM,CAAA,EAAG,EAAE,CAAC,CAAA,CAAA,CAAA;AACzE,EAAA,IAAI,KAAK,MAAA,IAAU,CAAA,IAAK,IAAA,CAAK,QAAA,CAAS,GAAG,CAAA,IAAK,CAAC,aAAA,CAAc,IAAA,CAAK,IAAI,CAAA,EAAG,OAAO,IAAA,CAAK,KAAA,CAAM,GAAG,EAAE,CAAA;AAChG,EAAA,OAAO,IAAA;AACT;AASO,SAAS,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documentation. The corpus is the catalog\n * `docs-catalog.ts` exposes — the same one `vantage docs` prints, so search never\n * creates a second source of truth.\n *\n * The index is built at run time: 65 pages per language (~300 KB) tokenize in a\n * few milliseconds, which is cheaper than shipping and version-locking a\n * prebuilt index alongside the docs bundle.\n */\n\n/**\n * Field weights. A name or a title match says far more about relevance than one\n * more occurrence in a long body, and BM25F models that as a weighted term\n * frequency (and a matching weighted document length).\n */\nconst FIELD_WEIGHTS = { slug: 3, title: 3, description: 2, body: 1 } as const\n\n/** Standard BM25 constants: term-frequency saturation and length normalization. */\nconst K1 = 1.2\nconst B = 0.75\n\n/**\n * Latin/digit runs, or runs of Japanese script (kana + CJK ideographs). CJK\n * punctuation (U+3000–U+303F, 。and 、) is deliberately outside the ranges, so\n * runs break at sentence boundaries.\n */\nconst TOKEN_RE = /[a-z0-9]+|[-ヿ㐀-䶿一-鿿]+/g\nconst LATIN_RE = /^[a-z0-9]+$/\n/** `TOKEN_RE`, but before lowercasing — for text that is not being indexed. */\nconst TOKEN_RE_ANYCASE = /[a-zA-Z0-9]+|[-ヿ㐀-䶿一-鿿]+/g\nconst CJK_RE = /[-ヿ㐀-䶿一-鿿]/\n\n/**\n * One run of a single script: hiragana (U+3041–U+309F), katakana (U+30A0–U+30FF,\n * so ー stays inside テーブル), or kanji. Japanese writes content words in\n * katakana and kanji and the grammatical glue between them in hiragana, so\n * cutting at every script change segments 「テーブルにページングを付けたい」into\n * テーブル · に · ページング · を · 付 · けたい without a morphological analyser.\n */\nconst SCRIPT_RE = /[ぁ-ゟ]+|[゠-ヿ]+|[㐀-䶿一-鿿]+/g\nconst HIRAGANA_RE = /^[ぁ-ゟ]$/\n\n/** Plural forms, so `colors` finds `color` and `queries` finds `query`. */\nfunction singular(word: string): string {\n if (word.length >= 5 && word.endsWith(\"ies\")) return `${word.slice(0, -3)}y`\n if (word.length >= 4 && word.endsWith(\"s\") && !/(ss|us|is)$/.test(word)) return word.slice(0, -1)\n return word\n}\n\n/**\n * Split text into index terms. Latin runs become words (`DataTable` splits into\n * `data` + `table`, so a two-word query finds it). Japanese runs are segmented\n * by script change; each segment is indexed whole *and* as character bigrams,\n * so an exact word scores high while a near miss (ページング / ページネーション)\n * still shares enough terms to be found.\n */\nexport function tokenize(text: string): string[] {\n const normalized = text\n .normalize(\"NFKC\")\n .replace(/([a-z0-9])([A-Z])/g, \"$1 $2\")\n .toLowerCase()\n const tokens: string[] = []\n for (const match of normalized.matchAll(TOKEN_RE)) {\n const run = match[0]!\n if (LATIN_RE.test(run)) {\n tokens.push(singular(run))\n continue\n }\n for (const segment of run.match(SCRIPT_RE) ?? []) {\n // A lone hiragana is a particle (を, に, が …): it appears in every page\n // and would make every page a match.\n if (segment.length === 1 && HIRAGANA_RE.test(segment)) continue\n // A 2-character segment is its own only bigram — pushing both would\n // double-count it.\n if (segment.length <= 2) {\n tokens.push(segment)\n continue\n }\n tokens.push(segment)\n for (let i = 0; i < segment.length - 1; i++) tokens.push(segment.slice(i, i + 2))\n }\n }\n return tokens\n}\n\n/**\n * The words a snippet should highlight: whole words and whole Japanese\n * segments as the user typed them, without the derived bigrams (highlighting\n * those would paint most of a Japanese line yellow) and without the singular\n * rewrite (which no longer appears verbatim in the text).\n */\nexport function queryPhrases(query: string): string[] {\n const phrases: string[] = []\n for (const match of query.normalize(\"NFKC\").matchAll(TOKEN_RE_ANYCASE)) {\n const run = match[0]!\n if (!CJK_RE.test(run)) {\n phrases.push(run)\n continue\n }\n for (const segment of run.match(SCRIPT_RE) ?? []) {\n if (segment.length === 1 && HIRAGANA_RE.test(segment)) continue\n phrases.push(segment)\n }\n }\n return [...new Set(phrases)]\n}\n\n/** One ranked document, with the body kept for snippet extraction. */\nexport interface SearchHit {\n entry: DocEntry\n score: number\n /** Query terms that were looked up — the input for `snippet()`. */\n terms: string[]\n body: string\n}\n\ninterface IndexedDoc {\n entry: DocEntry\n body: string\n /** Weighted term frequency across all fields. */\n tf: Map<string, number>\n /** Weighted document length. */\n length: number\n}\n\nexport interface SearchIndex {\n /** Every document with a non-zero score, best first. */\n search(query: string): SearchHit[]\n}\n\n/** Build the index for one language's catalog entries. */\nexport function buildIndex(entries: DocEntry[]): SearchIndex {\n const docs: IndexedDoc[] = entries.map((entry) => {\n const body = readDoc(entry)\n const tf = new Map<string, number>()\n let length = 0\n const add = (text: string, weight: number) => {\n for (const token of tokenize(text)) {\n tf.set(token, (tf.get(token) ?? 0) + weight)\n length += weight\n }\n }\n add(entry.slug, FIELD_WEIGHTS.slug)\n add(entry.title, FIELD_WEIGHTS.title)\n add(entry.description, FIELD_WEIGHTS.description)\n add(body, FIELD_WEIGHTS.body)\n return { entry, body, tf, length }\n })\n\n const df = new Map<string, number>()\n for (const doc of docs) {\n for (const term of doc.tf.keys()) df.set(term, (df.get(term) ?? 0) + 1)\n }\n const total = docs.length\n const avgLength = total ? docs.reduce((sum, doc) => sum + doc.length, 0) / total : 1\n\n return {\n search(query: string): SearchHit[] {\n const terms = [...new Set(tokenize(query))]\n if (terms.length === 0) return []\n\n const hits: SearchHit[] = []\n for (const doc of docs) {\n let score = 0\n for (const term of terms) {\n const tf = doc.tf.get(term)\n if (!tf) continue\n const n = df.get(term) ?? 0\n const idf = Math.log(1 + (total - n + 0.5) / (n + 0.5))\n const norm = 1 - B + (B * doc.length) / avgLength\n score += idf * ((tf * (K1 + 1)) / (tf + K1 * norm))\n }\n if (score > 0) hits.push({ entry: doc.entry, score, terms, body: doc.body })\n }\n hits.sort((a, b) => b.score - a.score || a.entry.slug.localeCompare(b.entry.slug))\n return hits\n },\n }\n}\n\n/** How much of a line to show around the first matched term. */\nconst SNIPPET_LENGTH = 150\n\n/**\n * Pick the passage that best covers the query terms. Lines are compared\n * lowercased only (no NFKC, no camelCase splitting) so offsets stay aligned\n * with the text that is printed.\n */\nexport function snippet(body: string, terms: string[], length = SNIPPET_LENGTH): string {\n let best = \"\"\n let bestHits = 0\n let bestIndex = 0\n let bestIsHeading = true\n\n // The first line is the page's own `# Title`, which the caller already shows.\n for (const raw of body.split(\"\\n\").slice(1)) {\n const line = raw.replace(/^\\s*[-*]\\s+/, \"\").replace(/\\s+/g, \" \").trim()\n if (!line || /^(```|~~~|\\|\\s*-{2,})/.test(line)) continue\n const haystack = line.toLowerCase()\n const heading = line.startsWith(\"#\")\n let hits = 0\n let first = -1\n for (const term of terms) {\n const at = haystack.indexOf(term)\n if (at === -1) continue\n hits++\n if (first === -1 || at < first) first = at\n }\n // Equal coverage: prose says more than a heading does.\n if (hits > bestHits || (hits === bestHits && hits > 0 && bestIsHeading && !heading)) {\n best = line\n bestHits = hits\n bestIndex = first\n bestIsHeading = heading\n }\n }\n\n if (!bestHits) return \"\"\n if (best.length <= length) return best\n\n const start = Math.max(0, bestIndex - Math.floor(length / 4))\n const text = best.slice(start, start + length).trim()\n return `${start > 0 ? \"…\" : \"\"}${text}${start + length < best.length ? \"…\" : \"\"}`\n}\n","import pc from \"picocolors\"\nimport {\n DEFAULT_DOC_LANG,\n DOC_LANGS,\n docsForLang,\n isDocLang,\n loadCatalog,\n readDoc,\n type DocEntry,\n type DocLang,\n} from \"./docs-catalog\"\nimport { buildIndex, queryPhrases, snippet, type SearchHit } from \"./search-index\"\nimport { log, printJson, type ParsedArgs } from \"./util\"\n\n/** Results shown when `--limit` is absent. */\nconst DEFAULT_LIMIT = 10\n\n/** Matching lines printed per page in regex mode (the count is always exact). */\nconst MAX_REGEX_LINES = 3\n\n/** Parse `--limit`, falling back silently — an off result list is not a failure. */\nfunction parseLimit(value: string | boolean | undefined, fallback: number): number {\n if (typeof value === \"string\") {\n const n = Number(value)\n if (Number.isInteger(n) && n > 0) return n\n }\n return fallback\n}\n\nfunction escapeRegExp(value: string): string {\n return value.replace(/[.*+?^${}()|[\\]\\\\]/g, \"\\\\$&\")\n}\n\n/** Dim a line, with every match of `re` picked out. Piped output stays plain. */\nfunction paintMatches(text: string, re: RegExp): string {\n if (!process.stdout.isTTY) return text\n let out = \"\"\n let last = 0\n for (const match of text.matchAll(re)) {\n const at = match.index ?? 0\n if (!match[0]) continue // zero-length match: nothing to highlight\n out += pc.dim(text.slice(last, at)) + pc.yellow(match[0])\n last = at + match[0].length\n }\n return out + pc.dim(text.slice(last))\n}\n\n/** Same, for the words of a natural-language query. */\nfunction paintTerms(text: string, words: string[]): string {\n if (!process.stdout.isTTY) return text\n if (words.length === 0) return pc.dim(text)\n return paintMatches(text, new RegExp(words.map(escapeRegExp).join(\"|\"), \"gi\"))\n}\n\nfunction header(count: number, query: string, lang: DocLang, mode: string): void {\n const label = `${count} result${count === 1 ? \"\" : \"s\"} for \"${query}\"`\n console.log(\"\")\n console.log(pc.bold(label) + pc.dim(` ${lang} · ${mode}`))\n console.log(\"\")\n}\n\nfunction footer(total: number, shown: number, lines: string[]): void {\n if (total > shown) {\n console.log(\"\")\n console.log(pc.dim(` ${total - shown} more — raise --limit to see them`))\n }\n console.log(\"\")\n for (const line of lines) console.log(pc.dim(line))\n}\n\nfunction noResults(query: string): void {\n log.warn(`Nothing matches \"${query}\".`)\n console.log(pc.dim(\" Try fewer or more general words, or run `vantage docs --list` to browse every page.\"))\n}\n\nfunction meta(entry: DocEntry) {\n return {\n slug: entry.slug,\n title: entry.title,\n description: entry.description,\n section: entry.section,\n sectionTitle: entry.sectionTitle,\n command: `vantage docs ${entry.slug}`,\n }\n}\n\n/** Default mode: rank the corpus with BM25 and show the best passage of each hit. */\nfunction runRanked(entries: DocEntry[], query: string, lang: DocLang, limit: number, json: boolean): number {\n const hits = buildIndex(entries).search(query)\n const shown = hits.slice(0, limit)\n const passage = (hit: SearchHit) => snippet(hit.body, hit.terms)\n\n if (json) {\n printJson({\n query,\n mode: \"bm25\",\n lang,\n count: hits.length,\n results: shown.map((hit) => ({\n ...meta(hit.entry),\n score: Math.round(hit.score * 1000) / 1000,\n snippet: passage(hit),\n })),\n })\n return 0\n }\n\n if (hits.length === 0) {\n noResults(query)\n return 0\n }\n\n const words = queryPhrases(query)\n const width = Math.max(...shown.map((hit) => hit.entry.slug.length))\n header(hits.length, query, lang, \"bm25\")\n for (const hit of shown) {\n const title = `${hit.entry.title}${pc.dim(` · ${hit.entry.sectionTitle}`)}`\n console.log(` ${pc.cyan(hit.entry.slug.padEnd(width))} ${title}`)\n const text = passage(hit)\n if (text) console.log(` ${\" \".repeat(width)} ${paintTerms(text, words)}`)\n }\n footer(hits.length, shown.length, [\n \"vantage docs <name> open one result --regex treat the query as a regular expression\",\n \"vantage search --json machine-readable --limit max results (default 10)\",\n ])\n return 0\n}\n\n/** `--regex` mode: scan names, titles and bodies for a regular expression. */\nfunction runRegex(entries: DocEntry[], query: string, lang: DocLang, limit: number, json: boolean): number {\n let scan: RegExp\n let probe: RegExp\n try {\n scan = new RegExp(query, \"gi\")\n probe = new RegExp(query, \"i\")\n } catch (err) {\n log.error(err instanceof Error ? err.message : `Invalid regular expression: ${String(err)}`)\n return 1\n }\n\n const results: { entry: DocEntry; matchCount: number; matches: { line: number; text: string }[] }[] = []\n for (const entry of entries) {\n const lines = readDoc(entry).split(\"\\n\")\n const matches: { line: number; text: string }[] = []\n let matchCount = 0\n for (let i = 0; i < lines.length; i++) {\n const found = [...lines[i]!.matchAll(scan)]\n if (found.length === 0) continue\n matchCount += found.length\n if (matches.length < MAX_REGEX_LINES) {\n matches.push({ line: i + 1, text: lines[i]!.replace(/\\s+/g, \" \").trim() })\n }\n }\n const inMeta = probe.test(entry.slug) || probe.test(entry.title) || probe.test(entry.description)\n if (matchCount === 0 && !inMeta) continue\n results.push({ entry, matchCount, matches })\n }\n // Stable sort: pages with more matches first, catalog order within ties.\n results.sort((a, b) => b.matchCount - a.matchCount)\n const shown = results.slice(0, limit)\n\n if (json) {\n printJson({\n query,\n mode: \"regex\",\n lang,\n count: results.length,\n results: shown.map((result) => ({\n ...meta(result.entry),\n matchCount: result.matchCount,\n matches: result.matches,\n })),\n })\n return 0\n }\n\n if (results.length === 0) {\n noResults(query)\n return 0\n }\n\n header(results.length, query, lang, \"regex\")\n for (const result of shown) {\n // A page can match on its name, title or description alone — with no body line to show.\n const count = pc.dim(\n result.matchCount ? ` ${result.matchCount} match${result.matchCount === 1 ? \"\" : \"es\"}` : \" name match\",\n )\n console.log(` ${pc.cyan(result.entry.slug)} ${result.entry.title}${count}`)\n for (const match of result.matches) {\n console.log(` ${pc.dim(String(match.line).padStart(4))} ${paintMatches(match.text, scan)}`)\n }\n }\n footer(results.length, shown.length, [\n \"vantage docs <name> open one result --limit max results (default 10)\",\n \"vantage search --json machine-readable --lang ja | en\",\n ])\n return 0\n}\n\n/** `vantage search <query> [--regex] [--limit n] [--json] [--lang ja|en]` */\nexport async function search(_root: string, args: ParsedArgs): Promise<number> {\n const query = args.positionals.slice(1).join(\" \").trim()\n if (!query) {\n log.error(\"Usage: vantage search <query> [--regex] [--limit <n>] [--lang ja|en] [--json]\")\n return 1\n }\n\n const catalog = loadCatalog()\n if (!catalog) {\n log.error(\"The bundled documentation is missing. Reinstall @squadbase/vantage, or run `pnpm build` in the framework repo.\")\n return 1\n }\n\n const langFlag = args.flags.lang\n if (langFlag !== undefined && !isDocLang(langFlag)) {\n log.error(`Unknown --lang \"${String(langFlag)}\". Available: ${DOC_LANGS.join(\", \")}`)\n return 1\n }\n const lang: DocLang = isDocLang(langFlag) ? langFlag : DEFAULT_DOC_LANG\n\n const entries = docsForLang(catalog, lang)\n if (entries.length === 0) {\n log.error(`No documentation bundled for \"${lang}\".`)\n return 1\n }\n\n // Pages that opted out with `search: false` (e.g. the changelog) are still\n // reachable via `vantage docs` but never surface here.\n const searchable = entries.filter((entry) => entry.searchable !== false)\n\n const limit = parseLimit(args.flags.limit, DEFAULT_LIMIT)\n const json = Boolean(args.flags.json)\n return args.flags.regex\n ? runRegex(searchable, query, lang, limit, json)\n : runRanked(searchable, query, lang, limit, json)\n}\n"]}
|
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
import { syncAgentsFile } from './chunk-
|
|
1
|
+
import { syncAgentsFile } from './chunk-QDZA5JSL.js';
|
|
2
2
|
import { generateArtifacts } from './chunk-EP6JHXSR.js';
|
|
3
3
|
import './chunk-KLEIVDUV.js';
|
|
4
4
|
import { scanProject } from './chunk-ZVANIULZ.js';
|
|
5
|
-
import { frameworkVersion, printJson, log } from './chunk-
|
|
5
|
+
import { frameworkVersion, printJson, log } from './chunk-3G43C6OL.js';
|
|
6
6
|
import './chunk-C2CX6GLX.js';
|
|
7
7
|
|
|
8
8
|
// @squadbase/vantage — generated build. Do not edit.
|
|
@@ -25,5 +25,5 @@ async function upgrade(root, args) {
|
|
|
25
25
|
}
|
|
26
26
|
|
|
27
27
|
export { upgrade };
|
|
28
|
-
//# sourceMappingURL=upgrade-
|
|
29
|
-
//# sourceMappingURL=upgrade-
|
|
28
|
+
//# sourceMappingURL=upgrade-GF2P67M6.js.map
|
|
29
|
+
//# sourceMappingURL=upgrade-GF2P67M6.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/cli/upgrade.ts"],"names":[],"mappings":";;;;;;;;;;AAWA,eAAsB,OAAA,CAAQ,MAAc,IAAA,EAAmC;AAC7E,EAAA,MAAM,UAAU,gBAAA,EAAiB;AACjC,EAAA,MAAM,KAAA,GAAQ,YAAY,IAAI,CAAA;AAC9B,EAAA,iBAAA,CAAkB,EAAE,IAAA,EAAM,KAAA,EAAO,CAAA;AAKjC,EAAA,MAAM,MAAA,GAAS,eAAe,IAAI,CAAA;AAElC,EAAA,IAAI,IAAA,CAAK,MAAM,IAAA,EAAM;AACnB,IAAA,SAAA,CAAU,EAAE,EAAA,EAAI,IAAA,EAAM,OAAA,EAAS,UAAA,EAAY,EAAC,EAAG,WAAA,EAAa,IAAA,EAAM,YAAA,EAAc,MAAA,KAAW,SAAA,EAAW,CAAA;AACtG,IAAA,OAAO,CAAA;AAAA,EACT;AAEA,EAAA,GAAA,CAAI,KAAA,CAAM,CAAA,gBAAA,EAAc,OAAO,CAAA,CAAE,CAAA;AACjC,EAAA,GAAA,CAAI,GAAG,iCAAiC,CAAA;AACxC,EAAA,IAAI,MAAA,KAAW,SAAA,EAAW,GAAA,CAAI,EAAA,CAAG,kDAAkD,CAAA;AACnF,EAAA,GAAA,CAAI,KAAK,wDAAwD,CAAA;AACjE,EAAA,OAAO,CAAA;AACT","file":"upgrade-
|
|
1
|
+
{"version":3,"sources":["../src/cli/upgrade.ts"],"names":[],"mappings":";;;;;;;;;;AAWA,eAAsB,OAAA,CAAQ,MAAc,IAAA,EAAmC;AAC7E,EAAA,MAAM,UAAU,gBAAA,EAAiB;AACjC,EAAA,MAAM,KAAA,GAAQ,YAAY,IAAI,CAAA;AAC9B,EAAA,iBAAA,CAAkB,EAAE,IAAA,EAAM,KAAA,EAAO,CAAA;AAKjC,EAAA,MAAM,MAAA,GAAS,eAAe,IAAI,CAAA;AAElC,EAAA,IAAI,IAAA,CAAK,MAAM,IAAA,EAAM;AACnB,IAAA,SAAA,CAAU,EAAE,EAAA,EAAI,IAAA,EAAM,OAAA,EAAS,UAAA,EAAY,EAAC,EAAG,WAAA,EAAa,IAAA,EAAM,YAAA,EAAc,MAAA,KAAW,SAAA,EAAW,CAAA;AACtG,IAAA,OAAO,CAAA;AAAA,EACT;AAEA,EAAA,GAAA,CAAI,KAAA,CAAM,CAAA,gBAAA,EAAc,OAAO,CAAA,CAAE,CAAA;AACjC,EAAA,GAAA,CAAI,GAAG,iCAAiC,CAAA;AACxC,EAAA,IAAI,MAAA,KAAW,SAAA,EAAW,GAAA,CAAI,EAAA,CAAG,kDAAkD,CAAA;AACnF,EAAA,GAAA,CAAI,KAAK,wDAAwD,CAAA;AACjE,EAAA,OAAO,CAAA;AACT","file":"upgrade-GF2P67M6.js","sourcesContent":["import { generateArtifacts } from \"../core/generate\"\nimport { scanProject } from \"../core/scan\"\nimport { syncAgentsFile } from \"./add\"\nimport { frameworkVersion, log, printJson, type ParsedArgs } from \"./util\"\n\n/**\n * `vantage upgrade` — reconcile generated artifacts with the installed\n * framework version and apply any needed code transforms. v0.1 only\n * regenerates artifacts and re-syncs a managed AGENTS.md + agents/*.md; the\n * migration hook exists for future major versions.\n */\nexport async function upgrade(root: string, args: ParsedArgs): Promise<number> {\n const version = frameworkVersion()\n const model = scanProject(root)\n generateArtifacts({ root, model })\n\n // Keep an adopted AGENTS.md + agents/*.md (the app-author map and its\n // per-artifact-type knowledge files) in step with the framework's canonical\n // copies. No-op when the app never ran `vantage add agents`.\n const agents = syncAgentsFile(root)\n\n if (args.flags.json) {\n printJson({ ok: true, version, transforms: [], regenerated: true, agentsSynced: agents === \"updated\" })\n return 0\n }\n\n log.brand(`upgrade → v${version}`)\n log.ok(\"Regenerated .vantage artifacts.\")\n if (agents === \"updated\") log.ok(\"Synced AGENTS.md and agents/ from the framework.\")\n log.info(\"No breaking code transforms required for this version.\")\n return 0\n}\n"]}
|
package/docs/en/changelog.md
CHANGED
|
@@ -9,19 +9,6 @@ What changed in each Vantage release. Newest is on top.
|
|
|
9
9
|
> minor release may include backwards-incompatible changes. A patch is limited to
|
|
10
10
|
> backwards-compatible additions and bug fixes.
|
|
11
11
|
|
|
12
|
-
## v0.6.2
|
|
13
|
-
|
|
14
|
-
The dev server can now run behind a reverse proxy (2026-09-23).
|
|
15
|
-
|
|
16
|
-
### Added
|
|
17
|
-
|
|
18
|
-
- **`--host [addr]` and `--allowed-hosts <list|true>`** on `vantage dev` / SPA `vantage preview`.
|
|
19
|
-
Vite rejects with 403 any request whose `Host` header is not `localhost`, so anything with
|
|
20
|
-
**another hostname in front of the server** — a sandbox preview proxy, a tunnel — could not reach
|
|
21
|
-
it before. `--allowed-hosts` can also come from the **`VANTAGE_ALLOWED_HOSTS`** environment
|
|
22
|
-
variable (the flag wins). With neither, nothing changes. See the
|
|
23
|
-
[CLI reference](cli-reference).
|
|
24
|
-
|
|
25
12
|
## v0.6.1
|
|
26
13
|
|
|
27
14
|
Pages can now be written as documents (2026-09-25).
|
package/docs/en/cli-reference.md
CHANGED
|
@@ -357,36 +357,6 @@ vantage dev --strict-port # will not start unless 5173 is free
|
|
|
357
357
|
> default silently. A fullstack `preview` binds its Node server to exactly one port, so it is **always**
|
|
358
358
|
> strict and `--no-strict-port` has no effect there.
|
|
359
359
|
|
|
360
|
-
## `--host` / `--allowed-hosts` — running behind a reverse proxy
|
|
361
|
-
|
|
362
|
-
By default `vantage dev` and a SPA `vantage preview` bind to `localhost` only and **reject with 403**
|
|
363
|
-
any request whose `Host` header is not `localhost` or the bound address (Vite's DNS-rebinding
|
|
364
|
-
protection). When something with **another hostname** sits in front of the server — a sandbox
|
|
365
|
-
preview proxy, a tunnel, a container network — these two flags let it through.
|
|
366
|
-
|
|
367
|
-
```bash
|
|
368
|
-
vantage dev --host # listen on every interface
|
|
369
|
-
vantage dev --host 0.0.0.0 # or on one address (--host=:: works too)
|
|
370
|
-
vantage dev --allowed-hosts preview.example.com # allow the hostname the proxy presents (comma-separated for several)
|
|
371
|
-
vantage dev --allowed-hosts true # disable the Host check altogether
|
|
372
|
-
```
|
|
373
|
-
|
|
374
|
-
| Flag | Meaning |
|
|
375
|
-
|---|---|
|
|
376
|
-
| `--host [addr]` | Without a value, bind to **every interface**; with one, bind to that address (Vite's `server.host`) |
|
|
377
|
-
| `--allowed-hosts <list\|true>` | The `Host` headers to accept, comma-separated. `true` disables the check (Vite's `server.allowedHosts`) |
|
|
378
|
-
|
|
379
|
-
`--allowed-hosts` can also come from the environment variable **`VANTAGE_ALLOWED_HOSTS`** (same
|
|
380
|
-
format), which suits a supervisor that starts the server and knows the hostname. When both are
|
|
381
|
-
present, **the flag wins**. With neither, Vite's default applies and only `localhost` is accepted,
|
|
382
|
-
exactly as before.
|
|
383
|
-
|
|
384
|
-
> [!NOTE]
|
|
385
|
-
> `--host` takes the next token as its value, so `vantage --host dev` would read `dev` as the
|
|
386
|
-
> address — write `--host=<addr>` or put `--host` last when a command or path follows it. A fullstack
|
|
387
|
-
> `preview` runs the Node server, which listens on every interface and does no `Host` check, so
|
|
388
|
-
> neither flag has an effect there (the command says so).
|
|
389
|
-
|
|
390
360
|
## Browser output in dev — forwarding and the overlay
|
|
391
361
|
|
|
392
362
|
`vantage dev` **forwards what happens in the browser to the dev terminal**. By default that means
|
package/docs/ja/changelog.md
CHANGED
|
@@ -8,19 +8,6 @@ Vantage のリリースごとの変更点です。新しいものが上に来ま
|
|
|
8
8
|
> まだプロトタイプ(**0.x**)です。0.x の間は **minor が実質のメジャー**扱いで、後方互換性の
|
|
9
9
|
> ない変更は minor で入ることがあります。patch は後方互換の機能追加とバグ修正のみです。
|
|
10
10
|
|
|
11
|
-
## v0.6.2
|
|
12
|
-
|
|
13
|
-
リバースプロキシの後ろで dev サーバーを動かせるようになりました(2026-09-23)。
|
|
14
|
-
|
|
15
|
-
### 追加
|
|
16
|
-
|
|
17
|
-
- **`--host [addr]` と `--allowed-hosts <list|true>`** を `vantage dev` / `vantage preview`(SPA)に
|
|
18
|
-
追加しました。Vite は `Host` ヘッダが `localhost` 以外のリクエストを 403 で拒否するため、
|
|
19
|
-
サンドボックスのプレビュープロキシやトンネルなど**別のホスト名で前に立つもの**があると
|
|
20
|
-
そのままでは届きませんでした。`--allowed-hosts` は環境変数 **`VANTAGE_ALLOWED_HOSTS`** でも
|
|
21
|
-
渡せます(フラグが優先)。どちらも指定しなければ挙動は従来どおりです。詳細は
|
|
22
|
-
[CLI リファレンス](cli-reference)を参照してください。
|
|
23
|
-
|
|
24
11
|
## v0.6.1
|
|
25
12
|
|
|
26
13
|
ドキュメントのページを書けるようになりました(2026-09-25)。
|
package/docs/ja/cli-reference.md
CHANGED
|
@@ -351,35 +351,6 @@ vantage dev --strict-port # 5173 が取れなければ起動し
|
|
|
351
351
|
> また fullstack の `preview` は Node サーバーを 1 ポートに bind するだけなので**常に厳格**で、
|
|
352
352
|
> `--no-strict-port` は効きません。
|
|
353
353
|
|
|
354
|
-
## `--host` / `--allowed-hosts` — リバースプロキシの後ろで動かす
|
|
355
|
-
|
|
356
|
-
`vantage dev` と `vantage preview`(SPA)は、既定では `localhost` にしか bind せず、`Host` ヘッダが
|
|
357
|
-
`localhost` か bind したアドレス以外のリクエストを **403 で拒否**します(Vite の DNS リバインディング
|
|
358
|
-
対策)。サンドボックスのプレビュープロキシ・トンネル・コンテナのネットワークなど、**別のホスト名で
|
|
359
|
-
前に立つもの**があるときは、この 2 つを組み合わせて通します。
|
|
360
|
-
|
|
361
|
-
```bash
|
|
362
|
-
vantage dev --host # すべてのインターフェースで listen
|
|
363
|
-
vantage dev --host 0.0.0.0 # アドレスを明示(--host=:: の形も可)
|
|
364
|
-
vantage dev --allowed-hosts preview.example.com # プロキシが名乗るホスト名を許可(カンマ区切りで複数)
|
|
365
|
-
vantage dev --allowed-hosts true # Host の検査そのものを無効化
|
|
366
|
-
```
|
|
367
|
-
|
|
368
|
-
| フラグ | 意味 |
|
|
369
|
-
|---|---|
|
|
370
|
-
| `--host [addr]` | 値なしなら**すべてのインターフェース**、値があればそのアドレスに bind する(Vite の `server.host`)|
|
|
371
|
-
| `--allowed-hosts <list\|true>` | 受け付ける `Host` ヘッダの一覧(カンマ区切り)。`true` で検査を無効化(Vite の `server.allowedHosts`)|
|
|
372
|
-
|
|
373
|
-
`--allowed-hosts` は環境変数 **`VANTAGE_ALLOWED_HOSTS`** でも渡せます(同じ書式)。サーバーを起動する
|
|
374
|
-
側の仕組みがホスト名を知っている場合はそちらが便利です。フラグと環境変数の両方があれば**フラグが
|
|
375
|
-
勝ちます**。どちらも無ければ Vite の既定のままで、これまでどおり `localhost` だけを受け付けます。
|
|
376
|
-
|
|
377
|
-
> [!NOTE]
|
|
378
|
-
> `--host` の値は次のトークンを取ります。`vantage --host dev` のように直後にコマンドやパスが来る
|
|
379
|
-
> 書き方は値と取り違えるので、その場合は `--host=<addr>` か、末尾に `--host` を置いてください。
|
|
380
|
-
> fullstack の `preview` は Node サーバーがすべてのインターフェースで listen し `Host` を検査しない
|
|
381
|
-
> ので、どちらのフラグも効きません(その旨が表示されます)。
|
|
382
|
-
|
|
383
354
|
## dev のブラウザ出力 — 転送とオーバーレイ
|
|
384
355
|
|
|
385
356
|
`vantage dev` は、ブラウザ側で起きたことを**開発ターミナルへ転送します**。既定で転送するのは
|
package/package.json
CHANGED
|
@@ -106,10 +106,12 @@ node <このスキルの場所>/scripts/contrast.mjs '<文字色>' '<背景色>'
|
|
|
106
106
|
見出しだけに使う色は 3:1 以上。`var(--color-*)` で書いた値は Tailwind の `oklch()` 値に直してから渡す。
|
|
107
107
|
落ちたら明度を調整して、提案に戻らずに直してよい(直したことは報告する)。
|
|
108
108
|
|
|
109
|
-
### 5. プレビューを見せる
|
|
109
|
+
### 5. プレビューを見せる(省略しない)
|
|
110
110
|
|
|
111
|
-
-
|
|
112
|
-
|
|
111
|
+
- **必ず**使い捨てページ `src/design-preview.tsx`(`src/` が無ければルート直下)を作る: KPI カード
|
|
112
|
+
3〜4 枚、`EChart` の棒または折れ線 1 つ(5 系列)、主要ボタン・破壊的ボタン、補足の文字。すべて
|
|
113
|
+
トークンで書く。既存ページやホームで代用しない ― ホームなどの画面はチャートやボタンを持たないことが
|
|
114
|
+
多く、変更後の色が見えない。
|
|
113
115
|
- スライドがあるなら既存のデッキの URL を案内する(プレビュー用のデッキは作らない)。
|
|
114
116
|
- **ユーザーが承認したら `src/design-preview.tsx` を削除する。** 残すとナビに出る。
|
|
115
117
|
|
|
@@ -121,6 +123,14 @@ npx vantage check
|
|
|
121
123
|
|
|
122
124
|
`HARDCODED_COLOR`(ページ内の色コード)や `DESIGN_MD_TOO_LONG` が出たらその場で直す。
|
|
123
125
|
|
|
126
|
+
### 7. 完了を報告する
|
|
127
|
+
|
|
128
|
+
報告には、更新したファイル(`DESIGN.md` / `styles.css`)に加えて次を**必ず**入れる。
|
|
129
|
+
|
|
130
|
+
- プレビューページのパスと URL(`src/design-preview.tsx` → `/design-preview`)。
|
|
131
|
+
- 「ホームなど既存の画面は一部の色しか使っていないので、変更が見えないことがある。配色はプレビュー
|
|
132
|
+
ページで確認してほしい」という一言。
|
|
133
|
+
|
|
124
134
|
## 会話中の指示との関係
|
|
125
135
|
|
|
126
136
|
- 会話中の個別の指示(「このグラフだけ赤で」)は `DESIGN.md` より優先する。そのページだけ直せばよい。
|