@locusai/cli 0.17.8 → 0.17.10

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/bin/locus.js +37 -16
  2. package/package.json +1 -1
package/bin/locus.js CHANGED
@@ -7709,7 +7709,7 @@ ${bold("locus plan")} — AI-powered sprint planning
7709
7709
 
7710
7710
  ${bold("Usage:")}
7711
7711
  locus plan "<directive>" ${dim("# AI creates a plan file")}
7712
- locus plan approve <id> ${dim("# Create GitHub issues from saved plan")}
7712
+ locus plan approve <id> [--sprint <name>] ${dim("# Create GitHub issues from saved plan")}
7713
7713
  locus plan list ${dim("# List saved plans")}
7714
7714
  locus plan show <id> ${dim("# Show a saved plan")}
7715
7715
  locus plan --from-issues --sprint <name> ${dim("# Organize existing issues")}
@@ -7723,6 +7723,7 @@ ${bold("Examples:")}
7723
7723
  locus plan "Build user authentication with OAuth"
7724
7724
  locus plan "Improve API performance" --sprint "Sprint 3"
7725
7725
  locus plan approve abc123
7726
+ locus plan approve abc123 --sprint "Sprint 3"
7726
7727
  locus plan list
7727
7728
  locus plan --from-issues --sprint "Sprint 2"
7728
7729
 
@@ -7771,7 +7772,8 @@ async function planCommand(projectRoot, args, flags = {}) {
7771
7772
  return handleShowPlan(projectRoot, args[1]);
7772
7773
  }
7773
7774
  if (args[0] === "approve") {
7774
- return handleApprovePlan(projectRoot, args[1], flags);
7775
+ const approveArgs = parsePlanArgs(args.slice(2));
7776
+ return handleApprovePlan(projectRoot, args[1], { ...flags, dryRun: flags.dryRun || approveArgs.dryRun }, approveArgs.sprintName);
7775
7777
  }
7776
7778
  const parsedArgs = parsePlanArgs(args);
7777
7779
  if (parsedArgs.error) {
@@ -7870,11 +7872,11 @@ ${bold("Plan:")} ${cyan(plan.directive)}
7870
7872
  }
7871
7873
  process.stderr.write(`
7872
7874
  `);
7873
- process.stderr.write(` Approve: ${bold(`locus plan approve ${plan.id.slice(0, 8)}`)}
7875
+ process.stderr.write(` Approve: ${bold(`locus plan approve ${plan.id.slice(0, 8)}`)} ${dim("(--sprint <name> to assign to a sprint)")}
7874
7876
 
7875
7877
  `);
7876
7878
  }
7877
- async function handleApprovePlan(projectRoot, id, flags) {
7879
+ async function handleApprovePlan(projectRoot, id, flags, sprintOverride) {
7878
7880
  if (!id) {
7879
7881
  process.stderr.write(`${red("✗")} Please provide a plan ID.
7880
7882
  `);
@@ -7898,11 +7900,12 @@ async function handleApprovePlan(projectRoot, id, flags) {
7898
7900
  return;
7899
7901
  }
7900
7902
  const config = loadConfig(projectRoot);
7903
+ const sprintName = sprintOverride ?? plan.sprint ?? undefined;
7901
7904
  process.stderr.write(`
7902
- ${bold("Approving plan:")} ${cyan(plan.directive)}
7905
+ ${bold("Approving plan:")}
7903
7906
  `);
7904
- if (plan.sprint) {
7905
- process.stderr.write(` ${dim(`Sprint: ${plan.sprint}`)}
7907
+ if (sprintName) {
7908
+ process.stderr.write(` ${dim(`Sprint: ${sprintName}`)}
7906
7909
  `);
7907
7910
  }
7908
7911
  process.stderr.write(`
@@ -7921,15 +7924,16 @@ ${bold("Approving plan:")} ${cyan(plan.directive)}
7921
7924
  `);
7922
7925
  return;
7923
7926
  }
7924
- await createPlannedIssues(projectRoot, config, plan.issues, plan.sprint ?? undefined);
7927
+ await createPlannedIssues(projectRoot, config, plan.issues, sprintName);
7925
7928
  }
7926
7929
  async function handleAIPlan(projectRoot, config, directive, sprintName, flags) {
7927
7930
  const id = generateId();
7928
7931
  const plansDir = ensurePlansDir(projectRoot);
7929
7932
  const planPath = join14(plansDir, `${id}.json`);
7930
7933
  const planPathRelative = `.locus/plans/${id}.json`;
7934
+ const displayDirective = directive;
7931
7935
  process.stderr.write(`
7932
- ${bold("Planning:")} ${cyan(directive)}
7936
+ ${bold("Planning:")} ${cyan(displayDirective)}
7933
7937
  `);
7934
7938
  if (sprintName) {
7935
7939
  process.stderr.write(` ${dim(`Sprint: ${sprintName}`)}
@@ -7938,8 +7942,25 @@ ${bold("Planning:")} ${cyan(directive)}
7938
7942
  process.stderr.write(`
7939
7943
  `);
7940
7944
  const prompt = buildPlanningPrompt(projectRoot, config, directive, sprintName, id, planPathRelative);
7941
- const { execCommand: execCommand2 } = await Promise.resolve().then(() => (init_exec(), exports_exec));
7942
- await execCommand2(projectRoot, [prompt], {});
7945
+ const aiResult = await runAI({
7946
+ prompt,
7947
+ provider: config.ai.provider,
7948
+ model: flags.model ?? config.ai.model,
7949
+ cwd: projectRoot,
7950
+ activity: "planning"
7951
+ });
7952
+ if (aiResult.interrupted) {
7953
+ process.stderr.write(`
7954
+ ${yellow("⚡")} Planning interrupted.
7955
+ `);
7956
+ return;
7957
+ }
7958
+ if (!aiResult.success) {
7959
+ process.stderr.write(`
7960
+ ${red("✗")} Planning failed: ${aiResult.error}
7961
+ `);
7962
+ return;
7963
+ }
7943
7964
  if (!existsSync13(planPath)) {
7944
7965
  process.stderr.write(`
7945
7966
  ${yellow("⚠")} Plan file was not created at ${bold(planPathRelative)}.
@@ -8279,6 +8300,7 @@ ${green("✓")} Created ${planned.length} issues.${milestoneTitle ? ` Sprint: ${
8279
8300
  `);
8280
8301
  }
8281
8302
  var init_plan = __esm(() => {
8303
+ init_run_ai();
8282
8304
  init_config();
8283
8305
  init_github();
8284
8306
  init_terminal();
@@ -8916,13 +8938,12 @@ async function convertDiscussionToPlan(projectRoot, id) {
8916
8938
  return;
8917
8939
  }
8918
8940
  const content = readFileSync12(join16(dir, match), "utf-8");
8919
- process.stderr.write(`
8920
- ${bold("Converting discussion to plan:")} ${cyan(id)}
8921
-
8922
- `);
8941
+ const titleMatch = content.match(/^#\s+(.+)/m);
8942
+ const discussionTitle = titleMatch ? titleMatch[1].trim() : id;
8923
8943
  await planCommand(projectRoot, [
8924
- `Create a detailed, actionable implementation plan based on this discussion document:
8944
+ `Create implementation plan from discussion: "${discussionTitle}"
8925
8945
 
8946
+ DISCUSSION CONTENT:
8926
8947
  ${content.slice(0, 8000)}`
8927
8948
  ], {});
8928
8949
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@locusai/cli",
3
- "version": "0.17.8",
3
+ "version": "0.17.10",
4
4
  "description": "GitHub-native AI engineering assistant",
5
5
  "type": "module",
6
6
  "bin": {