fix: review-driven hardening of pos ai hf/server + llamacpp provider
gates / consistency-and-conventions (push) Successful in 2m16s

Adversarial review of the AI tools (commits 387f23f/0856b25) found 2
BLOCKING + 5 REQUIRED defects; all fixed:

- pos-ai-hf --include/--exclude: bash-case glob filtering (array-safe,
  no jq regex interpolation, composes gguf->filename->include->exclude)
- pos-ai-server: ExecStart rebuilt as single-line properly-quoted command
  (systemd_quote for executable + model path; systemd-analyze verify rc=0)
- --branch/--revision aliased (last wins), dead BRANCH variable removed
- parallel download drains all jobs: per-pid wait, honest
  'X of Y files, N failed' summary, rc=1 on partial failure, no .hf-meta
  for half-downloaded models, EXIT-trap temp cleanup
- detect_llama_version guarded; validate_requested_flags errors on
  unsupported explicit flags with version-aware message
- pos ai hf cache [status|clear]: real implementation, fail-closed confirm
- new bin/pos-ai-llamacpp thin forwarder + llamacpp shorthand in bin/pos-ai
  (pos ai llamacpp <subcmd> = pos ai --provider llamacpp <subcmd>)
- docs synced: bin/pos-ai usage(), DOC/POS.md AI_PROVIDER row, howto/ai.md
  (adapter list, --provider backends, shorthand, providers table); gen
  regenerated (tree/dispatch/completions)

Verified: bash -n all bin/pos*; make gen idempotent; make check green;
make lint 0 FAIL, 0 WARN. Reviewer acceptance: APPROVE_WITH_NOTES
(0 REQUIRED). Audit deliverables + agent reports included for context.
This commit is contained in:
Your Name
2026-09-06 03:45:53 -04:00
parent 0856b25b97
commit 528b16676e
23 changed files with 2495 additions and 253 deletions
+6 -2
View File
@@ -39,7 +39,7 @@ usage() {
cat <<EOF
Usage: pos ai [subcommand] [--provider <name>] [--model <id>] [--session <name>] [--system <text>] [--full] [--last] [--trust]
AI assistant with pluggable providers (gemini, openrouter).
AI assistant with pluggable providers (gemini, openrouter, llamacpp).
Subcommands:
ask "<prompt>" Answer; prints the answer text to stdout. The prompt may
@@ -56,7 +56,7 @@ Subcommands:
'sessions' and 'sessions reset <name>'.
Options:
--provider <name> Provider to use (gemini|openrouter; default: gemini).
--provider <name> Provider to use (gemini|openrouter|llamacpp; default: gemini).
Can also be set via AI_PROVIDER env/config.
--model <id> Override the model for this invocation.
--session <name> Use a named persistent session instead of 'default':
@@ -698,5 +698,9 @@ case "${cmd:-}" in
models) cmd_models "${args[@]}" ;;
providers) cmd_providers "${args[@]}" ;;
sessions) cmd_sessions "${args[@]}" ;;
llamacpp)
# Provider shorthand (backward compat, same as the gemini/openrouter
# forwarders): pos ai llamacpp <subcmd> ... == pos ai --provider llamacpp <subcmd> ...
exec "$0" --provider llamacpp "${args[@]}" ;;
*) err "Unknown ai subcommand '$cmd' (see --help)" ;;
esac