specdx 0.5.0 → 0.6.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.
- package/.claude-plugin/plugin.json +2 -2
- package/README.md +70 -22
- package/dist/{check-RH5SCXWW.js → check-5EA2MTNN.js} +120 -26
- package/dist/check-5EA2MTNN.js.map +1 -0
- package/dist/{chunk-3YXRWQGX.js → chunk-2UUQJ2ER.js} +242 -53
- package/dist/chunk-2UUQJ2ER.js.map +1 -0
- package/dist/{chunk-6WFNZH7F.js → chunk-5XOWCPP2.js} +2 -2
- package/dist/{chunk-CQETLJTZ.js → chunk-6S2OQMUH.js} +8 -4
- package/dist/chunk-6S2OQMUH.js.map +1 -0
- package/dist/{chunk-BP3SB35W.js → chunk-JGD3BOPH.js} +15 -5
- package/dist/chunk-JGD3BOPH.js.map +1 -0
- package/dist/{chunk-BMOOLUPG.js → chunk-MOYYF7Q6.js} +2 -2
- package/dist/{chunk-ZIODMXST.js → chunk-VVZUJ6H4.js} +52 -14
- package/dist/{chunk-ZIODMXST.js.map → chunk-VVZUJ6H4.js.map} +1 -1
- package/dist/{chunk-6EQIDZ4D.js → chunk-WSLIO2ZD.js} +13 -13
- package/dist/{diff-QO7HMAK3.js → diff-ZT6HXHK5.js} +3 -3
- package/dist/dist-6WDWUOCV.js +26 -0
- package/dist/{dist-JPWHWMV2.js → dist-A3CWALDC.js} +30 -9
- package/dist/dist-A3CWALDC.js.map +1 -0
- package/dist/{generate-MS4BM7RU.js → generate-PTDHGDR2.js} +4 -4
- package/dist/{generate-story-OMM322L7.js → generate-story-BXGNKWC6.js} +3 -3
- package/dist/{generate-test-plan-75W7SZIO.js → generate-test-plan-PZUNCNN3.js} +2 -2
- package/dist/{graph-QOTMXENE.js → graph-GKXD2IGW.js} +2 -2
- package/dist/index.d.ts +11 -0
- package/dist/index.js +109 -22
- package/dist/index.js.map +1 -1
- package/dist/{lint-LPFLHVO4.js → lint-GZX5C5EQ.js} +55 -10
- package/dist/lint-GZX5C5EQ.js.map +1 -0
- package/dist/main.js +2 -2
- package/dist/{mcp-OEC43SPF.js → mcp-PIVG3LEF.js} +3 -3
- package/dist/{migrate-CBP2AVLH.js → migrate-VASWPA3L.js} +2 -2
- package/dist/{pack-X6FSWORJ.js → pack-DFUCNWVR.js} +3 -3
- package/dist/{ready-7MJWRGLT.js → ready-5OFSV2OD.js} +4 -4
- package/dist/{status-UUPZYX3J.js → status-5MDODW4N.js} +4 -4
- package/dist/{update-EI7IJRHG.js → update-NFXC45UT.js} +3 -3
- package/dist/{validate-HTTZLQWI.js → validate-LWRLZR3H.js} +2 -2
- package/package.json +10 -6
- package/skills/core/specdx-author-spec/SKILL.md +33 -0
- package/skills/core/specdx-author-spec/references/spec-type-reference.md +57 -0
- package/skills/core/specdx-author-spec/references/step-01-frontmatter.md +66 -0
- package/skills/core/specdx-author-spec/references/step-02-sections.md +111 -0
- package/skills/core/specdx-author-spec/references/step-03-finalize.md +48 -0
- package/skills/core/specdx-onboard/SKILL.md +54 -0
- package/skills/core/specdx-plan-from-spec/SKILL.md +76 -0
- package/skills/core/specdx-pre-commit/SKILL.md +70 -0
- package/skills/core/specdx-review-spec/SKILL.md +81 -0
- package/skills/core/specdx-router/SKILL.md +67 -0
- package/skills/core/specdx-sprint-review/SKILL.md +73 -0
- package/skills/core/specdx-start-task/SKILL.md +62 -0
- package/skills/experimental/specdx-check-drift/SKILL.md +77 -0
- package/skills/experimental/specdx-verify/SKILL.md +85 -0
- package/dist/check-RH5SCXWW.js.map +0 -1
- package/dist/chunk-3YXRWQGX.js.map +0 -1
- package/dist/chunk-BP3SB35W.js.map +0 -1
- package/dist/chunk-CQETLJTZ.js.map +0 -1
- package/dist/dist-JPWHWMV2.js.map +0 -1
- package/dist/dist-ROHCFKYT.js +0 -16
- package/dist/lint-LPFLHVO4.js.map +0 -1
- /package/dist/{chunk-6WFNZH7F.js.map → chunk-5XOWCPP2.js.map} +0 -0
- /package/dist/{chunk-BMOOLUPG.js.map → chunk-MOYYF7Q6.js.map} +0 -0
- /package/dist/{chunk-6EQIDZ4D.js.map → chunk-WSLIO2ZD.js.map} +0 -0
- /package/dist/{diff-QO7HMAK3.js.map → diff-ZT6HXHK5.js.map} +0 -0
- /package/dist/{dist-ROHCFKYT.js.map → dist-6WDWUOCV.js.map} +0 -0
- /package/dist/{generate-MS4BM7RU.js.map → generate-PTDHGDR2.js.map} +0 -0
- /package/dist/{generate-story-OMM322L7.js.map → generate-story-BXGNKWC6.js.map} +0 -0
- /package/dist/{generate-test-plan-75W7SZIO.js.map → generate-test-plan-PZUNCNN3.js.map} +0 -0
- /package/dist/{graph-QOTMXENE.js.map → graph-GKXD2IGW.js.map} +0 -0
- /package/dist/{mcp-OEC43SPF.js.map → mcp-PIVG3LEF.js.map} +0 -0
- /package/dist/{migrate-CBP2AVLH.js.map → migrate-VASWPA3L.js.map} +0 -0
- /package/dist/{pack-X6FSWORJ.js.map → pack-DFUCNWVR.js.map} +0 -0
- /package/dist/{ready-7MJWRGLT.js.map → ready-5OFSV2OD.js.map} +0 -0
- /package/dist/{status-UUPZYX3J.js.map → status-5MDODW4N.js.map} +0 -0
- /package/dist/{update-EI7IJRHG.js.map → update-NFXC45UT.js.map} +0 -0
- /package/dist/{validate-HTTZLQWI.js.map → validate-LWRLZR3H.js.map} +0 -0
|
@@ -1,8 +1,9 @@
|
|
|
1
1
|
import {
|
|
2
2
|
createLintEngine,
|
|
3
3
|
lintAgentFiles,
|
|
4
|
+
lintAgentFilesWithoutConfig,
|
|
4
5
|
resolveLintConfig
|
|
5
|
-
} from "./chunk-
|
|
6
|
+
} from "./chunk-VVZUJ6H4.js";
|
|
6
7
|
import {
|
|
7
8
|
createOutput
|
|
8
9
|
} from "./chunk-NHD44ZYN.js";
|
|
@@ -11,12 +12,14 @@ import {
|
|
|
11
12
|
sharedArgs
|
|
12
13
|
} from "./chunk-DMGABJ6T.js";
|
|
13
14
|
import {
|
|
15
|
+
ConfigError,
|
|
14
16
|
buildGraph,
|
|
15
17
|
createLogger,
|
|
18
|
+
findConfig,
|
|
16
19
|
loadConfig,
|
|
17
20
|
parseSpec,
|
|
18
21
|
resolveGlob
|
|
19
|
-
} from "./chunk-
|
|
22
|
+
} from "./chunk-JGD3BOPH.js";
|
|
20
23
|
import "./chunk-XRWLPU24.js";
|
|
21
24
|
import "./chunk-5WRI5ZAA.js";
|
|
22
25
|
|
|
@@ -53,7 +56,28 @@ async function runLint(options) {
|
|
|
53
56
|
if (!options.configDir) {
|
|
54
57
|
throw new TypeError("runLint requires `configDir` \u2014 the directory holding spec.config.yaml.");
|
|
55
58
|
}
|
|
56
|
-
const
|
|
59
|
+
const configPath = await findConfig(options.configDir);
|
|
60
|
+
if (!configPath) {
|
|
61
|
+
if (options.specPath) {
|
|
62
|
+
throw new ConfigError(
|
|
63
|
+
`No spec.config.yaml at or above this directory, so "${options.specPath}" was not linted as a spec. Run \`specdx lint\` with no path to lint AGENTS.md and CLAUDE.md, or \`specdx init\` to add a spec suite.`
|
|
64
|
+
);
|
|
65
|
+
}
|
|
66
|
+
const agentResults = await lintAgentFilesWithoutConfig(options.configDir);
|
|
67
|
+
if (!agentResults) {
|
|
68
|
+
throw new ConfigError("No spec.config.yaml found. Run 'specdx init' to create one.");
|
|
69
|
+
}
|
|
70
|
+
return {
|
|
71
|
+
diagnostics: agentResults.diagnostics,
|
|
72
|
+
hasErrors: agentResults.diagnostics.some((d) => d.severity === "error"),
|
|
73
|
+
hasWarnings: agentResults.diagnostics.some((d) => d.severity === "warn"),
|
|
74
|
+
specFiles: 0,
|
|
75
|
+
assessed: false,
|
|
76
|
+
agentFiles: agentResults.filesLinted,
|
|
77
|
+
specSuite: false
|
|
78
|
+
};
|
|
79
|
+
}
|
|
80
|
+
const config = await loadConfig(configPath, options.configDir);
|
|
57
81
|
const preset = options.preset ?? config.lint?.extends ?? "recommended";
|
|
58
82
|
const { rules, ignore } = await resolveLintConfig({
|
|
59
83
|
config,
|
|
@@ -115,13 +139,31 @@ async function runLint(options) {
|
|
|
115
139
|
}
|
|
116
140
|
const ignored = new Set(ignore);
|
|
117
141
|
const linted = specs.filter((spec) => !ignored.has(spec.filePath) && selects(spec.filePath));
|
|
118
|
-
return {
|
|
142
|
+
return {
|
|
143
|
+
...results,
|
|
144
|
+
specFiles: linted.length,
|
|
145
|
+
assessed: linted.length > 0,
|
|
146
|
+
agentFiles,
|
|
147
|
+
specSuite: true
|
|
148
|
+
};
|
|
149
|
+
}
|
|
150
|
+
function noSpecSuiteNotice(configDir) {
|
|
151
|
+
return {
|
|
152
|
+
ruleId: "agents/no-spec-suite",
|
|
153
|
+
severity: "info",
|
|
154
|
+
message: "No spec.config.yaml at or above this directory, so no specs were checked \u2014 only agent instruction files. Run `specdx init` to add a spec suite.",
|
|
155
|
+
filePath: configDir
|
|
156
|
+
};
|
|
119
157
|
}
|
|
120
158
|
function cleanRunMessage(results) {
|
|
121
|
-
const
|
|
122
|
-
if (results.
|
|
123
|
-
|
|
159
|
+
const agentPart = `${results.agentFiles} agent ${results.agentFiles === 1 ? "file" : "files"}`;
|
|
160
|
+
if (!results.specSuite) {
|
|
161
|
+
return ` \u2713 ${agentPart} checked, no problems found.
|
|
162
|
+
No spec.config.yaml here, so no specs were checked. Run \`specdx init\` to add a spec suite.
|
|
163
|
+
`;
|
|
124
164
|
}
|
|
165
|
+
const parts = [`${results.specFiles} ${results.specFiles === 1 ? "spec" : "specs"}`];
|
|
166
|
+
if (results.agentFiles > 0) parts.push(agentPart);
|
|
125
167
|
return ` \u2713 ${parts.join(" and ")} checked, no problems found.
|
|
126
168
|
`;
|
|
127
169
|
}
|
|
@@ -153,7 +195,7 @@ var lint_default = defineCommand({
|
|
|
153
195
|
preset: args.preset
|
|
154
196
|
});
|
|
155
197
|
const formatter = format.format === "json" ? formatJson : format.format === "github" ? formatGithub : formatPretty;
|
|
156
|
-
if (!results.assessed) {
|
|
198
|
+
if (!results.assessed && results.specSuite) {
|
|
157
199
|
console.error(
|
|
158
200
|
args.path ? `
|
|
159
201
|
\u26A0 No specs matched path "${args.path}", so nothing was linted. Check it against the specs declared in spec.config.yaml.
|
|
@@ -161,7 +203,9 @@ var lint_default = defineCommand({
|
|
|
161
203
|
);
|
|
162
204
|
process.exit(3);
|
|
163
205
|
}
|
|
164
|
-
const rendered = formatter(
|
|
206
|
+
const rendered = formatter(
|
|
207
|
+
results.specSuite ? results.diagnostics : [noSpecSuiteNotice(process.cwd()), ...results.diagnostics]
|
|
208
|
+
);
|
|
165
209
|
if (format.format === "pretty" && results.diagnostics.length === 0) {
|
|
166
210
|
output.info(cleanRunMessage(results));
|
|
167
211
|
} else {
|
|
@@ -179,6 +223,7 @@ var lint_default = defineCommand({
|
|
|
179
223
|
export {
|
|
180
224
|
cleanRunMessage,
|
|
181
225
|
lint_default as default,
|
|
226
|
+
noSpecSuiteNotice,
|
|
182
227
|
runLint
|
|
183
228
|
};
|
|
184
|
-
//# sourceMappingURL=lint-
|
|
229
|
+
//# sourceMappingURL=lint-GZX5C5EQ.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../src/commands/core/lint.ts","../src/formatters/pretty.ts","../src/formatters/json.ts","../src/formatters/github.ts"],"sourcesContent":["import { defineCommand } from \"citty\";\nimport {\n loadConfig,\n findConfig,\n ConfigError,\n parseSpec,\n resolveGlob,\n buildGraph,\n createLogger,\n} from \"@specdx/core\";\nimport {\n createLintEngine,\n resolveLintConfig,\n lintAgentFiles,\n lintAgentFilesWithoutConfig,\n type LintResults,\n type Diagnostic,\n} from \"@specdx/lint\";\nimport type { ParsedSpec } from \"@specdx/core\";\nimport { sharedArgs, resolveFormat } from \"../../shared-args.js\";\nimport { createOutput } from \"../../output.js\";\nimport { formatPretty } from \"../../formatters/pretty.js\";\nimport { formatJson } from \"../../formatters/json.js\";\nimport { formatGithub } from \"../../formatters/github.js\";\n\nconst FORMATS = [\"pretty\", \"json\", \"github\"] as const;\n\nexport interface RunLintOptions {\n configDir: string;\n specPath?: string;\n preset?: \"minimal\" | \"recommended\" | \"strict\";\n}\n\n/** Lint results plus whether anything was actually linted (vacuous-pass audit). */\nexport interface RunLintResults extends LintResults {\n /** Number of spec files linted. Named for what it counts, not \"count\". */\n specFiles: number;\n /** False when no specs resolved — \"no diagnostics\" is then not a pass. */\n assessed: boolean;\n /**\n * Agent instruction files linted. Zero when `agents` is not configured, which\n * is not a failure — the feature is opt-in. A configured `agents.paths` that\n * matches nothing is reported as an error diagnostic instead, because that\n * is a config promising a check that is not running.\n */\n agentFiles: number;\n /**\n * False when there is no `spec.config.yaml` and only agent instruction files\n * were linted. The zero-config on-ramp: a project with a CLAUDE.md and no\n * spec suite gets a useful answer instead of \"run specdx init\".\n *\n * `assessed` keeps meaning \"specs were assessed\", so the vacuous-pass guard\n * it exists for is unweakened; callers check this flag to know that a\n * `specFiles: 0` is expected here rather than a suite that resolved to\n * nothing.\n */\n specSuite: boolean;\n}\n\nexport async function runLint(options: RunLintOptions): Promise<RunLintResults> {\n // A JS caller omitting the option otherwise dies as ERR_INVALID_ARG_TYPE\n // deep inside path.join, with no mention of what was missing.\n if (!options.configDir) {\n throw new TypeError(\"runLint requires `configDir` — the directory holding spec.config.yaml.\");\n }\n // No spec suite is not automatically an error: a project may have a\n // CLAUDE.md and nothing else, and that is the on-ramp this supports.\n //\n // The presence check runs *before* `loadConfig`, deliberately. A missing\n // config and a malformed one both surface as `ConfigError`, and degrading on\n // the second would turn a YAML typo into a narrower check reported as a\n // pass — the vacuous-pass shape, one level up. Only genuine absence\n // degrades; anything else still throws.\n const configPath = await findConfig(options.configDir);\n if (!configPath) {\n // A caller who named a spec file asked for something this directory cannot\n // give. Linting the agent files instead and exiting 0 would report a pass\n // for a file nobody looked at — #53's defect through a new door, and the\n // guard below cannot catch it because it is scoped to a real suite.\n if (options.specPath) {\n throw new ConfigError(\n `No spec.config.yaml at or above this directory, so \"${options.specPath}\" was not linted as a spec. ` +\n `Run \\`specdx lint\\` with no path to lint AGENTS.md and CLAUDE.md, or \\`specdx init\\` to add a spec suite.`,\n );\n }\n const agentResults = await lintAgentFilesWithoutConfig(options.configDir);\n if (!agentResults) {\n // Nothing to lint at all. The original guidance is still the right one.\n throw new ConfigError(\"No spec.config.yaml found. Run 'specdx init' to create one.\");\n }\n return {\n diagnostics: agentResults.diagnostics,\n hasErrors: agentResults.diagnostics.some((d) => d.severity === \"error\"),\n hasWarnings: agentResults.diagnostics.some((d) => d.severity === \"warn\"),\n specFiles: 0,\n assessed: false,\n agentFiles: agentResults.filesLinted,\n specSuite: false,\n };\n }\n\n // Pass the path `findConfig` already resolved rather than making `loadConfig`\n // walk the tree a second time.\n const config = await loadConfig(configPath, options.configDir);\n const preset = options.preset ?? config.lint?.extends ?? \"recommended\";\n const { rules, ignore } = await resolveLintConfig({\n config,\n preset,\n configDir: options.configDir,\n });\n\n // Always parse the full suite so cross-reference rules have complete\n // context; a single-file lint filters the *diagnostics*, not the suite.\n const specs: ParsedSpec[] = [];\n for (const [, entry] of Object.entries(config.specs)) {\n const files = await resolveGlob(entry.path, options.configDir);\n for (const file of files) {\n specs.push(await parseSpec(file));\n }\n }\n\n let graph;\n let graphError: string | undefined;\n try {\n graph = buildGraph(config);\n } catch (err) {\n graphError = (err as Error).message;\n }\n\n const engine = createLintEngine({ rules, config, graph, ignore });\n const results = engine.lint(specs);\n\n // One definition of \"does --path select this file\", shared by the diagnostic\n // filter below and the assessed count further down. Two copies of this\n // predicate would be free to disagree, and a count that disagrees with the\n // filter is exactly how the vacuous pass got in: `--path` filtered the\n // diagnostics to nothing while the count still described the whole suite, so\n // a path matching no spec rendered as \"All specs pass lint checks\", exit 0.\n const { specPath } = options;\n const selects = (filePath: string) => specPath === undefined || filePath.includes(specPath);\n\n if (specPath !== undefined) {\n results.diagnostics = results.diagnostics.filter((d) => selects(d.filePath));\n results.hasErrors = results.diagnostics.some((d) => d.severity === \"error\");\n results.hasWarnings = results.diagnostics.some((d) => d.severity === \"warn\");\n }\n\n if (graphError) {\n results.diagnostics.push({\n ruleId: \"structure/no-circular-deps\",\n severity: \"error\",\n message: graphError,\n filePath: \"spec.config.yaml\",\n });\n results.hasErrors = true;\n }\n\n // Agent instruction files — AGENTS.md, CLAUDE.md. Opt-in via the `agents`\n // key, so upgrading specdx never adds diagnostics to a suite that did not\n // ask for them, and `lint.extends: strict` cannot promote someone's CLAUDE.md\n // findings to build failures. These are not specs: they are absent from\n // `allSpecs`, the graph, and every `--path` calculation above.\n let agentFiles = 0;\n if (config.agents) {\n const agentResults = await lintAgentFiles({ config, configDir: options.configDir });\n agentFiles = agentResults.filesLinted;\n\n if (!agentResults.assessed) {\n // A config that promises agent linting and inspects nothing is the\n // vacuous-pass shape again — silence here would read as \"your agent\n // files are fine\". An error diagnostic rather than exit 3, because the\n // specs above *were* assessed, and machine formats must show it.\n const patterns = config.agents.paths ?? [\"AGENTS.md\", \"CLAUDE.md\"];\n results.diagnostics.push({\n ruleId: \"agents/paths-match-nothing\",\n severity: \"error\",\n message: `agents.paths matched no files (${patterns.join(\", \")}), so no agent instruction file was linted. Remove the \\`agents\\` key or fix the paths.`,\n filePath: \"spec.config.yaml\",\n });\n results.hasErrors = true;\n }\n\n // A single-file lint narrows agent diagnostics the same way it narrows\n // spec ones; anything else would leak findings from files the user did\n // not ask about. Through the same `selects` predicate, not a second copy\n // of it — a second copy is precisely the bug #53 fixed.\n for (const diagnostic of agentResults.diagnostics) {\n if (!selects(diagnostic.filePath)) continue;\n results.diagnostics.push(diagnostic);\n if (diagnostic.severity === \"error\") results.hasErrors = true;\n if (diagnostic.severity === \"warn\") results.hasWarnings = true;\n }\n }\n\n // Count what was actually linted, not what resolved. `lint.ignore` excluding\n // every spec produces no diagnostics, and reporting that as a pass is the\n // vacuous-pass shape one config key over: \"0 problems\" because nothing was\n // looked at reads identically to \"0 problems\" because nothing was wrong.\n // `--path` narrows the same way, so it has to narrow this count too.\n const ignored = new Set(ignore);\n const linted = specs.filter((spec) => !ignored.has(spec.filePath) && selects(spec.filePath));\n\n return {\n ...results,\n specFiles: linted.length,\n assessed: linted.length > 0,\n agentFiles,\n specSuite: true,\n };\n}\n\n/**\n * The marker that says \"no specs were checked here, and that is expected\".\n *\n * `cleanRunMessage` says this in prose, but only on a clean pretty run. A CI\n * job reading `--format json` in a tree whose `spec.config.yaml` was never\n * checked out would otherwise get `[]` and exit 0 — byte-identical to a clean\n * suite, with the whole suite unexamined. Same shape as\n * `agents/paths-match-nothing` above: the fact has to reach machine formats,\n * and a diagnostic is the channel they have.\n *\n * Info severity, so it cannot fail a build. Agent-only mode is a supported\n * outcome, not a fault.\n */\nexport function noSpecSuiteNotice(configDir: string): Diagnostic {\n return {\n ruleId: \"agents/no-spec-suite\",\n severity: \"info\",\n message:\n \"No spec.config.yaml at or above this directory, so no specs were checked — only agent instruction files. Run `specdx init` to add a spec suite.\",\n filePath: configDir,\n };\n}\n\n/**\n * What a clean run says it checked.\n *\n * Exported for tests: this string is the only thing a passing run shows a\n * user, so it is the thing worth asserting on.\n */\nexport function cleanRunMessage(\n results: Pick<RunLintResults, \"specFiles\" | \"agentFiles\" | \"specSuite\">,\n): string {\n const agentPart = `${results.agentFiles} agent ${results.agentFiles === 1 ? \"file\" : \"files\"}`;\n\n // Agent-only mode. Never claim specs were checked when there were none to\n // check, and say why — someone in the wrong directory needs to be able to\n // tell this apart from a healthy run.\n if (!results.specSuite) {\n return ` ✓ ${agentPart} checked, no problems found.\\n No spec.config.yaml here, so no specs were checked. Run \\`specdx init\\` to add a spec suite.\\n`;\n }\n\n const parts = [`${results.specFiles} ${results.specFiles === 1 ? \"spec\" : \"specs\"}`];\n if (results.agentFiles > 0) parts.push(agentPart);\n return ` ✓ ${parts.join(\" and \")} checked, no problems found.\\n`;\n}\n\nexport default defineCommand({\n meta: { name: \"lint\", description: \"Lint all specs in the suite\" },\n args: {\n ...sharedArgs(FORMATS),\n fix: { type: \"boolean\", description: \"Auto-fix issues where possible\" },\n path: { type: \"positional\", description: \"Lint a specific spec file\", required: false },\n preset: { type: \"string\", description: \"Lint preset (minimal, recommended, strict)\" },\n },\n async run({ args }) {\n const logger = createLogger({ quiet: args.quiet, verbose: args.verbose });\n const output = createOutput({ quiet: args.quiet });\n\n const format = resolveFormat(args.format, FORMATS);\n if (!format.ok) {\n console.error(`\\n ✗ ${format.message}\\n`);\n process.exit(1);\n }\n\n if (args.fix) {\n logger.info(\"No auto-fixable issues supported yet.\");\n }\n\n try {\n const results = await runLint({\n configDir: process.cwd(),\n specPath: args.path,\n preset: args.preset as \"minimal\" | \"recommended\" | \"strict\" | undefined,\n });\n\n const formatter =\n format.format === \"json\"\n ? formatJson\n : format.format === \"github\"\n ? formatGithub\n : formatPretty;\n // \"No diagnostics\" over an empty selection is not a pass (vacuous-pass\n // audit). Name the actual cause: sending someone to spec.config.yaml when\n // they mistyped `--path` is a worse hint than no hint.\n // `assessed` is about the spec suite. In agent-only mode there is no\n // suite to assess and `specFiles: 0` is the expected answer, not a\n // vacuous pass — `runLint` has already refused the case where neither a\n // suite nor an agent file exists.\n if (!results.assessed && results.specSuite) {\n console.error(\n args.path\n ? `\\n ⚠ No specs matched path \"${args.path}\", so nothing was linted. Check it against the specs declared in spec.config.yaml.\\n`\n : \"\\n ⚠ No specs were linted. Check the spec paths in spec.config.yaml, and whether `lint.ignore` excludes them all.\\n\",\n );\n process.exit(3);\n }\n\n // Agent-only mode has to be visible in every format. The prose notice in\n // `cleanRunMessage` covers exactly one of three, and only when the run is\n // clean; prepending the marker covers the other two and the pretty runs\n // that do have diagnostics. The clean check below stays on the unprefixed\n // array, so the `✓` message is still what a clean agent-only run shows.\n const rendered = formatter(\n results.specSuite\n ? results.diagnostics\n : [noSpecSuiteNotice(process.cwd()), ...results.diagnostics],\n );\n // A clean pretty run is chrome; diagnostics and machine formats are not.\n if (format.format === \"pretty\" && results.diagnostics.length === 0) {\n // Say what was assessed, not just that nothing was wrong. With agent\n // linting configured, \"All specs pass\" is silent about whether the\n // agent files were looked at — and a clean run that skipped them\n // reads identically to one that checked them.\n output.info(cleanRunMessage(results));\n } else {\n output.out(rendered);\n }\n\n if (results.hasErrors) process.exit(1);\n } catch (err) {\n console.error(`\\n ✗ ${(err as Error).message}\\n`);\n process.exit(1);\n }\n },\n});\n","import type { Diagnostic } from \"@specdx/lint\";\n\nexport function formatPretty(diagnostics: Diagnostic[]): string {\n if (diagnostics.length === 0) return \" ✓ All specs pass lint checks.\\n\";\n return diagnostics\n .map((d) => {\n const icon = d.severity === \"error\" ? \"✗\" : d.severity === \"warn\" ? \"⚠\" : \"ℹ\";\n return ` ${icon} ${d.severity} ${d.message} (${d.ruleId})\\n ${d.filePath}${d.line ? `:${d.line}` : \"\"}`;\n })\n .join(\"\\n\");\n}\n","import type { Diagnostic } from \"@specdx/lint\";\nexport function formatJson(diagnostics: Diagnostic[]): string {\n return JSON.stringify(diagnostics, null, 2);\n}\n","import type { Diagnostic } from \"@specdx/lint\";\n\n/**\n * GitHub workflow-command annotations.\n *\n * Info-severity diagnostics map to `::notice`, not `::warning`. Rendering an\n * advisory as a warning put five warnings in the Actions log for a suite that\n * was clean and exited 0 — the ambiguity advisory in particular, which is info\n * precisely so it cannot fail a build (audit run 5, F5).\n */\nexport function formatGithub(diagnostics: Diagnostic[]): string {\n return diagnostics\n .map((d) => {\n const level = d.severity === \"error\" ? \"error\" : d.severity === \"warn\" ? \"warning\" : \"notice\";\n const line = d.line ? `,line=${d.line}` : \"\";\n return `::${level} file=${d.filePath}${line}::${d.message} (${d.ruleId})`;\n })\n .join(\"\\n\");\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,SAAS,qBAAqB;;;ACEvB,SAAS,aAAa,aAAmC;AAC9D,MAAI,YAAY,WAAW,EAAG,QAAO;AACrC,SAAO,YACJ,IAAI,CAAC,MAAM;AACV,UAAM,OAAO,EAAE,aAAa,UAAU,WAAM,EAAE,aAAa,SAAS,WAAM;AAC1E,WAAO,KAAK,IAAI,IAAI,EAAE,QAAQ,KAAK,EAAE,OAAO,MAAM,EAAE,MAAM;AAAA,MAAU,EAAE,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QAAQ,WAAW;AAAA,MAC/D;AAEA,UAAI,OAAO,WAAW,YAAY,QAAQ,YAAY,WAAW,GAAG;AAKlE,eAAO,KAAK,gBAAgB,OAAO,CAAC;AAAA,MACtC,OAAO;AACL,eAAO,IAAI,QAAQ;AAAA,MACrB;AAEA,UAAI,QAAQ,UAAW,SAAQ,KAAK,CAAC;AAAA,IACvC,SAAS,KAAK;AACZ,cAAQ,MAAM;AAAA,WAAU,IAAc,OAAO;AAAA,CAAI;AACjD,cAAQ,KAAK,CAAC;AAAA,IAChB;AAAA,EACF;AACF,CAAC;","names":[]}
|
package/dist/main.js
CHANGED
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
2
|
import {
|
|
3
3
|
package_default
|
|
4
|
-
} from "./chunk-
|
|
4
|
+
} from "./chunk-6S2OQMUH.js";
|
|
5
5
|
import {
|
|
6
6
|
subCommands
|
|
7
|
-
} from "./chunk-
|
|
7
|
+
} from "./chunk-WSLIO2ZD.js";
|
|
8
8
|
import "./chunk-XRWLPU24.js";
|
|
9
9
|
import "./chunk-5WRI5ZAA.js";
|
|
10
10
|
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import {
|
|
2
2
|
package_default
|
|
3
|
-
} from "./chunk-
|
|
3
|
+
} from "./chunk-6S2OQMUH.js";
|
|
4
4
|
import "./chunk-5WRI5ZAA.js";
|
|
5
5
|
|
|
6
6
|
// src/commands/core/mcp.ts
|
|
@@ -12,7 +12,7 @@ var mcp_default = defineCommand({
|
|
|
12
12
|
let mcp;
|
|
13
13
|
let stdio;
|
|
14
14
|
try {
|
|
15
|
-
mcp = await import("./dist-
|
|
15
|
+
mcp = await import("./dist-A3CWALDC.js");
|
|
16
16
|
stdio = await import("@modelcontextprotocol/sdk/server/stdio.js");
|
|
17
17
|
} catch (err) {
|
|
18
18
|
const missing = err.message.includes("zod") ? "zod" : "@modelcontextprotocol/sdk";
|
|
@@ -32,4 +32,4 @@ var mcp_default = defineCommand({
|
|
|
32
32
|
export {
|
|
33
33
|
mcp_default as default
|
|
34
34
|
};
|
|
35
|
-
//# sourceMappingURL=mcp-
|
|
35
|
+
//# sourceMappingURL=mcp-PIVG3LEF.js.map
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import {
|
|
2
2
|
createLogger,
|
|
3
3
|
loadConfig
|
|
4
|
-
} from "./chunk-
|
|
4
|
+
} from "./chunk-JGD3BOPH.js";
|
|
5
5
|
import {
|
|
6
6
|
SPEC_TYPES,
|
|
7
7
|
SUPPORTED_CONFIG_VERSION
|
|
@@ -65,4 +65,4 @@ var migrate_default = defineCommand({
|
|
|
65
65
|
export {
|
|
66
66
|
migrate_default as default
|
|
67
67
|
};
|
|
68
|
-
//# sourceMappingURL=migrate-
|
|
68
|
+
//# sourceMappingURL=migrate-VASWPA3L.js.map
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import {
|
|
2
2
|
pack
|
|
3
|
-
} from "./chunk-
|
|
3
|
+
} from "./chunk-MOYYF7Q6.js";
|
|
4
4
|
import {
|
|
5
5
|
quietArg,
|
|
6
6
|
verboseArg
|
|
@@ -11,7 +11,7 @@ import {
|
|
|
11
11
|
loadConfig,
|
|
12
12
|
parseSpec,
|
|
13
13
|
resolveGlob
|
|
14
|
-
} from "./chunk-
|
|
14
|
+
} from "./chunk-JGD3BOPH.js";
|
|
15
15
|
import "./chunk-XRWLPU24.js";
|
|
16
16
|
import "./chunk-5WRI5ZAA.js";
|
|
17
17
|
|
|
@@ -193,4 +193,4 @@ export {
|
|
|
193
193
|
emptyPackReason,
|
|
194
194
|
runPack
|
|
195
195
|
};
|
|
196
|
-
//# sourceMappingURL=pack-
|
|
196
|
+
//# sourceMappingURL=pack-DFUCNWVR.js.map
|
|
@@ -2,10 +2,10 @@ import {
|
|
|
2
2
|
createLintEngine,
|
|
3
3
|
parseFeatures,
|
|
4
4
|
resolveLintConfig
|
|
5
|
-
} from "./chunk-
|
|
5
|
+
} from "./chunk-VVZUJ6H4.js";
|
|
6
6
|
import {
|
|
7
7
|
DEFAULT_DIFF_CONFIG
|
|
8
|
-
} from "./chunk-
|
|
8
|
+
} from "./chunk-5XOWCPP2.js";
|
|
9
9
|
import {
|
|
10
10
|
resolveFormat,
|
|
11
11
|
sharedArgs
|
|
@@ -16,7 +16,7 @@ import {
|
|
|
16
16
|
loadConfig,
|
|
17
17
|
parseSpec,
|
|
18
18
|
resolveGlob
|
|
19
|
-
} from "./chunk-
|
|
19
|
+
} from "./chunk-JGD3BOPH.js";
|
|
20
20
|
import "./chunk-XRWLPU24.js";
|
|
21
21
|
import "./chunk-5WRI5ZAA.js";
|
|
22
22
|
|
|
@@ -267,4 +267,4 @@ export {
|
|
|
267
267
|
ready_default as default,
|
|
268
268
|
runReady
|
|
269
269
|
};
|
|
270
|
-
//# sourceMappingURL=ready-
|
|
270
|
+
//# sourceMappingURL=ready-5OFSV2OD.js.map
|
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
import {
|
|
2
2
|
createLintEngine,
|
|
3
3
|
resolveLintConfig
|
|
4
|
-
} from "./chunk-
|
|
4
|
+
} from "./chunk-VVZUJ6H4.js";
|
|
5
5
|
import {
|
|
6
6
|
DEFAULT_DIFF_CONFIG
|
|
7
|
-
} from "./chunk-
|
|
7
|
+
} from "./chunk-5XOWCPP2.js";
|
|
8
8
|
import {
|
|
9
9
|
createOutput
|
|
10
10
|
} from "./chunk-NHD44ZYN.js";
|
|
@@ -17,7 +17,7 @@ import {
|
|
|
17
17
|
loadConfig,
|
|
18
18
|
parseSpec,
|
|
19
19
|
resolveGlob
|
|
20
|
-
} from "./chunk-
|
|
20
|
+
} from "./chunk-JGD3BOPH.js";
|
|
21
21
|
import "./chunk-XRWLPU24.js";
|
|
22
22
|
import "./chunk-5WRI5ZAA.js";
|
|
23
23
|
|
|
@@ -188,4 +188,4 @@ export {
|
|
|
188
188
|
status_default as default,
|
|
189
189
|
runStatus
|
|
190
190
|
};
|
|
191
|
-
//# sourceMappingURL=status-
|
|
191
|
+
//# sourceMappingURL=status-5MDODW4N.js.map
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import {
|
|
2
2
|
runCheck
|
|
3
|
-
} from "./chunk-
|
|
3
|
+
} from "./chunk-2UUQJ2ER.js";
|
|
4
4
|
import {
|
|
5
5
|
resolveFormat,
|
|
6
6
|
sharedArgs
|
|
@@ -10,7 +10,7 @@ import {
|
|
|
10
10
|
loadConfig,
|
|
11
11
|
parseSpec,
|
|
12
12
|
resolveGlob
|
|
13
|
-
} from "./chunk-
|
|
13
|
+
} from "./chunk-JGD3BOPH.js";
|
|
14
14
|
import "./chunk-XRWLPU24.js";
|
|
15
15
|
import "./chunk-5WRI5ZAA.js";
|
|
16
16
|
|
|
@@ -139,4 +139,4 @@ export {
|
|
|
139
139
|
update_default as default,
|
|
140
140
|
generateUpdates
|
|
141
141
|
};
|
|
142
|
-
//# sourceMappingURL=update-
|
|
142
|
+
//# sourceMappingURL=update-NFXC45UT.js.map
|
|
@@ -11,7 +11,7 @@ import {
|
|
|
11
11
|
buildGraph,
|
|
12
12
|
loadConfig,
|
|
13
13
|
resolveGlob
|
|
14
|
-
} from "./chunk-
|
|
14
|
+
} from "./chunk-JGD3BOPH.js";
|
|
15
15
|
import "./chunk-XRWLPU24.js";
|
|
16
16
|
import "./chunk-5WRI5ZAA.js";
|
|
17
17
|
|
|
@@ -102,4 +102,4 @@ export {
|
|
|
102
102
|
validate_default as default,
|
|
103
103
|
runValidate
|
|
104
104
|
};
|
|
105
|
-
//# sourceMappingURL=validate-
|
|
105
|
+
//# sourceMappingURL=validate-LWRLZR3H.js.map
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "specdx",
|
|
3
|
-
"version": "0.
|
|
4
|
-
"description": "
|
|
3
|
+
"version": "0.6.1",
|
|
4
|
+
"description": "Lint the documents your coding agent reads: CLAUDE.md, AGENTS.md and specs. Deterministic, no LLM calls, no config needed.",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"license": "MIT",
|
|
7
7
|
"author": "Umar Gora (https://github.com/umxr)",
|
|
@@ -15,6 +15,9 @@
|
|
|
15
15
|
"url": "https://github.com/umxr/specdx/issues"
|
|
16
16
|
},
|
|
17
17
|
"keywords": [
|
|
18
|
+
"claude-md",
|
|
19
|
+
"agents-md",
|
|
20
|
+
"linter",
|
|
18
21
|
"spec",
|
|
19
22
|
"specification",
|
|
20
23
|
"prd",
|
|
@@ -42,6 +45,7 @@
|
|
|
42
45
|
},
|
|
43
46
|
"files": [
|
|
44
47
|
"dist",
|
|
48
|
+
"skills",
|
|
45
49
|
".claude-plugin",
|
|
46
50
|
"hooks",
|
|
47
51
|
"README.md"
|
|
@@ -66,12 +70,12 @@
|
|
|
66
70
|
"typescript": "^5.7.0",
|
|
67
71
|
"@specdx/check": "0.0.1",
|
|
68
72
|
"@specdx/diff": "0.0.1",
|
|
73
|
+
"@specdx/core": "0.0.1",
|
|
69
74
|
"@specdx/lint": "0.1.0",
|
|
70
75
|
"@specdx/mcp": "0.0.1",
|
|
71
|
-
"@specdx/core": "0.0.1",
|
|
72
76
|
"@specdx/pack": "0.0.1",
|
|
73
|
-
"@specdx/
|
|
74
|
-
"@specdx/
|
|
77
|
+
"@specdx/skills": "0.0.1",
|
|
78
|
+
"@specdx/schema": "0.0.1"
|
|
75
79
|
},
|
|
76
80
|
"publishConfig": {
|
|
77
81
|
"access": "public"
|
|
@@ -89,7 +93,7 @@
|
|
|
89
93
|
}
|
|
90
94
|
},
|
|
91
95
|
"scripts": {
|
|
92
|
-
"build": "tsup",
|
|
96
|
+
"build": "node ../../scripts/sync-plugin-skills.mjs && tsup",
|
|
93
97
|
"typecheck": "tsc --noEmit",
|
|
94
98
|
"test": "vitest run",
|
|
95
99
|
"clean": "rm -rf dist *.tsbuildinfo"
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: specdx-author-spec
|
|
3
|
+
description: Use when the user wants to create a new spec, write a PRD, document a technical design, record an architecture decision, add a user story, or write a test plan. Guides spec authoring with iterative linting.
|
|
4
|
+
allowed-tools: Bash(npx specdx:*) Read Write Edit
|
|
5
|
+
---
|
|
6
|
+
|
|
7
|
+
# Author a Spec
|
|
8
|
+
|
|
9
|
+
This skill follows a 3-step workflow. Load each step file as you reach it — this keeps the context focused and prevents bloat in long authoring sessions.
|
|
10
|
+
|
|
11
|
+
## Steps
|
|
12
|
+
|
|
13
|
+
1. **Frontmatter** — Read `references/step-01-frontmatter.md`
|
|
14
|
+
- Determine spec type, check existing specs, create file with frontmatter
|
|
15
|
+
|
|
16
|
+
2. **Sections** — Read `references/step-02-sections.md`
|
|
17
|
+
- Write sections one at a time, lint after every 2-3 sections
|
|
18
|
+
- HARD GATE: Do NOT skip lint between sections
|
|
19
|
+
|
|
20
|
+
3. **Finalize** — Read `references/step-03-finalize.md`
|
|
21
|
+
- Register in spec.config.yaml, run final validation
|
|
22
|
+
|
|
23
|
+
## How to use
|
|
24
|
+
|
|
25
|
+
Start by reading `references/step-01-frontmatter.md` (relative to this file). Complete that step fully before moving to step 2.
|
|
26
|
+
|
|
27
|
+
Each step file is self-contained with its own instructions. Do NOT read ahead — load one step at a time.
|
|
28
|
+
|
|
29
|
+
For detailed reference on spec types and their fields, see `references/spec-type-reference.md`.
|
|
30
|
+
|
|
31
|
+
## It's working if
|
|
32
|
+
|
|
33
|
+
The spec lints clean *and* a reader who was not in the conversation could build from it. If you finished the steps but every section is one vague line, the skill ran and the spec still fails its job — `specdx lint` will now flag placeholder sections, so an empty pass means real content.
|
|
@@ -0,0 +1,57 @@
|
|
|
1
|
+
# Spec Type Reference
|
|
2
|
+
|
|
3
|
+
## Frontmatter Fields (all types)
|
|
4
|
+
|
|
5
|
+
| Field | Required | Type | Notes |
|
|
6
|
+
|-------|----------|------|-------|
|
|
7
|
+
| id | yes | string | Unique across spec suite |
|
|
8
|
+
| type | yes | SpecType | See types below |
|
|
9
|
+
| title | yes | string | Human-readable title |
|
|
10
|
+
| status | yes | "draft" \| "review" \| "approved" \| "superseded" | |
|
|
11
|
+
| version | yes | string | Semantic version |
|
|
12
|
+
| created | yes | string | ISO date, must be quoted in YAML |
|
|
13
|
+
| authors | yes | string[] | At least one entry |
|
|
14
|
+
| updated | no | string | ISO date |
|
|
15
|
+
| tags | no | string[] | Keywords for search/pack relevance |
|
|
16
|
+
| references | no | SpecReference[] | Cross-references to other specs |
|
|
17
|
+
|
|
18
|
+
### Extra Fields for `user-story` type
|
|
19
|
+
|
|
20
|
+
| Field | Required | Type | Notes |
|
|
21
|
+
|-------|----------|------|-------|
|
|
22
|
+
| story_id | yes | string | Unique story identifier |
|
|
23
|
+
| priority | yes | "critical" \| "high" \| "medium" \| "low" | |
|
|
24
|
+
| estimate | yes | string | Story point or time estimate |
|
|
25
|
+
|
|
26
|
+
## Required Sections by Type
|
|
27
|
+
|
|
28
|
+
| Type | Required Sections |
|
|
29
|
+
|------|-------------------|
|
|
30
|
+
| prd | Problem Statement, Goals, Non-Goals, Features, Success Criteria |
|
|
31
|
+
| technical-design | Overview, Architecture, Data Model, API Design, Dependencies, Risks, Open Questions |
|
|
32
|
+
| user-story | Description, Acceptance Criteria, Dependencies, Notes |
|
|
33
|
+
| test-plan | Scope, Test Cases, Coverage Matrix, Edge Cases |
|
|
34
|
+
| adr | Context, Decision, Status, Consequences |
|
|
35
|
+
| api-contract | Endpoints, Request/Response Schemas, Auth, Error Codes |
|
|
36
|
+
|
|
37
|
+
## References Format
|
|
38
|
+
|
|
39
|
+
The `references` frontmatter field is an array of `SpecReference` objects:
|
|
40
|
+
|
|
41
|
+
```yaml
|
|
42
|
+
references:
|
|
43
|
+
- id: "spec-id-here"
|
|
44
|
+
relationship: "depends-on"
|
|
45
|
+
- id: "another-spec-id"
|
|
46
|
+
relationship: "implemented-by"
|
|
47
|
+
```
|
|
48
|
+
|
|
49
|
+
### Relationship Values
|
|
50
|
+
|
|
51
|
+
| Value | Meaning |
|
|
52
|
+
|-------|---------|
|
|
53
|
+
| implemented-by | This spec is implemented by the referenced spec |
|
|
54
|
+
| decomposed-into | This spec breaks down into the referenced spec |
|
|
55
|
+
| depends-on | This spec depends on the referenced spec |
|
|
56
|
+
| supersedes | This spec replaces the referenced spec |
|
|
57
|
+
| related-to | General association with the referenced spec |
|
|
@@ -0,0 +1,66 @@
|
|
|
1
|
+
---
|
|
2
|
+
step: 1
|
|
3
|
+
name: Frontmatter
|
|
4
|
+
description: Determine spec type, check existing specs, create file with frontmatter
|
|
5
|
+
---
|
|
6
|
+
|
|
7
|
+
# Step 1: Frontmatter
|
|
8
|
+
|
|
9
|
+
## Determine the type
|
|
10
|
+
|
|
11
|
+
Ask what kind of spec they need:
|
|
12
|
+
|
|
13
|
+
| Type | Use when | Required sections |
|
|
14
|
+
|---|---|---|
|
|
15
|
+
| `prd` | Defining what to build | Problem Statement, Goals, Non-Goals, Features, Success Criteria |
|
|
16
|
+
| `technical-design` | Describing how it works | Overview, Architecture, Data Model, API Design, Dependencies, Risks, Open Questions |
|
|
17
|
+
| `user-story` | Capturing a user workflow | Description, Acceptance Criteria, Dependencies, Notes |
|
|
18
|
+
| `test-plan` | Planning test coverage | Scope, Test Cases, Coverage Matrix, Edge Cases |
|
|
19
|
+
| `adr` | Recording a decision | Context, Decision, Status, Consequences |
|
|
20
|
+
| `api-contract` | Defining an API | Endpoints, Request/Response Schemas, Auth, Error Codes |
|
|
21
|
+
|
|
22
|
+
For detailed guidance on each type, read `spec-type-reference.md` in this directory.
|
|
23
|
+
|
|
24
|
+
## Check existing specs
|
|
25
|
+
|
|
26
|
+
```bash
|
|
27
|
+
npx specdx validate
|
|
28
|
+
npx specdx graph
|
|
29
|
+
```
|
|
30
|
+
|
|
31
|
+
This shows what specs exist and their dependency relationships. Use this to determine where the new spec fits.
|
|
32
|
+
|
|
33
|
+
## Create the file with frontmatter
|
|
34
|
+
|
|
35
|
+
```yaml
|
|
36
|
+
---
|
|
37
|
+
id: "<type>-<short-name>"
|
|
38
|
+
type: "<spec-type>"
|
|
39
|
+
title: "<clear title>"
|
|
40
|
+
status: "draft"
|
|
41
|
+
version: "0.1"
|
|
42
|
+
created: "<YYYY-MM-DD>"
|
|
43
|
+
authors: ["<name>"]
|
|
44
|
+
tags: ["<keyword>", "<keyword>"]
|
|
45
|
+
references:
|
|
46
|
+
- id: "<other-spec-id>"
|
|
47
|
+
relationship: "depends-on"
|
|
48
|
+
---
|
|
49
|
+
```
|
|
50
|
+
|
|
51
|
+
Rules:
|
|
52
|
+
- **Always quote dates**: `"2026-03-18"` — unquoted YAML dates fail validation
|
|
53
|
+
- **authors must have at least one entry** — `authors: []` fails validation
|
|
54
|
+
- **id** must be unique across the spec suite
|
|
55
|
+
- **type** must be one of: `prd`, `technical-design`, `user-story`, `test-plan`, `adr`, `api-contract`
|
|
56
|
+
- **status** must be one of: `draft`, `review`, `approved`, `superseded`
|
|
57
|
+
- **references.relationship** must be one of: `implemented-by`, `decomposed-into`, `depends-on`, `supersedes`, `related-to`
|
|
58
|
+
|
|
59
|
+
Run an initial lint to verify frontmatter:
|
|
60
|
+
|
|
61
|
+
```bash
|
|
62
|
+
npx specdx lint --path <file>
|
|
63
|
+
```
|
|
64
|
+
|
|
65
|
+
---
|
|
66
|
+
**Next:** When frontmatter passes lint, read `step-02-sections.md` in this directory.
|
|
@@ -0,0 +1,111 @@
|
|
|
1
|
+
---
|
|
2
|
+
step: 2
|
|
3
|
+
name: Sections
|
|
4
|
+
description: Write sections one at a time, lint after every 2-3 sections
|
|
5
|
+
---
|
|
6
|
+
|
|
7
|
+
# Step 2: Write Sections
|
|
8
|
+
|
|
9
|
+
## Write sections one at a time
|
|
10
|
+
|
|
11
|
+
For each required section:
|
|
12
|
+
1. Explain what the section should contain
|
|
13
|
+
2. Ask the user for their thoughts
|
|
14
|
+
3. Draft the section
|
|
15
|
+
4. Refine based on feedback
|
|
16
|
+
|
|
17
|
+
### PRD tips
|
|
18
|
+
- Use **F1**, **F2** etc. for features — the `story-coverage` lint rule checks each has a user story
|
|
19
|
+
- Be specific in Non-Goals — this prevents scope creep
|
|
20
|
+
|
|
21
|
+
### Technical Design tips
|
|
22
|
+
- Include concrete field names and types in Data Model
|
|
23
|
+
- List specific risks with likelihood and mitigation
|
|
24
|
+
|
|
25
|
+
### ADR tips
|
|
26
|
+
- State the decision in one clear sentence, then elaborate
|
|
27
|
+
- List both positive AND negative consequences
|
|
28
|
+
|
|
29
|
+
### User Story tips
|
|
30
|
+
- Acceptance criteria should be testable
|
|
31
|
+
- Include the priority and estimate in frontmatter
|
|
32
|
+
|
|
33
|
+
### Test Plan tips
|
|
34
|
+
- Coverage matrix should map to features from the PRD
|
|
35
|
+
- Edge cases are often where bugs hide — be thorough
|
|
36
|
+
|
|
37
|
+
### API Contract tips
|
|
38
|
+
- Include both success and error response schemas
|
|
39
|
+
- Document auth requirements per endpoint
|
|
40
|
+
|
|
41
|
+
## Lint after every 2-3 sections
|
|
42
|
+
|
|
43
|
+
```bash
|
|
44
|
+
npx specdx lint --path <file>
|
|
45
|
+
```
|
|
46
|
+
|
|
47
|
+
Common issues:
|
|
48
|
+
|
|
49
|
+
| Issue | Fix |
|
|
50
|
+
|---|---|
|
|
51
|
+
| Vague language ("as appropriate", "etc.", "TBD") | Replace with concrete language |
|
|
52
|
+
| Missing required section | Add it, even if minimal |
|
|
53
|
+
| Broken reference | Check the referenced spec ID exists |
|
|
54
|
+
|
|
55
|
+
<HARD-GATE>
|
|
56
|
+
Do NOT skip the lint step between sections. Run `npx specdx lint --path <file>`
|
|
57
|
+
after every 2-3 sections. Do NOT write the entire spec and lint at the end.
|
|
58
|
+
</HARD-GATE>
|
|
59
|
+
|
|
60
|
+
## Sections `specdx check` parses
|
|
61
|
+
|
|
62
|
+
Three sections are read by `specdx check` and compared against code. Prose in
|
|
63
|
+
them is fine, but the entries themselves must take one of these shapes or the
|
|
64
|
+
section is reported as not assessed — which silently removes it from the
|
|
65
|
+
coverage score.
|
|
66
|
+
|
|
67
|
+
**`## Endpoints`** (api-contract) — a bullet per endpoint, a `###` heading per
|
|
68
|
+
endpoint, or both:
|
|
69
|
+
|
|
70
|
+
```markdown
|
|
71
|
+
- `GET /invoices` — list invoices
|
|
72
|
+
- POST /invoices — create an invoice
|
|
73
|
+
|
|
74
|
+
### DELETE /invoices/:id
|
|
75
|
+
|
|
76
|
+
Void an invoice.
|
|
77
|
+
```
|
|
78
|
+
|
|
79
|
+
**`## Data Model`** (technical-design) — a `###` heading per type, one field per
|
|
80
|
+
line as `- name: type`. Backticks are optional. The heading must be a single
|
|
81
|
+
identifier: `### Notes on the model` is read as prose, not as a type.
|
|
82
|
+
|
|
83
|
+
```markdown
|
|
84
|
+
### Invoice
|
|
85
|
+
|
|
86
|
+
- id: string
|
|
87
|
+
- `amountCents`: number
|
|
88
|
+
- paidAt?: Date
|
|
89
|
+
```
|
|
90
|
+
|
|
91
|
+
**`## Test Cases`** (test-plan) — one bullet per case, optionally grouped under
|
|
92
|
+
`###` headings:
|
|
93
|
+
|
|
94
|
+
```markdown
|
|
95
|
+
### Invoices
|
|
96
|
+
|
|
97
|
+
- creates an invoice with a valid payload
|
|
98
|
+
- rejects an invoice with a negative amount
|
|
99
|
+
```
|
|
100
|
+
|
|
101
|
+
## Rationalizations to Resist
|
|
102
|
+
|
|
103
|
+
| Thought | Reality |
|
|
104
|
+
|---------|---------|
|
|
105
|
+
| "I'll lint at the end, it's faster" | Lint catches issues early. Fixing 1 issue now beats fixing 10 later. |
|
|
106
|
+
| "This section is simple, no need to lint" | Simple sections have frontmatter and reference issues too. |
|
|
107
|
+
| "The user seems in a hurry" | Shipping a broken spec wastes more time than linting. |
|
|
108
|
+
| "I already know the lint rules" | Rules evolve. Run the tool. |
|
|
109
|
+
|
|
110
|
+
---
|
|
111
|
+
**Next:** When all sections are written and linting clean, read `step-03-finalize.md` in this directory.
|