@prover-coder-ai/docker-git 1.0.20 → 1.0.22
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.release.bak +4 -3
- package/CHANGELOG.md +12 -0
- package/README.md +28 -1
- package/dist/src/docker-git/main.js +10256 -12
- package/dist/src/docker-git/main.js.map +1 -0
- package/package.json +3 -4
- package/src/docker-git/cli/parser-apply.ts +28 -0
- package/src/docker-git/cli/parser-clone.ts +3 -9
- package/src/docker-git/cli/parser-options.ts +71 -22
- package/src/docker-git/cli/parser.ts +2 -0
- package/src/docker-git/cli/usage.ts +11 -3
- package/src/docker-git/menu-actions.ts +5 -2
- package/src/docker-git/menu-create.ts +9 -13
- package/src/docker-git/menu-render.ts +1 -1
- package/src/docker-git/program.ts +2 -0
- package/tests/docker-git/entrypoint-auth.test.ts +14 -3
- package/tests/docker-git/parser-network-options.test.ts +47 -0
- package/tests/docker-git/parser.test.ts +105 -18
- package/vite.docker-git.config.ts +34 -0
- package/dist/main.js +0 -905
- package/dist/main.js.map +0 -1
- package/dist/src/app/main.js +0 -15
- package/dist/src/app/program.js +0 -61
- package/dist/src/docker-git/cli/input.js +0 -21
- package/dist/src/docker-git/cli/parser-attach.js +0 -19
- package/dist/src/docker-git/cli/parser-auth.js +0 -90
- package/dist/src/docker-git/cli/parser-clone.js +0 -41
- package/dist/src/docker-git/cli/parser-create.js +0 -1
- package/dist/src/docker-git/cli/parser-mcp-playwright.js +0 -18
- package/dist/src/docker-git/cli/parser-options.js +0 -109
- package/dist/src/docker-git/cli/parser-panes.js +0 -19
- package/dist/src/docker-git/cli/parser-scrap.js +0 -74
- package/dist/src/docker-git/cli/parser-sessions.js +0 -69
- package/dist/src/docker-git/cli/parser-shared.js +0 -26
- package/dist/src/docker-git/cli/parser-state.js +0 -62
- package/dist/src/docker-git/cli/parser.js +0 -46
- package/dist/src/docker-git/cli/read-command.js +0 -17
- package/dist/src/docker-git/cli/usage.js +0 -108
- package/dist/src/docker-git/menu-actions.js +0 -135
- package/dist/src/docker-git/menu-auth-data.js +0 -90
- package/dist/src/docker-git/menu-auth-helpers.js +0 -20
- package/dist/src/docker-git/menu-auth.js +0 -159
- package/dist/src/docker-git/menu-buffer-input.js +0 -9
- package/dist/src/docker-git/menu-create.js +0 -199
- package/dist/src/docker-git/menu-input-handler.js +0 -109
- package/dist/src/docker-git/menu-input-utils.js +0 -47
- package/dist/src/docker-git/menu-input.js +0 -2
- package/dist/src/docker-git/menu-labeled-env.js +0 -33
- package/dist/src/docker-git/menu-menu.js +0 -46
- package/dist/src/docker-git/menu-project-auth-claude.js +0 -43
- package/dist/src/docker-git/menu-project-auth-data.js +0 -165
- package/dist/src/docker-git/menu-project-auth.js +0 -124
- package/dist/src/docker-git/menu-render-auth.js +0 -45
- package/dist/src/docker-git/menu-render-common.js +0 -26
- package/dist/src/docker-git/menu-render-layout.js +0 -14
- package/dist/src/docker-git/menu-render-project-auth.js +0 -37
- package/dist/src/docker-git/menu-render-select.js +0 -129
- package/dist/src/docker-git/menu-render.js +0 -137
- package/dist/src/docker-git/menu-select-actions.js +0 -66
- package/dist/src/docker-git/menu-select-connect.js +0 -6
- package/dist/src/docker-git/menu-select-load.js +0 -12
- package/dist/src/docker-git/menu-select-order.js +0 -21
- package/dist/src/docker-git/menu-select-runtime.js +0 -82
- package/dist/src/docker-git/menu-select-view.js +0 -15
- package/dist/src/docker-git/menu-select.js +0 -98
- package/dist/src/docker-git/menu-shared.js +0 -180
- package/dist/src/docker-git/menu-startup.js +0 -57
- package/dist/src/docker-git/menu-types.js +0 -21
- package/dist/src/docker-git/menu.js +0 -226
- package/dist/src/docker-git/program.js +0 -42
- package/dist/src/docker-git/tmux.js +0 -176
|
@@ -2,6 +2,7 @@ import { describe, expect, it } from "@effect/vitest"
|
|
|
2
2
|
import { Effect, Either } from "effect"
|
|
3
3
|
|
|
4
4
|
import { type Command, defaultTemplateConfig } from "@effect-template/lib/core/domain"
|
|
5
|
+
import { expandContainerHome } from "@effect-template/lib/usecases/scrap-path"
|
|
5
6
|
import { parseArgs } from "../../src/docker-git/cli/parser.js"
|
|
6
7
|
|
|
7
8
|
type CreateCommand = Extract<Command, { _tag: "Create" }>
|
|
@@ -32,6 +33,26 @@ const parseOrThrow = (args: ReadonlyArray<string>): Command => {
|
|
|
32
33
|
})
|
|
33
34
|
}
|
|
34
35
|
|
|
36
|
+
type ProjectDirRunUpCommand = Extract<Command, { readonly projectDir: string; readonly runUp: boolean }>
|
|
37
|
+
|
|
38
|
+
const expectProjectDirRunUpCommand = (
|
|
39
|
+
args: ReadonlyArray<string>,
|
|
40
|
+
expectedTag: ProjectDirRunUpCommand["_tag"],
|
|
41
|
+
expectedProjectDir: string,
|
|
42
|
+
expectedRunUp: boolean
|
|
43
|
+
) =>
|
|
44
|
+
Effect.sync(() => {
|
|
45
|
+
const command = parseOrThrow(args)
|
|
46
|
+
if (command._tag !== expectedTag) {
|
|
47
|
+
throw new Error(`expected ${expectedTag} command`)
|
|
48
|
+
}
|
|
49
|
+
if (!("projectDir" in command) || !("runUp" in command)) {
|
|
50
|
+
throw new Error("expected command with projectDir and runUp")
|
|
51
|
+
}
|
|
52
|
+
expect(command.projectDir).toBe(expectedProjectDir)
|
|
53
|
+
expect(command.runUp).toBe(expectedRunUp)
|
|
54
|
+
})
|
|
55
|
+
|
|
35
56
|
const expectCreateCommand = (
|
|
36
57
|
args: ReadonlyArray<string>,
|
|
37
58
|
onRight: (command: CreateCommand) => void
|
|
@@ -50,8 +71,12 @@ const expectCreateDefaults = (command: CreateCommand) => {
|
|
|
50
71
|
expect(command.outDir).toBe(".docker-git/org/repo")
|
|
51
72
|
expect(command.runUp).toBe(true)
|
|
52
73
|
expect(command.forceEnv).toBe(false)
|
|
74
|
+
expect(command.config.dockerNetworkMode).toBe("shared")
|
|
75
|
+
expect(command.config.dockerSharedNetworkName).toBe("docker-git-shared")
|
|
53
76
|
}
|
|
54
77
|
|
|
78
|
+
const expandDefaultTargetDir = (path: string): string => expandContainerHome(defaultTemplateConfig.sshUser, path)
|
|
79
|
+
|
|
55
80
|
describe("parseArgs", () => {
|
|
56
81
|
it.effect("parses create command with defaults", () =>
|
|
57
82
|
expectCreateCommand(["create", "--repo-url", "https://github.com/org/repo.git"], (command) => {
|
|
@@ -76,14 +101,29 @@ describe("parseArgs", () => {
|
|
|
76
101
|
expect(command.config.volumeName).toBe("dg-repo-issue-9-home")
|
|
77
102
|
}))
|
|
78
103
|
|
|
79
|
-
it.effect("
|
|
104
|
+
it.effect("parses create command without repo url into empty workspace defaults", () =>
|
|
105
|
+
expectCreateCommand(["create"], (command) => {
|
|
106
|
+
expect(command.config.repoUrl).toBe("")
|
|
107
|
+
expect(command.config.repoRef).toBe(defaultTemplateConfig.repoRef)
|
|
108
|
+
expect(command.outDir).toBe(".docker-git/app")
|
|
109
|
+
expect(command.openSsh).toBe(false)
|
|
110
|
+
expect(command.waitForClone).toBe(false)
|
|
111
|
+
expect(command.config.containerName).toBe("dg-app")
|
|
112
|
+
expect(command.config.serviceName).toBe("dg-app")
|
|
113
|
+
expect(command.config.volumeName).toBe("dg-app-home")
|
|
114
|
+
expect(command.config.targetDir).toBe(expandDefaultTargetDir(defaultTemplateConfig.targetDir))
|
|
115
|
+
}))
|
|
116
|
+
|
|
117
|
+
it.effect("fails clone when repo url is missing", () => expectParseErrorTag(["clone"], "MissingRequiredOption"))
|
|
80
118
|
|
|
81
119
|
it.effect("parses clone command with positional repo url", () =>
|
|
82
120
|
expectCreateCommand(["clone", "https://github.com/org/repo.git"], (command) => {
|
|
83
121
|
expectCreateDefaults(command)
|
|
84
122
|
expect(command.openSsh).toBe(true)
|
|
85
123
|
expect(command.waitForClone).toBe(true)
|
|
86
|
-
expect(command.config.targetDir).toBe(
|
|
124
|
+
expect(command.config.targetDir).toBe(
|
|
125
|
+
expandDefaultTargetDir("~/workspaces/org/repo")
|
|
126
|
+
)
|
|
87
127
|
}))
|
|
88
128
|
|
|
89
129
|
it.effect("parses clone branch alias", () =>
|
|
@@ -96,6 +136,25 @@ describe("parseArgs", () => {
|
|
|
96
136
|
expect(command.openSsh).toBe(false)
|
|
97
137
|
}))
|
|
98
138
|
|
|
139
|
+
it.effect("parses clone git token label from inline option and normalizes it", () =>
|
|
140
|
+
expectCreateCommand(["clone", "https://github.com/org/repo.git", "--git-token=#agiens"], (command) => {
|
|
141
|
+
expect(command.config.gitTokenLabel).toBe("AGIENS")
|
|
142
|
+
}))
|
|
143
|
+
|
|
144
|
+
it.effect("parses clone codex/claude token labels from inline options and normalizes them", () =>
|
|
145
|
+
expectCreateCommand(
|
|
146
|
+
[
|
|
147
|
+
"clone",
|
|
148
|
+
"https://github.com/org/repo.git",
|
|
149
|
+
"--codex-token= Team A ",
|
|
150
|
+
"--claude-token=---AGIENS:::Claude---"
|
|
151
|
+
],
|
|
152
|
+
(command) => {
|
|
153
|
+
expect(command.config.codexAuthLabel).toBe("team-a")
|
|
154
|
+
expect(command.config.claudeAuthLabel).toBe("agiens-claude")
|
|
155
|
+
}
|
|
156
|
+
))
|
|
157
|
+
|
|
99
158
|
it.effect("supports enabling SSH auto-open for create", () =>
|
|
100
159
|
expectCreateCommand(["create", "--repo-url", "https://github.com/org/repo.git", "--ssh"], (command) => {
|
|
101
160
|
expect(command.openSsh).toBe(true)
|
|
@@ -118,7 +177,9 @@ describe("parseArgs", () => {
|
|
|
118
177
|
expect(command.config.repoUrl).toBe("https://github.com/agiens/crm.git")
|
|
119
178
|
expect(command.config.repoRef).toBe("vova-fork")
|
|
120
179
|
expect(command.outDir).toBe(".docker-git/agiens/crm")
|
|
121
|
-
expect(command.config.targetDir).toBe(
|
|
180
|
+
expect(command.config.targetDir).toBe(
|
|
181
|
+
expandDefaultTargetDir("~/workspaces/agiens/crm")
|
|
182
|
+
)
|
|
122
183
|
}))
|
|
123
184
|
|
|
124
185
|
it.effect("parses GitHub issue url as isolated project + issue branch", () =>
|
|
@@ -126,7 +187,9 @@ describe("parseArgs", () => {
|
|
|
126
187
|
expect(command.config.repoUrl).toBe("https://github.com/org/repo.git")
|
|
127
188
|
expect(command.config.repoRef).toBe("issue-5")
|
|
128
189
|
expect(command.outDir).toBe(".docker-git/org/repo/issue-5")
|
|
129
|
-
expect(command.config.targetDir).toBe(
|
|
190
|
+
expect(command.config.targetDir).toBe(
|
|
191
|
+
expandDefaultTargetDir("~/workspaces/org/repo/issue-5")
|
|
192
|
+
)
|
|
130
193
|
expect(command.config.containerName).toBe("dg-repo-issue-5")
|
|
131
194
|
expect(command.config.serviceName).toBe("dg-repo-issue-5")
|
|
132
195
|
expect(command.config.volumeName).toBe("dg-repo-issue-5-home")
|
|
@@ -137,7 +200,9 @@ describe("parseArgs", () => {
|
|
|
137
200
|
expect(command.config.repoUrl).toBe("https://github.com/org/repo.git")
|
|
138
201
|
expect(command.config.repoRef).toBe("refs/pull/42/head")
|
|
139
202
|
expect(command.outDir).toBe(".docker-git/org/repo/pr-42")
|
|
140
|
-
expect(command.config.targetDir).toBe(
|
|
203
|
+
expect(command.config.targetDir).toBe(
|
|
204
|
+
expandDefaultTargetDir("~/workspaces/org/repo/pr-42")
|
|
205
|
+
)
|
|
141
206
|
expect(command.config.containerName).toBe("dg-repo-pr-42")
|
|
142
207
|
expect(command.config.serviceName).toBe("dg-repo-pr-42")
|
|
143
208
|
expect(command.config.volumeName).toBe("dg-repo-pr-42-home")
|
|
@@ -153,31 +218,53 @@ describe("parseArgs", () => {
|
|
|
153
218
|
}))
|
|
154
219
|
|
|
155
220
|
it.effect("parses mcp-playwright command in current directory", () =>
|
|
221
|
+
expectProjectDirRunUpCommand(["mcp-playwright"], "McpPlaywrightUp", ".", true))
|
|
222
|
+
|
|
223
|
+
it.effect("parses mcp-playwright command with --no-up", () =>
|
|
224
|
+
expectProjectDirRunUpCommand(["mcp-playwright", "--no-up"], "McpPlaywrightUp", ".", false))
|
|
225
|
+
|
|
226
|
+
it.effect("parses mcp-playwright with positional repo url into project dir", () =>
|
|
156
227
|
Effect.sync(() => {
|
|
157
|
-
const command = parseOrThrow(["mcp-playwright"])
|
|
228
|
+
const command = parseOrThrow(["mcp-playwright", "https://github.com/org/repo.git"])
|
|
158
229
|
if (command._tag !== "McpPlaywrightUp") {
|
|
159
230
|
throw new Error("expected McpPlaywrightUp command")
|
|
160
231
|
}
|
|
161
|
-
expect(command.projectDir).toBe(".")
|
|
162
|
-
expect(command.runUp).toBe(true)
|
|
232
|
+
expect(command.projectDir).toBe(".docker-git/org/repo")
|
|
163
233
|
}))
|
|
164
234
|
|
|
165
|
-
it.effect("parses
|
|
235
|
+
it.effect("parses apply command in current directory", () =>
|
|
236
|
+
expectProjectDirRunUpCommand(["apply"], "Apply", ".", true))
|
|
237
|
+
|
|
238
|
+
it.effect("parses apply command with --no-up", () =>
|
|
239
|
+
expectProjectDirRunUpCommand(["apply", "--no-up"], "Apply", ".", false))
|
|
240
|
+
|
|
241
|
+
it.effect("parses apply with positional repo url into project dir", () =>
|
|
166
242
|
Effect.sync(() => {
|
|
167
|
-
const command = parseOrThrow(["
|
|
168
|
-
if (command._tag !== "
|
|
169
|
-
throw new Error("expected
|
|
243
|
+
const command = parseOrThrow(["apply", "https://github.com/org/repo.git"])
|
|
244
|
+
if (command._tag !== "Apply") {
|
|
245
|
+
throw new Error("expected Apply command")
|
|
170
246
|
}
|
|
171
|
-
expect(command.
|
|
247
|
+
expect(command.projectDir).toBe(".docker-git/org/repo")
|
|
172
248
|
}))
|
|
173
249
|
|
|
174
|
-
it.effect("parses
|
|
250
|
+
it.effect("parses apply token and mcp overrides", () =>
|
|
175
251
|
Effect.sync(() => {
|
|
176
|
-
const command = parseOrThrow([
|
|
177
|
-
|
|
178
|
-
|
|
252
|
+
const command = parseOrThrow([
|
|
253
|
+
"apply",
|
|
254
|
+
"--git-token=agien_main",
|
|
255
|
+
"--codex-token=Team A",
|
|
256
|
+
"--claude-token=Team B",
|
|
257
|
+
"--mcp-playwright",
|
|
258
|
+
"--no-up"
|
|
259
|
+
])
|
|
260
|
+
if (command._tag !== "Apply") {
|
|
261
|
+
throw new Error("expected Apply command")
|
|
179
262
|
}
|
|
180
|
-
expect(command.
|
|
263
|
+
expect(command.runUp).toBe(false)
|
|
264
|
+
expect(command.gitTokenLabel).toBe("agien_main")
|
|
265
|
+
expect(command.codexTokenLabel).toBe("Team A")
|
|
266
|
+
expect(command.claudeTokenLabel).toBe("Team B")
|
|
267
|
+
expect(command.enableMcpPlaywright).toBe(true)
|
|
181
268
|
}))
|
|
182
269
|
|
|
183
270
|
it.effect("parses down-all command", () =>
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
import path from "node:path"
|
|
2
|
+
import { fileURLToPath } from "node:url"
|
|
3
|
+
import { defineConfig } from "vite"
|
|
4
|
+
import tsconfigPaths from "vite-tsconfig-paths"
|
|
5
|
+
|
|
6
|
+
const __filename = fileURLToPath(import.meta.url)
|
|
7
|
+
const __dirname = path.dirname(__filename)
|
|
8
|
+
|
|
9
|
+
export default defineConfig({
|
|
10
|
+
plugins: [tsconfigPaths()],
|
|
11
|
+
publicDir: false,
|
|
12
|
+
resolve: {
|
|
13
|
+
alias: {
|
|
14
|
+
"@": path.resolve(__dirname, "src"),
|
|
15
|
+
"@effect-template/lib": path.resolve(__dirname, "../lib/src")
|
|
16
|
+
}
|
|
17
|
+
},
|
|
18
|
+
build: {
|
|
19
|
+
target: "node20",
|
|
20
|
+
outDir: "dist",
|
|
21
|
+
sourcemap: true,
|
|
22
|
+
ssr: "src/docker-git/main.ts",
|
|
23
|
+
rollupOptions: {
|
|
24
|
+
output: {
|
|
25
|
+
format: "es",
|
|
26
|
+
entryFileNames: "src/docker-git/main.js",
|
|
27
|
+
inlineDynamicImports: true
|
|
28
|
+
}
|
|
29
|
+
}
|
|
30
|
+
},
|
|
31
|
+
ssr: {
|
|
32
|
+
target: "node"
|
|
33
|
+
}
|
|
34
|
+
})
|