69 lines
1.3 KiB
Bash
Executable File
69 lines
1.3 KiB
Bash
Executable File
#!/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}"
|