@learnrudi/cli 1.8.6 → 1.8.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/dist/index.cjs +50 -5
- package/package.json +1 -1
package/dist/index.cjs
CHANGED
|
@@ -203,10 +203,18 @@ async function installDependencies(stackPath, manifest) {
|
|
|
203
203
|
}
|
|
204
204
|
const pipCmd = getBundledBinary("python", "pip");
|
|
205
205
|
console.log(` Installing pip dependencies...`);
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
|
|
206
|
+
try {
|
|
207
|
+
(0, import_child_process.execSync)(`"${pipCmd}" install -r requirements.txt`, {
|
|
208
|
+
cwd: reqCwd,
|
|
209
|
+
stdio: "pipe"
|
|
210
|
+
});
|
|
211
|
+
} catch (pipError) {
|
|
212
|
+
const stderr = pipError.stderr?.toString() || "";
|
|
213
|
+
const stdout = pipError.stdout?.toString() || "";
|
|
214
|
+
const output = stderr || stdout || pipError.message;
|
|
215
|
+
return { installed: false, error: `pip install failed:
|
|
216
|
+
${output}` };
|
|
217
|
+
}
|
|
210
218
|
return { installed: true };
|
|
211
219
|
}
|
|
212
220
|
return { installed: false, reason: `Unknown runtime: ${runtime}` };
|
|
@@ -225,6 +233,30 @@ function getSecretLink(secret) {
|
|
|
225
233
|
if (typeof secret !== "object" || !secret) return null;
|
|
226
234
|
return secret.link || secret.helpUrl || null;
|
|
227
235
|
}
|
|
236
|
+
function validateStackEntryPoint(stackPath, manifest) {
|
|
237
|
+
let command = manifest.command;
|
|
238
|
+
if (!command || command.length === 0) {
|
|
239
|
+
if (manifest.mcp?.command) {
|
|
240
|
+
const mcpCmd = manifest.mcp.command;
|
|
241
|
+
const mcpArgs = manifest.mcp.args || [];
|
|
242
|
+
command = [mcpCmd, ...mcpArgs];
|
|
243
|
+
}
|
|
244
|
+
}
|
|
245
|
+
if (!command || command.length === 0) {
|
|
246
|
+
return { valid: false, error: "No command defined in manifest" };
|
|
247
|
+
}
|
|
248
|
+
const runtimeCommands = ["node", "python", "python3", "npx", "deno", "bun"];
|
|
249
|
+
for (const arg of command) {
|
|
250
|
+
if (runtimeCommands.includes(arg)) continue;
|
|
251
|
+
if (arg.startsWith("-")) continue;
|
|
252
|
+
const entryPath = require("path").join(stackPath, arg);
|
|
253
|
+
if (!require("fs").existsSync(entryPath)) {
|
|
254
|
+
return { valid: false, error: `Entry point not found: ${arg}` };
|
|
255
|
+
}
|
|
256
|
+
return { valid: true };
|
|
257
|
+
}
|
|
258
|
+
return { valid: true };
|
|
259
|
+
}
|
|
228
260
|
async function checkSecrets(manifest) {
|
|
229
261
|
const secrets = getManifestSecrets(manifest);
|
|
230
262
|
const found = [];
|
|
@@ -352,11 +384,24 @@ Installing...`);
|
|
|
352
384
|
if (resolved.kind === "stack") {
|
|
353
385
|
const manifest = await loadManifest(result.path);
|
|
354
386
|
if (manifest) {
|
|
387
|
+
const validation = validateStackEntryPoint(result.path, manifest);
|
|
388
|
+
if (!validation.valid) {
|
|
389
|
+
console.error(`
|
|
390
|
+
\u2717 Stack validation failed: ${validation.error}`);
|
|
391
|
+
console.error(` The stack may be incomplete or misconfigured.`);
|
|
392
|
+
process.exit(1);
|
|
393
|
+
}
|
|
355
394
|
const depResult = await installDependencies(result.path, manifest);
|
|
356
395
|
if (depResult.installed) {
|
|
357
396
|
console.log(` \u2713 Dependencies installed`);
|
|
358
397
|
} else if (depResult.error) {
|
|
359
|
-
console.
|
|
398
|
+
console.error(`
|
|
399
|
+
\u2717 Failed to install dependencies:`);
|
|
400
|
+
console.error(` ${depResult.error}`);
|
|
401
|
+
console.error(`
|
|
402
|
+
Stack installed but may not work. Fix dependencies and run:`);
|
|
403
|
+
console.error(` rudi install ${result.id}`);
|
|
404
|
+
process.exit(1);
|
|
360
405
|
}
|
|
361
406
|
const { found, missing } = await checkSecrets(manifest);
|
|
362
407
|
const envExampleKeys = await parseEnvExample(result.path);
|