karajan-code 2.2.0 → 2.2.1

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.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "karajan-code",
3
- "version": "2.2.0",
3
+ "version": "2.2.1",
4
4
  "description": "Local multi-agent coding orchestrator with TDD, SonarQube, and code review pipeline",
5
5
  "type": "module",
6
6
  "license": "AGPL-3.0",
@@ -16,9 +16,11 @@ export function deriveProjectName(originalTask) {
16
16
  if (!originalTask || typeof originalTask !== "string") return "Untitled Project";
17
17
  const STOPWORDS = new Set([
18
18
  "a", "an", "the", "and", "or", "with", "for", "to", "of", "in", "on",
19
+ "is", "it", "its", "this", "that", "these", "those", "be", "been", "being",
19
20
  "build", "create", "implement", "make", "develop", "add", "set", "up",
20
- "setup", "write", "code", "new", "complete", "that", "from", "scratch",
21
- "application", "app", "tool", "system", "project", "using", "use"
21
+ "setup", "write", "code", "new", "complete", "from", "scratch",
22
+ "application", "app", "tool", "system", "project", "using", "use",
23
+ "full", "full-stack", "fullstack", "stack", "based", "simple", "basic"
22
24
  ]);
23
25
  const words = originalTask
24
26
  .toLowerCase()
@@ -65,54 +67,63 @@ export function needsSetupHu({ isNewProject = false, stackHints = [], subtasks =
65
67
  }
66
68
 
67
69
  /**
68
- * Build the setup HU story from stack hints + subtasks.
70
+ * Build a MINIMAL setup HU project structure + deps only.
71
+ * NEVER includes the full original task. The coder must only do setup.
69
72
  */
70
- function buildSetupHu({ stackHints, subtasks, originalTask }) {
71
- const hintList = stackHints.length > 0
73
+ function buildSetupHu({ stackHints }) {
74
+ const deps = stackHints.length > 0
72
75
  ? stackHints.map(h => `- ${h}`).join("\n")
73
- : "- Detect required dependencies from task and install them";
76
+ : "- (auto-detect from subsequent HUs)";
74
77
  const certifiedText = [
75
- `**Setup project infrastructure and dependencies.**`,
76
- ``,
77
- `Original goal: ${originalTask}`,
78
- ``,
79
- `**Scope:**`,
80
- `- Initialize project structure (package.json, workspaces if monorepo)`,
81
- `- Install all dependencies required by the task`,
82
- `- Configure tooling (test framework, linter, build tool)`,
83
- `- Create .env.example with all required env vars`,
84
- `- Verify install works (npm install, npm run test --run)`,
85
- ``,
86
- `**Stack hints:**`,
87
- hintList
78
+ "**Setup: initialize project structure and install dependencies.**",
79
+ "",
80
+ "SCOPE (do ONLY this, nothing else):",
81
+ "- Create package.json (with workspaces if monorepo detected from stack hints)",
82
+ "- Install all runtime + dev dependencies listed in stack hints",
83
+ "- Configure test framework so `npm test` runs (even with 0 tests)",
84
+ "- Create .env.example with placeholder variables",
85
+ "- Verify: `npm install` succeeds, `npm test` runs without error",
86
+ "",
87
+ "DO NOT implement any business logic, API routes, components, or features.",
88
+ "DO NOT add security middleware, auth, or any application code.",
89
+ "This HU is ONLY project scaffolding.",
90
+ "",
91
+ "Stack hints:",
92
+ deps
88
93
  ].join("\n");
89
94
  return {
90
95
  id: "HU-01",
91
- title: "Setup project infrastructure",
96
+ title: "Setup: project structure + dependencies",
92
97
  task_type: "infra",
93
98
  status: "certified",
94
99
  blocked_by: [],
95
100
  certified: { text: certifiedText },
96
101
  acceptance_criteria: [
97
- "Project builds without errors (npm install succeeds)",
98
- "Test framework is installed and 'npm test' runs (even with 0 tests)",
99
- "All declared dependencies match what the task requires",
100
- ".env.example exists with documented variables"
102
+ "npm install succeeds without errors",
103
+ "npm test runs (even with 0 tests)",
104
+ ".env.example exists",
105
+ "No business logic or application code added"
101
106
  ]
102
107
  };
103
108
  }
104
109
 
105
110
  /**
106
- * Build a task HU story from a subtask description.
111
+ * Build a MINIMAL task HU one specific, focused piece of work.
112
+ * Includes a short goal reference (max 80 chars) NOT the full task.
107
113
  */
108
- function buildTaskHu({ id, subtask, originalTask, blockedBy }) {
114
+ function buildTaskHu({ id, subtask, projectName, blockedBy }) {
109
115
  const taskType = classifyTaskType(subtask);
110
116
  const certifiedText = [
111
117
  `**${subtask}**`,
112
- ``,
113
- `Part of: ${originalTask}`,
114
- ``,
115
- `**Scope:** implement this subtask only. Do not touch unrelated subtasks.`
118
+ "",
119
+ `Project: ${projectName}`,
120
+ "",
121
+ "SCOPE (do ONLY this, nothing else):",
122
+ `- Implement: ${subtask}`,
123
+ "- Add unit tests for the new code",
124
+ "- Do NOT touch code outside this subtask's scope",
125
+ "- Do NOT refactor or 'improve' unrelated files",
126
+ "- Target: <200 lines changed (like an atomic PR)"
116
127
  ].join("\n");
117
128
  return {
118
129
  id,
@@ -122,9 +133,9 @@ function buildTaskHu({ id, subtask, originalTask, blockedBy }) {
122
133
  blocked_by: blockedBy,
123
134
  certified: { text: certifiedText },
124
135
  acceptance_criteria: [
125
- `Subtask '${subtask}' is implemented`,
126
- `Unit tests cover the new code (where applicable)`,
127
- `No regressions in existing functionality`
136
+ `${subtask} is implemented and working`,
137
+ "Unit tests cover the new code",
138
+ "No changes to files outside this subtask's scope"
128
139
  ]
129
140
  };
130
141
  }
@@ -160,23 +171,22 @@ export function generateHuBatch({
160
171
  const needsSetup = needsSetupHu({ isNewProject, stackHints, subtasks });
161
172
  let nextId = 1;
162
173
 
174
+ const projectName = deriveProjectName(originalTask);
175
+
163
176
  if (needsSetup) {
164
- stories.push(buildSetupHu({ stackHints, subtasks, originalTask }));
177
+ stories.push(buildSetupHu({ stackHints }));
165
178
  nextId = 2;
166
179
  }
167
180
 
168
181
  // Task HUs: linear dependency chain after setup (conservative default).
169
- // Architect context could later inform parallel-safe groupings.
170
182
  const setupId = needsSetup ? "HU-01" : null;
171
183
  let previousId = setupId;
172
184
  for (const subtask of subtasks) {
173
185
  const id = `HU-${String(nextId).padStart(2, "0")}`;
174
186
  const blockedBy = [];
175
187
  if (setupId) blockedBy.push(setupId);
176
- // Conservative: also depend on previous task HU to enforce linear execution.
177
- // Later phases can relax this with architect-informed graph.
178
188
  if (previousId && previousId !== setupId) blockedBy.push(previousId);
179
- stories.push(buildTaskHu({ id, subtask, originalTask, blockedBy }));
189
+ stories.push(buildTaskHu({ id, subtask, projectName, blockedBy }));
180
190
  previousId = id;
181
191
  nextId += 1;
182
192
  }