specdx 0.4.0-alpha.18 → 0.4.0-alpha.19
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 +1 -1
- package/README.md +42 -0
- package/dist/{check-PQQGR4KP.js → check-PRQNMBOE.js} +5 -5
- package/dist/{chunk-RI2SFGMR.js → chunk-5MYELBKF.js} +44 -17
- package/dist/chunk-5MYELBKF.js.map +1 -0
- package/dist/{chunk-FX4NRQHE.js → chunk-BD6UDHYW.js} +58 -10
- package/dist/chunk-BD6UDHYW.js.map +1 -0
- package/dist/{chunk-33FELECG.js → chunk-ERRUYMZO.js} +21 -18
- package/dist/chunk-ERRUYMZO.js.map +1 -0
- package/dist/{chunk-Z77VQUZ3.js → chunk-MM325DR6.js} +2 -2
- package/dist/chunk-RDNEANZB.js +103 -0
- package/dist/chunk-RDNEANZB.js.map +1 -0
- package/dist/{chunk-AXCGMUU7.js → chunk-RY5CDUNN.js} +2 -2
- package/dist/{chunk-TF7WSPFV.js → chunk-T232GZ2L.js} +2 -2
- package/dist/{chunk-SJCIM4TC.js → chunk-ZIPGRLYE.js} +3 -1
- package/dist/chunk-ZIPGRLYE.js.map +1 -0
- package/dist/{diff-IOBAJMKU.js → diff-PHEX3HUT.js} +4 -4
- package/dist/{dist-HRY2V5MO.js → dist-M7X5RJB3.js} +12 -10
- package/dist/dist-M7X5RJB3.js.map +1 -0
- package/dist/{dist-WXT4UJ55.js → dist-X4CSVKKR.js} +2 -2
- package/dist/{generate-NSTYQOAV.js → generate-FIMBI2NW.js} +5 -5
- package/dist/{generate-story-RFAPULQY.js → generate-story-5TPTJA7B.js} +13 -15
- package/dist/generate-story-5TPTJA7B.js.map +1 -0
- package/dist/{generate-test-plan-M22PCW73.js → generate-test-plan-XBAFJKJI.js} +51 -12
- package/dist/generate-test-plan-XBAFJKJI.js.map +1 -0
- package/dist/{graph-OKUMHR3Q.js → graph-UZJMLX4J.js} +3 -3
- package/dist/index.d.ts +171 -0
- package/dist/index.js +72 -22
- package/dist/index.js.map +1 -1
- package/dist/{lint-ADR7L6AP.js → lint-PUAQ2UL6.js} +4 -4
- package/dist/main.js +5 -103
- package/dist/main.js.map +1 -1
- package/dist/{mcp-A6CCWSS2.js → mcp-WTO5PDIS.js} +6 -3
- package/dist/mcp-WTO5PDIS.js.map +1 -0
- package/dist/{migrate-LAMRDT3V.js → migrate-DEFCNOAH.js} +18 -7
- package/dist/migrate-DEFCNOAH.js.map +1 -0
- package/dist/{pack-B3KYRKUR.js → pack-PNLD5AYW.js} +4 -4
- package/dist/{ready-GH4YKVOX.js → ready-XIO2IPRE.js} +5 -5
- package/dist/skills/core/specdx-author-spec/SKILL.md +1 -1
- package/dist/skills/core/specdx-author-spec/references/step-02-sections.md +41 -0
- package/dist/skills/core/specdx-router/SKILL.md +2 -2
- package/dist/skills/experimental/specdx-check-drift/SKILL.md +1 -1
- package/dist/skills/experimental/specdx-verify/SKILL.md +1 -1
- package/dist/{status-PQKPTDP5.js → status-BXOYBOH6.js} +5 -5
- package/dist/{update-VAC6XV5E.js → update-ELXABLVS.js} +4 -4
- package/dist/{validate-WIB246IE.js → validate-FXD5WS4C.js} +3 -3
- package/hooks/session-start +35 -3
- package/package.json +5 -5
- package/dist/chunk-33FELECG.js.map +0 -1
- package/dist/chunk-FX4NRQHE.js.map +0 -1
- package/dist/chunk-RI2SFGMR.js.map +0 -1
- package/dist/chunk-SJCIM4TC.js.map +0 -1
- package/dist/dist-HRY2V5MO.js.map +0 -1
- package/dist/generate-story-RFAPULQY.js.map +0 -1
- package/dist/generate-test-plan-M22PCW73.js.map +0 -1
- package/dist/mcp-A6CCWSS2.js.map +0 -1
- package/dist/migrate-LAMRDT3V.js.map +0 -1
- /package/dist/{check-PQQGR4KP.js.map → check-PRQNMBOE.js.map} +0 -0
- /package/dist/{chunk-Z77VQUZ3.js.map → chunk-MM325DR6.js.map} +0 -0
- /package/dist/{chunk-AXCGMUU7.js.map → chunk-RY5CDUNN.js.map} +0 -0
- /package/dist/{chunk-TF7WSPFV.js.map → chunk-T232GZ2L.js.map} +0 -0
- /package/dist/{diff-IOBAJMKU.js.map → diff-PHEX3HUT.js.map} +0 -0
- /package/dist/{dist-WXT4UJ55.js.map → dist-X4CSVKKR.js.map} +0 -0
- /package/dist/{generate-NSTYQOAV.js.map → generate-FIMBI2NW.js.map} +0 -0
- /package/dist/{graph-OKUMHR3Q.js.map → graph-UZJMLX4J.js.map} +0 -0
- /package/dist/{lint-ADR7L6AP.js.map → lint-PUAQ2UL6.js.map} +0 -0
- /package/dist/{pack-B3KYRKUR.js.map → pack-PNLD5AYW.js.map} +0 -0
- /package/dist/{ready-GH4YKVOX.js.map → ready-XIO2IPRE.js.map} +0 -0
- /package/dist/{status-PQKPTDP5.js.map → status-BXOYBOH6.js.map} +0 -0
- /package/dist/{update-VAC6XV5E.js.map → update-ELXABLVS.js.map} +0 -0
- /package/dist/{validate-WIB246IE.js.map → validate-FXD5WS4C.js.map} +0 -0
package/dist/index.js
CHANGED
|
@@ -1545,7 +1545,7 @@ var require_picomatch2 = __commonJS({
|
|
|
1545
1545
|
// src/commands/core/init.ts
|
|
1546
1546
|
import { defineCommand } from "citty";
|
|
1547
1547
|
import { mkdir, writeFile } from "fs/promises";
|
|
1548
|
-
import { join } from "path";
|
|
1548
|
+
import { join, basename, resolve } from "path";
|
|
1549
1549
|
|
|
1550
1550
|
// ../schema/dist/types.js
|
|
1551
1551
|
var SPEC_TYPES = [
|
|
@@ -2059,6 +2059,9 @@ async function scaffoldProject({
|
|
|
2059
2059
|
const configContent = buildConfigYaml(projectName, specs);
|
|
2060
2060
|
await writeFile(join(targetDir, "spec.config.yaml"), configContent, "utf-8");
|
|
2061
2061
|
}
|
|
2062
|
+
function defaultProjectName(dir) {
|
|
2063
|
+
return basename(resolve(dir)) || "my-project";
|
|
2064
|
+
}
|
|
2062
2065
|
var init_default = defineCommand({
|
|
2063
2066
|
meta: {
|
|
2064
2067
|
name: "init",
|
|
@@ -2067,8 +2070,7 @@ var init_default = defineCommand({
|
|
|
2067
2070
|
args: {
|
|
2068
2071
|
name: {
|
|
2069
2072
|
type: "string",
|
|
2070
|
-
description: "Project name"
|
|
2071
|
-
required: true
|
|
2073
|
+
description: "Project name (default: the target directory's name)"
|
|
2072
2074
|
},
|
|
2073
2075
|
template: {
|
|
2074
2076
|
type: "string",
|
|
@@ -2082,12 +2084,13 @@ var init_default = defineCommand({
|
|
|
2082
2084
|
}
|
|
2083
2085
|
},
|
|
2084
2086
|
async run({ args }) {
|
|
2085
|
-
const {
|
|
2087
|
+
const { template, dir } = args;
|
|
2086
2088
|
const validTemplates = ["lightweight", "bmad", "api-first", "quick", "context"];
|
|
2087
2089
|
if (!validTemplates.includes(template)) {
|
|
2088
2090
|
console.error(`Unknown template: ${template}. Choose from: ${validTemplates.join(", ")}`);
|
|
2089
2091
|
process.exit(1);
|
|
2090
2092
|
}
|
|
2093
|
+
const name = args.name || defaultProjectName(dir);
|
|
2091
2094
|
console.log(`Scaffolding "${name}" with template "${template}" in ${dir}...`);
|
|
2092
2095
|
await scaffoldProject({ projectName: name, template, targetDir: dir });
|
|
2093
2096
|
console.log(`Done! Project "${name}" scaffolded successfully.`);
|
|
@@ -2484,7 +2487,7 @@ function createLogger(options) {
|
|
|
2484
2487
|
|
|
2485
2488
|
// ../core/dist/preset.js
|
|
2486
2489
|
import { readFile as readFile3 } from "fs/promises";
|
|
2487
|
-
import { resolve, isAbsolute as isAbsolute2 } from "path";
|
|
2490
|
+
import { resolve as resolve2, isAbsolute as isAbsolute2 } from "path";
|
|
2488
2491
|
|
|
2489
2492
|
// ../lint/dist/engine.js
|
|
2490
2493
|
function createLintEngine(options) {
|
|
@@ -2651,10 +2654,13 @@ function extractFeatureSection(content) {
|
|
|
2651
2654
|
return body.join("\n");
|
|
2652
2655
|
}
|
|
2653
2656
|
function parseFeatures(content) {
|
|
2657
|
+
return parseFeatureEntries(content).map((f) => f.text);
|
|
2658
|
+
}
|
|
2659
|
+
function parseFeatureEntries(content) {
|
|
2654
2660
|
const section = extractFeatureSection(content);
|
|
2655
2661
|
if (section === null)
|
|
2656
2662
|
return [];
|
|
2657
|
-
const ID_PREFIX = /^\*{0,2}F\d
|
|
2663
|
+
const ID_PREFIX = /^\*{0,2}F(\d+)\*{0,2}\s*[:.-]\s*/i;
|
|
2658
2664
|
const features = [];
|
|
2659
2665
|
for (const rawLine of section.split("\n")) {
|
|
2660
2666
|
const line = rawLine.trim();
|
|
@@ -2664,9 +2670,10 @@ function parseFeatures(content) {
|
|
|
2664
2670
|
const text = bullet ? (bullet[1] ?? "").trim() : ID_PREFIX.test(line) ? line : "";
|
|
2665
2671
|
if (!text)
|
|
2666
2672
|
continue;
|
|
2673
|
+
const idMatch = ID_PREFIX.exec(text);
|
|
2667
2674
|
const stripped = text.replace(ID_PREFIX, "").trim();
|
|
2668
2675
|
if (stripped)
|
|
2669
|
-
features.push(stripped);
|
|
2676
|
+
features.push({ text: stripped, num: idMatch?.[1] });
|
|
2670
2677
|
}
|
|
2671
2678
|
return features;
|
|
2672
2679
|
}
|
|
@@ -2908,8 +2915,6 @@ var EDGE_CASE_KEYWORDS = [
|
|
|
2908
2915
|
"reject",
|
|
2909
2916
|
"unauthorized",
|
|
2910
2917
|
"forbidden",
|
|
2911
|
-
"404",
|
|
2912
|
-
"500",
|
|
2913
2918
|
"missing",
|
|
2914
2919
|
"malformed",
|
|
2915
2920
|
"overflow",
|
|
@@ -2919,8 +2924,18 @@ var EDGE_CASE_KEYWORDS = [
|
|
|
2919
2924
|
"fallback",
|
|
2920
2925
|
"crash",
|
|
2921
2926
|
"nonexistent",
|
|
2922
|
-
"corrupt"
|
|
2927
|
+
"corrupt",
|
|
2928
|
+
// Vocabulary that names a failure without using any of the words above.
|
|
2929
|
+
"conflict",
|
|
2930
|
+
"denied",
|
|
2931
|
+
"expired",
|
|
2932
|
+
"not found",
|
|
2933
|
+
"retry",
|
|
2934
|
+
"rate limit",
|
|
2935
|
+
"unavailable",
|
|
2936
|
+
"unprocessable"
|
|
2923
2937
|
];
|
|
2938
|
+
var ERROR_STATUS_CODE = /\b[45]\d{2}\b/;
|
|
2924
2939
|
var edgeCaseCoverageRule = {
|
|
2925
2940
|
id: "completeness/edge-case-coverage",
|
|
2926
2941
|
description: "Flag user stories or test plans that don't mention error states or edge cases",
|
|
@@ -2930,7 +2945,7 @@ var edgeCaseCoverageRule = {
|
|
|
2930
2945
|
if (type !== "user-story" && type !== "test-plan")
|
|
2931
2946
|
return [];
|
|
2932
2947
|
const content = context.spec.content.toLowerCase();
|
|
2933
|
-
const hasEdgeCases = EDGE_CASE_KEYWORDS.some((kw) => content.includes(kw));
|
|
2948
|
+
const hasEdgeCases = EDGE_CASE_KEYWORDS.some((kw) => content.includes(kw)) || ERROR_STATUS_CODE.test(content);
|
|
2934
2949
|
if (hasEdgeCases)
|
|
2935
2950
|
return [];
|
|
2936
2951
|
return [
|
|
@@ -3091,13 +3106,48 @@ var noPlaceholderSectionsRule = {
|
|
|
3091
3106
|
}
|
|
3092
3107
|
};
|
|
3093
3108
|
|
|
3109
|
+
// ../lint/dist/rules/id-matches-config-key.js
|
|
3110
|
+
import { basename as basename2 } from "path";
|
|
3111
|
+
var idMatchesConfigKeyRule = {
|
|
3112
|
+
id: "structure/id-matches-config-key",
|
|
3113
|
+
description: "A spec's frontmatter id should match the key it is registered under in the config",
|
|
3114
|
+
severity: "warn",
|
|
3115
|
+
run(context) {
|
|
3116
|
+
const { spec, config } = context;
|
|
3117
|
+
if (!config)
|
|
3118
|
+
return [];
|
|
3119
|
+
const id = spec.frontmatter.id;
|
|
3120
|
+
if (typeof id !== "string" || id.length === 0)
|
|
3121
|
+
return [];
|
|
3122
|
+
const specFile = basename2(spec.filePath);
|
|
3123
|
+
const candidates = Object.entries(config.specs).filter(([, entry]) => {
|
|
3124
|
+
const target = basename2(entry.path);
|
|
3125
|
+
return !target.includes("*") && target === specFile;
|
|
3126
|
+
});
|
|
3127
|
+
if (candidates.length !== 1)
|
|
3128
|
+
return [];
|
|
3129
|
+
const key = candidates[0][0];
|
|
3130
|
+
if (key === id)
|
|
3131
|
+
return [];
|
|
3132
|
+
return [
|
|
3133
|
+
{
|
|
3134
|
+
ruleId: "structure/id-matches-config-key",
|
|
3135
|
+
severity: "warn",
|
|
3136
|
+
message: `Spec declares id "${id}" but is registered in spec.config.yaml as "${key}". Frontmatter references resolve against "${id}" and config requires against "${key}", so the dependency graph shows them as two things. Rename one so they agree.`,
|
|
3137
|
+
filePath: spec.filePath
|
|
3138
|
+
}
|
|
3139
|
+
];
|
|
3140
|
+
}
|
|
3141
|
+
};
|
|
3142
|
+
|
|
3094
3143
|
// ../lint/dist/rules/index.js
|
|
3095
3144
|
var structureRules = [
|
|
3096
3145
|
validFrontmatterRule,
|
|
3097
3146
|
requiredSectionsRule,
|
|
3098
3147
|
validReferencesRule,
|
|
3099
3148
|
noCircularDepsRule,
|
|
3100
|
-
singleProjectContextRule
|
|
3149
|
+
singleProjectContextRule,
|
|
3150
|
+
idMatchesConfigKeyRule
|
|
3101
3151
|
];
|
|
3102
3152
|
var contentRules = [
|
|
3103
3153
|
storyCoverageRule,
|
|
@@ -5099,7 +5149,7 @@ function checkCrossReferences(allSpecs, removedIds) {
|
|
|
5099
5149
|
var import_picomatch = __toESM(require_picomatch2(), 1);
|
|
5100
5150
|
import { execSync as execSync2 } from "child_process";
|
|
5101
5151
|
import { readFileSync, realpathSync } from "fs";
|
|
5102
|
-
import { dirname as dirname2, relative, resolve as
|
|
5152
|
+
import { dirname as dirname2, relative, resolve as resolve3, sep } from "path";
|
|
5103
5153
|
function getRepoRoot(cwd) {
|
|
5104
5154
|
let root;
|
|
5105
5155
|
try {
|
|
@@ -5121,7 +5171,7 @@ function validateRef(ref, cwd) {
|
|
|
5121
5171
|
}
|
|
5122
5172
|
}
|
|
5123
5173
|
function gitShow(ref, filePath, projectRoot, repoRoot) {
|
|
5124
|
-
const relPath = relative(repoRoot,
|
|
5174
|
+
const relPath = relative(repoRoot, resolve3(projectRoot, filePath));
|
|
5125
5175
|
try {
|
|
5126
5176
|
return execSync2(`git show ${ref}:${relPath}`, {
|
|
5127
5177
|
cwd: repoRoot,
|
|
@@ -5138,7 +5188,7 @@ function toPosix(p) {
|
|
|
5138
5188
|
function buildEntryMatchers(specPathsByKey, projectRoot, repoRoot) {
|
|
5139
5189
|
return [...specPathsByKey].map(([key, specPath]) => ({
|
|
5140
5190
|
key,
|
|
5141
|
-
isMatch: (0, import_picomatch.default)(toPosix(relative(repoRoot,
|
|
5191
|
+
isMatch: (0, import_picomatch.default)(toPosix(relative(repoRoot, resolve3(projectRoot, specPath))))
|
|
5142
5192
|
}));
|
|
5143
5193
|
}
|
|
5144
5194
|
function getChangedSpecFiles(baseRef, headRef, matchers, projectRoot, repoRoot) {
|
|
@@ -5165,7 +5215,7 @@ function getChangedSpecFiles(baseRef, headRef, matchers, projectRoot, repoRoot)
|
|
|
5165
5215
|
if (!entry)
|
|
5166
5216
|
continue;
|
|
5167
5217
|
const changed = {
|
|
5168
|
-
path: relative(projectRoot,
|
|
5218
|
+
path: relative(projectRoot, resolve3(repoRoot, filePath)),
|
|
5169
5219
|
entryKey: entry.key
|
|
5170
5220
|
};
|
|
5171
5221
|
if (status === "M") {
|
|
@@ -5196,7 +5246,7 @@ function listSpecFilesAtRef(ref, matchers, projectRoot, repoRoot) {
|
|
|
5196
5246
|
const entry = matchers.find((m) => m.isMatch(filePath));
|
|
5197
5247
|
if (!entry)
|
|
5198
5248
|
continue;
|
|
5199
|
-
byEntry.get(entry.key)?.push(relative(projectRoot,
|
|
5249
|
+
byEntry.get(entry.key)?.push(relative(projectRoot, resolve3(repoRoot, filePath)));
|
|
5200
5250
|
}
|
|
5201
5251
|
return byEntry;
|
|
5202
5252
|
}
|
|
@@ -5218,7 +5268,7 @@ function listSpecFilesInWorktree(matchers, projectRoot, repoRoot) {
|
|
|
5218
5268
|
const entry = matchers.find((m) => m.isMatch(filePath));
|
|
5219
5269
|
if (!entry)
|
|
5220
5270
|
continue;
|
|
5221
|
-
byEntry.get(entry.key)?.push(relative(projectRoot,
|
|
5271
|
+
byEntry.get(entry.key)?.push(relative(projectRoot, resolve3(repoRoot, filePath)));
|
|
5222
5272
|
}
|
|
5223
5273
|
return byEntry;
|
|
5224
5274
|
}
|
|
@@ -5232,7 +5282,7 @@ function worktreeSide(matchers, projectRoot, repoRoot) {
|
|
|
5232
5282
|
return {
|
|
5233
5283
|
read: (path) => {
|
|
5234
5284
|
try {
|
|
5235
|
-
return readFileSync(
|
|
5285
|
+
return readFileSync(resolve3(projectRoot, path), "utf-8");
|
|
5236
5286
|
} catch {
|
|
5237
5287
|
throw new DiffError(`Cannot read "${path}" in the working tree`);
|
|
5238
5288
|
}
|
|
@@ -5261,7 +5311,7 @@ function getChangedSpecFilesInWorktree(baseRef, matchers, projectRoot, repoRoot)
|
|
|
5261
5311
|
return;
|
|
5262
5312
|
seen.add(filePath);
|
|
5263
5313
|
const changed = {
|
|
5264
|
-
path: relative(projectRoot,
|
|
5314
|
+
path: relative(projectRoot, resolve3(repoRoot, filePath)),
|
|
5265
5315
|
entryKey: entry.key
|
|
5266
5316
|
};
|
|
5267
5317
|
if (status === "M")
|
|
@@ -5318,7 +5368,7 @@ function listUncommittedSpecFiles(matchers, projectRoot, repoRoot) {
|
|
|
5318
5368
|
const filePath = (renamed ?? rawPath).replace(/^"|"$/g, "");
|
|
5319
5369
|
if (!matchers.some((m) => m.isMatch(filePath)))
|
|
5320
5370
|
continue;
|
|
5321
|
-
files.push(relative(projectRoot,
|
|
5371
|
+
files.push(relative(projectRoot, resolve3(repoRoot, filePath)));
|
|
5322
5372
|
}
|
|
5323
5373
|
return files;
|
|
5324
5374
|
}
|
|
@@ -5335,7 +5385,7 @@ async function specIdsFrom(files, read) {
|
|
|
5335
5385
|
return ids;
|
|
5336
5386
|
}
|
|
5337
5387
|
async function diffBetweenRefs(configPath, baseRef, headRef, options = {}) {
|
|
5338
|
-
const projectRoot = realpathSync(dirname2(
|
|
5388
|
+
const projectRoot = realpathSync(dirname2(resolve3(configPath)));
|
|
5339
5389
|
const repoRoot = getRepoRoot(projectRoot);
|
|
5340
5390
|
validateRef(baseRef, projectRoot);
|
|
5341
5391
|
if (!options.working)
|