46 lines
1.3 KiB
Plaintext
46 lines
1.3 KiB
Plaintext
|
|
#!/usr/bin/env nu
|
||
|
|
# Generate agent configuration JSON files from Nickel definitions
|
||
|
|
# Requires: nickel CLI installed
|
||
|
|
|
||
|
|
def main [] {
|
||
|
|
let script_dir = (get-env PWD | path split | drop 1 | path join)
|
||
|
|
let config_dir = $script_dir / config / agents
|
||
|
|
let output_dir = $config_dir / generated
|
||
|
|
|
||
|
|
print $"Generating agent configurations from Nickel definitions..."
|
||
|
|
print $"Input: ($config_dir)"
|
||
|
|
print $"Output: ($output_dir)"
|
||
|
|
|
||
|
|
# Create output directory
|
||
|
|
mkdir -p $output_dir
|
||
|
|
|
||
|
|
# List all agent definition files
|
||
|
|
let agents = (
|
||
|
|
ls ($config_dir | path join "*.ncl")
|
||
|
|
| filter { |it| $it.name != "schema.ncl" }
|
||
|
|
| each { |it| $it.name | str replace ".ncl" "" }
|
||
|
|
)
|
||
|
|
|
||
|
|
print $"\nFound ($agents | length) agent definitions:"
|
||
|
|
|
||
|
|
# Generate JSON for each agent
|
||
|
|
for agent in $agents {
|
||
|
|
print $" Generating ($agent)..."
|
||
|
|
|
||
|
|
let input_file = $config_dir | path join $"($agent).ncl"
|
||
|
|
let output_file = $output_dir | path join $"($agent).json"
|
||
|
|
|
||
|
|
# Use nickel to export to JSON
|
||
|
|
if (which nickel | is-empty) {
|
||
|
|
print $" ⚠ nickel command not found - skipping"
|
||
|
|
} else {
|
||
|
|
nickel export $input_file | save -f $output_file
|
||
|
|
print $" ✓ Generated ($output_file)"
|
||
|
|
}
|
||
|
|
}
|
||
|
|
|
||
|
|
print "\nAgent configuration generation complete!"
|
||
|
|
}
|
||
|
|
|
||
|
|
main
|