Commit graph

10 commits

Author SHA1 Message Date
Marco Allegretti
06b8889d27 fix(cli): avoid panics in progress styling 2026-02-25 12:28:28 +01:00
Marco Allegretti
961209ef0a fix: harden enter/stop and WAL recovery
- Guard WAL recovery and stale .running cleanup behind a try-acquired store lock\n- Persist rollback ResetState via MetadataStore to recompute checksums\n- Track a killable host PID for namespace enter/stop and treat SIGTERM/SIGKILL as clean exit\n- Derive OCI status PID via runtime state output\n- Make sandbox chroot script quoting robust for exec/enter
2026-02-25 11:48:58 +01:00
Marco Allegretti
9abbf426bf cli: exit cleanly on broken pipe
Piping CLI output into tools like head may close stdout early.
Rust then panics when printing.

Install a panic hook that exits successfully on EPIPE instead of
emitting a panic backtrace.
2026-02-24 11:46:51 +01:00
Marco Allegretti
7278d9923d cli: make snapshots output restorable
The snapshots command printed a snapshot layer internal ID that restore
cannot use.

Compute and display the stored layer manifest hash so it can be
copy/pasted into restore. JSON output now includes restore_hash.

Add an integration test covering commit -> snapshots -> restore.
2026-02-24 11:46:16 +01:00
Marco Allegretti
eff53cf7af cli: satisfy clippy and rustfmt
Refactor build and rebuild command handlers to pass BuildOptions instead
of multiple boolean flags, satisfying clippy's excessive-bools and
too-many-arguments lints.

Apply rustfmt output in CLI and core engine code.
2026-02-23 18:50:23 +01:00
Marco Allegretti
f1c6e55e09 cli: add pin command
Add a new 'pin' subcommand to rewrite base.image to an explicit URL.

Extend build and rebuild with --locked, --offline, and --require-pinned-image,
and wire flags into the core engine build options.
2026-02-23 18:29:46 +01:00
Marco Allegretti
32296bd75a Fix clippy warnings in new command
Refactor the 'karapace new' implementation to satisfy clippy -D warnings.

Adjust path handling, defaults, and string assignment to avoid pedantic lints.
2026-02-23 12:42:00 +01:00
Marco Allegretti
8e90f45efc Add new and tui CLI commands
Add 'karapace new' to generate a manifest from templates or prompts.

Add 'karapace tui' to launch the terminal UI.

Improve env-id resolution errors in non-JSON output with suggestions.

Add dialoguer and toml as CLI dependencies.
2026-02-23 12:15:39 +01:00
Marco Allegretti
fd7313a318 fix CI: skip prereq check for mock backend, add bash to opensuse
- Add KARAPACE_SKIP_PREREQS=1 env var check to skip runtime prerequisite
  checks (user namespaces, fuse-overlayfs) when testing with mock backend
- Set KARAPACE_SKIP_PREREQS=1 in CLI integration test helper
- Add bash to opensuse/tumbleweed container deps (required by
  dtolnay/rust-toolchain action)
2026-02-22 19:56:47 +01:00
Marco Allegretti
1416b0fc99 feat: karapace-cli — 23 commands, thin dispatcher, progress indicators
- 23 commands, each in its own module under commands/
- Thin main.rs dispatcher with clap subcommand routing
- Progress spinners (indicatif) and colored state output (console)
- Environment resolution by env_id, short_id, name, or prefix
- Structured JSON output (--json) on all query commands
- --verbose/-v for debug, --trace for trace-level logging
- KARAPACE_LOG env var for fine-grained log control
- Exit codes: 0 success, 1 failure, 2 manifest error, 3 store error
- Prerequisite check before runtime operations
- Shell completions (bash/zsh/fish/elvish/powershell) and man page generation
2026-02-22 18:37:54 +01:00