@sebastienrousseau/dotfiles 0.2.504 → 0.2.507
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/CHANGELOG.md +59 -0
- package/README.md +11 -11
- package/docs/AI.md +128 -58
- package/docs/COPYRIGHT +1 -1
- package/docs/STRUCTURE.md +1 -1
- package/docs/adr/ADR-012-ai-fleet-local-proxy.md +79 -0
- package/docs/adr/README.md +1 -0
- package/docs/index.md +2 -2
- package/docs/interop/A2A.md +2 -2
- package/docs/manual/00-introduction.md +1 -1
- package/docs/manual/01-concepts/02-trust-model.md +1 -1
- package/docs/manual/02-tutorials/01-first-install.md +1 -1
- package/docs/manual/03-reference/01-dot-cli.md +18 -3
- package/docs/manual/command-index.md +2 -2
- package/docs/operations/RELEASE_PIPELINE.md +3 -3
- package/docs/operations/TRUSTED_AGENT_WORKSTATION.md +6 -6
- package/docs/reference/TOOLS.md +1 -1
- package/docs/reference/UTILS.md +16 -12
- package/docs/security/AUTOMATION_SECRETS.md +1 -1
- package/docs/security/MCP_POLICY.md +4 -4
- package/docs/security/SECURITY_CHECKLIST.md +1 -1
- package/docs/security/SOUP_REGISTER.md +4 -4
- package/install.sh +7 -6
- package/package.json +1 -1
- package/scripts/ci/check-copyright-headers.sh +2 -1
- package/scripts/ci/check-shell-preamble.sh +2 -1
- package/scripts/ci/guard-gitleaks-checkout.sh +2 -1
- package/scripts/demo/record.sh +2 -1
- package/scripts/diagnostics/a2a-conformance.sh +2 -1
- package/scripts/diagnostics/alias-governance.sh +2 -1
- package/scripts/diagnostics/aliases-cheatsheet.sh +2 -1
- package/scripts/diagnostics/aliases-manifest.sh +2 -1
- package/scripts/diagnostics/benchmark.sh +2 -1
- package/scripts/diagnostics/conflicts.sh +2 -1
- package/scripts/diagnostics/doctor-unified.sh +2 -1
- package/scripts/diagnostics/doctor.sh +4 -3
- package/scripts/diagnostics/drift-dashboard.sh +2 -1
- package/scripts/diagnostics/health.sh +2 -1
- package/scripts/diagnostics/history-analysis.sh +2 -1
- package/scripts/diagnostics/mcp-doctor.sh +2 -1
- package/scripts/diagnostics/perf.sh +2 -1
- package/scripts/diagnostics/scorecard.sh +2 -1
- package/scripts/diagnostics/secret-governance.sh +2 -1
- package/scripts/diagnostics/security-score.sh +2 -1
- package/scripts/diagnostics/smoke-test.sh +2 -1
- package/scripts/diagnostics/snapshot.sh +2 -1
- package/scripts/diagnostics/verify.sh +2 -1
- package/scripts/diagnostics/verify_state.sh +2 -1
- package/scripts/diagnostics/version-locks.sh +2 -1
- package/scripts/diagnostics/workstation-attestation.sh +2 -1
- package/scripts/dot/commands/agent.sh +2 -1
- package/scripts/dot/commands/agents.sh +7 -6
- package/scripts/dot/commands/ai.sh +168 -193
- package/scripts/dot/commands/aliases.sh +2 -1
- package/scripts/dot/commands/appearance.sh +2 -1
- package/scripts/dot/commands/core.sh +2 -1
- package/scripts/dot/commands/diagnostics.sh +2 -1
- package/scripts/dot/commands/env-emit.sh +2 -1
- package/scripts/dot/commands/fleet.sh +2 -1
- package/scripts/dot/commands/init.sh +2 -1
- package/scripts/dot/commands/lint.sh +2 -1
- package/scripts/dot/commands/manual.sh +2 -1
- package/scripts/dot/commands/meta.sh +2 -1
- package/scripts/dot/commands/patterns.sh +2 -1
- package/scripts/dot/commands/registry.sh +2 -1
- package/scripts/dot/commands/restore.sh +2 -1
- package/scripts/dot/commands/secrets.sh +2 -1
- package/scripts/dot/commands/security.sh +2 -1
- package/scripts/dot/commands/tools.sh +2 -1
- package/scripts/fonts/install-nerd-fonts.sh +2 -1
- package/scripts/fonts/patch-fonts.sh +2 -1
- package/scripts/git-hooks/install.sh +2 -1
- package/scripts/git-hooks/pre-commit-audit.sh +3 -2
- package/scripts/lib/secrets_provider.sh +2 -1
- package/scripts/ops/ai-setup.sh +25 -16
- package/scripts/ops/bundle.sh +2 -1
- package/scripts/ops/chaos.sh +2 -1
- package/scripts/ops/chezmoi-apply.sh +22 -4
- package/scripts/ops/chezmoi-diff.sh +2 -1
- package/scripts/ops/chezmoi-remove.sh +2 -1
- package/scripts/ops/chezmoi-update.sh +2 -1
- package/scripts/ops/heal-chezmoi.sh +2 -1
- package/scripts/ops/heal-system.sh +2 -1
- package/scripts/ops/heal-tools.sh +2 -1
- package/scripts/ops/heal.sh +2 -1
- package/scripts/ops/post-apply-repair.sh +2 -1
- package/scripts/ops/prewarm.sh +2 -1
- package/scripts/ops/release.sh +2 -1
- package/scripts/ops/rollback.sh +3 -2
- package/scripts/ops/setup.sh +2 -1
- package/scripts/ops/teleport.sh +2 -1
- package/scripts/qa/check-version-consistency.sh +2 -1
- package/scripts/qa/coverage-baseline.sh +2 -1
- package/scripts/qa/docs-coverage.sh +3 -2
- package/scripts/qa/reliability-audit.sh +2 -1
- package/scripts/qa/scorecard-snapshot.sh +2 -1
- package/scripts/qa/traceability-coverage.sh +2 -1
- package/scripts/qa/validate-examples.sh +2 -1
- package/scripts/qa/wsl-contract.sh +2 -1
- package/scripts/secrets/age-init.sh +2 -1
- package/scripts/secrets/create-secrets-file.sh +2 -1
- package/scripts/secrets/encrypt-ssh-key.sh +2 -1
- package/scripts/security/backup.sh +2 -1
- package/scripts/security/check-disclosure-key-expiry.sh +2 -1
- package/scripts/security/dns-doh.sh +2 -1
- package/scripts/security/encryption-check.sh +2 -1
- package/scripts/security/enforce-policies.sh +2 -1
- package/scripts/security/firewall.sh +2 -1
- package/scripts/security/lock-configs.sh +2 -1
- package/scripts/security/lock-screen.sh +2 -1
- package/scripts/security/manage-secrets.sh +2 -1
- package/scripts/security/ssh-cert.sh +2 -1
- package/scripts/security/telemetry-kill.sh +2 -1
- package/scripts/security/usb-safety.sh +2 -1
- package/scripts/theme/apply-gnome-theme.sh +2 -1
- package/scripts/theme/extract-heic-frames.sh +2 -1
- package/scripts/theme/extract-theme.py +2 -1
- package/scripts/theme/install-boot-logo.sh +2 -1
- package/scripts/theme/install-catppuccin-themes.sh +2 -1
- package/scripts/theme/install-cursors.sh +2 -1
- package/scripts/theme/install-file-icons.sh +2 -1
- package/scripts/theme/install-grub-theme.sh +2 -1
- package/scripts/theme/install-lock-icon.sh +2 -1
- package/scripts/theme/merge-wallpaper.sh +2 -1
- package/scripts/theme/rebuild-themes.sh +2 -1
- package/scripts/theme/switch.sh +2 -1
- package/scripts/theme/wallpaper-rotate.sh +2 -1
- package/scripts/theme/wallpaper-sync.sh +5 -4
- package/scripts/tools/cmatrix.sh +2 -1
- package/scripts/tools/detect-collisions.py +2 -1
- package/scripts/tools/emoji-picker.sh +2 -1
- package/scripts/tools/figlet-banner.sh +2 -1
- package/scripts/tools/log-rotate.sh +2 -1
- package/scripts/tools/lolcat-wrap.sh +2 -1
- package/scripts/tools/pipes.sh +2 -1
- package/scripts/tuning/linux.sh +2 -1
- package/scripts/tuning/macos.sh +2 -1
- package/scripts/uninstall.sh +2 -1
- package/scripts/version-sync.sh +2 -1
|
@@ -1,18 +1,21 @@
|
|
|
1
1
|
#!/usr/bin/env bash
|
|
2
|
-
#
|
|
2
|
+
# SPDX-License-Identifier: MIT
|
|
3
|
+
# Copyright (c) 2015-2026 Sebastien Rousseau
|
|
3
4
|
## Dotfiles AI Commands.
|
|
4
5
|
##
|
|
5
6
|
## Provides AI CLI status, setup, RAG query, and bridge commands.
|
|
6
7
|
## Wraps AI CLI tools with contextual patterns and system metadata.
|
|
7
|
-
## Usage: dot ai [delegate|cost|status]|ai-setup|ai-query|cl|copilot|
|
|
8
|
+
## Usage: dot ai [delegate|cost|dashboard|proxy|local|status]|ai-setup|ai-query|cl|copilot|agy|kiro|sgpt|ollama|opencode|aider|autohand|vibe|qwen|zai
|
|
8
9
|
|
|
9
10
|
set -euo pipefail
|
|
10
11
|
|
|
11
12
|
SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
|
|
12
13
|
# shellcheck source=../../../lib/dot/utils.sh
|
|
13
14
|
source "$SCRIPT_DIR/../../../lib/dot/utils.sh"
|
|
15
|
+
# shellcheck source=../../../lib/dot/ai-commands.sh
|
|
16
|
+
source "$SCRIPT_DIR/../../../lib/dot/ai-commands.sh"
|
|
14
17
|
|
|
15
|
-
dot_ui_command_banner "AI and Agents" "${1:-}"
|
|
18
|
+
[[ -n "${DOT_AI_RAW:-}" ]] || dot_ui_command_banner "AI and Agents" "${1:-}" # raw mode: no banner
|
|
16
19
|
|
|
17
20
|
PATTERN_DIR="${XDG_CONFIG_HOME:-$HOME/.config}/ai/patterns"
|
|
18
21
|
AI_CACHE_DIR="${XDG_CACHE_HOME:-$HOME/.cache}/dotfiles/ai"
|
|
@@ -28,9 +31,14 @@ if [[ ! -d "$PATTERN_DIR" ]]; then
|
|
|
28
31
|
fi
|
|
29
32
|
|
|
30
33
|
_show_ai_bridge_usage() {
|
|
31
|
-
echo "Usage: dot
|
|
34
|
+
echo "Usage: dot ai \"<prompt>\" # one-shot on Claude"
|
|
35
|
+
echo " dot ai <tool> \"<prompt>\" # one-shot on a tool"
|
|
36
|
+
echo " dot ai <tool> --style <name> \"<prompt>\""
|
|
37
|
+
echo " dot ai chat [tool] # interactive session"
|
|
32
38
|
echo ""
|
|
33
|
-
echo "
|
|
39
|
+
echo "Tools: cl codex copilot goose crush amp cursor-agent grok agy kiro sgpt ollama opencode aider autohand vibe qwen zai"
|
|
40
|
+
echo ""
|
|
41
|
+
echo "Available styles:"
|
|
34
42
|
# shellcheck disable=SC2012
|
|
35
43
|
ls -1 "$PATTERN_DIR" 2>/dev/null | sed 's/\.md$//' | sed 's/^/ - /' || echo " (none)"
|
|
36
44
|
}
|
|
@@ -84,10 +92,12 @@ _ai_refresh_status_cache() {
|
|
|
84
92
|
i=$((i + 1))
|
|
85
93
|
done
|
|
86
94
|
# Probe is non-interactive: </dev/null is a clean EOF for tools that
|
|
87
|
-
# prompt for an API key on first run; `timeout
|
|
95
|
+
# prompt for an API key on first run; `timeout 8` caps the wait.
|
|
96
|
+
# Node-based tools (codex, copilot, opencode) need 5-8s on cold start;
|
|
97
|
+
# 3s caused false "not installed" results in the status cache.
|
|
88
98
|
# shellcheck disable=SC2016
|
|
89
99
|
local _TO=""
|
|
90
|
-
command -v timeout >/dev/null 2>&1 && _TO="timeout
|
|
100
|
+
command -v timeout >/dev/null 2>&1 && _TO="timeout 8 "
|
|
91
101
|
local probe_script='
|
|
92
102
|
payload="$1"; out_dir="$2"; to="$3"
|
|
93
103
|
i="${payload%%|*}"; entry="${payload#*|}"
|
|
@@ -141,46 +151,31 @@ _ai_status_field() {
|
|
|
141
151
|
awk -F'\t' -v b="$1" -v f="$2" '$1==b{print $f;exit}' "$AI_STATUS_CACHE_FILE" 2>/dev/null
|
|
142
152
|
}
|
|
143
153
|
|
|
144
|
-
# binary -> mise package
|
|
145
|
-
_ai_mise_pkg() {
|
|
146
|
-
case "$1" in
|
|
147
|
-
claude) echo "npm:@anthropic-ai/claude-code" ;;
|
|
148
|
-
codex) echo "npm:@openai/codex" ;;
|
|
149
|
-
copilot) echo "npm:@github/copilot" ;;
|
|
150
|
-
goose) echo "pipx:goose-ai" ;;
|
|
151
|
-
aider) echo "pipx:aider-chat" ;;
|
|
152
|
-
opencode) echo "npm:opencode-ai" ;;
|
|
153
|
-
sgpt) echo "pipx:shell-gpt" ;;
|
|
154
|
-
gemini) echo "npm:@google/gemini-cli" ;;
|
|
155
|
-
ollama) echo "aqua:ollama/ollama" ;;
|
|
156
|
-
kiro-cli) echo "kiro-cli" ;;
|
|
157
|
-
autohand) echo "npm:autohand-cli" ;;
|
|
158
|
-
vibe) echo "pipx:mistral-vibe" ;;
|
|
159
|
-
qwen) echo "npm:@qwen-code/qwen-code" ;;
|
|
160
|
-
zai) echo "npm:@guizmo-ai/zai-cli" ;;
|
|
161
|
-
*) echo "" ;;
|
|
162
|
-
esac
|
|
163
|
-
}
|
|
154
|
+
# _ai_mise_pkg (binary -> mise package map) is defined in lib/dot/ai-install.sh.
|
|
164
155
|
|
|
165
156
|
cmd_ai_status() {
|
|
166
157
|
ui_header "AI CLI Status"
|
|
167
158
|
|
|
168
159
|
# category|role|name|binary|description
|
|
169
160
|
local -a ai_clis=(
|
|
170
|
-
"Agents (autonomous)|agent|Claude Code|claude|Anthropic
|
|
171
|
-
"Agents (autonomous)|agent|Codex CLI|codex|OpenAI
|
|
172
|
-
"Agents (autonomous)|agent|Copilot CLI|copilot|GitHub Copilot
|
|
173
|
-
"Agents (autonomous)|agent|Goose|goose|Block's coding agent"
|
|
174
|
-
"
|
|
175
|
-
"
|
|
176
|
-
"
|
|
177
|
-
"
|
|
178
|
-
"Coding (interactive)|coding|
|
|
179
|
-
"Coding (interactive)|coding|
|
|
180
|
-
"
|
|
181
|
-
"
|
|
182
|
-
"
|
|
183
|
-
"
|
|
161
|
+
"Agents (autonomous)|agent|Claude Code|claude|Anthropic's flagship agentic coder"
|
|
162
|
+
"Agents (autonomous)|agent|Codex CLI|codex|OpenAI's autonomous coding agent"
|
|
163
|
+
"Agents (autonomous)|agent|Copilot CLI|copilot|GitHub Copilot in the terminal"
|
|
164
|
+
"Agents (autonomous)|agent|Goose|goose|Block's open-source coding agent"
|
|
165
|
+
"Agents (autonomous)|agent|Crush|crush|Charm's glamorous TUI coding agent"
|
|
166
|
+
"Agents (autonomous)|agent|Amp|amp|Sourcegraph's agentic coder"
|
|
167
|
+
"Agents (autonomous)|agent|Cursor CLI|cursor-agent|Cursor's terminal agent"
|
|
168
|
+
"Agents (autonomous)|agent|Grok Build|grok|xAI's terminal coding agent"
|
|
169
|
+
"Coding (interactive)|coding|Aider|aider|Git-aware AI pair programmer"
|
|
170
|
+
"Coding (interactive)|coding|OpenCode|opencode|Open-source terminal coding agent"
|
|
171
|
+
"Coding (interactive)|coding|Autohand Code|autohand|Autonomous multi-file coding agent"
|
|
172
|
+
"Coding (interactive)|coding|Mistral Vibe|vibe|Mistral's coding agent"
|
|
173
|
+
"Coding (interactive)|coding|Qwen Code|qwen|Alibaba Qwen coding assistant"
|
|
174
|
+
"Coding (interactive)|coding|ZAI|zai|Zhipu GLM coding agent"
|
|
175
|
+
"General (prompt-based)|general|Shell-GPT|sgpt|ChatGPT for the shell"
|
|
176
|
+
"General (prompt-based)|general|Antigravity CLI|agy|Google's Antigravity agent"
|
|
177
|
+
"Runtime (local)|local|Ollama|ollama|Run local & cloud open models"
|
|
178
|
+
"Cloud (platform)|cloud|Kiro CLI|kiro-cli|AWS's agentic dev assistant"
|
|
184
179
|
)
|
|
185
180
|
|
|
186
181
|
if ! _ai_cache_fresh "$AI_STATUS_CACHE_FILE"; then
|
|
@@ -254,6 +249,33 @@ cmd_ai_status() {
|
|
|
254
249
|
echo ""
|
|
255
250
|
for entry in "${_ai_to_install[@]}"; do
|
|
256
251
|
IFS='|' read -r name bin <<<"$entry"
|
|
252
|
+
# Tools without a mise package use their vendor's native installer.
|
|
253
|
+
case "$bin" in
|
|
254
|
+
claude)
|
|
255
|
+
install_claude_native "$name"
|
|
256
|
+
continue
|
|
257
|
+
;;
|
|
258
|
+
goose)
|
|
259
|
+
install_goose_native "$name"
|
|
260
|
+
continue
|
|
261
|
+
;;
|
|
262
|
+
agy)
|
|
263
|
+
install_agy_native "$name"
|
|
264
|
+
continue
|
|
265
|
+
;;
|
|
266
|
+
amp)
|
|
267
|
+
install_amp_native "$name"
|
|
268
|
+
continue
|
|
269
|
+
;;
|
|
270
|
+
cursor-agent)
|
|
271
|
+
install_cursor_native "$name"
|
|
272
|
+
continue
|
|
273
|
+
;;
|
|
274
|
+
grok)
|
|
275
|
+
install_grok_native "$name"
|
|
276
|
+
continue
|
|
277
|
+
;;
|
|
278
|
+
esac
|
|
257
279
|
local pkg
|
|
258
280
|
pkg=$(_ai_mise_pkg "$bin")
|
|
259
281
|
if [[ -n "$pkg" ]]; then
|
|
@@ -306,100 +328,16 @@ cmd_ai_status() {
|
|
|
306
328
|
fi
|
|
307
329
|
}
|
|
308
330
|
|
|
309
|
-
cmd_ai_setup
|
|
310
|
-
run_script "scripts/ops/ai-setup.sh" "AI setup script" "$@"
|
|
311
|
-
}
|
|
312
|
-
|
|
313
|
-
cmd_ai_query() {
|
|
314
|
-
run_script "dot_local/bin/executable_dot-ai" "AI RAG script" "$@"
|
|
315
|
-
}
|
|
331
|
+
# cmd_ai_setup / cmd_ai_query / cmd_ai_install live in lib/dot/ai-commands.sh.
|
|
316
332
|
|
|
317
|
-
# Locate the vibe-delegate / delegate-report tools deployed by the
|
|
318
|
-
# /vibe Claude Code skill. Path stays in sync with
|
|
319
|
-
# defaults/dot_claude/skills/vibe/tools/.
|
|
320
|
-
_ai_delegate_tool() {
|
|
321
|
-
local tool="$1" # vibe-delegate | delegate-report
|
|
322
|
-
local path="${HOME}/.claude/skills/vibe/tools/${tool}"
|
|
323
|
-
if [[ ! -x "$path" ]]; then
|
|
324
|
-
# Errors to stderr so callers capturing stdout via $() get just the path.
|
|
325
|
-
ui_err "$tool" "not found at $path" >&2
|
|
326
|
-
ui_info "Hint" "Run 'chezmoi apply' to deploy the /vibe skill" >&2
|
|
327
|
-
return 1
|
|
328
|
-
fi
|
|
329
|
-
printf '%s\n' "$path"
|
|
330
|
-
}
|
|
331
|
-
|
|
332
|
-
cmd_ai_delegate() {
|
|
333
|
-
# Front-door to the same delegator the /vibe slash command uses.
|
|
334
|
-
# Usage: dot ai delegate "<prompt>" [max-turns] [agent] [timeout]
|
|
335
|
-
if [[ $# -lt 1 ]]; then
|
|
336
|
-
ui_err "Usage" "dot ai delegate \"<prompt>\" [max-turns] [agent] [timeout-secs]"
|
|
337
|
-
ui_info "Example" "dot ai delegate \"add a CHANGELOG entry for v0.2.504\""
|
|
338
|
-
return 1
|
|
339
|
-
fi
|
|
340
|
-
local prompt="$1"
|
|
341
|
-
shift
|
|
342
|
-
local max_turns="${1:-10}"
|
|
343
|
-
local agent="${2:-}"
|
|
344
|
-
local timeout="${3:-180}"
|
|
345
|
-
local tool
|
|
346
|
-
tool="$(_ai_delegate_tool vibe-delegate)" || return 1
|
|
347
|
-
if ! has_command vibe; then
|
|
348
|
-
ui_warn "vibe" "not installed"
|
|
349
|
-
ui_info "Install" "mise use -g pipx:mistral-vibe"
|
|
350
|
-
return 1
|
|
351
|
-
fi
|
|
352
|
-
"$tool" "$(pwd)" "$prompt" "$max_turns" "$agent" "$timeout"
|
|
353
|
-
}
|
|
354
|
-
|
|
355
|
-
cmd_ai_cost() {
|
|
356
|
-
# Unified AI spend report. Wraps delegate-report (vibe runs) and is
|
|
357
|
-
# the documented interface for users: path may move later.
|
|
358
|
-
local tool
|
|
359
|
-
tool="$(_ai_delegate_tool delegate-report)" || return 1
|
|
360
|
-
"$tool" "$@"
|
|
361
|
-
}
|
|
362
|
-
|
|
363
|
-
# Append a best-effort run entry to the unified AI log read by
|
|
364
|
-
# delegate-report. Token/cost fields are left blank when the provider
|
|
365
|
-
# CLI does not surface them — the report tolerates missing fields and
|
|
366
|
-
# groups by `model`. This gives users one place to see invocations
|
|
367
|
-
# across Claude, Gemini, Aider, Vibe, etc., not just Vibe.
|
|
368
333
|
_ai_log_run() {
|
|
369
334
|
local provider="$1" exit_code="$2" duration_secs="$3" prompt_words="$4"
|
|
370
|
-
local
|
|
371
|
-
mkdir -p "$(dirname "$log_file")"
|
|
372
|
-
local project ts
|
|
335
|
+
local project ts log_bin
|
|
373
336
|
project="$(basename "$PWD")"
|
|
374
337
|
ts="$(date -u +%Y-%m-%dT%H:%M:%SZ)"
|
|
375
|
-
|
|
376
|
-
|
|
377
|
-
|
|
378
|
-
import json, sys
|
|
379
|
-
log, provider, project, ec, dur, pw, ts = sys.argv[1:8]
|
|
380
|
-
entry = {
|
|
381
|
-
"ts": ts,
|
|
382
|
-
"delegate": provider,
|
|
383
|
-
"model": provider,
|
|
384
|
-
"project": project,
|
|
385
|
-
"exit_code": int(ec),
|
|
386
|
-
"duration_secs": float(dur),
|
|
387
|
-
"prompt_words": int(pw),
|
|
388
|
-
"tool_calls": 0,
|
|
389
|
-
"files_changed": 0,
|
|
390
|
-
"wrote_nothing": False,
|
|
391
|
-
"warn_count": 0,
|
|
392
|
-
"search_replace_fails": 0,
|
|
393
|
-
"syntax_errors": 0,
|
|
394
|
-
"tokens_in": 0,
|
|
395
|
-
"tokens_out": 0,
|
|
396
|
-
"tokens_total": 0,
|
|
397
|
-
"cost_usd": 0,
|
|
398
|
-
"cost_claude_eq": 0,
|
|
399
|
-
}
|
|
400
|
-
with open(log, "a") as fh:
|
|
401
|
-
fh.write(json.dumps(entry) + "\n")
|
|
402
|
-
PY
|
|
338
|
+
log_bin="${HOME}/.local/bin/dot-ai-log"
|
|
339
|
+
[[ -x "$log_bin" ]] || return 0
|
|
340
|
+
"$log_bin" "$provider" "$project" "$exit_code" "$duration_secs" "$prompt_words" "$ts" || true
|
|
403
341
|
}
|
|
404
342
|
|
|
405
343
|
run_ai_with_context() {
|
|
@@ -414,7 +352,7 @@ run_ai_with_context() {
|
|
|
414
352
|
_show_ai_bridge_usage
|
|
415
353
|
exit 0
|
|
416
354
|
;;
|
|
417
|
-
--pattern | -p)
|
|
355
|
+
--style | --pattern | -p)
|
|
418
356
|
pattern_name="$2"
|
|
419
357
|
shift 2
|
|
420
358
|
;;
|
|
@@ -441,19 +379,26 @@ run_ai_with_context() {
|
|
|
441
379
|
fi
|
|
442
380
|
fi
|
|
443
381
|
|
|
444
|
-
#
|
|
445
|
-
|
|
446
|
-
|
|
382
|
+
# Build the prompt. Raw mode (DOT_AI_RAW) skips the system-metadata banner
|
|
383
|
+
# so callers like the cockpit get clean, streamable output.
|
|
384
|
+
local full_prompt
|
|
385
|
+
if [[ -n "${DOT_AI_RAW:-}" ]]; then
|
|
386
|
+
full_prompt="${system_context:+${system_context}
|
|
387
|
+
|
|
388
|
+
}${prompt}"
|
|
389
|
+
else
|
|
390
|
+
local metadata
|
|
391
|
+
metadata="## System Metadata
|
|
447
392
|
- OS: $(uname -s) $(uname -r)
|
|
448
393
|
- Arch: $(uname -m)
|
|
449
394
|
- Date: $(date -u)"
|
|
450
|
-
|
|
451
|
-
local full_prompt="${system_context}
|
|
395
|
+
full_prompt="${system_context}
|
|
452
396
|
|
|
453
397
|
${metadata}
|
|
454
398
|
|
|
455
399
|
## User Request
|
|
456
400
|
${prompt}"
|
|
401
|
+
fi
|
|
457
402
|
|
|
458
403
|
# Resolve the binary name for the tool
|
|
459
404
|
local tool_bin="$tool"
|
|
@@ -487,13 +432,31 @@ ${prompt}"
|
|
|
487
432
|
ui_err "$tool" "not installed — install with: mise use -g $mise_pkg@latest"
|
|
488
433
|
exit 1
|
|
489
434
|
fi
|
|
435
|
+
elif [[ "$tool_bin" == "agy" ]]; then
|
|
436
|
+
ui_warn "$tool" "not installed"
|
|
437
|
+
ui_info "Install" "curl -fsSL -o /tmp/agy-install.sh https://antigravity.google/cli/install.sh && bash /tmp/agy-install.sh"
|
|
438
|
+
exit 1
|
|
490
439
|
else
|
|
491
440
|
ui_err "$tool" "not installed and mise not available"
|
|
492
441
|
exit 1
|
|
493
442
|
fi
|
|
494
443
|
fi
|
|
495
444
|
|
|
496
|
-
ui_info "Executing $tool with pattern: ${pattern_name:-none}"
|
|
445
|
+
[[ -n "${DOT_AI_RAW:-}" ]] || ui_info "Executing $tool with pattern: ${pattern_name:-none}"
|
|
446
|
+
|
|
447
|
+
# Route non-Claude tools through the local gateway when one is running.
|
|
448
|
+
# The primary Claude ALWAYS uses its native session — never route it,
|
|
449
|
+
# and never set ANTHROPIC_API_KEY where Claude Code can see it (that
|
|
450
|
+
# disables claude.ai connectors). Routing is scoped to this run's
|
|
451
|
+
# subprocess; the interactive shell is never touched.
|
|
452
|
+
case "$tool" in
|
|
453
|
+
cl | claude) : ;;
|
|
454
|
+
*)
|
|
455
|
+
local _ai_local_env="${XDG_CONFIG_HOME:-$HOME/.config}/dotfiles/ai-local.env"
|
|
456
|
+
# shellcheck disable=SC1090
|
|
457
|
+
[[ -r "$_ai_local_env" ]] && source "$_ai_local_env"
|
|
458
|
+
;;
|
|
459
|
+
esac
|
|
497
460
|
|
|
498
461
|
# Wrap the provider invocation so we can log it to the unified AI run
|
|
499
462
|
# log. Each entry feeds `dot ai cost` so users see spend across every
|
|
@@ -503,92 +466,104 @@ ${prompt}"
|
|
|
503
466
|
_ai_start_ts=$(date +%s)
|
|
504
467
|
_ai_prompt_words=$(printf '%s' "$prompt" | wc -w | tr -d ' ')
|
|
505
468
|
_ai_exit=0
|
|
506
|
-
|
|
507
|
-
cl | claude)
|
|
508
|
-
printf "%s" "$full_prompt" | claude || _ai_exit=$?
|
|
509
|
-
;;
|
|
510
|
-
codex)
|
|
511
|
-
printf "%s" "$full_prompt" | codex || _ai_exit=$?
|
|
512
|
-
;;
|
|
513
|
-
copilot)
|
|
514
|
-
copilot -sp "$full_prompt" || _ai_exit=$?
|
|
515
|
-
;;
|
|
516
|
-
gemini)
|
|
517
|
-
printf "%s" "$full_prompt" | gemini chat || _ai_exit=$?
|
|
518
|
-
;;
|
|
519
|
-
goose)
|
|
520
|
-
printf "%s" "$full_prompt" | goose session start || _ai_exit=$?
|
|
521
|
-
;;
|
|
522
|
-
kiro | kiro-cli)
|
|
523
|
-
printf "%s" "$full_prompt" | kiro-cli chat || _ai_exit=$?
|
|
524
|
-
;;
|
|
525
|
-
sgpt)
|
|
526
|
-
printf "%s" "$full_prompt" | sgpt --chat shell-gpt || _ai_exit=$?
|
|
527
|
-
;;
|
|
528
|
-
ollama)
|
|
529
|
-
printf "%s" "$full_prompt" | ollama run llama3.2 || _ai_exit=$?
|
|
530
|
-
;;
|
|
531
|
-
opencode)
|
|
532
|
-
printf "%s" "$full_prompt" | opencode query || _ai_exit=$?
|
|
533
|
-
;;
|
|
534
|
-
aider)
|
|
535
|
-
printf "%s" "$full_prompt" | aider --msg "-" || _ai_exit=$?
|
|
536
|
-
;;
|
|
537
|
-
autohand)
|
|
538
|
-
printf "%s" "$full_prompt" | autohand chat || _ai_exit=$?
|
|
539
|
-
;;
|
|
540
|
-
vibe)
|
|
541
|
-
printf "%s" "$full_prompt" | vibe chat || _ai_exit=$?
|
|
542
|
-
;;
|
|
543
|
-
qwen)
|
|
544
|
-
printf "%s" "$full_prompt" | qwen chat || _ai_exit=$?
|
|
545
|
-
;;
|
|
546
|
-
zai)
|
|
547
|
-
printf "%s" "$full_prompt" | zai chat || _ai_exit=$?
|
|
548
|
-
;;
|
|
549
|
-
*)
|
|
550
|
-
ui_err "Unsupported tool" "$tool"
|
|
551
|
-
exit 1
|
|
552
|
-
;;
|
|
553
|
-
esac
|
|
469
|
+
_ai_invoke_provider "$tool" "$full_prompt" || _ai_exit=$?
|
|
554
470
|
_ai_end_ts=$(date +%s)
|
|
555
471
|
_ai_dur=$((_ai_end_ts - _ai_start_ts))
|
|
556
472
|
_ai_log_run "$tool_bin" "$_ai_exit" "$_ai_dur" "$_ai_prompt_words" 2>/dev/null || true
|
|
557
473
|
return "$_ai_exit"
|
|
558
474
|
}
|
|
559
475
|
|
|
560
|
-
# Dispatch
|
|
476
|
+
# Dispatch — flat, verb-first surface (see docs/AI.md).
|
|
561
477
|
case "${1:-}" in
|
|
562
478
|
ai)
|
|
563
479
|
shift
|
|
564
|
-
# Subcommands first: `dot ai delegate`, `dot ai cost`. Fall through
|
|
565
|
-
# to status if no subcommand or unknown one.
|
|
566
480
|
case "${1:-}" in
|
|
567
|
-
|
|
481
|
+
"")
|
|
482
|
+
# Bare `dot ai` → the Bubble Tea cockpit (or the launcher fallback).
|
|
483
|
+
_ai_cockpit cmd_ai_status
|
|
484
|
+
;;
|
|
485
|
+
chat)
|
|
568
486
|
shift
|
|
569
|
-
|
|
487
|
+
cmd_ai_chat "$@"
|
|
488
|
+
;;
|
|
489
|
+
tools)
|
|
490
|
+
shift
|
|
491
|
+
if [[ "${1:-}" == install ]]; then
|
|
492
|
+
shift
|
|
493
|
+
cmd_ai_install "$@"
|
|
494
|
+
else
|
|
495
|
+
cmd_ai_status "$@"
|
|
496
|
+
fi
|
|
497
|
+
;;
|
|
498
|
+
install)
|
|
499
|
+
shift
|
|
500
|
+
cmd_ai_install "$@"
|
|
501
|
+
;;
|
|
502
|
+
serve)
|
|
503
|
+
shift
|
|
504
|
+
_ai_serve "$@"
|
|
570
505
|
;;
|
|
571
506
|
cost)
|
|
572
507
|
shift
|
|
573
508
|
cmd_ai_cost "$@"
|
|
574
509
|
;;
|
|
575
|
-
|
|
510
|
+
login)
|
|
511
|
+
shift
|
|
512
|
+
cmd_ai_setup "$@"
|
|
513
|
+
;;
|
|
514
|
+
doctor)
|
|
515
|
+
shift
|
|
516
|
+
cmd_ai_doctor "$@"
|
|
517
|
+
;;
|
|
518
|
+
ask)
|
|
519
|
+
shift
|
|
520
|
+
cmd_ai_query "$@"
|
|
521
|
+
;;
|
|
522
|
+
run)
|
|
523
|
+
shift
|
|
524
|
+
_ai_oneshot "$@"
|
|
525
|
+
;;
|
|
526
|
+
delegate)
|
|
527
|
+
shift
|
|
528
|
+
cmd_ai_delegate "$@"
|
|
529
|
+
;;
|
|
530
|
+
# Deprecated verbs — still work, with a one-line hint to the new name.
|
|
531
|
+
status)
|
|
532
|
+
_ai_deprecated "dot ai tools"
|
|
576
533
|
cmd_ai_status "$@"
|
|
577
534
|
;;
|
|
535
|
+
dashboard | dash)
|
|
536
|
+
_ai_deprecated "dot ai (cockpit)"
|
|
537
|
+
_ai_cockpit cmd_ai_status
|
|
538
|
+
;;
|
|
539
|
+
proxy)
|
|
540
|
+
shift
|
|
541
|
+
_ai_deprecated "dot ai serve"
|
|
542
|
+
has_command dot-ai-proxy && exec dot-ai-proxy "$@" || exit 1
|
|
543
|
+
;;
|
|
544
|
+
local)
|
|
545
|
+
_ai_deprecated "dot ai serve"
|
|
546
|
+
has_command dot-ai-proxy && exec dot-ai-proxy "$@" || exit 1
|
|
547
|
+
;;
|
|
578
548
|
*)
|
|
579
|
-
|
|
549
|
+
# Bare prompt (`dot ai "fix this"`) or `dot ai <tool> "…"` → one-shot.
|
|
550
|
+
_ai_oneshot "$@"
|
|
580
551
|
;;
|
|
581
552
|
esac
|
|
582
553
|
;;
|
|
554
|
+
# Deprecated top-level forms — kept for muscle memory.
|
|
583
555
|
ai-setup)
|
|
556
|
+
_ai_deprecated "dot ai login"
|
|
584
557
|
shift
|
|
585
558
|
cmd_ai_setup "$@"
|
|
586
559
|
;;
|
|
587
560
|
ai-query)
|
|
561
|
+
_ai_deprecated "dot ai ask"
|
|
588
562
|
shift
|
|
589
563
|
cmd_ai_query "$@"
|
|
590
564
|
;;
|
|
591
|
-
cl | claude | codex | copilot |
|
|
565
|
+
cl | claude | codex | copilot | goose | crush | amp | cursor-agent | grok | agy | kiro | sgpt | ollama | opencode | aider | autohand | vibe | qwen | zai)
|
|
566
|
+
_ai_deprecated "dot ai $1"
|
|
592
567
|
tool="$1"
|
|
593
568
|
shift
|
|
594
569
|
run_ai_with_context "$tool" "$@"
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
#!/usr/bin/env bash
|
|
2
|
-
#
|
|
2
|
+
# SPDX-License-Identifier: MIT
|
|
3
|
+
# Copyright (c) 2015-2026 Sebastien Rousseau
|
|
3
4
|
# Dotfiles CLI - Aliases Commands (extracted from tools.sh)
|
|
4
5
|
# aliases list|search|why|stats|cheatsheet|tiers, alias-check
|
|
5
6
|
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
#!/usr/bin/env bash
|
|
2
|
-
#
|
|
2
|
+
# SPDX-License-Identifier: MIT
|
|
3
|
+
# Copyright (c) 2015-2026 Sebastien Rousseau
|
|
3
4
|
## Dotfiles Core Commands — Core chezmoi operations for the dot CLI.
|
|
4
5
|
##
|
|
5
6
|
## Provides apply, sync, update, add, diff, status, remove, cd, and edit
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
#!/usr/bin/env bash
|
|
2
|
-
#
|
|
2
|
+
# SPDX-License-Identifier: MIT
|
|
3
|
+
# Copyright (c) 2015-2026 Sebastien Rousseau
|
|
3
4
|
# Dotfiles CLI - Diagnostics Commands
|
|
4
5
|
# doctor, heal, health, rollback, drift, history, benchmark, verify, perf,
|
|
5
6
|
# scorecard, conflicts, locks, snapshot, load-bench, chaos, bundle, attest
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
#!/usr/bin/env bash
|
|
2
|
-
#
|
|
2
|
+
# SPDX-License-Identifier: MIT
|
|
3
|
+
# Copyright (c) 2015-2026 Sebastien Rousseau
|
|
3
4
|
#
|
|
4
5
|
# `dot env emit` — render a portable workstation-environment
|
|
5
6
|
# manifest. The output is the canonical "what is installed on this
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
#!/usr/bin/env bash
|
|
2
|
-
#
|
|
2
|
+
# SPDX-License-Identifier: MIT
|
|
3
|
+
# Copyright (c) 2015-2026 Sebastien Rousseau
|
|
3
4
|
# dot restore - Restore dotfiles from backup or previous state
|
|
4
5
|
# Usage: dot restore [--list|-l|--latest|-L|<backup-id>]
|
|
5
6
|
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
#!/usr/bin/env bash
|
|
2
|
-
#
|
|
2
|
+
# SPDX-License-Identifier: MIT
|
|
3
|
+
# Copyright (c) 2015-2026 Sebastien Rousseau
|
|
3
4
|
# Dotfiles CLI - Security Commands
|
|
4
5
|
# backup, encrypt-check, firewall, telemetry, dns-doh, lock-screen, usb-safety
|
|
5
6
|
|