Repository navigation
feat: import the personal agent source from dotfiles - #2
Merged
Merged
Conversation
…tfiles#279) ## 概要 - `tests/agents/hooks` の fake herdr を Python スクリプトから POSIX sh スクリプトに置き換え,負荷時の flaky 失敗を防ぐ. - 本番コード,timeout,assertion,lock は変更していない. - 判断事項: テスト基盤のみの変更のため,レビューとマージの可否. ## 変更前後 | | 変更前 | 変更後 | | --- | --- | --- | | fake herdr | テストごとに Python スクリプトを生成し,呼び出しごとに Python を起動 | `fake_herdr.sh` を symlink し,用意済み JSON を `cat` で返す | | agent 一覧 | 呼び出し時に `live_agents.txt` から Python で組み立て | `set_agents` が live agents の変更時に `agents.json` を書く | 原因: 負荷時に Python の fake が 5 秒の一覧取得 timeout を使い切り,許可されるはずの呼び出しが ask になっていた.フルラン 1 回で 1 件,別の 1 回で 13 件失敗し,再実行では再現しなかった. ## 検証 - [x] `uv run --frozen pytest tests/agents`: 1958 passed - [x] `lefthook run pre-commit`: 全フック成功 (`ty` の `contextmanager` deprecation 警告は既存コードで,今回の差分とは無関係) - [x] 差分はテスト 4 ファイルと `fake_herdr.sh` のみ (本番コード,timeout,assertion,lock の変更なし) <details> <summary>スコープと補足</summary> - 変更ファイル: `tests/agents/hooks/{conftest.py,herdr_runtime.py,fake_herdr.sh,test_herdr_ownership.py,test_herdr_ownership_workspaces.py}` - `herdr.write_text(...)` を `set_agents(...)` に置き換えた.`live_agents.txt` は従来どおり更新する. - 対応する Issue と plan コメントはなし.計画からの逸脱もなし. </details> 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-authored-by: furedea <[email protected]> Co-authored-by: Claude Sonnet 5.5 <[email protected]>
…a/dotfiles#284) ## 概要 `switch` と herdr の再起動で `SSL_CERT_FILE` などが入った新しいシェルでは,Claude Code の `/login` が `UNABLE_TO_GET_ISSUER_CERT_LOCALLY` で失敗した.既定の `CLAUDE_CODE_CERT_STORE=bundled,system` のうち OS 側の読み込みで失敗しており,`CLAUDE_CODE_CERT_STORE=bundled` ではログインできた.Claude Code 2.1.306 の内蔵 CA には侵害された eMudhra の root がないため,内蔵だけを使う. | | 変更前 | 変更後 | |---|---|---| | `CLAUDE_CODE_CERT_STORE` | 未設定(`bundled,system`) | `bundled` | | 新しいシェルでの `/login` | 証明書エラーで失敗 | 成功(手元で確認) | ## 受け入れ条件 - [x] `CLAUDE_CODE_CERT_STORE=bundled claude` で `/login` が成功する - [x] `nix flake check` が通る - [ ] `switch` 後,環境変数を付けずに起動した Claude Code でログインと API 呼び出しができる <details> <summary>補足</summary> - `CLAUDE_CODE_CERT_STORE` は settings の専用キーがなく,`env` ブロックで設定する(公式ドキュメント「Enterprise network configuration」). - 内蔵だけにすると,OS の証明書ストアにだけ入れた社内 CA(TLS を復号するプロキシなど)は使えない.今の環境にはない. - Claude Code 2.1.302 以前の内蔵 CA は侵害された root を含むため,この設定は 2.1.306 以上(furedea/dotfiles#281)を前提とする. </details> 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-authored-by: furedea <[email protected]> Co-authored-by: Claude Opus 5.5 <[email protected]>
…furedea/dotfiles#285) ## 背景 フックの状態ロックを `fcntl.flock(LOCK_NB)` で取得していたため,別のフックがロックを保持していると即座に `BlockingIOError`(EAGAIN,macOS では errno 35)で失敗していました. - dotfiles#273: 成功した herdr の結果が 2 つ同時に PostToolUse へ届くと,後続のフックがレコードロックを取れず,所有権レコードが失われ,以後のプロンプトとクリーンアップが確認を求める. - agent-harness#169: サブエージェントを同時に起動すると PreToolUse が `[Errno 35] Resource temporarily unavailable` で失敗し,サブエージェントが何もせず終了する. ## 変更内容(最終的なロックの挙動) `file_lock` は `blocking=False`(即時失敗),`timeout=None`(無期限に待機),`timeout=秒`(10 ms 間隔で再試行し,期限超過でロックのパスと `another hook holds it` を含む `LockTimeoutError`)を区別します.通常の待機上限 `LOCK_WAIT_SECONDS` は 0.5 秒で,呼び出し時に読み取ります. | 箇所 | 挙動 | 理由 | |---|---|---| | `registered_record()`(全フックの入口) | ロックを取らない | Stop が検証の間レコードロックを保持するため,同一セッションの他フックが失敗しないようにする.読み取りと `touch` は原子的書き込みで足りる | | `.register.lock`(登録) | 最大 0.5 秒の待機 | 登録の競合は短時間で終わる.既存レコードの `reopen` はこのロックを解放してから行い,待機が入れ子にならない | | resume(`reopen()` のレコードロック) | 最大 0.5 秒待ち,取れなければ `touch` のみして返る | Stop の検証中でも SessionStart を失敗させない | | herdr 所有権レコード(`confirm`) | 専用の `.herdr.lock` で最大 0.5 秒の待機 | レコードロックを使うと Stop の検証に待たされるため分離.同時の PostToolUse が両方とも記録される | | Stop(`gate`) | レコードロックを無期限に待機 | 検証の二重実行を直列化する従来の保証を維持 | | SessionEnd | レコードロックを最大 2 秒待ち,取れなければ `end()` を省略 | Codex の SessionEnd のタイムアウト 3 秒を超えない.検証中のセッションは mtime ベースの GC に任せる | | GC `.gc.lock` | 非ブロッキング.取れなければ GC を省略 | GC は付随処理であり,他の GC が走っているだけで Stop や SessionEnd を失敗させない | | GC のレコードごとのロック | 非ブロッキング(保持中のレコードは飛ばす) | Stop が長時間保持するため,レコード数に比例して待たない | ## テスト - 複数プロセスが同じセッションの hook エントリを同時に呼んでも EAGAIN で失敗しない. - 成功した `herdr agent start` / `workspace create` の結果が同時に PostToolUse へ届いても,実際のフックエントリ経由で両方のレコードが保持される. - 上限を超えてロックが保持された場合,ロックのパスと `another hook holds it` を含む明確なエラーになる. - Stop の検証中でも同一セッションの他フックが失敗しない.resume は `touch` のみで返り,SessionEnd は 2 秒で `end()` を省略する.GC が保持中のレコードや GC ロックを待たずに飛ばす. - `uv run --frozen pytest tests/agents`: 1973 passed.lefthook pre-commit: 全件成功. Closes furedea/dotfiles#273 Refs furedea/agent-harness#169 🤖 Generated with [Claude Code](https://claude.com/claude-code) --------- Co-authored-by: furedea <[email protected]> Co-authored-by: Claude Sonnet 5.5 <[email protected]>
…k kinds (furedea/dotfiles#287) ## 概要 ローカル開発サーバーへの読み取り専用 curl が毎回確認を求められていたため,許可範囲を広げる.あわせて,構文による確認要求の原因を監査ログから判別できるようにする. ## 変更内容 - `allowed_commands.json` の localhost 向け curl ルールで,次を許可する.ホストは localhost,127.0.0.1,[::1] に限定したままとする. - `-w`/`--write-out`: シングルクォートで囲んだ固定書式のみ.使えるのは許可リストにあるプレースホルダ(`%{http_code}`,`%{time_total}`,`%{time_connect}`,`%{time_starttransfer}`,`%{size_download}`,`%{content_type}`,`%{url_effective}`,`%{remote_ip}`),`\n`,英数字と一部の記号のみ.ダブルクォート,`%output`,`%{stderr}`,`@file` などファイルの読み書きや出力先の変更につながる書式は確認を求める. - `-D -`/`--dump-header -`: 標準出力のみ.ファイルへの出力は確認を求める. - `--compressed` - オプションの順序は固定とし,繰り返しや並べ替えは確認を求める. - `guard_command.py` で,localhost の curl を `jq`,`head`,`tail`,`grep`,`wc` の標準入力専用フィルターにパイプする形を,curl 単体と同様に扱う. - 各フィルターの引数は,シングルクォートの外側が固定の文字集合だけで構成されていることを要求する.glob や zsh の extended_glob によってフィルターがローカルファイルを読む経路を塞ぐ. - ファイルの読み書きやコード実行を伴うオプションがあるフィルターや,それ以外のパイプは従来どおり確認を求める. - `UnsupportedSyntax` に短い理由種別(heredoc,expansion,dollar-quote,wrapper,parse-failure)を追加し,構文による確認要求の監査ログには種別のみを記録する.コマンド本文や引数は記録しない. - パイプ検査を `shell_inspection.py` に分け,`shell_syntax.py` を行数上限内に収めた.`pyproject.toml` の `known_first_party` に登録し,deptry を通す. ## テスト - `uv run --frozen pytest tests/agents`: 2173 件成功 - `uv run --group audit vulture`: 指摘なし - `uv run --group audit deptry .`: 問題なし - `lefthook run pre-commit --all-files`: 成功 Closes furedea/dotfiles#286 🤖 Generated with [Claude Code](https://claude.com/claude-code) --------- Co-authored-by: furedea <[email protected]> Co-authored-by: Claude Sonnet 5.5 <[email protected]>
… or backtick (furedea/dotfiles#290) ## 概要 `codex-companion.mjs` の呼び出しで,単一引用符の外に dollar sign または backtick があるものを forbidden として拒否する. ## 背景 Claude Code の sandbox 除外は,展開を含まない単一の simple command にしか一致しない.dollar sign を含む focus text を渡した単発呼び出しが sandbox 内で実行され,`~/.claude/plugins/data/...` への書き込みで EPERM になった (2026-10-22). ## 変更内容 - `companion_objection` が `shell_inspection.text_outside_single_quotes` の結果に dollar sign / backtick があれば deny する - 理由文に,task / focus text に dollar sign や backtick を含めてはならないこと,sandbox 除外は展開を含むコマンドに一致しないことを明記 - 日本語本文,単一引用符内の dollar sign を含む simple call は引き続き許可 ## テスト - deny: 二重引用符内の dollar sign,裸の dollar 変数,backtick,dollar-paren 置換 - allow: 通常呼び出し,日本語本文,単一引用符内の dollar sign - `uv run --frozen pytest tests/agents` 2183 件成功,vulture,deptry,lefthook 成功 Closes furedea/dotfiles#288 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-authored-by: furedea <[email protected]> Co-authored-by: Claude Sonnet 5.5 <[email protected]>
…otfiles#291) ## 概要 localhost 向け curl の `literal_words` ルールが,出力先パス・送信ファイル・ヘッダーを制限していなかった問題を修正する. ## 背景 - `curl -s -o /Users/kaito/.zshrc http://localhost/` はサーバーの応答で任意のファイルを上書きできた. - `curl -s -d @/etc/passwd http://localhost/` は任意のファイルをローカルサーバーへ送信できた. - `curl -s -H 'Host: evil.com' http://localhost/` が許可されていた. 書き込みを制限しないサンドボックスのプロバイダーとフックを共有しているため,ルール側で制限する. ## 変更内容 - `-o`: `/dev/null` のみ許可.それ以外のファイル出力はすべて ask. - フックは `-o` のパスを,curl が実際に開くファイルに結び付けられない.実行時の作業ディレクトリがペイロードの `cwd` と異なることがあり,チェック後にシンボリックリンクを作成することもできる. - そのため,相対パス・隠しパス・シンボリックリンクを判定する方式(`is_local_output` と `cwd` の受け渡し)は廃止し,完全一致の `/dev/null` のみを許可する形にした. - `/dev/null/`,`/dev/./null`,`//dev/null`,`-` も ask. - `-d`: `@` で始まる値(シングルクォート内を含む)は ask. - `-H`: Accept,Content-Type,User-Agent のみ許可(大文字小文字不問,制御文字なし).Authorization,Cookie,Host,その他は ask.理由はルールの justification に記載. - PR 287 の形式(シングルクォートの `-w`,`-D -`,`--compressed`,読み取り専用フィルターのパイプ,固定のオプション順)は維持. ## テスト - `tests/agents/hooks/test_request_command.py` で,すべてのファイル出力が ask になり `/dev/null` だけが通ることを確認.`-d` と `-H` の ask/allow も追加. - `tests/agents/hooks/test_allowed_command.py` の localhost ダウンロード例を `-o /dev/null` に更新. - `uv run --frozen pytest tests/agents`: 2283 passed.vulture,deptry,lefthook も成功. Closes furedea/dotfiles#289 🤖 Generated with [Claude Code](https://claude.com/claude-code) --------- Co-authored-by: furedea <[email protected]> Co-authored-by: Claude Sonnet 5.5 <[email protected]>
…s#295) ## 概要 agent が `.github/workflows/` のワークフローを編集した直後に,actionlint に続けて `zizmor --offline` を実行する.あわせて dev shell に actionlint を追加する. ## 背景 編集フックは actionlint しか実行しておらず,zizmor の指摘(権限過多,テンプレートインジェクションなど)はコミット後の CI まで分からなかった.オフラインモードは GitHub API を呼ばず,1 ファイルあたり約 0.03 秒で終わる.また `lefthook.yml` は actionlint を実行するが,dev shell には入っていなかった. ## 変更内容 - `agents/hooks/lib/formatter_policy.py`:`actionlint_plan` を `workflow_plan` に改名し,`gha` キーはそのまま維持.ワークフロー YAML に `actionlint -oneline` → `zizmor --offline --no-progress --format plain` の順で 2 ステップを返す.zizmor は指摘があると非ゼロで終了するため,actionlint と同じく失敗として扱われる.ツール未導入時の動作は他のステップと同じ - `flake.nix`:dev shell の packages に `actionlint` を追加 - テスト(先に追加):ワークフローは両ステップを順に持つ,ワークフロー以外の YAML はどちらも持たない,zizmor の失敗が後続ステップに消されない,zizmor 未導入時に対象ファイル付きで通知して後続を止める ## 確認 - `uv run --frozen pytest tests/agents`:2299 件成功 - `nix flake check`:成功 - lefthook(pre-commit,commit-msg):成功 Refs furedea/dotfiles#264 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-authored-by: furedea <[email protected]> Co-authored-by: Claude Sonnet 5.5 <[email protected]>
…furedea/dotfiles#297) ## 概要 README に開発サイクル(親・レーン・Codex・ユーザーの分担)を `#### Development Cycle` として追記し,`herdr-delegation` と `git-workflow` のスキルをその流れに合わせました.レーンが実装依頼からレビュー,CI 待ちまでを自分で回し,最後に `LANE-READY` または `LANE-BLOCKED` を返します. ## 変更前後 | 項目 | 変更前 | 変更後 | | --- | --- | --- | | README | 開発サイクルの記述なし | `AI Agent Environment` の末尾に `Development Cycle` を追加 | | レビューの起動 | 親が別のレビュアーレーンを起動 | レーンが自分でレビュアー(Codex 実装なら Opus サブエージェント,Claude 実装なら Codex レビュー)を起動し,指摘の修正は Codex に依頼 | | レーンの完了報告 | PR を確認するのみ | 最終メッセージを `LANE-READY`(CI 成功かつ指摘なし)または `LANE-BLOCKED`(理由付き)で終える | | 親の待機 | `--until working` → `--until done --until blocked` で待ち PR を確認 | 同じ待機に加え,`herdr agent read` で `LANE-READY` を確認し,PR の状態を見てユーザーへ報告 | | 親ペインへの入力 | 規定なし | レーンは `herdr agent prompt` / `send-text` で親ペインに入力しない | ## 受け入れ条件 - [x] README に `#### Development Cycle` を追加した - [x] `herdr-delegation/SKILL.md` をレーン主導のレビューと `LANE-READY` に合わせた - [x] `git-workflow/references/branches.md` の待機・確認の記述を合わせた - [x] `lefthook run pre-commit --all-files` が通る - [ ] CI が成功する Closes furedea/dotfiles#253 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-authored-by: furedea <[email protected]> Co-authored-by: Claude Opus 5.5 <[email protected]>
…uredea/dotfiles#298) ## 概要 Claude Code のサンドボックスが,セッションを開いたリポジトリだけでなく,ホーム配下のあらゆるリポジトリの Git hooks と config への書き込みを拒否するようにする.`sandbox.filesystem.denyWrite` に glob を 3 つ足す.公式ドキュメントでは,`denyWrite` の wildcard は macOS で有効とされている(Linux では無視される).接頭辞のないパスはユーザー設定では `~/.claude` 基準で解決されるので,`~/**/` で固定した. ## 変更前後 | 項目 | 変更前 | 変更後 | | --- | --- | --- | | `sandbox.filesystem.denyWrite` | 未設定 | `~/**/.git/hooks`,`~/**/.git/config`,`~/**/.git/worktrees/*/config.worktree` | | 入れ子の別リポジトリの `.git/hooks` | 書ける | `Operation not permitted` | | コミットと push | 動く | 動く | ## 範囲外 サブモジュールの `.git/modules/<name>/hooks` と `config` は対象外(Issue の 3 パターンに含まれない). ## 受け入れ条件 - [x] `denyWrite` に 3 つの glob が入っている - [x] `tests/agents/claude/test_settings.py` に仕様テストを足した - [x] `lefthook run pre-commit --all-files` が通る - [ ] `switch` のあと,入れ子のリポジトリの `.git/hooks` への書き込みが拒否される - [ ] `switch` のあと,レーンがコミットと push をできる Closes furedea/dotfiles#296 🤖 Generated with [Claude Code](https://claude.com/claude-code) --------- Co-authored-by: furedea <[email protected]> Co-authored-by: Claude Sonnet 5.5 <[email protected]>
…ectories (furedea/dotfiles#304) ## 概要 検証 hook の `rust_plan` が,`tests/<dir>/<file>.rs` の変更に対しても `cargo test --test <file>` を実行し,存在しないテスト名で失敗していた.変更されたファイルを含む統合テストのターゲットを解決するようにした. 1. `Cargo.toml` の `[[test]]` に `path` があれば,そのファイルまたはディレクトリを含むエントリの `name` を使う(`tomllib` で解析). 2. なければ Cargo の自動検出に従う(`tests/<name>.rs` → `<name>`,`tests/<dir>/main.rs` があれば `<dir>`). 3. 決められなければ crate 全体のテスト(`RUST_FULL_SUITE`)にする. ## 変更前後 | | 変更前 | 変更後 | |---|---|---| | `tests/foo.rs` を変更 | `--test foo` | `--test foo`(変わらない) | | `tests/<dir>/<file>.rs` を変更 | `--test <file>`(存在せず失敗) | `[[test]]` の `name`,なければ `<dir>` | | どのテストか決められない | — | crate 全体のテスト | ## 受け入れ条件 - [x] `tests/<dir>/<file>.rs` の変更で,そのファイルを含むテストが実行される - [x] Cargo.toml の `[[test]]` の `name` と `path` が考慮される - [x] 決められないときは crate 全体のテストになる - [x] テストがある Closes furedea/dotfiles#303 🤖 Generated with [Claude Code](https://claude.com/claude-code) --------- Co-authored-by: furedea <[email protected]> Co-authored-by: Claude Opus 5.5 <[email protected]>
…edea/dotfiles#300) ## 概要 ユーザーがマージしたあと,親セッションが `~/.claude/hooks/cleanup_worktrees.py` を実行して,マージ済みの worktree とブランチを片付け,`main` を fast-forward する.`herdr worktree remove` で手作業で消すと,ブランチが残り,次の掃除の対象からもリポジトリが外れるため,それをやめる. - `agents/claude/settings.json`: `sandbox.excludedCommands` に絶対パスの 2 件(引数なし,`--dry-run`)だけを追加.ワイルドカードなしの完全一致. - guard hook: 引数なしと `--dry-run` だけを確認なしで許可する.追加引数,連結,パイプ,リダイレクト,ラッパー経由は従来どおり確認になる. - ドキュメント: README の手順表,`branches.md`,`herdr-delegation/SKILL.md` を更新. ## 変更前後 | 項目 | 変更前 | 変更後 | | --- | --- | --- | | sandbox 除外 | なし(他リポジトリの `.git` に書けない) | 絶対パスの引数なしと `--dry-run` のみ | | guard の扱い | 確認が必要 | 引数なしと `--dry-run` は許可,それ以外は従来どおり | | 片付けの手順 | 手作業の `herdr worktree remove` | マージ後に親が `cleanup_worktrees.py` を実行 | ## 受け入れ条件 - [x] `excludedCommands` に 2 件だけ追加されている(テストあり) - [x] guard が引数なしと `--dry-run` を許可する(テストあり) - [x] 他の引数や連結コマンドは許可されない(テストあり) - [x] README,`branches.md`,`herdr-delegation` が更新されている - [x] `lefthook run pre-commit --all-files` と `pytest tests/agents` が通る - [ ] CI が通る ## 既知の制限 - primary ワークスペースを閉じる判定は,セッションの所有権 record を信頼する.state ディレクトリは sandbox 内から書けるため,偽の record を置かれると,エージェントが動いていない user のワークスペースを閉じさせられる可能性がある.閉じられるのは,エージェントが動いていないワークスペースだけである.既存の `herdr workspace close` の所有権判定と同じ信頼モデルとして受け入れる. - レーン worktree の `.git` や config に仕込まれたコマンド(`core.fsmonitor` など)は,スクリプトが primary 側の admin dir を明示して git を実行するため,動かない. - primary の信頼判定は,sandbox で書き込める場所(`sandbox.filesystem.allowWrite`,`/tmp`,`TMPDIR`,`~/.herdr/worktrees`)の外にあり,`.git` が実ディレクトリのものに限る.設定ファイルを読めないときは,レーン由来の primary を飛ばし,呼び出し元自身のリポジトリだけを掃除する. - 次の場合は primary と判定されず,掃除の対象から外れる(受け入れる): `.git` がファイルの primary(separate-git-dir),サブモジュール内の cwd. - primary 自体が `extensions.worktreeConfig=true` の場合,競合して書き換えられた `config.worktree` の読み込みは防げない.どのリポジトリもこれを有効にしておらず,`sandbox.filesystem.denyWrite` が `~/**/.git/worktrees/*/config.worktree` への書き込みをすでに塞いでいる(furedea/dotfiles#298)ため,受け入れる. Closes furedea/dotfiles#299 🤖 Generated with [Claude Code](https://claude.com/claude-code) --------- Co-authored-by: furedea <[email protected]> Co-authored-by: Claude Opus 5.5 <[email protected]>
…furedea/dotfiles#302) ## 概要 Codex プラグインのバージョンが上がるたびに `excludedCommands` が合わなくなる問題を直す.`excludedCommands` のバージョン部分を `*` にし,`guard_command.py` が厳密なパス(`Path.home()` で展開した絶対パス.引用符付きのリテラル `~` は node が cwd 相対で解決するため拒否)だけを許可する. ## 変更前後 | 項目 | 変更前 | 変更後 | | --- | --- | --- | | `excludedCommands` | `node "/Users/kaito/.claude/plugins/cache/openai-codex/codex/1.0.3/scripts/codex-companion.mjs" *` | `node "~/.claude/plugins/cache/openai-codex/codex/*/scripts/codex-companion.mjs" *` | | guard のパス検査 | ファイル名が `codex-companion.mjs` なら許可 | `<home>/.claude/plugins/cache/openai-codex/codex/<数字>.<数字>.<数字>/scripts/codex-companion.mjs`(`Path.home()` で展開した絶対パス)だけ許可 | | 拒否するもの | なし | `..`,別ディレクトリ,別ファイル,数字でないバージョン | ## 確認事項 - ドキュメント上,`excludedCommands` は `Bash(...)` の権限ルールと同じ構文で,途中の `*` に対応すると読める.ただし `sandbox.excludedCommands` の設定リファレンス本体は読めず,先頭の `~/` の展開についても記載がない. - そのため,`switch` 後に親が実際の呼び出しで,`~/` と途中の `*` が合うことを確かめる. ## 受け入れ条件 - [x] guard のテストを先に書き,失敗を確認してから実装した - [x] 正しいバージョンの絶対パスを許可し,引用符付きのリテラル `~` を拒否する - [x] `..`,別ディレクトリ,別ファイル,数字でないバージョンを拒否する - [x] 単一コマンド,`$` なし,バッククォートなしの既存ルールを維持する - [x] `uv run pytest tests/agents` 2345 件成功 - [x] `lefthook run pre-commit --all-files` 成功 - [ ] `switch` 後に Codex プラグインの呼び出しが sandbox の外で動くことを親が確認する Closes furedea/dotfiles#301 🤖 Generated with [Claude Code](https://claude.com/claude-code) --------- Co-authored-by: furedea <[email protected]> Co-authored-by: Claude Opus 5.5 <[email protected]>
furedea/dotfiles#306) ## 概要 `cleanup_worktrees.py` の「信頼しない場所」の一覧を `untrusted_locations()` に切り出し,テストから差し替えられるようにした.テストは一覧を明示的な fixture ディレクトリに差し替えるので,pytest の一時ディレクトリが sandbox の `/private/tmp/claude-501/...` にあっても通る.本番の判定は変えていない. | | 変更前 | 変更後 | |---|---|---| | sandbox の中でのテスト | 一時ディレクトリが書き込み可能と判定され失敗 | 通る | | 信頼しない場所の一覧 | 関数内に直書き | `untrusted_locations()` に切り出し,テストで差し替え可能 | | 偽リポジトリのテスト | `tmp_path` 直下に置く | 「書き込み可能」とした `writable/` の下に置き,拒否されることを確認 | | 本番の一覧のテスト | なし | `/tmp`,`/private/tmp`,TMPDIR,`/tmp/claude`,`allowWrite`,`~/.herdr/worktrees` を含むことを確認 | ## 受け入れ条件 - [x] sandbox の中で cleanup のテストがすべて通る(70 件) - [ ] CI でも通る - [x] 本番の判定は変わらない Closes furedea/dotfiles#305 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-authored-by: furedea <[email protected]> Co-authored-by: Claude Sonnet 5.5 <[email protected]>
…dotfiles#310) ## 概要 cleanup_worktrees のテストが置く `git` wrapper は,`shutil.which("git")` の結果を `exec` していた.`/usr/bin` が先にある PATH ではそれが Xcode の shim になり,shim が PATH から git を探し直して wrapper を再び呼ぶため無限ループしていた.共通ヘルパー `tests/runtime.py` の `real_git()` が `git --exec-path` から本物の git を一度だけ割り出し,すべての wrapper がそれを `exec` する.本番コードは変更していない. ## 変更前後 | | 変更前 | 変更後 | |---|---|---| | wrapper が呼ぶ git | `shutil.which("git")`(shim のことがある) | `real_git()`(`git --exec-path` 配下の実体) | | `/usr/bin` が先の PATH | 約 15 件失敗 | 101 件 pass | | nix が先の PATH | 101 件 pass | 101 件 pass | ## 受け入れ条件 - [x] `/usr/bin` が先の PATH で `test_cleanup_worktrees*.py` が全件通る - [x] nix の git が先の PATH でも通る - [ ] CI でも通る - [x] 同じ wrapper のやり方をしている他のテストも直した(4 ファイル 6 箇所) Closes furedea/dotfiles#307 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-authored-by: furedea <[email protected]> Co-authored-by: Claude Sonnet 5.5 <[email protected]>
Flatten tests/agents into tests, merge the agent fixtures into the shared conftest, and fix repository-root lookups for the shallower layout. Drop tests that exercise dotfiles-only composition (the Home Manager rendering bats files and the dotfiles test-mapping extensions); they stay in furedea/dotfiles. Refs furedea/dotfiles#314
…project Add packages.default (the agents/ tree with shebangs pinned to Python 3.14), a shebang check, and a devShell with agent-harness. Point pyproject.toml at agents/ and tests/ with dotfiles' current ruff, ty, and pytest settings, and stop building a wheel. Refs furedea/dotfiles#314
…tory Supersedes furedea/dotfiles ADR-0016 and ADR-0030. Refs furedea/dotfiles#314
…the flake agent-harness only publishes packages for aarch64-darwin, so the devShell failed to evaluate on Linux runners. Refs furedea/dotfiles#314
shfmt needs the repository .editorconfig, and the lint-format tests need oxlint, oxfmt, and Codex from a locked npm install. Refs furedea/dotfiles#314
This was referenced Oct 24, 2026
Contributor
Author
|
コードレビューの指摘 10 件は,すべて dotfiles から取り込んだ既存の挙動で,移送によって悪化したものはない.
Refs furedea/dotfiles#314 |
7 tasks
25 of 26 tasks
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
概要
個人用エージェントハーネスの source(
agents/)を,furedea/dotfilesb214b4fから履歴ごと取り込む.計画: furedea/dotfiles#314 (comment)git filter-repoを 1 回だけ実行し,189 コミットをorigin/mainの上に直線で配置した(merge コミットなし).作者,作者日付,件名は元のまま.#NNNはfuredea/dotfiles#NNNに書き換えたclaude/hooks/*など)も含め,改名前の履歴を保ったagents/→agents/,tests/agents/→tests/,scripts/agents/bootstrap_server.sh→scripts/bootstrap_server.shpackages.default)とpyproject.toml,CI(all-green),guard_file.pyとnix-dotfilesskill の案内文,ADR の再採番,ADR-0012ADR の対応(dotfiles → agent-config)
0023→0001,0028→0002,0029→0003,0031→0004,0032→0005,0033→0006,0034→0007,0035→0008,0036→0009,0037→0010,0038→0011.新規 0012 が dotfiles の ADR-0016 と ADR-0030 を置き換える.
検証
bootstrap_server.bats13 件が通過agent-harness installの出力を dotfilesb214b4fと比較し,差分は意図したテキスト変更 3 ファイルのみnix build .#defaultとnix flake checkが成功マージ方法
ruleset が squash のみのため,このブランチは通常マージしない.ユーザーが ruleset を一時的に無効にし,
mainへ fast-forward する.備考
dotfiles 専用のテスト(
agent_hook.bats,codex_notification.bats,test_verification_rule.pyの対応表テスト)は含めていない.dotfiles 側に残す.Refs furedea/dotfiles#314
🤖 Generated with Claude Code