feat: headless --clean mode for AI tool post-session hooks - #18
Merged
Merged
Conversation
Adds `irona --clean <path>`, which scans, deletes every artifact directory it finds, and prints one summary line without touching the terminal — usable from an AI tool's session-end hook. `--dry-run` reports without deleting. Gitignore-only matches are skipped by default since an unattended sweep could take out a gitignored data/ or secrets/ directory; `--include-gitignored` opts back in. Exit code is 0 on success including nothing-found, 1 if a delete failed. Moves format_bytes out of render.rs into src/format.rs so headless output does not depend on the ratatui rendering module. Closes #15 Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
kunjee17
force-pushed
the
feat/headless-clean
branch
from
July 26, 2026 17:24
3f8c5da to
537a66d
Compare
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.
Closes #15.
What
irona --clean <path>scans, deletes every artifact directory it finds, prints one summary line, and never enters raw mode or the alternate screen — so it works from a Claude CodeStophook or any non-interactive context.Decisions
Answering the issue's open questions:
irona <path>positional working with no clap restructuring.--dry-runincluded. The safety valve before wiring a destructive command into a hook.0on nothing-found,1only when a delete failed. A clean workspace must not fail a hook noisily.--only rust,nodedeferred. Needs a name parser for all fifteenLanguagevariants and nothing depends on it yet.One decision not in the issue: gitignore-detected directories are excluded by default in headless mode. In the TUI a person reads the list before selecting; unattended, a gitignored
data/,logs/, orsecrets/would be deleted with nobody watching.--include-gitignoredrestores the full sweep. TUI behaviour is unchanged.Structure
New
src/headless.rsdrives the existingscanner::scananddeleter::delete_all, which were already TUI-independent.format_bytesmoves fromrender.rsto a newsrc/format.rsso headless output does not depend on the rendering module.Verification
cargo nextest run— 68 tests pass (51 before, 17 new)cargo clippy --all-targets -- -D warnings— cleantarget/in place, real run deletes it and exits0, second run reports nothing-to-clean and exits0,--dry-runwithout--cleanexits2with a clap error, and--include-gitignoreddeletes a gitignoreddist/that the default run leaves aloneNote
PR #17 also edits the
Argsstruct inmain.rsto add--mcp. Whichever merges second needs a small conflict resolution there; nothing structural overlaps.🤖 Generated with Claude Code