daedalion 0.0.1 → 0.1.0
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 +20 -5
- package/bin/daedalion.js +12 -5
- package/dist/commands/build.d.ts +3 -0
- package/dist/commands/build.d.ts.map +1 -0
- package/dist/commands/build.js +167 -0
- package/dist/commands/build.js.map +1 -0
- package/dist/commands/clean.d.ts +2 -0
- package/dist/commands/clean.d.ts.map +1 -0
- package/dist/commands/clean.js +106 -0
- package/dist/commands/clean.js.map +1 -0
- package/dist/commands/init.d.ts +3 -0
- package/dist/commands/init.d.ts.map +1 -0
- package/dist/commands/init.js +83 -0
- package/dist/commands/init.js.map +1 -0
- package/dist/commands/validate.d.ts +2 -0
- package/dist/commands/validate.d.ts.map +1 -0
- package/dist/commands/validate.js +119 -0
- package/dist/commands/validate.js.map +1 -0
- package/dist/config.d.ts +5 -0
- package/dist/config.d.ts.map +1 -0
- package/dist/config.js +101 -0
- package/dist/config.js.map +1 -0
- package/dist/generators/agent.d.ts +3 -0
- package/dist/generators/agent.d.ts.map +1 -0
- package/dist/generators/agent.js +105 -0
- package/dist/generators/agent.js.map +1 -0
- package/dist/generators/instructions.d.ts +3 -0
- package/dist/generators/instructions.d.ts.map +1 -0
- package/{src → dist}/generators/instructions.js +42 -52
- package/dist/generators/instructions.js.map +1 -0
- package/dist/generators/prompt.d.ts +4 -0
- package/dist/generators/prompt.d.ts.map +1 -0
- package/{src → dist}/generators/prompt.js +96 -102
- package/dist/generators/prompt.js.map +1 -0
- package/dist/generators/skill.d.ts +3 -0
- package/dist/generators/skill.d.ts.map +1 -0
- package/dist/generators/skill.js +89 -0
- package/dist/generators/skill.js.map +1 -0
- package/dist/generators/tools.d.ts +3 -0
- package/dist/generators/tools.d.ts.map +1 -0
- package/dist/generators/tools.js +192 -0
- package/dist/generators/tools.js.map +1 -0
- package/dist/generators/workflow.d.ts +3 -0
- package/dist/generators/workflow.d.ts.map +1 -0
- package/{src → dist}/generators/workflow.js +47 -53
- package/dist/generators/workflow.js.map +1 -0
- package/dist/index.d.ts +16 -0
- package/dist/index.d.ts.map +1 -0
- package/{src → dist}/index.js +1 -0
- package/dist/index.js.map +1 -0
- package/dist/parsers/proposal.d.ts +3 -0
- package/dist/parsers/proposal.d.ts.map +1 -0
- package/dist/parsers/proposal.js +45 -0
- package/dist/parsers/proposal.js.map +1 -0
- package/dist/parsers/spec.d.ts +3 -0
- package/dist/parsers/spec.d.ts.map +1 -0
- package/dist/parsers/spec.js +87 -0
- package/dist/parsers/spec.js.map +1 -0
- package/dist/parsers/tasks.d.ts +4 -0
- package/dist/parsers/tasks.d.ts.map +1 -0
- package/dist/parsers/tasks.js +39 -0
- package/dist/parsers/tasks.js.map +1 -0
- package/dist/types.d.ts +107 -0
- package/dist/types.d.ts.map +1 -0
- package/dist/types.js +2 -0
- package/dist/types.js.map +1 -0
- package/dist/utils.d.ts +5 -0
- package/dist/utils.d.ts.map +1 -0
- package/dist/utils.js +46 -0
- package/dist/utils.js.map +1 -0
- package/dist/version.d.ts +3 -0
- package/dist/version.d.ts.map +1 -0
- package/dist/version.js +47 -0
- package/dist/version.js.map +1 -0
- package/package.json +18 -3
- package/src/commands/build.js +0 -198
- package/src/commands/clean.js +0 -85
- package/src/commands/init.js +0 -88
- package/src/commands/validate.js +0 -141
- package/src/config.js +0 -50
- package/src/generators/agent.js +0 -121
- package/src/generators/skill.js +0 -105
- package/src/generators/tools.js +0 -183
- package/src/parsers/proposal.js +0 -52
- package/src/parsers/spec.js +0 -105
- package/src/parsers/tasks.js +0 -46
- package/src/utils.js +0 -51
- package/src/version.js +0 -60
package/dist/config.js
ADDED
|
@@ -0,0 +1,101 @@
|
|
|
1
|
+
import { readFileSync, existsSync } from 'fs';
|
|
2
|
+
import { join, resolve, relative } from 'path';
|
|
3
|
+
import yaml from 'yaml';
|
|
4
|
+
const KNOWN_TOP_LEVEL_KEYS = new Set([
|
|
5
|
+
'version',
|
|
6
|
+
'target',
|
|
7
|
+
'openspec',
|
|
8
|
+
'output',
|
|
9
|
+
'ci',
|
|
10
|
+
'agents',
|
|
11
|
+
'tools',
|
|
12
|
+
]);
|
|
13
|
+
const DEFAULT_CONFIG = {
|
|
14
|
+
version: 1,
|
|
15
|
+
target: 'github',
|
|
16
|
+
openspec: './openspec',
|
|
17
|
+
output: './.github',
|
|
18
|
+
ci: {
|
|
19
|
+
auto_commit: false,
|
|
20
|
+
commit_message: 'chore: regenerate agents from specs',
|
|
21
|
+
},
|
|
22
|
+
agents: {
|
|
23
|
+
target: 'ide',
|
|
24
|
+
tools: null,
|
|
25
|
+
},
|
|
26
|
+
};
|
|
27
|
+
/**
|
|
28
|
+
* Validate that a resolved path does not escape the project root.
|
|
29
|
+
* Throws if the path traverses outside `root`.
|
|
30
|
+
*/
|
|
31
|
+
function safePath(root, unsafePath) {
|
|
32
|
+
const resolved = resolve(root, unsafePath);
|
|
33
|
+
const rel = relative(root, resolved);
|
|
34
|
+
if (rel.startsWith('..') || resolve(root, rel) !== resolved) {
|
|
35
|
+
throw new Error(`Path "${unsafePath}" resolves outside the project root ("${root}").`);
|
|
36
|
+
}
|
|
37
|
+
return resolved;
|
|
38
|
+
}
|
|
39
|
+
/**
|
|
40
|
+
* Validate user-supplied config values. Throws on hard errors;
|
|
41
|
+
* warns (console.warn) for unknown top-level keys.
|
|
42
|
+
*/
|
|
43
|
+
function validateConfig(userConfig) {
|
|
44
|
+
// Warn for unknown top-level keys
|
|
45
|
+
for (const key of Object.keys(userConfig)) {
|
|
46
|
+
if (!KNOWN_TOP_LEVEL_KEYS.has(key)) {
|
|
47
|
+
console.warn(`daedalion: unknown config key "${key}" — ignoring.`);
|
|
48
|
+
}
|
|
49
|
+
}
|
|
50
|
+
// version must be 1
|
|
51
|
+
if (userConfig.version !== undefined && userConfig.version !== 1) {
|
|
52
|
+
throw new Error(`Unsupported config version: ${String(userConfig.version)}. Only version 1 is supported.`);
|
|
53
|
+
}
|
|
54
|
+
// agents.target must be 'ide' or 'sdk'
|
|
55
|
+
const agents = userConfig.agents;
|
|
56
|
+
if (agents?.target !== undefined) {
|
|
57
|
+
if (agents.target !== 'ide' && agents.target !== 'sdk') {
|
|
58
|
+
throw new Error(`Invalid agents.target: "${String(agents.target)}". Must be "ide" or "sdk".`);
|
|
59
|
+
}
|
|
60
|
+
}
|
|
61
|
+
// openspec must be a non-empty string
|
|
62
|
+
if (userConfig.openspec !== undefined) {
|
|
63
|
+
if (typeof userConfig.openspec !== 'string' || userConfig.openspec.trim() === '') {
|
|
64
|
+
throw new Error('Config "openspec" must be a non-empty string.');
|
|
65
|
+
}
|
|
66
|
+
}
|
|
67
|
+
// output must be a non-empty string
|
|
68
|
+
if (userConfig.output !== undefined) {
|
|
69
|
+
if (typeof userConfig.output !== 'string' || userConfig.output.trim() === '') {
|
|
70
|
+
throw new Error('Config "output" must be a non-empty string.');
|
|
71
|
+
}
|
|
72
|
+
}
|
|
73
|
+
}
|
|
74
|
+
export function loadConfig(cwd) {
|
|
75
|
+
const configPath = join(cwd, 'daedalion.yaml');
|
|
76
|
+
if (!existsSync(configPath)) {
|
|
77
|
+
return { ...DEFAULT_CONFIG };
|
|
78
|
+
}
|
|
79
|
+
const content = readFileSync(configPath, 'utf-8');
|
|
80
|
+
const userConfig = yaml.parse(content) || {};
|
|
81
|
+
validateConfig(userConfig);
|
|
82
|
+
return {
|
|
83
|
+
...DEFAULT_CONFIG,
|
|
84
|
+
...userConfig,
|
|
85
|
+
ci: {
|
|
86
|
+
...DEFAULT_CONFIG.ci,
|
|
87
|
+
...(userConfig.ci || {}),
|
|
88
|
+
},
|
|
89
|
+
agents: {
|
|
90
|
+
...DEFAULT_CONFIG.agents,
|
|
91
|
+
...(userConfig.agents || {}),
|
|
92
|
+
},
|
|
93
|
+
};
|
|
94
|
+
}
|
|
95
|
+
export function resolveOpenspecPath(cwd, config) {
|
|
96
|
+
return safePath(cwd, config.openspec);
|
|
97
|
+
}
|
|
98
|
+
export function resolveOutputPath(cwd, config) {
|
|
99
|
+
return safePath(cwd, config.output);
|
|
100
|
+
}
|
|
101
|
+
//# sourceMappingURL=config.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"config.js","sourceRoot":"","sources":["../src/config.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAAE,UAAU,EAAE,MAAM,IAAI,CAAC;AAC9C,OAAO,EAAE,IAAI,EAAE,OAAO,EAAE,QAAQ,EAAE,MAAM,MAAM,CAAC;AAC/C,OAAO,IAAI,MAAM,MAAM,CAAC;AAGxB,MAAM,oBAAoB,GAAwB,IAAI,GAAG,CAAC;IACxD,SAAS;IACT,QAAQ;IACR,UAAU;IACV,QAAQ;IACR,IAAI;IACJ,QAAQ;IACR,OAAO;CACR,CAAC,CAAC;AAEH,MAAM,cAAc,GAAoB;IACtC,OAAO,EAAE,CAAC;IACV,MAAM,EAAE,QAAQ;IAChB,QAAQ,EAAE,YAAY;IACtB,MAAM,EAAE,WAAW;IACnB,EAAE,EAAE;QACF,WAAW,EAAE,KAAK;QAClB,cAAc,EAAE,qCAAqC;KACtD;IACD,MAAM,EAAE;QACN,MAAM,EAAE,KAAK;QACb,KAAK,EAAE,IAAI;KACZ;CACF,CAAC;AAEF;;;GAGG;AACH,SAAS,QAAQ,CAAC,IAAY,EAAE,UAAkB;IAChD,MAAM,QAAQ,GAAG,OAAO,CAAC,IAAI,EAAE,UAAU,CAAC,CAAC;IAC3C,MAAM,GAAG,GAAG,QAAQ,CAAC,IAAI,EAAE,QAAQ,CAAC,CAAC;IAErC,IAAI,GAAG,CAAC,UAAU,CAAC,IAAI,CAAC,IAAI,OAAO,CAAC,IAAI,EAAE,GAAG,CAAC,KAAK,QAAQ,EAAE,CAAC;QAC5D,MAAM,IAAI,KAAK,CACb,SAAS,UAAU,yCAAyC,IAAI,KAAK,CACtE,CAAC;IACJ,CAAC;IAED,OAAO,QAAQ,CAAC;AAClB,CAAC;AAED;;;GAGG;AACH,SAAS,cAAc,CAAC,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AE/F,wBAAgB,aAAa,CAC3B,IAAI,EAAE,IAAI,EACV,SAAS,EAAE,MAAM,EACjB,OAAO,GAAE,YAAiB,EAC1B,MAAM,GAAE,OAAO,CAAC,eAAe,CAAM,GACpC,aAAa,CAwCf"}
|
|
@@ -0,0 +1,105 @@
|
|
|
1
|
+
import { ensureDir } from '../utils.js';
|
|
2
|
+
import { writeFileSync } from 'fs';
|
|
3
|
+
import { join } from 'path';
|
|
4
|
+
export function generateAgent(spec, outputDir, options = {}, config = {}) {
|
|
5
|
+
const agentPath = join(outputDir, 'agents', `${spec.domain}.agent.md`);
|
|
6
|
+
const skillDescription = generateSkillDescription(spec);
|
|
7
|
+
const agentConfig = config.agents || {};
|
|
8
|
+
const target = agentConfig.target || 'ide';
|
|
9
|
+
let tools;
|
|
10
|
+
let workflow;
|
|
11
|
+
if (target === 'sdk') {
|
|
12
|
+
const specTools = extractTools(spec);
|
|
13
|
+
tools = specTools.length > 0 ? specTools.map(t => t.name) : (agentConfig.tools || []);
|
|
14
|
+
workflow = generateSDKWorkflow(spec, tools);
|
|
15
|
+
}
|
|
16
|
+
else {
|
|
17
|
+
tools = ['edit', 'search', 'terminal'];
|
|
18
|
+
workflow = generateIDEWorkflow(spec);
|
|
19
|
+
}
|
|
20
|
+
const toolsYaml = tools.length > 0
|
|
21
|
+
? `tools: [${tools.map(t => `'${t}'`).join(', ')}]`
|
|
22
|
+
: '';
|
|
23
|
+
const content = `---
|
|
24
|
+
name: ${spec.domain}
|
|
25
|
+
description: Implements ${spec.domain} features following specifications
|
|
26
|
+
${toolsYaml}
|
|
27
|
+
---
|
|
28
|
+
# ${spec.domain} Agent
|
|
29
|
+
|
|
30
|
+
${workflow}
|
|
31
|
+
`;
|
|
32
|
+
if (options.dryRun) {
|
|
33
|
+
return { path: agentPath, content };
|
|
34
|
+
}
|
|
35
|
+
ensureDir(agentPath);
|
|
36
|
+
writeFileSync(agentPath, content);
|
|
37
|
+
return { path: agentPath, content };
|
|
38
|
+
}
|
|
39
|
+
function extractTools(spec) {
|
|
40
|
+
const tools = [];
|
|
41
|
+
const frontmatter = spec.frontmatter || {};
|
|
42
|
+
if (frontmatter.tools && Array.isArray(frontmatter.tools)) {
|
|
43
|
+
for (const tool of frontmatter.tools) {
|
|
44
|
+
if (typeof tool === 'string') {
|
|
45
|
+
tools.push({ name: tool });
|
|
46
|
+
}
|
|
47
|
+
else if (typeof tool === 'object' && tool !== null && 'name' in tool) {
|
|
48
|
+
tools.push(tool);
|
|
49
|
+
}
|
|
50
|
+
}
|
|
51
|
+
}
|
|
52
|
+
return tools;
|
|
53
|
+
}
|
|
54
|
+
function generateIDEWorkflow(spec) {
|
|
55
|
+
const skillDescription = generateSkillDescription(spec);
|
|
56
|
+
return `You implement ${spec.domain} features following the specification.
|
|
57
|
+
|
|
58
|
+
## Available Skills
|
|
59
|
+
- **#${spec.domain}** — ${skillDescription}
|
|
60
|
+
|
|
61
|
+
## Workflow
|
|
62
|
+
1. Read the #${spec.domain} skill for requirements
|
|
63
|
+
2. Implement following acceptance criteria
|
|
64
|
+
3. Verify all scenarios pass
|
|
65
|
+
`;
|
|
66
|
+
}
|
|
67
|
+
function generateSDKWorkflow(spec, tools) {
|
|
68
|
+
const skillDescription = generateSkillDescription(spec);
|
|
69
|
+
if (tools.length === 0) {
|
|
70
|
+
return `You implement ${spec.domain} features following the specification.
|
|
71
|
+
|
|
72
|
+
## Available Skills
|
|
73
|
+
- **#${spec.domain}** — ${skillDescription}
|
|
74
|
+
|
|
75
|
+
## Workflow
|
|
76
|
+
1. Read the #${spec.domain} skill for requirements
|
|
77
|
+
2. Implement following acceptance criteria
|
|
78
|
+
3. Verify all scenarios pass
|
|
79
|
+
`;
|
|
80
|
+
}
|
|
81
|
+
return `You implement ${spec.domain} features following the specification.
|
|
82
|
+
|
|
83
|
+
## Available Skills
|
|
84
|
+
- **#${spec.domain}** — ${skillDescription}
|
|
85
|
+
|
|
86
|
+
## Available Tools
|
|
87
|
+
${tools.map(t => `- **${t}**`).join('\n')}
|
|
88
|
+
|
|
89
|
+
## Workflow
|
|
90
|
+
1. Read the #${spec.domain} skill for requirements
|
|
91
|
+
2. Use available tools to implement following acceptance criteria
|
|
92
|
+
3. Verify all scenarios pass
|
|
93
|
+
`;
|
|
94
|
+
}
|
|
95
|
+
function generateSkillDescription(spec) {
|
|
96
|
+
if (spec.requirements.length === 0) {
|
|
97
|
+
return `${spec.title} requirements and acceptance criteria`;
|
|
98
|
+
}
|
|
99
|
+
const reqNames = spec.requirements
|
|
100
|
+
.slice(0, 3)
|
|
101
|
+
.map(r => r.name.toLowerCase())
|
|
102
|
+
.join(', ');
|
|
103
|
+
return `${spec.title} - ${reqNames}`;
|
|
104
|
+
}
|
|
105
|
+
//# sourceMappingURL=agent.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"agent.js","sourceRoot":"","sources":["../../src/generators/agent.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,MAAM,aAAa,CAAC;AACxC,OAAO,EAAE,aAAa,EAAE,MAAM,IAAI,CAAC;AACnC,OAAO,EAAE,IAAI,EAAE,MAAM,MAAM,CAAC;AAG5B,MAAM,UAAU,aAAa,CAC3B,IAAU,EACV,SAAiB,EACjB,UAAwB,EAAE,EAC1B,SAAmC,EAAE;IAErC,MAAM,SAAS,GAAG,IAAI,CAAC,SAAS,EAAE,QAAQ,EAAE,GAAG,IAAI,CAAC,MAAM,WAAW,CAAC,CAAC;IAEvE,MAAM,gBAAgB,GAAG,wBAAwB,CAAC,IAAI,CAAC,CAAC;IACxD,MAAM,WAAW,GAAG,MAAM,CAAC,MAAM,IAAI,EAA+B,CAAC;IACrE,MAAM,MAAM,GAAG,WAAW,CAAC,MAAM,IAAI,KAAK,CAAC;IAE3C,IAAI,KAAe,CAAC;IACpB,IAAI,QAAgB,CAAC;IAErB,IAAI,MAAM,KAAK,KAAK,EAAE,CAAC;QACrB,MAAM,SAAS,GAAG,YAAY,CAAC,IAAI,CAAC,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,wBAAwB,CAAC,IAAU;IAC1C,IAAI,IAAI,CAAC,YAAY,CAAC,MAAM,KAAK,CAAC,EAAE,CAAC;QACnC,OAAO,GAAG,IAAI,CAAC,KAAK,uCAAuC,CAAC;IAC9D,CAAC;IAED,MAAM,QAAQ,GAAG,IAAI,CAAC,YAAY;SAC/B,KAAK,CAAC,CAAC,EAAE,CAAC,CAAC;SACX,GAAG,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,IAAI,CAAC,WAAW,EAAE,CAAC;SAC9B,IAAI,CAAC,IAAI,CAAC,CAAC;IAEd,OAAO,GAAG,IAAI,CAAC,KAAK,MAAM,QAAQ,EAAE,CAAC;AACvC,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"instructions.d.ts","sourceRoot":"","sources":["../../src/generators/instructions.ts"],"names":[],"mappings":"AAIA,OAAO,KAAK,EAAE,aAAa,EAAE,YAAY,EAAE,MAAM,aAAa,CAAC;AAE/D,wBAAgB,oBAAoB,CAAC,WAAW,EAAE,MAAM,EAAE,SAAS,EAAE,MAAM,EAAE,OAAO,GAAE,YAAiB,GAAG,aAAa,CAoBtH"}
|
|
@@ -2,64 +2,54 @@ import { readFileSync, existsSync } from 'fs';
|
|
|
2
2
|
import { writeFileSync } from 'fs';
|
|
3
3
|
import { join } from 'path';
|
|
4
4
|
import { ensureDir } from '../utils.js';
|
|
5
|
-
|
|
6
5
|
export function generateInstructions(openspecDir, outputDir, options = {}) {
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
6
|
+
const projectPath = join(openspecDir, 'project.md');
|
|
7
|
+
const instructionsPath = join(outputDir, 'copilot-instructions.md');
|
|
8
|
+
let content;
|
|
9
|
+
if (existsSync(projectPath)) {
|
|
10
|
+
const projectContent = readFileSync(projectPath, 'utf-8');
|
|
11
|
+
content = transformProjectToInstructions(projectContent);
|
|
12
|
+
}
|
|
13
|
+
else {
|
|
14
|
+
content = generateDefaultInstructions();
|
|
15
|
+
}
|
|
16
|
+
if (options.dryRun) {
|
|
17
|
+
return { path: instructionsPath, content };
|
|
18
|
+
}
|
|
19
|
+
ensureDir(instructionsPath);
|
|
20
|
+
writeFileSync(instructionsPath, content);
|
|
20
21
|
return { path: instructionsPath, content };
|
|
21
|
-
}
|
|
22
|
-
|
|
23
|
-
ensureDir(instructionsPath);
|
|
24
|
-
writeFileSync(instructionsPath, content);
|
|
25
|
-
return { path: instructionsPath, content };
|
|
26
22
|
}
|
|
27
|
-
|
|
28
23
|
function transformProjectToInstructions(projectContent) {
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
> Do not edit directly - changes will be overwritten.
|
|
35
|
-
|
|
24
|
+
const header = `# Copilot Instructions
|
|
25
|
+
|
|
26
|
+
> Auto-generated by Daedalion from openspec/project.md
|
|
27
|
+
> Do not edit directly - changes will be overwritten.
|
|
28
|
+
|
|
36
29
|
`;
|
|
37
|
-
|
|
38
|
-
return header + projectContent;
|
|
30
|
+
return header + projectContent;
|
|
39
31
|
}
|
|
40
|
-
|
|
41
32
|
function generateDefaultInstructions() {
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
Check the \`.github/
|
|
62
|
-
Check the \`.github/agents/\` directory for specialized agents.
|
|
63
|
-
Check the \`.github/prompts/\` directory for slash commands.
|
|
33
|
+
return `# Copilot Instructions
|
|
34
|
+
|
|
35
|
+
> Auto-generated by Daedalion
|
|
36
|
+
> Do not edit directly - changes will be overwritten.
|
|
37
|
+
|
|
38
|
+
## Project Overview
|
|
39
|
+
|
|
40
|
+
This project uses OpenSpec for specification-driven development.
|
|
41
|
+
|
|
42
|
+
## Working with Specifications
|
|
43
|
+
|
|
44
|
+
- Specs are in \`openspec/specs/\`
|
|
45
|
+
- Active changes are in \`openspec/changes/\`
|
|
46
|
+
- Use the available skills and agents for implementation guidance
|
|
47
|
+
|
|
48
|
+
## Available Resources
|
|
49
|
+
|
|
50
|
+
Check the \`.github/skills/\` directory for implementation guides.
|
|
51
|
+
Check the \`.github/agents/\` directory for specialized agents.
|
|
52
|
+
Check the \`.github/prompts/\` directory for slash commands.
|
|
64
53
|
`;
|
|
65
54
|
}
|
|
55
|
+
//# sourceMappingURL=instructions.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"instructions.js","sourceRoot":"","sources":["../../src/generators/instructions.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAAE,UAAU,EAAE,MAAM,IAAI,CAAC;AAC9C,OAAO,EAAE,aAAa,EAAE,MAAM,IAAI,CAAC;AACnC,OAAO,EAAE,IAAI,EAAE,MAAM,MAAM,CAAC;AAC5B,OAAO,EAAE,SAAS,EAAE,MAAM,aAAa,CAAC;AAGxC,MAAM,UAAU,oBAAoB,CAAC,WAAmB,EAAE,SAAiB,EAAE,UAAwB,EAAE;IACrG,MAAM,WAAW,GAAW,IAAI,CAAC,WAAW,EAAE,YAAY,CAAC,CAAC;IAC5D,MAAM,gBAAgB,GAAW,IAAI,CAAC,SAAS,EAAE,yBAAyB,CAAC,CAAC;IAE5E,IAAI,OAAe,CAAC;IAEpB,IAAI,UAAU,CAAC,WAAW,CAAC,EAAE,CAAC;QAC5B,MAAM,cAAc,GAAW,YAAY,CAAC,WAAW,EAAE,OAAO,CAAC,CAAC;QAClE,OAAO,GAAG,8BAA8B,CAAC,cAAc,CAAC,CAAC;IAC3D,CAAC;SAAM,CAAC;QACN,OAAO,GAAG,2BAA2B,EAAE,CAAC;IAC1C,CAAC;IAED,IAAI,OAAO,CAAC,MAAM,EAAE,CAAC;QACnB,OAAO,EAAE,IAAI,EAAE,gBAAgB,EAAE,OAAO,EAAE,CAAC;IAC7C,CAAC;IAED,SAAS,CAAC,gBAAgB,CAAC,CAAC;IAC5B,aAAa,CAAC,gBAAgB,EAAE,OAAO,CAAC,CAAC;IACzC,OAAO,EAAE,IAAI,EAAE,gBAAgB,EAAE,OAAO,EAAE,CAAC;AAC7C,CAAC;AAED,SAAS,8BAA8B,CAAC,cAAsB;IAC5D,MAAM,MAAM,GAAW;;;;;CAKxB,CAAC;IAEA,OAAO,MAAM,GAAG,cAAc,CAAC;AACjC,CAAC;AAED,SAAS,2BAA2B;IAClC,OAAO;;;;;;;;;;;;;;;;;;;;CAoBR,CAAC;AACF,CAAC"}
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
import type { BuildOptions, GeneratedFile, Proposal, TasksSummary } from '../types.js';
|
|
2
|
+
export declare function generatePrompt(proposal: Proposal, tasks: TasksSummary, domain: string, outputDir: string, options?: BuildOptions): GeneratedFile;
|
|
3
|
+
export declare function generateCyclePrompt(outputDir: string, options?: BuildOptions): GeneratedFile;
|
|
4
|
+
//# sourceMappingURL=prompt.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"prompt.d.ts","sourceRoot":"","sources":["../../src/generators/prompt.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAE,YAAY,EAAE,aAAa,EAAE,QAAQ,EAAE,YAAY,EAAE,MAAM,aAAa,CAAC;AAEvF,wBAAgB,cAAc,CAC5B,QAAQ,EAAE,QAAQ,EAClB,KAAK,EAAE,YAAY,EACnB,MAAM,EAAE,MAAM,EACd,SAAS,EAAE,MAAM,EACjB,OAAO,GAAE,YAAiB,GACzB,aAAa,CAkCf;AAED,wBAAgB,mBAAmB,CACjC,SAAS,EAAE,MAAM,EACjB,OAAO,GAAE,YAAiB,GACzB,aAAa,CAwEf"}
|
|
@@ -1,113 +1,107 @@
|
|
|
1
1
|
import { ensureDir } from '../utils.js';
|
|
2
2
|
import { writeFileSync } from 'fs';
|
|
3
3
|
import { join } from 'path';
|
|
4
|
-
|
|
5
4
|
export function generatePrompt(proposal, tasks, domain, outputDir, options = {}) {
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
${tasks.
|
|
29
|
-
${tasks.hasMore ? `\n> See full list in tasks.md` : ''}` : ''}
|
|
5
|
+
const promptPath = join(outputDir, 'prompts', `${proposal.changeName}.prompt.md`);
|
|
6
|
+
const content = `---
|
|
7
|
+
description: ${proposal.title}
|
|
8
|
+
agent: ${domain || 'default'}
|
|
9
|
+
---
|
|
10
|
+
Implement the ${proposal.changeName} change proposal.
|
|
11
|
+
|
|
12
|
+
## Context
|
|
13
|
+
${proposal.why || 'No context provided.'}
|
|
14
|
+
|
|
15
|
+
## Scope
|
|
16
|
+
${proposal.what || 'No scope defined.'}
|
|
17
|
+
|
|
18
|
+
## Reference
|
|
19
|
+
- Proposal: openspec/changes/${proposal.changeName}/proposal.md
|
|
20
|
+
- Tasks: openspec/changes/${proposal.changeName}/tasks.md
|
|
21
|
+
|
|
22
|
+
## Skills
|
|
23
|
+
- #${domain || 'default'}
|
|
24
|
+
${tasks && tasks.items.length > 0 ? `
|
|
25
|
+
## Tasks
|
|
26
|
+
${tasks.items.map((t) => `- [ ] ${t}`).join('\n')}
|
|
27
|
+
${tasks.hasMore ? `\n> See full list in tasks.md` : ''}` : ''}
|
|
30
28
|
`;
|
|
31
|
-
|
|
32
|
-
|
|
29
|
+
if (options.dryRun) {
|
|
30
|
+
return { path: promptPath, content };
|
|
31
|
+
}
|
|
32
|
+
ensureDir(promptPath);
|
|
33
|
+
writeFileSync(promptPath, content);
|
|
33
34
|
return { path: promptPath, content };
|
|
34
|
-
}
|
|
35
|
-
|
|
36
|
-
ensureDir(promptPath);
|
|
37
|
-
writeFileSync(promptPath, content);
|
|
38
|
-
return { path: promptPath, content };
|
|
39
35
|
}
|
|
40
|
-
|
|
41
36
|
export function generateCyclePrompt(outputDir, options = {}) {
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
description: OpenSpec cycle coordinator
|
|
45
|
-
agent: default
|
|
46
|
-
---
|
|
47
|
-
You are the OpenSpec cycle coordinator. Route requests to the correct OpenSpec prompt based on the project phase.
|
|
48
|
-
|
|
49
|
-
## Core Principle
|
|
50
|
-
**NEVER start coding until the specs are clear, agreed upon, and explicitly approved by the human.**
|
|
51
|
-
|
|
52
|
-
## Source of Truth
|
|
53
|
-
- \`openspec/specs/\` = approved, canonical specifications (never edit directly)
|
|
54
|
-
- \`openspec/changes/<change-id>/specs/\` = temporary delta specs (additions/modifications/removals) that merge to canonical specs after approval
|
|
55
|
-
- \`openspec/AGENTS.md\` = tool-specific integration instructions
|
|
56
|
-
- \`openspec/project.md\` = project conventions (tech stack, naming rules, patterns)
|
|
57
|
-
|
|
58
|
-
## Helpful CLI Commands
|
|
59
|
-
- Use \`openspec view\` to see the status of proposals, tasks, and specs.
|
|
60
|
-
- Use \`openspec view <change-id>\` to inspect the proposal, tasks, and spec deltas.
|
|
61
|
-
- Use \`openspec list --changes\` or \`openspec list --specs\` for detailed views
|
|
62
|
-
- Use \`openspec --help\` to see all available commands.
|
|
63
|
-
|
|
64
|
-
## Inputs
|
|
65
|
-
- User request
|
|
66
|
-
- Optional change-id
|
|
67
|
-
- Spec approval status
|
|
68
|
-
- Task completion status
|
|
69
|
-
|
|
70
|
-
## Workflow Phases
|
|
71
|
-
|
|
72
|
-
### Phase 1: Draft (Proposal + Spec Deltas)
|
|
73
|
-
- Create \`proposal.md\` (why, goals, scope, non-goals, risks)
|
|
74
|
-
- Create \`tasks.md\` (numbered checklist with \`- [ ]\` checkboxes)
|
|
75
|
-
- Create spec deltas in \`specs/<module>/spec.md\` with sections:
|
|
76
|
-
- \`## ADDED Requirements\`
|
|
77
|
-
- \`## MODIFIED Requirements\`
|
|
78
|
-
- \`## REMOVED Requirements\`
|
|
79
|
-
- Each requirement uses SHALL/MUST language
|
|
80
|
-
- Each requirement includes \`#### Scenario:\` blocks with WHEN → THEN outcomes
|
|
81
|
-
|
|
82
|
-
### Phase 2: Review & Refine
|
|
83
|
-
- Iterate on proposal, tasks, and delta specs based on human feedback
|
|
84
|
-
- **Do NOT proceed to code until human explicitly approves specs**
|
|
85
|
-
|
|
86
|
-
### Phase 3: Implement
|
|
87
|
-
- Follow \`tasks.md\` checklist step-by-step
|
|
88
|
-
- Update tasks: change \`- [ ]\` to \`- [x]\` as you complete items
|
|
89
|
-
- Refine delta specs if needed (keep accurate)
|
|
90
|
-
- Human confirms when all tasks are complete
|
|
91
|
-
|
|
92
|
-
### Phase 4: Archive
|
|
93
|
-
- Merge approved deltas from \`openspec/changes/<id>/specs/\` into \`openspec/specs/\`
|
|
94
|
-
- Move change folder to \`openspec/archive/\`
|
|
95
|
-
- **Requires human confirmation** (CLI: \`openspec archive <change-id> --yes\`)
|
|
96
|
-
|
|
97
|
-
## Rules
|
|
98
|
-
1. If no change-id exists or the request is to start new work → run @openspec-proposal.prompt.md to create proposal, tasks, and spec deltas. Ask for approval before coding.
|
|
99
|
-
2. If specs are approved and implementation is requested → run @openspec-apply.prompt.md.
|
|
100
|
-
3. If all tasks are complete and the user confirms → run @openspec-archive.prompt.md.
|
|
101
|
-
4. If asked for status → summarize proposal + specs + tasks progress. Recommend the next phase clearly.
|
|
102
|
-
|
|
103
|
-
Always state the current phase (Draft/Review/Implement/Ready to Archive/Archived) and the next action.
|
|
37
|
+
const promptPath = join(outputDir, 'prompts', 'daedalion-openspec-cycle.prompt.md');
|
|
38
|
+
const content = `---
|
|
39
|
+
description: OpenSpec cycle coordinator
|
|
40
|
+
agent: default
|
|
41
|
+
---
|
|
42
|
+
You are the OpenSpec cycle coordinator. Route requests to the correct OpenSpec prompt based on the project phase.
|
|
43
|
+
|
|
44
|
+
## Core Principle
|
|
45
|
+
**NEVER start coding until the specs are clear, agreed upon, and explicitly approved by the human.**
|
|
46
|
+
|
|
47
|
+
## Source of Truth
|
|
48
|
+
- \`openspec/specs/\` = approved, canonical specifications (never edit directly)
|
|
49
|
+
- \`openspec/changes/<change-id>/specs/\` = temporary delta specs (additions/modifications/removals) that merge to canonical specs after approval
|
|
50
|
+
- \`openspec/AGENTS.md\` = tool-specific integration instructions
|
|
51
|
+
- \`openspec/project.md\` = project conventions (tech stack, naming rules, patterns)
|
|
52
|
+
|
|
53
|
+
## Helpful CLI Commands
|
|
54
|
+
- Use \`openspec view\` to see the status of proposals, tasks, and specs.
|
|
55
|
+
- Use \`openspec view <change-id>\` to inspect the proposal, tasks, and spec deltas.
|
|
56
|
+
- Use \`openspec list --changes\` or \`openspec list --specs\` for detailed views
|
|
57
|
+
- Use \`openspec --help\` to see all available commands.
|
|
58
|
+
|
|
59
|
+
## Inputs
|
|
60
|
+
- User request
|
|
61
|
+
- Optional change-id
|
|
62
|
+
- Spec approval status
|
|
63
|
+
- Task completion status
|
|
64
|
+
|
|
65
|
+
## Workflow Phases
|
|
66
|
+
|
|
67
|
+
### Phase 1: Draft (Proposal + Spec Deltas)
|
|
68
|
+
- Create \`proposal.md\` (why, goals, scope, non-goals, risks)
|
|
69
|
+
- Create \`tasks.md\` (numbered checklist with \`- [ ]\` checkboxes)
|
|
70
|
+
- Create spec deltas in \`specs/<module>/spec.md\` with sections:
|
|
71
|
+
- \`## ADDED Requirements\`
|
|
72
|
+
- \`## MODIFIED Requirements\`
|
|
73
|
+
- \`## REMOVED Requirements\`
|
|
74
|
+
- Each requirement uses SHALL/MUST language
|
|
75
|
+
- Each requirement includes \`#### Scenario:\` blocks with WHEN → THEN outcomes
|
|
76
|
+
|
|
77
|
+
### Phase 2: Review & Refine
|
|
78
|
+
- Iterate on proposal, tasks, and delta specs based on human feedback
|
|
79
|
+
- **Do NOT proceed to code until human explicitly approves specs**
|
|
80
|
+
|
|
81
|
+
### Phase 3: Implement
|
|
82
|
+
- Follow \`tasks.md\` checklist step-by-step
|
|
83
|
+
- Update tasks: change \`- [ ]\` to \`- [x]\` as you complete items
|
|
84
|
+
- Refine delta specs if needed (keep accurate)
|
|
85
|
+
- Human confirms when all tasks are complete
|
|
86
|
+
|
|
87
|
+
### Phase 4: Archive
|
|
88
|
+
- Merge approved deltas from \`openspec/changes/<id>/specs/\` into \`openspec/specs/\`
|
|
89
|
+
- Move change folder to \`openspec/archive/\`
|
|
90
|
+
- **Requires human confirmation** (CLI: \`openspec archive <change-id> --yes\`)
|
|
91
|
+
|
|
92
|
+
## Rules
|
|
93
|
+
1. If no change-id exists or the request is to start new work → run @openspec-proposal.prompt.md to create proposal, tasks, and spec deltas. Ask for approval before coding.
|
|
94
|
+
2. If specs are approved and implementation is requested → run @openspec-apply.prompt.md.
|
|
95
|
+
3. If all tasks are complete and the user confirms → run @openspec-archive.prompt.md.
|
|
96
|
+
4. If asked for status → summarize proposal + specs + tasks progress. Recommend the next phase clearly.
|
|
97
|
+
|
|
98
|
+
Always state the current phase (Draft/Review/Implement/Ready to Archive/Archived) and the next action.
|
|
104
99
|
`;
|
|
105
|
-
|
|
106
|
-
|
|
100
|
+
if (options.dryRun) {
|
|
101
|
+
return { path: promptPath, content };
|
|
102
|
+
}
|
|
103
|
+
ensureDir(promptPath);
|
|
104
|
+
writeFileSync(promptPath, content);
|
|
107
105
|
return { path: promptPath, content };
|
|
108
|
-
}
|
|
109
|
-
|
|
110
|
-
ensureDir(promptPath);
|
|
111
|
-
writeFileSync(promptPath, content);
|
|
112
|
-
return { path: promptPath, content };
|
|
113
106
|
}
|
|
107
|
+
//# sourceMappingURL=prompt.js.map
|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