@@ -10,9 +10,9 @@ import { CommandFailedError } from "./errors.js"
1010
1111const successExitCode = Number ( ExitCode ( 0 ) )
1212
13- // CHANGE: read clone request from process argv and npm lifecycle metadata
14- // WHY: allow pnpm run clone <url> to work without "--"
15- // QUOTE(ТЗ): "pnpm run clone <url> "
13+ // CHANGE: read shortcut requests from process argv and npm lifecycle metadata
14+ // WHY: allow pnpm run clone/open <url> to work without "--"
15+ // QUOTE(ТЗ): "Добавить команду open. ... Просто открывает существующий по ссылке "
1616// REF: user-request-2026-01-27
1717// SOURCE: n/a
1818// FORMAT THEOREM: forall env: read(env) -> deterministic(request)
@@ -24,17 +24,8 @@ export const readCloneRequest: Effect.Effect<CloneRequest> = Effect.sync(() =>
2424 resolveCloneRequest ( process . argv . slice ( 2 ) , process . env [ "npm_lifecycle_event" ] )
2525)
2626
27- // CHANGE: run docker-git clone by building and invoking its CLI
28- // WHY: reuse docker-git without mutating its codebase
29- // QUOTE(ТЗ): "docker git мы никак не изменяем"
30- // REF: user-request-2026-01-27
31- // SOURCE: n/a
32- // FORMAT THEOREM: forall args: build && run(args) -> docker_git_invoked(args)
33- // PURITY: SHELL
34- // EFFECT: Effect<void, CommandFailedError | PlatformError, CommandExecutor | Path>
35- // INVARIANT: build runs before clone command
36- // COMPLEXITY: O(build + clone)
37- export const runDockerGitClone = (
27+ const runDockerGitCommand = (
28+ commandName : "clone" | "open" ,
3829 args : ReadonlyArray < string >
3930) : Effect . Effect <
4031 void ,
@@ -47,7 +38,7 @@ export const runDockerGitClone = (
4738 const appRoot = path . join ( workspaceRoot , "packages" , "app" )
4839 const dockerGitCli = path . join ( appRoot , "dist" , "src" , "docker-git" , "main.js" )
4940 const buildLabel = `pnpm -C ${ appRoot } build:docker-git`
50- const cloneLabel = `node ${ dockerGitCli } clone `
41+ const runLabel = `node ${ dockerGitCli } ${ commandName } `
5142
5243 yield * _ (
5344 runCommandWithExitCodes (
@@ -58,9 +49,45 @@ export const runDockerGitClone = (
5849 )
5950 yield * _ (
6051 runCommandWithExitCodes (
61- { cwd : workspaceRoot , command : "node" , args : [ dockerGitCli , "clone" , ...args ] } ,
52+ { cwd : workspaceRoot , command : "node" , args : [ dockerGitCli , commandName , ...args ] } ,
6253 [ successExitCode ] ,
63- ( exitCode ) => new CommandFailedError ( { command : cloneLabel , exitCode } )
54+ ( exitCode ) => new CommandFailedError ( { command : runLabel , exitCode } )
6455 )
6556 )
6657 } )
58+
59+ // CHANGE: run docker-git clone by building and invoking its CLI
60+ // WHY: reuse docker-git without mutating its codebase
61+ // QUOTE(ТЗ): "docker git мы никак не изменяем"
62+ // REF: user-request-2026-01-27
63+ // SOURCE: n/a
64+ // FORMAT THEOREM: forall args: build && run(args) -> docker_git_invoked(args)
65+ // PURITY: SHELL
66+ // EFFECT: Effect<void, CommandFailedError | PlatformError, CommandExecutor | Path>
67+ // INVARIANT: build runs before clone command
68+ // COMPLEXITY: O(build + clone)
69+ export const runDockerGitClone = (
70+ args : ReadonlyArray < string >
71+ ) : Effect . Effect <
72+ void ,
73+ CommandFailedError | PlatformError ,
74+ CommandExecutor . CommandExecutor | Path . Path
75+ > => runDockerGitCommand ( "clone" , args )
76+
77+ // CHANGE: run docker-git open by building and invoking its CLI
78+ // WHY: mirror clone shortcut behavior for opening an existing repo workspace
79+ // QUOTE(ТЗ): "Добавить команду open. ... Просто открывает существующий по ссылке"
80+ // REF: user-request-2026-02-20-open-command
81+ // SOURCE: n/a
82+ // FORMAT THEOREM: forall args: build && run(args) -> docker_git_open_invoked(args)
83+ // PURITY: SHELL
84+ // EFFECT: Effect<void, CommandFailedError | PlatformError, CommandExecutor | Path>
85+ // INVARIANT: build runs before open command
86+ // COMPLEXITY: O(build + open)
87+ export const runDockerGitOpen = (
88+ args : ReadonlyArray < string >
89+ ) : Effect . Effect <
90+ void ,
91+ CommandFailedError | PlatformError ,
92+ CommandExecutor . CommandExecutor | Path . Path
93+ > => runDockerGitCommand ( "open" , args )
0 commit comments