@shortwind/cli 0.1.0-beta.12 → 0.1.0-beta.13
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/{bench-BGO3pupw.js → bench-B7SxNGiU.js} +57 -9
- package/dist/bench-B7SxNGiU.js.map +1 -0
- package/dist/bin.js +143 -3
- package/dist/bin.js.map +1 -1
- package/dist/index.d.ts +4 -1
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +1 -1
- package/package.json +3 -3
- package/dist/bench-BGO3pupw.js.map +0 -1
package/dist/bin.js
CHANGED
|
@@ -1,8 +1,103 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
|
-
import { C as cliVersion, S as DEFAULT_REGISTRY, _ as
|
|
2
|
+
import { C as readConfig, D as init, E as cliVersion, M as detectProject, S as installedFamilies, T as DEFAULT_REGISTRY, _ as reseal, a as extractClassUsages, b as remove, c as verify, d as dev, f as BuildError, g as preset, h as ls, i as DEFAULT_CONTENT, l as UpgradeError, m as formatLsText, n as formatBenchTable, o as formatFindingsText, p as build, r as ALL_RULES, s as lint, t as bench, u as upgrade, v as NewFamilyError, x as add, y as newFamily } from "./bench-B7SxNGiU.js";
|
|
3
|
+
import { existsSync, readFileSync } from "node:fs";
|
|
4
|
+
import { readFile } from "node:fs/promises";
|
|
5
|
+
import path from "node:path";
|
|
6
|
+
import { buildRegistry, parseRecipeFile } from "@shortwind/core";
|
|
7
|
+
import { findResidualRecipeTokens } from "@shortwind/tailwind";
|
|
8
|
+
import { glob } from "tinyglobby";
|
|
3
9
|
import * as p from "@clack/prompts";
|
|
4
10
|
import pc from "picocolors";
|
|
5
11
|
import { cac } from "cac";
|
|
12
|
+
//#region src/commands/doctor.ts
|
|
13
|
+
const DEFAULT_OUTPUT_DIRS = [
|
|
14
|
+
".next",
|
|
15
|
+
"dist",
|
|
16
|
+
"out",
|
|
17
|
+
"build"
|
|
18
|
+
];
|
|
19
|
+
const OUTPUT_GLOB = "**/*.{html,htm,js,mjs,cjs,rsc}";
|
|
20
|
+
const OUTPUT_IGNORE = ["**/node_modules/**", "**/cache/**"];
|
|
21
|
+
async function doctor(options) {
|
|
22
|
+
const cwd = path.resolve(options.cwd);
|
|
23
|
+
const config = await readConfig(cwd);
|
|
24
|
+
const recipesDir = path.join(cwd, config.recipesDir);
|
|
25
|
+
const registry = loadRegistryLenient(recipesDir);
|
|
26
|
+
const outputDirs = (options.dirs ?? DEFAULT_OUTPUT_DIRS).filter((d) => existsSync(path.join(cwd, d)));
|
|
27
|
+
if (outputDirs.length === 0) return {
|
|
28
|
+
ok: false,
|
|
29
|
+
verdict: "no-output",
|
|
30
|
+
outputDirs: [],
|
|
31
|
+
scannedFiles: 0,
|
|
32
|
+
findings: [],
|
|
33
|
+
usedInSource: []
|
|
34
|
+
};
|
|
35
|
+
const files = await glob(outputDirs.map((d) => path.posix.join(d.split(path.sep).join("/"), OUTPUT_GLOB)), {
|
|
36
|
+
cwd,
|
|
37
|
+
absolute: true,
|
|
38
|
+
onlyFiles: true,
|
|
39
|
+
ignore: OUTPUT_IGNORE
|
|
40
|
+
});
|
|
41
|
+
const findings = [];
|
|
42
|
+
for (const file of files.sort()) {
|
|
43
|
+
const tokens = findResidualRecipeTokens(await readFile(file, "utf8"), registry);
|
|
44
|
+
if (tokens.length > 0) findings.push({
|
|
45
|
+
file,
|
|
46
|
+
tokens
|
|
47
|
+
});
|
|
48
|
+
}
|
|
49
|
+
const usedInSource = await scanSourceUsage(cwd, recipesDir, registry, options.content ?? config.content);
|
|
50
|
+
let verdict = "clean";
|
|
51
|
+
if (findings.length > 0) {
|
|
52
|
+
const raw = new Set(findings.flatMap((f) => f.tokens));
|
|
53
|
+
verdict = usedInSource.length > 0 && usedInSource.every((t) => raw.has(t)) ? "not-wired" : "leak";
|
|
54
|
+
}
|
|
55
|
+
return {
|
|
56
|
+
ok: verdict === "clean",
|
|
57
|
+
verdict,
|
|
58
|
+
outputDirs,
|
|
59
|
+
scannedFiles: files.length,
|
|
60
|
+
findings,
|
|
61
|
+
usedInSource
|
|
62
|
+
};
|
|
63
|
+
}
|
|
64
|
+
function loadRegistryLenient(recipesDir) {
|
|
65
|
+
const allRecipes = [];
|
|
66
|
+
for (const family of installedFamilies(recipesDir)) {
|
|
67
|
+
const parsed = parseRecipeFile(readFileSync(path.join(recipesDir, `${family}.css`), "utf8"), `${family}.css`);
|
|
68
|
+
if (parsed.ok) allRecipes.push(...parsed.value.recipes);
|
|
69
|
+
}
|
|
70
|
+
const built = buildRegistry(allRecipes);
|
|
71
|
+
if (built.ok) return built.value;
|
|
72
|
+
return {
|
|
73
|
+
flattened: Object.fromEntries(allRecipes.map((r) => [r.name, []])),
|
|
74
|
+
families: {}
|
|
75
|
+
};
|
|
76
|
+
}
|
|
77
|
+
async function scanSourceUsage(cwd, recipesDir, registry, content) {
|
|
78
|
+
const recipesIgnore = path.posix.join(path.relative(cwd, recipesDir).split(path.sep).join("/") || ".", "**");
|
|
79
|
+
const files = await glob(content ?? DEFAULT_CONTENT, {
|
|
80
|
+
cwd,
|
|
81
|
+
absolute: true,
|
|
82
|
+
onlyFiles: true,
|
|
83
|
+
ignore: [
|
|
84
|
+
"**/node_modules/**",
|
|
85
|
+
"**/dist/**",
|
|
86
|
+
"**/.next/**",
|
|
87
|
+
recipesIgnore
|
|
88
|
+
]
|
|
89
|
+
});
|
|
90
|
+
const used = /* @__PURE__ */ new Set();
|
|
91
|
+
for (const file of files) {
|
|
92
|
+
const source = await readFile(file, "utf8");
|
|
93
|
+
for (const usage of extractClassUsages(source)) for (const token of usage.tokens) {
|
|
94
|
+
if (!token.value.startsWith("@")) continue;
|
|
95
|
+
if (Object.hasOwn(registry.flattened, token.value.slice(1))) used.add(token.value);
|
|
96
|
+
}
|
|
97
|
+
}
|
|
98
|
+
return [...used].sort();
|
|
99
|
+
}
|
|
100
|
+
//#endregion
|
|
6
101
|
//#region src/cli.ts
|
|
7
102
|
const KNOWN_PRESETS = [
|
|
8
103
|
"starter",
|
|
@@ -184,7 +279,17 @@ async function run(argv = process.argv) {
|
|
|
184
279
|
}
|
|
185
280
|
process.exit(1);
|
|
186
281
|
});
|
|
187
|
-
cli.command("
|
|
282
|
+
cli.command("doctor", "Scan build output for unexpanded @recipe tokens").option("--dir <path>", "Output directory to scan (repeatable; default: .next, dist, out, build)").option("--json", "Emit machine-readable JSON").option("--cwd <dir>", "Working directory").action(async (opts) => {
|
|
283
|
+
const cwd = opts.cwd ?? process.cwd();
|
|
284
|
+
const doctorOptions = { cwd };
|
|
285
|
+
if (opts.dir !== void 0) doctorOptions.dirs = Array.isArray(opts.dir) ? opts.dir : [opts.dir];
|
|
286
|
+
const result = await doctor(doctorOptions);
|
|
287
|
+
if (opts.json) process.stdout.write(JSON.stringify(result, null, 2) + "\n");
|
|
288
|
+
else printDoctorReport(result, cwd);
|
|
289
|
+
if (result.verdict === "no-output") process.exit(2);
|
|
290
|
+
if (!result.ok) process.exit(1);
|
|
291
|
+
});
|
|
292
|
+
cli.command("lint", "Static analysis over source files and recipes").option("--fix", "Apply auto-fixes where supported").option("--rule <rule>", "Only run the named rule (repeatable)").option("--content <glob>", "Source glob to scan for recipe usage (repeatable; overrides config)").option("--json", "Emit machine-readable JSON").option("--cwd <dir>", "Working directory").action(async (opts) => {
|
|
188
293
|
const requested = opts.rule === void 0 ? [] : Array.isArray(opts.rule) ? opts.rule : [opts.rule];
|
|
189
294
|
for (const r of requested) if (!ALL_RULES.includes(r)) {
|
|
190
295
|
process.stderr.write(`unknown rule: ${r}\n`);
|
|
@@ -194,12 +299,14 @@ async function run(argv = process.argv) {
|
|
|
194
299
|
const lintOptions = { cwd: opts.cwd ?? process.cwd() };
|
|
195
300
|
if (opts.fix) lintOptions.fix = true;
|
|
196
301
|
if (requested.length > 0) lintOptions.rules = requested;
|
|
302
|
+
if (opts.content !== void 0) lintOptions.content = Array.isArray(opts.content) ? opts.content : [opts.content];
|
|
197
303
|
const result = await lint(lintOptions);
|
|
198
304
|
if (opts.json) process.stdout.write(JSON.stringify(result, null, 2) + "\n");
|
|
199
305
|
else {
|
|
200
306
|
const text = formatFindingsText(result.findings);
|
|
201
307
|
if (text) process.stdout.write(text + "\n");
|
|
202
308
|
for (const f of result.filesFixed) p.log.success(`fixed ${f}`);
|
|
309
|
+
if (result.scannedFiles === 0) p.log.warn("content scan matched no source files — usage rules (recipe/unused) were skipped.\nPoint lint at your sources with \"content\" in shortwind.config.json or --content <glob>.");
|
|
203
310
|
if (result.findings.length === 0) p.log.success("no findings");
|
|
204
311
|
}
|
|
205
312
|
if (!result.ok) process.exit(1);
|
|
@@ -251,6 +358,33 @@ function printUpgradeSummary(outcomes) {
|
|
|
251
358
|
else if (o.action === "kept" && o.reason === "user-chose-keep") process.stdout.write(pc.dim(` ${o.family} kept local\n`));
|
|
252
359
|
else if (o.action === "skipped") process.stdout.write(pc.dim(` ${o.family} skipped (${o.reason})\n`));
|
|
253
360
|
}
|
|
361
|
+
function printDoctorReport(result, cwd) {
|
|
362
|
+
if (result.verdict === "no-output") {
|
|
363
|
+
p.log.error("no build output found (looked for .next/, dist/, out/, build/).\nRun your framework's build first, or point doctor at it with --dir <path>.");
|
|
364
|
+
return;
|
|
365
|
+
}
|
|
366
|
+
if (result.verdict === "clean") {
|
|
367
|
+
p.log.success(`no unexpanded recipe tokens in ${result.outputDirs.join(", ")} (${result.scannedFiles} files scanned)`);
|
|
368
|
+
return;
|
|
369
|
+
}
|
|
370
|
+
for (const f of result.findings) process.stderr.write(`${path.relative(cwd, f.file)}: ${f.tokens.join(", ")}\n`);
|
|
371
|
+
const tokenCount = new Set(result.findings.flatMap((f) => f.tokens)).size;
|
|
372
|
+
if (result.verdict === "not-wired") {
|
|
373
|
+
const bundler = detectProject(cwd).bundler;
|
|
374
|
+
p.log.error(`found ${tokenCount} raw @recipe token${tokenCount === 1 ? "" : "s"} in build output and every recipe your source references is among them — it looks like no Shortwind transform ran during the build.\nIs the adapter wired? ${adapterHint(bundler)}\nSetup guide: ${setupGuideUrl(bundler)}`);
|
|
375
|
+
} else p.log.error(`found ${tokenCount} raw @recipe token${tokenCount === 1 ? "" : "s"} in build output. The Shortwind transform ran (other recipes expanded), so these specific tokens escaped it — typically a className built from a variable/prop/template, or markup in a region the expander treats as opaque.\nSee https://shortwind.dev/docs/dynamic-classes`);
|
|
376
|
+
}
|
|
377
|
+
function setupGuideUrl(bundler) {
|
|
378
|
+
return bundler === "unknown" ? "https://shortwind.dev/docs/install" : `https://shortwind.dev/docs/setup-${bundler}`;
|
|
379
|
+
}
|
|
380
|
+
function adapterHint(bundler) {
|
|
381
|
+
switch (bundler) {
|
|
382
|
+
case "next": return "Next needs `export default withShortwind()(nextConfig)` in next.config — note the call is curried.";
|
|
383
|
+
case "vite": return "Vite needs `shortwind()` in the vite.config plugins array: `plugins: [shortwind(), tailwindcss(), ...]`.";
|
|
384
|
+
case "astro": return "Astro needs `shortwind()` in astro.config `integrations`.";
|
|
385
|
+
default: return "Add the Shortwind plugin for your bundler (see the setup guide).";
|
|
386
|
+
}
|
|
387
|
+
}
|
|
254
388
|
function describeVerifyIssue(issue) {
|
|
255
389
|
switch (issue.kind) {
|
|
256
390
|
case "missing-header": return "no fingerprint header — recipe was hand-stripped";
|
|
@@ -308,8 +442,13 @@ Finish by installing them yourself:
|
|
|
308
442
|
${installCmd(result.packageManager)} ${specs}\n\n(${result.installError ?? "unknown error"})`);
|
|
309
443
|
}
|
|
310
444
|
if (result.bundlerConfigAction === "manual" && result.bundlerConfigSnippet) p.log.warn(`Add the plugin to your bundler config:\n\n${result.bundlerConfigSnippet}`);
|
|
445
|
+
p.log.info(`Setup guide for your stack: ${setupGuideUrl(result.bundler)}`);
|
|
446
|
+
if (result.themeAction === "supplemented") p.log.info(`Your theme (${result.themePath}) didn't define ${result.supplementedThemeTokens.length} design token${result.supplementedThemeTokens.length === 1 ? "" : "s"} the installed recipes use:\n\n ${result.supplementedThemeTokens.join(", ")}\n\nAppended them with neutral placeholder values (marked block at the end of the file) so recipes render on first run — tune them to your palette.\nReference values: https://shortwind.dev/docs/install#theme-tokens`);
|
|
311
447
|
if (result.missingThemeTokens.length > 0) p.log.warn(`Your existing theme (${result.themePath}) does not define ${result.missingThemeTokens.length} design token${result.missingThemeTokens.length === 1 ? "" : "s"} the installed recipes use:\n\n ${result.missingThemeTokens.join(", ")}\n\nRecipes referencing them will render colorless until you add the tokens to your @theme.\nThe default token block is documented at https://shortwind.dev/docs/install#theme-tokens`);
|
|
312
|
-
p.outro(`Next: run \`${result.packageManager}
|
|
448
|
+
p.outro(`Next: run \`${devCmd(result.packageManager)}\` and check a recipe renders. After a production build, \`npx shortwind doctor\` verifies nothing shipped unexpanded.`);
|
|
449
|
+
}
|
|
450
|
+
function devCmd(pm) {
|
|
451
|
+
return pm === "npm" ? "npm run dev" : `${pm} dev`;
|
|
313
452
|
}
|
|
314
453
|
function describeAgentsFile(result) {
|
|
315
454
|
switch (result.agentsFileAction) {
|
|
@@ -329,6 +468,7 @@ function describeTheme(result) {
|
|
|
329
468
|
switch (result.themeAction) {
|
|
330
469
|
case "injected": return `tokens added to ${result.themePath}`;
|
|
331
470
|
case "created": return `wrote ${result.themePath}`;
|
|
471
|
+
case "supplemented": return `kept your theme; appended ${result.supplementedThemeTokens.length} missing tokens to ${result.themePath}`;
|
|
332
472
|
case "skipped": return result.themePath ? `left existing theme in ${result.themePath} untouched` : "skipped (no Tailwind v4 CSS entry — define color tokens yourself)";
|
|
333
473
|
}
|
|
334
474
|
}
|
package/dist/bin.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"bin.js","names":["runPreset"],"sources":["../src/cli.ts","../src/bin.ts"],"sourcesContent":["import * as p from \"@clack/prompts\";\nimport pc from \"picocolors\";\nimport { cac } from \"cac\";\nimport { add } from \"./commands/add.js\";\nimport { build, BuildError } from \"./commands/build.js\";\nimport { dev } from \"./commands/dev.js\";\nimport { remove } from \"./commands/remove.js\";\nimport { preset as runPreset } from \"./commands/preset.js\";\nimport { ls, formatLsText } from \"./commands/ls.js\";\nimport {\n upgrade,\n UpgradeError,\n type TouchedContext,\n type UpgradeChoice,\n} from \"./commands/upgrade.js\";\nimport { verify } from \"./commands/verify.js\";\nimport { lint, formatFindingsText, ALL_RULES, type Rule } from \"./commands/lint.js\";\nimport { init, cliVersion, type InitOptions, DEFAULT_REGISTRY } from \"./init.js\";\nimport { bench, formatBenchTable } from \"./commands/bench.js\";\nimport { newFamily, NewFamilyError } from \"./commands/new.js\";\nimport { reseal } from \"./commands/reseal.js\";\n\nconst KNOWN_PRESETS = [\"starter\", \"app\", \"content\", \"all\", \"none\"];\nexport const DEFAULT_PRESET = \"starter\";\n\n// Decide the init preset without forcing a TTY: an explicit --preset wins,\n// --yes/-y takes the default, and only the bare interactive call prompts —\n// agents and CI run `init --yes` unattended (#68).\nexport async function resolveInitPreset(\n opts: { preset?: string; yes?: boolean },\n prompt: () => Promise<string>,\n): Promise<string> {\n if (opts.preset !== undefined) return opts.preset;\n if (opts.yes) return DEFAULT_PRESET;\n return prompt();\n}\n\nexport async function run(argv: string[] = process.argv): Promise<void> {\n const cli = cac(\"shortwind\");\n\n cli\n .command(\"init\", \"Bootstrap Shortwind in this project\")\n .option(\"--preset <name>\", \"Preset to install (starter|app|content|all|none)\")\n .option(\"-y, --yes\", `Skip prompts and use the default preset (${DEFAULT_PRESET})`)\n .option(\"--registry <url>\", \"Registry origin\", { default: DEFAULT_REGISTRY })\n .option(\"--cwd <dir>\", \"Working directory\", { default: process.cwd() })\n .action(async (opts: { preset?: string; yes?: boolean; registry?: string; cwd?: string }) => {\n const preset = await resolveInitPreset(opts, promptForPreset);\n const options: InitOptions = {\n cwd: opts.cwd ?? process.cwd(),\n preset,\n };\n if (opts.registry !== undefined) options.registry = opts.registry;\n const result = await init(options);\n printInitSummary(result);\n });\n\n cli\n .command(\"add <...families>\", \"Install one or more families\")\n .option(\"--as <name>\", \"Rename the family on install (requires a single family)\")\n .option(\"--all\", \"Install every family in the registry\")\n .option(\"--force\", \"Overwrite existing files\")\n .option(\"--registry <url>\", \"Registry origin\")\n .option(\"--cwd <dir>\", \"Working directory\")\n .action(\n async (\n families: string[],\n opts: { as?: string; all?: boolean; force?: boolean; registry?: string; cwd?: string },\n ) => {\n const addOptions: Parameters<typeof add>[0] = {\n cwd: opts.cwd ?? process.cwd(),\n families,\n };\n if (opts.as !== undefined) addOptions.as = opts.as;\n if (opts.all) addOptions.all = true;\n if (opts.force) addOptions.force = true;\n if (opts.registry !== undefined) addOptions.registry = opts.registry;\n const result = await add(addOptions);\n for (const fam of result.added) p.log.success(`added ${fam}`);\n for (const fam of result.overwritten) p.log.success(`overwrote ${fam}`);\n for (const fam of result.skipped) p.log.warn(`${fam} already exists (use --force)`);\n for (const missing of result.missingDependencies) {\n p.log.warn(\n `${missing.family} references unknown recipes: ${missing.references.join(\", \")}`,\n );\n }\n },\n );\n\n cli\n .command(\"new <family>\", \"Scaffold a new custom recipe family file\")\n .option(\"--force\", \"Overwrite an existing family file\")\n .option(\"--cwd <dir>\", \"Working directory\")\n .action(async (family: string, opts: { force?: boolean; cwd?: string }) => {\n try {\n const result = await newFamily({\n cwd: opts.cwd ?? process.cwd(),\n family,\n ...(opts.force ? { force: true } : {}),\n });\n p.log.success(`created ${result.familyPath}`);\n p.log.info(`regenerated ${result.skillPath} — edit the recipes, then \\`shortwind build\\` to refresh.`);\n } catch (err) {\n if (err instanceof NewFamilyError) {\n process.stderr.write(err.message + \"\\n\");\n process.exit(1);\n }\n throw err;\n }\n });\n\n cli\n .command(\"remove <...families>\", \"Remove installed families\")\n .option(\"--cwd <dir>\", \"Working directory\")\n .action(async (families: string[], opts: { cwd?: string }) => {\n const result = await remove({ cwd: opts.cwd ?? process.cwd(), families });\n for (const fam of result.removed) p.log.success(`removed ${fam}`);\n for (const fam of result.notFound) p.log.warn(`${fam} is not installed`);\n for (const broken of result.brokenDependents) {\n p.log.warn(\n `${broken.dependent} references removed recipes: ${broken.references.join(\", \")}`,\n );\n }\n });\n\n cli\n .command(\"preset <name>\", \"Install every family in the named preset (additive)\")\n .option(\"--registry <url>\", \"Registry origin\")\n .option(\"--cwd <dir>\", \"Working directory\")\n .action(async (name: string, opts: { registry?: string; cwd?: string }) => {\n const presetOptions: Parameters<typeof runPreset>[0] = {\n cwd: opts.cwd ?? process.cwd(),\n name,\n };\n if (opts.registry !== undefined) presetOptions.registry = opts.registry;\n const result = await runPreset(presetOptions);\n p.log.info(`preset ${name}: ${result.added.length} added, ${result.skipped.length} already present`);\n });\n\n cli\n .command(\"ls\", \"List installed and available families\")\n .option(\"--installed\", \"Only installed\")\n .option(\"--available\", \"Only available\")\n .option(\"--json\", \"Emit JSON\")\n .option(\"--registry <url>\", \"Registry origin\")\n .option(\"--cwd <dir>\", \"Working directory\")\n .action(\n async (opts: {\n installed?: boolean;\n available?: boolean;\n json?: boolean;\n registry?: string;\n cwd?: string;\n }) => {\n const lsOptions: Parameters<typeof ls>[0] = {\n cwd: opts.cwd ?? process.cwd(),\n };\n if (opts.installed) lsOptions.installedOnly = true;\n if (opts.available) lsOptions.availableOnly = true;\n if (opts.registry !== undefined) lsOptions.registry = opts.registry;\n const result = await ls(lsOptions);\n if (opts.json) {\n process.stdout.write(JSON.stringify(result, null, 2) + \"\\n\");\n } else {\n process.stdout.write(formatLsText(result) + \"\\n\");\n }\n },\n );\n\n cli\n .command(\"build\", \"Regenerate SKILL.md from ./recipes/\")\n .option(\"--cwd <dir>\", \"Working directory\")\n .action(async (opts: { cwd?: string }) => {\n try {\n const result = await build({ cwd: opts.cwd ?? process.cwd() });\n if (result.changed) p.log.success(`regenerated ${result.families.length} families`);\n else p.log.info(`up to date (${result.families.length} families)`);\n } catch (err) {\n if (err instanceof BuildError) {\n process.stderr.write(err.message + \"\\n\");\n process.exit(1);\n }\n throw err;\n }\n });\n\n cli\n .command(\"dev\", \"Watch ./recipes/ and regenerate SKILL.md on change\")\n .option(\"--cwd <dir>\", \"Working directory\")\n .option(\"--once\", \"Run build once and exit\")\n .action(async (opts: { cwd?: string; once?: boolean }) => {\n if (opts.once) {\n try {\n await build({ cwd: opts.cwd ?? process.cwd() });\n } catch (err) {\n if (err instanceof BuildError) {\n process.stderr.write(err.message + \"\\n\");\n process.exit(1);\n }\n throw err;\n }\n return;\n }\n const controller = new AbortController();\n const onSigint = (): void => controller.abort();\n process.on(\"SIGINT\", onSigint);\n try {\n const { stop } = await dev({\n cwd: opts.cwd ?? process.cwd(),\n signal: controller.signal,\n onStatus: (status) => {\n if (status.kind === \"rebuilt\") {\n const msg = `✓ regenerated ${status.families.length} families${status.changed ? \"\" : \" (no changes)\"}`;\n process.stdout.write(msg + \"\\n\");\n } else if (status.kind === \"ready\") {\n process.stdout.write(`watching ${status.recipesDir}\\n`);\n } else {\n process.stderr.write(status.message + \"\\n\");\n }\n },\n });\n // Block until SIGINT (or otherwise aborted), then close the watcher\n // and exit cleanly — without this the listener stays attached and\n // controller.abort() never returns control to the CLI.\n await new Promise<void>((resolve) => {\n if (controller.signal.aborted) resolve();\n else controller.signal.addEventListener(\"abort\", () => resolve(), { once: true });\n });\n await stop();\n } finally {\n process.off(\"SIGINT\", onSigint);\n }\n process.exit(0);\n });\n\n cli\n .command(\"upgrade [...families]\", \"Pull registry updates into ./recipes\")\n .option(\"--check\", \"Read-only — print drift summary and exit nonzero on updates\")\n .option(\"--force\", \"Skip touched-detection; overwrite local edits\")\n .option(\"--registry <url>\", \"Registry origin\")\n .option(\"--cwd <dir>\", \"Working directory\")\n .action(\n async (\n families: string[],\n opts: { check?: boolean; force?: boolean; registry?: string; cwd?: string },\n ) => {\n try {\n const upgradeOptions: Parameters<typeof upgrade>[0] = {\n cwd: opts.cwd ?? process.cwd(),\n families,\n };\n if (opts.check) upgradeOptions.check = true;\n if (opts.force) upgradeOptions.force = true;\n if (opts.registry !== undefined) upgradeOptions.registry = opts.registry;\n if (!opts.check && !opts.force) {\n upgradeOptions.resolver = makeInteractiveResolver();\n }\n const result = await upgrade(upgradeOptions);\n printUpgradeSummary(result.outcomes);\n if (opts.check) {\n if (result.hasUpdates || result.hasTouched) process.exit(1);\n }\n } catch (err) {\n if (err instanceof UpgradeError) {\n process.stderr.write(err.message + \"\\n\");\n process.exit(2);\n }\n throw err;\n }\n },\n );\n\n cli\n .command(\"reseal [...families]\", \"Re-sign recipes after intentional edits (updates header sha + lockfile)\")\n .option(\"--cwd <dir>\", \"Working directory\")\n .action(async (families: string[], opts: { cwd?: string }) => {\n const result = await reseal({ cwd: opts.cwd ?? process.cwd(), families });\n for (const f of result.resealed) p.log.success(`resealed ${f}`);\n for (const f of result.unchanged) p.log.info(`${f} already sealed`);\n for (const f of result.notFound) p.log.warn(`${f} is not installed`);\n for (const f of result.noHeader) p.log.warn(`${f} has no fingerprint header`);\n if (result.resealed.length === 0 && result.unchanged.length > 0 && result.notFound.length === 0) {\n p.log.success(\"all recipes already sealed\");\n }\n });\n\n cli\n .command(\"verify\", \"Check installed recipes against fingerprint headers and lockfile\")\n .option(\"--cwd <dir>\", \"Working directory\")\n .action(async (opts: { cwd?: string }) => {\n const result = await verify({ cwd: opts.cwd ?? process.cwd() });\n if (result.ok) {\n p.log.success(`verified ${result.checked.length} families`);\n return;\n }\n for (const issue of result.issues) {\n const desc = describeVerifyIssue(issue);\n process.stderr.write(`${issue.family}: ${desc}\\n`);\n }\n process.exit(1);\n });\n\n cli\n .command(\"lint\", \"Static analysis over source files and recipes\")\n .option(\"--fix\", \"Apply auto-fixes where supported\")\n .option(\"--rule <rule>\", \"Only run the named rule (repeatable)\")\n .option(\"--json\", \"Emit machine-readable JSON\")\n .option(\"--cwd <dir>\", \"Working directory\")\n .action(\n async (opts: { fix?: boolean; rule?: string | string[]; json?: boolean; cwd?: string }) => {\n const requested = opts.rule === undefined ? [] : Array.isArray(opts.rule) ? opts.rule : [opts.rule];\n for (const r of requested) {\n if (!ALL_RULES.includes(r as Rule)) {\n process.stderr.write(`unknown rule: ${r}\\n`);\n process.stderr.write(`available: ${ALL_RULES.join(\", \")}\\n`);\n process.exit(2);\n }\n }\n const lintOptions: Parameters<typeof lint>[0] = { cwd: opts.cwd ?? process.cwd() };\n if (opts.fix) lintOptions.fix = true;\n if (requested.length > 0) lintOptions.rules = requested as Rule[];\n const result = await lint(lintOptions);\n if (opts.json) {\n process.stdout.write(JSON.stringify(result, null, 2) + \"\\n\");\n } else {\n const text = formatFindingsText(result.findings);\n if (text) process.stdout.write(text + \"\\n\");\n for (const f of result.filesFixed) p.log.success(`fixed ${f}`);\n if (result.findings.length === 0) p.log.success(\"no findings\");\n }\n if (!result.ok) process.exit(1);\n },\n );\n\n cli\n .command(\"bench [path]\", \"Benchmark token savings in a corpus or target directory\")\n .option(\"--corpus\", \"Run benchmark on the built-in corpus\")\n .option(\"--json\", \"Emit machine-readable JSON\")\n .option(\"--cwd <dir>\", \"Working directory\")\n .action(async (pathArg: string | undefined, opts: { corpus?: boolean; json?: boolean; cwd?: string }) => {\n const benchOptions: Parameters<typeof bench>[0] = { cwd: opts.cwd ?? process.cwd() };\n if (opts.corpus) benchOptions.corpus = true;\n if (pathArg !== undefined) benchOptions.path = pathArg;\n const result = await bench(benchOptions);\n if (opts.json) {\n process.stdout.write(JSON.stringify(result, null, 2) + \"\\n\");\n } else {\n const text = formatBenchTable(result);\n process.stdout.write(text + \"\\n\");\n }\n });\n\n cli.help();\n cli.version(cliVersion() ?? \"0.0.0\");\n // cac's parse() invokes the matched command's async action but does NOT await\n // it, so a rejection inside any async command (network failure in `add`, a\n // rethrow in `build`/`upgrade`, …) escapes bin.ts's `run().catch` and prints\n // a raw unhandled-rejection dump. Parse without running, then await the\n // command so its promise flows back to the caller's catch.\n cli.parse(argv, { run: false });\n await cli.runMatchedCommand();\n}\n\nfunction makeInteractiveResolver() {\n return async (ctx: TouchedContext): Promise<UpgradeChoice> => {\n process.stdout.write(\n pc.yellow(`\\n${ctx.family}: locally modified — incoming ${ctx.incoming.version}\\n`),\n );\n const choice = await p.select({\n message: `Resolve ${ctx.family}`,\n options: [\n { value: \"accept\", label: \"Accept new (discard local edits)\" },\n { value: \"keep\", label: \"Keep yours\" },\n { value: \"skip\", label: \"Skip for now\" },\n ],\n });\n if (p.isCancel(choice)) return \"skip\";\n return choice as UpgradeChoice;\n };\n}\n\nfunction printUpgradeSummary(outcomes: Awaited<ReturnType<typeof upgrade>>[\"outcomes\"]): void {\n for (const o of outcomes) {\n if (o.action === \"updated\") {\n process.stdout.write(pc.green(`✓ ${o.family} ${o.from} → ${o.to}\\n`));\n } else if (o.action === \"would-update\") {\n process.stdout.write(pc.cyan(`→ ${o.family} ${o.from} → ${o.to} (available)\\n`));\n } else if (o.action === \"would-review\") {\n process.stdout.write(pc.yellow(`! ${o.family} ${o.from} → ${o.to} (touched; needs review)\\n`));\n } else if (o.action === \"kept\" && o.reason === \"user-chose-keep\") {\n process.stdout.write(pc.dim(` ${o.family} kept local\\n`));\n } else if (o.action === \"skipped\") {\n process.stdout.write(pc.dim(` ${o.family} skipped (${o.reason})\\n`));\n }\n }\n}\n\nfunction describeVerifyIssue(issue: import(\"./commands/verify.js\").VerifyIssue): string {\n switch (issue.kind) {\n case \"missing-header\":\n return \"no fingerprint header — recipe was hand-stripped\";\n case \"header-tampered\":\n return `header sha ${issue.recorded} but body hashes to ${issue.actual}`;\n case \"legacy-fingerprint\":\n return `sealed with an older fingerprint format (${issue.recorded}) — run \\`shortwind reseal\\` to upgrade it (the recipe body is unchanged)`;\n case \"lockfile-mismatch\":\n return `lockfile expects ${issue.locked} but body hashes to ${issue.actual}`;\n case \"missing-lock-entry\":\n return \"installed but not recorded in lockfile\";\n case \"missing-file\":\n return \"in lockfile but file is missing\";\n }\n}\n\nasync function promptForPreset(): Promise<string> {\n const choice = await p.select({\n message: \"Pick a preset\",\n options: KNOWN_PRESETS.map((name) => ({ value: name, label: name })),\n });\n if (p.isCancel(choice)) {\n p.cancel(\"Cancelled.\");\n process.exit(0);\n }\n return choice;\n}\n\nfunction installCmd(pm: Awaited<ReturnType<typeof init>>[\"packageManager\"]): string {\n switch (pm) {\n case \"bun\":\n return \"bun add -d\";\n case \"npm\":\n return \"npm install -D\";\n default:\n return `${pm} add -D`;\n }\n}\n\nfunction printInitSummary(result: Awaited<ReturnType<typeof init>>): void {\n p.note(\n [\n `preset: ${result.preset}`,\n `registry: ${result.registry}`,\n `package manager: ${result.packageManager}`,\n `families copied: ${result.installedFamilies.length}`,\n `families skipped: ${result.skippedFamilies.length}`,\n `adapters: ${result.installOk ? result.installedPackages.join(\", \") || \"none\" : \"install failed — see below\"}`,\n ``,\n `config: ${result.configPath}`,\n `vscode settings: ${result.vscodePath}`,\n `pre-commit: ${result.huskyPath ?? \"skipped (not a git repository)\"}`,\n `SKILL.md: ${result.skillPath}`,\n `theme: ${describeTheme(result)}`,\n `bundler config: ${describeBundlerConfig(result)}`,\n `agent guide: ${describeAgentsFile(result)}`,\n ].join(\"\\n\"),\n \"shortwind init\",\n );\n if (!result.installOk) {\n const v = cliVersion();\n const specs = result.installedPackages.map((p) => (v ? `${p}@${v}` : p)).join(\" \");\n p.log.warn(\n `Couldn't auto-install adapters (your recipes and config were still scaffolded).\\n` +\n `Finish by installing them yourself:\\n\\n` +\n ` ${installCmd(result.packageManager)} ${specs}\\n\\n` +\n `(${result.installError ?? \"unknown error\"})`,\n );\n }\n if (result.bundlerConfigAction === \"manual\" && result.bundlerConfigSnippet) {\n p.log.warn(`Add the plugin to your bundler config:\\n\\n${result.bundlerConfigSnippet}`);\n }\n if (result.missingThemeTokens.length > 0) {\n p.log.warn(\n `Your existing theme (${result.themePath}) does not define ${result.missingThemeTokens.length} design token${result.missingThemeTokens.length === 1 ? \"\" : \"s\"} the installed recipes use:\\n\\n` +\n ` ${result.missingThemeTokens.join(\", \")}\\n\\n` +\n `Recipes referencing them will render colorless until you add the tokens to your @theme.\\n` +\n `The default token block is documented at https://shortwind.dev/docs/install#theme-tokens`,\n );\n }\n p.outro(`Next: run \\`${result.packageManager} dev\\` to start watching.`);\n}\n\nfunction describeAgentsFile(result: Awaited<ReturnType<typeof init>>): string {\n switch (result.agentsFileAction) {\n case \"created\":\n return `wrote ${result.agentsFilePath}`;\n case \"appended\":\n return `added recipe pointer to ${result.agentsFilePath}`;\n case \"skipped\":\n return `pointer already in ${result.agentsFilePath}`;\n }\n}\n\nfunction describeBundlerConfig(result: Awaited<ReturnType<typeof init>>): string {\n switch (result.bundlerConfigAction) {\n case \"patched\":\n return `plugin added to ${result.bundlerConfigPath}`;\n case \"manual\":\n return \"needs a manual edit (see below)\";\n case \"skipped\":\n return result.bundlerConfigPath\n ? `already wired in ${result.bundlerConfigPath}`\n : \"skipped (no supported bundler)\";\n }\n}\n\nfunction describeTheme(result: Awaited<ReturnType<typeof init>>): string {\n switch (result.themeAction) {\n case \"injected\":\n return `tokens added to ${result.themePath}`;\n case \"created\":\n return `wrote ${result.themePath}`;\n case \"skipped\":\n return result.themePath\n ? `left existing theme in ${result.themePath} untouched`\n : \"skipped (no Tailwind v4 CSS entry — define color tokens yourself)\";\n }\n}\n","#!/usr/bin/env node\nimport { run } from \"./cli.js\";\n\nrun().catch((err) => {\n console.error(err instanceof Error ? err.stack ?? err.message : err);\n process.exit(1);\n});\n"],"mappings":";;;;;;AAsBA,MAAM,gBAAgB;CAAC;CAAW;CAAO;CAAW;CAAO;CAAO;AAClE,MAAa,iBAAiB;AAK9B,eAAsB,kBACpB,MACA,QACiB;CACjB,IAAI,KAAK,WAAW,KAAA,GAAW,OAAO,KAAK;CAC3C,IAAI,KAAK,KAAK,OAAO;CACrB,OAAO,QAAQ;;AAGjB,eAAsB,IAAI,OAAiB,QAAQ,MAAqB;CACtE,MAAM,MAAM,IAAI,YAAY;CAE5B,IACG,QAAQ,QAAQ,sCAAsC,CACtD,OAAO,mBAAmB,mDAAmD,CAC7E,OAAO,aAAa,4CAA4C,eAAe,GAAG,CAClF,OAAO,oBAAoB,mBAAmB,EAAE,SAAS,kBAAkB,CAAC,CAC5E,OAAO,eAAe,qBAAqB,EAAE,SAAS,QAAQ,KAAK,EAAE,CAAC,CACtE,OAAO,OAAO,SAA8E;EAC3F,MAAM,SA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cAC3C;;;;;AC/fV,KAAK,CAAC,OAAO,QAAQ;CACnB,QAAQ,MAAM,eAAe,QAAQ,IAAI,SAAS,IAAI,UAAU,IAAI;CACpE,QAAQ,KAAK,EAAE;EACf"}
|
|
1
|
+
{"version":3,"file":"bin.js","names":["runPreset"],"sources":["../src/commands/doctor.ts","../src/cli.ts","../src/bin.ts"],"sourcesContent":["import { existsSync, readFileSync } from \"node:fs\";\nimport { readFile } from \"node:fs/promises\";\nimport path from \"node:path\";\nimport { glob } from \"tinyglobby\";\nimport { buildRegistry, parseRecipeFile } from \"@shortwind/core\";\nimport type { Recipe, Registry } from \"@shortwind/core\";\nimport { findResidualRecipeTokens } from \"@shortwind/tailwind\";\nimport { installedFamilies, readConfig } from \"../project.js\";\nimport { DEFAULT_CONTENT, extractClassUsages } from \"./lint.js\";\n\nexport type DoctorVerdict =\n // No raw recipe tokens in any scanned output file.\n | \"clean\"\n // Raw tokens found AND every recipe referenced in source is among them —\n // nothing was expanded, so the adapter almost certainly never ran.\n | \"not-wired\"\n // Raw tokens found but other recipes did expand — the transform ran and\n // these specific tokens escaped it (dynamic className, opaque region, …).\n | \"leak\"\n // No build output directory found to scan.\n | \"no-output\";\n\nexport type DoctorFinding = { file: string; tokens: string[] };\n\nexport type DoctorOptions = {\n cwd: string;\n // Output directories to scan, relative to cwd. Defaults to whichever of\n // .next/, dist/, out/, build/ exist.\n dirs?: string[];\n // Source globs for the \"what does the project actually use\" scan; same\n // semantics and fallback chain as lint's content option.\n content?: string[];\n};\n\nexport type DoctorResult = {\n ok: boolean;\n verdict: DoctorVerdict;\n outputDirs: string[];\n scannedFiles: number;\n findings: DoctorFinding[];\n // Known recipes referenced from source files, as @-tokens, sorted.\n usedInSource: string[];\n};\n\nconst DEFAULT_OUTPUT_DIRS = [\".next\", \"dist\", \"out\", \"build\"];\n\n// Only formats a framework emits markup/scripts into. Sourcemaps embed the\n// original source (raw tokens are expected there) and are excluded by not\n// being listed; CSS never legitimately carries an @recipe token but Tailwind\n// output is full of @media/@container at-rules, so it stays out too.\nconst OUTPUT_GLOB = \"**/*.{html,htm,js,mjs,cjs,rsc}\";\n\n// Bundler caches (.next/cache, .vite cache dirs) store pre-transform source.\nconst OUTPUT_IGNORE = [\"**/node_modules/**\", \"**/cache/**\"];\n\nexport async function doctor(options: DoctorOptions): Promise<DoctorResult> {\n const cwd = path.resolve(options.cwd);\n const config = await readConfig(cwd);\n const recipesDir = path.join(cwd, config.recipesDir);\n const registry = loadRegistryLenient(recipesDir);\n\n const outputDirs = (options.dirs ?? DEFAULT_OUTPUT_DIRS).filter((d) =>\n existsSync(path.join(cwd, d)),\n );\n if (outputDirs.length === 0) {\n return {\n ok: false,\n verdict: \"no-output\",\n outputDirs: [],\n scannedFiles: 0,\n findings: [],\n usedInSource: [],\n };\n }\n\n const files = await glob(\n outputDirs.map((d) => path.posix.join(d.split(path.sep).join(\"/\"), OUTPUT_GLOB)),\n { cwd, absolute: true, onlyFiles: true, ignore: OUTPUT_IGNORE },\n );\n\n const findings: DoctorFinding[] = [];\n for (const file of files.sort()) {\n const code = await readFile(file, \"utf8\");\n const tokens = findResidualRecipeTokens(code, registry);\n if (tokens.length > 0) findings.push({ file, tokens });\n }\n\n const usedInSource = await scanSourceUsage(cwd, recipesDir, registry, options.content ?? config.content);\n\n let verdict: DoctorVerdict = \"clean\";\n if (findings.length > 0) {\n const raw = new Set(findings.flatMap((f) => f.tokens));\n verdict =\n usedInSource.length > 0 && usedInSource.every((t) => raw.has(t))\n ? \"not-wired\"\n : \"leak\";\n }\n\n return {\n ok: verdict === \"clean\",\n verdict,\n outputDirs,\n scannedFiles: files.length,\n findings,\n usedInSource,\n };\n}\n\n// Doctor's job is scanning build output, not validating recipes — a registry\n// that fails to resolve (cycle, unknown ref: lint's territory) must not stop\n// the leak scan. Fall back to a name-only registry so known-token matching\n// still works.\nfunction loadRegistryLenient(recipesDir: string): Registry {\n const allRecipes: Recipe[] = [];\n for (const family of installedFamilies(recipesDir)) {\n const source = readFileSync(path.join(recipesDir, `${family}.css`), \"utf8\");\n const parsed = parseRecipeFile(source, `${family}.css`);\n if (parsed.ok) allRecipes.push(...parsed.value.recipes);\n }\n const built = buildRegistry(allRecipes);\n if (built.ok) return built.value;\n return {\n flattened: Object.fromEntries(allRecipes.map((r) => [r.name, []])),\n families: {},\n };\n}\n\nasync function scanSourceUsage(\n cwd: string,\n recipesDir: string,\n registry: Registry,\n content: string[] | undefined,\n): Promise<string[]> {\n // Same project-relative recipes ignore as lint (see lint.ts for why the\n // absolute form is unsafe with tinyglobby).\n const recipesIgnore = path.posix.join(\n path.relative(cwd, recipesDir).split(path.sep).join(\"/\") || \".\",\n \"**\",\n );\n const files = await glob(content ?? DEFAULT_CONTENT, {\n cwd,\n absolute: true,\n onlyFiles: true,\n ignore: [\"**/node_modules/**\", \"**/dist/**\", \"**/.next/**\", recipesIgnore],\n });\n const used = new Set<string>();\n for (const file of files) {\n const source = await readFile(file, \"utf8\");\n for (const usage of extractClassUsages(source)) {\n for (const token of usage.tokens) {\n if (!token.value.startsWith(\"@\")) continue;\n if (Object.hasOwn(registry.flattened, token.value.slice(1))) used.add(token.value);\n }\n }\n }\n return [...used].sort();\n}\n","import path from \"node:path\";\nimport * as p from \"@clack/prompts\";\nimport pc from \"picocolors\";\nimport { cac } from \"cac\";\nimport { add } from \"./commands/add.js\";\nimport { build, BuildError } from \"./commands/build.js\";\nimport { dev } from \"./commands/dev.js\";\nimport { remove } from \"./commands/remove.js\";\nimport { preset as runPreset } from \"./commands/preset.js\";\nimport { ls, formatLsText } from \"./commands/ls.js\";\nimport {\n upgrade,\n UpgradeError,\n type TouchedContext,\n type UpgradeChoice,\n} from \"./commands/upgrade.js\";\nimport { verify, type VerifyIssue } from \"./commands/verify.js\";\nimport { doctor } from \"./commands/doctor.js\";\nimport { detectProject, type Bundler } from \"./detect.js\";\nimport { lint, formatFindingsText, ALL_RULES, type Rule } from \"./commands/lint.js\";\nimport { init, cliVersion, type InitOptions, DEFAULT_REGISTRY } from \"./init.js\";\nimport { bench, formatBenchTable } from \"./commands/bench.js\";\nimport { newFamily, NewFamilyError } from \"./commands/new.js\";\nimport { reseal } from \"./commands/reseal.js\";\n\nconst KNOWN_PRESETS = [\"starter\", \"app\", \"content\", \"all\", \"none\"];\nexport const DEFAULT_PRESET = \"starter\";\n\n// Decide the init preset without forcing a TTY: an explicit --preset wins,\n// --yes/-y takes the default, and only the bare interactive call prompts —\n// agents and CI run `init --yes` unattended (#68).\nexport async function resolveInitPreset(\n opts: { preset?: string; yes?: boolean },\n prompt: () => Promise<string>,\n): Promise<string> {\n if (opts.preset !== undefined) return opts.preset;\n if (opts.yes) return DEFAULT_PRESET;\n return prompt();\n}\n\nexport async function run(argv: string[] = process.argv): Promise<void> {\n const cli = cac(\"shortwind\");\n\n cli\n .command(\"init\", \"Bootstrap Shortwind in this project\")\n .option(\"--preset <name>\", \"Preset to install (starter|app|content|all|none)\")\n .option(\"-y, --yes\", `Skip prompts and use the default preset (${DEFAULT_PRESET})`)\n .option(\"--registry <url>\", \"Registry origin\", { default: DEFAULT_REGISTRY })\n .option(\"--cwd <dir>\", \"Working directory\", { default: process.cwd() })\n .action(async (opts: { preset?: string; yes?: boolean; registry?: string; cwd?: string }) => {\n const preset = await resolveInitPreset(opts, promptForPreset);\n const options: InitOptions = {\n cwd: opts.cwd ?? process.cwd(),\n preset,\n };\n if (opts.registry !== undefined) options.registry = opts.registry;\n const result = await init(options);\n printInitSummary(result);\n });\n\n cli\n .command(\"add <...families>\", \"Install one or more families\")\n .option(\"--as <name>\", \"Rename the family on install (requires a single family)\")\n .option(\"--all\", \"Install every family in the registry\")\n .option(\"--force\", \"Overwrite existing files\")\n .option(\"--registry <url>\", \"Registry origin\")\n .option(\"--cwd <dir>\", \"Working directory\")\n .action(\n async (\n families: string[],\n opts: { as?: string; all?: boolean; force?: boolean; registry?: string; cwd?: string },\n ) => {\n const addOptions: Parameters<typeof add>[0] = {\n cwd: opts.cwd ?? process.cwd(),\n families,\n };\n if (opts.as !== undefined) addOptions.as = opts.as;\n if (opts.all) addOptions.all = true;\n if (opts.force) addOptions.force = true;\n if (opts.registry !== undefined) addOptions.registry = opts.registry;\n const result = await add(addOptions);\n for (const fam of result.added) p.log.success(`added ${fam}`);\n for (const fam of result.overwritten) p.log.success(`overwrote ${fam}`);\n for (const fam of result.skipped) p.log.warn(`${fam} already exists (use --force)`);\n for (const missing of result.missingDependencies) {\n p.log.warn(\n `${missing.family} references unknown recipes: ${missing.references.join(\", \")}`,\n );\n }\n },\n );\n\n cli\n .command(\"new <family>\", \"Scaffold a new custom recipe family file\")\n .option(\"--force\", \"Overwrite an existing family file\")\n .option(\"--cwd <dir>\", \"Working directory\")\n .action(async (family: string, opts: { force?: boolean; cwd?: string }) => {\n try {\n const result = await newFamily({\n cwd: opts.cwd ?? process.cwd(),\n family,\n ...(opts.force ? { force: true } : {}),\n });\n p.log.success(`created ${result.familyPath}`);\n p.log.info(`regenerated ${result.skillPath} — edit the recipes, then \\`shortwind build\\` to refresh.`);\n } catch (err) {\n if (err instanceof NewFamilyError) {\n process.stderr.write(err.message + \"\\n\");\n process.exit(1);\n }\n throw err;\n }\n });\n\n cli\n .command(\"remove <...families>\", \"Remove installed families\")\n .option(\"--cwd <dir>\", \"Working directory\")\n .action(async (families: string[], opts: { cwd?: string }) => {\n const result = await remove({ cwd: opts.cwd ?? process.cwd(), families });\n for (const fam of result.removed) p.log.success(`removed ${fam}`);\n for (const fam of result.notFound) p.log.warn(`${fam} is not installed`);\n for (const broken of result.brokenDependents) {\n p.log.warn(\n `${broken.dependent} references removed recipes: ${broken.references.join(\", \")}`,\n );\n }\n });\n\n cli\n .command(\"preset <name>\", \"Install every family in the named preset (additive)\")\n .option(\"--registry <url>\", \"Registry origin\")\n .option(\"--cwd <dir>\", \"Working directory\")\n .action(async (name: string, opts: { registry?: string; cwd?: string }) => {\n const presetOptions: Parameters<typeof runPreset>[0] = {\n cwd: opts.cwd ?? process.cwd(),\n name,\n };\n if (opts.registry !== undefined) presetOptions.registry = opts.registry;\n const result = await runPreset(presetOptions);\n p.log.info(`preset ${name}: ${result.added.length} added, ${result.skipped.length} already present`);\n });\n\n cli\n .command(\"ls\", \"List installed and available families\")\n .option(\"--installed\", \"Only installed\")\n .option(\"--available\", \"Only available\")\n .option(\"--json\", \"Emit JSON\")\n .option(\"--registry <url>\", \"Registry origin\")\n .option(\"--cwd <dir>\", \"Working directory\")\n .action(\n async (opts: {\n installed?: boolean;\n available?: boolean;\n json?: boolean;\n registry?: string;\n cwd?: string;\n }) => {\n const lsOptions: Parameters<typeof ls>[0] = {\n cwd: opts.cwd ?? process.cwd(),\n };\n if (opts.installed) lsOptions.installedOnly = true;\n if (opts.available) lsOptions.availableOnly = true;\n if (opts.registry !== undefined) lsOptions.registry = opts.registry;\n const result = await ls(lsOptions);\n if (opts.json) {\n process.stdout.write(JSON.stringify(result, null, 2) + \"\\n\");\n } else {\n process.stdout.write(formatLsText(result) + \"\\n\");\n }\n },\n );\n\n cli\n .command(\"build\", \"Regenerate SKILL.md from ./recipes/\")\n .option(\"--cwd <dir>\", \"Working directory\")\n .action(async (opts: { cwd?: string }) => {\n try {\n const result = await build({ cwd: opts.cwd ?? process.cwd() });\n if (result.changed) p.log.success(`regenerated ${result.families.length} families`);\n else p.log.info(`up to date (${result.families.length} families)`);\n } catch (err) {\n if (err instanceof BuildError) {\n process.stderr.write(err.message + \"\\n\");\n process.exit(1);\n }\n throw err;\n }\n });\n\n cli\n .command(\"dev\", \"Watch ./recipes/ and regenerate SKILL.md on change\")\n .option(\"--cwd <dir>\", \"Working directory\")\n .option(\"--once\", \"Run build once and exit\")\n .action(async (opts: { cwd?: string; once?: boolean }) => {\n if (opts.once) {\n try {\n await build({ cwd: opts.cwd ?? process.cwd() });\n } catch (err) {\n if (err instanceof BuildError) {\n process.stderr.write(err.message + \"\\n\");\n process.exit(1);\n }\n throw err;\n }\n return;\n }\n const controller = new AbortController();\n const onSigint = (): void => controller.abort();\n process.on(\"SIGINT\", onSigint);\n try {\n const { stop } = await dev({\n cwd: opts.cwd ?? process.cwd(),\n signal: controller.signal,\n onStatus: (status) => {\n if (status.kind === \"rebuilt\") {\n const msg = `✓ regenerated ${status.families.length} families${status.changed ? \"\" : \" (no changes)\"}`;\n process.stdout.write(msg + \"\\n\");\n } else if (status.kind === \"ready\") {\n process.stdout.write(`watching ${status.recipesDir}\\n`);\n } else {\n process.stderr.write(status.message + \"\\n\");\n }\n },\n });\n // Block until SIGINT (or otherwise aborted), then close the watcher\n // and exit cleanly — without this the listener stays attached and\n // controller.abort() never returns control to the CLI.\n await new Promise<void>((resolve) => {\n if (controller.signal.aborted) resolve();\n else controller.signal.addEventListener(\"abort\", () => resolve(), { once: true });\n });\n await stop();\n } finally {\n process.off(\"SIGINT\", onSigint);\n }\n process.exit(0);\n });\n\n cli\n .command(\"upgrade [...families]\", \"Pull registry updates into ./recipes\")\n .option(\"--check\", \"Read-only — print drift summary and exit nonzero on updates\")\n .option(\"--force\", \"Skip touched-detection; overwrite local edits\")\n .option(\"--registry <url>\", \"Registry origin\")\n .option(\"--cwd <dir>\", \"Working directory\")\n .action(\n async (\n families: string[],\n opts: { check?: boolean; force?: boolean; registry?: string; cwd?: string },\n ) => {\n try {\n const upgradeOptions: Parameters<typeof upgrade>[0] = {\n cwd: opts.cwd ?? process.cwd(),\n families,\n };\n if (opts.check) upgradeOptions.check = true;\n if (opts.force) upgradeOptions.force = true;\n if (opts.registry !== undefined) upgradeOptions.registry = opts.registry;\n if (!opts.check && !opts.force) {\n upgradeOptions.resolver = makeInteractiveResolver();\n }\n const result = await upgrade(upgradeOptions);\n printUpgradeSummary(result.outcomes);\n if (opts.check) {\n if (result.hasUpdates || result.hasTouched) process.exit(1);\n }\n } catch (err) {\n if (err instanceof UpgradeError) {\n process.stderr.write(err.message + \"\\n\");\n process.exit(2);\n }\n throw err;\n }\n },\n );\n\n cli\n .command(\"reseal [...families]\", \"Re-sign recipes after intentional edits (updates header sha + lockfile)\")\n .option(\"--cwd <dir>\", \"Working directory\")\n .action(async (families: string[], opts: { cwd?: string }) => {\n const result = await reseal({ cwd: opts.cwd ?? process.cwd(), families });\n for (const f of result.resealed) p.log.success(`resealed ${f}`);\n for (const f of result.unchanged) p.log.info(`${f} already sealed`);\n for (const f of result.notFound) p.log.warn(`${f} is not installed`);\n for (const f of result.noHeader) p.log.warn(`${f} has no fingerprint header`);\n if (result.resealed.length === 0 && result.unchanged.length > 0 && result.notFound.length === 0) {\n p.log.success(\"all recipes already sealed\");\n }\n });\n\n cli\n .command(\"verify\", \"Check installed recipes against fingerprint headers and lockfile\")\n .option(\"--cwd <dir>\", \"Working directory\")\n .action(async (opts: { cwd?: string }) => {\n const result = await verify({ cwd: opts.cwd ?? process.cwd() });\n if (result.ok) {\n p.log.success(`verified ${result.checked.length} families`);\n return;\n }\n for (const issue of result.issues) {\n const desc = describeVerifyIssue(issue);\n process.stderr.write(`${issue.family}: ${desc}\\n`);\n }\n process.exit(1);\n });\n\n cli\n .command(\"doctor\", \"Scan build output for unexpanded @recipe tokens\")\n .option(\"--dir <path>\", \"Output directory to scan (repeatable; default: .next, dist, out, build)\")\n .option(\"--json\", \"Emit machine-readable JSON\")\n .option(\"--cwd <dir>\", \"Working directory\")\n .action(async (opts: { dir?: string | string[]; json?: boolean; cwd?: string }) => {\n const cwd = opts.cwd ?? process.cwd();\n const doctorOptions: Parameters<typeof doctor>[0] = { cwd };\n if (opts.dir !== undefined) {\n doctorOptions.dirs = Array.isArray(opts.dir) ? opts.dir : [opts.dir];\n }\n const result = await doctor(doctorOptions);\n if (opts.json) {\n process.stdout.write(JSON.stringify(result, null, 2) + \"\\n\");\n } else {\n printDoctorReport(result, cwd);\n }\n if (result.verdict === \"no-output\") process.exit(2);\n if (!result.ok) process.exit(1);\n });\n\n cli\n .command(\"lint\", \"Static analysis over source files and recipes\")\n .option(\"--fix\", \"Apply auto-fixes where supported\")\n .option(\"--rule <rule>\", \"Only run the named rule (repeatable)\")\n .option(\"--content <glob>\", \"Source glob to scan for recipe usage (repeatable; overrides config)\")\n .option(\"--json\", \"Emit machine-readable JSON\")\n .option(\"--cwd <dir>\", \"Working directory\")\n .action(\n async (opts: {\n fix?: boolean;\n rule?: string | string[];\n content?: string | string[];\n json?: boolean;\n cwd?: string;\n }) => {\n const requested = opts.rule === undefined ? [] : Array.isArray(opts.rule) ? opts.rule : [opts.rule];\n for (const r of requested) {\n if (!ALL_RULES.includes(r as Rule)) {\n process.stderr.write(`unknown rule: ${r}\\n`);\n process.stderr.write(`available: ${ALL_RULES.join(\", \")}\\n`);\n process.exit(2);\n }\n }\n const lintOptions: Parameters<typeof lint>[0] = { cwd: opts.cwd ?? process.cwd() };\n if (opts.fix) lintOptions.fix = true;\n if (requested.length > 0) lintOptions.rules = requested as Rule[];\n if (opts.content !== undefined) {\n lintOptions.content = Array.isArray(opts.content) ? opts.content : [opts.content];\n }\n const result = await lint(lintOptions);\n if (opts.json) {\n process.stdout.write(JSON.stringify(result, null, 2) + \"\\n\");\n } else {\n const text = formatFindingsText(result.findings);\n if (text) process.stdout.write(text + \"\\n\");\n for (const f of result.filesFixed) p.log.success(`fixed ${f}`);\n if (result.scannedFiles === 0) {\n p.log.warn(\n `content scan matched no source files — usage rules (recipe/unused) were skipped.\\n` +\n `Point lint at your sources with \"content\" in shortwind.config.json or --content <glob>.`,\n );\n }\n if (result.findings.length === 0) p.log.success(\"no findings\");\n }\n if (!result.ok) process.exit(1);\n },\n );\n\n cli\n .command(\"bench [path]\", \"Benchmark token savings in a corpus or target directory\")\n .option(\"--corpus\", \"Run benchmark on the built-in corpus\")\n .option(\"--json\", \"Emit machine-readable JSON\")\n .option(\"--cwd <dir>\", \"Working directory\")\n .action(async (pathArg: string | undefined, opts: { corpus?: boolean; json?: boolean; cwd?: string }) => {\n const benchOptions: Parameters<typeof bench>[0] = { cwd: opts.cwd ?? process.cwd() };\n if (opts.corpus) benchOptions.corpus = true;\n if (pathArg !== undefined) benchOptions.path = pathArg;\n const result = await bench(benchOptions);\n if (opts.json) {\n process.stdout.write(JSON.stringify(result, null, 2) + \"\\n\");\n } else {\n const text = formatBenchTable(result);\n process.stdout.write(text + \"\\n\");\n }\n });\n\n cli.help();\n cli.version(cliVersion() ?? \"0.0.0\");\n // cac's parse() invokes the matched command's async action but does NOT await\n // it, so a rejection inside any async command (network failure in `add`, a\n // rethrow in `build`/`upgrade`, …) escapes bin.ts's `run().catch` and prints\n // a raw unhandled-rejection dump. Parse without running, then await the\n // command so its promise flows back to the caller's catch.\n cli.parse(argv, { run: false });\n await cli.runMatchedCommand();\n}\n\nfunction makeInteractiveResolver() {\n return async (ctx: TouchedContext): Promise<UpgradeChoice> => {\n process.stdout.write(\n pc.yellow(`\\n${ctx.family}: locally modified — incoming ${ctx.incoming.version}\\n`),\n );\n const choice = await p.select({\n message: `Resolve ${ctx.family}`,\n options: [\n { value: \"accept\", label: \"Accept new (discard local edits)\" },\n { value: \"keep\", label: \"Keep yours\" },\n { value: \"skip\", label: \"Skip for now\" },\n ],\n });\n if (p.isCancel(choice)) return \"skip\";\n return choice as UpgradeChoice;\n };\n}\n\nfunction printUpgradeSummary(outcomes: Awaited<ReturnType<typeof upgrade>>[\"outcomes\"]): void {\n for (const o of outcomes) {\n if (o.action === \"updated\") {\n process.stdout.write(pc.green(`✓ ${o.family} ${o.from} → ${o.to}\\n`));\n } else if (o.action === \"would-update\") {\n process.stdout.write(pc.cyan(`→ ${o.family} ${o.from} → ${o.to} (available)\\n`));\n } else if (o.action === \"would-review\") {\n process.stdout.write(pc.yellow(`! ${o.family} ${o.from} → ${o.to} (touched; needs review)\\n`));\n } else if (o.action === \"kept\" && o.reason === \"user-chose-keep\") {\n process.stdout.write(pc.dim(` ${o.family} kept local\\n`));\n } else if (o.action === \"skipped\") {\n process.stdout.write(pc.dim(` ${o.family} skipped (${o.reason})\\n`));\n }\n }\n}\n\n// The whole point of doctor (#84) is telling \"you forgot to wire the adapter\"\n// apart from \"the adapter ran and something leaked\" — both otherwise present\n// as a green build that ships raw @recipe text.\nfunction printDoctorReport(result: Awaited<ReturnType<typeof doctor>>, cwd: string): void {\n if (result.verdict === \"no-output\") {\n p.log.error(\n `no build output found (looked for .next/, dist/, out/, build/).\\n` +\n `Run your framework's build first, or point doctor at it with --dir <path>.`,\n );\n return;\n }\n if (result.verdict === \"clean\") {\n p.log.success(\n `no unexpanded recipe tokens in ${result.outputDirs.join(\", \")} (${result.scannedFiles} files scanned)`,\n );\n return;\n }\n for (const f of result.findings) {\n process.stderr.write(`${path.relative(cwd, f.file)}: ${f.tokens.join(\", \")}\\n`);\n }\n const tokenCount = new Set(result.findings.flatMap((f) => f.tokens)).size;\n if (result.verdict === \"not-wired\") {\n const bundler = detectProject(cwd).bundler;\n p.log.error(\n `found ${tokenCount} raw @recipe token${tokenCount === 1 ? \"\" : \"s\"} in build output and ` +\n `every recipe your source references is among them — it looks like no Shortwind ` +\n `transform ran during the build.\\n` +\n `Is the adapter wired? ${adapterHint(bundler)}\\n` +\n `Setup guide: ${setupGuideUrl(bundler)}`,\n );\n } else {\n p.log.error(\n `found ${tokenCount} raw @recipe token${tokenCount === 1 ? \"\" : \"s\"} in build output. ` +\n `The Shortwind transform ran (other recipes expanded), so these specific tokens ` +\n `escaped it — typically a className built from a variable/prop/template, or markup ` +\n `in a region the expander treats as opaque.\\n` +\n `See https://shortwind.dev/docs/dynamic-classes`,\n );\n }\n}\n\n// Slugs match site/src/content/docs/setup-<bundler>.md (#85).\nfunction setupGuideUrl(bundler: Bundler): string {\n return bundler === \"unknown\"\n ? \"https://shortwind.dev/docs/install\"\n : `https://shortwind.dev/docs/setup-${bundler}`;\n}\n\nfunction adapterHint(bundler: Bundler): string {\n switch (bundler) {\n case \"next\":\n return \"Next needs `export default withShortwind()(nextConfig)` in next.config — note the call is curried.\";\n case \"vite\":\n return \"Vite needs `shortwind()` in the vite.config plugins array: `plugins: [shortwind(), tailwindcss(), ...]`.\";\n case \"astro\":\n return \"Astro needs `shortwind()` in astro.config `integrations`.\";\n default:\n return \"Add the Shortwind plugin for your bundler (see the setup guide).\";\n }\n}\n\nfunction describeVerifyIssue(issue: VerifyIssue): string {\n switch (issue.kind) {\n case \"missing-header\":\n return \"no fingerprint header — recipe was hand-stripped\";\n case \"header-tampered\":\n return `header sha ${issue.recorded} but body hashes to ${issue.actual}`;\n case \"legacy-fingerprint\":\n return `sealed with an older fingerprint format (${issue.recorded}) — run \\`shortwind reseal\\` to upgrade it (the recipe body is unchanged)`;\n case \"lockfile-mismatch\":\n return `lockfile expects ${issue.locked} but body hashes to ${issue.actual}`;\n case \"missing-lock-entry\":\n return \"installed but not recorded in lockfile\";\n case \"missing-file\":\n return \"in lockfile but file is missing\";\n }\n}\n\nasync function promptForPreset(): Promise<string> {\n const choice = await p.select({\n message: \"Pick a preset\",\n options: KNOWN_PRESETS.map((name) => ({ value: name, label: name })),\n });\n if (p.isCancel(choice)) {\n p.cancel(\"Cancelled.\");\n process.exit(0);\n }\n return choice;\n}\n\nfunction installCmd(pm: Awaited<ReturnType<typeof init>>[\"packageManager\"]): string {\n switch (pm) {\n case \"bun\":\n return \"bun add -d\";\n case \"npm\":\n return \"npm install -D\";\n default:\n return `${pm} add -D`;\n }\n}\n\nfunction printInitSummary(result: Awaited<ReturnType<typeof init>>): void {\n p.note(\n [\n `preset: ${result.preset}`,\n `registry: ${result.registry}`,\n `package manager: ${result.packageManager}`,\n `families copied: ${result.installedFamilies.length}`,\n `families skipped: ${result.skippedFamilies.length}`,\n `adapters: ${result.installOk ? result.installedPackages.join(\", \") || \"none\" : \"install failed — see below\"}`,\n ``,\n `config: ${result.configPath}`,\n `vscode settings: ${result.vscodePath}`,\n `pre-commit: ${result.huskyPath ?? \"skipped (not a git repository)\"}`,\n `SKILL.md: ${result.skillPath}`,\n `theme: ${describeTheme(result)}`,\n `bundler config: ${describeBundlerConfig(result)}`,\n `agent guide: ${describeAgentsFile(result)}`,\n ].join(\"\\n\"),\n \"shortwind init\",\n );\n if (!result.installOk) {\n const v = cliVersion();\n const specs = result.installedPackages.map((p) => (v ? `${p}@${v}` : p)).join(\" \");\n p.log.warn(\n `Couldn't auto-install adapters (your recipes and config were still scaffolded).\\n` +\n `Finish by installing them yourself:\\n\\n` +\n ` ${installCmd(result.packageManager)} ${specs}\\n\\n` +\n `(${result.installError ?? \"unknown error\"})`,\n );\n }\n if (result.bundlerConfigAction === \"manual\" && result.bundlerConfigSnippet) {\n p.log.warn(`Add the plugin to your bundler config:\\n\\n${result.bundlerConfigSnippet}`);\n }\n p.log.info(`Setup guide for your stack: ${setupGuideUrl(result.bundler)}`);\n if (result.themeAction === \"supplemented\") {\n p.log.info(\n `Your theme (${result.themePath}) didn't define ${result.supplementedThemeTokens.length} design token${result.supplementedThemeTokens.length === 1 ? \"\" : \"s\"} the installed recipes use:\\n\\n` +\n ` ${result.supplementedThemeTokens.join(\", \")}\\n\\n` +\n `Appended them with neutral placeholder values (marked block at the end of the file) so recipes render on first run — tune them to your palette.\\n` +\n `Reference values: https://shortwind.dev/docs/install#theme-tokens`,\n );\n }\n if (result.missingThemeTokens.length > 0) {\n p.log.warn(\n `Your existing theme (${result.themePath}) does not define ${result.missingThemeTokens.length} design token${result.missingThemeTokens.length === 1 ? \"\" : \"s\"} the installed recipes use:\\n\\n` +\n ` ${result.missingThemeTokens.join(\", \")}\\n\\n` +\n `Recipes referencing them will render colorless until you add the tokens to your @theme.\\n` +\n `The default token block is documented at https://shortwind.dev/docs/install#theme-tokens`,\n );\n }\n p.outro(\n `Next: run \\`${devCmd(result.packageManager)}\\` and check a recipe renders. After a production build, \\`npx shortwind doctor\\` verifies nothing shipped unexpanded.`,\n );\n}\n\n// `npm dev` is not a thing — npm needs the `run` form; pnpm/yarn/bun accept\n// the bare script name.\nfunction devCmd(pm: Awaited<ReturnType<typeof init>>[\"packageManager\"]): string {\n return pm === \"npm\" ? \"npm run dev\" : `${pm} dev`;\n}\n\nfunction describeAgentsFile(result: Awaited<ReturnType<typeof init>>): string {\n switch (result.agentsFileAction) {\n case \"created\":\n return `wrote ${result.agentsFilePath}`;\n case \"appended\":\n return `added recipe pointer to ${result.agentsFilePath}`;\n case \"skipped\":\n return `pointer already in ${result.agentsFilePath}`;\n }\n}\n\nfunction describeBundlerConfig(result: Awaited<ReturnType<typeof init>>): string {\n switch (result.bundlerConfigAction) {\n case \"patched\":\n return `plugin added to ${result.bundlerConfigPath}`;\n case \"manual\":\n return \"needs a manual edit (see below)\";\n case \"skipped\":\n return result.bundlerConfigPath\n ? `already wired in ${result.bundlerConfigPath}`\n : \"skipped (no supported bundler)\";\n }\n}\n\nfunction describeTheme(result: Awaited<ReturnType<typeof init>>): string {\n switch (result.themeAction) {\n case \"injected\":\n return `tokens added to ${result.themePath}`;\n case \"created\":\n return `wrote ${result.themePath}`;\n case \"supplemented\":\n return `kept your theme; appended ${result.supplementedThemeTokens.length} missing tokens to ${result.themePath}`;\n case \"skipped\":\n return result.themePath\n ? `left existing theme in ${result.themePath} untouched`\n : \"skipped (no Tailwind v4 CSS entry — define color tokens yourself)\";\n }\n}\n","#!/usr/bin/env node\nimport { run } from \"./cli.js\";\n\nrun().catch((err) => {\n console.error(err instanceof Error ? err.stack ?? err.message : err);\n process.exit(1);\n});\n"],"mappings":";;;;;;;;;;;;AA4CA,MAAM,sBAAsB;CAAC;CAAS;CAAQ;CAAO;CAAQ;AAM7D,MAAM,cAAc;AAGpB,MAAM,gBAAgB,CAAC,sBAAsB,cAAc;AAE3D,eAAsB,OAAO,SAA+C;CAC1E,MAAM,MAAM,KAAK,QAAQ,QAAQ,IAAI;CACrC,MAAM,SAAS,MAAM,WAAW,IAAI;CACpC,MAAM,aAAa,KAAK,KAAK,KAAK,OAAO,WAAW;CACpD,MAAM,WAAW,oBAAoB,WAAW;CAEhD,MAAM,cAAc,QAAQ,QAAQ,qBAAqB,QAAQ,MAC/D,WAAW,KAAK,KAAK,KAAK,EAAE,CAAC,CAC9B;CACD,IAAI,WAAW,WAAW,GACxB,OAAO;EACL,IAAI;EACJ,SAAS;EACT,YAAY,EAAE;EACd,cAAc;E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B,OAAO,UAAU,oBAAoB,OAAO,mBAAmB,OAAO,eAAe,OAAO,mBAAmB,WAAW,IAAI,KAAK,IAAI,mCACxJ,OAAO,mBAAmB,KAAK,KAAK,CAAC,uLAG7C;CAEH,EAAE,MACA,eAAe,OAAO,OAAO,eAAe,CAAC,wHAC9C;;AAKH,SAAS,OAAO,IAAgE;CAC9E,OAAO,OAAO,QAAQ,gBAAgB,GAAG,GAAG;;AAG9C,SAAS,mBAAmB,QAAkD;CAC5E,QAAQ,OAAO,kBAAf;EACE,KAAK,WACH,OAAO,SAAS,OAAO;EACzB,KAAK,YACH,OAAO,2BAA2B,OAAO;EAC3C,KAAK,WACH,OAAO,sBAAsB,OAAO;;;AAI1C,SAAS,sBAAsB,QAAkD;CAC/E,QAAQ,OAAO,qBAAf;EACE,KAAK,WACH,OAAO,mBAAmB,OAAO;EACnC,KAAK,UACH,OAAO;EACT,KAAK,WACH,OAAO,OAAO,oBACV,oBAAoB,OAAO,sBAC3B;;;AAIV,SAAS,cAAc,QAAkD;CACvE,QAAQ,OAAO,aAAf;EACE,KAAK,YACH,OAAO,mBAAmB,OAAO;EACnC,KAAK,WACH,OAAO,SAAS,OAAO;EACzB,KAAK,gBACH,OAAO,6BAA6B,OAAO,wBAAwB,OAAO,qBAAqB,OAAO;EACxG,KAAK,WACH,OAAO,OAAO,YACV,0BAA0B,OAAO,UAAU,cAC3C;;;;;ACvnBV,KAAK,CAAC,OAAO,QAAQ;CACnB,QAAQ,MAAM,eAAe,QAAQ,IAAI,SAAS,IAAI,UAAU,IAAI;CACpE,QAAQ,KAAK,EAAE;EACf"}
|
package/dist/index.d.ts
CHANGED
|
@@ -15,7 +15,7 @@ type ProjectShape = {
|
|
|
15
15
|
declare function detectProject(cwd: string): ProjectShape;
|
|
16
16
|
//#endregion
|
|
17
17
|
//#region src/theme.d.ts
|
|
18
|
-
type ThemeAction = "injected" | "created" | "skipped";
|
|
18
|
+
type ThemeAction = "injected" | "created" | "skipped" | "supplemented";
|
|
19
19
|
//#endregion
|
|
20
20
|
//#region src/bundler-config.d.ts
|
|
21
21
|
type BundlerWireAction = "patched" | "manual" | "skipped";
|
|
@@ -34,6 +34,7 @@ type InitOptions = {
|
|
|
34
34
|
type InstallPackages = (pm: PackageManager, packages: string[], cwd: string) => Promise<void>;
|
|
35
35
|
type InitResult = {
|
|
36
36
|
packageManager: PackageManager;
|
|
37
|
+
bundler: ReturnType<typeof detectProject>["bundler"];
|
|
37
38
|
preset: string;
|
|
38
39
|
registry: string;
|
|
39
40
|
families: string[];
|
|
@@ -48,6 +49,7 @@ type InitResult = {
|
|
|
48
49
|
themeAction: ThemeAction;
|
|
49
50
|
safelistCssPaths: string[];
|
|
50
51
|
missingThemeTokens: string[];
|
|
52
|
+
supplementedThemeTokens: string[];
|
|
51
53
|
bundlerConfigPath: string | null;
|
|
52
54
|
bundlerConfigAction: BundlerWireAction;
|
|
53
55
|
bundlerConfigSnippet?: string;
|
|
@@ -377,6 +379,7 @@ type LintResult = {
|
|
|
377
379
|
ok: boolean;
|
|
378
380
|
findings: Finding[];
|
|
379
381
|
filesFixed: string[];
|
|
382
|
+
scannedFiles: number;
|
|
380
383
|
};
|
|
381
384
|
declare function lint(options: LintOptions): Promise<LintResult>;
|
|
382
385
|
type ClassUsage = {
|
package/dist/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","names":[],"sources":["../src/detect.ts","../src/theme.ts","../src/bundler-config.ts","../src/agents-file.ts","../src/init.ts","../src/registry-source.ts","../src/lockfile.ts","../src/commands/add.ts","../src/commands/remove.ts","../src/commands/new.ts","../src/commands/reseal.ts","../src/commands/preset.ts","../src/commands/ls.ts","../src/commands/build.ts","../src/commands/dev.ts","../src/commands/upgrade.ts","../src/commands/verify.ts","../src/commands/bench.ts","../src/commands/lint.ts","../src/fingerprint.ts","../src/project.ts"],"mappings":";;;KAKY,cAAA;AAAA,KACA,OAAA;AAAA,KAOA,SAAA;AAAA,KAEA,YAAA;EACV,cAAA,EAAgB,cAAA;EAChB,eAAA;EACA,aAAA;EACA,OAAA,EAAS,OAAA;EACT,SAAA,EAAW,SAAA;EACX,cAAA;AAAA;AAAA,iBAyBc,aAAA,CAAc,GAAA,WAAc,YAAA;;;
|
|
1
|
+
{"version":3,"file":"index.d.ts","names":[],"sources":["../src/detect.ts","../src/theme.ts","../src/bundler-config.ts","../src/agents-file.ts","../src/init.ts","../src/registry-source.ts","../src/lockfile.ts","../src/commands/add.ts","../src/commands/remove.ts","../src/commands/new.ts","../src/commands/reseal.ts","../src/commands/preset.ts","../src/commands/ls.ts","../src/commands/build.ts","../src/commands/dev.ts","../src/commands/upgrade.ts","../src/commands/verify.ts","../src/commands/bench.ts","../src/commands/lint.ts","../src/fingerprint.ts","../src/project.ts"],"mappings":";;;KAKY,cAAA;AAAA,KACA,OAAA;AAAA,KAOA,SAAA;AAAA,KAEA,YAAA;EACV,cAAA,EAAgB,cAAA;EAChB,eAAA;EACA,aAAA;EACA,OAAA,EAAS,OAAA;EACT,SAAA,EAAW,SAAA;EACX,cAAA;AAAA;AAAA,iBAyBc,aAAA,CAAc,GAAA,WAAc,YAAA;;;KCuDhC,WAAA;;;KC3FA,iBAAA;;;KCyBA,gBAAA;;;cCCC,gBAAA;AAAA,KAED,WAAA;EACV,GAAA;EACA,MAAA;EACA,QAAA;EACA,eAAA,GAAkB,eAAA;AAAA;AAAA,KAGR,eAAA,IACV,EAAA,EAAI,cAAA,EACJ,QAAA,YACA,GAAA,aACG,OAAA;AAAA,KAEO,UAAA;EACV,cAAA,EAAgB,cAAA;EAGhB,OAAA,EAAS,UAAA,QAAkB,aAAA;EAC3B,MAAA;EACA,QAAA;EACA,QAAA;EACA,iBAAA;EACA,iBAAA;EACA,eAAA;EACA,UAAA;EACA,UAAA;EAEA,SAAA;EACA,SAAA;EACA,SAAA;EACA,WAAA,EAAa,WAAA;EAGb,gBAAA;EAIA,kBAAA;EAGA,uBAAA;EACA,iBAAA;EACA,mBAAA,E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,KAGU,UAAA;EACV,EAAA;EACA,QAAA,EAAU,OAAA;EACV,UAAA;EAKA,YAAA;AAAA;AAAA,iBAYoB,IAAA,CAAK,OAAA,EAAS,WAAA,GAAc,OAAA,CAAQ,UAAA;AAAA,KA6YrD,UAAA;EACH,UAAA;EAKA,UAAA;EACA,GAAA;EACA,MAAA,EAAQ,KAAA;IAAQ,KAAA;IAAe,IAAA;IAAc,MAAA;EAAA;EAI7C,aAAA,EAAe,KAAA;IAAQ,KAAA;IAAe,IAAA;IAAc,MAAA;EAAA;EAIpD,OAAA;AAAA;AAAA,iBAWc,kBAAA,CAAmB,MAAA,WAAiB,UAAA;AAAA,iBAyPpC,kBAAA,CAAmB,QAAA,EAAU,OAAA;;;KCjtBjC,YAAA;EACV,MAAA;EACA,OAAA;EACA,GAAA;AAAA;AAAA,iBAGc,aAAA,CAAc,MAAA,WAAiB,YAAA;AAAA,iBAgB/B,cAAA,CAAe,MAAA;AAAA,iBA2Bf,mBAAA,CAAoB,MAAA,UAAgB,MAAA;AAAA,iBAmBpC,eAAA,CAAgB,MAAA,UAAgB,OAAA,UAAiB,GAAA;AAAA,iBAIjD,gBAAA,CAAiB,MAAA,UAAgB,GAAA;AAAA,iBASjC,cAAA,CAAe,MAAA,UAAgB,MAAA,UAAgB,OAAA;;;;;;;;;;;iBCqE/C,oBAAA,CAAqB,MAAA,UAAgB,IAAA,UAAc,EAAA"}
|
package/dist/index.js
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import { A as
|
|
1
|
+
import { A as createRegistrySource, D as init, F as extractHeader, I as rewriteHeaderSha, L as sealRecipeFile, M as detectProject, N as buildHeaderLine, O as readLockfile, P as computeBodySha, R as verifyFetchedFamily, T as DEFAULT_REGISTRY, _ as reseal, a as extractClassUsages, b as remove, c as verify, d as dev, f as BuildError, g as preset, h as ls, j as resolvePresetFamilies, k as writeLockfile, l as UpgradeError, m as formatLsText, n as formatBenchTable, o as formatFindingsText, p as build, r as ALL_RULES, s as lint, t as bench, u as upgrade, v as NewFamilyError, w as renameFamilyInSource, x as add, y as newFamily } from "./bench-B7SxNGiU.js";
|
|
2
2
|
export { ALL_RULES, BuildError, DEFAULT_REGISTRY, NewFamilyError, UpgradeError, add, bench, build, buildHeaderLine, computeBodySha, createRegistrySource, detectProject, dev, extractClassUsages, extractHeader, formatBenchTable, formatFindingsText, formatLsText, init, lint, ls, newFamily, preset, readLockfile, remove, renameFamilyInSource, reseal, resolvePresetFamilies, rewriteHeaderSha, sealRecipeFile, upgrade, verify, verifyFetchedFamily, writeLockfile };
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@shortwind/cli",
|
|
3
|
-
"version": "0.1.0-beta.
|
|
3
|
+
"version": "0.1.0-beta.13",
|
|
4
4
|
"description": "Shortwind CLI — init, add, remove, upgrade, dev, build, lint, ls, preset. Provides the `shortwind` command.",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"bin": {
|
|
@@ -19,8 +19,8 @@
|
|
|
19
19
|
"jsonc-parser": "^3.3.1",
|
|
20
20
|
"picocolors": "^1.1.1",
|
|
21
21
|
"tinyglobby": "^0.2.16",
|
|
22
|
-
"@shortwind/core": "0.1.0-beta.
|
|
23
|
-
"@shortwind/tailwind": "0.1.0-beta.
|
|
22
|
+
"@shortwind/core": "0.1.0-beta.13",
|
|
23
|
+
"@shortwind/tailwind": "0.1.0-beta.13"
|
|
24
24
|
},
|
|
25
25
|
"devDependencies": {
|
|
26
26
|
"@types/node": "^25.7.0",
|