63 lines
1.7 KiB
Plaintext
63 lines
1.7 KiB
Plaintext
![]() |
#!/usr/bin/env nu
|
||
|
# Dynamic Version Cache Agent
|
||
|
# Token-optimized agent for progressive version caching with infra-aware hierarchy
|
||
|
# Usage: nu agent.nu <command> [args]
|
||
|
|
||
|
use cache_manager.nu *
|
||
|
use version_loader.nu *
|
||
|
use grace_checker.nu *
|
||
|
use batch_updater.nu *
|
||
|
|
||
|
# Main agent entry point
|
||
|
def main [
|
||
|
command: string # Command: init, get, update-all, clear, status
|
||
|
...args # Additional arguments
|
||
|
] {
|
||
|
match $command {
|
||
|
"init" => {
|
||
|
print "π Initializing dynamic version cache system..."
|
||
|
init-cache-system
|
||
|
print "β
Cache system initialized"
|
||
|
}
|
||
|
|
||
|
"get" => {
|
||
|
if ($args | length) == 0 {
|
||
|
print "β Usage: agent.nu get <component-name>"
|
||
|
exit 1
|
||
|
}
|
||
|
let component = ($args | get 0)
|
||
|
print $"π Getting version for ($component)..."
|
||
|
let version = (get-cached-version $component)
|
||
|
print $"π¦ ($component): ($version)"
|
||
|
}
|
||
|
|
||
|
"update-all" => {
|
||
|
print "π Updating all cached versions..."
|
||
|
batch-update-cache
|
||
|
print "β
Cache updated"
|
||
|
}
|
||
|
|
||
|
"clear" => {
|
||
|
print "ποΈ Clearing version cache..."
|
||
|
clear-cache-system
|
||
|
print "β
Cache cleared"
|
||
|
}
|
||
|
|
||
|
"status" => {
|
||
|
print "π Version cache status:"
|
||
|
show-cache-status
|
||
|
}
|
||
|
|
||
|
"sync" => {
|
||
|
print "π Syncing cache from sources..."
|
||
|
sync-cache-from-sources
|
||
|
print "β
Cache synced"
|
||
|
}
|
||
|
|
||
|
_ => {
|
||
|
print $"β Unknown command: ($command)"
|
||
|
print "Available commands: init, get, update-all, clear, status, sync"
|
||
|
exit 1
|
||
|
}
|
||
|
}
|
||
|
}
|