specdx 0.4.0-alpha.2 → 0.4.0-alpha.20
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/.claude-plugin/plugin.json +7 -2
- package/LICENSE +21 -0
- package/README.md +477 -0
- package/dist/{check-PZFBVQIP.js → check-GGQB3SHI.js} +36 -10
- package/dist/check-GGQB3SHI.js.map +1 -0
- package/dist/chunk-5WRI5ZAA.js +31 -0
- package/dist/chunk-CI7KYTC7.js +103 -0
- package/dist/chunk-CI7KYTC7.js.map +1 -0
- package/dist/chunk-FBMYBYFB.js +182 -0
- package/dist/chunk-FBMYBYFB.js.map +1 -0
- package/dist/{chunk-FZWT4HVX.js → chunk-MM325DR6.js} +156 -2
- package/dist/chunk-MM325DR6.js.map +1 -0
- package/dist/chunk-RY5CDUNN.js +2846 -0
- package/dist/chunk-RY5CDUNN.js.map +1 -0
- package/dist/{chunk-YRDOYUKF.js → chunk-T232GZ2L.js} +124 -19
- package/dist/chunk-T232GZ2L.js.map +1 -0
- package/dist/{chunk-PHWUK7TH.js → chunk-UZKOJL2N.js} +288 -50
- package/dist/chunk-UZKOJL2N.js.map +1 -0
- package/dist/{chunk-QEUZJWBY.js → chunk-ZB5R5SK5.js} +364 -59
- package/dist/chunk-ZB5R5SK5.js.map +1 -0
- package/dist/{chunk-YDU26YTH.js → chunk-ZIPGRLYE.js} +120 -16
- package/dist/chunk-ZIPGRLYE.js.map +1 -0
- package/dist/diff-PHEX3HUT.js +188 -0
- package/dist/diff-PHEX3HUT.js.map +1 -0
- package/dist/{dist-2B2MR5AM.js → dist-DQ6NNKZO.js} +53 -14
- package/dist/dist-DQ6NNKZO.js.map +1 -0
- package/dist/dist-RT3MTIUW.js +16 -0
- package/dist/dist-RT3MTIUW.js.map +1 -0
- package/dist/generate-5VO6M4PB.js +21 -0
- package/dist/generate-5VO6M4PB.js.map +1 -0
- package/dist/{generate-story-AOALIKSD.js → generate-story-CJMV2F5K.js} +48 -20
- package/dist/generate-story-CJMV2F5K.js.map +1 -0
- package/dist/{generate-test-plan-34L6RGOB.js → generate-test-plan-XBAFJKJI.js} +63 -10
- package/dist/generate-test-plan-XBAFJKJI.js.map +1 -0
- package/dist/graph-UZJMLX4J.js +103 -0
- package/dist/graph-UZJMLX4J.js.map +1 -0
- package/dist/index.d.ts +171 -0
- package/dist/index.js +2635 -386
- package/dist/index.js.map +1 -1
- package/dist/{lint-XGVQ6LCP.js → lint-TVL2ILOQ.js} +20 -8
- package/dist/lint-TVL2ILOQ.js.map +1 -0
- package/dist/main.js +11 -146
- package/dist/main.js.map +1 -1
- package/dist/mcp-F7LJBZ4X.js +35 -0
- package/dist/mcp-F7LJBZ4X.js.map +1 -0
- package/dist/{migrate-KDJZQKP7.js → migrate-DEFCNOAH.js} +20 -8
- package/dist/migrate-DEFCNOAH.js.map +1 -0
- package/dist/{pack-OJ3CDZHD.js → pack-PNLD5AYW.js} +36 -11
- package/dist/pack-PNLD5AYW.js.map +1 -0
- package/dist/ready-2PHBPWJD.js +257 -0
- package/dist/ready-2PHBPWJD.js.map +1 -0
- package/dist/skills/{specdx-author-spec.md → core/specdx-author-spec/SKILL.md} +10 -6
- package/dist/skills/{specdx-author-spec → core/specdx-author-spec/references}/step-01-frontmatter.md +1 -1
- package/dist/skills/{specdx-author-spec → core/specdx-author-spec/references}/step-02-sections.md +41 -0
- package/dist/skills/{specdx-onboard.md → core/specdx-onboard/SKILL.md} +8 -3
- package/dist/skills/{specdx-plan-from-spec.md → core/specdx-plan-from-spec/SKILL.md} +5 -1
- package/dist/skills/{specdx-pre-commit.md → core/specdx-pre-commit/SKILL.md} +16 -2
- package/dist/skills/{specdx-review-spec.md → core/specdx-review-spec/SKILL.md} +5 -1
- package/dist/skills/core/specdx-router/SKILL.md +67 -0
- package/dist/skills/{specdx-sprint-review.md → core/specdx-sprint-review/SKILL.md} +5 -1
- package/dist/skills/{specdx-start-task.md → core/specdx-start-task/SKILL.md} +5 -1
- package/dist/skills/{specdx-check-drift.md → experimental/specdx-check-drift/SKILL.md} +10 -4
- package/dist/skills/{specdx-verify.md → experimental/specdx-verify/SKILL.md} +17 -2
- package/dist/skills-LHFTTEJ7.js +121 -0
- package/dist/skills-LHFTTEJ7.js.map +1 -0
- package/dist/{status-JVIXK73H.js → status-UKLQV4AI.js} +48 -34
- package/dist/status-UKLQV4AI.js.map +1 -0
- package/dist/{update-HFLDULNJ.js → update-KLDLDQZM.js} +6 -5
- package/dist/update-KLDLDQZM.js.map +1 -0
- package/dist/validate-FXD5WS4C.js +87 -0
- package/dist/validate-FXD5WS4C.js.map +1 -0
- package/hooks/hooks.json +12 -6
- package/hooks/session-start +35 -3
- package/package.json +68 -21
- package/dist/changelog-G6XDIAZP.js +0 -86
- package/dist/changelog-G6XDIAZP.js.map +0 -1
- package/dist/check-PZFBVQIP.js.map +0 -1
- package/dist/chunk-7C3BAVCP.js +0 -1147
- package/dist/chunk-7C3BAVCP.js.map +0 -1
- package/dist/chunk-FZWT4HVX.js.map +0 -1
- package/dist/chunk-PHWUK7TH.js.map +0 -1
- package/dist/chunk-QEUZJWBY.js.map +0 -1
- package/dist/chunk-YDU26YTH.js.map +0 -1
- package/dist/chunk-YRDOYUKF.js.map +0 -1
- package/dist/diff-BEZARP53.js +0 -100
- package/dist/diff-BEZARP53.js.map +0 -1
- package/dist/dist-2B2MR5AM.js.map +0 -1
- package/dist/dist-WIK7F2PJ.js +0 -11
- package/dist/explain-PCZKDEM4.js +0 -102
- package/dist/explain-PCZKDEM4.js.map +0 -1
- package/dist/generate-OMEBJQFQ.js +0 -13
- package/dist/generate-OMEBJQFQ.js.map +0 -1
- package/dist/generate-story-AOALIKSD.js.map +0 -1
- package/dist/generate-test-plan-34L6RGOB.js.map +0 -1
- package/dist/graph-RR5UTY3R.js +0 -54
- package/dist/graph-RR5UTY3R.js.map +0 -1
- package/dist/lint-XGVQ6LCP.js.map +0 -1
- package/dist/mcp-GUFW37BE.js +0 -17
- package/dist/mcp-GUFW37BE.js.map +0 -1
- package/dist/migrate-KDJZQKP7.js.map +0 -1
- package/dist/pack-OJ3CDZHD.js.map +0 -1
- package/dist/ready-WTNO5W7C.js +0 -165
- package/dist/ready-WTNO5W7C.js.map +0 -1
- package/dist/skills-3GBBWZW2.js +0 -93
- package/dist/skills-3GBBWZW2.js.map +0 -1
- package/dist/status-JVIXK73H.js.map +0 -1
- package/dist/update-HFLDULNJ.js.map +0 -1
- package/dist/validate-O7W5YLR6.js +0 -34
- package/dist/validate-O7W5YLR6.js.map +0 -1
- /package/dist/{dist-WIK7F2PJ.js.map → chunk-5WRI5ZAA.js.map} +0 -0
- /package/dist/skills/{spec-type-reference.md → core/specdx-author-spec/references/spec-type-reference.md} +0 -0
- /package/dist/skills/{specdx-author-spec → core/specdx-author-spec/references}/step-03-finalize.md +0 -0
|
@@ -0,0 +1,103 @@
|
|
|
1
|
+
// package.json
|
|
2
|
+
var package_default = {
|
|
3
|
+
name: "specdx",
|
|
4
|
+
version: "0.4.0-alpha.20",
|
|
5
|
+
description: "Spec-driven development toolchain. Validate, lint, pack, and ship specs for LLM-assisted workflows.",
|
|
6
|
+
type: "module",
|
|
7
|
+
license: "MIT",
|
|
8
|
+
author: "Umar Gora (https://github.com/umxr)",
|
|
9
|
+
repository: {
|
|
10
|
+
type: "git",
|
|
11
|
+
url: "https://github.com/umxr/specdx.git",
|
|
12
|
+
directory: "packages/cli"
|
|
13
|
+
},
|
|
14
|
+
homepage: "https://github.com/umxr/specdx#readme",
|
|
15
|
+
bugs: {
|
|
16
|
+
url: "https://github.com/umxr/specdx/issues"
|
|
17
|
+
},
|
|
18
|
+
keywords: [
|
|
19
|
+
"spec",
|
|
20
|
+
"specification",
|
|
21
|
+
"prd",
|
|
22
|
+
"technical-design",
|
|
23
|
+
"api-contract",
|
|
24
|
+
"lint",
|
|
25
|
+
"validation",
|
|
26
|
+
"llm",
|
|
27
|
+
"ai",
|
|
28
|
+
"context-packing",
|
|
29
|
+
"spec-driven-development",
|
|
30
|
+
"claude-code"
|
|
31
|
+
],
|
|
32
|
+
engines: {
|
|
33
|
+
node: ">=18.0.0"
|
|
34
|
+
},
|
|
35
|
+
bin: {
|
|
36
|
+
specdx: "./dist/main.js"
|
|
37
|
+
},
|
|
38
|
+
exports: {
|
|
39
|
+
".": {
|
|
40
|
+
types: "./dist/index.d.ts",
|
|
41
|
+
import: "./dist/index.js"
|
|
42
|
+
}
|
|
43
|
+
},
|
|
44
|
+
files: [
|
|
45
|
+
"dist",
|
|
46
|
+
".claude-plugin",
|
|
47
|
+
"hooks",
|
|
48
|
+
"README.md"
|
|
49
|
+
],
|
|
50
|
+
scripts: {
|
|
51
|
+
build: "tsup",
|
|
52
|
+
typecheck: "tsc --noEmit",
|
|
53
|
+
test: "vitest run",
|
|
54
|
+
clean: "rm -rf dist *.tsbuildinfo"
|
|
55
|
+
},
|
|
56
|
+
dependencies: {
|
|
57
|
+
"@modelcontextprotocol/sdk": "^1.27.0",
|
|
58
|
+
ajv: "^8.18.0",
|
|
59
|
+
"ajv-formats": "^3.0.1",
|
|
60
|
+
citty: "^0.2.1",
|
|
61
|
+
consola: "^3.4.0",
|
|
62
|
+
"gray-matter": "^4.0.3",
|
|
63
|
+
"js-tiktoken": "^1.0.18",
|
|
64
|
+
"remark-parse": "^11.0.0",
|
|
65
|
+
tinyglobby: "^0.2.12",
|
|
66
|
+
unified: "^11.0.0",
|
|
67
|
+
"unist-util-visit": "^5.0.0",
|
|
68
|
+
yaml: "^2.7.0",
|
|
69
|
+
zod: "^3.23.0"
|
|
70
|
+
},
|
|
71
|
+
devDependencies: {
|
|
72
|
+
"@specdx/check": "workspace:*",
|
|
73
|
+
"@specdx/core": "workspace:*",
|
|
74
|
+
"@specdx/diff": "workspace:*",
|
|
75
|
+
"@specdx/lint": "workspace:*",
|
|
76
|
+
"@specdx/mcp": "workspace:*",
|
|
77
|
+
"@specdx/pack": "workspace:*",
|
|
78
|
+
"@specdx/schema": "workspace:*",
|
|
79
|
+
"@specdx/skills": "workspace:*",
|
|
80
|
+
tsup: "^8.5.1",
|
|
81
|
+
typescript: "^5.7.0"
|
|
82
|
+
},
|
|
83
|
+
publishConfig: {
|
|
84
|
+
access: "public"
|
|
85
|
+
},
|
|
86
|
+
peerDependencies: {
|
|
87
|
+
"ts-morph": ">=20",
|
|
88
|
+
"@anthropic-ai/sdk": ">=0.30"
|
|
89
|
+
},
|
|
90
|
+
peerDependenciesMeta: {
|
|
91
|
+
"ts-morph": {
|
|
92
|
+
optional: true
|
|
93
|
+
},
|
|
94
|
+
"@anthropic-ai/sdk": {
|
|
95
|
+
optional: true
|
|
96
|
+
}
|
|
97
|
+
}
|
|
98
|
+
};
|
|
99
|
+
|
|
100
|
+
export {
|
|
101
|
+
package_default
|
|
102
|
+
};
|
|
103
|
+
//# sourceMappingURL=chunk-CI7KYTC7.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../package.json"],"sourcesContent":["{\n \"name\": \"specdx\",\n \"version\": \"0.4.0-alpha.20\",\n \"description\": \"Spec-driven development toolchain. Validate, lint, pack, and ship specs for LLM-assisted workflows.\",\n \"type\": \"module\",\n \"license\": \"MIT\",\n \"author\": \"Umar Gora (https://github.com/umxr)\",\n \"repository\": {\n \"type\": \"git\",\n \"url\": \"https://github.com/umxr/specdx.git\",\n \"directory\": \"packages/cli\"\n },\n \"homepage\": \"https://github.com/umxr/specdx#readme\",\n \"bugs\": {\n \"url\": \"https://github.com/umxr/specdx/issues\"\n },\n \"keywords\": [\n \"spec\",\n \"specification\",\n \"prd\",\n \"technical-design\",\n \"api-contract\",\n \"lint\",\n \"validation\",\n \"llm\",\n \"ai\",\n \"context-packing\",\n \"spec-driven-development\",\n \"claude-code\"\n ],\n \"engines\": {\n \"node\": \">=18.0.0\"\n },\n \"bin\": {\n \"specdx\": \"./dist/main.js\"\n },\n \"exports\": {\n \".\": {\n \"types\": \"./dist/index.d.ts\",\n \"import\": \"./dist/index.js\"\n }\n },\n \"files\": [\n \"dist\",\n \".claude-plugin\",\n \"hooks\",\n \"README.md\"\n ],\n \"scripts\": {\n \"build\": \"tsup\",\n \"typecheck\": \"tsc --noEmit\",\n \"test\": \"vitest run\",\n \"clean\": \"rm -rf dist *.tsbuildinfo\"\n },\n \"dependencies\": {\n \"@modelcontextprotocol/sdk\": \"^1.27.0\",\n \"ajv\": \"^8.18.0\",\n \"ajv-formats\": \"^3.0.1\",\n \"citty\": \"^0.2.1\",\n \"consola\": \"^3.4.0\",\n \"gray-matter\": \"^4.0.3\",\n \"js-tiktoken\": \"^1.0.18\",\n \"remark-parse\": \"^11.0.0\",\n \"tinyglobby\": \"^0.2.12\",\n \"unified\": \"^11.0.0\",\n \"unist-util-visit\": \"^5.0.0\",\n \"yaml\": \"^2.7.0\",\n \"zod\": \"^3.23.0\"\n },\n \"devDependencies\": {\n \"@specdx/check\": \"workspace:*\",\n \"@specdx/core\": \"workspace:*\",\n \"@specdx/diff\": \"workspace:*\",\n \"@specdx/lint\": \"workspace:*\",\n \"@specdx/mcp\": \"workspace:*\",\n \"@specdx/pack\": \"workspace:*\",\n \"@specdx/schema\": \"workspace:*\",\n \"@specdx/skills\": \"workspace:*\",\n \"tsup\": \"^8.5.1\",\n \"typescript\": \"^5.7.0\"\n },\n \"publishConfig\": {\n \"access\": \"public\"\n },\n \"peerDependencies\": {\n \"ts-morph\": \">=20\",\n \"@anthropic-ai/sdk\": \">=0.30\"\n },\n \"peerDependenciesMeta\": {\n \"ts-morph\": {\n \"optional\": true\n },\n \"@anthropic-ai/sdk\": {\n \"optional\": true\n }\n }\n}\n"],"mappings":";AAAA;AAAA,EACE,MAAQ;AAAA,EACR,SAAW;AAAA,EACX,aAAe;AAAA,EACf,MAAQ;AAAA,EACR,SAAW;AAAA,EACX,QAAU;AAAA,EACV,YAAc;AAAA,IACZ,MAAQ;AAAA,IACR,KAAO;AAAA,IACP,WAAa;AAAA,EACf;AAAA,EACA,UAAY;AAAA,EACZ,MAAQ;AAAA,IACN,KAAO;AAAA,EACT;AAAA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ACF;","names":[]}
|
|
@@ -0,0 +1,182 @@
|
|
|
1
|
+
import {
|
|
2
|
+
REQUIRED_SECTIONS
|
|
3
|
+
} from "./chunk-ZIPGRLYE.js";
|
|
4
|
+
|
|
5
|
+
// src/commands/core/init.ts
|
|
6
|
+
import { defineCommand } from "citty";
|
|
7
|
+
import { mkdir, writeFile } from "fs/promises";
|
|
8
|
+
import { join, basename, resolve } from "path";
|
|
9
|
+
var TEMPLATE_SPECS = {
|
|
10
|
+
lightweight: [
|
|
11
|
+
{ filename: "prd.md", type: "prd" },
|
|
12
|
+
{ filename: "technical-design.md", type: "technical-design" }
|
|
13
|
+
],
|
|
14
|
+
bmad: [
|
|
15
|
+
{ filename: "prd.md", type: "prd" },
|
|
16
|
+
{ filename: "technical-design.md", type: "technical-design" },
|
|
17
|
+
{ filename: "test-plan.md", type: "test-plan" }
|
|
18
|
+
],
|
|
19
|
+
"api-first": [
|
|
20
|
+
{ filename: "technical-design.md", type: "technical-design" },
|
|
21
|
+
{ filename: "api-contract.md", type: "api-contract" },
|
|
22
|
+
{ filename: "test-plan.md", type: "test-plan" }
|
|
23
|
+
],
|
|
24
|
+
quick: [{ filename: "quick-spec.md", type: "quick-spec" }],
|
|
25
|
+
context: [{ filename: "project-context.md", type: "project-context" }]
|
|
26
|
+
};
|
|
27
|
+
var TEMPLATE_EXTRA_DIRS = {
|
|
28
|
+
lightweight: [],
|
|
29
|
+
bmad: ["specs/stories", "specs/adr"],
|
|
30
|
+
"api-first": [],
|
|
31
|
+
quick: [],
|
|
32
|
+
context: []
|
|
33
|
+
};
|
|
34
|
+
function specIdFromFilename(filename) {
|
|
35
|
+
return filename.replace(/\.md$/, "");
|
|
36
|
+
}
|
|
37
|
+
function specTitleFromType(type) {
|
|
38
|
+
return type.split("-").map((w) => w.charAt(0).toUpperCase() + w.slice(1)).join(" ");
|
|
39
|
+
}
|
|
40
|
+
function buildSpecFile(filename, type, projectName, today) {
|
|
41
|
+
const id = specIdFromFilename(filename);
|
|
42
|
+
const title = `${specTitleFromType(type)} \u2014 ${projectName}`;
|
|
43
|
+
const sections = REQUIRED_SECTIONS[type];
|
|
44
|
+
const frontmatter = [
|
|
45
|
+
"---",
|
|
46
|
+
`id: ${id}`,
|
|
47
|
+
`type: ${type}`,
|
|
48
|
+
`title: "${title}"`,
|
|
49
|
+
`status: draft`,
|
|
50
|
+
`version: "0.1"`,
|
|
51
|
+
`created: "${today}"`,
|
|
52
|
+
`authors: ["author"]`,
|
|
53
|
+
"---"
|
|
54
|
+
].join("\n");
|
|
55
|
+
const body = sections.map((section) => `
|
|
56
|
+
## ${section}
|
|
57
|
+
|
|
58
|
+
<!-- placeholder -->`).join("\n");
|
|
59
|
+
return `${frontmatter}
|
|
60
|
+
${body}
|
|
61
|
+
`;
|
|
62
|
+
}
|
|
63
|
+
function buildConfigYaml(projectName, specs) {
|
|
64
|
+
const specEntries = specs.map(({ filename, type }) => {
|
|
65
|
+
const key = specIdFromFilename(filename);
|
|
66
|
+
return ` ${key}:
|
|
67
|
+
path: specs/${filename}
|
|
68
|
+
type: ${type}`;
|
|
69
|
+
}).join("\n");
|
|
70
|
+
return [`version: "1.0"`, `project:`, ` name: "${projectName}"`, `specs:`, specEntries].join("\n") + "\n";
|
|
71
|
+
}
|
|
72
|
+
async function scaffoldProject({
|
|
73
|
+
projectName,
|
|
74
|
+
template,
|
|
75
|
+
targetDir
|
|
76
|
+
}) {
|
|
77
|
+
const today = (/* @__PURE__ */ new Date()).toISOString().slice(0, 10);
|
|
78
|
+
const specsDir = join(targetDir, "specs");
|
|
79
|
+
await mkdir(specsDir, { recursive: true });
|
|
80
|
+
for (const extraDir of TEMPLATE_EXTRA_DIRS[template]) {
|
|
81
|
+
await mkdir(join(targetDir, extraDir), { recursive: true });
|
|
82
|
+
}
|
|
83
|
+
const specs = TEMPLATE_SPECS[template];
|
|
84
|
+
for (const { filename, type } of specs) {
|
|
85
|
+
const content = buildSpecFile(filename, type, projectName, today);
|
|
86
|
+
await writeFile(join(specsDir, filename), content, "utf-8");
|
|
87
|
+
}
|
|
88
|
+
const configContent = buildConfigYaml(projectName, specs);
|
|
89
|
+
await writeFile(join(targetDir, "spec.config.yaml"), configContent, "utf-8");
|
|
90
|
+
}
|
|
91
|
+
function defaultProjectName(dir) {
|
|
92
|
+
return basename(resolve(dir)) || "my-project";
|
|
93
|
+
}
|
|
94
|
+
var init_default = defineCommand({
|
|
95
|
+
meta: {
|
|
96
|
+
name: "init",
|
|
97
|
+
description: "Initialize a new specdx project with spec scaffolding"
|
|
98
|
+
},
|
|
99
|
+
args: {
|
|
100
|
+
name: {
|
|
101
|
+
type: "string",
|
|
102
|
+
description: "Project name (default: the target directory's name)"
|
|
103
|
+
},
|
|
104
|
+
template: {
|
|
105
|
+
type: "string",
|
|
106
|
+
description: "Template to use (lightweight, bmad, api-first)",
|
|
107
|
+
default: "lightweight"
|
|
108
|
+
},
|
|
109
|
+
dir: {
|
|
110
|
+
type: "string",
|
|
111
|
+
description: "Target directory",
|
|
112
|
+
default: "."
|
|
113
|
+
}
|
|
114
|
+
},
|
|
115
|
+
async run({ args }) {
|
|
116
|
+
const { template, dir } = args;
|
|
117
|
+
const validTemplates = ["lightweight", "bmad", "api-first", "quick", "context"];
|
|
118
|
+
if (!validTemplates.includes(template)) {
|
|
119
|
+
console.error(`Unknown template: ${template}. Choose from: ${validTemplates.join(", ")}`);
|
|
120
|
+
process.exit(1);
|
|
121
|
+
}
|
|
122
|
+
const name = args.name || defaultProjectName(dir);
|
|
123
|
+
console.log(`Scaffolding "${name}" with template "${template}" in ${dir}...`);
|
|
124
|
+
await scaffoldProject({ projectName: name, template, targetDir: dir });
|
|
125
|
+
console.log(`Done! Project "${name}" scaffolded successfully.`);
|
|
126
|
+
}
|
|
127
|
+
});
|
|
128
|
+
|
|
129
|
+
// src/commands/registry.ts
|
|
130
|
+
var CORE_COMMANDS = [
|
|
131
|
+
"init",
|
|
132
|
+
"lint",
|
|
133
|
+
"validate",
|
|
134
|
+
"graph",
|
|
135
|
+
"skills",
|
|
136
|
+
"pack",
|
|
137
|
+
"diff",
|
|
138
|
+
"status",
|
|
139
|
+
"ready",
|
|
140
|
+
"generate",
|
|
141
|
+
"generate story",
|
|
142
|
+
"mcp"
|
|
143
|
+
];
|
|
144
|
+
var EXPERIMENTAL_COMMANDS = ["check", "update", "migrate", "generate test-plan"];
|
|
145
|
+
var COMMAND_NAMES = [...CORE_COMMANDS, ...EXPERIMENTAL_COMMANDS];
|
|
146
|
+
function bucketOf(name) {
|
|
147
|
+
return EXPERIMENTAL_COMMANDS.includes(name) ? "experimental" : "core";
|
|
148
|
+
}
|
|
149
|
+
function labelled(name, cmd) {
|
|
150
|
+
if (bucketOf(name) === "core") return cmd;
|
|
151
|
+
const meta = cmd.meta;
|
|
152
|
+
if (typeof meta !== "object" || meta === null || "then" in meta) return cmd;
|
|
153
|
+
return {
|
|
154
|
+
...cmd,
|
|
155
|
+
meta: { ...meta, description: `[experimental] ${meta.description ?? ""}`.trim() }
|
|
156
|
+
};
|
|
157
|
+
}
|
|
158
|
+
function bucketed(name, load) {
|
|
159
|
+
return () => load().then((cmd) => labelled(name, cmd));
|
|
160
|
+
}
|
|
161
|
+
var subCommands = {
|
|
162
|
+
init: init_default,
|
|
163
|
+
lint: bucketed("lint", () => import("./lint-TVL2ILOQ.js").then((m) => m.default)),
|
|
164
|
+
validate: bucketed("validate", () => import("./validate-FXD5WS4C.js").then((m) => m.default)),
|
|
165
|
+
graph: bucketed("graph", () => import("./graph-UZJMLX4J.js").then((m) => m.default)),
|
|
166
|
+
skills: bucketed("skills", () => import("./skills-LHFTTEJ7.js").then((m) => m.default)),
|
|
167
|
+
pack: bucketed("pack", () => import("./pack-PNLD5AYW.js").then((m) => m.default)),
|
|
168
|
+
diff: bucketed("diff", () => import("./diff-PHEX3HUT.js").then((m) => m.default)),
|
|
169
|
+
status: bucketed("status", () => import("./status-UKLQV4AI.js").then((m) => m.default)),
|
|
170
|
+
check: bucketed("check", () => import("./check-GGQB3SHI.js").then((m) => m.default)),
|
|
171
|
+
ready: bucketed("ready", () => import("./ready-2PHBPWJD.js").then((m) => m.default)),
|
|
172
|
+
update: bucketed("update", () => import("./update-KLDLDQZM.js").then((m) => m.default)),
|
|
173
|
+
generate: bucketed("generate", () => import("./generate-5VO6M4PB.js").then((m) => m.default)),
|
|
174
|
+
migrate: bucketed("migrate", () => import("./migrate-DEFCNOAH.js").then((m) => m.default)),
|
|
175
|
+
mcp: bucketed("mcp", () => import("./mcp-F7LJBZ4X.js").then((m) => m.default))
|
|
176
|
+
};
|
|
177
|
+
|
|
178
|
+
export {
|
|
179
|
+
labelled,
|
|
180
|
+
subCommands
|
|
181
|
+
};
|
|
182
|
+
//# sourceMappingURL=chunk-FBMYBYFB.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../src/commands/core/init.ts","../src/commands/registry.ts"],"sourcesContent":["import { defineCommand } from \"citty\";\nimport { mkdir, writeFile } from \"node:fs/promises\";\nimport { join, basename, resolve } from \"node:path\";\nimport { REQUIRED_SECTIONS } from \"@specdx/schema\";\n\nexport type Template = \"lightweight\" | \"bmad\" | \"api-first\" | \"quick\" | \"context\";\n\ninterface ScaffoldOptions {\n projectName: string;\n template: Template;\n targetDir: string;\n}\n\nconst TEMPLATE_SPECS: Record<\n Template,\n Array<{ filename: string; type: keyof typeof REQUIRED_SECTIONS }>\n> = {\n lightweight: [\n { filename: \"prd.md\", type: \"prd\" },\n { filename: \"technical-design.md\", type: \"technical-design\" },\n ],\n bmad: [\n { filename: \"prd.md\", type: \"prd\" },\n { filename: \"technical-design.md\", type: \"technical-design\" },\n { filename: \"test-plan.md\", type: \"test-plan\" },\n ],\n \"api-first\": [\n { filename: \"technical-design.md\", type: \"technical-design\" },\n { filename: \"api-contract.md\", type: \"api-contract\" },\n { filename: \"test-plan.md\", type: \"test-plan\" },\n ],\n quick: [{ filename: \"quick-spec.md\", type: \"quick-spec\" }],\n context: [{ filename: \"project-context.md\", type: \"project-context\" }],\n};\n\nconst TEMPLATE_EXTRA_DIRS: Record<Template, string[]> = {\n lightweight: [],\n bmad: [\"specs/stories\", \"specs/adr\"],\n \"api-first\": [],\n quick: [],\n context: [],\n};\n\nfunction specIdFromFilename(filename: string): string {\n return filename.replace(/\\.md$/, \"\");\n}\n\nfunction specTitleFromType(type: string): string {\n return type\n .split(\"-\")\n .map((w) => w.charAt(0).toUpperCase() + w.slice(1))\n .join(\" \");\n}\n\nfunction buildSpecFile(\n filename: string,\n type: keyof typeof REQUIRED_SECTIONS,\n projectName: string,\n today: string,\n): string {\n const id = specIdFromFilename(filename);\n const title = `${specTitleFromType(type)} — ${projectName}`;\n const sections = REQUIRED_SECTIONS[type];\n\n const frontmatter = [\n \"---\",\n `id: ${id}`,\n `type: ${type}`,\n `title: \"${title}\"`,\n `status: draft`,\n `version: \"0.1\"`,\n `created: \"${today}\"`,\n `authors: [\"author\"]`,\n \"---\",\n ].join(\"\\n\");\n\n const body = sections.map((section) => `\\n## ${section}\\n\\n<!-- placeholder -->`).join(\"\\n\");\n\n return `${frontmatter}\\n${body}\\n`;\n}\n\nfunction buildConfigYaml(\n projectName: string,\n specs: Array<{ filename: string; type: string }>,\n): string {\n const specEntries = specs\n .map(({ filename, type }) => {\n const key = specIdFromFilename(filename);\n return ` ${key}:\\n path: specs/${filename}\\n type: ${type}`;\n })\n .join(\"\\n\");\n\n return (\n [`version: \"1.0\"`, `project:`, ` name: \"${projectName}\"`, `specs:`, specEntries].join(\"\\n\") +\n \"\\n\"\n );\n}\n\nexport async function scaffoldProject({\n projectName,\n template,\n targetDir,\n}: ScaffoldOptions): Promise<void> {\n const today = new Date().toISOString().slice(0, 10);\n const specsDir = join(targetDir, \"specs\");\n\n // Create specs/ directory\n await mkdir(specsDir, { recursive: true });\n\n // Create extra template dirs (e.g., bmad needs stories/ and adr/)\n for (const extraDir of TEMPLATE_EXTRA_DIRS[template]) {\n await mkdir(join(targetDir, extraDir), { recursive: true });\n }\n\n const specs = TEMPLATE_SPECS[template];\n\n // Write spec files\n for (const { filename, type } of specs) {\n const content = buildSpecFile(filename, type, projectName, today);\n await writeFile(join(specsDir, filename), content, \"utf-8\");\n }\n\n // Write spec.config.yaml\n const configContent = buildConfigYaml(projectName, specs);\n await writeFile(join(targetDir, \"spec.config.yaml\"), configContent, \"utf-8\");\n}\n\n/**\n * The project name to use when `--name` is absent: the target directory's own\n * name, resolved so that `.` becomes the current directory rather than a dot.\n */\nexport function defaultProjectName(dir: string): string {\n return basename(resolve(dir)) || \"my-project\";\n}\n\nexport default defineCommand({\n meta: {\n name: \"init\",\n description: \"Initialize a new specdx project with spec scaffolding\",\n },\n args: {\n name: {\n type: \"string\",\n description: \"Project name (default: the target directory's name)\",\n },\n template: {\n type: \"string\",\n description: \"Template to use (lightweight, bmad, api-first)\",\n default: \"lightweight\",\n },\n dir: {\n type: \"string\",\n description: \"Target directory\",\n default: \".\",\n },\n },\n async run({ args }) {\n const { template, dir } = args;\n const validTemplates: Template[] = [\"lightweight\", \"bmad\", \"api-first\", \"quick\", \"context\"];\n if (!validTemplates.includes(template as Template)) {\n console.error(`Unknown template: ${template}. Choose from: ${validTemplates.join(\", \")}`);\n process.exit(1);\n }\n\n // The first command anyone runs should not fail on a missing flag when the\n // answer is sitting in the path. `--name` still wins where they differ.\n const name = args.name || defaultProjectName(dir);\n\n console.log(`Scaffolding \"${name}\" with template \"${template}\" in ${dir}...`);\n await scaffoldProject({ projectName: name, template: template as Template, targetDir: dir });\n console.log(`Done! Project \"${name}\" scaffolded successfully.`);\n },\n});\n","import type { ArgsDef, CommandDef, SubCommandsDef } from \"citty\";\nimport initCommand from \"./core/init.js\";\n\n/**\n * Promoted commands — the set `--help` presents without a caveat.\n *\n * Promotion is the directory a command lives in, not an adjective someone\n * remembered to type into its description. `explain` and `changelog` both\n * drifted into the core surface precisely because the marker was a string.\n * Sub-commands are spelled the way a user types them.\n */\nexport const CORE_COMMANDS = [\n \"init\",\n \"lint\",\n \"validate\",\n \"graph\",\n \"skills\",\n \"pack\",\n \"diff\",\n \"status\",\n \"ready\",\n \"generate\",\n \"generate story\",\n \"mcp\",\n] as const;\n\n/** Commands whose output is not yet trusted enough to promote. */\nexport const EXPERIMENTAL_COMMANDS = [\"check\", \"update\", \"migrate\", \"generate test-plan\"] as const;\n\n/** Every command that ships, promoted or not. */\nexport const COMMAND_NAMES = [...CORE_COMMANDS, ...EXPERIMENTAL_COMMANDS];\n\nexport type CommandName = (typeof COMMAND_NAMES)[number];\n\n/** Bucket directory a command lives in, under `commands/`. */\nexport function bucketOf(name: string): \"core\" | \"experimental\" {\n return (EXPERIMENTAL_COMMANDS as readonly string[]).includes(name) ? \"experimental\" : \"core\";\n}\n\n/** Module path for a command, relative to `commands/`. */\nexport function moduleOf(name: string): string {\n return `${bucketOf(name)}/${name.replace(/ /g, \"-\")}.ts`;\n}\n\n/**\n * Prefix an experimental command's description with its caveat.\n *\n * Derived from the bucket, so no description in the tree spells `[experimental]`\n * itself and the two can never disagree.\n */\nexport function labelled<T extends ArgsDef>(name: string, cmd: CommandDef<T>): CommandDef<T> {\n if (bucketOf(name) === \"core\") return cmd;\n const meta = cmd.meta;\n // citty allows meta to be a function or promise. Ours are all plain objects,\n // and the conformance test asserts every experimental command renders the\n // caveat -- so a command that adopts lazy meta fails loudly rather than\n // shipping unlabelled.\n if (typeof meta !== \"object\" || meta === null || \"then\" in meta) return cmd;\n return {\n ...cmd,\n meta: { ...meta, description: `[experimental] ${meta.description ?? \"\"}`.trim() },\n };\n}\n\n/** Lazily load a command module and label it according to its bucket. */\nfunction bucketed<T extends ArgsDef>(\n name: string,\n load: () => Promise<CommandDef<T>>,\n): () => Promise<CommandDef<T>> {\n return () => load().then((cmd) => labelled(name, cmd));\n}\n\n/**\n * The `subCommands` map citty registers, keyed by the top-level names above.\n *\n * Typed as citty's own `SubCommandsDef` rather than a `Record<CommandName, ...>`:\n * `CommandDef` is invariant in its args, so a narrower annotation rejects every\n * command that declares args. The conformance test asserts the keys instead.\n */\nexport const subCommands: SubCommandsDef = {\n init: initCommand,\n lint: bucketed(\"lint\", () => import(\"./core/lint.js\").then((m) => m.default)),\n validate: bucketed(\"validate\", () => import(\"./core/validate.js\").then((m) => m.default)),\n graph: bucketed(\"graph\", () => import(\"./core/graph.js\").then((m) => m.default)),\n skills: bucketed(\"skills\", () => import(\"./core/skills.js\").then((m) => m.default)),\n pack: bucketed(\"pack\", () => import(\"./core/pack.js\").then((m) => m.default)),\n diff: bucketed(\"diff\", () => import(\"./core/diff.js\").then((m) => m.default)),\n status: bucketed(\"status\", () => import(\"./core/status.js\").then((m) => m.default)),\n check: bucketed(\"check\", () => import(\"./experimental/check.js\").then((m) => m.default)),\n ready: bucketed(\"ready\", () => import(\"./core/ready.js\").then((m) => m.default)),\n update: bucketed(\"update\", () => import(\"./experimental/update.js\").then((m) => m.default)),\n generate: bucketed(\"generate\", () => import(\"./core/generate.js\").then((m) => m.default)),\n migrate: bucketed(\"migrate\", () => import(\"./experimental/migrate.js\").then((m) => m.default)),\n mcp: bucketed(\"mcp\", () => import(\"./core/mcp.js\").then((m) => m.default)),\n};\n"],"mappings":";;;;;AAAA,SAAS,qBAAqB;AAC9B,SAAS,OAAO,iBAAiB;AACjC,SAAS,MAAM,UAAU,eAAe;AAWxC,IAAM,iBAGF;AAAA,EACF,aAAa;AAAA,IACX,EAAE,UAAU,UAAU,MAAM,MAAM;AAAA,IAClC,EAAE,UAAU,uBAAuB,MAAM,mBAAmB;AAAA,EAC9D;AAAA,EACA,MAAM;AAAA,IACJ,EAAE,UAAU,UAAU,MAAM,MAAM;AAAA,IAClC,EAAE,UAAU,uBAAuB,MAAM,mBAAmB;AAAA,IAC5D,EAAE,UAAU,gBAAgB,MAAM,YAAY;AAAA,EAChD;AAAA,EACA,aAAa;AAAA,IACX,EAAE,UAAU,uBAAuB,MAAM,mBAAmB;AAAA,IAC5D,EAAE,UAAU,mBAAmB,MAAM,eAAe;AAAA,IACpD,EAAE,UAAU,gBAAgB,MAAM,YAAY;AAAA,EAChD;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AC,MAAM,EAAE,OAAO,CAAC;AAC3E;","names":[]}
|
|
@@ -1,7 +1,8 @@
|
|
|
1
1
|
import {
|
|
2
|
+
DEPENDENCY_RELATIONSHIPS,
|
|
2
3
|
validateConfig,
|
|
3
4
|
validateSpec
|
|
4
|
-
} from "./chunk-
|
|
5
|
+
} from "./chunk-ZIPGRLYE.js";
|
|
5
6
|
|
|
6
7
|
// ../core/dist/config.js
|
|
7
8
|
import { readFile } from "fs/promises";
|
|
@@ -262,6 +263,50 @@ function buildGraph(config) {
|
|
|
262
263
|
}
|
|
263
264
|
};
|
|
264
265
|
}
|
|
266
|
+
function collectReferenceEdges(specs) {
|
|
267
|
+
const edges = [];
|
|
268
|
+
for (const spec of specs) {
|
|
269
|
+
const fromId = spec.frontmatter.id;
|
|
270
|
+
if (typeof fromId !== "string")
|
|
271
|
+
continue;
|
|
272
|
+
const refs = spec.frontmatter.references;
|
|
273
|
+
if (!Array.isArray(refs))
|
|
274
|
+
continue;
|
|
275
|
+
for (const ref of refs) {
|
|
276
|
+
if (ref && typeof ref === "object" && "id" in ref) {
|
|
277
|
+
const r = ref;
|
|
278
|
+
if (typeof r.id === "string") {
|
|
279
|
+
edges.push({
|
|
280
|
+
fromId,
|
|
281
|
+
toId: r.id,
|
|
282
|
+
relationship: typeof r.relationship === "string" ? r.relationship : "related-to"
|
|
283
|
+
});
|
|
284
|
+
}
|
|
285
|
+
}
|
|
286
|
+
}
|
|
287
|
+
}
|
|
288
|
+
return edges;
|
|
289
|
+
}
|
|
290
|
+
function findUnreflectedReferences(referenceEdges, idToEntry, graph) {
|
|
291
|
+
const configEdges = new Set(graph.edges.map((e) => `${e.from}\u2192${e.to}`));
|
|
292
|
+
const missing = [];
|
|
293
|
+
for (const edge of referenceEdges) {
|
|
294
|
+
const direction = DEPENDENCY_RELATIONSHIPS[edge.relationship];
|
|
295
|
+
if (!direction)
|
|
296
|
+
continue;
|
|
297
|
+
const selfEntry = idToEntry.get(edge.fromId);
|
|
298
|
+
const targetEntry = idToEntry.get(edge.toId);
|
|
299
|
+
if (!selfEntry || !targetEntry || selfEntry === targetEntry)
|
|
300
|
+
continue;
|
|
301
|
+
const requiringEntry = direction === "self-requires-target" ? selfEntry : targetEntry;
|
|
302
|
+
const requiredEntry = direction === "self-requires-target" ? targetEntry : selfEntry;
|
|
303
|
+
if (!configEdges.has(`${requiredEntry}\u2192${requiringEntry}`)) {
|
|
304
|
+
const createsCycle = graph.getDownstream(requiringEntry).includes(requiredEntry);
|
|
305
|
+
missing.push({ edge, requiringEntry, requiredEntry, createsCycle });
|
|
306
|
+
}
|
|
307
|
+
}
|
|
308
|
+
return missing;
|
|
309
|
+
}
|
|
265
310
|
|
|
266
311
|
// ../core/dist/glob.js
|
|
267
312
|
import { glob } from "tinyglobby";
|
|
@@ -282,6 +327,112 @@ function createLogger(options) {
|
|
|
282
327
|
return createConsola({ level });
|
|
283
328
|
}
|
|
284
329
|
|
|
330
|
+
// ../core/dist/relations.js
|
|
331
|
+
function mapEntriesToIds(config, specsByEntry) {
|
|
332
|
+
const entryIds = /* @__PURE__ */ new Map();
|
|
333
|
+
for (const key of Object.keys(config.specs)) {
|
|
334
|
+
const ids = [];
|
|
335
|
+
for (const spec of specsByEntry.get(key) ?? []) {
|
|
336
|
+
const id = spec.frontmatter.id;
|
|
337
|
+
if (typeof id === "string")
|
|
338
|
+
ids.push(id);
|
|
339
|
+
}
|
|
340
|
+
entryIds.set(key, ids);
|
|
341
|
+
}
|
|
342
|
+
return entryIds;
|
|
343
|
+
}
|
|
344
|
+
function collectKnownIds(specsByEntry) {
|
|
345
|
+
const ids = /* @__PURE__ */ new Set();
|
|
346
|
+
for (const specs of specsByEntry.values()) {
|
|
347
|
+
for (const spec of specs) {
|
|
348
|
+
const id = spec.frontmatter.id;
|
|
349
|
+
if (typeof id === "string")
|
|
350
|
+
ids.add(id);
|
|
351
|
+
}
|
|
352
|
+
}
|
|
353
|
+
return ids;
|
|
354
|
+
}
|
|
355
|
+
function walk(specId, adjacency) {
|
|
356
|
+
const visited = /* @__PURE__ */ new Set();
|
|
357
|
+
const stack = [specId];
|
|
358
|
+
while (stack.length > 0) {
|
|
359
|
+
const current = stack.pop();
|
|
360
|
+
for (const next of adjacency.get(current) ?? []) {
|
|
361
|
+
if (!visited.has(next)) {
|
|
362
|
+
visited.add(next);
|
|
363
|
+
stack.push(next);
|
|
364
|
+
}
|
|
365
|
+
}
|
|
366
|
+
}
|
|
367
|
+
visited.delete(specId);
|
|
368
|
+
return [...visited];
|
|
369
|
+
}
|
|
370
|
+
function buildRelationResolver(config, specsByEntry) {
|
|
371
|
+
const entryIds = config ? mapEntriesToIds(config, specsByEntry) : /* @__PURE__ */ new Map();
|
|
372
|
+
const knownIds = collectKnownIds(specsByEntry);
|
|
373
|
+
const edgeSources = /* @__PURE__ */ new Map();
|
|
374
|
+
const addEdge = (from, to, source) => {
|
|
375
|
+
if (from === to)
|
|
376
|
+
return;
|
|
377
|
+
const key = `${from}\0${to}`;
|
|
378
|
+
const existing = edgeSources.get(key);
|
|
379
|
+
if (!existing) {
|
|
380
|
+
edgeSources.set(key, source);
|
|
381
|
+
} else if (existing !== source) {
|
|
382
|
+
edgeSources.set(key, "both");
|
|
383
|
+
}
|
|
384
|
+
};
|
|
385
|
+
for (const [key, entry] of Object.entries(config?.specs ?? {})) {
|
|
386
|
+
const requires = entry.requires ?? [];
|
|
387
|
+
for (const dep of requires) {
|
|
388
|
+
for (const from of entryIds.get(dep) ?? []) {
|
|
389
|
+
for (const to of entryIds.get(key) ?? []) {
|
|
390
|
+
addEdge(from, to, "requires");
|
|
391
|
+
}
|
|
392
|
+
}
|
|
393
|
+
}
|
|
394
|
+
}
|
|
395
|
+
for (const specs of specsByEntry.values()) {
|
|
396
|
+
for (const spec of specs) {
|
|
397
|
+
const selfId = spec.frontmatter.id;
|
|
398
|
+
if (typeof selfId !== "string")
|
|
399
|
+
continue;
|
|
400
|
+
const refs = spec.frontmatter.references;
|
|
401
|
+
if (!Array.isArray(refs))
|
|
402
|
+
continue;
|
|
403
|
+
for (const ref of refs) {
|
|
404
|
+
if (!ref || typeof ref !== "object")
|
|
405
|
+
continue;
|
|
406
|
+
const { id: targetId, relationship } = ref;
|
|
407
|
+
if (typeof targetId !== "string" || typeof relationship !== "string")
|
|
408
|
+
continue;
|
|
409
|
+
if (!knownIds.has(targetId))
|
|
410
|
+
continue;
|
|
411
|
+
const direction = DEPENDENCY_RELATIONSHIPS[relationship];
|
|
412
|
+
if (direction === "self-requires-target") {
|
|
413
|
+
addEdge(targetId, selfId, "references");
|
|
414
|
+
} else if (direction === "target-requires-self") {
|
|
415
|
+
addEdge(selfId, targetId, "references");
|
|
416
|
+
}
|
|
417
|
+
}
|
|
418
|
+
}
|
|
419
|
+
}
|
|
420
|
+
const edges = [];
|
|
421
|
+
const downstreamAdj = /* @__PURE__ */ new Map();
|
|
422
|
+
const upstreamAdj = /* @__PURE__ */ new Map();
|
|
423
|
+
for (const [key, source] of edgeSources) {
|
|
424
|
+
const [from, to] = key.split("\0");
|
|
425
|
+
edges.push({ from, to, source });
|
|
426
|
+
downstreamAdj.set(from, [...downstreamAdj.get(from) ?? [], to]);
|
|
427
|
+
upstreamAdj.set(to, [...upstreamAdj.get(to) ?? [], from]);
|
|
428
|
+
}
|
|
429
|
+
return {
|
|
430
|
+
edges,
|
|
431
|
+
getUpstream: (specId) => walk(specId, upstreamAdj),
|
|
432
|
+
getDownstream: (specId) => walk(specId, downstreamAdj)
|
|
433
|
+
};
|
|
434
|
+
}
|
|
435
|
+
|
|
285
436
|
// ../core/dist/preset.js
|
|
286
437
|
import { readFile as readFile3 } from "fs/promises";
|
|
287
438
|
import { resolve, isAbsolute as isAbsolute2 } from "path";
|
|
@@ -294,7 +445,10 @@ export {
|
|
|
294
445
|
parseSpecFromString,
|
|
295
446
|
GraphError,
|
|
296
447
|
buildGraph,
|
|
448
|
+
collectReferenceEdges,
|
|
449
|
+
findUnreflectedReferences,
|
|
450
|
+
buildRelationResolver,
|
|
297
451
|
resolveGlob,
|
|
298
452
|
createLogger
|
|
299
453
|
};
|
|
300
|
-
//# sourceMappingURL=chunk-
|
|
454
|
+
//# sourceMappingURL=chunk-MM325DR6.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../core/src/config.ts","../../core/src/parser.ts","../../core/src/tokens.ts","../../core/src/graph.ts","../../core/src/glob.ts","../../core/src/logger.ts","../../core/src/relations.ts","../../core/src/preset.ts"],"sourcesContent":["import { readFile } from \"node:fs/promises\";\nimport { join, dirname } from \"node:path\";\nimport { parse as parseYaml } from \"yaml\";\nimport { validateConfig, type SdxConfig } from \"@specdx/schema\";\n\nexport class ConfigError extends Error {\n constructor(\n message: string,\n public readonly errors?: unknown[],\n ) {\n super(message);\n this.name = \"ConfigError\";\n }\n}\n\nconst CONFIG_FILENAME = \"spec.config.yaml\";\n\nexport async function loadConfig(filePath?: string, searchFrom?: string): Promise<SdxConfig> {\n const resolvedPath = filePath ?? (await findConfig(searchFrom ?? process.cwd()));\n if (!resolvedPath) {\n throw new ConfigError(`No ${CONFIG_FILENAME} found. Run 'sdx init' to create one.`);\n }\n\n let raw: string;\n try {\n raw = await readFile(resolvedPath, \"utf-8\");\n } catch {\n throw new ConfigError(`Cannot read config file: ${resolvedPath}`);\n }\n\n let data: Record<string, unknown>;\n try {\n data = parseYaml(raw) as Record<string, unknown>;\n } catch (err) {\n throw new ConfigError(`Invalid YAML in ${resolvedPath}: ${(err as Error).message}`);\n }\n\n const result = validateConfig(data);\n if (!result.valid) {\n throw new ConfigError(`Invalid config in ${resolvedPath}`, result.errors ?? undefined);\n }\n\n return data as unknown as SdxConfig;\n}\n\nasync function findConfig(from: string): Promise<string | undefined> {\n let dir = from;\n while (true) {\n const candidate = join(dir, CONFIG_FILENAME);\n try {\n await readFile(candidate, \"utf-8\");\n return candidate;\n } catch {\n const parent = dirname(dir);\n if (parent === dir) return undefined;\n dir = parent;\n }\n }\n}\n","import { readFile } from \"node:fs/promises\";\nimport { extname } from \"node:path\";\nimport * as grayMatterNs from \"gray-matter\";\nimport { parse as parseYaml } from \"yaml\";\nimport { unified } from \"unified\";\nimport remarkParse from \"remark-parse\";\nimport { visit } from \"unist-util-visit\";\nimport { validateSpec, type ValidationResult } from \"@specdx/schema\";\nimport type { BaseSpec, SpecType } from \"@specdx/schema\";\nimport { countTokens } from \"./tokens.js\";\n\n// gray-matter is CJS — its callable default is exposed via .default in an ESM context\ntype GrayMatterFn = (input: string) => { data: Record<string, unknown>; content: string };\nconst matter = ((grayMatterNs as unknown as { default?: GrayMatterFn }).default ??\n (grayMatterNs as unknown as GrayMatterFn)) as GrayMatterFn;\n\nexport class ParseError extends Error {\n constructor(message: string) {\n super(message);\n this.name = \"ParseError\";\n }\n}\n\nexport interface ParsedSection {\n heading: string;\n content: string;\n tokens: number;\n}\n\nexport interface ParsedSpec {\n filePath: string;\n frontmatter: BaseSpec & Record<string, unknown>;\n content: string;\n sections: string[];\n parsedSections: ParsedSection[];\n valid: boolean;\n validationErrors: ValidationResult[\"errors\"];\n}\n\nexport async function parseSpec(filePath: string): Promise<ParsedSpec> {\n let raw: string;\n try {\n raw = await readFile(filePath, \"utf-8\");\n } catch {\n throw new ParseError(`Cannot read spec file: ${filePath}`);\n }\n\n return parseSpecFromString(raw, filePath);\n}\n\nexport function parseSpecFromString(content: string, filePath: string): Promise<ParsedSpec> {\n const ext = extname(filePath).toLowerCase();\n if (ext === \".yaml\" || ext === \".yml\") {\n return Promise.resolve(parseYamlSpec(filePath, content));\n }\n return Promise.resolve(parseMarkdownSpec(filePath, content));\n}\n\nfunction parseMarkdownSpec(filePath: string, raw: string): ParsedSpec {\n const { data, content } = matter(raw);\n const parsedSections = extractParsedSections(content);\n const sections = parsedSections.map((s) => s.heading).filter(Boolean);\n const frontmatter = data as BaseSpec & Record<string, unknown>;\n const specType = frontmatter.type as SpecType | undefined;\n\n let valid = false;\n let validationErrors: ValidationResult[\"errors\"] = null;\n if (specType) {\n const result = validateSpec(specType, data);\n valid = result.valid;\n validationErrors = result.errors;\n }\n\n return { filePath, frontmatter, content, sections, parsedSections, valid, validationErrors };\n}\n\nfunction parseYamlSpec(filePath: string, raw: string): ParsedSpec {\n let data: Record<string, unknown>;\n try {\n data = parseYaml(raw) as Record<string, unknown>;\n } catch (err) {\n throw new ParseError(`Invalid YAML in ${filePath}: ${(err as Error).message}`);\n }\n\n const frontmatter = data as BaseSpec & Record<string, unknown>;\n const specType = frontmatter.type as SpecType | undefined;\n\n let valid = false;\n let validationErrors: ValidationResult[\"errors\"] = null;\n if (specType) {\n const result = validateSpec(specType, data);\n valid = result.valid;\n validationErrors = result.errors;\n }\n\n return {\n filePath,\n frontmatter,\n content: \"\",\n sections: [],\n parsedSections: [],\n valid,\n validationErrors,\n };\n}\n\nfunction extractParsedSections(markdown: string): ParsedSection[] {\n const tree = unified().use(remarkParse).parse(markdown);\n\n const h2s: { heading: string; startOffset: number; endOffset: number }[] = [];\n\n visit(tree, \"heading\", (node) => {\n if (node.depth === 2) {\n const text = (node.children as Array<{ type: string; value?: string }>)\n .filter((c) => c.type === \"text\")\n .map((c) => c.value ?? \"\")\n .join(\"\");\n h2s.push({\n heading: text,\n startOffset: node.position!.start.offset as number,\n endOffset: node.position!.end.offset as number,\n });\n }\n });\n\n const sections: ParsedSection[] = [];\n\n // Preamble: content before first H2\n const firstH2 = h2s[0];\n const firstOffset = firstH2 ? firstH2.startOffset : markdown.length;\n const preamble = markdown.slice(0, firstOffset).trim();\n if (preamble) {\n sections.push({ heading: \"\", content: preamble, tokens: countTokens(preamble) });\n }\n\n // Each H2 section: content AFTER the heading line, up to the next H2 (or end)\n for (let i = 0; i < h2s.length; i++) {\n const current = h2s[i]!;\n const next = h2s[i + 1];\n const end = next ? next.startOffset : markdown.length;\n const content = markdown.slice(current.endOffset, end).trim();\n sections.push({\n heading: current.heading,\n content,\n tokens: countTokens(content),\n });\n }\n\n return sections;\n}\n","import { encodingForModel } from \"js-tiktoken\";\n\nlet encoder: ReturnType<typeof encodingForModel> | undefined;\n\nfunction getEncoder() {\n if (!encoder) encoder = encodingForModel(\"gpt-4o\");\n return encoder;\n}\n\nexport function countTokens(text: string): number {\n if (!text) return 0;\n return getEncoder().encode(text).length;\n}\n","import type { SdxConfig } from \"@specdx/schema\";\nimport { DEPENDENCY_RELATIONSHIPS } from \"@specdx/schema\";\n\nexport class GraphError extends Error {\n constructor(message: string) {\n super(message);\n this.name = \"GraphError\";\n }\n}\n\nexport interface Edge {\n from: string;\n to: string;\n}\n\nexport interface DependencyGraph {\n nodes: string[];\n edges: Edge[];\n topologicalSort(): string[];\n getDownstream(nodeId: string): string[];\n getUpstream(nodeId: string): string[];\n}\n\nexport function buildGraph(config: SdxConfig): DependencyGraph {\n const specNames = Object.keys(config.specs);\n const adjacency = new Map<string, string[]>();\n const reverseAdj = new Map<string, string[]>();\n const edges: Edge[] = [];\n\n for (const name of specNames) {\n adjacency.set(name, []);\n reverseAdj.set(name, []);\n }\n\n for (const [name, entry] of Object.entries(config.specs)) {\n if (!entry.requires) continue;\n for (const dep of entry.requires) {\n if (!adjacency.has(dep)) {\n throw new GraphError(\n `Spec \"${name}\" requires \"${dep}\", which does not exist in the config.`,\n );\n }\n adjacency.get(dep)!.push(name);\n reverseAdj.get(name)!.push(dep);\n edges.push({ from: dep, to: name });\n }\n }\n\n // Kahn's algorithm for cycle detection + topological sort\n const inDegree = new Map<string, number>();\n for (const name of specNames) inDegree.set(name, reverseAdj.get(name)!.length);\n\n const queue: string[] = [];\n for (const [name, degree] of inDegree) {\n if (degree === 0) queue.push(name);\n }\n\n const sorted: string[] = [];\n while (queue.length > 0) {\n const node = queue.shift()!;\n sorted.push(node);\n for (const neighbor of adjacency.get(node)!) {\n const newDegree = inDegree.get(neighbor)! - 1;\n inDegree.set(neighbor, newDegree);\n if (newDegree === 0) queue.push(neighbor);\n }\n }\n\n if (sorted.length !== specNames.length) {\n const remaining = specNames.filter((n) => !sorted.includes(n));\n throw new GraphError(`Circular dependency detected involving: ${remaining.join(\", \")}`);\n }\n\n return {\n nodes: specNames,\n edges,\n topologicalSort: () => [...sorted],\n getDownstream(nodeId: string): string[] {\n const visited = new Set<string>();\n const stack = [nodeId];\n while (stack.length > 0) {\n const current = stack.pop()!;\n for (const neighbor of adjacency.get(current) ?? []) {\n if (!visited.has(neighbor)) {\n visited.add(neighbor);\n stack.push(neighbor);\n }\n }\n }\n return [...visited];\n },\n getUpstream(nodeId: string): string[] {\n const visited = new Set<string>();\n const stack = [nodeId];\n while (stack.length > 0) {\n const current = stack.pop()!;\n for (const dep of reverseAdj.get(current) ?? []) {\n if (!visited.has(dep)) {\n visited.add(dep);\n stack.push(dep);\n }\n }\n }\n return [...visited];\n },\n };\n}\n\n/** A relationship edge declared in a spec's frontmatter `references`. */\nexport interface ReferenceEdge {\n fromId: string;\n toId: string;\n relationship: string;\n}\n\n// The dependency-implying taxonomy lives in @specdx/schema so it is versioned\n// with the schema it describes, rather than hardcoded here (ADR:\n// references/requires unification).\n\n/**\n * Collect relationship edges declared in spec frontmatter `references` fields.\n * Edges point from the declaring spec's id to the referenced spec's id.\n */\nexport function collectReferenceEdges(\n specs: { frontmatter: Record<string, unknown> }[],\n): ReferenceEdge[] {\n const edges: ReferenceEdge[] = [];\n for (const spec of specs) {\n const fromId = spec.frontmatter.id;\n if (typeof fromId !== \"string\") continue;\n const refs = spec.frontmatter.references;\n if (!Array.isArray(refs)) continue;\n for (const ref of refs) {\n if (ref && typeof ref === \"object\" && \"id\" in ref) {\n const r = ref as { id: unknown; relationship?: unknown };\n if (typeof r.id === \"string\") {\n edges.push({\n fromId,\n toId: r.id,\n relationship: typeof r.relationship === \"string\" ? r.relationship : \"related-to\",\n });\n }\n }\n }\n }\n return edges;\n}\n\n/**\n * Find dependency-implying frontmatter references that the config-level\n * `requires` graph does not reflect. `idToEntry` maps spec frontmatter ids to\n * config entry keys. References within the same entry (e.g. story-to-story\n * under one glob) and references to unmapped ids are skipped — reference\n * existence itself is the `structure/valid-references` lint rule's concern.\n */\nexport interface UnreflectedReference {\n edge: ReferenceEdge;\n requiringEntry: string;\n requiredEntry: string;\n /** True when adding the suggested requires edge would create a cycle. */\n createsCycle: boolean;\n}\n\nexport function findUnreflectedReferences(\n referenceEdges: ReferenceEdge[],\n idToEntry: Map<string, string>,\n graph: DependencyGraph,\n): UnreflectedReference[] {\n const configEdges = new Set(graph.edges.map((e) => `${e.from}→${e.to}`));\n const missing: UnreflectedReference[] = [];\n\n for (const edge of referenceEdges) {\n const direction = DEPENDENCY_RELATIONSHIPS[edge.relationship as never];\n if (!direction) continue;\n\n const selfEntry = idToEntry.get(edge.fromId);\n const targetEntry = idToEntry.get(edge.toId);\n if (!selfEntry || !targetEntry || selfEntry === targetEntry) continue;\n\n const requiringEntry = direction === \"self-requires-target\" ? selfEntry : targetEntry;\n const requiredEntry = direction === \"self-requires-target\" ? targetEntry : selfEntry;\n\n // Config edges point dependency → dependent\n if (!configEdges.has(`${requiredEntry}→${requiringEntry}`)) {\n // The suggested edge closes a cycle when the required entry is already\n // downstream of the requiring one (issue #13) — never recommend it.\n const createsCycle = graph.getDownstream(requiringEntry).includes(requiredEntry);\n missing.push({ edge, requiringEntry, requiredEntry, createsCycle });\n }\n }\n\n return missing;\n}\n","import { glob } from \"tinyglobby\";\nimport { join, isAbsolute } from \"node:path\";\n\nexport async function resolveGlob(pattern: string, baseDir: string): Promise<string[]> {\n const absolutePattern = isAbsolute(pattern) ? pattern : join(baseDir, pattern);\n return glob([absolutePattern], { absolute: true });\n}\n","import { createConsola, type ConsolaInstance } from \"consola\";\n\nexport type LogLevel = \"debug\" | \"info\" | \"warn\" | \"error\";\n\nexport interface LoggerOptions {\n quiet?: boolean;\n verbose?: boolean;\n}\n\nexport interface Logger extends ConsolaInstance {\n level: number;\n}\n\nexport function createLogger(options?: LoggerOptions): Logger {\n let level = 3; // info\n if (options?.quiet) level = 1; // only errors\n if (options?.verbose) level = 4; // debug\n return createConsola({ level }) as Logger;\n}\n","import type { SdxConfig } from \"@specdx/schema\";\nimport { DEPENDENCY_RELATIONSHIPS } from \"@specdx/schema\";\n\n/** Where a relation edge was declared. */\nexport type RelationSource = \"requires\" | \"references\" | \"both\";\n\n/** A dependency edge in **spec id** space, pointing upstream → downstream. */\nexport interface RelationEdge {\n /** Spec id of the dependency. */\n from: string;\n /** Spec id of the dependent. */\n to: string;\n /** Which declaration(s) produced this edge. */\n source: RelationSource;\n}\n\n/**\n * Answers \"what is upstream / downstream of this spec?\" in spec id space.\n *\n * specdx declares relationships two ways: config `requires` (keyed by config\n * entry, glob-aware, cheap) and frontmatter `references` (keyed by spec id,\n * typed). Consumers used to read one or the other, so the same question got\n * different answers — `freshness/staleness-check` saw only references, while\n * impact analysis saw only the config graph. This resolver unions both at\n * query time so every consumer agrees, without changing which source owns\n * graph topology (ADR: references/requires unification, Option B).\n */\nexport interface RelationResolver {\n /** All dependency edges, in spec id space, deduplicated. */\n edges: RelationEdge[];\n /** Spec ids this spec depends on, transitively. */\n getUpstream(specId: string): string[];\n /** Spec ids that depend on this spec, transitively. */\n getDownstream(specId: string): string[];\n}\n\ninterface SpecLike {\n frontmatter: Record<string, unknown>;\n}\n\n/** Map each config entry key to the spec ids its path resolved to. */\nfunction mapEntriesToIds(\n config: SdxConfig,\n specsByEntry: Map<string, SpecLike[]>,\n): Map<string, string[]> {\n const entryIds = new Map<string, string[]>();\n for (const key of Object.keys(config.specs)) {\n const ids: string[] = [];\n for (const spec of specsByEntry.get(key) ?? []) {\n const id = spec.frontmatter.id;\n if (typeof id === \"string\") ids.push(id);\n }\n entryIds.set(key, ids);\n }\n return entryIds;\n}\n\n/** Every spec id present, regardless of which entry it came from. */\nfunction collectKnownIds(specsByEntry: Map<string, SpecLike[]>): Set<string> {\n const ids = new Set<string>();\n for (const specs of specsByEntry.values()) {\n for (const spec of specs) {\n const id = spec.frontmatter.id;\n if (typeof id === \"string\") ids.add(id);\n }\n }\n return ids;\n}\n\nfunction walk(specId: string, adjacency: Map<string, string[]>): string[] {\n const visited = new Set<string>();\n const stack = [specId];\n while (stack.length > 0) {\n const current = stack.pop()!;\n for (const next of adjacency.get(current) ?? []) {\n if (!visited.has(next)) {\n visited.add(next);\n stack.push(next);\n }\n }\n }\n visited.delete(specId);\n return [...visited];\n}\n\n/**\n * Build a resolver from config `requires` and dependency-implying frontmatter\n * `references`.\n *\n * A glob entry is one config entry but many spec ids, so one `requires` edge\n * between entries expands to the cross-product of their spec ids. Structural\n * reference kinds (`decomposed-into`, `supersedes`, `related-to`) are not\n * dependency-implying and are excluded — see DEPENDENCY_RELATIONSHIPS.\n *\n * @param config - Spec config. When undefined, only frontmatter references\n * contribute edges — useful for callers that have specs but no config.\n * @param specsByEntry - Parsed specs grouped by the config entry key they resolved from.\n */\nexport function buildRelationResolver(\n config: SdxConfig | undefined,\n specsByEntry: Map<string, SpecLike[]>,\n): RelationResolver {\n const entryIds = config ? mapEntriesToIds(config, specsByEntry) : new Map<string, string[]>();\n const knownIds = collectKnownIds(specsByEntry);\n\n // key \"from→to\" -> source, so a relation declared both ways is one edge\n const edgeSources = new Map<string, RelationSource>();\n const addEdge = (from: string, to: string, source: \"requires\" | \"references\"): void => {\n if (from === to) return;\n const key = `${from}\u0000${to}`;\n const existing = edgeSources.get(key);\n if (!existing) {\n edgeSources.set(key, source);\n } else if (existing !== source) {\n edgeSources.set(key, \"both\");\n }\n };\n\n // 1. Config requires: entry-level edges expand across the entries' spec ids\n for (const [key, entry] of Object.entries(config?.specs ?? {})) {\n const requires = (entry as { requires?: string[] }).requires ?? [];\n for (const dep of requires) {\n for (const from of entryIds.get(dep) ?? []) {\n for (const to of entryIds.get(key) ?? []) {\n addEdge(from, to, \"requires\");\n }\n }\n }\n }\n\n // 2. Frontmatter references, already in spec id space\n for (const specs of specsByEntry.values()) {\n for (const spec of specs) {\n const selfId = spec.frontmatter.id;\n if (typeof selfId !== \"string\") continue;\n const refs = spec.frontmatter.references;\n if (!Array.isArray(refs)) continue;\n\n for (const ref of refs) {\n if (!ref || typeof ref !== \"object\") continue;\n const { id: targetId, relationship } = ref as { id?: unknown; relationship?: unknown };\n if (typeof targetId !== \"string\" || typeof relationship !== \"string\") continue;\n // Referencing a spec outside the suite is valid-references' concern.\n if (!knownIds.has(targetId)) continue;\n\n const direction = DEPENDENCY_RELATIONSHIPS[relationship as never];\n if (direction === \"self-requires-target\") {\n addEdge(targetId, selfId, \"references\");\n } else if (direction === \"target-requires-self\") {\n addEdge(selfId, targetId, \"references\");\n }\n }\n }\n }\n\n const edges: RelationEdge[] = [];\n const downstreamAdj = new Map<string, string[]>();\n const upstreamAdj = new Map<string, string[]>();\n\n for (const [key, source] of edgeSources) {\n const [from, to] = key.split(\"\u0000\") as [string, string];\n edges.push({ from, to, source });\n downstreamAdj.set(from, [...(downstreamAdj.get(from) ?? []), to]);\n upstreamAdj.set(to, [...(upstreamAdj.get(to) ?? []), from]);\n }\n\n return {\n edges,\n getUpstream: (specId) => walk(specId, upstreamAdj),\n getDownstream: (specId) => walk(specId, downstreamAdj),\n };\n}\n","import { readFile } from \"node:fs/promises\";\nimport { resolve, isAbsolute } from \"node:path\";\nimport { ConfigError } from \"./config.js\";\n\nconst BUILTINS = [\"minimal\", \"recommended\", \"strict\"];\n\n/**\n * Resolve a preset name to its config content.\n * Returns null for built-in presets (handled by @specdx/lint).\n * Resolves local file paths and npm package names.\n */\nexport async function resolvePreset(\n name: string,\n cwd = process.cwd(),\n): Promise<Record<string, unknown> | null> {\n if (BUILTINS.includes(name)) {\n return null;\n }\n\n // Try local file path\n const localPath = isAbsolute(name) ? name : resolve(cwd, name);\n try {\n const content = await readFile(localPath, \"utf-8\");\n const { default: yaml } = await import(\"yaml\");\n return yaml.parse(content) as Record<string, unknown>;\n } catch {\n // Not a local file, try npm\n }\n\n // Try npm package\n try {\n const mod = (await import(name)) as { default?: Record<string, unknown> };\n return (mod.default ?? mod) as Record<string, unknown>;\n } catch {\n throw new ConfigError(`Could not resolve preset \"${name}\" as a local file or npm package`);\n }\n}\n"],"mappings":";;;;;;;AAAA,SAAS,gBAA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