Skip to content

Commit 6cc6d7d

Browse files
authored
refactor: structure (#146)
1 parent 34d8285 commit 6cc6d7d

File tree

189 files changed

+485
-570
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

189 files changed

+485
-570
lines changed

.github/workflows/strategies-smoke.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -226,13 +226,13 @@ jobs:
226226
if: steps.secrets_ok.outputs.ok == 'true'
227227
run: |
228228
set -euo pipefail
229-
RUN_DIR=$(ls -td results/run_* 2>/dev/null | head -n1 || true)
229+
RUN_DIR=$(ls -td .pitaya/results/run_* 2>/dev/null | head -n1 || true)
230230
if [ -z "$RUN_DIR" ]; then
231231
echo "No results directory found" >&2
232232
exit 1
233233
fi
234234
RUN_ID=$(basename "$RUN_DIR")
235-
STATE_JSON="pitaya_state/$RUN_ID/state.json"
235+
STATE_JSON=".pitaya/state/$RUN_ID/state.json"
236236
237237
echo "Results: $RUN_DIR" >> $GITHUB_STEP_SUMMARY
238238
if [ ! -f "$STATE_JSON" ]; then

.gitignore

Lines changed: 2 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -54,13 +54,6 @@ dmypy.json
5454
.spyproject
5555
.ropeproject
5656

57-
# Logs
58-
logs/
59-
*.log
60-
log/
61-
*.log.*
62-
test_logs/
63-
6457
# Environment variables
6558
.env
6659
.env.*
@@ -81,8 +74,5 @@ desktop.ini
8174
*.backup
8275
*.orig
8376

84-
# Output directories
85-
output/
86-
results/
87-
runs/
88-
pitaya_state/
77+
# Runtime/output
78+
.pitaya/

CHANGELOG.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
2020

2121
- Persist per-instance metadata to results and logs artifacts. ([#79](https://github.com/tact-lang/pitaya/pull/79))
2222
- CLI flags: `--override-config` and `--resume-key-policy {strict|suffix}` to control how resume applies overrides and durable key behavior. ([#81](https://github.com/tact-lang/pitaya/pull/81))
23-
- Persist the effective run configuration to `pitaya_state/<run_id>/config.json` and a redacted copy to `logs/<run_id>/config.json` to improve resume fidelity. ([#81](https://github.com/tact-lang/pitaya/pull/81))
23+
- Persist the effective run configuration to `.pitaya/state/<run_id>/config.json` and a redacted copy to `logs/<run_id>/config.json` to improve resume fidelity. ([#81](https://github.com/tact-lang/pitaya/pull/81))
2424
- Strategy: `pr-review` — N reviewers, validator per reviewer, and a composer; CI‑friendly with JSON trailer parsing and fail gating.
2525
- Workspace: Optional `--include-branches` (CSV/JSON) or config `runner.include_branches` to materialize extra read‑only branches in the isolated workspace for all strategies. Also supported per-task via `workspace_include_branches` metadata. ([#95](https://github.com/tact-lang/pitaya/pull/95))
2626

README.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -117,8 +117,8 @@ CLI overrides config; `-S key=value` only affects the selected strategy.
117117

118118
## Results & Logs
119119

120-
- Logs: `logs/<run_id>/events.jsonl` and JSONL component logs (orchestration.jsonl, runner.jsonl, tui.jsonl, other.jsonl)
121-
- Results: `results/<run_id>/` (summary.json, metadata.json, branches.txt, instance_metrics.csv, instances/<id>.json)
120+
- Logs: `.pitaya/logs/<run_id>/events.jsonl` and JSONL component logs (orchestration.jsonl, runner.jsonl, tui.jsonl, other.jsonl)
121+
- Results: `.pitaya/results/<run_id>/` (summary.json, metadata.json, branches.txt, instance_metrics.csv, instances/<id>.json)
122122
- Branches: `pitaya/<strategy>/<run_id>/k<short8>` (hierarchical namespace)
123123
- Resume: `pitaya --resume <run_id>`
124124

docs/cli.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -169,8 +169,8 @@ pitaya "task" --force-commit # force a commit if changes exist
169169

170170
- Precedence: CLI > env > .env > project config > defaults.
171171
- Directories:
172-
- State: `--state-dir ./pitaya_state` (default)
173-
- Logs: `--logs-dir ./logs` (default)
172+
- State: `--state-dir ./.pitaya/state` (default)
173+
- Logs: `--logs-dir .pitaya/logs` (default)
174174

175175
## Maintenance
176176

docs/configuration.md

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,7 @@ strategies:
3838
iterations: 3
3939

4040
logging:
41-
# JSONL component logs under logs/<run_id>/
41+
# JSONL component logs under .pitaya/logs/<run_id>/
4242
max_file_size: 10485760 # 10MB per component file before rotation
4343
retention_days: 7 # cleanup old run dirs (component logs)
4444
console_verbose: false # headless-only: surface agent/tool steps to console (same as --verbose)
@@ -81,22 +81,22 @@ Most strategies leave these at defaults. To force an import even when there are
8181

8282
## Directories
8383

84-
- State: `pitaya_state/` (can be changed with `--state-dir`)
85-
- Logs: `logs/<run_id>/` (change with `--logs-dir`)
86-
- Results: `results/<run_id>/` (summary.json, metadata.json, branches.txt, instance_metrics.csv, instances/<id>.json)
84+
- State: `.pitaya/state/` (can be changed with `--state-dir`)
85+
- Logs: `.pitaya/logs/<run_id>/` (change with `--logs-dir`)
86+
- Results: `.pitaya/results/<run_id>/` (summary.json, metadata.json, branches.txt, instance_metrics.csv, instances/<id>.json)
8787

8888
Structured logs
8989

90-
- Pitaya writes JSON Lines component logs in `logs/<run_id>/` (orchestration.jsonl, runner.jsonl, tui.jsonl, other.jsonl).
90+
- Pitaya writes JSON Lines component logs in `.pitaya/logs/<run_id>/` (orchestration.jsonl, runner.jsonl, tui.jsonl, other.jsonl).
9191
- Old log directories are cleaned up periodically; component files rotate by size.
9292
- Custom redaction patterns from `logging.redaction.custom_patterns` are applied to both logs and emitted events.
9393

9494
## Effective config persistence and resume
9595

9696
On a fresh run, Pitaya writes the fully merged configuration (CLI + env + .env + file + defaults):
9797

98-
- Unredacted copy to `pitaya_state/<run_id>/config.json` (for fidelity on resume). The `pitaya_state/` directory is git‑ignored by default.
99-
- Redacted copy to `logs/<run_id>/config.json` (tokens/API keys masked) for auditability alongside logs.
98+
- Unredacted copy to `.pitaya/state/<run_id>/config.json` (for fidelity on resume). The `.pitaya/state/` directory is git‑ignored by default.
99+
- Redacted copy to `.pitaya/logs/<run_id>/config.json` (tokens/API keys masked) for auditability alongside logs.
100100

101101
On `--resume <run_id>`, Pitaya loads the saved effective config by default. This preserves durable keys and behavior. CLI overrides on resume are applied as follows:
102102

docs/custom-strategies.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,7 @@ Create a file `my_strategy.py` in your repo:
4040
```python
4141
from dataclasses import dataclass
4242
from typing import List
43-
from pitaya.orchestration.strategies.base import Strategy, StrategyConfig
43+
from pitaya.orchestration.strategy.base import Strategy, StrategyConfig
4444
from pitaya.shared import InstanceResult
4545

4646
@dataclass
@@ -80,7 +80,7 @@ Spawn N parallel tasks and wait for all, tolerating failures:
8080
```python
8181
from dataclasses import dataclass
8282
from typing import List
83-
from pitaya.orchestration.strategies.base import Strategy, StrategyConfig
83+
from pitaya.orchestration.strategy.base import Strategy, StrategyConfig
8484
from pitaya.shared import InstanceResult
8585

8686
@dataclass

docs/quickstart.md

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -59,7 +59,7 @@ cd pitaya
5959
uv run pitaya --version
6060

6161
# Or directly via Python module
62-
python -m src.cli --version
62+
python -m pitaya --version
6363
```
6464

6565
## Authenticate
@@ -108,7 +108,7 @@ uv run pitaya "Create a HELLO.txt file with 'Hello from Pitaya' text in it and c
108108
Tips
109109

110110
- Press Ctrl+C to stop the run. Pitaya shuts down gracefully (containers stopped, state saved) and prints a resume hint with the run ID.
111-
- After completion, results are written under `results/<run_id>/` and logs under `logs/<run_id>/`.
111+
- After completion, results are written under `.pitaya/results/<run_id>/` and logs under `.pitaya/logs/<run_id>/`.
112112
- Branches are created only if the agent commits changes.
113113

114114
## Explore More
@@ -135,8 +135,8 @@ pitaya "Write the funniest and most original joke possible" --strategy iterative
135135

136136
## Where to Find Results
137137

138-
- Logs: `logs/<run_id>/events.jsonl` and JSONL component logs (orchestration.jsonl, runner.jsonl, tui.jsonl, other.jsonl)
139-
- Results: `results/<run_id>/` (summary.json, metadata.json, branches.txt, metrics, instances/<id>.json)
138+
- Logs: `.pitaya/logs/<run_id>/events.jsonl` and JSONL component logs (orchestration.jsonl, runner.jsonl, tui.jsonl, other.jsonl)
139+
- Results: `.pitaya/results/<run_id>/` (summary.json, metadata.json, branches.txt, metrics, instances/<id>.json)
140140
- Branches: `pitaya/<strategy>/<run_id>/k<short8>` (hierarchical namespace)
141141

142142
List branches:

docs/tui.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,7 @@ Inspect a previous run without the orchestrator running:
4444
```bash
4545
pitaya-tui --run-id run_20250114_123456
4646
# or from an events file
47-
pitaya-tui --events-file logs/run_20250114_123456/events.jsonl --output streaming
47+
pitaya-tui --events-file .pitaya/logs/run_20250114_123456/events.jsonl --output streaming
4848
```
4949

5050
Filters:
@@ -54,5 +54,5 @@ Filters:
5454
## Tips
5555

5656
- Cancel with Ctrl+C; a graceful shutdown stops containers, saves state, and prints a resume hint with the run ID.
57-
- Logs live at `logs/<run_id>/`; results at `results/<run_id>/`.
57+
- Logs live at `.pitaya/logs/<run_id>/`; results at `.pitaya/results/<run_id>/`.
5858
- In compact mode, long branches shorten to their unique suffix with a leading `/` so the `k<short8>` tail is visible.

examples/custom_simple.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -11,9 +11,9 @@
1111
from dataclasses import dataclass
1212
from typing import List
1313

14-
from src.orchestration.strategies.base import Strategy, StrategyConfig
15-
from src.orchestration.strategy_context import StrategyContext
16-
from src.shared import InstanceResult
14+
from pitaya.orchestration.strategy.base import Strategy, StrategyConfig
15+
from pitaya.orchestration.strategy.context import StrategyContext
16+
from pitaya.shared import InstanceResult
1717

1818

1919
@dataclass

0 commit comments

Comments
 (0)