@agentlink.sh/cli 0.10.2 → 0.11.0

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 (3) hide show
  1. package/README.md +9 -6
  2. package/dist/index.js +74 -15
  3. package/package.json +1 -1
package/README.md CHANGED
@@ -41,16 +41,19 @@ The install scripts automatically detect your OS, install Node.js if needed, and
41
41
  ## Quick start
42
42
 
43
43
  ```bash
44
- # Create a new project (cloud by default, zero questions with name + prompt)
45
- agentlink my-app "Build a project management tool with kanban boards"
44
+ # Create a new project (cloud by default)
45
+ agentlink my-app
46
+
47
+ # With a prompt for Claude Code
48
+ agentlink my-app --prompt "Build a project management tool with kanban boards"
46
49
 
47
- # Interactive wizard (asks project name and frontend choice)
50
+ # Interactive wizard
48
51
  agentlink
49
52
  ```
50
53
 
51
54
  ## Commands
52
55
 
53
- ### `agentlink [name] [prompt]`
56
+ ### `agentlink [name]`
54
57
 
55
58
  Interactive wizard that scaffolds a new project or updates an existing one. Uses Supabase Cloud by default — region is auto-detected from your timezone, all recommended skills are installed automatically.
56
59
 
@@ -61,8 +64,8 @@ agentlink
61
64
  # With project name
62
65
  agentlink my-app
63
66
 
64
- # With name and prompt (zero questions express mode)
65
- agentlink my-app "Build a project management tool with kanban boards"
67
+ # With prompt (passed to Claude Code on launch)
68
+ agentlink my-app --prompt "Build a project management tool"
66
69
 
67
70
  # Local Docker mode (instead of cloud)
68
71
  agentlink my-app --local
package/dist/index.js CHANGED
@@ -3711,6 +3711,9 @@ async function scaffold(options) {
3711
3711
  if (options.cloud) {
3712
3712
  await trackedStep("start-supabase", "Creating Supabase cloud project", async (spinner) => {
3713
3713
  if (isResume && ctx.projectRef) {
3714
+ if (ctx.apiUrl && ctx.publishableKey && ctx.secretKey) {
3715
+ return;
3716
+ }
3714
3717
  spinner.text = "Creating Supabase cloud project \u2014 Waiting for project to be ready";
3715
3718
  await waitForProjectReady(ctx.projectRef, spinner);
3716
3719
  return;
@@ -3775,6 +3778,9 @@ async function scaffold(options) {
3775
3778
  });
3776
3779
  }
3777
3780
  await trackedStep("read-config", "Reading Supabase configuration", async () => {
3781
+ if (ctx.apiUrl && ctx.publishableKey && ctx.secretKey && (ctx.dbUrl || options.cloud)) {
3782
+ return;
3783
+ }
3778
3784
  if (options.cloud) {
3779
3785
  const keys = await getApiKeys(ctx.projectRef);
3780
3786
  ctx.apiUrl = `https://${ctx.projectRef}.supabase.co`;
@@ -4438,25 +4444,71 @@ function finishScaffold(summary, frontend, cloudConfig, prompt, launchClaude, sk
4438
4444
  console.log(` ${dim("Switch env")} agentlink env use <name>`);
4439
4445
  console.log(dim(" \u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500"));
4440
4446
  console.log();
4441
- if (launchClaude === false || nonInteractive) {
4447
+ if (launchClaude === false || nonInteractive || !prompt) {
4442
4448
  return;
4443
4449
  }
4444
4450
  console.log(blue(" Launching Claude Code..."));
4445
4451
  console.log();
4446
- const launchArgs = prompt ? `${JSON.stringify(prompt)}` : "";
4447
- execSync(`claude ${launchArgs}`, {
4452
+ execSync(`claude ${JSON.stringify(prompt)}`, {
4448
4453
  cwd: summary.projectDir,
4449
4454
  stdio: "inherit"
4450
4455
  });
4451
4456
  }
4452
- async function wizard(initialName, initialPrompt, opts = {}) {
4457
+ async function wizard(initialName, opts = {}) {
4453
4458
  const { forceUpdate, frontend: initialFrontend, local: localMode, skills: installSkills, launch: launchClaude, yes: autoYes, nonInteractive } = opts;
4454
- if (opts.prompt) {
4455
- initialPrompt = opts.prompt;
4456
- }
4457
4459
  if (opts.token) {
4458
4460
  process.env.SUPABASE_ACCESS_TOKEN = opts.token;
4459
4461
  }
4462
+ if (opts.link) {
4463
+ const { projectRef, dbUrl, apiUrl, publishableKey, secretKey } = opts.link;
4464
+ if (!projectRef || !dbUrl || !apiUrl || !publishableKey || !secretKey) {
4465
+ throw new Error(
4466
+ "--link requires all connection flags:\n --project-ref, --db-url, --api-url, --publishable-key, --secret-key"
4467
+ );
4468
+ }
4469
+ const name2 = initialName === "." ? path15.basename(process.cwd()) : initialName ?? "my-app";
4470
+ const scaffoldHere2 = initialName === ".";
4471
+ const projectDir2 = scaffoldHere2 ? process.cwd() : path15.resolve(process.cwd(), name2);
4472
+ const frontend2 = initialFrontend ?? "vite";
4473
+ const skills2 = installSkills === false ? [] : getCompanionSkills(frontend2);
4474
+ const region = projectRef.length > 0 ? "us-east-1" : "us-east-1";
4475
+ if (!scaffoldHere2) {
4476
+ fs15.mkdirSync(projectDir2, { recursive: true });
4477
+ }
4478
+ const cloudConfig2 = { orgId: "", region, label: "dev" };
4479
+ printBanner();
4480
+ console.log(dim(` v${pkg2.version}`));
4481
+ console.log();
4482
+ console.log(` ${blue("\u25CF")} Linking to Supabase project ${dim(projectRef)}`);
4483
+ console.log();
4484
+ const scaffoldOpts2 = { name: name2, skills: skills2, mode: "new", frontend: frontend2, cloud: cloudConfig2, nonInteractive: true };
4485
+ saveProgress(projectDir2, {
4486
+ version: pkg2.version,
4487
+ options: scaffoldOpts2,
4488
+ ctx: {
4489
+ dbUrl,
4490
+ apiUrl,
4491
+ publishableKey,
4492
+ secretKey,
4493
+ projectRef
4494
+ },
4495
+ completedSteps: [],
4496
+ prompt: opts.prompt ?? "",
4497
+ updatedAt: (/* @__PURE__ */ new Date()).toISOString()
4498
+ });
4499
+ saveSession(projectDir2, name2);
4500
+ const summary2 = await scaffold({
4501
+ ...scaffoldOpts2,
4502
+ resume: {
4503
+ completedSteps: [],
4504
+ ctx: { dbUrl, apiUrl, publishableKey, secretKey, projectRef },
4505
+ prompt: opts.prompt ?? "",
4506
+ projectDir: projectDir2
4507
+ }
4508
+ });
4509
+ finishScaffold(summary2, frontend2, cloudConfig2, opts.prompt ?? "", launchClaude, skills2, true);
4510
+ return;
4511
+ }
4460
4512
  printBanner();
4461
4513
  console.log(dim(` v${pkg2.version}`));
4462
4514
  console.log();
@@ -4676,7 +4728,6 @@ Run without --resume to start fresh.`
4676
4728
  });
4677
4729
  }
4678
4730
  } else if (initialName === ".") {
4679
- mode = "existing";
4680
4731
  name = path15.basename(process.cwd());
4681
4732
  } else if (initialName) {
4682
4733
  if (mode === "new") {
@@ -4704,7 +4755,7 @@ ${red("Error:")} ${error}`);
4704
4755
  if (mode === "new") {
4705
4756
  if (initialFrontend !== void 0) {
4706
4757
  frontend = initialFrontend;
4707
- } else if (nonInteractive || initialName && initialPrompt) {
4758
+ } else if (nonInteractive || initialName && opts.prompt) {
4708
4759
  frontend = "vite";
4709
4760
  } else {
4710
4761
  frontend = await select3({
@@ -4775,7 +4826,7 @@ ${red("Error:")} No organizations found. Create one at ${link("https://supabase.
4775
4826
  if (mode === "existing") {
4776
4827
  prompt = "Analyze the current project and plan a migration to the architecture proposed by AgentLink";
4777
4828
  } else {
4778
- prompt = initialPrompt ?? "";
4829
+ prompt = opts.prompt ?? "";
4779
4830
  }
4780
4831
  if (!useCloud && mode === "existing" && !autoYes && !nonInteractive) {
4781
4832
  const proceed = await confirm5({
@@ -4791,9 +4842,10 @@ ${amber("Aborted.")} Stop other Supabase instances manually before running again
4791
4842
  process.exit(0);
4792
4843
  }
4793
4844
  }
4794
- const projectDir = mode === "existing" ? process.cwd() : path15.resolve(process.cwd(), name);
4845
+ const scaffoldHere = mode === "existing" || initialName === ".";
4846
+ const projectDir = scaffoldHere ? process.cwd() : path15.resolve(process.cwd(), name);
4795
4847
  const scaffoldOpts = { name, skills, mode, frontend, cloud: cloudConfig, nonInteractive };
4796
- if (mode === "new") {
4848
+ if (!scaffoldHere) {
4797
4849
  fs15.mkdirSync(projectDir, { recursive: true });
4798
4850
  }
4799
4851
  saveProgress(projectDir, {
@@ -4819,7 +4871,7 @@ function enableDebug(cmd) {
4819
4871
  if (debug) initLog(true);
4820
4872
  }
4821
4873
  program.hook("preAction", (thisCommand) => enableDebug(thisCommand));
4822
- program.name("agentlink").description("CLI for scaffolding Supabase apps with AI agents").version(pkg3.version).argument("[name]", "Project name").argument("[prompt]", "What do you want to build?").option("--debug", "Write debug log to agentlink-debug.log").option("--force-update", "Force update even if project is up to date").option("--no-frontend", "Skip frontend scaffolding").option("--nextjs", "Use NextJS instead of React + Vite for frontend").option("--local", "Use local Docker instead of Supabase Cloud").option("--no-skills", "Skip companion skill installation").option("--no-launch", "Skip launching Claude Code after scaffold").option("-y, --yes", "Auto-confirm all prompts").option("--token <token>", "Supabase access token (skips interactive login)").option("--org <id>", "Supabase organization ID").option("--region <region>", "Supabase Cloud region (e.g. us-east-1)").option("--prompt <prompt>", "What to build (alternative to positional arg)").option("--resume", "Resume a previously failed scaffold").option("--non-interactive", "Error instead of prompting when info is missing").action(async (name, prompt) => {
4874
+ program.name("agentlink").description("CLI for scaffolding Supabase apps with AI agents").version(pkg3.version).argument("[name]", "Project name (use . to scaffold in current directory)").option("--debug", "Write debug log to agentlink-debug.log").option("--force-update", "Force update even if project is up to date").option("--no-frontend", "Skip frontend scaffolding").option("--nextjs", "Use NextJS instead of React + Vite for frontend").option("--local", "Use local Docker instead of Supabase Cloud").option("--no-skills", "Skip companion skill installation").option("--no-launch", "Skip launching Claude Code after scaffold").option("-y, --yes", "Auto-confirm all prompts").option("--token <token>", "Supabase access token (skips interactive login)").option("--org <id>", "Supabase organization ID").option("--region <region>", "Supabase Cloud region (e.g. us-east-1)").option("--prompt <prompt>", "What to build (passed to Claude Code on launch)").option("--resume", "Resume a previously failed scaffold").option("--non-interactive", "Error instead of prompting when info is missing").option("--link", "Link to an existing Supabase project (requires --project-ref and connection flags)").option("--project-ref <ref>", "Supabase project ref (used with --link)").option("--db-url <url>", "Database URL (used with --link)").option("--api-url <url>", "Supabase API URL (used with --link)").option("--publishable-key <key>", "Supabase publishable key (used with --link)").option("--secret-key <key>", "Supabase secret key (used with --link)").action(async (name) => {
4823
4875
  const opts = program.opts();
4824
4876
  const debug = opts.debug ?? false;
4825
4877
  initLog(debug);
@@ -4832,7 +4884,7 @@ program.name("agentlink").description("CLI for scaffolding Supabase apps with AI
4832
4884
  } else if (opts.frontend !== void 0) {
4833
4885
  frontend = "vite";
4834
4886
  }
4835
- await wizard(name, prompt, {
4887
+ await wizard(name, {
4836
4888
  forceUpdate: opts.forceUpdate,
4837
4889
  frontend,
4838
4890
  local: opts.local,
@@ -4844,7 +4896,14 @@ program.name("agentlink").description("CLI for scaffolding Supabase apps with AI
4844
4896
  region: opts.region,
4845
4897
  prompt: opts.prompt,
4846
4898
  resume: opts.resume,
4847
- nonInteractive: opts.nonInteractive
4899
+ nonInteractive: opts.nonInteractive,
4900
+ link: opts.link ? {
4901
+ projectRef: opts.projectRef,
4902
+ dbUrl: opts.dbUrl,
4903
+ apiUrl: opts.apiUrl,
4904
+ publishableKey: opts.publishableKey,
4905
+ secretKey: opts.secretKey
4906
+ } : void 0
4848
4907
  });
4849
4908
  } catch (err) {
4850
4909
  const msg = `
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@agentlink.sh/cli",
3
- "version": "0.10.2",
3
+ "version": "0.11.0",
4
4
  "description": "CLI for scaffolding Supabase apps with AI agents",
5
5
  "bin": {
6
6
  "agentlink": "dist/index.js"