feat: add config module and agent setup for migration

- Add config module from backup (loader, accessor, migration)
- Add agent reference cards for token-efficient migration
- Add migration knowledge base and instructions
- Ready to start systematic config-driven migration
This commit is contained in:
Jesús Pérez 2025-09-22 23:36:59 +01:00
parent a509868257
commit 0a837aed54
7 changed files with 1402 additions and 0 deletions

View file

@ -0,0 +1,37 @@
# Agent Instructions Template (Token-Efficient)
## Syntax Fixer Agent
```markdown
TASK: Fix syntax errors in FILE_PATH
PATTERNS: See SYNTAX_FIX_CARD.md
OUTPUT: {"status": "fixed", "changes": N, "test_passed": bool}
TEST: nu --ide-check FILE_PATH
```
## ENV Migrator Agent
```markdown
TASK: Replace ENV vars in FILE_PATH
MAPPING: See ENV_MAPPING_CARD.md
KEEP: PROVISIONING_ARGS, PROVISIONING_OUT, NOW, CURRENT_*
OUTPUT: {"status": "migrated", "replacements": N}
```
## Validator Agent
```markdown
TASK: Test FILE_PATH works
COMMANDS: nu --ide-check FILE_PATH
OUTPUT: {"syntax_valid": bool, "errors": []}
```
## File Analyzer Agent
```markdown
TASK: Find issues in FILE_PATH
FIND: syntax errors, env refs, hardcoded paths
OUTPUT: {"syntax_errors": [], "env_refs": [], "paths": []}
```
## Token Budget
- Single file: ~500-1000 tokens
- Pattern reference: ~200 tokens
- Instructions: ~300 tokens
- Total per agent: ~1000-1500 tokens

View file

@ -0,0 +1,35 @@
# ENV → Accessor Mapping (Token-Efficient Reference)
## Critical Mappings
### Core Variables
```nushell
$env.PROVISIONING → (get-base-path)
$env.PROVISIONING_DEBUG → (is-debug-enabled)
$env.PROVISIONING_OUT → (get-provisioning-out)
$env.PROVISIONING_ARGS → (get-provisioning-args)
$env.PROVISIONING_MODULE → (get-provisioning-module)
$env.PROVISIONING_NAME → (get-provisioning-name)
```
### Path Variables
```nushell
$env.PROVISIONING_PROVIDERS_PATH → (get-providers-path)
$env.PROVISIONING_TASKSERVS_PATH → (get-taskservs-path)
$env.PROVISIONING_TOOLS_PATH → (get-tools-path)
$env.PROVISIONING_TEMPLATES_PATH → (get-templates-path)
```
### Runtime Variables (Keep as ENV)
```nushell
$env.PROVISIONING_ARGS # Command arguments - KEEP
$env.PROVISIONING_OUT # Output redirection - KEEP
$env.NOW # Timestamps - KEEP
$env.CURRENT_* # Context variables - KEEP
```
## Usage Pattern
```nushell
# Always wrap in parentheses
let value = ((get-function-name) | default "fallback")
```

View file

@ -0,0 +1,38 @@
# Syntax Fix Patterns (Token-Efficient Reference)
## Critical Patterns to Fix
### 1. Function Call Parentheses
```nushell
# BROKEN
$"(get-provisioning-args)? | default "") "
# FIXED
((get-provisioning-args) | default "")
```
### 2. Command Parentheses
```nushell
# BROKEN
^$"(get-provisioning-name))" -mod server
# FIXED
^(get-provisioning-name) -mod server
```
### 3. Missing Function Calls
```nushell
# BROKEN
let ops = $"(get-provisioning-args)? | default "") "
# FIXED
let ops = ((get-provisioning-args) | default "")
```
## Testing Command
```bash
nu --ide-check FILE_PATH
```
## Success Pattern
All function calls must be wrapped in parentheses when used in expressions.