@prover-coder-ai/docker-git 1.0.22 → 1.0.23

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": "@prover-coder-ai/docker-git",
3
- "version": "1.0.22",
3
+ "version": "1.0.23",
4
4
  "description": "Minimal Vite-powered TypeScript console starter using Effect",
5
5
  "main": "dist/src/docker-git/main.js",
6
6
  "bin": {
@@ -50,6 +50,7 @@
50
50
  "build:docker-git": "vite build --config vite.docker-git.config.ts",
51
51
  "check": "pnpm run typecheck",
52
52
  "clone": "pnpm -C ../.. run clone",
53
+ "open": "pnpm -C ../.. run open",
53
54
  "docker-git": "node dist/src/docker-git/main.js",
54
55
  "list": "pnpm -C ../.. run list",
55
56
  "prestart": "pnpm run build",
@@ -1,17 +1,17 @@
1
- import { listProjects, readCloneRequest, runDockerGitClone } from "@effect-template/lib"
1
+ import { listProjects, readCloneRequest, runDockerGitClone, runDockerGitOpen } from "@effect-template/lib"
2
2
  import { Console, Effect, Match, pipe } from "effect"
3
3
 
4
4
  /**
5
5
  * Compose the CLI program as a single effect.
6
6
  *
7
- * @returns Effect that either runs docker-git clone or prints usage.
7
+ * @returns Effect that either runs docker-git clone/open or prints usage.
8
8
  *
9
- * @pure false - uses Console output and spawns commands when cloning
9
+ * @pure false - uses Console output and spawns commands when running shortcuts
10
10
  * @effect Console, CommandExecutor, Path
11
- * @invariant forall args in Argv: clone(args) -> docker_git_invoked(args)
11
+ * @invariant forall args in Argv: shortcut(args) -> docker_git_invoked(args)
12
12
  * @precondition true
13
- * @postcondition clone(args) -> docker_git_invoked(args); otherwise usage printed
14
- * @complexity O(build + clone)
13
+ * @postcondition shortcut(args) -> docker_git_invoked(args); otherwise usage printed
14
+ * @complexity O(build + shortcut)
15
15
  * @throws Never - all errors are typed in the Effect error channel
16
16
  */
17
17
  // CHANGE: replace greeting demo with deterministic usage text
@@ -28,32 +28,35 @@ const usageText = [
28
28
  "Usage:",
29
29
  " pnpm docker-git",
30
30
  " pnpm clone <repo-url> [ref]",
31
+ " pnpm open <repo-url>",
31
32
  " pnpm list",
32
33
  "",
33
34
  "Notes:",
34
35
  " - docker-git is the interactive TUI.",
35
- " - clone builds + runs docker-git clone for you."
36
+ " - clone builds + runs docker-git clone for you.",
37
+ " - open builds + runs docker-git open for existing projects."
36
38
  ].join("\n")
37
39
 
38
40
  // PURITY: SHELL
39
41
  // EFFECT: Effect<void, never, Console>
40
42
  const runHelp = Console.log(usageText)
41
43
 
42
- // CHANGE: route between clone runner and help based on CLI context
43
- // WHY: allow pnpm run clone <url> while keeping a single entrypoint
44
- // QUOTE(ТЗ): "pnpm run clone <url>"
44
+ // CHANGE: route between shortcut runners and help based on CLI context
45
+ // WHY: allow pnpm run clone/open <url> while keeping a single entrypoint
46
+ // QUOTE(ТЗ): "Добавить команду open."
45
47
  // REF: user-request-2026-01-27
46
48
  // SOURCE: n/a
47
- // FORMAT THEOREM: forall argv: clone(argv) -> docker_git_invoked(argv)
49
+ // FORMAT THEOREM: forall argv: shortcut(argv) -> docker_git_invoked(argv)
48
50
  // PURITY: SHELL
49
51
  // EFFECT: Effect<void, Error, Console | CommandExecutor | Path>
50
- // INVARIANT: help is printed when clone is not requested
51
- // COMPLEXITY: O(build + clone)
52
+ // INVARIANT: help is printed when shortcut is not requested
53
+ // COMPLEXITY: O(build + shortcut)
52
54
  const runDockerGit = pipe(
53
55
  readCloneRequest,
54
56
  Effect.flatMap((request) =>
55
57
  Match.value(request).pipe(
56
58
  Match.when({ _tag: "Clone" }, ({ args }) => runDockerGitClone(args)),
59
+ Match.when({ _tag: "Open" }, ({ args }) => runDockerGitOpen(args)),
57
60
  Match.when({ _tag: "None" }, () => runHelp),
58
61
  Match.exhaustive
59
62
  )
@@ -75,6 +75,7 @@ export const parseArgs = (args: ReadonlyArray<string>): Either.Either<Command, P
75
75
  Match.when("auth", () => parseAuth(rest))
76
76
  )
77
77
  .pipe(
78
+ Match.when("open", () => parseAttach(rest)),
78
79
  Match.when("apply", () => parseApply(rest)),
79
80
  Match.when("state", () => parseState(rest)),
80
81
  Match.orElse(() => Either.left(unknownCommandError))
@@ -5,6 +5,7 @@ import type { ParseError } from "@effect-template/lib/core/domain"
5
5
  export const usageText = `docker-git menu
6
6
  docker-git create [--repo-url <url>] [options]
7
7
  docker-git clone <url> [options]
8
+ docker-git open [<url>] [options]
8
9
  docker-git apply [<url>] [options]
9
10
  docker-git mcp-playwright [<url>] [options]
10
11
  docker-git attach [<url>] [options]
@@ -22,9 +23,10 @@ Commands:
22
23
  menu Interactive menu (default when no args)
23
24
  create, init Generate docker development environment (repo URL optional)
24
25
  clone Create + run container and clone repo
26
+ open Open existing docker-git project workspace
25
27
  apply Apply docker-git config to an existing project/container (current dir by default)
26
28
  mcp-playwright Enable Playwright MCP + Chromium sidecar for an existing project dir
27
- attach, tmux Open tmux workspace for a docker-git project
29
+ attach, tmux Alias for open
28
30
  panes, terms List tmux panes for a docker-git project
29
31
  scrap Export/import project scrap (session snapshot + rebuildable deps)
30
32
  sessions List/kill/log container terminal processes
@@ -51,7 +53,7 @@ Options:
51
53
  --network-mode <mode> Compose network mode: shared|project (default: shared)
52
54
  --shared-network <name> Shared Docker network name when network-mode=shared (default: docker-git-shared)
53
55
  --out-dir <path> Output directory (default: <projectsRoot>/<org>/<repo>[/issue-<id>|/pr-<id>])
54
- --project-dir <path> Project directory for attach (default: .)
56
+ --project-dir <path> Project directory for open/attach (default: .)
55
57
  --archive <path> Scrap snapshot directory (default: .orch/scrap/session)
56
58
  --mode <session> Scrap mode (default: session)
57
59
  --git-token <label> Token label for clone/create (maps to GITHUB_TOKEN__<LABEL>, example: agiens)
@@ -0,0 +1,76 @@
1
+ import { expect } from "@effect/vitest"
2
+ import { Effect, Either } from "effect"
3
+
4
+ import type { Command } from "@effect-template/lib/core/domain"
5
+ import { parseArgs } from "../../src/docker-git/cli/parser.js"
6
+
7
+ export type CreateCommand = Extract<Command, { _tag: "Create" }>
8
+ type ProjectDirRunUpCommand = Extract<Command, { readonly projectDir: string; readonly runUp: boolean }>
9
+
10
+ export const expectParseErrorTag = (
11
+ args: ReadonlyArray<string>,
12
+ expectedTag: string
13
+ ) =>
14
+ Effect.sync(() => {
15
+ const parsed = parseArgs(args)
16
+ Either.match(parsed, {
17
+ onLeft: (error) => {
18
+ expect(error._tag).toBe(expectedTag)
19
+ },
20
+ onRight: () => {
21
+ throw new Error("expected parse error")
22
+ }
23
+ })
24
+ })
25
+
26
+ export const parseOrThrow = (args: ReadonlyArray<string>): Command => {
27
+ const parsed = parseArgs(args)
28
+ return Either.match(parsed, {
29
+ onLeft: (error) => {
30
+ throw new Error(`unexpected error ${error._tag}`)
31
+ },
32
+ onRight: (command) => command
33
+ })
34
+ }
35
+
36
+ export const expectProjectDirRunUpCommand = (
37
+ args: ReadonlyArray<string>,
38
+ expectedTag: ProjectDirRunUpCommand["_tag"],
39
+ expectedProjectDir: string,
40
+ expectedRunUp: boolean
41
+ ) =>
42
+ Effect.sync(() => {
43
+ const command = parseOrThrow(args)
44
+ if (command._tag !== expectedTag) {
45
+ throw new Error(`expected ${expectedTag} command`)
46
+ }
47
+ if (!("projectDir" in command) || !("runUp" in command)) {
48
+ throw new Error("expected command with projectDir and runUp")
49
+ }
50
+ expect(command.projectDir).toBe(expectedProjectDir)
51
+ expect(command.runUp).toBe(expectedRunUp)
52
+ })
53
+
54
+ export const expectAttachProjectDirCommand = (
55
+ args: ReadonlyArray<string>,
56
+ expectedProjectDir: string
57
+ ) =>
58
+ Effect.sync(() => {
59
+ const command = parseOrThrow(args)
60
+ if (command._tag !== "Attach") {
61
+ throw new Error("expected Attach command")
62
+ }
63
+ expect(command.projectDir).toBe(expectedProjectDir)
64
+ })
65
+
66
+ export const expectCreateCommand = (
67
+ args: ReadonlyArray<string>,
68
+ onRight: (command: CreateCommand) => void
69
+ ) =>
70
+ Effect.sync(() => {
71
+ const command = parseOrThrow(args)
72
+ if (command._tag !== "Create") {
73
+ throw new Error("expected Create command")
74
+ }
75
+ onRight(command)
76
+ })
@@ -1,69 +1,16 @@
1
1
  import { describe, expect, it } from "@effect/vitest"
2
- import { Effect, Either } from "effect"
2
+ import { Effect } from "effect"
3
3
 
4
- import { type Command, defaultTemplateConfig } from "@effect-template/lib/core/domain"
4
+ import { defaultTemplateConfig } from "@effect-template/lib/core/domain"
5
5
  import { expandContainerHome } from "@effect-template/lib/usecases/scrap-path"
6
- import { parseArgs } from "../../src/docker-git/cli/parser.js"
7
-
8
- type CreateCommand = Extract<Command, { _tag: "Create" }>
9
-
10
- const expectParseErrorTag = (
11
- args: ReadonlyArray<string>,
12
- expectedTag: string
13
- ) =>
14
- Effect.sync(() => {
15
- const parsed = parseArgs(args)
16
- Either.match(parsed, {
17
- onLeft: (error) => {
18
- expect(error._tag).toBe(expectedTag)
19
- },
20
- onRight: () => {
21
- throw new Error("expected parse error")
22
- }
23
- })
24
- })
25
-
26
- const parseOrThrow = (args: ReadonlyArray<string>): Command => {
27
- const parsed = parseArgs(args)
28
- return Either.match(parsed, {
29
- onLeft: (error) => {
30
- throw new Error(`unexpected error ${error._tag}`)
31
- },
32
- onRight: (command) => command
33
- })
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
-
56
- const expectCreateCommand = (
57
- args: ReadonlyArray<string>,
58
- onRight: (command: CreateCommand) => void
59
- ) =>
60
- Effect.sync(() => {
61
- const command = parseOrThrow(args)
62
- if (command._tag !== "Create") {
63
- throw new Error("expected Create command")
64
- }
65
- onRight(command)
66
- })
6
+ import {
7
+ type CreateCommand,
8
+ expectAttachProjectDirCommand,
9
+ expectCreateCommand,
10
+ expectParseErrorTag,
11
+ expectProjectDirRunUpCommand,
12
+ parseOrThrow
13
+ } from "./parser-helpers.js"
67
14
 
68
15
  const expectCreateDefaults = (command: CreateCommand) => {
69
16
  expect(command.config.repoUrl).toBe("https://github.com/org/repo.git")
@@ -209,13 +156,10 @@ describe("parseArgs", () => {
209
156
  }))
210
157
 
211
158
  it.effect("parses attach with GitHub issue url into issue workspace", () =>
212
- Effect.sync(() => {
213
- const command = parseOrThrow(["attach", "https://github.com/org/repo/issues/7"])
214
- if (command._tag !== "Attach") {
215
- throw new Error("expected Attach command")
216
- }
217
- expect(command.projectDir).toBe(".docker-git/org/repo/issue-7")
218
- }))
159
+ expectAttachProjectDirCommand(["attach", "https://github.com/org/repo/issues/7"], ".docker-git/org/repo/issue-7"))
160
+
161
+ it.effect("parses open with GitHub issue url into issue workspace", () =>
162
+ expectAttachProjectDirCommand(["open", "https://github.com/org/repo/issues/7"], ".docker-git/org/repo/issue-7"))
219
163
 
220
164
  it.effect("parses mcp-playwright command in current directory", () =>
221
165
  expectProjectDirRunUpCommand(["mcp-playwright"], "McpPlaywrightUp", ".", true))