@dujavi/ai-md 0.3.0 → 0.5.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +108 -24
- package/bin/ai-md.js +346 -99
- package/docs/architecture.html +316 -0
- package/docs/architecture.png +0 -0
- package/lib/config.js +110 -8
- package/lib/scripts.js +104 -0
- package/lib/status.js +11 -1
- package/package.json +9 -6
- package/scripts/sync-config.sh +2 -2
- package/scripts/ensure-agent-tools.sh +0 -114
|
@@ -1,114 +0,0 @@
|
|
|
1
|
-
#!/usr/bin/env bash
|
|
2
|
-
# Ensure Grok Build CLI + quota-axi are installed on this machine.
|
|
3
|
-
# Safe to re-run (idempotent). Does not print secrets.
|
|
4
|
-
set -euo pipefail
|
|
5
|
-
|
|
6
|
-
DRY_RUN=0
|
|
7
|
-
|
|
8
|
-
usage() {
|
|
9
|
-
cat <<'EOF'
|
|
10
|
-
Usage: ensure-agent-tools.sh [--dry-run]
|
|
11
|
-
|
|
12
|
-
Installs or updates:
|
|
13
|
-
- grok (Grok Build CLI) via https://x.ai/cli/install.sh
|
|
14
|
-
- quota-axi via volta (if present) or npm -g
|
|
15
|
-
|
|
16
|
-
Then prints version + auth/quota smoke checks (no secrets).
|
|
17
|
-
EOF
|
|
18
|
-
}
|
|
19
|
-
|
|
20
|
-
log() { printf '%s\n' "$*"; }
|
|
21
|
-
err() { printf 'error: %s\n' "$*" >&2; }
|
|
22
|
-
run() {
|
|
23
|
-
if [[ "$DRY_RUN" -eq 1 ]]; then
|
|
24
|
-
log "dry-run: $*"
|
|
25
|
-
else
|
|
26
|
-
"$@"
|
|
27
|
-
fi
|
|
28
|
-
}
|
|
29
|
-
|
|
30
|
-
while [[ $# -gt 0 ]]; do
|
|
31
|
-
case "$1" in
|
|
32
|
-
--dry-run) DRY_RUN=1; shift ;;
|
|
33
|
-
-h|--help|help) usage; exit 0 ;;
|
|
34
|
-
*) err "unknown argument: $1"; usage; exit 1 ;;
|
|
35
|
-
esac
|
|
36
|
-
done
|
|
37
|
-
|
|
38
|
-
ensure_path_hint() {
|
|
39
|
-
local need=0
|
|
40
|
-
case ":$PATH:" in
|
|
41
|
-
*":$HOME/.local/bin:"*) ;;
|
|
42
|
-
*) need=1; log "note: add \$HOME/.local/bin to PATH" ;;
|
|
43
|
-
esac
|
|
44
|
-
case ":$PATH:" in
|
|
45
|
-
*":$HOME/.grok/bin:"*) ;;
|
|
46
|
-
*) need=1; log "note: add \$HOME/.grok/bin to PATH (grok installer usually does)" ;;
|
|
47
|
-
esac
|
|
48
|
-
return 0
|
|
49
|
-
}
|
|
50
|
-
|
|
51
|
-
install_grok() {
|
|
52
|
-
if command -v grok >/dev/null 2>&1; then
|
|
53
|
-
log "grok present: $(grok --version 2>/dev/null || echo unknown)"
|
|
54
|
-
log "Updating grok via official installer…"
|
|
55
|
-
else
|
|
56
|
-
log "Installing grok via official installer…"
|
|
57
|
-
fi
|
|
58
|
-
if [[ "$DRY_RUN" -eq 1 ]]; then
|
|
59
|
-
log "dry-run: curl -fsSL https://x.ai/cli/install.sh | bash"
|
|
60
|
-
return 0
|
|
61
|
-
fi
|
|
62
|
-
curl -fsSL https://x.ai/cli/install.sh | bash
|
|
63
|
-
}
|
|
64
|
-
|
|
65
|
-
install_quota_axi() {
|
|
66
|
-
if command -v quota-axi >/dev/null 2>&1; then
|
|
67
|
-
log "quota-axi present: $(quota-axi --version 2>/dev/null || echo unknown)"
|
|
68
|
-
else
|
|
69
|
-
log "Installing quota-axi…"
|
|
70
|
-
fi
|
|
71
|
-
if command -v volta >/dev/null 2>&1; then
|
|
72
|
-
run volta install quota-axi
|
|
73
|
-
elif command -v npm >/dev/null 2>&1; then
|
|
74
|
-
run npm install -g quota-axi
|
|
75
|
-
else
|
|
76
|
-
err "Need volta or npm to install quota-axi"
|
|
77
|
-
return 1
|
|
78
|
-
fi
|
|
79
|
-
}
|
|
80
|
-
|
|
81
|
-
smoke() {
|
|
82
|
-
log ""
|
|
83
|
-
log "=== smoke checks ==="
|
|
84
|
-
if command -v grok >/dev/null 2>&1; then
|
|
85
|
-
log "grok: $(command -v grok)"
|
|
86
|
-
grok --version 2>&1 || true
|
|
87
|
-
if [[ -f "$HOME/.grok/auth.json" ]]; then
|
|
88
|
-
log "grok auth: ~/.grok/auth.json present"
|
|
89
|
-
else
|
|
90
|
-
log "grok auth: missing — run \`grok\` (browser) or set XAI_API_KEY"
|
|
91
|
-
fi
|
|
92
|
-
else
|
|
93
|
-
err "grok not on PATH after install"
|
|
94
|
-
fi
|
|
95
|
-
|
|
96
|
-
if command -v quota-axi >/dev/null 2>&1; then
|
|
97
|
-
log "quota-axi: $(command -v quota-axi)"
|
|
98
|
-
quota-axi auth 2>&1 || true
|
|
99
|
-
quota-axi --provider grok 2>&1 || true
|
|
100
|
-
else
|
|
101
|
-
err "quota-axi not on PATH after install"
|
|
102
|
-
fi
|
|
103
|
-
|
|
104
|
-
if ! command -v sqlite3 >/dev/null 2>&1; then
|
|
105
|
-
log "note: sqlite3 not found — Cursor quota via quota-axi may fail (install sqlite3)"
|
|
106
|
-
fi
|
|
107
|
-
}
|
|
108
|
-
|
|
109
|
-
ensure_path_hint
|
|
110
|
-
install_grok
|
|
111
|
-
install_quota_axi
|
|
112
|
-
smoke
|
|
113
|
-
log ""
|
|
114
|
-
log "Done. Re-run anytime; pair with: ai-md install"
|