@rebasepro/cli 0.9.1-canary.e3f810f → 0.9.1-canary.eab7ae2
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,
|
|
1
|
+
export declare function skillsCommand(subcommand: string | undefined, _args: string[]): Promise<void>;
|
package/dist/index.es.js
CHANGED
|
@@ -943,13 +943,6 @@ async function promptForOptions(rawArgs, pm) {
|
|
|
943
943
|
cloudUrl: resolveCloudUrl(rawArgs)
|
|
944
944
|
};
|
|
945
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
|
-
}
|
|
953
946
|
const questions = buildInitQuestions({
|
|
954
947
|
nameArg,
|
|
955
948
|
templateArg,
|
|
@@ -2477,43 +2470,22 @@ function installForAgent(agentKey, skills, projectDir) {
|
|
|
2477
2470
|
}
|
|
2478
2471
|
return count;
|
|
2479
2472
|
}
|
|
2480
|
-
async function skillsCommand(subcommand,
|
|
2473
|
+
async function skillsCommand(subcommand, _args) {
|
|
2481
2474
|
switch (subcommand) {
|
|
2482
2475
|
case "install":
|
|
2483
|
-
await skillsInstall(
|
|
2476
|
+
await skillsInstall();
|
|
2484
2477
|
break;
|
|
2485
2478
|
case "--help":
|
|
2486
2479
|
case void 0:
|
|
2487
2480
|
printSkillsHelp();
|
|
2488
2481
|
break;
|
|
2489
2482
|
default:
|
|
2490
|
-
console.
|
|
2483
|
+
console.log(chalk.red(`Unknown skills subcommand: ${subcommand}`));
|
|
2491
2484
|
console.log("");
|
|
2492
2485
|
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);
|
|
2513
2486
|
}
|
|
2514
|
-
return requested;
|
|
2515
2487
|
}
|
|
2516
|
-
async function skillsInstall(
|
|
2488
|
+
async function skillsInstall() {
|
|
2517
2489
|
const projectDir = process.cwd();
|
|
2518
2490
|
let skillsDir;
|
|
2519
2491
|
try {
|
|
@@ -2527,14 +2499,8 @@ async function skillsInstall(rawArgs = []) {
|
|
|
2527
2499
|
console.error(`${chalk.red.bold("ERROR")} No skills found in ${skillsDir}`);
|
|
2528
2500
|
process.exit(1);
|
|
2529
2501
|
}
|
|
2530
|
-
let agents =
|
|
2502
|
+
let agents = detectAgents(projectDir);
|
|
2531
2503
|
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
|
-
}
|
|
2538
2504
|
const choices = Object.entries(AGENTS).map(([key, agent]) => ({
|
|
2539
2505
|
name: agent.label,
|
|
2540
2506
|
value: key,
|
|
@@ -2576,15 +2542,8 @@ ${chalk.green.bold("Subcommands")}
|
|
|
2576
2542
|
${chalk.blue.bold("install")} Install Rebase agent skills for your AI coding assistant
|
|
2577
2543
|
Supports: Cursor, Claude Code, Windsurf, Gemini CLI, Antigravity
|
|
2578
2544
|
|
|
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
|
-
|
|
2584
2545
|
${chalk.green.bold("Examples")}
|
|
2585
2546
|
${chalk.cyan("rebase skills install")}
|
|
2586
|
-
${chalk.cyan("rebase skills install --agent claude")}
|
|
2587
|
-
${chalk.cyan("rebase skills install --agent claude,cursor")}
|
|
2588
2547
|
`);
|
|
2589
2548
|
}
|
|
2590
2549
|
//#endregion
|
|
@@ -2616,16 +2575,9 @@ function loadEnv(projectRoot) {
|
|
|
2616
2575
|
}
|
|
2617
2576
|
return env;
|
|
2618
2577
|
}
|
|
2619
|
-
function resolveBaseUrl(env
|
|
2620
|
-
|
|
2621
|
-
|
|
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"}`;
|
|
2578
|
+
function resolveBaseUrl(env) {
|
|
2579
|
+
const port = env.PORT || env.REBASE_PORT || "3001";
|
|
2580
|
+
return env.REBASE_BASE_URL || `http://localhost:${port}`;
|
|
2629
2581
|
}
|
|
2630
2582
|
async function apiKeysCommand(subcommand, rawArgs) {
|
|
2631
2583
|
if (!subcommand || subcommand === "--help") {
|
|
@@ -2650,9 +2602,8 @@ async function apiKeysCommand(subcommand, rawArgs) {
|
|
|
2650
2602
|
}
|
|
2651
2603
|
}
|
|
2652
2604
|
async function listKeys(_rawArgs) {
|
|
2653
|
-
const
|
|
2654
|
-
const
|
|
2655
|
-
const baseUrl = resolveBaseUrl(env, projectRoot);
|
|
2605
|
+
const env = loadEnv(requireProjectRoot());
|
|
2606
|
+
const baseUrl = resolveBaseUrl(env);
|
|
2656
2607
|
const serviceKey = env.SERVICE_KEY || env.REBASE_SERVICE_KEY;
|
|
2657
2608
|
if (!serviceKey) {
|
|
2658
2609
|
console.error(chalk.red("✗ SERVICE_KEY not found in .env — required for admin operations."));
|
|
@@ -2757,9 +2708,8 @@ async function createKey(rawArgs) {
|
|
|
2757
2708
|
expires_at = parsed.toISOString();
|
|
2758
2709
|
}
|
|
2759
2710
|
}
|
|
2760
|
-
const
|
|
2761
|
-
const
|
|
2762
|
-
const baseUrl = resolveBaseUrl(env, projectRoot);
|
|
2711
|
+
const env = loadEnv(requireProjectRoot());
|
|
2712
|
+
const baseUrl = resolveBaseUrl(env);
|
|
2763
2713
|
const serviceKey = env.SERVICE_KEY || env.REBASE_SERVICE_KEY;
|
|
2764
2714
|
if (!serviceKey) {
|
|
2765
2715
|
console.error(chalk.red("✗ SERVICE_KEY not found in .env — required for admin operations."));
|
|
@@ -2816,9 +2766,8 @@ async function revokeKey(rawArgs) {
|
|
|
2816
2766
|
console.log(chalk.gray(" Usage: rebase api-keys revoke <key-id>"));
|
|
2817
2767
|
process.exit(1);
|
|
2818
2768
|
}
|
|
2819
|
-
const
|
|
2820
|
-
const
|
|
2821
|
-
const baseUrl = resolveBaseUrl(env, projectRoot);
|
|
2769
|
+
const env = loadEnv(requireProjectRoot());
|
|
2770
|
+
const baseUrl = resolveBaseUrl(env);
|
|
2822
2771
|
const serviceKey = env.SERVICE_KEY || env.REBASE_SERVICE_KEY;
|
|
2823
2772
|
if (!serviceKey) {
|
|
2824
2773
|
console.error(chalk.red("✗ SERVICE_KEY not found in .env — required for admin operations."));
|
|
@@ -3287,18 +3236,13 @@ function fmtDate(value) {
|
|
|
3287
3236
|
*/
|
|
3288
3237
|
var POLL_INTERVAL_MS = 1500;
|
|
3289
3238
|
var POLL_TIMEOUT_MS = 900 * 1e3;
|
|
3290
|
-
var MAX_SOURCE_UPLOAD_BYTES = 100 * 1024 * 1024;
|
|
3291
3239
|
function sleep(ms) {
|
|
3292
3240
|
return new Promise((r) => setTimeout(r, ms));
|
|
3293
3241
|
}
|
|
3294
|
-
function run(cmd, cmdArgs, cwd
|
|
3242
|
+
function run(cmd, cmdArgs, cwd) {
|
|
3295
3243
|
return new Promise((resolve, reject) => {
|
|
3296
3244
|
const child = spawn(cmd, cmdArgs, {
|
|
3297
3245
|
cwd,
|
|
3298
|
-
env: env ? {
|
|
3299
|
-
...process.env,
|
|
3300
|
-
...env
|
|
3301
|
-
} : void 0,
|
|
3302
3246
|
stdio: [
|
|
3303
3247
|
"ignore",
|
|
3304
3248
|
"ignore",
|
|
@@ -3328,7 +3272,7 @@ async function createSourceTarball(sourceDir) {
|
|
|
3328
3272
|
for (const ignore of [".gitignore", ".rebaseignore"]) if (fs.existsSync(path.join(dir, ignore))) tarArgs.push(`--exclude-from=${ignore}`);
|
|
3329
3273
|
tarArgs.push(".");
|
|
3330
3274
|
try {
|
|
3331
|
-
await run("tar", tarArgs, dir
|
|
3275
|
+
await run("tar", tarArgs, dir);
|
|
3332
3276
|
} catch (e) {
|
|
3333
3277
|
fail(`Failed to package source: ${e instanceof Error ? e.message : String(e)}`);
|
|
3334
3278
|
}
|
|
@@ -3338,7 +3282,6 @@ async function createSourceTarball(sourceDir) {
|
|
|
3338
3282
|
async function uploadSource(url, token, projectId, tarPath) {
|
|
3339
3283
|
const bytes = fs.readFileSync(tarPath);
|
|
3340
3284
|
const sizeMb = (bytes.length / 1024 / 1024).toFixed(1);
|
|
3341
|
-
if (bytes.length > MAX_SOURCE_UPLOAD_BYTES) fail(`Source context is ${sizeMb} MB — the upload cap is ${Math.round(MAX_SOURCE_UPLOAD_BYTES / 1024 / 1024)} MB.`, "Trim the build context: exclude sourcemaps (*.map), build output and large assets via .rebaseignore or .gitignore.");
|
|
3342
3285
|
console.log(chalk.gray(` Uploading source (${sizeMb} MB)...`));
|
|
3343
3286
|
const res = await fetch(`${url}/api/functions/deploy/upload?projectId=${encodeURIComponent(projectId)}`, {
|
|
3344
3287
|
method: "POST",
|
|
@@ -4318,8 +4261,6 @@ ${chalk.green.bold("Options")}
|
|
|
4318
4261
|
${chalk.blue("--secret")} Mark a variable write-only ${chalk.gray("(set)")}
|
|
4319
4262
|
${chalk.blue("--json")} Machine-readable output
|
|
4320
4263
|
${chalk.blue("--project, -p")} Project slug ${chalk.gray("(defaults to the linked project)")}
|
|
4321
|
-
|
|
4322
|
-
${chalk.gray("Values are encrypted at rest (AES-256-GCM) and only decrypted at deploy time.")}
|
|
4323
4264
|
`);
|
|
4324
4265
|
}
|
|
4325
4266
|
function printEnvHelpJson() {
|
|
@@ -5680,10 +5621,9 @@ async function entry(args) {
|
|
|
5680
5621
|
await cloudCommand(effectiveSubcommand, args);
|
|
5681
5622
|
break;
|
|
5682
5623
|
default:
|
|
5683
|
-
console.
|
|
5624
|
+
console.log(chalk.red(`Unknown command: ${command}`));
|
|
5684
5625
|
console.log("");
|
|
5685
5626
|
printHelp();
|
|
5686
|
-
process.exit(1);
|
|
5687
5627
|
}
|
|
5688
5628
|
}
|
|
5689
5629
|
function printHelp() {
|