init repo

This commit is contained in:
2026-04-22 20:55:36 +02:00
commit 0155516457
32 changed files with 7712 additions and 0 deletions

68
ai/scripts/build-context.sh Executable file
View File

@@ -0,0 +1,68 @@
#!/usr/bin/env bash
set -euo pipefail
mkdir -p ai/context
OUT="ai/context/project-context.md"
{
echo "# Project Context"
echo
echo "Generated: $(date -u +"%Y-%m-%dT%H:%M:%SZ")"
echo
echo "## Repo Tree"
echo
echo '```text'
if command -v tree >/dev/null 2>&1; then
tree -a -I target -I .git
else
echo "[tree not installed, showing file list fallback]"
fd -t f . src docs ai .cargo -E ai/context -E target | sort
fi
echo '```'
echo
echo "## Cargo.toml"
echo
echo '```toml'
cat Cargo.toml
echo '```'
echo
echo "## AGENTS.md"
echo
cat AGENTS.md
echo
echo "## Source Files"
echo
while IFS= read -r file; do
echo "### ${file}"
echo
case "${file}" in
*.rs)
echo '```rust'
cat "${file}"
echo '```'
;;
*.toml)
echo '```toml'
cat "${file}"
echo '```'
;;
*.md)
cat "${file}"
;;
*)
echo '```text'
cat "${file}"
echo '```'
;;
esac
echo
done < <(fd -t f . src docs ai .cargo -E ai/context -E target | sort)
echo "## TODO / FIXME / HACK"
echo
echo '```text'
rg -n "TODO|FIXME|HACK|BUG" . --glob '!target/**' --glob '!ai/context/**' || true
echo '```'
} > "${OUT}"
echo "Wrote ${OUT}"

18
ai/scripts/llama-chat.sh Executable file
View File

@@ -0,0 +1,18 @@
#!/usr/bin/env bash
set -euo pipefail
MODEL="${LLAMA_MODEL:-}"
if [ -z "${MODEL}" ]; then
echo "error: LLAMA_MODEL not set"
echo "export LLAMA_MODEL=/absolute/path/to/model.gguf"
exit 1
fi
./ai/scripts/build-context.sh >/dev/null
exec llama-cli \
-m "${MODEL}" \
-sysf ai/system-prompt.md \
-f ai/context/project-context.md \
-cnv \
-mli

47
ai/scripts/llama-task.sh Executable file
View File

@@ -0,0 +1,47 @@
#!/usr/bin/env bash
set -euo pipefail
MODE="${1:-}"
TASK="${2:-}"
if [ -z "${MODE}" ] || [ -z "${TASK}" ]; then
echo "usage: $0 <plan|fix|review> <task text>"
exit 1
fi
MODEL="${LLAMA_MODEL:-}"
if [ -z "${MODEL}" ]; then
echo "error: LLAMA_MODEL not set"
echo "export LLAMA_MODEL=/absolute/path/to/model.gguf"
exit 1
fi
case "${MODE}" in
plan|fix|review) ;;
*)
echo "error: mode must be one of: plan fix review"
exit 1
;;
esac
./ai/scripts/build-context.sh >/dev/null
TMP="$(mktemp)"
trap 'rm -f "$TMP"' EXIT
{
cat "ai/prompts/${MODE}.md"
echo
echo "User task:"
echo "${TASK}"
echo
echo "Project context follows:"
echo
cat ai/context/project-context.md
} > "${TMP}"
exec llama-cli \
-m "${MODEL}" \
-sysf ai/system-prompt.md \
-f "${TMP}" \
-st