@supaku/agentfactory-linear 0.7.48 → 0.7.50

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.
@@ -6,6 +6,7 @@
6
6
  */
7
7
  import type { AgentWorkType, SubIssueStatus } from '../types.js';
8
8
  export declare const WORK_RESULT_MARKER_INSTRUCTION = "\n\nMANDATORY \u2014 Structured Result Marker:\nYou MUST include exactly one of these HTML comment markers in your final output:\n- On pass: <!-- WORK_RESULT:passed -->\n- On fail: <!-- WORK_RESULT:failed -->\nWithout this marker, the orchestrator CANNOT detect your result and the issue status will NOT be updated. Even if you encounter errors, always emit <!-- WORK_RESULT:failed -->.";
9
+ export declare const READ_ONLY_CONSTRAINT = "\n\nCRITICAL CONSTRAINT \u2014 READ-ONLY ROLE:\nYou are a VALIDATION agent, NOT a development agent. You MUST NOT modify any source code, configuration files, migration files, or project files. Your role is strictly to READ, VALIDATE, and REPORT.\nFORBIDDEN actions: creating files, editing files, writing code, committing changes, patching snapshots, fixing bugs, resolving errors in code.\nALLOWED actions: reading files, running tests, running builds, checking CI status, posting comments, merging PRs (acceptance only), updating Linear status.\nIf you discover issues (missing files, broken builds, failing tests), REPORT them in your result comment and emit WORK_RESULT:failed. Do NOT attempt to fix them.";
9
10
  export declare const PR_SELECTION_GUIDANCE = "\n\nPR Selection (Multi-PR Handling):\nIssues may have multiple PRs. Select the correct one:\n1. Check linked PRs in the issue attachments/links for GitHub PR URLs\n2. Filter by state \u2014 prefer OPEN over MERGED over CLOSED: gh pr view NNN --json state\n3. If multiple OPEN PRs, pick the most recently created one\n4. Fallback search by branch: gh pr list --head \"$(git branch --show-current)\" --state open\n5. Last resort search by issue ID: gh pr list --state open --search \"[issue-id]\"\n6. If no PR found, emit WORK_RESULT:failed with explanation";
10
11
  /**
11
12
  * Context from the workflow state machine for retry enrichment.
@@ -1 +1 @@
1
- {"version":3,"file":"prompts.d.ts","sourceRoot":"","sources":["../../../src/defaults/prompts.ts"],"names":[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AM,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,CAiJR;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"}
@@ -21,6 +21,13 @@ You MUST include exactly one of these HTML comment markers in your final output:
21
21
  - On pass: <!-- WORK_RESULT:passed -->
22
22
  - On fail: <!-- WORK_RESULT:failed -->
23
23
  Without this marker, the orchestrator CANNOT detect your result and the issue status will NOT be updated. Even if you encounter errors, always emit <!-- WORK_RESULT:failed -->.`;
24
+ export const READ_ONLY_CONSTRAINT = `
25
+
26
+ CRITICAL CONSTRAINT — READ-ONLY ROLE:
27
+ You are a VALIDATION agent, NOT a development agent. You MUST NOT modify any source code, configuration files, migration files, or project files. Your role is strictly to READ, VALIDATE, and REPORT.
28
+ FORBIDDEN actions: creating files, editing files, writing code, committing changes, patching snapshots, fixing bugs, resolving errors in code.
29
+ ALLOWED actions: reading files, running tests, running builds, checking CI status, posting comments, merging PRs (acceptance only), updating Linear status.
30
+ If you discover issues (missing files, broken builds, failing tests), REPORT them in your result comment and emit WORK_RESULT:failed. Do NOT attempt to fix them.`;
24
31
  export const PR_SELECTION_GUIDANCE = `
25
32
 
26
33
  PR Selection (Multi-PR Handling):
@@ -123,6 +130,7 @@ Do NOT wait for user approval - create issues automatically.`;
123
130
  break;
124
131
  case 'qa':
125
132
  basePrompt = `QA ${identifier}. Validate the implementation against acceptance criteria.
133
+ ${READ_ONLY_CONSTRAINT}
126
134
  ${WORK_RESULT_MARKER_INSTRUCTION}
127
135
  ${PR_SELECTION_GUIDANCE}
128
136
 
@@ -136,6 +144,7 @@ Validation Steps:
136
144
  break;
137
145
  case 'acceptance':
138
146
  basePrompt = `Process acceptance for ${identifier}. Validate development and QA work is complete, verify PR is ready to merge (CI passing, no conflicts), merge the PR, and clean up local resources.
147
+ ${READ_ONLY_CONSTRAINT}
139
148
  ${WORK_RESULT_MARKER_INSTRUCTION}
140
149
  ${PR_SELECTION_GUIDANCE}
141
150
 
@@ -190,12 +199,43 @@ If any sub-issue is not Finished, report the failure and do not mark the parent
190
199
  break;
191
200
  }
192
201
  case 'qa-coordination':
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.
194
- ${WORK_RESULT_MARKER_INSTRUCTION}`;
202
+ basePrompt = `Coordinate QA across sub-issues for parent issue ${identifier}. Fetch sub-issues, validate each against acceptance criteria, collect pass/fail results, and roll up to parent.
203
+ ${READ_ONLY_CONSTRAINT}
204
+ ${WORK_RESULT_MARKER_INSTRUCTION}
205
+ ${PR_SELECTION_GUIDANCE}
206
+
207
+ QA Coordination Steps:
208
+ 1. Find and validate the correct PR (see PR selection above)
209
+ 2. Fetch all sub-issues and verify each is in Finished or later status
210
+ 3. Run tests scoped to the affected packages
211
+ 4. Verify the build passes (pnpm typecheck && pnpm build)
212
+ 5. Review changes against each sub-issue's acceptance criteria
213
+ 6. Verify cross-cutting concerns: shared types, API contracts, data flow between sub-issues
214
+ 7. Check deployment status (CI checks on the PR)
215
+
216
+ Pass/Fail:
217
+ - PASS (emit <!-- WORK_RESULT:passed -->): ALL tests pass, build succeeds, all sub-issues implemented, deployment healthy
218
+ - FAIL (emit <!-- WORK_RESULT:failed -->): ANY test failure, build error, missing implementation, deployment failure
219
+ Post a result comment listing per-sub-issue findings, then emit the marker.`;
195
220
  break;
196
221
  case 'acceptance-coordination':
197
- basePrompt = `Coordinate acceptance across sub-issues for parent issue ${identifier}. Verify all sub-issues are Delivered, validate the PR (CI passing, no conflicts), merge the PR, and bulk-update sub-issues to Accepted.
198
- ${WORK_RESULT_MARKER_INSTRUCTION}`;
222
+ basePrompt = `Coordinate acceptance across sub-issues for parent issue ${identifier}. Verify all sub-issues are Delivered, validate the PR, merge it, and bulk-update sub-issues to Accepted.
223
+ ${READ_ONLY_CONSTRAINT}
224
+ ${WORK_RESULT_MARKER_INSTRUCTION}
225
+ ${PR_SELECTION_GUIDANCE}
226
+
227
+ Acceptance Coordination Steps:
228
+ 1. Find and validate the correct PR (see PR selection above)
229
+ 2. Verify ALL sub-issues are in Delivered or Accepted status
230
+ 3. Verify CI is passing and there are no merge conflicts
231
+ 4. Merge the PR
232
+ 5. Delete the remote branch after successful merge
233
+ 6. Post result comment with per-sub-issue status, then emit the marker
234
+
235
+ Pass/Fail:
236
+ - PASS (emit <!-- WORK_RESULT:passed -->): All sub-issues Delivered, CI passing, PR merged successfully
237
+ - FAIL (emit <!-- WORK_RESULT:failed -->): Incomplete sub-issues, CI failure, merge conflicts, merge failed
238
+ If ANY issue prevents merging, do NOT attempt to fix it — emit WORK_RESULT:failed with details.`;
199
239
  break;
200
240
  }
201
241
  basePrompt += HUMAN_BLOCKER_INSTRUCTION;
@@ -138,6 +138,46 @@ describe('defaultGeneratePrompt with workflowContext', () => {
138
138
  expect(result).toContain('Please focus on the API layer');
139
139
  });
140
140
  });
141
+ describe('defaultGeneratePrompt read-only constraint', () => {
142
+ const readOnlyWorkTypes = ['qa', 'acceptance', 'qa-coordination', 'acceptance-coordination'];
143
+ for (const workType of readOnlyWorkTypes) {
144
+ it(`includes READ-ONLY constraint for ${workType}`, () => {
145
+ const result = defaultGeneratePrompt('PROJ-123', workType);
146
+ expect(result).toContain('READ-ONLY ROLE');
147
+ expect(result).toContain('MUST NOT modify any source code');
148
+ expect(result).toContain('WORK_RESULT:failed');
149
+ });
150
+ }
151
+ const writableWorkTypes = ['development', 'coordination', 'refinement', 'research', 'backlog-creation', 'inflight'];
152
+ for (const workType of writableWorkTypes) {
153
+ it(`does NOT include READ-ONLY constraint for ${workType}`, () => {
154
+ const result = defaultGeneratePrompt('PROJ-123', workType);
155
+ expect(result).not.toContain('READ-ONLY ROLE');
156
+ });
157
+ }
158
+ });
159
+ describe('defaultGeneratePrompt coordination prompts have steps', () => {
160
+ it('qa-coordination includes numbered steps and pass/fail criteria', () => {
161
+ const result = defaultGeneratePrompt('PROJ-100', 'qa-coordination');
162
+ expect(result).toContain('QA Coordination Steps:');
163
+ expect(result).toContain('1. Find and validate the correct PR');
164
+ expect(result).toContain('Pass/Fail:');
165
+ expect(result).toContain('WORK_RESULT:passed');
166
+ expect(result).toContain('WORK_RESULT:failed');
167
+ expect(result).toContain('PR Selection');
168
+ });
169
+ it('acceptance-coordination includes numbered steps and pass/fail criteria', () => {
170
+ const result = defaultGeneratePrompt('PROJ-100', 'acceptance-coordination');
171
+ expect(result).toContain('Acceptance Coordination Steps:');
172
+ expect(result).toContain('1. Find and validate the correct PR');
173
+ expect(result).toContain('Merge the PR');
174
+ expect(result).toContain('Pass/Fail:');
175
+ expect(result).toContain('WORK_RESULT:passed');
176
+ expect(result).toContain('WORK_RESULT:failed');
177
+ expect(result).toContain('do NOT attempt to fix it');
178
+ expect(result).toContain('PR Selection');
179
+ });
180
+ });
141
181
  describe('defaultGeneratePrompt coordination retry', () => {
142
182
  it('uses fresh coordination prompt when no workflowContext', () => {
143
183
  const result = defaultGeneratePrompt('PROJ-100', 'coordination');
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@supaku/agentfactory-linear",
3
- "version": "0.7.48",
3
+ "version": "0.7.50",
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)",