@markjaquith/agency 2.15.0 → 2.17.0
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/README.md +35 -1
- package/cli.ts +40 -0
- package/package.json +1 -1
- package/src/cli-parser.test.ts +34 -0
- package/src/cli-parser.ts +38 -4
- package/src/cli.test.ts +50 -0
- package/src/commands/next.ts +64 -0
- package/src/commands/pr.ts +2 -0
- package/src/commands/read-only.test.ts +2 -0
- package/src/commands/sync.ts +36 -0
- package/src/commands/work.test.ts +84 -0
- package/src/commands/work.ts +25 -2
- package/src/protocol.ts +11 -0
- package/src/services/ClaimService.ts +94 -0
- package/src/services/GraphService.test.ts +36 -0
- package/src/services/GraphService.ts +8 -1
- package/src/services/PullRequestService.test.ts +20 -1
- package/src/services/PullRequestService.ts +14 -1
- package/src/services/ReadinessService.test.ts +223 -0
- package/src/services/ReadinessService.ts +230 -0
- package/src/services/SyncService.test.ts +364 -0
- package/src/services/SyncService.ts +738 -0
- package/src/services/WorktreeService.test.ts +12 -0
- package/src/services/WorktreeService.ts +6 -2
- package/src/test-utils.ts +4 -0
|
@@ -206,6 +206,18 @@ describe("WorktreeService", () => {
|
|
|
206
206
|
expect(
|
|
207
207
|
await Bun.file(join(root, "tasks", "valid-target", "code")).exists(),
|
|
208
208
|
).toBe(false)
|
|
209
|
+
|
|
210
|
+
await expect(
|
|
211
|
+
runTestEffect(
|
|
212
|
+
WorktreeService.pipe(
|
|
213
|
+
Effect.flatMap((service) =>
|
|
214
|
+
service.materialize("valid-target", undefined, root, {
|
|
215
|
+
force: true,
|
|
216
|
+
}),
|
|
217
|
+
),
|
|
218
|
+
),
|
|
219
|
+
),
|
|
220
|
+
).resolves.toMatchObject({ repo: "agency" })
|
|
209
221
|
})
|
|
210
222
|
|
|
211
223
|
test("uses a configured worktree creation command", async () => {
|
|
@@ -84,6 +84,10 @@ const isCommitId = (ref: string) => /^[0-9a-f]{40,64}$/i.test(ref)
|
|
|
84
84
|
const originRef = (ref: string) =>
|
|
85
85
|
ref.replace(/^refs\/remotes\/origin\//, "").replace(/^origin\//, "")
|
|
86
86
|
|
|
87
|
+
interface MaterializeOptions extends BaseCommandOptions {
|
|
88
|
+
readonly force?: boolean
|
|
89
|
+
}
|
|
90
|
+
|
|
87
91
|
export class WorktreeService extends Effect.Service<WorktreeService>()(
|
|
88
92
|
"WorktreeService",
|
|
89
93
|
{
|
|
@@ -92,7 +96,7 @@ export class WorktreeService extends Effect.Service<WorktreeService>()(
|
|
|
92
96
|
taskId: string,
|
|
93
97
|
phaseId?: string,
|
|
94
98
|
startPath: string = process.cwd(),
|
|
95
|
-
options:
|
|
99
|
+
options: MaterializeOptions = {},
|
|
96
100
|
) =>
|
|
97
101
|
Effect.gen(function* () {
|
|
98
102
|
const fs = yield* FileSystemService
|
|
@@ -105,7 +109,7 @@ export class WorktreeService extends Effect.Service<WorktreeService>()(
|
|
|
105
109
|
const { root, config } = yield* workbase.loadConfig(startPath)
|
|
106
110
|
const report = yield* workbase.validate(root)
|
|
107
111
|
const validationIssue = report.issues[0]
|
|
108
|
-
if (validationIssue) {
|
|
112
|
+
if (validationIssue && !options.force) {
|
|
109
113
|
return yield* new WorktreeError({
|
|
110
114
|
message: `${validationIssue.path}: ${validationIssue.message}`,
|
|
111
115
|
})
|
package/src/test-utils.ts
CHANGED
|
@@ -16,6 +16,8 @@ import { IntegrationService } from "./services/IntegrationService"
|
|
|
16
16
|
import { ContextService } from "./services/ContextService"
|
|
17
17
|
import { GraphService } from "./services/GraphService"
|
|
18
18
|
import { ClaimService } from "./services/ClaimService"
|
|
19
|
+
import { SyncService } from "./services/SyncService"
|
|
20
|
+
import { ReadinessService } from "./services/ReadinessService"
|
|
19
21
|
|
|
20
22
|
export const createTempDir = () => mkdtemp(join(tmpdir(), "agency-test-"))
|
|
21
23
|
|
|
@@ -36,6 +38,8 @@ const TestLayer = Layer.mergeAll(
|
|
|
36
38
|
ContextService.Default,
|
|
37
39
|
GraphService.Default,
|
|
38
40
|
ClaimService.Default,
|
|
41
|
+
SyncService.Default,
|
|
42
|
+
ReadinessService.Default,
|
|
39
43
|
)
|
|
40
44
|
|
|
41
45
|
export async function runTestEffect<A, E>(
|