cskit-cli 1.0.2 → 1.0.3
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 +61 -0
package/package.json
CHANGED
package/src/commands/init.js
CHANGED
|
@@ -96,6 +96,64 @@ async function setupPythonEnv(projectDir, spinner) {
|
|
|
96
96
|
}
|
|
97
97
|
}
|
|
98
98
|
|
|
99
|
+
/**
|
|
100
|
+
* Setup CSK in Claude Code directories
|
|
101
|
+
*/
|
|
102
|
+
async function setupCommands(projectDir, spinner) {
|
|
103
|
+
spinner.start('Setting up CSK for Claude Code...');
|
|
104
|
+
|
|
105
|
+
try {
|
|
106
|
+
const claudeDir = path.join(projectDir, '.claude');
|
|
107
|
+
ensureDir(claudeDir);
|
|
108
|
+
|
|
109
|
+
// Map: source → destination
|
|
110
|
+
const mappings = [
|
|
111
|
+
{ src: 'src/commands', dest: '.claude/commands' },
|
|
112
|
+
{ src: 'core', dest: '.claude/skills/csk/core' },
|
|
113
|
+
{ src: 'domains', dest: '.claude/skills/csk/domains' },
|
|
114
|
+
{ src: 'industries', dest: '.claude/skills/csk/industries' },
|
|
115
|
+
{ src: 'lib', dest: '.claude/skills/csk/lib' }
|
|
116
|
+
];
|
|
117
|
+
|
|
118
|
+
let copied = 0;
|
|
119
|
+
for (const { src, dest } of mappings) {
|
|
120
|
+
const srcPath = path.join(projectDir, src);
|
|
121
|
+
const destPath = path.join(projectDir, dest);
|
|
122
|
+
|
|
123
|
+
if (fs.existsSync(srcPath)) {
|
|
124
|
+
ensureDir(destPath);
|
|
125
|
+
copyDirRecursive(srcPath, destPath);
|
|
126
|
+
copied++;
|
|
127
|
+
}
|
|
128
|
+
}
|
|
129
|
+
|
|
130
|
+
spinner.succeed(`CSK installed to .claude/ (${copied} modules)`);
|
|
131
|
+
return { success: true };
|
|
132
|
+
} catch (error) {
|
|
133
|
+
spinner.warn(`CSK setup failed: ${error.message}`);
|
|
134
|
+
return { success: false, error: error.message };
|
|
135
|
+
}
|
|
136
|
+
}
|
|
137
|
+
|
|
138
|
+
/**
|
|
139
|
+
* Recursively copy directory
|
|
140
|
+
*/
|
|
141
|
+
function copyDirRecursive(src, dest) {
|
|
142
|
+
const entries = fs.readdirSync(src, { withFileTypes: true });
|
|
143
|
+
|
|
144
|
+
for (const entry of entries) {
|
|
145
|
+
const srcPath = path.join(src, entry.name);
|
|
146
|
+
const destPath = path.join(dest, entry.name);
|
|
147
|
+
|
|
148
|
+
if (entry.isDirectory()) {
|
|
149
|
+
ensureDir(destPath);
|
|
150
|
+
copyDirRecursive(srcPath, destPath);
|
|
151
|
+
} else {
|
|
152
|
+
fs.copyFileSync(srcPath, destPath);
|
|
153
|
+
}
|
|
154
|
+
}
|
|
155
|
+
}
|
|
156
|
+
|
|
99
157
|
/**
|
|
100
158
|
* Main init command handler
|
|
101
159
|
*/
|
|
@@ -254,6 +312,9 @@ async function initCommand(options) {
|
|
|
254
312
|
console.log('');
|
|
255
313
|
const pythonResult = await setupPythonEnv(projectDir, spinner);
|
|
256
314
|
|
|
315
|
+
// Copy commands to .claude/commands/
|
|
316
|
+
await setupCommands(projectDir, spinner);
|
|
317
|
+
|
|
257
318
|
// Success message
|
|
258
319
|
const ver = selectedVersion.replace(/^v/, '');
|
|
259
320
|
console.log(chalk.green(`\n ✓ CSK v${ver} ${isUpdate ? 'updated' : 'installed'} successfully!\n`));
|