space-architect 2.0.0.rc2 → 2.0.1

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.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 8bec4cc0a199a23ba60c9efd070163098e43a0a76bd8d2f85fbdbe4f7c7a6077
4
- data.tar.gz: cc8a23d0ee170242104ef94f020abdb5ed58b8aa4e7c34c97edad42b9cf61433
3
+ metadata.gz: 4ded62e199397e162bba1ff6ee37a5c6a9c7ee83a446d154107036aa4d628768
4
+ data.tar.gz: 592a6bb0c3b10b2773873e7fc3fd79cf7197bad78ada5520c5c9dc77e60aae2f
5
5
  SHA512:
6
- metadata.gz: 0564b3f3909ae233a788950f795afd6fbb3e2edc57ed87b8186cfdb2255d3380e66b140d7f217616ac5f63f9410f04b9f944ede1b06166bd60278429e0550f57
7
- data.tar.gz: 1b9f709c3ff2dcb77237207fb9cffaad67983eb938f0fe8ee4fc36cc8c95a14acc72523b0c59ebed0c5147a4b792b41d487a21e80e6a11ba1d765f4db0719936
6
+ metadata.gz: 91b5a865cb40557085399853e723e7763c2a54cb183d95b9744f9886753579aa841309f3f2dc490d28a3ad10d4693db06cfb615a9716b2b13fe68ded86b932f6
7
+ data.tar.gz: 6ebb0c24e6e603252aab77da49ff2b904d22084e0c840f7d46d5ac0eb66ec7c315ec04816d6446dc537cac5b3dbc58c7663d8bbbb563443566cd6e84de5ee05a
data/CHANGELOG.md CHANGED
@@ -5,62 +5,281 @@ All notable changes to this project are documented in this file.
5
5
  The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.1.0/),
6
6
  and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
7
7
 
8
- ## [2.0.0] - 2026-06-27
8
+ ## [2.0.1] - 2026-07-01
9
9
 
10
- Re-architects the single `architect` gem into three composable binaries —
11
- **`space` · `architect` · `src`** — over clean `Space::Core` / `Space::Architect`
12
- / `Space::Src` library seams. End-user CLI behaviour is preserved byte-for-byte
13
- except where called out under **Changed** below.
10
+ Fast-follow completing the `pack.persist:` story from 2.0.0.
14
11
 
15
12
  ### Added
16
13
 
14
+ - **Seed-on-empty for `pack.persist:`.** Content baked at a persisted path now
15
+ survives a first-run empty bind mount. `space pack` snapshots each persisted
16
+ dir to a `/opt/space-seed<path>` sidecar after provisioning, and the entrypoint
17
+ restores an empty mount from its seed on first run only (a non-empty mount
18
+ keeps its evolving state). Previously the empty host mount shadowed the baked
19
+ content — e.g. a provisioned `~/.hermes/config.yaml` was hidden once
20
+ `/root/.hermes` was persisted. Template-only; a space with no `pack.persist:`
21
+ renders an identical Dockerfile and entrypoint.
22
+
23
+ ### Fixed
24
+
25
+ - **First-run boot on bind-mount-root-restricted runtimes.** The seed restore
26
+ tolerates a benign copy failure (`2>/dev/null || true`) so that on runtimes
27
+ where the persisted path is a bind mount whose root rejects utime updates
28
+ (virtiofs under Apple `container`), the entrypoint's `set -e` no longer turns a
29
+ cosmetic `cp` EPERM into a fatal abort before the payload execs.
30
+
31
+ ## [2.0.0] - 2026-07-01
32
+
33
+ A ground-up release across four fronts:
34
+
35
+ 1. **Three composable binaries** — `space` · `architect` · `src` — over clean
36
+ `Space::Core` / `Space::Architect` / `Space::Src` library seams (retiring the
37
+ single `SpaceArchitect` namespace).
38
+ 2. **An overhauled Architect Loop** — the "mission" vocabulary becomes
39
+ "project," Acceptance Criteria gain a structured, runnable `gates` block, and
40
+ the loop grows first-class verbs (`gate`, `verdict`, `land`, `ground`), an
41
+ integration-branch-by-default workflow, and a SessionStart re-grounding hook.
42
+ 3. **Reproducible space containers** — `space pack` / `build` / `run` turn a
43
+ space into an OCI image.
44
+ 4. **`space-server`** — a new Hanami + React web app to import, view, and share
45
+ Architect spaces and AI-agent transcripts. **It ships in the repo, not in the
46
+ gem** (the gem packages only `lib/`, `exe/`, and `skill/`).
47
+
48
+ This is a major, breaking release for both CLI users and library embedders — see
49
+ the **BREAKING** items under Changed. The repository is now a monorepo; the
50
+ `space-architect` gem lives at the root and the server under `server/`.
51
+
52
+ ### Added
53
+
54
+ #### CLI — binaries, research, and dispatch
55
+
17
56
  - **`src` — standalone evergreen-engine binary** (`exe/src`). `repo`, `org`,
18
57
  `sync`, `status`, `config`, `daemon`, and `clone`, plus single-token fuzzy
19
58
  navigation (`src <query>` resolves to a repo and honours the `cd` contract)
20
- and native fish shell integration with completions. Previously this engine was
21
- reachable only as `architect src …`; it is now a first-class binary in its own
22
- right (and still forwarded by `architect src …`).
59
+ and native fish shell integration with completions. Previously reachable only
60
+ as `architect src …`; now a first-class binary (and still forwarded by
61
+ `architect src …`).
23
62
  - **`architect research dispatch | status | wait`** — first-class parallel,
24
- read-only research lanes. Detached `claude -p` researchers (no Edit/Write/Bash)
25
- run in the background; a socketry/async fiber mux tails each lane's `run.jsonl`
26
- and extracts its report. The architect verifies claims and writes Grounds.
63
+ read-only research lanes. Detached `claude -p` researchers restricted to
64
+ `Read,Grep,Glob,WebSearch,WebFetch` (no Edit/Write/Bash) run in the background;
65
+ a socketry/async fiber mux tails each lane's `run.jsonl` and extracts its
66
+ report. The architect verifies claims and writes Grounds.
27
67
  - **`architect dispatch --detach`** — detached builder launch that returns
28
68
  immediately with a PID and survives the harness wall-clock reap; poll the
29
69
  lane's report for completion.
70
+ - **`architect dispatch` HTTP push** — stream a builder's live output to an
71
+ ingest server. `--push-url <url> --push-token <tok>` POSTs the NDJSON stream to
72
+ an existing run's ingest URL; `--push-host <host> --push-token <tok>` first
73
+ creates the run (`POST <host>/runs`), derives `<host>/runs/<id>/ingest`, streams
74
+ there, and prints the run id. `--push-url`/`--push-host` are mutually exclusive,
75
+ both require `--push-token` (Bearer auth), and neither combines with `--detach`.
76
+ The stream is teed to the run log and the endpoint concurrently over fibers.
77
+ - **`architect dispatch --timeout`** — wall-clock timeout for a builder (default
78
+ `14400`s / 4h; `0` disables; foreground only). A wedged builder's process group
79
+ is escalated TERM→grace→KILL and reported as timed out (exit 124).
80
+
81
+ #### Architect Loop — gates and new verbs
82
+
83
+ - **A fenced ` ```gates ` block inside each iteration's Acceptance Criteria.**
84
+ Runnable checks are now structured YAML gates — `id`, `ac` (which prose AC it
85
+ backs), `cmd`, optional `cwd`, an `expect` block (`exit_code` / `stdout_match`
86
+ / `threshold`), and an optional per-gate `timeout` (seconds; default 900),
87
+ replacing the old free-text AC table.
88
+ - **Gate linting at freeze time** (`GateLint`, via dry-validation). `architect
89
+ freeze` validates the gates block: malformed gates fail the freeze; absent or
90
+ empty gates warn but are allowed (prose-judged iterations); duplicate ids, bad
91
+ threshold operators, and non-single-capture regexes are caught.
92
+ - **`architect gate` — a gate runner.** Runs the frozen Acceptance-Criteria gate
93
+ commands (always read from the freeze commit, never the working copy) in the
94
+ resolved repo or lane worktree, scoring captured output against each `expect`
95
+ block with a pure `GateEvaluator`.
96
+ - **`architect verdict <iteration> continue|kill`** — records the decision in the
97
+ `project:` block and writes the `## Verdict` prose in one commit; the first tool
98
+ that actually persists a verdict decision.
99
+ - **`architect land`** — generates the end-of-project PR for each integrated repo
100
+ (writes a `build/land/<repo>-pr-body.md` and prints the `gh pr create …`
101
+ invocation). Side-effect-free: no git write, no push, no `gh` call.
102
+ - **`architect ground` + a SessionStart re-grounding hook.** `architect init`
103
+ now also writes `.claude/settings.json` registering SessionStart hooks
104
+ (startup/clear/resume) that run `architect ground`, re-emitting `ARCHITECT.md`,
105
+ `BRIEF.md`, and the in-flight iteration file so a freshly cleared or resumed
106
+ session self-orients. A worktree guard suppresses grounding inside builder
107
+ worktrees, so builders are never fed architect context.
108
+
109
+ #### Space containers (require a `container` / OCI runtime)
110
+
111
+ - **`space pack`** — generate a portable OCI build context for the current space
112
+ (writes `Dockerfile`, `entrypoint.sh`, and a `.dockerignore` into `build/oci/`,
113
+ overridable with `-o/--output`) and print a build hint.
114
+ - **`space build`** — pack, then `container build`, tagging reproducibly by commit
115
+ as `<space-id>:<git-short-sha>` plus `<space-id>:latest` (SHA suffixed `-dirty`
116
+ when the tree is dirty).
117
+ - **`space run`** — `container run --rm` on `<space-id>:latest`, defaulting to an
118
+ interactive login shell or a passed command, auto-detecting TTY (`--tty` to
119
+ force). Forwards `ANTHROPIC_API_KEY` / `CLAUDE_CODE_OAUTH_TOKEN` /
120
+ `ANTHROPIC_BASE_URL` from the host only if set — credentials are never baked
121
+ into a layer. (All three commands are also reachable as `architect space …`.)
122
+ - **Declarative `pack:` config in `space.yaml`.** `pack.provision` — build-time
123
+ provisioning scripts (space-relative) emitted as ordered `RUN` steps;
124
+ `pack.persist` — absolute guest paths bind-mounted from `.state/<guest>` so
125
+ state survives across runs. Provision paths are validated (must exist, be
126
+ relative, and stay within the space root).
127
+ - **Git baked into the image + in-container worktrees.** The image copies the
128
+ whole space tree (repos and history) into `/space`, installs the pinned
129
+ in-space `space-architect`, seeds a default git identity, and sets `git
130
+ safe.directory '*'` so `git worktree` works on the root-owned tree.
131
+
132
+ #### `space-server` (repo, not shipped in the gem)
133
+
134
+ - **A Hanami web app to view and share Architect work** (`server/`). Imports an
135
+ Architect space and renders its iterations against the canonical six-section
136
+ shape (Grounds · Specification · Acceptance Criteria · Builder Prompt · Builder
137
+ Report · Verdict), alongside that space's runs and artifacts; separately ingests
138
+ exported AI chat transcripts (Claude Code, Codex, pi, opencode) for markdown/code
139
+ browsing, per-turn annotation, and read-only public sharing.
140
+ - **Architect-space data model + `SpaceImporter`.** New `spaces` / `iterations` /
141
+ `artifacts` tables and a `rake space:import[/path]` task that reads a space's
142
+ `space.yaml`, markdown artifacts, and builder run streams (`build/*/run.jsonl`)
143
+ into Postgres — idempotent, keyed by slug/ordinal/path.
144
+ - **A stitched per-space read view (Inertia/React).** `Spaces/Index` and
145
+ `Spaces/Show` interleave iterations and architect sessions into one
146
+ timestamp-ordered timeline with inline transcript cards and run/artifact
147
+ drill-downs; imported timestamps are timezone-faithful and each run carries a
148
+ `harness · model` badge.
149
+ - **Live agent-run streaming.** Machine clients push run events over Bearer token
150
+ auth; browsers replay them live over SSE. Pairs with the CLI's
151
+ `architect dispatch --push-*`.
152
+ - **Session normalizers for architect transcripts.** `Normalizer::ClaudeSession`
153
+ understands Claude Code's `~/.claude/projects/**.jsonl` session-log shape and
154
+ `Normalizer::OpencodeSession` reads opencode's SQLite DB read-only, both
155
+ emitting the same normalized event stream as the builder-dispatch parser.
156
+ - **Five in-tree Hanami extension gems** under `server/gems/*` (each path-loaded,
157
+ with its own gemspec and tests): `hanami-healthcheck` (a `/up` endpoint),
158
+ `inertia-hanami` (an Inertia.js protocol adapter), `hanami-credentials`
159
+ (encrypted credentials store), `hanami-force-ssl` (Rack 3 HTTPS/HSTS
160
+ middleware), and `vite-hanami` (Vite tag helpers + dev-server proxy).
30
161
 
31
162
  ### Changed
32
163
 
33
- - **BREAKING — three binaries over clean seams.** `space` now runs on
34
- `Space::Core` alone (`exe/space`); `architect` forwards `space …` / `src …` to
35
- their surfaces; `src` is its own executable (`exe/src`). The gem now installs
36
- three executables (`architect`, `space`, `src`) where 1.3.0 installed two.
164
+ - **BREAKING — three binaries over clean seams.** `space` runs on `Space::Core`
165
+ alone (`exe/space`); `architect` (`exe/architect`) forwards `space …` / `src …`
166
+ to their surfaces; `src` is its own executable. The gem now installs three
167
+ executables where 1.3.0 installed two.
37
168
  - **BREAKING — Ruby namespace overhaul (library embedders).** The single
38
169
  `SpaceArchitect::*` module is retired and split into `Space::Core::*`
39
- (foundation: config, state, XDG, terminal, git/mise clients, space store),
40
- `Space::Architect::*` (mission, harness, dispatch, research), and
41
- `Space::Src::*` (the evergreen engine). Update any `require`s and constant
42
- references. The CLI surface is unaffected.
170
+ (config, state, XDG, terminal, git/mise clients, space store),
171
+ `Space::Architect::*` (project, harness, dispatch, research), and
172
+ `Space::Src::*` (the evergreen engine). No `SpaceArchitect` constant remains —
173
+ update any `require`s and constant references. The CLI surface is unaffected.
174
+ - **BREAKING — "mission" is now "project," with no back-compat shim.** The
175
+ `space.yaml` project-state key `architect:` becomes `project:`; existing spaces
176
+ are not read until the key is renamed. The core class `ArchitectMission` becomes
177
+ `ArchitectProject`, all user-facing output follows (`Project ready:` /
178
+ `Project status:`), and the default integration branch is `project/<slug>`.
179
+ No deprecation alias is provided.
43
180
  - **BREAKING — `repo-tender` absorbed into `space-src`.** The vendored
44
- `repo-tender` engine is gone; its functionality now ships as `Space::Src`.
45
- State migrates automatically from `$XDG_STATE_HOME/repo-tender/` to
46
- `$XDG_STATE_HOME/space-src/` on first run (data-preserving).
47
- - **BREAKING — `space new` takes repeatable `-r` flags.** Repos are now passed
48
- as `space new "My Space" -r org/repo -r example/alpha` instead of as positional
49
- arguments after the title. Repeated `-r` accumulate; the comma form still works.
50
- - **Colourful global help** for `space` and `architect` (`--help` listing), with
51
- global colour options (`--color` / `--colors`) inherited by every command via a
52
- shared `BaseCommand`. The `src` binary keeps its own `--plain` / `--json`
53
- output system.
54
- - `space --version` now reports the space-surface (`Space::Core`) version
55
- independently of the architect mission tooling.
181
+ `repo-tender` engine is gone; its functionality now ships as `Space::Src`. State
182
+ migrates automatically from `$XDG_STATE_HOME/repo-tender/` to
183
+ `$XDG_STATE_HOME/space-src/` (and the launchd label likewise) on first run,
184
+ data-preserving.
185
+ - **BREAKING — `space new` takes repeatable `-r` flags.** Repos are passed as
186
+ `space new "My Space" -r org/repo -r example/alpha` instead of as trailing
187
+ positional arguments. Repeated `-r` accumulate; the comma form still works.
188
+ - **Acceptance Criteria are prose (AC1, AC2, ) plus the gates block, not a
189
+ `| AC# | Command | Threshold |` table.** The prose is what the architect judges
190
+ against; gates are the necessary-not-sufficient mechanical check.
191
+ - **`architect new` allocates the ordinal at spec-time.** The `I<NN>` number is
192
+ assigned by `new`, not pre-numbered; `ARCHITECT.md` gains an un-numbered ordered
193
+ **Backlog** so reshuffling priorities no longer forces renumber churn.
194
+ - **Integration branch by default.** Lanes merge `--no-ff` into one shared,
195
+ stable `project/<slug>` branch instead of into `main` or per-iteration branches;
196
+ the end-of-project PR is deferred to `architect land`. Merge conflicts abort
197
+ cleanly and are treated as a lane-plan disjointness defect.
198
+ - **`architect gate` reports PASS/FAIL per gate and exits nonzero on any
199
+ failure** (it began as a raw-output-only runner) — while the framing keeps the
200
+ Acceptance-Criteria verdict with the architect, not the runner.
201
+ - **Post-flight moved out of the dispatching session.** The dispatch session now
202
+ only babysits builders to completion and hands off; a fresh judging session owns
203
+ post-flight checks, gates, verdict, and integration. Two first-class lane
204
+ patterns are documented: **parallel + fast-follow** and **serial deferred
205
+ judgment**.
206
+ - **`architect status` tells the truth about verdicts** — rendering
207
+ `awaiting-verdict` for integrated-but-unjudged iterations and the recorded
208
+ `continue`/`kill`, instead of a freeze/lane placeholder.
209
+ - **The loop is model-agnostic.** `dispatch --model` help clarifies any
210
+ provider/tier is fine (pin a full id, not a floating alias); the probe/spike is
211
+ documented as a first-class iteration type; `docs/DESIGN.md` was revived.
212
+ - **Builder streams now include partial messages.** The claude harness argv gained
213
+ `--include-partial-messages`, so `run.jsonl` (and any HTTP push) carries
214
+ streaming partial-message events, not just completed turns — consumers should
215
+ expect the finer-grained shape.
216
+ - **Colourful global help** for `space` and `architect`, with global colour
217
+ options `--color` (auto/always/never) and its `--colors` alias inherited by
218
+ every command via a shared `BaseCommand`. `src` keeps its own `--plain` /
219
+ `--json` system.
220
+ - **`space --version`** now reports the space-surface (`Space::Core`) version
221
+ independently of the architect project tooling.
222
+ - **The repository is now a monorepo.** The gem keeps the root (`lib/`, `exe/`,
223
+ `skill/`, `space-architect.gemspec`); the `space-server` app lives under
224
+ `server/`. Gem consumers are unaffected — `server/` is never packaged.
225
+
226
+ ### Removed
227
+
228
+ - **The `architect:` `space.yaml` key and the `ArchitectMission` class** —
229
+ renamed to `project:` / `ArchitectProject` with no alias (BREAKING; see above).
230
+ - **The Acceptance-Criteria command/threshold markdown table** — replaced by
231
+ prose ACs plus the fenced `gates` block.
232
+ - **The post-flight phase in the dispatching session** — that work now belongs to
233
+ a fresh judging session.
234
+
235
+ ### Fixed
236
+
237
+ - **Gate thresholds matched the first occurrence instead of the last.**
238
+ `GateEvaluator#check_threshold` now takes the last regex match, repairing frozen
239
+ `(\d+) runs`-style suite-green gates without editing the frozen AC.
240
+ - **A frozen per-gate `cwd` ran against the checked-out repo instead of the lane
241
+ worktree.** `run_gates` now re-roots a `cwd` pointing into the lane's repo onto
242
+ the lane worktree.
243
+ - **`architect verify` false-FAILed "no builder commits" after integration.** The
244
+ architect's own `integrate` commit was miscounted; `merge_lane!` now records
245
+ `integrate_sha` and the mechanical checks exclude exactly that SHA.
246
+ - **A missing `touch_set` rendered a silent `N/A`.** Bounds now render
247
+ `WARN — no touch_set recorded`, distinguishing "unchecked" from "clean."
248
+ - **Bounds glob matching was unsafe.** `fnmatch` now uses
249
+ `FNM_PATHNAME | FNM_EXTGLOB` and parses NUL-delimited `git status --porcelain
250
+ -z`, so `*` no longer crosses `/`, `**` works, and renames/spaced paths are
251
+ handled.
252
+ - **HTTP push is now best-effort and isolated.** If the ingest server's transport
253
+ fails or a push write errors mid-stream, `dispatch` logs a one-line warning and
254
+ keeps the run log intact rather than tearing down the builder; a failed push
255
+ disables further pushes for that run without dropping log output.
256
+ - **Container login-shell PATH and git identity.** The image writes
257
+ `/etc/profile.d/space-architect.sh` so `bash --login` finds `architect` /
258
+ `space` / `claude`, and the entrypoint seeds `user.name` / `user.email` if
259
+ unset so in-image commits and worktrees no longer fail on a missing identity.
260
+ - **The gate evaluator lacked a discriminating threshold test** — added one that
261
+ genuinely separates pass from fail, closing a hole where a broken evaluator
262
+ could still pass its own suite.
56
263
 
57
264
  ### Internal
58
265
 
59
- - `Space::Core` carved out as a standalone, leak-free foundation (no
60
- `SpaceArchitect` references); behaviour preserved byte-for-byte across the
61
- carve, the module rename, and the binary split.
62
- - CI: `softprops/action-gh-release` bumped to v3 (Node 24 runtime).
63
- - Test suite: 762 runs, 0 failures.
266
+ - **`Space::Core` carved out as a standalone, leak-free foundation** (no
267
+ `SpaceArchitect` references), with behaviour preserved across the carve, the
268
+ module rename, and the binary split.
269
+ - **New runtime dependencies:** `async-http ~> 0.95` and `protocol-http ~> 0.62`
270
+ (backing the HTTP push tee and the research mux).
271
+ - **Split, per-subtree CI.** The gem keeps a lean workflow (Ruby tests +
272
+ bundler-audit); a separate `server-ci.yml` runs the server suite against
273
+ Postgres 17 / Redis 7 service containers, a Node 24 frontend job, a matrix that
274
+ tests all five `server/gems/*` independently, and a server bundler-audit.
275
+ Toolchain is pinned via `mise.toml` (Ruby 4.0.5) at both the root and `server/`.
276
+ - **CI bumps:** `softprops/action-gh-release` v2 → v3 (Node 24 runtime),
277
+ `actions/cache` 5 → 6, `actions/checkout` 5 → 7, `actions/setup-node` 5 → 6,
278
+ and `shrine` 3.8.0 (server).
279
+ - **Prerelease-aware release pipeline.** `release.yml` marks rc/beta/alpha/pre
280
+ tags as GitHub prereleases so an RC tag is not published as `latest`; `2.0.0.rc1`
281
+ and `2.0.0.rc2` were cut ahead of this final.
282
+ - Gem test suite: 948 runs, 3611 assertions, 0 failures, 0 errors, 0 skips.
64
283
 
65
284
  ## [1.3.0] - 2026-06-25
66
285
 
@@ -97,6 +316,7 @@ except where called out under **Changed** below.
97
316
  lanes, worktrees, and headless `claude -p` dispatch, with variant sets and the
98
317
  claude-code and opencode harnesses.
99
318
 
319
+ [2.0.1]: https://github.com/jetpks/space-architect/compare/v2.0.0...v2.0.1
100
320
  [2.0.0]: https://github.com/jetpks/space-architect/compare/v1.3.0...v2.0.0
101
321
  [1.3.0]: https://github.com/jetpks/space-architect/compare/v1.2.0...v1.3.0
102
322
  [1.2.0]: https://github.com/jetpks/space-architect/compare/v1.1.0...v1.2.0
data/README.md CHANGED
@@ -13,7 +13,7 @@ The gem ships **three composable binaries** over clean library seams:
13
13
 
14
14
  | Binary | What it does | Library |
15
15
  |--------|--------------|---------|
16
- | **`space`** 🪐 | Create and manage task-scoped workspaces | `Space::Core` |
16
+ | **`space`** 🪐 | Create, manage & containerize task-scoped workspaces | `Space::Core` |
17
17
  | **`architect`** 🏗️ | Run the Architect Loop — judgment + headless builders | `Space::Architect` |
18
18
  | **`src`** 🌲 | Tend evergreen repo checkouts for copy-on-write provisioning | `Space::Src` |
19
19
 
@@ -84,6 +84,11 @@ architect init # scaffold ARCHITECT.md + arch
84
84
  architect new my-feature # scaffold the next iteration file
85
85
  architect freeze my-feature # lock the Acceptance Criteria ❄️
86
86
  architect dispatch my-feature lane-a # send a headless builder to work
87
+
88
+ # Containers (run from inside a space) — a portable, reproducible-by-SHA image of the space
89
+ space pack # render build/oci/ (Dockerfile + entrypoint)
90
+ space build # pack + build & tag <space-id>:<git-sha>
91
+ space run # run it — login shell, auth from your env
87
92
  ```
88
93
 
89
94
  ## `space` — task-scoped workspaces 🌌
@@ -118,6 +123,60 @@ same day get a counter (`…-name-of-space-2`). 📅
118
123
  Everything `space` does is also reachable as `architect space …` from within a
119
124
  project.
120
125
 
126
+ ## Containerize a space: `pack` · `build` · `run` 📦
127
+
128
+ A space is self-describing enough to become a container. `space pack` renders a
129
+ portable OCI build context from the space; `space build` packs and builds it into
130
+ a **reproducible-by-SHA** image; `space run` runs that image with your auth
131
+ injected at runtime and stateful paths bind-mounted back to the host. 🐳
132
+
133
+ ```sh
134
+ space pack # render build/oci/ (Dockerfile + entrypoint + ignore file)
135
+ space pack -o /tmp/ctx # …to a different output directory
136
+ space build # pack, then build & tag <space-id>:<git-sha> and :latest
137
+ space run # run <space-id>:latest — login shell, auth from your env
138
+ space run architect status # …or run a one-off command instead of the login shell
139
+ space run --tty # force an interactive TTY (default: auto-detect)
140
+ ```
141
+
142
+ **What lands in the image.** The context copies the whole space tree (filtered by
143
+ a generated `Dockerfile.dockerignore`) onto a `ruby:4.0.5` base with `git`, the
144
+ Claude Code CLI, and the `space-architect` gem — installed from the in-space
145
+ `repos/space-architect` checkout when present (a pinned build), else from
146
+ RubyGems. Secrets never enter the layers: `.env`, `*.key`, `*.pem`, ssh keys,
147
+ `build/`, and `tmp/` are all excluded by the generated ignore file. 🔒
148
+
149
+ **Reproducible by SHA.** `space build` tags the image `<space-id>:<sha>`, where
150
+ `<sha>` is the space repo's 12-char `HEAD` (suffixed `-dirty` when the tree has
151
+ uncommitted changes), plus a moving `:latest`. Same commit → same tag → same
152
+ image. It drives the `container` CLI, but the output is an ordinary OCI/Docker
153
+ build context, so `docker build -f build/oci/Dockerfile .` (from the space root)
154
+ works just as well.
155
+
156
+ **Auth stays out of the layers.** `space run` injects only the auth environment
157
+ variables that are actually set — `ANTHROPIC_API_KEY`, `CLAUDE_CODE_OAUTH_TOKEN`,
158
+ `ANTHROPIC_BASE_URL` — with `-e` at run time, so credentials live in your shell,
159
+ never in the image. 🗝️
160
+
161
+ **Declaring provisioning & persistence** — two optional keys in `space.yaml`:
162
+
163
+ ```yaml
164
+ pack:
165
+ provision: # build-time: relative scripts, baked in by `space build`
166
+ - scripts/setup-toolchain.sh
167
+ persist: # run-time: absolute guest paths, bind-mounted per run
168
+ - /root/.claude
169
+ - /root/.local/state
170
+ ```
171
+
172
+ `provision` scripts must live under the space root and run as `RUN /space/<script>`
173
+ while the image builds. `persist` paths must be absolute; `space run` bind-mounts
174
+ each one from `<space>/.state<path>` on the host (created on first run) so a
175
+ container's mutable state survives across runs. Both are validated at pack time.
176
+
177
+ Like everything else, these are reachable as `architect space pack|build|run`
178
+ from inside a project.
179
+
121
180
  ## `src` — the evergreen engine 🌲
122
181
 
123
182
  `src` keeps local clones under `<src_dir>/<host>/<owner>/<repo>` (default
@@ -56,6 +56,13 @@ RUN printf 'export PATH="/usr/local/bundle/bin:/root/.local/bin:$PATH"\n' \
56
56
  RUN /space/<%= script %>
57
57
  <% end -%>
58
58
  <% end -%>
59
+ <% if persist_paths.any? -%>
60
+
61
+ # Seed snapshot: capture baked content of persisted dirs so a first-run (empty) mount is seeded from it
62
+ <% persist_paths.each do |guest_path| -%>
63
+ RUN mkdir -p "/opt/space-seed<%= guest_path %>" && cp -a "<%= guest_path %>/." "/opt/space-seed<%= guest_path %>/" 2>/dev/null || true
64
+ <% end -%>
65
+ <% end -%>
59
66
 
60
67
  WORKDIR /space
61
68
 
@@ -3,6 +3,12 @@ set -e
3
3
  git config --global --add safe.directory '*'
4
4
  git config --global --get user.name >/dev/null 2>&1 || git config --global user.name 'space-architect'
5
5
  git config --global --get user.email >/dev/null 2>&1 || git config --global user.email 'architect@localhost'
6
+ <% persist_paths.each do |guest_path| -%>
7
+ if [ -d "/opt/space-seed<%= guest_path %>" ] && [ -z "$(ls -A "<%= guest_path %>" 2>/dev/null)" ]; then
8
+ mkdir -p "<%= guest_path %>"
9
+ cp -a "/opt/space-seed<%= guest_path %>/." "<%= guest_path %>/" 2>/dev/null || true
10
+ fi
11
+ <% end -%>
6
12
  if [ "$#" -eq 0 ]; then
7
13
  exec bash --login
8
14
  else
@@ -2,6 +2,6 @@
2
2
 
3
3
  module Space
4
4
  module Core
5
- VERSION = "2.0.0.rc2"
5
+ VERSION = "2.0.1"
6
6
  end
7
7
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: space-architect
3
3
  version: !ruby/object:Gem::Version
4
- version: 2.0.0.rc2
4
+ version: 2.0.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Eric Jacobs