@stillwind/cli 0.0.0-stage → 0.1.0-rc.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/LICENSE ADDED
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) Stillwind contributors
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
package/README.md CHANGED
@@ -1,3 +1,63 @@
1
- # Temporary Holding Version
1
+ # Stillwind CLI
2
2
 
3
- This version is a temporary placeholder for this package. An operational version to replace this has been submitted for review and is awaiting a staged release.
3
+ Stillwind compiles Tailwind CSS v4 utilities into component props and static CSS.
4
+ It uses theme rules and compiler checks to keep styling code in order, even when
5
+ AI agents write much of it.
6
+
7
+ `@stillwind/cli` is Stillwind's command-line interface for sorting, linting,
8
+ automatic fixes, and CI checks. It uses the same project configuration as the
9
+ build integration and editor.
10
+
11
+ ## Install
12
+
13
+ ```sh
14
+ vp i -D @stillwind/cli
15
+ ```
16
+
17
+ Create a [Stillwind project configuration](https://stillwind.dev/docs/configuration)
18
+ before running commands. The CLI searches upward from the working directory for
19
+ `stillwind.config.*`. Use `--config path` to select another file.
20
+
21
+ ## Commands
22
+
23
+ ```sh
24
+ stillwind fmt
25
+ stillwind lint
26
+ stillwind lint --fix
27
+ ```
28
+
29
+ `fmt` sorts utility inputs and preserves source layout and token spellings. Run a
30
+ general formatter afterward, or use
31
+ [prettier-plugin-stillwind](https://github.com/SegaraRai/stillwind/blob/main/packages/prettier-plugin/README.md).
32
+ `lint` reports findings; `lint --fix` applies enabled automatic fixes. Only changed
33
+ files are saved.
34
+
35
+ Optional file patterns narrow the configured project scopes:
36
+
37
+ ```sh
38
+ stillwind lint 'src/**/*.tsx'
39
+ ```
40
+
41
+ ## CI and machine-readable output
42
+
43
+ ```sh
44
+ stillwind fmt --check
45
+ stillwind lint --max-warnings 0
46
+ stillwind lint --format json
47
+ ```
48
+
49
+ `fmt --check` and `lint` do not save sources. JSON and GitHub annotations use stdout;
50
+ configuration logs use stderr. GitHub annotations are the default in GitHub Actions.
51
+
52
+ | Exit code | Meaning |
53
+ | --------- | -------------------------------------------------------------------------------------------------------------------- |
54
+ | `0` | Formatting succeeded, formatting check found no changes, or lint found no errors and stayed within any warning limit |
55
+ | `1` | Formatting changes are required, lint found errors, or the warning limit was exceeded |
56
+ | `2` | Invalid options, failed configuration/analysis/planning/I/O, or no matching targets |
57
+
58
+ Warnings alone return `0` when no limit is set. `stillwind --help` lists commands;
59
+ `stillwind <command> --help` lists options. `stillwind lsp --stdio` starts the
60
+ language server for clients using the Language Server Protocol.
61
+
62
+ See the [CLI reference](https://github.com/SegaraRai/stillwind/blob/main/docs/cli.md)
63
+ for configuration discovery, saving guarantees, output formats, and the JSON schema.
@@ -0,0 +1,2 @@
1
+ import { FormatResult, LintResult, format, formatLint, lint } from "@stillwind/analysis/node";
2
+ export { type FormatResult, type LintResult, format, formatLint, lint };
package/dist/index.js ADDED
@@ -0,0 +1 @@
1
+ export { format, formatLint, lint } from "@stillwind/analysis/node";
package/dist/main.d.ts ADDED
@@ -0,0 +1 @@
1
+ export {}
package/dist/main.js ADDED
@@ -0,0 +1,508 @@
1
+ #!/usr/bin/env node
2
+ import process from "node:process";
3
+ import { parseArgs, stripVTControlCharacters, styleText } from "node:util";
4
+ import { defineCittyPlugin, defineCommand, parseArgs as parseArgs$1, renderUsage, runCommand } from "citty";
5
+ import path from "node:path";
6
+ import { fileURLToPath, pathToFileURL } from "node:url";
7
+ import { lintReports } from "@stillwind/analysis";
8
+ // package.json
9
+ var version = "0.1.0-rc.0";
10
+ // src/arguments.ts
11
+ const configArgs = { config: {
12
+ type: "string",
13
+ alias: "c",
14
+ description: "Use this configuration file",
15
+ valueHint: "path"
16
+ } };
17
+ const outputArgs = {
18
+ format: {
19
+ type: "enum",
20
+ options: [
21
+ "text",
22
+ "json",
23
+ "github",
24
+ "files"
25
+ ],
26
+ default: process.env.GITHUB_ACTIONS === "true" ? "github" : "text",
27
+ description: "Output format"
28
+ },
29
+ color: {
30
+ type: "enum",
31
+ options: [
32
+ "auto",
33
+ "always",
34
+ "never"
35
+ ],
36
+ default: "auto",
37
+ description: "Control terminal colors"
38
+ },
39
+ hyperlinks: {
40
+ type: "enum",
41
+ options: [
42
+ "auto",
43
+ "always",
44
+ "never"
45
+ ],
46
+ default: "auto",
47
+ description: "Control links to source locations"
48
+ }
49
+ };
50
+ const targetArgs = {
51
+ ...configArgs,
52
+ ...outputArgs,
53
+ globs: {
54
+ type: "positional",
55
+ required: false,
56
+ description: "Filter configured targets with one or more globs"
57
+ }
58
+ };
59
+ const warningArgs = {
60
+ quiet: {
61
+ type: "boolean",
62
+ description: "Hide lint warnings while retaining their counts"
63
+ },
64
+ "max-warnings": {
65
+ type: "string",
66
+ description: "Fail when the warning count exceeds this non-negative integer",
67
+ valueHint: "count"
68
+ }
69
+ };
70
+ function warningLimit(value) {
71
+ if (value === void 0) return;
72
+ if (!/^\d+$/.test(value) || !Number.isSafeInteger(Number(value))) throw new Error("Invalid value for --max-warnings: expected a non-negative integer");
73
+ return Number(value);
74
+ }
75
+ const builtinArgs = {
76
+ help: {
77
+ type: "boolean",
78
+ alias: "h",
79
+ description: "Show usage"
80
+ },
81
+ version: {
82
+ type: "boolean",
83
+ alias: "v",
84
+ description: "Show version"
85
+ }
86
+ };
87
+ /**
88
+ * Updates display options using citty's enum validation and defaults.
89
+ * A valid format is retained if a later display option fails, so the error uses the requested format.
90
+ */
91
+ function readOutputOptions(rawArgs, options) {
92
+ options.format = parseArgs$1(rawArgs, { format: outputArgs.format }).format;
93
+ const { color, hyperlinks } = parseArgs$1(rawArgs, outputArgs);
94
+ options.color = color;
95
+ options.hyperlinks = hyperlinks;
96
+ }
97
+ /** Rejects unknown named options and empty string options that citty otherwise accepts. */
98
+ const strictArguments = defineCittyPlugin({
99
+ name: "strict-arguments",
100
+ async setup({ args, cmd }) {
101
+ const definitions = await (typeof cmd.args === "function" ? cmd.args() : cmd.args) ?? {};
102
+ const names = /* @__PURE__ */ new Set(["_", ...Object.keys(definitions).flatMap((name) => [name, name.replace(/-([a-z])/g, (_, letter) => letter.toUpperCase())])]);
103
+ for (const definition of Object.values(definitions)) if ("alias" in definition) for (const alias of [definition.alias ?? []].flat()) names.add(alias);
104
+ for (const name of Object.keys(args)) if (!names.has(name)) throw new Error(`Unknown option: --${name}`);
105
+ 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}`);
106
+ }
107
+ });
108
+ /**
109
+ * Locates the command without mistaking an option's value for it.
110
+ * Keeps options before the command and removes help/version flags handled by the entrypoint.
111
+ */
112
+ function parseInvocation(rawArgs, definitions) {
113
+ const combined = {
114
+ ...definitions,
115
+ ...builtinArgs
116
+ };
117
+ const options = {};
118
+ for (const [name, definition] of Object.entries(combined)) {
119
+ if (definition.type === "positional") continue;
120
+ options[name] = { type: definition.type === "boolean" ? "boolean" : "string" };
121
+ if ("alias" in definition && typeof definition.alias === "string") options[name].short = definition.alias;
122
+ }
123
+ const { tokens } = parseArgs({
124
+ args: rawArgs,
125
+ options,
126
+ strict: false,
127
+ allowPositionals: true,
128
+ allowNegative: true,
129
+ tokens: true
130
+ });
131
+ const first = tokens.find((token) => token.kind === "positional" || token.kind === "option-terminator");
132
+ const commandIndex = first?.kind === "positional" ? first.index : void 0;
133
+ const builtinTokens = tokens.filter((token) => token.kind === "option" && ["help", "version"].includes(token.name));
134
+ const flags = parseArgs$1(builtinTokens.map((token) => rawArgs[token.index]), builtinArgs);
135
+ const omitted = new Set(builtinTokens.map((token) => token.index));
136
+ if (commandIndex !== void 0) omitted.add(commandIndex);
137
+ return {
138
+ name: commandIndex === void 0 ? void 0 : rawArgs[commandIndex],
139
+ rawArgs: rawArgs.filter((_, index) => !omitted.has(index)),
140
+ help: flags.help,
141
+ version: flags.version
142
+ };
143
+ }
144
+ // src/output.ts
145
+ function displayEnabled(mode, kind, tty, env) {
146
+ if (mode !== "auto") return mode === "always";
147
+ if (kind === "color") {
148
+ if (env.NO_COLOR !== void 0 || env.FORCE_COLOR === "0") return false;
149
+ if (env.FORCE_COLOR !== void 0) return true;
150
+ return env.TERM !== "dumb" && (tty || env.GITHUB_ACTIONS === "true" || env.GITLAB_CI === "true");
151
+ }
152
+ return tty && !env.CI && env.TERM !== "dumb" && (env.TERM_PROGRAM === "vscode" || env.TERM_PROGRAM === "iTerm.app" || env.WT_SESSION !== void 0 || env.VTE_VERSION !== void 0 || env.TERM === "xterm-kitty");
153
+ }
154
+ /** Renders one CLI result independently of the original analysis graph. */
155
+ function renderResult(result, options, stderr = false, frames) {
156
+ if (options.format === "json") return JSON.stringify(result);
157
+ const root = options.format === "github" ? process.env.GITHUB_WORKSPACE ?? options.cwd ?? process.cwd() : options.cwd ?? process.cwd();
158
+ const file = (uri) => {
159
+ const displayed = displayPath(uri, root);
160
+ return options.format === "github" ? displayed.replaceAll("\\", "/") : displayed;
161
+ };
162
+ if (options.format === "files") return result.changed.map(file).join("\n");
163
+ const tty = !!(stderr ? process.stderr : process.stdout).isTTY;
164
+ const color = options.format === "text" && displayEnabled(options.color, "color", tty, process.env);
165
+ const hyperlinks = options.format === "text" && displayEnabled(options.hyperlinks, "hyperlinks", tty, process.env);
166
+ const at = (label) => label.scope === "document" ? file(label.location.uri) : `${file(label.location.uri)}:${label.location.startLine + 1}:${label.location.startColumn + 1}`;
167
+ const linked = (label) => link(at(label), label.location, hyperlinks);
168
+ const addFrame = (label) => {
169
+ const frame = frames?.render(label);
170
+ if (frame) lines.push(...frame.split("\n").map((line) => ` ${line}`));
171
+ };
172
+ const lines = [];
173
+ for (const { project, report } of result.diagnostics) {
174
+ const message = clean(report.message);
175
+ const details = [
176
+ ...report.primary.message ? [`note: ${clean(report.primary.message)}`] : [],
177
+ ...report.related.map((label) => `related: ${at(label)}${label.message ? `: ${clean(label.message)}` : ""}`),
178
+ ...report.notes.map((note) => `note: ${clean(note)}`),
179
+ ...report.actions.map((action) => `help: ${clean(action.title)}`)
180
+ ];
181
+ if (options.format === "github") {
182
+ const location = report.primary.location;
183
+ const properties = {
184
+ file: file(location.uri),
185
+ title: `project ${project + 1}: ${clean(report.code)}`
186
+ };
187
+ if (report.primary.scope === "range") {
188
+ properties.line = location.startLine + 1;
189
+ properties.col = location.startColumn + 1;
190
+ if (location.endColumn > 0 && (location.endLine > location.startLine || location.endColumn > location.startColumn)) {
191
+ properties.endLine = location.endLine + 1;
192
+ properties.endColumn = location.endColumn;
193
+ } else if (location.endLine > location.startLine) properties.endLine = location.endLine;
194
+ }
195
+ lines.push(annotation(report.severity === "error" ? "error" : "warning", properties, [message, ...details].join("\n")));
196
+ } else {
197
+ const severity = paint(report.severity, report.severity === "error" ? "red" : "yellow", color);
198
+ lines.push(`${linked(report.primary)}: ${severity} ${clean(report.code)} [project ${project + 1}]: ${message}`);
199
+ addFrame(report.primary);
200
+ if (report.primary.message) lines.push(` note: ${clean(report.primary.message)}`);
201
+ for (const related of report.related) {
202
+ lines.push(` related: ${linked(related)}${related.message ? `: ${clean(related.message)}` : ""}`);
203
+ addFrame(related);
204
+ }
205
+ lines.push(...report.notes.map((note) => ` note: ${clean(note)}`));
206
+ lines.push(...report.actions.map((action) => ` help: ${clean(action.title)}`));
207
+ lines.push("");
208
+ }
209
+ }
210
+ for (const failure of result.failures) lines.push(renderFailure(failure, options.format === "github", file, color));
211
+ if (result.command === "fmt") for (const changed of result.changed) if (options.format === "github" && options.check) lines.push(annotation("error", {
212
+ file: file(changed),
213
+ title: "Stillwind formatting"
214
+ }, "Stillwind utilities need sorting. Run stillwind fmt."));
215
+ else {
216
+ const location = {
217
+ uri: changed,
218
+ startLine: 0,
219
+ startColumn: 0
220
+ };
221
+ lines.push(`${link(file(changed), location, hyperlinks)}${options.format === "text" ? options.check ? ": needs formatting" : ": formatted" : ""}`);
222
+ }
223
+ if (result.summary.warningLimitExceeded) {
224
+ const message = `Warning count (${result.summary.warnings}) exceeds --max-warnings${options.maxWarnings === void 0 ? "" : ` (${options.maxWarnings})`}.`;
225
+ lines.push(options.format === "github" ? annotation("error", { title: "Stillwind warnings" }, message) : `error: ${message}`);
226
+ }
227
+ if (options.format === "text") {
228
+ if (lines.length && lines.at(-1) !== "") lines.push("");
229
+ const { summary } = result;
230
+ lines.push(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")}` : ""}.`);
231
+ const suggestions = result.diagnostics.filter(({ report }) => report.actions.length > 0).length;
232
+ if (result.command === "lint" && suggestions) lines.push(`help: Suggested edits are available for ${count(suggestions, "diagnostic")}. Run stillwind lint --fix to apply automatic fixes.`);
233
+ }
234
+ return lines.join("\n");
235
+ }
236
+ /** Writes text execution failures to stderr and command results to stdout. */
237
+ async function writeResult(result, options) {
238
+ const stderr = options.format === "text" && result.failures.length > 0;
239
+ const output = renderResult(result, options, stderr, options.format === "text" && result.diagnostics.length ? new (await (import("./source-frame-V8U3FSfw.js"))).SourceFrames() : void 0);
240
+ if (output) (stderr ? process.stderr : process.stdout).write(output + "\n");
241
+ }
242
+ function renderFailure(failure, github, file, color) {
243
+ const details = failure.details.map((detail) => `${file(detail.file)}: ${clean(detail.message)}`);
244
+ const project = failure.project === void 0 ? "" : ` [project ${failure.project + 1}]`;
245
+ return github ? annotation("error", {
246
+ ...failure.file ? { file: file(failure.file) } : {},
247
+ title: `Stillwind${project}`
248
+ }, [clean(failure.message), ...details].join("\n")) : `${failure.file ? `${file(failure.file)}: ` : ""}${paint("error", "red", color)}${project}: ${clean(failure.message)}${details.length ? `\n ${details.join("\n ")}` : ""}`;
249
+ }
250
+ function count(value, noun) {
251
+ return `${value} ${noun}${value === 1 ? "" : "s"}`;
252
+ }
253
+ function paint(text, color, enabled) {
254
+ return enabled ? styleText(color, text, { validateStream: false }) : text;
255
+ }
256
+ function clean(text) {
257
+ return stripVTControlCharacters(text).replace(/\p{Cc}/gu, (character) => character === "\n" || character === "\r" || character === " " ? character : "");
258
+ }
259
+ function sourcePath(uri) {
260
+ try {
261
+ return uri.startsWith("file:") ? fileURLToPath(uri) : uri;
262
+ } catch {
263
+ return uri;
264
+ }
265
+ }
266
+ function displayPath(uri, cwd) {
267
+ const file = sourcePath(uri);
268
+ return clean(path.isAbsolute(file) ? path.relative(cwd, file) || "." : file);
269
+ }
270
+ function link(label, location, enabled) {
271
+ const file = sourcePath(location.uri);
272
+ if (!enabled || !path.isAbsolute(file)) return label;
273
+ const url = pathToFileURL(file);
274
+ url.hash = `L${location.startLine + 1}:${location.startColumn + 1}`;
275
+ return `\u001b]8;;${url.href}\u001b\\${label}\u001b]8;;\u001b\\`;
276
+ }
277
+ function annotation(level, properties, message) {
278
+ const escapeData = (value) => clean(value).replace(/%/g, "%25").replace(/\r/g, "%0D").replace(/\n/g, "%0A");
279
+ const fields = Object.entries(properties).map(([key, value]) => `${key}=${escapeData(String(value)).replace(/:/g, "%3A").replace(/,/g, "%2C")}`).join(",");
280
+ return `::${level}${fields ? ` ${fields}` : ""}::${escapeData(message)}`;
281
+ }
282
+ // src/result.ts
283
+ /** Projects analysis into CLI data before visibility filtering and rendering. */
284
+ function cliResult(command, result, policy = {}) {
285
+ const failedFiles = new Set(result.failures?.map((failure) => failure.file));
286
+ const diagnostics = lintReports(command === "fmt" ? result.results.filter(({ result }) => result.status !== "complete" || failedFiles.has(result.entry)) : result.results);
287
+ const failures = result.results.flatMap(({ project, result }) => result.status === "complete" ? [] : [{
288
+ project,
289
+ file: result.entry,
290
+ message: `Incomplete analysis${result.error ? `: ${result.error}` : ""}`,
291
+ details: [...(result.graph?.dependencies ?? []).flatMap((dependency) => dependency.status === "unresolved" || dependency.status === "unsupported" ? [{
292
+ file: dependency.importer,
293
+ message: `${dependency.status}: ${dependency.specifier}`
294
+ }] : []), ...(result.graph?.unverified ?? []).map((range) => ({
295
+ file: range.moduleId,
296
+ message: `unverified${range.start === void 0 ? "" : ` bytes ${range.start}-${range.end}`}: ${range.reason}`
297
+ }))]
298
+ }]);
299
+ for (const failure of result.failures ?? []) if (!failures.some((existing) => existing.file === failure.file)) failures.push({
300
+ file: failure.file,
301
+ message: failure.message,
302
+ details: []
303
+ });
304
+ if (!result.results.length && !failures.length) failures.push({
305
+ message: "No analysis targets matched the configured scopes",
306
+ details: []
307
+ });
308
+ const changed = [...new Set(result.changed ?? [])].sort();
309
+ const errors = diagnostics.filter(({ report }) => report.severity === "error").length;
310
+ const warnings = diagnostics.length - errors;
311
+ const warningLimitExceeded = policy.maxWarnings !== void 0 && warnings > policy.maxWarnings;
312
+ return {
313
+ command,
314
+ config: result.config,
315
+ diagnostics: policy.quiet ? diagnostics.filter(({ report }) => report.severity === "error") : diagnostics,
316
+ failures,
317
+ changed,
318
+ summary: {
319
+ files: (/* @__PURE__ */ new Set([...result.results.map(({ result }) => result.entry), ...(result.failures ?? []).map((failure) => failure.file)])).size,
320
+ errors,
321
+ warnings,
322
+ failures: failures.length,
323
+ changed: changed.length,
324
+ suggestions: diagnostics.filter(({ report }) => report.actions.length > 0).length,
325
+ warningLimitExceeded
326
+ },
327
+ exitCode: failures.length ? 2 : errors || warningLimitExceeded || policy.check && changed.length ? 1 : 0
328
+ };
329
+ }
330
+ /** Retains reports carried by failed rewrite planning in the same CLI envelope. */
331
+ function failureResult(command, error, policy = {}) {
332
+ const results = error instanceof Error && "results" in error && Array.isArray(error.results) ? error.results : [];
333
+ const result = cliResult("lint", {
334
+ config: results[0]?.config ?? "",
335
+ results
336
+ }, policy);
337
+ result.command = command;
338
+ result.config = results[0]?.config ?? null;
339
+ if (!results.length || !result.failures.length) result.failures = [{
340
+ message: error instanceof Error ? error.message : String(error),
341
+ details: []
342
+ }];
343
+ result.summary.failures = result.failures.length;
344
+ result.exitCode = 2;
345
+ return result;
346
+ }
347
+ // src/commands.ts
348
+ const fmtArgs = {
349
+ ...targetArgs,
350
+ check: {
351
+ type: "boolean",
352
+ description: "Check formatting without saving files"
353
+ }
354
+ };
355
+ const lintArgs = {
356
+ ...targetArgs,
357
+ ...warningArgs,
358
+ format: {
359
+ ...outputArgs.format,
360
+ options: [
361
+ "text",
362
+ "json",
363
+ "github"
364
+ ]
365
+ },
366
+ fix: {
367
+ type: "boolean",
368
+ description: "Apply converged automatic fixes"
369
+ }
370
+ };
371
+ const lspArgs = {
372
+ ...configArgs,
373
+ stdio: {
374
+ type: "boolean",
375
+ required: true,
376
+ description: "Use the Language Server Protocol over stdin/stdout"
377
+ }
378
+ };
379
+ const subCommands = {
380
+ fmt: defineCommand({
381
+ meta: {
382
+ name: "fmt",
383
+ description: "Sort Stillwind utilities"
384
+ },
385
+ args: fmtArgs,
386
+ plugins: [strictArguments],
387
+ async run({ args, data }) {
388
+ const options = data;
389
+ options.check = args.check;
390
+ const { format } = await import("@stillwind/analysis/node");
391
+ const result = cliResult("fmt", await format({
392
+ config: args.config,
393
+ cwd: options.cwd,
394
+ patterns: args._,
395
+ check: args.check
396
+ }), { check: args.check });
397
+ await writeResult(result, options);
398
+ process.exitCode = result.exitCode;
399
+ }
400
+ }),
401
+ lint: defineCommand({
402
+ meta: {
403
+ name: "lint",
404
+ description: "Check Stillwind styles"
405
+ },
406
+ args: lintArgs,
407
+ plugins: [strictArguments],
408
+ async run({ args, data }) {
409
+ const options = data;
410
+ const maxWarnings = warningLimit(args["max-warnings"]);
411
+ options.quiet = args.quiet;
412
+ options.maxWarnings = maxWarnings;
413
+ const { lint } = await import("@stillwind/analysis/node");
414
+ const result = cliResult("lint", await lint({
415
+ config: args.config,
416
+ cwd: options.cwd,
417
+ patterns: args._,
418
+ fix: args.fix
419
+ }), {
420
+ quiet: args.quiet,
421
+ maxWarnings
422
+ });
423
+ await writeResult(result, options);
424
+ process.exitCode = result.exitCode;
425
+ }
426
+ }),
427
+ lsp: defineCommand({
428
+ meta: {
429
+ name: "lsp",
430
+ description: "Start the language server"
431
+ },
432
+ args: lspArgs,
433
+ plugins: [strictArguments],
434
+ async run({ args }) {
435
+ if (!args.stdio || args._.length) throw new Error("lsp requires --stdio and accepts no globs");
436
+ const { startLanguageServer } = await import("@stillwind/language-server/node");
437
+ startLanguageServer(args.config);
438
+ }
439
+ })
440
+ };
441
+ const command = defineCommand({
442
+ meta: {
443
+ name: "stillwind",
444
+ version,
445
+ description: "Sort and check Stillwind styles"
446
+ },
447
+ args: {
448
+ ...configArgs,
449
+ ...outputArgs,
450
+ ...builtinArgs
451
+ },
452
+ subCommands
453
+ });
454
+ async function runCli(rawArgs = process.argv.slice(2)) {
455
+ const options = {
456
+ format: outputArgs.format.default,
457
+ color: "auto",
458
+ hyperlinks: "auto",
459
+ cwd: process.cwd()
460
+ };
461
+ let name = null;
462
+ try {
463
+ const invocation = parseInvocation(rawArgs, {
464
+ ...fmtArgs,
465
+ ...lintArgs,
466
+ ...lspArgs
467
+ });
468
+ name = invocation.name === "fmt" || invocation.name === "lint" ? invocation.name : null;
469
+ if (invocation.name === "lsp") options.format = "text";
470
+ else readOutputOptions(rawArgs, options);
471
+ if (invocation.name && !Object.hasOwn(subCommands, invocation.name)) throw new Error(`Unknown command: ${invocation.name}`);
472
+ if (!rawArgs.length || invocation.help) {
473
+ const sub = subCommands[invocation.name];
474
+ const subject = sub ?? command;
475
+ write(displayUsage(await renderUsage({
476
+ meta: subject.meta,
477
+ args: subject.args,
478
+ subCommands: subject.subCommands
479
+ }, sub ? { meta: command.meta } : void 0), options));
480
+ } else if (rawArgs.length === 1 && invocation.version) write(version);
481
+ else {
482
+ if (invocation.version) throw new Error("--version must be used without a command");
483
+ if (!invocation.name) throw new Error("A command is required: fmt, lint, or lsp");
484
+ await runCommand(subCommands[invocation.name], {
485
+ rawArgs: invocation.rawArgs,
486
+ data: options
487
+ });
488
+ }
489
+ } catch (error) {
490
+ await writeResult(failureResult(name, error, options), options.format === "files" ? {
491
+ ...options,
492
+ format: "text"
493
+ } : options);
494
+ process.exitCode = 2;
495
+ }
496
+ }
497
+ function write(output) {
498
+ if (output) process.stdout.write(output + "\n");
499
+ }
500
+ function displayUsage(usage, options) {
501
+ const plain = stripVTControlCharacters(usage);
502
+ return displayEnabled(options.color, "color", !!process.stdout.isTTY, process.env) ? styleText("cyan", plain, { validateStream: false }) : plain;
503
+ }
504
+ // src/main.ts
505
+ await runCli();
506
+ export {};
507
+
508
+ //# sourceMappingURL=main.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"main.js","names":["parseArgs","tokenizeArgs","packageJson.version"],"sources":["../package.json","../src/arguments.ts","../src/output.ts","../src/result.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 path from \"node:path\";\nimport process from \"node:process\";\nimport { fileURLToPath, pathToFileURL } from \"node:url\";\nimport { stripVTControlCharacters, styleText } from \"node:util\";\n\nimport type { CliDiagnostic, CliFailure, CliResult, ResultPolicy } 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 } 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 ];\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 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.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 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 { lintReports } from \"@stillwind/analysis\";\nimport type { LintResult } from \"@stillwind/analysis/node\";\n\nexport type CliCommand = \"lint\" | \"fmt\" | null;\n\nexport type CliDiagnostic = ReturnType<typeof lintReports>[number];\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 summary: {\n files: number;\n errors: number;\n warnings: number;\n failures: number;\n changed: 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/** Projects analysis into CLI data before visibility filtering and rendering. */\nexport function cliResult(\n command: CliCommand,\n result: Pick<LintResult, \"config\" | \"results\" | \"changed\" | \"failures\">,\n policy: ResultPolicy = {},\n): CliResult {\n const failedFiles = new Set(result.failures?.map((failure) => failure.file));\n const diagnostics = lintReports(\n command === \"fmt\"\n ? result.results.filter(\n ({ result }) => result.status !== \"complete\" || failedFiles.has(result.entry),\n )\n : result.results,\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 (!result.results.length && !failures.length) {\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 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 suggestions: diagnostics.filter(({ report }) => report.actions.length > 0).length,\n warningLimitExceeded,\n },\n exitCode: failures.length\n ? 2\n : errors || warningLimitExceeded || (policy.check && changed.length)\n ? 1\n : 0,\n };\n}\n\n/** Retains reports carried by failed rewrite planning in the same CLI envelope. */\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 process from \"node:process\";\nimport { stripVTControlCharacters, styleText } from \"node:util\";\n\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 } 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 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 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\nexport const command = defineCommand({\n meta: {\n name: \"stillwind\",\n version: packageJson.version,\n description: \"Sort and check 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 ...lspArgs,\n });\n name = invocation.name === \"fmt\" || invocation.name === \"lint\" ? invocation.name : 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(\"A command is required: fmt, lint, or lsp\");\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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CAA0C;GAE5D,MAAM,WAAW,YAAY,WAAW,OAAiD;IACvF,SAAS,WAAW;IACpB,MAAM;GACR,CAAC;EACH;CACF,SAAS,OAAO;EAEd,MAAM,YADS,cAAc,MAAM,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;;AC/MA,MAAM,OAAO"}
@@ -0,0 +1,74 @@
1
+ import path from "node:path";
2
+ import { fileURLToPath } from "node:url";
3
+ import { readFileSync } from "node:fs";
4
+ import { codeFrameColumns } from "@babel/code-frame";
5
+ import { fingerprint } from "@stillwind/native";
6
+ import stringWidth from "string-width";
7
+ // src/source-frame.ts
8
+ /** Reads each document once and only displays the revision named by a report. */
9
+ var SourceFrames = class {
10
+ #sources = /* @__PURE__ */ new Map();
11
+ render(label) {
12
+ if (label.scope !== "range") return;
13
+ const { uri, revision } = label.location;
14
+ if (!this.#sources.has(uri)) try {
15
+ const file = uri.startsWith("file:") ? fileURLToPath(uri) : uri;
16
+ if (!path.isAbsolute(file)) return;
17
+ const text = readFileSync(file, "utf8");
18
+ this.#sources.set(uri, {
19
+ text,
20
+ revision: fingerprint(text)
21
+ });
22
+ } catch {
23
+ this.#sources.set(uri, null);
24
+ }
25
+ const source = this.#sources.get(uri);
26
+ return source?.revision === revision ? sourceFrame(source.text, label) : void 0;
27
+ }
28
+ };
29
+ /** Adapts UTF-16 ranges to terminal widths while Babel supplies the frame and gutters. */
30
+ function sourceFrame(source, label) {
31
+ if (label.scope !== "range") return;
32
+ const location = label.location;
33
+ const lines = source.split("\n").map((line) => line.replace(/\r$/, ""));
34
+ const { startLine, startColumn } = location;
35
+ let { endLine, endColumn } = location;
36
+ if (startLine < 0 || endLine < startLine || endLine >= lines.length || startColumn < 0 || startColumn > lines[startLine].length || endColumn < 0 || endColumn > lines[endLine].length || startLine === endLine && endColumn < startColumn) return;
37
+ if (endLine > startLine && endColumn === 0) endColumn = lines[--endLine].length;
38
+ const truncated = endLine > startLine + 3;
39
+ if (truncated) {
40
+ endLine = startLine + 3;
41
+ endColumn = lines[endLine].length;
42
+ }
43
+ const display = (text) => text.replace(/\t/g, " ").replace(/[\p{Cc}\u2028\u2029]/gu, " ");
44
+ const frame = codeFrameColumns(lines.map(display).join("\n"), {
45
+ start: {
46
+ line: startLine + 1,
47
+ column: 1
48
+ },
49
+ end: {
50
+ line: endLine + 1,
51
+ column: lines[endLine].length + 1
52
+ }
53
+ }, {
54
+ linesAbove: 1,
55
+ linesBelow: truncated ? 0 : 1,
56
+ highlightCode: false
57
+ });
58
+ let current = startLine;
59
+ const rendered = frame.split("\n").map((line) => {
60
+ const numbered = /^>\s+(\d+) \|/.exec(line);
61
+ if (numbered) current = Number(numbered[1]) - 1;
62
+ const marker = /^(\s+\| ) *\^+$/.exec(line);
63
+ if (!marker) return line;
64
+ const start = current === startLine ? startColumn : 0;
65
+ const end = current === endLine ? endColumn : lines[current].length;
66
+ const before = stringWidth(display(lines[current].slice(0, start)));
67
+ const width = Math.max(1, stringWidth(display(lines[current].slice(start, end))));
68
+ return `${marker[1]}${" ".repeat(before)}${"^".repeat(width)}`;
69
+ }).join("\n");
70
+ return truncated ? `${rendered}\n …` : rendered;
71
+ }
72
+ export { SourceFrames };
73
+
74
+ //# sourceMappingURL=source-frame-V8U3FSfw.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"source-frame-V8U3FSfw.js","names":[],"sources":["../src/source-frame.ts"],"sourcesContent":["import { readFileSync } from \"node:fs\";\nimport path from \"node:path\";\nimport { fileURLToPath } from \"node:url\";\n\nimport { codeFrameColumns } from \"@babel/code-frame\";\nimport { fingerprint } from \"@stillwind/native\";\nimport stringWidth from \"string-width\";\n\nimport type { CliDiagnostic } from \"./result.ts\";\n\ntype Label = CliDiagnostic[\"report\"][\"primary\"];\n\n/** Reads each document once and only displays the revision named by a report. */\nexport class SourceFrames {\n readonly #sources = new Map<\n string,\n {\n text: string;\n revision: string;\n } | null\n >();\n\n render(label: Label): string | undefined {\n if (label.scope !== \"range\") {\n return undefined;\n }\n const { uri, revision } = label.location;\n if (!this.#sources.has(uri)) {\n try {\n const file = uri.startsWith(\"file:\") ? fileURLToPath(uri) : uri;\n if (!path.isAbsolute(file)) {\n return undefined;\n }\n const text = readFileSync(file, \"utf8\");\n this.#sources.set(uri, { text, revision: fingerprint(text) });\n } catch {\n this.#sources.set(uri, null);\n }\n }\n const source = this.#sources.get(uri);\n return source?.revision === revision ? sourceFrame(source.text, label) : undefined;\n }\n}\n\n/** Adapts UTF-16 ranges to terminal widths while Babel supplies the frame and gutters. */\nexport function sourceFrame(source: string, label: Label): string | undefined {\n if (label.scope !== \"range\") {\n return undefined;\n }\n const location = label.location;\n const lines = source.split(\"\\n\").map((line) => line.replace(/\\r$/, \"\"));\n const { startLine, startColumn } = location;\n let { endLine, endColumn } = location;\n if (\n startLine < 0 ||\n endLine < startLine ||\n endLine >= lines.length ||\n startColumn < 0 ||\n startColumn > lines[startLine].length ||\n endColumn < 0 ||\n endColumn > lines[endLine].length ||\n (startLine === endLine && endColumn < startColumn)\n ) {\n return undefined;\n }\n if (endLine > startLine && endColumn === 0) {\n endColumn = lines[--endLine].length;\n }\n const truncated = endLine > startLine + 3;\n if (truncated) {\n endLine = startLine + 3;\n endColumn = lines[endLine].length;\n }\n const display = (text: string) =>\n text.replace(/\\t/g, \" \").replace(/[\\p{Cc}\\u2028\\u2029]/gu, \" \");\n const frame = codeFrameColumns(\n lines.map(display).join(\"\\n\"),\n {\n start: { line: startLine + 1, column: 1 },\n end: { line: endLine + 1, column: lines[endLine].length + 1 },\n },\n { linesAbove: 1, linesBelow: truncated ? 0 : 1, highlightCode: false },\n );\n let current = startLine;\n const rendered = frame\n .split(\"\\n\")\n .map((line) => {\n const numbered = /^>\\s+(\\d+) \\|/.exec(line);\n if (numbered) {\n current = Number(numbered[1]) - 1;\n }\n const marker = /^(\\s+\\| ) *\\^+$/.exec(line);\n if (!marker) {\n return line;\n }\n const start = current === startLine ? startColumn : 0;\n const end = current === endLine ? endColumn : lines[current].length;\n const before = stringWidth(display(lines[current].slice(0, start)));\n const width = Math.max(1, stringWidth(display(lines[current].slice(start, end))));\n return `${marker[1]}${\" \".repeat(before)}${\"^\".repeat(width)}`;\n })\n .join(\"\\n\");\n return truncated ? `${rendered}\\n …` : rendered;\n}\n"],"mappings":";;;;;;;;AAaA,IAAa,eAAb,MAA0B;CACxB,2BAAoB,IAAI,IAMtB;CAEF,OAAO,OAAkC;EACvC,IAAI,MAAM,UAAU,SAClB;EAEF,MAAM,EAAE,KAAK,aAAa,MAAM;EAChC,IAAI,CAAC,KAAK,SAAS,IAAI,GAAG,GACxB,IAAI;GACF,MAAM,OAAO,IAAI,WAAW,OAAO,IAAI,cAAc,GAAG,IAAI;GAC5D,IAAI,CAAC,KAAK,WAAW,IAAI,GACvB;GAEF,MAAM,OAAO,aAAa,MAAM,MAAM;GACtC,KAAK,SAAS,IAAI,KAAK;IAAE;IAAM,UAAU,YAAY,IAAI;GAAE,CAAC;EAC9D,QAAQ;GACN,KAAK,SAAS,IAAI,KAAK,IAAI;EAC7B;EAEF,MAAM,SAAS,KAAK,SAAS,IAAI,GAAG;EACpC,OAAO,QAAQ,aAAa,WAAW,YAAY,OAAO,MAAM,KAAK,IAAI,KAAA;CAC3E;AACF;;AAGA,SAAgB,YAAY,QAAgB,OAAkC;CAC5E,IAAI,MAAM,UAAU,SAClB;CAEF,MAAM,WAAW,MAAM;CACvB,MAAM,QAAQ,OAAO,MAA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,KAAK,IAAI,GAAG,YAAY,QAAQ,MAAM,QAAQ,CAAC,MAAM,OAAO,GAAG,CAAC,CAAC,CAAC;EAChF,OAAO,GAAG,OAAO,KAAK,IAAI,OAAO,MAAM,IAAI,IAAI,OAAO,KAAK;CAC7D,CAAC,CAAC,CACD,KAAK,IAAI;CACZ,OAAO,YAAY,GAAG,SAAS,SAAS;AAC1C"}
package/package.json CHANGED
@@ -1,6 +1,47 @@
1
1
  {
2
2
  "name": "@stillwind/cli",
3
- "version": "0.0.0-stage",
4
- "stub": true,
5
- "description": "Temporary package placeholder for staged publishing"
3
+ "version": "0.1.0-rc.0",
4
+ "description": "Command wrappers for Stillwind tools",
5
+ "homepage": "https://stillwind.dev/",
6
+ "bugs": {
7
+ "url": "https://github.com/SegaraRai/stillwind/issues"
8
+ },
9
+ "license": "MIT",
10
+ "repository": {
11
+ "type": "git",
12
+ "url": "git+https://github.com/SegaraRai/stillwind.git",
13
+ "directory": "packages/cli"
14
+ },
15
+ "bin": {
16
+ "stillwind": "dist/main.js"
17
+ },
18
+ "files": [
19
+ "dist"
20
+ ],
21
+ "type": "module",
22
+ "exports": {
23
+ ".": {
24
+ "types": "./dist/index.d.ts",
25
+ "default": "./dist/index.js"
26
+ },
27
+ "./package.json": "./package.json"
28
+ },
29
+ "publishConfig": {
30
+ "access": "public"
31
+ },
32
+ "dependencies": {
33
+ "@babel/code-frame": "^8.0.6",
34
+ "@stillwind/analysis": "0.1.0-rc.0",
35
+ "@stillwind/language-server": "0.1.0-rc.0",
36
+ "@stillwind/native": "0.1.0-rc.0",
37
+ "citty": "^0.2.2",
38
+ "string-width": "^8.3.0"
39
+ },
40
+ "devDependencies": {
41
+ "@stillwind-internal/tools-workspace": "0.0.0",
42
+ "@types/babel__code-frame": "^7.27.0",
43
+ "@types/node": "^26.6.5",
44
+ "typescript": "^6.0.3",
45
+ "vite-plus": "1.4.0"
46
+ }
6
47
  }