@rebasepro/cli 0.9.1-canary.f0ac103 → 0.9.1-canary.f2f61da

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.
@@ -1 +1 @@
1
- export declare function skillsCommand(subcommand: string | undefined, _args: string[]): Promise<void>;
1
+ export declare function skillsCommand(subcommand: string | undefined, rawArgs: string[]): Promise<void>;
package/dist/index.es.js CHANGED
@@ -135,7 +135,8 @@ function getPMCommands(pm) {
135
135
  runWorkspace: (workspace, script) => [
136
136
  "pnpm",
137
137
  "--filter",
138
- workspace,
138
+ `./${workspace}`,
139
+ "run",
139
140
  script
140
141
  ],
141
142
  dlx: (pkg, args) => [
@@ -942,6 +943,13 @@ async function promptForOptions(rawArgs, pm) {
942
943
  cloudUrl: resolveCloudUrl(rawArgs)
943
944
  };
944
945
  }
946
+ if (!process.stdin.isTTY) {
947
+ console.error(chalk.red("Cannot prompt: this is a non-interactive terminal (no TTY)."));
948
+ console.error(chalk.yellow(" Re-run with --yes to accept defaults, passing any choices as flags, e.g.:"));
949
+ console.error(chalk.yellow(` rebase init ${nameArg || "my-app"} --yes --template blog --flavor cms`));
950
+ console.error(chalk.gray(" Options: --template <blog|ecommerce|blank> --flavor <cms|baas> --database-url <url> --install --git"));
951
+ process.exit(1);
952
+ }
945
953
  const questions = buildInitQuestions({
946
954
  nameArg,
947
955
  templateArg,
@@ -2469,22 +2477,43 @@ function installForAgent(agentKey, skills, projectDir) {
2469
2477
  }
2470
2478
  return count;
2471
2479
  }
2472
- async function skillsCommand(subcommand, _args) {
2480
+ async function skillsCommand(subcommand, rawArgs) {
2473
2481
  switch (subcommand) {
2474
2482
  case "install":
2475
- await skillsInstall();
2483
+ await skillsInstall(rawArgs);
2476
2484
  break;
2477
2485
  case "--help":
2478
2486
  case void 0:
2479
2487
  printSkillsHelp();
2480
2488
  break;
2481
2489
  default:
2482
- console.log(chalk.red(`Unknown skills subcommand: ${subcommand}`));
2490
+ console.error(chalk.red(`Unknown skills subcommand: ${subcommand}`));
2483
2491
  console.log("");
2484
2492
  printSkillsHelp();
2493
+ process.exit(1);
2494
+ }
2495
+ }
2496
+ /**
2497
+ * Agents named explicitly on the command line, e.g. `--agent claude --agent cursor`
2498
+ * (also accepts a comma-separated list). Returns null when none were given.
2499
+ */
2500
+ function parseAgentFlags(rawArgs) {
2501
+ const requested = [];
2502
+ for (let i = 0; i < rawArgs.length; i++) {
2503
+ if (rawArgs[i] !== "--agent" && rawArgs[i] !== "-a") continue;
2504
+ const value = rawArgs[i + 1];
2505
+ if (value && !value.startsWith("-")) requested.push(...value.split(",").map((v) => v.trim()).filter(Boolean));
2506
+ }
2507
+ if (requested.length === 0) return null;
2508
+ const valid = Object.keys(AGENTS);
2509
+ const unknown = requested.filter((a) => !valid.includes(a));
2510
+ if (unknown.length > 0) {
2511
+ console.error(chalk.red(`Unknown agent(s): ${unknown.join(", ")}. Available: ${valid.join(", ")}`));
2512
+ process.exit(1);
2485
2513
  }
2514
+ return requested;
2486
2515
  }
2487
- async function skillsInstall() {
2516
+ async function skillsInstall(rawArgs = []) {
2488
2517
  const projectDir = process.cwd();
2489
2518
  let skillsDir;
2490
2519
  try {
@@ -2498,8 +2527,14 @@ async function skillsInstall() {
2498
2527
  console.error(`${chalk.red.bold("ERROR")} No skills found in ${skillsDir}`);
2499
2528
  process.exit(1);
2500
2529
  }
2501
- let agents = detectAgents(projectDir);
2530
+ let agents = parseAgentFlags(rawArgs) ?? detectAgents(projectDir);
2502
2531
  if (agents.length === 0) {
2532
+ if (!process.stdin.isTTY) {
2533
+ console.error(chalk.red("Cannot prompt: this is a non-interactive terminal (no TTY)."));
2534
+ console.error(chalk.yellow(` Name the agents explicitly, e.g. rebase skills install --agent ${Object.keys(AGENTS)[0]}`));
2535
+ console.error(chalk.gray(` Available: ${Object.keys(AGENTS).join(", ")}`));
2536
+ process.exit(1);
2537
+ }
2503
2538
  const choices = Object.entries(AGENTS).map(([key, agent]) => ({
2504
2539
  name: agent.label,
2505
2540
  value: key,
@@ -2541,8 +2576,15 @@ ${chalk.green.bold("Subcommands")}
2541
2576
  ${chalk.blue.bold("install")} Install Rebase agent skills for your AI coding assistant
2542
2577
  Supports: Cursor, Claude Code, Windsurf, Gemini CLI, Antigravity
2543
2578
 
2579
+ ${chalk.green.bold("Options")}
2580
+ ${chalk.blue("--agent, -a")} Agent(s) to install for, skipping detection and the prompt.
2581
+ Repeat the flag or pass a comma-separated list.
2582
+ Available: ${Object.keys(AGENTS).join(", ")}
2583
+
2544
2584
  ${chalk.green.bold("Examples")}
2545
2585
  ${chalk.cyan("rebase skills install")}
2586
+ ${chalk.cyan("rebase skills install --agent claude")}
2587
+ ${chalk.cyan("rebase skills install --agent claude,cursor")}
2546
2588
  `);
2547
2589
  }
2548
2590
  //#endregion
@@ -2574,9 +2616,16 @@ function loadEnv(projectRoot) {
2574
2616
  }
2575
2617
  return env;
2576
2618
  }
2577
- function resolveBaseUrl(env) {
2578
- const port = env.PORT || env.REBASE_PORT || "3001";
2579
- return env.REBASE_BASE_URL || `http://localhost:${port}`;
2619
+ function resolveBaseUrl(env, projectRoot) {
2620
+ if (env.REBASE_BASE_URL) return env.REBASE_BASE_URL;
2621
+ if (projectRoot) try {
2622
+ const urlFile = path.join(projectRoot, ".rebase-dev-url");
2623
+ if (fs.existsSync(urlFile)) {
2624
+ const devUrl = fs.readFileSync(urlFile, "utf-8").trim();
2625
+ if (devUrl) return devUrl;
2626
+ }
2627
+ } catch {}
2628
+ return `http://localhost:${env.PORT || env.REBASE_PORT || "3001"}`;
2580
2629
  }
2581
2630
  async function apiKeysCommand(subcommand, rawArgs) {
2582
2631
  if (!subcommand || subcommand === "--help") {
@@ -2601,8 +2650,9 @@ async function apiKeysCommand(subcommand, rawArgs) {
2601
2650
  }
2602
2651
  }
2603
2652
  async function listKeys(_rawArgs) {
2604
- const env = loadEnv(requireProjectRoot());
2605
- const baseUrl = resolveBaseUrl(env);
2653
+ const projectRoot = requireProjectRoot();
2654
+ const env = loadEnv(projectRoot);
2655
+ const baseUrl = resolveBaseUrl(env, projectRoot);
2606
2656
  const serviceKey = env.SERVICE_KEY || env.REBASE_SERVICE_KEY;
2607
2657
  if (!serviceKey) {
2608
2658
  console.error(chalk.red("✗ SERVICE_KEY not found in .env — required for admin operations."));
@@ -2707,8 +2757,9 @@ async function createKey(rawArgs) {
2707
2757
  expires_at = parsed.toISOString();
2708
2758
  }
2709
2759
  }
2710
- const env = loadEnv(requireProjectRoot());
2711
- const baseUrl = resolveBaseUrl(env);
2760
+ const projectRoot = requireProjectRoot();
2761
+ const env = loadEnv(projectRoot);
2762
+ const baseUrl = resolveBaseUrl(env, projectRoot);
2712
2763
  const serviceKey = env.SERVICE_KEY || env.REBASE_SERVICE_KEY;
2713
2764
  if (!serviceKey) {
2714
2765
  console.error(chalk.red("✗ SERVICE_KEY not found in .env — required for admin operations."));
@@ -2765,8 +2816,9 @@ async function revokeKey(rawArgs) {
2765
2816
  console.log(chalk.gray(" Usage: rebase api-keys revoke <key-id>"));
2766
2817
  process.exit(1);
2767
2818
  }
2768
- const env = loadEnv(requireProjectRoot());
2769
- const baseUrl = resolveBaseUrl(env);
2819
+ const projectRoot = requireProjectRoot();
2820
+ const env = loadEnv(projectRoot);
2821
+ const baseUrl = resolveBaseUrl(env, projectRoot);
2770
2822
  const serviceKey = env.SERVICE_KEY || env.REBASE_SERVICE_KEY;
2771
2823
  if (!serviceKey) {
2772
2824
  console.error(chalk.red("✗ SERVICE_KEY not found in .env — required for admin operations."));
@@ -4260,6 +4312,8 @@ ${chalk.green.bold("Options")}
4260
4312
  ${chalk.blue("--secret")} Mark a variable write-only ${chalk.gray("(set)")}
4261
4313
  ${chalk.blue("--json")} Machine-readable output
4262
4314
  ${chalk.blue("--project, -p")} Project slug ${chalk.gray("(defaults to the linked project)")}
4315
+
4316
+ ${chalk.gray("Values are encrypted at rest (AES-256-GCM) and only decrypted at deploy time.")}
4263
4317
  `);
4264
4318
  }
4265
4319
  function printEnvHelpJson() {
@@ -5620,9 +5674,10 @@ async function entry(args) {
5620
5674
  await cloudCommand(effectiveSubcommand, args);
5621
5675
  break;
5622
5676
  default:
5623
- console.log(chalk.red(`Unknown command: ${command}`));
5677
+ console.error(chalk.red(`Unknown command: ${command}`));
5624
5678
  console.log("");
5625
5679
  printHelp();
5680
+ process.exit(1);
5626
5681
  }
5627
5682
  }
5628
5683
  function printHelp() {