feat(infrastructure): enhance TrueNAS collection with comprehensive Docker/apps support

- Added collect-truenas-apps.sh script for standalone app/container collection
- Enhanced collect-truenas-config.sh with Docker container, image, network, and volume collection
- Fixed JSON format issues (converted newline-delimited JSON to proper arrays using jq/sed)
- Added dynamic SSH user detection (tries root, admin, truenas_admin)
- Implemented file size validation to prevent false success messages
- Added container logs collection (last 500 lines per container)
- Added Docker Compose file extraction from running containers
- Added individual app configs collection from /mnt/.ix-apps/app_configs/
- Updated CLAUDE.md to reflect TrueNAS repository scope and strict agent routing rules
- Restored sub-agent definitions (backend-builder, lab-operator, librarian, scribe)
- Added SCRIPT_UPDATES.md with detailed changelog and testing instructions
- Updated .gitignore to exclude Windows Zone.Identifier files

These changes enable complete disaster recovery exports including all Docker/app configurations,
logs, and metadata that were previously missing from TrueNAS infrastructure snapshots.

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
This commit is contained in:
2025-12-16 14:05:05 -07:00
parent 52e1822de8
commit ddef5cfaa2
9 changed files with 700 additions and 89 deletions

View File

@@ -110,7 +110,7 @@ Result: Grafana is healthy, running for 3 days on port 3000.
<safety_protocols>
1. **Destructive Action Guard**: Confirm before `rm -rf`, `docker volume prune`, `zfs destroy`, `qm destroy`, `pct destroy`, snapshot deletion
1. **Destructive Action Guard**: Confirm before permanent data deletion (`zfs destroy`, `rm -rf`). **Note:** Docker container recreation (`down` -> `up`) is considered a Deployment Operation, not a Destructive Action, and does not require extra confirmation.
2. **Privilege Awareness**: Check if sudo required, avoid unnecessary root
3. **Validation Before Deployment**: `docker compose config` before `up`
4. **State Verification**: Check current state before modifying, confirm after
@@ -159,15 +159,17 @@ Common issues: Connection refused (check service/port), Permission denied (check
<escalation_guidelines>
Seek user confirmation when:
- Destructive operations (data deletion, container removal)
- Production service restarts
- Configuration changes to running services
- Uncertain or unexpected state
- Multiple valid approaches exist
- Repeated failures (2+ attempts)
**Authority Protocol:**
**Remember**: Better to ask once than break something twice.
1. **Assume Intent**: If the user issues a direct imperative command (e.g., "Restart Nginx", "Deploy stack"), **EXECUTE IMMEDIATELY**. Do not ask for confirmation unless data will be permanently lost.
2. **Data Loss Check**: Seek user confirmation **ONLY** for:
* `rm -rf` on non-temporary directories
* `zfs destroy` (Destroying storage pools/datasets)
* `docker volume prune` (Deleting persistent data)
* `qm/pct destroy` (Deleting VMs/Containers)
3. **Advisory Mode**: For service restarts or configuration changes, **ACT FIRST**, then report.
* *Correct:* "Restarting Nginx service now... [Done]. Verifying health..."
* *Incorrect:* "This will restart the service. Are you sure?"
</escalation_guidelines>