mspec 0.0.1 → 0.0.2
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/commands/init.js +9 -7
- package/dist/commands/init.test.js +11 -9
- package/dist/templates/index.js +40 -35
- package/package.json +1 -1
package/dist/commands/init.js
CHANGED
|
@@ -42,13 +42,15 @@ async function initCommand() {
|
|
|
42
42
|
}
|
|
43
43
|
};
|
|
44
44
|
fs_1.default.writeFileSync(path_1.default.join(mspecDir, 'mspec.json'), JSON.stringify(mspecConfig, null, 2));
|
|
45
|
-
// Write agent integration
|
|
46
|
-
const
|
|
47
|
-
if (
|
|
48
|
-
const
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
45
|
+
// Write agent integration files
|
|
46
|
+
const agentTemplates = (0, templates_1.getTemplates)(agent);
|
|
47
|
+
if (agentTemplates.length > 0) {
|
|
48
|
+
for (const template of agentTemplates) {
|
|
49
|
+
const targetDir = path_1.default.join(process.cwd(), template.dir);
|
|
50
|
+
fs_1.default.mkdirSync(targetDir, { recursive: true });
|
|
51
|
+
fs_1.default.writeFileSync(path_1.default.join(targetDir, template.file), template.content);
|
|
52
|
+
console.log(chalk_1.default.green(`Created integration file for ${agent} at ${path_1.default.join(template.dir, template.file)}`));
|
|
53
|
+
}
|
|
52
54
|
}
|
|
53
55
|
else {
|
|
54
56
|
console.log(chalk_1.default.yellow(`No specific integration template found for ${agent}. Setup completed with generic settings.`));
|
|
@@ -28,14 +28,14 @@ describe('initCommand', () => {
|
|
|
28
28
|
jest.restoreAllMocks();
|
|
29
29
|
});
|
|
30
30
|
const providers = [
|
|
31
|
-
{ agent: 'claude',
|
|
32
|
-
{ agent: 'gemini',
|
|
33
|
-
{ agent: 'cursor',
|
|
34
|
-
{ agent: 'opencode',
|
|
35
|
-
{ agent: 'zed',
|
|
36
|
-
{ agent: 'generic',
|
|
31
|
+
{ agent: 'claude', expectedFiles: ['.claude/commands/mspec.spec.md', '.claude/commands/mspec.plan.md', '.claude/commands/mspec.apply.md'] },
|
|
32
|
+
{ agent: 'gemini', expectedFiles: ['.gemini/commands/mspec.spec.toml', '.gemini/commands/mspec.plan.toml', '.gemini/commands/mspec.apply.toml'] },
|
|
33
|
+
{ agent: 'cursor', expectedFiles: ['.cursor/rules/mspec.spec.mdc', '.cursor/rules/mspec.plan.mdc', '.cursor/rules/mspec.apply.mdc'] },
|
|
34
|
+
{ agent: 'opencode', expectedFiles: ['.opencode/commands/mspec.spec.md', '.opencode/commands/mspec.plan.md', '.opencode/commands/mspec.apply.md'] },
|
|
35
|
+
{ agent: 'zed', expectedFiles: ['.mspec/INSTRUCTIONS.md'] },
|
|
36
|
+
{ agent: 'generic', expectedFiles: ['.mspec/INSTRUCTIONS.md'] }
|
|
37
37
|
];
|
|
38
|
-
providers.forEach(({ agent,
|
|
38
|
+
providers.forEach(({ agent, expectedFiles }) => {
|
|
39
39
|
it(`should initialize the .mspec environment for ${agent}`, async () => {
|
|
40
40
|
mockPrompt.mockResolvedValueOnce({ agent });
|
|
41
41
|
const consoleSpy = jest.spyOn(console, 'log').mockImplementation();
|
|
@@ -47,8 +47,10 @@ describe('initCommand', () => {
|
|
|
47
47
|
expect(fs_1.default.existsSync(configPath)).toBe(true);
|
|
48
48
|
const config = JSON.parse(fs_1.default.readFileSync(configPath, 'utf-8'));
|
|
49
49
|
expect(config.agent).toBe(agent);
|
|
50
|
-
const
|
|
51
|
-
|
|
50
|
+
for (const expectedFile of expectedFiles) {
|
|
51
|
+
const integrationPath = path_1.default.join(tmpDir, expectedFile);
|
|
52
|
+
expect(fs_1.default.existsSync(integrationPath)).toBe(true);
|
|
53
|
+
}
|
|
52
54
|
});
|
|
53
55
|
});
|
|
54
56
|
it('should skip initialization if .mspec directory already exists', async () => {
|
package/dist/templates/index.js
CHANGED
|
@@ -1,74 +1,79 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.templates = void 0;
|
|
4
|
-
exports.
|
|
4
|
+
exports.getTemplates = getTemplates;
|
|
5
|
+
const commands = [
|
|
6
|
+
{ name: 'mspec.spec', desc: 'Create a new spec' },
|
|
7
|
+
{ name: 'mspec.plan', desc: 'Plan tasks for a spec' },
|
|
8
|
+
{ name: 'mspec.apply', desc: 'Implement tasks for a spec' }
|
|
9
|
+
];
|
|
5
10
|
exports.templates = {
|
|
6
|
-
claude: {
|
|
11
|
+
claude: commands.map(cmd => ({
|
|
7
12
|
dir: '.claude/commands',
|
|
8
|
-
file:
|
|
13
|
+
file: `${cmd.name}.md`,
|
|
9
14
|
content: `---
|
|
10
|
-
description: "
|
|
15
|
+
description: "${cmd.desc} using mspec"
|
|
11
16
|
---
|
|
12
17
|
You are an AI assistant using the mspec framework.
|
|
13
|
-
When asked to
|
|
18
|
+
When asked to /${cmd.name}, follow the minimalist spec-driven development guidelines.
|
|
14
19
|
Specs are in .mspec/specs. Tasks are in .mspec/tasks.
|
|
15
20
|
`
|
|
16
|
-
},
|
|
17
|
-
gemini: {
|
|
21
|
+
})),
|
|
22
|
+
gemini: commands.map(cmd => ({
|
|
18
23
|
dir: '.gemini/commands',
|
|
19
|
-
file:
|
|
20
|
-
content: `description = "
|
|
24
|
+
file: `${cmd.name}.toml`,
|
|
25
|
+
content: `description = "${cmd.desc} using mspec"
|
|
21
26
|
prompt = """
|
|
22
27
|
You are an AI assistant using the mspec framework.
|
|
23
|
-
When asked to
|
|
28
|
+
When asked to /${cmd.name}, follow the minimalist spec-driven development guidelines.
|
|
24
29
|
Specs are in .mspec/specs. Tasks are in .mspec/tasks.
|
|
25
30
|
"""
|
|
26
31
|
`
|
|
27
|
-
},
|
|
28
|
-
cursor: {
|
|
32
|
+
})),
|
|
33
|
+
cursor: commands.map(cmd => ({
|
|
29
34
|
dir: '.cursor/rules',
|
|
30
|
-
file:
|
|
35
|
+
file: `${cmd.name}.mdc`,
|
|
31
36
|
content: `---
|
|
32
|
-
description:
|
|
37
|
+
description: ${cmd.desc} using mspec
|
|
33
38
|
globs: *
|
|
34
39
|
---
|
|
35
40
|
You are an AI assistant using the mspec framework.
|
|
36
|
-
When asked to
|
|
41
|
+
When asked to /${cmd.name}, follow the minimalist spec-driven development guidelines.
|
|
37
42
|
Specs are in .mspec/specs. Tasks are in .mspec/tasks.
|
|
38
43
|
`
|
|
39
|
-
},
|
|
40
|
-
opencode: {
|
|
44
|
+
})),
|
|
45
|
+
opencode: commands.map(cmd => ({
|
|
41
46
|
dir: '.opencode/commands',
|
|
42
|
-
file:
|
|
47
|
+
file: `${cmd.name}.md`,
|
|
43
48
|
content: `---
|
|
44
|
-
description: "
|
|
49
|
+
description: "${cmd.desc} using mspec"
|
|
45
50
|
---
|
|
46
51
|
You are an AI assistant using the mspec framework.
|
|
47
|
-
When asked to
|
|
52
|
+
When asked to /${cmd.name}, follow the minimalist spec-driven development guidelines.
|
|
48
53
|
Specs are in .mspec/specs. Tasks are in .mspec/tasks.
|
|
49
54
|
`
|
|
50
|
-
},
|
|
51
|
-
zed: {
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
+
})),
|
|
56
|
+
zed: [{
|
|
57
|
+
dir: '.mspec',
|
|
58
|
+
file: 'INSTRUCTIONS.md',
|
|
59
|
+
content: `# mspec Instructions
|
|
55
60
|
|
|
56
61
|
You are an AI assistant using the mspec framework.
|
|
57
|
-
When asked to /mspec
|
|
62
|
+
When asked to /mspec.spec, /mspec.plan, or /mspec.apply, follow the minimalist spec-driven development guidelines.
|
|
58
63
|
Specs are in .mspec/specs. Tasks are in .mspec/tasks.
|
|
59
64
|
`
|
|
60
|
-
|
|
61
|
-
generic: {
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
+
}],
|
|
66
|
+
generic: [{
|
|
67
|
+
dir: '.mspec',
|
|
68
|
+
file: 'INSTRUCTIONS.md',
|
|
69
|
+
content: `# mspec Instructions
|
|
65
70
|
|
|
66
71
|
You are an AI assistant using the mspec framework.
|
|
67
|
-
When asked to /mspec
|
|
72
|
+
When asked to /mspec.spec, /mspec.plan, or /mspec.apply, follow the minimalist spec-driven development guidelines.
|
|
68
73
|
Specs are in .mspec/specs. Tasks are in .mspec/tasks.
|
|
69
74
|
`
|
|
70
|
-
|
|
75
|
+
}]
|
|
71
76
|
};
|
|
72
|
-
function
|
|
73
|
-
return exports.templates[agent];
|
|
77
|
+
function getTemplates(agent) {
|
|
78
|
+
return exports.templates[agent] || [];
|
|
74
79
|
}
|