Add Jeannie ask command finder

This commit is contained in:
juvdiaz 2026-06-29 20:43:08 -06:00
parent d0004d99f8
commit 791c9d5822
5 changed files with 47 additions and 0 deletions

View File

@ -1089,12 +1089,16 @@ Build the local homelab knowledge index separately from the main deployment:
```bash ```bash
./jeannie ai-index ./jeannie ai-index
./jeannie ai-check ./jeannie ai-check
./jeannie ask "how do I check edge to Gitea?"
``` ```
The index is built from the non-secret source list in The index is built from the non-secret source list in
`infra/ai/knowledge-sources.txt` and defaults to `/data/homelab-ai/index`. `infra/ai/knowledge-sources.txt` and defaults to `/data/homelab-ai/index`.
Doctor commands use it as extra context when it exists, but infrastructure Doctor commands use it as extra context when it exists, but infrastructure
deployment does not depend on it. deployment does not depend on it.
Use `ask` as the runbook and command finder. It returns the closest indexed
docs/scripts by default; set `LAB_AI_ASK_LLM=true` to ask Ollama after
retrieval.
The CV page has two client-side presentation modes: The CV page has two client-side presentation modes:

View File

@ -1089,12 +1089,16 @@ Build the local homelab knowledge index separately from the main deployment:
```bash ```bash
./{{ main_script }} ai-index ./{{ main_script }} ai-index
./{{ main_script }} ai-check ./{{ main_script }} ai-check
./{{ main_script }} ask "how do I check edge to Gitea?"
``` ```
The index is built from the non-secret source list in The index is built from the non-secret source list in
`infra/ai/knowledge-sources.txt` and defaults to `/data/homelab-ai/index`. `infra/ai/knowledge-sources.txt` and defaults to `/data/homelab-ai/index`.
Doctor commands use it as extra context when it exists, but infrastructure Doctor commands use it as extra context when it exists, but infrastructure
deployment does not depend on it. deployment does not depend on it.
Use `ask` as the runbook and command finder. It returns the closest indexed
docs/scripts by default; set `LAB_AI_ASK_LLM=true` to ask Ollama after
retrieval.
The CV page has two client-side presentation modes: The CV page has two client-side presentation modes:

View File

@ -275,6 +275,10 @@ structure.
: Check local AI helper prerequisites, knowledge index, and Ollama availability : Check local AI helper prerequisites, knowledge index, and Ollama availability
when the backstage helper is enabled. when the backstage helper is enabled.
`ask QUESTION...`
: Search the local homelab knowledge index for relevant docs, runbooks, scripts,
and commands. Set `LAB_AI_ASK_LLM=true` to ask Ollama after retrieval.
### Defensive Security ### Defensive Security
`security-scan` `security-scan`

View File

@ -5866,6 +5866,11 @@ PY
echo "AI check passed." echo "AI check passed."
} }
ask_homelab() {
require_debian_server "ask"
"${REPO_ROOT}/scripts/ask" "${@:2}"
}
security_scan() { security_scan() {
require_debian_server "security-scan" require_debian_server "security-scan"
"${REPO_ROOT}/scripts/security-scan" all "${REPO_ROOT}/scripts/security-scan" all
@ -6181,6 +6186,7 @@ Security Learning
AI And Indexing AI And Indexing
ai-index Build the local homelab RAG index. ai-index Build the local homelab RAG index.
ai-check Query/check the local AI index. ai-check Query/check the local AI index.
ask QUESTION... Find relevant docs/runbooks/commands.
Destructive Destructive
nuke Guarded cluster state destruction path. nuke Guarded cluster state destruction path.
@ -6380,6 +6386,9 @@ case "${1:-}" in
ai-check) ai-check)
ai_check ai_check
;; ;;
ask)
ask_homelab "$@"
;;
security-scan) security-scan)
security_scan security_scan
;; ;;

26
scripts/ask Executable file
View File

@ -0,0 +1,26 @@
#!/usr/bin/env bash
set -euo pipefail
REPO_ROOT="$(cd "$(dirname "${BASH_SOURCE[0]}")/.." && pwd)"
usage() {
cat <<'EOF'
Usage: ./jeannie ask QUESTION...
Search the homelab knowledge index for the closest docs, runbooks, scripts, and
Jeannie commands. Set LAB_AI_ASK_LLM=true to ask Ollama after retrieval.
EOF
}
case "${1:-}" in
""|-h|--help|help)
usage
exit 0
;;
esac
if [ "${LAB_AI_ASK_LLM:-false}" = "true" ]; then
exec "${REPO_ROOT}/scripts/query-homelab-ai-index" --ask "$@"
fi
exec "${REPO_ROOT}/scripts/query-homelab-ai-index" --context-only "$@"