2.4 KiB
2.4 KiB
Test Plan: CLI Flags
Feature description
Loki CLI accepts flags for model, role, session, agent, file input, execution mode, and various info/list commands. Flags determine the execution path through main.rs.
Behaviors to test
Early-exit flags
- --info parsed correctly
- --list-models parsed correctly
- --list-roles parsed correctly
- --list-sessions parsed correctly
- --list-agents parsed correctly
- --list-rags parsed correctly
- --list-macros parsed correctly
- --sync-models parsed correctly
- --build-tools parsed correctly
- --authenticate runs OAuth and exits (integration)
- --completions generates shell completions and exits (integration)
- Vault flags (--add/get/update/delete-secret, --list-secrets) parsed
Mode selection
- No text/file → text returns None (REPL indicator)
- Text provided → text joined and returned
- --agent → agent field set
- --role → role field set
- --execute (-e) → execute flag set
- --code (-c) → code flag set
- --prompt → prompt field set
- --macro → macro_name field set
Flag combinations
- --model + --role parsed together
- --session + --role parsed together
- --session + --agent → agent with session (integration)
- --agent + --agent-variable → variables set (integration)
- --dry-run flag parsed
- --no-stream (-S) flag parsed
- --file + text → both parsed
- --empty-session + --session parsed
- --save-session + --session parsed
Prelude
- apply_prelude runs before main execution (async + filesystem)
- Prelude "role:name" loads role (async + filesystem)
- Prelude "session:name" loads session (async + filesystem)
- Prelude "session:role" loads both (async + filesystem)
- Prelude skipped if macro_flag set (async)
- Prelude skipped if state already has role/session/agent (async)
Additional behaviors tested (not in original plan)
- Default Cli has all flags unset/empty
- Short flags: -m, -r, -a, -s, -e, -c, -S, -f
- Multiple -f flags accumulate
- Trailing text args collected as vec
- Cli::text() returns None with no args (terminal stdin)
- Cli::text() joins trailing args with spaces
- --rag flag parsed
- --macro flag parsed
Old code reference
src/cli/mod.rs— Cli struct, flag definitionssrc/main.rs— run(), flag processing, mode branching