cybervisor 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.
- cybervisor-0.1.0/PKG-INFO +289 -0
- cybervisor-0.1.0/README.md +268 -0
- cybervisor-0.1.0/pyproject.toml +66 -0
- cybervisor-0.1.0/setup.cfg +4 -0
- cybervisor-0.1.0/src/cybervisor/__init__.py +3 -0
- cybervisor-0.1.0/src/cybervisor/__main__.py +3 -0
- cybervisor-0.1.0/src/cybervisor/adapters/__init__.py +3 -0
- cybervisor-0.1.0/src/cybervisor/adapters/base.py +147 -0
- cybervisor-0.1.0/src/cybervisor/adapters/claude/__init__.py +3 -0
- cybervisor-0.1.0/src/cybervisor/adapters/claude/adapter.py +118 -0
- cybervisor-0.1.0/src/cybervisor/adapters/claude/stream.py +150 -0
- cybervisor-0.1.0/src/cybervisor/adapters/gemini/__init__.py +3 -0
- cybervisor-0.1.0/src/cybervisor/adapters/gemini/adapter.py +128 -0
- cybervisor-0.1.0/src/cybervisor/adapters/gemini/hook_context.py +112 -0
- cybervisor-0.1.0/src/cybervisor/adapters/gemini/stream.py +130 -0
- cybervisor-0.1.0/src/cybervisor/adapters/mock/__init__.py +3 -0
- cybervisor-0.1.0/src/cybervisor/adapters/mock/adapter.py +30 -0
- cybervisor-0.1.0/src/cybervisor/adapters/registry.py +55 -0
- cybervisor-0.1.0/src/cybervisor/adapters/types.py +45 -0
- cybervisor-0.1.0/src/cybervisor/agent_hook.py +29 -0
- cybervisor-0.1.0/src/cybervisor/assets/__init__.py +0 -0
- cybervisor-0.1.0/src/cybervisor/assets/hooks/__init__.py +0 -0
- cybervisor-0.1.0/src/cybervisor/assets/hooks/stop-hook-verifier.md +13 -0
- cybervisor-0.1.0/src/cybervisor/cli.py +231 -0
- cybervisor-0.1.0/src/cybervisor/config.py +251 -0
- cybervisor-0.1.0/src/cybervisor/core_hooks/__init__.py +0 -0
- cybervisor-0.1.0/src/cybervisor/core_hooks/runner.py +837 -0
- cybervisor-0.1.0/src/cybervisor/env.py +32 -0
- cybervisor-0.1.0/src/cybervisor/hooks.py +238 -0
- cybervisor-0.1.0/src/cybervisor/logging.py +289 -0
- cybervisor-0.1.0/src/cybervisor/pipeline.py +504 -0
- cybervisor-0.1.0/src/cybervisor/preflight.py +34 -0
- cybervisor-0.1.0/src/cybervisor/signals.py +104 -0
- cybervisor-0.1.0/src/cybervisor/stream_logging.py +214 -0
- cybervisor-0.1.0/src/cybervisor.egg-info/PKG-INFO +289 -0
- cybervisor-0.1.0/src/cybervisor.egg-info/SOURCES.txt +39 -0
- cybervisor-0.1.0/src/cybervisor.egg-info/dependency_links.txt +1 -0
- cybervisor-0.1.0/src/cybervisor.egg-info/entry_points.txt +3 -0
- cybervisor-0.1.0/src/cybervisor.egg-info/requires.txt +5 -0
- cybervisor-0.1.0/src/cybervisor.egg-info/top_level.txt +1 -0
- cybervisor-0.1.0/tests/test_env.py +31 -0
|
@@ -0,0 +1,289 @@
|
|
|
1
|
+
Metadata-Version: 2.4
|
|
2
|
+
Name: cybervisor
|
|
3
|
+
Version: 0.1.0
|
|
4
|
+
Summary: Autonomous CLI supervisor for staged AI workflows
|
|
5
|
+
Author: crzidea
|
|
6
|
+
Project-URL: Homepage, https://github.com/crzidea/cybervisor
|
|
7
|
+
Project-URL: Repository, https://github.com/crzidea/cybervisor
|
|
8
|
+
Project-URL: Issues, https://github.com/crzidea/cybervisor/issues
|
|
9
|
+
Classifier: Development Status :: 3 - Alpha
|
|
10
|
+
Classifier: Environment :: Console
|
|
11
|
+
Classifier: Intended Audience :: Developers
|
|
12
|
+
Classifier: Programming Language :: Python :: 3
|
|
13
|
+
Classifier: Programming Language :: Python :: 3.11
|
|
14
|
+
Classifier: Programming Language :: Python :: 3.12
|
|
15
|
+
Classifier: Typing :: Typed
|
|
16
|
+
Requires-Python: >=3.11
|
|
17
|
+
Description-Content-Type: text/markdown
|
|
18
|
+
Requires-Dist: httpx>=0.27.0
|
|
19
|
+
Requires-Dist: pyyaml>=6.0.3
|
|
20
|
+
Requires-Dist: setproctitle>=1.3.4; platform_system != "Windows"
|
|
21
|
+
|
|
22
|
+
# cybervisor
|
|
23
|
+
|
|
24
|
+
`cybervisor` is an autonomous CLI supervisor for development runs. It executes a default 5-stage pipeline with Gemini CLI, Claude Code, or a mock agent, supports customizing stages in YAML config, installs runtime hooks for non-interactive execution, enforces optional stage-result contracts, and keeps audit logs in JSONL.
|
|
25
|
+
|
|
26
|
+
## What it does
|
|
27
|
+
|
|
28
|
+
- Runs the default five ordered stages: `Spec`, `Review Spec`, `Implement`, `Review Code`, `Verify`
|
|
29
|
+
- Allows custom stage lists in `cybervisor.yaml`
|
|
30
|
+
- Supports optional structured stage-result contracts and artifact-driven routing
|
|
31
|
+
- Fails fast when the selected agent CLI or hook verifier credentials are missing
|
|
32
|
+
- Writes non-secret hook runtime metadata and settings snapshots under `.cybervisor/hooks/` for non-mock runs
|
|
33
|
+
- Keeps verifier credentials in inherited `CYBERVISOR_LLM_*` env vars instead of persisting them under `.cybervisor/hooks/`
|
|
34
|
+
- Snapshots `.gemini/settings.json` or `.claude/settings.json` and restores the exact pre-run content on exit
|
|
35
|
+
- Streams live agent output to stderr and persists per-stage logs under `.cybervisor/`
|
|
36
|
+
- Exits with `130` on `SIGINT` or `SIGTERM` after cleanup
|
|
37
|
+
|
|
38
|
+
## Requirements
|
|
39
|
+
|
|
40
|
+
- Python 3.11+
|
|
41
|
+
- [`uv`](https://docs.astral.sh/uv/)
|
|
42
|
+
- One of:
|
|
43
|
+
- `gemini` on `PATH`
|
|
44
|
+
- `claude` on `PATH`
|
|
45
|
+
- `mock` mode for local deterministic runs
|
|
46
|
+
- `CYBERVISOR_LLM_API_KEY` for non-mock runs
|
|
47
|
+
|
|
48
|
+
Optional local env loading is supported from `.env` in the working directory. `cybervisor` reads only `CYBERVISOR_LLM_BASE_URL`, `CYBERVISOR_LLM_API_KEY`, and `CYBERVISOR_LLM_MODEL`, and does not override variables already exported in the shell.
|
|
49
|
+
|
|
50
|
+
## Install
|
|
51
|
+
|
|
52
|
+
Install the CLI onto your `PATH`:
|
|
53
|
+
|
|
54
|
+
```bash
|
|
55
|
+
uv tool install -e .
|
|
56
|
+
```
|
|
57
|
+
|
|
58
|
+
After installation, verify:
|
|
59
|
+
|
|
60
|
+
```bash
|
|
61
|
+
cybervisor --version
|
|
62
|
+
```
|
|
63
|
+
|
|
64
|
+
Developer fallback if you do not want to install the CLI globally:
|
|
65
|
+
|
|
66
|
+
```bash
|
|
67
|
+
uv run cybervisor --version
|
|
68
|
+
```
|
|
69
|
+
|
|
70
|
+
## Setup
|
|
71
|
+
|
|
72
|
+
```bash
|
|
73
|
+
uv sync
|
|
74
|
+
cp .env.example .env
|
|
75
|
+
```
|
|
76
|
+
|
|
77
|
+
Set at least:
|
|
78
|
+
|
|
79
|
+
```bash
|
|
80
|
+
CYBERVISOR_LLM_API_KEY=...
|
|
81
|
+
# Optional overrides
|
|
82
|
+
# CYBERVISOR_LLM_BASE_URL=https://api.openai.com/v1
|
|
83
|
+
# CYBERVISOR_LLM_MODEL=auto
|
|
84
|
+
```
|
|
85
|
+
|
|
86
|
+
## Usage
|
|
87
|
+
|
|
88
|
+
Minimal run:
|
|
89
|
+
|
|
90
|
+
```bash
|
|
91
|
+
cybervisor "Create a 360 feedback system" --config cybervisor.yaml
|
|
92
|
+
```
|
|
93
|
+
|
|
94
|
+
Start from a specific stage:
|
|
95
|
+
|
|
96
|
+
```bash
|
|
97
|
+
cybervisor "Create a 360 feedback system" --start-stage "Implement"
|
|
98
|
+
```
|
|
99
|
+
|
|
100
|
+
Version and help:
|
|
101
|
+
|
|
102
|
+
```bash
|
|
103
|
+
cybervisor --version
|
|
104
|
+
cybervisor --help
|
|
105
|
+
```
|
|
106
|
+
|
|
107
|
+
Minimal config:
|
|
108
|
+
|
|
109
|
+
```yaml
|
|
110
|
+
pipeline:
|
|
111
|
+
agent_tool: gemini
|
|
112
|
+
|
|
113
|
+
stages:
|
|
114
|
+
- name: Spec
|
|
115
|
+
- name: Review Spec
|
|
116
|
+
- name: Implement
|
|
117
|
+
- name: Review Code
|
|
118
|
+
- name: Verify
|
|
119
|
+
```
|
|
120
|
+
|
|
121
|
+
Notes:
|
|
122
|
+
|
|
123
|
+
- `hook:` values are sourced from `CYBERVISOR_LLM_*` env vars, not from config file literals
|
|
124
|
+
- If a stage omits `prompt_template`, the default template is used
|
|
125
|
+
- If `stages:` is omitted, the default five-stage pipeline is used
|
|
126
|
+
- If `stages:` is provided, `cybervisor` runs the stages exactly as configured
|
|
127
|
+
- Stages may optionally declare a `contract` for required result artifacts and a `next_stage` for explicit success-path routing
|
|
128
|
+
- When a review stage can route `changes_requested` to a correction stage, set that review stage's `next_stage` explicitly for the `approved` path instead of relying on linear order
|
|
129
|
+
- Use `--start-stage STAGE_NAME` to skip earlier stages and begin execution at the named stage
|
|
130
|
+
|
|
131
|
+
Review/fix loop example:
|
|
132
|
+
|
|
133
|
+
```yaml
|
|
134
|
+
pipeline:
|
|
135
|
+
agent_tool: claude
|
|
136
|
+
|
|
137
|
+
stages:
|
|
138
|
+
- name: Implement
|
|
139
|
+
|
|
140
|
+
- name: Review Code
|
|
141
|
+
next_stage: Verify
|
|
142
|
+
prompt_template: |
|
|
143
|
+
Review the implementation.
|
|
144
|
+
Write the final result to .cybervisor/contracts/artifacts/Review Code.yaml.
|
|
145
|
+
contract:
|
|
146
|
+
allowed_statuses: [approved, changes_requested]
|
|
147
|
+
routes:
|
|
148
|
+
changes_requested:
|
|
149
|
+
next_stage: Fix Code
|
|
150
|
+
injections: [summary, details, actions]
|
|
151
|
+
|
|
152
|
+
- name: Fix Code
|
|
153
|
+
next_stage: Review Code
|
|
154
|
+
prompt_template: |
|
|
155
|
+
Fix the issues described by the latest review.
|
|
156
|
+
Full contract:
|
|
157
|
+
{latest_contract_yaml}
|
|
158
|
+
Summary:
|
|
159
|
+
{latest_contract_summary}
|
|
160
|
+
Details:
|
|
161
|
+
{latest_contract_details_yaml}
|
|
162
|
+
Actions:
|
|
163
|
+
{latest_contract_actions_yaml}
|
|
164
|
+
|
|
165
|
+
- name: Verify
|
|
166
|
+
```
|
|
167
|
+
|
|
168
|
+
In this pattern:
|
|
169
|
+
|
|
170
|
+
- `Review Code` with `status: approved` goes to `Verify`
|
|
171
|
+
- `Review Code` with `status: changes_requested` goes to `Fix Code`
|
|
172
|
+
- `Fix Code` loops back to `Review Code`
|
|
173
|
+
- If `Review Code` omitted `next_stage: Verify`, a linear stage list would otherwise fall through to `Fix Code`
|
|
174
|
+
- Contract prompt guides live at `.cybervisor/contracts/prompts/[Stage Name].md`
|
|
175
|
+
|
|
176
|
+
## Runtime behavior
|
|
177
|
+
|
|
178
|
+
For `gemini` and `claude` runs, `cybervisor`:
|
|
179
|
+
|
|
180
|
+
1. Performs preflight checks.
|
|
181
|
+
2. Writes shared hook runtime metadata into `.cybervisor/hooks/`.
|
|
182
|
+
3. Persists an exact settings snapshot in `.cybervisor/hooks/`.
|
|
183
|
+
4. Patches the active tool settings file so the selected agent invokes the packaged `cybervisor-agent-hook` entry point.
|
|
184
|
+
5. Starts the agent in a dedicated process group when supported.
|
|
185
|
+
6. Uses the runtime hook to classify autonomy decisions as `approve` or `block`, then adapts those into the selected tool's native hook output so the agent continues autonomously.
|
|
186
|
+
7. If the active stage declares a contract, uses the same hook runtime to block completion until the required artifact exists and is structurally valid.
|
|
187
|
+
8. Streams agent output into stderr and the stage log file.
|
|
188
|
+
9. Re-validates contract artifacts after agent exit, then routes by contract status or explicit `next_stage` when configured.
|
|
189
|
+
10. Restores settings and removes runtime files on success, failure, or interrupt.
|
|
190
|
+
|
|
191
|
+
Generated artifacts:
|
|
192
|
+
|
|
193
|
+
- `.cybervisor/logs/cybervisor.log.jsonl`: structured run log
|
|
194
|
+
- `.cybervisor/logs/stages/<stage_name>.jsonl`: captured transcript per stage
|
|
195
|
+
- `.cybervisor/contracts/artifacts/*.yaml`: optional stage-result artifacts for contract-enabled stages
|
|
196
|
+
- `.cybervisor/contracts/prompts/*.md`: authored contract prompt guides for contract-enabled stages
|
|
197
|
+
|
|
198
|
+
## Development
|
|
199
|
+
|
|
200
|
+
Validation commands used by this repo:
|
|
201
|
+
|
|
202
|
+
```bash
|
|
203
|
+
uv run mypy --strict src
|
|
204
|
+
uv run pytest
|
|
205
|
+
```
|
|
206
|
+
|
|
207
|
+
Useful focused runs:
|
|
208
|
+
|
|
209
|
+
```bash
|
|
210
|
+
uv run pytest tests/integration/test_pipeline_e2e.py
|
|
211
|
+
uv run pytest tests/unit/test_hooks.py tests/unit/test_pipeline.py tests/unit/test_signals.py
|
|
212
|
+
```
|
|
213
|
+
|
|
214
|
+
## Publish
|
|
215
|
+
|
|
216
|
+
Build distributions:
|
|
217
|
+
|
|
218
|
+
```bash
|
|
219
|
+
uv build
|
|
220
|
+
```
|
|
221
|
+
|
|
222
|
+
Check the generated artifacts locally:
|
|
223
|
+
|
|
224
|
+
```bash
|
|
225
|
+
python -m zipfile -l dist/*.whl
|
|
226
|
+
tar -tf dist/*.tar.gz
|
|
227
|
+
```
|
|
228
|
+
|
|
229
|
+
Upload to PyPI with a token:
|
|
230
|
+
|
|
231
|
+
```bash
|
|
232
|
+
export UV_PUBLISH_TOKEN=your-pypi-token
|
|
233
|
+
uv publish
|
|
234
|
+
```
|
|
235
|
+
|
|
236
|
+
Optional dry run against TestPyPI:
|
|
237
|
+
|
|
238
|
+
```bash
|
|
239
|
+
export UV_PUBLISH_TOKEN=your-testpypi-token
|
|
240
|
+
uv publish --index testpypi
|
|
241
|
+
```
|
|
242
|
+
|
|
243
|
+
If the version already exists on PyPI, bump `version` in `pyproject.toml` and `src/cybervisor/__init__.py` before rebuilding.
|
|
244
|
+
|
|
245
|
+
## Manual demo workflow
|
|
246
|
+
|
|
247
|
+
The repository includes a demo bootstrap helper:
|
|
248
|
+
|
|
249
|
+
```bash
|
|
250
|
+
scripts/e2e-demo-project.sh
|
|
251
|
+
```
|
|
252
|
+
|
|
253
|
+
That script:
|
|
254
|
+
|
|
255
|
+
- creates a fresh demo workspace with `scripts/init-demo-project.sh`
|
|
256
|
+
- supports `--agent-tool claude|gemini` and defaults to `claude`
|
|
257
|
+
- optionally starts a local deterministic hook verifier stub when run with `--with-local-api`
|
|
258
|
+
- copies `templates/demo/.env` into the demo workspace as `.env`
|
|
259
|
+
- prints the exact `cd` and `cybervisor` command to run manually in your shell
|
|
260
|
+
- reminds you to install the CLI first if `cybervisor` is not yet on your `PATH`
|
|
261
|
+
|
|
262
|
+
## Specs Directory
|
|
263
|
+
|
|
264
|
+
Feature folders under `specs/` are archival implementation artifacts after delivery. The current source of truth for runtime behavior is the checked-in code plus the main project docs and constitution.
|
|
265
|
+
|
|
266
|
+
## Repository layout
|
|
267
|
+
|
|
268
|
+
```text
|
|
269
|
+
src/cybervisor/ Core CLI package
|
|
270
|
+
assets/hooks/ Standalone runtime hook source
|
|
271
|
+
scripts/ Demo bootstrap and end-to-end scripts
|
|
272
|
+
templates/demo/ Demo project scaffold
|
|
273
|
+
tests/ Unit and integration coverage
|
|
274
|
+
specs/ Speckit feature artifacts
|
|
275
|
+
.specify/ Constitution, templates, and repo scripts
|
|
276
|
+
AGENTS.md Symlink to .specify/memory/constitution.md
|
|
277
|
+
GEMINI.md Symlink to AGENTS.md
|
|
278
|
+
CLAUDE.md Symlink to AGENTS.md
|
|
279
|
+
```
|
|
280
|
+
|
|
281
|
+
## Agent docs
|
|
282
|
+
|
|
283
|
+
The agent mandate files are symlinked by design:
|
|
284
|
+
|
|
285
|
+
- `AGENTS.md` -> `.specify/memory/constitution.md`
|
|
286
|
+
- `GEMINI.md` -> `AGENTS.md`
|
|
287
|
+
- `CLAUDE.md` -> `AGENTS.md`
|
|
288
|
+
|
|
289
|
+
If mandate content needs to change, update `.specify/memory/constitution.md`, not the symlinks.
|
|
@@ -0,0 +1,268 @@
|
|
|
1
|
+
# cybervisor
|
|
2
|
+
|
|
3
|
+
`cybervisor` is an autonomous CLI supervisor for development runs. It executes a default 5-stage pipeline with Gemini CLI, Claude Code, or a mock agent, supports customizing stages in YAML config, installs runtime hooks for non-interactive execution, enforces optional stage-result contracts, and keeps audit logs in JSONL.
|
|
4
|
+
|
|
5
|
+
## What it does
|
|
6
|
+
|
|
7
|
+
- Runs the default five ordered stages: `Spec`, `Review Spec`, `Implement`, `Review Code`, `Verify`
|
|
8
|
+
- Allows custom stage lists in `cybervisor.yaml`
|
|
9
|
+
- Supports optional structured stage-result contracts and artifact-driven routing
|
|
10
|
+
- Fails fast when the selected agent CLI or hook verifier credentials are missing
|
|
11
|
+
- Writes non-secret hook runtime metadata and settings snapshots under `.cybervisor/hooks/` for non-mock runs
|
|
12
|
+
- Keeps verifier credentials in inherited `CYBERVISOR_LLM_*` env vars instead of persisting them under `.cybervisor/hooks/`
|
|
13
|
+
- Snapshots `.gemini/settings.json` or `.claude/settings.json` and restores the exact pre-run content on exit
|
|
14
|
+
- Streams live agent output to stderr and persists per-stage logs under `.cybervisor/`
|
|
15
|
+
- Exits with `130` on `SIGINT` or `SIGTERM` after cleanup
|
|
16
|
+
|
|
17
|
+
## Requirements
|
|
18
|
+
|
|
19
|
+
- Python 3.11+
|
|
20
|
+
- [`uv`](https://docs.astral.sh/uv/)
|
|
21
|
+
- One of:
|
|
22
|
+
- `gemini` on `PATH`
|
|
23
|
+
- `claude` on `PATH`
|
|
24
|
+
- `mock` mode for local deterministic runs
|
|
25
|
+
- `CYBERVISOR_LLM_API_KEY` for non-mock runs
|
|
26
|
+
|
|
27
|
+
Optional local env loading is supported from `.env` in the working directory. `cybervisor` reads only `CYBERVISOR_LLM_BASE_URL`, `CYBERVISOR_LLM_API_KEY`, and `CYBERVISOR_LLM_MODEL`, and does not override variables already exported in the shell.
|
|
28
|
+
|
|
29
|
+
## Install
|
|
30
|
+
|
|
31
|
+
Install the CLI onto your `PATH`:
|
|
32
|
+
|
|
33
|
+
```bash
|
|
34
|
+
uv tool install -e .
|
|
35
|
+
```
|
|
36
|
+
|
|
37
|
+
After installation, verify:
|
|
38
|
+
|
|
39
|
+
```bash
|
|
40
|
+
cybervisor --version
|
|
41
|
+
```
|
|
42
|
+
|
|
43
|
+
Developer fallback if you do not want to install the CLI globally:
|
|
44
|
+
|
|
45
|
+
```bash
|
|
46
|
+
uv run cybervisor --version
|
|
47
|
+
```
|
|
48
|
+
|
|
49
|
+
## Setup
|
|
50
|
+
|
|
51
|
+
```bash
|
|
52
|
+
uv sync
|
|
53
|
+
cp .env.example .env
|
|
54
|
+
```
|
|
55
|
+
|
|
56
|
+
Set at least:
|
|
57
|
+
|
|
58
|
+
```bash
|
|
59
|
+
CYBERVISOR_LLM_API_KEY=...
|
|
60
|
+
# Optional overrides
|
|
61
|
+
# CYBERVISOR_LLM_BASE_URL=https://api.openai.com/v1
|
|
62
|
+
# CYBERVISOR_LLM_MODEL=auto
|
|
63
|
+
```
|
|
64
|
+
|
|
65
|
+
## Usage
|
|
66
|
+
|
|
67
|
+
Minimal run:
|
|
68
|
+
|
|
69
|
+
```bash
|
|
70
|
+
cybervisor "Create a 360 feedback system" --config cybervisor.yaml
|
|
71
|
+
```
|
|
72
|
+
|
|
73
|
+
Start from a specific stage:
|
|
74
|
+
|
|
75
|
+
```bash
|
|
76
|
+
cybervisor "Create a 360 feedback system" --start-stage "Implement"
|
|
77
|
+
```
|
|
78
|
+
|
|
79
|
+
Version and help:
|
|
80
|
+
|
|
81
|
+
```bash
|
|
82
|
+
cybervisor --version
|
|
83
|
+
cybervisor --help
|
|
84
|
+
```
|
|
85
|
+
|
|
86
|
+
Minimal config:
|
|
87
|
+
|
|
88
|
+
```yaml
|
|
89
|
+
pipeline:
|
|
90
|
+
agent_tool: gemini
|
|
91
|
+
|
|
92
|
+
stages:
|
|
93
|
+
- name: Spec
|
|
94
|
+
- name: Review Spec
|
|
95
|
+
- name: Implement
|
|
96
|
+
- name: Review Code
|
|
97
|
+
- name: Verify
|
|
98
|
+
```
|
|
99
|
+
|
|
100
|
+
Notes:
|
|
101
|
+
|
|
102
|
+
- `hook:` values are sourced from `CYBERVISOR_LLM_*` env vars, not from config file literals
|
|
103
|
+
- If a stage omits `prompt_template`, the default template is used
|
|
104
|
+
- If `stages:` is omitted, the default five-stage pipeline is used
|
|
105
|
+
- If `stages:` is provided, `cybervisor` runs the stages exactly as configured
|
|
106
|
+
- Stages may optionally declare a `contract` for required result artifacts and a `next_stage` for explicit success-path routing
|
|
107
|
+
- When a review stage can route `changes_requested` to a correction stage, set that review stage's `next_stage` explicitly for the `approved` path instead of relying on linear order
|
|
108
|
+
- Use `--start-stage STAGE_NAME` to skip earlier stages and begin execution at the named stage
|
|
109
|
+
|
|
110
|
+
Review/fix loop example:
|
|
111
|
+
|
|
112
|
+
```yaml
|
|
113
|
+
pipeline:
|
|
114
|
+
agent_tool: claude
|
|
115
|
+
|
|
116
|
+
stages:
|
|
117
|
+
- name: Implement
|
|
118
|
+
|
|
119
|
+
- name: Review Code
|
|
120
|
+
next_stage: Verify
|
|
121
|
+
prompt_template: |
|
|
122
|
+
Review the implementation.
|
|
123
|
+
Write the final result to .cybervisor/contracts/artifacts/Review Code.yaml.
|
|
124
|
+
contract:
|
|
125
|
+
allowed_statuses: [approved, changes_requested]
|
|
126
|
+
routes:
|
|
127
|
+
changes_requested:
|
|
128
|
+
next_stage: Fix Code
|
|
129
|
+
injections: [summary, details, actions]
|
|
130
|
+
|
|
131
|
+
- name: Fix Code
|
|
132
|
+
next_stage: Review Code
|
|
133
|
+
prompt_template: |
|
|
134
|
+
Fix the issues described by the latest review.
|
|
135
|
+
Full contract:
|
|
136
|
+
{latest_contract_yaml}
|
|
137
|
+
Summary:
|
|
138
|
+
{latest_contract_summary}
|
|
139
|
+
Details:
|
|
140
|
+
{latest_contract_details_yaml}
|
|
141
|
+
Actions:
|
|
142
|
+
{latest_contract_actions_yaml}
|
|
143
|
+
|
|
144
|
+
- name: Verify
|
|
145
|
+
```
|
|
146
|
+
|
|
147
|
+
In this pattern:
|
|
148
|
+
|
|
149
|
+
- `Review Code` with `status: approved` goes to `Verify`
|
|
150
|
+
- `Review Code` with `status: changes_requested` goes to `Fix Code`
|
|
151
|
+
- `Fix Code` loops back to `Review Code`
|
|
152
|
+
- If `Review Code` omitted `next_stage: Verify`, a linear stage list would otherwise fall through to `Fix Code`
|
|
153
|
+
- Contract prompt guides live at `.cybervisor/contracts/prompts/[Stage Name].md`
|
|
154
|
+
|
|
155
|
+
## Runtime behavior
|
|
156
|
+
|
|
157
|
+
For `gemini` and `claude` runs, `cybervisor`:
|
|
158
|
+
|
|
159
|
+
1. Performs preflight checks.
|
|
160
|
+
2. Writes shared hook runtime metadata into `.cybervisor/hooks/`.
|
|
161
|
+
3. Persists an exact settings snapshot in `.cybervisor/hooks/`.
|
|
162
|
+
4. Patches the active tool settings file so the selected agent invokes the packaged `cybervisor-agent-hook` entry point.
|
|
163
|
+
5. Starts the agent in a dedicated process group when supported.
|
|
164
|
+
6. Uses the runtime hook to classify autonomy decisions as `approve` or `block`, then adapts those into the selected tool's native hook output so the agent continues autonomously.
|
|
165
|
+
7. If the active stage declares a contract, uses the same hook runtime to block completion until the required artifact exists and is structurally valid.
|
|
166
|
+
8. Streams agent output into stderr and the stage log file.
|
|
167
|
+
9. Re-validates contract artifacts after agent exit, then routes by contract status or explicit `next_stage` when configured.
|
|
168
|
+
10. Restores settings and removes runtime files on success, failure, or interrupt.
|
|
169
|
+
|
|
170
|
+
Generated artifacts:
|
|
171
|
+
|
|
172
|
+
- `.cybervisor/logs/cybervisor.log.jsonl`: structured run log
|
|
173
|
+
- `.cybervisor/logs/stages/<stage_name>.jsonl`: captured transcript per stage
|
|
174
|
+
- `.cybervisor/contracts/artifacts/*.yaml`: optional stage-result artifacts for contract-enabled stages
|
|
175
|
+
- `.cybervisor/contracts/prompts/*.md`: authored contract prompt guides for contract-enabled stages
|
|
176
|
+
|
|
177
|
+
## Development
|
|
178
|
+
|
|
179
|
+
Validation commands used by this repo:
|
|
180
|
+
|
|
181
|
+
```bash
|
|
182
|
+
uv run mypy --strict src
|
|
183
|
+
uv run pytest
|
|
184
|
+
```
|
|
185
|
+
|
|
186
|
+
Useful focused runs:
|
|
187
|
+
|
|
188
|
+
```bash
|
|
189
|
+
uv run pytest tests/integration/test_pipeline_e2e.py
|
|
190
|
+
uv run pytest tests/unit/test_hooks.py tests/unit/test_pipeline.py tests/unit/test_signals.py
|
|
191
|
+
```
|
|
192
|
+
|
|
193
|
+
## Publish
|
|
194
|
+
|
|
195
|
+
Build distributions:
|
|
196
|
+
|
|
197
|
+
```bash
|
|
198
|
+
uv build
|
|
199
|
+
```
|
|
200
|
+
|
|
201
|
+
Check the generated artifacts locally:
|
|
202
|
+
|
|
203
|
+
```bash
|
|
204
|
+
python -m zipfile -l dist/*.whl
|
|
205
|
+
tar -tf dist/*.tar.gz
|
|
206
|
+
```
|
|
207
|
+
|
|
208
|
+
Upload to PyPI with a token:
|
|
209
|
+
|
|
210
|
+
```bash
|
|
211
|
+
export UV_PUBLISH_TOKEN=your-pypi-token
|
|
212
|
+
uv publish
|
|
213
|
+
```
|
|
214
|
+
|
|
215
|
+
Optional dry run against TestPyPI:
|
|
216
|
+
|
|
217
|
+
```bash
|
|
218
|
+
export UV_PUBLISH_TOKEN=your-testpypi-token
|
|
219
|
+
uv publish --index testpypi
|
|
220
|
+
```
|
|
221
|
+
|
|
222
|
+
If the version already exists on PyPI, bump `version` in `pyproject.toml` and `src/cybervisor/__init__.py` before rebuilding.
|
|
223
|
+
|
|
224
|
+
## Manual demo workflow
|
|
225
|
+
|
|
226
|
+
The repository includes a demo bootstrap helper:
|
|
227
|
+
|
|
228
|
+
```bash
|
|
229
|
+
scripts/e2e-demo-project.sh
|
|
230
|
+
```
|
|
231
|
+
|
|
232
|
+
That script:
|
|
233
|
+
|
|
234
|
+
- creates a fresh demo workspace with `scripts/init-demo-project.sh`
|
|
235
|
+
- supports `--agent-tool claude|gemini` and defaults to `claude`
|
|
236
|
+
- optionally starts a local deterministic hook verifier stub when run with `--with-local-api`
|
|
237
|
+
- copies `templates/demo/.env` into the demo workspace as `.env`
|
|
238
|
+
- prints the exact `cd` and `cybervisor` command to run manually in your shell
|
|
239
|
+
- reminds you to install the CLI first if `cybervisor` is not yet on your `PATH`
|
|
240
|
+
|
|
241
|
+
## Specs Directory
|
|
242
|
+
|
|
243
|
+
Feature folders under `specs/` are archival implementation artifacts after delivery. The current source of truth for runtime behavior is the checked-in code plus the main project docs and constitution.
|
|
244
|
+
|
|
245
|
+
## Repository layout
|
|
246
|
+
|
|
247
|
+
```text
|
|
248
|
+
src/cybervisor/ Core CLI package
|
|
249
|
+
assets/hooks/ Standalone runtime hook source
|
|
250
|
+
scripts/ Demo bootstrap and end-to-end scripts
|
|
251
|
+
templates/demo/ Demo project scaffold
|
|
252
|
+
tests/ Unit and integration coverage
|
|
253
|
+
specs/ Speckit feature artifacts
|
|
254
|
+
.specify/ Constitution, templates, and repo scripts
|
|
255
|
+
AGENTS.md Symlink to .specify/memory/constitution.md
|
|
256
|
+
GEMINI.md Symlink to AGENTS.md
|
|
257
|
+
CLAUDE.md Symlink to AGENTS.md
|
|
258
|
+
```
|
|
259
|
+
|
|
260
|
+
## Agent docs
|
|
261
|
+
|
|
262
|
+
The agent mandate files are symlinked by design:
|
|
263
|
+
|
|
264
|
+
- `AGENTS.md` -> `.specify/memory/constitution.md`
|
|
265
|
+
- `GEMINI.md` -> `AGENTS.md`
|
|
266
|
+
- `CLAUDE.md` -> `AGENTS.md`
|
|
267
|
+
|
|
268
|
+
If mandate content needs to change, update `.specify/memory/constitution.md`, not the symlinks.
|
|
@@ -0,0 +1,66 @@
|
|
|
1
|
+
[project]
|
|
2
|
+
name = "cybervisor"
|
|
3
|
+
version = "0.1.0"
|
|
4
|
+
description = "Autonomous CLI supervisor for staged AI workflows"
|
|
5
|
+
readme = {file = "README.md", content-type = "text/markdown"}
|
|
6
|
+
requires-python = ">=3.11"
|
|
7
|
+
authors = [
|
|
8
|
+
{name = "crzidea"},
|
|
9
|
+
]
|
|
10
|
+
classifiers = [
|
|
11
|
+
"Development Status :: 3 - Alpha",
|
|
12
|
+
"Environment :: Console",
|
|
13
|
+
"Intended Audience :: Developers",
|
|
14
|
+
"Programming Language :: Python :: 3",
|
|
15
|
+
"Programming Language :: Python :: 3.11",
|
|
16
|
+
"Programming Language :: Python :: 3.12",
|
|
17
|
+
"Typing :: Typed",
|
|
18
|
+
]
|
|
19
|
+
dependencies = [
|
|
20
|
+
"httpx>=0.27.0",
|
|
21
|
+
"pyyaml>=6.0.3",
|
|
22
|
+
"setproctitle>=1.3.4; platform_system != 'Windows'",
|
|
23
|
+
]
|
|
24
|
+
|
|
25
|
+
[project.urls]
|
|
26
|
+
Homepage = "https://github.com/crzidea/cybervisor"
|
|
27
|
+
Repository = "https://github.com/crzidea/cybervisor"
|
|
28
|
+
Issues = "https://github.com/crzidea/cybervisor/issues"
|
|
29
|
+
|
|
30
|
+
[dependency-groups]
|
|
31
|
+
dev = [
|
|
32
|
+
"pytest>=8.0.0",
|
|
33
|
+
"playwright>=1.50.0",
|
|
34
|
+
"mypy>=1.10.0",
|
|
35
|
+
"types-pyyaml>=6.0.12.20250915",
|
|
36
|
+
]
|
|
37
|
+
|
|
38
|
+
[tool.uv]
|
|
39
|
+
default-groups = ["dev"]
|
|
40
|
+
|
|
41
|
+
[project.scripts]
|
|
42
|
+
cybervisor = "cybervisor.cli:main"
|
|
43
|
+
cybervisor-agent-hook = "cybervisor.agent_hook:main"
|
|
44
|
+
|
|
45
|
+
[build-system]
|
|
46
|
+
requires = ["setuptools>=68", "wheel"]
|
|
47
|
+
build-backend = "setuptools.build_meta"
|
|
48
|
+
|
|
49
|
+
[tool.setuptools]
|
|
50
|
+
package-dir = {"" = "src"}
|
|
51
|
+
|
|
52
|
+
[tool.setuptools.packages.find]
|
|
53
|
+
where = ["src"]
|
|
54
|
+
|
|
55
|
+
[tool.setuptools.package-data]
|
|
56
|
+
cybervisor = ["assets/hooks/*.md"]
|
|
57
|
+
|
|
58
|
+
[tool.pytest.ini_options]
|
|
59
|
+
addopts = "-q"
|
|
60
|
+
testpaths = ["tests"]
|
|
61
|
+
|
|
62
|
+
[tool.mypy]
|
|
63
|
+
python_version = "3.11"
|
|
64
|
+
strict = true
|
|
65
|
+
mypy_path = "src"
|
|
66
|
+
packages = ["cybervisor"]
|