@nwire/cli 0.9.1 → 0.9.2

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.
Files changed (59) hide show
  1. package/dist/cli.js +2 -1
  2. package/dist/cli.js.map +1 -1
  3. package/dist/commands/build.d.ts.map +1 -1
  4. package/dist/commands/build.js +13 -16
  5. package/dist/commands/build.js.map +1 -1
  6. package/dist/commands/cache.d.ts +3 -2
  7. package/dist/commands/cache.d.ts.map +1 -1
  8. package/dist/commands/cache.js +7 -16
  9. package/dist/commands/cache.js.map +1 -1
  10. package/dist/commands/check.d.ts +10 -2
  11. package/dist/commands/check.d.ts.map +1 -1
  12. package/dist/commands/check.js +34 -9
  13. package/dist/commands/check.js.map +1 -1
  14. package/dist/commands/fmt.d.ts +8 -3
  15. package/dist/commands/fmt.d.ts.map +1 -1
  16. package/dist/commands/fmt.js +35 -11
  17. package/dist/commands/fmt.js.map +1 -1
  18. package/dist/commands/lint.d.ts +7 -2
  19. package/dist/commands/lint.d.ts.map +1 -1
  20. package/dist/commands/lint.js +34 -12
  21. package/dist/commands/lint.js.map +1 -1
  22. package/dist/commands/ls.d.ts +1 -0
  23. package/dist/commands/ls.d.ts.map +1 -1
  24. package/dist/commands/ls.js +3 -0
  25. package/dist/commands/ls.js.map +1 -1
  26. package/dist/commands/mcp.d.ts.map +1 -1
  27. package/dist/commands/mcp.js +2 -1
  28. package/dist/commands/mcp.js.map +1 -1
  29. package/dist/lib/ensure-scan.d.ts +29 -0
  30. package/dist/lib/ensure-scan.d.ts.map +1 -0
  31. package/dist/lib/ensure-scan.js +42 -0
  32. package/dist/lib/ensure-scan.js.map +1 -0
  33. package/dist/lib/layout.d.ts +41 -0
  34. package/dist/lib/layout.d.ts.map +1 -0
  35. package/dist/lib/layout.js +129 -0
  36. package/dist/lib/layout.js.map +1 -0
  37. package/dist/lib/package-manager.d.ts +18 -0
  38. package/dist/lib/package-manager.d.ts.map +1 -0
  39. package/dist/lib/package-manager.js +68 -0
  40. package/dist/lib/package-manager.js.map +1 -0
  41. package/dist/lib/project.d.ts +3 -3
  42. package/dist/lib/project.d.ts.map +1 -1
  43. package/dist/lib/project.js +16 -33
  44. package/dist/lib/project.js.map +1 -1
  45. package/dist/lib/scan-cache.d.ts +28 -0
  46. package/dist/lib/scan-cache.d.ts.map +1 -0
  47. package/dist/lib/scan-cache.js +103 -0
  48. package/dist/lib/scan-cache.js.map +1 -0
  49. package/dist/lib/script-runner.d.ts +43 -0
  50. package/dist/lib/script-runner.d.ts.map +1 -0
  51. package/dist/lib/script-runner.js +91 -0
  52. package/dist/lib/script-runner.js.map +1 -0
  53. package/dist/lib/version.d.ts +9 -0
  54. package/dist/lib/version.d.ts.map +1 -0
  55. package/dist/lib/version.js +30 -0
  56. package/dist/lib/version.js.map +1 -0
  57. package/dist/ls-runner.js +34 -39
  58. package/dist/ls-runner.js.map +1 -1
  59. package/package.json +5 -5
package/dist/cli.js CHANGED
@@ -34,10 +34,11 @@ import { studioCommand } from "./commands/studio.js";
34
34
  import { testCommand } from "./commands/test.js";
35
35
  import { traceCommand } from "./commands/trace.js";
36
36
  import { watchCommand } from "./commands/watch.js";
37
+ import { cliVersion } from "./lib/version.js";
37
38
  const main = defineCommand({
38
39
  meta: {
39
40
  name: "nwire",
40
- version: "0.8.17",
41
+ version: cliVersion(),
41
42
  description: "Nwire — event-driven framework. Dev, build, please, ps, logs, studio, …",
42
43
  },
43
44
  subCommands: {
package/dist/cli.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"file":"cli.js","sourceRoot":"","sources":["../src/cli.ts"],"names":[],"mappings":";AACA;;;;;;;;;;;;GAYG;AAEH,OAAO,EAAE,aAAa,EAAE,OAAO,EAAE,MAAM,OAAO,CAAC;AAE/C,OAAO,EAAE,YAAY,EAAE,MAAM,kBAAkB,CAAC;AAChD,OAAO,EAAE,YAAY,EAAE,MAAM,kBAAkB,CAAC;AAChD,OAAO,EAAE,YAAY,EAAE,MAAM,kBAAkB,CA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ACf,MAAM,EAAE,aAAa;QACrB,IAAI,EAAE,WAAW;QACjB,KAAK,EAAE,YAAY;QACnB,KAAK,EAAE,YAAY;KACpB;CACF,CAAC,CAAC;AAEH,wEAAwE;AACxE,uEAAuE;AACvE,wEAAwE;AACxE,gCAAgC;AAChC,MAAM,QAAQ,GAAG,OAAO,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC;AACvC,IAAI,QAAQ,CAAC,MAAM,KAAK,CAAC,EAAE,CAAC;IAC1B,KAAK,eAAe,CAAC,GAAI,CAAC,EAAW,CAAC,CAAC;AACzC,CAAC;KAAM,CAAC;IACN,KAAK,OAAO,CAAC,IAAI,CAAC,CAAC;AACrB,CAAC"}
@@ -1 +1 @@
1
- {"version":3,"file":"build.d.ts","sourceRoot":"","sources":["../../src/commands/build.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAkBH,eAAO,MAAM,YAAY;;;;;;EAyDvB,CAAC"}
1
+ {"version":3,"file":"build.d.ts","sourceRoot":"","sources":["../../src/commands/build.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AASH,eAAO,MAAM,YAAY;;;;;;EAmEvB,CAAC"}
@@ -5,18 +5,9 @@
5
5
  */
6
6
  import { defineCommand } from "citty";
7
7
  import { resolve } from "node:path";
8
- import { existsSync } from "node:fs";
9
8
  import { palette } from "../lib/colors.js";
10
- import { detectProject } from "../lib/project.js";
9
+ import { detectLayout, resolveWire } from "../lib/layout.js";
11
10
  import { runTaskList } from "../lib/run-task.js";
12
- function resolveEntry(cwd, wireName) {
13
- const appDir = resolve(cwd, "apps", wireName);
14
- for (const candidate of [resolve(appDir, "run.ts"), resolve(appDir, "main.ts")]) {
15
- if (existsSync(candidate))
16
- return candidate;
17
- }
18
- return undefined;
19
- }
20
11
  export const buildCommand = defineCommand({
21
12
  meta: {
22
13
  name: "build",
@@ -31,16 +22,22 @@ export const buildCommand = defineCommand({
31
22
  },
32
23
  async run({ args }) {
33
24
  const cwd = process.cwd();
34
- const project = detectProject(cwd);
35
- const wires = args.wire ? [String(args.wire)] : [...project.wires];
36
- if (wires.length === 0) {
25
+ const layout = detectLayout(cwd);
26
+ if (layout.wires.length === 0) {
37
27
  // eslint-disable-next-line no-console
38
- console.error(palette.err("nwire build:") + " no wires detected (expected apps/<name>/{run,main}.ts)");
28
+ console.error(palette.err("nwire build:") +
29
+ " no wires detected. Expected one of: " +
30
+ "app/{run,main}.ts (single-wire), apps/<name>/{run,main}.ts (multi-wire), " +
31
+ "src/{main,index}.ts (flat), or a nwire.config.ts.");
39
32
  process.exit(1);
40
33
  }
41
- const tasks = wires.flatMap((wire) => {
42
- const entry = resolveEntry(cwd, wire);
34
+ const requested = args.wire ? [String(args.wire)] : layout.wires.map((w) => w.name);
35
+ const tasks = requested.flatMap((wire) => {
36
+ const entry = resolveWire(layout, wire);
43
37
  if (!entry) {
38
+ // eslint-disable-next-line no-console
39
+ console.error(palette.err(`nwire build: unknown wire "${wire}". `) +
40
+ `Known wires: ${layout.wires.map((w) => w.name).join(", ") || "(none)"}.`);
44
41
  return [
45
42
  {
46
43
  title: `${wire} — entry missing`,
@@ -1 +1 @@
1
- {"version":3,"file":"build.js","sourceRoot":"","sources":["../../src/commands/build.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,OAAO,EAAE,aAAa,EAAE,MAAM,OAAO,CAAC;AACtC,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AACpC,OAAO,EAAE,UAAU,EAAE,MAAM,SAAS,CAAC;AAErC,OAAO,EAAE,OAAO,EAAE,MAAM,eAAe,CAAC;AACxC,OAAO,EAAE,aAAa,EAAE,MAAM,gBAAgB,CAAC;AAC/C,OAAO,EAAE,WAAW,EAAE,MAAM,iBAAiB,CAAC;AAE9C,SAAS,YAAY,CAAC,GAAW,EAAE,QAAgB;IACjD,MAAM,MAAM,GAAG,OAAO,CAAC,GAAG,EAAE,MAAM,EAAE,QAAQ,CAAC,CAAC;IAC9C,KAAK,MAAM,SAAS,IAA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AAG,OAAO,CAAC,GAAG,EAAE,MAAM,EAAE,IAAI,CAAC,CAAC;YAC1C,OAAO;gBACL;oBACE,KAAK,EAAE,GAAG,IAAI,KAAK,KAAK,CAAC,OAAO,CAAC,GAAG,GAAG,GAAG,EAAE,EAAE,CAAC,WAAW,IAAI,GAAG;oBACjE,OAAO,EAAE,MAAM;oBACf,IAAI,EAAE;wBACJ,MAAM;wBACN,MAAM;wBACN,OAAO;wBACP,OAAO;wBACP,KAAK;wBACL,UAAU;wBACV,MAAM;wBACN,eAAe;qBACK;iBACvB;aACF,CAAC;QACJ,CAAC,CAAC,CAAC;QAEH,OAAO,CAAC,IAAI,CAAC,MAAM,WAAW,CAAC,KAAK,CAAC,CAAC,CAAC;IACzC,CAAC;CACF,CAAC,CAAC"}
@@ -1,6 +1,7 @@
1
1
  /**
2
- * `nwire cache` — rebuilds `.nwire/` (manifest + per-kind JSON files) by
3
- * invoking the bundled cache-runner script under vite-node.
2
+ * `nwire cache` — rebuild `.nwire/` (manifest + per-kind JSON files).
3
+ * Equivalent to `ensureScanFresh({ force: true })`: skips the
4
+ * fingerprint cheap-path and always re-runs the cache builder.
4
5
  */
5
6
  export declare const cacheCommand: import("citty").CommandDef<import("citty").ArgsDef>;
6
7
  //# sourceMappingURL=cache.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"cache.d.ts","sourceRoot":"","sources":["../../src/commands/cache.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAYH,eAAO,MAAM,YAAY,qDAcvB,CAAC"}
1
+ {"version":3,"file":"cache.d.ts","sourceRoot":"","sources":["../../src/commands/cache.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAMH,eAAO,MAAM,YAAY,qDASvB,CAAC"}
@@ -1,27 +1,18 @@
1
1
  /**
2
- * `nwire cache` — rebuilds `.nwire/` (manifest + per-kind JSON files) by
3
- * invoking the bundled cache-runner script under vite-node.
2
+ * `nwire cache` — rebuild `.nwire/` (manifest + per-kind JSON files).
3
+ * Equivalent to `ensureScanFresh({ force: true })`: skips the
4
+ * fingerprint cheap-path and always re-runs the cache builder.
4
5
  */
5
6
  import { defineCommand } from "citty";
6
- import { resolve, dirname } from "node:path";
7
- import { existsSync } from "node:fs";
8
- import { fileURLToPath } from "node:url";
9
- import { palette } from "../lib/colors.js";
10
- import { viteNode } from "../lib/vite-node.js";
11
- const here = dirname(fileURLToPath(import.meta.url));
7
+ import { ensureScanFresh } from "../lib/ensure-scan.js";
12
8
  export const cacheCommand = defineCommand({
13
9
  meta: {
14
10
  name: "cache",
15
11
  description: "Rebuild .nwire/ cache (manifest + per-kind JSON)",
16
12
  },
17
- async run({ rawArgs }) {
18
- const builderPath = resolve(here, "..", "cache-runner.js");
19
- if (!existsSync(builderPath)) {
20
- // eslint-disable-next-line no-console
21
- console.error(palette.err("nwire cache:") + ` cache runner missing at ${builderPath}`);
22
- process.exit(1);
23
- }
24
- process.exit(viteNode(builderPath, rawArgs));
13
+ async run() {
14
+ const { rebuilt } = ensureScanFresh(process.cwd(), { force: true });
15
+ process.exit(rebuilt ? 0 : 1);
25
16
  },
26
17
  });
27
18
  //# sourceMappingURL=cache.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"cache.js","sourceRoot":"","sources":["../../src/commands/cache.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,EAAE,aAAa,EAAE,MAAM,OAAO,CAAC;AACtC,OAAO,EAAE,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AAC7C,OAAO,EAAE,UAAU,EAAE,MAAM,SAAS,CAAC;AACrC,OAAO,EAAE,aAAa,EAAE,MAAM,UAAU,CAAC;AAEzC,OAAO,EAAE,OAAO,EAAE,MAAM,eAAe,CAAC;AACxC,OAAO,EAAE,QAAQ,EAAE,MAAM,kBAAkB,CAAC;AAE5C,MAAM,IAAI,GAAG,OAAO,CAAC,aAAa,CAAC,MAAM,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC,CAAC;AAErD,MAAM,CAAC,MAAM,YAAY,GAAG,aAAa,CAAC;IACxC,IAAI,EAAE;QACJ,IAAI,EAAE,OAAO;QACb,WAAW,EAAE,kDAAkD;KAChE;IACD,KAAK,CAAC,GAAG,CAAC,EAAE,OAAO,EAAE;QACnB,MAAM,WAAW,GAAG,OAAO,CAAC,IAAI,EAAE,IAAI,EAAE,iBAAiB,CAAC,CAAC;QAC3D,IAAI,CAAC,UAAU,CAAC,WAAW,CAAC,EAAE,CAAC;YAC7B,sCAAsC;YACtC,OAAO,CAAC,KAAK,CAAC,OAAO,CAAC,GAAG,CAAC,cAAc,CAAC,GAAG,4BAA4B,WAAW,EAAE,CAAC,CAAC;YACvF,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC;QAClB,CAAC;QACD,OAAO,CAAC,IAAI,CAAC,QAAQ,CAAC,WAAW,EAAE,OAAO,CAAC,CAAC,CAAC;IAC/C,CAAC;CACF,CAAC,CAAC"}
1
+ {"version":3,"file":"cache.js","sourceRoot":"","sources":["../../src/commands/cache.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,OAAO,EAAE,aAAa,EAAE,MAAM,OAAO,CAAC;AAEtC,OAAO,EAAE,eAAe,EAAE,MAAM,oBAAoB,CAAC;AAErD,MAAM,CAAC,MAAM,YAAY,GAAG,aAAa,CAAC;IACxC,IAAI,EAAE;QACJ,IAAI,EAAE,OAAO;QACb,WAAW,EAAE,kDAAkD;KAChE;IACD,KAAK,CAAC,GAAG;QACP,MAAM,EAAE,OAAO,EAAE,GAAG,eAAe,CAAC,OAAO,CAAC,GAAG,EAAE,EAAE,EAAE,KAAK,EAAE,IAAI,EAAE,CAAC,CAAC;QACpE,OAAO,CAAC,IAAI,CAAC,OAAO,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC;IAChC,CAAC;CACF,CAAC,CAAC"}
@@ -1,6 +1,14 @@
1
1
  /**
2
- * `nwire check` — composed quality gate. Runs format-check, lint, and
3
- * typecheck in sequence. Use before pushing or in CI.
2
+ * `nwire check` — composed quality gate. Reads the consumer's
3
+ * package.json scripts and runs whatever they've defined.
4
+ *
5
+ * 1. `scripts.check` — single entrypoint wins.
6
+ * 2. `scripts.format:check`, `scripts.lint`, `scripts.typecheck` —
7
+ * whichever subset is defined, in that order.
8
+ * 3. Fallback to any installed formatter / linter / type checker:
9
+ * `oxfmt --check`, `biome check`, `prettier --check`; `oxlint`,
10
+ * `eslint`; `tsc --noEmit`. Only spawns binaries that exist in
11
+ * `node_modules/.bin`.
4
12
  */
5
13
  export declare const checkCommand: import("citty").CommandDef<import("citty").ArgsDef>;
6
14
  //# sourceMappingURL=check.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"check.d.ts","sourceRoot":"","sources":["../../src/commands/check.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAMH,eAAO,MAAM,YAAY,qDAavB,CAAC"}
1
+ {"version":3,"file":"check.d.ts","sourceRoot":"","sources":["../../src/commands/check.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;GAWG;AAOH,eAAO,MAAM,YAAY,qDA+BvB,CAAC"}
@@ -1,20 +1,45 @@
1
1
  /**
2
- * `nwire check` — composed quality gate. Runs format-check, lint, and
3
- * typecheck in sequence. Use before pushing or in CI.
2
+ * `nwire check` — composed quality gate. Reads the consumer's
3
+ * package.json scripts and runs whatever they've defined.
4
+ *
5
+ * 1. `scripts.check` — single entrypoint wins.
6
+ * 2. `scripts.format:check`, `scripts.lint`, `scripts.typecheck` —
7
+ * whichever subset is defined, in that order.
8
+ * 3. Fallback to any installed formatter / linter / type checker:
9
+ * `oxfmt --check`, `biome check`, `prettier --check`; `oxlint`,
10
+ * `eslint`; `tsc --noEmit`. Only spawns binaries that exist in
11
+ * `node_modules/.bin`.
4
12
  */
5
13
  import { defineCommand } from "citty";
6
- import { runTaskList } from "../lib/run-task.js";
14
+ import { palette } from "../lib/colors.js";
15
+ import { runScriptStrategy } from "../lib/script-runner.js";
7
16
  export const checkCommand = defineCommand({
8
17
  meta: {
9
18
  name: "check",
10
- description: "Run format-check + lint + typecheck",
19
+ description: "Run format-check + lint + typecheck (consumer-defined or sensible defaults)",
11
20
  },
12
21
  async run() {
13
- const code = await runTaskList([
14
- { title: "format (oxfmt --check)", command: "pnpm", args: ["exec", "oxfmt", "--check"] },
15
- { title: "lint (oxlint)", command: "pnpm", args: ["exec", "oxlint"] },
16
- { title: "typecheck (tsc)", command: "pnpm", args: ["exec", "tsc", "--noEmit"] },
17
- ]);
22
+ const cwd = process.cwd();
23
+ const { code, ran } = await runScriptStrategy(cwd, {
24
+ operationName: "check",
25
+ consumerScript: "check",
26
+ consumerSubScripts: ["format:check", "lint", "typecheck"],
27
+ fallback: [
28
+ { title: "format (oxfmt --check)", bin: "oxfmt", args: ["--check"] },
29
+ { title: "format (biome check)", bin: "biome", args: ["check"] },
30
+ { title: "format (prettier --check)", bin: "prettier", args: ["--check", "."] },
31
+ { title: "lint (oxlint)", bin: "oxlint" },
32
+ { title: "lint (eslint)", bin: "eslint", args: ["."] },
33
+ { title: "typecheck (tsc --noEmit)", bin: "tsc", args: ["--noEmit"] },
34
+ ],
35
+ });
36
+ if (!ran) {
37
+ // eslint-disable-next-line no-console
38
+ console.error(palette.err("nwire check:") +
39
+ " no `check`, `format:check`, `lint`, or `typecheck` script in package.json " +
40
+ "and none of oxfmt/oxlint/biome/prettier/eslint/tsc are installed locally.");
41
+ process.exit(1);
42
+ }
18
43
  process.exit(code);
19
44
  },
20
45
  });
@@ -1 +1 @@
1
- {"version":3,"file":"check.js","sourceRoot":"","sources":["../../src/commands/check.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,EAAE,aAAa,EAAE,MAAM,OAAO,CAAC;AAEtC,OAAO,EAAE,WAAW,EAAE,MAAM,iBAAiB,CAAC;AAE9C,MAAM,CAAC,MAAM,YAAY,GAAG,aAAa,CAAC;IACxC,IAAI,EAAE;QACJ,IAAI,EAAE,OAAO;QACb,WAAW,EAAE,qCAAqC;KACnD;IACD,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EAAE,CAAC,SAAS,CAAC,EAAE;gBACpE,EAAE,KAAK,EAAE,sBAAsB,EAAE,GAAG,EAAE,OAAO,EAAE,IAAI,EAAE,CAAC,OAAO,CAAC,EAAE;gBAChE,EAAE,KAAK,EAAE,2BAA2B,EAAE,GAAG,EAAE,UAAU,EAAE,IAAI,EAAE,CAAC,SAAS,EAAE,GAAG,CAAC,EAAE;gBAC/E,EAAE,KAAK,EAAE,eAAe,EAAE,GAAG,EAAE,QAAQ,EAAE;gBACzC,EAAE,KAAK,EAAE,eAAe,EAAE,GAAG,EAAE,QAAQ,EAAE,IAAI,EAAE,CAAC,GAAG,CAAC,EAAE;gBACtD,EAAE,KAAK,EAAE,0BAA0B,EAAE,GAAG,EAAE,KAAK,EAAE,IAAI,EAAE,CAAC,UAAU,CAAC,EAAE;aACtE;SACF,CAAC,CAAC;QACH,IAAI,CAAC,GAAG,EAAE,CAAC;YACT,sCAAsC;YACtC,OAAO,CAAC,KAAK,CACX,OAAO,CAAC,GAAG,CAAC,cAAc,CAAC;gBACzB,6EAA6E;gBAC7E,2EAA2E,CAC9E,CAAC;YACF,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC;QAClB,CAAC;QACD,OAAO,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;IACrB,CAAC;CACF,CAAC,CAAC"}
@@ -1,7 +1,12 @@
1
1
  /**
2
- * `nwire fmt` — passthrough to `oxfmt` wrapped in a listr2 task so the
3
- * output shape matches `lint`, `check`, and `build`. Honors any
4
- * oxfmt config in the consumer's project.
2
+ * `nwire fmt` — run the consumer's formatter. Picks the first
3
+ * available source in order:
4
+ *
5
+ * 1. `scripts.format` (and `scripts.format:check` for `--check`)
6
+ * 2. Any installed formatter — `oxfmt`, then `biome format --write`,
7
+ * then `prettier --write`.
8
+ *
9
+ * Extra positional args / flags pass through.
5
10
  */
6
11
  export declare const fmtCommand: import("citty").CommandDef<{
7
12
  check: {
@@ -1 +1 @@
1
- {"version":3,"file":"fmt.d.ts","sourceRoot":"","sources":["../../src/commands/fmt.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAMH,eAAO,MAAM,UAAU;;;;;;EAwBrB,CAAC"}
1
+ {"version":3,"file":"fmt.d.ts","sourceRoot":"","sources":["../../src/commands/fmt.ts"],"names":[],"mappings":"AAAA;;;;;;;;;GASG;AAOH,eAAO,MAAM,UAAU;;;;;;EA8CrB,CAAC"}
@@ -1,14 +1,20 @@
1
1
  /**
2
- * `nwire fmt` — passthrough to `oxfmt` wrapped in a listr2 task so the
3
- * output shape matches `lint`, `check`, and `build`. Honors any
4
- * oxfmt config in the consumer's project.
2
+ * `nwire fmt` — run the consumer's formatter. Picks the first
3
+ * available source in order:
4
+ *
5
+ * 1. `scripts.format` (and `scripts.format:check` for `--check`)
6
+ * 2. Any installed formatter — `oxfmt`, then `biome format --write`,
7
+ * then `prettier --write`.
8
+ *
9
+ * Extra positional args / flags pass through.
5
10
  */
6
11
  import { defineCommand } from "citty";
7
- import { runTaskList } from "../lib/run-task.js";
12
+ import { palette } from "../lib/colors.js";
13
+ import { runScriptStrategy } from "../lib/script-runner.js";
8
14
  export const fmtCommand = defineCommand({
9
15
  meta: {
10
16
  name: "fmt",
11
- description: "Format the project with oxfmt",
17
+ description: "Format the project (consumer-defined or installed formatter)",
12
18
  },
13
19
  args: {
14
20
  check: {
@@ -18,15 +24,33 @@ export const fmtCommand = defineCommand({
18
24
  },
19
25
  },
20
26
  async run({ args, rawArgs }) {
27
+ const cwd = process.cwd();
21
28
  const passthrough = rawArgs.filter((a) => a !== "--check" && a !== "-c");
22
- const oxfmtArgs = args.check ? ["--check", ...passthrough] : passthrough;
23
- const code = await runTaskList([
29
+ const writeFallback = [
30
+ { title: "oxfmt", bin: "oxfmt", args: passthrough },
31
+ { title: "biome format --write", bin: "biome", args: ["format", "--write", ...passthrough] },
32
+ { title: "prettier --write", bin: "prettier", args: ["--write", ".", ...passthrough] },
33
+ ];
34
+ const checkFallback = [
35
+ { title: "oxfmt --check", bin: "oxfmt", args: ["--check", ...passthrough] },
36
+ { title: "biome check", bin: "biome", args: ["check", ...passthrough] },
24
37
  {
25
- title: args.check ? "oxfmt --check" : "oxfmt",
26
- command: "pnpm",
27
- args: ["exec", "oxfmt", ...oxfmtArgs],
38
+ title: "prettier --check",
39
+ bin: "prettier",
40
+ args: ["--check", ".", ...passthrough],
28
41
  },
29
- ]);
42
+ ];
43
+ const { code, ran } = await runScriptStrategy(cwd, {
44
+ operationName: "fmt",
45
+ consumerScript: args.check ? "format:check" : "format",
46
+ fallback: args.check ? checkFallback : writeFallback,
47
+ });
48
+ if (!ran) {
49
+ // eslint-disable-next-line no-console
50
+ console.error(palette.err("nwire fmt:") +
51
+ " no `format` script and no installed formatter (oxfmt, biome, or prettier).");
52
+ process.exit(1);
53
+ }
30
54
  process.exit(code);
31
55
  },
32
56
  });
@@ -1 +1 @@
1
- {"version":3,"file":"fmt.js","sourceRoot":"","sources":["../../src/commands/fmt.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,OAAO,EAAE,aAAa,EAAE,MAAM,OAAO,CAAC;AAEtC,OAAO,EAAE,WAAW,EAAE,MAAM,iBAAiB,CAAC;AAE9C,MAAM,CAAC,MAAM,UAAU,GAAG,aAAa,CAAC;IACtC,IAAI,EAAE;QACJ,IAAI,EAAE,KAAK;QACX,WAAW,EAAE,+BAA+B;KAC7C;IACD,IAAI,EAAE;QACJ,KAAK,EAAE;YACL,IAAI,EAAE,SAAS;YACf,WAAW,EAAE,0CAA0C;YACvD,OAAO,EAAE,KAAK;SACf;KACF;IACD,KAAK,CAAC,GAAG,CAAC,EAAE,IAAI,EAAE,OAAO,EAAE;QACzB,MAAM,WAAW,GAAG,OAAO,CAAC,MAAM,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,KAAK,SAAS,IAAI,CAAC,KAAK,IAAI,CAAC,CAAC;QACzE,MAAM,SAAS,GAAG,IAAI,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,SAAS,E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 +1,11 @@
1
1
  /**
2
- * `nwire lint` — passthrough to `oxlint` wrapped in a listr2 task.
3
- * Honors the consumer project's oxlint config.
2
+ * `nwire lint` — run the consumer's lint. Picks the first available
3
+ * source in order:
4
+ *
5
+ * 1. `scripts.lint` (and `scripts.lint:fix` for `--fix`)
6
+ * 2. Any installed linter — `oxlint`, then `eslint`.
7
+ *
8
+ * Extra positional args / flags pass through.
4
9
  */
5
10
  export declare const lintCommand: import("citty").CommandDef<{
6
11
  fix: {
@@ -1 +1 @@
1
- {"version":3,"file":"lint.d.ts","sourceRoot":"","sources":["../../src/commands/lint.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAMH,eAAO,MAAM,WAAW;;;;;;EAwBtB,CAAC"}
1
+ {"version":3,"file":"lint.d.ts","sourceRoot":"","sources":["../../src/commands/lint.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AAOH,eAAO,MAAM,WAAW;;;;;;EA2CtB,CAAC"}
@@ -1,13 +1,19 @@
1
1
  /**
2
- * `nwire lint` — passthrough to `oxlint` wrapped in a listr2 task.
3
- * Honors the consumer project's oxlint config.
2
+ * `nwire lint` — run the consumer's lint. Picks the first available
3
+ * source in order:
4
+ *
5
+ * 1. `scripts.lint` (and `scripts.lint:fix` for `--fix`)
6
+ * 2. Any installed linter — `oxlint`, then `eslint`.
7
+ *
8
+ * Extra positional args / flags pass through.
4
9
  */
5
10
  import { defineCommand } from "citty";
6
- import { runTaskList } from "../lib/run-task.js";
11
+ import { palette } from "../lib/colors.js";
12
+ import { runScriptStrategy } from "../lib/script-runner.js";
7
13
  export const lintCommand = defineCommand({
8
14
  meta: {
9
15
  name: "lint",
10
- description: "Lint the project with oxlint",
16
+ description: "Lint the project (consumer-defined or installed linter)",
11
17
  },
12
18
  args: {
13
19
  fix: {
@@ -17,15 +23,31 @@ export const lintCommand = defineCommand({
17
23
  },
18
24
  },
19
25
  async run({ args, rawArgs }) {
26
+ const cwd = process.cwd();
20
27
  const passthrough = rawArgs.filter((a) => a !== "--fix");
21
- const oxlintArgs = args.fix ? ["--fix", ...passthrough] : passthrough;
22
- const code = await runTaskList([
23
- {
24
- title: args.fix ? "oxlint --fix" : "oxlint",
25
- command: "pnpm",
26
- args: ["exec", "oxlint", ...oxlintArgs],
27
- },
28
- ]);
28
+ const fixArgs = args.fix ? ["--fix"] : [];
29
+ const { code, ran } = await runScriptStrategy(cwd, {
30
+ operationName: "lint",
31
+ consumerScript: args.fix ? "lint:fix" : "lint",
32
+ fallback: [
33
+ {
34
+ title: args.fix ? "oxlint --fix" : "oxlint",
35
+ bin: "oxlint",
36
+ args: [...fixArgs, ...passthrough],
37
+ },
38
+ {
39
+ title: args.fix ? "eslint --fix" : "eslint",
40
+ bin: "eslint",
41
+ args: [...fixArgs, ".", ...passthrough],
42
+ },
43
+ ],
44
+ });
45
+ if (!ran) {
46
+ // eslint-disable-next-line no-console
47
+ console.error(palette.err("nwire lint:") +
48
+ " no `lint` script and no installed linter (oxlint or eslint).");
49
+ process.exit(1);
50
+ }
29
51
  process.exit(code);
30
52
  },
31
53
  });
@@ -1 +1 @@
1
- {"version":3,"file":"lint.js","sourceRoot":"","sources":["../../src/commands/lint.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,EAAE,aAAa,EAAE,MAAM,OAAO,CAAC;AAEtC,OAAO,EAAE,WAAW,EAAE,MAAM,iBAAiB,CAAC;AAE9C,MAAM,CAAC,MAAM,WAAW,GAAG,aAAa,CAAC;IACvC,IAAI,EAAE;QACJ,IAAI,EAAE,MAAM;QACZ,WAAW,EAAE,8BAA8B;KAC5C;IACD,IAAI,EAAE;QACJ,GAAG,EAAE;YACH,IAAI,EAAE,SAAS;YACf,WAAW,EAAE,qCAAqC;YAClD,OAAO,EAAE,KAAK;SACf;KACF;IACD,KAAK,CAAC,GAAG,CAAC,EAAE,IAAI,EAAE,OAAO,EAAE;QACzB,MAAM,WAAW,GAAG,OAAO,CAAC,MAAM,CAAC,CAAC,CAAC,EAAE,EAAE,C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AG,CAAC,CAAC,CAAC,CAAC,OAAO,CAAC,CAAC,CAAC,CAAC,EAAE,CAAC;QAE1C,MAAM,EAAE,IAAI,EAAE,GAAG,EAAE,GAAG,MAAM,iBAAiB,CAAC,GAAG,EAAE;YACjD,aAAa,EAAE,MAAM;YACrB,cAAc,EAAE,IAAI,CAAC,GAAG,CAAC,CAAC,CAAC,UAAU,CAAC,CAAC,CAAC,MAAM;YAC9C,QAAQ,EAAE;gBACR;oBACE,KAAK,EAAE,IAAI,CAAC,GAAG,CAAC,CAAC,CAAC,cAAc,CAAC,CAAC,CAAC,QAAQ;oBAC3C,GAAG,EAAE,QAAQ;oBACb,IAAI,EAAE,CAAC,GAAG,OAAO,EAAE,GAAG,WAAW,CAAC;iBACnC;gBACD;oBACE,KAAK,EAAE,IAAI,CAAC,GAAG,CAAC,CAAC,CAAC,cAAc,CAAC,CAAC,CAAC,QAAQ;oBAC3C,GAAG,EAAE,QAAQ;oBACb,IAAI,EAAE,CAAC,GAAG,OAAO,EAAE,GAAG,EAAE,GAAG,WAAW,CAAC;iBACxC;aACF;SACF,CAAC,CAAC;QACH,IAAI,CAAC,GAAG,EAAE,CAAC;YACT,sCAAsC;YACtC,OAAO,CAAC,KAAK,CACX,OAAO,CAAC,GAAG,CAAC,aAAa,CAAC;gBACxB,+DAA+D,CAClE,CAAC;YACF,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC;QAClB,CAAC;QACD,OAAO,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;IACrB,CAAC;CACF,CAAC,CAAC"}
@@ -1,5 +1,6 @@
1
1
  /**
2
2
  * `nwire ls` — lists every discovered wire and every action.
3
+ * Runs an incremental scan first so the manifest is fresh.
3
4
  */
4
5
  export declare const lsCommand: import("citty").CommandDef<import("citty").ArgsDef>;
5
6
  //# sourceMappingURL=ls.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"ls.d.ts","sourceRoot":"","sources":["../../src/commands/ls.ts"],"names":[],"mappings":"AAAA;;GAEG;AAYH,eAAO,MAAM,SAAS,qDAcpB,CAAC"}
1
+ {"version":3,"file":"ls.d.ts","sourceRoot":"","sources":["../../src/commands/ls.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAaH,eAAO,MAAM,SAAS,qDAepB,CAAC"}
@@ -1,11 +1,13 @@
1
1
  /**
2
2
  * `nwire ls` — lists every discovered wire and every action.
3
+ * Runs an incremental scan first so the manifest is fresh.
3
4
  */
4
5
  import { defineCommand } from "citty";
5
6
  import { resolve, dirname } from "node:path";
6
7
  import { existsSync } from "node:fs";
7
8
  import { fileURLToPath } from "node:url";
8
9
  import { palette } from "../lib/colors.js";
10
+ import { ensureScanFresh } from "../lib/ensure-scan.js";
9
11
  import { viteNode } from "../lib/vite-node.js";
10
12
  const here = dirname(fileURLToPath(import.meta.url));
11
13
  export const lsCommand = defineCommand({
@@ -14,6 +16,7 @@ export const lsCommand = defineCommand({
14
16
  description: "List discovered wires + actions",
15
17
  },
16
18
  async run({ rawArgs }) {
19
+ ensureScanFresh(process.cwd(), { quiet: true });
17
20
  const builderPath = resolve(here, "..", "ls-runner.js");
18
21
  if (!existsSync(builderPath)) {
19
22
  // eslint-disable-next-line no-console
@@ -1 +1 @@
1
- {"version":3,"file":"ls.js","sourceRoot":"","sources":["../../src/commands/ls.ts"],"names":[],"mappings":"AAAA;;GAEG;AAEH,OAAO,EAAE,aAAa,EAAE,MAAM,OAAO,CAAC;AACtC,OAAO,EAAE,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AAC7C,OAAO,EAAE,UAAU,EAAE,MAAM,SAAS,CAAC;AACrC,OAAO,EAAE,aAAa,EAAE,MAAM,UAAU,CAAC;AAEzC,OAAO,EAAE,OAAO,EAAE,MAAM,eAAe,CAAC;AACxC,OAAO,EAAE,QAAQ,EAAE,MAAM,kBAAkB,CAAC;AAE5C,MAAM,IAAI,GAAG,OAAO,CAAC,aAAa,CAAC,MAAM,CAAC,IAAI,CAAC,GAAG,CAAC,CA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ACV,WAAW,EAAE,iCAAiC;KAC/C;IACD,KAAK,CAAC,GAAG,CAAC,EAAE,OAAO,EAAE;QACnB,eAAe,CAAC,OAAO,CAAC,GAAG,EAAE,EAAE,EAAE,KAAK,EAAE,IAAI,EAAE,CAAC,CAAC;QAChD,MAAM,WAAW,GAAG,OAAO,CAAC,IAAI,EAAE,IAAI,EAAE,cAAc,CAAC,CAAC;QACxD,IAAI,CAAC,UAAU,CAAC,WAAW,CAAC,EAAE,CAAC;YAC7B,sCAAsC;YACtC,OAAO,CAAC,KAAK,CAAC,OAAO,CAAC,GAAG,CAAC,WAAW,CAAC,GAAG,yBAAyB,WAAW,EAAE,CAAC,CAAC;YACjF,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC;QAClB,CAAC;QACD,OAAO,CAAC,IAAI,CAAC,QAAQ,CAAC,WAAW,EAAE,OAAO,CAAC,CAAC,CAAC;IAC/C,CAAC;CACF,CAAC,CAAC"}
@@ -1 +1 @@
1
- {"version":3,"file":"mcp.d.ts","sourceRoot":"","sources":["../../src/commands/mcp.ts"],"names":[],"mappings":"AAAA;;GAEG;AAKH,eAAO,MAAM,UAAU,qDAWrB,CAAC"}
1
+ {"version":3,"file":"mcp.d.ts","sourceRoot":"","sources":["../../src/commands/mcp.ts"],"names":[],"mappings":"AAAA;;GAEG;AAOH,eAAO,MAAM,UAAU,qDAWrB,CAAC"}
@@ -3,6 +3,7 @@
3
3
  */
4
4
  import { defineCommand } from "citty";
5
5
  import { serveMcp } from "@nwire/mcp";
6
+ import { cliVersion } from "../lib/version.js";
6
7
  export const mcpCommand = defineCommand({
7
8
  meta: {
8
9
  name: "mcp",
@@ -11,7 +12,7 @@ export const mcpCommand = defineCommand({
11
12
  async run() {
12
13
  await serveMcp({
13
14
  serverName: "nwire",
14
- serverVersion: "0.9.0",
15
+ serverVersion: cliVersion(),
15
16
  });
16
17
  },
17
18
  });
@@ -1 +1 @@
1
- {"version":3,"file":"mcp.js","sourceRoot":"","sources":["../../src/commands/mcp.ts"],"names":[],"mappings":"AAAA;;GAEG;AAEH,OAAO,EAAE,aAAa,EAAE,MAAM,OAAO,CAAC;AACtC,OAAO,EAAE,QAAQ,EAAE,MAAM,YAAY,CAAC;AAEtC,MAAM,CAAC,MAAM,UAAU,GAAG,aAAa,CAAC;IACtC,IAAI,EAAE;QACJ,IAAI,EAAE,KAAK;QACX,WAAW,EAAE,iDAAiD;KAC/D;IACD,KAAK,CAAC,GAAG;QACP,MAAM,QAAQ,CAAC;YACb,UAAU,EAAE,OAAO;YACnB,aAAa,EAAE,OAAO;SACvB,CAAC,CAAC;IACL,CAAC;CACF,CAAC,CAAC"}
1
+ {"version":3,"file":"mcp.js","sourceRoot":"","sources":["../../src/commands/mcp.ts"],"names":[],"mappings":"AAAA;;GAEG;AAEH,OAAO,EAAE,aAAa,EAAE,MAAM,OAAO,CAAC;AACtC,OAAO,EAAE,QAAQ,EAAE,MAAM,YAAY,CAAC;AAEtC,OAAO,EAAE,UAAU,EAAE,MAAM,gBAAgB,CAAC;AAE5C,MAAM,CAAC,MAAM,UAAU,GAAG,aAAa,CAAC;IACtC,IAAI,EAAE;QACJ,IAAI,EAAE,KAAK;QACX,WAAW,EAAE,iDAAiD;KAC/D;IACD,KAAK,CAAC,GAAG;QACP,MAAM,QAAQ,CAAC;YACb,UAAU,EAAE,OAAO;YACnB,aAAa,EAAE,UAAU,EAAE;SAC5B,CAAC,CAAC;IACL,CAAC;CACF,CAAC,CAAC"}
@@ -0,0 +1,29 @@
1
+ /**
2
+ * `ensureScanFresh` — guarantee `.nwire/manifest.json` (and the rest of
3
+ * the per-kind JSON files) reflect the current source tree. Called by
4
+ * every CLI command that reads the scan cache.
5
+ *
6
+ * Cheap path: compute fingerprint, compare to saved; if match, return.
7
+ * Expensive path: spawn the cache-runner under vite-node to rebuild,
8
+ * then save the new fingerprint. The expensive path runs at most once
9
+ * per source change.
10
+ */
11
+ export interface EnsureScanOptions {
12
+ /**
13
+ * When `true`, run the cache builder even if the fingerprint matches.
14
+ * Useful for `nwire cache` itself.
15
+ */
16
+ readonly force?: boolean;
17
+ /**
18
+ * When `true`, do not print "scan refreshed" messages. Default `false`.
19
+ */
20
+ readonly quiet?: boolean;
21
+ }
22
+ export interface EnsureScanResult {
23
+ /** Whether the cache was rebuilt during this call. */
24
+ readonly rebuilt: boolean;
25
+ /** The fingerprint that's now saved on disk. */
26
+ readonly fingerprint: string;
27
+ }
28
+ export declare function ensureScanFresh(cwd?: string, opts?: EnsureScanOptions): EnsureScanResult;
29
+ //# sourceMappingURL=ensure-scan.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"ensure-scan.d.ts","sourceRoot":"","sources":["../../src/lib/ensure-scan.ts"],"names":[],"mappings":"AAAA;;;;;;;;;GASG;AAYH,MAAM,WAAW,iBAAiB;IAChC;;;OAGG;IACH,QAAQ,CAAC,KAAK,CAAC,EAAE,OAAO,CAAC;IACzB;;OAEG;IACH,QAAQ,CAAC,KAAK,CAAC,EAAE,OAAO,CAAC;CAC1B;AAED,MAAM,WAAW,gBAAgB;IAC/B,sDAAsD;IACtD,QAAQ,CAAC,OAAO,EAAE,OAAO,CAAC;IAC1B,gDAAgD;IAChD,QAAQ,CAAC,WAAW,EAAE,MAAM,CAAC;CAC9B;AAED,wBAAgB,eAAe,CAC7B,GAAG,GAAE,MAAsB,EAC3B,IAAI,GAAE,iBAAsB,GAC3B,gBAAgB,CAyBlB"}
@@ -0,0 +1,42 @@
1
+ /**
2
+ * `ensureScanFresh` — guarantee `.nwire/manifest.json` (and the rest of
3
+ * the per-kind JSON files) reflect the current source tree. Called by
4
+ * every CLI command that reads the scan cache.
5
+ *
6
+ * Cheap path: compute fingerprint, compare to saved; if match, return.
7
+ * Expensive path: spawn the cache-runner under vite-node to rebuild,
8
+ * then save the new fingerprint. The expensive path runs at most once
9
+ * per source change.
10
+ */
11
+ import { existsSync } from "node:fs";
12
+ import { dirname, resolve } from "node:path";
13
+ import { fileURLToPath } from "node:url";
14
+ import { palette } from "./colors.js";
15
+ import { execSync } from "./exec.js";
16
+ import { fingerprint, isFresh, writeFingerprint } from "./scan-cache.js";
17
+ const here = dirname(fileURLToPath(import.meta.url));
18
+ export function ensureScanFresh(cwd = process.cwd(), opts = {}) {
19
+ const fp = fingerprint(cwd);
20
+ if (!opts.force && isFresh(cwd, fp)) {
21
+ return { rebuilt: false, fingerprint: fp };
22
+ }
23
+ const builderPath = resolve(here, "..", "cache-runner.js");
24
+ if (!existsSync(builderPath)) {
25
+ // Builder is missing from dist (dev-mode oddity). Skip — commands
26
+ // that need the cache will surface their own "no manifest" error.
27
+ return { rebuilt: false, fingerprint: fp };
28
+ }
29
+ if (!opts.quiet) {
30
+ // eslint-disable-next-line no-console
31
+ console.error(palette.dim("scanning project…"));
32
+ }
33
+ const code = execSync("pnpm", ["exec", "vite-node", builderPath]);
34
+ if (code !== 0) {
35
+ // Cache build failed; keep whatever's on disk. Don't update the
36
+ // fingerprint, so the next call retries.
37
+ return { rebuilt: false, fingerprint: fp };
38
+ }
39
+ writeFingerprint(cwd, fp);
40
+ return { rebuilt: true, fingerprint: fp };
41
+ }
42
+ //# sourceMappingURL=ensure-scan.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"ensure-scan.js","sourceRoot":"","sources":["../../src/lib/ensure-scan.ts"],"names":[],"mappings":"AAAA;;;;;;;;;GASG;AAEH,OAAO,EAAE,UAAU,EAAE,MAAM,SAAS,CAAC;AACrC,OAAO,EAAE,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AAC7C,OAAO,EAAE,aAAa,EAAE,MAAM,UAAU,CAAC;AAEzC,OAAO,EAAE,OAAO,EAAE,MAAM,UAAU,CAAC;AACnC,OAAO,EAAE,QAAQ,EAAE,MAAM,QAAQ,CAAC;AAClC,OAAO,EAAE,WAAW,EAAE,OAAO,EAAE,gBAAgB,EAAE,MAAM,cAAc,CAAC;AAEtE,MAAM,IAAI,GAAG,OAAO,CAAC,aAAa,CAAC,MAAM,CAAC,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