@markjaquith/agency 0.7.1 → 0.7.3
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
|
@@ -141,7 +141,7 @@ describe("work command", () => {
|
|
|
141
141
|
restore()
|
|
142
142
|
|
|
143
143
|
expect(spawnCalled).toBe(true)
|
|
144
|
-
expect(spawnArgs).toEqual(["opencode", "
|
|
144
|
+
expect(spawnArgs).toEqual(["opencode", "--prompt", "Start the task"])
|
|
145
145
|
})
|
|
146
146
|
})
|
|
147
147
|
|
|
@@ -171,7 +171,7 @@ describe("work command", () => {
|
|
|
171
171
|
|
|
172
172
|
restore()
|
|
173
173
|
|
|
174
|
-
expect(capturedArgs).toEqual(["opencode", "
|
|
174
|
+
expect(capturedArgs).toEqual(["opencode", "--prompt", "Start the task"])
|
|
175
175
|
// On macOS, temp directories can have /private prefix
|
|
176
176
|
expect(
|
|
177
177
|
capturedOptions.cwd === tempDir ||
|
|
@@ -278,7 +278,7 @@ describe("work command", () => {
|
|
|
278
278
|
|
|
279
279
|
restore()
|
|
280
280
|
|
|
281
|
-
expect(capturedArgs).toEqual(["opencode", "
|
|
281
|
+
expect(capturedArgs).toEqual(["opencode", "--prompt", "Start the task"])
|
|
282
282
|
})
|
|
283
283
|
|
|
284
284
|
test("--claude flag forces use of Claude Code", async () => {
|
|
@@ -387,7 +387,7 @@ describe("work command", () => {
|
|
|
387
387
|
|
|
388
388
|
expect(capturedArgs).toEqual([
|
|
389
389
|
"opencode",
|
|
390
|
-
"
|
|
390
|
+
"--prompt",
|
|
391
391
|
"Start the task",
|
|
392
392
|
"--model",
|
|
393
393
|
"claude-sonnet-4-20250514",
|
|
@@ -456,7 +456,7 @@ describe("work command", () => {
|
|
|
456
456
|
|
|
457
457
|
restore()
|
|
458
458
|
|
|
459
|
-
expect(capturedArgs).toEqual(["opencode", "
|
|
459
|
+
expect(capturedArgs).toEqual(["opencode", "--prompt", "Start the task"])
|
|
460
460
|
})
|
|
461
461
|
})
|
|
462
462
|
})
|
package/src/commands/work.ts
CHANGED
|
@@ -117,7 +117,7 @@ export const work = (options: WorkOptions = {}) =>
|
|
|
117
117
|
|
|
118
118
|
const cliName = useOpencode ? "opencode" : "claude"
|
|
119
119
|
const baseArgs = useOpencode
|
|
120
|
-
? [cliName, "
|
|
120
|
+
? [cliName, "--prompt", "Start the task"]
|
|
121
121
|
: [cliName, "Start the task"]
|
|
122
122
|
|
|
123
123
|
// Append extra args if provided
|
|
@@ -364,7 +364,7 @@ export class GitService extends Effect.Service<GitService>()("GitService", {
|
|
|
364
364
|
const configBranch = yield* getGitConfigEffect(
|
|
365
365
|
"agency.mainBranch",
|
|
366
366
|
gitRoot,
|
|
367
|
-
)
|
|
367
|
+
).pipe(Effect.catchAll(() => Effect.succeed(null)))
|
|
368
368
|
const mainBranch =
|
|
369
369
|
configBranch || (yield* findMainBranchEffect(gitRoot))
|
|
370
370
|
|
|
@@ -383,6 +383,49 @@ export class GitService extends Effect.Service<GitService>()("GitService", {
|
|
|
383
383
|
const strippedMainBranch =
|
|
384
384
|
mainBranch.match(/^[^/]+\/(.+)$/)?.[1] || mainBranch
|
|
385
385
|
|
|
386
|
+
// If currentBranch is empty (detached HEAD), check if HEAD points to main branch
|
|
387
|
+
if (!currentBranch) {
|
|
388
|
+
const headCommit = yield* runGitCommandOrFail(
|
|
389
|
+
["git", "rev-parse", "HEAD"],
|
|
390
|
+
gitRoot,
|
|
391
|
+
)
|
|
392
|
+
const headSha = headCommit.trim()
|
|
393
|
+
|
|
394
|
+
// Check if HEAD matches the configured main branch
|
|
395
|
+
const mainCommitResult = yield* spawnProcess(
|
|
396
|
+
["git", "rev-parse", mainBranch],
|
|
397
|
+
{ cwd: gitRoot },
|
|
398
|
+
)
|
|
399
|
+
if (
|
|
400
|
+
mainCommitResult.exitCode === 0 &&
|
|
401
|
+
headSha === mainCommitResult.stdout.trim()
|
|
402
|
+
) {
|
|
403
|
+
return false
|
|
404
|
+
}
|
|
405
|
+
|
|
406
|
+
// If mainBranch doesn't have a remote prefix, also check the remote version
|
|
407
|
+
if (!mainBranch.includes("/")) {
|
|
408
|
+
const remote = yield* findDefaultRemoteEffect(gitRoot).pipe(
|
|
409
|
+
Effect.catchAll(() => Effect.succeed(null)),
|
|
410
|
+
)
|
|
411
|
+
if (remote) {
|
|
412
|
+
const remoteBranch = `${remote}/${mainBranch}`
|
|
413
|
+
const remoteCommitResult = yield* spawnProcess(
|
|
414
|
+
["git", "rev-parse", remoteBranch],
|
|
415
|
+
{ cwd: gitRoot },
|
|
416
|
+
)
|
|
417
|
+
if (
|
|
418
|
+
remoteCommitResult.exitCode === 0 &&
|
|
419
|
+
headSha === remoteCommitResult.stdout.trim()
|
|
420
|
+
) {
|
|
421
|
+
return false
|
|
422
|
+
}
|
|
423
|
+
}
|
|
424
|
+
}
|
|
425
|
+
|
|
426
|
+
return true
|
|
427
|
+
}
|
|
428
|
+
|
|
386
429
|
// Current branch is not a feature branch if it matches either the full or stripped name
|
|
387
430
|
return (
|
|
388
431
|
currentBranch !== mainBranch && currentBranch !== strippedMainBranch
|