cp-toolkit 2.2.2 → 2.2.4

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.
Files changed (71) hide show
  1. package/package.json +1 -1
  2. package/src/commands/add.js +23 -16
  3. package/src/commands/doctor.js +15 -10
  4. package/src/commands/init.js +410 -64
  5. package/templates/AGENTS.md +47 -0
  6. package/templates/ARCHITECTURE.md +42 -0
  7. package/templates/agents/backend-specialist.md +1 -0
  8. package/templates/agents/code-archaeologist.md +116 -106
  9. package/templates/agents/database-architect.md +1 -0
  10. package/templates/agents/debugger.md +1 -0
  11. package/templates/agents/devops-engineer.md +1 -0
  12. package/templates/agents/documentation-writer.md +1 -0
  13. package/templates/agents/explorer-agent.md +83 -73
  14. package/templates/agents/frontend-specialist.md +1 -0
  15. package/templates/agents/game-developer.md +1 -0
  16. package/templates/agents/mobile-developer.md +1 -0
  17. package/templates/agents/orchestrator.md +426 -416
  18. package/templates/agents/penetration-tester.md +1 -0
  19. package/templates/agents/performance-optimizer.md +1 -0
  20. package/templates/agents/product-manager.md +122 -112
  21. package/templates/agents/product-owner.md +105 -95
  22. package/templates/agents/project-planner.md +416 -406
  23. package/templates/agents/qa-automation-engineer.md +113 -103
  24. package/templates/agents/security-auditor.md +1 -0
  25. package/templates/agents/seo-specialist.md +1 -0
  26. package/templates/agents/test-engineer.md +1 -0
  27. package/templates/skills/core/behavioral-modes/SKILL.md +244 -242
  28. package/templates/skills/core/brainstorming/SKILL.md +166 -163
  29. package/templates/skills/core/mcp-builder/SKILL.md +178 -176
  30. package/templates/skills/core/parallel-agents/SKILL.md +187 -175
  31. package/templates/skills/core/plan-writing/SKILL.md +154 -152
  32. package/templates/skills/optional/api-patterns/SKILL.md +83 -81
  33. package/templates/skills/optional/app-builder/SKILL.md +78 -75
  34. package/templates/skills/optional/app-builder/templates/SKILL.md +41 -39
  35. package/templates/skills/optional/architecture/SKILL.md +58 -55
  36. package/templates/skills/optional/bash-linux/SKILL.md +201 -199
  37. package/templates/skills/optional/code-review-checklist/SKILL.md +110 -109
  38. package/templates/skills/optional/database-design/SKILL.md +54 -52
  39. package/templates/skills/optional/deployment-procedures/SKILL.md +243 -241
  40. package/templates/skills/optional/documentation-templates/SKILL.md +196 -194
  41. package/templates/skills/optional/frontend-design/SKILL.md +421 -418
  42. package/templates/skills/optional/game-development/2d-games/SKILL.md +120 -119
  43. package/templates/skills/optional/game-development/3d-games/SKILL.md +136 -135
  44. package/templates/skills/optional/game-development/SKILL.md +169 -167
  45. package/templates/skills/optional/game-development/game-art/SKILL.md +187 -185
  46. package/templates/skills/optional/game-development/game-audio/SKILL.md +192 -190
  47. package/templates/skills/optional/game-development/game-design/SKILL.md +131 -129
  48. package/templates/skills/optional/game-development/mobile-games/SKILL.md +110 -108
  49. package/templates/skills/optional/game-development/multiplayer/SKILL.md +133 -132
  50. package/templates/skills/optional/game-development/pc-games/SKILL.md +146 -144
  51. package/templates/skills/optional/game-development/vr-ar/SKILL.md +124 -123
  52. package/templates/skills/optional/game-development/web-games/SKILL.md +152 -150
  53. package/templates/skills/optional/geo-fundamentals/SKILL.md +158 -156
  54. package/templates/skills/optional/i18n-localization/SKILL.md +156 -154
  55. package/templates/skills/optional/lint-and-validate/SKILL.md +48 -45
  56. package/templates/skills/optional/mobile-design/SKILL.md +397 -394
  57. package/templates/skills/optional/nextjs-react-expert/SKILL.md +271 -267
  58. package/templates/skills/optional/nodejs-best-practices/SKILL.md +335 -333
  59. package/templates/skills/optional/performance-profiling/SKILL.md +145 -143
  60. package/templates/skills/optional/powershell-windows/SKILL.md +169 -167
  61. package/templates/skills/optional/python-patterns/SKILL.md +443 -441
  62. package/templates/skills/optional/red-team-tactics/SKILL.md +201 -199
  63. package/templates/skills/optional/seo-fundamentals/SKILL.md +130 -129
  64. package/templates/skills/optional/server-management/SKILL.md +163 -161
  65. package/templates/skills/optional/systematic-debugging/SKILL.md +111 -109
  66. package/templates/skills/optional/tailwind-patterns/SKILL.md +271 -269
  67. package/templates/skills/optional/tdd-workflow/SKILL.md +150 -149
  68. package/templates/skills/optional/testing-patterns/SKILL.md +179 -178
  69. package/templates/skills/optional/vulnerability-scanner/SKILL.md +278 -276
  70. package/templates/skills/optional/web-design-guidelines/SKILL.md +60 -57
  71. package/templates/skills/optional/webapp-testing/SKILL.md +188 -187
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "cp-toolkit",
3
- "version": "2.2.2",
3
+ "version": "2.2.4",
4
4
  "description": "Copilot Toolkit - AI Agent framework for GitHub Copilot, Claude, Gemini CLI, and other AI assistants",
5
5
  "keywords": [
6
6
  "ai-agents",
@@ -13,6 +13,8 @@ const AGENT_TEMPLATES = {
13
13
  specialist: (name, description, triggers) => `---
14
14
  name: ${name}
15
15
  description: ${description}
16
+ version: 1.0
17
+ skills: clean-code
16
18
  ---
17
19
 
18
20
  # ${name}
@@ -39,6 +41,8 @@ ${triggers.map(t => `- ${t} related tasks`).join('\n')}
39
41
  reviewer: (name, description, triggers) => `---
40
42
  name: ${name}
41
43
  description: ${description}
44
+ version: 1.0
45
+ skills: clean-code, qa-automation-engineer
42
46
  ---
43
47
 
44
48
  # ${name}
@@ -76,7 +80,7 @@ description: ${description}
76
80
 
77
81
  export async function addCommand(type, name, options) {
78
82
  const targetDir = process.cwd();
79
-
83
+
80
84
  // Validate type
81
85
  const validTypes = ['agent', 'instruction'];
82
86
  if (!validTypes.includes(type)) {
@@ -84,7 +88,7 @@ export async function addCommand(type, name, options) {
84
88
  console.log(chalk.dim(` Valid types: ${validTypes.join(', ')}`));
85
89
  return;
86
90
  }
87
-
91
+
88
92
  // Check if cp-kit is initialized
89
93
  const githubDir = path.join(targetDir, '.github');
90
94
  if (!fs.existsSync(path.join(githubDir, 'copilot-instructions.md'))) {
@@ -92,9 +96,9 @@ export async function addCommand(type, name, options) {
92
96
  console.log(chalk.dim(' Run: cp-kit init'));
93
97
  return;
94
98
  }
95
-
99
+
96
100
  console.log(chalk.bold.cyan(`\n➕ Adding ${type}: ${name}\n`));
97
-
101
+
98
102
  switch (type) {
99
103
  case 'agent':
100
104
  await addAgent(githubDir, name, options);
@@ -107,12 +111,12 @@ export async function addCommand(type, name, options) {
107
111
 
108
112
  async function addAgent(githubDir, name, options) {
109
113
  const agentFile = path.join(githubDir, 'agents', `${name}.md`);
110
-
114
+
111
115
  if (fs.existsSync(agentFile)) {
112
116
  console.log(chalk.yellow(`⚠️ Agent "${name}" already exists.`));
113
117
  return;
114
118
  }
115
-
119
+
116
120
  const response = await prompts([
117
121
  {
118
122
  type: 'text',
@@ -136,30 +140,30 @@ async function addAgent(githubDir, name, options) {
136
140
  ]
137
141
  }
138
142
  ]);
139
-
143
+
140
144
  if (!response.description) {
141
145
  console.log(chalk.yellow('Aborted.'));
142
146
  return;
143
147
  }
144
-
148
+
145
149
  const triggers = response.triggers.split(',').map(t => t.trim());
146
150
  const content = AGENT_TEMPLATES[response.template](name, response.description, triggers);
147
-
151
+
148
152
  await fs.ensureDir(path.dirname(agentFile));
149
153
  await fs.writeFile(agentFile, content);
150
-
154
+
151
155
  console.log(chalk.green(`✅ Created agent: .github/agents/${name}.md`));
152
156
  console.log(chalk.dim(` Invoke with @${name} in Copilot Chat`));
153
157
  }
154
158
 
155
159
  async function addInstruction(githubDir, name, options) {
156
160
  const instrFile = path.join(githubDir, 'instructions', `${name}.instructions.md`);
157
-
161
+
158
162
  if (fs.existsSync(instrFile)) {
159
163
  console.log(chalk.yellow(`⚠️ Instruction "${name}" already exists.`));
160
164
  return;
161
165
  }
162
-
166
+
163
167
  const response = await prompts([
164
168
  {
165
169
  type: 'text',
@@ -174,13 +178,16 @@ async function addInstruction(githubDir, name, options) {
174
178
  initial: `${name} coding guidelines`
175
179
  }
176
180
  ]);
177
-
181
+
178
182
  if (!response.applyTo) {
179
183
  console.log(chalk.yellow('Aborted.'));
180
184
  return;
181
185
  }
182
-
186
+
183
187
  const content = `---
188
+ name: ${name}
189
+ description: ${response.description}
190
+ version: 1.0
184
191
  applyTo: "${response.applyTo}"
185
192
  ---
186
193
 
@@ -201,10 +208,10 @@ applyTo: "${response.applyTo}"
201
208
  ### Best Practices
202
209
  - [Add specific guidelines here]
203
210
  `;
204
-
211
+
205
212
  await fs.ensureDir(path.dirname(instrFile));
206
213
  await fs.writeFile(instrFile, content);
207
-
214
+
208
215
  console.log(chalk.green(`✅ Created instruction: .github/instructions/${name}.instructions.md`));
209
216
  console.log(chalk.dim(` Will apply to: ${response.applyTo}`));
210
217
  }
@@ -61,7 +61,7 @@ const CHECKS = [
61
61
  fix: 'Run: cp-kit init (with MCP option)'
62
62
  },
63
63
  {
64
- name: 'Instructions have valid applyTo',
64
+ name: 'Instructions have valid frontmatter (applyTo, version)',
65
65
  check: async (dir) => {
66
66
  const instrDir = path.join(dir, '.github', 'instructions');
67
67
  if (!await fs.pathExists(instrDir)) return true;
@@ -69,13 +69,15 @@ const CHECKS = [
69
69
  for (const file of files.filter(f => f.endsWith('.instructions.md'))) {
70
70
  const content = await fs.readFile(path.join(instrDir, file), 'utf-8');
71
71
  if (!content.includes('applyTo:')) return false;
72
+ if (!content.includes('version:')) return false;
73
+ if (!content.includes('description:')) return false;
72
74
  }
73
75
  return true;
74
76
  },
75
- fix: 'Add applyTo frontmatter to instruction files'
77
+ fix: 'Add version and description frontmatter to instruction files'
76
78
  },
77
79
  {
78
- name: 'Agents have valid frontmatter',
80
+ name: 'Agents have complete frontmatter (name, description, skills)',
79
81
  check: async (dir) => {
80
82
  const agentsDir = path.join(dir, '.github', 'agents');
81
83
  if (!await fs.pathExists(agentsDir)) return true;
@@ -84,30 +86,33 @@ const CHECKS = [
84
86
  const content = await fs.readFile(path.join(agentsDir, file), 'utf-8');
85
87
  if (!content.startsWith('---')) return false;
86
88
  if (!content.includes('name:')) return false;
89
+ if (!content.includes('description:')) return false;
90
+ if (!content.includes('skills:')) return false;
91
+ if (!content.includes('applyTo:')) return false;
87
92
  }
88
93
  return true;
89
94
  },
90
- fix: 'Add frontmatter with name: to agent files'
95
+ fix: 'Update agent files with full frontmatter (name, description, skills, applyTo)'
91
96
  }
92
97
  ];
93
98
 
94
99
  export async function doctorCommand() {
95
100
  const targetDir = process.cwd();
96
-
101
+
97
102
  console.log('');
98
103
  console.log(chalk.bold.cyan('🩺 cp-kit Doctor'));
99
104
  console.log(chalk.gray('─'.repeat(50)));
100
105
  console.log(chalk.gray(`Checking: ${targetDir}`));
101
106
  console.log('');
102
-
107
+
103
108
  let passed = 0;
104
109
  let failed = 0;
105
110
  let warnings = 0;
106
-
111
+
107
112
  for (const check of CHECKS) {
108
113
  try {
109
114
  const result = await check.check(targetDir);
110
-
115
+
111
116
  if (result) {
112
117
  console.log(chalk.green(' ✓ ') + check.name);
113
118
  passed++;
@@ -126,10 +131,10 @@ export async function doctorCommand() {
126
131
  failed++;
127
132
  }
128
133
  }
129
-
134
+
130
135
  console.log('');
131
136
  console.log(chalk.gray('─'.repeat(50)));
132
-
137
+
133
138
  if (failed === 0) {
134
139
  if (warnings > 0) {
135
140
  console.log(chalk.green.bold(`✓ All checks passed!`) + chalk.gray(` (${passed} passed, ${warnings} optional)`));