@prover-coder-ai/docker-git 1.0.9 → 1.0.11

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,22 @@ import { parseArgs } from "../../src/docker-git/cli/parser.js"
6
6
 
7
7
  type CreateCommand = Extract<Command, { _tag: "Create" }>
8
8
 
9
+ const expectParseErrorTag = (
10
+ args: ReadonlyArray<string>,
11
+ expectedTag: string
12
+ ) =>
13
+ Effect.sync(() => {
14
+ const parsed = parseArgs(args)
15
+ Either.match(parsed, {
16
+ onLeft: (error) => {
17
+ expect(error._tag).toBe(expectedTag)
18
+ },
19
+ onRight: () => {
20
+ throw new Error("expected parse error")
21
+ }
22
+ })
23
+ })
24
+
9
25
  const parseOrThrow = (args: ReadonlyArray<string>): Command => {
10
26
  const parsed = parseArgs(args)
11
27
  return Either.match(parsed, {
@@ -40,6 +56,8 @@ describe("parseArgs", () => {
40
56
  it.effect("parses create command with defaults", () =>
41
57
  expectCreateCommand(["create", "--repo-url", "https://github.com/org/repo.git"], (command) => {
42
58
  expectCreateDefaults(command)
59
+ expect(command.openSsh).toBe(false)
60
+ expect(command.waitForClone).toBe(false)
43
61
  expect(command.config.containerName).toBe("dg-repo")
44
62
  expect(command.config.serviceName).toBe("dg-repo")
45
63
  expect(command.config.volumeName).toBe("dg-repo-home")
@@ -51,26 +69,20 @@ describe("parseArgs", () => {
51
69
  expect(command.config.repoUrl).toBe("https://github.com/org/repo.git")
52
70
  expect(command.config.repoRef).toBe("issue-9")
53
71
  expect(command.outDir).toBe(".docker-git/org/repo/issue-9")
72
+ expect(command.openSsh).toBe(false)
73
+ expect(command.waitForClone).toBe(false)
54
74
  expect(command.config.containerName).toBe("dg-repo-issue-9")
55
75
  expect(command.config.serviceName).toBe("dg-repo-issue-9")
56
76
  expect(command.config.volumeName).toBe("dg-repo-issue-9-home")
57
77
  }))
58
78
 
59
- it.effect("fails on missing repo url", () =>
60
- Effect.sync(() => {
61
- Either.match(parseArgs(["create"]), {
62
- onLeft: (error) => {
63
- expect(error._tag).toBe("MissingRequiredOption")
64
- },
65
- onRight: () => {
66
- throw new Error("expected parse error")
67
- }
68
- })
69
- }))
79
+ it.effect("fails on missing repo url", () => expectParseErrorTag(["create"], "MissingRequiredOption"))
70
80
 
71
81
  it.effect("parses clone command with positional repo url", () =>
72
82
  expectCreateCommand(["clone", "https://github.com/org/repo.git"], (command) => {
73
83
  expectCreateDefaults(command)
84
+ expect(command.openSsh).toBe(true)
85
+ expect(command.waitForClone).toBe(true)
74
86
  expect(command.config.targetDir).toBe("/home/dev/org/repo")
75
87
  }))
76
88
 
@@ -79,6 +91,16 @@ describe("parseArgs", () => {
79
91
  expect(command.config.repoRef).toBe("feature-x")
80
92
  }))
81
93
 
94
+ it.effect("supports disabling SSH auto-open for clone", () =>
95
+ expectCreateCommand(["clone", "https://github.com/org/repo.git", "--no-ssh"], (command) => {
96
+ expect(command.openSsh).toBe(false)
97
+ }))
98
+
99
+ it.effect("supports enabling SSH auto-open for create", () =>
100
+ expectCreateCommand(["create", "--repo-url", "https://github.com/org/repo.git", "--ssh"], (command) => {
101
+ expect(command.openSsh).toBe(true)
102
+ }))
103
+
82
104
  it.effect("parses force-env flag for clone", () =>
83
105
  expectCreateCommand(["clone", "https://github.com/org/repo.git", "--force-env"], (command) => {
84
106
  expect(command.force).toBe(false)
@@ -169,4 +191,35 @@ describe("parseArgs", () => {
169
191
  }
170
192
  expect(command.message).toBe("sync state")
171
193
  }))
194
+
195
+ it.effect("parses scrap export with defaults", () =>
196
+ Effect.sync(() => {
197
+ const command = parseOrThrow(["scrap", "export"])
198
+ if (command._tag !== "ScrapExport") {
199
+ throw new Error("expected ScrapExport command")
200
+ }
201
+ expect(command.projectDir).toBe(".")
202
+ expect(command.archivePath).toBe(".orch/scrap/session")
203
+ }))
204
+
205
+ it.effect("fails scrap import without archive", () =>
206
+ expectParseErrorTag(["scrap", "import"], "MissingRequiredOption"))
207
+
208
+ it.effect("parses scrap import wipe defaults", () =>
209
+ Effect.sync(() => {
210
+ const command = parseOrThrow(["scrap", "import", "--archive", "workspace.tar.gz"])
211
+ if (command._tag !== "ScrapImport") {
212
+ throw new Error("expected ScrapImport command")
213
+ }
214
+ expect(command.wipe).toBe(true)
215
+ }))
216
+
217
+ it.effect("parses scrap import --no-wipe", () =>
218
+ Effect.sync(() => {
219
+ const command = parseOrThrow(["scrap", "import", "--archive", "workspace.tar.gz", "--no-wipe"])
220
+ if (command._tag !== "ScrapImport") {
221
+ throw new Error("expected ScrapImport command")
222
+ }
223
+ expect(command.wipe).toBe(false)
224
+ }))
172
225
  })