@supaku/agentfactory-linear 0.7.47 → 0.7.48

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
- {"version":3,"file":"prompts.d.ts","sourceRoot":"","sources":["../../../src/defaults/prompts.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,OAAO,KAAK,EAAE,aAAa,EAAE,cAAc,EAAE,MAAM,aAAa,CAAA;AAahE,eAAO,MAAM,8BAA8B,uYAMsI,CAAA;AAEjL,eAAO,MAAM,qBAAqB,ijBAS0B,CAAA;AAE5D;;;GAGG;AACH,MAAM,WAAW,eAAe;IAC9B,UAAU,EAAE,MAAM,CAAA;IAClB,QAAQ,EAAE,MAAM,CAAA;IAChB,cAAc,EAAE,MAAM,GAAG,IAAI,CAAA;IAC7B,cAAc,CAAC,EAAE,MAAM,CAAA;CACxB;AAED;;GAEG;AACH,wBAAgB,wBAAwB,CACtC,QAAQ,EAAE,aAAa,EACvB,OAAO,EAAE,eAAe,GACvB,MAAM,CA0DR;AAED;;;;;;;GAOG;AACH,wBAAgB,qBAAqB,CACnC,UAAU,EAAE,MAAM,EAClB,QAAQ,EAAE,aAAa,EACvB,cAAc,CAAC,EAAE,MAAM,EACvB,eAAe,CAAC,EAAE,eAAe,GAChC,MAAM,CAuFR;AAED;;GAEG;AACH,wBAAgB,2BAA2B,CACzC,eAAe,EAAE,MAAM,EACvB,gBAAgB,EAAE,cAAc,EAAE,GACjC,MAAM,CAoBR;AAED;;GAEG;AACH,wBAAgB,mCAAmC,CACjD,eAAe,EAAE,MAAM,EACvB,gBAAgB,EAAE,cAAc,EAAE,GACjC,MAAM,CAmBR"}
1
+ {"version":3,"file":"prompts.d.ts","sourceRoot":"","sources":["../../../src/defaults/prompts.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,OAAO,KAAK,EAAE,aAAa,EAAE,cAAc,EAAE,MAAM,aAAa,CAAA;AAahE,eAAO,MAAM,8BAA8B,uYAMsI,CAAA;AAEjL,eAAO,MAAM,qBAAqB,ijBAS0B,CAAA;AAE5D;;;GAGG;AACH,MAAM,WAAW,eAAe;IAC9B,UAAU,EAAE,MAAM,CAAA;IAClB,QAAQ,EAAE,MAAM,CAAA;IAChB,cAAc,EAAE,MAAM,GAAG,IAAI,CAAA;IAC7B,cAAc,CAAC,EAAE,MAAM,CAAA;CACxB;AAED;;GAEG;AACH,wBAAgB,wBAAwB,CACtC,QAAQ,EAAE,aAAa,EACvB,OAAO,EAAE,eAAe,GACvB,MAAM,CA0DR;AAED;;;;;;;GAOG;AACH,wBAAgB,qBAAqB,CACnC,UAAU,EAAE,MAAM,EAClB,QAAQ,EAAE,aAAa,EACvB,cAAc,CAAC,EAAE,MAAM,EACvB,eAAe,CAAC,EAAE,eAAe,GAChC,MAAM,CAgHR;AAED;;GAEG;AACH,wBAAgB,2BAA2B,CACzC,eAAe,EAAE,MAAM,EACvB,gBAAgB,EAAE,cAAc,EAAE,GACjC,MAAM,CAoBR;AAED;;GAEG;AACH,wBAAgB,mCAAmC,CACjD,eAAe,EAAE,MAAM,EACvB,gBAAgB,EAAE,cAAc,EAAE,GACjC,MAAM,CAmBR"}
@@ -150,8 +150,32 @@ Acceptance Steps:
150
150
  case 'refinement':
151
151
  basePrompt = `Refine ${identifier} based on rejection feedback. Read comments, update requirements, then return to Backlog.`;
152
152
  break;
153
- case 'coordination':
154
- basePrompt = `Coordinate sub-issue execution for parent issue ${identifier}. Fetch sub-issues with dependency graph, create tasks mapping to each sub-issue, spawn sub-agents for unblocked sub-issues in parallel, monitor completion, and create a single PR with all changes when done.
153
+ case 'coordination': {
154
+ const isRetry = workflowContext && workflowContext.cycleCount > 0;
155
+ if (isRetry) {
156
+ basePrompt = `Fix issues found during QA for parent issue ${identifier}.
157
+
158
+ REWORK MODE — DO NOT re-coordinate sub-issues from scratch.
159
+ All sub-issues are already Finished and a PR already exists. QA failed and specific fixes are needed.
160
+
161
+ MANDATORY FIRST STEPS:
162
+ 1. Read the most recent QA failure comments: pnpm af-linear list-comments ${identifier}
163
+ 2. Identify the SPECIFIC fixes needed from the QA failure details below
164
+ 3. Apply fixes directly — do NOT re-spawn sub-agents for already-complete work
165
+ 4. Commit fixes, push to the existing PR branch
166
+ 5. Run full validation: pnpm typecheck && pnpm build && pnpm test
167
+ 6. Update parent issue status to Finished
168
+
169
+ COMMON REWORK FIXES:
170
+ - Missing migration .json snapshots: Find .ts migrations without .json, patch the latest snapshot
171
+ - TypeScript errors: Read the error details, fix the type issues
172
+ - Missing API fields: Update route handlers to include missing fields
173
+ - Build failures: Run pnpm build, diagnose, fix
174
+
175
+ If the existing PR branch is checked out, work directly on it. Do not create a new branch or PR.`;
176
+ }
177
+ else {
178
+ basePrompt = `Coordinate sub-issue execution for parent issue ${identifier}. Fetch sub-issues with dependency graph, create tasks mapping to each sub-issue, spawn sub-agents for unblocked sub-issues in parallel, monitor completion, and create a single PR with all changes when done.
155
179
 
156
180
  SUB-ISSUE STATUS MANAGEMENT:
157
181
  Update sub-issue statuses in Linear as work progresses:
@@ -162,7 +186,9 @@ Update sub-issue statuses in Linear as work progresses:
162
186
  COMPLETION VERIFICATION:
163
187
  Before marking the parent issue as complete, verify ALL sub-issues are in Finished status.
164
188
  If any sub-issue is not Finished, report the failure and do not mark the parent as complete.`;
189
+ }
165
190
  break;
191
+ }
166
192
  case 'qa-coordination':
167
193
  basePrompt = `Coordinate QA across sub-issues for parent issue ${identifier}. Fetch sub-issues, spawn QA sub-agents in parallel for each sub-issue, collect pass/fail results, and roll up to parent. ALL sub-issues must pass QA for the parent to pass.
168
194
  ${WORK_RESULT_MARKER_INSTRUCTION}`;
@@ -52,6 +52,16 @@ describe('buildFailureContextBlock', () => {
52
52
  expect(result).toContain('retry #2');
53
53
  });
54
54
  });
55
+ describe('qa-coordination work type', () => {
56
+ it('returns empty string when no failure summary', () => {
57
+ expect(buildFailureContextBlock('qa-coordination', { ...baseContext, failureSummary: null })).toBe('');
58
+ });
59
+ it('includes previous QA results when failure summary exists', () => {
60
+ const result = buildFailureContextBlock('qa-coordination', baseContext);
61
+ expect(result).toContain('Previous QA Results');
62
+ expect(result).toContain('TypeError in UserService');
63
+ });
64
+ });
55
65
  describe('qa work type', () => {
56
66
  it('returns empty string when no failure summary', () => {
57
67
  expect(buildFailureContextBlock('qa', { ...baseContext, failureSummary: null })).toBe('');
@@ -128,3 +138,86 @@ describe('defaultGeneratePrompt with workflowContext', () => {
128
138
  expect(result).toContain('Please focus on the API layer');
129
139
  });
130
140
  });
141
+ describe('defaultGeneratePrompt coordination retry', () => {
142
+ it('uses fresh coordination prompt when no workflowContext', () => {
143
+ const result = defaultGeneratePrompt('PROJ-100', 'coordination');
144
+ expect(result).toContain('Coordinate sub-issue execution for parent issue PROJ-100');
145
+ expect(result).toContain('Fetch sub-issues with dependency graph');
146
+ expect(result).not.toContain('REWORK MODE');
147
+ });
148
+ it('uses fresh coordination prompt when cycleCount is 0', () => {
149
+ const result = defaultGeneratePrompt('PROJ-100', 'coordination', undefined, {
150
+ cycleCount: 0,
151
+ strategy: 'normal',
152
+ failureSummary: null,
153
+ });
154
+ expect(result).toContain('Coordinate sub-issue execution for parent issue PROJ-100');
155
+ expect(result).not.toContain('REWORK MODE');
156
+ });
157
+ it('switches to rework mode when cycleCount > 0', () => {
158
+ const result = defaultGeneratePrompt('PROJ-100', 'coordination', undefined, {
159
+ cycleCount: 1,
160
+ strategy: 'context-enriched',
161
+ failureSummary: '2 migrations missing .json snapshots',
162
+ });
163
+ expect(result).toContain('REWORK MODE');
164
+ expect(result).toContain('Fix issues found during QA for parent issue PROJ-100');
165
+ expect(result).toContain('DO NOT re-coordinate sub-issues from scratch');
166
+ expect(result).toContain('pnpm af-linear list-comments PROJ-100');
167
+ expect(result).not.toContain('Fetch sub-issues with dependency graph');
168
+ });
169
+ it('includes common rework fixes in rework mode', () => {
170
+ const result = defaultGeneratePrompt('PROJ-100', 'coordination', undefined, {
171
+ cycleCount: 2,
172
+ strategy: 'context-enriched',
173
+ failureSummary: 'Build failed',
174
+ });
175
+ expect(result).toContain('Missing migration .json snapshots');
176
+ expect(result).toContain('TypeScript errors');
177
+ expect(result).toContain('Missing API fields');
178
+ expect(result).toContain('Build failures');
179
+ });
180
+ it('appends failure context block in rework mode', () => {
181
+ const result = defaultGeneratePrompt('PROJ-100', 'coordination', undefined, {
182
+ cycleCount: 2,
183
+ strategy: 'context-enriched',
184
+ failureSummary: 'Tests failed: missing snapshot for 20260308_migration.ts',
185
+ });
186
+ expect(result).toContain('REWORK MODE');
187
+ expect(result).toContain('Retry Context');
188
+ expect(result).toContain('retry #2');
189
+ expect(result).toContain('missing snapshot for 20260308_migration.ts');
190
+ });
191
+ it('includes mention context alongside rework mode', () => {
192
+ const result = defaultGeneratePrompt('PROJ-100', 'coordination', 'Focus on the migration snapshots', {
193
+ cycleCount: 1,
194
+ strategy: 'normal',
195
+ failureSummary: 'Missing .json snapshots',
196
+ });
197
+ expect(result).toContain('REWORK MODE');
198
+ expect(result).toContain('Focus on the migration snapshots');
199
+ });
200
+ it('instructs agent to use existing PR branch', () => {
201
+ const result = defaultGeneratePrompt('PROJ-100', 'coordination', undefined, {
202
+ cycleCount: 1,
203
+ strategy: 'normal',
204
+ failureSummary: null,
205
+ });
206
+ expect(result).toContain('Do not create a new branch or PR');
207
+ expect(result).toContain('push to the existing PR branch');
208
+ });
209
+ it('includes sub-issue status management in fresh coordination', () => {
210
+ const result = defaultGeneratePrompt('PROJ-100', 'coordination');
211
+ expect(result).toContain('SUB-ISSUE STATUS MANAGEMENT');
212
+ expect(result).toContain('COMPLETION VERIFICATION');
213
+ });
214
+ it('does not include sub-issue status management in rework mode', () => {
215
+ const result = defaultGeneratePrompt('PROJ-100', 'coordination', undefined, {
216
+ cycleCount: 1,
217
+ strategy: 'normal',
218
+ failureSummary: 'QA failed',
219
+ });
220
+ expect(result).not.toContain('SUB-ISSUE STATUS MANAGEMENT');
221
+ expect(result).not.toContain('COMPLETION VERIFICATION');
222
+ });
223
+ });
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@supaku/agentfactory-linear",
3
- "version": "0.7.47",
3
+ "version": "0.7.48",
4
4
  "type": "module",
5
5
  "description": "Linear issue tracker integration for AgentFactory — status transitions, agent sessions, work routing",
6
6
  "author": "Supaku (https://supaku.com)",