cskit-cli 1.0.5 → 1.0.7
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 +54 -42
package/package.json
CHANGED
package/src/commands/init.js
CHANGED
|
@@ -97,24 +97,53 @@ async function setupPythonEnv(projectDir, spinner) {
|
|
|
97
97
|
const pipPath = path.join(venvPath, 'bin', 'pip');
|
|
98
98
|
|
|
99
99
|
try {
|
|
100
|
-
execSync(`"${pipPath}" install -r requirements.txt
|
|
100
|
+
execSync(`"${pipPath}" install -r requirements.txt`, {
|
|
101
101
|
stdio: 'pipe',
|
|
102
102
|
cwd: libPythonDir
|
|
103
103
|
});
|
|
104
104
|
spinner.succeed(`Python environment ready (${pythonVersion})`);
|
|
105
105
|
return { success: true, version: pythonVersion };
|
|
106
106
|
} catch (pipError) {
|
|
107
|
-
//
|
|
107
|
+
// Extract failed packages from error output
|
|
108
|
+
const errorOutput = pipError.stderr ? pipError.stderr.toString() : pipError.message;
|
|
109
|
+
const failedPackages = [];
|
|
110
|
+
|
|
111
|
+
// Parse error output for specific package failures
|
|
112
|
+
const lines = errorOutput.split('\n');
|
|
113
|
+
for (const line of lines) {
|
|
114
|
+
if (line.includes('No matching distribution') || line.includes('Could not find')) {
|
|
115
|
+
const match = line.match(/for\s+(\S+)/);
|
|
116
|
+
if (match) failedPackages.push(match[1]);
|
|
117
|
+
}
|
|
118
|
+
if (line.includes('ERROR:')) {
|
|
119
|
+
const pkgMatch = line.match(/ERROR:.*?(\S+>=[\d.]+)/);
|
|
120
|
+
if (pkgMatch) failedPackages.push(pkgMatch[1]);
|
|
121
|
+
}
|
|
122
|
+
}
|
|
123
|
+
|
|
124
|
+
// Try installing without failed packages
|
|
108
125
|
spinner.text = 'Retrying with core packages...';
|
|
109
126
|
try {
|
|
110
127
|
execSync(`"${pipPath}" install numpy pandas scipy pydantic rich click -q`, {
|
|
111
128
|
stdio: 'pipe',
|
|
112
129
|
cwd: libPythonDir
|
|
113
130
|
});
|
|
114
|
-
|
|
115
|
-
|
|
131
|
+
|
|
132
|
+
// Show specific failures
|
|
133
|
+
if (failedPackages.length > 0) {
|
|
134
|
+
spinner.warn(`Partial install - failed packages:`);
|
|
135
|
+
console.log(chalk.yellow(`\n Failed: ${failedPackages.join(', ')}`));
|
|
136
|
+
console.log(chalk.dim(` Run manually: ${pipPath} install <package>\n`));
|
|
137
|
+
} else {
|
|
138
|
+
spinner.warn('Partial install - some optional packages failed');
|
|
139
|
+
console.log(chalk.dim(`\n Error: ${errorOutput.slice(0, 200)}...\n`));
|
|
140
|
+
}
|
|
141
|
+
|
|
142
|
+
return { success: true, partial: true, version: pythonVersion, failed: failedPackages };
|
|
116
143
|
} catch {
|
|
117
|
-
|
|
144
|
+
spinner.fail('Python setup failed');
|
|
145
|
+
console.log(chalk.red(`\n ${errorOutput.slice(0, 500)}\n`));
|
|
146
|
+
return { success: false, error: errorOutput.slice(0, 200) };
|
|
118
147
|
}
|
|
119
148
|
}
|
|
120
149
|
} catch (error) {
|
|
@@ -124,42 +153,25 @@ async function setupPythonEnv(projectDir, spinner) {
|
|
|
124
153
|
}
|
|
125
154
|
|
|
126
155
|
/**
|
|
127
|
-
*
|
|
156
|
+
* Remap source paths to .claude/ destinations
|
|
157
|
+
* Downloads directly to Claude Code directories
|
|
128
158
|
*/
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
{ src: 'domains', dest: '.claude/skills/csk/domains' },
|
|
141
|
-
{ src: 'industries', dest: '.claude/skills/csk/industries' },
|
|
142
|
-
{ src: 'lib', dest: '.claude/skills/csk/lib' }
|
|
143
|
-
];
|
|
144
|
-
|
|
145
|
-
let copied = 0;
|
|
146
|
-
for (const { src, dest } of mappings) {
|
|
147
|
-
const srcPath = path.join(projectDir, src);
|
|
148
|
-
const destPath = path.join(projectDir, dest);
|
|
149
|
-
|
|
150
|
-
if (fs.existsSync(srcPath)) {
|
|
151
|
-
ensureDir(destPath);
|
|
152
|
-
copyDirRecursive(srcPath, destPath);
|
|
153
|
-
copied++;
|
|
154
|
-
}
|
|
159
|
+
function remapPath(filePath) {
|
|
160
|
+
const mappings = [
|
|
161
|
+
{ from: 'src/commands/', to: '.claude/commands/' },
|
|
162
|
+
{ from: 'core/', to: '.claude/skills/csk/core/' },
|
|
163
|
+
{ from: 'domains/', to: '.claude/skills/csk/domains/' },
|
|
164
|
+
{ from: 'industries/', to: '.claude/skills/csk/industries/' }
|
|
165
|
+
];
|
|
166
|
+
|
|
167
|
+
for (const { from, to } of mappings) {
|
|
168
|
+
if (filePath.startsWith(from)) {
|
|
169
|
+
return filePath.replace(from, to);
|
|
155
170
|
}
|
|
156
|
-
|
|
157
|
-
spinner.succeed(`CSK installed to .claude/ (${copied} modules)`);
|
|
158
|
-
return { success: true };
|
|
159
|
-
} catch (error) {
|
|
160
|
-
spinner.warn(`CSK setup failed: ${error.message}`);
|
|
161
|
-
return { success: false, error: error.message };
|
|
162
171
|
}
|
|
172
|
+
|
|
173
|
+
// Keep other files as-is (lib/, cli/, config/, etc.)
|
|
174
|
+
return filePath;
|
|
163
175
|
}
|
|
164
176
|
|
|
165
177
|
/**
|
|
@@ -277,8 +289,8 @@ async function initCommand(options) {
|
|
|
277
289
|
|
|
278
290
|
for (let i = 0; i < files.length; i++) {
|
|
279
291
|
const file = files[i];
|
|
280
|
-
const
|
|
281
|
-
const
|
|
292
|
+
const relativePath = remapPath(file.path);
|
|
293
|
+
const targetPath = path.join(projectDir, relativePath);
|
|
282
294
|
|
|
283
295
|
// Update progress bar
|
|
284
296
|
process.stdout.write(`\r ${progressBar(i + 1, files.length)} ${chalk.dim(`(${i + 1}/${files.length})`)}`);
|
|
@@ -339,8 +351,8 @@ async function initCommand(options) {
|
|
|
339
351
|
console.log('');
|
|
340
352
|
const pythonResult = await setupPythonEnv(projectDir, spinner);
|
|
341
353
|
|
|
342
|
-
//
|
|
343
|
-
|
|
354
|
+
// CSK files already downloaded to .claude/ (no copy needed)
|
|
355
|
+
spinner.succeed('CSK installed to .claude/');
|
|
344
356
|
|
|
345
357
|
// Success message
|
|
346
358
|
const ver = selectedVersion.replace(/^v/, '');
|