diff --git a/README.md b/README.md index 986796c..b79af56 100644 --- a/README.md +++ b/README.md @@ -1089,12 +1089,16 @@ Build the local homelab knowledge index separately from the main deployment: ```bash ./jeannie ai-index ./jeannie ai-check +./jeannie ask "how do I check edge to Gitea?" ``` The index is built from the non-secret source list in `infra/ai/knowledge-sources.txt` and defaults to `/data/homelab-ai/index`. Doctor commands use it as extra context when it exists, but infrastructure 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: diff --git a/README.md.tmpl b/README.md.tmpl index 8b73a86..634627a 100644 --- a/README.md.tmpl +++ b/README.md.tmpl @@ -1089,12 +1089,16 @@ Build the local homelab knowledge index separately from the main deployment: ```bash ./{{ main_script }} ai-index ./{{ 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 `infra/ai/knowledge-sources.txt` and defaults to `/data/homelab-ai/index`. Doctor commands use it as extra context when it exists, but infrastructure 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: diff --git a/docs/jeannie.1.md b/docs/jeannie.1.md index 5f31996..5be2163 100644 --- a/docs/jeannie.1.md +++ b/docs/jeannie.1.md @@ -275,6 +275,10 @@ structure. : Check local AI helper prerequisites, knowledge index, and Ollama availability 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 `security-scan` diff --git a/jeannie b/jeannie index 68a5f16..0adea3a 100755 --- a/jeannie +++ b/jeannie @@ -5866,6 +5866,11 @@ PY echo "AI check passed." } +ask_homelab() { + require_debian_server "ask" + "${REPO_ROOT}/scripts/ask" "${@:2}" +} + security_scan() { require_debian_server "security-scan" "${REPO_ROOT}/scripts/security-scan" all @@ -6181,6 +6186,7 @@ Security Learning AI And Indexing ai-index Build the local homelab RAG index. ai-check Query/check the local AI index. + ask QUESTION... Find relevant docs/runbooks/commands. Destructive nuke Guarded cluster state destruction path. @@ -6380,6 +6386,9 @@ case "${1:-}" in ai-check) ai_check ;; + ask) + ask_homelab "$@" + ;; security-scan) security_scan ;; diff --git a/scripts/ask b/scripts/ask new file mode 100755 index 0000000..9fcbd29 --- /dev/null +++ b/scripts/ask @@ -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 "$@"