alab-cli 0.1.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 (43) hide show
  1. alab_cli-0.1.0/LICENSE +9 -0
  2. alab_cli-0.1.0/PKG-INFO +333 -0
  3. alab_cli-0.1.0/README.md +314 -0
  4. alab_cli-0.1.0/pyproject.toml +58 -0
  5. alab_cli-0.1.0/setup.cfg +4 -0
  6. alab_cli-0.1.0/src/alab/__init__.py +5 -0
  7. alab_cli-0.1.0/src/alab/__main__.py +4 -0
  8. alab_cli-0.1.0/src/alab/auth.py +242 -0
  9. alab_cli-0.1.0/src/alab/cli.py +638 -0
  10. alab_cli-0.1.0/src/alab/configs.py +614 -0
  11. alab_cli-0.1.0/src/alab/context.py +188 -0
  12. alab_cli-0.1.0/src/alab/db.py +283 -0
  13. alab_cli-0.1.0/src/alab/docker_platform.py +22 -0
  14. alab_cli-0.1.0/src/alab/errors.py +66 -0
  15. alab_cli-0.1.0/src/alab/home.py +82 -0
  16. alab_cli-0.1.0/src/alab/ids.py +43 -0
  17. alab_cli-0.1.0/src/alab/migrations/1_initial.sql +512 -0
  18. alab_cli-0.1.0/src/alab/proc.py +38 -0
  19. alab_cli-0.1.0/src/alab/registry.py +253 -0
  20. alab_cli-0.1.0/src/alab/rendering.py +88 -0
  21. alab_cli-0.1.0/src/alab/runner.py +2316 -0
  22. alab_cli-0.1.0/src/alab/services.py +10555 -0
  23. alab_cli-0.1.0/src/alab/source_import.py +306 -0
  24. alab_cli-0.1.0/src/alab/timeutil.py +33 -0
  25. alab_cli-0.1.0/src/alab_cli.egg-info/PKG-INFO +333 -0
  26. alab_cli-0.1.0/src/alab_cli.egg-info/SOURCES.txt +41 -0
  27. alab_cli-0.1.0/src/alab_cli.egg-info/dependency_links.txt +1 -0
  28. alab_cli-0.1.0/src/alab_cli.egg-info/entry_points.txt +2 -0
  29. alab_cli-0.1.0/src/alab_cli.egg-info/requires.txt +5 -0
  30. alab_cli-0.1.0/src/alab_cli.egg-info/top_level.txt +1 -0
  31. alab_cli-0.1.0/tests/test_auth.py +366 -0
  32. alab_cli-0.1.0/tests/test_cli_contract.py +20641 -0
  33. alab_cli-0.1.0/tests/test_errors.py +110 -0
  34. alab_cli-0.1.0/tests/test_ids.py +54 -0
  35. alab_cli-0.1.0/tests/test_migrations.py +1594 -0
  36. alab_cli-0.1.0/tests/test_real_docker.py +875 -0
  37. alab_cli-0.1.0/tests/test_real_skydiscover_catalog.py +143 -0
  38. alab_cli-0.1.0/tests/test_real_skydiscover_python.py +327 -0
  39. alab_cli-0.1.0/tests/test_runner_docker.py +1645 -0
  40. alab_cli-0.1.0/tests/test_runner_harbor.py +637 -0
  41. alab_cli-0.1.0/tests/test_runner_local.py +1098 -0
  42. alab_cli-0.1.0/tests/test_runner_skydiscover.py +590 -0
  43. alab_cli-0.1.0/tests/test_smoke.py +17304 -0
alab_cli-0.1.0/LICENSE ADDED
@@ -0,0 +1,9 @@
1
+ GNU GENERAL PUBLIC LICENSE
2
+ Version 3, 29 June 2007
3
+
4
+ Copyright (C) 2007 Free Software Foundation, Inc. <https://fsf.org/>
5
+ Everyone is permitted to copy and distribute verbatim copies of this license document, but changing it is not allowed.
6
+
7
+ This project is licensed under GPL-3.0-or-later. The full GPL-3.0 license text is available at:
8
+
9
+ https://www.gnu.org/licenses/gpl-3.0.txt
@@ -0,0 +1,333 @@
1
+ Metadata-Version: 2.4
2
+ Name: alab-cli
3
+ Version: 0.1.0
4
+ Summary: Local agent-first experiment workbench CLI
5
+ Author: ALab contributors
6
+ License-Expression: GPL-3.0-or-later
7
+ Project-URL: Homepage, https://github.com/bebetterest/ALab
8
+ Project-URL: Repository, https://github.com/bebetterest/ALab
9
+ Project-URL: Issues, https://github.com/bebetterest/ALab/issues
10
+ Requires-Python: >=3.11
11
+ Description-Content-Type: text/markdown
12
+ License-File: LICENSE
13
+ Requires-Dist: typer>=0.12.0
14
+ Requires-Dist: rich>=13.7.0
15
+ Requires-Dist: pydantic>=2.7.0
16
+ Requires-Dist: tomli-w>=1.0.0
17
+ Requires-Dist: pathspec>=0.12.0
18
+ Dynamic: license-file
19
+
20
+ # ALab
21
+
22
+ <p align="center">
23
+ <img src="docs/assets/readme-header.png" alt="Hand-drawn ALab virtual experiment workbench banner" width="100%">
24
+ </p>
25
+
26
+ ALab is a local, agent-first Python CLI workbench for iterative experiments. It lets external agents work in isolated Git worktrees, run repeatable evaluations, submit final results, and inspect visible prior experiment evidence through explicit collaboration boundaries.
27
+
28
+ ALab V1 is intentionally local-only: no server, sync service, web UI, built-in agent launcher, or account system. It owns the local project records, source snapshots, experiment lifecycle, runner execution, logs, artifacts, and visibility rules; agents remain external CLI operators.
29
+
30
+ ## Highlights
31
+
32
+ - Local CLI workbench for projects, sources, experiments, runs, submissions, logs, artifacts, annotations, and audits.
33
+ - Context-aware command surface: `alab help` and command preflight show only what the current project, experiment, inspection checkout, token, or explicit key can use.
34
+ - Git-backed experiment isolation: each experiment is an isolated branch/worktree with a worktree token for run and submit operations.
35
+ - Reproducible project setup: project config controls runner, reward, artifact capture, environment, secrets, mutable paths, and visibility.
36
+ - Runner support for local subprocesses, Docker images/Dockerfiles, Harbor verifiers, and SkyDiscover Python/Docker evaluators.
37
+ - Collaboration boundary, not strong local security: root/admin keys and experiment tokens gate CLI capabilities, while local project records remain plaintext.
38
+ - Secret hygiene: raw keys/tokens are not stored; generated raw keys are printed once, experiment tokens stay in token files, and `secret_env` values are not rendered or exported.
39
+ - Open-source documentation set with English canonical docs and synchronized Chinese `*_cn.md` companions.
40
+
41
+ ## Current Status
42
+
43
+ The current V1 implementation is runnable and has a closed current-worktree evidence ledger. The product contract remains [docs/blueprint.md](docs/blueprint.md); detailed requirement evidence lives in [docs/completion_audit.md](docs/completion_audit.md); current progress and active queues live in [docs/progress.md](docs/progress.md) and [docs/progress_pipeline.md](docs/progress_pipeline.md).
44
+
45
+ ## Environment Requirements
46
+
47
+ Required:
48
+
49
+ - macOS or Linux. Windows is not part of V1 acceptance testing.
50
+ - Python 3.11 or newer.
51
+ - Git.
52
+ - [`uv`](https://docs.astral.sh/uv/) for the project-local Python environment and locked dependency resolution.
53
+
54
+ Optional:
55
+
56
+ - Docker, only for Docker runner and Harbor/SkyDiscover Docker evaluator workflows.
57
+ - Network access to Python package indexes for dependency-installing evaluator tests.
58
+ - Network access to GitHub for live SkyDiscover catalog validation.
59
+ - Codex CLI or another external agent runtime if you want autonomous workers; ALab itself does not launch agents.
60
+
61
+ Local environment variables are documented in [.env.example](.env.example). Real `.env` files are ignored; do not commit root keys, project admin keys, experiment tokens, or secret values.
62
+
63
+ ## Installation
64
+
65
+ ALab is distributed as the `alab-cli` Python package and installs the `alab` console script. Once the package is published to a Python package index, install it directly with pip:
66
+
67
+ ```sh
68
+ python -m pip install alab-cli
69
+ alab help
70
+ ```
71
+
72
+ Until then, install from a checkout or Git URL:
73
+
74
+ ```sh
75
+ python -m pip install "git+https://github.com/bebetterest/ALab.git"
76
+ ```
77
+
78
+ Or, from an already cloned checkout:
79
+
80
+ ```sh
81
+ git clone https://github.com/bebetterest/ALab.git ALab
82
+ cd ALab
83
+ python -m pip install .
84
+ alab help
85
+ ```
86
+
87
+ For editable local development with the installed command:
88
+
89
+ ```sh
90
+ python -m pip install -e .
91
+ alab help
92
+ ```
93
+
94
+ If you prefer an isolated CLI tool environment, `uv` can install the same console script:
95
+
96
+ ```sh
97
+ uv tool install --editable .
98
+ alab help
99
+ ```
100
+
101
+ If `pip` or `uv` installs the command into a directory that is not on `PATH`, add the displayed script directory to your shell path.
102
+
103
+ For repository development and locked local verification, use the checkout environment instead:
104
+
105
+ ```sh
106
+ uv sync --locked
107
+ uv run --locked alab help
108
+ ```
109
+
110
+ Run the default validation suite:
111
+
112
+ ```sh
113
+ uv run --locked pytest -q
114
+ uv run --locked ruff check
115
+ ```
116
+
117
+ If a local package mirror is slow or unavailable, use the official Python index for the current command:
118
+
119
+ ```sh
120
+ UV_CACHE_DIR=.uv-cache UV_DEFAULT_INDEX=https://pypi.org/simple uv run --locked pytest -q
121
+ ```
122
+
123
+ If dependency downloads are unavailable but the current Python environment already has the required test dependencies, the source tree can still be exercised directly:
124
+
125
+ ```sh
126
+ PYTHONPATH=src python -m pytest -q
127
+ ```
128
+
129
+ ## Quick Start
130
+
131
+ This local runner example creates an isolated ALab home under the repository, initializes a project from a small Python source tree, creates one experiment, runs evaluation, and submits the result.
132
+
133
+ The commands below assume `alab` is installed. If you are working only from the checkout, replace `alab` with `uv run --locked alab` while inside the repository, or with `uv run --project /absolute/path/to/ALab --locked alab` from an experiment worktree.
134
+
135
+ Create a demo source and config:
136
+
137
+ ```sh
138
+ mkdir -p .alab-demo/source
139
+ cat > .alab-demo/source/main.py <<'PY'
140
+ print("reward=1.0")
141
+ PY
142
+
143
+ cat > .alab-demo/alab.project.toml <<'TOML'
144
+ [runner]
145
+ type = "local"
146
+ command = ["python", "main.py"]
147
+ timeout_seconds = 60
148
+ working_directory = "."
149
+ env_mode = "sanitized"
150
+
151
+ [reward]
152
+ type = "stdout_regex"
153
+ direction = "maximize"
154
+ primary_metric = "reward"
155
+ pattern = "reward=([0-9.]+)"
156
+ TOML
157
+ ```
158
+
159
+ Initialize an ALab home. The root key is printed once:
160
+
161
+ ```sh
162
+ ALAB_HOME="$PWD/.alab-demo/home" alab auth init
163
+ ```
164
+
165
+ Initialize the project with the printed root key:
166
+
167
+ ```sh
168
+ ALAB_HOME="$PWD/.alab-demo/home" alab project init local \
169
+ --config .alab-demo/alab.project.toml \
170
+ --source-path .alab-demo/source \
171
+ --name "Demo" \
172
+ --task "Keep the reward output passing" \
173
+ --key <root-key>
174
+ ```
175
+
176
+ Create an experiment. Public experiment creation is enabled by default for local agent bootstrap:
177
+
178
+ ```sh
179
+ ALAB_HOME="$PWD/.alab-demo/home" alab exp create \
180
+ --project <project-id> \
181
+ --name "attempt-1"
182
+ ```
183
+
184
+ Enter the rendered worktree path, run the evaluator, and submit after a passed run:
185
+
186
+ ```sh
187
+ cd <worktree-path>
188
+ ALAB_HOME="/absolute/path/to/ALab/.alab-demo/home" alab status
189
+ ALAB_HOME="/absolute/path/to/ALab/.alab-demo/home" alab run --message "baseline demo run"
190
+ ALAB_HOME="/absolute/path/to/ALab/.alab-demo/home" alab submit \
191
+ --message "final demo candidate" \
192
+ --summary "The demo candidate prints a parseable reward." \
193
+ --feedback "The latest run passed with reward 1.0." \
194
+ --ref none
195
+ ```
196
+
197
+ Useful next commands:
198
+
199
+ ```sh
200
+ alab help
201
+ alab observe experiments list
202
+ alab observe runs list --exp <exp-id>
203
+ alab observe experiments best
204
+ ```
205
+
206
+ ## Core Concepts
207
+
208
+ - **Home**: local ALab state root containing SQLite records, config, caches, backups, and project storage.
209
+ - **Project**: task, goal, config, source registry, validation records, visibility policy, and project admin boundary.
210
+ - **Source**: immutable snapshot imported from a local path, Git repo, empty source, Harbor task source, or SkyDiscover initial program.
211
+ - **Experiment**: isolated Git branch/worktree bound to exactly one source and one config version.
212
+ - **Run**: one evaluator execution for an experiment commit, with status, reward, logs, artifacts, and warning codes.
213
+ - **Submit**: closes an experiment with final summary, feedback, final run, final commit, and explicit refs.
214
+ - **Inspection checkout**: read-only checkout for observing/exporting scoped experiment evidence without becoming submit-capable.
215
+
216
+ ## Configuration
217
+
218
+ Project behavior is controlled by TOML config:
219
+
220
+ - `[runner]`: runner type, command/shell, working directory, timeout, Docker fields, Harbor task refs, or SkyDiscover task refs.
221
+ - `[reward]`: reward type and primary metric. Supported reward families include `exit_code`, `file`, `stdout_regex`, `harbor`, and `skydiscover`.
222
+ - `[artifacts]` and `[logs]`: captured output roots, glob patterns, and byte limits.
223
+ - `[env]` and `[secret_env]`: explicit environment injection. Secret values are local plaintext but are not rendered or exported.
224
+ - `[mutable]`: paths the experiment may change when running or submitting.
225
+ - Visibility/public bootstrap policy: controls how experiments can see prior work and whether local no-key experiment creation is allowed.
226
+
227
+ See [docs/spec_runners_adapters.md](docs/spec_runners_adapters.md), [docs/spec_project_source_experiment.md](docs/spec_project_source_experiment.md), and [docs/spec_observe_collaboration.md](docs/spec_observe_collaboration.md) for the detailed contracts.
228
+
229
+ ## Examples
230
+
231
+ - [examples/skydiscover_circle_packing_codex](examples/skydiscover_circle_packing_codex/): complete SkyDiscover circle-packing example with setup, single Codex worker run, project-controller loop, report collection, and real-run notes.
232
+
233
+ The repository also includes Codex-facing role skills under [skills](skills/). They are external runbooks for operating ALab through the CLI as an experiment worker, project controller, or global admin; they do not add an embedded agent launcher to ALab.
234
+
235
+ ## Testing And Development
236
+
237
+ Default checks:
238
+
239
+ ```sh
240
+ UV_CACHE_DIR=.uv-cache UV_DEFAULT_INDEX=https://pypi.org/simple uv run --locked pytest -q
241
+ UV_CACHE_DIR=.uv-cache UV_DEFAULT_INDEX=https://pypi.org/simple uv run --locked ruff check
242
+ ```
243
+
244
+ Opt-in integration gates are excluded from the default suite:
245
+
246
+ ```sh
247
+ ALAB_RUN_REAL_DOCKER=1 UV_CACHE_DIR=.uv-cache UV_DEFAULT_INDEX=https://pypi.org/simple uv run pytest -m real_docker
248
+ ALAB_RUN_REAL_SKYDISCOVER_PYTHON=1 UV_CACHE_DIR=.uv-cache uv run pytest -m real_skydiscover_python
249
+ ALAB_RUN_NETWORKED_SKYDISCOVER_PYTHON=1 UV_CACHE_DIR=.uv-cache UV_DEFAULT_INDEX=https://pypi.org/simple uv run pytest -m networked_skydiscover_python
250
+ ALAB_RUN_NATIVE_SKYDISCOVER_PYTHON=1 UV_CACHE_DIR=.uv-cache UV_DEFAULT_INDEX=https://pypi.org/simple uv run pytest -m native_skydiscover_python
251
+ ALAB_RUN_LIVE_SKYDISCOVER_CATALOG=1 UV_CACHE_DIR=.uv-cache uv run pytest -m live_skydiscover_catalog
252
+ ```
253
+
254
+ Notes:
255
+
256
+ - `uv.lock` is tracked because CI and local validation use `uv run --locked`.
257
+ - Keep local cache/output paths ignored (`.uv-cache/`, `.pytest_cache/`, `.ruff_cache/`, `.alab-demo/`, `.env`).
258
+ - GitHub Actions runs the default lint and pytest suite on pull requests and pushes to `main`; real Docker and live/networked SkyDiscover gates remain manual workflow inputs.
259
+ - Pushes to `main` check PyPI for the current `pyproject.toml` package version; if that exact version is missing, CI builds and publishes through PyPI Trusted Publishing, otherwise it skips publishing.
260
+ - The PyPI `alab-cli` project must trust repository `bebetterest/ALab`, workflow `ci.yml`, and environment `pypi` before the first automated publish can succeed.
261
+
262
+ ## Security And Data Model
263
+
264
+ ALab V1 is a local collaboration boundary, not a multi-user security product:
265
+
266
+ - Raw root/admin keys are printed only at creation/regeneration.
267
+ - Raw experiment tokens are written to token files and are not printed.
268
+ - Credential verifiers are stored; raw credential secrets are not.
269
+ - Project records are local plaintext SQLite/filesystem data.
270
+ - `secret_env` values are local plaintext, redacted from rendered logs where configured, and never exported by config commands.
271
+ - Artifact exports are exact captured bytes and are not automatically redacted.
272
+
273
+ ## Repository Structure
274
+
275
+ ```text
276
+ .
277
+ ├── .github/
278
+ │ └── workflows/
279
+ │ └── ci.yml
280
+ ├── docs/
281
+ │ ├── assets/
282
+ │ │ └── readme-header.png
283
+ │ ├── blueprint.md
284
+ │ ├── blueprint_cn.md
285
+ │ ├── completion_audit.md
286
+ │ ├── completion_audit_cn.md
287
+ │ ├── progress.md
288
+ │ ├── progress_cn.md
289
+ │ ├── progress_pipeline.md
290
+ │ └── progress_pipeline_cn.md
291
+ ├── examples/
292
+ │ └── skydiscover_circle_packing_codex/
293
+ ├── skills/
294
+ │ ├── alab-experiment-worker/
295
+ │ ├── alab-project-controller/
296
+ │ └── alab-global-admin/
297
+ ├── src/
298
+ │ └── alab/
299
+ ├── tests/
300
+ │ ├── test_smoke.py
301
+ │ ├── test_cli_contract.py
302
+ │ ├── test_runner_docker.py
303
+ │ ├── test_runner_harbor.py
304
+ │ └── test_runner_skydiscover.py
305
+ ├── LICENSE
306
+ ├── .env.example
307
+ ├── pyproject.toml
308
+ ├── uv.lock
309
+ ├── README.md
310
+ └── README_cn.md
311
+ ```
312
+
313
+ Local-only agent notes such as `AGENTS.md` and `CORE.md` are intentionally git-ignored and are not part of the public repository layout.
314
+
315
+ ## Documentation
316
+
317
+ - English documentation is canonical.
318
+ - Synchronized Chinese documents use the `*_cn.md` naming pattern.
319
+ - [docs/blueprint.md](docs/blueprint.md) is the V1 product overview.
320
+ - [docs/spec_cli.md](docs/spec_cli.md), [docs/spec_storage_auth_context.md](docs/spec_storage_auth_context.md), [docs/spec_project_source_experiment.md](docs/spec_project_source_experiment.md), [docs/spec_lifecycle.md](docs/spec_lifecycle.md), [docs/spec_runners_adapters.md](docs/spec_runners_adapters.md), [docs/spec_observe_collaboration.md](docs/spec_observe_collaboration.md), and [docs/spec_tests.md](docs/spec_tests.md) define subsystem contracts.
321
+ - [docs/progress.md](docs/progress.md), [docs/progress_pipeline.md](docs/progress_pipeline.md), [docs/progress_closed_gaps.md](docs/progress_closed_gaps.md), and [docs/progress_log.md](docs/progress_log.md) track current state, active queues, closed gaps, and history.
322
+ - [docs/completion_audit.md](docs/completion_audit.md) tracks requirement-level evidence.
323
+
324
+ ## Contributing
325
+
326
+ - Keep changes scoped and aligned with the blueprint/spec contracts.
327
+ - Update English docs first, then synchronize the matching Chinese `*_cn.md` file.
328
+ - Add focused tests for new behavior and run the relevant pytest/ruff commands before opening a PR.
329
+ - Do not commit real `.env` files, raw keys, experiment tokens, generated caches, local ALab homes, or private runner outputs.
330
+
331
+ ## License
332
+
333
+ The project license is `GPL-3.0-or-later`; see [LICENSE](LICENSE).
@@ -0,0 +1,314 @@
1
+ # ALab
2
+
3
+ <p align="center">
4
+ <img src="docs/assets/readme-header.png" alt="Hand-drawn ALab virtual experiment workbench banner" width="100%">
5
+ </p>
6
+
7
+ ALab is a local, agent-first Python CLI workbench for iterative experiments. It lets external agents work in isolated Git worktrees, run repeatable evaluations, submit final results, and inspect visible prior experiment evidence through explicit collaboration boundaries.
8
+
9
+ ALab V1 is intentionally local-only: no server, sync service, web UI, built-in agent launcher, or account system. It owns the local project records, source snapshots, experiment lifecycle, runner execution, logs, artifacts, and visibility rules; agents remain external CLI operators.
10
+
11
+ ## Highlights
12
+
13
+ - Local CLI workbench for projects, sources, experiments, runs, submissions, logs, artifacts, annotations, and audits.
14
+ - Context-aware command surface: `alab help` and command preflight show only what the current project, experiment, inspection checkout, token, or explicit key can use.
15
+ - Git-backed experiment isolation: each experiment is an isolated branch/worktree with a worktree token for run and submit operations.
16
+ - Reproducible project setup: project config controls runner, reward, artifact capture, environment, secrets, mutable paths, and visibility.
17
+ - Runner support for local subprocesses, Docker images/Dockerfiles, Harbor verifiers, and SkyDiscover Python/Docker evaluators.
18
+ - Collaboration boundary, not strong local security: root/admin keys and experiment tokens gate CLI capabilities, while local project records remain plaintext.
19
+ - Secret hygiene: raw keys/tokens are not stored; generated raw keys are printed once, experiment tokens stay in token files, and `secret_env` values are not rendered or exported.
20
+ - Open-source documentation set with English canonical docs and synchronized Chinese `*_cn.md` companions.
21
+
22
+ ## Current Status
23
+
24
+ The current V1 implementation is runnable and has a closed current-worktree evidence ledger. The product contract remains [docs/blueprint.md](docs/blueprint.md); detailed requirement evidence lives in [docs/completion_audit.md](docs/completion_audit.md); current progress and active queues live in [docs/progress.md](docs/progress.md) and [docs/progress_pipeline.md](docs/progress_pipeline.md).
25
+
26
+ ## Environment Requirements
27
+
28
+ Required:
29
+
30
+ - macOS or Linux. Windows is not part of V1 acceptance testing.
31
+ - Python 3.11 or newer.
32
+ - Git.
33
+ - [`uv`](https://docs.astral.sh/uv/) for the project-local Python environment and locked dependency resolution.
34
+
35
+ Optional:
36
+
37
+ - Docker, only for Docker runner and Harbor/SkyDiscover Docker evaluator workflows.
38
+ - Network access to Python package indexes for dependency-installing evaluator tests.
39
+ - Network access to GitHub for live SkyDiscover catalog validation.
40
+ - Codex CLI or another external agent runtime if you want autonomous workers; ALab itself does not launch agents.
41
+
42
+ Local environment variables are documented in [.env.example](.env.example). Real `.env` files are ignored; do not commit root keys, project admin keys, experiment tokens, or secret values.
43
+
44
+ ## Installation
45
+
46
+ ALab is distributed as the `alab-cli` Python package and installs the `alab` console script. Once the package is published to a Python package index, install it directly with pip:
47
+
48
+ ```sh
49
+ python -m pip install alab-cli
50
+ alab help
51
+ ```
52
+
53
+ Until then, install from a checkout or Git URL:
54
+
55
+ ```sh
56
+ python -m pip install "git+https://github.com/bebetterest/ALab.git"
57
+ ```
58
+
59
+ Or, from an already cloned checkout:
60
+
61
+ ```sh
62
+ git clone https://github.com/bebetterest/ALab.git ALab
63
+ cd ALab
64
+ python -m pip install .
65
+ alab help
66
+ ```
67
+
68
+ For editable local development with the installed command:
69
+
70
+ ```sh
71
+ python -m pip install -e .
72
+ alab help
73
+ ```
74
+
75
+ If you prefer an isolated CLI tool environment, `uv` can install the same console script:
76
+
77
+ ```sh
78
+ uv tool install --editable .
79
+ alab help
80
+ ```
81
+
82
+ If `pip` or `uv` installs the command into a directory that is not on `PATH`, add the displayed script directory to your shell path.
83
+
84
+ For repository development and locked local verification, use the checkout environment instead:
85
+
86
+ ```sh
87
+ uv sync --locked
88
+ uv run --locked alab help
89
+ ```
90
+
91
+ Run the default validation suite:
92
+
93
+ ```sh
94
+ uv run --locked pytest -q
95
+ uv run --locked ruff check
96
+ ```
97
+
98
+ If a local package mirror is slow or unavailable, use the official Python index for the current command:
99
+
100
+ ```sh
101
+ UV_CACHE_DIR=.uv-cache UV_DEFAULT_INDEX=https://pypi.org/simple uv run --locked pytest -q
102
+ ```
103
+
104
+ If dependency downloads are unavailable but the current Python environment already has the required test dependencies, the source tree can still be exercised directly:
105
+
106
+ ```sh
107
+ PYTHONPATH=src python -m pytest -q
108
+ ```
109
+
110
+ ## Quick Start
111
+
112
+ This local runner example creates an isolated ALab home under the repository, initializes a project from a small Python source tree, creates one experiment, runs evaluation, and submits the result.
113
+
114
+ The commands below assume `alab` is installed. If you are working only from the checkout, replace `alab` with `uv run --locked alab` while inside the repository, or with `uv run --project /absolute/path/to/ALab --locked alab` from an experiment worktree.
115
+
116
+ Create a demo source and config:
117
+
118
+ ```sh
119
+ mkdir -p .alab-demo/source
120
+ cat > .alab-demo/source/main.py <<'PY'
121
+ print("reward=1.0")
122
+ PY
123
+
124
+ cat > .alab-demo/alab.project.toml <<'TOML'
125
+ [runner]
126
+ type = "local"
127
+ command = ["python", "main.py"]
128
+ timeout_seconds = 60
129
+ working_directory = "."
130
+ env_mode = "sanitized"
131
+
132
+ [reward]
133
+ type = "stdout_regex"
134
+ direction = "maximize"
135
+ primary_metric = "reward"
136
+ pattern = "reward=([0-9.]+)"
137
+ TOML
138
+ ```
139
+
140
+ Initialize an ALab home. The root key is printed once:
141
+
142
+ ```sh
143
+ ALAB_HOME="$PWD/.alab-demo/home" alab auth init
144
+ ```
145
+
146
+ Initialize the project with the printed root key:
147
+
148
+ ```sh
149
+ ALAB_HOME="$PWD/.alab-demo/home" alab project init local \
150
+ --config .alab-demo/alab.project.toml \
151
+ --source-path .alab-demo/source \
152
+ --name "Demo" \
153
+ --task "Keep the reward output passing" \
154
+ --key <root-key>
155
+ ```
156
+
157
+ Create an experiment. Public experiment creation is enabled by default for local agent bootstrap:
158
+
159
+ ```sh
160
+ ALAB_HOME="$PWD/.alab-demo/home" alab exp create \
161
+ --project <project-id> \
162
+ --name "attempt-1"
163
+ ```
164
+
165
+ Enter the rendered worktree path, run the evaluator, and submit after a passed run:
166
+
167
+ ```sh
168
+ cd <worktree-path>
169
+ ALAB_HOME="/absolute/path/to/ALab/.alab-demo/home" alab status
170
+ ALAB_HOME="/absolute/path/to/ALab/.alab-demo/home" alab run --message "baseline demo run"
171
+ ALAB_HOME="/absolute/path/to/ALab/.alab-demo/home" alab submit \
172
+ --message "final demo candidate" \
173
+ --summary "The demo candidate prints a parseable reward." \
174
+ --feedback "The latest run passed with reward 1.0." \
175
+ --ref none
176
+ ```
177
+
178
+ Useful next commands:
179
+
180
+ ```sh
181
+ alab help
182
+ alab observe experiments list
183
+ alab observe runs list --exp <exp-id>
184
+ alab observe experiments best
185
+ ```
186
+
187
+ ## Core Concepts
188
+
189
+ - **Home**: local ALab state root containing SQLite records, config, caches, backups, and project storage.
190
+ - **Project**: task, goal, config, source registry, validation records, visibility policy, and project admin boundary.
191
+ - **Source**: immutable snapshot imported from a local path, Git repo, empty source, Harbor task source, or SkyDiscover initial program.
192
+ - **Experiment**: isolated Git branch/worktree bound to exactly one source and one config version.
193
+ - **Run**: one evaluator execution for an experiment commit, with status, reward, logs, artifacts, and warning codes.
194
+ - **Submit**: closes an experiment with final summary, feedback, final run, final commit, and explicit refs.
195
+ - **Inspection checkout**: read-only checkout for observing/exporting scoped experiment evidence without becoming submit-capable.
196
+
197
+ ## Configuration
198
+
199
+ Project behavior is controlled by TOML config:
200
+
201
+ - `[runner]`: runner type, command/shell, working directory, timeout, Docker fields, Harbor task refs, or SkyDiscover task refs.
202
+ - `[reward]`: reward type and primary metric. Supported reward families include `exit_code`, `file`, `stdout_regex`, `harbor`, and `skydiscover`.
203
+ - `[artifacts]` and `[logs]`: captured output roots, glob patterns, and byte limits.
204
+ - `[env]` and `[secret_env]`: explicit environment injection. Secret values are local plaintext but are not rendered or exported.
205
+ - `[mutable]`: paths the experiment may change when running or submitting.
206
+ - Visibility/public bootstrap policy: controls how experiments can see prior work and whether local no-key experiment creation is allowed.
207
+
208
+ See [docs/spec_runners_adapters.md](docs/spec_runners_adapters.md), [docs/spec_project_source_experiment.md](docs/spec_project_source_experiment.md), and [docs/spec_observe_collaboration.md](docs/spec_observe_collaboration.md) for the detailed contracts.
209
+
210
+ ## Examples
211
+
212
+ - [examples/skydiscover_circle_packing_codex](examples/skydiscover_circle_packing_codex/): complete SkyDiscover circle-packing example with setup, single Codex worker run, project-controller loop, report collection, and real-run notes.
213
+
214
+ The repository also includes Codex-facing role skills under [skills](skills/). They are external runbooks for operating ALab through the CLI as an experiment worker, project controller, or global admin; they do not add an embedded agent launcher to ALab.
215
+
216
+ ## Testing And Development
217
+
218
+ Default checks:
219
+
220
+ ```sh
221
+ UV_CACHE_DIR=.uv-cache UV_DEFAULT_INDEX=https://pypi.org/simple uv run --locked pytest -q
222
+ UV_CACHE_DIR=.uv-cache UV_DEFAULT_INDEX=https://pypi.org/simple uv run --locked ruff check
223
+ ```
224
+
225
+ Opt-in integration gates are excluded from the default suite:
226
+
227
+ ```sh
228
+ ALAB_RUN_REAL_DOCKER=1 UV_CACHE_DIR=.uv-cache UV_DEFAULT_INDEX=https://pypi.org/simple uv run pytest -m real_docker
229
+ ALAB_RUN_REAL_SKYDISCOVER_PYTHON=1 UV_CACHE_DIR=.uv-cache uv run pytest -m real_skydiscover_python
230
+ ALAB_RUN_NETWORKED_SKYDISCOVER_PYTHON=1 UV_CACHE_DIR=.uv-cache UV_DEFAULT_INDEX=https://pypi.org/simple uv run pytest -m networked_skydiscover_python
231
+ ALAB_RUN_NATIVE_SKYDISCOVER_PYTHON=1 UV_CACHE_DIR=.uv-cache UV_DEFAULT_INDEX=https://pypi.org/simple uv run pytest -m native_skydiscover_python
232
+ ALAB_RUN_LIVE_SKYDISCOVER_CATALOG=1 UV_CACHE_DIR=.uv-cache uv run pytest -m live_skydiscover_catalog
233
+ ```
234
+
235
+ Notes:
236
+
237
+ - `uv.lock` is tracked because CI and local validation use `uv run --locked`.
238
+ - Keep local cache/output paths ignored (`.uv-cache/`, `.pytest_cache/`, `.ruff_cache/`, `.alab-demo/`, `.env`).
239
+ - GitHub Actions runs the default lint and pytest suite on pull requests and pushes to `main`; real Docker and live/networked SkyDiscover gates remain manual workflow inputs.
240
+ - Pushes to `main` check PyPI for the current `pyproject.toml` package version; if that exact version is missing, CI builds and publishes through PyPI Trusted Publishing, otherwise it skips publishing.
241
+ - The PyPI `alab-cli` project must trust repository `bebetterest/ALab`, workflow `ci.yml`, and environment `pypi` before the first automated publish can succeed.
242
+
243
+ ## Security And Data Model
244
+
245
+ ALab V1 is a local collaboration boundary, not a multi-user security product:
246
+
247
+ - Raw root/admin keys are printed only at creation/regeneration.
248
+ - Raw experiment tokens are written to token files and are not printed.
249
+ - Credential verifiers are stored; raw credential secrets are not.
250
+ - Project records are local plaintext SQLite/filesystem data.
251
+ - `secret_env` values are local plaintext, redacted from rendered logs where configured, and never exported by config commands.
252
+ - Artifact exports are exact captured bytes and are not automatically redacted.
253
+
254
+ ## Repository Structure
255
+
256
+ ```text
257
+ .
258
+ ├── .github/
259
+ │ └── workflows/
260
+ │ └── ci.yml
261
+ ├── docs/
262
+ │ ├── assets/
263
+ │ │ └── readme-header.png
264
+ │ ├── blueprint.md
265
+ │ ├── blueprint_cn.md
266
+ │ ├── completion_audit.md
267
+ │ ├── completion_audit_cn.md
268
+ │ ├── progress.md
269
+ │ ├── progress_cn.md
270
+ │ ├── progress_pipeline.md
271
+ │ └── progress_pipeline_cn.md
272
+ ├── examples/
273
+ │ └── skydiscover_circle_packing_codex/
274
+ ├── skills/
275
+ │ ├── alab-experiment-worker/
276
+ │ ├── alab-project-controller/
277
+ │ └── alab-global-admin/
278
+ ├── src/
279
+ │ └── alab/
280
+ ├── tests/
281
+ │ ├── test_smoke.py
282
+ │ ├── test_cli_contract.py
283
+ │ ├── test_runner_docker.py
284
+ │ ├── test_runner_harbor.py
285
+ │ └── test_runner_skydiscover.py
286
+ ├── LICENSE
287
+ ├── .env.example
288
+ ├── pyproject.toml
289
+ ├── uv.lock
290
+ ├── README.md
291
+ └── README_cn.md
292
+ ```
293
+
294
+ Local-only agent notes such as `AGENTS.md` and `CORE.md` are intentionally git-ignored and are not part of the public repository layout.
295
+
296
+ ## Documentation
297
+
298
+ - English documentation is canonical.
299
+ - Synchronized Chinese documents use the `*_cn.md` naming pattern.
300
+ - [docs/blueprint.md](docs/blueprint.md) is the V1 product overview.
301
+ - [docs/spec_cli.md](docs/spec_cli.md), [docs/spec_storage_auth_context.md](docs/spec_storage_auth_context.md), [docs/spec_project_source_experiment.md](docs/spec_project_source_experiment.md), [docs/spec_lifecycle.md](docs/spec_lifecycle.md), [docs/spec_runners_adapters.md](docs/spec_runners_adapters.md), [docs/spec_observe_collaboration.md](docs/spec_observe_collaboration.md), and [docs/spec_tests.md](docs/spec_tests.md) define subsystem contracts.
302
+ - [docs/progress.md](docs/progress.md), [docs/progress_pipeline.md](docs/progress_pipeline.md), [docs/progress_closed_gaps.md](docs/progress_closed_gaps.md), and [docs/progress_log.md](docs/progress_log.md) track current state, active queues, closed gaps, and history.
303
+ - [docs/completion_audit.md](docs/completion_audit.md) tracks requirement-level evidence.
304
+
305
+ ## Contributing
306
+
307
+ - Keep changes scoped and aligned with the blueprint/spec contracts.
308
+ - Update English docs first, then synchronize the matching Chinese `*_cn.md` file.
309
+ - Add focused tests for new behavior and run the relevant pytest/ruff commands before opening a PR.
310
+ - Do not commit real `.env` files, raw keys, experiment tokens, generated caches, local ALab homes, or private runner outputs.
311
+
312
+ ## License
313
+
314
+ The project license is `GPL-3.0-or-later`; see [LICENSE](LICENSE).