@locusai/cli 0.9.14 → 0.9.17

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.
@@ -24976,7 +24976,8 @@ var ApiResponseSchema = exports_external.object({
24976
24976
  meta: exports_external.object({
24977
24977
  pagination: PaginationMetaSchema.optional(),
24978
24978
  timestamp: exports_external.string(),
24979
- path: exports_external.string()
24979
+ path: exports_external.string(),
24980
+ requestId: exports_external.string().optional()
24980
24981
  }).optional()
24981
24982
  });
24982
24983
  var SuccessResponseSchema = exports_external.object({
package/bin/locus.js CHANGED
@@ -36693,7 +36693,8 @@ var init_common = __esm(() => {
36693
36693
  meta: exports_external.object({
36694
36694
  pagination: PaginationMetaSchema.optional(),
36695
36695
  timestamp: exports_external.string(),
36696
- path: exports_external.string()
36696
+ path: exports_external.string(),
36697
+ requestId: exports_external.string().optional()
36697
36698
  }).optional()
36698
36699
  });
36699
36700
  SuccessResponseSchema = exports_external.object({
@@ -40588,7 +40589,10 @@ function parseSprintPlanFromAI(raw, directive) {
40588
40589
  if (jsonMatch) {
40589
40590
  jsonStr = jsonMatch[1]?.trim() || "";
40590
40591
  }
40591
- const parsed = JSON.parse(jsonStr);
40592
+ let parsed = JSON.parse(jsonStr);
40593
+ if (parsed.revisedPlan) {
40594
+ parsed = parsed.revisedPlan;
40595
+ }
40592
40596
  const now = new Date().toISOString();
40593
40597
  const id = `plan-${Date.now()}`;
40594
40598
  const tasks2 = (parsed.tasks || []).map((t, i) => ({
@@ -40801,10 +40805,25 @@ Review and refine the Tech Lead's breakdown:
40801
40805
 
40802
40806
  1. **Ordering** — Order tasks so that foundational work comes first. Tasks that produce outputs consumed by later tasks must appear earlier in the list. Foundation tasks (schemas, config, shared code) must be listed before tasks that build on them. The array index IS the execution order.
40803
40807
  2. **Risk Assessment** — Flag tasks that are risky, underestimated, or have unknowns.
40804
- 3. **Task Splitting** — If a task is too large (would take more than a day), split it.
40805
- 4. **Task Merging** — If two tasks are trivially small and related, merge them.
40806
- 5. **Complexity Scoring** — Rate each task 1-5 (1=trivial, 5=very complex).
40807
- 6. **Missing Tasks** — Add any tasks the Tech Lead missed (database migrations, configuration, testing, etc.).
40808
+ 3. **Task Merging** — If two tasks are trivially small and related, merge them.
40809
+ 4. **Complexity Scoring** — Rate each task 1-5 (1=trivial, 5=very complex).
40810
+ 5. **Missing Tasks** — Add any tasks the Tech Lead missed (database migrations, configuration, testing, etc.).
40811
+
40812
+ ## CRITICAL: Task Isolation & Overlap Detection
40813
+
40814
+ Tasks are executed by INDEPENDENT agents on SEPARATE git branches that get merged together. Each agent has NO knowledge of what other agents are doing. You MUST enforce these rules:
40815
+
40816
+ 1. **Detect overlapping file modifications.** For each task, mentally list the files it will touch. If two tasks modify the same file (especially config files like app.module.ts, configuration.ts, package.json, or shared modules), they WILL cause merge conflicts. You must either:
40817
+ - **Merge them** into a single task, OR
40818
+ - **Move the shared file changes** into one foundational task that runs and merges first
40819
+
40820
+ 2. **Detect duplicated work.** If two tasks both introduce the same environment variable, config field, dependency, helper function, or module registration — that is duplicated work. Consolidate it into ONE task.
40821
+
40822
+ 3. **Do NOT split tasks that share code changes.** Even if a task is large, do NOT split it if the subtasks would both need to modify the same files. A single larger self-contained task is far better than two smaller conflicting tasks. Only split tasks when the parts are truly independent (touch completely different files and modules).
40823
+
40824
+ 4. **Validate self-containment.** Each task must include ALL changes it needs to function: config, schema, module registration, implementation, and tests. A task must NOT assume another concurrent task will provide something it needs.
40825
+
40826
+ 5. **Flag high-conflict zones.** In your risk assessment, specifically call out any remaining cases where tasks might touch the same files, and explain why it's unavoidable and how merge conflicts can be minimized.
40808
40827
 
40809
40828
  ## Output Format
40810
40829
 
@@ -40834,6 +40853,116 @@ Respond with ONLY a JSON object (no markdown code blocks, no explanation):
40834
40853
  return prompt;
40835
40854
  }
40836
40855
 
40856
+ // ../sdk/src/planning/agents/cross-task-reviewer.ts
40857
+ function buildCrossTaskReviewerPrompt(input) {
40858
+ let prompt = `# Role: Cross-Task Reviewer (Architect + Engineer + Planner)
40859
+
40860
+ You are a combined Architect, Senior Engineer, and Sprint Planner performing a FINAL review of a sprint plan. Your sole focus is ensuring that tasks are fully isolated and will not conflict when executed by independent agents on separate git branches.
40861
+
40862
+ ## Context
40863
+
40864
+ In this system, each task is executed by an independent AI agent that:
40865
+ - Works on its own git branch (worktree)
40866
+ - Has NO knowledge of what other agents are working on
40867
+ - Cannot see changes made by other concurrent agents
40868
+ - Its branch will be merged into main after completion
40869
+
40870
+ This means that if two tasks modify the same file, add the same dependency, or introduce the same config variable — they WILL cause merge conflicts and duplicated code.
40871
+
40872
+ ## CEO Directive
40873
+ > ${input.directive}
40874
+ `;
40875
+ if (input.feedback) {
40876
+ prompt += `
40877
+ ## CEO Feedback on Previous Plan
40878
+ > ${input.feedback}
40879
+
40880
+ IMPORTANT: Ensure the reviewed plan still addresses this feedback.
40881
+ `;
40882
+ }
40883
+ prompt += `
40884
+ ## Project Context
40885
+ ${input.projectContext || "No project context available."}
40886
+
40887
+ ## Sprint Plan to Review
40888
+ ${input.sprintOrganizerOutput}
40889
+
40890
+ ## Your Review Checklist
40891
+
40892
+ Go through EACH pair of tasks and check for:
40893
+
40894
+ ### 1. File Overlap Analysis
40895
+ For each task, list the files it will likely modify. Then check:
40896
+ - Do any two tasks modify the same file? (e.g., app.module.ts, configuration.ts, package.json, shared DTOs)
40897
+ - If yes: MERGE those tasks or move shared changes to a foundational task
40898
+
40899
+ ### 2. Duplicated Work Detection
40900
+ Check if multiple tasks:
40901
+ - Add the same environment variable or config field
40902
+ - Install or configure the same dependency
40903
+ - Register the same module or provider
40904
+ - Create the same helper function, guard, interceptor, or middleware
40905
+ - Add the same import to a shared file
40906
+ If yes: consolidate into ONE task
40907
+
40908
+ ### 3. Self-Containment Validation
40909
+ For each task, verify:
40910
+ - Does it include ALL config/env changes it needs?
40911
+ - Does it include ALL module registrations it needs?
40912
+ - Does it include ALL dependency installations it needs?
40913
+ - Can it be completed without ANY output from concurrent tasks?
40914
+
40915
+ ### 4. Merge Conflict Risk Zones
40916
+ Identify the highest-risk files (files that multiple tasks might touch) and ensure only ONE task modifies each.
40917
+
40918
+ ## Output Format
40919
+
40920
+ Respond with ONLY a JSON object (no markdown code blocks, no explanation):
40921
+
40922
+ {
40923
+ "hasIssues": true | false,
40924
+ "issues": [
40925
+ {
40926
+ "type": "file_overlap" | "duplicated_work" | "not_self_contained" | "merge_conflict_risk",
40927
+ "description": "string describing the specific issue",
40928
+ "affectedTasks": ["Task Title 1", "Task Title 2"],
40929
+ "resolution": "string describing how to fix it (merge, move, consolidate)"
40930
+ }
40931
+ ],
40932
+ "revisedPlan": {
40933
+ "name": "string (2-4 words)",
40934
+ "goal": "string (1 paragraph)",
40935
+ "estimatedDays": 3,
40936
+ "tasks": [
40937
+ {
40938
+ "title": "string",
40939
+ "description": "string",
40940
+ "assigneeRole": "BACKEND | FRONTEND | QA | PM | DESIGN",
40941
+ "priority": "CRITICAL | HIGH | MEDIUM | LOW",
40942
+ "labels": ["string"],
40943
+ "acceptanceCriteria": ["string"],
40944
+ "complexity": 3
40945
+ }
40946
+ ],
40947
+ "risks": [
40948
+ {
40949
+ "description": "string",
40950
+ "mitigation": "string",
40951
+ "severity": "low | medium | high"
40952
+ }
40953
+ ]
40954
+ }
40955
+ }
40956
+
40957
+ IMPORTANT:
40958
+ - If hasIssues is true, the revisedPlan MUST contain the corrected task list with issues resolved (tasks merged, duplicated work consolidated, etc.)
40959
+ - If hasIssues is false, the revisedPlan should be identical to the input plan (no changes needed)
40960
+ - The revisedPlan is ALWAYS required — it becomes the final plan
40961
+ - When merging tasks, combine their acceptance criteria and update descriptions to cover all consolidated work
40962
+ - Prefer fewer, larger, self-contained tasks over many small conflicting ones`;
40963
+ return prompt;
40964
+ }
40965
+
40837
40966
  // ../sdk/src/planning/agents/sprint-organizer.ts
40838
40967
  function buildSprintOrganizerPrompt(input) {
40839
40968
  let prompt = `# Role: Sprint Organizer
@@ -40872,6 +41001,15 @@ Guidelines:
40872
41001
  - Ensure acceptance criteria are specific and testable
40873
41002
  - Keep the sprint focused — if it's too large (>12 tasks), consider reducing scope
40874
41003
 
41004
+ ## CRITICAL: Task Isolation Validation
41005
+
41006
+ Before finalizing, validate that EVERY task is fully self-contained and conflict-free:
41007
+
41008
+ 1. **No two tasks should modify the same file.** If they do, merge them or restructure so shared changes live in one foundational task.
41009
+ 2. **No duplicated work.** Each env var, config field, dependency, module import, or helper function must be introduced by exactly ONE task.
41010
+ 3. **Each task is independently executable.** An agent working on task N must be able to complete it without knowing what tasks N-1 or N+1 are doing. The only exception is foundational tasks that are merged BEFORE dependent tasks start.
41011
+ 4. **Prefer fewer, larger self-contained tasks over many small overlapping ones.** Do not split a task if the parts would conflict with each other.
41012
+
40875
41013
  ## Output Format
40876
41014
 
40877
41015
  Respond with ONLY a JSON object (no markdown code blocks, no explanation):
@@ -40943,6 +41081,16 @@ Think about:
40943
41081
  - What the right granularity is (not too big, not too small)
40944
41082
  - What risks or unknowns exist
40945
41083
 
41084
+ ## CRITICAL: Task Isolation Rules
41085
+
41086
+ Tasks will be executed by INDEPENDENT agents on SEPARATE git branches that get merged together. Each agent has NO knowledge of what other agents are doing. Therefore:
41087
+
41088
+ 1. **No shared work across tasks.** If two tasks both need the same config variable, helper function, database migration, or module setup, that shared work MUST be consolidated into ONE task (or placed into a dedicated foundational task that runs first and is merged before others start).
41089
+ 2. **Each task must be fully self-contained.** A task must include ALL the code changes it needs to work — from config to implementation to tests. It should NOT assume that another task in the same sprint will create something it depends on.
41090
+ 3. **Do NOT split tasks if they share code changes.** If implementing feature A and feature B both require modifying the same file or adding the same dependency/config, they should be ONE task — even if that makes the task larger. A bigger self-contained task is better than two smaller conflicting tasks.
41091
+ 4. **Think about file-level conflicts.** Two tasks modifying the same file (e.g., app.module.ts, configuration.ts, package.json) will cause git merge conflicts. Minimize this by bundling related changes together.
41092
+ 5. **Environment variables, configs, and shared modules are high-conflict zones.** If a task introduces a new env var, config schema field, or module import, NO other task should touch that same file unless absolutely necessary.
41093
+
40946
41094
  ## Output Format
40947
41095
 
40948
41096
  Respond with ONLY a JSON object (no markdown code blocks, no explanation):
@@ -40980,7 +41128,7 @@ class PlanningMeeting {
40980
41128
  async run(directive, feedback) {
40981
41129
  const projectContext = this.getProjectContext();
40982
41130
  const codebaseIndex = this.getCodebaseIndex();
40983
- this.log("Phase 1/3: Tech Lead analyzing directive...", "info");
41131
+ this.log("Phase 1/4: Tech Lead analyzing directive...", "info");
40984
41132
  const techLeadPrompt = buildTechLeadPrompt({
40985
41133
  directive,
40986
41134
  projectContext,
@@ -40989,7 +41137,7 @@ class PlanningMeeting {
40989
41137
  });
40990
41138
  const techLeadOutput = await this.aiRunner.run(techLeadPrompt);
40991
41139
  this.log("Tech Lead phase complete.", "success");
40992
- this.log("Phase 2/3: Architect refining task breakdown...", "info");
41140
+ this.log("Phase 2/4: Architect refining task breakdown...", "info");
40993
41141
  const architectPrompt = buildArchitectPrompt({
40994
41142
  directive,
40995
41143
  projectContext,
@@ -40998,7 +41146,7 @@ class PlanningMeeting {
40998
41146
  });
40999
41147
  const architectOutput = await this.aiRunner.run(architectPrompt);
41000
41148
  this.log("Architect phase complete.", "success");
41001
- this.log("Phase 3/3: Sprint Organizer finalizing plan...", "info");
41149
+ this.log("Phase 3/4: Sprint Organizer finalizing plan...", "info");
41002
41150
  const sprintOrganizerPrompt = buildSprintOrganizerPrompt({
41003
41151
  directive,
41004
41152
  architectOutput,
@@ -41006,7 +41154,16 @@ class PlanningMeeting {
41006
41154
  });
41007
41155
  const sprintOrganizerOutput = await this.aiRunner.run(sprintOrganizerPrompt);
41008
41156
  this.log("Sprint Organizer phase complete.", "success");
41009
- const plan = parseSprintPlanFromAI(sprintOrganizerOutput, directive);
41157
+ this.log("Phase 4/4: Cross-Task Review checking for conflicts and overlaps...", "info");
41158
+ const crossTaskReviewerPrompt = buildCrossTaskReviewerPrompt({
41159
+ directive,
41160
+ projectContext,
41161
+ sprintOrganizerOutput,
41162
+ feedback
41163
+ });
41164
+ const crossTaskReviewOutput = await this.aiRunner.run(crossTaskReviewerPrompt);
41165
+ this.log("Cross-Task Review phase complete.", "success");
41166
+ const plan = parseSprintPlanFromAI(crossTaskReviewOutput, directive);
41010
41167
  if (feedback) {
41011
41168
  plan.feedback = feedback;
41012
41169
  }
@@ -41015,7 +41172,8 @@ class PlanningMeeting {
41015
41172
  phaseOutputs: {
41016
41173
  techLead: techLeadOutput,
41017
41174
  architect: architectOutput,
41018
- sprintOrganizer: sprintOrganizerOutput
41175
+ sprintOrganizer: sprintOrganizerOutput,
41176
+ crossTaskReview: crossTaskReviewOutput
41019
41177
  }
41020
41178
  };
41021
41179
  }
@@ -42781,6 +42939,10 @@ function ensureGitIdentity(projectPath) {
42781
42939
  stdio: "ignore"
42782
42940
  });
42783
42941
  }
42942
+ execSync3("git config --global pull.rebase true", {
42943
+ cwd: projectPath,
42944
+ stdio: "ignore"
42945
+ });
42784
42946
  }
42785
42947
 
42786
42948
  class ConfigManager {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@locusai/cli",
3
- "version": "0.9.14",
3
+ "version": "0.9.17",
4
4
  "description": "CLI for Locus - AI-native project management platform",
5
5
  "type": "module",
6
6
  "bin": {
@@ -32,7 +32,7 @@
32
32
  "author": "",
33
33
  "license": "MIT",
34
34
  "dependencies": {
35
- "@locusai/sdk": "^0.9.14"
35
+ "@locusai/sdk": "^0.9.17"
36
36
  },
37
37
  "devDependencies": {}
38
38
  }