@markjaquith/agency 3.3.0 → 3.3.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": "@markjaquith/agency",
3
- "version": "3.3.0",
3
+ "version": "3.3.1",
4
4
  "description": "Manage agentic work across repositories with durable workbases",
5
5
  "keywords": [
6
6
  "agents",
@@ -16,6 +16,7 @@ import {
16
16
  import type { RepositoryReference } from "../workbase/schemas"
17
17
  import type { BaseCommandOptions } from "../utils/command"
18
18
  import { createLoggers } from "../utils/effect"
19
+ import { createProgress } from "../utils/progress"
19
20
  import { withWorktreeLocks } from "./WorktreeLock"
20
21
  import { VersionControlService } from "./VersionControlService"
21
22
  import type {
@@ -257,7 +258,12 @@ const runPostCheckoutHook = (options: {
257
258
  const isCommitId = (ref: string) => /^[0-9a-f]{40,64}$/i.test(ref)
258
259
 
259
260
  const originRef = (ref: string) =>
260
- ref.replace(/^refs\/remotes\/origin\//, "").replace(/^origin\//, "")
261
+ ref
262
+ .replace(/^refs\/remotes\/origin\//, "")
263
+ .replace(/^origin\//, "")
264
+ .replace(/^refs\/heads\//, "")
265
+
266
+ const gitFetchTimeoutMs = 4 * 60 * 1000
261
267
 
262
268
  interface MaterializeOptions extends BaseCommandOptions {
263
269
  readonly force?: boolean
@@ -882,6 +888,9 @@ export class WorktreeService extends Effect.Service<WorktreeService>()(
882
888
  const tasks = yield* TaskService
883
889
  const phases = yield* PhaseService
884
890
  const { verboseLog } = createLoggers(options)
891
+ const progress = createProgress({
892
+ silent: options.silent || options.json,
893
+ })
885
894
  const forwardCommandOutput =
886
895
  options.verbose === true && !options.silent && !options.json
887
896
  const { root, config } = yield* workbase.loadConfig(startPath)
@@ -1046,7 +1055,10 @@ export class WorktreeService extends Effect.Service<WorktreeService>()(
1046
1055
  "origin",
1047
1056
  originRef(executionBase),
1048
1057
  ],
1049
- { captureOutput: true },
1058
+ {
1059
+ captureOutput: true,
1060
+ timeoutMs: gitFetchTimeoutMs,
1061
+ },
1050
1062
  )
1051
1063
  if (
1052
1064
  remoteBase.exitCode !== 0 ||
@@ -1102,7 +1114,10 @@ export class WorktreeService extends Effect.Service<WorktreeService>()(
1102
1114
  "origin",
1103
1115
  originRef(checkout.ref),
1104
1116
  ],
1105
- { captureOutput: true },
1117
+ {
1118
+ captureOutput: true,
1119
+ timeoutMs: gitFetchTimeoutMs,
1120
+ },
1106
1121
  )
1107
1122
  if (remote.exitCode === 0 && remote.stdout.trim())
1108
1123
  commit = remote.stdout.trim().split(/\s+/)[0]
@@ -1165,7 +1180,7 @@ export class WorktreeService extends Effect.Service<WorktreeService>()(
1165
1180
  })
1166
1181
  }
1167
1182
 
1168
- const fetchOrigin = (ref?: string) =>
1183
+ const fetchOrigin = (ref: string) =>
1169
1184
  Effect.gen(function* () {
1170
1185
  const remote = yield* fs.runCommand(
1171
1186
  [
@@ -1185,7 +1200,7 @@ export class WorktreeService extends Effect.Service<WorktreeService>()(
1185
1200
  repositoryPath,
1186
1201
  "fetch",
1187
1202
  "origin",
1188
- ...(ref ? [ref] : []),
1203
+ ref,
1189
1204
  ]
1190
1205
  if (options.dryRun) {
1191
1206
  operations.push({
@@ -1197,14 +1212,19 @@ export class WorktreeService extends Effect.Service<WorktreeService>()(
1197
1212
  return false
1198
1213
  }
1199
1214
 
1215
+ const status = `Fetching '${ref}' for '${alias}'`
1216
+ progress.start(`${status}...`)
1200
1217
  const fetch = yield* fs.runCommand(command, {
1201
1218
  captureOutput: true,
1219
+ timeoutMs: gitFetchTimeoutMs,
1202
1220
  })
1203
1221
  if (fetch.exitCode !== 0) {
1222
+ progress.fail(`${status} failed`)
1204
1223
  return yield* new WorktreeError({
1205
1224
  message: `Failed to fetch '${alias}': ${fetch.stderr}`,
1206
1225
  })
1207
1226
  }
1227
+ progress.succeed(`${status} complete`)
1208
1228
  operations.push({
1209
1229
  action: "fetch",
1210
1230
  repo: alias,
@@ -1321,7 +1341,7 @@ export class WorktreeService extends Effect.Service<WorktreeService>()(
1321
1341
  message: `Worktree registry contains a missing checkout at ${checkoutPath}`,
1322
1342
  })
1323
1343
  }
1324
- yield* fetchOrigin()
1344
+ yield* fetchOrigin(originRef(executionBase))
1325
1345
 
1326
1346
  let args: string[]
1327
1347
  let env: Record<string, string> | undefined