rewrite all to PIP
This commit is contained in:
@@ -1,26 +1,38 @@
|
||||
# AGENTS.md
|
||||
|
||||
## Repo layout
|
||||
- `pipeline-runner/` — single Python package (FastAPI + uvicorn). All code lives here.
|
||||
- `pipeline-runner/app.py` — FastAPI app entrypoint with REST API + WebSocket + static file serving.
|
||||
- `pipeline-runner/main.py` — uvicorn dev server launcher (`python main.py`).
|
||||
- `pipeline-runner/static/index.html` — frontend UI.
|
||||
- `pipeline-runner/` — C++ application built with PIP (Platform Independent Primitives).
|
||||
- `pipeline-runner/src/main.cpp` — entry point, config loading, server start.
|
||||
- `pipeline-runner/src/server.h/.cpp` — PIHTTPServer routes, all API endpoints.
|
||||
- `pipeline-runner/src/pipeline.h/.cpp` — Pipeline/Prompt structs, JSON file I/O, log functions.
|
||||
- `pipeline-runner/src/runner.h/.cpp` — async pipeline execution (PIThread + PIProcess per step).
|
||||
- `pipeline-runner/src/messageutils.h/.cpp` — HTTP response helpers (JSON, error, success).
|
||||
- `pipeline-runner/pipeline-runner.conf` — JSON config file (port, directories).
|
||||
- `pipeline-runner/tests/` — gtest tests for pipeline storage and runner.
|
||||
- `pipeline-runner/CMakeLists.txt` — CMake build config with PIP + gtest (FetchContent).
|
||||
- `pipeline-runner/storage/pipelines/` — JSON files for persisted pipelines.
|
||||
- `pipeline-runner/storage/logs/` — execution logs (one file per run).
|
||||
|
||||
## Dev commands
|
||||
- Install deps: `cd pipeline-runner && pip install -r requirements.txt`
|
||||
- Start dev server: `cd pipeline-runner && python main.py` (uvicorn with reload, port 8000)
|
||||
- Deploy with auto-reload: `cd pipeline-runner && ./deploy.sh` (activates venv, installs deps, starts uvicorn with `--reload`)
|
||||
- Run tests: `cd pipeline-runner && python -m pytest`
|
||||
- Tests use `httpx`-backed `TestClient` from FastAPI.
|
||||
- Tests that exercise pipeline execution (`TestExecutePipeline`) monkeypatch `asyncio.create_subprocess_exec` to avoid calling `opencode` — they do not require `opencode` to be installed.
|
||||
- The `clean_storage` fixture auto-removes `storage/pipelines/` and `storage/logs/` before/after each test.
|
||||
- Build: `cd pipeline-runner/build && cmake .. && make`
|
||||
- Run: `cd pipeline-runner/build && ./pipeline-runner ../pipeline-runner.conf`
|
||||
- Run tests: `cd pipeline-runner/build && ./test-pipeline-runner`
|
||||
- Clean build: `rm -rf pipeline-runner/build && mkdir pipeline-runner/build && cd pipeline-runner/build && cmake .. && make`
|
||||
|
||||
## API endpoints
|
||||
| Method | Path | Description |
|
||||
|--------|------|-------------|
|
||||
| GET | `/api/pipelines` | List all pipelines |
|
||||
| POST | `/api/pipelines` | Create pipeline (JSON body) |
|
||||
| GET | `/api/pipelines/{id}` | Get single pipeline |
|
||||
| DELETE | `/api/pipelines/{id}` | Delete pipeline |
|
||||
| POST | `/api/runs` | Start execution (`{"pipeline_id": "..."}`) |
|
||||
| GET | `/api/runs/{run_id}/status` | Poll run status + step results |
|
||||
| GET | `/api/runs/{run_id}/log` | Get log file contents |
|
||||
|
||||
## Key behaviors
|
||||
- Pipeline execution runs `opencode run <prompt> --title <title>` per step via `asyncio.create_subprocess_exec`.
|
||||
- Pipeline execution runs `opencode run <text> --title <title>` per step via `PIProcess`.
|
||||
- Pipeline stops on first step error (non-zero return code).
|
||||
- Real-time logs are streamed over WebSocket at `/ws/{run_id}`.
|
||||
- CORS is open (`allow_origins=["*"]`) for dev convenience.
|
||||
- No lint, typecheck, or formatter tooling is configured.
|
||||
|
||||
- Each run executes in a separate `PIThread`.
|
||||
- CORS headers are added to all responses (`Access-Control-Allow-Origin: *`).
|
||||
- Config is loaded from `pipeline-runner.conf` (JSON format).
|
||||
|
||||
Reference in New Issue
Block a user