@applica-software-guru/sdd-core 1.0.0 → 1.3.3
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/agent/agent-defaults.d.ts +3 -0
- package/dist/agent/agent-defaults.d.ts.map +1 -0
- package/dist/agent/agent-defaults.js +13 -0
- package/dist/agent/agent-defaults.js.map +1 -0
- package/dist/agent/agent-runner.d.ts +9 -0
- package/dist/agent/agent-runner.d.ts.map +1 -0
- package/dist/agent/agent-runner.js +43 -0
- package/dist/agent/agent-runner.js.map +1 -0
- package/dist/index.d.ts +10 -5
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +11 -1
- package/dist/index.js.map +1 -1
- package/dist/prompt/apply-prompt-generator.d.ts +3 -0
- package/dist/prompt/apply-prompt-generator.d.ts.map +1 -0
- package/dist/prompt/apply-prompt-generator.js +48 -0
- package/dist/prompt/apply-prompt-generator.js.map +1 -0
- package/dist/prompt/prompt-generator.d.ts.map +1 -1
- package/dist/prompt/prompt-generator.js +7 -11
- package/dist/prompt/prompt-generator.js.map +1 -1
- package/dist/scaffold/init.d.ts +1 -1
- package/dist/scaffold/init.d.ts.map +1 -1
- package/dist/scaffold/init.js +10 -29
- package/dist/scaffold/init.js.map +1 -1
- package/dist/scaffold/skill-adapters.d.ts +39 -0
- package/dist/scaffold/skill-adapters.d.ts.map +1 -0
- package/dist/scaffold/skill-adapters.js +224 -0
- package/dist/scaffold/skill-adapters.js.map +1 -0
- package/dist/scaffold/templates.d.ts +5 -1
- package/dist/scaffold/templates.d.ts.map +1 -1
- package/dist/scaffold/templates.js +203 -55
- package/dist/scaffold/templates.js.map +1 -1
- package/dist/sdd.d.ts +7 -3
- package/dist/sdd.d.ts.map +1 -1
- package/dist/sdd.js +36 -18
- package/dist/sdd.js.map +1 -1
- package/dist/types.d.ts +2 -0
- package/dist/types.d.ts.map +1 -1
- package/package.json +1 -1
- package/src/agent/agent-defaults.ts +12 -0
- package/src/agent/agent-runner.ts +54 -0
- package/src/index.ts +17 -5
- package/src/prompt/apply-prompt-generator.ts +58 -0
- package/src/prompt/prompt-generator.ts +8 -18
- package/src/scaffold/init.ts +17 -38
- package/src/scaffold/skill-adapters.ts +322 -0
- package/src/scaffold/templates.ts +207 -54
- package/src/sdd.ts +57 -31
- package/src/types.ts +2 -0
- package/tests/apply.test.ts +119 -0
- package/tests/integration.test.ts +94 -51
- package/dist/delta/hasher.d.ts +0 -2
- package/dist/delta/hasher.d.ts.map +0 -1
- package/dist/delta/hasher.js +0 -8
- package/dist/delta/hasher.js.map +0 -1
- package/dist/lock/lock-manager.d.ts +0 -6
- package/dist/lock/lock-manager.d.ts.map +0 -1
- package/dist/lock/lock-manager.js +0 -39
- package/dist/lock/lock-manager.js.map +0 -1
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"agent-defaults.d.ts","sourceRoot":"","sources":["../../src/agent/agent-defaults.ts"],"names":[],"mappings":"AAAA,eAAO,MAAM,cAAc,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAIjD,CAAC;AAEF,wBAAgB,mBAAmB,CACjC,IAAI,EAAE,MAAM,EACZ,YAAY,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,GACpC,MAAM,GAAG,SAAS,CAEpB"}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.DEFAULT_AGENTS = void 0;
|
|
4
|
+
exports.resolveAgentCommand = resolveAgentCommand;
|
|
5
|
+
exports.DEFAULT_AGENTS = {
|
|
6
|
+
claude: 'claude -p "$(cat $PROMPT_FILE)" --dangerously-skip-permissions --verbose',
|
|
7
|
+
codex: 'codex -q "$(cat $PROMPT_FILE)"',
|
|
8
|
+
opencode: 'opencode -p "$(cat $PROMPT_FILE)"',
|
|
9
|
+
};
|
|
10
|
+
function resolveAgentCommand(name, configAgents) {
|
|
11
|
+
return configAgents?.[name] ?? exports.DEFAULT_AGENTS[name];
|
|
12
|
+
}
|
|
13
|
+
//# sourceMappingURL=agent-defaults.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"agent-defaults.js","sourceRoot":"","sources":["../../src/agent/agent-defaults.ts"],"names":[],"mappings":";;;AAMA,kDAKC;AAXY,QAAA,cAAc,GAA2B;IACpD,MAAM,EAAE,0EAA0E;IAClF,KAAK,EAAE,gCAAgC;IACvC,QAAQ,EAAE,mCAAmC;CAC9C,CAAC;AAEF,SAAgB,mBAAmB,CACjC,IAAY,EACZ,YAAqC;IAErC,OAAO,YAAY,EAAE,CAAC,IAAI,CAAC,IAAI,sBAAc,CAAC,IAAI,CAAC,CAAC;AACtD,CAAC"}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
export interface AgentRunnerOptions {
|
|
2
|
+
root: string;
|
|
3
|
+
prompt: string;
|
|
4
|
+
agent: string;
|
|
5
|
+
agents?: Record<string, string>;
|
|
6
|
+
onOutput?: (data: string) => void;
|
|
7
|
+
}
|
|
8
|
+
export declare function runAgent(options: AgentRunnerOptions): Promise<number>;
|
|
9
|
+
//# sourceMappingURL=agent-runner.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"agent-runner.d.ts","sourceRoot":"","sources":["../../src/agent/agent-runner.ts"],"names":[],"mappings":"AAOA,MAAM,WAAW,kBAAkB;IACjC,IAAI,EAAE,MAAM,CAAC;IACb,MAAM,EAAE,MAAM,CAAC;IACf,KAAK,EAAE,MAAM,CAAC;IACd,MAAM,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;IAChC,QAAQ,CAAC,EAAE,CAAC,IAAI,EAAE,MAAM,KAAK,IAAI,CAAC;CACnC;AAED,wBAAsB,QAAQ,CAAC,OAAO,EAAE,kBAAkB,GAAG,OAAO,CAAC,MAAM,CAAC,CAsC3E"}
|
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.runAgent = runAgent;
|
|
4
|
+
const node_child_process_1 = require("node:child_process");
|
|
5
|
+
const promises_1 = require("node:fs/promises");
|
|
6
|
+
const node_os_1 = require("node:os");
|
|
7
|
+
const node_path_1 = require("node:path");
|
|
8
|
+
const node_crypto_1 = require("node:crypto");
|
|
9
|
+
const agent_defaults_js_1 = require("./agent-defaults.js");
|
|
10
|
+
async function runAgent(options) {
|
|
11
|
+
const { root, prompt, agent, agents, onOutput } = options;
|
|
12
|
+
const template = (0, agent_defaults_js_1.resolveAgentCommand)(agent, agents);
|
|
13
|
+
if (!template) {
|
|
14
|
+
throw new Error(`Unknown agent "${agent}". Available: ${Object.keys(agents ?? {}).join(', ') || 'claude, codex, opencode'}`);
|
|
15
|
+
}
|
|
16
|
+
// Write prompt to temp file (too large for CLI arg)
|
|
17
|
+
const tmpFile = (0, node_path_1.join)((0, node_os_1.tmpdir)(), `sdd-prompt-${(0, node_crypto_1.randomBytes)(6).toString('hex')}.md`);
|
|
18
|
+
await (0, promises_1.writeFile)(tmpFile, prompt, 'utf-8');
|
|
19
|
+
// Replace $PROMPT_FILE with the temp file path in the command template
|
|
20
|
+
const command = template.replace(/\$PROMPT_FILE/g, tmpFile);
|
|
21
|
+
try {
|
|
22
|
+
const exitCode = await new Promise((resolve, reject) => {
|
|
23
|
+
const child = (0, node_child_process_1.spawn)(command, {
|
|
24
|
+
cwd: root,
|
|
25
|
+
shell: true,
|
|
26
|
+
stdio: onOutput ? ['inherit', 'pipe', 'pipe'] : 'inherit',
|
|
27
|
+
});
|
|
28
|
+
if (onOutput && child.stdout) {
|
|
29
|
+
child.stdout.on('data', (data) => onOutput(data.toString()));
|
|
30
|
+
}
|
|
31
|
+
if (onOutput && child.stderr) {
|
|
32
|
+
child.stderr.on('data', (data) => onOutput(data.toString()));
|
|
33
|
+
}
|
|
34
|
+
child.on('error', reject);
|
|
35
|
+
child.on('close', (code) => resolve(code ?? 1));
|
|
36
|
+
});
|
|
37
|
+
return exitCode;
|
|
38
|
+
}
|
|
39
|
+
finally {
|
|
40
|
+
await (0, promises_1.unlink)(tmpFile).catch(() => { });
|
|
41
|
+
}
|
|
42
|
+
}
|
|
43
|
+
//# sourceMappingURL=agent-runner.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"agent-runner.js","sourceRoot":"","sources":["../../src/agent/agent-runner.ts"],"names":[],"mappings":";;AAeA,4BAsCC;AArDD,2DAA2C;AAC3C,+CAAqD;AACrD,qCAAiC;AACjC,yCAAiC;AACjC,6CAA0C;AAC1C,2DAA0D;AAUnD,KAAK,UAAU,QAAQ,CAAC,OAA2B;IACxD,MAAM,EAAE,IAAI,EAAE,MAAM,EAAE,KAAK,EAAE,MAAM,EAAE,QAAQ,EAAE,GAAG,OAAO,CAAC;IAE1D,MAAM,QAAQ,GAAG,IAAA,uCAAmB,EAAC,KAAK,EAAE,MAAM,CAAC,CAAC;IACpD,IAAI,CAAC,QAAQ,EAAE,CAAC;QACd,MAAM,IAAI,KAAK,CAAC,kBAAkB,KAAK,iBAAiB,MAAM,CAAC,IAAI,CAAC,MAAM,IAAI,EAAE,CAAC,CAAC,IAAI,CAAC,IAAI,CAAC,IAAI,yBAAyB,EAAE,CAAC,CAAC;IAC/H,CAAC;IAED,oDAAoD;IACpD,MAAM,OAAO,GAAG,IAAA,gBAAI,EAAC,IAAA,gBAAM,GAAE,EAAE,cAAc,IAAA,yBAAW,EAAC,CAAC,CAAC,CAAC,QAAQ,CAAC,KAAK,CAAC,KAAK,CAAC,CAAC;IAClF,MAAM,IAAA,oBAAS,EAAC,OAAO,EAAE,MAAM,EAAE,OAAO,CAAC,CAAC;IAE1C,uEAAuE;IACvE,MAAM,OAAO,GAAG,QAAQ,CAAC,OAAO,CAAC,gBAAgB,EAAE,OAAO,CAAC,CAAC;IAE5D,IAAI,CAAC;QACH,MAAM,QAAQ,GAAG,MAAM,IAAI,OA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FileStatus, SDDConfig, ChangeRequest, ChangeRequestFrontmatter, ChangeRequestStatus, Bug, BugFrontmatter, BugStatus, } from
|
|
3
|
-
export { SDDError, LockFileNotFoundError, ParseError, ProjectNotInitializedError } from
|
|
4
|
-
export type { ProjectInfo } from
|
|
5
|
-
export { isSDDProject, readConfig } from
|
|
1
|
+
export { SDD } from "./sdd.js";
|
|
2
|
+
export type { StoryFrontmatter, StoryFile, PendingItem, Delta, DeltaFile, ValidationResult, ValidationIssue, StoryStatus, StoryFileStatus, SDDConfig, ChangeRequest, ChangeRequestFrontmatter, ChangeRequestStatus, Bug, BugFrontmatter, BugStatus, } from "./types.js";
|
|
3
|
+
export { SDDError, LockFileNotFoundError, ParseError, ProjectNotInitializedError } from "./errors.js";
|
|
4
|
+
export type { ProjectInfo } from "./scaffold/templates.js";
|
|
5
|
+
export { isSDDProject, readConfig, writeConfig } from "./config/config-manager.js";
|
|
6
|
+
export { runAgent } from "./agent/agent-runner.js";
|
|
7
|
+
export type { AgentRunnerOptions } from "./agent/agent-runner.js";
|
|
8
|
+
export { DEFAULT_AGENTS, resolveAgentCommand } from "./agent/agent-defaults.js";
|
|
9
|
+
export { listSupportedAdapters, SKILL_ADAPTERS, syncSkillAdapters } from "./scaffold/skill-adapters.js";
|
|
10
|
+
export type { AdapterMode, SkillAdapterDefinition, SyncAdaptersOptions, AdapterFileAction, AdapterFileChange, SyncAdaptersResult, } from "./scaffold/skill-adapters.js";
|
|
6
11
|
//# sourceMappingURL=index.d.ts.map
|
package/dist/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,GAAG,EAAE,MAAM,UAAU,CAAC;AAC/B,YAAY,EACV,gBAAgB,EAChB,SAAS,EACT,WAAW,EACX,KAAK,EACL,SAAS,EACT,gBAAgB,EAChB,eAAe,EACf,WAAW,EACX,eAAe,EACf,SAAS,EACT,a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/dist/index.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.readConfig = exports.isSDDProject = exports.ProjectNotInitializedError = exports.ParseError = exports.LockFileNotFoundError = exports.SDDError = exports.SDD = void 0;
|
|
3
|
+
exports.syncSkillAdapters = exports.SKILL_ADAPTERS = exports.listSupportedAdapters = exports.resolveAgentCommand = exports.DEFAULT_AGENTS = exports.runAgent = exports.writeConfig = exports.readConfig = exports.isSDDProject = exports.ProjectNotInitializedError = exports.ParseError = exports.LockFileNotFoundError = exports.SDDError = exports.SDD = void 0;
|
|
4
4
|
var sdd_js_1 = require("./sdd.js");
|
|
5
5
|
Object.defineProperty(exports, "SDD", { enumerable: true, get: function () { return sdd_js_1.SDD; } });
|
|
6
6
|
var errors_js_1 = require("./errors.js");
|
|
@@ -11,4 +11,14 @@ Object.defineProperty(exports, "ProjectNotInitializedError", { enumerable: true,
|
|
|
11
11
|
var config_manager_js_1 = require("./config/config-manager.js");
|
|
12
12
|
Object.defineProperty(exports, "isSDDProject", { enumerable: true, get: function () { return config_manager_js_1.isSDDProject; } });
|
|
13
13
|
Object.defineProperty(exports, "readConfig", { enumerable: true, get: function () { return config_manager_js_1.readConfig; } });
|
|
14
|
+
Object.defineProperty(exports, "writeConfig", { enumerable: true, get: function () { return config_manager_js_1.writeConfig; } });
|
|
15
|
+
var agent_runner_js_1 = require("./agent/agent-runner.js");
|
|
16
|
+
Object.defineProperty(exports, "runAgent", { enumerable: true, get: function () { return agent_runner_js_1.runAgent; } });
|
|
17
|
+
var agent_defaults_js_1 = require("./agent/agent-defaults.js");
|
|
18
|
+
Object.defineProperty(exports, "DEFAULT_AGENTS", { enumerable: true, get: function () { return agent_defaults_js_1.DEFAULT_AGENTS; } });
|
|
19
|
+
Object.defineProperty(exports, "resolveAgentCommand", { enumerable: true, get: function () { return agent_defaults_js_1.resolveAgentCommand; } });
|
|
20
|
+
var skill_adapters_js_1 = require("./scaffold/skill-adapters.js");
|
|
21
|
+
Object.defineProperty(exports, "listSupportedAdapters", { enumerable: true, get: function () { return skill_adapters_js_1.listSupportedAdapters; } });
|
|
22
|
+
Object.defineProperty(exports, "SKILL_ADAPTERS", { enumerable: true, get: function () { return skill_adapters_js_1.SKILL_ADAPTERS; } });
|
|
23
|
+
Object.defineProperty(exports, "syncSkillAdapters", { enumerable: true, get: function () { return skill_adapters_js_1.syncSkillAdapters; } });
|
|
14
24
|
//# sourceMappingURL=index.js.map
|
package/dist/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":";;;AAAA,mCAA+B;AAAtB,6FAAA,GAAG,OAAA;AAmBZ,yCAAsG;AAA7F,qGAAA,QAAQ,OAAA;AAAE,kHAAA,qBAAqB,OAAA;AAAE,uGAAA,UAAU,OAAA;AAAE,uHAAA,0BAA0B,OAAA;AAEhF,
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":";;;AAAA,mCAA+B;AAAtB,6FAAA,GAAG,OAAA;AAmBZ,yCAAsG;AAA7F,qGAAA,QAAQ,OAAA;AAAE,kHAAA,qBAAqB,OAAA;AAAE,uGAAA,UAAU,OAAA;AAAE,uHAAA,0BAA0B,OAAA;AAEhF,gEAAmF;AAA1E,iHAAA,YAAY,OAAA;AAAE,+GAAA,UAAU,OAAA;AAAE,gHAAA,WAAW,OAAA;AAC9C,2DAAmD;AAA1C,2GAAA,QAAQ,OAAA;AAEjB,+DAAgF;AAAvE,mHAAA,cAAc,OAAA;AAAE,wHAAA,mBAAmB,OAAA;AAC5C,kEAAwG;AAA/F,0HAAA,qBAAqB,OAAA;AAAE,mHAAA,cAAc,OAAA;AAAE,sHAAA,iBAAiB,OAAA"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"apply-prompt-generator.d.ts","sourceRoot":"","sources":["../../src/prompt/apply-prompt-generator.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,GAAG,EAAE,aAAa,EAAE,SAAS,EAAE,MAAM,aAAa,CAAC;AAGjE,wBAAgB,mBAAmB,CACjC,IAAI,EAAE,GAAG,EAAE,EACX,cAAc,EAAE,aAAa,EAAE,EAC/B,YAAY,EAAE,SAAS,EAAE,EACzB,IAAI,EAAE,MAAM,GACX,MAAM,GAAG,IAAI,CAiDf"}
|
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.generateApplyPrompt = generateApplyPrompt;
|
|
4
|
+
const git_js_1 = require("../git/git.js");
|
|
5
|
+
function generateApplyPrompt(bugs, changeRequests, pendingFiles, root) {
|
|
6
|
+
if (bugs.length === 0 && changeRequests.length === 0 && pendingFiles.length === 0) {
|
|
7
|
+
return null;
|
|
8
|
+
}
|
|
9
|
+
const sections = [];
|
|
10
|
+
// Bugs
|
|
11
|
+
if (bugs.length > 0) {
|
|
12
|
+
const lines = [`## Open bugs (${bugs.length})\n`];
|
|
13
|
+
for (const bug of bugs) {
|
|
14
|
+
lines.push(`### \`${bug.relativePath}\` — ${bug.frontmatter.title}\n`);
|
|
15
|
+
lines.push(bug.body.trim());
|
|
16
|
+
lines.push('');
|
|
17
|
+
}
|
|
18
|
+
sections.push(lines.join('\n'));
|
|
19
|
+
}
|
|
20
|
+
// Change Requests
|
|
21
|
+
if (changeRequests.length > 0) {
|
|
22
|
+
const lines = [`## Pending change requests (${changeRequests.length})\n`];
|
|
23
|
+
for (const cr of changeRequests) {
|
|
24
|
+
lines.push(`### \`${cr.relativePath}\` — ${cr.frontmatter.title}\n`);
|
|
25
|
+
lines.push(cr.body.trim());
|
|
26
|
+
lines.push('');
|
|
27
|
+
}
|
|
28
|
+
sections.push(lines.join('\n'));
|
|
29
|
+
}
|
|
30
|
+
// Pending files
|
|
31
|
+
if (pendingFiles.length > 0) {
|
|
32
|
+
const lines = [`## Pending files (${pendingFiles.length})\n`];
|
|
33
|
+
for (const f of pendingFiles) {
|
|
34
|
+
lines.push(`- \`${f.relativePath}\` — **${f.frontmatter.status}**`);
|
|
35
|
+
}
|
|
36
|
+
const changed = pendingFiles.filter((f) => f.frontmatter.status === 'changed');
|
|
37
|
+
for (const f of changed) {
|
|
38
|
+
const diff = (0, git_js_1.getFileDiff)(root, f.relativePath);
|
|
39
|
+
if (diff) {
|
|
40
|
+
lines.push('');
|
|
41
|
+
lines.push(`### Diff: \`${f.relativePath}\`\n\n\`\`\`diff\n${diff}\n\`\`\``);
|
|
42
|
+
}
|
|
43
|
+
}
|
|
44
|
+
sections.push(lines.join('\n'));
|
|
45
|
+
}
|
|
46
|
+
return sections.join('\n\n');
|
|
47
|
+
}
|
|
48
|
+
//# sourceMappingURL=apply-prompt-generator.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"apply-prompt-generator.js","sourceRoot":"","sources":["../../src/prompt/apply-prompt-generator.ts"],"names":[],"mappings":";;AAGA,kDAsDC;AAxDD,0CAA4C;AAE5C,SAAgB,mBAAmB,CACjC,IAAW,EACX,cAA+B,EAC/B,YAAyB,EACzB,IAAY;IAEZ,IAAI,IAAI,CAAC,MAAM,KAAK,CAAC,IAAI,cAAc,CAAC,MAAM,KAAK,CAAC,IAAI,YAAY,CAAC,MAAM,KAAK,CAAC,EAAE,CAAC;QAClF,OAAO,IAAI,CAAC;IACd,CAAC;IAED,MAAM,QAAQ,GAAa,EAAE,CAAC;IAE9B,OAAO;IACP,IAAI,IAAI,CAAC,MAAM,GAAG,CAAC,EAAE,CAAC;QACpB,MAAM,KAAK,GAAG,CAAC,iBAAiB,IAAI,CAAC,MAAM,KAAK,CAAC,CAAC;QAClD,KAAK,MAAM,GAAG,IAAI,IAAI,EAAE,CAAC;YACvB,KAAK,CAAC,IAAI,CAAC,SAAS,GAAG,CAAC,YAAY,QAAQ,GAAG,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AAS,CAAC,CAAC;QAC/E,KAAK,MAAM,CAAC,IAAI,OAAO,EAAE,CAAC;YACxB,MAAM,IAAI,GAAG,IAAA,oBAAW,EAAC,IAAI,EAAE,CAAC,CAAC,YAAY,CAAC,CAAC;YAC/C,IAAI,IAAI,EAAE,CAAC;gBACT,KAAK,CAAC,IAAI,CAAC,EAAE,CAAC,CAAC;gBACf,KAAK,CAAC,IAAI,CAAC,eAAe,CAAC,CAAC,YAAY,qBAAqB,IAAI,UAAU,CAAC,CAAC;YAC/E,CAAC;QACH,CAAC;QAED,QAAQ,CAAC,IAAI,CAAC,KAAK,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC,CAAC;IAClC,CAAC;IAED,OAAO,QAAQ,CAAC,IAAI,CAAC,MAAM,CAAC,CAAC;AAC/B,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"prompt-generator.d.ts","sourceRoot":"","sources":["../../src/prompt/prompt-generator.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,aAAa,CAAC;AAG7C,wBAAgB,cAAc,CAAC,KAAK,EAAE,SAAS,EAAE,EAAE,IAAI,CAAC,EAAE,MAAM,GAAG,MAAM,
|
|
1
|
+
{"version":3,"file":"prompt-generator.d.ts","sourceRoot":"","sources":["../../src/prompt/prompt-generator.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,aAAa,CAAC;AAG7C,wBAAgB,cAAc,CAAC,KAAK,EAAE,SAAS,EAAE,EAAE,IAAI,CAAC,EAAE,MAAM,GAAG,MAAM,CAmCxE"}
|
|
@@ -3,38 +3,34 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
3
3
|
exports.generatePrompt = generatePrompt;
|
|
4
4
|
const git_js_1 = require("../git/git.js");
|
|
5
5
|
function generatePrompt(files, root) {
|
|
6
|
-
const sections = [];
|
|
7
|
-
sections.push('# SDD Sync Prompt\n\nThis project uses Story Driven Development. Implement the changes described below.');
|
|
8
6
|
if (files.length === 0) {
|
|
9
|
-
|
|
10
|
-
return sections.join('\n\n');
|
|
7
|
+
return 'Nothing to do — all files are synced.';
|
|
11
8
|
}
|
|
12
|
-
const
|
|
9
|
+
const sections = [];
|
|
10
|
+
const lines = [`## Pending files (${files.length})\n`];
|
|
13
11
|
for (const f of files) {
|
|
14
12
|
lines.push(`- \`${f.relativePath}\` — **${f.frontmatter.status}**`);
|
|
15
13
|
}
|
|
16
|
-
lines.push('');
|
|
17
|
-
lines.push('Read each file listed above before implementing.');
|
|
18
14
|
sections.push(lines.join('\n'));
|
|
19
|
-
//
|
|
15
|
+
// Git diff for changed files
|
|
20
16
|
if (root) {
|
|
21
17
|
const changed = files.filter((f) => f.frontmatter.status === 'changed');
|
|
22
18
|
for (const f of changed) {
|
|
23
19
|
const diff = (0, git_js_1.getFileDiff)(root, f.relativePath);
|
|
24
20
|
if (diff) {
|
|
25
|
-
sections.push(`##
|
|
21
|
+
sections.push(`## Diff: \`${f.relativePath}\`\n\n\`\`\`diff\n${diff}\n\`\`\``);
|
|
26
22
|
}
|
|
27
23
|
}
|
|
28
24
|
}
|
|
25
|
+
// Deleted files
|
|
29
26
|
const deleted = files.filter((f) => f.frontmatter.status === 'deleted');
|
|
30
27
|
if (deleted.length > 0) {
|
|
31
28
|
const delLines = ['## Files to remove\n'];
|
|
32
29
|
for (const f of deleted) {
|
|
33
|
-
delLines.push(`- \`${f.relativePath}
|
|
30
|
+
delLines.push(`- \`${f.relativePath}\``);
|
|
34
31
|
}
|
|
35
32
|
sections.push(delLines.join('\n'));
|
|
36
33
|
}
|
|
37
|
-
sections.push(`## Instructions\n\n1. Read each file listed above\n2. For **new** files: implement what the documentation describes\n3. For **changed** files: update the code to match the updated documentation (see diff above)\n4. For **deleted** files: remove the related code from \`code/\`\n5. If a file has a \`## Agent Notes\` section, respect those constraints\n6. All code goes inside \`code/\`\n7. After implementing each file, run \`sdd mark-synced <file>\`\n8. **Immediately after mark-synced, commit**: \`git add -A && git commit -m "sdd sync: <description>"\`\n9. When done with all files, list every file you created or modified`);
|
|
38
34
|
return sections.join('\n\n');
|
|
39
35
|
}
|
|
40
36
|
//# sourceMappingURL=prompt-generator.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"prompt-generator.js","sourceRoot":"","sources":["../../src/prompt/prompt-generator.ts"],"names":[],"mappings":";;AAGA,
|
|
1
|
+
{"version":3,"file":"prompt-generator.js","sourceRoot":"","sources":["../../src/prompt/prompt-generator.ts"],"names":[],"mappings":";;AAGA,wCAmCC;AArCD,0CAA4C;AAE5C,SAAgB,cAAc,CAAC,KAAkB,EAAE,IAAa;IAC9D,IAAI,KAAK,CAAC,MAAM,KAAK,CAAC,EAAE,CAAC;QACvB,OAAO,uCAAuC,CAAC;IACjD,CAAC;IAED,MAAM,QAAQ,GAAa,EAAE,CAAC;IAE9B,MAAM,KAAK,GAAG,CAAC,qBAAqB,KAAK,CAAC,MAAM,KAAK,CAAC,CAAC;IACvD,KAAK,MAAM,CAAC,IAAI,KAAK,EAAE,CAAC;QACtB,KAAK,CAAC,IAAI,CAAC,OAAO,CAAC,CAAC,YAAY,UAAU,CAAC,CAAC,WAAW,CAAC,MAAM,IAAI,CAAC,CAAC;IACtE,CAAC;IACD,QAAQ,CAAC,IAAI,CAAC,KAAK,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC,CAAC;IAEhC,6BAA6B;IAC7B,IAAI,IAAI,EAAE,CAAC;QACT,MAAM,OAAO,GAAG,KAAK,CAAC,MAAM,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,WAAW,CAAC,MAAM,KAAK,SAAS,CAAC,CAAC;QACxE,KAAK,MAAM,CAAC,IAAI,OAAO,EAAE,CAAC;YACxB,MAAM,IAAI,GAAG,IAAA,oBAAW,EAAC,IAAI,EAAE,CAAC,CAAC,YAAY,CAAC,CAAC;YAC/C,IAAI,IAAI,EAAE,CAAC;gBACT,QAAQ,CAAC,IAAI,CAAC,cAAc,CAAC,CAAC,YAAY,qBAAqB,IAAI,UAAU,CAAC,CAAC;YACjF,CAAC;QACH,CAAC;IACH,CAAC;IAED,gBAAgB;IAChB,MAAM,OAAO,GAAG,KAAK,CAAC,MAAM,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,WAAW,CAAC,MAAM,KAAK,SAAS,CAAC,CAAC;IACxE,IAAI,OAAO,CAAC,MAAM,GAAG,CAAC,EAAE,CAAC;QACvB,MAAM,QAAQ,GAAG,CAAC,sBAAsB,CAAC,CAAC;QAC1C,KAAK,MAAM,CAAC,IAAI,OAAO,EAAE,CAAC;YACxB,QAAQ,CAAC,IAAI,CAAC,OAAO,CAAC,CAAC,YAAY,IAAI,CAAC,CAAC;QAC3C,CAAC;QACD,QAAQ,CAAC,IAAI,CAAC,QAAQ,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC,CAAC;IACrC,CAAC;IAED,OAAO,QAAQ,CAAC,IAAI,CAAC,MAAM,CAAC,CAAC;AAC/B,CAAC"}
|
package/dist/scaffold/init.d.ts
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"init.d.ts","sourceRoot":"","sources":["../../src/scaffold/init.ts"],"names":[],"mappings":"AAGA,OAAO,
|
|
1
|
+
{"version":3,"file":"init.d.ts","sourceRoot":"","sources":["../../src/scaffold/init.ts"],"names":[],"mappings":"AAGA,OAAO,EAAE,KAAK,WAAW,EAAE,MAAM,gBAAgB,CAAC;AAMlD,wBAAsB,WAAW,CAAC,IAAI,EAAE,MAAM,EAAE,IAAI,CAAC,EAAE,WAAW,GAAG,OAAO,CAAC,MAAM,EAAE,CAAC,CAwCrF"}
|
package/dist/scaffold/init.js
CHANGED
|
@@ -4,7 +4,7 @@ exports.initProject = initProject;
|
|
|
4
4
|
const promises_1 = require("node:fs/promises");
|
|
5
5
|
const node_fs_1 = require("node:fs");
|
|
6
6
|
const node_path_1 = require("node:path");
|
|
7
|
-
const
|
|
7
|
+
const skill_adapters_js_1 = require("./skill-adapters.js");
|
|
8
8
|
const config_manager_js_1 = require("../config/config-manager.js");
|
|
9
9
|
const git_js_1 = require("../git/git.js");
|
|
10
10
|
async function initProject(root, info) {
|
|
@@ -13,7 +13,7 @@ async function initProject(root, info) {
|
|
|
13
13
|
// Ensure git repo
|
|
14
14
|
if (!(0, git_js_1.isGitRepo)(root)) {
|
|
15
15
|
(0, git_js_1.gitInit)(root);
|
|
16
|
-
createdFiles.push(
|
|
16
|
+
createdFiles.push(".git");
|
|
17
17
|
}
|
|
18
18
|
// Create .sdd directory
|
|
19
19
|
if (!(0, node_fs_1.existsSync)(sddDir)) {
|
|
@@ -21,43 +21,24 @@ async function initProject(root, info) {
|
|
|
21
21
|
}
|
|
22
22
|
// Write config
|
|
23
23
|
const config = {
|
|
24
|
-
description: info?.description ??
|
|
24
|
+
description: info?.description ?? "",
|
|
25
25
|
};
|
|
26
26
|
await (0, config_manager_js_1.writeConfig)(root, config);
|
|
27
|
-
createdFiles.push(
|
|
27
|
+
createdFiles.push(".sdd/config.yaml");
|
|
28
28
|
// Create directory structure
|
|
29
|
-
const dirs = [
|
|
29
|
+
const dirs = ["product", "product/features", "system", "code", "change-requests", "bugs"];
|
|
30
30
|
for (const dir of dirs) {
|
|
31
31
|
const absDir = (0, node_path_1.resolve)(root, dir);
|
|
32
32
|
if (!(0, node_fs_1.existsSync)(absDir)) {
|
|
33
33
|
await (0, promises_1.mkdir)(absDir, { recursive: true });
|
|
34
34
|
}
|
|
35
35
|
}
|
|
36
|
-
// Create agent
|
|
37
|
-
const
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
}
|
|
42
|
-
// Create agent instruction pointers
|
|
43
|
-
const POINTER = 'Read INSTRUCTIONS.md in the project root for all instructions.\n';
|
|
44
|
-
const agentFiles = [
|
|
45
|
-
{ path: '.claude/CLAUDE.md', dir: '.claude' },
|
|
46
|
-
{ path: '.github/copilot-instructions.md', dir: '.github' },
|
|
47
|
-
{ path: '.cursorrules' },
|
|
48
|
-
];
|
|
49
|
-
for (const entry of agentFiles) {
|
|
50
|
-
const absPath = (0, node_path_1.resolve)(root, entry.path);
|
|
51
|
-
if ((0, node_fs_1.existsSync)(absPath))
|
|
52
|
-
continue;
|
|
53
|
-
if (entry.dir) {
|
|
54
|
-
const absDir = (0, node_path_1.resolve)(root, entry.dir);
|
|
55
|
-
if (!(0, node_fs_1.existsSync)(absDir)) {
|
|
56
|
-
await (0, promises_1.mkdir)(absDir, { recursive: true });
|
|
57
|
-
}
|
|
36
|
+
// Create canonical skill and agent adapters
|
|
37
|
+
const adapters = await (0, skill_adapters_js_1.syncSkillAdapters)(root);
|
|
38
|
+
for (const change of [...adapters.canonical, ...adapters.adapters]) {
|
|
39
|
+
if (change.action === "created") {
|
|
40
|
+
createdFiles.push(change.path);
|
|
58
41
|
}
|
|
59
|
-
await (0, promises_1.writeFile)(absPath, POINTER, 'utf-8');
|
|
60
|
-
createdFiles.push(entry.path);
|
|
61
42
|
}
|
|
62
43
|
return createdFiles;
|
|
63
44
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"init.js","sourceRoot":"","sources":["../../src/scaffold/init.ts"],"names":[],"mappings":";;
|
|
1
|
+
{"version":3,"file":"init.js","sourceRoot":"","sources":["../../src/scaffold/init.ts"],"names":[],"mappings":";;AASA,kCAwCC;AAjDD,+CAAyC;AACzC,qCAAqC;AACrC,yCAAoC;AAEpC,2DAAwD;AACxD,mEAAsE;AACtE,0CAAmD;AAG5C,KAAK,UAAU,WAAW,CAAC,IAAY,EAAE,IAAkB;IAChE,MAAM,YAAY,GAAa,EAAE,CAAC;IAClC,MAAM,MAAM,GAAG,IAAA,8BAAU,EAAC,IAAI,CAAC,CAAC;IAEhC,kBAAkB;IAClB,IAAI,CAAC,IAAA,kBAAS,EAAC,IAAI,CAAC,EAAE,CAAC;QACrB,IAAA,gBAAO,EAAC,IAAI,CAAC,CAAC;QACd,YAAY,CAA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0 +1,39 @@
|
|
|
1
|
+
export type AdapterMode = "pointer" | "mirror";
|
|
2
|
+
export interface SkillPathsDefinition {
|
|
3
|
+
skillId: string;
|
|
4
|
+
paths: string[];
|
|
5
|
+
}
|
|
6
|
+
export interface SkillAdapterDefinition {
|
|
7
|
+
id: string;
|
|
8
|
+
mode: AdapterMode;
|
|
9
|
+
skills: SkillPathsDefinition[];
|
|
10
|
+
}
|
|
11
|
+
export interface SyncAdaptersOptions {
|
|
12
|
+
agents?: string[];
|
|
13
|
+
force?: boolean;
|
|
14
|
+
dryRun?: boolean;
|
|
15
|
+
}
|
|
16
|
+
export type AdapterFileAction = "created" | "updated" | "skipped";
|
|
17
|
+
export interface AdapterFileChange {
|
|
18
|
+
path: string;
|
|
19
|
+
action: AdapterFileAction;
|
|
20
|
+
reason?: string;
|
|
21
|
+
}
|
|
22
|
+
export interface SyncAdaptersResult {
|
|
23
|
+
canonical: AdapterFileChange[];
|
|
24
|
+
adapters: AdapterFileChange[];
|
|
25
|
+
selectedAgents: string[];
|
|
26
|
+
}
|
|
27
|
+
export interface SkillPathsDefinition {
|
|
28
|
+
skillId: string;
|
|
29
|
+
paths: string[];
|
|
30
|
+
}
|
|
31
|
+
export interface SkillAdapterDefinition {
|
|
32
|
+
id: string;
|
|
33
|
+
mode: AdapterMode;
|
|
34
|
+
skills: SkillPathsDefinition[];
|
|
35
|
+
}
|
|
36
|
+
export declare const SKILL_ADAPTERS: SkillAdapterDefinition[];
|
|
37
|
+
export declare function listSupportedAdapters(): string[];
|
|
38
|
+
export declare function syncSkillAdapters(root: string, options?: SyncAdaptersOptions): Promise<SyncAdaptersResult>;
|
|
39
|
+
//# sourceMappingURL=skill-adapters.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"skill-adapters.d.ts","sourceRoot":"","sources":["../../src/scaffold/skill-adapters.ts"],"names":[],"mappings":"AAcA,MAAM,MAAM,WAAW,GAAG,SAAS,GAAG,QAAQ,CAAC;AAE/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perty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.SKILL_ADAPTERS = void 0;
|
|
4
|
+
exports.listSupportedAdapters = listSupportedAdapters;
|
|
5
|
+
exports.syncSkillAdapters = syncSkillAdapters;
|
|
6
|
+
const promises_1 = require("node:fs/promises");
|
|
7
|
+
const node_fs_1 = require("node:fs");
|
|
8
|
+
const node_path_1 = require("node:path");
|
|
9
|
+
const templates_js_1 = require("./templates.js");
|
|
10
|
+
const MANAGED_HEADER = "<!-- AUTO-GENERATED BY SDD. DO NOT EDIT MANUALLY. -->\n";
|
|
11
|
+
const CANONICAL_BASE_DIR = ".sdd/skill";
|
|
12
|
+
const CANONICAL_SKILLS = [
|
|
13
|
+
{
|
|
14
|
+
id: "sdd",
|
|
15
|
+
files: [
|
|
16
|
+
{
|
|
17
|
+
path: `${CANONICAL_BASE_DIR}/sdd/SKILL.md`,
|
|
18
|
+
content: templates_js_1.SKILL_MD_TEMPLATE,
|
|
19
|
+
},
|
|
20
|
+
{
|
|
21
|
+
path: `${CANONICAL_BASE_DIR}/sdd/references/file-format.md`,
|
|
22
|
+
content: templates_js_1.FILE_FORMAT_REFERENCE,
|
|
23
|
+
},
|
|
24
|
+
{
|
|
25
|
+
path: `${CANONICAL_BASE_DIR}/sdd/references/change-requests.md`,
|
|
26
|
+
content: templates_js_1.CHANGE_REQUESTS_REFERENCE,
|
|
27
|
+
},
|
|
28
|
+
{
|
|
29
|
+
path: `${CANONICAL_BASE_DIR}/sdd/references/bugs.md`,
|
|
30
|
+
content: templates_js_1.BUGS_REFERENCE,
|
|
31
|
+
},
|
|
32
|
+
],
|
|
33
|
+
},
|
|
34
|
+
{
|
|
35
|
+
id: "sdd-ui",
|
|
36
|
+
files: [
|
|
37
|
+
{
|
|
38
|
+
path: `${CANONICAL_BASE_DIR}/sdd-ui/SKILL.md`,
|
|
39
|
+
content: templates_js_1.SKILL_UI_MD_TEMPLATE,
|
|
40
|
+
},
|
|
41
|
+
],
|
|
42
|
+
},
|
|
43
|
+
];
|
|
44
|
+
const CANONICAL_FILES = CANONICAL_SKILLS.flatMap((skill) => skill.files);
|
|
45
|
+
exports.SKILL_ADAPTERS = [
|
|
46
|
+
{
|
|
47
|
+
id: "claude",
|
|
48
|
+
mode: "mirror",
|
|
49
|
+
skills: [
|
|
50
|
+
{
|
|
51
|
+
skillId: "sdd",
|
|
52
|
+
paths: [
|
|
53
|
+
".claude/skills/sdd/SKILL.md",
|
|
54
|
+
".claude/skills/sdd/references/file-format.md",
|
|
55
|
+
".claude/skills/sdd/references/change-requests.md",
|
|
56
|
+
".claude/skills/sdd/references/bugs.md",
|
|
57
|
+
],
|
|
58
|
+
},
|
|
59
|
+
{
|
|
60
|
+
skillId: "sdd-ui",
|
|
61
|
+
paths: [".claude/skills/sdd-ui/SKILL.md"],
|
|
62
|
+
},
|
|
63
|
+
],
|
|
64
|
+
},
|
|
65
|
+
{
|
|
66
|
+
id: "universal",
|
|
67
|
+
mode: "mirror",
|
|
68
|
+
skills: [
|
|
69
|
+
{
|
|
70
|
+
skillId: "sdd",
|
|
71
|
+
paths: [
|
|
72
|
+
".agents/skills/sdd/SKILL.md",
|
|
73
|
+
".agents/skills/sdd/references/file-format.md",
|
|
74
|
+
".agents/skills/sdd/references/change-requests.md",
|
|
75
|
+
".agents/skills/sdd/references/bugs.md",
|
|
76
|
+
],
|
|
77
|
+
},
|
|
78
|
+
{
|
|
79
|
+
skillId: "sdd-ui",
|
|
80
|
+
paths: [".agents/skills/sdd-ui/SKILL.md"],
|
|
81
|
+
},
|
|
82
|
+
],
|
|
83
|
+
},
|
|
84
|
+
];
|
|
85
|
+
function listSupportedAdapters() {
|
|
86
|
+
return exports.SKILL_ADAPTERS.map((adapter) => adapter.id);
|
|
87
|
+
}
|
|
88
|
+
async function syncSkillAdapters(root, options) {
|
|
89
|
+
const force = options?.force ?? false;
|
|
90
|
+
const dryRun = options?.dryRun ?? false;
|
|
91
|
+
const selected = resolveSelectedAdapters(options?.agents);
|
|
92
|
+
// Build a map of skillId → canonical files for quick lookup
|
|
93
|
+
const canonicalFilesBySkill = new Map();
|
|
94
|
+
for (const skill of CANONICAL_SKILLS) {
|
|
95
|
+
canonicalFilesBySkill.set(skill.id, skill.files);
|
|
96
|
+
}
|
|
97
|
+
const canonicalChanges = [];
|
|
98
|
+
for (const file of CANONICAL_FILES) {
|
|
99
|
+
const change = await upsertFile(root, file.path, file.content, {
|
|
100
|
+
force,
|
|
101
|
+
dryRun,
|
|
102
|
+
managed: false,
|
|
103
|
+
});
|
|
104
|
+
canonicalChanges.push(change);
|
|
105
|
+
}
|
|
106
|
+
const adapterChanges = [];
|
|
107
|
+
for (const adapter of selected) {
|
|
108
|
+
for (const skillDef of adapter.skills) {
|
|
109
|
+
const canonicalFiles = canonicalFilesBySkill.get(skillDef.skillId);
|
|
110
|
+
if (adapter.mode === "pointer") {
|
|
111
|
+
const content = buildPointerContent(adapter.id, skillDef.skillId);
|
|
112
|
+
for (const path of skillDef.paths) {
|
|
113
|
+
const change = await upsertFile(root, path, content, {
|
|
114
|
+
force,
|
|
115
|
+
dryRun,
|
|
116
|
+
managed: true,
|
|
117
|
+
});
|
|
118
|
+
adapterChanges.push(change);
|
|
119
|
+
}
|
|
120
|
+
continue;
|
|
121
|
+
}
|
|
122
|
+
// mirror mode: copy canonical content to adapter paths
|
|
123
|
+
if (!canonicalFiles) {
|
|
124
|
+
for (const path of skillDef.paths) {
|
|
125
|
+
adapterChanges.push({
|
|
126
|
+
path,
|
|
127
|
+
action: "skipped",
|
|
128
|
+
reason: `No canonical files found for skill "${skillDef.skillId}"`,
|
|
129
|
+
});
|
|
130
|
+
}
|
|
131
|
+
continue;
|
|
132
|
+
}
|
|
133
|
+
for (let i = 0; i < skillDef.paths.length; i += 1) {
|
|
134
|
+
const canonical = canonicalFiles[i];
|
|
135
|
+
if (!canonical) {
|
|
136
|
+
adapterChanges.push({
|
|
137
|
+
path: skillDef.paths[i],
|
|
138
|
+
action: "skipped",
|
|
139
|
+
reason: "No corresponding canonical source file",
|
|
140
|
+
});
|
|
141
|
+
continue;
|
|
142
|
+
}
|
|
143
|
+
const change = await upsertFile(root, skillDef.paths[i], canonical.content, {
|
|
144
|
+
force,
|
|
145
|
+
dryRun,
|
|
146
|
+
managed: false,
|
|
147
|
+
});
|
|
148
|
+
adapterChanges.push(change);
|
|
149
|
+
}
|
|
150
|
+
}
|
|
151
|
+
}
|
|
152
|
+
return {
|
|
153
|
+
canonical: canonicalChanges,
|
|
154
|
+
adapters: adapterChanges,
|
|
155
|
+
selectedAgents: selected.map((adapter) => adapter.id),
|
|
156
|
+
};
|
|
157
|
+
}
|
|
158
|
+
function resolveSelectedAdapters(agents) {
|
|
159
|
+
if (!agents || agents.length === 0) {
|
|
160
|
+
return exports.SKILL_ADAPTERS;
|
|
161
|
+
}
|
|
162
|
+
const normalized = new Set(agents.map((agent) => agent.trim().toLowerCase()).filter(Boolean));
|
|
163
|
+
const selected = exports.SKILL_ADAPTERS.filter((adapter) => normalized.has(adapter.id));
|
|
164
|
+
const missing = Array.from(normalized).filter((agent) => !exports.SKILL_ADAPTERS.some((adapter) => adapter.id === agent));
|
|
165
|
+
if (missing.length > 0) {
|
|
166
|
+
throw new Error(`Unsupported adapters: ${missing.join(", ")}`);
|
|
167
|
+
}
|
|
168
|
+
return selected;
|
|
169
|
+
}
|
|
170
|
+
function buildPointerContent(adapterId, skillId) {
|
|
171
|
+
if (adapterId === "cursor") {
|
|
172
|
+
return `---
|
|
173
|
+
description: SDD ${skillId} adapter
|
|
174
|
+
alwaysApply: false
|
|
175
|
+
---
|
|
176
|
+
|
|
177
|
+
Read .sdd/skill/${skillId}/SKILL.md for the full SDD ${skillId} workflow.
|
|
178
|
+
|
|
179
|
+
If needed, also read the references in .sdd/skill/${skillId}/references/
|
|
180
|
+
`;
|
|
181
|
+
}
|
|
182
|
+
return `# SDD ${skillId} Adapter (${adapterId})
|
|
183
|
+
|
|
184
|
+
Primary instructions: .sdd/skill/${skillId}/SKILL.md
|
|
185
|
+
|
|
186
|
+
References:
|
|
187
|
+
- .sdd/skill/${skillId}/references/
|
|
188
|
+
|
|
189
|
+
Fallback (legacy): .claude/skills/${skillId}/SKILL.md
|
|
190
|
+
`;
|
|
191
|
+
}
|
|
192
|
+
async function upsertFile(root, relativePath, content, options) {
|
|
193
|
+
const absPath = (0, node_path_1.resolve)(root, relativePath);
|
|
194
|
+
const finalContent = options.managed
|
|
195
|
+
? `${MANAGED_HEADER}${content}`
|
|
196
|
+
: content;
|
|
197
|
+
if (!(0, node_fs_1.existsSync)(absPath)) {
|
|
198
|
+
if (!options.dryRun) {
|
|
199
|
+
await (0, promises_1.mkdir)((0, node_path_1.dirname)(absPath), { recursive: true });
|
|
200
|
+
await (0, promises_1.writeFile)(absPath, finalContent, "utf-8");
|
|
201
|
+
}
|
|
202
|
+
return { path: relativePath, action: "created" };
|
|
203
|
+
}
|
|
204
|
+
const current = await (0, promises_1.readFile)(absPath, "utf-8");
|
|
205
|
+
if (current === finalContent) {
|
|
206
|
+
return {
|
|
207
|
+
path: relativePath,
|
|
208
|
+
action: "skipped",
|
|
209
|
+
reason: "Already up to date",
|
|
210
|
+
};
|
|
211
|
+
}
|
|
212
|
+
if (!options.force) {
|
|
213
|
+
return {
|
|
214
|
+
path: relativePath,
|
|
215
|
+
action: "skipped",
|
|
216
|
+
reason: "Exists (use --force to overwrite)",
|
|
217
|
+
};
|
|
218
|
+
}
|
|
219
|
+
if (!options.dryRun) {
|
|
220
|
+
await (0, promises_1.writeFile)(absPath, finalContent, "utf-8");
|
|
221
|
+
}
|
|
222
|
+
return { path: relativePath, action: "updated" };
|
|
223
|
+
}
|
|
224
|
+
//# sourceMappingURL=skill-adapters.js.map
|