config-audit/commands/status.md
Kjell Tore Guttormsen b85919f2ec fix(commands): close the promises the command templates could not keep
DEL B chunk `interview` (+ discover/status/cleanup/help). Fasit written before
the run predicted 8 defects and refuted 4 candidates; all 8 confirmed, all 4
refutations held, and three predictions turned out too narrow.

- M-BUG-36: `drift --list` reached the command as 0 bytes. drift-cli accepted
  --output-file but list mode ignored it, and the listing goes to stderr, which
  the command discards per ux-rules rule 2. Fixing the caller alone would not
  have helped.
- M-BUG-37: feature-gap's "Create backup" step ran fix-cli without --apply.
  Dry-run is the default, so no backup existed (backupId: null) while the
  command went on to edit config believing it could roll back.
- M-BUG-38: fix-cli told users to recover with scanners/rollback-cli.mjs, which
  does not exist. Dead reference in the one message read after a bad fix.
- M-BUG-21 fourth arm: five templates carried literal [--global]/[--full-machine]
  inside executable bash blocks. A bracketed placeholder does not start with a
  dash, so every scanner's arg loop takes it as the scan target.
- interview and analyze never said which session they act on; interview could
  rewind a finished session; cleanup interpolated an unvalidated id into rm -rf
  (an empty id deletes every session); status advertised a `resume` command that
  does not exist and documented an `all` argument it never parsed.

TDD: 9 red tests first, including a machine sweep for dead /config-audit
references and for bracketed flags in bash blocks. Suite 1432 -> 1441/0.
Frozen v5.0.0 snapshots untouched; --raw/--json contracts unchanged.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01UGvA1uUQn2hPBPMaCKK6x3
2026-07-31 21:27:07 +02:00

4.8 KiB
Raw Blame History

name description allowed-tools model
config-audit:status Show current session state and available actions Read, Glob, Bash sonnet

Config-Audit: Status

Display current session state and guide next actions.

Usage

/config-audit status
/config-audit status --raw   # show the raw v5.0.0 phase identifiers (current_phase: "discover", etc.) instead of humanized labels

Phase-label translation

The state.yaml field current_phase is the machine contract — never rename it. The user-facing label is humanized. Map the field value to a plain-language label when rendering (default mode):

current_phase (machine field, unchanged) User-facing label
discover Looking at your config files
analyze Working out what to recommend
interview Asking what you'd like to focus on
plan Putting together your action plan
implement Making the changes
verify Double-checking everything worked

When --raw is in $ARGUMENTS, render the raw current_phase field value verbatim (no humanization).

Implementation

  1. Parse flags:

    RAW_FLAG=""
    if echo "$ARGUMENTS" | grep -q -- "--raw"; then RAW_FLAG="--raw"; fi
    ALL_FLAG=""
    if echo "$ARGUMENTS" | grep -qw -- "all"; then ALL_FLAG="all"; fi
    

    When ALL_FLAG is set, skip steps 24 and render the List All Sessions table below instead of a single session's status.

  2. Find active session:

    Glob: ~/.claude/config-audit/sessions/*/state.yaml
    Sort by modification time
    Use most recent
    
  3. Read session state with the Read tool:

    session_id: "20250126_143022"
    current_phase: "analyze"
    completed_phases: ["discover", "analyze"]
    next_phase: "interview"
    ...
    
  4. Display status (default mode — humanized phase labels):

    ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
    Config-Audit Session Status
    ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
    
    Session:  20250126_143022
    Started:  2025-01-26 14:30:22
    
    PHASE PROGRESS
    ──────────────
    ✓ Phase 1: Looking at your config files     - 15 files found (current directory)
    ✓ Phase 2: Working out what to recommend    - report generated
    ○ Phase 3: Asking what you'd like to focus on - not started (optional)
    ○ Phase 4: Putting together your action plan  - not started
    ○ Phase 5: Making the changes                 - not started
    
    NEXT ACTION
    ───────────
    Run: /config-audit interview
    Or:  /config-audit plan (skip interview)
    
    SESSION FILES
    ─────────────
    Scope:    ~/.claude/config-audit/sessions/20250126_143022/scope.yaml
    Findings: ~/.claude/config-audit/sessions/20250126_143022/findings/
    Report:   ~/.claude/config-audit/sessions/20250126_143022/analysis-report.md
    
    ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
    

    In --raw mode, replace the humanized phase labels with the verbatim machine field values (Phase 1: discover, Phase 2: analyze, etc.).

  5. If no session found:

    No active config-audit session found.
    
    Start a new audit with:
    /config-audit           # Full audit with auto-scope
    /config-audit discover  # Discovery phase only
    

Session Information

Display based on completed phases:

Phase Info to Display
scope Scope type, paths to scan
discover Files found count, issues count
analyze Conflicts, duplicates, opportunities
interview Preferences summary
plan Actions count, risk level
implement Success/fail counts, backup location

List All Sessions

With all flag:

/config-audit status all

Shows:

All config-audit sessions:

| Session | Phase | Created |
|---------|-------|---------|
| 20250126_143022 | analyze | 2025-01-26 14:30 |
| 20250125_091500 | complete | 2025-01-25 09:15 |
| 20250120_160000 | implement | 2025-01-20 16:00 |

Resuming a session

There is no resume command. Sessions are selected by recency: every session-aware command globs ~/.claude/config-audit/sessions/*/state.yaml and takes the most recently modified one.

To continue an older session, run its next phase directly — /config-audit plan, /config-audit implement, and so on read next_phase from the state file. If the wrong session keeps winning, delete the stale ones with /config-audit cleanup.