@learnrudi/cli 1.8.5 → 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.
Files changed (2) hide show
  1. package/dist/index.cjs +59 -7
  2. package/package.json +1 -1
package/dist/index.cjs CHANGED
@@ -188,18 +188,33 @@ async function installDependencies(stackPath, manifest) {
188
188
  });
189
189
  return { installed: true };
190
190
  } else if (runtime === "python") {
191
- const requirementsPath = path.join(stackPath, "requirements.txt");
191
+ let requirementsPath = path.join(stackPath, "python", "requirements.txt");
192
+ let reqCwd = path.join(stackPath, "python");
192
193
  try {
193
194
  await fs.access(requirementsPath);
194
195
  } catch {
195
- return { installed: false, reason: "No requirements.txt" };
196
+ requirementsPath = path.join(stackPath, "requirements.txt");
197
+ reqCwd = stackPath;
198
+ try {
199
+ await fs.access(requirementsPath);
200
+ } catch {
201
+ return { installed: false, reason: "No requirements.txt" };
202
+ }
196
203
  }
197
204
  const pipCmd = getBundledBinary("python", "pip");
198
205
  console.log(` Installing pip dependencies...`);
199
- (0, import_child_process.execSync)(`"${pipCmd}" install -r requirements.txt`, {
200
- cwd: stackPath,
201
- stdio: "pipe"
202
- });
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
+ }
203
218
  return { installed: true };
204
219
  }
205
220
  return { installed: false, reason: `Unknown runtime: ${runtime}` };
@@ -218,6 +233,30 @@ function getSecretLink(secret) {
218
233
  if (typeof secret !== "object" || !secret) return null;
219
234
  return secret.link || secret.helpUrl || null;
220
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
+ }
221
260
  async function checkSecrets(manifest) {
222
261
  const secrets = getManifestSecrets(manifest);
223
262
  const found = [];
@@ -345,11 +384,24 @@ Installing...`);
345
384
  if (resolved.kind === "stack") {
346
385
  const manifest = await loadManifest(result.path);
347
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
+ }
348
394
  const depResult = await installDependencies(result.path, manifest);
349
395
  if (depResult.installed) {
350
396
  console.log(` \u2713 Dependencies installed`);
351
397
  } else if (depResult.error) {
352
- console.log(` \u26A0 Failed to install dependencies: ${depResult.error}`);
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);
353
405
  }
354
406
  const { found, missing } = await checkSecrets(manifest);
355
407
  const envExampleKeys = await parseEnvExample(result.path);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@learnrudi/cli",
3
- "version": "1.8.5",
3
+ "version": "1.8.7",
4
4
  "description": "RUDI CLI - Install and manage MCP stacks, runtimes, and AI agents",
5
5
  "type": "module",
6
6
  "main": "dist/index.cjs",