treebox 0.4.0__tar.gz → 0.6.0__tar.gz

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.
Files changed (70) hide show
  1. {treebox-0.4.0 → treebox-0.6.0/.agents}/skills/treebox/SKILL.md +31 -29
  2. treebox-0.6.0/CHANGELOG.md +10 -0
  3. {treebox-0.4.0 → treebox-0.6.0}/CLAUDE.md +20 -15
  4. {treebox-0.4.0 → treebox-0.6.0}/CONTRIBUTING.md +6 -3
  5. treebox-0.6.0/LICENSE +202 -0
  6. {treebox-0.4.0 → treebox-0.6.0}/PKG-INFO +71 -63
  7. {treebox-0.4.0 → treebox-0.6.0}/README.md +69 -61
  8. treebox-0.6.0/ROADMAP.md +18 -0
  9. treebox-0.6.0/assets/treebox-demo.gif +0 -0
  10. treebox-0.6.0/assets/treebox-logo.png +0 -0
  11. {treebox-0.4.0 → treebox-0.6.0}/docs/agents.md +4 -3
  12. treebox-0.6.0/docs/configuration.md +160 -0
  13. {treebox-0.4.0 → treebox-0.6.0}/docs/how-it-works.md +14 -5
  14. {treebox-0.4.0 → treebox-0.6.0}/docs/index.md +8 -8
  15. {treebox-0.4.0 → treebox-0.6.0}/docs/install.md +5 -5
  16. {treebox-0.4.0 → treebox-0.6.0}/docs/usage.md +96 -18
  17. {treebox-0.4.0 → treebox-0.6.0}/install.sh +4 -12
  18. {treebox-0.4.0 → treebox-0.6.0}/mkdocs.yml +1 -1
  19. {treebox-0.4.0 → treebox-0.6.0}/pyproject.toml +2 -2
  20. {treebox-0.4.0 → treebox-0.6.0}/src/treebox/assets.py +4 -3
  21. {treebox-0.4.0 → treebox-0.6.0}/src/treebox/cli.py +216 -145
  22. {treebox-0.4.0 → treebox-0.6.0}/src/treebox/config.py +74 -23
  23. {treebox-0.4.0 → treebox-0.6.0}/src/treebox/forge.py +8 -2
  24. {treebox-0.4.0 → treebox-0.6.0}/src/treebox/git.py +58 -25
  25. {treebox-0.4.0 → treebox-0.6.0}/src/treebox/locking.py +2 -1
  26. {treebox-0.4.0 → treebox-0.6.0}/src/treebox/models.py +26 -0
  27. {treebox-0.4.0 → treebox-0.6.0}/src/treebox/output.py +32 -18
  28. {treebox-0.4.0 → treebox-0.6.0}/src/treebox/provision.py +18 -7
  29. {treebox-0.4.0 → treebox-0.6.0}/src/treebox/runners/base.py +4 -2
  30. {treebox-0.4.0 → treebox-0.6.0}/src/treebox/runners/docker.py +55 -23
  31. {treebox-0.4.0 → treebox-0.6.0}/src/treebox/state.py +12 -9
  32. {treebox-0.4.0 → treebox-0.6.0}/src/treebox/system.py +2 -1
  33. treebox-0.6.0/tests/test_contract.py +366 -0
  34. {treebox-0.4.0 → treebox-0.6.0}/tests/test_integration.py +397 -28
  35. {treebox-0.4.0 → treebox-0.6.0}/tests/test_units.py +817 -35
  36. treebox-0.4.0/.agents/skills/no-mistakes/SKILL.md +0 -247
  37. treebox-0.4.0/LICENSE +0 -73
  38. treebox-0.4.0/ROADMAP.md +0 -5
  39. treebox-0.4.0/docs/assets/treebox-logo.png +0 -0
  40. treebox-0.4.0/docs/configuration.md +0 -130
  41. {treebox-0.4.0 → treebox-0.6.0}/.github/workflows/autofix.yml +0 -0
  42. {treebox-0.4.0 → treebox-0.6.0}/.github/workflows/ci.yml +0 -0
  43. {treebox-0.4.0 → treebox-0.6.0}/.github/workflows/claude.yml +0 -0
  44. {treebox-0.4.0 → treebox-0.6.0}/.github/workflows/docs.yml +0 -0
  45. {treebox-0.4.0 → treebox-0.6.0}/.github/workflows/release.yml +0 -0
  46. {treebox-0.4.0 → treebox-0.6.0}/.gitignore +0 -0
  47. {treebox-0.4.0 → treebox-0.6.0}/.pre-commit-config.yaml +0 -0
  48. {treebox-0.4.0 → treebox-0.6.0}/AGENTS.md +0 -0
  49. {treebox-0.4.0 → treebox-0.6.0/docs}/assets/treebox-logo.png +0 -0
  50. {treebox-0.4.0 → treebox-0.6.0}/docs/javascripts/treebox.js +0 -0
  51. {treebox-0.4.0 → treebox-0.6.0}/docs/stylesheets/extra.css +0 -0
  52. {treebox-0.4.0 → treebox-0.6.0}/hooks/copy_page.py +0 -0
  53. {treebox-0.4.0 → treebox-0.6.0}/scripts/validate.sh +0 -0
  54. {treebox-0.4.0 → treebox-0.6.0}/src/treebox/__init__.py +0 -0
  55. {treebox-0.4.0 → treebox-0.6.0}/src/treebox/assets/container/Dockerfile +0 -0
  56. {treebox-0.4.0 → treebox-0.6.0}/src/treebox/assets/container/allowed-domains.sh +0 -0
  57. {treebox-0.4.0 → treebox-0.6.0}/src/treebox/assets/container/container.json +0 -0
  58. {treebox-0.4.0 → treebox-0.6.0}/src/treebox/assets/container/firewall.json +0 -0
  59. {treebox-0.4.0 → treebox-0.6.0}/src/treebox/assets/container/init-firewall.sh +0 -0
  60. {treebox-0.4.0 → treebox-0.6.0}/src/treebox/assets/container/post-create.sh +0 -0
  61. {treebox-0.4.0 → treebox-0.6.0}/src/treebox/assets/pre-push +0 -0
  62. {treebox-0.4.0 → treebox-0.6.0}/src/treebox/ecosystems.py +0 -0
  63. {treebox-0.4.0 → treebox-0.6.0}/src/treebox/names.py +0 -0
  64. {treebox-0.4.0 → treebox-0.6.0}/src/treebox/py.typed +0 -0
  65. {treebox-0.4.0 → treebox-0.6.0}/src/treebox/resolve.py +0 -0
  66. {treebox-0.4.0 → treebox-0.6.0}/src/treebox/runners/__init__.py +0 -0
  67. {treebox-0.4.0 → treebox-0.6.0}/src/treebox/runners/host.py +0 -0
  68. {treebox-0.4.0 → treebox-0.6.0}/src/treebox/status.py +0 -0
  69. {treebox-0.4.0 → treebox-0.6.0}/tests/conftest.py +0 -0
  70. {treebox-0.4.0 → treebox-0.6.0}/uv.lock +0 -0
@@ -18,41 +18,42 @@ Provisioning (fetch → resolve branch → worktree add → copy submodules →
18
18
  ## Workflow
19
19
 
20
20
  1. Run `treebox doctor` (add `--isolation docker` to check the Docker daemon when docker isolation will be used).
21
- 2. If creating and no branch is supplied, ask for a short valid Git branch name. Slashes are allowed, e.g. `feature/auth`.
22
- 3. Create with `treebox create <branch> --base <trunk>`.
21
+ 2. If creating named work, ask for a short valid worktree name: one lowercase slug (`[a-z0-9-]+`). Omit it only when the user wants treebox to generate a petname.
22
+ 3. Create with `treebox create <name> --base <trunk>`, or use `treebox create [name] --checkout <existing-branch>` to resume/review an existing branch.
23
23
  4. If any command exits non-zero, stop and show the full error (and its `hint`). Do not retry automatically — branch on the exit code (below).
24
24
  5. Report that the CLI launched the agent, or show the error that prevented launch.
25
25
 
26
26
  ## Command reference
27
27
 
28
- - `create BRANCH` — provision and launch. Flags: `--base <branch>` `--checkout <existing-branch>` `--isolation host|docker` `--harness claude|codex` `--template <name>` `--cold` `--no-fetch` `--firewall/--no-firewall` `--dry-run` `--print` `--json` `--repo <path>` `--root <dir>` `--quiet` `--verbose`.
29
- - `enter BRANCH [-- AGENT_ARGS…]` — re-launch in an existing worktree; refreshes `.env`, re-syncs deps only if the lockfile changed. Flags: `--isolation` `--harness` `--template <name>` `--cold` `--print` `--json` `--repo` `--root` `--quiet` `--verbose`.
28
+ - `create [NAME]` — provision and launch. Flags: `--base <branch>` `--checkout <existing-branch>` `--isolation host|docker` `--harness claude|codex` `--template <name>` `--cold` `--no-fetch` `--firewall/--no-firewall` `--dry-run` `--print` `--json` `--repo <path>` `--root <dir>` `--quiet` `--verbose`.
29
+ - `enter REF [-- AGENT_ARGS…]` — re-launch in an existing worktree; refreshes `.env`, re-syncs deps only if the lockfile changed. Flags: `--isolation` `--harness` `--template <name>` `--cold` `--print` `--json` `--repo` `--root` `--quiet` `--verbose`.
30
30
  - `list` (alias `ls`) — table of worktrees (branch · isolation · deps freshness · `.env` presence · directory). Flags: `--repo` `--root` `--json`.
31
- - `teardown BRANCH` (alias `rm`) — remove the worktree; caches are left intact. Flags: `--force` `--delete-branch` `--remove-volumes` `--skip-container` `--json` `--isolation` `--repo` `--root` `--quiet` `--verbose`.
31
+ - `teardown [REF...]` (alias `rm`) — remove selected worktrees; caches are left intact. Flags: `--force` `--delete-branch` `--remove-volumes` `--skip-container` `--json` `--isolation` `--repo` `--root` `--quiet` `--verbose`.
32
32
  - `doctor` — check git, login credentials, UID/GID, and isolation deps. Flags: `--isolation` `--repo` `--json`.
33
- - `version` / `--version` — print the version.
33
+ - `version` / `--version` / `-V` — print the version.
34
34
 
35
35
  ## Examples
36
36
 
37
37
  ```bash
38
- treebox create feature/auth --base dev # new branch from origin/dev, host isolation
39
- treebox create bugfix/docs --base dev --isolation docker
40
- treebox create hotfix/login --base main --cold # ignore shared cache, from-source build
41
- treebox create feature/auth --harness codex # Codex instead of Claude
42
- treebox create feature/auth --repo /path/to/repo
43
- treebox enter feature/auth # re-launch; refresh .env, re-sync deps if changed
44
- treebox enter feature/auth -- "continue the refactor" # args after -- go to the agent verbatim
38
+ treebox create fix-auth --base dev # new placeholder from origin/dev, host isolation
39
+ treebox create docs-fix --base dev --isolation docker
40
+ treebox create hotfix-login --base main --cold # ignore shared cache, from-source build
41
+ treebox create fix-auth --harness codex # Codex instead of Claude
42
+ treebox create review-auth --checkout feature/auth # exact existing branch
43
+ treebox create fix-auth --repo /path/to/repo
44
+ treebox enter fix-auth # re-launch; refresh .env, re-sync deps if changed
45
+ treebox enter fix-auth -- "continue the refactor" # args after -- go to the agent verbatim
45
46
  treebox list
46
- treebox teardown feature/auth --force
47
- treebox teardown feature/auth --force --delete-branch
47
+ treebox teardown fix-auth --force
48
+ treebox teardown fix-auth --force --delete-branch
48
49
  ```
49
50
 
50
51
  Provision without launching the agent (for scripting / over SSH / when you only need the worktree prepared):
51
52
 
52
53
  ```bash
53
- treebox create feature/auth --dry-run # print the git/setup commands it would run; change nothing
54
- treebox create feature/auth --print # prints the launch command (self-contained: carries the worktree dir, runnable from anywhere), no launch
55
- treebox create feature/auth --json # JSON {schemaVersion, worktree_path, branch, base, entry_command, created}
54
+ treebox create fix-auth --dry-run # print the git/setup commands it would run; change nothing
55
+ treebox create fix-auth --print # prints the launch command (self-contained: carries the worktree dir, runnable from anywhere), no launch
56
+ treebox create fix-auth --json # JSON {schemaVersion, name, worktree_path, branch, base, entry_command, created}
56
57
  treebox list --json # JSON {schemaVersion, worktrees:[…]}
57
58
  treebox doctor --json # JSON health report; exits non-zero if a hard check fails
58
59
  ```
@@ -64,31 +65,32 @@ Branch on the **exit code**, not the text:
64
65
  | code | meaning |
65
66
  |------|---------|
66
67
  | `0` | success |
67
- | `2` | usage bad branch name or option |
68
+ | `1` | runtime failure, missing runner dependency, or failed doctor hard check |
69
+ | `2` | usage — bad name/branch/config/ref or option |
68
70
  | `3` | not-found — the worktree the command needs doesn't exist |
69
71
  | `4` | auth/permission — `origin` fetch failed |
70
- | `5` | conflict — already exists / branch lock held / uncommitted changes |
72
+ | `5` | conflict — already exists / worktree lock held / uncommitted changes |
71
73
 
72
- With `--json`, a failure prints **one object on stderr**: `{"schemaVersion":3,"error":{"code":"NOT_FOUND","message":"…","hint":"…"}}`. Read `error.code`, surface `error.hint`. Every JSON payload carries `schemaVersion` and only gains fields within a version (don't assume a fixed key set).
74
+ With `--json`, a failure prints **one object on stderr**: `{"schemaVersion":3,"error":{"code":"NOT_FOUND","message":"…","hint":"…"}}`; `path` may also appear for path-specific failures such as `DIRTY_WORKTREE`. Read `error.code`, surface `error.hint`. Every JSON payload carries `schemaVersion` and only gains fields within a version (don't reject extra keys).
73
75
 
74
76
  ## Usage tips
75
77
 
76
78
  - **Default base is `main`** (configurable). A new branch created without `--base` is cut from `origin/main`; pass `--base <trunk>` when the repo's trunk is `master`, `dev`, etc.
77
79
  - Ask before using `--delete-branch` or `--remove-volumes`. Defaults keep both.
78
- - Branch names may include slashes. The CLI keeps the Git branch name but flattens slashes to `--` for the directory: `feature/auth` `<root>/feature--auth` (default `<root>` = `.treebox/worktrees` under the repo; override with `--root`).
79
- - `create` launches the agent (Claude by default) after provisioning. Use `--harness codex`, or `--print` / `--json` / `--dry-run` to avoid launching.
80
- - `create` is **idempotent**: re-running it on a fully-provisioned worktree reports it and exits `0` (`created: false` in `--json`), not an error. Use `enter` to re-launch an existing one. If the dir exists but setup never finished (a prior run died mid-provision), `create` resumes setup instead of launching into a half-built tree.
80
+ - `create NAME` accepts one lowercase slug; branch names with slashes belong in `--checkout` or as refs to `enter`/`teardown`. `create --checkout feature/auth` keeps the Git branch name but derives the directory name as `feature--auth` unless you pass `NAME` explicitly (default `<root>` = `.treebox/worktrees` under the repo; override with `--root`).
81
+ - `create` launches the agent (Claude by default) after provisioning and exits with the agent process's exit code. Use `--harness codex`, or `--print` / `--json` / `--dry-run` to avoid launching.
82
+ - Re-running `create` on a fully provisioned same-name worktree is a `SLUG_CONFLICT` (exit `5`), not an idempotent enter. Use `enter` to re-launch. If the dir exists but setup never finished (a prior run died mid-provision), `create` resumes setup instead of launching into a half-built tree.
81
83
  - **Freshness is enforced.** `create` *requires* a successful `git fetch origin` and branches from the freshly-fetched `origin/<base>` (preferred over a stale local branch). If the fetch fails it exits `4` and does **not** fall back to stale refs. In a terminal, git/ssh will prompt for credentials (no pre-loaded ssh-agent needed); headless/`--json` runs need working non-interactive auth. Pass `--no-fetch` only when the user explicitly accepts possibly-stale local refs (e.g. offline). A repo with no `origin` skips the fetch. Run `doctor` to check origin reachability up front.
82
84
  - `enter` recomputes the dependency-manifest hash and re-syncs only when deps changed; it always refreshes `.env`. Pass extra agent args after `--`. `--cold` bypasses the shared cache.
83
85
  - `--cold` is the escape hatch for a corrupted cache: from-source dependency resolution.
84
- - `teardown` confirms interactively. Without a TTY (scripts/agents) or with `--json` it refuses unless `--force` (exit `5`); `--force` is also required to remove a worktree with uncommitted changes. `--json` prints a record of what was removed to stdout. `--skip-container` leaves containers/images alone. With host isolation there are no containers/volumes to remove.
85
- - Only one `create`/`enter` may provision a given branch at a time (a per-branch lock, exit `5` if held). Wait rather than retrying immediately.
86
- - Output: a compact spinner + green checkmarks with right-aligned timings on stderr, degrading gracefully off-TTY and under `NO_COLOR` (no color/animation). `--verbose` streams raw command output; `--quiet` suppresses progress. `--json`/`--print`/`--dry-run` write machine output to stdout.
86
+ - `teardown` confirms interactively. Without a TTY (scripts/agents) or with `--json` it refuses unless `--force` (exit `5`); `--force` is also required to remove a worktree with uncommitted changes. `--json` prints a record of what was removed to stdout. `--skip-container` leaves containers/images alone; cleanup failures are best-effort (`container: "failed"`) and do not undo worktree removal. With host isolation there are no containers/volumes to remove.
87
+ - Only one `create`/`enter`/`teardown` may operate on a given worktree name at a time (a per-name lock, exit `5` if held). Wait rather than retrying immediately.
88
+ - Output: a compact spinner + green checkmarks with right-aligned timings on stderr, degrading gracefully off-TTY and under `NO_COLOR` (no color/animation). `--verbose` streams raw command output; `--quiet` suppresses progress. `--json` success payloads and `--print` commands write to stdout; human `--dry-run` writes its plan to stderr, while `--dry-run --json` writes JSON to stdout.
87
89
  - The container firewall is off by default; pass `--firewall` to merge in the generated outbound allowlist. `--firewall`/`--no-firewall` is a tri-state override — an explicit flag wins in either direction and absence falls through to the `firewall` config default (so `--no-firewall` opts a single run out of a `firewall = true` config). The created-time choice is recorded, so `enter` reuses it rather than re-resolving the config.
88
90
 
89
91
  ## Notes
90
92
 
91
93
  - Authentication is **subscription-login only**: a one-time `claude` / `codex` login on the host (`~/.claude`, `~/.codex`) is reused everywhere. `doctor` verifies those dirs. `ANTHROPIC_API_KEY` is never used.
92
- - Defaults (`isolation`, `harness`, `base`, `root`, `env_file`, `firewall`, caches, custom setup hook) are configurable via a user-level TOML at `$TREEBOX_CONFIG`, else `~/.config/treebox/config.toml`. There is no repo-level config (a repo you don't trust must not run host commands).
93
- - The sandbox container is always defined by the operator template, never by anything in the target repo. Templates are named (`--template <name>`, default `default`): resolved from `$TREEBOX_TEMPLATE_DIR`, then `~/.config/treebox/templates/<name>/`, then the bundled default (only for `default`). An unknown name is a loud error, not a fallback. The rendered config + build context live *outside* the mounted worktree (`<root>/.containers/<branch>/`) and are never mounted in, so the boxed agent can't read or edit its own cage.
94
+ - Defaults (`isolation`, `harness`, `base`, `root`, `env_file`, `firewall`, caches, custom setup hook) are configurable via a user-level TOML at `$TREEBOX_CONFIG`, else `$TREEBOX_HOME/config.toml` (default `~/.treebox/config.toml`). There is no repo-level config (a repo you don't trust must not run host commands).
95
+ - The sandbox container is always defined by the operator template, never by anything in the target repo. Templates are named (`--template <name>`, default `default`): resolved from `$TREEBOX_TEMPLATE_DIR`, then `$TREEBOX_HOME/templates/<name>/` (default `~/.treebox/templates/<name>/`), then the bundled default (only for `default`). An unknown name is a loud error, not a fallback. The rendered config + build context live *outside* the mounted worktree (`<root>/.containers/<branch>/`) and are never mounted in, so the boxed agent can't read or edit its own cage.
94
96
  - Shared package caches live on the host and are reused across worktrees (and bind-mounted into containers), so a fresh worktree sets up at near warm-tree speed.
@@ -0,0 +1,10 @@
1
+ # Changelog
2
+
3
+ All notable changes to treebox will be documented in this file.
4
+
5
+ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.1.0/),
6
+ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
7
+
8
+ ## [Unreleased]
9
+
10
+ _Changes landing after the initial release will be recorded here._
@@ -2,8 +2,10 @@
2
2
 
3
3
  This file provides guidance to Claude Code (claude.ai/code) when working with code in this repository.
4
4
 
5
- > `AGENTS.md` and `.agents/skills/` are symlinks. `CLAUDE.md` and `.claude/skills/`
6
- > are the sources of truth edit those; the symlinks reflect changes automatically.
5
+ > `AGENTS.md` symlinks to `CLAUDE.md`, and `.agents/skills/` symlinks to
6
+ > `.claude/skills/`. The `treebox` skill's canonical copy lives in `skills/`
7
+ > (kept there for users to copy-paste); `.claude/skills/treebox/` symlinks to it.
8
+ > Edit the sources — `CLAUDE.md` and `skills/` — and the symlinks reflect the change.
7
9
 
8
10
  ## What this is
9
11
 
@@ -21,8 +23,8 @@ uv run --extra dev python -m pytest # full unit + integration suite
21
23
  uv run --extra dev python -m pytest tests/test_units.py::test_name # single test (or -k <pattern>)
22
24
  uv run --extra dev ruff check src tests # lint
23
25
  uv run --extra dev ruff format --check src tests # format check (drop --check to apply)
24
- uv run --extra dev mypy # type check (config in pyproject.toml)
25
- uv run --extra dev pre-commit install # install lint/format/type hooks (see CONTRIBUTING.md)
26
+ uv run --extra dev mypy # strict type check (config in pyproject.toml)
27
+ uv run --extra dev pre-commit install # install lint/format/strict type-check hooks (see CONTRIBUTING.md)
26
28
  ./scripts/validate.sh # lint + format + tests + live host-runner smoke (real uv, throwaway local remote)
27
29
  uv pip install -e ".[dev]" # editable dev environment
28
30
  uv run --extra docs mkdocs serve # docs site (docs/ + mkdocs.yml), live-reloading
@@ -52,13 +54,13 @@ run (pluggable)**.
52
54
  git just works). `HARNESS_COMMANDS` maps `claude`/`codex` to their
53
55
  fully-autonomous launch argv.
54
56
  - **`cli.py`** (Typer) is the entry point: `create [NAME] / enter <ref> /
55
- list / teardown <ref>... / doctor` (`ls`/`rm` are hidden aliases of
56
- list/teardown). `enter`/`teardown` resolve a ref as
57
+ list / teardown <ref>... / doctor / version` (`ls`/`rm` are hidden aliases
58
+ of list/teardown). `enter`/`teardown` resolve a ref as
57
59
  name → live branch → unique substring (`resolve.py`); ambiguity exits 2.
58
- It enforces **stable exit codes** (`0` ok · `2` usage · `3` not-found · `4`
59
- auth/fetch · `5` conflict) and **`--json`** output carrying a
60
- `schemaVersion` that only gains fields within a version — a breaking reshape
61
- bumps it (git-porcelain discipline). Agents
60
+ It enforces **stable exit codes** (`0` ok · `1` runtime/doctor hard-check ·
61
+ `2` usage · `3` not-found · `4` auth/fetch · `5` conflict) and **`--json`**
62
+ output carrying a `schemaVersion` that only gains fields within a version —
63
+ a breaking reshape bumps it (git-porcelain discipline). Agents
62
64
  branch on these, so don't change their meanings casually.
63
65
  - **`ecosystems.py`** detects package managers (uv, npm, pnpm, go, cargo),
64
66
  drives their cache-backed setup, and defines which manifest files feed the
@@ -73,11 +75,14 @@ run (pluggable)**.
73
75
  with `git branch -m`). `create --checkout feature/auth` derives the name by
74
76
  flattening slashes to `--` (`feature--auth`); generated names come from
75
77
  `names.py`.
76
- - **`config.py`** is **user-level TOML only**, never read from the target repo —
77
- a repo-level config could run arbitrary host commands. Same principle in
78
- **`assets.py`**: the sandbox template is operator-owned and rendered into
79
- a host-side dir *beside* the worktree, never inside the mount, so a boxed agent
80
- cannot edit the config that defines its own sandbox.
78
+ - **`config.py`** is **user-level TOML only** (`$TREEBOX_CONFIG`, else
79
+ `$TREEBOX_HOME/config.toml`, default `~/.treebox/config.toml`), never read
80
+ from the target repo a repo-level config could run arbitrary host commands.
81
+ Same principle in **`assets.py`**: templates resolve from
82
+ `$TREEBOX_TEMPLATE_DIR`, then `$TREEBOX_HOME/templates/<name>` (default
83
+ `~/.treebox/templates/<name>`), and the sandbox template is operator-owned
84
+ and rendered into a host-side dir *beside* the worktree, never inside the
85
+ mount, so a boxed agent cannot edit the config that defines its own sandbox.
81
86
 
82
87
  ## Invariants to preserve
83
88
 
@@ -10,10 +10,12 @@ treebox is a small, one-maintainer project. Contributions are welcome, but the s
10
10
 
11
11
  For larger feature ideas, open an issue first so we can decide whether they fit the project.
12
12
 
13
+ A good contribution has also had a fair round of review before it lands — by you, by an AI reviewer, or preferably both.
14
+
13
15
  ## Local checks
14
16
 
15
17
  Install the pre-commit hooks once so every commit is auto-formatted, lint-fixed,
16
- and type-checked (`ruff format`, `ruff check --fix`, and `mypy`):
18
+ and type-checked in strict mode (`ruff format`, `ruff check --fix`, and `mypy`):
17
19
 
18
20
  ```bash
19
21
  uv run --extra dev pre-commit install
@@ -32,7 +34,8 @@ will have no reported checks and the PR will stall; the remedy is to push from
32
34
  the workflow using a PAT or GitHub App token stored as a repo secret (e.g.
33
35
  `AUTOFIX_TOKEN`) instead of `GITHUB_TOKEN`.
34
36
 
35
- For code changes, run the relevant checks before opening a PR:
37
+ For code changes, run the relevant checks before opening a PR. Mypy runs in
38
+ strict mode (configured in `pyproject.toml`):
36
39
 
37
40
  ```bash
38
41
  uv run --extra dev python -m pytest
@@ -49,4 +52,4 @@ uv run --extra docs mkdocs build --strict
49
52
 
50
53
  ## Boundaries
51
54
 
52
- Please preserve the basics: fresh refs by default, no trust in target-repo sandbox config, stable CLI output for scripts, and subscription-based agent auth.
55
+ Please preserve the basics: fresh refs by default, no trust in target-repo sandbox config, and stable CLI output for scripts.
treebox-0.6.0/LICENSE ADDED
@@ -0,0 +1,202 @@
1
+ Apache License
2
+ Version 2.0, January 2004
3
+ http://www.apache.org/licenses/
4
+
5
+ TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
6
+
7
+ 1. Definitions.
8
+
9
+ "License" shall mean the terms and conditions for use, reproduction,
10
+ and distribution as defined by Sections 1 through 9 of this document.
11
+
12
+ "Licensor" shall mean the copyright owner or entity authorized by
13
+ the copyright owner that is granting the License.
14
+
15
+ "Legal Entity" shall mean the union of the acting entity and all
16
+ other entities that control, are controlled by, or are under common
17
+ control with that entity. For the purposes of this definition,
18
+ "control" means (i) the power, direct or indirect, to cause the
19
+ direction or management of such entity, whether by contract or
20
+ otherwise, or (ii) ownership of fifty percent (50%) or more of the
21
+ outstanding shares, or (iii) beneficial ownership of such entity.
22
+
23
+ "You" (or "Your") shall mean an individual or Legal Entity
24
+ exercising permissions granted by this License.
25
+
26
+ "Source" form shall mean the preferred form for making modifications,
27
+ including but not limited to software source code, documentation
28
+ source, and configuration files.
29
+
30
+ "Object" form shall mean any form resulting from mechanical
31
+ transformation or translation of a Source form, including but
32
+ not limited to compiled object code, generated documentation,
33
+ and conversions to other media types.
34
+
35
+ "Work" shall mean the work of authorship, whether in Source or
36
+ Object form, made available under the License, as indicated by a
37
+ copyright notice that is included in or attached to the work
38
+ (an example is provided in the Appendix below).
39
+
40
+ "Derivative Works" shall mean any work, whether in Source or Object
41
+ form, that is based on (or derived from) the Work and for which the
42
+ editorial revisions, annotations, elaborations, or other modifications
43
+ represent, as a whole, an original work of authorship. For the purposes
44
+ of this License, Derivative Works shall not include works that remain
45
+ separable from, or merely link (or bind by name) to the interfaces of,
46
+ the Work and Derivative Works thereof.
47
+
48
+ "Contribution" shall mean any work of authorship, including
49
+ the original version of the Work and any modifications or additions
50
+ to that Work or Derivative Works thereof, that is intentionally
51
+ submitted to Licensor for inclusion in the Work by the copyright owner
52
+ or by an individual or Legal Entity authorized to submit on behalf of
53
+ the copyright owner. For the purposes of this definition, "submitted"
54
+ means any form of electronic, verbal, or written communication sent
55
+ to the Licensor or its representatives, including but not limited to
56
+ communication on electronic mailing lists, source code control systems,
57
+ and issue tracking systems that are managed by, or on behalf of, the
58
+ Licensor for the purpose of discussing and improving the Work, but
59
+ excluding communication that is conspicuously marked or otherwise
60
+ designated in writing by the copyright owner as "Not a Contribution."
61
+
62
+ "Contributor" shall mean Licensor and any individual or Legal Entity
63
+ on behalf of whom a Contribution has been received by Licensor and
64
+ subsequently incorporated within the Work.
65
+
66
+ 2. Grant of Copyright License. Subject to the terms and conditions of
67
+ this License, each Contributor hereby grants to You a perpetual,
68
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
69
+ copyright license to reproduce, prepare Derivative Works of,
70
+ publicly display, publicly perform, sublicense, and distribute the
71
+ Work and such Derivative Works in Source or Object form.
72
+
73
+ 3. Grant of Patent License. Subject to the terms and conditions of
74
+ this License, each Contributor hereby grants to You a perpetual,
75
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
76
+ (except as stated in this section) patent license to make, have made,
77
+ use, offer to sell, sell, import, and otherwise transfer the Work,
78
+ where such license applies only to those patent claims licensable
79
+ by such Contributor that are necessarily infringed by their
80
+ Contribution(s) alone or by combination of their Contribution(s)
81
+ with the Work to which such Contribution(s) was submitted. If You
82
+ institute patent litigation against any entity (including a
83
+ cross-claim or counterclaim in a lawsuit) alleging that the Work
84
+ or a Contribution incorporated within the Work constitutes direct
85
+ or contributory patent infringement, then any patent licenses
86
+ granted to You under this License for that Work shall terminate
87
+ as of the date such litigation is filed.
88
+
89
+ 4. Redistribution. You may reproduce and distribute copies of the
90
+ Work or Derivative Works thereof in any medium, with or without
91
+ modifications, and in Source or Object form, provided that You
92
+ meet the following conditions:
93
+
94
+ (a) You must give any other recipients of the Work or
95
+ Derivative Works a copy of this License; and
96
+
97
+ (b) You must cause any modified files to carry prominent notices
98
+ stating that You changed the files; and
99
+
100
+ (c) You must retain, in the Source form of any Derivative Works
101
+ that You distribute, all copyright, patent, trademark, and
102
+ attribution notices from the Source form of the Work,
103
+ excluding those notices that do not pertain to any part of
104
+ the Derivative Works; and
105
+
106
+ (d) If the Work includes a "NOTICE" text file as part of its
107
+ distribution, then any Derivative Works that You distribute must
108
+ include a readable copy of the attribution notices contained
109
+ within such NOTICE file, excluding those notices that do not
110
+ pertain to any part of the Derivative Works, in at least one
111
+ of the following places: within a NOTICE text file distributed
112
+ as part of the Derivative Works; within the Source form or
113
+ documentation, if provided along with the Derivative Works; or,
114
+ within a display generated by the Derivative Works, if and
115
+ wherever such third-party notices normally appear. The contents
116
+ of the NOTICE file are for informational purposes only and
117
+ do not modify the License. You may add Your own attribution
118
+ notices within Derivative Works that You distribute, alongside
119
+ or as an addendum to the NOTICE text from the Work, provided
120
+ that such additional attribution notices cannot be construed
121
+ as modifying the License.
122
+
123
+ You may add Your own copyright statement to Your modifications and
124
+ may provide additional or different license terms and conditions
125
+ for use, reproduction, or distribution of Your modifications, or
126
+ for any such Derivative Works as a whole, provided Your use,
127
+ reproduction, and distribution of the Work otherwise complies with
128
+ the conditions stated in this License.
129
+
130
+ 5. Submission of Contributions. Unless You explicitly state otherwise,
131
+ any Contribution intentionally submitted for inclusion in the Work
132
+ by You to the Licensor shall be under the terms and conditions of
133
+ this License, without any additional terms or conditions.
134
+ Notwithstanding the above, nothing herein shall supersede or modify
135
+ the terms of any separate license agreement you may have executed
136
+ with Licensor regarding such Contributions.
137
+
138
+ 6. Trademarks. This License does not grant permission to use the trade
139
+ names, trademarks, service marks, or product names of the Licensor,
140
+ except as required for reasonable and customary use in describing the
141
+ origin of the Work and reproducing the content of the NOTICE file.
142
+
143
+ 7. Disclaimer of Warranty. Unless required by applicable law or
144
+ agreed to in writing, Licensor provides the Work (and each
145
+ Contributor provides its Contributions) on an "AS IS" BASIS,
146
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
147
+ implied, including, without limitation, any warranties or conditions
148
+ of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
149
+ PARTICULAR PURPOSE. You are solely responsible for determining the
150
+ appropriateness of using or redistributing the Work and assume any
151
+ risks associated with Your exercise of permissions under this License.
152
+
153
+ 8. Limitation of Liability. In no event and under no legal theory,
154
+ whether in tort (including negligence), contract, or otherwise,
155
+ unless required by applicable law (such as deliberate and grossly
156
+ negligent acts) or agreed to in writing, shall any Contributor be
157
+ liable to You for damages, including any direct, indirect, special,
158
+ incidental, or consequential damages of any character arising as a
159
+ result of this License or out of the use or inability to use the
160
+ Work (including but not limited to damages for loss of goodwill,
161
+ work stoppage, computer failure or malfunction, or any and all
162
+ other commercial damages or losses), even if such Contributor
163
+ has been advised of the possibility of such damages.
164
+
165
+ 9. Accepting Warranty or Additional Liability. While redistributing
166
+ the Work or Derivative Works thereof, You may choose to offer,
167
+ and charge a fee for, acceptance of support, warranty, indemnity,
168
+ or other liability obligations and/or rights consistent with this
169
+ License. However, in accepting such obligations, You may act only
170
+ on Your own behalf and on Your sole responsibility, not on behalf
171
+ of any other Contributor, and only if You agree to indemnify,
172
+ defend, and hold each Contributor harmless for any liability
173
+ incurred by, or claims asserted against, such Contributor by reason
174
+ of your accepting any such warranty or additional liability.
175
+
176
+ END OF TERMS AND CONDITIONS
177
+
178
+ APPENDIX: How to apply the Apache License to your work.
179
+
180
+ To apply the Apache License to your work, attach the following
181
+ boilerplate notice, with the fields enclosed by brackets "[]"
182
+ replaced with your own identifying information. (Don't include
183
+ the brackets!) The text should be enclosed in the appropriate
184
+ comment syntax for the file format. We also recommend that a
185
+ file or class name and description of purpose be included on the
186
+ same "printed page" as the copyright notice for easier
187
+ identification within third-party archives.
188
+
189
+ Copyright [yyyy] [name of copyright owner]
190
+
191
+ Licensed under the Apache License, Version 2.0 (the "License");
192
+ you may not use this file except in compliance with the License.
193
+ You may obtain a copy of the License at
194
+
195
+ http://www.apache.org/licenses/LICENSE-2.0
196
+
197
+ Unless required by applicable law or agreed to in writing, software
198
+ distributed under the License is distributed on an "AS IS" BASIS,
199
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
200
+ See the License for the specific language governing permissions and
201
+ limitations under the License.
202
+