@sk-labs/copilot-kit 3.0.1 ā 3.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/lib/commands.js +149 -8
- package/package.json +1 -1
package/lib/commands.js
CHANGED
|
@@ -12,6 +12,8 @@ const GITHUB_API = 'https://api.github.com';
|
|
|
12
12
|
async function init(options) {
|
|
13
13
|
const targetPath = path.resolve(options.path || '.');
|
|
14
14
|
const githubPath = path.join(targetPath, '.github');
|
|
15
|
+
const vscodePath = path.join(targetPath, '.vscode');
|
|
16
|
+
const vscodeSettingsPath = path.join(vscodePath, 'settings.json');
|
|
15
17
|
|
|
16
18
|
if (!options.quiet) {
|
|
17
19
|
console.log(chalk.bold.blue('\nš Copilot Kit Installer\n'));
|
|
@@ -25,7 +27,7 @@ async function init(options) {
|
|
|
25
27
|
|
|
26
28
|
if (!shouldOverwrite) {
|
|
27
29
|
console.log(chalk.yellow('Aborted.\n'));
|
|
28
|
-
process.exit(0);
|
|
30
|
+
process.exit(0);
|
|
29
31
|
}
|
|
30
32
|
}
|
|
31
33
|
|
|
@@ -33,6 +35,7 @@ async function init(options) {
|
|
|
33
35
|
console.log(chalk.cyan('š Dry run - no changes will be made\n'));
|
|
34
36
|
console.log(chalk.dim('Would download from:'), `https://github.com/${GITHUB_REPO}/archive/${options.branch}.zip`);
|
|
35
37
|
console.log(chalk.dim('Would install to:'), githubPath);
|
|
38
|
+
console.log(chalk.dim('Would install to:'), vscodePath);
|
|
36
39
|
return;
|
|
37
40
|
}
|
|
38
41
|
|
|
@@ -44,15 +47,15 @@ async function init(options) {
|
|
|
44
47
|
|
|
45
48
|
if (spinner) spinner.text = 'Extracting files...';
|
|
46
49
|
|
|
47
|
-
// Extract .github
|
|
50
|
+
// Extract .github and .vscode folders
|
|
48
51
|
const zip = new AdmZip(zipBuffer);
|
|
49
52
|
const entries = zip.getEntries();
|
|
50
53
|
|
|
51
54
|
// Find the root folder name (copilot-kit-main or similar)
|
|
52
55
|
const rootFolder = entries[0].entryName.split('/')[0];
|
|
53
56
|
|
|
54
|
-
// Extract
|
|
55
|
-
let
|
|
57
|
+
// Extract .github folder
|
|
58
|
+
let githubFileCount = 0;
|
|
56
59
|
entries.forEach(entry => {
|
|
57
60
|
if (entry.entryName.startsWith(`${rootFolder}/.github/`)) {
|
|
58
61
|
const relativePath = entry.entryName.replace(`${rootFolder}/`, '');
|
|
@@ -63,18 +66,66 @@ async function init(options) {
|
|
|
63
66
|
} else {
|
|
64
67
|
fs.mkdirSync(path.dirname(targetFile), { recursive: true });
|
|
65
68
|
fs.writeFileSync(targetFile, entry.getData());
|
|
66
|
-
|
|
69
|
+
githubFileCount++;
|
|
67
70
|
}
|
|
68
71
|
}
|
|
69
72
|
});
|
|
70
73
|
|
|
74
|
+
// Handle .vscode/settings.json
|
|
75
|
+
if (spinner) spinner.text = 'Configuring VS Code settings...';
|
|
76
|
+
|
|
77
|
+
const vscodeSettingsEntry = entries.find(e => e.entryName === `${rootFolder}/.vscode/settings.json`);
|
|
78
|
+
|
|
79
|
+
if (vscodeSettingsEntry) {
|
|
80
|
+
const newSettings = JSON.parse(vscodeSettingsEntry.getData().toString('utf8'));
|
|
81
|
+
|
|
82
|
+
if (fs.existsSync(vscodeSettingsPath)) {
|
|
83
|
+
// .vscode/settings.json already exists
|
|
84
|
+
if (spinner) spinner.stop();
|
|
85
|
+
|
|
86
|
+
console.log(chalk.yellow('\nā ļø .vscode/settings.json already exists!'));
|
|
87
|
+
console.log(chalk.dim('Choose an option:'));
|
|
88
|
+
console.log(chalk.dim(' [R] Replace - Overwrite with Copilot Kit settings'));
|
|
89
|
+
console.log(chalk.dim(' [M] Merge - Add Copilot Kit settings to existing (recommended)'));
|
|
90
|
+
console.log(chalk.dim(' [S] Skip - Keep existing settings'));
|
|
91
|
+
|
|
92
|
+
const answer = await askQuestion(chalk.bold('\nYour choice (R/M/S): '));
|
|
93
|
+
const choice = answer.trim().toLowerCase();
|
|
94
|
+
|
|
95
|
+
if (choice === 'r') {
|
|
96
|
+
// Replace
|
|
97
|
+
fs.mkdirSync(vscodePath, { recursive: true });
|
|
98
|
+
fs.writeFileSync(vscodeSettingsPath, JSON.stringify(newSettings, null, 2));
|
|
99
|
+
console.log(chalk.green('ā Replaced .vscode/settings.json'));
|
|
100
|
+
} else if (choice === 'm') {
|
|
101
|
+
// Merge
|
|
102
|
+
const existingSettings = JSON.parse(fs.readFileSync(vscodeSettingsPath, 'utf8'));
|
|
103
|
+
const mergedSettings = mergeSettings(existingSettings, newSettings);
|
|
104
|
+
fs.writeFileSync(vscodeSettingsPath, JSON.stringify(mergedSettings, null, 2));
|
|
105
|
+
console.log(chalk.green('ā Merged Copilot Kit settings into existing settings.json'));
|
|
106
|
+
} else {
|
|
107
|
+
// Skip
|
|
108
|
+
console.log(chalk.yellow('ā Skipped .vscode/settings.json'));
|
|
109
|
+
}
|
|
110
|
+
|
|
111
|
+
if (spinner) spinner.start();
|
|
112
|
+
} else {
|
|
113
|
+
// No existing settings.json, create new
|
|
114
|
+
fs.mkdirSync(vscodePath, { recursive: true });
|
|
115
|
+
fs.writeFileSync(vscodeSettingsPath, JSON.stringify(newSettings, null, 2));
|
|
116
|
+
}
|
|
117
|
+
}
|
|
118
|
+
|
|
71
119
|
if (spinner) spinner.succeed(chalk.green('ā Copilot Kit installed successfully!'));
|
|
72
120
|
|
|
73
121
|
if (!options.quiet) {
|
|
74
|
-
console.log(chalk.dim(`\nš¦ Installed ${
|
|
122
|
+
console.log(chalk.dim(`\nš¦ Installed ${githubFileCount} files to ${githubPath}`));
|
|
123
|
+
console.log(chalk.dim(`š¦ Configured VS Code settings at ${vscodeSettingsPath}\n`));
|
|
124
|
+
console.log(chalk.bold('š“ CRITICAL: Reload VS Code for settings to take effect!'));
|
|
125
|
+
console.log(chalk.dim(' Press Ctrl+Shift+P ā "Developer: Reload Window"\n'));
|
|
75
126
|
console.log(chalk.bold('Next steps:'));
|
|
76
|
-
console.log(chalk.dim(' 1.
|
|
77
|
-
console.log(chalk.dim(' 2.
|
|
127
|
+
console.log(chalk.dim(' 1. Reload VS Code (Ctrl+Shift+P ā Reload Window)'));
|
|
128
|
+
console.log(chalk.dim(' 2. Test auto-detection: "Create a responsive card component"'));
|
|
78
129
|
console.log(chalk.dim(' 3. Docs: https://github.com/sk-labs/copilot-kit\n'));
|
|
79
130
|
}
|
|
80
131
|
} catch (error) {
|
|
@@ -141,6 +192,8 @@ async function update(options) {
|
|
|
141
192
|
async function status(options) {
|
|
142
193
|
const targetPath = path.resolve(options.path || '.');
|
|
143
194
|
const githubPath = path.join(targetPath, '.github');
|
|
195
|
+
const vscodePath = path.join(targetPath, '.vscode');
|
|
196
|
+
const vscodeSettingsPath = path.join(vscodePath, 'settings.json');
|
|
144
197
|
|
|
145
198
|
console.log(chalk.bold.blue('\nš Copilot Kit Status\n'));
|
|
146
199
|
|
|
@@ -179,6 +232,45 @@ async function status(options) {
|
|
|
179
232
|
}
|
|
180
233
|
});
|
|
181
234
|
|
|
235
|
+
// Check VS Code settings
|
|
236
|
+
console.log();
|
|
237
|
+
console.log(chalk.bold('VS Code Configuration:'));
|
|
238
|
+
|
|
239
|
+
if (fs.existsSync(vscodeSettingsPath)) {
|
|
240
|
+
try {
|
|
241
|
+
const settings = JSON.parse(fs.readFileSync(vscodeSettingsPath, 'utf8'));
|
|
242
|
+
|
|
243
|
+
// Check critical setting
|
|
244
|
+
const criticalSetting = settings['chat.customAgentInSubagent.enabled'];
|
|
245
|
+
if (criticalSetting === true) {
|
|
246
|
+
console.log(chalk.green('ā Auto-detection enabled'), chalk.dim('(chat.customAgentInSubagent.enabled)'));
|
|
247
|
+
} else {
|
|
248
|
+
console.log(chalk.red('ā Auto-detection disabled'), chalk.dim('(chat.customAgentInSubagent.enabled)'));
|
|
249
|
+
console.log(chalk.yellow(' ā ļø Run "copilot-kit init" to configure settings'));
|
|
250
|
+
}
|
|
251
|
+
|
|
252
|
+
// Check other important settings
|
|
253
|
+
const importantSettings = [
|
|
254
|
+
'chat.agentFilesLocations',
|
|
255
|
+
'chat.useAgentSkills',
|
|
256
|
+
'chat.agentSkillsLocations'
|
|
257
|
+
];
|
|
258
|
+
|
|
259
|
+
let configuredCount = 0;
|
|
260
|
+
importantSettings.forEach(key => {
|
|
261
|
+
if (settings[key] !== undefined) configuredCount++;
|
|
262
|
+
});
|
|
263
|
+
|
|
264
|
+
console.log(chalk.dim(` ${configuredCount}/${importantSettings.length} important settings configured`));
|
|
265
|
+
|
|
266
|
+
} catch (error) {
|
|
267
|
+
console.log(chalk.yellow('ā ļø settings.json exists but could not be parsed'));
|
|
268
|
+
}
|
|
269
|
+
} else {
|
|
270
|
+
console.log(chalk.yellow('ā ļø .vscode/settings.json not found'));
|
|
271
|
+
console.log(chalk.dim(' Run "copilot-kit init" to create it'));
|
|
272
|
+
}
|
|
273
|
+
|
|
182
274
|
console.log();
|
|
183
275
|
}
|
|
184
276
|
|
|
@@ -221,4 +313,53 @@ function askConfirmation(question) {
|
|
|
221
313
|
});
|
|
222
314
|
}
|
|
223
315
|
|
|
316
|
+
function askQuestion(question) {
|
|
317
|
+
const rl = readline.createInterface({
|
|
318
|
+
input: process.stdin,
|
|
319
|
+
output: process.stdout
|
|
320
|
+
});
|
|
321
|
+
|
|
322
|
+
return new Promise(resolve => {
|
|
323
|
+
rl.question(question, (answer) => {
|
|
324
|
+
rl.close();
|
|
325
|
+
resolve(answer);
|
|
326
|
+
});
|
|
327
|
+
});
|
|
328
|
+
}
|
|
329
|
+
|
|
330
|
+
function mergeSettings(existing, newSettings) {
|
|
331
|
+
// Merge settings, with Copilot Kit settings taking priority
|
|
332
|
+
const merged = { ...existing };
|
|
333
|
+
|
|
334
|
+
// Copilot Kit critical settings (always override)
|
|
335
|
+
const criticalSettings = [
|
|
336
|
+
'chat.customAgentInSubagent.enabled',
|
|
337
|
+
'chat.agentFilesLocations',
|
|
338
|
+
'chat.agent.enabled',
|
|
339
|
+
'chat.useAgentSkills',
|
|
340
|
+
'chat.agentSkillsLocations',
|
|
341
|
+
'github.copilot.chat.codeGeneration.useInstructionFiles',
|
|
342
|
+
'chat.instructionsFilesLocations',
|
|
343
|
+
'chat.includeApplyingInstructions',
|
|
344
|
+
'chat.promptFilesLocations',
|
|
345
|
+
'chat.useAgentsMdFile'
|
|
346
|
+
];
|
|
347
|
+
|
|
348
|
+
// Override critical settings
|
|
349
|
+
criticalSettings.forEach(key => {
|
|
350
|
+
if (newSettings[key] !== undefined) {
|
|
351
|
+
merged[key] = newSettings[key];
|
|
352
|
+
}
|
|
353
|
+
});
|
|
354
|
+
|
|
355
|
+
// Add other Copilot Kit settings if not present
|
|
356
|
+
Object.keys(newSettings).forEach(key => {
|
|
357
|
+
if (merged[key] === undefined) {
|
|
358
|
+
merged[key] = newSettings[key];
|
|
359
|
+
}
|
|
360
|
+
});
|
|
361
|
+
|
|
362
|
+
return merged;
|
|
363
|
+
}
|
|
364
|
+
|
|
224
365
|
module.exports = { init, update, status };
|