specweave 1.0.22 → 1.0.24
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/README.md +95 -378
- package/dist/src/cli/commands/init.d.ts.map +1 -1
- package/dist/src/cli/commands/init.js +8 -26
- package/dist/src/cli/commands/init.js.map +1 -1
- package/dist/src/core/living-docs/cross-project-sync.d.ts +2 -0
- package/dist/src/core/living-docs/cross-project-sync.d.ts.map +1 -1
- package/dist/src/core/living-docs/cross-project-sync.js +14 -4
- package/dist/src/core/living-docs/cross-project-sync.js.map +1 -1
- package/dist/src/core/living-docs/living-docs-sync.d.ts.map +1 -1
- package/dist/src/core/living-docs/living-docs-sync.js +6 -2
- package/dist/src/core/living-docs/living-docs-sync.js.map +1 -1
- package/package.json +3 -3
- package/plugins/specweave/hooks/docs-changed.sh.backup +79 -0
- package/plugins/specweave/hooks/human-input-required.sh.backup +75 -0
- package/plugins/specweave/hooks/post-first-increment.sh.backup +61 -0
- package/plugins/specweave/hooks/post-increment-change.sh.backup +98 -0
- package/plugins/specweave/hooks/post-increment-completion.sh.backup +231 -0
- package/plugins/specweave/hooks/post-increment-planning.sh.backup +1048 -0
- package/plugins/specweave/hooks/post-increment-status-change.sh.backup +147 -0
- package/plugins/specweave/hooks/post-spec-update.sh.backup +158 -0
- package/plugins/specweave/hooks/post-user-story-complete.sh.backup +179 -0
- package/plugins/specweave/hooks/pre-command-deduplication.sh.backup +83 -0
- package/plugins/specweave/hooks/pre-implementation.sh.backup +67 -0
- package/plugins/specweave/hooks/pre-task-completion.sh.backup +194 -0
- package/plugins/specweave/hooks/pre-tool-use.sh.backup +133 -0
- package/plugins/specweave/hooks/user-prompt-submit.sh.backup +386 -0
- package/plugins/specweave-ado/hooks/post-living-docs-update.sh.backup +353 -0
- package/plugins/specweave-ado/hooks/post-task-completion.sh.backup +172 -0
- package/plugins/specweave-ado/lib/enhanced-ado-sync.js +170 -0
- package/plugins/specweave-github/hooks/.specweave/logs/hooks-debug.log +1262 -0
- package/plugins/specweave-github/hooks/post-task-completion.sh.backup +258 -0
- package/plugins/specweave-github/lib/enhanced-github-sync.js +220 -0
- package/plugins/specweave-jira/hooks/post-task-completion.sh.backup +172 -0
- package/plugins/specweave-jira/lib/enhanced-jira-sync.js +134 -0
- package/plugins/specweave-release/hooks/.specweave/logs/dora-tracking.log +1254 -0
- package/plugins/specweave-release/hooks/post-task-completion.sh.backup +110 -0
|
@@ -0,0 +1,134 @@
|
|
|
1
|
+
import { EnhancedContentBuilder } from "../../../dist/src/core/sync/enhanced-content-builder.js";
|
|
2
|
+
import { SpecIncrementMapper } from "../../../dist/src/core/sync/spec-increment-mapper.js";
|
|
3
|
+
import { parseSpecContent } from "../../../dist/src/core/spec-content-sync.js";
|
|
4
|
+
import * as path from "path";
|
|
5
|
+
import * as fs from "fs/promises";
|
|
6
|
+
async function syncSpecToJiraWithEnhancedContent(options) {
|
|
7
|
+
const { specPath, domain, project, dryRun = false, verbose = false } = options;
|
|
8
|
+
try {
|
|
9
|
+
const baseSpec = await parseSpecContent(specPath);
|
|
10
|
+
if (!baseSpec) {
|
|
11
|
+
return {
|
|
12
|
+
success: false,
|
|
13
|
+
action: "error",
|
|
14
|
+
error: "Failed to parse spec content"
|
|
15
|
+
};
|
|
16
|
+
}
|
|
17
|
+
if (verbose) {
|
|
18
|
+
console.log(`\u{1F4C4} Parsed spec: ${baseSpec.identifier.compact}`);
|
|
19
|
+
}
|
|
20
|
+
const specId = baseSpec.identifier.full || baseSpec.identifier.compact;
|
|
21
|
+
const rootDir = await findSpecWeaveRoot(specPath);
|
|
22
|
+
const mapper = new SpecIncrementMapper(rootDir);
|
|
23
|
+
const mapping = await mapper.mapSpecToIncrements(specId);
|
|
24
|
+
if (verbose) {
|
|
25
|
+
console.log(`\u{1F517} Found ${mapping.increments.length} related increments`);
|
|
26
|
+
}
|
|
27
|
+
const taskMapping = buildTaskMapping(mapping.increments);
|
|
28
|
+
const architectureDocs = await findArchitectureDocs(rootDir, specId);
|
|
29
|
+
const enhancedSpec = {
|
|
30
|
+
...baseSpec,
|
|
31
|
+
summary: baseSpec.description,
|
|
32
|
+
taskMapping,
|
|
33
|
+
architectureDocs
|
|
34
|
+
};
|
|
35
|
+
const builder = new EnhancedContentBuilder();
|
|
36
|
+
const description = builder.buildExternalDescription(enhancedSpec);
|
|
37
|
+
if (verbose) {
|
|
38
|
+
console.log(`\u{1F4DD} Generated description: ${description.length} characters`);
|
|
39
|
+
}
|
|
40
|
+
if (dryRun) {
|
|
41
|
+
console.log("\u{1F50D} DRY RUN - Would create/update epic with:");
|
|
42
|
+
console.log(` Summary: ${baseSpec.title}`);
|
|
43
|
+
console.log(` Description length: ${description.length}`);
|
|
44
|
+
return {
|
|
45
|
+
success: true,
|
|
46
|
+
action: "no-change",
|
|
47
|
+
tasksLinked: taskMapping?.tasks.length || 0
|
|
48
|
+
};
|
|
49
|
+
}
|
|
50
|
+
if (!dryRun && (!domain || !project)) {
|
|
51
|
+
return {
|
|
52
|
+
success: false,
|
|
53
|
+
action: "error",
|
|
54
|
+
error: "JIRA domain/project not specified (required for actual sync)"
|
|
55
|
+
};
|
|
56
|
+
}
|
|
57
|
+
const result = {
|
|
58
|
+
success: true,
|
|
59
|
+
action: dryRun ? "no-change" : "created",
|
|
60
|
+
// Assume create if not dry run
|
|
61
|
+
tasksLinked: taskMapping?.tasks.length || 0
|
|
62
|
+
};
|
|
63
|
+
if (domain && project && !dryRun) {
|
|
64
|
+
result.epicKey = `SPEC-001`;
|
|
65
|
+
result.epicUrl = `https://${domain}/browse/SPEC-001`;
|
|
66
|
+
if (verbose) {
|
|
67
|
+
console.log(`\u26A0\uFE0F JIRA API integration not implemented in this file`);
|
|
68
|
+
console.log(` Use jira-spec-sync.ts for actual JIRA synchronization`);
|
|
69
|
+
}
|
|
70
|
+
}
|
|
71
|
+
return result;
|
|
72
|
+
} catch (error) {
|
|
73
|
+
return {
|
|
74
|
+
success: false,
|
|
75
|
+
action: "error",
|
|
76
|
+
error: error.message
|
|
77
|
+
};
|
|
78
|
+
}
|
|
79
|
+
}
|
|
80
|
+
async function findSpecWeaveRoot(specPath) {
|
|
81
|
+
let currentDir = path.dirname(specPath);
|
|
82
|
+
while (true) {
|
|
83
|
+
const specweaveDir = path.join(currentDir, ".specweave");
|
|
84
|
+
try {
|
|
85
|
+
await fs.access(specweaveDir);
|
|
86
|
+
return currentDir;
|
|
87
|
+
} catch {
|
|
88
|
+
const parentDir = path.dirname(currentDir);
|
|
89
|
+
if (parentDir === currentDir) {
|
|
90
|
+
throw new Error(".specweave directory not found");
|
|
91
|
+
}
|
|
92
|
+
currentDir = parentDir;
|
|
93
|
+
}
|
|
94
|
+
}
|
|
95
|
+
}
|
|
96
|
+
function buildTaskMapping(increments) {
|
|
97
|
+
if (increments.length === 0) return void 0;
|
|
98
|
+
const firstIncrement = increments[0];
|
|
99
|
+
const tasks = firstIncrement.tasks.map((task) => ({
|
|
100
|
+
id: task.id,
|
|
101
|
+
title: task.title,
|
|
102
|
+
userStories: task.userStories
|
|
103
|
+
}));
|
|
104
|
+
return {
|
|
105
|
+
incrementId: firstIncrement.id,
|
|
106
|
+
tasks,
|
|
107
|
+
tasksUrl: `tasks.md`
|
|
108
|
+
// JIRA doesn't support external links in same way
|
|
109
|
+
};
|
|
110
|
+
}
|
|
111
|
+
async function findArchitectureDocs(rootDir, specId) {
|
|
112
|
+
const docs = [];
|
|
113
|
+
const archDir = path.join(rootDir, ".specweave/docs/internal/architecture");
|
|
114
|
+
try {
|
|
115
|
+
const adrDir = path.join(archDir, "adr");
|
|
116
|
+
try {
|
|
117
|
+
const adrs = await fs.readdir(adrDir);
|
|
118
|
+
const relatedAdrs = adrs.filter((file) => file.includes(specId.replace("spec-", "")));
|
|
119
|
+
for (const adr of relatedAdrs) {
|
|
120
|
+
docs.push({
|
|
121
|
+
type: "adr",
|
|
122
|
+
path: path.join(adrDir, adr),
|
|
123
|
+
title: adr.replace(".md", "").replace(/-/g, " ")
|
|
124
|
+
});
|
|
125
|
+
}
|
|
126
|
+
} catch {
|
|
127
|
+
}
|
|
128
|
+
} catch {
|
|
129
|
+
}
|
|
130
|
+
return docs;
|
|
131
|
+
}
|
|
132
|
+
export {
|
|
133
|
+
syncSpecToJiraWithEnhancedContent
|
|
134
|
+
};
|