bathos 0.3.1__tar.gz → 0.4.1__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.
- {bathos-0.3.1 → bathos-0.4.1}/CLAUDE.md +7 -3
- {bathos-0.3.1 → bathos-0.4.1}/PKG-INFO +8 -1
- {bathos-0.3.1 → bathos-0.4.1}/README.md +7 -0
- {bathos-0.3.1 → bathos-0.4.1}/agent_assets/using_bathos/SKILL.md +1 -1
- {bathos-0.3.1 → bathos-0.4.1}/pyproject.toml +1 -1
- {bathos-0.3.1 → bathos-0.4.1}/src/bathos/__init__.py +1 -1
- {bathos-0.3.1 → bathos-0.4.1}/src/bathos/catalog.py +2 -2
- {bathos-0.3.1 → bathos-0.4.1}/src/bathos/cli.py +240 -10
- {bathos-0.3.1 → bathos-0.4.1}/src/bathos/compact.py +117 -4
- {bathos-0.3.1 → bathos-0.4.1}/src/bathos/config.py +5 -1
- {bathos-0.3.1 → bathos-0.4.1}/src/bathos/mcp.py +129 -0
- {bathos-0.3.1 → bathos-0.4.1}/src/bathos/migrate.py +57 -2
- bathos-0.4.1/src/bathos/postmortem.py +177 -0
- {bathos-0.3.1 → bathos-0.4.1}/src/bathos/query.py +54 -35
- {bathos-0.3.1 → bathos-0.4.1}/src/bathos/runner.py +14 -0
- {bathos-0.3.1 → bathos-0.4.1}/src/bathos/schema.py +51 -1
- {bathos-0.3.1 → bathos-0.4.1}/src/bathos/sync.py +23 -3
- {bathos-0.3.1 → bathos-0.4.1}/tests/test_catalog.py +1 -1
- {bathos-0.3.1 → bathos-0.4.1}/tests/test_cli.py +35 -3
- {bathos-0.3.1 → bathos-0.4.1}/tests/test_cluster_workflow.py +2 -2
- {bathos-0.3.1 → bathos-0.4.1}/tests/test_compact.py +31 -30
- {bathos-0.3.1 → bathos-0.4.1}/tests/test_config.py +10 -0
- {bathos-0.3.1 → bathos-0.4.1}/tests/test_integration.py +5 -4
- {bathos-0.3.1 → bathos-0.4.1}/tests/test_linter.py +4 -0
- bathos-0.4.1/tests/test_postmortem.py +604 -0
- {bathos-0.3.1 → bathos-0.4.1}/tests/test_query.py +1 -1
- {bathos-0.3.1 → bathos-0.4.1}/tests/test_remote.py +1 -1
- {bathos-0.3.1 → bathos-0.4.1}/tests/test_schema.py +6 -6
- bathos-0.4.1/tests/test_sync_project_filter.py +211 -0
- {bathos-0.3.1 → bathos-0.4.1}/uv.lock +1 -1
- {bathos-0.3.1 → bathos-0.4.1}/.agent/workspace.id +0 -0
- {bathos-0.3.1 → bathos-0.4.1}/.bth.toml +0 -0
- {bathos-0.3.1 → bathos-0.4.1}/.coverage +0 -0
- {bathos-0.3.1 → bathos-0.4.1}/.github/SECRETS.md +0 -0
- {bathos-0.3.1 → bathos-0.4.1}/.github/workflows/publish.yml +0 -0
- {bathos-0.3.1 → bathos-0.4.1}/.github/workflows/test.yml +0 -0
- {bathos-0.3.1 → bathos-0.4.1}/.gitignore +0 -0
- {bathos-0.3.1 → bathos-0.4.1}/.python-version +0 -0
- {bathos-0.3.1 → bathos-0.4.1}/.readthedocs.yaml +0 -0
- {bathos-0.3.1 → bathos-0.4.1}/CHANGELOG.md +0 -0
- {bathos-0.3.1 → bathos-0.4.1}/LICENSE +0 -0
- {bathos-0.3.1 → bathos-0.4.1}/agent_assets/docs/claude-code-integration.md +0 -0
- {bathos-0.3.1 → bathos-0.4.1}/agent_assets/docs/gemini-cli-integration.md +0 -0
- {bathos-0.3.1 → bathos-0.4.1}/docs/Makefile +0 -0
- {bathos-0.3.1 → bathos-0.4.1}/docs/source/api.rst +0 -0
- {bathos-0.3.1 → bathos-0.4.1}/docs/source/architecture.rst +0 -0
- {bathos-0.3.1 → bathos-0.4.1}/docs/source/conf.py +0 -0
- {bathos-0.3.1 → bathos-0.4.1}/docs/source/contributing.rst +0 -0
- {bathos-0.3.1 → bathos-0.4.1}/docs/source/index.rst +0 -0
- {bathos-0.3.1 → bathos-0.4.1}/docs/source/slurm-integration.rst +0 -0
- {bathos-0.3.1 → bathos-0.4.1}/docs/source/user-guide.rst +0 -0
- {bathos-0.3.1 → bathos-0.4.1}/docs/superpowers/plans/2026-05-15-bathos-v01-core.md +0 -0
- {bathos-0.3.1 → bathos-0.4.1}/docs/superpowers/plans/2026-05-19-agent-onboarding-export.md +0 -0
- {bathos-0.3.1 → bathos-0.4.1}/docs/superpowers/plans/2026-05-19-decorator.md +0 -0
- {bathos-0.3.1 → bathos-0.4.1}/docs/superpowers/plans/2026-05-19-historical-migration.md +0 -0
- {bathos-0.3.1 → bathos-0.4.1}/docs/superpowers/plans/2026-05-19-linter.md +0 -0
- {bathos-0.3.1 → bathos-0.4.1}/docs/superpowers/plans/2026-05-19-remote-management.md +0 -0
- {bathos-0.3.1 → bathos-0.4.1}/docs/superpowers/plans/2026-05-19-schema-versioning.md +0 -0
- {bathos-0.3.1 → bathos-0.4.1}/docs/superpowers/plans/2026-05-19-skill-and-export-mcp.md +0 -0
- {bathos-0.3.1 → bathos-0.4.1}/docs/superpowers/plans/2026-05-19-v02-feature-wiring.md +0 -0
- {bathos-0.3.1 → bathos-0.4.1}/docs/superpowers/plans/2026-05-20-agentic-integrity-design.md +0 -0
- {bathos-0.3.1 → bathos-0.4.1}/docs/superpowers/plans/2026-05-20-agentic-integrity-impl-plan.md +0 -0
- {bathos-0.3.1 → bathos-0.4.1}/docs/superpowers/specs/2026-05-15-bathos-design.md +0 -0
- {bathos-0.3.1 → bathos-0.4.1}/inventory.txt +0 -0
- {bathos-0.3.1 → bathos-0.4.1}/main.py +0 -0
- {bathos-0.3.1 → bathos-0.4.1}/praxia.toml +0 -0
- {bathos-0.3.1 → bathos-0.4.1}/scripts/benchmarks/.bth.toml +0 -0
- {bathos-0.3.1 → bathos-0.4.1}/scripts/experiments/.bth.toml +0 -0
- {bathos-0.3.1 → bathos-0.4.1}/scripts/slurm/_bth_env.sh +0 -0
- {bathos-0.3.1 → bathos-0.4.1}/src/bathos/archive.py +0 -0
- {bathos-0.3.1 → bathos-0.4.1}/src/bathos/campaigns.py +0 -0
- {bathos-0.3.1 → bathos-0.4.1}/src/bathos/checker.py +0 -0
- {bathos-0.3.1 → bathos-0.4.1}/src/bathos/decorators.py +0 -0
- {bathos-0.3.1 → bathos-0.4.1}/src/bathos/export.py +0 -0
- {bathos-0.3.1 → bathos-0.4.1}/src/bathos/git.py +0 -0
- {bathos-0.3.1 → bathos-0.4.1}/src/bathos/init.py +0 -0
- {bathos-0.3.1 → bathos-0.4.1}/src/bathos/linter.py +0 -0
- {bathos-0.3.1 → bathos-0.4.1}/src/bathos/new_experiment.py +0 -0
- {bathos-0.3.1 → bathos-0.4.1}/src/bathos/prereg.py +0 -0
- {bathos-0.3.1 → bathos-0.4.1}/src/bathos/remote.py +0 -0
- {bathos-0.3.1 → bathos-0.4.1}/src/bathos/sidecar.py +0 -0
- {bathos-0.3.1 → bathos-0.4.1}/src/bathos/sprint_audit.py +0 -0
- {bathos-0.3.1 → bathos-0.4.1}/src/bathos/templates/_bth_env.sh +0 -0
- {bathos-0.3.1 → bathos-0.4.1}/src/bathos/validate.py +0 -0
- {bathos-0.3.1 → bathos-0.4.1}/tests/__init__.py +0 -0
- {bathos-0.3.1 → bathos-0.4.1}/tests/conftest.py +0 -0
- {bathos-0.3.1 → bathos-0.4.1}/tests/test_archive.py +0 -0
- {bathos-0.3.1 → bathos-0.4.1}/tests/test_campaigns.py +0 -0
- {bathos-0.3.1 → bathos-0.4.1}/tests/test_checker.py +0 -0
- {bathos-0.3.1 → bathos-0.4.1}/tests/test_decorators.py +0 -0
- {bathos-0.3.1 → bathos-0.4.1}/tests/test_export.py +0 -0
- {bathos-0.3.1 → bathos-0.4.1}/tests/test_git.py +0 -0
- {bathos-0.3.1 → bathos-0.4.1}/tests/test_init.py +0 -0
- {bathos-0.3.1 → bathos-0.4.1}/tests/test_mcp_integration.py +0 -0
- {bathos-0.3.1 → bathos-0.4.1}/tests/test_mcp_server.py +0 -0
- {bathos-0.3.1 → bathos-0.4.1}/tests/test_migrate.py +0 -0
- {bathos-0.3.1 → bathos-0.4.1}/tests/test_new_experiment.py +0 -0
- {bathos-0.3.1 → bathos-0.4.1}/tests/test_prereg.py +0 -0
- {bathos-0.3.1 → bathos-0.4.1}/tests/test_runner.py +0 -0
- {bathos-0.3.1 → bathos-0.4.1}/tests/test_sidecar.py +0 -0
- {bathos-0.3.1 → bathos-0.4.1}/tests/test_slurm_integration.py +0 -0
- {bathos-0.3.1 → bathos-0.4.1}/tests/test_sprint_audit.py +0 -0
- {bathos-0.3.1 → bathos-0.4.1}/tests/test_sync.py +0 -0
- {bathos-0.3.1 → bathos-0.4.1}/tests/test_validate.py +0 -0
|
@@ -10,9 +10,9 @@ bathos is a standalone experiment tracking CLI for a single researcher across 10
|
|
|
10
10
|
|
|
11
11
|
---
|
|
12
12
|
|
|
13
|
-
## Current Status (as of 2026-05-
|
|
13
|
+
## Current Status (as of 2026-05-21)
|
|
14
14
|
|
|
15
|
-
**v0.
|
|
15
|
+
**v0.4.1: complete and merged to main.** 348 tests passing.
|
|
16
16
|
|
|
17
17
|
- Full design spec: `.praxia/specs/bathos-design.md`
|
|
18
18
|
- v0.1 implementation plan: `.praxia/specs/bathos-v01-plan.md`
|
|
@@ -22,6 +22,10 @@ bathos is a standalone experiment tracking CLI for a single researcher across 10
|
|
|
22
22
|
|
|
23
23
|
**Shipped in v0.3:** Agentic integrity gate (`--agent-mode`, `--no-sidecar`, `--derived-from`), lineage tracking (`bth lineage`), campaigns (`bth campaign` subcommands + MCP tools), sprint audit (`bth sprint-audit`), Tier-2 lint checks, schema v3 with campaign/lineage/integrity fields, `--campaign` flag on `bth run`.
|
|
24
24
|
|
|
25
|
+
**Shipped in v0.4:** Per-project sync filtering — `bth sync` now pushes/pulls only the current project's runs (no cross-project contamination). Cool-tier layout changed to `runs/<slug>/run_<uuid>.parquet`. New command `bth migrate-to-project-subdirs` migrates flat catalogs. `sync_filter` config knob; `--no-project-filter` opt-out planned.
|
|
26
|
+
|
|
27
|
+
**Shipped in v0.4.1:** Postmortem tracking — `*.bth.postmortem.toml` format, `bth postmortem validate` CLI command, `postmortem_scaffold`/`postmortem_validate`/`postmortem_get` MCP tools. Schema v4 with 10 new DuckDB columns; `compact` syncs postmortem metadata. Validation covers refutation consistency, asset path containment, sha256 checksums, and git drift detection. `script_sha256` computed in `runner.py` at experiment launch.
|
|
28
|
+
|
|
25
29
|
**Remaining backlog:** #136 (bth-migrate praxia workflow), #137 (global instruction portability), #142 (results management design).
|
|
26
30
|
|
|
27
31
|
---
|
|
@@ -34,7 +38,7 @@ bathos is a standalone experiment tracking CLI for a single researcher across 10
|
|
|
34
38
|
SLURM job / bth run
|
|
35
39
|
│
|
|
36
40
|
▼ atomic write-then-rename
|
|
37
|
-
cool/ ~/.bth/catalog/runs
|
|
41
|
+
cool/ ~/.bth/catalog/runs/<slug>/run_<uuid>.parquet ← minimal schema, SLURM-safe
|
|
38
42
|
│
|
|
39
43
|
bth compact (lazy on query or explicit)
|
|
40
44
|
│
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: bathos
|
|
3
|
-
Version: 0.
|
|
3
|
+
Version: 0.4.1
|
|
4
4
|
Summary: Local-first, zero-server experiment tracking for researchers
|
|
5
5
|
Project-URL: Homepage, https://github.com/mariellerossi/bathos
|
|
6
6
|
Project-URL: Documentation, https://bathos.readthedocs.io
|
|
@@ -96,8 +96,15 @@ bth sql "SELECT project_slug, count(*) FROM runs GROUP BY 1"
|
|
|
96
96
|
- `bth lint [--project-root PATH]` — check scripts/ for naming conventions and missing sidecars
|
|
97
97
|
- `bth new-experiment <name>` — scaffold a new experiment script and sidecar
|
|
98
98
|
- `bth migrate` — upgrade cool-tier Parquet fragments to current schema version
|
|
99
|
+
- `bth migrate-to-project-subdirs [--dry-run]` — move flat catalog runs into `runs/<slug>/` subdirs (v0.4+)
|
|
99
100
|
- `bth export` — export the using-bathos skill and register MCP server
|
|
100
101
|
|
|
102
|
+
**`bth sync`** — Sync cool-tier catalog to/from cluster (v0.4+: per-project filtered)
|
|
103
|
+
- `bth sync [<remote>]` — push only this project's runs to the remote (filtered by `project_slug`)
|
|
104
|
+
- `bth sync [<remote>] --pull` — pull only this project's runs from the remote
|
|
105
|
+
- Output: `Pushed 47 runs (filtered 275 from other projects) to 'engaging' in 1.2s`
|
|
106
|
+
- Config: `sync_filter = "none"` in `.bth.toml` disables filtering (pushes all projects)
|
|
107
|
+
|
|
101
108
|
**`bth remote`** — Manage sync remotes
|
|
102
109
|
- `bth remote add <name> <url>` — add an SSH remote for catalog sync
|
|
103
110
|
- `bth remote list` — list configured remotes
|
|
@@ -60,8 +60,15 @@ bth sql "SELECT project_slug, count(*) FROM runs GROUP BY 1"
|
|
|
60
60
|
- `bth lint [--project-root PATH]` — check scripts/ for naming conventions and missing sidecars
|
|
61
61
|
- `bth new-experiment <name>` — scaffold a new experiment script and sidecar
|
|
62
62
|
- `bth migrate` — upgrade cool-tier Parquet fragments to current schema version
|
|
63
|
+
- `bth migrate-to-project-subdirs [--dry-run]` — move flat catalog runs into `runs/<slug>/` subdirs (v0.4+)
|
|
63
64
|
- `bth export` — export the using-bathos skill and register MCP server
|
|
64
65
|
|
|
66
|
+
**`bth sync`** — Sync cool-tier catalog to/from cluster (v0.4+: per-project filtered)
|
|
67
|
+
- `bth sync [<remote>]` — push only this project's runs to the remote (filtered by `project_slug`)
|
|
68
|
+
- `bth sync [<remote>] --pull` — pull only this project's runs from the remote
|
|
69
|
+
- Output: `Pushed 47 runs (filtered 275 from other projects) to 'engaging' in 1.2s`
|
|
70
|
+
- Config: `sync_filter = "none"` in `.bth.toml` disables filtering (pushes all projects)
|
|
71
|
+
|
|
65
72
|
**`bth remote`** — Manage sync remotes
|
|
66
73
|
- `bth remote add <name> <url>` — add an SSH remote for catalog sync
|
|
67
74
|
- `bth remote list` — list configured remotes
|
|
@@ -13,7 +13,7 @@ description: "Use when working in any bathos-tracked research project — experi
|
|
|
13
13
|
|
|
14
14
|
**Scope:** Single researcher, 10+ projects, SLURM cluster integration.
|
|
15
15
|
|
|
16
|
-
**Status:** ✅ v0.
|
|
16
|
+
**Status:** ✅ v0.4.0 shipped — 333 tests passing. Full CLI + MCP server available, including campaigns, agentic integrity gates, and per-project sync filtering.
|
|
17
17
|
|
|
18
18
|
---
|
|
19
19
|
|
|
@@ -15,7 +15,7 @@ def init_catalog(catalog_dir: Path) -> None:
|
|
|
15
15
|
|
|
16
16
|
def write_run(run: Run, catalog_dir: Path) -> None:
|
|
17
17
|
"""Write (or overwrite) a run record atomically."""
|
|
18
|
-
runs_dir = catalog_dir / "runs"
|
|
18
|
+
runs_dir = catalog_dir / "runs" / run.project_slug
|
|
19
19
|
runs_dir.mkdir(parents=True, exist_ok=True)
|
|
20
20
|
target = runs_dir / f"run_{run.id}.parquet"
|
|
21
21
|
tmp = runs_dir / f"run_{run.id}.tmp.parquet"
|
|
@@ -28,7 +28,7 @@ def read_runs(catalog_dir: Path) -> list[Run]:
|
|
|
28
28
|
runs_dir = catalog_dir / "runs"
|
|
29
29
|
if not runs_dir.exists():
|
|
30
30
|
return []
|
|
31
|
-
parquet_files = list(runs_dir.
|
|
31
|
+
parquet_files = list(runs_dir.rglob("run_*.parquet"))
|
|
32
32
|
if not parquet_files:
|
|
33
33
|
return []
|
|
34
34
|
tables = [pq.read_table(f) for f in parquet_files]
|
|
@@ -18,13 +18,19 @@ app.add_typer(remote_app, name="remote")
|
|
|
18
18
|
campaign_app = typer.Typer(help="Manage experiment campaigns")
|
|
19
19
|
app.add_typer(campaign_app, name="campaign")
|
|
20
20
|
|
|
21
|
+
postmortem_app = typer.Typer(help="Manage postmortem reviews")
|
|
22
|
+
app.add_typer(postmortem_app, name="postmortem")
|
|
23
|
+
|
|
21
24
|
|
|
22
25
|
def _catalog_dir() -> Path:
|
|
23
26
|
override = os.environ.get("BTH_CATALOG_DIR")
|
|
24
27
|
if override:
|
|
25
28
|
return Path(override)
|
|
26
|
-
from bathos.config import default_catalog_dir
|
|
29
|
+
from bathos.config import find_project_config, load_project_config, default_catalog_dir
|
|
27
30
|
|
|
31
|
+
cfg_path = find_project_config()
|
|
32
|
+
if cfg_path is not None:
|
|
33
|
+
return load_project_config(cfg_path).catalog_dir
|
|
28
34
|
return default_catalog_dir()
|
|
29
35
|
|
|
30
36
|
|
|
@@ -419,6 +425,7 @@ def campaign_create(
|
|
|
419
425
|
):
|
|
420
426
|
"""Create a new campaign."""
|
|
421
427
|
import duckdb
|
|
428
|
+
|
|
422
429
|
from bathos.campaigns import create_campaign
|
|
423
430
|
slug = _require_project_slug()
|
|
424
431
|
db = duckdb.connect(str(_catalog_dir() / "bathos.db"))
|
|
@@ -436,7 +443,8 @@ def campaign_add(
|
|
|
436
443
|
):
|
|
437
444
|
"""Add a run to a campaign."""
|
|
438
445
|
import duckdb
|
|
439
|
-
|
|
446
|
+
|
|
447
|
+
from bathos.campaigns import CampaignError, add_run_to_campaign
|
|
440
448
|
db = duckdb.connect(str(_catalog_dir() / "bathos.db"))
|
|
441
449
|
try:
|
|
442
450
|
add_run_to_campaign(db, campaign, run_id)
|
|
@@ -456,7 +464,8 @@ def campaign_conclude(
|
|
|
456
464
|
):
|
|
457
465
|
"""Conclude a campaign with an outcome label."""
|
|
458
466
|
import duckdb
|
|
459
|
-
|
|
467
|
+
|
|
468
|
+
from bathos.campaigns import CampaignError, conclude_campaign
|
|
460
469
|
db = duckdb.connect(str(_catalog_dir() / "bathos.db"))
|
|
461
470
|
try:
|
|
462
471
|
conclude_campaign(db, campaign_id, outcome, note)
|
|
@@ -474,6 +483,7 @@ def campaign_ls(
|
|
|
474
483
|
):
|
|
475
484
|
"""List campaigns."""
|
|
476
485
|
import duckdb
|
|
486
|
+
|
|
477
487
|
from bathos.campaigns import list_campaigns
|
|
478
488
|
db = duckdb.connect(str(_catalog_dir() / "bathos.db"), read_only=True)
|
|
479
489
|
try:
|
|
@@ -493,6 +503,7 @@ def campaign_show(
|
|
|
493
503
|
):
|
|
494
504
|
"""Show campaign details."""
|
|
495
505
|
import duckdb
|
|
506
|
+
|
|
496
507
|
from bathos.campaigns import get_campaign
|
|
497
508
|
db = duckdb.connect(str(_catalog_dir() / "bathos.db"), read_only=True)
|
|
498
509
|
try:
|
|
@@ -521,6 +532,7 @@ def campaign_review(
|
|
|
521
532
|
):
|
|
522
533
|
"""Review campaign: residual rate, bypass rate, outcome distribution."""
|
|
523
534
|
import duckdb
|
|
535
|
+
|
|
524
536
|
from bathos.campaigns import review_campaign
|
|
525
537
|
db = duckdb.connect(str(_catalog_dir() / "bathos.db"), read_only=True)
|
|
526
538
|
try:
|
|
@@ -595,9 +607,10 @@ def sync(
|
|
|
595
607
|
|
|
596
608
|
try:
|
|
597
609
|
result = sync_catalog(remote, config, catalog_dir, pull=pull)
|
|
598
|
-
direction = "
|
|
610
|
+
direction = "Pulled" if pull else "Pushed"
|
|
611
|
+
filter_msg = f" (filtered {result.filtered} from other projects)" if result.filtered > 0 else ""
|
|
599
612
|
typer.echo(
|
|
600
|
-
f"{direction
|
|
613
|
+
f"{direction} {result.transferred} runs{filter_msg} to/from '{result.remote}' in {result.duration_s:.1f}s"
|
|
601
614
|
)
|
|
602
615
|
except ValueError as e:
|
|
603
616
|
typer.echo(str(e), err=True)
|
|
@@ -624,6 +637,27 @@ def migrate(
|
|
|
624
637
|
typer.echo(" Nothing to migrate.")
|
|
625
638
|
|
|
626
639
|
|
|
640
|
+
@app.command("migrate-to-project-subdirs")
|
|
641
|
+
def migrate_to_subdirs_cmd(
|
|
642
|
+
dry_run: bool = typer.Option(False, "--dry-run", help="Show what would be moved without writing"),
|
|
643
|
+
):
|
|
644
|
+
"""Move flat cool-tier run parquets into per-project subdirectories.
|
|
645
|
+
|
|
646
|
+
Reads each run's project_slug and moves it to runs/<slug>/run_<uuid>.parquet.
|
|
647
|
+
Run this on both local and remote before using per-project sync filtering.
|
|
648
|
+
"""
|
|
649
|
+
from bathos.migrate import migrate_to_project_subdirs
|
|
650
|
+
|
|
651
|
+
result = migrate_to_project_subdirs(_catalog_dir(), dry_run=dry_run)
|
|
652
|
+
action = "Would move" if dry_run else "Moved"
|
|
653
|
+
typer.echo(f"{action} {result.moved} run(s) into per-project subdirectories.")
|
|
654
|
+
if result.skipped:
|
|
655
|
+
typer.echo(f" {result.skipped} already in place (skipped).")
|
|
656
|
+
if result.by_slug:
|
|
657
|
+
for slug, count in sorted(result.by_slug.items()):
|
|
658
|
+
typer.echo(f" {slug}: {count}")
|
|
659
|
+
|
|
660
|
+
|
|
627
661
|
@app.command("sprint-audit")
|
|
628
662
|
def sprint_audit_cmd(
|
|
629
663
|
hours: int = typer.Option(24, "--hours", help="Lookback window in hours"),
|
|
@@ -654,11 +688,11 @@ def lint(
|
|
|
654
688
|
):
|
|
655
689
|
"""Check scripts/ for naming conventions and missing sidecars."""
|
|
656
690
|
from bathos.linter import (
|
|
657
|
-
lint_project,
|
|
658
691
|
IssueSeverity,
|
|
659
|
-
check_residual_rates,
|
|
660
692
|
check_bypass_trend,
|
|
693
|
+
check_residual_rates,
|
|
661
694
|
check_unfired_branches,
|
|
695
|
+
lint_project,
|
|
662
696
|
)
|
|
663
697
|
|
|
664
698
|
issues = lint_project(project_root.resolve())
|
|
@@ -680,7 +714,11 @@ def lint(
|
|
|
680
714
|
|
|
681
715
|
for issue in issues:
|
|
682
716
|
prefix = "error" if issue.severity == IssueSeverity.ERROR else "warning"
|
|
683
|
-
|
|
717
|
+
try:
|
|
718
|
+
display_path = issue.path.relative_to(project_root.resolve())
|
|
719
|
+
except ValueError:
|
|
720
|
+
display_path = issue.path
|
|
721
|
+
typer.echo(f"{prefix}: {display_path} — {issue.issue}: {issue.detail}")
|
|
684
722
|
|
|
685
723
|
typer.echo()
|
|
686
724
|
typer.echo(f"{len(errors)} error(s), {len(warnings)} warning(s).")
|
|
@@ -716,7 +754,7 @@ def export_cmd(
|
|
|
716
754
|
dry_run: bool = typer.Option(False, "--dry-run", help="Print what would happen without writing"),
|
|
717
755
|
):
|
|
718
756
|
"""Export the using-bathos skill and register MCP server for a code tool."""
|
|
719
|
-
from bathos.export import
|
|
757
|
+
from bathos.export import ExportError, export_skill, register_mcp, resolve_target
|
|
720
758
|
|
|
721
759
|
try:
|
|
722
760
|
target = resolve_target(tool=tool, level=level)
|
|
@@ -738,8 +776,8 @@ def export_cmd(
|
|
|
738
776
|
@app.command("catalog-version")
|
|
739
777
|
def catalog_version_cmd():
|
|
740
778
|
"""Show schema version status of the catalog."""
|
|
741
|
-
from bathos.schema import CURRENT_SCHEMA_VERSION
|
|
742
779
|
from bathos.migrate import migrate_catalog
|
|
780
|
+
from bathos.schema import CURRENT_SCHEMA_VERSION
|
|
743
781
|
|
|
744
782
|
catalog_dir = _catalog_dir()
|
|
745
783
|
typer.echo(f"Current schema version: {CURRENT_SCHEMA_VERSION}")
|
|
@@ -775,3 +813,195 @@ def _parse_since(since: str | None) -> datetime | None:
|
|
|
775
813
|
if since.endswith("h"):
|
|
776
814
|
return datetime.now(UTC) - timedelta(hours=float(since[:-1]))
|
|
777
815
|
return None
|
|
816
|
+
|
|
817
|
+
|
|
818
|
+
@postmortem_app.command()
|
|
819
|
+
def scaffold(
|
|
820
|
+
run_id: str = typer.Argument(..., help="Run ID to scaffold a postmortem template for"),
|
|
821
|
+
):
|
|
822
|
+
"""Scaffold a new postmortem template for the given Run ID."""
|
|
823
|
+
from bathos.config import find_project_config, load_project_config
|
|
824
|
+
from bathos.catalog import read_runs
|
|
825
|
+
import duckdb
|
|
826
|
+
import shlex
|
|
827
|
+
|
|
828
|
+
# 1. Search for run in DB
|
|
829
|
+
run_row = None
|
|
830
|
+
db_path = _catalog_dir() / "bathos.db"
|
|
831
|
+
if db_path.exists():
|
|
832
|
+
con = duckdb.connect(str(db_path))
|
|
833
|
+
try:
|
|
834
|
+
run_row = con.execute("SELECT command, project_slug FROM runs WHERE id = ?", [run_id]).fetchone()
|
|
835
|
+
except Exception:
|
|
836
|
+
pass
|
|
837
|
+
finally:
|
|
838
|
+
con.close()
|
|
839
|
+
|
|
840
|
+
if not run_row:
|
|
841
|
+
# Check cool fragments
|
|
842
|
+
cool_runs = read_runs(_catalog_dir())
|
|
843
|
+
for r in cool_runs:
|
|
844
|
+
if r.id == run_id:
|
|
845
|
+
run_row = (r.command, r.project_slug)
|
|
846
|
+
break
|
|
847
|
+
|
|
848
|
+
if not run_row:
|
|
849
|
+
typer.echo("Run not found", err=True)
|
|
850
|
+
raise typer.Exit(1)
|
|
851
|
+
|
|
852
|
+
command = run_row[0]
|
|
853
|
+
|
|
854
|
+
# Get workspace root
|
|
855
|
+
config_path = find_project_config(Path.cwd())
|
|
856
|
+
if config_path:
|
|
857
|
+
workspace_root = load_project_config(config_path).root
|
|
858
|
+
else:
|
|
859
|
+
workspace_root = Path.cwd()
|
|
860
|
+
|
|
861
|
+
# Parse command to find the script
|
|
862
|
+
parts = shlex.split(command)
|
|
863
|
+
script_path = None
|
|
864
|
+
for part in parts:
|
|
865
|
+
p = Path(part)
|
|
866
|
+
if p.suffix == ".py":
|
|
867
|
+
script_path = workspace_root / p
|
|
868
|
+
break
|
|
869
|
+
if (workspace_root / p).is_file():
|
|
870
|
+
script_path = workspace_root / p
|
|
871
|
+
break
|
|
872
|
+
|
|
873
|
+
if not script_path:
|
|
874
|
+
# Fallback to run.py in workspace root
|
|
875
|
+
script_path = workspace_root / "run.py"
|
|
876
|
+
|
|
877
|
+
script_path.parent.mkdir(parents=True, exist_ok=True)
|
|
878
|
+
postmortem_path = script_path.parent / f"{script_path.name}.{run_id}.bth.postmortem.toml"
|
|
879
|
+
|
|
880
|
+
# Scaffold content
|
|
881
|
+
toml_content = f"""run_id = "{run_id}"
|
|
882
|
+
|
|
883
|
+
[postmortem]
|
|
884
|
+
hypothesis_status = "unassigned"
|
|
885
|
+
summary = ""
|
|
886
|
+
unexpected_observations = ""
|
|
887
|
+
root_cause = ""
|
|
888
|
+
verdict_override = "none"
|
|
889
|
+
next_steps = ""
|
|
890
|
+
author = ""
|
|
891
|
+
status = "draft"
|
|
892
|
+
|
|
893
|
+
[asset_links]
|
|
894
|
+
"""
|
|
895
|
+
postmortem_path.write_text(toml_content)
|
|
896
|
+
typer.echo(f"Scaffolded postmortem template at {postmortem_path}")
|
|
897
|
+
|
|
898
|
+
|
|
899
|
+
@postmortem_app.command()
|
|
900
|
+
def show(
|
|
901
|
+
run_id: str = typer.Argument(..., help="Run ID of the postmortem to show"),
|
|
902
|
+
strict_files: bool = typer.Option(False, "--strict-files", help="Fail if files in asset_links do not exist"),
|
|
903
|
+
):
|
|
904
|
+
"""Display and validate the postmortem for the given Run ID."""
|
|
905
|
+
from bathos.config import find_project_config, load_project_config
|
|
906
|
+
from bathos.postmortem import parse_postmortem, validate_postmortem
|
|
907
|
+
from bathos.schema import Run
|
|
908
|
+
import duckdb
|
|
909
|
+
|
|
910
|
+
config_path = find_project_config(Path.cwd())
|
|
911
|
+
if config_path:
|
|
912
|
+
workspace_root = load_project_config(config_path).root
|
|
913
|
+
else:
|
|
914
|
+
workspace_root = Path.cwd()
|
|
915
|
+
|
|
916
|
+
# Find the postmortem TOML file in workspace
|
|
917
|
+
postmortem_file = None
|
|
918
|
+
if workspace_root.exists():
|
|
919
|
+
for pm_file in workspace_root.rglob("*.bth.postmortem.toml"):
|
|
920
|
+
try:
|
|
921
|
+
pm = parse_postmortem(pm_file)
|
|
922
|
+
if pm.run_id == run_id:
|
|
923
|
+
postmortem_file = pm_file
|
|
924
|
+
break
|
|
925
|
+
except Exception:
|
|
926
|
+
pass
|
|
927
|
+
|
|
928
|
+
if not postmortem_file:
|
|
929
|
+
typer.echo("Postmortem not found", err=True)
|
|
930
|
+
raise typer.Exit(1)
|
|
931
|
+
|
|
932
|
+
pm = parse_postmortem(postmortem_file)
|
|
933
|
+
|
|
934
|
+
# Search for run in DB
|
|
935
|
+
run_obj = None
|
|
936
|
+
db_path = _catalog_dir() / "bathos.db"
|
|
937
|
+
if db_path.exists():
|
|
938
|
+
con = duckdb.connect(str(db_path))
|
|
939
|
+
try:
|
|
940
|
+
arrow_tbl = con.execute("SELECT * FROM runs WHERE id = ?", [run_id]).arrow()
|
|
941
|
+
if arrow_tbl.num_rows > 0:
|
|
942
|
+
pydict = arrow_tbl.to_pydict()
|
|
943
|
+
run_obj = Run.from_arrow_row(pydict, 0)
|
|
944
|
+
except Exception:
|
|
945
|
+
pass
|
|
946
|
+
finally:
|
|
947
|
+
con.close()
|
|
948
|
+
|
|
949
|
+
if not run_obj:
|
|
950
|
+
# Check cool fragments
|
|
951
|
+
from bathos.catalog import read_runs
|
|
952
|
+
cool_runs = read_runs(_catalog_dir())
|
|
953
|
+
for r in cool_runs:
|
|
954
|
+
if r.id == run_id:
|
|
955
|
+
run_obj = r
|
|
956
|
+
break
|
|
957
|
+
|
|
958
|
+
# Perform validation
|
|
959
|
+
result = validate_postmortem(pm, workspace_root=workspace_root, run=run_obj, strict_files=strict_files)
|
|
960
|
+
if not result.ok:
|
|
961
|
+
typer.echo("Validation failed", err=True)
|
|
962
|
+
for err in result.errors:
|
|
963
|
+
typer.echo(f"- {err.message}", err=True)
|
|
964
|
+
typer.echo(f"Hypothesis status: {pm.hypothesis_status}", err=True)
|
|
965
|
+
typer.echo(f"Verdict override: {pm.verdict_override}", err=True)
|
|
966
|
+
raise typer.Exit(1)
|
|
967
|
+
|
|
968
|
+
typer.echo(f"Run ID: {pm.run_id}")
|
|
969
|
+
typer.echo(f"Status: {pm.status}")
|
|
970
|
+
typer.echo(f"Hypothesis Status: {pm.hypothesis_status}")
|
|
971
|
+
typer.echo(f"Verdict Override: {pm.verdict_override}")
|
|
972
|
+
typer.echo(f"Summary: {pm.summary}")
|
|
973
|
+
if pm.asset_links:
|
|
974
|
+
typer.echo(f"Asset Links: {pm.asset_links}")
|
|
975
|
+
|
|
976
|
+
|
|
977
|
+
@postmortem_app.command()
|
|
978
|
+
def validate(
|
|
979
|
+
file: Path = typer.Argument(..., help="Path to .bth.postmortem.toml file to validate"),
|
|
980
|
+
strict: bool = typer.Option(False, "--strict", help="Treat missing run ID as error"),
|
|
981
|
+
strict_files: bool = typer.Option(False, "--strict-files", help="Treat missing asset files as error"),
|
|
982
|
+
):
|
|
983
|
+
"""Validate a postmortem TOML file for structural and logical correctness."""
|
|
984
|
+
from bathos.postmortem import parse_postmortem, validate_postmortem
|
|
985
|
+
from bathos.config import find_project_config, load_project_config
|
|
986
|
+
|
|
987
|
+
if not file.exists():
|
|
988
|
+
typer.echo(f"File not found: {file}", err=True)
|
|
989
|
+
raise typer.Exit(1)
|
|
990
|
+
|
|
991
|
+
try:
|
|
992
|
+
pm = parse_postmortem(file)
|
|
993
|
+
except Exception as e:
|
|
994
|
+
typer.echo(f"Parse error: {e}", err=True)
|
|
995
|
+
raise typer.Exit(1)
|
|
996
|
+
|
|
997
|
+
config_path = find_project_config(Path.cwd())
|
|
998
|
+
workspace_root = load_project_config(config_path).root if config_path else Path.cwd()
|
|
999
|
+
|
|
1000
|
+
result = validate_postmortem(pm, workspace_root=workspace_root, strict=strict, strict_files=strict_files)
|
|
1001
|
+
if result.ok:
|
|
1002
|
+
typer.echo(f"✓ {file.name} is valid")
|
|
1003
|
+
else:
|
|
1004
|
+
typer.echo(f"✗ Validation failed for {file.name}:", err=True)
|
|
1005
|
+
for err in result.errors:
|
|
1006
|
+
typer.echo(f" - {err.message}", err=True)
|
|
1007
|
+
raise typer.Exit(1)
|
|
@@ -99,9 +99,26 @@ def _migrate_v2(run_dict: dict) -> dict:
|
|
|
99
99
|
return run_dict
|
|
100
100
|
|
|
101
101
|
|
|
102
|
+
def _migrate_v3(run_dict: dict) -> dict:
|
|
103
|
+
"""Migrate v3 fragment to v4 by adding postmortem fields."""
|
|
104
|
+
run_dict["script_sha256"] = ""
|
|
105
|
+
run_dict["postmortem_status"] = "unassigned"
|
|
106
|
+
run_dict["postmortem_override"] = "none"
|
|
107
|
+
run_dict["postmortem_verdict_override"] = "none"
|
|
108
|
+
run_dict["postmortem_author"] = ""
|
|
109
|
+
run_dict["postmortem_path"] = ""
|
|
110
|
+
run_dict["postmortem_hypothesis_status"] = "unassigned"
|
|
111
|
+
run_dict["postmortem_has_anomalies"] = False
|
|
112
|
+
run_dict["postmortem_summary"] = ""
|
|
113
|
+
run_dict["postmortem_asset_links"] = "{}"
|
|
114
|
+
run_dict["schema_version"] = "4"
|
|
115
|
+
return run_dict
|
|
116
|
+
|
|
117
|
+
|
|
102
118
|
MIGRATIONS["0"] = _migrate_v0
|
|
103
119
|
MIGRATIONS["1"] = _migrate_v1
|
|
104
120
|
MIGRATIONS["2"] = _migrate_v2
|
|
121
|
+
MIGRATIONS["3"] = _migrate_v3
|
|
105
122
|
|
|
106
123
|
|
|
107
124
|
_RUNS_TABLE_SCHEMA = """
|
|
@@ -132,7 +149,17 @@ CREATE TABLE IF NOT EXISTS runs (
|
|
|
132
149
|
sidecar_mode TEXT,
|
|
133
150
|
outcome_is_residual BOOLEAN,
|
|
134
151
|
skill_sha256 TEXT,
|
|
135
|
-
campaign_id TEXT
|
|
152
|
+
campaign_id TEXT,
|
|
153
|
+
script_sha256 TEXT,
|
|
154
|
+
postmortem_status TEXT,
|
|
155
|
+
postmortem_override TEXT,
|
|
156
|
+
postmortem_verdict_override TEXT,
|
|
157
|
+
postmortem_author TEXT,
|
|
158
|
+
postmortem_path TEXT,
|
|
159
|
+
postmortem_hypothesis_status TEXT,
|
|
160
|
+
postmortem_has_anomalies BOOLEAN,
|
|
161
|
+
postmortem_summary TEXT,
|
|
162
|
+
postmortem_asset_links TEXT
|
|
136
163
|
)
|
|
137
164
|
"""
|
|
138
165
|
|
|
@@ -180,7 +207,7 @@ def _fragment_count(catalog_dir: Path) -> int:
|
|
|
180
207
|
runs_dir = catalog_dir / "runs"
|
|
181
208
|
if not runs_dir.exists():
|
|
182
209
|
return 0
|
|
183
|
-
return len(list(runs_dir.
|
|
210
|
+
return len(list(runs_dir.rglob("run_*.parquet")))
|
|
184
211
|
|
|
185
212
|
|
|
186
213
|
def should_compact(catalog_dir: Path) -> bool:
|
|
@@ -238,6 +265,28 @@ def compact(catalog_dir: Path) -> CompactResult:
|
|
|
238
265
|
# Read all runs from cool fragments (read_runs snapshots file list internally)
|
|
239
266
|
cool_runs = read_runs(catalog_dir)
|
|
240
267
|
|
|
268
|
+
# Parse all postmortems in workspace
|
|
269
|
+
from bathos.config import find_project_config, load_project_config
|
|
270
|
+
from bathos.postmortem import parse_postmortem
|
|
271
|
+
|
|
272
|
+
postmortem_map = {}
|
|
273
|
+
config_path = find_project_config(Path.cwd())
|
|
274
|
+
if config_path:
|
|
275
|
+
project_config = load_project_config(config_path)
|
|
276
|
+
workspace_root = project_config.root
|
|
277
|
+
else:
|
|
278
|
+
workspace_root = Path.cwd()
|
|
279
|
+
|
|
280
|
+
if workspace_root.exists():
|
|
281
|
+
for pm_file in workspace_root.rglob("*.bth.postmortem.toml"):
|
|
282
|
+
try:
|
|
283
|
+
pm = parse_postmortem(pm_file)
|
|
284
|
+
if pm.status != "draft":
|
|
285
|
+
rel_path = str(pm_file.relative_to(workspace_root))
|
|
286
|
+
postmortem_map[pm.run_id] = (pm, rel_path)
|
|
287
|
+
except Exception:
|
|
288
|
+
pass
|
|
289
|
+
|
|
241
290
|
# Open DuckDB connection
|
|
242
291
|
db_path = catalog_dir / "bathos.db"
|
|
243
292
|
con = duckdb.connect(str(db_path))
|
|
@@ -273,11 +322,63 @@ def compact(catalog_dir: Path) -> CompactResult:
|
|
|
273
322
|
|
|
274
323
|
if existing:
|
|
275
324
|
skipped += 1
|
|
325
|
+
if run.id in postmortem_map:
|
|
326
|
+
pm, rel_path = postmortem_map[run.id]
|
|
327
|
+
postmortem_verdict_override = pm.verdict_override
|
|
328
|
+
postmortem_has_anomalies = any(v and str(v).lower() != "none" for v in getattr(pm, "anomalies", {}).values())
|
|
329
|
+
|
|
330
|
+
curr_outcome = con.execute("SELECT outcome FROM runs WHERE id = ?", [run.id]).fetchone()[0] or ""
|
|
331
|
+
outcome = postmortem_verdict_override if postmortem_verdict_override != "none" else curr_outcome
|
|
332
|
+
|
|
333
|
+
con.execute(
|
|
334
|
+
"""
|
|
335
|
+
UPDATE runs SET
|
|
336
|
+
outcome = ?,
|
|
337
|
+
postmortem_status = ?,
|
|
338
|
+
postmortem_override = ?,
|
|
339
|
+
postmortem_verdict_override = ?,
|
|
340
|
+
postmortem_author = ?,
|
|
341
|
+
postmortem_path = ?,
|
|
342
|
+
postmortem_hypothesis_status = ?,
|
|
343
|
+
postmortem_has_anomalies = ?,
|
|
344
|
+
postmortem_summary = ?,
|
|
345
|
+
postmortem_asset_links = ?
|
|
346
|
+
WHERE id = ?
|
|
347
|
+
""",
|
|
348
|
+
[
|
|
349
|
+
outcome,
|
|
350
|
+
pm.status,
|
|
351
|
+
pm.verdict_override,
|
|
352
|
+
pm.verdict_override,
|
|
353
|
+
pm.author,
|
|
354
|
+
rel_path,
|
|
355
|
+
pm.hypothesis_status,
|
|
356
|
+
postmortem_has_anomalies,
|
|
357
|
+
pm.summary,
|
|
358
|
+
json.dumps(pm.asset_links),
|
|
359
|
+
run.id
|
|
360
|
+
]
|
|
361
|
+
)
|
|
276
362
|
continue
|
|
277
363
|
|
|
278
364
|
# Apply migrations if needed
|
|
279
365
|
run = _apply_migrations(run)
|
|
280
366
|
|
|
367
|
+
# Apply postmortem updates to run object if present
|
|
368
|
+
if run.id in postmortem_map:
|
|
369
|
+
pm, rel_path = postmortem_map[run.id]
|
|
370
|
+
run.postmortem_status = pm.status
|
|
371
|
+
run.postmortem_override = pm.verdict_override
|
|
372
|
+
run.postmortem_verdict_override = pm.verdict_override
|
|
373
|
+
run.postmortem_author = pm.author
|
|
374
|
+
run.postmortem_path = rel_path
|
|
375
|
+
run.postmortem_hypothesis_status = pm.hypothesis_status
|
|
376
|
+
run.postmortem_has_anomalies = any(v and str(v).lower() != "none" for v in getattr(pm, "anomalies", {}).values())
|
|
377
|
+
run.postmortem_summary = pm.summary
|
|
378
|
+
run.postmortem_asset_links = json.dumps(pm.asset_links)
|
|
379
|
+
if pm.verdict_override != "none":
|
|
380
|
+
run.outcome = pm.verdict_override
|
|
381
|
+
|
|
281
382
|
# Collect output metadata
|
|
282
383
|
output_metadata = []
|
|
283
384
|
if run.output_paths:
|
|
@@ -295,8 +396,10 @@ def compact(catalog_dir: Path) -> CompactResult:
|
|
|
295
396
|
id, project_slug, command, argv, git_hash, git_branch,
|
|
296
397
|
git_dirty, timestamp, duration_s, exit_code, status,
|
|
297
398
|
output_paths, tags, schema_version, slurm_job_id, hostname, metadata, outcome, output_metadata,
|
|
298
|
-
sidecar_sha256, sidecar_path, parent_run_id, agent_mode, sidecar_mode, outcome_is_residual, skill_sha256, campaign_id
|
|
299
|
-
|
|
399
|
+
sidecar_sha256, sidecar_path, parent_run_id, agent_mode, sidecar_mode, outcome_is_residual, skill_sha256, campaign_id,
|
|
400
|
+
script_sha256, postmortem_status, postmortem_override, postmortem_verdict_override, postmortem_author, postmortem_path,
|
|
401
|
+
postmortem_hypothesis_status, postmortem_has_anomalies, postmortem_summary, postmortem_asset_links
|
|
402
|
+
) VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?)
|
|
300
403
|
""",
|
|
301
404
|
[
|
|
302
405
|
run.id,
|
|
@@ -326,6 +429,16 @@ def compact(catalog_dir: Path) -> CompactResult:
|
|
|
326
429
|
run.outcome_is_residual,
|
|
327
430
|
run.skill_sha256,
|
|
328
431
|
run.campaign_id,
|
|
432
|
+
run.script_sha256,
|
|
433
|
+
run.postmortem_status,
|
|
434
|
+
run.postmortem_override,
|
|
435
|
+
run.postmortem_verdict_override,
|
|
436
|
+
run.postmortem_author,
|
|
437
|
+
run.postmortem_path,
|
|
438
|
+
run.postmortem_hypothesis_status,
|
|
439
|
+
run.postmortem_has_anomalies,
|
|
440
|
+
run.postmortem_summary,
|
|
441
|
+
run.postmortem_asset_links,
|
|
329
442
|
],
|
|
330
443
|
)
|
|
331
444
|
|
|
@@ -14,13 +14,16 @@ class ProjectConfig:
|
|
|
14
14
|
catalog_dir: Path = field(default_factory=lambda: Path.home() / ".bth" / "catalog")
|
|
15
15
|
remotes: dict[str, dict] = field(default_factory=dict)
|
|
16
16
|
slurm: dict = field(default_factory=dict)
|
|
17
|
+
sync_filter: str = "project_slug"
|
|
17
18
|
|
|
18
19
|
|
|
19
20
|
def default_catalog_dir() -> Path:
|
|
20
21
|
return Path.home() / ".bth" / "catalog"
|
|
21
22
|
|
|
22
23
|
|
|
23
|
-
def find_project_config(start: Path =
|
|
24
|
+
def find_project_config(start: Path | None = None) -> Path | None:
|
|
25
|
+
if start is None:
|
|
26
|
+
start = Path.cwd()
|
|
24
27
|
for directory in [start, *start.parents]:
|
|
25
28
|
candidate = directory / ".bth.toml"
|
|
26
29
|
if candidate.exists():
|
|
@@ -38,6 +41,7 @@ def load_project_config(path: Path) -> ProjectConfig:
|
|
|
38
41
|
catalog_dir=Path(project["catalog_dir"]) if "catalog_dir" in project else default_catalog_dir(),
|
|
39
42
|
remotes=data.get("remotes", {}),
|
|
40
43
|
slurm=data.get("slurm", {}),
|
|
44
|
+
sync_filter=project.get("sync_filter", "project_slug"),
|
|
41
45
|
)
|
|
42
46
|
|
|
43
47
|
|