<#1004 New `osctrl-cli` functionality along with t...
# osctrl
g
#1004 New `osctrl-cli` functionality along with the new `osctrl-api` changes Pull request opened by javuto Refresh osctrl-cli with new osctrl-api functionality + TUI dashboard Problem osctrl-cli lagged behind osctrl-api. The interactive shell covered the core surface (nodes, queries, carves, environments, tags, users, audit, settings) but none of the newer API additions: the per-node console, the file explorer, node posture + compliance scoring, saved queries, the query template library, or node log retrieval. There was also no at-a-glance fleet view from the terminal. Change New API client wrappers •
cmd/cli/api-console.go
— console sessions (create/show/close), command submit, command status, command results (
/api/v1/console/...
) •
cmd/cli/api-extras.go
— file explorer (sessions, `list`/`stat`, request status, entries), posture (node records, SOC2/ISO27001 risk score, profile templates), saved queries (list/create/update/delete), query samples, and node logs (`result`/`status`) •
cmd/cli/api.go
—
ReqGeneric
now accepts any 2xx (not just 200) since the new POST routes return
201 Created
New interactive shell modules (
cmd/cli/shell_module_extras.go
, backed by
cmd/cli/shell_store_extras.go
): •
use console
→ `open <node>`: live per-node REPL. Shell-style commands (
ls
,
cd
,
pwd
,
get
,
tables
) and SQL, inline spinner while the node answers, result rows rendered as tables, server-side
cd
tracking, session history restored on open •
use file-explorer
→ `open <node>`: live remote browsing (
ls
,
stat
,
cd
re-root) with polling and entry tables •
use posture
→
show
,
score
(color-coded risk level + control table sorted fail → warn → pass),
profiles
•
use saved
→
list
,
show
,
save
,
update
,
delete
,
run
(dispatches with existing
set
targeting options),
samples
(template library) •
use nodes
gains
logs <node> [result|status]
• New surfaces are exposed via optional interfaces (
consoleStore
,
postureStore
,
savedStore
) so
--db
mode fails cleanly with "requires API mode" instead of crashing; tab completion and module help cover the new modules Full-screen TUI dashboard (
cmd/cli/tui_dashboard.go
) • New
osctrl-cli tui
(alias
dashboard
) command using termui (already a dependency) • Fleet-health and in-flight queries/carves gauges, platform bar chart, detail pane switchable between environments / queries / audit • Auto-refresh every 30s,
r
force-refresh, `q`/Ctrl-C quit • Works in both
--api
and
--db
modes through the existing
DataStore
façade Validation •
go build ./...
,
go vet ./cmd/cli/
,
gofmt
clean •
golangci-lint run ./cmd/cli/...
— 0 issues •
go test ./cmd/cli/ ./pkg/console/ ./pkg/fileexplorer/ ./pkg/posture/
— pass • New `cmd/cli/api_extras_test.go`: httptest round-trip tests for every new endpoint (console session lifecycle, command submit/poll/results, file explorer list/stat/results, posture records/score/profiles, saved-query CRUD, samples, node logs), store-cast regression tests asserting dbStore rejects and apiStore implements the new surfaces, and a URL-shape test asserting the client paths match the server route table jmpsec/osctrl