prvng_core/nulib/scripts/query-workspace-info.nu

45 lines
1.2 KiB
Text
Raw Normal View History

feat(core): three-layer DAG, unified component arch, commands-registry cache, Nushell 0.112.2 migration - DAG architecture: `dag show/validate/export` (nulib/main_provisioning/dag.nu), config loader (lib_provisioning/config/loader/dag.nu), taskserv dag-executor. Backed by schemas/lib/dag/*.ncl; orchestrator emits NATS events via WorkspaceComposition::into_workflow. See ADR-020, ADR-021. - Unified Component Architecture: components/mod.nu, main_provisioning/ {components,workflow,extensions,ontoref-queries}.nu. Full workflow engine with topological sort and NATS subject emission. Blocks A-H complete (libre-daoshi). - Commands-registry: nulib/commands-registry.ncl (Nickel source, 314 lines) + JSON cache at ~/.cache/provisioning/commands-registry.json rebuilt on source change. cli/provisioning fast-path alias expansion avoids cold Nu startup. ADDING_COMMANDS.md documents new-command workflow. - Platform service manager: service-manager.nu (+573), startup.nu (+611), service-check.nu (+255); autostart/bootstrap/health/target refactored. - Nushell 0.112.2 migration: removed all try/catch and bash redirections; external commands prefixed with ^; type signatures enforced. Driven by scripts/refactor-try-catch{,-simplified}.nu. - TTY stack: removed shlib/*-tty.sh; replaced by cli/tty-dispatch.sh, tty-filter.sh, tty-commands.conf. - New domain modules: images/ (golden image lifecycle), workspace/{state,sync}.nu, main_provisioning/{bootstrap,cluster-deploy,fip,state}.nu, commands/{state, build,integrations/auth,utilities/alias}.nu, platform.nu expanded (+874). - Config loader overhaul: loader/core.nu slimmed (-759), cache/core.nu refactored (-454), removed legacy loaders/file_loader.nu (-330). - Thirteen new provisioning-<domain>.nu top-level modules for bash dispatcher. - Tests: test_workspace_state.nu (+351); updates to test_oci_registry, test_services. - README + CHANGELOG updated.
2026-04-17 04:27:33 +01:00
# Show active workspace info including infrastructure list
# Sourced by bash after lib_minimal.nu is loaded — not meant to be run standalone
let ws_result = (workspace-active)
let ws_name = if (is-ok $ws_result) { $ws_result.ok } else { "" }
if ($ws_name | is-empty) {
print 'No active workspace'
exit 1
}
let info_result = (workspace-info $ws_name)
if not (is-ok $info_result) {
print $"Error: ($info_result.err)"
exit 1
}
let info = $info_result.ok
if not $info.exists {
print $"Workspace '($ws_name)' not found in config"
exit 1
}
print $"📊 Workspace: ($info.name)"
print $" Path: ($info.path)"
print $" Last used: ($info.last_used)"
if ($info.default_infra | is-not-empty) {
print $" Default: ($info.default_infra)"
}
print ""
if ($info.infrastructures | is-empty) {
print "📁 Infrastructures: (none configured)"
} else {
print "📁 Infrastructures:"
$info.infrastructures | each {|inf|
let srv_label = if $inf.servers == 1 { "1 server" } else { $"($inf.servers) servers" }
let marker = if $inf.name == $info.default_infra { " ★" } else { "" }
print $" • ($inf.name) [($srv_label)]($marker)"
} | ignore
}