cp-toolkit 2.1.0 ā 2.1.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/package.json +1 -1
- package/src/commands/init.js +25 -12
package/package.json
CHANGED
package/src/commands/init.js
CHANGED
|
@@ -259,9 +259,11 @@ const TEMPLATE_INSTRUCTIONS = {
|
|
|
259
259
|
};
|
|
260
260
|
|
|
261
261
|
export async function initCommand(directory, options) {
|
|
262
|
-
const
|
|
262
|
+
const targetDir = directory ? path.resolve(directory) : process.cwd();
|
|
263
|
+
const dirName = path.basename(targetDir);
|
|
264
|
+
const templatesDir = path.join(path.dirname(new URL(import.meta.url).pathname.replace(/^\/([A-Za-z]:)/, '$1')), '../../templates');
|
|
263
265
|
|
|
264
|
-
console.log(chalk.bold.cyan('\nš cp-
|
|
266
|
+
console.log(chalk.bold.cyan('\nš cp-toolkit - GitHub Copilot Agent Toolkit\n'));
|
|
265
267
|
|
|
266
268
|
// Create directory if needed
|
|
267
269
|
if (directory && !fs.existsSync(targetDir)) {
|
|
@@ -275,7 +277,7 @@ const templatesDir = path.resolve(__dirname, '../../templates');
|
|
|
275
277
|
const { overwrite } = await prompts({
|
|
276
278
|
type: 'confirm',
|
|
277
279
|
name: 'overwrite',
|
|
278
|
-
message: 'cp-
|
|
280
|
+
message: 'cp-toolkit (.agent) already initialized. Overwrite?',
|
|
279
281
|
initial: false
|
|
280
282
|
});
|
|
281
283
|
|
|
@@ -302,14 +304,14 @@ const templatesDir = path.resolve(__dirname, '../../templates');
|
|
|
302
304
|
{
|
|
303
305
|
type: 'confirm',
|
|
304
306
|
name: 'installEverything',
|
|
305
|
-
message: 'Install full
|
|
307
|
+
message: 'Install full Copilot Kit (Agents, Skills, Workflows)?',
|
|
306
308
|
initial: true
|
|
307
309
|
}
|
|
308
310
|
]);
|
|
309
311
|
config = { ...config, ...response };
|
|
310
312
|
}
|
|
311
313
|
|
|
312
|
-
const spinner = ora('Installing
|
|
314
|
+
const spinner = ora('Installing Copilot Kit...').start();
|
|
313
315
|
|
|
314
316
|
try {
|
|
315
317
|
// 1. Copy Templates to .agent folder
|
|
@@ -381,7 +383,7 @@ const templatesDir = path.resolve(__dirname, '../../templates');
|
|
|
381
383
|
// Based on list_dir earlier, it wasn't there. It was likely outside.
|
|
382
384
|
// We will generate a basic one if missing.
|
|
383
385
|
|
|
384
|
-
spinner.succeed(chalk.green('
|
|
386
|
+
spinner.succeed(chalk.green('Copilot Kit installed successfully!'));
|
|
385
387
|
|
|
386
388
|
console.log(chalk.bold('\nNext Steps:'));
|
|
387
389
|
console.log(`1. Open ${chalk.cyan('.github/copilot-instructions.md')} to see the setup.`);
|
|
@@ -396,18 +398,27 @@ const templatesDir = path.resolve(__dirname, '../../templates');
|
|
|
396
398
|
|
|
397
399
|
function generateAgentFile(agent) {
|
|
398
400
|
// Deprecated generally, using static files now, but keeping for fallback
|
|
399
|
-
return
|
|
401
|
+
return `---
|
|
402
|
+
name: ${agent.name}
|
|
403
|
+
description: ${agent.description}
|
|
404
|
+
skills: [${agent.skills.join(', ')}]
|
|
405
|
+
---
|
|
406
|
+
|
|
407
|
+
# ${agent.name}
|
|
408
|
+
|
|
409
|
+
${agent.description}
|
|
410
|
+
`;
|
|
400
411
|
}
|
|
401
412
|
|
|
402
413
|
function generateCopilotInstructions(config) {
|
|
403
|
-
return
|
|
414
|
+
return `# GitHub Copilot Instructions
|
|
404
415
|
|
|
405
|
-
> **
|
|
406
|
-
> Profile:
|
|
416
|
+
> **Copilot Kit Active**
|
|
417
|
+
> Profile: ${config.projectName}
|
|
407
418
|
|
|
408
419
|
## š§ Core Protocols
|
|
409
420
|
|
|
410
|
-
The user has installed the **
|
|
421
|
+
The user has installed the **Copilot Kit** in \`.agent/\`.
|
|
411
422
|
You must follow the rules defined in \`.agent/rules/GEMINI.md\`.
|
|
412
423
|
|
|
413
424
|
### Structure
|
|
@@ -424,7 +435,9 @@ Always read \`.agent/rules/GEMINI.md\` first.
|
|
|
424
435
|
## š ļø MCP Tools
|
|
425
436
|
An MCP server is configured at \`.agent/scripts/mcp-server.js\`.
|
|
426
437
|
Use it to list available tools, resources, and prompts.
|
|
427
|
-
|
|
438
|
+
`;
|
|
428
439
|
}
|
|
440
|
+
|
|
429
441
|
export default initCommand;
|
|
430
442
|
|
|
443
|
+
|