@fyow/copilot-everything 1.0.7 → 1.0.9
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/cli.js +10 -3
- package/src/commands/init.js +51 -5
package/package.json
CHANGED
package/src/cli.js
CHANGED
|
@@ -39,7 +39,9 @@ Commands:
|
|
|
39
39
|
|
|
40
40
|
Options:
|
|
41
41
|
--ai <type> Target AI platform: copilot (default), claude, or all
|
|
42
|
-
--force Overwrite existing files
|
|
42
|
+
--force Overwrite existing files (except MCP config)
|
|
43
|
+
--force-mcp Force overwrite MCP config (~/.copilot/mcp-config.json)
|
|
44
|
+
-y, --yes Skip confirmation prompts for force operations
|
|
43
45
|
--skip-agents Skip agent installation
|
|
44
46
|
--skip-skills Skip skills installation
|
|
45
47
|
--skip-hooks Skip hooks installation
|
|
@@ -48,9 +50,11 @@ Options:
|
|
|
48
50
|
|
|
49
51
|
Examples:
|
|
50
52
|
copilot-everything init
|
|
53
|
+
copilot-everything init --force-mcp
|
|
54
|
+
copilot-everything init --force-mcp -y
|
|
51
55
|
copilot-everything init --ai copilot
|
|
52
56
|
copilot-everything init --ai claude
|
|
53
|
-
copilot-everything init --ai all --force
|
|
57
|
+
copilot-everything init --ai all --force -y
|
|
54
58
|
|
|
55
59
|
Learn more: https://github.com/fyow/copilot-everything
|
|
56
60
|
`;
|
|
@@ -70,7 +74,10 @@ if (flags.h || flags.help || !command) {
|
|
|
70
74
|
// Execute command
|
|
71
75
|
switch (command) {
|
|
72
76
|
case 'init':
|
|
73
|
-
init(flags)
|
|
77
|
+
init(flags).catch(err => {
|
|
78
|
+
console.error('Error:', err.message);
|
|
79
|
+
process.exit(1);
|
|
80
|
+
});
|
|
74
81
|
break;
|
|
75
82
|
default:
|
|
76
83
|
console.error(`Unknown command: ${command}`);
|
package/src/commands/init.js
CHANGED
|
@@ -82,16 +82,36 @@ function copyFile(src, dest, options = {}) {
|
|
|
82
82
|
}
|
|
83
83
|
}
|
|
84
84
|
|
|
85
|
+
const readline = require('readline');
|
|
86
|
+
|
|
87
|
+
/**
|
|
88
|
+
* Prompt user for confirmation
|
|
89
|
+
*/
|
|
90
|
+
function confirm(message) {
|
|
91
|
+
return new Promise((resolve) => {
|
|
92
|
+
const rl = readline.createInterface({
|
|
93
|
+
input: process.stdin,
|
|
94
|
+
output: process.stdout
|
|
95
|
+
});
|
|
96
|
+
rl.question(`${message} (y/N): `, (answer) => {
|
|
97
|
+
rl.close();
|
|
98
|
+
resolve(answer.toLowerCase() === 'y' || answer.toLowerCase() === 'yes');
|
|
99
|
+
});
|
|
100
|
+
});
|
|
101
|
+
}
|
|
102
|
+
|
|
85
103
|
/**
|
|
86
104
|
* Main init function
|
|
87
105
|
*/
|
|
88
|
-
function init(flags = {}) {
|
|
106
|
+
async function init(flags = {}) {
|
|
89
107
|
const targetDir = process.cwd();
|
|
90
108
|
const aiType = flags.ai || 'copilot';
|
|
91
109
|
const force = flags.force || false;
|
|
110
|
+
const forceMcp = flags['force-mcp'] || false;
|
|
92
111
|
const skipAgents = flags['skip-agents'] || false;
|
|
93
112
|
const skipSkills = flags['skip-skills'] || false;
|
|
94
113
|
const skipHooks = flags['skip-hooks'] || false;
|
|
114
|
+
const yes = flags.yes || flags.y || false;
|
|
95
115
|
|
|
96
116
|
console.log('');
|
|
97
117
|
console.log('🚀 copilot-everything init');
|
|
@@ -99,8 +119,33 @@ function init(flags = {}) {
|
|
|
99
119
|
console.log(`📁 Target directory: ${targetDir}`);
|
|
100
120
|
console.log(`🤖 AI platform: ${aiType}`);
|
|
101
121
|
console.log(`⚡ Force overwrite: ${force ? 'yes' : 'no'}`);
|
|
122
|
+
console.log(`⚡ Force MCP overwrite: ${forceMcp ? 'yes' : 'no'}`);
|
|
102
123
|
console.log('');
|
|
103
124
|
|
|
125
|
+
// Confirm if using force flags
|
|
126
|
+
if ((force || forceMcp) && !yes) {
|
|
127
|
+
const warnings = [];
|
|
128
|
+
if (force) {
|
|
129
|
+
warnings.push(' ⚠️ --force will overwrite existing agent, skill, and instruction files');
|
|
130
|
+
}
|
|
131
|
+
if (forceMcp) {
|
|
132
|
+
warnings.push(' ⚠️ --force-mcp will overwrite ~/.copilot/mcp-config.json (your API keys!)');
|
|
133
|
+
}
|
|
134
|
+
|
|
135
|
+
console.log('⚠️ Warning:');
|
|
136
|
+
warnings.forEach(w => console.log(w));
|
|
137
|
+
console.log('');
|
|
138
|
+
|
|
139
|
+
const confirmed = await confirm('Do you want to continue?');
|
|
140
|
+
if (!confirmed) {
|
|
141
|
+
console.log('');
|
|
142
|
+
console.log('❌ Operation cancelled.');
|
|
143
|
+
console.log('');
|
|
144
|
+
return;
|
|
145
|
+
}
|
|
146
|
+
console.log('');
|
|
147
|
+
}
|
|
148
|
+
|
|
104
149
|
const options = { force };
|
|
105
150
|
let totalCopied = 0;
|
|
106
151
|
let totalSkipped = 0;
|
|
@@ -199,21 +244,22 @@ function init(flags = {}) {
|
|
|
199
244
|
totalErrors.push(...agentsMdResult.errors);
|
|
200
245
|
|
|
201
246
|
// MCP config to ~/.copilot/
|
|
202
|
-
//
|
|
247
|
+
// Only overwrite MCP config with --force-mcp flag, as it contains user's API keys and custom configs
|
|
203
248
|
const homeDir = process.env.HOME || process.env.USERPROFILE;
|
|
204
249
|
const mcpConfigSrc = path.join(PACKAGE_ROOT, 'copilot', 'mcp-config.json');
|
|
205
250
|
const mcpConfigDest = path.join(homeDir, '.copilot', 'mcp-config.json');
|
|
206
251
|
|
|
207
252
|
if (fs.existsSync(mcpConfigSrc)) {
|
|
208
|
-
if (fs.existsSync(mcpConfigDest)) {
|
|
253
|
+
if (fs.existsSync(mcpConfigDest) && !forceMcp) {
|
|
209
254
|
console.log(` ⚠️ MCP config: skipped (${mcpConfigDest} already exists)`);
|
|
210
255
|
console.log(` 💡 Your existing MCP configuration is preserved`);
|
|
256
|
+
console.log(` 💡 Use --force-mcp to overwrite with template`);
|
|
211
257
|
console.log(` 💡 Template available at: ${mcpConfigSrc}`);
|
|
212
258
|
totalSkipped += 1;
|
|
213
259
|
} else {
|
|
214
|
-
const mcpResult = copyFile(mcpConfigSrc, mcpConfigDest, { force:
|
|
260
|
+
const mcpResult = copyFile(mcpConfigSrc, mcpConfigDest, { force: forceMcp });
|
|
215
261
|
if (mcpResult.copied > 0) {
|
|
216
|
-
console.log(` ✅ MCP config: installed to ${mcpConfigDest}`);
|
|
262
|
+
console.log(` ✅ MCP config: ${forceMcp ? 'overwritten' : 'installed'} to ${mcpConfigDest}`);
|
|
217
263
|
}
|
|
218
264
|
totalCopied += mcpResult.copied;
|
|
219
265
|
totalSkipped += mcpResult.skipped;
|