@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.
Files changed (139) hide show
  1. package/CHANGELOG.md +59 -0
  2. package/README.md +11 -11
  3. package/docs/AI.md +128 -58
  4. package/docs/COPYRIGHT +1 -1
  5. package/docs/STRUCTURE.md +1 -1
  6. package/docs/adr/ADR-012-ai-fleet-local-proxy.md +79 -0
  7. package/docs/adr/README.md +1 -0
  8. package/docs/index.md +2 -2
  9. package/docs/interop/A2A.md +2 -2
  10. package/docs/manual/00-introduction.md +1 -1
  11. package/docs/manual/01-concepts/02-trust-model.md +1 -1
  12. package/docs/manual/02-tutorials/01-first-install.md +1 -1
  13. package/docs/manual/03-reference/01-dot-cli.md +18 -3
  14. package/docs/manual/command-index.md +2 -2
  15. package/docs/operations/RELEASE_PIPELINE.md +3 -3
  16. package/docs/operations/TRUSTED_AGENT_WORKSTATION.md +6 -6
  17. package/docs/reference/TOOLS.md +1 -1
  18. package/docs/reference/UTILS.md +16 -12
  19. package/docs/security/AUTOMATION_SECRETS.md +1 -1
  20. package/docs/security/MCP_POLICY.md +4 -4
  21. package/docs/security/SECURITY_CHECKLIST.md +1 -1
  22. package/docs/security/SOUP_REGISTER.md +4 -4
  23. package/install.sh +7 -6
  24. package/package.json +1 -1
  25. package/scripts/ci/check-copyright-headers.sh +2 -1
  26. package/scripts/ci/check-shell-preamble.sh +2 -1
  27. package/scripts/ci/guard-gitleaks-checkout.sh +2 -1
  28. package/scripts/demo/record.sh +2 -1
  29. package/scripts/diagnostics/a2a-conformance.sh +2 -1
  30. package/scripts/diagnostics/alias-governance.sh +2 -1
  31. package/scripts/diagnostics/aliases-cheatsheet.sh +2 -1
  32. package/scripts/diagnostics/aliases-manifest.sh +2 -1
  33. package/scripts/diagnostics/benchmark.sh +2 -1
  34. package/scripts/diagnostics/conflicts.sh +2 -1
  35. package/scripts/diagnostics/doctor-unified.sh +2 -1
  36. package/scripts/diagnostics/doctor.sh +4 -3
  37. package/scripts/diagnostics/drift-dashboard.sh +2 -1
  38. package/scripts/diagnostics/health.sh +2 -1
  39. package/scripts/diagnostics/history-analysis.sh +2 -1
  40. package/scripts/diagnostics/mcp-doctor.sh +2 -1
  41. package/scripts/diagnostics/perf.sh +2 -1
  42. package/scripts/diagnostics/scorecard.sh +2 -1
  43. package/scripts/diagnostics/secret-governance.sh +2 -1
  44. package/scripts/diagnostics/security-score.sh +2 -1
  45. package/scripts/diagnostics/smoke-test.sh +2 -1
  46. package/scripts/diagnostics/snapshot.sh +2 -1
  47. package/scripts/diagnostics/verify.sh +2 -1
  48. package/scripts/diagnostics/verify_state.sh +2 -1
  49. package/scripts/diagnostics/version-locks.sh +2 -1
  50. package/scripts/diagnostics/workstation-attestation.sh +2 -1
  51. package/scripts/dot/commands/agent.sh +2 -1
  52. package/scripts/dot/commands/agents.sh +7 -6
  53. package/scripts/dot/commands/ai.sh +168 -193
  54. package/scripts/dot/commands/aliases.sh +2 -1
  55. package/scripts/dot/commands/appearance.sh +2 -1
  56. package/scripts/dot/commands/core.sh +2 -1
  57. package/scripts/dot/commands/diagnostics.sh +2 -1
  58. package/scripts/dot/commands/env-emit.sh +2 -1
  59. package/scripts/dot/commands/fleet.sh +2 -1
  60. package/scripts/dot/commands/init.sh +2 -1
  61. package/scripts/dot/commands/lint.sh +2 -1
  62. package/scripts/dot/commands/manual.sh +2 -1
  63. package/scripts/dot/commands/meta.sh +2 -1
  64. package/scripts/dot/commands/patterns.sh +2 -1
  65. package/scripts/dot/commands/registry.sh +2 -1
  66. package/scripts/dot/commands/restore.sh +2 -1
  67. package/scripts/dot/commands/secrets.sh +2 -1
  68. package/scripts/dot/commands/security.sh +2 -1
  69. package/scripts/dot/commands/tools.sh +2 -1
  70. package/scripts/fonts/install-nerd-fonts.sh +2 -1
  71. package/scripts/fonts/patch-fonts.sh +2 -1
  72. package/scripts/git-hooks/install.sh +2 -1
  73. package/scripts/git-hooks/pre-commit-audit.sh +3 -2
  74. package/scripts/lib/secrets_provider.sh +2 -1
  75. package/scripts/ops/ai-setup.sh +25 -16
  76. package/scripts/ops/bundle.sh +2 -1
  77. package/scripts/ops/chaos.sh +2 -1
  78. package/scripts/ops/chezmoi-apply.sh +22 -4
  79. package/scripts/ops/chezmoi-diff.sh +2 -1
  80. package/scripts/ops/chezmoi-remove.sh +2 -1
  81. package/scripts/ops/chezmoi-update.sh +2 -1
  82. package/scripts/ops/heal-chezmoi.sh +2 -1
  83. package/scripts/ops/heal-system.sh +2 -1
  84. package/scripts/ops/heal-tools.sh +2 -1
  85. package/scripts/ops/heal.sh +2 -1
  86. package/scripts/ops/post-apply-repair.sh +2 -1
  87. package/scripts/ops/prewarm.sh +2 -1
  88. package/scripts/ops/release.sh +2 -1
  89. package/scripts/ops/rollback.sh +3 -2
  90. package/scripts/ops/setup.sh +2 -1
  91. package/scripts/ops/teleport.sh +2 -1
  92. package/scripts/qa/check-version-consistency.sh +2 -1
  93. package/scripts/qa/coverage-baseline.sh +2 -1
  94. package/scripts/qa/docs-coverage.sh +3 -2
  95. package/scripts/qa/reliability-audit.sh +2 -1
  96. package/scripts/qa/scorecard-snapshot.sh +2 -1
  97. package/scripts/qa/traceability-coverage.sh +2 -1
  98. package/scripts/qa/validate-examples.sh +2 -1
  99. package/scripts/qa/wsl-contract.sh +2 -1
  100. package/scripts/secrets/age-init.sh +2 -1
  101. package/scripts/secrets/create-secrets-file.sh +2 -1
  102. package/scripts/secrets/encrypt-ssh-key.sh +2 -1
  103. package/scripts/security/backup.sh +2 -1
  104. package/scripts/security/check-disclosure-key-expiry.sh +2 -1
  105. package/scripts/security/dns-doh.sh +2 -1
  106. package/scripts/security/encryption-check.sh +2 -1
  107. package/scripts/security/enforce-policies.sh +2 -1
  108. package/scripts/security/firewall.sh +2 -1
  109. package/scripts/security/lock-configs.sh +2 -1
  110. package/scripts/security/lock-screen.sh +2 -1
  111. package/scripts/security/manage-secrets.sh +2 -1
  112. package/scripts/security/ssh-cert.sh +2 -1
  113. package/scripts/security/telemetry-kill.sh +2 -1
  114. package/scripts/security/usb-safety.sh +2 -1
  115. package/scripts/theme/apply-gnome-theme.sh +2 -1
  116. package/scripts/theme/extract-heic-frames.sh +2 -1
  117. package/scripts/theme/extract-theme.py +2 -1
  118. package/scripts/theme/install-boot-logo.sh +2 -1
  119. package/scripts/theme/install-catppuccin-themes.sh +2 -1
  120. package/scripts/theme/install-cursors.sh +2 -1
  121. package/scripts/theme/install-file-icons.sh +2 -1
  122. package/scripts/theme/install-grub-theme.sh +2 -1
  123. package/scripts/theme/install-lock-icon.sh +2 -1
  124. package/scripts/theme/merge-wallpaper.sh +2 -1
  125. package/scripts/theme/rebuild-themes.sh +2 -1
  126. package/scripts/theme/switch.sh +2 -1
  127. package/scripts/theme/wallpaper-rotate.sh +2 -1
  128. package/scripts/theme/wallpaper-sync.sh +5 -4
  129. package/scripts/tools/cmatrix.sh +2 -1
  130. package/scripts/tools/detect-collisions.py +2 -1
  131. package/scripts/tools/emoji-picker.sh +2 -1
  132. package/scripts/tools/figlet-banner.sh +2 -1
  133. package/scripts/tools/log-rotate.sh +2 -1
  134. package/scripts/tools/lolcat-wrap.sh +2 -1
  135. package/scripts/tools/pipes.sh +2 -1
  136. package/scripts/tuning/linux.sh +2 -1
  137. package/scripts/tuning/macos.sh +2 -1
  138. package/scripts/uninstall.sh +2 -1
  139. package/scripts/version-sync.sh +2 -1
@@ -1,18 +1,21 @@
1
1
  #!/usr/bin/env bash
2
- # Copyright (c) 2015-2026 Dotfiles. All rights reserved.
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|gemini|kiro|sgpt|ollama|opencode|aider|autohand|vibe|qwen|zai
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 cl|codex|copilot|gemini|goose|kiro|autohand|vibe|qwen|zai --pattern [name] \"prompt\""
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 "Available Patterns:"
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 3` caps the wait.
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 3 "
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 mapping
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 CLI agent"
171
- "Agents (autonomous)|agent|Codex CLI|codex|OpenAI Codex agent"
172
- "Agents (autonomous)|agent|Copilot CLI|copilot|GitHub Copilot CLI"
173
- "Agents (autonomous)|agent|Goose|goose|Block's coding agent"
174
- "Coding (interactive)|coding|Aider|aider|AI pair programmer"
175
- "Coding (interactive)|coding|OpenCode|opencode|Terminal coding assistant"
176
- "Coding (interactive)|coding|Autohand Code|autohand|Autohand coding agent"
177
- "Coding (interactive)|coding|Mistral Vibe|vibe|Mistral AI coding agent"
178
- "Coding (interactive)|coding|Qwen Code|qwen|Qwen AI coding assistant"
179
- "Coding (interactive)|coding|ZAI|zai|Zhipu AI coding agent"
180
- "General (prompt-based)|general|Shell-GPT|sgpt|ChatGPT terminal interface"
181
- "General (prompt-based)|general|Gemini CLI|gemini|Google AI CLI"
182
- "Runtime (local)|local|Ollama|ollama|Local LLM runner"
183
- "Cloud (platform)|cloud|Kiro CLI|kiro-cli|AWS AI assistant"
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 log_file="${HOME}/.local/share/delegate-runs.jsonl"
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
- # python3 keeps the encoding boring; jq would also work but isn't
376
- # guaranteed present everywhere this script runs.
377
- python3 - "$log_file" "$provider" "$project" "$exit_code" "$duration_secs" "$prompt_words" "$ts" <<'PY'
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
- # Inject dynamic system metadata
445
- local metadata
446
- metadata="## System Metadata
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
- case "$tool" in
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
- delegate)
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
- cmd_ai_delegate "$@"
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
- "" | status)
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
- cmd_ai_status "$@"
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 | gemini | goose | kiro | sgpt | ollama | opencode | aider | autohand | vibe | qwen | zai)
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
- # Copyright (c) 2015-2026 Dotfiles. All rights reserved.
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
- # Copyright (c) 2015-2026 Dotfiles. All rights reserved.
2
+ # SPDX-License-Identifier: MIT
3
+ # Copyright (c) 2015-2026 Sebastien Rousseau
3
4
  # Dotfiles CLI - Appearance Commands
4
5
  # theme, wallpaper, fonts, tune
5
6
 
@@ -1,5 +1,6 @@
1
1
  #!/usr/bin/env bash
2
- # Copyright (c) 2015-2026 Dotfiles. All rights reserved.
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
- # Copyright (c) 2015-2026 Dotfiles. All rights reserved.
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
- # Copyright (c) 2015-2026 Dotfiles. All rights reserved.
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
- # Copyright (c) 2015-2026 Dotfiles. All rights reserved.
2
+ # SPDX-License-Identifier: MIT
3
+ # Copyright (c) 2015-2026 Sebastien Rousseau
3
4
  # Dotfiles CLI - Fleet Commands
4
5
  # fleet status|nodes|drift|events|namespace
5
6
 
@@ -1,5 +1,6 @@
1
1
  #!/usr/bin/env bash
2
- # Copyright (c) 2015-2026 Dotfiles. All rights reserved.
2
+ # SPDX-License-Identifier: MIT
3
+ # Copyright (c) 2015-2026 Sebastien Rousseau
3
4
  # shellcheck shell=bash
4
5
  #
5
6
  # scripts/dot/commands/init.sh
@@ -1,5 +1,6 @@
1
1
  #!/usr/bin/env bash
2
- # Copyright (c) 2015-2026 Dotfiles. All rights reserved.
2
+ # SPDX-License-Identifier: MIT
3
+ # Copyright (c) 2015-2026 Sebastien Rousseau
3
4
  # Dotfiles CLI - Lint Command
4
5
  # Wraps shellcheck and shfmt with project-specific flags
5
6
 
@@ -1,5 +1,6 @@
1
1
  #!/usr/bin/env bash
2
- # Copyright (c) 2015-2026 Dotfiles. All rights reserved.
2
+ # SPDX-License-Identifier: MIT
3
+ # Copyright (c) 2015-2026 Sebastien Rousseau
3
4
  # dot manual — open or download the dotfiles manual in multiple formats.
4
5
  #
5
6
  # Usage:
@@ -1,5 +1,6 @@
1
1
  #!/usr/bin/env bash
2
- # Copyright (c) 2015-2026 Dotfiles. All rights reserved.
2
+ # SPDX-License-Identifier: MIT
3
+ # Copyright (c) 2015-2026 Sebastien Rousseau
3
4
  # Dotfiles CLI - Meta Commands
4
5
  # upgrade, prewarm, docs, learn, keys, sandbox, mcp, mode, agent
5
6
 
@@ -1,5 +1,6 @@
1
1
  #!/usr/bin/env bash
2
- # Copyright (c) 2015-2026 Dotfiles. All rights reserved.
2
+ # SPDX-License-Identifier: MIT
3
+ # Copyright (c) 2015-2026 Sebastien Rousseau
3
4
  # AI Steering Patterns Management.
4
5
  # Usage: dot patterns [list|view|edit] [name]
5
6
 
@@ -1,5 +1,6 @@
1
1
  #!/usr/bin/env bash
2
- # Copyright (c) 2015-2026 Dotfiles. All rights reserved.
2
+ # SPDX-License-Identifier: MIT
3
+ # Copyright (c) 2015-2026 Sebastien Rousseau
3
4
  # shellcheck shell=bash
4
5
  #
5
6
  # scripts/dot/commands/registry.sh
@@ -1,5 +1,6 @@
1
1
  #!/usr/bin/env bash
2
- # Copyright (c) 2015-2026 Dotfiles. All rights reserved.
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
- # Copyright (c) 2015-2026 Dotfiles. All rights reserved.
2
+ # SPDX-License-Identifier: MIT
3
+ # Copyright (c) 2015-2026 Sebastien Rousseau
3
4
  # Dotfiles CLI - Secrets/Env Commands
4
5
  # secrets-init, secrets, secrets-create, ssh-key, env load
5
6
 
@@ -1,5 +1,6 @@
1
1
  #!/usr/bin/env bash
2
- # Copyright (c) 2015-2026 Dotfiles. All rights reserved.
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
 
@@ -1,5 +1,6 @@
1
1
  #!/usr/bin/env bash
2
- # Copyright (c) 2015-2026 Dotfiles. All rights reserved.
2
+ # SPDX-License-Identifier: MIT
3
+ # Copyright (c) 2015-2026 Sebastien Rousseau
3
4
  # Dotfiles CLI - Tools Commands
4
5
  # tools, new, packages, log-rotate, aliases, alias-check, env, profile
5
6
 
@@ -1,5 +1,6 @@
1
1
  #!/usr/bin/env bash
2
- # Copyright (c) 2015-2026 Dotfiles. All rights reserved.
2
+ # SPDX-License-Identifier: MIT
3
+ # Copyright (c) 2015-2026 Sebastien Rousseau
3
4
  set -euo pipefail
4
5
 
5
6
  SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
@@ -1,5 +1,6 @@
1
1
  #!/usr/bin/env bash
2
- # Copyright (c) 2015-2026 Dotfiles. All rights reserved.
2
+ # SPDX-License-Identifier: MIT
3
+ # Copyright (c) 2015-2026 Sebastien Rousseau
3
4
  set -euo pipefail
4
5
 
5
6
  if [[ $# -lt 1 ]]; then
@@ -1,5 +1,6 @@
1
1
  #!/usr/bin/env bash
2
- # Copyright (c) 2015-2026 Dotfiles. All rights reserved.
2
+ # SPDX-License-Identifier: MIT
3
+ # Copyright (c) 2015-2026 Sebastien Rousseau
3
4
  set -euo pipefail
4
5
 
5
6
  repo_root="$(cd "$(dirname "${BASH_SOURCE[0]}")/../.." && pwd)"