From 7e94d52e17f67ee21f6264154a524bc14b390755 Mon Sep 17 00:00:00 2001 From: joelazar Date: Sun, 14 Jun 2026 00:57:34 +0200 Subject: [PATCH] :sparkles: add RTK Pi extension for bash command optimization - Add `private_rtk.ts` extension that rewrites bash commands via `rtk rewrite` for token savings - Rename Claude settings files to `private_settings.json` and add RTK hook configuration - Update Zed settings formatting (add trailing commas for consistency) - Remove unused Brew formulae and casks; mark trusted taps explicitly - Remove deprecated fish plugins (fish-ssh-agent, replay.fish) --- Brewfile.work | 76 +---- dot_aerospace.toml | 4 +- dot_agents/dot_skill-lock.json | 8 +- .../{settings.json => private_settings.json} | 15 +- .../{settings.json => private_settings.json} | 16 +- dot_config/private_fish/fish_plugins | 2 - dot_config/zed/private_settings.json | 284 +++++++++--------- dot_pi/agent/AGENTS.md | 2 + dot_pi/agent/extensions/private_rtk.ts | 80 +++++ 9 files changed, 267 insertions(+), 220 deletions(-) rename dot_claude-work/{settings.json => private_settings.json} (93%) rename dot_claude/{settings.json => private_settings.json} (93%) create mode 100644 dot_pi/agent/extensions/private_rtk.ts diff --git a/Brewfile.work b/Brewfile.work index b4c70f30..1577cdbc 100644 --- a/Brewfile.work +++ b/Brewfile.work @@ -1,32 +1,26 @@ -tap "aws/tap" -tap "buo/cask-upgrade" -tap "darrylmorley/whatcable" +tap "aws/tap", trusted: true +tap "buo/cask-upgrade", trusted: true +tap "darrylmorley/whatcable", trusted: true tap "dlvhdr/formulae" -tap "grafana/grafana" -tap "hashicorp/tap" +tap "grafana/grafana", trusted: true +tap "hashicorp/tap", trusted: true tap "jakehilborn/jakehilborn" tap "ksdme/tap" -tap "macos-fuse-t/cask" -tap "mongodb/brew" -tap "nats-io/nats-tools" -tap "nikitabobko/tap" +tap "macos-fuse-t/cask", trusted: true +tap "mongodb/brew", trusted: true +tap "nats-io/nats-tools", trusted: true +tap "nikitabobko/tap", trusted: true tap "openai/tools" -tap "oven-sh/bun" -tap "protonpass/tap" +tap "oven-sh/bun", trusted: true +tap "protonpass/tap", trusted: true tap "schpet/tap" -tap "steipete/tap" -tap "tonisives/tap" tap "tw93/tap" -# Run your GitHub Actions locally -brew "act" # Easily download, build, install, upgrade, and uninstall Python packages brew "python-setuptools" # OpenType text shaping engine brew "harfbuzz" # Simple, modern, secure file encryption brew "age" -# Arduino command-line interface -brew "arduino-cli" # Record and share terminal sessions brew "asciinema" # Code searching, linting, rewriting @@ -127,30 +121,18 @@ brew "git-delta" brew "git-lfs" # Git extension to generate reports for standup meetings brew "git-standup" -# Turn any Git repository into a prompt-friendly text ingest for LLMs -brew "gitingest" # Interactive command-line tool for using emoji in commit messages brew "gitmoji" # Open source programming language to build simple/reliable/efficient software brew "go" -# Stricter gofmt -brew "gofumpt" -# Language server for `golangci-lint` -brew "golangci-lint-langserver" # CLI for Drive, Gmail, Calendar, Sheets, Docs, Chat, Admin, and more brew "googleworkspace-cli" -# Go Language's command-line interface for database migrations -brew "goose" -# Human friendly `go test` runner -brew "gotestsum" # Tool for glamorous shell scripts brew "gum" # Open-source video transcoder available for Linux, Mac, and Windows brew "handbrake" # Kubernetes package manager brew "helm" -# Language server for Helm -brew "helm-ls" # Improved top (interactive process viewer) brew "htop" # User-friendly cURL replacement (command-line HTTP client) @@ -193,8 +175,6 @@ brew "qemu" brew "lima-additional-guestagents" # CLI for SQLite Databases with auto-completion and syntax highlighting brew "litecli" -# LLM inference in C/C++ -brew "llama.cpp" # Next-gen compiler infrastructure brew "llvm" # Just-In-Time Compiler (JIT) for the Lua programming language @@ -207,8 +187,6 @@ brew "mas" brew "mermaid-cli" # Polyglot runtime manager (asdf rust clone) brew "mise" -# Tool for smooth Git handover in mob programming sessions -brew "mob" # MongoDB Shell to connect, configure, query, and work with your MongoDB database brew "mongosh" # NCurses Disk Usage @@ -259,18 +237,12 @@ brew "ripgrep-all" brew "rtk" # Powerful, clean, object-oriented scripting language brew "ruby" -# CLI search and replace | Space Age seD -brew "sad" -# Display and control your Android device -brew "scrcpy" # Intuitive find & replace CLI brew "sd" # 7-Zip is a file archiver with a high compression ratio brew "sevenzip" # CLI to update and use Solo 2 security keys brew "solo2-cli" -# Generate type safe Go from SQL -brew "sqlc" # Cross-shell prompt for astronauts brew "starship" # Very fast implementation of tldr in Rust @@ -324,15 +296,15 @@ brew "zoxide" # eks-node-viewer is a tool for visualizing dynamic node usage within an EKS cluster. brew "aws/tap/eks-node-viewer" # Git diff pager based on delta but with a file tree, à la GitHub -brew "dlvhdr/formulae/diffnav" +brew "dlvhdr/formulae/diffnav", trusted: true # Grafana Cloud CLI brew "grafana/grafana/gcx" # Terraform brew "hashicorp/tap/terraform" # macOS command line utility to configure multi-display resolutions and arrangements. Essentially XRandR for macOS. -brew "jakehilborn/jakehilborn/displayplacer" +brew "jakehilborn/jakehilborn/displayplacer", trusted: true # A utility toolkit of most commonly used tools by software developers and IT professionals -brew "ksdme/tap/ut" +brew "ksdme/tap/ut", trusted: true # This package contains standard utilities for interacting with MongoDB. brew "mongodb/brew/mongodb-database-tools" # NATS utility @@ -341,12 +313,8 @@ brew "nats-io/nats-tools/nats" brew "oven-sh/bun/bun" # Proton Pass CLI - Command-line interface for Proton Pass brew "protonpass/tap/pass-cli" -# CLI tool for linear.app that uses git branch names and directory names to open issues and team pages -brew "schpet/tap/linear" -# Command-line ElevenLabs TTS with mac-style flags -brew "steipete/tap/sag" # Comprehensive macOS cleanup and application uninstall tool -brew "tw93/tap/mole" +brew "tw93/tap/mole", trusted: true # Password manager that keeps all passwords secure behind one password cask "1password" # Command-line interface for 1Password @@ -355,8 +323,6 @@ cask "1password-cli" cask "nikitabobko/tap/aerospace" # Browse, search and analyse your past AI coding sessions cask "agentsview" -# Android SDK component -cask "android-platform-tools" # Compact TeX distribution as alternative to the full TeX Live / MacTeX cask "basictex" # Open source IDE for exploring and testing APIs @@ -373,14 +339,10 @@ cask "claude-code@latest" cask "cleanshot" # OpenAI's coding agent that runs in your terminal cask "codex" -# OpenAI's Codex desktop app for managing coding agents -cask "codex-app" # Voice and text chat software cask "discord" # Web browser cask "firefox" -cask "font-fira-code" -cask "font-fira-code-nerd-font" cask "font-maple-mono" cask "font-maple-mono-nf" # Kext-less implementation of FUSE @@ -393,8 +355,6 @@ cask "ghostty" cask "google-chrome" # Client for the Google Drive storage service cask "google-drive" -# Native desktop AI assistant from Google -cask "google-gemini" # Chromium-based web browser cask "helium-browser" # Free and open-source media player @@ -403,8 +363,6 @@ cask "iina" cask "inkscape" # Keyboard customiser cask "karabiner-elements" -# Voice-to-text transcription and paste tool -cask "kitlangton-hex" # Intercept, modify, replay, save HTTP/S traffic cask "mitmproxy" # Tool to control external monitor brightness & volume @@ -412,7 +370,7 @@ cask "monitorcontrol" # Knowledge base that works on top of a local folder of plain text Markdown files cask "obsidian" # The official CLI for the OpenAI API. -cask "openai/tools/openai" +cask "openai/tools/openai", trusted: true # Client program for the OpenVPN Access Server cask "openvpn-connect" # WebKit based web browser @@ -433,8 +391,6 @@ cask "sonos" cask "spotify" # Video game digital distribution service cask "steam" -# Native terminal coding agents command center -cask "supacode" # Native GUI tool for relational databases cask "tableplus" # Mesh VPN based on WireGuard diff --git a/dot_aerospace.toml b/dot_aerospace.toml index ec896faa..1e5cca1b 100644 --- a/dot_aerospace.toml +++ b/dot_aerospace.toml @@ -86,11 +86,11 @@ outer.right = 0 cmd-ctrl-alt-enter = 'exec-and-forget open /Applications/Ghostty.app' cmd-ctrl-alt-space = 'exec-and-forget open /Applications/Claude.app' +cmd-ctrl-alt-d = 'exec-and-forget open -a Discord' cmd-ctrl-alt-z = 'exec-and-forget open /Applications/Zed.app' cmd-ctrl-alt-b = 'exec-and-forget open -a Helium' cmd-ctrl-alt-o = 'exec-and-forget open -a Obsidian' -cmd-ctrl-alt-s = 'exec-and-forget open -a Slack' -cmd-ctrl-alt-d = 'exec-and-forget open -a Discord' +# cmd-ctrl-alt-s = 'exec-and-forget open -a Slack' cmd-ctrl-alt-m = 'exec-and-forget open -a Spotify' diff --git a/dot_agents/dot_skill-lock.json b/dot_agents/dot_skill-lock.json index 22e58544..3e21c607 100644 --- a/dot_agents/dot_skill-lock.json +++ b/dot_agents/dot_skill-lock.json @@ -24,9 +24,9 @@ "sourceType": "github", "sourceUrl": "https://github.com/anthropics/skills.git", "skillPath": "skills/frontend-design/SKILL.md", - "skillFolderHash": "928950704df8a8b885c03de5da626331e6f29cf8", + "skillFolderHash": "0d5b74a14bdf3ebcd64f352d06376a2ef05ed296", "installedAt": "2026-05-25T13:30:00.000Z", - "updatedAt": "2026-05-30T10:38:03.978Z" + "updatedAt": "2026-06-13T21:48:51.027Z" }, "gcx": { "source": "/Users/joelazar/.local/share/chezmoi/dot_agents/skills/gcx", @@ -258,9 +258,9 @@ "sourceType": "github", "sourceUrl": "https://github.com/pbakaus/impeccable.git", "skillPath": ".agents/skills/impeccable/SKILL.md", - "skillFolderHash": "9fe84c4d60e8cfc09cc38cc873918ba2fd8f1495", + "skillFolderHash": "b8f5ff07669681920b944fc1b7e8b0c3bbb09884", "installedAt": "2026-05-30T10:39:26.849Z", - "updatedAt": "2026-06-08T08:48:24.674Z" + "updatedAt": "2026-06-13T21:49:24.896Z" }, "last30days": { "source": "mvanhorn/last30days-skill", diff --git a/dot_claude-work/settings.json b/dot_claude-work/private_settings.json similarity index 93% rename from dot_claude-work/settings.json rename to dot_claude-work/private_settings.json index bde734fb..f6f2b5b8 100644 --- a/dot_claude-work/settings.json +++ b/dot_claude-work/private_settings.json @@ -124,5 +124,18 @@ "theme": "dark-ansi", "preferredNotifChannel": "ghostty", "fileCheckpointingEnabled": false, - "voiceEnabled": false + "voiceEnabled": false, + "hooks": { + "PreToolUse": [ + { + "matcher": "Bash", + "hooks": [ + { + "type": "command", + "command": "rtk hook claude" + } + ] + } + ] + } } diff --git a/dot_claude/settings.json b/dot_claude/private_settings.json similarity index 93% rename from dot_claude/settings.json rename to dot_claude/private_settings.json index 06f5a766..dc118a85 100644 --- a/dot_claude/settings.json +++ b/dot_claude/private_settings.json @@ -127,5 +127,19 @@ "fileCheckpointingEnabled": false, "inputNeededNotifEnabled": true, "agentPushNotifEnabled": true, - "voiceEnabled": false + "voiceEnabled": false, + "hooks": { + "PreToolUse": [ + { + "matcher": "Bash", + "hooks": [ + { + "type": "command", + "command": "rtk hook claude" + } + ] + } + ] + } } + diff --git a/dot_config/private_fish/fish_plugins b/dot_config/private_fish/fish_plugins index 0cfb675d..6de208ff 100644 --- a/dot_config/private_fish/fish_plugins +++ b/dot_config/private_fish/fish_plugins @@ -1,7 +1,5 @@ -danhper/fish-ssh-agent franciscolourenco/done jorgebucaran/autopair.fish -jorgebucaran/replay.fish nickeb96/puffer-fish jorgebucaran/fisher catppuccin/fish diff --git a/dot_config/zed/private_settings.json b/dot_config/zed/private_settings.json index d8e73f8c..d9019e6e 100644 --- a/dot_config/zed/private_settings.json +++ b/dot_config/zed/private_settings.json @@ -3,32 +3,32 @@ // APPEARANCE // ══════════════════════════════════════════════════════════════════════════════ "debugger": { - "button": false + "button": false, }, "search": { - "button": false + "button": false, }, "toolbar": { "code_actions": false, "agent_review": true, "selections_menu": true, "quick_actions": false, - "breadcrumbs": true + "breadcrumbs": true, }, "status_bar": { "show_active_file": false, "cursor_position_button": true, - "active_language_button": true + "active_language_button": true, }, "theme": { "mode": "dark", "light": "One Light", - "dark": "Catppuccin Mocha" + "dark": "Catppuccin Mocha", }, "icon_theme": { "mode": "dark", "light": "Catppuccin Mocha", - "dark": "Material Icon Theme" + "dark": "Material Icon Theme", }, "ui_font_size": 13.0, "agent_ui_font_size": 13.0, @@ -39,7 +39,7 @@ "cv02": true, // alternative `a` with top arm "cv05": true, // alternative `g` in double story style "cv61": true, // alternative `,` and `;` with straight tail - "cv63": true // alternative `<=` in arrow style + "cv63": true, // alternative `<=` in arrow style }, "cursor_blink": false, "colorize_brackets": true, // rainbow brackets @@ -63,7 +63,7 @@ "vim": { "use_system_clipboard": "never", // use vim registers, not system clipboard "use_smartcase_find": true, // case-insensitive find unless uppercase - "highlight_on_yank_duration": 500 // visual feedback on yank (ms) + "highlight_on_yank_duration": 500, // visual feedback on yank (ms) }, // ══════════════════════════════════════════════════════════════════════════════ @@ -71,7 +71,7 @@ // ══════════════════════════════════════════════════════════════════════════════ "which_key": { "enabled": true, - "delay_ms": 400 + "delay_ms": 400, }, // ══════════════════════════════════════════════════════════════════════════════ @@ -80,18 +80,18 @@ "git": { "inline_blame": { "delay_ms": 200, - "show_commit_summary": true - } + "show_commit_summary": true, + }, }, // ══════════════════════════════════════════════════════════════════════════════ // INLAY HINTS & INDENT GUIDES // ══════════════════════════════════════════════════════════════════════════════ "inlay_hints": { - "enabled": true + "enabled": true, }, "indent_guides": { - "coloring": "indent_aware" // different colors per indent level + "coloring": "indent_aware", // different colors per indent level }, // ══════════════════════════════════════════════════════════════════════════════ @@ -100,7 +100,7 @@ "preview_tabs": { "enabled": true, "enable_keep_preview_on_code_navigation": true, - "enable_preview_from_file_finder": true + "enable_preview_from_file_finder": true, }, // ══════════════════════════════════════════════════════════════════════════════ @@ -118,7 +118,7 @@ // SESSION // ══════════════════════════════════════════════════════════════════════════════ "session": { - "trust_all_worktrees": true + "trust_all_worktrees": true, }, // ══════════════════════════════════════════════════════════════════════════════ @@ -129,11 +129,11 @@ "bottom_dock_layout": "right_aligned", "centered_layout": { "left_padding": 0.15, - "right_padding": 0.15 + "right_padding": 0.15, }, "active_pane_modifiers": { "inactive_opacity": 0.7, - "border_size": 0.5 + "border_size": 0.5, }, // ══════════════════════════════════════════════════════════════════════════════ @@ -147,7 +147,7 @@ "show_branch_name": true, "show_user_menu": true, "show_menus": true, - "show_sign_in": false + "show_sign_in": false, }, // ══════════════════════════════════════════════════════════════════════════════ @@ -157,20 +157,20 @@ "show_pinned_tabs_in_separate_row": false, "show": true, "show_nav_history_buttons": false, - "show_tab_bar_buttons": false + "show_tab_bar_buttons": false, }, "tabs": { "show_diagnostics": "errors", "git_status": true, "file_icons": true, - "activate_on_close": "neighbour" + "activate_on_close": "neighbour", }, // ══════════════════════════════════════════════════════════════════════════════ // SCROLLBAR // ══════════════════════════════════════════════════════════════════════════════ "scrollbar": { - "show": "system" + "show": "system", }, // ══════════════════════════════════════════════════════════════════════════════ @@ -184,16 +184,16 @@ "auto_reveal_entries": false, "entry_spacing": "standard", "diagnostic_badges": true, - "git_status_indicator": true // show git status colors on files in project panel + "git_status_indicator": true, // show git status colors on files in project panel }, "outline_panel": { "button": false, - "dock": "right" + "dock": "right", }, "collaboration_panel": { "dock": "right", "button": false, - "default_width": 300 + "default_width": 300, }, "git_panel": { "dock": "right", @@ -203,7 +203,7 @@ "default_width": 300, "show_count_badge": true, "file_icons": true, - "status_style": "icon" // show git status as icons (alternative: "label_color") + "status_style": "icon", // show git status as icons (alternative: "label_color") }, // ══════════════════════════════════════════════════════════════════════════════ @@ -211,7 +211,7 @@ // ══════════════════════════════════════════════════════════════════════════════ "file_finder": { "modal_max_width": "medium", - "include_ignored": "all" + "include_ignored": "all", }, // ══════════════════════════════════════════════════════════════════════════════ @@ -219,18 +219,18 @@ // ══════════════════════════════════════════════════════════════════════════════ "diagnostics": { "inline": { - "enabled": true - } + "enabled": true, + }, }, // ══════════════════════════════════════════════════════════════════════════════ // MESSAGES & CALLS // ══════════════════════════════════════════════════════════════════════════════ "message_editor": { - "auto_replace_emoji_shortcode": false + "auto_replace_emoji_shortcode": false, }, "calls": { - "mute_on_join": true + "mute_on_join": true, }, // ══════════════════════════════════════════════════════════════════════════════ @@ -241,7 +241,7 @@ // ══════════════════════════════════════════════════════════════════════════════ "edit_predictions": { "disabled_globs": [], - "provider": "zed" + "provider": "zed", }, "agent": { "sidebar_side": "left", @@ -250,19 +250,19 @@ "button": false, "single_file_review": false, "tool_permissions": { - "default": "allow" + "default": "allow", }, "message_editor_min_lines": 3, "inline_assistant_model": { "provider": "copilot_chat", - "model": "claude-sonnet-4.6" + "model": "claude-sonnet-4.6", }, "use_modifier_to_send": false, "play_sound_when_agent_done": "never", "show_turn_stats": true, // show timer + token count per turn "commit_message_model": { "provider": "copilot_chat", - "model": "gpt-5.4-mini" + "model": "gpt-5.4-mini", }, "enable_feedback": false, "thinking_display": "preview", @@ -270,8 +270,8 @@ "effort": "medium", "enable_thinking": true, "provider": "copilot_chat", - "model": "claude-sonnet-4.6" - } + "model": "claude-sonnet-4.6", + }, }, // ══════════════════════════════════════════════════════════════════════════════ @@ -280,16 +280,16 @@ "agent_servers": { "codex-acp": { "type": "registry", - "default_mode": "full-access" + "default_mode": "full-access", }, "claude-acp": { "type": "registry", "default_mode": "bypassPermissions", - "favorite_models": ["opus", "default"] + "favorite_models": ["opus", "default"], }, "pi-acp": { - "type": "registry" - } + "type": "registry", + }, }, // ══════════════════════════════════════════════════════════════════════════════ @@ -302,9 +302,9 @@ "args": [], "projects": [ { - "paths": ["/Users/joelazar/Code/jets"] - } - ] + "paths": ["/Users/joelazar/Code/jets"], + }, + ], }, { "host": "openclaw", @@ -312,10 +312,10 @@ "args": [], "projects": [ { - "paths": ["/home/openclaw"] - } - ] - } + "paths": ["/home/openclaw"], + }, + ], + }, ], // ══════════════════════════════════════════════════════════════════════════════ @@ -324,7 +324,7 @@ "terminal": { "button": false, "scrollbar": { - "show": "never" + "show": "never", }, "max_scroll_history_lines": 50000, "blinking": "off", @@ -334,19 +334,19 @@ "cv02": true, "cv05": true, "cv61": true, - "cv63": true + "cv63": true, }, "detect_venv": { "on": { - "activate_script": "fish" - } + "activate_script": "fish", + }, }, "env": { "GIT_EDITOR": "zed --wait", - "EDITOR": "zed" + "EDITOR": "zed", }, "minimum_contrast": 0, - "keep_selection_on_copy": false + "keep_selection_on_copy": false, }, // ══════════════════════════════════════════════════════════════════════════════ @@ -381,7 +381,7 @@ "**/__pycache__", "**/.ropeproject", "**/.pytest_cache", - "**/.ruff_cache" + "**/.ruff_cache", ], // ══════════════════════════════════════════════════════════════════════════════ @@ -402,7 +402,7 @@ "**/group_vars/**.yml", "**/group_vars/**.yaml", "**playbook*.yaml", - "**playbook*.yml" + "**playbook*.yml", ], "Dockerfile": ["Dockerfile*"], "Helm": [ @@ -411,10 +411,10 @@ "**/templates/**/*.yml", "**/helmfile.d/**/*.yaml", "**/helmfile.d/**/*.yml", - "**/values*.yaml" + "**/values*.yaml", ], "Shell Script": ["*.envrc*"], - "Nginx": ["**/nginx/**/*.conf", "nginx.conf"] + "Nginx": ["**/nginx/**/*.conf", "nginx.conf"], }, // ══════════════════════════════════════════════════════════════════════════════ @@ -422,13 +422,13 @@ // ══════════════════════════════════════════════════════════════════════════════ "language_models": { "openai": { - "available_models": [] + "available_models": [], }, "anthropic": { - "available_models": [] + "available_models": [], }, "google": { - "available_models": [] + "available_models": [], }, "deepseek": { "api_url": "https://api.deepseek.com", @@ -436,18 +436,18 @@ { "name": "deepseek-chat", "display_name": "DeepSeek Chat", - "max_tokens": 64000 + "max_tokens": 64000, }, { "name": "deepseek-reasoner", "display_name": "DeepSeek Reasoner", "max_tokens": 64000, - "max_output_tokens": 4096 - } - ] + "max_output_tokens": 4096, + }, + ], }, "zed.dev": { - "available_models": [] + "available_models": [], }, "ollama": { "available_models": [ @@ -455,19 +455,19 @@ "name": "devstral", "display_name": "Mistral Devstral - 24B", "max_tokens": 131072, - "supports_tools": true + "supports_tools": true, }, { "name": "qwen3-coder:30b", "display_name": "Qwen 3 Coder - 30B-A3B", "max_tokens": 262144, - "supports_tools": true + "supports_tools": true, }, { "name": "qwen3:4b", "display_name": "Qwen 3 - 4B", "max_tokens": 32768, - "supports_tools": true + "supports_tools": true, }, { "name": "gpt-oss:20b", @@ -475,9 +475,9 @@ "max_tokens": 131072, "supports_tools": true, "supports_thinking": true, - "supports_images": true - } - ] + "supports_images": true, + }, + ], }, "openai_compatible": { "Cerebras": { @@ -491,12 +491,12 @@ "tools": true, "images": true, "parallel_tool_calls": true, - "prompt_cache_key": false - } - } - ] - } - } + "prompt_cache_key": false, + }, + }, + ], + }, + }, }, // ══════════════════════════════════════════════════════════════════════════════ @@ -507,37 +507,37 @@ "rust-analyzer": { "initialization_options": { "check": { - "command": "clippy" + "command": "clippy", }, "cargo": { "allFeatures": true, "loadOutDirsFromCheck": true, "buildScripts": { - "enable": true - } + "enable": true, + }, }, "procMacro": { "enable": true, "ignored": { "async-trait": ["async_trait"], "napi-derive": ["napi"], - "async-recursion": ["async_recursion"] - } + "async-recursion": ["async_recursion"], + }, }, "rust": { - "analyzerTargetDir": true + "analyzerTargetDir": true, }, "inlayHints": { "maxLength": null, "lifetimeElisionHints": { "enable": "skip_trivial", - "useParameterNames": true + "useParameterNames": true, }, "closureReturnTypeHints": { - "enable": "always" - } - } - } + "enable": "always", + }, + }, + }, }, // Python: basedpyright with relaxed type checking "basedpyright": { @@ -554,32 +554,32 @@ "reportUnknownLambdaType": "none", "reportUnknownMemberType": "none", "reportUnknownParameterType": "none", - "reportUnknownVariableType": "none" - } - } - } - } + "reportUnknownVariableType": "none", + }, + }, + }, + }, }, // Ansible: lint enabled "ansible": { "settings": { "ansible": { - "path": "ansible" + "path": "ansible", }, "executionEnvironment": { - "enabled": false + "enabled": false, }, "python": { - "interpreterPath": "python3" + "interpreterPath": "python3", }, "validation": { "enabled": true, "lint": { "enabled": true, - "path": "ansible-lint" - } - } - } + "path": "ansible-lint", + }, + }, + }, }, // Go: gofumpt, semantic tokens, codelenses, hints "gopls": { @@ -589,13 +589,7 @@ "completeUnimported": true, "staticcheck": false, "semanticTokens": true, - "directoryFilters": [ - "-.git", - "-.vscode", - "-.idea", - "-.vscode-test", - "-node_modules" - ], + "directoryFilters": ["-.git", "-.vscode", "-.idea", "-.vscode-test", "-node_modules"], "experimentalPostfixCompletions": true, "codelenses": { "gc_details": true, @@ -605,7 +599,7 @@ "test": true, "tidy": true, "upgrade_dependency": true, - "vendor": true + "vendor": true, }, "hints": { "assignVariableTypes": true, @@ -614,29 +608,22 @@ "constantValues": true, "functionTypeParameters": true, "parameterNames": true, - "rangeVariableTypes": true + "rangeVariableTypes": true, }, "analyses": { "nilness": true, "unusedparams": true, "unusedwrite": true, - "useany": true - } - } + "useany": true, + }, + }, }, // golangci-lint "golangci-lint": { "initialization_options": { - "command": [ - "golangci-lint", - "run", - "--output.json.path", - "stdout", - "--show-stats=false", - "--output.text.path=" - ] - } - } + "command": ["golangci-lint", "run", "--output.json.path", "stdout", "--show-stats=false", "--output.text.path="], + }, + }, }, // ══════════════════════════════════════════════════════════════════════════════ @@ -649,46 +636,43 @@ { "external": { "command": "bash", - "arguments": [ - "-c", - "ruff check --select=I --fix --stdin-filename {buffer_path} | ruff format --stdin-filename {buffer_path}" - ] - } - } + "arguments": ["-c", "ruff check --select=I --fix --stdin-filename {buffer_path} | ruff format --stdin-filename {buffer_path}"], + }, + }, ], - "language_servers": ["ty", "..."] + "language_servers": ["ty", "..."], }, "JavaScript": { "code_actions_on_format": { - "source.fixAll.eslint": true - } + "source.fixAll.eslint": true, + }, }, "Go": { "format_on_save": "on", "language_servers": ["!harper-ls", "..."], - "document_folding_ranges": "on" + "document_folding_ranges": "on", }, "Markdown": { - "format_on_save": "on" + "format_on_save": "on", }, "Terraform": { "format_on_save": "on", "formatter": { "external": { "command": "tofu", - "arguments": ["fmt", "-"] - } - } + "arguments": ["fmt", "-"], + }, + }, }, "Fish": { "format_on_save": "on", "formatter": { "external": { "command": "fish_indent", - "arguments": [] - } - } - } + "arguments": [], + }, + }, + }, }, // ══════════════════════════════════════════════════════════════════════════════ @@ -728,7 +712,7 @@ "toml": true, "vscode-icons": true, "zedokai": true, - "zig": true + "zig": true, }, // ══════════════════════════════════════════════════════════════════════════════ @@ -739,21 +723,21 @@ "syntax": { "comment": { "font_style": "italic", - "font_weight": 300 + "font_weight": 300, }, "keyword": { - "font_style": "italic" + "font_style": "italic", }, "keyword.import": { - "font_style": "italic" + "font_style": "italic", }, "keyword.type": { - "font_style": "italic" + "font_style": "italic", }, "type": { - "font_style": "italic" - } - } - } - } + "font_style": "italic", + }, + }, + }, + }, } diff --git a/dot_pi/agent/AGENTS.md b/dot_pi/agent/AGENTS.md index 2faa513e..62aa12f0 100644 --- a/dot_pi/agent/AGENTS.md +++ b/dot_pi/agent/AGENTS.md @@ -24,3 +24,5 @@ - Expose what must be exposed, hide what must be hidden - Every line will be judged at the scales - Occam's Razor in code + +@RTK.md diff --git a/dot_pi/agent/extensions/private_rtk.ts b/dot_pi/agent/extensions/private_rtk.ts new file mode 100644 index 00000000..32cb2b5f --- /dev/null +++ b/dot_pi/agent/extensions/private_rtk.ts @@ -0,0 +1,80 @@ +// RTK Pi extension — rewrites bash commands to use rtk for token savings. +// Requires: rtk >= 0.23.0 in PATH. +// +// This is a thin delegating extension: all rewrite logic lives in `rtk rewrite`, +// which is the single source of truth (src/discover/registry.rs). +// To add or change rewrite rules, edit the Rust registry — not this file. +// +// Exit code contract for `rtk rewrite`: +// 0 + stdout Rewrite found → mutate command +// 1 No RTK equivalent → pass through unchanged +// 3 + stdout Rewrite (advisory) → mutate command + +import type { ExtensionAPI } from "@earendil-works/pi-coding-agent" +import { isToolCallEventType } from "@earendil-works/pi-coding-agent" + +const REWRITE_TIMEOUT_MS = 2_000 +const MIN_SUPPORTED_RTK_MINOR = 23 + +// Parse "X.Y.Z" semver, return [major, minor, patch] or null. +function parseSemver(raw: string): [number, number, number] | null { + const m = raw.trim().match(/(\d+)\.(\d+)\.(\d+)/) + if (!m) return null + return [parseInt(m[1], 10), parseInt(m[2], 10), parseInt(m[3], 10)] +} + +// Calls `rtk rewrite`; returns the rewritten command or null (pass through). +async function rewriteCommand( + pi: ExtensionAPI, + cmd: string, + signal?: AbortSignal +): Promise { + const result = await pi.exec("rtk", ["rewrite", cmd], { + timeout: REWRITE_TIMEOUT_MS, + signal, + }) + if (result.killed) return null + if (result.code !== 0 && result.code !== 3) return null + return result.stdout.trim() || null +} + +export default async function (pi: ExtensionAPI) { + // Probe rtk version at load time; disables extension if missing or too old. + const ver = await pi.exec("rtk", ["--version"], { timeout: REWRITE_TIMEOUT_MS }) + if (ver.code !== 0) { + console.warn("[rtk] rtk binary not found in PATH — extension disabled") + return + } + + // Warn and bail if rtk predates 0.23.0 (when `rtk rewrite` was introduced). + const parsed = parseSemver(ver.stdout.replace(/^rtk\s+/, "")) + if (parsed) { + const [major, minor] = parsed + if (major === 0 && minor < MIN_SUPPORTED_RTK_MINOR) { + console.warn(`[rtk] rtk ${ver.stdout.trim()} is too old (need >= 0.23.0) — extension disabled`) + return + } + } + + pi.on("tool_call", async (event, ctx) => { + try { + if (!isToolCallEventType("bash", event)) return + + const cmd = event.input.command + if (typeof cmd !== "string" || cmd.trim() === "") return + + if (cmd.startsWith("rtk ")) return + if (process.env.RTK_DISABLED === "1") return + + // Delegate to RTK. + const rewritten = await rewriteCommand(pi, cmd, ctx.signal) + if (rewritten && rewritten !== cmd) { + event.input.command = rewritten + } + } catch (err) { + // Fail open: never block execution on an unexpected error. + console.warn("[rtk] unexpected error in tool_call handler; passing through command", err) + return + } + }) +} -- 2.51.2