feat(pi): add baseline safe file tools #209

Closed
jwilger wants to merge 12 commits from add-some-tools into main
Owner

Summary

  • add safe_remove for deleting explicit files without shelling out
  • add safe_unstage for removing explicit paths from the Git index
  • add safe_restore for explicitly confirmed working-tree reverts

Verification

  • verify_harness passed after adding safe_remove
  • verify_harness passed after adding safe_unstage
  • verify_harness passed after adding safe_restore
  • final verify_harness passed

This PR is intended to cover only the new baseline semantic tools currently on add-some-tools after PR #208 was merged.

## Summary - add `safe_remove` for deleting explicit files without shelling out - add `safe_unstage` for removing explicit paths from the Git index - add `safe_restore` for explicitly confirmed working-tree reverts ## Verification - `verify_harness` passed after adding safe_remove - `verify_harness` passed after adding safe_unstage - `verify_harness` passed after adding safe_restore - final `verify_harness` passed This PR is intended to cover only the new baseline semantic tools currently on `add-some-tools` after PR #208 was merged.
Add a typed Pi tool for validated branch switching so sessions can leave main without direct bash access.

The guardrail requires a clean working tree and rejects unsafe branch names or switches to main.
Keep the stashed guardrail helper formatting from the post-hook cleanup on the branch where the safe branch-switch tool work now lives.
Add typed branch creation/switch validation and prevent safe_commit from committing on main.

Move full verification to pre-push, remove pi-lens to avoid deferred end-of-turn formatting stalls, and make git mutation tools use async child process execution so long hooks do not block Pi's event loop.
Write raw git command output to a temporary file and return only a concise summary plus the file path to Pi context.

This keeps safe_commit, safe_create_branch, safe_switch_branch, and safe_push from flooding context while preserving access to full command output when needed.
The release-tooling check runs the Pi guardrails contract test with node, so include nodejs in the derivation inputs used by pre-push verification.
test(release): align pi tool verification inputs
Some checks failed
CI / Verify PR with nix flake check (pull_request) Has been cancelled
CI / Request auto_review semantic review (pull_request) Has been cancelled
CI / Build PR artifacts (no token) (pull_request) Has been cancelled
CI / Publish PR artifact packages (pull_request) Has been cancelled
c67dc8852e
Include nodejs for the Pi guardrails contract and update the lefthook contract to expect full verification on pre-push.
docs: add semantic tool guardrail
Some checks failed
CI / Verify PR with nix flake check (pull_request) Has been cancelled
CI / Request auto_review semantic review (pull_request) Has been cancelled
CI / Build PR artifacts (no token) (pull_request) Has been cancelled
CI / Publish PR artifact packages (pull_request) Has been cancelled
ee5ce17ea6
Encourage adding purpose-built tools or workflows when a new operation does not fit existing tool semantics.
docs: remove obsolete pi-lens guardrail
All checks were successful
CI / Verify PR with nix flake check (pull_request) Successful in 2m20s
CI / Request auto_review semantic review (pull_request) Successful in 1s
CI / Build PR artifacts (no token) (pull_request) Successful in 2s
CI / Publish PR artifact packages (pull_request) Successful in 1s
auto_review auto_review: 1 warning
ab51718ccb
Drop the deferred pi-lens formatting instruction now that pi-lens is no longer used.
Add semantic verify_harness and verify_release_tooling tools, move Pi guardrail contracts to tests/pi_guardrails, and tighten BDD/TDD guardrails so RED/GREEN evidence must come from real focused command output.

Also require safe_push callers to explicitly confirm open PR metadata covers all branch commits.
Add a semantic safe_remove tool for deleting explicit files without repurposing unrelated tools or shell rm.
Add a semantic safe_unstage tool for removing explicit files from the Git index when stash/apply or other workflows leave paths staged.
feat(pi): add safe restore tool
All checks were successful
CI / Verify PR with nix flake check (pull_request) Successful in 3m49s
CI / Request auto_review semantic review (pull_request) Successful in 1s
CI / Build PR artifacts (no token) (pull_request) Successful in 2s
CI / Publish PR artifact packages (pull_request) Successful in 1s
auto_review auto_review: no findings
4a20aa0b6a
Add a semantic safe_restore tool for explicitly confirmed working-tree reverts without shelling out through bash.
auto-review left a comment

This PR introduces new safe file tools for Git operations, enhancing safety by avoiding shell commands. The changes include new functions for safe commit, branch creation, and file operations, along with corresponding tests. The PR appears well-structured and safe to merge.

Walkthrough

  • auto-review-git-safety.mjs: Introduces functions for safe Git operations, ensuring operations like commit and branch creation are done safely.
  • auto-review-guardrails.ts: Implements new tools for safe Git operations, replacing shell commands with Node.js functions.
  • Tests: New tests are added to ensure the correctness of the new safe tools, and some existing tests are refactored or moved to align with the new structure.
This PR introduces new safe file tools for Git operations, enhancing safety by avoiding shell commands. The changes include new functions for safe commit, branch creation, and file operations, along with corresponding tests. The PR appears well-structured and safe to merge. ## Walkthrough - **auto-review-git-safety.mjs**: Introduces functions for safe Git operations, ensuring operations like commit and branch creation are done safely. - **auto-review-guardrails.ts**: Implements new tools for safe Git operations, replacing shell commands with Node.js functions. - **Tests**: New tests are added to ensure the correctness of the new safe tools, and some existing tests are refactored or moved to align with the new structure.
Author
Owner

bye pi - you are a pain in the ass when I just want to get shit done

bye pi - you are a pain in the ass when I just want to get shit done
jwilger closed this pull request 2026-05-15 20:26:25 -07:00
Some checks are pending
CI / Verify PR with nix flake check (pull_request) Successful in 3m49s
CI / Request auto_review semantic review (pull_request) Successful in 1s
Required
Details
CI / Build PR artifacts (no token) (pull_request) Successful in 2s
Required
Details
CI / Publish PR artifact packages (pull_request) Successful in 1s
auto_review auto_review: no findings
Required
CI / Build (pull_request)
Required
CI / Clippy (pull_request)
Required
CI / Test (pull_request)
Required
CI / Dependency policy (pull_request)
Required
CI / Format check (pull_request)
Required

Pull request closed

Sign in to join this conversation.
No reviewers
No milestone
No project
No assignees
2 participants
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
Slipstream/auto_review!209
No description provided.