specdx 0.1.0-alpha.1

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 (49) hide show
  1. package/dist/commands/graph.d.ts +19 -0
  2. package/dist/commands/graph.d.ts.map +1 -0
  3. package/dist/commands/graph.js +36 -0
  4. package/dist/commands/graph.js.map +1 -0
  5. package/dist/commands/init.d.ts +26 -0
  6. package/dist/commands/init.d.ts.map +1 -0
  7. package/dist/commands/init.js +116 -0
  8. package/dist/commands/init.js.map +1 -0
  9. package/dist/commands/init.test.d.ts +2 -0
  10. package/dist/commands/init.test.d.ts.map +1 -0
  11. package/dist/commands/init.test.js +42 -0
  12. package/dist/commands/init.test.js.map +1 -0
  13. package/dist/commands/lint.d.ts +39 -0
  14. package/dist/commands/lint.d.ts.map +1 -0
  15. package/dist/commands/lint.js +66 -0
  16. package/dist/commands/lint.js.map +1 -0
  17. package/dist/commands/lint.test.d.ts +2 -0
  18. package/dist/commands/lint.test.d.ts.map +1 -0
  19. package/dist/commands/lint.test.js +61 -0
  20. package/dist/commands/lint.test.js.map +1 -0
  21. package/dist/commands/validate.d.ts +19 -0
  22. package/dist/commands/validate.d.ts.map +1 -0
  23. package/dist/commands/validate.js +25 -0
  24. package/dist/commands/validate.js.map +1 -0
  25. package/dist/formatters/github.d.ts +3 -0
  26. package/dist/formatters/github.d.ts.map +1 -0
  27. package/dist/formatters/github.js +10 -0
  28. package/dist/formatters/github.js.map +1 -0
  29. package/dist/formatters/json.d.ts +3 -0
  30. package/dist/formatters/json.d.ts.map +1 -0
  31. package/dist/formatters/json.js +4 -0
  32. package/dist/formatters/json.js.map +1 -0
  33. package/dist/formatters/pretty.d.ts +3 -0
  34. package/dist/formatters/pretty.d.ts.map +1 -0
  35. package/dist/formatters/pretty.js +11 -0
  36. package/dist/formatters/pretty.js.map +1 -0
  37. package/dist/index.d.ts +3 -0
  38. package/dist/index.d.ts.map +1 -0
  39. package/dist/index.js +3 -0
  40. package/dist/index.js.map +1 -0
  41. package/dist/main.d.ts +3 -0
  42. package/dist/main.d.ts.map +1 -0
  43. package/dist/main.js +14 -0
  44. package/dist/main.js.map +1 -0
  45. package/dist/shared-args.d.ts +18 -0
  46. package/dist/shared-args.d.ts.map +1 -0
  47. package/dist/shared-args.js +10 -0
  48. package/dist/shared-args.js.map +1 -0
  49. package/package.json +33 -0
@@ -0,0 +1,19 @@
1
+ declare const _default: import("citty").CommandDef<{
2
+ readonly quiet: {
3
+ type: "boolean";
4
+ description: string;
5
+ alias: string[];
6
+ };
7
+ readonly verbose: {
8
+ type: "boolean";
9
+ description: string;
10
+ alias: string[];
11
+ };
12
+ readonly format: {
13
+ type: "string";
14
+ description: string;
15
+ default: string;
16
+ };
17
+ }>;
18
+ export default _default;
19
+ //# sourceMappingURL=graph.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"graph.d.ts","sourceRoot":"","sources":["../../src/commands/graph.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;AAIA,wBA6BG"}
@@ -0,0 +1,36 @@
1
+ import { defineCommand } from "citty";
2
+ import { loadConfig, buildGraph, GraphError } from "@sdx/core";
3
+ import { sharedArgs } from "../shared-args.js";
4
+ export default defineCommand({
5
+ meta: { name: "graph", description: "Print the spec dependency graph" },
6
+ args: { ...sharedArgs },
7
+ async run({ args }) {
8
+ const config = await loadConfig(undefined, process.cwd());
9
+ try {
10
+ const graph = buildGraph(config);
11
+ const sorted = graph.topologicalSort();
12
+ if (args.format === "dot") {
13
+ console.log("digraph specs {");
14
+ for (const edge of graph.edges)
15
+ console.log(` "${edge.from}" -> "${edge.to}";`);
16
+ console.log("}");
17
+ return;
18
+ }
19
+ console.log("\n Spec Dependency Graph:\n");
20
+ for (const node of sorted) {
21
+ const downstream = graph.getDownstream(node);
22
+ const arrow = downstream.length > 0 ? ` → ${downstream.join(", ")}` : "";
23
+ console.log(` ${node}${arrow}`);
24
+ }
25
+ console.log("");
26
+ }
27
+ catch (err) {
28
+ if (err instanceof GraphError) {
29
+ console.error(` ✗ ${err.message}`);
30
+ process.exit(1);
31
+ }
32
+ throw err;
33
+ }
34
+ },
35
+ });
36
+ //# sourceMappingURL=graph.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"graph.js","sourceRoot":"","sources":["../../src/commands/graph.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,aAAa,EAAE,MAAM,OAAO,CAAC;AACtC,OAAO,EAAE,UAAU,EAAE,UAAU,EAAE,UAAU,EAAE,MAAM,WAAW,CAAC;AAC/D,OAAO,EAAE,UAAU,EAAE,MAAM,mBAAmB,CAAC;AAE/C,eAAe,aAAa,CAAC;IAC3B,IAAI,EAAE,EAAE,IAAI,EAAE,OAAO,EAAE,WAAW,EAAE,iCAAiC,EAAE;IACvE,IAAI,EAAE,EAAE,GAAG,UAAU,EAAE;IACvB,KAAK,CAAC,GAAG,CAAC,EAAE,IAAI,EAAE;QAChB,MAAM,MAAM,GAAG,MAAM,UAAU,CAAC,SAAS,EAAE,OAAO,CAAC,GAAG,EAAE,CAAC,CAAC;QAC1D,IAAI,CAAC;YACH,MAAM,KAAK,GAAG,UAAU,CAAC,MAAM,CAAC,CAAC;YACjC,MAAM,MAAM,GAAG,KAAK,CAAC,eAAe,EAAE,CAAC;YACvC,IAAI,IAAI,CAAC,MAAM,KAAK,KAAK,EAAE,CAAC;gBAC1B,OAAO,CAAC,GAAG,CAAC,iBAAiB,CAAC,CAAC;gBAC/B,KAAK,MAAM,IAAI,IAAI,KAAK,CAAC,KAAK;oBAAE,OAAO,CAAC,GAAG,CAAC,MAAM,IAAI,CAAC,IAAI,SAAS,IAAI,CAAC,EAAE,IAAI,CAAC,CAAC;gBACjF,OAAO,CAAC,GAAG,CAAC,GAAG,CAAC,CAAC;gBACjB,OAAO;YACT,CAAC;YACD,OAAO,CAAC,GAAG,CAAC,8BAA8B,CAAC,CAAC;YAC5C,KAAK,MAAM,IAAI,IAAI,MAAM,EAAE,CAAC;gBAC1B,MAAM,UAAU,GAAG,KAAK,CAAC,aAAa,CAAC,IAAI,CAAC,CAAC;gBAC7C,MAAM,KAAK,GAAG,UAAU,CAAC,MAAM,GAAG,CAAC,CAAC,CAAC,CAAC,MAAM,UAAU,CAAC,IAAI,CAAC,IAAI,CAAC,EAAE,CAAC,CAAC,CAAC,EAAE,CAAC;gBACzE,OAAO,CAAC,GAAG,CAAC,KAAK,IAAI,GAAG,KAAK,EAAE,CAAC,CAAC;YACnC,CAAC;YACD,OAAO,CAAC,GAAG,CAAC,EAAE,CAAC,CAAC;QAClB,CAAC;QAAC,OAAO,GAAG,EAAE,CAAC;YACb,IAAI,GAAG,YAAY,UAAU,EAAE,CAAC;gBAC9B,OAAO,CAAC,KAAK,CAAC,OAAO,GAAG,CAAC,OAAO,EAAE,CAAC,CAAC;gBACpC,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC;YAClB,CAAC;YACD,MAAM,GAAG,CAAC;QACZ,CAAC;IACH,CAAC;CACF,CAAC,CAAC"}
@@ -0,0 +1,26 @@
1
+ export type Template = "lightweight" | "bmad" | "api-first";
2
+ interface ScaffoldOptions {
3
+ projectName: string;
4
+ template: Template;
5
+ targetDir: string;
6
+ }
7
+ export declare function scaffoldProject({ projectName, template, targetDir, }: ScaffoldOptions): Promise<void>;
8
+ declare const _default: import("citty").CommandDef<{
9
+ readonly name: {
10
+ readonly type: "string";
11
+ readonly description: "Project name";
12
+ readonly required: true;
13
+ };
14
+ readonly template: {
15
+ readonly type: "string";
16
+ readonly description: "Template to use (lightweight, bmad, api-first)";
17
+ readonly default: "lightweight";
18
+ };
19
+ readonly dir: {
20
+ readonly type: "string";
21
+ readonly description: "Target directory";
22
+ readonly default: ".";
23
+ };
24
+ }>;
25
+ export default _default;
26
+ //# sourceMappingURL=init.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"init.d.ts","sourceRoot":"","sources":["../../src/commands/init.ts"],"names":[],"mappings":"AAKA,MAAM,MAAM,QAAQ,GAAG,aAAa,GAAG,MAAM,GAAG,WAAW,CAAC;AAE5D,UAAU,eAAe;IACvB,WAAW,EAAE,MAAM,CAAC;IACpB,QAAQ,EAAE,QAAQ,CAAC;IACnB,SAAS,EAAE,MAAM,CAAC;CACnB;AAmFD,wBAAsB,eAAe,CAAC,EACpC,WAAW,EACX,QAAQ,EACR,SAAS,GACV,EAAE,eAAe,GAAG,OAAO,CAAC,IAAI,CAAC,CAuBjC;;;;;;;;;;;;;;;;;;AAED,wBAiCG"}
@@ -0,0 +1,116 @@
1
+ import { defineCommand } from "citty";
2
+ import { mkdir, writeFile } from "node:fs/promises";
3
+ import { join } from "node:path";
4
+ import { REQUIRED_SECTIONS } from "@sdx/schema";
5
+ const TEMPLATE_SPECS = {
6
+ lightweight: [
7
+ { filename: "prd.md", type: "prd" },
8
+ { filename: "technical-design.md", type: "technical-design" },
9
+ ],
10
+ bmad: [
11
+ { filename: "prd.md", type: "prd" },
12
+ { filename: "technical-design.md", type: "technical-design" },
13
+ { filename: "test-plan.md", type: "test-plan" },
14
+ ],
15
+ "api-first": [
16
+ { filename: "technical-design.md", type: "technical-design" },
17
+ { filename: "api-contract.md", type: "api-contract" },
18
+ { filename: "test-plan.md", type: "test-plan" },
19
+ ],
20
+ };
21
+ const TEMPLATE_EXTRA_DIRS = {
22
+ lightweight: [],
23
+ bmad: ["specs/stories", "specs/adr"],
24
+ "api-first": [],
25
+ };
26
+ function specIdFromFilename(filename) {
27
+ return filename.replace(/\.md$/, "");
28
+ }
29
+ function specTitleFromType(type) {
30
+ return type
31
+ .split("-")
32
+ .map((w) => w.charAt(0).toUpperCase() + w.slice(1))
33
+ .join(" ");
34
+ }
35
+ function buildSpecFile(filename, type, projectName, today) {
36
+ const id = specIdFromFilename(filename);
37
+ const title = `${specTitleFromType(type)} — ${projectName}`;
38
+ const sections = REQUIRED_SECTIONS[type];
39
+ const frontmatter = [
40
+ "---",
41
+ `id: ${id}`,
42
+ `type: ${type}`,
43
+ `title: "${title}"`,
44
+ `status: draft`,
45
+ `version: "0.1"`,
46
+ `created: ${today}`,
47
+ `authors: []`,
48
+ "---",
49
+ ].join("\n");
50
+ const body = sections.map((section) => `\n## ${section}\n\n<!-- placeholder -->`).join("\n");
51
+ return `${frontmatter}\n${body}\n`;
52
+ }
53
+ function buildConfigYaml(projectName, specs) {
54
+ const specEntries = specs
55
+ .map(({ filename, type }) => {
56
+ const key = specIdFromFilename(filename);
57
+ return ` ${key}:\n path: specs/${filename}\n type: ${type}`;
58
+ })
59
+ .join("\n");
60
+ return ([`version: "1.0"`, `project:`, ` name: "${projectName}"`, `specs:`, specEntries].join("\n") +
61
+ "\n");
62
+ }
63
+ export async function scaffoldProject({ projectName, template, targetDir, }) {
64
+ const today = new Date().toISOString().slice(0, 10);
65
+ const specsDir = join(targetDir, "specs");
66
+ // Create specs/ directory
67
+ await mkdir(specsDir, { recursive: true });
68
+ // Create extra template dirs (e.g., bmad needs stories/ and adr/)
69
+ for (const extraDir of TEMPLATE_EXTRA_DIRS[template]) {
70
+ await mkdir(join(targetDir, extraDir), { recursive: true });
71
+ }
72
+ const specs = TEMPLATE_SPECS[template];
73
+ // Write spec files
74
+ for (const { filename, type } of specs) {
75
+ const content = buildSpecFile(filename, type, projectName, today);
76
+ await writeFile(join(specsDir, filename), content, "utf-8");
77
+ }
78
+ // Write spec.config.yaml
79
+ const configContent = buildConfigYaml(projectName, specs);
80
+ await writeFile(join(targetDir, "spec.config.yaml"), configContent, "utf-8");
81
+ }
82
+ export default defineCommand({
83
+ meta: {
84
+ name: "init",
85
+ description: "Initialize a new SDX project with spec scaffolding",
86
+ },
87
+ args: {
88
+ name: {
89
+ type: "string",
90
+ description: "Project name",
91
+ required: true,
92
+ },
93
+ template: {
94
+ type: "string",
95
+ description: "Template to use (lightweight, bmad, api-first)",
96
+ default: "lightweight",
97
+ },
98
+ dir: {
99
+ type: "string",
100
+ description: "Target directory",
101
+ default: ".",
102
+ },
103
+ },
104
+ async run({ args }) {
105
+ const { name, template, dir } = args;
106
+ const validTemplates = ["lightweight", "bmad", "api-first"];
107
+ if (!validTemplates.includes(template)) {
108
+ console.error(`Unknown template: ${template}. Choose from: ${validTemplates.join(", ")}`);
109
+ process.exit(1);
110
+ }
111
+ console.log(`Scaffolding "${name}" with template "${template}" in ${dir}...`);
112
+ await scaffoldProject({ projectName: name, template: template, targetDir: dir });
113
+ console.log(`Done! Project "${name}" scaffolded successfully.`);
114
+ },
115
+ });
116
+ //# sourceMappingURL=init.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"init.js","sourceRoot":"","sources":["../../src/commands/init.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,aAAa,EAAE,MAAM,OAAO,CAAC;AACtC,OAAO,EAAE,KAAK,EAAE,SAAS,EAAE,MAAM,kBAAkB,CAAC;AACpD,OAAO,EAAE,IAAI,EAAE,MAAM,WAAW,CAAC;AACjC,OAAO,EAAE,iBAAiB,EAAE,MAAM,aAAa,CAAC;AAUhD,MAAM,cAAc,GAGhB;IACF,WAAW,EAAE;QACX,EAAE,QAAQ,EAAE,QAAQ,EAAE,IAAI,EAAE,KAAK,EAAE;QACnC,EAAE,QAAQ,EAAE,qBAAqB,EAAE,IAAI,EAAE,kBAAkB,EAAE;KAC9D;IACD,IAAI,EAAE;QACJ,EAAE,QAAQ,EAAE,QAAQ,EAAE,IAAI,EAAE,KAAK,EAAE;QACnC,EAAE,QAAQ,EAAE,qBAAqB,EAAE,IAAI,EAAE,kBAAkB,EAAE;QAC7D,EAAE,QAAQ,EAAE,cAAc,EAAE,IAAI,EAAE,WAAW,EAAE;KAChD;IACD,WAAW,EAAE;QACX,EAAE,QAAQ,EAAE,qBAAqB,EAAE,IAAI,EAAE,kBAAkB,EAAE;QAC7D,EAAE,QAAQ,EAAE,iBAAiB,EAAE,IAAI,EAAE,cAAc,EAAE;QACrD,EAAE,QAAQ,EAAE,cAAc,EAAE,IAAI,EAAE,WAAW,EAAE;KAChD;CACF,CAAC;AAEF,MAAM,mBAAmB,GAA+B;IACtD,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QAC9E,MAAM,eAAe,CAAC,EAAE,WAAW,EAAE,IAAI,EAAE,QAAQ,EAAE,QAAoB,EAAE,SAAS,EAAE,GAAG,EAAE,CAAC,CAAC;QAC7F,OAAO,CAAC,GAAG,CAAC,kBAAkB,IAAI,4BAA4B,CAAC,CAAC;IAClE,CAAC;CACF,CAAC,CAAC"}
@@ -0,0 +1,2 @@
1
+ export {};
2
+ //# sourceMappingURL=init.test.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"init.test.d.ts","sourceRoot":"","sources":["../../src/commands/init.test.ts"],"names":[],"mappings":""}
@@ -0,0 +1,42 @@
1
+ import { describe, it, expect, beforeEach, afterEach } from "vitest";
2
+ import { mkdtemp, rm, readFile, readdir } from "node:fs/promises";
3
+ import { join } from "node:path";
4
+ import { tmpdir } from "node:os";
5
+ import { scaffoldProject } from "./init.js";
6
+ describe("scaffoldProject", () => {
7
+ let tempDir;
8
+ beforeEach(async () => {
9
+ tempDir = await mkdtemp(join(tmpdir(), "sdx-test-"));
10
+ });
11
+ afterEach(async () => {
12
+ await rm(tempDir, { recursive: true });
13
+ });
14
+ it("scaffolds a lightweight project", async () => {
15
+ await scaffoldProject({
16
+ projectName: "test-project",
17
+ template: "lightweight",
18
+ targetDir: tempDir,
19
+ });
20
+ const config = await readFile(join(tempDir, "spec.config.yaml"), "utf-8");
21
+ expect(config).toContain("version:");
22
+ expect(config).toContain("test-project");
23
+ const files = await readdir(join(tempDir, "specs"));
24
+ expect(files).toContain("prd.md");
25
+ expect(files).toContain("technical-design.md");
26
+ });
27
+ it("scaffolds a bmad project", async () => {
28
+ await scaffoldProject({ projectName: "bmad-project", template: "bmad", targetDir: tempDir });
29
+ const config = await readFile(join(tempDir, "spec.config.yaml"), "utf-8");
30
+ expect(config).toContain("bmad-project");
31
+ });
32
+ it("scaffolds an api-first project", async () => {
33
+ await scaffoldProject({
34
+ projectName: "api-project",
35
+ template: "api-first",
36
+ targetDir: tempDir,
37
+ });
38
+ const files = await readdir(join(tempDir, "specs"));
39
+ expect(files).toContain("api-contract.md");
40
+ });
41
+ });
42
+ //# sourceMappingURL=init.test.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"init.test.js","sourceRoot":"","sources":["../../src/commands/init.test.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAE,EAAE,EAAE,MAAM,EAAE,UAAU,EAAE,SAAS,EAAE,MAAM,QAAQ,CAAC;AACrE,OAAO,EAAE,OAAO,EAAE,EAAE,EAAE,QAAQ,EAAE,OAAO,EAAE,MAAM,kBAAkB,CAAC;AAClE,OAAO,EAAE,IAAI,EAAE,MAAM,WAAW,CAAC;AACjC,OAAO,EAAE,MAAM,EAAE,MAAM,SAAS,CAAC;AACjC,OAAO,EAAE,eAAe,EAAE,MAAM,WAAW,CAAC;AAE5C,QAAQ,CAAC,iBAAiB,EAAE,GAAG,EAAE;IAC/B,IAAI,OAAe,CAAC;IAEpB,UAAU,CAAC,KAAK,IAAI,EAAE;QACpB,OAAO,GAAG,MAAM,OAAO,CAAC,IAAI,CAAC,MAAM,EAAE,EAAE,WAAW,CAAC,CAAC,CAAC;IACvD,CAAC,CAAC,CAAC;IACH,SAAS,CAAC,KAAK,IAAI,EAAE;QACnB,MAAM,EAAE,CAAC,OAAO,EAAE,EAAE,SAAS,EAAE,IAAI,EAAE,CAAC,CAAC;IACzC,CAAC,CAAC,CAAC;IAEH,EAAE,CAAC,iCAAiC,EAAE,KAAK,IAAI,EAAE;QAC/C,MAAM,eAAe,CAAC;YACpB,WAAW,EAAE,cAAc;YAC3B,QAAQ,EAAE,aAAa;YACvB,SAAS,EAAE,OAAO;SACnB,CAAC,CAAC;QACH,MAAM,MAAM,GAAG,MAAM,QAAQ,CAAC,IAAI,CAAC,OAAO,EAAE,kBAAkB,CAAC,EAAE,OAAO,CAAC,CAAC;QAC1E,MAAM,CAAC,MAAM,CAAC,CAAC,SAAS,CAAC,UAAU,CAAC,CAAC;QACrC,MAAM,CAAC,MAAM,CAAC,CAAC,SAAS,CAAC,cAAc,CAAC,CAAC;QACzC,MAAM,KAAK,GAAG,MAAM,OAAO,CAAC,IAAI,CAAC,OAAO,EAAE,OAAO,CAAC,CAAC,CAAC;QACpD,MAAM,CAAC,KAAK,CAAC,CAAC,SAAS,CAAC,QAAQ,CAAC,CAAC;QAClC,MAAM,CAAC,KAAK,CAAC,CAAC,SAAS,CAAC,qBAAqB,CAAC,CAAC;IACjD,CAAC,CAAC,CAAC;IAEH,EAAE,CAAC,0BAA0B,EAAE,KAAK,IAAI,EAAE;QACxC,MAAM,eAAe,CAAC,EAAE,WAAW,EAAE,cAAc,EAAE,QAAQ,EAAE,MAAM,EAAE,SAAS,EAAE,OAAO,EAAE,CAAC,CAAC;QAC7F,MAAM,MAAM,GAAG,MAAM,QAAQ,CAAC,IAAI,CAAC,OAAO,EAAE,kBAAkB,CAAC,EAAE,OAAO,CAAC,CAAC;QAC1E,MAAM,CAAC,MAAM,CAAC,CAAC,SAAS,CAAC,cAAc,CAAC,CAAC;IAC3C,CAAC,CAAC,CAAC;IAEH,EAAE,CAAC,gCAAgC,EAAE,KAAK,IAAI,EAAE;QAC9C,MAAM,eAAe,CAAC;YACpB,WAAW,EAAE,aAAa;YAC1B,QAAQ,EAAE,WAAW;YACrB,SAAS,EAAE,OAAO;SACnB,CAAC,CAAC;QACH,MAAM,KAAK,GAAG,MAAM,OAAO,CAAC,IAAI,CAAC,OAAO,EAAE,OAAO,CAAC,CAAC,CAAC;QACpD,MAAM,CAAC,KAAK,CAAC,CAAC,SAAS,CAAC,iBAAiB,CAAC,CAAC;IAC7C,CAAC,CAAC,CAAC;AACL,CAAC,CAAC,CAAC"}
@@ -0,0 +1,39 @@
1
+ import { type LintResults } from "@sdx/lint";
2
+ export interface RunLintOptions {
3
+ configDir: string;
4
+ specPath?: string;
5
+ preset?: "minimal" | "recommended" | "strict";
6
+ }
7
+ export declare function runLint(options: RunLintOptions): Promise<LintResults>;
8
+ declare const _default: import("citty").CommandDef<{
9
+ readonly fix: {
10
+ readonly type: "boolean";
11
+ readonly description: "Auto-fix issues where possible";
12
+ };
13
+ readonly path: {
14
+ readonly type: "positional";
15
+ readonly description: "Lint a specific spec file";
16
+ readonly required: false;
17
+ };
18
+ readonly preset: {
19
+ readonly type: "string";
20
+ readonly description: "Lint preset (minimal, recommended, strict)";
21
+ };
22
+ readonly quiet: {
23
+ type: "boolean";
24
+ description: string;
25
+ alias: string[];
26
+ };
27
+ readonly verbose: {
28
+ type: "boolean";
29
+ description: string;
30
+ alias: string[];
31
+ };
32
+ readonly format: {
33
+ type: "string";
34
+ description: string;
35
+ default: string;
36
+ };
37
+ }>;
38
+ export default _default;
39
+ //# sourceMappingURL=lint.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"lint.d.ts","sourceRoot":"","sources":["../../src/commands/lint.ts"],"names":[],"mappings":"AAEA,OAAO,EAA+B,KAAK,WAAW,EAAE,MAAM,WAAW,CAAC;AAO1E,MAAM,WAAW,cAAc;IAC7B,SAAS,EAAE,MAAM,CAAC;IAClB,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,MAAM,CAAC,EAAE,SAAS,GAAG,aAAa,GAAG,QAAQ,CAAC;CAC/C;AAED,wBAAsB,OAAO,CAAC,OAAO,EAAE,cAAc,GAAG,OAAO,CAAC,WAAW,CAAC,CAoC3E;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAED,wBA2BG"}
@@ -0,0 +1,66 @@
1
+ import { defineCommand } from "citty";
2
+ import { loadConfig, parseSpec, resolveGlob, buildGraph, createLogger } from "@sdx/core";
3
+ import { createLintEngine, getPreset } from "@sdx/lint";
4
+ import { sharedArgs } from "../shared-args.js";
5
+ import { formatPretty } from "../formatters/pretty.js";
6
+ import { formatJson } from "../formatters/json.js";
7
+ import { formatGithub } from "../formatters/github.js";
8
+ export async function runLint(options) {
9
+ const config = await loadConfig(undefined, options.configDir);
10
+ const preset = options.preset ?? config.lint?.extends ?? "recommended";
11
+ const rules = getPreset(preset);
12
+ const specs = [];
13
+ for (const [, entry] of Object.entries(config.specs)) {
14
+ const files = await resolveGlob(entry.path, options.configDir);
15
+ for (const file of files) {
16
+ if (options.specPath && !file.includes(options.specPath))
17
+ continue;
18
+ specs.push(await parseSpec(file));
19
+ }
20
+ }
21
+ let graph;
22
+ let graphError;
23
+ try {
24
+ graph = buildGraph(config);
25
+ }
26
+ catch (err) {
27
+ graphError = err.message;
28
+ }
29
+ const engine = createLintEngine({ rules, config, graph });
30
+ const results = engine.lint(specs);
31
+ if (graphError) {
32
+ results.diagnostics.push({
33
+ ruleId: "structure/no-circular-deps",
34
+ severity: "error",
35
+ message: graphError,
36
+ filePath: "spec.config.yaml",
37
+ });
38
+ results.hasErrors = true;
39
+ }
40
+ return results;
41
+ }
42
+ export default defineCommand({
43
+ meta: { name: "lint", description: "Lint all specs in the suite" },
44
+ args: {
45
+ ...sharedArgs,
46
+ fix: { type: "boolean", description: "Auto-fix issues where possible" },
47
+ path: { type: "positional", description: "Lint a specific spec file", required: false },
48
+ preset: { type: "string", description: "Lint preset (minimal, recommended, strict)" },
49
+ },
50
+ async run({ args }) {
51
+ const logger = createLogger({ quiet: args.quiet, verbose: args.verbose });
52
+ if (args.fix) {
53
+ logger.info("No auto-fixable issues supported yet.");
54
+ }
55
+ const results = await runLint({
56
+ configDir: process.cwd(),
57
+ specPath: args.path,
58
+ preset: args.preset,
59
+ });
60
+ const formatter = args.format === "json" ? formatJson : args.format === "github" ? formatGithub : formatPretty;
61
+ console.log(formatter(results.diagnostics));
62
+ if (results.hasErrors)
63
+ process.exit(1);
64
+ },
65
+ });
66
+ //# sourceMappingURL=lint.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"lint.js","sourceRoot":"","sources":["../../src/commands/lint.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,aAAa,EAAE,MAAM,OAAO,CAAC;AACtC,OAAO,EAAE,UAAU,EAAE,SAAS,EAAE,WAAW,EAAE,UAAU,EAAE,YAAY,EAAE,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,EAAE;YACxB,QAAQ,EAAE,IAAI,CAAC,IAAI;YACnB,MAAM,EAAE,IAAI,CAAC,MAAa;SAC3B,CAAC,CAAC;QAEH,MAAM,SAAS,GACb,IAAI,CAAC,MAAM,KAAK,MAAM,CAAC,CAAC,CAAC,UAAU,CAAC,CAAC,CAAC,IAAI,CAAC,MAAM,KAAK,QAAQ,CAAC,CAAC,CAAC,YAAY,CAAC,CAAC,CAAC,YAAY,CAAC;QAC/F,OAAO,CAAC,GAAG,CAAC,SAAS,CAAC,OAAO,CAAC,WAAW,CAAC,CAAC,CAAC;QAE5C,IAAI,OAAO,CAAC,SAAS;YAAE,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC;IACzC,CAAC;CACF,CAAC,CAAC"}
@@ -0,0 +1,2 @@
1
+ export {};
2
+ //# sourceMappingURL=lint.test.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"lint.test.d.ts","sourceRoot":"","sources":["../../src/commands/lint.test.ts"],"names":[],"mappings":""}
@@ -0,0 +1,61 @@
1
+ import { describe, it, expect, beforeEach, afterEach } from "vitest";
2
+ import { mkdtemp, rm, writeFile, mkdir } from "node:fs/promises";
3
+ import { join } from "node:path";
4
+ import { tmpdir } from "node:os";
5
+ import { runLint } from "./lint.js";
6
+ describe("runLint", () => {
7
+ let tempDir;
8
+ beforeEach(async () => {
9
+ tempDir = await mkdtemp(join(tmpdir(), "sdx-lint-test-"));
10
+ await mkdir(join(tempDir, "specs"), { recursive: true });
11
+ });
12
+ afterEach(async () => {
13
+ await rm(tempDir, { recursive: true });
14
+ });
15
+ it("returns diagnostics for a spec with issues", async () => {
16
+ await writeFile(join(tempDir, "spec.config.yaml"), `version: "1.0"\nspecs:\n prd:\n path: "specs/prd.md"\n type: "prd"\n`);
17
+ await writeFile(join(tempDir, "specs/prd.md"), `---\nid: "prd-001"\ntype: "prd"\ntitle: "Test"\nstatus: "draft"\nversion: "1.0"\ncreated: "2026-01-01"\nauthors: ["dev"]\n---\n\n# Test\n\n## Problem Statement\n\nSome content with TBD items.\n`);
18
+ const result = await runLint({ configDir: tempDir });
19
+ expect(result.diagnostics.length).toBeGreaterThan(0);
20
+ });
21
+ it("passes for a well-formed spec", async () => {
22
+ await writeFile(join(tempDir, "spec.config.yaml"), `version: "1.0"\nspecs:\n prd:\n path: "specs/prd.md"\n type: "prd"\n`);
23
+ await writeFile(join(tempDir, "specs/prd.md"), [
24
+ "---",
25
+ 'id: "prd-001"',
26
+ 'type: "prd"',
27
+ 'title: "Test"',
28
+ 'status: "draft"',
29
+ 'version: "1.0"',
30
+ 'created: "2026-01-01"',
31
+ 'authors: ["dev"]',
32
+ "---",
33
+ "",
34
+ "# Test",
35
+ "",
36
+ "## Problem Statement",
37
+ "",
38
+ "Users need a solution.",
39
+ "",
40
+ "## Goals",
41
+ "",
42
+ "- Be useful",
43
+ "",
44
+ "## Non-Goals",
45
+ "",
46
+ "- Everything else",
47
+ "",
48
+ "## Features",
49
+ "",
50
+ "- **F1**: Core feature",
51
+ "",
52
+ "## Success Criteria",
53
+ "",
54
+ "- It works",
55
+ ].join("\n"));
56
+ const result = await runLint({ configDir: tempDir });
57
+ const errors = result.diagnostics.filter((d) => d.severity === "error");
58
+ expect(errors).toHaveLength(0);
59
+ });
60
+ });
61
+ //# sourceMappingURL=lint.test.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"lint.test.js","sourceRoot":"","sources":["../../src/commands/lint.test.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAE,EAAE,EAAE,MAAM,EAAE,UAAU,EAAE,SAAS,EAAE,MAAM,QAAQ,CAAC;AACrE,OAAO,EAAE,OAAO,EAAE,EAAE,EAAE,SAAS,EAAE,KAAK,EAAE,MAAM,kBAAkB,CAAC;AACjE,OAAO,EAAE,IAAI,EAAE,MAAM,WAAW,CAAC;AACjC,OAAO,EAAE,MAAM,EAAE,MAAM,SAAS,CAAC;AACjC,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,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,QAAQ;YACR,EAAE;YACF,sBAAsB;YACtB,EAAE;YACF,wBAAwB;YACxB,EAAE;YACF,UAAU;YACV,EAAE;YACF,aAAa;YACb,EAAE;YACF,cAAc;YACd,EAAE;YACF,mBAAmB;YACnB,EAAE;YACF,aAAa;YACb,EAAE;YACF,wBAAwB;YACxB,EAAE;YACF,qBAAqB;YACrB,EAAE;YACF,YAAY;SACb,CAAC,IAAI,CAAC,IAAI,CAAC,CACb,CAAC;QACF,MAAM,MAAM,GAAG,MAAM,OAAO,CAAC,EAAE,SAAS,EAAE,OAAO,EAAE,CAAC,CAAC;QACrD,MAAM,MAAM,GAAG,MAAM,CAAC,WAAW,CAAC,MAAM,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,QAAQ,KAAK,OAAO,CAAC,CAAC;QACxE,MAAM,CAAC,MAAM,CAAC,CAAC,YAAY,CAAC,CAAC,CAAC,CAAC;IACjC,CAAC,CAAC,CAAC;AACL,CAAC,CAAC,CAAC"}
@@ -0,0 +1,19 @@
1
+ declare const _default: import("citty").CommandDef<{
2
+ readonly quiet: {
3
+ type: "boolean";
4
+ description: string;
5
+ alias: string[];
6
+ };
7
+ readonly verbose: {
8
+ type: "boolean";
9
+ description: string;
10
+ alias: string[];
11
+ };
12
+ readonly format: {
13
+ type: "string";
14
+ description: string;
15
+ default: string;
16
+ };
17
+ }>;
18
+ export default _default;
19
+ //# sourceMappingURL=validate.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"validate.d.ts","sourceRoot":"","sources":["../../src/commands/validate.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;AAIA,wBAkBG"}
@@ -0,0 +1,25 @@
1
+ import { defineCommand } from "citty";
2
+ import { loadConfig, ConfigError } from "@sdx/core";
3
+ import { sharedArgs } from "../shared-args.js";
4
+ export default defineCommand({
5
+ meta: { name: "validate", description: "Validate spec.config.yaml" },
6
+ args: { ...sharedArgs },
7
+ async run() {
8
+ try {
9
+ const config = await loadConfig(undefined, process.cwd());
10
+ console.log(` ✓ Config valid. ${Object.keys(config.specs).length} specs defined.`);
11
+ }
12
+ catch (err) {
13
+ if (err instanceof ConfigError) {
14
+ console.error(` ✗ Config invalid: ${err.message}`);
15
+ if (err.errors) {
16
+ for (const e of err.errors)
17
+ console.error(` - ${JSON.stringify(e)}`);
18
+ }
19
+ process.exit(1);
20
+ }
21
+ throw err;
22
+ }
23
+ },
24
+ });
25
+ //# sourceMappingURL=validate.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"validate.js","sourceRoot":"","sources":["../../src/commands/validate.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,aAAa,EAAE,MAAM,OAAO,CAAC;AACtC,OAAO,EAAE,UAAU,EAAE,WAAW,EAAE,MAAM,WAAW,CAAC;AACpD,OAAO,EAAE,UAAU,EAAE,MAAM,mBAAmB,CAAC;AAE/C,eAAe,aAAa,CAAC;IAC3B,IAAI,EAAE,EAAE,IAAI,EAAE,UAAU,EAAE,WAAW,EAAE,2BAA2B,EAAE;IACpE,IAAI,EAAE,EAAE,GAAG,UAAU,EAAE;IACvB,KAAK,CAAC,GAAG;QACP,IAAI,CAAC;YACH,MAAM,MAAM,GAAG,MAAM,UAAU,CAAC,SAAS,EAAE,OAAO,CAAC,GAAG,EAAE,CAAC,CAAC;YAC1D,OAAO,CAAC,GAAG,CAAC,qBAAqB,MAAM,CAAC,IAAI,CAAC,MAAM,CAAC,KAAK,CAAC,CAAC,MAAM,iBAAiB,CAAC,CAAC;QACtF,CAAC;QAAC,OAAO,GAAG,EAAE,CAAC;YACb,IAAI,GAAG,YAAY,WAAW,EAAE,CAAC;gBAC/B,OAAO,CAAC,KAAK,CAAC,uBAAuB,GAAG,CAAC,OAAO,EAAE,CAAC,CAAC;gBACpD,IAAI,GAAG,CAAC,MAAM,EAAE,CAAC;oBACf,KAAK,MAAM,CAAC,IAAI,GAAG,CAAC,MAAM;wBAAE,OAAO,CAAC,KAAK,CAAC,SAAS,IAAI,CAAC,SAAS,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC;gBAC1E,CAAC;gBACD,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC;YAClB,CAAC;YACD,MAAM,GAAG,CAAC;QACZ,CAAC;IACH,CAAC;CACF,CAAC,CAAC"}
@@ -0,0 +1,3 @@
1
+ import type { Diagnostic } from "@sdx/lint";
2
+ export declare function formatGithub(diagnostics: Diagnostic[]): string;
3
+ //# sourceMappingURL=github.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"github.d.ts","sourceRoot":"","sources":["../../src/formatters/github.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,WAAW,CAAC;AAC5C,wBAAgB,YAAY,CAAC,WAAW,EAAE,UAAU,EAAE,GAAG,MAAM,CAQ9D"}
@@ -0,0 +1,10 @@
1
+ export function formatGithub(diagnostics) {
2
+ return diagnostics
3
+ .map((d) => {
4
+ const level = d.severity === "error" ? "error" : "warning";
5
+ const line = d.line ? `,line=${d.line}` : "";
6
+ return `::${level} file=${d.filePath}${line}::${d.message} (${d.ruleId})`;
7
+ })
8
+ .join("\n");
9
+ }
10
+ //# sourceMappingURL=github.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"github.js","sourceRoot":"","sources":["../../src/formatters/github.ts"],"names":[],"mappings":"AACA,MAAM,UAAU,YAAY,CAAC,WAAyB;IACpD,OAAO,WAAW;SACf,GAAG,CAAC,CAAC,CAAC,EAAE,EAAE;QACT,MAAM,KAAK,GAAG,CAAC,CAAC,QAAQ,KAAK,OAAO,CAAC,CAAC,CAAC,OAAO,CAAC,CAAC,CAAC,SAAS,CAAC;QAC3D,MAAM,IAAI,GAAG,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,SAAS,CAAC,CAAC,IAAI,EAAE,CAAC,CAAC,CAAC,EAAE,CAAC;QAC7C,OAAO,KAAK,KAAK,SAAS,CAAC,CAAC,QAAQ,GAAG,IAAI,KAAK,CAAC,CAAC,OAAO,KAAK,CAAC,CAAC,MAAM,GAAG,CAAC;IAC5E,CAAC,CAAC;SACD,IAAI,CAAC,IAAI,CAAC,CAAC;AAChB,CAAC"}
@@ -0,0 +1,3 @@
1
+ import type { Diagnostic } from "@sdx/lint";
2
+ export declare function formatJson(diagnostics: Diagnostic[]): string;
3
+ //# sourceMappingURL=json.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"json.d.ts","sourceRoot":"","sources":["../../src/formatters/json.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,WAAW,CAAC;AAC5C,wBAAgB,UAAU,CAAC,WAAW,EAAE,UAAU,EAAE,GAAG,MAAM,CAE5D"}
@@ -0,0 +1,4 @@
1
+ export function formatJson(diagnostics) {
2
+ return JSON.stringify(diagnostics, null, 2);
3
+ }
4
+ //# sourceMappingURL=json.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"json.js","sourceRoot":"","sources":["../../src/formatters/json.ts"],"names":[],"mappings":"AACA,MAAM,UAAU,UAAU,CAAC,WAAyB;IAClD,OAAO,IAAI,CAAC,SAAS,CAAC,WAAW,EAAE,IAAI,EAAE,CAAC,CAAC,CAAC;AAC9C,CAAC"}
@@ -0,0 +1,3 @@
1
+ import type { Diagnostic } from "@sdx/lint";
2
+ export declare function formatPretty(diagnostics: Diagnostic[]): string;
3
+ //# sourceMappingURL=pretty.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"pretty.d.ts","sourceRoot":"","sources":["../../src/formatters/pretty.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,WAAW,CAAC;AAE5C,wBAAgB,YAAY,CAAC,WAAW,EAAE,UAAU,EAAE,GAAG,MAAM,CAQ9D"}
@@ -0,0 +1,11 @@
1
+ export function formatPretty(diagnostics) {
2
+ if (diagnostics.length === 0)
3
+ return " ✓ All specs pass lint checks.\n";
4
+ return diagnostics
5
+ .map((d) => {
6
+ const icon = d.severity === "error" ? "✗" : d.severity === "warn" ? "⚠" : "ℹ";
7
+ return ` ${icon} ${d.severity} ${d.message} (${d.ruleId})\n ${d.filePath}${d.line ? `:${d.line}` : ""}`;
8
+ })
9
+ .join("\n");
10
+ }
11
+ //# sourceMappingURL=pretty.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"pretty.js","sourceRoot":"","sources":["../../src/formatters/pretty.ts"],"names":[],"mappings":"AAEA,MAAM,UAAU,YAAY,CAAC,WAAyB;IACpD,IAAI,WAAW,CAAC,MAAM,KAAK,CAAC;QAAE,OAAO,mCAAmC,CAAC;IACzE,OAAO,WAAW;SACf,GAAG,CAAC,CAAC,CAAC,EAAE,EAAE;QACT,MAAM,IAAI,GAAG,CAAC,CAAC,QAAQ,KAAK,OAAO,CAAC,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,CAAC,QAAQ,KAAK,MAAM,CAAC,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC,GAAG,CAAC;QAC9E,OAAO,KAAK,IAAI,IAAI,CAAC,CAAC,QAAQ,KAAK,CAAC,CAAC,OAAO,MAAM,CAAC,CAAC,MAAM,UAAU,CAAC,CAAC,QAAQ,GAAG,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC,IAAI,EAAE,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC;IAChH,CAAC,CAAC;SACD,IAAI,CAAC,IAAI,CAAC,CAAC;AAChB,CAAC"}
@@ -0,0 +1,3 @@
1
+ export { scaffoldProject } from "./commands/init.js";
2
+ export { runLint } from "./commands/lint.js";
3
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,eAAe,EAAE,MAAM,oBAAoB,CAAC;AACrD,OAAO,EAAE,OAAO,EAAE,MAAM,oBAAoB,CAAC"}
package/dist/index.js ADDED
@@ -0,0 +1,3 @@
1
+ export { scaffoldProject } from "./commands/init.js";
2
+ export { runLint } from "./commands/lint.js";
3
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,eAAe,EAAE,MAAM,oBAAoB,CAAC;AACrD,OAAO,EAAE,OAAO,EAAE,MAAM,oBAAoB,CAAC"}
package/dist/main.d.ts ADDED
@@ -0,0 +1,3 @@
1
+ #!/usr/bin/env node
2
+ export {};
3
+ //# sourceMappingURL=main.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"main.d.ts","sourceRoot":"","sources":["../src/main.ts"],"names":[],"mappings":""}
package/dist/main.js ADDED
@@ -0,0 +1,14 @@
1
+ #!/usr/bin/env node
2
+ import { defineCommand, runMain } from "citty";
3
+ import initCommand from "./commands/init.js";
4
+ const main = defineCommand({
5
+ meta: { name: "sdx", version: "0.0.0", description: "SDX — Spec Developer Experience" },
6
+ subCommands: {
7
+ init: initCommand,
8
+ lint: () => import("./commands/lint.js").then((m) => m.default),
9
+ validate: () => import("./commands/validate.js").then((m) => m.default),
10
+ graph: () => import("./commands/graph.js").then((m) => m.default),
11
+ },
12
+ });
13
+ runMain(main);
14
+ //# sourceMappingURL=main.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"main.js","sourceRoot":"","sources":["../src/main.ts"],"names":[],"mappings":";AACA,OAAO,EAAE,aAAa,EAAE,OAAO,EAAE,MAAM,OAAO,CAAC;AAC/C,OAAO,WAAW,MAAM,oBAAoB,CAAC;AAE7C,MAAM,IAAI,GAAG,aAAa,CAAC;IACzB,IAAI,EAAE,EAAE,IAAI,EAAE,KAAK,EAAE,OAAO,EAAE,OAAO,EAAE,WAAW,EAAE,iCAAiC,EAAE;IACvF,WAAW,EAAE;QACX,IAAI,EAAE,WAAW;QACjB,IAAI,EAAE,GAAG,EAAE,CAAC,MAAM,CAAC,oBAAoB,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,OAAO,CAAC;QAC/D,QAAQ,EAAE,GAAG,EAAE,CAAC,MAAM,CAAC,wBAAwB,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,OAAO,CAAC;QACvE,KAAK,EAAE,GAAG,EAAE,CAAC,MAAM,CAAC,qBAAqB,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,OAAO,CAAC;KAClE;CACF,CAAC,CAAC;AAEH,OAAO,CAAC,IAAI,CAAC,CAAC"}
@@ -0,0 +1,18 @@
1
+ export declare const sharedArgs: {
2
+ quiet: {
3
+ type: "boolean";
4
+ description: string;
5
+ alias: string[];
6
+ };
7
+ verbose: {
8
+ type: "boolean";
9
+ description: string;
10
+ alias: string[];
11
+ };
12
+ format: {
13
+ type: "string";
14
+ description: string;
15
+ default: string;
16
+ };
17
+ };
18
+ //# sourceMappingURL=shared-args.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"shared-args.d.ts","sourceRoot":"","sources":["../src/shared-args.ts"],"names":[],"mappings":"AAAA,eAAO,MAAM,UAAU;;;;;;;;;;;;;;;;CAQtB,CAAC"}
@@ -0,0 +1,10 @@
1
+ export const sharedArgs = {
2
+ quiet: { type: "boolean", description: "Suppress info output", alias: ["q"] },
3
+ verbose: { type: "boolean", description: "Enable debug output", alias: ["V"] },
4
+ format: {
5
+ type: "string",
6
+ description: "Output format (pretty, json, github)",
7
+ default: "pretty",
8
+ },
9
+ };
10
+ //# sourceMappingURL=shared-args.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"shared-args.js","sourceRoot":"","sources":["../src/shared-args.ts"],"names":[],"mappings":"AAAA,MAAM,CAAC,MAAM,UAAU,GAAG;IACxB,KAAK,EAAE,EAAE,IAAI,EAAE,SAAkB,EAAE,WAAW,EAAE,sBAAsB,EAAE,KAAK,EAAE,CAAC,GAAG,CAAC,EAAE;IACtF,OAAO,EAAE,EAAE,IAAI,EAAE,SAAkB,EAAE,WAAW,EAAE,qBAAqB,EAAE,KAAK,EAAE,CAAC,GAAG,CAAC,EAAE;IACvF,MAAM,EAAE;QACN,IAAI,EAAE,QAAiB;QACvB,WAAW,EAAE,sCAAsC;QACnD,OAAO,EAAE,QAAQ;KAClB;CACF,CAAC"}
package/package.json ADDED
@@ -0,0 +1,33 @@
1
+ {
2
+ "name": "specdx",
3
+ "version": "0.1.0-alpha.1",
4
+ "type": "module",
5
+ "bin": {
6
+ "sdx": "./dist/main.js"
7
+ },
8
+ "exports": {
9
+ ".": {
10
+ "import": "./dist/index.js",
11
+ "types": "./dist/index.d.ts"
12
+ }
13
+ },
14
+ "files": [
15
+ "dist"
16
+ ],
17
+ "scripts": {
18
+ "build": "tsc --build",
19
+ "typecheck": "tsc --build --noEmit",
20
+ "test": "vitest run",
21
+ "clean": "rm -rf dist *.tsbuildinfo"
22
+ },
23
+ "dependencies": {
24
+ "@sdx/schema": "workspace:*",
25
+ "@sdx/core": "workspace:*",
26
+ "@sdx/lint": "workspace:*",
27
+ "citty": "^0.2.1",
28
+ "consola": "^3.4.0"
29
+ },
30
+ "devDependencies": {
31
+ "typescript": "^5.7.0"
32
+ }
33
+ }