@markjaquith/agency 2.71.25 → 2.71.26

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": "@markjaquith/agency",
3
- "version": "2.71.25",
3
+ "version": "2.71.26",
4
4
  "description": "Manage agentic work across repositories with durable workbases",
5
5
  "keywords": [
6
6
  "agents",
@@ -148,6 +148,33 @@ status: open
148
148
  return root
149
149
  }
150
150
 
151
+ const createReviewWorkbase = async () => {
152
+ const root = join(tempRoot, "review-workbase")
153
+ await write(root, "agency.json", '{"version":2}\n')
154
+ await mkdir(join(root, "repos/agency"), { recursive: true })
155
+ await mkdir(join(root, "tasks/review/code/agency"), { recursive: true })
156
+ await write(
157
+ root,
158
+ "tasks/review/TASK.md",
159
+ `---
160
+ ticketUrl: null
161
+ description: Review a branch
162
+ review:
163
+ repo: agency
164
+ source:
165
+ kind: branch
166
+ ref: refs/heads/review
167
+ commit: 0123456789abcdef0123456789abcdef01234567
168
+ refreshedAt: 2026-08-19T00:00:00.000Z
169
+ status: working
170
+ ---
171
+
172
+ # Review
173
+ `,
174
+ )
175
+ return root
176
+ }
177
+
151
178
  test("creates and records an Agency pull request", async () => {
152
179
  const url = "https://github.com/markjaquith/agency/pull/123"
153
180
  let received: unknown[] = []
@@ -221,6 +248,19 @@ status: open
221
248
  ])
222
249
  })
223
250
 
251
+ test("focuses a review task invocation on its review checkout", async () => {
252
+ const root = await createReviewWorkbase()
253
+ const task = join(root, "tasks/review")
254
+
255
+ expect(await runTestEffect(pr(["view", "--web"], task))).toBe(0)
256
+ expect(await captured()).toEqual([
257
+ await realpath(join(task, "code/agency")),
258
+ "pr",
259
+ "view",
260
+ "--web",
261
+ ])
262
+ })
263
+
224
264
  test("injects the execution branch and repository for jj targets", async () => {
225
265
  const root = await createExecutionWorkbase("jj")
226
266
  const task = join(root, "tasks/single")
@@ -98,28 +98,31 @@ export const pr = (args: readonly string[], cwd: string = process.cwd()) =>
98
98
  context?.validation.valid && context.workspace?.writable?.materialized
99
99
  ? context.authority.writable?.checkoutPath
100
100
  : null
101
- const focusedCwd = writableCheckout ?? invocationCwd
101
+ const reviewCheckout =
102
+ context?.validation.valid && context.review?.checkout?.materialized
103
+ ? context.review.checkout.checkoutPath
104
+ : null
105
+ const focusedCheckout = writableCheckout ?? reviewCheckout
106
+ const focusedCwd = focusedCheckout ?? invocationCwd
102
107
  let forwardedArgs = args
103
108
  let environment: Record<string, string> = {}
104
- if (
105
- writableCheckout &&
106
- context?.workbase.vcs === "jj" &&
107
- context.authority.writable
108
- ) {
109
- const execution =
110
- context.documents?.phase?.data ?? context.documents?.task?.data
111
- const { config } = yield* workbase.loadConfig(context.workbase.root)
112
- const remote =
113
- config.repositories?.[context.authority.writable.repo]?.remote
114
- if (execution && "branch" in execution && remote) {
115
- forwardedArgs = withJjContext(
116
- args,
117
- execution.branch,
118
- repositoryFromRemote(remote),
119
- )
109
+ if (focusedCheckout && context?.workbase.vcs === "jj") {
110
+ if (writableCheckout && context.authority.writable) {
111
+ const execution =
112
+ context.documents?.phase?.data ?? context.documents?.task?.data
113
+ const { config } = yield* workbase.loadConfig(context.workbase.root)
114
+ const remote =
115
+ config.repositories?.[context.authority.writable.repo]?.remote
116
+ if (execution && "branch" in execution && remote) {
117
+ forwardedArgs = withJjContext(
118
+ args,
119
+ execution.branch,
120
+ repositoryFromRemote(remote),
121
+ )
122
+ }
120
123
  }
121
124
  const backend = yield* versionControl.forWorkbase(context.workbase.root)
122
- environment = yield* backend.gitEnvironment(writableCheckout)
125
+ environment = yield* backend.gitEnvironment(focusedCheckout)
123
126
  }
124
127
  const result = yield* fs.runCommand(["gh", "pr", ...forwardedArgs], {
125
128
  cwd: focusedCwd,