Skip to content

audit: add pyauto-audit shell function and drop rejected prompt 04 - #12

Merged
Jammy2211 merged 1 commit into
mainfrom
feature/pyauto-audit
Apr 28, 2026
Merged

audit: add pyauto-audit shell function and drop rejected prompt 04#12
Jammy2211 merged 1 commit into
mainfrom
feature/pyauto-audit

Conversation

@Jammy2211

Copy link
Copy Markdown
Collaborator

Summary

  • New scripts/pyauto_audit.sh defining a pyauto-audit shell function: 3-section structural audit (non-git dirs / old stashes / abandoned branches). On-demand, no cron, no severity tags, no snooze file.
  • Live-tree dry-run during smoke testing surfaced real signal: 4 stray non-git dirs (bad/, path/, priors/, scripts/), 3 old stashes (PyAutoFit / PyAutoGalaxy / PyAutoLens, all >20 days), 1 abandoned branch (PyAutoFit/feature/ep, last commit 2026-02-18).
  • Deletes autoprompt/04_source_of_truth_rule.md — already-rejected; the dashboard + prompt 03's history guard cover the failure modes.

Closes #11.

Test plan

  • Live tree run finds 4 non-git dirs, 3 old stashes, 1 abandoned branch.
  • PYAUTO_AUDIT_BRANCH_DAYS=20 lowers threshold and surfaces 3 abandoned branches (including currently-on-it euclid_strong_lens_modeling_pipeline/fix/extra-galaxies-gui-vis-index).
  • PYAUTO_AUDIT_STASH_DAYS=999 suppresses the stash section.
  • PYAUTO_AUDIT_ROOT=<empty-tmpdir> prints pyauto-audit: clean (no findings under <dir>).
  • Always exits 0; pure read — no state mutated.
  • Run completes in <2s (no fetches, local checks only).

Bug found and fixed during smoke testing

First implementation used IFS=\$'\t' to split for-each-ref --format='...%09...' output. Bash treats consecutive whitespace IFS chars as one delimiter, which collapsed the empty-upstream column into the timestamp column for local-only branches. Switched to | delimiter (matching Section 2's stash format) — for-each-ref formatting allows arbitrary separators, and git refnames disallow |.

🤖 Generated with Claude Code

`scripts/pyauto_audit.sh` defines a `pyauto-audit` shell function (sourced
from ~/.bashrc next to pyauto_status.sh) that scans ~/Code/PyAutoLabs/
for state the dashboard can't show:

  1. Top-level directories with no .git (skip "." and "z_" prefixes
     for hidden / personal-staging dirs).
  2. Stashes older than PYAUTO_AUDIT_STASH_DAYS (default 14 days).
  3. Local-only branches with no upstream and last commit older than
     PYAUTO_AUDIT_BRANCH_DAYS (default 30 days).

Three sections, plain text, sections suppressed when empty, single
"clean" message when all clear. Always exits 0 — informational, the
user reads and decides. Run on demand. PYAUTO_AUDIT_ROOT,
PYAUTO_AUDIT_STASH_DAYS, PYAUTO_AUDIT_BRANCH_DAYS env-var overrides.

Re-scoped from autoprompt 06 (the heavyweight monthly cron audit
spec). The dashboard's `b` flag (shipped in #10) covers prompt 06's
findings #1 + #2; prompts 02 + 07 cover #4 + #7. Only the genuinely
structural checks remain.

Also deletes autoprompt/04_source_of_truth_rule.md — already-rejected
during this sweep. The pyauto-status BEHIND counts and prompt 03's
history-rewrite guard cover the failure modes that 04 was trying to
address; keeping a rejected prompt in autoprompt/ is just noise.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
@Jammy2211
Jammy2211 merged commit 27a0308 into main Apr 28, 2026
@Jammy2211
Jammy2211 deleted the feature/pyauto-audit branch April 28, 2026 08:07
Jammy2211 pushed a commit that referenced this pull request May 28, 2026
Jammy2211 pushed a commit that referenced this pull request Jul 9, 2026
Jammy2211 pushed a commit that referenced this pull request Sep 4, 2026
Jammy2211 pushed a commit that referenced this pull request Sep 4, 2026
…ge order for all three phases

Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_013HsZA1ufn3msgPiDFxEXa6
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Add pyauto-audit shell function for non-git dirs / old stashes / abandoned branches

1 participant