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.
@@ -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 file
46
- const template = (0, templates_1.getTemplate)(agent);
47
- if (template) {
48
- const targetDir = path_1.default.join(process.cwd(), template.dir);
49
- fs_1.default.mkdirSync(targetDir, { recursive: true });
50
- fs_1.default.writeFileSync(path_1.default.join(targetDir, template.file), template.content);
51
- console.log(chalk_1.default.green(`Created integration file for ${agent} at ${path_1.default.join(template.dir, template.file)}`));
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', expectedFile: '.claude/commands/mspec.md' },
32
- { agent: 'gemini', expectedFile: '.gemini/commands/mspec.toml' },
33
- { agent: 'cursor', expectedFile: '.cursor/rules/mspec.mdc' },
34
- { agent: 'opencode', expectedFile: '.opencode/commands/mspec.md' },
35
- { agent: 'zed', expectedFile: '.mspec/INSTRUCTIONS.md' },
36
- { agent: 'generic', expectedFile: '.mspec/INSTRUCTIONS.md' }
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, expectedFile }) => {
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 integrationPath = path_1.default.join(tmpDir, expectedFile);
51
- expect(fs_1.default.existsSync(integrationPath)).toBe(true);
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 () => {
@@ -1,74 +1,79 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.templates = void 0;
4
- exports.getTemplate = getTemplate;
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: 'mspec.md',
13
+ file: `${cmd.name}.md`,
9
14
  content: `---
10
- description: "Commands for Spec-Driven Development using mspec"
15
+ description: "${cmd.desc} using mspec"
11
16
  ---
12
17
  You are an AI assistant using the mspec framework.
13
- When asked to /mspec:spec, /mspec:plan, or /mspec:apply, follow the minimalist spec-driven development guidelines.
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: 'mspec.toml',
20
- content: `description = "Commands for Spec-Driven Development using mspec"
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 /mspec:spec, /mspec:plan, or /mspec:apply, follow the minimalist spec-driven development guidelines.
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: 'mspec.mdc',
35
+ file: `${cmd.name}.mdc`,
31
36
  content: `---
32
- description: Commands for Spec-Driven Development using mspec
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 /mspec:spec, /mspec:plan, or /mspec:apply, follow the minimalist spec-driven development guidelines.
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: 'mspec.md',
47
+ file: `${cmd.name}.md`,
43
48
  content: `---
44
- description: "Commands for Spec-Driven Development using mspec"
49
+ description: "${cmd.desc} using mspec"
45
50
  ---
46
51
  You are an AI assistant using the mspec framework.
47
- When asked to /mspec:spec, /mspec:plan, or /mspec:apply, follow the minimalist spec-driven development guidelines.
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
- dir: '.mspec',
53
- file: 'INSTRUCTIONS.md',
54
- content: `# mspec Instructions
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:spec, /mspec:plan, or /mspec:apply, follow the minimalist spec-driven development guidelines.
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
- dir: '.mspec',
63
- file: 'INSTRUCTIONS.md',
64
- content: `# mspec Instructions
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:spec, /mspec:plan, or /mspec:apply, follow the minimalist spec-driven development guidelines.
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 getTemplate(agent) {
73
- return exports.templates[agent];
77
+ function getTemplates(agent) {
78
+ return exports.templates[agent] || [];
74
79
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "mspec",
3
- "version": "0.0.1",
3
+ "version": "0.0.2",
4
4
  "description": "A minimalist Spec-Driven Development (SDD) toolkit for solo developers and AI agents",
5
5
  "main": "index.js",
6
6
  "scripts": {