Skip to content

Commit 8ee39e7

Browse files
committed
Merge remote-tracking branch 'origin/main' into renovate-all-work
2 parents b031159 + 1079695 commit 8ee39e7

30 files changed

+676
-340
lines changed

Dockerfile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ FROM ubuntu:24.04
33
ENV DEBIAN_FRONTEND=noninteractive
44

55
RUN apt-get update && apt-get install -y --no-install-recommends \
6-
openssh-server git ca-certificates nodejs npm \
6+
openssh-server git ca-certificates nodejs npm sshpass \
77
&& rm -rf /var/lib/apt/lists/*
88

99
# Tooling: pnpm + Codex CLI

README.md

Lines changed: 30 additions & 228 deletions
Original file line numberDiff line numberDiff line change
@@ -1,248 +1,50 @@
11
# docker-git
22

3-
`docker-git` generates a disposable Docker development environment per repository (or empty workspace) and stores it under a single projects root (default: `~/.docker-git`).
3+
`docker-git` создаёт отдельную Docker-среду для каждого репозитория, issue или PR.
4+
По умолчанию проекты лежат в `~/.docker-git`.
45

5-
Key goals:
6-
- Functional Core, Imperative Shell implementation (pure templates + typed orchestration).
7-
- Per-project `.orch/` directory (env + local state), while still allowing shared credentials across containers.
8-
- Shared package caches (`pnpm`/`npm`/`yarn`) across all project containers.
9-
- Optional Playwright MCP + Chromium sidecar so Codex and Claude Code can do browser automation.
6+
## Что нужно
107

11-
## Quickstart
8+
- Docker Engine или Docker Desktop
9+
- Доступ к Docker без `sudo`
10+
- Node.js и `npm`
1211

13-
From this repo:
12+
## Установка
1413

1514
```bash
16-
pnpm install
17-
18-
# Interactive TUI menu (default)
19-
pnpm run docker-git
20-
21-
# Create an empty workspace container (no git clone)
22-
pnpm run docker-git create
15+
npm i -g @prover-coder-ai/docker-git
16+
docker-git --help
17+
```
2318

24-
# Clone a repo into its own container (creates under ~/.docker-git)
25-
pnpm run docker-git clone https://github.com/agiens/crm/tree/vova-fork --force
19+
## Авторизация
2620

27-
# Clone an issue URL (creates isolated workspace + issue branch)
28-
pnpm run docker-git clone https://github.com/agiens/crm/issues/123 --force
21+
```bash
22+
docker-git auth github login --web
23+
docker-git auth codex login --web
24+
docker-git auth claude login --web
25+
```
2926

30-
# Open an existing docker-git project by repo/issue URL (runs up + tmux attach)
31-
pnpm run docker-git open https://github.com/agiens/crm/issues/123
27+
## Пример
3228

33-
# Reset only project env defaults (keep workspace volume/data)
34-
pnpm run docker-git clone https://github.com/agiens/crm/issues/123 --force-env
29+
Можно передавать ссылку на репозиторий, ветку (`/tree/...`), issue или PR.
3530

36-
# Same, but also enable Playwright MCP + Chromium sidecar for Codex/Claude
37-
pnpm run docker-git clone https://github.com/agiens/crm/tree/vova-fork --force --mcp-playwright
31+
```bash
32+
docker-git clone https://github.com/ProverCoderAI/docker-git/issues/122 --force --mcp-playwright
3833
```
3934

40-
## API Docker (separate runtime)
35+
- `--force` пересоздаёт окружение и удаляет volumes проекта.
36+
- `--mcp-playwright` включает Playwright MCP и Chromium sidecar для браузерной автоматизации.
4137

42-
HTTP API (`packages/api`) has a dedicated Docker image and compose file:
38+
Автоматический запуск агента:
4339

4440
```bash
45-
docker compose -f docker-compose.api.yml up -d --build
46-
curl -s http://127.0.0.1:3334/health
41+
docker-git clone https://github.com/ProverCoderAI/docker-git/issues/122 --force --auto
4742
```
4843

49-
By default API port `3334` is published to host (`127.0.0.1:3334`).
50-
51-
Useful env overrides:
52-
- `DOCKER_GIT_API_BIND_HOST` (default: `127.0.0.1`)
53-
- `DOCKER_GIT_API_PORT` (default: `3334`)
54-
- `DOCKER_GIT_PROJECTS_ROOT_HOST` (host path, default: `/home/dev/.docker-git`)
55-
- `DOCKER_GIT_PROJECTS_ROOT` (container path, default: `/home/dev/.docker-git`)
56-
57-
Detailed federation subscription workflow and JSON examples are documented in `packages/api/README.md`.
58-
59-
## Parallel Issues / PRs
60-
61-
When you clone GitHub issue or PR URLs, docker-git creates isolated project paths and container names:
62-
- `.../issues/123` -> `<projectsRoot>/<owner>/<repo>/issue-123` (branch `issue-123`)
63-
- `.../pull/45` -> `<projectsRoot>/<owner>/<repo>/pr-45` (ref `refs/pull/45/head`)
64-
65-
This lets you run multiple issues/PRs for the same repository in parallel without container/path collisions.
66-
67-
Force modes:
68-
- `--force`: overwrite managed files and wipe compose volumes (`docker compose down -v`).
69-
- `--force-env`: reset only project env defaults and recreate containers without wiping volumes.
70-
71-
Agent context for issue workspaces:
72-
- Global `${CODEX_HOME}/AGENTS.md` includes workspace path + issue/PR context.
73-
74-
## Projects Root Layout
75-
76-
The projects root is:
77-
- `~/.docker-git` by default
78-
- Override with `DOCKER_GIT_PROJECTS_ROOT=/some/path`
79-
80-
Structure (simplified):
81-
82-
```text
83-
~/.docker-git/
84-
authorized_keys
85-
.orch/
86-
env/
87-
global.env # shared tokens/keys (GitHub, Git, Claude) with labels
88-
auth/
89-
codex/ # shared Codex auth/config (when CODEX_SHARE_AUTH=1)
90-
gh/ # GH CLI auth cache for OAuth login container
91-
.cache/
92-
git-mirrors/ # shared git clone mirrors
93-
packages/ # shared pnpm/npm/yarn caches
94-
<owner>/<repo>/
95-
docker-compose.yml
96-
Dockerfile
97-
entrypoint.sh
98-
docker-git.json
99-
.orch/
100-
env/
101-
project.env # per-project env knobs (see below)
102-
auth/
103-
codex/ # project-local Codex state (sessions/logs/tmp/etc)
104-
```
44+
- `--auto` сам выбирает Claude или Codex по доступной авторизации. Если доступны оба, выбор случайный.
45+
- `--auto=claude` или `--auto=codex` принудительно выбирает агента.
46+
- В auto-режиме агент сам выполняет задачу, создаёт PR и после завершения контейнер очищается.
47+
48+
## Подробности
10549

106-
## Codex Auth: Shared Credentials, Per-Project Sessions
107-
108-
Default behavior:
109-
- Shared credentials live in `/home/dev/.codex-shared/auth.json` (mounted from `<projectsRoot>/.orch/auth/codex`).
110-
- Each project keeps its own Codex state under `/home/dev/.codex/` (mounted from project `.orch/auth/codex`).
111-
- The entrypoint links `/home/dev/.codex/auth.json -> /home/dev/.codex-shared/auth.json`.
112-
113-
This avoids `refresh_token` rotation issues that can happen when copying `auth.json` into every project while still keeping session state isolated per project.
114-
115-
Disable sharing (per-project auth):
116-
- Set `CODEX_SHARE_AUTH=0` in `.orch/env/project.env`.
117-
118-
## Claude Code Defaults
119-
120-
On container start, docker-git syncs Claude Code user settings under `$CLAUDE_CONFIG_DIR/settings.json`:
121-
- `permissions.defaultMode = "bypassPermissions"` so local disposable containers behave like docker-git Codex containers (no permission prompts).
122-
- Existing unrelated Claude settings are preserved.
123-
124-
## Playwright MCP (Chromium Sidecar)
125-
126-
Enable during create/clone:
127-
- Add `--mcp-playwright`
128-
129-
Enable for an existing project directory (preserves `.orch/env/project.env` and volumes):
130-
- `docker-git mcp-playwright [<url>] [--project-dir <path>]`
131-
132-
This will:
133-
- Create a Chromium sidecar container: `dg-<repo>-browser`
134-
- Configure Codex MCP server `playwright` inside the dev container
135-
- Configure Claude Code MCP server `playwright` inside `$CLAUDE_CONFIG_DIR/.claude.json`
136-
- Provide a wrapper `docker-git-playwright-mcp` inside the dev container
137-
138-
Template attribute behavior:
139-
- `--mcp-playwright` sets `enableMcpPlaywright=true` in `docker-git.json`.
140-
- On container start, docker-git syncs Playwright MCP config for both Codex and Claude based on this attribute/env.
141-
142-
Concurrency (many Codex sessions):
143-
- Default is safe for many sessions: `MCP_PLAYWRIGHT_ISOLATED=1`
144-
- Each Codex session gets its own browser context (incognito) to reduce cross-session interference.
145-
- If you want a shared browser context (shared cookies/login), set `MCP_PLAYWRIGHT_ISOLATED=0` (not recommended with multiple concurrent sessions).
146-
147-
## Runtime Env Knobs (per project)
148-
149-
Edit: `<projectDir>/.orch/env/project.env`
150-
151-
Common toggles:
152-
- `CODEX_SHARE_AUTH=1|0` (default: `1`)
153-
- `CODEX_AUTO_UPDATE=1|0` (default: `1`)
154-
- `CLAUDE_AUTO_SYSTEM_PROMPT=1|0` (default: `1`, auto-attach managed system prompt to `claude`)
155-
- `DOCKER_GIT_ZSH_AUTOSUGGEST=1|0` (default: `1`)
156-
- `MCP_PLAYWRIGHT_ISOLATED=1|0` (default: `1`)
157-
- `MCP_PLAYWRIGHT_CDP_ENDPOINT=http://...` (override CDP endpoint if needed)
158-
- `PNPM_STORE_DIR=/home/dev/.docker-git/.cache/packages/pnpm/store` (default shared store)
159-
- `NPM_CONFIG_CACHE=/home/dev/.docker-git/.cache/packages/npm` (default shared cache)
160-
- `YARN_CACHE_FOLDER=/home/dev/.docker-git/.cache/packages/yarn` (default shared cache)
161-
162-
## Compose Network Mode
163-
164-
Default mode is shared:
165-
- `--network-mode shared` (default)
166-
- Shared compose network name: `--shared-network docker-git-shared`
167-
168-
Shared mode keeps one external Docker network for all docker-git projects, which reduces address pool pressure when many projects are created.
169-
170-
If you need strict per-project isolation:
171-
- `--network-mode project`
172-
173-
In project mode, each project uses `<service>-net` (Docker-managed bridge network).
174-
175-
## Troubleshooting
176-
177-
MCP errors in `codex` UI:
178-
- `No such file or directory (os error 2)` for `playwright`:
179-
- `~/.codex/config.toml` contains `[mcp_servers.playwright]`, but the container was created without `--mcp-playwright`.
180-
- Fix (recommended): run `docker-git mcp-playwright [<url>]` to enable it for the existing project.
181-
- Fix (recreate): recreate with `--force-env --mcp-playwright` (keeps volumes) or `--force --mcp-playwright` (wipes volumes).
182-
- `handshaking ... initialize response`:
183-
- The configured MCP command is not a real MCP server (example: `command="echo"`).
184-
185-
MCP errors in `claude` UI:
186-
- `MCP server "playwright" not found`:
187-
- The container/project was created without `--mcp-playwright` (or `enableMcpPlaywright=false` in `docker-git.json`).
188-
- Fix: run `docker-git mcp-playwright [<url>]` or recreate/apply with `--mcp-playwright`.
189-
190-
Docker permission error (`/var/run/docker.sock`):
191-
- Symptom:
192-
- `permission denied while trying to connect to the docker API at unix:///var/run/docker.sock`
193-
- Check:
194-
```bash
195-
id
196-
ls -l /var/run/docker.sock
197-
docker version
198-
```
199-
- Fix (works in `fish` and `bash`):
200-
```bash
201-
sudo chgrp docker /var/run/docker.sock
202-
sudo chmod 660 /var/run/docker.sock
203-
sudo mkdir -p /etc/systemd/system/docker.socket.d
204-
printf '[Socket]\nSocketGroup=docker\nSocketMode=0660\n' | sudo tee /etc/systemd/system/docker.socket.d/override.conf >/dev/null
205-
sudo systemctl daemon-reload
206-
sudo systemctl restart docker.socket docker
207-
```
208-
- Verify:
209-
```bash
210-
ls -l /var/run/docker.sock
211-
docker version
212-
```
213-
- Note:
214-
- Do not run `pnpm run docker-git ...` with `sudo`.
215-
216-
Docker network pool exhausted (`all predefined address pools have been fully subnetted`):
217-
- Symptom:
218-
- `failed to create network ... all predefined address pools have been fully subnetted`
219-
- Quick recovery:
220-
```bash
221-
docker network prune -f
222-
```
223-
- Long-term fix:
224-
- Configure Docker daemon `default-address-pools` in `/etc/docker/daemon.json`.
225-
- Prefer `docker-git` shared network mode (`--network-mode shared`).
226-
227-
Clone auth error (`Invalid username or token`):
228-
- Symptom:
229-
- `remote: Invalid username or token. Password authentication is not supported for Git operations.`
230-
- Check and fix token:
231-
```bash
232-
pnpm run docker-git auth github status
233-
pnpm run docker-git auth github logout
234-
pnpm run docker-git auth github login --web
235-
pnpm run docker-git auth github status
236-
```
237-
- Token requirements:
238-
- Token must have access to the target repository.
239-
- For org repositories with SSO/SAML, authorize the token for that organization.
240-
- Recommended scopes: `repo,workflow,read:org`.
241-
242-
## Security Notes
243-
244-
The generated Codex config uses:
245-
- `sandbox_mode = "danger-full-access"`
246-
- `approval_policy = "never"`
247-
248-
This is intended for local disposable containers. Do not reuse these defaults for untrusted code.
50+
`docker-git --help`

packages/api/Dockerfile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ ENV DEBIAN_FRONTEND=noninteractive
44
WORKDIR /workspace
55

66
RUN apt-get update && apt-get install -y --no-install-recommends \
7-
ca-certificates curl git docker.io docker-compose-v2 \
7+
ca-certificates curl git docker.io docker-compose-v2 sshpass \
88
&& rm -rf /var/lib/apt/lists/*
99

1010
RUN curl -fsSL https://deb.nodesource.com/setup_24.x | bash - \

packages/api/src/api/contracts.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -49,6 +49,7 @@ export type CreateProjectRequest = {
4949
readonly gitTokenLabel?: string | undefined
5050
readonly codexTokenLabel?: string | undefined
5151
readonly claudeTokenLabel?: string | undefined
52+
readonly agentAutoMode?: string | undefined
5253
readonly up?: boolean | undefined
5354
readonly openSsh?: boolean | undefined
5455
readonly force?: boolean | undefined

packages/api/src/api/schema.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,7 @@ export const CreateProjectRequestSchema = Schema.Struct({
2525
gitTokenLabel: OptionalString,
2626
codexTokenLabel: OptionalString,
2727
claudeTokenLabel: OptionalString,
28+
agentAutoMode: OptionalString,
2829
up: OptionalBoolean,
2930
openSsh: OptionalBoolean,
3031
force: OptionalBoolean,

packages/api/src/services/projects.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -199,6 +199,7 @@ export const createProjectFromRequest = (
199199
...(request.gitTokenLabel === undefined ? {} : { gitTokenLabel: request.gitTokenLabel }),
200200
...(request.codexTokenLabel === undefined ? {} : { codexTokenLabel: request.codexTokenLabel }),
201201
...(request.claudeTokenLabel === undefined ? {} : { claudeTokenLabel: request.claudeTokenLabel }),
202+
...(request.agentAutoMode === undefined ? {} : { agentAutoMode: request.agentAutoMode }),
202203
...(request.up === undefined ? {} : { up: request.up }),
203204
...(request.openSsh === undefined ? {} : { openSsh: request.openSsh }),
204205
...(request.force === undefined ? {} : { force: request.force }),

packages/app/CHANGELOG.md

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,23 @@
11
# @prover-coder-ai/docker-git
22

3+
## 1.0.39
4+
5+
### Patch Changes
6+
7+
- chore: automated version bump
8+
9+
## 1.0.38
10+
11+
### Patch Changes
12+
13+
- chore: automated version bump
14+
15+
## 1.0.37
16+
17+
### Patch Changes
18+
19+
- chore: automated version bump
20+
321
## 1.0.36
422

523
### Patch Changes

packages/app/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "@prover-coder-ai/docker-git",
3-
"version": "1.0.36",
3+
"version": "1.0.39",
44
"description": "Minimal Vite-powered TypeScript console starter using Effect",
55
"main": "dist/src/docker-git/main.js",
66
"bin": {

0 commit comments

Comments
 (0)