runops 2.9.1__tar.gz → 2.10.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 (126) hide show
  1. {runops-2.9.1 → runops-2.10.0}/PKG-INFO +1 -1
  2. {runops-2.9.1 → runops-2.10.0}/SPEC.md +4 -2
  3. {runops-2.9.1 → runops-2.10.0}/docs/guide.md +1 -0
  4. {runops-2.9.1 → runops-2.10.0}/docs/reference.md +1 -1
  5. {runops-2.9.1 → runops-2.10.0}/pyproject.toml +1 -1
  6. {runops-2.9.1 → runops-2.10.0}/src/runops/__init__.py +1 -1
  7. {runops-2.9.1 → runops-2.10.0}/src/runops/cli.py +6 -1
  8. {runops-2.9.1 → runops-2.10.0}/src/runops/ops/setup.py +38 -4
  9. {runops-2.9.1 → runops-2.10.0}/src/runops/skills/runops-reference/SKILL.md +1 -1
  10. {runops-2.9.1 → runops-2.10.0}/tests/conftest.py +1 -1
  11. {runops-2.9.1 → runops-2.10.0}/tests/test_analysis_layout.py +1 -3
  12. {runops-2.9.1 → runops-2.10.0}/tests/test_setup_misc.py +48 -2
  13. {runops-2.9.1 → runops-2.10.0}/uv.lock +1 -1
  14. {runops-2.9.1 → runops-2.10.0}/.agents/skills/check/SKILL.md +0 -0
  15. {runops-2.9.1 → runops-2.10.0}/.agents/skills/improve-harness/SKILL.md +0 -0
  16. {runops-2.9.1 → runops-2.10.0}/.agents/skills/python-package-refactor/SKILL.md +0 -0
  17. {runops-2.9.1 → runops-2.10.0}/.agents/skills/python-package-refactor/agents/openai.yaml +0 -0
  18. {runops-2.9.1 → runops-2.10.0}/.agents/skills/python-package-refactor/examples/refactor-request.md +0 -0
  19. {runops-2.9.1 → runops-2.10.0}/.agents/skills/python-package-refactor/references/anti-patterns.md +0 -0
  20. {runops-2.9.1 → runops-2.10.0}/.agents/skills/python-package-refactor/references/api-compatibility.md +0 -0
  21. {runops-2.9.1 → runops-2.10.0}/.agents/skills/python-package-refactor/references/packaging-modernization.md +0 -0
  22. {runops-2.9.1 → runops-2.10.0}/.agents/skills/python-package-refactor/references/refactor-playbook.md +0 -0
  23. {runops-2.9.1 → runops-2.10.0}/.agents/skills/python-package-refactor/references/verification.md +0 -0
  24. {runops-2.9.1 → runops-2.10.0}/.agents/skills/python-package-refactor/scripts/api_surface_snapshot.py +0 -0
  25. {runops-2.9.1 → runops-2.10.0}/.agents/skills/python-package-refactor/scripts/import_smoke.py +0 -0
  26. {runops-2.9.1 → runops-2.10.0}/.agents/skills/python-package-refactor/scripts/inspect_python_package.py +0 -0
  27. {runops-2.9.1 → runops-2.10.0}/.agents/skills/python-package-refactor/scripts/refactor_quality_gate.py +0 -0
  28. {runops-2.9.1 → runops-2.10.0}/.agents/skills/release/SKILL.md +0 -0
  29. {runops-2.9.1 → runops-2.10.0}/.agents/skills/simulator-adapter/SKILL.md +0 -0
  30. {runops-2.9.1 → runops-2.10.0}/.agents/skills/spec-reviewer/SKILL.md +0 -0
  31. {runops-2.9.1 → runops-2.10.0}/.agents/skills/sync-docs/SKILL.md +0 -0
  32. {runops-2.9.1 → runops-2.10.0}/.claude/agents/spec-reviewer.md +0 -0
  33. {runops-2.9.1 → runops-2.10.0}/.claude/rules/architecture.md +0 -0
  34. {runops-2.9.1 → runops-2.10.0}/.claude/rules/dev-workflow.md +0 -0
  35. {runops-2.9.1 → runops-2.10.0}/.claude/rules/gotchas.md +0 -0
  36. {runops-2.9.1 → runops-2.10.0}/.claude/settings.json +0 -0
  37. {runops-2.9.1 → runops-2.10.0}/.claude/skills/check/SKILL.md +0 -0
  38. {runops-2.9.1 → runops-2.10.0}/.claude/skills/improve-harness/SKILL.md +0 -0
  39. {runops-2.9.1 → runops-2.10.0}/.claude/skills/python-package-refactor/SKILL.md +0 -0
  40. {runops-2.9.1 → runops-2.10.0}/.claude/skills/release/SKILL.md +0 -0
  41. {runops-2.9.1 → runops-2.10.0}/.claude/skills/simulator-adapter/SKILL.md +0 -0
  42. {runops-2.9.1 → runops-2.10.0}/.claude/skills/spec-reviewer/SKILL.md +0 -0
  43. {runops-2.9.1 → runops-2.10.0}/.claude/skills/sync-docs/SKILL.md +0 -0
  44. {runops-2.9.1 → runops-2.10.0}/.codex/README.md +0 -0
  45. {runops-2.9.1 → runops-2.10.0}/.codex/agents/spec-reviewer.toml +0 -0
  46. {runops-2.9.1 → runops-2.10.0}/.codex/config.toml +0 -0
  47. {runops-2.9.1 → runops-2.10.0}/.codex/rules/runops.rules +0 -0
  48. {runops-2.9.1 → runops-2.10.0}/.dockerignore +0 -0
  49. {runops-2.9.1 → runops-2.10.0}/.gitattributes +0 -0
  50. {runops-2.9.1 → runops-2.10.0}/.github/assets/conversation-dark.svg +0 -0
  51. {runops-2.9.1 → runops-2.10.0}/.github/assets/conversation-light.svg +0 -0
  52. {runops-2.9.1 → runops-2.10.0}/.github/assets/hero-dark.svg +0 -0
  53. {runops-2.9.1 → runops-2.10.0}/.github/assets/hero-light.svg +0 -0
  54. {runops-2.9.1 → runops-2.10.0}/.github/assets/make_readme_art.py +0 -0
  55. {runops-2.9.1 → runops-2.10.0}/.github/workflows/ci.yml +0 -0
  56. {runops-2.9.1 → runops-2.10.0}/.github/workflows/publish.yml +0 -0
  57. {runops-2.9.1 → runops-2.10.0}/.gitignore +0 -0
  58. {runops-2.9.1 → runops-2.10.0}/.pre-commit-config.yaml +0 -0
  59. {runops-2.9.1 → runops-2.10.0}/.vscode/settings.json +0 -0
  60. {runops-2.9.1 → runops-2.10.0}/AGENTS.md +0 -0
  61. {runops-2.9.1 → runops-2.10.0}/CLAUDE.md +0 -0
  62. {runops-2.9.1 → runops-2.10.0}/LICENSE +0 -0
  63. {runops-2.9.1 → runops-2.10.0}/README.md +0 -0
  64. {runops-2.9.1 → runops-2.10.0}/docs/adapter.md +0 -0
  65. {runops-2.9.1 → runops-2.10.0}/src/runops/adapters/__init__.py +0 -0
  66. {runops-2.9.1 → runops-2.10.0}/src/runops/adapters/base.py +0 -0
  67. {runops-2.9.1 → runops-2.10.0}/src/runops/adapters/generic.py +0 -0
  68. {runops-2.9.1 → runops-2.10.0}/src/runops/adapters/registry.py +0 -0
  69. {runops-2.9.1 → runops-2.10.0}/src/runops/case.py +0 -0
  70. {runops-2.9.1 → runops-2.10.0}/src/runops/config.py +0 -0
  71. {runops-2.9.1 → runops-2.10.0}/src/runops/errors.py +0 -0
  72. {runops-2.9.1 → runops-2.10.0}/src/runops/harness.py +0 -0
  73. {runops-2.9.1 → runops-2.10.0}/src/runops/jobgen.py +0 -0
  74. {runops-2.9.1 → runops-2.10.0}/src/runops/launchers.py +0 -0
  75. {runops-2.9.1 → runops-2.10.0}/src/runops/legacy_adapters/__init__.py +0 -0
  76. {runops-2.9.1 → runops-2.10.0}/src/runops/legacy_adapters/beach.py +0 -0
  77. {runops-2.9.1 → runops-2.10.0}/src/runops/legacy_adapters/emses.py +0 -0
  78. {runops-2.9.1 → runops-2.10.0}/src/runops/manifest.py +0 -0
  79. {runops-2.9.1 → runops-2.10.0}/src/runops/ops/__init__.py +0 -0
  80. {runops-2.9.1 → runops-2.10.0}/src/runops/ops/analysis.py +0 -0
  81. {runops-2.9.1 → runops-2.10.0}/src/runops/ops/common.py +0 -0
  82. {runops-2.9.1 → runops-2.10.0}/src/runops/ops/create.py +0 -0
  83. {runops-2.9.1 → runops-2.10.0}/src/runops/ops/listing.py +0 -0
  84. {runops-2.9.1 → runops-2.10.0}/src/runops/ops/notes.py +0 -0
  85. {runops-2.9.1 → runops-2.10.0}/src/runops/ops/progress.py +0 -0
  86. {runops-2.9.1 → runops-2.10.0}/src/runops/ops/skills.py +0 -0
  87. {runops-2.9.1 → runops-2.10.0}/src/runops/ops/submit.py +0 -0
  88. {runops-2.9.1 → runops-2.10.0}/src/runops/ops/sync.py +0 -0
  89. {runops-2.9.1 → runops-2.10.0}/src/runops/ops/tidy.py +0 -0
  90. {runops-2.9.1 → runops-2.10.0}/src/runops/project.py +0 -0
  91. {runops-2.9.1 → runops-2.10.0}/src/runops/runtime.py +0 -0
  92. {runops-2.9.1 → runops-2.10.0}/src/runops/skills/runops-analyze/SKILL.md +0 -0
  93. {runops-2.9.1 → runops-2.10.0}/src/runops/skills/runops-analyze/example-report/README.md +0 -0
  94. {runops-2.9.1 → runops-2.10.0}/src/runops/skills/runops-analyze/example-report/out/fig1_maps.png +0 -0
  95. {runops-2.9.1 → runops-2.10.0}/src/runops/skills/runops-analyze/example-report/out/fig2_dependence.png +0 -0
  96. {runops-2.9.1 → runops-2.10.0}/src/runops/skills/runops-analyze/example-report/out/values.csv +0 -0
  97. {runops-2.9.1 → runops-2.10.0}/src/runops/skills/runops-analyze/example-report/report.html +0 -0
  98. {runops-2.9.1 → runops-2.10.0}/src/runops/skills/runops-analyze/example-report/scripts/build_html.py +0 -0
  99. {runops-2.9.1 → runops-2.10.0}/src/runops/skills/runops-analyze/example-report/scripts/make_figures.py +0 -0
  100. {runops-2.9.1 → runops-2.10.0}/src/runops/skills/runops-analyze/report-guide.md +0 -0
  101. {runops-2.9.1 → runops-2.10.0}/src/runops/skills/runops-check-status/SKILL.md +0 -0
  102. {runops-2.9.1 → runops-2.10.0}/src/runops/skills/runops-create-run/SKILL.md +0 -0
  103. {runops-2.9.1 → runops-2.10.0}/src/runops/skills/runops-maintain/SKILL.md +0 -0
  104. {runops-2.9.1 → runops-2.10.0}/src/runops/skills/runops-tidy/SKILL.md +0 -0
  105. {runops-2.9.1 → runops-2.10.0}/src/runops/slurm.py +0 -0
  106. {runops-2.9.1 → runops-2.10.0}/src/runops/util.py +0 -0
  107. {runops-2.9.1 → runops-2.10.0}/tests/__init__.py +0 -0
  108. {runops-2.9.1 → runops-2.10.0}/tests/golden/mpi_standard.sh +0 -0
  109. {runops-2.9.1 → runops-2.10.0}/tests/golden/openmp_rsc.sh +0 -0
  110. {runops-2.9.1 → runops-2.10.0}/tests/test_adapters.py +0 -0
  111. {runops-2.9.1 → runops-2.10.0}/tests/test_archive_series.py +0 -0
  112. {runops-2.9.1 → runops-2.10.0}/tests/test_build.py +0 -0
  113. {runops-2.9.1 → runops-2.10.0}/tests/test_dev_harness.py +0 -0
  114. {runops-2.9.1 → runops-2.10.0}/tests/test_jobgen.py +0 -0
  115. {runops-2.9.1 → runops-2.10.0}/tests/test_legacy_adapters.py +0 -0
  116. {runops-2.9.1 → runops-2.10.0}/tests/test_lifecycle.py +0 -0
  117. {runops-2.9.1 → runops-2.10.0}/tests/test_manifest_config.py +0 -0
  118. {runops-2.9.1 → runops-2.10.0}/tests/test_mv_naming.py +0 -0
  119. {runops-2.9.1 → runops-2.10.0}/tests/test_progress.py +0 -0
  120. {runops-2.9.1 → runops-2.10.0}/tests/test_project_scope.py +0 -0
  121. {runops-2.9.1 → runops-2.10.0}/tests/test_run_job.py +0 -0
  122. {runops-2.9.1 → runops-2.10.0}/tests/test_safety.py +0 -0
  123. {runops-2.9.1 → runops-2.10.0}/tests/test_scratch_tidy.py +0 -0
  124. {runops-2.9.1 → runops-2.10.0}/tests/test_skills.py +0 -0
  125. {runops-2.9.1 → runops-2.10.0}/tests/test_sweep.py +0 -0
  126. {runops-2.9.1 → runops-2.10.0}/tests/test_sync_evidence.py +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.5
2
2
  Name: runops
3
- Version: 2.9.1
3
+ Version: 2.10.0
4
4
  Summary: Run ledger and Slurm job submission for HPC simulation projects
5
5
  Project-URL: Homepage, https://github.com/Nkzono99/runops
6
6
  Project-URL: Documentation, https://github.com/Nkzono99/runops/blob/main/docs/reference.md
@@ -541,7 +541,7 @@ Organize(`pin`、`archive`、`mv`、`restore`、`delete`、`tidy`)、Project
541
541
 
542
542
  | command | 効果 |
543
543
  |---|---|
544
- | `runo init [SIM...] [--site kudpc\|standard] [--no-install] [-y]` | `runops.toml`、`cases/`、`runs/`、`LOG.md`、`AGENTS.md`、`.venv` を作る。SIM ごとに adapter package を `.venv` に install し、skill を展開する(§8)。端末から引数なしで実行すると site と simulator を尋ねる。`--site` が無ければ host 名から推定する(KUDPC のログインノードなら `kudpc`) |
544
+ | `runo init [SIM...] [--site kudpc\|standard] [--no-install] [--no-git] [-y]` | `runops.toml`、`cases/`、`runs/`、`LOG.md`、`AGENTS.md`、`.venv` を作る。git repository の外なら `git init`(branch `main`)して、作ったものを最初の commit(`runo init`)にする(`--no-git` で行わない)。SIM ごとに adapter package を `.venv` に install し、skill を展開する(§8)。端末から引数なしで実行すると site と simulator を尋ねる。`--site` が無ければ host 名から推定する(KUDPC のログインノードなら `kudpc`) |
545
545
  | `runo doctor [--json]` | `runops.toml` の妥当性、adapter の import 可否、`.venv` に無い package(§4)、executable の存在、`sbatch` の有無、skill の鮮度を検査 |
546
546
  | `runo update [--skills-only] [-y]` | adapter package を upgrade し、skill を再展開する |
547
547
  | `runo build SIM [--force]` | `local_source` simulator を `.runops/build/` に build する(§4.1) |
@@ -824,7 +824,8 @@ seal、index を持たない)。
824
824
  - 調査 directory は `README.md`(問い・対象 run id・方法・結果・制約)、`scripts/`
825
825
  (Python、sbatch)、`out/`(図・JSON・CSV)、`logs/`(job の stdout/stderr)からなる。
826
826
  topic は内容で名付け、同じ問いは README に日付付きで追記する。
827
- - `init` の `.gitignore` は `**/logs/`、`__pycache__/`、`.runops/analysis-env/` を含む。
827
+ - `init` の `.gitignore` は `.runops/*`(`last_run_id` と `skills.lock` は残す)、`**/logs/`、`__pycache__/`、
828
+ `runs/**/work/`、`analysis/**/work/` を含む。
828
829
  既存 project のファイルは自動で再配置しない。
829
830
  - `context` は現用 group の `_analysis/*/README.md` がある topic 名を表示し、
830
831
  `--json` では `group_analysis` に project 相対の group path → topic 名一覧を返す。
@@ -1058,5 +1059,6 @@ v2 の文書は次の 4 ファイルだけにする。
1058
1059
  | 常用と保守の案内(2026-11-12) | `runo --help` を typer の `rich_help_panel` で 4 panel に分け、生成 AGENTS.md と `runops-reference` の表を常用(作成と投入、監視、整理)と保守(`init`、`doctor`、`update`、`build`)に分ける。command は削らない | 利用痕跡では作成・投入・監視・復旧・保管が常用で、保守の command は project の準備と更新のときだけ使われていた。常に読む案内を常用の command に寄せる |
1059
1060
  | 代表値と再現性の書き方(2026-11-12) | `runops-analyze` の `report-guide.md` に 2 点を足す: 代表値の図には平均する領域・重み・基準を本文に書く。再現性の検査は bitwise の一致、標本のばらつき、物理量の許容差を分けて設計する | 面積平均した電位の基準と領域が読み手と食い違った。並列 Monte Carlo の逐点一致を求めて、加算順序の違いを不一致と取り違えた |
1060
1061
  | 起動検査の書き方(2026-11-12) | `runops-create-run` に節を置く: 短い起動検査は起動と物理設定の成立だけを判定し、定常性・統計誤差・収束は別に評価する。止める条件と警告を分け、閾値に根拠と分母を添え、項目ごとの判定・実測値・単位・閾値・script の版を JSON に残す。代表 1 配置の検査を他の配置に広げない。runops は判定を持たない(§1.4) | 起動検査に運用判断を混ぜて厳しくしすぎた例と、代表 1 配置の試験が他の配置の不良を拾えなかった例が続いた。判定の記録を runops が持つ案は、2 例目が出るまで見送る |
1062
+ | `init` が git を始める(2026-11-21) | git repository の外で `init` すると `git init` と最初の commit を行う。`git` が無い、commit に失敗した(user の設定が無いなど)ときは warning を出して続ける。`.gitignore` は `.runops/*` を外して記録の file だけ戻す | project は git 管理を想定していたのに `init` は `.gitignore` を書くだけで、10 project のうち git だったのは自前の repository を持つ 1 つだけだった。`.runops/` の下の cache(snapshot、source、実行 file)が数 GB になり、個別に外す方式では追いつかなかった |
1061
1063
  | command の削除(2026-11-12) | `runo summarize` と adapter の `summarize()` hook、`runo migrate-v1` と `ops/migrate.py` を外す(command 23)。既存 run の `analysis/summary.json` は消さず、読む機能も無い。v1 project には runops 2.8 の `migrate-v1` を案内する(§11)。`legacy_adapters/` は `init` が使うので残す | 4 project の利用痕跡で v2 形式の summary は 6 件だけで、adapter の inspect や project の解析と重複していた。v1 からの移行は一度限りで、残る v1 project も 2.8 で変換できる。上限 25 の枠を常用の機能に残す |
1062
1064
  | 使い方ガイド | `docs/guide.md` を追加し、文書を 4 ファイルにする(§13.3) | README の依頼例の表と command 一覧の間を埋める、場面ごとの流れ(case と run の分け方、smoke から本計算、状態の決まり方、整理)の置き場所が無かった |
@@ -22,6 +22,7 @@ runo init
22
22
  | `cases/`、`runs/` | 入力テンプレートと、実行した run の置き場所 |
23
23
  | `LOG.md`、`notes/` | 判断の記録と、再利用する知見の置き場所([6 節](#6-記録を残す)) |
24
24
  | `.venv/` | simulator の Python package(adapter と skill を含む) |
25
+ | `.git/`、`.gitignore` | 入力と記録の履歴。最初の commit まで `runo init` が作る(計算の出力と `.runops/` の cache は外す) |
25
26
  | `AGENTS.md`、`CLAUDE.md`、`.agents/skills/`、`.claude/skills/` | エージェント向けの規則と skill |
26
27
 
27
28
  この directory で Codex か Claude Code を起動し、調べたいことを話しかけてください。
@@ -185,7 +185,7 @@ project の保守(設定、package、build):
185
185
 
186
186
  | command | 動作 |
187
187
  |---|---|
188
- | `runo init [SIM...] [--site kudpc\|standard] [--no-install] [-y]` | project を作る。`SIM` は `emses` や `name=package-spec`。端末から引数なしで実行すると site と simulator を尋ねる。`--site` の既定はホスト名から推定(KUDPC のログインノードなら `kudpc`、`camphor` も同義) |
188
+ | `runo init [SIM...] [--site kudpc\|standard] [--no-install] [--no-git] [-y]` | project を作る。git repository の外なら `git init` して最初の commit を作る(`--no-git` で行わない)。`SIM` は `emses` や `name=package-spec`。端末から引数なしで実行すると site と simulator を尋ねる。`--site` の既定はホスト名から推定(KUDPC のログインノードなら `kudpc`、`camphor` も同義) |
189
189
  | `runo doctor [--json]` | 設定、adapter の解決経路、`.venv` に無い package、executable、sbatch、skill の鮮度とリンク切れを点検 |
190
190
  | `runo update [--skills-only] [-y]` | simulator package を更新し skill と AGENTS.md の管理 block を再生成。`package` を指定した simulator でも、adapter の `pip_packages()` にある他の package(emses の emout など)が `.venv` に無ければ入れる |
191
191
  | `runo build SIM [--force]` | `local_source` の simulator を build |
@@ -4,7 +4,7 @@ build-backend = "hatchling.build"
4
4
 
5
5
  [project]
6
6
  name = "runops"
7
- version = "2.9.1"
7
+ version = "2.10.0"
8
8
  description = "Run ledger and Slurm job submission for HPC simulation projects"
9
9
  readme = "README.md"
10
10
  license = "Apache-2.0"
@@ -1,3 +1,3 @@
1
1
  """runops: run ledger and Slurm job submission for HPC simulation projects."""
2
2
 
3
- __version__ = "2.9.1"
3
+ __version__ = "2.10.0"
@@ -178,6 +178,9 @@ def init(
178
178
  no_install: bool = typer.Option(
179
179
  False, "--no-install", help="Do not create .venv or install packages."
180
180
  ),
181
+ no_git: bool = typer.Option(
182
+ False, "--no-git", help="Do not start a git repository (none is started inside one)."
183
+ ),
181
184
  yes: bool = typer.Option(False, "-y", "--yes"),
182
185
  ) -> None:
183
186
  """Create a runops project in the current directory.
@@ -200,7 +203,7 @@ def init(
200
203
  install = not no_install
201
204
  if sims and install and any(s.split("=")[0] != "generic" for s in sims):
202
205
  install = _ask_install(root, yes)
203
- report = init_project(root, sims, site=site, name=name, install=install)
206
+ report = init_project(root, sims, site=site, name=name, install=install, git=not no_git)
204
207
  if report.site_detected:
205
208
  out.print(f"site: {report.site} (guessed from host {hostname()}; use --site to change)")
206
209
  if report.install_failed:
@@ -214,6 +217,8 @@ def init(
214
217
  out.print(f"created {item}")
215
218
  for spec in report.installed:
216
219
  out.print(f"installed {spec}")
220
+ if report.git_started:
221
+ out.print("started a git repository (first commit: runo init)")
217
222
  _warn(report.warnings)
218
223
  out.print(
219
224
  "next: start your agent (Codex / Claude Code) here and describe what to simulate; "
@@ -89,13 +89,13 @@ def resolve_site(site: str) -> tuple[str, bool]:
89
89
 
90
90
  GITIGNORE = """\
91
91
  .venv/
92
- .runops/analysis-env/
92
+ .runops/*
93
+ !.runops/last_run_id
94
+ !.runops/skills.lock
93
95
  **/logs/
94
96
  __pycache__/
95
- .runops/build/
96
- .runops/index.toml
97
- .runops/*.lock
98
97
  runs/**/work/
98
+ analysis/**/work/
99
99
  CLAUDE.local.md
100
100
  .claude/settings.local.json
101
101
  """
@@ -139,6 +139,7 @@ class InitReport:
139
139
  site: str = ""
140
140
  site_detected: bool = False
141
141
  install_failed: bool = False
142
+ git_started: bool = False
142
143
  created: list[str] = field(default_factory=list)
143
144
  installed: list[str] = field(default_factory=list)
144
145
  warnings: list[str] = field(default_factory=list)
@@ -160,6 +161,7 @@ def init_project(
160
161
  site: str = "",
161
162
  name: str = "",
162
163
  install: bool = True,
164
+ git: bool = True,
163
165
  ) -> InitReport:
164
166
  root = root.resolve()
165
167
  if (root / CONFIG_FILE).exists():
@@ -231,9 +233,41 @@ def init_project(
231
233
  report.created += add_legacy_adapters(project)
232
234
  report.warnings += refresh_agent_files(project)
233
235
  report.created += ["AGENTS.md", "CLAUDE.md", ".agents/skills/", ".claude/skills/"]
236
+ if git:
237
+ report.git_started, git_warnings = start_git(root)
238
+ report.warnings += git_warnings
234
239
  return report
235
240
 
236
241
 
242
+ def start_git(root: Path) -> tuple[bool, list[str]]:
243
+ """Make ``root`` a git repository with a first commit, unless it already is in one.
244
+
245
+ Returns whether a repository was started, and warnings. A missing ``git`` or a
246
+ failed commit (no user identity, a hook) leaves the project usable without git.
247
+ """
248
+ exe = shutil.which("git")
249
+ if exe is None:
250
+ return False, ["git not found; the project is not under git (run `git init` later)"]
251
+
252
+ def run(*args: str) -> subprocess.CompletedProcess[str]:
253
+ return subprocess.run(
254
+ [exe, "-C", str(root), *args], capture_output=True, text=True, check=False
255
+ )
256
+
257
+ inside = run("rev-parse", "--is-inside-work-tree")
258
+ if inside.returncode == 0 and inside.stdout.strip() == "true":
259
+ return False, []
260
+ for args in (("init", "-q"), ("symbolic-ref", "HEAD", "refs/heads/main"), ("add", "-A")):
261
+ res = run(*args)
262
+ if res.returncode != 0:
263
+ return False, [f"git {args[0]} failed: {res.stderr.strip()}"]
264
+ res = run("commit", "-q", "-m", "runo init")
265
+ if res.returncode != 0:
266
+ detail = res.stderr.strip().splitlines()[-1:] or ["unknown error"]
267
+ return True, [f"git repository started, but the first commit failed: {detail[0]}"]
268
+ return True, []
269
+
270
+
237
271
  LEGACY_ADAPTERS = ("emses", "beach")
238
272
 
239
273
 
@@ -36,7 +36,7 @@ Setup, packages and builds; `runops-maintain` has the procedures.
36
36
 
37
37
  | command | effect |
38
38
  |---|---|
39
- | `runo init [SIM...] [--site kudpc\|standard] [--no-install] [-y]` | create runops.toml, cases/, runs/, LOG.md, notes/, AGENTS.md, skills; install simulator packages. Site defaults to a guess from the host name; asks interactively only in a terminal without arguments |
39
+ | `runo init [SIM...] [--site kudpc\|standard] [--no-install] [--no-git] [-y]` | create runops.toml, cases/, runs/, LOG.md, notes/, AGENTS.md, skills; install simulator packages; outside a git repository, `git init` and a first commit. Site defaults to a guess from the host name; asks interactively only in a terminal without arguments |
40
40
  | `runo doctor [--json]` | check config, adapters, packages missing from .venv, executables, sbatch, skill freshness |
41
41
  | `runo update [--skills-only] [-y]` | upgrade simulator packages and redeploy skills / AGENTS.md block |
42
42
  | `runo build SIM [--force]` | build a local_source simulator into .runops/build/<sim>-<commit>-<hash> |
@@ -104,7 +104,7 @@ def fake_slurm(monkeypatch: pytest.MonkeyPatch) -> FakeSlurm:
104
104
  @pytest.fixture
105
105
  def project_dir(tmp_path: Path, monkeypatch: pytest.MonkeyPatch) -> Path:
106
106
  root = tmp_path / "proj"
107
- init_project(root, ["generic"], install=False)
107
+ init_project(root, ["generic"], install=False, git=False)
108
108
  case = root / "cases" / "demo"
109
109
  case.mkdir(parents=True)
110
110
  (case / "case.toml").write_text(CASE_TOML)
@@ -261,9 +261,7 @@ def test_analysis_skill_and_ignore_template_are_deployed(project_dir: Path, cli)
261
261
  for base in (".agents/skills", ".claude/skills"):
262
262
  assert (project_dir / base / "runops-analyze/SKILL.md").is_file()
263
263
  ignore = (project_dir / ".gitignore").read_text()
264
- assert all(
265
- pattern in ignore for pattern in ("**/logs/", "__pycache__/", ".runops/analysis-env/")
266
- )
264
+ assert all(pattern in ignore for pattern in ("**/logs/", "__pycache__/", ".runops/*"))
267
265
  assert "Notes and analysis" in (project_dir / "AGENTS.md").read_text()
268
266
  assert cli("update", "--skills-only").code == 0
269
267
 
@@ -31,6 +31,52 @@ def test_init_camphor_preset(tmp_path: Path) -> None:
31
31
  assert not (root / "adapters/mysim.py").exists()
32
32
 
33
33
 
34
+ def _git_identity(monkeypatch: pytest.MonkeyPatch) -> None:
35
+ for key in ("GIT_AUTHOR_NAME", "GIT_COMMITTER_NAME"):
36
+ monkeypatch.setenv(key, "runops test")
37
+ for key in ("GIT_AUTHOR_EMAIL", "GIT_COMMITTER_EMAIL"):
38
+ monkeypatch.setenv(key, "test@example.invalid")
39
+
40
+
41
+ @pytest.mark.skipif(shutil.which("git") is None, reason="git not installed")
42
+ def test_init_starts_git_with_first_commit(tmp_path: Path, monkeypatch: pytest.MonkeyPatch) -> None:
43
+ _git_identity(monkeypatch)
44
+ root = tmp_path / "p"
45
+ report = init_project(root, ["generic"], install=False)
46
+ assert report.git_started and not report.warnings
47
+
48
+ def git(*args: str) -> str:
49
+ return subprocess.run(
50
+ ["git", "-C", str(root), *args], capture_output=True, text=True, check=True
51
+ ).stdout
52
+
53
+ assert git("rev-parse", "--abbrev-ref", "HEAD").strip() == "main"
54
+ assert git("log", "--format=%s").strip() == "runo init"
55
+ tracked = git("ls-files").split()
56
+ assert "runops.toml" in tracked and "LOG.md" in tracked and "AGENTS.md" in tracked
57
+ assert git("status", "--porcelain") == ""
58
+ (root / ".runops" / "snapshots").mkdir()
59
+ (root / ".runops" / "snapshots" / "big.h5").write_text("x")
60
+ (root / ".runops" / "last_run_id").write_text("R1\n")
61
+ assert git("status", "--porcelain", "--untracked-files=all").split() == [
62
+ "??",
63
+ ".runops/last_run_id",
64
+ ]
65
+
66
+
67
+ @pytest.mark.skipif(shutil.which("git") is None, reason="git not installed")
68
+ def test_init_inside_a_repository_or_with_no_git_leaves_git_alone(
69
+ tmp_path: Path, monkeypatch: pytest.MonkeyPatch
70
+ ) -> None:
71
+ _git_identity(monkeypatch)
72
+ subprocess.run(["git", "init", "-q", str(tmp_path)], check=True)
73
+ inner = init_project(tmp_path / "inner", ["generic"], install=False)
74
+ assert not inner.git_started and not (tmp_path / "inner" / ".git").exists()
75
+ other = tmp_path.parent / f"{tmp_path.name}-nogit"
76
+ report = init_project(other, ["generic"], install=False, git=False)
77
+ assert not report.git_started and not (other / ".git").exists()
78
+
79
+
34
80
  def test_init_refuses_existing(project_dir: Path, cli) -> None: # type: ignore[no-untyped-def]
35
81
  res = cli("init", "generic", "--no-install")
36
82
  assert res.code == 2 and "already exists" in res.err
@@ -352,7 +398,7 @@ def test_emses_install_brings_the_adapters_other_packages(
352
398
  root = tmp_path / "emses-proj"
353
399
  pip = FakePip(root)
354
400
  monkeypatch.setattr("runops.ops.setup.subprocess.run", pip)
355
- report = init_project(root, ["emses"], install=True)
401
+ report = init_project(root, ["emses"], install=True, git=False)
356
402
  package = KNOWN_PACKAGES["emses"]
357
403
  # runops.toml names the simulator package; the adapter it brings also wants emout.
358
404
  assert load_toml(root / "runops.toml")["simulators"]["emses"]["package"] == package
@@ -384,7 +430,7 @@ def test_beach_install_is_unchanged(tmp_path: Path, monkeypatch: pytest.MonkeyPa
384
430
  root = tmp_path / "beach-proj"
385
431
  pip = FakePip(root)
386
432
  monkeypatch.setattr("runops.ops.setup.subprocess.run", pip)
387
- report = init_project(root, ["beach"], install=True)
433
+ report = init_project(root, ["beach"], install=True, git=False)
388
434
  assert pip.installs == [[KNOWN_PACKAGES["beach"]]]
389
435
  assert report.installed == [KNOWN_PACKAGES["beach"]]
390
436
 
@@ -525,7 +525,7 @@ wheels = [
525
525
 
526
526
  [[package]]
527
527
  name = "runops"
528
- version = "2.9.0"
528
+ version = "2.10.0"
529
529
  source = { editable = "." }
530
530
  dependencies = [
531
531
  { name = "jinja2" },
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes