@stillwind/cli 0.11.0 → 0.13.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/CHANGELOG.md CHANGED
@@ -1,5 +1,67 @@
1
1
  # @stillwind/cli
2
2
 
3
+ ## 0.13.0
4
+
5
+ ### Minor Changes
6
+
7
+ - CSS `@variant` rules now accept `or(...)` variant alternatives, such as `@variant md:or(hover,focus) { ... }`.
8
+
9
+ - `stillwind lint`, `fmt`, and `check` now analyze the projects of a configuration in parallel worker processes, so a configuration that lists several projects, such as a monorepo root, finishes sooner. Projects that share a target file are still analyzed together in one process. `lint`, `format`, and `check` in `@stillwind/analysis` accept a `concurrency` option that sets the maximum number of worker processes. By default, the maximum is half of the available parallelism.
10
+
11
+ ### Patch Changes
12
+
13
+ - `prefer-canonical-utilities` no longer suggests a replacement that matches only for the current theme values. For example, it no longer suggests `rounded-md` for `rounded-[min(var(--radius-md),10px)]`, because the two differ when `--radius-md` is larger than `10px`.
14
+
15
+ It also no longer uses the built-in value of `--radius` for a theme value that refers to `var(--radius)`, because the generated CSS does not declare that value. For example, with `--radius-lg: var(--radius)` in `@theme inline` and `--radius` declared in `:root`, it no longer suggests `rounded-lg` for `rounded-[4px]`.
16
+
17
+ - Hover previews now annotate conditional utilities and recipe variants/slots with rule-leading comments, show scoped previews when hovering recipe slots, variant axes, variant options, compound entries, and style sub-expressions, and filter `recipe({ ... })` call previews by static arguments and `defaultVariants`.
18
+
19
+ - Hover previews now annotate `color-mix()` and `light-dark()` color equivalents, evaluate `calc()` with `rem` dimensions when `themeValues` is disabled and inside `@media` / `@container` preludes, display registered `@property` definitions on `@stillwind-require-properties` arguments, preview `style.when()`, `style.ref()`, and `style.recipe()` calls and their variable references, and display the resolved JavaScript string literal for `style.media()` calls and references.
20
+
21
+ - Hover previews in the language server now omit redundant empty `& {}` rules inside selector variants, trim trailing blank lines from CSS code blocks, annotate active theme declarations hovered in stylesheets, omit redundant hexadecimal comments on shorthand hex theme tokens, omit marker-class notes under enclosing variants, and avoid treating unrelated `.at()` and `.in()` calls as ref variants.
22
+
23
+ - Analysis no longer prepares the TypeScript checker again each time CSS ordering reads a module that the analyzed files do not import for type information. `stillwind lint`, `fmt`, and `check` and the editor finish sooner in projects whose components are imported through other modules.
24
+
25
+ - Show marker documentation instead of a variant CSS block when hovering `style.ref()` declarations and ref marker references.
26
+
27
+ - Fix hover and completion previews for `if(...)`, `or(...)`, and `@scope` variants, and remove trailing spaces in `@starting-style` completion details.
28
+
29
+ - Variant hover and completion previews now mark where utility declarations or nested rules are inserted with `/* … */`.
30
+
31
+ - Updated dependencies:
32
+ - @stillwind/analysis@0.13.0
33
+ - @stillwind/language-server@0.13.0
34
+ - @stillwind/native@0.13.0
35
+
36
+ ## 0.12.0
37
+
38
+ ### Minor Changes
39
+
40
+ - Added `stillwind check` and `stillwind check --fix` to run lint checks and utility sorting in a single analysis pass. `stillwind check` reports lint findings and files that need sorting without saving, and exits with `1` when errors or unsorted files remain. `stillwind check --fix` applies converged automatic fixes and utility sorting, saves changed files, and reports findings for the final sources. `@stillwind/analysis/node` exports the corresponding `check()` function, and `stillwind`'s agent instructions now recommend `stillwind check --fix`.
41
+
42
+ - Added `stillwind info` (and `info()` in `@stillwind/analysis/node`) to report each project's resolved root, stylesheet path, target and exclude globs, matched file count, registered plugins, sorting and `typeFacts` settings, and active lint rules in text or JSON format without compiling source files.
43
+
44
+ - Add `--limit <n>` to `stillwind check` and `stillwind lint` to cap displayed diagnostics while preserving full counts and exit codes, add `summary.byCode` and `summary.omittedDiagnostics` to `--format json`, and expose working-directory-relative `file` paths with 1-based `line` and `column` fields directly on JSON diagnostics and inspect previews.
45
+
46
+ - `stillwind utilities` and `stillwind variants` now accept `--names-only` to list matching names without formatting CSS previews. Pattern searches in `stillwind utilities` now also include placeholder patterns for functional utilities' non-enumerable domains, such as `p-<number>` and `p-[<length-percentage>]` (`kind: "pattern"` in JSON). `stillwind theme` now includes resolved values for tokens that reference other theme variables (`resolvedValue` in JSON, and inline comments in text output).
47
+
48
+ - Diagnostic actions in CLI output now distinguish automatic fixes from manual suggestions (`actions[].autofix`, `summary.autofixable`, and `(autofix)` / `(suggestion)` labels in text output), and the `--fix` hint is shown only when automatic fixes are available. `stillwind inspect` now explains why no previews were returned (`emptyReason`: `no-styles`, `line-out-of-range`, `column-out-of-range`, or `no-match-at-position`). Uncompiled runtime placeholder errors for every `style.*` macro now include guidance on build integration ordering and `docs/integrations.md`.
49
+
50
+ - Added project-scoped `hooks` (`defineHook` and `AnalysisHook` from `stillwind/config` and `@stillwind/config`) for in-memory formatting in `stillwind fmt` and `stillwind check`. Hooks support `setup`, `teardown`, and per-file `format` callbacks so formatters such as Oxfmt run after Stillwind utility sorting in one pass, including `--check`. `stillwind info` now also lists configured hook names.
51
+
52
+ ### Patch Changes
53
+
54
+ - The `stillwind` package now bundles `docs/llms.txt`, a single-file index of all bundled Markdown documentation pages with relative paths and descriptions, and updates `AGENTS_TEMPLATE.md` and `skills/stillwind/SKILL.md` so coding agents can look up design-system tokens, utilities, and generated CSS without broken cross-skill links. The public `style()` overload now appears before the internal checker overload so TypeScript diagnostics report the public signature first. `stillwind inspect` now prints `docs:` lines for findings in text output, matching `stillwind lint`.
55
+
56
+ - Make editor integrations clearer. The VS Code extension shows a Stillwind status bar item that tells whether the project's `@stillwind/cli` or the bundled language server runs, and opens the output channel on click. A change to `stillwind.configFile` restarts the language server. **Stillwind: Sort Utilities** reports in the status bar when the utilities are already sorted. Stillwind at-rules in CSS files show descriptions and syntax on hover and in completion, and the Command Palette no longer lists internal commands. Diagnostics use `stillwind` as their source, and add the project path only when several projects report on the same file. Color utilities complete with color swatches, completion lists report when the catalog has more entries than they show, resolved completions keep their detail, Quick Fixes link to their diagnostics and mark the primary fix as preferred, and hovers name the project only when several projects give different results. The Prettier `stillwindConfig` option describes every `stillwind.config.*` format.
57
+
58
+ - Make CLI and build output easier to read. `stillwind --help` now highlights headings and options, lists `--format files` only for `stillwind fmt`, and suggests valid commands and `--help` for an unknown command or option. Text output colors file paths, codes, `note:`, `help:`, and `docs:` labels, shows `[project N]` only when results come from several projects, and gives `stillwind inspect` diagnostics the same colors and docs links. Compiler and lint messages no longer show internal byte offsets or debug values, name the conflicting framework and source format for `SW02001`, show the rejected prefix for `SW01001`, and use consistent punctuation and backticks. Unterminated blocks, nesting overflows, and syntax errors in CSS now point at the failing character instead of the whole stylesheet. When the failing CSS has no document URI, such as CSS that a plugin generates, the error message names that source and the byte offset. Vite reports compile errors in the error overlay with a clickable location and a code frame, and build warnings use the `stillwind: <rule>: <message> (<path>:<line>:<column>)` form.
59
+
60
+ - Updated dependencies:
61
+ - @stillwind/analysis@0.12.0
62
+ - @stillwind/language-server@0.12.0
63
+ - @stillwind/native@0.12.0
64
+
3
65
  ## 0.11.0
4
66
 
5
67
  ### Patch Changes
package/README.md CHANGED
@@ -9,7 +9,7 @@ It uses the same project configuration as the build integration and editor.
9
9
  ## Install
10
10
 
11
11
  ```sh
12
- vp i -D @stillwind/cli
12
+ npm install -D @stillwind/cli
13
13
  ```
14
14
 
15
15
  Create a [Stillwind project configuration](https://stillwind.dev/docs/configuration)
@@ -19,15 +19,20 @@ before running commands. The CLI searches upward from the working directory for
19
19
  ## Commands
20
20
 
21
21
  ```sh
22
+ stillwind check
23
+ stillwind check --fix
22
24
  stillwind fmt
23
25
  stillwind lint
24
26
  stillwind lint --fix
27
+ stillwind info
25
28
  stillwind inspect src/Button.tsx:12
26
29
  stillwind theme 'color-*'
27
30
  stillwind utilities p-4 'bg-*'
28
31
  stillwind variants 'group-*'
29
32
  ```
30
33
 
34
+ `check` runs lint and utility sorting checks in one pass; `check --fix` applies
35
+ enabled automatic fixes, sorts utilities, and reports the remaining findings.
31
36
  `fmt` sorts utility inputs and preserves source layout and token spellings. Run a
32
37
  general formatter afterward, or use
33
38
  [prettier-plugin-stillwind](https://stillwind.dev/docs/formatters).
package/dist/main.js CHANGED
@@ -8,7 +8,7 @@ import { fileURLToPath, pathToFileURL } from "node:url";
8
8
  import { documentationSection, documentationUrl, lintReports } from "@stillwind/analysis";
9
9
  import { existsSync } from "node:fs";
10
10
  // package.json
11
- var version = "0.11.0";
11
+ var version = "0.13.0";
12
12
  // src/arguments.ts
13
13
  const configArgs = { config: {
14
14
  type: "string",
@@ -22,11 +22,10 @@ const outputArgs = {
22
22
  options: [
23
23
  "text",
24
24
  "json",
25
- "github",
26
- "files"
25
+ "github"
27
26
  ],
28
27
  default: process.env.GITHUB_ACTIONS === "true" ? "github" : "text",
29
- description: "Output format"
28
+ description: "Output format (text, json, or github)"
30
29
  },
31
30
  color: {
32
31
  type: "enum",
@@ -49,6 +48,16 @@ const outputArgs = {
49
48
  description: "Control links to source locations"
50
49
  }
51
50
  };
51
+ const allFormatArg = {
52
+ ...outputArgs.format,
53
+ options: [
54
+ "text",
55
+ "json",
56
+ "github",
57
+ "files"
58
+ ],
59
+ description: "Output format (text, json, github, or files)"
60
+ };
52
61
  const targetArgs = {
53
62
  ...configArgs,
54
63
  ...outputArgs,
@@ -67,13 +76,21 @@ const warningArgs = {
67
76
  type: "string",
68
77
  description: "Fail when the warning count exceeds this non-negative integer",
69
78
  valueHint: "count"
79
+ },
80
+ limit: {
81
+ type: "string",
82
+ description: "Show at most this many diagnostics while retaining summary counts",
83
+ valueHint: "count"
70
84
  }
71
85
  };
72
- function warningLimit(value) {
86
+ function nonNegativeInteger(value, option) {
73
87
  if (value === void 0) return;
74
- if (!/^\d+$/.test(value) || !Number.isSafeInteger(Number(value))) throw new Error("Invalid value for --max-warnings: expected a non-negative integer");
88
+ if (!/^\d+$/.test(value) || !Number.isSafeInteger(Number(value))) throw new Error(`Invalid value for ${option}: expected a non-negative integer`);
75
89
  return Number(value);
76
90
  }
91
+ function warningLimit(value) {
92
+ return nonNegativeInteger(value, "--max-warnings");
93
+ }
77
94
  const builtinArgs = {
78
95
  help: {
79
96
  type: "boolean",
@@ -91,8 +108,11 @@ const builtinArgs = {
91
108
  * A valid format is retained if a later display option fails, so the error uses the requested format.
92
109
  */
93
110
  function readOutputOptions(rawArgs, options) {
94
- options.format = parseArgs$1(rawArgs, { format: outputArgs.format }).format;
95
- const { color, hyperlinks } = parseArgs$1(rawArgs, outputArgs);
111
+ options.format = parseArgs$1(rawArgs, { format: allFormatArg }).format;
112
+ const { color, hyperlinks } = parseArgs$1(rawArgs, {
113
+ color: outputArgs.color,
114
+ hyperlinks: outputArgs.hyperlinks
115
+ });
96
116
  options.color = color;
97
117
  options.hyperlinks = hyperlinks;
98
118
  }
@@ -103,7 +123,10 @@ const strictArguments = defineCittyPlugin({
103
123
  const definitions = await (typeof cmd.args === "function" ? cmd.args() : cmd.args) ?? {};
104
124
  const names = /* @__PURE__ */ new Set(["_", ...Object.keys(definitions).flatMap((name) => [name, name.replace(/-([a-z])/g, (_, letter) => letter.toUpperCase())])]);
105
125
  for (const definition of Object.values(definitions)) if ("alias" in definition) for (const alias of [definition.alias ?? []].flat()) names.add(alias);
106
- for (const name of Object.keys(args)) if (!names.has(name)) throw new Error(`Unknown option: --${name}`);
126
+ for (const name of Object.keys(args)) if (!names.has(name)) {
127
+ const flag = name.length === 1 ? `-${name}` : `--${name}`;
128
+ throw new Error(`Unknown option: ${flag}. Run with --help to see valid options.`);
129
+ }
107
130
  for (const [name, definition] of Object.entries(definitions)) if (definition.type === "string" && args[name] !== void 0 && (typeof args[name] !== "string" || args[name] === "")) throw new Error(`Missing or invalid value for --${name}`);
108
131
  }
109
132
  });
@@ -172,6 +195,15 @@ function stillwindRoot(config) {
172
195
  }
173
196
  }
174
197
  // src/result.ts
198
+ function relativeFilePath(uri, cwd) {
199
+ let file = uri;
200
+ if (uri.startsWith("file:")) try {
201
+ file = fileURLToPath(uri);
202
+ } catch {
203
+ file = uri;
204
+ }
205
+ return (path.isAbsolute(file) ? path.relative(cwd, file) || "." : file).replaceAll("\\", "/");
206
+ }
175
207
  /**
176
208
  * Tests whether a command reads a design system and no source files.
177
209
  */
@@ -179,10 +211,19 @@ function isDesignCommand(command) {
179
211
  return command === "theme" || command === "utilities" || command === "variants";
180
212
  }
181
213
  /**
214
+ * Returns whether `--fix` automatically applies `action` for `report`.
215
+ * Only the first action whose edits are nonempty and stay on the primary document's revision
216
+ * is applied automatically; subsequent alternatives or cross-document edits are manual suggestions.
217
+ */
218
+ function isAutofixAction(report, action, index) {
219
+ return index === 0 && action.edits.length > 0 && action.edits.every((edit) => edit.location.uri === report.primary.location.uri && edit.location.revision === report.primary.location.revision);
220
+ }
221
+ /**
182
222
  * Projects analysis into CLI data before visibility filtering and rendering.
183
223
  */
184
224
  function cliResult(command, result, policy = {}) {
185
225
  const failedFiles = new Set(result.failures?.map((failure) => failure.file));
226
+ const cwd = policy.cwd ?? process.cwd();
186
227
  const root = stillwindRoot(result.config);
187
228
  const docs = (code) => {
188
229
  const page = documentationPage(code, root);
@@ -190,18 +231,36 @@ function cliResult(command, result, policy = {}) {
190
231
  };
191
232
  const previews = (result.previews ?? []).map((preview) => ({
192
233
  ...preview,
234
+ file: relativeFilePath(preview.location.uri, cwd),
235
+ line: preview.location.startLine + 1,
236
+ column: preview.location.startColumn + 1,
193
237
  diagnostics: preview.diagnostics.map((diagnostic) => ({
194
238
  ...diagnostic,
195
239
  ...docs(diagnostic.code)
196
240
  }))
197
241
  }));
198
242
  const invalid = previews.filter(({ valid }) => !valid).length;
199
- const { tokens = [], candidates = [], unmatched = [] } = result;
243
+ const { tokens = [], candidates = [], unmatched = [], projects = [] } = result;
200
244
  const invalidCandidates = candidates.filter(({ valid }) => !valid).length;
201
- const diagnostics = lintReports(command !== "lint" ? result.results.filter(({ result }) => result.status !== "complete" || failedFiles.has(result.entry)) : result.results).map((diagnostic) => ({
202
- ...diagnostic,
203
- ...docs(diagnostic.report.code)
204
- }));
245
+ const diagnostics = lintReports(command !== "lint" && command !== "check" ? result.results.filter(({ result }) => result.status !== "complete" || failedFiles.has(result.entry)) : result.results).map((diagnostic) => {
246
+ const { primary } = diagnostic.report;
247
+ return {
248
+ ...diagnostic,
249
+ file: relativeFilePath(primary.location.uri, cwd),
250
+ ...primary.scope === "range" ? {
251
+ line: primary.location.startLine + 1,
252
+ column: primary.location.startColumn + 1
253
+ } : {},
254
+ report: {
255
+ ...diagnostic.report,
256
+ actions: diagnostic.report.actions.map((action, index) => ({
257
+ ...action,
258
+ autofix: isAutofixAction(diagnostic.report, action, index)
259
+ }))
260
+ },
261
+ ...docs(diagnostic.report.code)
262
+ };
263
+ });
205
264
  const failures = result.results.flatMap(({ project, result }) => result.status === "complete" ? [] : [{
206
265
  project,
207
266
  file: result.entry,
@@ -219,21 +278,42 @@ function cliResult(command, result, policy = {}) {
219
278
  message: failure.message,
220
279
  details: []
221
280
  });
222
- if (!result.results.length && !failures.length && !isDesignCommand(command)) failures.push({
223
- message: "No analysis targets matched the configured scopes",
281
+ if (!result.results.length && !failures.length && !isDesignCommand(command) && command !== "info") failures.push({
282
+ message: "No analysis targets matched the configured scopes; check `files`/`exclude` in stillwind.config.* or the provided glob patterns",
224
283
  details: []
225
284
  });
226
285
  const changed = [...new Set(result.changed ?? [])].sort();
227
286
  const errors = diagnostics.filter(({ report }) => report.severity === "error").length;
228
287
  const warnings = diagnostics.length - errors;
229
288
  const warningLimitExceeded = policy.maxWarnings !== void 0 && warnings > policy.maxWarnings;
289
+ const byCodeMap = /* @__PURE__ */ new Map();
290
+ for (const diagnostic of diagnostics) {
291
+ const { code, severity, actions } = diagnostic.report;
292
+ const entry = byCodeMap.get(code) ?? {
293
+ errors: 0,
294
+ warnings: 0,
295
+ autofixable: 0,
296
+ ...diagnostic.docs ? { docs: diagnostic.docs } : {}
297
+ };
298
+ if (severity === "error") entry.errors += 1;
299
+ else entry.warnings += 1;
300
+ if (actions.some((action) => action.autofix)) entry.autofixable += 1;
301
+ byCodeMap.set(code, entry);
302
+ }
303
+ const byCode = {};
304
+ for (const code of [...byCodeMap.keys()].sort()) byCode[code] = byCodeMap.get(code);
305
+ const visible = policy.quiet ? diagnostics.filter(({ report }) => report.severity === "error") : diagnostics;
306
+ const shown = policy.limit === void 0 ? visible : visible.slice(0, policy.limit);
307
+ const omittedDiagnostics = visible.length - shown.length;
230
308
  return {
231
309
  command,
232
310
  config: result.config,
233
- diagnostics: policy.quiet ? diagnostics.filter(({ report }) => report.severity === "error") : diagnostics,
311
+ diagnostics: shown,
234
312
  failures,
235
313
  changed,
236
314
  previews,
315
+ ...result.emptyReason ? { emptyReason: result.emptyReason } : {},
316
+ projects,
237
317
  tokens,
238
318
  candidates,
239
319
  unmatched,
@@ -245,11 +325,15 @@ function cliResult(command, result, policy = {}) {
245
325
  changed: changed.length,
246
326
  previews: previews.length,
247
327
  invalidPreviews: invalid,
328
+ projects: projects.length,
248
329
  tokens: tokens.length,
249
330
  candidates: candidates.length,
250
331
  invalidCandidates,
251
332
  unmatched: unmatched.length,
252
- suggestions: diagnostics.filter(({ report }) => report.actions.length > 0).length,
333
+ autofixable: diagnostics.filter(({ report }) => report.actions.some((action) => action.autofix)).length,
334
+ suggestions: diagnostics.filter(({ report }) => report.actions.some((action) => !action.autofix)).length,
335
+ omittedDiagnostics,
336
+ byCode,
253
337
  warningLimitExceeded
254
338
  },
255
339
  exitCode: failures.length ? 2 : errors || warningLimitExceeded || policy.check && changed.length || command === "inspect" && (invalid || !previews.length) || invalidCandidates || unmatched.length ? 1 : 0
@@ -303,13 +387,19 @@ function renderResult(result, options, stderr = false, frames) {
303
387
  if (frame) lines.push(...frame.split("\n").map((line) => ` ${line}`));
304
388
  };
305
389
  const lines = [];
390
+ const analysisProjects = new Set([
391
+ ...result.diagnostics,
392
+ ...result.previews,
393
+ ...result.failures
394
+ ].flatMap(({ project }) => project === void 0 ? [] : [project]));
395
+ const projectTag = (project) => project !== void 0 && analysisProjects.size > 1 ? ` [project ${project + 1}]` : "";
306
396
  for (const { project, report, docs } of result.diagnostics) {
307
397
  const message = clean(report.message);
308
398
  const details = [
309
399
  ...report.primary.message ? [`note: ${clean(report.primary.message)}`] : [],
310
400
  ...report.related.map((label) => `related: ${at(label)}${label.message ? `: ${clean(label.message)}` : ""}`),
311
401
  ...report.notes.map((note) => `note: ${clean(note)}`),
312
- ...report.actions.map((action) => `help: ${clean(action.title)}`),
402
+ ...report.actions.map((action) => `help: ${clean(action.title)} (${action.autofix ? "autofix" : "suggestion"})`),
313
403
  ...docs ? [`docs: ${docs}`] : []
314
404
  ];
315
405
  if (options.format === "github") {
@@ -329,21 +419,26 @@ function renderResult(result, options, stderr = false, frames) {
329
419
  lines.push(annotation(report.severity === "error" ? "error" : "warning", properties, [message, ...details].join("\n")));
330
420
  } else {
331
421
  const severity = paint(report.severity, report.severity === "error" ? "red" : "yellow", color);
332
- lines.push(`${linked(report.primary)}: ${severity} ${clean(report.code)} [project ${project + 1}]: ${message}`);
422
+ const tag = projectTag(project);
423
+ lines.push(`${paint(linked(report.primary), "bold", color)}: ${severity} ${paint(clean(report.code), "dim", color)}${tag ? paint(tag, "dim", color) : ""}: ${message}`);
333
424
  addFrame(report.primary);
334
- if (report.primary.message) lines.push(` note: ${clean(report.primary.message)}`);
425
+ if (report.primary.message) lines.push(` ${paint("note:", "cyan", color)} ${clean(report.primary.message)}`);
335
426
  for (const related of report.related) {
336
- lines.push(` related: ${linked(related)}${related.message ? `: ${clean(related.message)}` : ""}`);
427
+ lines.push(` ${paint("related:", "cyan", color)} ${linked(related)}${related.message ? `: ${clean(related.message)}` : ""}`);
337
428
  addFrame(related);
338
429
  }
339
- lines.push(...report.notes.map((note) => ` note: ${clean(note)}`));
340
- lines.push(...report.actions.map((action) => ` help: ${clean(action.title)}`));
341
- if (docs) lines.push(` docs: ${docs}`);
430
+ lines.push(...report.notes.map((note) => ` ${paint("note:", "cyan", color)} ${clean(note)}`));
431
+ lines.push(...report.actions.map((action) => ` ${paint("help:", "cyan", color)} ${clean(action.title)} (${action.autofix ? "autofix" : "suggestion"})`));
432
+ if (docs) lines.push(` ${paint("docs:", "dim", color)} ${docs}`);
342
433
  lines.push("");
343
434
  }
344
435
  }
345
- for (const failure of result.failures) lines.push(renderFailure(failure, options.format === "github", file, color));
346
- if (result.command === "fmt") for (const changed of result.changed) if (options.format === "github" && options.check) lines.push(annotation("error", {
436
+ if (options.format === "text" && result.summary.omittedDiagnostics > 0) {
437
+ lines.push(`... ${count(result.summary.omittedDiagnostics, "more diagnostic")} omitted${options.limit === void 0 ? "" : ` (--limit ${options.limit})`}.`);
438
+ lines.push("");
439
+ }
440
+ for (const failure of result.failures) lines.push(renderFailure(failure, projectTag(failure.project), options.format === "github", file, color));
441
+ if (result.command === "fmt" || result.command === "check") for (const changed of result.changed) if (options.format === "github" && options.check) lines.push(annotation("error", {
347
442
  file: file(changed),
348
443
  title: "Stillwind formatting"
349
444
  }, "Stillwind utilities need sorting. Run stillwind fmt."));
@@ -353,7 +448,8 @@ function renderResult(result, options, stderr = false, frames) {
353
448
  startLine: 0,
354
449
  startColumn: 0
355
450
  };
356
- lines.push(`${link(file(changed), location, hyperlinks)}${options.format === "text" ? options.check ? ": needs formatting" : ": formatted" : ""}`);
451
+ const status = options.format !== "text" ? "" : options.check ? ": needs formatting" : result.command === "check" ? ": updated" : ": formatted";
452
+ lines.push(`${link(file(changed), location, hyperlinks)}${status}`);
357
453
  }
358
454
  if (result.command === "inspect") {
359
455
  for (const { project, location, css, valid, diagnostics, documentation } of result.previews) {
@@ -361,43 +457,74 @@ function renderResult(result, options, stderr = false, frames) {
361
457
  scope: "range",
362
458
  location
363
459
  };
364
- lines.push(`${linked(label)} [project ${project + 1}]`);
365
- const failure = valid || diagnostics.length ? [] : ["error: CSS generation failed."];
366
- lines.push(...clean([
367
- ...failure,
368
- ...diagnostics.map(({ severity, code, message }) => `${severity} ${code}: ${message}`),
369
- css,
370
- documentation
371
- ].filter(Boolean).join("\n")).trimEnd().split("\n").map((line) => line ? ` ${line}` : ""));
460
+ const tag = projectTag(project);
461
+ lines.push(`${paint(linked(label), "bold", color)}${tag ? paint(tag, "dim", color) : ""}`);
462
+ if (!valid && !diagnostics.length) lines.push(` ${paint("error", "red", color)}: CSS generation failed.`);
463
+ for (const { severity, code, message, docs } of diagnostics) {
464
+ const renderedSeverity = paint(severity, severity === "error" ? "red" : "yellow", color);
465
+ lines.push(` ${renderedSeverity} ${paint(clean(code), "dim", color)}: ${clean(message)}`);
466
+ if (docs) lines.push(` ${paint("docs:", "dim", color)} ${clean(docs)}`);
467
+ }
468
+ const body = clean([css, documentation].filter(Boolean).join("\n")).trimEnd();
469
+ if (body) lines.push(...body.split("\n").map((line) => line ? ` ${line}` : ""));
470
+ lines.push("");
471
+ }
472
+ if (!result.summary.previews && !result.summary.failures) lines.push(result.emptyReason === "line-out-of-range" ? "The requested line is outside the selected file." : result.emptyReason === "column-out-of-range" ? "The requested column is outside the selected line." : result.emptyReason === "no-match-at-position" ? "No Stillwind style call overlaps the requested position (the file has styles at another line or column)." : "The selected source contains no Stillwind style calls or generated CSS.");
473
+ }
474
+ if (result.command === "info" && options.format === "text") {
475
+ if (result.config) {
476
+ lines.push(`config: ${file(result.config)}`);
477
+ lines.push("");
478
+ }
479
+ for (const info of result.projects) {
480
+ lines.push(`project ${info.project + 1}${info.name ? ` (${clean(info.name)})` : ""}`);
481
+ lines.push(` root: ${file(info.root)}`);
482
+ lines.push(` css: ${file(info.css)}`);
483
+ lines.push(` files: ${info.files.map(clean).join(", ")}`);
484
+ if (info.exclude.length) lines.push(` exclude: ${info.exclude.map(clean).join(", ")}`);
485
+ lines.push(` matched files: ${info.matchedFiles}`);
486
+ if (info.plugins.length) lines.push(` plugins: ${info.plugins.map(clean).join(", ")}`);
487
+ if (info.hooks.length) lines.push(` hooks: ${info.hooks.map(clean).join(", ")}`);
488
+ lines.push(` sort: ${info.sort ? "enabled" : "disabled"}`);
489
+ lines.push(` typeFacts: ${info.typeFacts ? "enabled" : "disabled"}`);
490
+ const entries = Object.entries(info.lint);
491
+ const denied = entries.filter(([, setting]) => typeof setting === "string" ? setting === "deny" : setting.severity === "deny").length;
492
+ const warned = entries.length - denied;
493
+ lines.push(entries.length ? ` lint: ${count(entries.length, "active rule")} (${denied} deny, ${warned} warn)` : " lint: disabled");
494
+ for (const [rule, setting] of entries) {
495
+ const severity = typeof setting === "string" ? setting : setting.severity;
496
+ lines.push(` ${clean(rule)}: ${severity}`);
497
+ }
372
498
  lines.push("");
373
499
  }
374
- if (!result.summary.previews && !result.summary.failures) lines.push("The selected source has no generated CSS.");
375
500
  }
376
501
  const projects = new Set([...result.tokens, ...result.candidates].map(({ project }) => project));
377
502
  const tag = (project) => projects.size > 1 ? ` [project ${project + 1}]` : "";
378
- for (const { project, name, value, source } of result.tokens) lines.push(`${clean(name)}: ${clean(value)}${source === "default" ? " (default)" : ""}${tag(project)}`);
379
- for (const { project, name, kind, valid, css, suggestion, canonical } of result.candidates) {
380
- if (valid) {
381
- lines.push(`${clean(name)}${kind === "marker" ? " (marker)" : ""}${tag(project)}`);
382
- lines.push(...clean(css).trimEnd().split("\n").map((line) => line ? ` ${line}` : ""));
383
- if (canonical) lines.push(` help: The canonical spelling is ${clean(canonical)}.`);
384
- } else {
385
- lines.push(`${clean(name)}${tag(project)}: ${paint(`unknown ${kind}`, "red", color)}`);
386
- if (suggestion) lines.push(` help: Did you mean ${clean(suggestion)}?`);
387
- }
503
+ for (const { project, name, value, resolvedValue, source } of result.tokens) lines.push(`${clean(name)}: ${clean(value)}${resolvedValue ? ` /* ${clean(resolvedValue)} */` : ""}${source === "default" ? " (default)" : ""}${tag(project)}`);
504
+ for (const { project, name, kind, valid, css, suggestion, canonical } of result.candidates) if (valid) {
505
+ const label = kind === "marker" ? " (marker)" : kind === "pattern" ? " (pattern)" : "";
506
+ lines.push(`${clean(name)}${label}${tag(project)}`);
507
+ if (css) lines.push(...clean(css).trimEnd().split("\n").map((line) => line ? ` ${line}` : ""));
508
+ if (canonical) lines.push(` help: The canonical spelling is ${clean(canonical)}.`);
509
+ if (css) lines.push("");
510
+ } else {
511
+ lines.push(`${clean(name)}${tag(project)}: ${paint(`unknown ${kind}`, "red", color)}`);
512
+ if (suggestion) lines.push(` help: Did you mean ${clean(suggestion)}?`);
388
513
  lines.push("");
389
514
  }
390
515
  for (const target of result.unmatched) lines.push(`${clean(target)}: ${paint("no match", "red", color)}`);
391
516
  if (result.summary.warningLimitExceeded) {
392
517
  const message = `Warning count (${result.summary.warnings}) exceeds --max-warnings${options.maxWarnings === void 0 ? "" : ` (${options.maxWarnings})`}.`;
393
- lines.push(options.format === "github" ? annotation("error", { title: "Stillwind warnings" }, message) : `error: ${message}`);
518
+ lines.push(options.format === "github" ? annotation("error", { title: "Stillwind warnings" }, message) : `${paint("error", "red", color)}: ${message}`);
394
519
  }
395
520
  if (options.format === "text") {
396
521
  if (lines.length && lines.at(-1) !== "") lines.push("");
397
522
  const { summary } = result;
398
- lines.push(isDesignCommand(result.command) ? `${result.command === "theme" ? count(summary.tokens, "token") : count(summary.candidates, result.command === "variants" ? "variant" : "utility").replace("utilitys", "utilities")}${summary.invalidCandidates ? `; ${summary.invalidCandidates} unknown` : ""}${summary.unmatched ? `; ${count(summary.unmatched, "unmatched target")}` : ""}${summary.failures ? `; ${count(summary.failures, "execution failure")}` : ""}.` : result.command === "inspect" ? `${count(summary.previews, "preview")} in ${count(summary.files, "file")}${summary.invalidPreviews ? `; ${summary.invalidPreviews} failed to generate CSS` : ""}${summary.failures ? `; ${count(summary.failures, "execution failure")}` : ""}.` : result.command === "fmt" && !summary.failures ? options.check ? summary.changed ? `${count(summary.changed, "file")} ${summary.changed === 1 ? "needs" : "need"} formatting.` : `All selected files are formatted (${summary.files} checked).` : `Formatted ${count(summary.changed, "file")} (${summary.files} checked).` : `${count(summary.errors, "error")}, ${count(summary.warnings, "warning")} in ${count(summary.files, "file")}${summary.failures ? `; ${count(summary.failures, "execution failure")}` : ""}.`);
399
- const suggestions = result.diagnostics.filter(({ report }) => report.actions.length > 0).length;
400
- if (result.command === "lint" && suggestions) lines.push(`help: Suggested edits are available for ${count(suggestions, "diagnostic")}. Run stillwind lint --fix to apply automatic fixes.`);
523
+ lines.push(result.command === "info" ? `${count(summary.projects, "project")}${summary.failures ? `; ${count(summary.failures, "execution failure")}` : ""}.` : isDesignCommand(result.command) ? `${result.command === "theme" ? count(summary.tokens, "token") : count(summary.candidates, result.command === "variants" ? "variant" : "utility").replace("utilitys", "utilities")}${summary.invalidCandidates ? `; ${summary.invalidCandidates} unknown` : ""}${summary.unmatched ? `; ${count(summary.unmatched, "unmatched target")}` : ""}${summary.failures ? `; ${count(summary.failures, "execution failure")}` : ""}.` : result.command === "inspect" ? `${count(summary.previews, "preview")} in ${count(summary.files, "file")}${summary.invalidPreviews ? `; ${summary.invalidPreviews} failed to generate CSS` : ""}${summary.failures ? `; ${count(summary.failures, "execution failure")}` : ""}.` : result.command === "fmt" && !summary.failures ? options.check ? summary.changed ? `${count(summary.changed, "file")} ${summary.changed === 1 ? "needs" : "need"} formatting.` : `All selected files are formatted (${summary.files} checked).` : `Formatted ${count(summary.changed, "file")} (${summary.files} checked).` : result.command === "check" ? `${count(summary.errors, "error")}, ${count(summary.warnings, "warning")} in ${count(summary.files, "file")}${summary.changed ? options.check ? `; ${count(summary.changed, "file")} ${summary.changed === 1 ? "needs" : "need"} formatting` : `; updated ${count(summary.changed, "file")}` : ""}${summary.failures ? `; ${count(summary.failures, "execution failure")}` : ""}.` : `${count(summary.errors, "error")}, ${count(summary.warnings, "warning")} in ${count(summary.files, "file")}${summary.failures ? `; ${count(summary.failures, "execution failure")}` : ""}.`);
524
+ const autofixable = result.summary.autofixable;
525
+ const manualSuggestions = result.summary.suggestions;
526
+ if ((result.command === "lint" || result.command === "check") && autofixable) lines.push(result.command === "check" ? `help: Automatic fixes are available for ${count(autofixable, "diagnostic")}. Run stillwind check --fix to apply automatic fixes and sort utilities.` : `help: Automatic fixes are available for ${count(autofixable, "diagnostic")}. Run stillwind lint --fix to apply automatic fixes.`);
527
+ else if ((result.command === "lint" || result.command === "check") && manualSuggestions) lines.push(`help: Manual suggestions are available for ${count(manualSuggestions, "diagnostic")}. Review them in the source; --fix does not apply them automatically.`);
401
528
  }
402
529
  return lines.join("\n");
403
530
  }
@@ -407,9 +534,8 @@ async function writeResult(result, options) {
407
534
  const output = renderResult(result, options, stderr, options.format === "text" && result.diagnostics.length ? new (await (import("./source-frame-V8U3FSfw.js"))).SourceFrames() : void 0);
408
535
  if (output) (stderr ? process.stderr : process.stdout).write(output + "\n");
409
536
  }
410
- function renderFailure(failure, github, file, color) {
537
+ function renderFailure(failure, project, github, file, color) {
411
538
  const details = failure.details.map((detail) => `${file(detail.file)}: ${clean(detail.message)}`);
412
- const project = failure.project === void 0 ? "" : ` [project ${failure.project + 1}]`;
413
539
  return github ? annotation("error", {
414
540
  ...failure.file ? { file: file(failure.file) } : {},
415
541
  title: `Stillwind${project}`
@@ -448,39 +574,41 @@ function annotation(level, properties, message) {
448
574
  return `::${level}${fields ? ` ${fields}` : ""}::${escapeData(message)}`;
449
575
  }
450
576
  // src/commands.ts
451
- const fmtArgs = {
577
+ const checkArgs = {
452
578
  ...targetArgs,
453
- check: {
579
+ ...warningArgs,
580
+ fix: {
454
581
  type: "boolean",
455
- description: "Check formatting without saving files"
582
+ description: "Apply automatic fixes and sort utilities"
456
583
  }
457
584
  };
458
- const lintArgs = {
585
+ const fmtArgs = {
459
586
  ...targetArgs,
460
- ...warningArgs,
461
587
  format: {
462
588
  ...outputArgs.format,
463
589
  options: [
464
590
  "text",
465
591
  "json",
466
- "github"
467
- ]
592
+ "github",
593
+ "files"
594
+ ],
595
+ description: "Output format (text, json, github, or files)"
468
596
  },
597
+ check: {
598
+ type: "boolean",
599
+ description: "Check formatting without saving files"
600
+ }
601
+ };
602
+ const lintArgs = {
603
+ ...targetArgs,
604
+ ...warningArgs,
469
605
  fix: {
470
606
  type: "boolean",
471
- description: "Apply converged automatic fixes"
607
+ description: "Apply automatic fixes"
472
608
  }
473
609
  };
474
610
  const inspectArgs = {
475
611
  ...targetArgs,
476
- format: {
477
- ...outputArgs.format,
478
- options: [
479
- "text",
480
- "json",
481
- "github"
482
- ]
483
- },
484
612
  globs: {
485
613
  ...targetArgs.globs,
486
614
  description: "Select files with paths or globs, optionally followed by :line or :line:column"
@@ -488,16 +616,7 @@ const inspectArgs = {
488
616
  };
489
617
  const designArgs = {
490
618
  ...configArgs,
491
- format: {
492
- ...outputArgs.format,
493
- options: [
494
- "text",
495
- "json",
496
- "github"
497
- ]
498
- },
499
- color: outputArgs.color,
500
- hyperlinks: outputArgs.hyperlinks
619
+ ...outputArgs
501
620
  };
502
621
  const themeArgs = {
503
622
  ...designArgs,
@@ -518,6 +637,10 @@ const candidateArgs = {
518
637
  type: "positional",
519
638
  required: false,
520
639
  description: "Check exact names, or search with * patterns"
640
+ },
641
+ "names-only": {
642
+ type: "boolean",
643
+ description: "List matching names without CSS previews"
521
644
  }
522
645
  };
523
646
  const lspArgs = {
@@ -529,6 +652,38 @@ const lspArgs = {
529
652
  }
530
653
  };
531
654
  const subCommands = {
655
+ check: defineCommand({
656
+ meta: {
657
+ name: "check",
658
+ description: "Check Stillwind lint and utility sorting"
659
+ },
660
+ args: checkArgs,
661
+ plugins: [strictArguments],
662
+ async run({ args, data }) {
663
+ const options = data;
664
+ const maxWarnings = warningLimit(args["max-warnings"]);
665
+ const limit = nonNegativeInteger(args.limit, "--limit");
666
+ options.check = !args.fix;
667
+ options.quiet = args.quiet;
668
+ options.maxWarnings = maxWarnings;
669
+ options.limit = limit;
670
+ const { check } = await import("@stillwind/analysis/node");
671
+ const result = cliResult("check", await check({
672
+ config: args.config,
673
+ cwd: options.cwd,
674
+ patterns: args._,
675
+ fix: args.fix
676
+ }), {
677
+ check: !args.fix,
678
+ quiet: args.quiet,
679
+ maxWarnings,
680
+ limit,
681
+ cwd: options.cwd
682
+ });
683
+ await writeResult(result, options);
684
+ process.exitCode = result.exitCode;
685
+ }
686
+ }),
532
687
  fmt: defineCommand({
533
688
  meta: {
534
689
  name: "fmt",
@@ -545,7 +700,10 @@ const subCommands = {
545
700
  cwd: options.cwd,
546
701
  patterns: args._,
547
702
  check: args.check
548
- }), { check: args.check });
703
+ }), {
704
+ check: args.check,
705
+ cwd: options.cwd
706
+ });
549
707
  await writeResult(result, options);
550
708
  process.exitCode = result.exitCode;
551
709
  }
@@ -560,8 +718,10 @@ const subCommands = {
560
718
  async run({ args, data }) {
561
719
  const options = data;
562
720
  const maxWarnings = warningLimit(args["max-warnings"]);
721
+ const limit = nonNegativeInteger(args.limit, "--limit");
563
722
  options.quiet = args.quiet;
564
723
  options.maxWarnings = maxWarnings;
724
+ options.limit = limit;
565
725
  const { lint } = await import("@stillwind/analysis/node");
566
726
  const result = cliResult("lint", await lint({
567
727
  config: args.config,
@@ -570,7 +730,9 @@ const subCommands = {
570
730
  fix: args.fix
571
731
  }), {
572
732
  quiet: args.quiet,
573
- maxWarnings
733
+ maxWarnings,
734
+ limit,
735
+ cwd: options.cwd
574
736
  });
575
737
  await writeResult(result, options);
576
738
  process.exitCode = result.exitCode;
@@ -590,7 +752,29 @@ const subCommands = {
590
752
  config: args.config,
591
753
  cwd: options.cwd,
592
754
  targets: args._
593
- }));
755
+ }), { cwd: options.cwd });
756
+ await writeResult(result, options);
757
+ process.exitCode = result.exitCode;
758
+ }
759
+ }),
760
+ info: defineCommand({
761
+ meta: {
762
+ name: "info",
763
+ description: "Show the resolved project configuration"
764
+ },
765
+ args: designArgs,
766
+ plugins: [strictArguments],
767
+ async run({ args, data }) {
768
+ if (args._.length) throw new Error("info accepts no positional arguments");
769
+ const options = data;
770
+ const { info } = await import("@stillwind/analysis/node");
771
+ const result = cliResult("info", {
772
+ ...await info({
773
+ config: args.config,
774
+ cwd: options.cwd
775
+ }),
776
+ results: []
777
+ });
594
778
  await writeResult(result, options);
595
779
  process.exitCode = result.exitCode;
596
780
  }
@@ -620,7 +804,8 @@ const subCommands = {
620
804
  async run({ args, data }) {
621
805
  await runDesignCommand("utilities", data, args.config, {
622
806
  kind: "utilities",
623
- targets: args._
807
+ targets: args._,
808
+ namesOnly: args["names-only"]
624
809
  });
625
810
  }
626
811
  }),
@@ -634,7 +819,8 @@ const subCommands = {
634
819
  async run({ args, data }) {
635
820
  await runDesignCommand("variants", data, args.config, {
636
821
  kind: "variants",
637
- targets: args._
822
+ targets: args._,
823
+ namesOnly: args["names-only"]
638
824
  });
639
825
  }
640
826
  }),
@@ -646,7 +832,7 @@ const subCommands = {
646
832
  args: lspArgs,
647
833
  plugins: [strictArguments],
648
834
  async run({ args }) {
649
- if (!args.stdio || args._.length) throw new Error("lsp requires --stdio and accepts no globs");
835
+ if (!args.stdio || args._.length) throw new Error("lsp requires --stdio and accepts no positional arguments");
650
836
  const { startLanguageServer } = await import("@stillwind/language-server/node");
651
837
  startLanguageServer(args.config);
652
838
  }
@@ -687,6 +873,7 @@ async function runCli(rawArgs = process.argv.slice(2)) {
687
873
  let name = null;
688
874
  try {
689
875
  const invocation = parseInvocation(rawArgs, {
876
+ ...checkArgs,
690
877
  ...fmtArgs,
691
878
  ...lintArgs,
692
879
  ...inspectArgs,
@@ -694,10 +881,10 @@ async function runCli(rawArgs = process.argv.slice(2)) {
694
881
  ...candidateArgs,
695
882
  ...lspArgs
696
883
  });
697
- name = invocation.name === "fmt" || invocation.name === "lint" || invocation.name === "inspect" || invocation.name === "theme" || invocation.name === "utilities" || invocation.name === "variants" ? invocation.name : null;
884
+ name = invocation.name === "check" || invocation.name === "fmt" || invocation.name === "lint" || invocation.name === "inspect" || invocation.name === "info" || invocation.name === "theme" || invocation.name === "utilities" || invocation.name === "variants" ? invocation.name : null;
698
885
  if (invocation.name === "lsp") options.format = "text";
699
886
  else readOutputOptions(rawArgs, options);
700
- if (invocation.name && !Object.hasOwn(subCommands, invocation.name)) throw new Error(`Unknown command: ${invocation.name}`);
887
+ if (invocation.name && !Object.hasOwn(subCommands, invocation.name)) throw new Error(`Unknown command: ${invocation.name}. Expected one of: check, fmt, lint, inspect, info, theme, utilities, variants, or lsp. Run stillwind --help for usage.`);
701
888
  if (!rawArgs.length || invocation.help) {
702
889
  const sub = subCommands[invocation.name];
703
890
  const subject = sub ?? command;
@@ -709,7 +896,7 @@ async function runCli(rawArgs = process.argv.slice(2)) {
709
896
  } else if (rawArgs.length === 1 && invocation.version) write(version);
710
897
  else {
711
898
  if (invocation.version) throw new Error("--version must be used without a command");
712
- if (!invocation.name) throw new Error("A command is required: fmt, lint, inspect, theme, utilities, variants, or lsp");
899
+ if (!invocation.name) throw new Error("A command is required: check, fmt, lint, inspect, info, theme, utilities, variants, or lsp");
713
900
  await runCommand(subCommands[invocation.name], {
714
901
  rawArgs: invocation.rawArgs,
715
902
  data: options
@@ -728,7 +915,15 @@ function write(output) {
728
915
  }
729
916
  function displayUsage(usage, options) {
730
917
  const plain = stripVTControlCharacters(usage);
731
- return displayEnabled(options.color, "color", !!process.stdout.isTTY, process.env) ? styleText("cyan", plain, { validateStream: false }) : plain;
918
+ if (!displayEnabled(options.color, "color", !!process.stdout.isTTY, process.env)) return plain;
919
+ const style = (format, text) => styleText(format, text, { validateStream: false });
920
+ return plain.split("\n").map((line, index) => {
921
+ if (index === 0 && line.trim()) return style(["bold", "cyan"], line);
922
+ if (/^[A-Z][A-Z0-9 /_-]*$/.test(line.trim())) return style("bold", line);
923
+ const entry = /^(\s+)(\S+(?:,\s*\S+)*(?:\s+<[^>]+>|\s+\[[^\]]+\])?)(\s{2,})(.*)$/.exec(line);
924
+ if (entry) return `${entry[1]}${style("cyan", entry[2])}${entry[3]}${entry[4]}`;
925
+ return line;
926
+ }).join("\n");
732
927
  }
733
928
  // src/main.ts
734
929
  await runCli();
package/dist/main.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"file":"main.js","names":["parseArgs","tokenizeArgs","packageJson.version"],"sources":["../package.json","../src/arguments.ts","../src/documentation.ts","../src/result.ts","../src/output.ts","../src/commands.ts","../src/main.ts"],"sourcesContent":["","import process from \"node:process\";\nimport { parseArgs as tokenizeArgs } from \"node:util\";\n\nimport { defineCittyPlugin, parseArgs, type ArgsDef } from \"citty\";\n\nimport type { DisplayMode, OutputFormat, OutputOptions } from \"./output.ts\";\n\nexport const configArgs = {\n config: {\n type: \"string\",\n alias: \"c\",\n description: \"Use this configuration file\",\n valueHint: \"path\",\n },\n} as const;\n\nexport const outputArgs = {\n format: {\n type: \"enum\",\n options: [\"text\", \"json\", \"github\", \"files\"] as OutputFormat[],\n default: process.env.GITHUB_ACTIONS === \"true\" ? \"github\" : \"text\",\n description: \"Output format\",\n },\n color: {\n type: \"enum\",\n options: [\"auto\", \"always\", \"never\"] as DisplayMode[],\n default: \"auto\",\n description: \"Control terminal colors\",\n },\n hyperlinks: {\n type: \"enum\",\n options: [\"auto\", \"always\", \"never\"] as DisplayMode[],\n default: \"auto\",\n description: \"Control links to source locations\",\n },\n} as const;\n\nexport const targetArgs = {\n ...configArgs,\n ...outputArgs,\n globs: {\n type: \"positional\",\n required: false,\n description: \"Filter configured targets with one or more globs\",\n },\n} as const;\n\nexport const warningArgs = {\n quiet: {\n type: \"boolean\",\n description: \"Hide lint warnings while retaining their counts\",\n },\n \"max-warnings\": {\n type: \"string\",\n description: \"Fail when the warning count exceeds this non-negative integer\",\n valueHint: \"count\",\n },\n} as const;\n\nexport function warningLimit(value: string | undefined): number | undefined {\n if (value === undefined) {\n return undefined;\n }\n if (!/^\\d+$/.test(value) || !Number.isSafeInteger(Number(value))) {\n throw new Error(\"Invalid value for --max-warnings: expected a non-negative integer\");\n }\n return Number(value);\n}\n\nexport const builtinArgs = {\n help: {\n type: \"boolean\",\n alias: \"h\",\n description: \"Show usage\",\n },\n version: {\n type: \"boolean\",\n alias: \"v\",\n description: \"Show version\",\n },\n} as const;\n\n/**\n * Updates display options using citty's enum validation and defaults.\n * A valid format is retained if a later display option fails, so the error uses the requested format.\n */\nexport function readOutputOptions(rawArgs: string[], options: OutputOptions): void {\n options.format = parseArgs<{\n format: typeof outputArgs.format;\n }>(rawArgs, {\n format: outputArgs.format,\n }).format;\n const { color, hyperlinks } = parseArgs<typeof outputArgs>(rawArgs, outputArgs);\n options.color = color;\n options.hyperlinks = hyperlinks;\n}\n\n/** Rejects unknown named options and empty string options that citty otherwise accepts. */\nexport const strictArguments = defineCittyPlugin({\n name: \"strict-arguments\",\n async setup({ args, cmd }) {\n const definitions: ArgsDef =\n (await (typeof cmd.args === \"function\" ? cmd.args() : cmd.args)) ?? {};\n const names = new Set([\n \"_\",\n ...Object.keys(definitions).flatMap((name) => [\n name,\n name.replace(/-([a-z])/g, (_, letter: string) => letter.toUpperCase()),\n ]),\n ]);\n for (const definition of Object.values(definitions)) {\n if (\"alias\" in definition) {\n for (const alias of [definition.alias ?? []].flat()) {\n names.add(alias);\n }\n }\n }\n for (const name of Object.keys(args)) {\n if (!names.has(name)) {\n throw new Error(`Unknown option: --${name}`);\n }\n }\n for (const [name, definition] of Object.entries(definitions)) {\n if (\n definition.type === \"string\" &&\n args[name] !== undefined &&\n (typeof args[name] !== \"string\" || args[name] === \"\")\n ) {\n throw new Error(`Missing or invalid value for --${name}`);\n }\n }\n },\n});\n\n/**\n * Locates the command without mistaking an option's value for it.\n * Keeps options before the command and removes help/version flags handled by the entrypoint.\n */\nexport function parseInvocation(rawArgs: string[], definitions: ArgsDef) {\n const combined: ArgsDef = { ...definitions, ...builtinArgs };\n const options: Record<string, { type: \"boolean\" | \"string\"; short?: string }> = {};\n for (const [name, definition] of Object.entries(combined)) {\n if (definition.type === \"positional\") {\n continue;\n }\n const option = {\n type: definition.type === \"boolean\" ? (\"boolean\" as const) : (\"string\" as const),\n };\n options[name] = option;\n if (\"alias\" in definition && typeof definition.alias === \"string\") {\n options[name].short = definition.alias;\n }\n }\n const { tokens } = tokenizeArgs({\n args: rawArgs,\n options,\n strict: false,\n allowPositionals: true,\n allowNegative: true,\n tokens: true,\n });\n const first = tokens.find(\n (token) => token.kind === \"positional\" || token.kind === \"option-terminator\",\n );\n const commandIndex = first?.kind === \"positional\" ? first.index : undefined;\n const builtinTokens = tokens.filter(\n (token) => token.kind === \"option\" && [\"help\", \"version\"].includes(token.name),\n );\n const flags = parseArgs<typeof builtinArgs>(\n builtinTokens.map((token) => rawArgs[token.index]),\n builtinArgs,\n );\n const omitted = new Set(builtinTokens.map((token) => token.index));\n if (commandIndex !== undefined) {\n omitted.add(commandIndex);\n }\n\n return {\n name: commandIndex === undefined ? undefined : rawArgs[commandIndex],\n rawArgs: rawArgs.filter((_, index) => !omitted.has(index)),\n help: flags.help,\n version: flags.version,\n };\n}\n","import { existsSync } from \"node:fs\";\nimport { createRequire } from \"node:module\";\nimport path from \"node:path\";\n\nimport { documentationSection, documentationUrl } from \"@stillwind/analysis\";\n\n/**\n * Finds the documentation page of a report code.\n *\n * @param code - Compiler code, such as `SW01001`, or lint rule name.\n * @param root - Root directory of the installed `stillwind` package, when one resolves.\n * @returns The absolute path of the page in that package, which matches the installed version.\n * Otherwise, the page on the website. Codes without a page return undefined.\n */\nexport function documentationPage(code: string, root: string | undefined): string | undefined {\n const section = documentationSection(code);\n if (!section) {\n return undefined;\n }\n const file = root && path.join(root, \"docs\", section, `${code}.md`);\n return file && existsSync(file) ? file : documentationUrl(code);\n}\n\n/**\n * Finds the `stillwind` package that a configuration file resolves.\n *\n * @param config - Absolute configuration path.\n * @returns The package root, or undefined when no package resolves.\n */\nexport function stillwindRoot(config: string | null): string | undefined {\n try {\n return config\n ? path.dirname(createRequire(config).resolve(\"stillwind/package.json\"))\n : undefined;\n } catch {\n return undefined;\n }\n}\n","import { lintReports } from \"@stillwind/analysis\";\nimport type { DesignSystemAnswer, InspectPreview, LintResult } from \"@stillwind/analysis/node\";\n\nimport { documentationPage, stillwindRoot } from \"./documentation.ts\";\n\n/**\n * A command that reads a design system and no source files.\n */\nexport type DesignCommand = \"theme\" | \"utilities\" | \"variants\";\n\nexport type CliCommand = \"lint\" | \"fmt\" | \"inspect\" | DesignCommand | null;\n\nexport type CliDiagnostic = ReturnType<typeof lintReports>[number] & {\n /** Absolute path or URL of the page that explains the report code. */\n docs?: string;\n};\n\n/** A preview whose findings link to the pages that explain their codes. */\nexport type CliPreview = Omit<InspectPreview, \"diagnostics\"> & {\n diagnostics: (InspectPreview[\"diagnostics\"][number] & {\n /** Absolute path or URL of the page that explains the code. */\n docs?: string;\n })[];\n};\n\nexport interface CliFailure {\n project?: number;\n file?: string;\n message: string;\n details: {\n file: string;\n message: string;\n }[];\n}\n\nexport interface CliResult {\n command: CliCommand;\n config: string | null;\n diagnostics: CliDiagnostic[];\n failures: CliFailure[];\n changed: string[];\n previews: CliPreview[];\n tokens: DesignSystemAnswer[\"tokens\"];\n candidates: DesignSystemAnswer[\"candidates\"];\n unmatched: string[];\n summary: {\n files: number;\n errors: number;\n warnings: number;\n failures: number;\n changed: number;\n previews: number;\n invalidPreviews: number;\n tokens: number;\n candidates: number;\n invalidCandidates: number;\n unmatched: number;\n suggestions: number;\n warningLimitExceeded: boolean;\n };\n exitCode: 0 | 1 | 2;\n}\n\nexport interface ResultPolicy {\n check?: boolean;\n quiet?: boolean;\n maxWarnings?: number;\n}\n\n/**\n * Tests whether a command reads a design system and no source files.\n */\nexport function isDesignCommand(command: CliCommand): command is DesignCommand {\n return command === \"theme\" || command === \"utilities\" || command === \"variants\";\n}\n\n/**\n * Projects analysis into CLI data before visibility filtering and rendering.\n */\nexport function cliResult(\n command: CliCommand,\n result: Pick<LintResult, \"config\" | \"results\" | \"changed\"> & {\n failures?: readonly Pick<NonNullable<LintResult[\"failures\"]>[number], \"file\" | \"message\">[];\n previews?: InspectPreview[];\n } & Partial<Pick<DesignSystemAnswer, \"tokens\" | \"candidates\" | \"unmatched\">>,\n policy: ResultPolicy = {},\n): CliResult {\n const failedFiles = new Set(result.failures?.map((failure) => failure.file));\n const root = stillwindRoot(result.config);\n const docs = (code: string) => {\n const page = documentationPage(code, root);\n return page ? { docs: page } : {};\n };\n const previews = (result.previews ?? []).map((preview) => ({\n ...preview,\n diagnostics: preview.diagnostics.map((diagnostic) => ({\n ...diagnostic,\n ...docs(diagnostic.code),\n })),\n }));\n const invalid = previews.filter(({ valid }) => !valid).length;\n const { tokens = [], candidates = [], unmatched = [] } = result;\n const invalidCandidates = candidates.filter(({ valid }) => !valid).length;\n const diagnostics: CliDiagnostic[] = lintReports(\n command !== \"lint\"\n ? result.results.filter(\n ({ result }) => result.status !== \"complete\" || failedFiles.has(result.entry),\n )\n : result.results,\n ).map((diagnostic) => ({ ...diagnostic, ...docs(diagnostic.report.code) }));\n const failures: CliFailure[] = result.results.flatMap(({ project, result }) =>\n result.status === \"complete\"\n ? []\n : [\n {\n project,\n file: result.entry,\n message: `Incomplete analysis${result.error ? `: ${result.error}` : \"\"}`,\n details: [\n ...(result.graph?.dependencies ?? []).flatMap((dependency) =>\n dependency.status === \"unresolved\" || dependency.status === \"unsupported\"\n ? [\n {\n file: dependency.importer,\n message: `${dependency.status}: ${dependency.specifier}`,\n },\n ]\n : [],\n ),\n ...(result.graph?.unverified ?? []).map((range) => ({\n file: range.moduleId,\n message: `unverified${range.start === undefined ? \"\" : ` bytes ${range.start}-${range.end}`}: ${range.reason}`,\n })),\n ],\n },\n ],\n );\n for (const failure of result.failures ?? []) {\n if (!failures.some((existing) => existing.file === failure.file)) {\n failures.push({\n file: failure.file,\n message: failure.message,\n details: [],\n });\n }\n }\n if (!result.results.length && !failures.length && !isDesignCommand(command)) {\n failures.push({\n message: \"No analysis targets matched the configured scopes\",\n details: [],\n });\n }\n const changed = [...new Set(result.changed ?? [])].sort();\n const errors = diagnostics.filter(({ report }) => report.severity === \"error\").length;\n const warnings = diagnostics.length - errors;\n const warningLimitExceeded = policy.maxWarnings !== undefined && warnings > policy.maxWarnings;\n return {\n command,\n config: result.config,\n diagnostics: policy.quiet\n ? diagnostics.filter(({ report }) => report.severity === \"error\")\n : diagnostics,\n failures,\n changed,\n previews,\n tokens,\n candidates,\n unmatched,\n summary: {\n files: new Set([\n ...result.results.map(({ result }) => result.entry),\n ...(result.failures ?? []).map((failure) => failure.file),\n ]).size,\n errors,\n warnings,\n failures: failures.length,\n changed: changed.length,\n previews: previews.length,\n invalidPreviews: invalid,\n tokens: tokens.length,\n candidates: candidates.length,\n invalidCandidates,\n unmatched: unmatched.length,\n suggestions: diagnostics.filter(({ report }) => report.actions.length > 0).length,\n warningLimitExceeded,\n },\n exitCode: failures.length\n ? 2\n : errors ||\n warningLimitExceeded ||\n (policy.check && changed.length) ||\n (command === \"inspect\" && (invalid || !previews.length)) ||\n invalidCandidates ||\n unmatched.length\n ? 1\n : 0,\n };\n}\n\n/**\n * Retains reports carried by failed rewrite planning in the same CLI envelope.\n */\nexport function failureResult(\n command: CliCommand,\n error: unknown,\n policy: ResultPolicy = {},\n): CliResult {\n const results =\n error instanceof Error && \"results\" in error && Array.isArray(error.results)\n ? (error.results as LintResult[\"results\"])\n : [];\n const result = cliResult(\n \"lint\",\n {\n config: results[0]?.config ?? \"\",\n results,\n },\n policy,\n );\n result.command = command;\n result.config = results[0]?.config ?? null;\n if (!results.length || !result.failures.length) {\n result.failures = [\n {\n message: error instanceof Error ? error.message : String(error),\n details: [],\n },\n ];\n }\n result.summary.failures = result.failures.length;\n result.exitCode = 2;\n return result;\n}\n","import path from \"node:path\";\nimport process from \"node:process\";\nimport { fileURLToPath, pathToFileURL } from \"node:url\";\nimport { stripVTControlCharacters, styleText } from \"node:util\";\n\nimport {\n isDesignCommand,\n type CliDiagnostic,\n type CliFailure,\n type CliResult,\n type ResultPolicy,\n} from \"./result.ts\";\nimport type { SourceFrames } from \"./source-frame.ts\";\n\nexport type OutputFormat = \"text\" | \"json\" | \"github\" | \"files\";\n\nexport type DisplayMode = \"auto\" | \"always\" | \"never\";\n\nexport interface OutputOptions extends ResultPolicy {\n format: OutputFormat;\n color: DisplayMode;\n hyperlinks: DisplayMode;\n cwd?: string;\n}\n\ntype Label = CliDiagnostic[\"report\"][\"primary\"];\n\ntype Location = Label[\"location\"];\n\nexport function displayEnabled(\n mode: DisplayMode,\n kind: \"color\" | \"hyperlinks\",\n tty: boolean,\n env: NodeJS.ProcessEnv,\n): boolean {\n if (mode !== \"auto\") {\n return mode === \"always\";\n }\n if (kind === \"color\") {\n if (env.NO_COLOR !== undefined || env.FORCE_COLOR === \"0\") {\n return false;\n }\n if (env.FORCE_COLOR !== undefined) {\n return true;\n }\n return (\n env.TERM !== \"dumb\" && (tty || env.GITHUB_ACTIONS === \"true\" || env.GITLAB_CI === \"true\")\n );\n }\n return (\n tty &&\n !env.CI &&\n env.TERM !== \"dumb\" &&\n (env.TERM_PROGRAM === \"vscode\" ||\n env.TERM_PROGRAM === \"iTerm.app\" ||\n env.WT_SESSION !== undefined ||\n env.VTE_VERSION !== undefined ||\n env.TERM === \"xterm-kitty\")\n );\n}\n\n/** Renders one CLI result independently of the original analysis graph. */\nexport function renderResult(\n result: CliResult,\n options: OutputOptions,\n stderr = false,\n frames?: SourceFrames,\n): string {\n if (options.format === \"json\") {\n return JSON.stringify(result);\n }\n const root =\n options.format === \"github\"\n ? (process.env.GITHUB_WORKSPACE ?? options.cwd ?? process.cwd())\n : (options.cwd ?? process.cwd());\n const file = (uri: string) => {\n const displayed = displayPath(uri, root);\n return options.format === \"github\" ? displayed.replaceAll(\"\\\\\", \"/\") : displayed;\n };\n if (options.format === \"files\") {\n return result.changed.map(file).join(\"\\n\");\n }\n const tty = !!(stderr ? process.stderr : process.stdout).isTTY;\n const color =\n options.format === \"text\" && displayEnabled(options.color, \"color\", tty, process.env);\n const hyperlinks =\n options.format === \"text\" && displayEnabled(options.hyperlinks, \"hyperlinks\", tty, process.env);\n const at = (label: Label) =>\n label.scope === \"document\"\n ? file(label.location.uri)\n : `${file(label.location.uri)}:${label.location.startLine + 1}:${label.location.startColumn + 1}`;\n const linked = (label: Label) => link(at(label), label.location, hyperlinks);\n const addFrame = (label: Label) => {\n const frame = frames?.render(label);\n if (frame) {\n lines.push(...frame.split(\"\\n\").map((line) => ` ${line}`));\n }\n };\n const lines: string[] = [];\n for (const { project, report, docs } of result.diagnostics) {\n const message = clean(report.message);\n const details = [\n ...(report.primary.message ? [`note: ${clean(report.primary.message)}`] : []),\n ...report.related.map(\n (label) => `related: ${at(label)}${label.message ? `: ${clean(label.message)}` : \"\"}`,\n ),\n ...report.notes.map((note) => `note: ${clean(note)}`),\n ...report.actions.map((action) => `help: ${clean(action.title)}`),\n ...(docs ? [`docs: ${docs}`] : []),\n ];\n if (options.format === \"github\") {\n const location = report.primary.location;\n const properties: Record<string, string | number> = {\n file: file(location.uri),\n title: `project ${project + 1}: ${clean(report.code)}`,\n };\n if (report.primary.scope === \"range\") {\n properties.line = location.startLine + 1;\n properties.col = location.startColumn + 1;\n // GitHub annotation ends are inclusive; report ranges are exclusive.\n if (\n location.endColumn > 0 &&\n (location.endLine > location.startLine || location.endColumn > location.startColumn)\n ) {\n properties.endLine = location.endLine + 1;\n properties.endColumn = location.endColumn;\n } else if (location.endLine > location.startLine) {\n properties.endLine = location.endLine;\n }\n }\n lines.push(\n annotation(\n report.severity === \"error\" ? \"error\" : \"warning\",\n properties,\n [message, ...details].join(\"\\n\"),\n ),\n );\n } else {\n const severity = paint(\n report.severity,\n report.severity === \"error\" ? \"red\" : \"yellow\",\n color,\n );\n lines.push(\n `${linked(report.primary)}: ${severity} ${clean(report.code)} [project ${project + 1}]: ${message}`,\n );\n addFrame(report.primary);\n if (report.primary.message) {\n lines.push(` note: ${clean(report.primary.message)}`);\n }\n for (const related of report.related) {\n lines.push(\n ` related: ${linked(related)}${related.message ? `: ${clean(related.message)}` : \"\"}`,\n );\n addFrame(related);\n }\n lines.push(...report.notes.map((note) => ` note: ${clean(note)}`));\n lines.push(...report.actions.map((action) => ` help: ${clean(action.title)}`));\n if (docs) {\n lines.push(` docs: ${docs}`);\n }\n lines.push(\"\");\n }\n }\n for (const failure of result.failures) {\n lines.push(renderFailure(failure, options.format === \"github\", file, color));\n }\n if (result.command === \"fmt\") {\n for (const changed of result.changed) {\n if (options.format === \"github\" && options.check) {\n lines.push(\n annotation(\n \"error\",\n { file: file(changed), title: \"Stillwind formatting\" },\n \"Stillwind utilities need sorting. Run stillwind fmt.\",\n ),\n );\n } else {\n const location = { uri: changed, startLine: 0, startColumn: 0 };\n lines.push(\n `${link(file(changed), location, hyperlinks)}${options.format === \"text\" ? (options.check ? \": needs formatting\" : \": formatted\") : \"\"}`,\n );\n }\n }\n }\n if (result.command === \"inspect\") {\n for (const { project, location, css, valid, diagnostics, documentation } of result.previews) {\n const label = {\n scope: \"range\",\n location,\n } as Label;\n lines.push(`${linked(label)} [project ${project + 1}]`);\n const failure = valid || diagnostics.length ? [] : [\"error: CSS generation failed.\"];\n lines.push(\n ...clean(\n [\n ...failure,\n ...diagnostics.map(({ severity, code, message }) => `${severity} ${code}: ${message}`),\n css,\n documentation,\n ]\n .filter(Boolean)\n .join(\"\\n\"),\n )\n .trimEnd()\n .split(\"\\n\")\n .map((line) => (line ? ` ${line}` : \"\")),\n );\n lines.push(\"\");\n }\n if (!result.summary.previews && !result.summary.failures) {\n lines.push(\"The selected source has no generated CSS.\");\n }\n }\n const projects = new Set([...result.tokens, ...result.candidates].map(({ project }) => project));\n const tag = (project: number) => (projects.size > 1 ? ` [project ${project + 1}]` : \"\");\n for (const { project, name, value, source } of result.tokens) {\n lines.push(\n `${clean(name)}: ${clean(value)}${source === \"default\" ? \" (default)\" : \"\"}${tag(project)}`,\n );\n }\n for (const { project, name, kind, valid, css, suggestion, canonical } of result.candidates) {\n if (valid) {\n lines.push(`${clean(name)}${kind === \"marker\" ? \" (marker)\" : \"\"}${tag(project)}`);\n lines.push(\n ...clean(css)\n .trimEnd()\n .split(\"\\n\")\n .map((line) => (line ? ` ${line}` : \"\")),\n );\n if (canonical) {\n lines.push(` help: The canonical spelling is ${clean(canonical)}.`);\n }\n } else {\n lines.push(`${clean(name)}${tag(project)}: ${paint(`unknown ${kind}`, \"red\", color)}`);\n if (suggestion) {\n lines.push(` help: Did you mean ${clean(suggestion)}?`);\n }\n }\n lines.push(\"\");\n }\n for (const target of result.unmatched) {\n lines.push(`${clean(target)}: ${paint(\"no match\", \"red\", color)}`);\n }\n if (result.summary.warningLimitExceeded) {\n const message = `Warning count (${result.summary.warnings}) exceeds --max-warnings${options.maxWarnings === undefined ? \"\" : ` (${options.maxWarnings})`}.`;\n lines.push(\n options.format === \"github\"\n ? annotation(\"error\", { title: \"Stillwind warnings\" }, message)\n : `error: ${message}`,\n );\n }\n if (options.format === \"text\") {\n if (lines.length && lines.at(-1) !== \"\") {\n lines.push(\"\");\n }\n const { summary } = result;\n lines.push(\n isDesignCommand(result.command)\n ? `${result.command === \"theme\" ? count(summary.tokens, \"token\") : count(summary.candidates, result.command === \"variants\" ? \"variant\" : \"utility\").replace(\"utilitys\", \"utilities\")}${summary.invalidCandidates ? `; ${summary.invalidCandidates} unknown` : \"\"}${summary.unmatched ? `; ${count(summary.unmatched, \"unmatched target\")}` : \"\"}${summary.failures ? `; ${count(summary.failures, \"execution failure\")}` : \"\"}.`\n : result.command === \"inspect\"\n ? `${count(summary.previews, \"preview\")} in ${count(summary.files, \"file\")}${summary.invalidPreviews ? `; ${summary.invalidPreviews} failed to generate CSS` : \"\"}${summary.failures ? `; ${count(summary.failures, \"execution failure\")}` : \"\"}.`\n : result.command === \"fmt\" && !summary.failures\n ? options.check\n ? summary.changed\n ? `${count(summary.changed, \"file\")} ${summary.changed === 1 ? \"needs\" : \"need\"} formatting.`\n : `All selected files are formatted (${summary.files} checked).`\n : `Formatted ${count(summary.changed, \"file\")} (${summary.files} checked).`\n : `${count(summary.errors, \"error\")}, ${count(summary.warnings, \"warning\")} in ${count(summary.files, \"file\")}${summary.failures ? `; ${count(summary.failures, \"execution failure\")}` : \"\"}.`,\n );\n const suggestions = result.diagnostics.filter(({ report }) => report.actions.length > 0).length;\n if (result.command === \"lint\" && suggestions) {\n lines.push(\n `help: Suggested edits are available for ${count(suggestions, \"diagnostic\")}. Run stillwind lint --fix to apply automatic fixes.`,\n );\n }\n }\n return lines.join(\"\\n\");\n}\n\n/** Writes text execution failures to stderr and command results to stdout. */\nexport async function writeResult(result: CliResult, options: OutputOptions): Promise<void> {\n const stderr = options.format === \"text\" && result.failures.length > 0;\n const frames =\n options.format === \"text\" && result.diagnostics.length\n ? new (await import(\"./source-frame.ts\")).SourceFrames()\n : undefined;\n const output = renderResult(result, options, stderr, frames);\n if (output) {\n (stderr ? process.stderr : process.stdout).write(output + \"\\n\");\n }\n}\n\nfunction renderFailure(\n failure: CliFailure,\n github: boolean,\n file: (uri: string) => string,\n color: boolean,\n): string {\n const details = failure.details.map((detail) => `${file(detail.file)}: ${clean(detail.message)}`);\n const project = failure.project === undefined ? \"\" : ` [project ${failure.project + 1}]`;\n return github\n ? annotation(\n \"error\",\n { ...(failure.file ? { file: file(failure.file) } : {}), title: `Stillwind${project}` },\n [clean(failure.message), ...details].join(\"\\n\"),\n )\n : `${failure.file ? `${file(failure.file)}: ` : \"\"}${paint(\"error\", \"red\", color)}${project}: ${clean(failure.message)}${details.length ? `\\n ${details.join(\"\\n \")}` : \"\"}`;\n}\n\nfunction count(value: number, noun: string): string {\n return `${value} ${noun}${value === 1 ? \"\" : \"s\"}`;\n}\n\nfunction paint(text: string, color: \"red\" | \"yellow\", enabled: boolean): string {\n return enabled ? styleText(color, text, { validateStream: false }) : text;\n}\n\nfunction clean(text: string): string {\n return stripVTControlCharacters(text).replace(/\\p{Cc}/gu, (character) =>\n character === \"\\n\" || character === \"\\r\" || character === \"\\t\" ? character : \"\",\n );\n}\n\nfunction sourcePath(uri: string): string {\n try {\n return uri.startsWith(\"file:\") ? fileURLToPath(uri) : uri;\n } catch {\n return uri;\n }\n}\n\nexport function displayPath(uri: string, cwd: string): string {\n const file = sourcePath(uri);\n return clean(path.isAbsolute(file) ? path.relative(cwd, file) || \".\" : file);\n}\n\nfunction link(\n label: string,\n location: Pick<Location, \"uri\" | \"startLine\" | \"startColumn\">,\n enabled: boolean,\n): string {\n const file = sourcePath(location.uri);\n if (!enabled || !path.isAbsolute(file)) {\n return label;\n }\n const url = pathToFileURL(file);\n url.hash = `L${location.startLine + 1}:${location.startColumn + 1}`;\n return `\\u001b]8;;${url.href}\\u001b\\\\${label}\\u001b]8;;\\u001b\\\\`;\n}\n\nexport function annotation(\n level: \"error\" | \"warning\",\n properties: Record<string, string | number>,\n message: string,\n): string {\n const escapeData = (value: string): string =>\n clean(value).replace(/%/g, \"%25\").replace(/\\r/g, \"%0D\").replace(/\\n/g, \"%0A\");\n const fields = Object.entries(properties)\n .map(\n ([key, value]) =>\n `${key}=${escapeData(String(value)).replace(/:/g, \"%3A\").replace(/,/g, \"%2C\")}`,\n )\n .join(\",\");\n return `::${level}${fields ? ` ${fields}` : \"\"}::${escapeData(message)}`;\n}\n","import process from \"node:process\";\nimport { stripVTControlCharacters, styleText } from \"node:util\";\n\nimport type { DesignSystemRequest, DesignTokenSource } from \"@stillwind/analysis\";\nimport { defineCommand, renderUsage, runCommand, type ArgsDef, type CommandDef } from \"citty\";\n\nimport packageJson from \"../package.json\" with { type: \"json\" };\nimport {\n builtinArgs,\n configArgs,\n outputArgs,\n parseInvocation,\n readOutputOptions,\n strictArguments,\n targetArgs,\n warningArgs,\n warningLimit,\n} from \"./arguments.ts\";\nimport { displayEnabled, writeResult, type OutputOptions } from \"./output.ts\";\nimport { cliResult, failureResult, type CliCommand, type DesignCommand } from \"./result.ts\";\n\nconst fmtArgs = {\n ...targetArgs,\n check: {\n type: \"boolean\",\n description: \"Check formatting without saving files\",\n },\n} as const;\n\nconst lintArgs = {\n ...targetArgs,\n ...warningArgs,\n format: {\n ...outputArgs.format,\n options: [\"text\", \"json\", \"github\"] as (\"text\" | \"json\" | \"github\")[],\n },\n fix: {\n type: \"boolean\",\n description: \"Apply converged automatic fixes\",\n },\n} as const;\n\nconst inspectArgs = {\n ...targetArgs,\n format: {\n ...outputArgs.format,\n options: [\"text\", \"json\", \"github\"] as (\"text\" | \"json\" | \"github\")[],\n },\n globs: {\n ...targetArgs.globs,\n description: \"Select files with paths or globs, optionally followed by :line or :line:column\",\n },\n} as const;\n\nconst designArgs = {\n ...configArgs,\n format: {\n ...outputArgs.format,\n options: [\"text\", \"json\", \"github\"] as (\"text\" | \"json\" | \"github\")[],\n },\n color: outputArgs.color,\n hyperlinks: outputArgs.hyperlinks,\n} as const;\n\nconst themeArgs = {\n ...designArgs,\n names: {\n type: \"positional\",\n required: false,\n description: \"Select tokens by name without the leading --, where * matches any text\",\n },\n source: {\n type: \"enum\",\n options: [\"project\", \"default\"] as DesignTokenSource[],\n description: \"Show only the tokens with this origin\",\n },\n} as const;\n\nconst candidateArgs = {\n ...designArgs,\n names: {\n type: \"positional\",\n required: false,\n description: \"Check exact names, or search with * patterns\",\n },\n} as const;\n\nconst lspArgs = {\n ...configArgs,\n stdio: {\n type: \"boolean\",\n required: true,\n description: \"Use the Language Server Protocol over stdin/stdout\",\n },\n} as const;\n\nconst subCommands = {\n fmt: defineCommand({\n meta: {\n name: \"fmt\",\n description: \"Sort Stillwind utilities\",\n },\n args: fmtArgs,\n plugins: [strictArguments],\n async run({ args, data }) {\n const options = data as OutputOptions;\n options.check = args.check;\n const { format } = await import(\"@stillwind/analysis/node\");\n const analysis = await format({\n config: args.config,\n cwd: options.cwd,\n patterns: args._,\n check: args.check,\n });\n const result = cliResult(\"fmt\", analysis, {\n check: args.check,\n });\n await writeResult(result, options);\n process.exitCode = result.exitCode;\n },\n }),\n lint: defineCommand({\n meta: {\n name: \"lint\",\n description: \"Check Stillwind styles\",\n },\n args: lintArgs,\n plugins: [strictArguments],\n async run({ args, data }) {\n const options = data as OutputOptions;\n const maxWarnings = warningLimit(args[\"max-warnings\"]);\n options.quiet = args.quiet;\n options.maxWarnings = maxWarnings;\n const { lint } = await import(\"@stillwind/analysis/node\");\n const analysis = await lint({\n config: args.config,\n cwd: options.cwd,\n patterns: args._,\n fix: args.fix,\n });\n const result = cliResult(\"lint\", analysis, {\n quiet: args.quiet,\n maxWarnings,\n });\n await writeResult(result, options);\n process.exitCode = result.exitCode;\n },\n }),\n inspect: defineCommand({\n meta: {\n name: \"inspect\",\n description: \"Show the CSS that Stillwind generates for source code\",\n },\n args: inspectArgs,\n plugins: [strictArguments],\n async run({ args, data }) {\n const options = data as OutputOptions;\n const { inspect } = await import(\"@stillwind/analysis/node\");\n const analysis = await inspect({\n config: args.config,\n cwd: options.cwd,\n targets: args._,\n });\n const result = cliResult(\"inspect\", analysis);\n await writeResult(result, options);\n process.exitCode = result.exitCode;\n },\n }),\n theme: defineCommand({\n meta: {\n name: \"theme\",\n description: \"List the theme tokens of the project\",\n },\n args: themeArgs,\n plugins: [strictArguments],\n async run({ args, data }) {\n await runDesignCommand(\"theme\", data as OutputOptions, args.config, {\n kind: \"theme\",\n targets: args._,\n source: args.source,\n });\n },\n }),\n utilities: defineCommand({\n meta: {\n name: \"utilities\",\n description: \"Check or search the utilities of the project\",\n },\n args: candidateArgs,\n plugins: [strictArguments],\n async run({ args, data }) {\n await runDesignCommand(\"utilities\", data as OutputOptions, args.config, {\n kind: \"utilities\",\n targets: args._,\n });\n },\n }),\n variants: defineCommand({\n meta: {\n name: \"variants\",\n description: \"Check or search the variants of the project\",\n },\n args: candidateArgs,\n plugins: [strictArguments],\n async run({ args, data }) {\n await runDesignCommand(\"variants\", data as OutputOptions, args.config, {\n kind: \"variants\",\n targets: args._,\n });\n },\n }),\n lsp: defineCommand({\n meta: {\n name: \"lsp\",\n description: \"Start the language server\",\n },\n args: lspArgs,\n plugins: [strictArguments],\n async run({ args }) {\n if (!args.stdio || args._.length) {\n throw new Error(\"lsp requires --stdio and accepts no globs\");\n }\n const { startLanguageServer } = await import(\"@stillwind/language-server/node\");\n startLanguageServer(args.config);\n },\n }),\n};\n\nasync function runDesignCommand(\n name: DesignCommand,\n options: OutputOptions,\n config: string | undefined,\n request: DesignSystemRequest,\n): Promise<void> {\n const { designSystem } = await import(\"@stillwind/analysis/node\");\n const answer = await designSystem({ config, cwd: options.cwd }, request);\n const result = cliResult(name, { ...answer, results: [] });\n await writeResult(result, options);\n process.exitCode = result.exitCode;\n}\n\nexport const command = defineCommand({\n meta: {\n name: \"stillwind\",\n version: packageJson.version,\n description: \"Sort, check, and inspect Stillwind styles\",\n },\n args: {\n ...configArgs,\n ...outputArgs,\n ...builtinArgs,\n },\n subCommands,\n});\n\nexport async function runCli(rawArgs = process.argv.slice(2)): Promise<void> {\n const options: OutputOptions = {\n format: outputArgs.format.default,\n color: \"auto\",\n hyperlinks: \"auto\",\n cwd: process.cwd(),\n };\n let name: CliCommand = null;\n\n try {\n const invocation = parseInvocation(rawArgs, {\n ...fmtArgs,\n ...lintArgs,\n ...inspectArgs,\n ...themeArgs,\n ...candidateArgs,\n ...lspArgs,\n });\n name =\n invocation.name === \"fmt\" ||\n invocation.name === \"lint\" ||\n invocation.name === \"inspect\" ||\n invocation.name === \"theme\" ||\n invocation.name === \"utilities\" ||\n invocation.name === \"variants\"\n ? invocation.name\n : null;\n if (invocation.name === \"lsp\") {\n options.format = \"text\";\n } else {\n readOutputOptions(rawArgs, options);\n }\n if (invocation.name && !Object.hasOwn(subCommands, invocation.name)) {\n throw new Error(`Unknown command: ${invocation.name}`);\n }\n\n if (!rawArgs.length || invocation.help) {\n const sub = subCommands[invocation.name as keyof typeof subCommands];\n const subject = sub ?? command;\n const usage = await renderUsage<ArgsDef>(\n {\n meta: subject.meta,\n args: subject.args,\n subCommands: subject.subCommands,\n },\n sub\n ? {\n meta: command.meta,\n }\n : undefined,\n );\n write(displayUsage(usage, options));\n } else if (rawArgs.length === 1 && invocation.version) {\n write(packageJson.version);\n } else {\n if (invocation.version) {\n throw new Error(\"--version must be used without a command\");\n }\n if (!invocation.name) {\n throw new Error(\n \"A command is required: fmt, lint, inspect, theme, utilities, variants, or lsp\",\n );\n }\n await runCommand(subCommands[invocation.name as keyof typeof subCommands] as CommandDef, {\n rawArgs: invocation.rawArgs,\n data: options,\n });\n }\n } catch (error) {\n const result = failureResult(name, error, options);\n await writeResult(\n result,\n options.format === \"files\" ? { ...options, format: \"text\" } : options,\n );\n process.exitCode = 2;\n }\n}\n\nfunction write(output: string): void {\n if (output) {\n process.stdout.write(output + \"\\n\");\n }\n}\n\nfunction displayUsage(usage: string, options: OutputOptions): string {\n const plain = stripVTControlCharacters(usage);\n return displayEnabled(options.color, \"color\", !!process.stdout.isTTY, process.env)\n ? styleText(\"cyan\", plain, {\n validateStream: false,\n })\n : plain;\n}\n","#!/usr/bin/env node\n\nimport { runCli } from \"./commands.ts\";\n\nawait runCli();\n"],"mappings":";;;;;;;;;;;;ACOA,MAAa,aAAa,EACxB,QAAQ;CACN,MAAM;CACN,OAAO;CACP,aAAa;CACb,WAAW;AACb,EACF;AAEA,MAAa,aAAa;CACxB,QAAQ;EACN,MAAM;EACN,SAAS;GAAC;GAAQ;GAAQ;GAAU;EAAO;EAC3C,SAAS,QAAQ,IAAI,mBAAmB,SAAS,WAAW;EAC5D,aAAa;CACf;CACA,OAAO;EACL,MAAM;EACN,SAAS;GAAC;GAAQ;GAAU;EAAO;EACnC,SAAS;EACT,aAAa;CACf;CACA,YAAY;EACV,MAAM;EACN,SAAS;GAAC;GAAQ;GAAU;EAAO;EACnC,SAAS;EACT,aAAa;CACf;AACF;AAEA,MAAa,aAAa;CACxB,GAAG;CACH,GAAG;CACH,OAAO;EACL,MAAM;EACN,UAAU;EACV,aAAa;CACf;AACF;AAEA,MAAa,cAAc;CACzB,OAAO;EACL,MAAM;EACN,aAAa;CACf;CACA,gBAAgB;EACd,MAAM;EACN,aAAa;EACb,WAAW;CACb;AACF;AAEA,SAAgB,aAAa,OAA+C;CAC1E,IAAI,UAAU,KAAA,GACZ;CAEF,IAAI,CAAC,QAAQ,KAAK,KAAK,KAAK,CAAC,OAAO,cAAc,OAAO,KAAK,CAAC,GAC7D,MAAM,IAAI,MAAM,mEAAmE;CAErF,OAAO,OAAO,KAAK;AACrB;AAEA,MAAa,cAAc;CACzB,MAAM;EACJ,MAAM;EACN,OAAO;EACP,aAAa;CACf;CACA,SAAS;EACP,MAAM;EACN,OAAO;EACP,aAAa;CACf;AACF;;;;;AAMA,SAAgB,kBAAkB,SAAmB,SAA8B;CACjF,QAAQ,SAASA,YAEd,SAAS,EACV,QAAQ,WAAW,OACrB,CAAC,CAAC,CAAC;CACH,MAAM,EAAE,OAAO,eAAeA,YAA6B,SAAS,UAAU;CAC9E,Q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AM,OAAO,OAExC,GACA,QAAQ,WAAW,UAAU;GAAE,GAAG;GAAS,QAAQ;EAAO,IAAI,OAChE;EACA,QAAQ,WAAW;CACrB;AACF;AAEA,SAAS,MAAM,QAAsB;CACnC,IAAI,QACF,QAAQ,OAAO,MAAM,SAAS,IAAI;AAEtC;AAEA,SAAS,aAAa,OAAe,SAAgC;CACnE,MAAM,QAAQ,yBAAyB,KAAK;CAC5C,OAAO,eAAe,QAAQ,OAAO,SAAS,CAAC,CAAC,QAAQ,OAAO,OAAO,QAAQ,GAAG,IAC7E,UAAU,QAAQ,OAAO,EACvB,gBAAgB,MAClB,CAAC,IACD;AACN;;ACtVA,MAAM,OAAO"}
1
+ {"version":3,"file":"main.js","names":["parseArgs","tokenizeArgs","packageJson.version"],"sources":["../package.json","../src/arguments.ts","../src/documentation.ts","../src/result.ts","../src/output.ts","../src/commands.ts","../src/main.ts"],"sourcesContent":["","import process from \"node:process\";\nimport { parseArgs as tokenizeArgs } from \"node:util\";\n\nimport { defineCittyPlugin, parseArgs, type ArgsDef } from \"citty\";\n\nimport type { DisplayMode, OutputFormat, OutputOptions } from \"./output.ts\";\n\nexport const configArgs = {\n config: {\n type: \"string\",\n alias: \"c\",\n description: \"Use this configuration file\",\n valueHint: \"path\",\n },\n} as const;\n\nexport const outputArgs = {\n format: {\n type: \"enum\",\n options: [\"text\", \"json\", \"github\"] as (\"text\" | \"json\" | \"github\")[],\n default: process.env.GITHUB_ACTIONS === \"true\" ? \"github\" : \"text\",\n description: \"Output format (text, json, or github)\",\n },\n color: {\n type: \"enum\",\n options: [\"auto\", \"always\", \"never\"] as DisplayMode[],\n default: \"auto\",\n description: \"Control terminal colors\",\n },\n hyperlinks: {\n type: \"enum\",\n options: [\"auto\", \"always\", \"never\"] as DisplayMode[],\n default: \"auto\",\n description: \"Control links to source locations\",\n },\n} as const;\n\nconst allFormatArg = {\n ...outputArgs.format,\n options: [\"text\", \"json\", \"github\", \"files\"] as OutputFormat[],\n description: \"Output format (text, json, github, or files)\",\n} as const;\n\nexport const targetArgs = {\n ...configArgs,\n ...outputArgs,\n globs: {\n type: \"positional\",\n required: false,\n description: \"Filter configured targets with one or more globs\",\n },\n} as const;\n\nexport const warningArgs = {\n quiet: {\n type: \"boolean\",\n description: \"Hide lint warnings while retaining their counts\",\n },\n \"max-warnings\": {\n type: \"string\",\n description: \"Fail when the warning count exceeds this non-negative integer\",\n valueHint: \"count\",\n },\n limit: {\n type: \"string\",\n description: \"Show at most this many diagnostics while retaining summary counts\",\n valueHint: \"count\",\n },\n} as const;\n\nexport function nonNegativeInteger(value: string | undefined, option: string): number | undefined {\n if (value === undefined) {\n return undefined;\n }\n if (!/^\\d+$/.test(value) || !Number.isSafeInteger(Number(value))) {\n throw new Error(`Invalid value for ${option}: expected a non-negative integer`);\n }\n return Number(value);\n}\n\nexport function warningLimit(value: string | undefined): number | undefined {\n return nonNegativeInteger(value, \"--max-warnings\");\n}\n\nexport const builtinArgs = {\n help: {\n type: \"boolean\",\n alias: \"h\",\n description: \"Show usage\",\n },\n version: {\n type: \"boolean\",\n alias: \"v\",\n description: \"Show version\",\n },\n} as const;\n\n/**\n * Updates display options using citty's enum validation and defaults.\n * A valid format is retained if a later display option fails, so the error uses the requested format.\n */\nexport function readOutputOptions(rawArgs: string[], options: OutputOptions): void {\n options.format = parseArgs<{\n format: typeof allFormatArg;\n }>(rawArgs, {\n format: allFormatArg,\n }).format;\n const { color, hyperlinks } = parseArgs<{\n color: typeof outputArgs.color;\n hyperlinks: typeof outputArgs.hyperlinks;\n }>(rawArgs, {\n color: outputArgs.color,\n hyperlinks: outputArgs.hyperlinks,\n });\n options.color = color;\n options.hyperlinks = hyperlinks;\n}\n\n/** Rejects unknown named options and empty string options that citty otherwise accepts. */\nexport const strictArguments = defineCittyPlugin({\n name: \"strict-arguments\",\n async setup({ args, cmd }) {\n const definitions: ArgsDef =\n (await (typeof cmd.args === \"function\" ? cmd.args() : cmd.args)) ?? {};\n const names = new Set([\n \"_\",\n ...Object.keys(definitions).flatMap((name) => [\n name,\n name.replace(/-([a-z])/g, (_, letter: string) => letter.toUpperCase()),\n ]),\n ]);\n for (const definition of Object.values(definitions)) {\n if (\"alias\" in definition) {\n for (const alias of [definition.alias ?? []].flat()) {\n names.add(alias);\n }\n }\n }\n for (const name of Object.keys(args)) {\n if (!names.has(name)) {\n const flag = name.length === 1 ? `-${name}` : `--${name}`;\n throw new Error(`Unknown option: ${flag}. Run with --help to see valid options.`);\n }\n }\n for (const [name, definition] of Object.entries(definitions)) {\n if (\n definition.type === \"string\" &&\n args[name] !== undefined &&\n (typeof args[name] !== \"string\" || args[name] === \"\")\n ) {\n throw new Error(`Missing or invalid value for --${name}`);\n }\n }\n },\n});\n\n/**\n * Locates the command without mistaking an option's value for it.\n * Keeps options before the command and removes help/version flags handled by the entrypoint.\n */\nexport function parseInvocation(rawArgs: string[], definitions: ArgsDef) {\n const combined: ArgsDef = { ...definitions, ...builtinArgs };\n const options: Record<string, { type: \"boolean\" | \"string\"; short?: string }> = {};\n for (const [name, definition] of Object.entries(combined)) {\n if (definition.type === \"positional\") {\n continue;\n }\n const option = {\n type: definition.type === \"boolean\" ? (\"boolean\" as const) : (\"string\" as const),\n };\n options[name] = option;\n if (\"alias\" in definition && typeof definition.alias === \"string\") {\n options[name].short = definition.alias;\n }\n }\n const { tokens } = tokenizeArgs({\n args: rawArgs,\n options,\n strict: false,\n allowPositionals: true,\n allowNegative: true,\n tokens: true,\n });\n const first = tokens.find(\n (token) => token.kind === \"positional\" || token.kind === \"option-terminator\",\n );\n const commandIndex = first?.kind === \"positional\" ? first.index : undefined;\n const builtinTokens = tokens.filter(\n (token) => token.kind === \"option\" && [\"help\", \"version\"].includes(token.name),\n );\n const flags = parseArgs<typeof builtinArgs>(\n builtinTokens.map((token) => rawArgs[token.index]),\n builtinArgs,\n );\n const omitted = new Set(builtinTokens.map((token) => token.index));\n if (commandIndex !== undefined) {\n omitted.add(commandIndex);\n }\n\n return {\n name: commandIndex === undefined ? undefined : rawArgs[commandIndex],\n rawArgs: rawArgs.filter((_, index) => !omitted.has(index)),\n help: flags.help,\n version: flags.version,\n };\n}\n","import { existsSync } from \"node:fs\";\nimport { createRequire } from \"node:module\";\nimport path from \"node:path\";\n\nimport { documentationSection, documentationUrl } from \"@stillwind/analysis\";\n\n/**\n * Finds the documentation page of a report code.\n *\n * @param code - Compiler code, such as `SW01001`, or lint rule name.\n * @param root - Root directory of the installed `stillwind` package, when one resolves.\n * @returns The absolute path of the page in that package, which matches the installed version.\n * Otherwise, the page on the website. Codes without a page return undefined.\n */\nexport function documentationPage(code: string, root: string | undefined): string | undefined {\n const section = documentationSection(code);\n if (!section) {\n return undefined;\n }\n const file = root && path.join(root, \"docs\", section, `${code}.md`);\n return file && existsSync(file) ? file : documentationUrl(code);\n}\n\n/**\n * Finds the `stillwind` package that a configuration file resolves.\n *\n * @param config - Absolute configuration path.\n * @returns The package root, or undefined when no package resolves.\n */\nexport function stillwindRoot(config: string | null): string | undefined {\n try {\n return config\n ? path.dirname(createRequire(config).resolve(\"stillwind/package.json\"))\n : undefined;\n } catch {\n return undefined;\n }\n}\n","import path from \"node:path\";\nimport process from \"node:process\";\nimport { fileURLToPath } from \"node:url\";\n\nimport { lintReports } from \"@stillwind/analysis\";\nimport type {\n DesignSystemAnswer,\n InspectEmptyReason,\n InspectPreview,\n LintResult,\n ProjectInfo,\n} from \"@stillwind/analysis/node\";\n\nimport { documentationPage, stillwindRoot } from \"./documentation.ts\";\n\n/**\n * A command that reads a design system and no source files.\n */\nexport type DesignCommand = \"theme\" | \"utilities\" | \"variants\";\n\nexport type CliCommand = \"check\" | \"lint\" | \"fmt\" | \"inspect\" | \"info\" | DesignCommand | null;\n\ntype RawReport = ReturnType<typeof lintReports>[number][\"report\"];\n\n/** One suggested edit action annotated with whether `--fix` applies it automatically. */\nexport type CliAction = RawReport[\"actions\"][number] & {\n /** True when `--fix` applies this action automatically; false for manual suggestions. */\n autofix: boolean;\n};\n\nexport type CliDiagnostic = Omit<ReturnType<typeof lintReports>[number], \"report\"> & {\n /** Workspace-relative POSIX path of the primary location (or absolute on another volume). */\n file: string;\n /** One-based start line of the primary location when scope is `\"range\"`. */\n line?: number;\n /** One-based UTF-16 start column of the primary location when scope is `\"range\"`. */\n column?: number;\n report: Omit<RawReport, \"actions\"> & {\n actions: CliAction[];\n };\n /** Absolute path or URL of the page that explains the report code. */\n docs?: string;\n};\n\n/** A preview whose findings link to the pages that explain their codes. */\nexport type CliPreview = Omit<InspectPreview, \"diagnostics\"> & {\n /** Workspace-relative POSIX path of the preview location (or absolute on another volume). */\n file: string;\n /** One-based start line of the preview range. */\n line: number;\n /** One-based UTF-16 start column of the preview range. */\n column: number;\n diagnostics: (InspectPreview[\"diagnostics\"][number] & {\n /** Absolute path or URL of the page that explains the code. */\n docs?: string;\n })[];\n};\n\n/** Aggregated counts for one diagnostic code or lint rule. */\nexport interface CodeSummary {\n errors: number;\n warnings: number;\n autofixable: number;\n /** Absolute path or URL of the page that explains this code, when available. */\n docs?: string;\n}\n\nexport interface CliFailure {\n project?: number;\n file?: string;\n message: string;\n details: {\n file: string;\n message: string;\n }[];\n}\n\nexport interface CliResult {\n command: CliCommand;\n config: string | null;\n diagnostics: CliDiagnostic[];\n failures: CliFailure[];\n changed: string[];\n previews: CliPreview[];\n /** Explains why `inspect` produced no previews without failures. Omitted otherwise. */\n emptyReason?: InspectEmptyReason;\n projects: ProjectInfo[];\n tokens: DesignSystemAnswer[\"tokens\"];\n candidates: DesignSystemAnswer[\"candidates\"];\n unmatched: string[];\n summary: {\n files: number;\n errors: number;\n warnings: number;\n failures: number;\n changed: number;\n previews: number;\n invalidPreviews: number;\n projects: number;\n tokens: number;\n candidates: number;\n invalidCandidates: number;\n unmatched: number;\n /** Diagnostics that have an automatic fix applied by `--fix`. */\n autofixable: number;\n /** Diagnostics that have manual suggested edits not applied by `--fix`. */\n suggestions: number;\n /** Number of diagnostics omitted from the `diagnostics` array by `--limit`. */\n omittedDiagnostics: number;\n /** Counts grouped by diagnostic code or lint rule, in code order. */\n byCode: Record<string, CodeSummary>;\n warningLimitExceeded: boolean;\n };\n exitCode: 0 | 1 | 2;\n}\n\nexport interface ResultPolicy {\n check?: boolean;\n quiet?: boolean;\n maxWarnings?: number;\n limit?: number;\n cwd?: string;\n}\n\nfunction relativeFilePath(uri: string, cwd: string): string {\n let file = uri;\n if (uri.startsWith(\"file:\")) {\n try {\n file = fileURLToPath(uri);\n } catch {\n file = uri;\n }\n }\n const relative = path.isAbsolute(file) ? path.relative(cwd, file) || \".\" : file;\n return relative.replaceAll(\"\\\\\", \"/\");\n}\n\n/**\n * Tests whether a command reads a design system and no source files.\n */\nexport function isDesignCommand(command: CliCommand): command is DesignCommand {\n return command === \"theme\" || command === \"utilities\" || command === \"variants\";\n}\n\n/**\n * Returns whether `--fix` automatically applies `action` for `report`.\n * Only the first action whose edits are nonempty and stay on the primary document's revision\n * is applied automatically; subsequent alternatives or cross-document edits are manual suggestions.\n */\nfunction isAutofixAction(\n report: RawReport,\n action: RawReport[\"actions\"][number],\n index: number,\n): boolean {\n return (\n index === 0 &&\n action.edits.length > 0 &&\n action.edits.every(\n (edit) =>\n edit.location.uri === report.primary.location.uri &&\n edit.location.revision === report.primary.location.revision,\n )\n );\n}\n\n/**\n * Projects analysis into CLI data before visibility filtering and rendering.\n */\nexport function cliResult(\n command: CliCommand,\n result: Pick<LintResult, \"config\" | \"results\" | \"changed\"> & {\n failures?: readonly Pick<NonNullable<LintResult[\"failures\"]>[number], \"file\" | \"message\">[];\n previews?: InspectPreview[];\n emptyReason?: InspectEmptyReason;\n projects?: ProjectInfo[];\n } & Partial<Pick<DesignSystemAnswer, \"tokens\" | \"candidates\" | \"unmatched\">>,\n policy: ResultPolicy = {},\n): CliResult {\n const failedFiles = new Set(result.failures?.map((failure) => failure.file));\n const cwd = policy.cwd ?? process.cwd();\n const root = stillwindRoot(result.config);\n const docs = (code: string) => {\n const page = documentationPage(code, root);\n return page ? { docs: page } : {};\n };\n const previews: CliPreview[] = (result.previews ?? []).map((preview) => ({\n ...preview,\n file: relativeFilePath(preview.location.uri, cwd),\n line: preview.location.startLine + 1,\n column: preview.location.startColumn + 1,\n diagnostics: preview.diagnostics.map((diagnostic) => ({\n ...diagnostic,\n ...docs(diagnostic.code),\n })),\n }));\n const invalid = previews.filter(({ valid }) => !valid).length;\n const { tokens = [], candidates = [], unmatched = [], projects = [] } = result;\n const invalidCandidates = candidates.filter(({ valid }) => !valid).length;\n const diagnostics: CliDiagnostic[] = lintReports(\n command !== \"lint\" && command !== \"check\"\n ? result.results.filter(\n ({ result }) => result.status !== \"complete\" || failedFiles.has(result.entry),\n )\n : result.results,\n ).map((diagnostic) => {\n const { primary } = diagnostic.report;\n return {\n ...diagnostic,\n file: relativeFilePath(primary.location.uri, cwd),\n ...(primary.scope === \"range\"\n ? {\n line: primary.location.startLine + 1,\n column: primary.location.startColumn + 1,\n }\n : {}),\n report: {\n ...diagnostic.report,\n actions: diagnostic.report.actions.map((action, index) => ({\n ...action,\n autofix: isAutofixAction(diagnostic.report, action, index),\n })),\n },\n ...docs(diagnostic.report.code),\n };\n });\n const failures: CliFailure[] = result.results.flatMap(({ project, result }) =>\n result.status === \"complete\"\n ? []\n : [\n {\n project,\n file: result.entry,\n message: `Incomplete analysis${result.error ? `: ${result.error}` : \"\"}`,\n details: [\n ...(result.graph?.dependencies ?? []).flatMap((dependency) =>\n dependency.status === \"unresolved\" || dependency.status === \"unsupported\"\n ? [\n {\n file: dependency.importer,\n message: `${dependency.status}: ${dependency.specifier}`,\n },\n ]\n : [],\n ),\n ...(result.graph?.unverified ?? []).map((range) => ({\n file: range.moduleId,\n message: `unverified${range.start === undefined ? \"\" : ` bytes ${range.start}-${range.end}`}: ${range.reason}`,\n })),\n ],\n },\n ],\n );\n for (const failure of result.failures ?? []) {\n if (!failures.some((existing) => existing.file === failure.file)) {\n failures.push({\n file: failure.file,\n message: failure.message,\n details: [],\n });\n }\n }\n if (\n !result.results.length &&\n !failures.length &&\n !isDesignCommand(command) &&\n command !== \"info\"\n ) {\n failures.push({\n message:\n \"No analysis targets matched the configured scopes; check `files`/`exclude` in stillwind.config.* or the provided glob patterns\",\n details: [],\n });\n }\n const changed = [...new Set(result.changed ?? [])].sort();\n const errors = diagnostics.filter(({ report }) => report.severity === \"error\").length;\n const warnings = diagnostics.length - errors;\n const warningLimitExceeded = policy.maxWarnings !== undefined && warnings > policy.maxWarnings;\n const byCodeMap = new Map<string, CodeSummary>();\n for (const diagnostic of diagnostics) {\n const { code, severity, actions } = diagnostic.report;\n const entry = byCodeMap.get(code) ?? {\n errors: 0,\n warnings: 0,\n autofixable: 0,\n ...(diagnostic.docs ? { docs: diagnostic.docs } : {}),\n };\n if (severity === \"error\") {\n entry.errors += 1;\n } else {\n entry.warnings += 1;\n }\n if (actions.some((action) => action.autofix)) {\n entry.autofixable += 1;\n }\n byCodeMap.set(code, entry);\n }\n const byCode: Record<string, CodeSummary> = {};\n for (const code of [...byCodeMap.keys()].sort()) {\n byCode[code] = byCodeMap.get(code)!;\n }\n const visible = policy.quiet\n ? diagnostics.filter(({ report }) => report.severity === \"error\")\n : diagnostics;\n const shown = policy.limit === undefined ? visible : visible.slice(0, policy.limit);\n const omittedDiagnostics = visible.length - shown.length;\n return {\n command,\n config: result.config,\n diagnostics: shown,\n failures,\n changed,\n previews,\n ...(result.emptyReason ? { emptyReason: result.emptyReason } : {}),\n projects,\n tokens,\n candidates,\n unmatched,\n summary: {\n files: new Set([\n ...result.results.map(({ result }) => result.entry),\n ...(result.failures ?? []).map((failure) => failure.file),\n ]).size,\n errors,\n warnings,\n failures: failures.length,\n changed: changed.length,\n previews: previews.length,\n invalidPreviews: invalid,\n projects: projects.length,\n tokens: tokens.length,\n candidates: candidates.length,\n invalidCandidates,\n unmatched: unmatched.length,\n autofixable: diagnostics.filter(({ report }) =>\n report.actions.some((action) => action.autofix),\n ).length,\n suggestions: diagnostics.filter(({ report }) =>\n report.actions.some((action) => !action.autofix),\n ).length,\n omittedDiagnostics,\n byCode,\n warningLimitExceeded,\n },\n exitCode: failures.length\n ? 2\n : errors ||\n warningLimitExceeded ||\n (policy.check && changed.length) ||\n (command === \"inspect\" && (invalid || !previews.length)) ||\n invalidCandidates ||\n unmatched.length\n ? 1\n : 0,\n };\n}\n\n/**\n * Retains reports carried by failed rewrite planning in the same CLI envelope.\n */\nexport function failureResult(\n command: CliCommand,\n error: unknown,\n policy: ResultPolicy = {},\n): CliResult {\n const results =\n error instanceof Error && \"results\" in error && Array.isArray(error.results)\n ? (error.results as LintResult[\"results\"])\n : [];\n const result = cliResult(\n \"lint\",\n {\n config: results[0]?.config ?? \"\",\n results,\n },\n policy,\n );\n result.command = command;\n result.config = results[0]?.config ?? null;\n if (!results.length || !result.failures.length) {\n result.failures = [\n {\n message: error instanceof Error ? error.message : String(error),\n details: [],\n },\n ];\n }\n result.summary.failures = result.failures.length;\n result.exitCode = 2;\n return result;\n}\n","import path from \"node:path\";\nimport process from \"node:process\";\nimport { fileURLToPath, pathToFileURL } from \"node:url\";\nimport { stripVTControlCharacters, styleText } from \"node:util\";\n\nimport {\n isDesignCommand,\n type CliDiagnostic,\n type CliFailure,\n type CliResult,\n type ResultPolicy,\n} from \"./result.ts\";\nimport type { SourceFrames } from \"./source-frame.ts\";\n\nexport type OutputFormat = \"text\" | \"json\" | \"github\" | \"files\";\n\nexport type DisplayMode = \"auto\" | \"always\" | \"never\";\n\nexport interface OutputOptions extends ResultPolicy {\n format: OutputFormat;\n color: DisplayMode;\n hyperlinks: DisplayMode;\n cwd?: string;\n}\n\ntype Label = CliDiagnostic[\"report\"][\"primary\"];\n\ntype Location = Label[\"location\"];\n\nexport function displayEnabled(\n mode: DisplayMode,\n kind: \"color\" | \"hyperlinks\",\n tty: boolean,\n env: NodeJS.ProcessEnv,\n): boolean {\n if (mode !== \"auto\") {\n return mode === \"always\";\n }\n if (kind === \"color\") {\n if (env.NO_COLOR !== undefined || env.FORCE_COLOR === \"0\") {\n return false;\n }\n if (env.FORCE_COLOR !== undefined) {\n return true;\n }\n return (\n env.TERM !== \"dumb\" && (tty || env.GITHUB_ACTIONS === \"true\" || env.GITLAB_CI === \"true\")\n );\n }\n return (\n tty &&\n !env.CI &&\n env.TERM !== \"dumb\" &&\n (env.TERM_PROGRAM === \"vscode\" ||\n env.TERM_PROGRAM === \"iTerm.app\" ||\n env.WT_SESSION !== undefined ||\n env.VTE_VERSION !== undefined ||\n env.TERM === \"xterm-kitty\")\n );\n}\n\n/** Renders one CLI result independently of the original analysis graph. */\nexport function renderResult(\n result: CliResult,\n options: OutputOptions,\n stderr = false,\n frames?: SourceFrames,\n): string {\n if (options.format === \"json\") {\n return JSON.stringify(result);\n }\n const root =\n options.format === \"github\"\n ? (process.env.GITHUB_WORKSPACE ?? options.cwd ?? process.cwd())\n : (options.cwd ?? process.cwd());\n const file = (uri: string) => {\n const displayed = displayPath(uri, root);\n return options.format === \"github\" ? displayed.replaceAll(\"\\\\\", \"/\") : displayed;\n };\n if (options.format === \"files\") {\n return result.changed.map(file).join(\"\\n\");\n }\n const tty = !!(stderr ? process.stderr : process.stdout).isTTY;\n const color =\n options.format === \"text\" && displayEnabled(options.color, \"color\", tty, process.env);\n const hyperlinks =\n options.format === \"text\" && displayEnabled(options.hyperlinks, \"hyperlinks\", tty, process.env);\n const at = (label: Label) =>\n label.scope === \"document\"\n ? file(label.location.uri)\n : `${file(label.location.uri)}:${label.location.startLine + 1}:${label.location.startColumn + 1}`;\n const linked = (label: Label) => link(at(label), label.location, hyperlinks);\n const addFrame = (label: Label) => {\n const frame = frames?.render(label);\n if (frame) {\n lines.push(...frame.split(\"\\n\").map((line) => ` ${line}`));\n }\n };\n const lines: string[] = [];\n // Project tags appear only when the reported items come from more than one project.\n const analysisProjects = new Set(\n [...result.diagnostics, ...result.previews, ...result.failures].flatMap(({ project }) =>\n project === undefined ? [] : [project],\n ),\n );\n const projectTag = (project: number | undefined) =>\n project !== undefined && analysisProjects.size > 1 ? ` [project ${project + 1}]` : \"\";\n for (const { project, report, docs } of result.diagnostics) {\n const message = clean(report.message);\n const details = [\n ...(report.primary.message ? [`note: ${clean(report.primary.message)}`] : []),\n ...report.related.map(\n (label) => `related: ${at(label)}${label.message ? `: ${clean(label.message)}` : \"\"}`,\n ),\n ...report.notes.map((note) => `note: ${clean(note)}`),\n ...report.actions.map(\n (action) => `help: ${clean(action.title)} (${action.autofix ? \"autofix\" : \"suggestion\"})`,\n ),\n ...(docs ? [`docs: ${docs}`] : []),\n ];\n if (options.format === \"github\") {\n const location = report.primary.location;\n const properties: Record<string, string | number> = {\n file: file(location.uri),\n title: `project ${project + 1}: ${clean(report.code)}`,\n };\n if (report.primary.scope === \"range\") {\n properties.line = location.startLine + 1;\n properties.col = location.startColumn + 1;\n // GitHub annotation ends are inclusive; report ranges are exclusive.\n if (\n location.endColumn > 0 &&\n (location.endLine > location.startLine || location.endColumn > location.startColumn)\n ) {\n properties.endLine = location.endLine + 1;\n properties.endColumn = location.endColumn;\n } else if (location.endLine > location.startLine) {\n properties.endLine = location.endLine;\n }\n }\n lines.push(\n annotation(\n report.severity === \"error\" ? \"error\" : \"warning\",\n properties,\n [message, ...details].join(\"\\n\"),\n ),\n );\n } else {\n const severity = paint(\n report.severity,\n report.severity === \"error\" ? \"red\" : \"yellow\",\n color,\n );\n const tag = projectTag(project);\n lines.push(\n `${paint(linked(report.primary), \"bold\", color)}: ${severity} ${paint(clean(report.code), \"dim\", color)}${tag ? paint(tag, \"dim\", color) : \"\"}: ${message}`,\n );\n addFrame(report.primary);\n if (report.primary.message) {\n lines.push(` ${paint(\"note:\", \"cyan\", color)} ${clean(report.primary.message)}`);\n }\n for (const related of report.related) {\n lines.push(\n ` ${paint(\"related:\", \"cyan\", color)} ${linked(related)}${related.message ? `: ${clean(related.message)}` : \"\"}`,\n );\n addFrame(related);\n }\n lines.push(\n ...report.notes.map((note) => ` ${paint(\"note:\", \"cyan\", color)} ${clean(note)}`),\n );\n lines.push(\n ...report.actions.map(\n (action) =>\n ` ${paint(\"help:\", \"cyan\", color)} ${clean(action.title)} (${action.autofix ? \"autofix\" : \"suggestion\"})`,\n ),\n );\n if (docs) {\n lines.push(` ${paint(\"docs:\", \"dim\", color)} ${docs}`);\n }\n lines.push(\"\");\n }\n }\n if (options.format === \"text\" && result.summary.omittedDiagnostics > 0) {\n lines.push(\n `... ${count(result.summary.omittedDiagnostics, \"more diagnostic\")} omitted${options.limit === undefined ? \"\" : ` (--limit ${options.limit})`}.`,\n );\n lines.push(\"\");\n }\n for (const failure of result.failures) {\n lines.push(\n renderFailure(failure, projectTag(failure.project), options.format === \"github\", file, color),\n );\n }\n if (result.command === \"fmt\" || result.command === \"check\") {\n for (const changed of result.changed) {\n if (options.format === \"github\" && options.check) {\n lines.push(\n annotation(\n \"error\",\n { file: file(changed), title: \"Stillwind formatting\" },\n \"Stillwind utilities need sorting. Run stillwind fmt.\",\n ),\n );\n } else {\n const location = { uri: changed, startLine: 0, startColumn: 0 };\n const status =\n options.format !== \"text\"\n ? \"\"\n : options.check\n ? \": needs formatting\"\n : result.command === \"check\"\n ? \": updated\"\n : \": formatted\";\n lines.push(`${link(file(changed), location, hyperlinks)}${status}`);\n }\n }\n }\n if (result.command === \"inspect\") {\n for (const { project, location, css, valid, diagnostics, documentation } of result.previews) {\n const label = {\n scope: \"range\",\n location,\n } as Label;\n const tag = projectTag(project);\n lines.push(`${paint(linked(label), \"bold\", color)}${tag ? paint(tag, \"dim\", color) : \"\"}`);\n if (!valid && !diagnostics.length) {\n lines.push(` ${paint(\"error\", \"red\", color)}: CSS generation failed.`);\n }\n for (const { severity, code, message, docs } of diagnostics) {\n const renderedSeverity = paint(severity, severity === \"error\" ? \"red\" : \"yellow\", color);\n lines.push(` ${renderedSeverity} ${paint(clean(code), \"dim\", color)}: ${clean(message)}`);\n if (docs) {\n lines.push(` ${paint(\"docs:\", \"dim\", color)} ${clean(docs)}`);\n }\n }\n const body = clean([css, documentation].filter(Boolean).join(\"\\n\")).trimEnd();\n if (body) {\n lines.push(...body.split(\"\\n\").map((line) => (line ? ` ${line}` : \"\")));\n }\n lines.push(\"\");\n }\n if (!result.summary.previews && !result.summary.failures) {\n lines.push(\n result.emptyReason === \"line-out-of-range\"\n ? \"The requested line is outside the selected file.\"\n : result.emptyReason === \"column-out-of-range\"\n ? \"The requested column is outside the selected line.\"\n : result.emptyReason === \"no-match-at-position\"\n ? \"No Stillwind style call overlaps the requested position (the file has styles at another line or column).\"\n : \"The selected source contains no Stillwind style calls or generated CSS.\",\n );\n }\n }\n if (result.command === \"info\" && options.format === \"text\") {\n if (result.config) {\n lines.push(`config: ${file(result.config)}`);\n lines.push(\"\");\n }\n for (const info of result.projects) {\n lines.push(`project ${info.project + 1}${info.name ? ` (${clean(info.name)})` : \"\"}`);\n lines.push(` root: ${file(info.root)}`);\n lines.push(` css: ${file(info.css)}`);\n lines.push(` files: ${info.files.map(clean).join(\", \")}`);\n if (info.exclude.length) {\n lines.push(` exclude: ${info.exclude.map(clean).join(\", \")}`);\n }\n lines.push(` matched files: ${info.matchedFiles}`);\n if (info.plugins.length) {\n lines.push(` plugins: ${info.plugins.map(clean).join(\", \")}`);\n }\n if (info.hooks.length) {\n lines.push(` hooks: ${info.hooks.map(clean).join(\", \")}`);\n }\n lines.push(` sort: ${info.sort ? \"enabled\" : \"disabled\"}`);\n lines.push(` typeFacts: ${info.typeFacts ? \"enabled\" : \"disabled\"}`);\n const entries = Object.entries(info.lint);\n const denied = entries.filter(([, setting]) =>\n typeof setting === \"string\" ? setting === \"deny\" : setting.severity === \"deny\",\n ).length;\n const warned = entries.length - denied;\n lines.push(\n entries.length\n ? ` lint: ${count(entries.length, \"active rule\")} (${denied} deny, ${warned} warn)`\n : \" lint: disabled\",\n );\n for (const [rule, setting] of entries) {\n const severity = typeof setting === \"string\" ? setting : setting.severity;\n lines.push(` ${clean(rule)}: ${severity}`);\n }\n lines.push(\"\");\n }\n }\n const projects = new Set([...result.tokens, ...result.candidates].map(({ project }) => project));\n const tag = (project: number) => (projects.size > 1 ? ` [project ${project + 1}]` : \"\");\n for (const { project, name, value, resolvedValue, source } of result.tokens) {\n lines.push(\n `${clean(name)}: ${clean(value)}${resolvedValue ? ` /* ${clean(resolvedValue)} */` : \"\"}${source === \"default\" ? \" (default)\" : \"\"}${tag(project)}`,\n );\n }\n for (const { project, name, kind, valid, css, suggestion, canonical } of result.candidates) {\n if (valid) {\n const label = kind === \"marker\" ? \" (marker)\" : kind === \"pattern\" ? \" (pattern)\" : \"\";\n lines.push(`${clean(name)}${label}${tag(project)}`);\n if (css) {\n lines.push(\n ...clean(css)\n .trimEnd()\n .split(\"\\n\")\n .map((line) => (line ? ` ${line}` : \"\")),\n );\n }\n if (canonical) {\n lines.push(` help: The canonical spelling is ${clean(canonical)}.`);\n }\n if (css) {\n lines.push(\"\");\n }\n } else {\n lines.push(`${clean(name)}${tag(project)}: ${paint(`unknown ${kind}`, \"red\", color)}`);\n if (suggestion) {\n lines.push(` help: Did you mean ${clean(suggestion)}?`);\n }\n lines.push(\"\");\n }\n }\n for (const target of result.unmatched) {\n lines.push(`${clean(target)}: ${paint(\"no match\", \"red\", color)}`);\n }\n if (result.summary.warningLimitExceeded) {\n const message = `Warning count (${result.summary.warnings}) exceeds --max-warnings${options.maxWarnings === undefined ? \"\" : ` (${options.maxWarnings})`}.`;\n lines.push(\n options.format === \"github\"\n ? annotation(\"error\", { title: \"Stillwind warnings\" }, message)\n : `${paint(\"error\", \"red\", color)}: ${message}`,\n );\n }\n if (options.format === \"text\") {\n if (lines.length && lines.at(-1) !== \"\") {\n lines.push(\"\");\n }\n const { summary } = result;\n lines.push(\n result.command === \"info\"\n ? `${count(summary.projects, \"project\")}${summary.failures ? `; ${count(summary.failures, \"execution failure\")}` : \"\"}.`\n : isDesignCommand(result.command)\n ? `${result.command === \"theme\" ? count(summary.tokens, \"token\") : count(summary.candidates, result.command === \"variants\" ? \"variant\" : \"utility\").replace(\"utilitys\", \"utilities\")}${summary.invalidCandidates ? `; ${summary.invalidCandidates} unknown` : \"\"}${summary.unmatched ? `; ${count(summary.unmatched, \"unmatched target\")}` : \"\"}${summary.failures ? `; ${count(summary.failures, \"execution failure\")}` : \"\"}.`\n : result.command === \"inspect\"\n ? `${count(summary.previews, \"preview\")} in ${count(summary.files, \"file\")}${summary.invalidPreviews ? `; ${summary.invalidPreviews} failed to generate CSS` : \"\"}${summary.failures ? `; ${count(summary.failures, \"execution failure\")}` : \"\"}.`\n : result.command === \"fmt\" && !summary.failures\n ? options.check\n ? summary.changed\n ? `${count(summary.changed, \"file\")} ${summary.changed === 1 ? \"needs\" : \"need\"} formatting.`\n : `All selected files are formatted (${summary.files} checked).`\n : `Formatted ${count(summary.changed, \"file\")} (${summary.files} checked).`\n : result.command === \"check\"\n ? `${count(summary.errors, \"error\")}, ${count(summary.warnings, \"warning\")} in ${count(summary.files, \"file\")}${summary.changed ? (options.check ? `; ${count(summary.changed, \"file\")} ${summary.changed === 1 ? \"needs\" : \"need\"} formatting` : `; updated ${count(summary.changed, \"file\")}`) : \"\"}${summary.failures ? `; ${count(summary.failures, \"execution failure\")}` : \"\"}.`\n : `${count(summary.errors, \"error\")}, ${count(summary.warnings, \"warning\")} in ${count(summary.files, \"file\")}${summary.failures ? `; ${count(summary.failures, \"execution failure\")}` : \"\"}.`,\n );\n const autofixable = result.summary.autofixable;\n const manualSuggestions = result.summary.suggestions;\n if ((result.command === \"lint\" || result.command === \"check\") && autofixable) {\n lines.push(\n result.command === \"check\"\n ? `help: Automatic fixes are available for ${count(autofixable, \"diagnostic\")}. Run stillwind check --fix to apply automatic fixes and sort utilities.`\n : `help: Automatic fixes are available for ${count(autofixable, \"diagnostic\")}. Run stillwind lint --fix to apply automatic fixes.`,\n );\n } else if ((result.command === \"lint\" || result.command === \"check\") && manualSuggestions) {\n lines.push(\n `help: Manual suggestions are available for ${count(manualSuggestions, \"diagnostic\")}. Review them in the source; --fix does not apply them automatically.`,\n );\n }\n }\n return lines.join(\"\\n\");\n}\n\n/** Writes text execution failures to stderr and command results to stdout. */\nexport async function writeResult(result: CliResult, options: OutputOptions): Promise<void> {\n const stderr = options.format === \"text\" && result.failures.length > 0;\n const frames =\n options.format === \"text\" && result.diagnostics.length\n ? new (await import(\"./source-frame.ts\")).SourceFrames()\n : undefined;\n const output = renderResult(result, options, stderr, frames);\n if (output) {\n (stderr ? process.stderr : process.stdout).write(output + \"\\n\");\n }\n}\n\nfunction renderFailure(\n failure: CliFailure,\n project: string,\n github: boolean,\n file: (uri: string) => string,\n color: boolean,\n): string {\n const details = failure.details.map((detail) => `${file(detail.file)}: ${clean(detail.message)}`);\n return github\n ? annotation(\n \"error\",\n { ...(failure.file ? { file: file(failure.file) } : {}), title: `Stillwind${project}` },\n [clean(failure.message), ...details].join(\"\\n\"),\n )\n : `${failure.file ? `${file(failure.file)}: ` : \"\"}${paint(\"error\", \"red\", color)}${project}: ${clean(failure.message)}${details.length ? `\\n ${details.join(\"\\n \")}` : \"\"}`;\n}\n\nfunction count(value: number, noun: string): string {\n return `${value} ${noun}${value === 1 ? \"\" : \"s\"}`;\n}\n\nfunction paint(\n text: string,\n color: \"red\" | \"yellow\" | \"cyan\" | \"dim\" | \"bold\",\n enabled: boolean,\n): string {\n return enabled ? styleText(color, text, { validateStream: false }) : text;\n}\n\nfunction clean(text: string): string {\n return stripVTControlCharacters(text).replace(/\\p{Cc}/gu, (character) =>\n character === \"\\n\" || character === \"\\r\" || character === \"\\t\" ? character : \"\",\n );\n}\n\nfunction sourcePath(uri: string): string {\n try {\n return uri.startsWith(\"file:\") ? fileURLToPath(uri) : uri;\n } catch {\n return uri;\n }\n}\n\nexport function displayPath(uri: string, cwd: string): string {\n const file = sourcePath(uri);\n return clean(path.isAbsolute(file) ? path.relative(cwd, file) || \".\" : file);\n}\n\nfunction link(\n label: string,\n location: Pick<Location, \"uri\" | \"startLine\" | \"startColumn\">,\n enabled: boolean,\n): string {\n const file = sourcePath(location.uri);\n if (!enabled || !path.isAbsolute(file)) {\n return label;\n }\n const url = pathToFileURL(file);\n url.hash = `L${location.startLine + 1}:${location.startColumn + 1}`;\n return `\\u001b]8;;${url.href}\\u001b\\\\${label}\\u001b]8;;\\u001b\\\\`;\n}\n\nexport function annotation(\n level: \"error\" | \"warning\",\n properties: Record<string, string | number>,\n message: string,\n): string {\n const escapeData = (value: string): string =>\n clean(value).replace(/%/g, \"%25\").replace(/\\r/g, \"%0D\").replace(/\\n/g, \"%0A\");\n const fields = Object.entries(properties)\n .map(\n ([key, value]) =>\n `${key}=${escapeData(String(value)).replace(/:/g, \"%3A\").replace(/,/g, \"%2C\")}`,\n )\n .join(\",\");\n return `::${level}${fields ? ` ${fields}` : \"\"}::${escapeData(message)}`;\n}\n","import process from \"node:process\";\nimport { stripVTControlCharacters, styleText } from \"node:util\";\n\nimport type { DesignSystemRequest, DesignTokenSource } from \"@stillwind/analysis\";\nimport { defineCommand, renderUsage, runCommand, type ArgsDef, type CommandDef } from \"citty\";\n\nimport packageJson from \"../package.json\" with { type: \"json\" };\nimport {\n builtinArgs,\n configArgs,\n nonNegativeInteger,\n outputArgs,\n parseInvocation,\n readOutputOptions,\n strictArguments,\n targetArgs,\n warningArgs,\n warningLimit,\n} from \"./arguments.ts\";\nimport { displayEnabled, writeResult, type OutputFormat, type OutputOptions } from \"./output.ts\";\nimport { cliResult, failureResult, type CliCommand, type DesignCommand } from \"./result.ts\";\n\nconst checkArgs = {\n ...targetArgs,\n ...warningArgs,\n fix: {\n type: \"boolean\",\n description: \"Apply automatic fixes and sort utilities\",\n },\n} as const;\n\nconst fmtArgs = {\n ...targetArgs,\n format: {\n ...outputArgs.format,\n options: [\"text\", \"json\", \"github\", \"files\"] as OutputFormat[],\n description: \"Output format (text, json, github, or files)\",\n },\n check: {\n type: \"boolean\",\n description: \"Check formatting without saving files\",\n },\n} as const;\n\nconst lintArgs = {\n ...targetArgs,\n ...warningArgs,\n fix: {\n type: \"boolean\",\n description: \"Apply automatic fixes\",\n },\n} as const;\n\nconst inspectArgs = {\n ...targetArgs,\n globs: {\n ...targetArgs.globs,\n description: \"Select files with paths or globs, optionally followed by :line or :line:column\",\n },\n} as const;\n\nconst designArgs = {\n ...configArgs,\n ...outputArgs,\n} as const;\n\nconst themeArgs = {\n ...designArgs,\n names: {\n type: \"positional\",\n required: false,\n description: \"Select tokens by name without the leading --, where * matches any text\",\n },\n source: {\n type: \"enum\",\n options: [\"project\", \"default\"] as DesignTokenSource[],\n description: \"Show only the tokens with this origin\",\n },\n} as const;\n\nconst candidateArgs = {\n ...designArgs,\n names: {\n type: \"positional\",\n required: false,\n description: \"Check exact names, or search with * patterns\",\n },\n \"names-only\": {\n type: \"boolean\",\n description: \"List matching names without CSS previews\",\n },\n} as const;\n\nconst lspArgs = {\n ...configArgs,\n stdio: {\n type: \"boolean\",\n required: true,\n description: \"Use the Language Server Protocol over stdin/stdout\",\n },\n} as const;\n\nconst subCommands = {\n check: defineCommand({\n meta: {\n name: \"check\",\n description: \"Check Stillwind lint and utility sorting\",\n },\n args: checkArgs,\n plugins: [strictArguments],\n async run({ args, data }) {\n const options = data as OutputOptions;\n const maxWarnings = warningLimit(args[\"max-warnings\"]);\n const limit = nonNegativeInteger(args.limit, \"--limit\");\n options.check = !args.fix;\n options.quiet = args.quiet;\n options.maxWarnings = maxWarnings;\n options.limit = limit;\n const { check } = await import(\"@stillwind/analysis/node\");\n const analysis = await check({\n config: args.config,\n cwd: options.cwd,\n patterns: args._,\n fix: args.fix,\n });\n const result = cliResult(\"check\", analysis, {\n check: !args.fix,\n quiet: args.quiet,\n maxWarnings,\n limit,\n cwd: options.cwd,\n });\n await writeResult(result, options);\n process.exitCode = result.exitCode;\n },\n }),\n fmt: defineCommand({\n meta: {\n name: \"fmt\",\n description: \"Sort Stillwind utilities\",\n },\n args: fmtArgs,\n plugins: [strictArguments],\n async run({ args, data }) {\n const options = data as OutputOptions;\n options.check = args.check;\n const { format } = await import(\"@stillwind/analysis/node\");\n const analysis = await format({\n config: args.config,\n cwd: options.cwd,\n patterns: args._,\n check: args.check,\n });\n const result = cliResult(\"fmt\", analysis, {\n check: args.check,\n cwd: options.cwd,\n });\n await writeResult(result, options);\n process.exitCode = result.exitCode;\n },\n }),\n lint: defineCommand({\n meta: {\n name: \"lint\",\n description: \"Check Stillwind styles\",\n },\n args: lintArgs,\n plugins: [strictArguments],\n async run({ args, data }) {\n const options = data as OutputOptions;\n const maxWarnings = warningLimit(args[\"max-warnings\"]);\n const limit = nonNegativeInteger(args.limit, \"--limit\");\n options.quiet = args.quiet;\n options.maxWarnings = maxWarnings;\n options.limit = limit;\n const { lint } = await import(\"@stillwind/analysis/node\");\n const analysis = await lint({\n config: args.config,\n cwd: options.cwd,\n patterns: args._,\n fix: args.fix,\n });\n const result = cliResult(\"lint\", analysis, {\n quiet: args.quiet,\n maxWarnings,\n limit,\n cwd: options.cwd,\n });\n await writeResult(result, options);\n process.exitCode = result.exitCode;\n },\n }),\n inspect: defineCommand({\n meta: {\n name: \"inspect\",\n description: \"Show the CSS that Stillwind generates for source code\",\n },\n args: inspectArgs,\n plugins: [strictArguments],\n async run({ args, data }) {\n const options = data as OutputOptions;\n const { inspect } = await import(\"@stillwind/analysis/node\");\n const analysis = await inspect({\n config: args.config,\n cwd: options.cwd,\n targets: args._,\n });\n const result = cliResult(\"inspect\", analysis, {\n cwd: options.cwd,\n });\n await writeResult(result, options);\n process.exitCode = result.exitCode;\n },\n }),\n info: defineCommand({\n meta: {\n name: \"info\",\n description: \"Show the resolved project configuration\",\n },\n args: designArgs,\n plugins: [strictArguments],\n async run({ args, data }) {\n if (args._.length) {\n throw new Error(\"info accepts no positional arguments\");\n }\n const options = data as OutputOptions;\n const { info } = await import(\"@stillwind/analysis/node\");\n const resolved = await info({\n config: args.config,\n cwd: options.cwd,\n });\n const result = cliResult(\"info\", {\n ...resolved,\n results: [],\n });\n await writeResult(result, options);\n process.exitCode = result.exitCode;\n },\n }),\n theme: defineCommand({\n meta: {\n name: \"theme\",\n description: \"List the theme tokens of the project\",\n },\n args: themeArgs,\n plugins: [strictArguments],\n async run({ args, data }) {\n await runDesignCommand(\"theme\", data as OutputOptions, args.config, {\n kind: \"theme\",\n targets: args._,\n source: args.source,\n });\n },\n }),\n utilities: defineCommand({\n meta: {\n name: \"utilities\",\n description: \"Check or search the utilities of the project\",\n },\n args: candidateArgs,\n plugins: [strictArguments],\n async run({ args, data }) {\n await runDesignCommand(\"utilities\", data as OutputOptions, args.config, {\n kind: \"utilities\",\n targets: args._,\n namesOnly: args[\"names-only\"],\n });\n },\n }),\n variants: defineCommand({\n meta: {\n name: \"variants\",\n description: \"Check or search the variants of the project\",\n },\n args: candidateArgs,\n plugins: [strictArguments],\n async run({ args, data }) {\n await runDesignCommand(\"variants\", data as OutputOptions, args.config, {\n kind: \"variants\",\n targets: args._,\n namesOnly: args[\"names-only\"],\n });\n },\n }),\n lsp: defineCommand({\n meta: {\n name: \"lsp\",\n description: \"Start the language server\",\n },\n args: lspArgs,\n plugins: [strictArguments],\n async run({ args }) {\n if (!args.stdio || args._.length) {\n throw new Error(\"lsp requires --stdio and accepts no positional arguments\");\n }\n const { startLanguageServer } = await import(\"@stillwind/language-server/node\");\n startLanguageServer(args.config);\n },\n }),\n};\n\nasync function runDesignCommand(\n name: DesignCommand,\n options: OutputOptions,\n config: string | undefined,\n request: DesignSystemRequest,\n): Promise<void> {\n const { designSystem } = await import(\"@stillwind/analysis/node\");\n const answer = await designSystem({ config, cwd: options.cwd }, request);\n const result = cliResult(name, { ...answer, results: [] });\n await writeResult(result, options);\n process.exitCode = result.exitCode;\n}\n\nexport const command = defineCommand({\n meta: {\n name: \"stillwind\",\n version: packageJson.version,\n description: \"Sort, check, and inspect Stillwind styles\",\n },\n args: {\n ...configArgs,\n ...outputArgs,\n ...builtinArgs,\n },\n subCommands,\n});\n\nexport async function runCli(rawArgs = process.argv.slice(2)): Promise<void> {\n const options: OutputOptions = {\n format: outputArgs.format.default,\n color: \"auto\",\n hyperlinks: \"auto\",\n cwd: process.cwd(),\n };\n let name: CliCommand = null;\n\n try {\n const invocation = parseInvocation(rawArgs, {\n ...checkArgs,\n ...fmtArgs,\n ...lintArgs,\n ...inspectArgs,\n ...themeArgs,\n ...candidateArgs,\n ...lspArgs,\n });\n name =\n invocation.name === \"check\" ||\n invocation.name === \"fmt\" ||\n invocation.name === \"lint\" ||\n invocation.name === \"inspect\" ||\n invocation.name === \"info\" ||\n invocation.name === \"theme\" ||\n invocation.name === \"utilities\" ||\n invocation.name === \"variants\"\n ? invocation.name\n : null;\n if (invocation.name === \"lsp\") {\n options.format = \"text\";\n } else {\n readOutputOptions(rawArgs, options);\n }\n if (invocation.name && !Object.hasOwn(subCommands, invocation.name)) {\n throw new Error(\n `Unknown command: ${invocation.name}. Expected one of: check, fmt, lint, inspect, info, theme, utilities, variants, or lsp. Run stillwind --help for usage.`,\n );\n }\n\n if (!rawArgs.length || invocation.help) {\n const sub = subCommands[invocation.name as keyof typeof subCommands];\n const subject = sub ?? command;\n const usage = await renderUsage<ArgsDef>(\n {\n meta: subject.meta,\n args: subject.args,\n subCommands: subject.subCommands,\n },\n sub\n ? {\n meta: command.meta,\n }\n : undefined,\n );\n write(displayUsage(usage, options));\n } else if (rawArgs.length === 1 && invocation.version) {\n write(packageJson.version);\n } else {\n if (invocation.version) {\n throw new Error(\"--version must be used without a command\");\n }\n if (!invocation.name) {\n throw new Error(\n \"A command is required: check, fmt, lint, inspect, info, theme, utilities, variants, or lsp\",\n );\n }\n await runCommand(subCommands[invocation.name as keyof typeof subCommands] as CommandDef, {\n rawArgs: invocation.rawArgs,\n data: options,\n });\n }\n } catch (error) {\n const result = failureResult(name, error, options);\n await writeResult(\n result,\n options.format === \"files\" ? { ...options, format: \"text\" } : options,\n );\n process.exitCode = 2;\n }\n}\n\nfunction write(output: string): void {\n if (output) {\n process.stdout.write(output + \"\\n\");\n }\n}\n\nfunction displayUsage(usage: string, options: OutputOptions): string {\n const plain = stripVTControlCharacters(usage);\n if (!displayEnabled(options.color, \"color\", !!process.stdout.isTTY, process.env)) {\n return plain;\n }\n const style = (format: Parameters<typeof styleText>[0], text: string) =>\n styleText(format, text, { validateStream: false });\n return plain\n .split(\"\\n\")\n .map((line, index) => {\n if (index === 0 && line.trim()) {\n return style([\"bold\", \"cyan\"], line);\n }\n if (/^[A-Z][A-Z0-9 /_-]*$/.test(line.trim())) {\n return style(\"bold\", line);\n }\n const entry = /^(\\s+)(\\S+(?:,\\s*\\S+)*(?:\\s+<[^>]+>|\\s+\\[[^\\]]+\\])?)(\\s{2,})(.*)$/.exec(line);\n if (entry) {\n return `${entry[1]}${style(\"cyan\", entry[2])}${entry[3]}${entry[4]}`;\n }\n return line;\n })\n .join(\"\\n\");\n}\n","#!/usr/bin/env node\n\nimport { runCli } from \"./commands.ts\";\n\nawait runCli();\n"],"mappings":";;;;;;;;;;;;ACOA,MAAa,aAAa,EACxB,QAAQ;CACN,MAAM;CACN,OAAO;CACP,aAAa;CACb,WAAW;AACb,EACF;AAEA,MAAa,aAAa;CACxB,QAAQ;EACN,MAAM;EACN,SAAS;GAAC;GAAQ;GAAQ;EAAQ;EAClC,SAAS,QAAQ,IAAI,mBAAmB,SAAS,WAAW;EAC5D,aAAa;CACf;CACA,OAAO;EACL,MAAM;EACN,SAAS;GAAC;GAAQ;GAAU;EAAO;EACnC,SAAS;EACT,aAAa;CACf;CACA,YAAY;EACV,MAAM;EACN,SAAS;GAAC;GAAQ;GAAU;EAAO;EACnC,SAAS;EACT,aAAa;CACf;AACF;AAEA,MAAM,eAAe;CACnB,GAAG,WAAW;CACd,SAAS;EAAC;EAAQ;EAAQ;EAAU;CAAO;CAC3C,aAAa;AACf;AAEA,MAAa,aAAa;CACxB,GAAG;CACH,GAAG;CACH,OAAO;EACL,MAAM;EACN,UAAU;EACV,aAAa;CACf;AACF;AAEA,MAAa,cAAc;CACzB,OAAO;EACL,MAAM;EACN,aAAa;CACf;CACA,gBAAgB;EACd,MAAM;EACN,aAAa;EACb,WAAW;CACb;CACA,OAAO;EACL,MAAM;EACN,aAAa;EACb,WAAW;CACb;AACF;AAEA,SAAgB,mBAAmB,OAA2B,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AAQ,WAAW;CACrB;AACF;AAEA,SAAS,MAAM,QAAsB;CACnC,IAAI,QACF,QAAQ,OAAO,MAAM,SAAS,IAAI;AAEtC;AAEA,SAAS,aAAa,OAAe,SAAgC;CACnE,MAAM,QAAQ,yBAAyB,KAAK;CAC5C,IAAI,CAAC,eAAe,QAAQ,OAAO,SAAS,CAAC,CAAC,QAAQ,OAAO,OAAO,QAAQ,GAAG,GAC7E,OAAO;CAET,MAAM,SAAS,QAAyC,SACtD,UAAU,QAAQ,MAAM,EAAE,gBAAgB,MAAM,CAAC;CACnD,OAAO,MACJ,MAAM,IAAI,CAAC,CACX,KAAK,MAAM,UAAU;EACpB,IAAI,UAAU,KAAK,KAAK,KAAK,GAC3B,OAAO,MAAM,CAAC,QAAQ,MAAM,GAAG,IAAI;EAErC,IAAI,uBAAuB,KAAK,KAAK,KAAK,CAAC,GACzC,OAAO,MAAM,QAAQ,IAAI;EAE3B,MAAM,QAAQ,oEAAoE,KAAK,IAAI;EAC3F,IAAI,OACF,OAAO,GAAG,MAAM,KAAK,MAAM,QAAQ,MAAM,EAAE,IAAI,MAAM,KAAK,MAAM;EAElE,OAAO;CACT,CAAC,CAAC,CACD,KAAK,IAAI;AACd;;ACpbA,MAAM,OAAO"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@stillwind/cli",
3
- "version": "0.11.0",
3
+ "version": "0.13.0",
4
4
  "description": "Stillwind CLI to sort, lint, and fix utilities, inspect generated CSS, and query the design system",
5
5
  "keywords": [
6
6
  "ci",
@@ -46,9 +46,9 @@
46
46
  },
47
47
  "dependencies": {
48
48
  "@babel/code-frame": "^8.0.6",
49
- "@stillwind/analysis": "0.11.0",
50
- "@stillwind/language-server": "0.11.0",
51
- "@stillwind/native": "0.11.0",
49
+ "@stillwind/analysis": "0.13.0",
50
+ "@stillwind/language-server": "0.13.0",
51
+ "@stillwind/native": "0.13.0",
52
52
  "citty": "^0.2.2",
53
53
  "string-width": "^8.3.0"
54
54
  },
@@ -57,6 +57,6 @@
57
57
  "@types/babel__code-frame": "^7.27.0",
58
58
  "@types/node": "^26.6.6",
59
59
  "typescript": "^6.0.3",
60
- "vite-plus": "1.6.0"
60
+ "vite-plus": "1.8.0"
61
61
  }
62
62
  }