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
93 lines
4.2 KiB
Markdown
93 lines
4.2 KiB
Markdown
---
|
|
name: config-audit:interview
|
|
description: Phase 3 - Interactive interview to gather user preferences
|
|
allowed-tools: Read, Write, Edit, AskUserQuestion, Bash
|
|
model: sonnet
|
|
---
|
|
|
|
# Config-Audit: Interview (Phase 3)
|
|
|
|
Gather user preferences to inform the action plan.
|
|
|
|
## IMPORTANT: Inline Execution Only
|
|
|
|
This command runs AskUserQuestion **directly in the main context** — NOT via a Task subagent.
|
|
AskUserQuestion requires synchronous terminal interaction and does not work when delegated to a Task subagent.
|
|
|
|
## Prerequisites
|
|
|
|
- Must have completed Phase 2 (analysis)
|
|
- Use the Read tool on the analysis at `~/.claude/config-audit/sessions/{session-id}/analysis-report.md`
|
|
|
|
## Arguments
|
|
|
|
- `$ARGUMENTS` may contain `--raw` — pass-through accepted for CLI surface consistency. Interview is interactive prose only (no scanner output, no findings prose), so `--raw` is a no-op here.
|
|
|
|
## Implementation Steps
|
|
|
|
0. **Parse flags**:
|
|
|
|
```bash
|
|
RAW_FLAG=""
|
|
if echo "$ARGUMENTS" | grep -q -- "--raw"; then RAW_FLAG="--raw"; fi
|
|
```
|
|
|
|
1. **Resolve the session, then load its state**:
|
|
|
|
```
|
|
Glob: ~/.claude/config-audit/sessions/*/state.yaml
|
|
Sort by modification time — the most recently modified session wins
|
|
```
|
|
|
|
Every path below substitutes that session's id for `{session-id}`. Never guess
|
|
it: if the Glob returns nothing, say "No audit session found — run
|
|
`/config-audit discover` first" and exit. Read the session's `state.yaml` and
|
|
verify `completed_phases` contains `analyze`; if it doesn't, tell the user
|
|
analysis hasn't run yet and exit. Then read the analysis report for context.
|
|
2. **Conduct interview inline**: Use AskUserQuestion tool directly (NOT via Task). Adapt questions based on analysis findings.
|
|
3. **Save interview results**: Write to `~/.claude/config-audit/sessions/{session-id}/interview.md`
|
|
4. **Update state** (see state-management rule), with one bound specific to this
|
|
command: interview is optional and can be run against a session that already
|
|
moved past it. If `completed_phases` already contains a later phase (`plan`,
|
|
`implement`, `verify`), do **not** rewind `current_phase` and do not re-add a
|
|
phase already in `completed_phases` — append `interview` only if it is absent,
|
|
leave `current_phase`/`next_phase` pointing at the furthest phase reached, and
|
|
tell the user the preferences will apply the next time `/config-audit plan`
|
|
runs. Rewinding a finished session is how its progress gets lost.
|
|
5. **Output summary**
|
|
|
|
## Interview Questions
|
|
|
|
Ask these using AskUserQuestion (skip questions that don't apply based on analysis). Where the analysis report references finding IDs, use the humanized title from the report rather than re-deriving prose:
|
|
|
|
1. **Config Style** — Centralized vs Distributed vs Hybrid organization
|
|
2. **Unused automation that runs at specific events** — Wire up, review individually, delete, or leave (only if the analysis report flagged one)
|
|
3. **Duplicate Permissions** — Remove from local, consolidate, or keep (only if found)
|
|
4. **Modular Rules** — Use .claude/rules/ pattern? Yes/No
|
|
5. **Path-Scoped Rules** — Which patterns (tests, src, config, docs) — only if Q4=Yes
|
|
6. **Conflict Resolution** — Per-conflict: global vs project vs custom value (only if conflicts found)
|
|
7. **Permission Audit** — Audit or keep (only if >30 patterns in settings.local.json)
|
|
8. **Project Inheritance** — Per-project: inherit or isolate (only if multiple projects)
|
|
|
|
## Adaptive Questioning
|
|
|
|
Skip questions that don't apply:
|
|
- No unused hooks question if all hooks are wired
|
|
- No duplicates question if no duplicates found
|
|
- No conflict questions if no conflicts detected
|
|
- No path-scoping if user said no to modular rules
|
|
- Fewer project questions if only one project
|
|
- No permission audit if <30 patterns
|
|
|
|
## Skip Interview Option
|
|
|
|
If user runs `/config-audit plan` without interview:
|
|
- Use sensible defaults (centralized, inherit, enable rules)
|
|
- Flag decisions in plan as "assumed"
|
|
|
|
## Error Handling
|
|
|
|
- If user selects "Other" for any question, ask follow-up with AskUserQuestion
|
|
- If interview is cancelled, save partial results
|
|
- If no analysis report found, report error and exit
|
|
- If AskUserQuestion fails, STOP — do not use alternative methods
|