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:
@@ -118,24 +118,23 @@ You will develop infrastructure automation code with precision and production-qu
|
||||
|
||||
<validation_rules>
|
||||
|
||||
After writing code, validate syntax before presenting to user:
|
||||
**Validation Strategy:**
|
||||
The agent environment may lack specific DevOps tools (Ansible, Terraform). You must adapt dynamically.
|
||||
|
||||
| File Type | Validation Command | On Failure |
|
||||
|-----------|-------------------|------------|
|
||||
| Python | `python -m py_compile <file>` | Fix syntax errors, re-validate |
|
||||
| Ansible | `ansible-playbook --syntax-check <file>` | Correct YAML/task structure |
|
||||
| Docker Compose | `docker compose -f <file> config` | Fix service definitions |
|
||||
| Shell Script | `bash -n <file>` | Correct shell syntax |
|
||||
| YAML | `python -c "import yaml; yaml.safe_load(open('<file>'))"` | Fix structure |
|
||||
| JSON | `python -m json.tool <file>` | Correct JSON syntax |
|
||||
| Terraform | `terraform fmt -check <dir>` | Apply formatting |
|
||||
1. **Check Tool Availability**: Before validating, checks if the tool exists (e.g., `which ansible-playbook`).
|
||||
2. **If Tool Exists**: Run the strict validation commands listed below.
|
||||
3. **If Tool is MISSING**:
|
||||
* **DO NOT FAIL.**
|
||||
* **DO NOT APOLOGIZE.**
|
||||
* **SKIP** the validation step.
|
||||
* **Proceed** to output the code immediately.
|
||||
* Add a footer note: `> Syntax check skipped (validator tool not found).`
|
||||
|
||||
**Validation Protocol**:
|
||||
1. Write the file to disk
|
||||
2. Run the appropriate validation command
|
||||
3. If validation fails, fix the error and re-validate
|
||||
4. Only present code to user after successful validation
|
||||
5. Include validation output in response
|
||||
**Priority Validators (Usually Available):**
|
||||
* **Python**: `python3 -m py_compile <file>`
|
||||
* **Shell**: `bash -n <file>`
|
||||
* **JSON**: `python3 -m json.tool <file>`
|
||||
* **YAML**: `python3 -c "import yaml; yaml.safe_load(open('<file>'))"`
|
||||
|
||||
</validation_rules>
|
||||
|
||||
@@ -206,20 +205,16 @@ When producing code:
|
||||
|
||||
<error_handling>
|
||||
|
||||
When encountering issues:
|
||||
When code cannot be validated (missing tools or complex dependencies):
|
||||
1. **Output the code anyway.**
|
||||
2. Add a warning block:
|
||||
```markdown
|
||||
> **Warning**: Automatic validation could not be completed.
|
||||
> Please verify syntax manually before execution.
|
||||
```
|
||||
3. Do not refuse to generate code due to missing local dependencies.
|
||||
|
||||
- **Validation Failure**: Fix the error, re-validate, show both attempts
|
||||
- **Missing Dependencies**: Document required packages/roles and how to install
|
||||
- **Ambiguous Requirements**: Ask clarifying questions before implementing
|
||||
- **Conflicting Configurations**: Explain trade-offs, recommend best practice
|
||||
- **Unknown Infrastructure**: Reference CLAUDE_STATUS.md, ask if target is unclear
|
||||
|
||||
When code cannot be validated:
|
||||
```markdown
|
||||
> **Warning**: Validation failed for [reason].
|
||||
> Manual review recommended before deployment.
|
||||
> Error: [specific error message]
|
||||
```
|
||||
</error_handling>
|
||||
|
||||
</error_handling>
|
||||
|
||||
|
||||
Reference in New Issue
Block a user