specweave 0.28.17 → 0.28.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/dist/plugins/specweave-ado/lib/ado-board-resolver.d.ts +94 -0
- package/dist/plugins/specweave-ado/lib/ado-board-resolver.d.ts.map +1 -0
- package/dist/plugins/specweave-ado/lib/ado-board-resolver.js +219 -0
- package/dist/plugins/specweave-ado/lib/ado-board-resolver.js.map +1 -0
- package/dist/plugins/specweave-github/lib/github-feature-sync.d.ts +6 -11
- package/dist/plugins/specweave-github/lib/github-feature-sync.d.ts.map +1 -1
- package/dist/plugins/specweave-github/lib/github-feature-sync.js +6 -11
- package/dist/plugins/specweave-github/lib/github-feature-sync.js.map +1 -1
- package/dist/plugins/specweave-github/lib/github-increment-sync-cli.d.ts +19 -0
- package/dist/plugins/specweave-github/lib/github-increment-sync-cli.d.ts.map +1 -0
- package/dist/plugins/specweave-github/lib/github-increment-sync-cli.js +380 -0
- package/dist/plugins/specweave-github/lib/github-increment-sync-cli.js.map +1 -0
- package/dist/plugins/specweave-github/lib/increment-issue-builder.d.ts +92 -0
- package/dist/plugins/specweave-github/lib/increment-issue-builder.d.ts.map +1 -0
- package/dist/plugins/specweave-github/lib/increment-issue-builder.js +349 -0
- package/dist/plugins/specweave-github/lib/increment-issue-builder.js.map +1 -0
- package/dist/plugins/specweave-jira/lib/jira-board-resolver.d.ts +50 -0
- package/dist/plugins/specweave-jira/lib/jira-board-resolver.d.ts.map +1 -0
- package/dist/plugins/specweave-jira/lib/jira-board-resolver.js +84 -0
- package/dist/plugins/specweave-jira/lib/jira-board-resolver.js.map +1 -0
- package/dist/src/cli/commands/import-external.d.ts.map +1 -1
- package/dist/src/cli/commands/import-external.js +12 -7
- package/dist/src/cli/commands/import-external.js.map +1 -1
- package/dist/src/cli/helpers/init/external-import.d.ts.map +1 -1
- package/dist/src/cli/helpers/init/external-import.js +122 -17
- package/dist/src/cli/helpers/init/external-import.js.map +1 -1
- package/dist/src/cli/helpers/issue-tracker/ado-area-selection.d.ts +65 -0
- package/dist/src/cli/helpers/issue-tracker/ado-area-selection.d.ts.map +1 -0
- package/dist/src/cli/helpers/issue-tracker/ado-area-selection.js +278 -0
- package/dist/src/cli/helpers/issue-tracker/ado-area-selection.js.map +1 -0
- package/dist/src/cli/helpers/issue-tracker/jira-board-selection.d.ts +64 -0
- package/dist/src/cli/helpers/issue-tracker/jira-board-selection.d.ts.map +1 -0
- package/dist/src/cli/helpers/issue-tracker/jira-board-selection.js +251 -0
- package/dist/src/cli/helpers/issue-tracker/jira-board-selection.js.map +1 -0
- package/dist/src/core/ac-test-validator-cli.js +4 -1
- package/dist/src/core/ac-test-validator-cli.js.map +1 -1
- package/dist/src/core/ac-test-validator.d.ts.map +1 -1
- package/dist/src/core/ac-test-validator.js +4 -1
- package/dist/src/core/ac-test-validator.js.map +1 -1
- package/dist/src/core/types/increment-metadata.d.ts +75 -0
- package/dist/src/core/types/increment-metadata.d.ts.map +1 -1
- package/dist/src/core/types/sync-profile.d.ts +137 -5
- package/dist/src/core/types/sync-profile.d.ts.map +1 -1
- package/dist/src/core/types/sync-profile.js +63 -0
- package/dist/src/core/types/sync-profile.js.map +1 -1
- package/dist/src/importers/external-importer.d.ts +25 -0
- package/dist/src/importers/external-importer.d.ts.map +1 -1
- package/dist/src/importers/github-importer.d.ts.map +1 -1
- package/dist/src/importers/github-importer.js +5 -3
- package/dist/src/importers/github-importer.js.map +1 -1
- package/dist/src/importers/item-converter.d.ts +51 -0
- package/dist/src/importers/item-converter.d.ts.map +1 -1
- package/dist/src/importers/item-converter.js +39 -12
- package/dist/src/importers/item-converter.js.map +1 -1
- package/dist/src/init/repo/types.d.ts +1 -1
- package/dist/src/living-docs/fs-id-allocator.d.ts +72 -3
- package/dist/src/living-docs/fs-id-allocator.d.ts.map +1 -1
- package/dist/src/living-docs/fs-id-allocator.js +142 -16
- package/dist/src/living-docs/fs-id-allocator.js.map +1 -1
- package/dist/src/locales/de/cli.json +14 -0
- package/dist/src/locales/es/cli.json +14 -0
- package/dist/src/locales/fr/cli.json +14 -0
- package/dist/src/locales/ja/cli.json +14 -0
- package/dist/src/locales/ko/cli.json +14 -0
- package/dist/src/locales/pt/cli.json +14 -0
- package/dist/src/locales/ru/cli.json +14 -0
- package/dist/src/locales/zh/cli.json +14 -0
- package/dist/src/utils/chalk-fallback.d.ts +38 -0
- package/dist/src/utils/chalk-fallback.d.ts.map +1 -0
- package/dist/src/utils/chalk-fallback.js +118 -0
- package/dist/src/utils/chalk-fallback.js.map +1 -0
- package/dist/src/utils/project-id-generator.d.ts +127 -0
- package/dist/src/utils/project-id-generator.d.ts.map +1 -0
- package/dist/src/utils/project-id-generator.js +228 -0
- package/dist/src/utils/project-id-generator.js.map +1 -0
- package/package.json +1 -1
- package/plugins/specweave/agents/pm/AGENT.md +202 -0
- package/plugins/specweave/commands/specweave-import-external.md +5 -3
- package/plugins/specweave/commands/specweave-sync-docs.md +6 -2
- package/plugins/specweave/hooks/pre-task-completion.sh +35 -17
- package/plugins/specweave/lib/vendor/core/ac-test-validator-cli.d.ts +16 -0
- package/plugins/specweave/lib/vendor/core/ac-test-validator-cli.js +121 -0
- package/plugins/specweave/lib/vendor/core/ac-test-validator-cli.js.map +1 -0
- package/plugins/specweave/lib/vendor/core/ac-test-validator.d.ts +111 -0
- package/plugins/specweave/lib/vendor/core/ac-test-validator.js +295 -0
- package/plugins/specweave/lib/vendor/core/ac-test-validator.js.map +1 -0
- package/plugins/specweave/lib/vendor/core/types/increment-metadata.d.ts +75 -0
- package/plugins/specweave/lib/vendor/utils/chalk-fallback.d.ts +38 -0
- package/plugins/specweave/lib/vendor/utils/chalk-fallback.js +118 -0
- package/plugins/specweave/lib/vendor/utils/chalk-fallback.js.map +1 -0
- package/plugins/specweave/lib/vendor/utils/fs-native.d.ts +179 -0
- package/plugins/specweave/lib/vendor/utils/fs-native.js +319 -0
- package/plugins/specweave/lib/vendor/utils/fs-native.js.map +1 -0
- package/plugins/specweave/skills/code-reviewer/SKILL.md +1 -1
- package/plugins/specweave/skills/docs-updater/SKILL.md +61 -0
- package/plugins/specweave/skills/increment-planner/SKILL.md +10 -335
- package/plugins/specweave/skills/increment-planner/templates/metadata.json +13 -0
- package/plugins/specweave/skills/increment-planner/templates/plan.md +50 -0
- package/plugins/specweave/skills/increment-planner/templates/spec-multi-project.md +86 -0
- package/plugins/specweave/skills/increment-planner/templates/spec-single-project.md +50 -0
- package/plugins/specweave/skills/increment-planner/templates/tasks-multi-project.md +86 -0
- package/plugins/specweave/skills/increment-planner/templates/tasks-single-project.md +48 -0
- package/plugins/specweave-ado/commands/specweave-ado-import-areas.md +358 -0
- package/plugins/specweave-alternatives/skills/architecture-alternatives/SKILL.md +1 -0
- package/plugins/specweave-alternatives/skills/bmad-method/SKILL.md +1 -0
- package/plugins/specweave-core/skills/code-quality/SKILL.md +1 -0
- package/plugins/specweave-core/skills/design-patterns/SKILL.md +1 -0
- package/plugins/specweave-core/skills/software-architecture/SKILL.md +1 -0
- package/plugins/specweave-github/commands/specweave-github-cleanup-duplicates.md +14 -10
- package/plugins/specweave-github/commands/specweave-github-sync.md +57 -0
- package/plugins/specweave-github/hooks/.specweave/logs/hooks-debug.log +68 -0
- package/plugins/specweave-github/lib/github-feature-sync.ts +6 -11
- package/plugins/specweave-github/lib/github-increment-sync-cli.js +343 -0
- package/plugins/specweave-github/lib/github-increment-sync-cli.ts +484 -0
- package/plugins/specweave-github/lib/increment-issue-builder.js +368 -0
- package/plugins/specweave-github/lib/increment-issue-builder.ts +471 -0
- package/plugins/specweave-github/skills/github-issue-standard/SKILL.md +19 -24
- package/plugins/specweave-infrastructure/agents/observability-engineer/AGENT.md +15 -23
- package/plugins/specweave-jira/commands/specweave-jira-import-boards.md +331 -0
- package/plugins/specweave-ml/agents/data-scientist/AGENT.md +16 -20
- package/plugins/specweave-ml/agents/ml-engineer/AGENT.md +18 -19
- package/plugins/specweave-ml/skills/{ml-pipeline-workflow → mlops-dag-builder}/SKILL.md +18 -14
- package/plugins/specweave-release/hooks/.specweave/logs/dora-tracking.log +102 -0
- package/plugins/specweave-ui/skills/browser-automation/SKILL.md +1 -1
- package/plugins/specweave-ui/skills/ui-testing/SKILL.md +10 -122
- package/dist/plugins/specweave-github/lib/epic-content-builder.d.ts +0 -70
- package/dist/plugins/specweave-github/lib/epic-content-builder.d.ts.map +0 -1
- package/dist/plugins/specweave-github/lib/epic-content-builder.js +0 -258
- package/dist/plugins/specweave-github/lib/epic-content-builder.js.map +0 -1
- package/dist/plugins/specweave-github/lib/github-epic-sync.d.ts +0 -83
- package/dist/plugins/specweave-github/lib/github-epic-sync.d.ts.map +0 -1
- package/dist/plugins/specweave-github/lib/github-epic-sync.js +0 -466
- package/dist/plugins/specweave-github/lib/github-epic-sync.js.map +0 -1
- package/plugins/specweave-github/lib/epic-content-builder.js +0 -265
- package/plugins/specweave-github/lib/epic-content-builder.ts +0 -376
- package/plugins/specweave-github/lib/github-epic-sync.js +0 -488
- package/plugins/specweave-github/lib/github-epic-sync.ts +0 -715
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Chalk Fallback Utility
|
|
3
|
+
*
|
|
4
|
+
* Provides chalk-like API for colored console output with graceful fallback
|
|
5
|
+
* to plain text when chalk is not available (e.g., in marketplace plugins).
|
|
6
|
+
*
|
|
7
|
+
* This enables AC test validator to work in both:
|
|
8
|
+
* 1. Full npm-installed environments (uses real chalk)
|
|
9
|
+
* 2. Marketplace plugin environments (uses ANSI codes or plain text)
|
|
10
|
+
*/
|
|
11
|
+
type ChalkInput = string | number;
|
|
12
|
+
interface ChalkFn {
|
|
13
|
+
(text: ChalkInput): string;
|
|
14
|
+
bold: ChalkFn;
|
|
15
|
+
}
|
|
16
|
+
interface ChalkInstance {
|
|
17
|
+
red: ChalkFn;
|
|
18
|
+
green: ChalkFn;
|
|
19
|
+
yellow: ChalkFn;
|
|
20
|
+
blue: ChalkFn;
|
|
21
|
+
gray: ChalkFn;
|
|
22
|
+
bold: ChalkFn & {
|
|
23
|
+
(text: string): string;
|
|
24
|
+
};
|
|
25
|
+
}
|
|
26
|
+
/**
|
|
27
|
+
* Chalk-compatible API using ANSI codes
|
|
28
|
+
* Falls back to plain text if terminal doesn't support colors
|
|
29
|
+
*/
|
|
30
|
+
export declare const chalkFallback: ChalkInstance;
|
|
31
|
+
export declare function getChalk(): Promise<ChalkInstance>;
|
|
32
|
+
/**
|
|
33
|
+
* Synchronous chalk getter - uses fallback if chalk wasn't pre-loaded
|
|
34
|
+
* Call getChalk() at module init to try loading real chalk first
|
|
35
|
+
*/
|
|
36
|
+
export declare function getChalkSync(): ChalkInstance;
|
|
37
|
+
export default chalkFallback;
|
|
38
|
+
//# sourceMappingURL=chalk-fallback.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"chalk-fallback.d.ts","sourceRoot":"","sources":["../../../src/utils/chalk-fallback.ts"],"names":[],"mappings":"AAAA;;;;;;;;;GASG;AAiBH,KAAK,UAAU,GAAG,MAAM,GAAG,MAAM,CAAC;AAoClC,UAAU,OAAO;IACf,CAAC,IAAI,EAAE,UAAU,GAAG,MAAM,CAAC;IAC3B,IAAI,EAAE,OAAO,CAAC;CACf;AAED,UAAU,aAAa;IACrB,GAAG,EAAE,OAAO,CAAC;IACb,KAAK,EAAE,OAAO,CAAC;IACf,MAAM,EAAE,OAAO,CAAC;IAChB,IAAI,EAAE,OAAO,CAAC;IACd,IAAI,EAAE,OAAO,CAAC;IACd,IAAI,EAAE,OAAO,GAAG;QACd,CAAC,IAAI,EAAE,MAAM,GAAG,MAAM,CAAC;KACxB,CAAC;CACH;AAED;;;GAGG;AACH,eAAO,MAAM,aAAa,EAAE,aAoB3B,CAAC;AAqBF,wBAAsB,QAAQ,IAAI,OAAO,CAAC,aAAa,CAAC,CAavD;AAED;;;GAGG;AACH,wBAAgB,YAAY,IAAI,aAAa,CAE5C;AAED,eAAe,aAAa,CAAC"}
|
|
@@ -0,0 +1,118 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Chalk Fallback Utility
|
|
3
|
+
*
|
|
4
|
+
* Provides chalk-like API for colored console output with graceful fallback
|
|
5
|
+
* to plain text when chalk is not available (e.g., in marketplace plugins).
|
|
6
|
+
*
|
|
7
|
+
* This enables AC test validator to work in both:
|
|
8
|
+
* 1. Full npm-installed environments (uses real chalk)
|
|
9
|
+
* 2. Marketplace plugin environments (uses ANSI codes or plain text)
|
|
10
|
+
*/
|
|
11
|
+
// Simple ANSI color codes for terminal output
|
|
12
|
+
const ANSI = {
|
|
13
|
+
reset: '\x1b[0m',
|
|
14
|
+
bold: '\x1b[1m',
|
|
15
|
+
red: '\x1b[31m',
|
|
16
|
+
green: '\x1b[32m',
|
|
17
|
+
yellow: '\x1b[33m',
|
|
18
|
+
blue: '\x1b[34m',
|
|
19
|
+
gray: '\x1b[90m',
|
|
20
|
+
};
|
|
21
|
+
// Check if we're in a TTY that supports colors
|
|
22
|
+
const supportsColor = process.stdout?.isTTY ?? false;
|
|
23
|
+
/**
|
|
24
|
+
* Creates a chalk-like color function
|
|
25
|
+
*/
|
|
26
|
+
function createColorFn(colorCode) {
|
|
27
|
+
const fn = ((text) => {
|
|
28
|
+
const str = String(text);
|
|
29
|
+
if (!supportsColor)
|
|
30
|
+
return str;
|
|
31
|
+
return `${colorCode}${str}${ANSI.reset}`;
|
|
32
|
+
});
|
|
33
|
+
// Add chainable modifiers
|
|
34
|
+
fn.bold = ((text) => {
|
|
35
|
+
const str = String(text);
|
|
36
|
+
if (!supportsColor)
|
|
37
|
+
return str;
|
|
38
|
+
return `${ANSI.bold}${colorCode}${str}${ANSI.reset}`;
|
|
39
|
+
});
|
|
40
|
+
return fn;
|
|
41
|
+
}
|
|
42
|
+
/**
|
|
43
|
+
* Creates a bold color function
|
|
44
|
+
*/
|
|
45
|
+
function createBoldColorFn(colorCode) {
|
|
46
|
+
const fn = ((text) => {
|
|
47
|
+
const str = String(text);
|
|
48
|
+
if (!supportsColor)
|
|
49
|
+
return str;
|
|
50
|
+
return `${ANSI.bold}${colorCode}${str}${ANSI.reset}`;
|
|
51
|
+
});
|
|
52
|
+
fn.bold = fn;
|
|
53
|
+
return fn;
|
|
54
|
+
}
|
|
55
|
+
/**
|
|
56
|
+
* Chalk-compatible API using ANSI codes
|
|
57
|
+
* Falls back to plain text if terminal doesn't support colors
|
|
58
|
+
*/
|
|
59
|
+
export const chalkFallback = {
|
|
60
|
+
red: createColorFn(ANSI.red),
|
|
61
|
+
green: createColorFn(ANSI.green),
|
|
62
|
+
yellow: createColorFn(ANSI.yellow),
|
|
63
|
+
blue: createColorFn(ANSI.blue),
|
|
64
|
+
gray: createColorFn(ANSI.gray),
|
|
65
|
+
bold: Object.assign(((text) => {
|
|
66
|
+
const str = String(text);
|
|
67
|
+
if (!supportsColor)
|
|
68
|
+
return str;
|
|
69
|
+
return `${ANSI.bold}${str}${ANSI.reset}`;
|
|
70
|
+
}), {
|
|
71
|
+
bold: ((text) => {
|
|
72
|
+
const str = String(text);
|
|
73
|
+
if (!supportsColor)
|
|
74
|
+
return str;
|
|
75
|
+
return `${ANSI.bold}${str}${ANSI.reset}`;
|
|
76
|
+
}),
|
|
77
|
+
}),
|
|
78
|
+
};
|
|
79
|
+
// Add nested color methods to bold
|
|
80
|
+
chalkFallback.bold.red = createBoldColorFn(ANSI.red);
|
|
81
|
+
chalkFallback.bold.green = createBoldColorFn(ANSI.green);
|
|
82
|
+
chalkFallback.bold.yellow = createBoldColorFn(ANSI.yellow);
|
|
83
|
+
chalkFallback.bold.blue = createBoldColorFn(ANSI.blue);
|
|
84
|
+
chalkFallback.bold.gray = createBoldColorFn(ANSI.gray);
|
|
85
|
+
// Add bold method to color functions for chaining like chalk.green.bold()
|
|
86
|
+
chalkFallback.red.bold = createBoldColorFn(ANSI.red);
|
|
87
|
+
chalkFallback.green.bold = createBoldColorFn(ANSI.green);
|
|
88
|
+
chalkFallback.yellow.bold = createBoldColorFn(ANSI.yellow);
|
|
89
|
+
chalkFallback.blue.bold = createBoldColorFn(ANSI.blue);
|
|
90
|
+
chalkFallback.gray.bold = createBoldColorFn(ANSI.gray);
|
|
91
|
+
/**
|
|
92
|
+
* Try to import chalk, fall back to ANSI implementation
|
|
93
|
+
*/
|
|
94
|
+
let resolvedChalk = null;
|
|
95
|
+
export async function getChalk() {
|
|
96
|
+
if (resolvedChalk)
|
|
97
|
+
return resolvedChalk;
|
|
98
|
+
try {
|
|
99
|
+
// Try to dynamically import chalk
|
|
100
|
+
const chalkModule = await import('chalk');
|
|
101
|
+
resolvedChalk = chalkModule.default;
|
|
102
|
+
return resolvedChalk;
|
|
103
|
+
}
|
|
104
|
+
catch {
|
|
105
|
+
// Chalk not available, use fallback
|
|
106
|
+
resolvedChalk = chalkFallback;
|
|
107
|
+
return resolvedChalk;
|
|
108
|
+
}
|
|
109
|
+
}
|
|
110
|
+
/**
|
|
111
|
+
* Synchronous chalk getter - uses fallback if chalk wasn't pre-loaded
|
|
112
|
+
* Call getChalk() at module init to try loading real chalk first
|
|
113
|
+
*/
|
|
114
|
+
export function getChalkSync() {
|
|
115
|
+
return resolvedChalk ?? chalkFallback;
|
|
116
|
+
}
|
|
117
|
+
export default chalkFallback;
|
|
118
|
+
//# sourceMappingURL=chalk-fallback.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"chalk-fallback.js","sourceRoot":"","sources":["../../../src/utils/chalk-fallback.ts"],"names":[],"mappings":"AAAA;;;;;;;;;GASG;AAEH,8CAA8C;AAC9C,MAAM,IAAI,GAAG;IACX,KAAK,EAAE,SAAS;IAChB,IAAI,EAAE,SAAS;IACf,GAAG,EAAE,UAAU;IACf,KAAK,EAAE,UAAU;IACjB,MAAM,EAAE,UAAU;IAClB,IAAI,EAAE,UAAU;IAChB,IAAI,EAAE,UAAU;CACjB,CAAC;AAEF,+CAA+C;AAC/C,MAAM,aAAa,GAAG,OAAO,CAAC,MAAM,EAAE,KAAK,IAAI,KAAK,CAAC;AAKrD;;GAEG;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C,CAAC;AACrD,aAAa,CAAC,KAAK,CAAC,IAAI,GAAG,iBAAiB,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC;AACzD,aAAa,CAAC,MAAM,CAAC,IAAI,GAAG,iBAAiB,CAAC,IAAI,CAAC,MAAM,CAAC,CAAC;AAC3D,aAAa,CAAC,IAAI,CAAC,IAAI,GAAG,iBAAiB,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;AACvD,aAAa,CAAC,IAAI,CAAC,IAAI,GAAG,iBAAiB,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;AAEvD;;GAEG;AACH,IAAI,aAAa,GAAyB,IAAI,CAAC;AAE/C,MAAM,CAAC,KAAK,UAAU,QAAQ;IAC5B,IAAI,aAAa;QAAE,OAAO,aAAa,CAAC;IAExC,IAAI,CAAC;QACH,kCAAkC;QAClC,MAAM,WAAW,GAAG,MAAM,MAAM,CAAC,OAAO,CAAC,CAAC;QAC1C,aAAa,GAAG,WAAW,CAAC,OAAmC,CAAC;QAChE,OAAO,aAAa,CAAC;IACvB,CAAC;IAAC,MAAM,CAAC;QACP,oCAAoC;QACpC,aAAa,GAAG,aAAa,CAAC;QAC9B,OAAO,aAAa,CAAC;IACvB,CAAC;AACH,CAAC;AAED;;;GAGG;AACH,MAAM,UAAU,YAAY;IAC1B,OAAO,aAAa,IAAI,aAAa,CAAC;AACxC,CAAC;AAED,eAAe,aAAa,CAAC"}
|
|
@@ -0,0 +1,127 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Project ID Generator with Duplicate Prevention (v0.29.0+)
|
|
3
|
+
*
|
|
4
|
+
* Generates unique SpecWeave project IDs from external tool entities:
|
|
5
|
+
* - JIRA boards → Project IDs
|
|
6
|
+
* - ADO area paths → Project IDs
|
|
7
|
+
* - GitHub repos → Project IDs
|
|
8
|
+
*
|
|
9
|
+
* Handles collision detection and composite key generation.
|
|
10
|
+
*/
|
|
11
|
+
/**
|
|
12
|
+
* Project ID generation options
|
|
13
|
+
*/
|
|
14
|
+
export interface ProjectIdOptions {
|
|
15
|
+
/** External container (JIRA project key, ADO project name) */
|
|
16
|
+
externalContainer: string;
|
|
17
|
+
/** Local name (board name, area path, repo name) */
|
|
18
|
+
localName: string;
|
|
19
|
+
/** Provider type */
|
|
20
|
+
provider: 'jira' | 'ado' | 'github';
|
|
21
|
+
/** Existing project IDs to check for collisions */
|
|
22
|
+
existingIds?: string[];
|
|
23
|
+
}
|
|
24
|
+
/**
|
|
25
|
+
* Generated project ID result
|
|
26
|
+
*/
|
|
27
|
+
export interface ProjectIdResult {
|
|
28
|
+
/** Generated project ID */
|
|
29
|
+
id: string;
|
|
30
|
+
/** Whether collision was detected and prefix was added */
|
|
31
|
+
hadCollision: boolean;
|
|
32
|
+
/** Original local name before sanitization */
|
|
33
|
+
originalName: string;
|
|
34
|
+
/** Full composite key (container + local) */
|
|
35
|
+
compositeKey: string;
|
|
36
|
+
}
|
|
37
|
+
/**
|
|
38
|
+
* Normalize a string to a valid project ID
|
|
39
|
+
* - Lowercase
|
|
40
|
+
* - Replace spaces and special chars with hyphens
|
|
41
|
+
* - Remove consecutive hyphens
|
|
42
|
+
* - Remove leading/trailing hyphens
|
|
43
|
+
*/
|
|
44
|
+
export declare function normalizeToProjectId(name: string): string;
|
|
45
|
+
/**
|
|
46
|
+
* Generate a short prefix from external container name
|
|
47
|
+
* Used when collision is detected
|
|
48
|
+
*/
|
|
49
|
+
export declare function generateContainerPrefix(container: string): string;
|
|
50
|
+
/**
|
|
51
|
+
* Generate unique project ID with collision detection
|
|
52
|
+
*
|
|
53
|
+
* Algorithm:
|
|
54
|
+
* 1. Normalize local name to project ID format
|
|
55
|
+
* 2. Check if ID exists in existingIds
|
|
56
|
+
* 3. If collision, add container prefix: "core-fe" instead of "fe"
|
|
57
|
+
* 4. If still collision (rare), add numeric suffix: "core-fe-2"
|
|
58
|
+
*
|
|
59
|
+
* @param options Generation options
|
|
60
|
+
* @returns Generated project ID with metadata
|
|
61
|
+
*/
|
|
62
|
+
export declare function generateProjectId(options: ProjectIdOptions): ProjectIdResult;
|
|
63
|
+
/**
|
|
64
|
+
* Batch generate project IDs from multiple sources
|
|
65
|
+
* Ensures no collisions within the batch and with existing IDs
|
|
66
|
+
*/
|
|
67
|
+
export declare function generateProjectIdsBatch(sources: Array<{
|
|
68
|
+
container: string;
|
|
69
|
+
localName: string;
|
|
70
|
+
provider: 'jira' | 'ado' | 'github';
|
|
71
|
+
}>, existingIds?: string[]): Map<string, ProjectIdResult>;
|
|
72
|
+
/**
|
|
73
|
+
* Get existing project IDs from a SpecWeave project
|
|
74
|
+
*
|
|
75
|
+
* @param projectRoot Path to project root
|
|
76
|
+
* @returns Array of existing project IDs
|
|
77
|
+
*/
|
|
78
|
+
export declare function getExistingProjectIds(projectRoot: string): string[];
|
|
79
|
+
/**
|
|
80
|
+
* Create 2-level directory structure for JIRA/ADO projects
|
|
81
|
+
*
|
|
82
|
+
* Structure:
|
|
83
|
+
* .specweave/docs/internal/specs/
|
|
84
|
+
* ├── JIRA-CORE/ (external container level)
|
|
85
|
+
* │ ├── fe/ (SpecWeave project level)
|
|
86
|
+
* │ ├── be/
|
|
87
|
+
* │ └── mobile/
|
|
88
|
+
* └── ADO-MyProduct/
|
|
89
|
+
* ├── fe/
|
|
90
|
+
* └── be/
|
|
91
|
+
*
|
|
92
|
+
* @param projectRoot Path to project root
|
|
93
|
+
* @param containerType Type of external container
|
|
94
|
+
* @param containerId External container ID (JIRA project key or ADO project name)
|
|
95
|
+
* @param specweaveProjectId SpecWeave project ID
|
|
96
|
+
*/
|
|
97
|
+
export declare function createTwoLevelProjectDir(projectRoot: string, containerType: 'jira' | 'ado', containerId: string, specweaveProjectId: string): string;
|
|
98
|
+
/**
|
|
99
|
+
* Get the 2-level path for a project
|
|
100
|
+
*
|
|
101
|
+
* @param projectRoot Path to project root
|
|
102
|
+
* @param containerType Type of external container
|
|
103
|
+
* @param containerId External container ID
|
|
104
|
+
* @param specweaveProjectId SpecWeave project ID
|
|
105
|
+
* @returns Full path or undefined if using flat structure
|
|
106
|
+
*/
|
|
107
|
+
export declare function getTwoLevelProjectPath(projectRoot: string, containerType: 'jira' | 'ado' | null, containerId: string | null, specweaveProjectId: string): string;
|
|
108
|
+
/**
|
|
109
|
+
* Parse a 2-level project path to extract container and project info
|
|
110
|
+
*
|
|
111
|
+
* @param projectPath Path like ".specweave/docs/internal/specs/JIRA-CORE/fe"
|
|
112
|
+
* @returns Parsed container and project info
|
|
113
|
+
*/
|
|
114
|
+
export declare function parseTwoLevelPath(projectPath: string): {
|
|
115
|
+
containerType: 'jira' | 'ado' | null;
|
|
116
|
+
containerId: string | null;
|
|
117
|
+
projectId: string;
|
|
118
|
+
} | null;
|
|
119
|
+
/**
|
|
120
|
+
* Validate project ID format
|
|
121
|
+
*/
|
|
122
|
+
export declare function isValidProjectId(id: string): boolean;
|
|
123
|
+
/**
|
|
124
|
+
* Suggest a valid project ID from an invalid one
|
|
125
|
+
*/
|
|
126
|
+
export declare function suggestProjectId(invalidId: string): string;
|
|
127
|
+
//# sourceMappingURL=project-id-generator.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"project-id-generator.d.ts","sourceRoot":"","sources":["../../../src/utils/project-id-generator.ts"],"names":[],"mappings":"AAAA;;;;;;;;;GASG;AAKH;;GAEG;AACH,MAAM,WAAW,gBAAgB;IAC/B,8DAA8D;IAC9D,iBAAiB,EAAE,MAAM,CAAC;IAE1B,oDAAoD;IACpD,SAAS,EAAE,MAAM,CAAC;IAElB,oBAAoB;IACpB,QAAQ,EAAE,MAAM,GAAG,KAAK,GAAG,QAAQ,CAAC;IAEpC,mDAAmD;IACnD,WAAW,CAAC,EAAE,MAAM,EAAE,CAAC;CACxB;AAED;;GAEG;AACH,MAAM,WAAW,eAAe;IAC9B,2BAA2B;IAC3B,EAAE,EAAE,MAAM,CAAC;IAEX,0DAA0D;IAC1D,YAAY,EAAE,OAAO,CAAC;IAEtB,8CAA8C;IAC9C,YAAY,EAAE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AS,EAAE,MAAM,CAAC;CACnB,GAAG,IAAI,CAyBP;AAED;;GAEG;AACH,wBAAgB,gBAAgB,CAAC,EAAE,EAAE,MAAM,GAAG,OAAO,CAEpD;AAED;;GAEG;AACH,wBAAgB,gBAAgB,CAAC,SAAS,EAAE,MAAM,GAAG,MAAM,CAG1D"}
|
|
@@ -0,0 +1,228 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Project ID Generator with Duplicate Prevention (v0.29.0+)
|
|
3
|
+
*
|
|
4
|
+
* Generates unique SpecWeave project IDs from external tool entities:
|
|
5
|
+
* - JIRA boards → Project IDs
|
|
6
|
+
* - ADO area paths → Project IDs
|
|
7
|
+
* - GitHub repos → Project IDs
|
|
8
|
+
*
|
|
9
|
+
* Handles collision detection and composite key generation.
|
|
10
|
+
*/
|
|
11
|
+
import * as fs from './fs-native.js';
|
|
12
|
+
import * as path from 'path';
|
|
13
|
+
/**
|
|
14
|
+
* Normalize a string to a valid project ID
|
|
15
|
+
* - Lowercase
|
|
16
|
+
* - Replace spaces and special chars with hyphens
|
|
17
|
+
* - Remove consecutive hyphens
|
|
18
|
+
* - Remove leading/trailing hyphens
|
|
19
|
+
*/
|
|
20
|
+
export function normalizeToProjectId(name) {
|
|
21
|
+
return name
|
|
22
|
+
.toLowerCase()
|
|
23
|
+
.replace(/[^a-z0-9]+/g, '-') // Replace non-alphanumeric with hyphens
|
|
24
|
+
.replace(/-+/g, '-') // Remove consecutive hyphens
|
|
25
|
+
.replace(/^-|-$/g, ''); // Remove leading/trailing hyphens
|
|
26
|
+
}
|
|
27
|
+
/**
|
|
28
|
+
* Generate a short prefix from external container name
|
|
29
|
+
* Used when collision is detected
|
|
30
|
+
*/
|
|
31
|
+
export function generateContainerPrefix(container) {
|
|
32
|
+
// For JIRA project keys like "CORE", use as-is (already short)
|
|
33
|
+
if (/^[A-Z]{2,10}$/.test(container)) {
|
|
34
|
+
return container.toLowerCase();
|
|
35
|
+
}
|
|
36
|
+
// For longer names, create abbreviation
|
|
37
|
+
// "MyProduct" → "mp", "Backend-Services" → "bs"
|
|
38
|
+
const words = container.split(/[-_\s]+/);
|
|
39
|
+
if (words.length === 1) {
|
|
40
|
+
// Single word: use first 3 chars
|
|
41
|
+
return container.substring(0, 3).toLowerCase();
|
|
42
|
+
}
|
|
43
|
+
// Multiple words: use first letter of each
|
|
44
|
+
return words.map(w => w[0]).join('').toLowerCase();
|
|
45
|
+
}
|
|
46
|
+
/**
|
|
47
|
+
* Generate unique project ID with collision detection
|
|
48
|
+
*
|
|
49
|
+
* Algorithm:
|
|
50
|
+
* 1. Normalize local name to project ID format
|
|
51
|
+
* 2. Check if ID exists in existingIds
|
|
52
|
+
* 3. If collision, add container prefix: "core-fe" instead of "fe"
|
|
53
|
+
* 4. If still collision (rare), add numeric suffix: "core-fe-2"
|
|
54
|
+
*
|
|
55
|
+
* @param options Generation options
|
|
56
|
+
* @returns Generated project ID with metadata
|
|
57
|
+
*/
|
|
58
|
+
export function generateProjectId(options) {
|
|
59
|
+
const { externalContainer, localName, provider, existingIds = [] } = options;
|
|
60
|
+
// Step 1: Normalize local name
|
|
61
|
+
const baseId = normalizeToProjectId(localName);
|
|
62
|
+
const compositeKey = `${externalContainer}/${localName}`;
|
|
63
|
+
// Step 2: Check for collision
|
|
64
|
+
if (!existingIds.includes(baseId)) {
|
|
65
|
+
return {
|
|
66
|
+
id: baseId,
|
|
67
|
+
hadCollision: false,
|
|
68
|
+
originalName: localName,
|
|
69
|
+
compositeKey,
|
|
70
|
+
};
|
|
71
|
+
}
|
|
72
|
+
// Step 3: Collision detected - add container prefix
|
|
73
|
+
const prefix = generateContainerPrefix(externalContainer);
|
|
74
|
+
let prefixedId = `${prefix}-${baseId}`;
|
|
75
|
+
if (!existingIds.includes(prefixedId)) {
|
|
76
|
+
return {
|
|
77
|
+
id: prefixedId,
|
|
78
|
+
hadCollision: true,
|
|
79
|
+
originalName: localName,
|
|
80
|
+
compositeKey,
|
|
81
|
+
};
|
|
82
|
+
}
|
|
83
|
+
// Step 4: Still collision (rare) - add numeric suffix
|
|
84
|
+
let suffix = 2;
|
|
85
|
+
while (existingIds.includes(`${prefixedId}-${suffix}`)) {
|
|
86
|
+
suffix++;
|
|
87
|
+
if (suffix > 100) {
|
|
88
|
+
throw new Error(`Cannot generate unique ID for ${compositeKey} after 100 attempts`);
|
|
89
|
+
}
|
|
90
|
+
}
|
|
91
|
+
return {
|
|
92
|
+
id: `${prefixedId}-${suffix}`,
|
|
93
|
+
hadCollision: true,
|
|
94
|
+
originalName: localName,
|
|
95
|
+
compositeKey,
|
|
96
|
+
};
|
|
97
|
+
}
|
|
98
|
+
/**
|
|
99
|
+
* Batch generate project IDs from multiple sources
|
|
100
|
+
* Ensures no collisions within the batch and with existing IDs
|
|
101
|
+
*/
|
|
102
|
+
export function generateProjectIdsBatch(sources, existingIds = []) {
|
|
103
|
+
const results = new Map();
|
|
104
|
+
const allIds = [...existingIds];
|
|
105
|
+
for (const source of sources) {
|
|
106
|
+
const result = generateProjectId({
|
|
107
|
+
externalContainer: source.container,
|
|
108
|
+
localName: source.localName,
|
|
109
|
+
provider: source.provider,
|
|
110
|
+
existingIds: allIds,
|
|
111
|
+
});
|
|
112
|
+
// Add to tracking to prevent intra-batch collisions
|
|
113
|
+
allIds.push(result.id);
|
|
114
|
+
// Key by composite key for easy lookup
|
|
115
|
+
results.set(result.compositeKey, result);
|
|
116
|
+
}
|
|
117
|
+
return results;
|
|
118
|
+
}
|
|
119
|
+
/**
|
|
120
|
+
* Get existing project IDs from a SpecWeave project
|
|
121
|
+
*
|
|
122
|
+
* @param projectRoot Path to project root
|
|
123
|
+
* @returns Array of existing project IDs
|
|
124
|
+
*/
|
|
125
|
+
export function getExistingProjectIds(projectRoot) {
|
|
126
|
+
const specsDir = path.join(projectRoot, '.specweave', 'docs', 'internal', 'specs');
|
|
127
|
+
if (!fs.existsSync(specsDir)) {
|
|
128
|
+
return [];
|
|
129
|
+
}
|
|
130
|
+
try {
|
|
131
|
+
const entries = fs.readdirSync(specsDir, { withFileTypes: true });
|
|
132
|
+
return entries
|
|
133
|
+
.filter(entry => entry.isDirectory() && !entry.name.startsWith('_'))
|
|
134
|
+
.map(entry => entry.name);
|
|
135
|
+
}
|
|
136
|
+
catch {
|
|
137
|
+
return [];
|
|
138
|
+
}
|
|
139
|
+
}
|
|
140
|
+
/**
|
|
141
|
+
* Create 2-level directory structure for JIRA/ADO projects
|
|
142
|
+
*
|
|
143
|
+
* Structure:
|
|
144
|
+
* .specweave/docs/internal/specs/
|
|
145
|
+
* ├── JIRA-CORE/ (external container level)
|
|
146
|
+
* │ ├── fe/ (SpecWeave project level)
|
|
147
|
+
* │ ├── be/
|
|
148
|
+
* │ └── mobile/
|
|
149
|
+
* └── ADO-MyProduct/
|
|
150
|
+
* ├── fe/
|
|
151
|
+
* └── be/
|
|
152
|
+
*
|
|
153
|
+
* @param projectRoot Path to project root
|
|
154
|
+
* @param containerType Type of external container
|
|
155
|
+
* @param containerId External container ID (JIRA project key or ADO project name)
|
|
156
|
+
* @param specweaveProjectId SpecWeave project ID
|
|
157
|
+
*/
|
|
158
|
+
export function createTwoLevelProjectDir(projectRoot, containerType, containerId, specweaveProjectId) {
|
|
159
|
+
// Normalize container ID to directory-safe name
|
|
160
|
+
const containerDirName = `${containerType.toUpperCase()}-${normalizeToProjectId(containerId)}`;
|
|
161
|
+
const projectDirName = specweaveProjectId;
|
|
162
|
+
const fullPath = path.join(projectRoot, '.specweave', 'docs', 'internal', 'specs', containerDirName, projectDirName);
|
|
163
|
+
if (!fs.existsSync(fullPath)) {
|
|
164
|
+
fs.mkdirSync(fullPath, { recursive: true });
|
|
165
|
+
}
|
|
166
|
+
return fullPath;
|
|
167
|
+
}
|
|
168
|
+
/**
|
|
169
|
+
* Get the 2-level path for a project
|
|
170
|
+
*
|
|
171
|
+
* @param projectRoot Path to project root
|
|
172
|
+
* @param containerType Type of external container
|
|
173
|
+
* @param containerId External container ID
|
|
174
|
+
* @param specweaveProjectId SpecWeave project ID
|
|
175
|
+
* @returns Full path or undefined if using flat structure
|
|
176
|
+
*/
|
|
177
|
+
export function getTwoLevelProjectPath(projectRoot, containerType, containerId, specweaveProjectId) {
|
|
178
|
+
// If no container type, use flat structure (GitHub or single project)
|
|
179
|
+
if (!containerType || !containerId) {
|
|
180
|
+
return path.join(projectRoot, '.specweave', 'docs', 'internal', 'specs', specweaveProjectId);
|
|
181
|
+
}
|
|
182
|
+
// 2-level structure for JIRA/ADO
|
|
183
|
+
const containerDirName = `${containerType.toUpperCase()}-${normalizeToProjectId(containerId)}`;
|
|
184
|
+
return path.join(projectRoot, '.specweave', 'docs', 'internal', 'specs', containerDirName, specweaveProjectId);
|
|
185
|
+
}
|
|
186
|
+
/**
|
|
187
|
+
* Parse a 2-level project path to extract container and project info
|
|
188
|
+
*
|
|
189
|
+
* @param projectPath Path like ".specweave/docs/internal/specs/JIRA-CORE/fe"
|
|
190
|
+
* @returns Parsed container and project info
|
|
191
|
+
*/
|
|
192
|
+
export function parseTwoLevelPath(projectPath) {
|
|
193
|
+
// Match pattern: .../specs/{CONTAINER-TYPE-ID}/{PROJECT-ID}
|
|
194
|
+
const match = projectPath.match(/specs[/\\]((?:JIRA|ADO)-([^/\\]+))[/\\]([^/\\]+)/);
|
|
195
|
+
if (!match) {
|
|
196
|
+
// Try flat structure: .../specs/{PROJECT-ID}
|
|
197
|
+
const flatMatch = projectPath.match(/specs[/\\]([^/\\]+)$/);
|
|
198
|
+
if (flatMatch) {
|
|
199
|
+
return {
|
|
200
|
+
containerType: null,
|
|
201
|
+
containerId: null,
|
|
202
|
+
projectId: flatMatch[1],
|
|
203
|
+
};
|
|
204
|
+
}
|
|
205
|
+
return null;
|
|
206
|
+
}
|
|
207
|
+
const [, containerDir, containerId, projectId] = match;
|
|
208
|
+
const containerType = containerDir.startsWith('JIRA-') ? 'jira' : 'ado';
|
|
209
|
+
return {
|
|
210
|
+
containerType,
|
|
211
|
+
containerId,
|
|
212
|
+
projectId,
|
|
213
|
+
};
|
|
214
|
+
}
|
|
215
|
+
/**
|
|
216
|
+
* Validate project ID format
|
|
217
|
+
*/
|
|
218
|
+
export function isValidProjectId(id) {
|
|
219
|
+
return /^[a-z0-9][a-z0-9-]*[a-z0-9]$|^[a-z0-9]$/.test(id);
|
|
220
|
+
}
|
|
221
|
+
/**
|
|
222
|
+
* Suggest a valid project ID from an invalid one
|
|
223
|
+
*/
|
|
224
|
+
export function suggestProjectId(invalidId) {
|
|
225
|
+
const suggestion = normalizeToProjectId(invalidId);
|
|
226
|
+
return suggestion || 'project';
|
|
227
|
+
}
|
|
228
|
+
//# sourceMappingURL=project-id-generator.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"project-id-generator.js","sourceRoot":"","sources":["../../../src/utils/project-id-generator.ts"],"names":[],"mappings":"AAAA;;;;;;;;;GASG;AAEH,OAAO,KAAK,EAAE,MAAM,gBAAgB,CAAC;AACrC,OAAO,KAAK,IAAI,MAAM,MAAM,CAAC;AAoC7B;;;;;;GAMG;AACH,MAAM,UAAU,oBAAoB,CAAC,IAAY;IAC/C,OAAO,IAAI;SACR,WAAW,EAAE;SACb,OAAO,CAAC,aAAa,EAAE,GAAG,CAAC,CAAG,wCAAwC;SACtE,OAAO,CAAC,KAAK,EAAE,GAAG,CAAC,CAAW,6BAA6B;SAC3D,OAAO,CAAC,QAAQ,EAAE,EAAE,CAAC,CAAC,CAAQ,kCAAkC;AACrE,CAAC;AAED;;;GAGG;AACH,MAAM,UAAU,uBAAuB,CAAC,SAAiB;IACvD,+DAA+D;IAC/D,IAAI,eAAe,CAAC,IAAI,CAAC,SAAS,CAAC,EAAE,CAAC;QACpC,OAAO,SAAS,CAAC,WAAW,EAAE,CAAC;IACjC,CAAC;IAED,wCAAwC;IACxC,gDAAgD;IAChD,MAAM,KAAK,GAAG,SAAS,CAAC,KAAK,CAAC,SAAS,CAAC,CAAC;IACzC,IAAI,KAAK,CAAC,MAAM,KAAK,CAAC,EAAE,CAAC;QACvB,iCAAiC;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AC;IACnD,OAAO,UAAU,IAAI,SAAS,CAAC;AACjC,CAAC"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "specweave",
|
|
3
|
-
"version": "0.28.
|
|
3
|
+
"version": "0.28.19",
|
|
4
4
|
"description": "Spec-driven development framework for Claude Code. AI-native workflow with living documentation, intelligent agents, and multilingual support (9 languages). Enterprise-grade traceability with permanent specs and temporary increments.",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "dist/index.js",
|