@gtheys/rifle-batteries0.2.0
Rifle distro batteries — bootstrap, ask-user-question, prompt-snippets, tool-pills, desktop-notify, sudo, and herdr-title extensions in one package
Untested on omp
This is a pi package. No one has reported whether it works on omp yet. If you try it, add your result below.
Reports 0
No reports yet.
Readme
@gtheys/rifle-batteries
Rifle distro batteries — the seven small single-purpose pi extensions of the pi-my-rifle-ext distro (bootstrap, ask-user-question, prompt-snippets, tool-pills, desktop-notify, sudo, herdr-title) consolidated into one installable package, so a single manifest entry loads them all. Modules are absorbed one per commit from their standalone packages; this README and the manifest grow with every absorb.
Extensions
| Extension | Description | Link |
|---|---|---|
| bootstrap | Startup bootstrap — symlinks agents/AGENTS.md to ~/.pi/agent/AGENTS.md; /doctor command + bun run doctor CLI validate the whole rifle installation |
./bootstrap/ |
| ask-user-question | ask_user_question tool — pauses execution for interactive text / single-select / multi-select questions with an Other free-text escape hatch |
./ask-user-question/ |
| prompt-snippets | One-shot prompt snippets — alt+s / /snippets toggle menu, bodies prepended/appended to the next message, widget shows active set |
./prompt-snippets/ |
| tool-pills | Colored pill badges + collapsed output for ls/read/find/grep/bash, Nerd Font file icons (ls renders as a tree; PI_TOOL_PILLS_ICONS=off disables), find/grep accelerated by the @ff-labs/fff-node frecency index of the session cwd (falls back to the built-in SDK tools when unavailable), and Shiki-powered syntax-highlighted diffs for write/edit; its fff database lives at ~/.pi/agent/pi-rifle-batteries/tool-pills/fff/ (a legacy ~/.pi/agent/pi-tool-pills/fff/ is migrated there on first load and never destroyed) |
./tool-pills/ |
| desktop-notify | /notify command — desktop notifications (notify-send) when pi finishes work after an idle period, mirrored into herdr inside a herdr session, plus ntfy push; also pages on blocking prompts |
./desktop-notify/ |
| sudo | sudo_run tool — root command execution behind an Allow/Deny confirmation + masked password prompt (password piped to sudo -S, never persisted); auto-denies after 60s of inactivity, and fires a best-effort attention alert (critical desktop notification + herdr request sound) while the prompt waits |
./sudo/ |
| herdr-title | Renames the current herdr pane to Pi - <cwd> on session start, so panes are identifiable in the workspace; no-op outside herdr |
./herdr-title/ |
Configuration
ask-user-question
Global config lives at ~/.pi/agent/pi-rifle-batteries/ask-user-question/config.json (a legacy ~/.pi/agent/pi-ask-user-question/config.json is migrated there on first load and never destroyed). A project override at <cwd>/.pi/pi-rifle-batteries/ask-user-question/config.json replaces the global styleRules list per project. Each styleRules entry is appended verbatim as a prompt guideline for ask_user_question, so your question-style preferences are in the model's context every time it asks a question (config changes need a session restart).
| Option | Type | Default | Description |
|---|---|---|---|
styleRules |
string[] | [] |
Question-style rules, appended in order after the tool's 7 base guidelines |
{
"$schema": "config.schema.json",
"styleRules": []
}
desktop-notify
Global config lives at ~/.pi/agent/pi-rifle-batteries/desktop-notify/config.json (a legacy ~/.pi/agent/pi-desktop-notify/config.json is migrated there on first load and never destroyed). A project override at <cwd>/.pi/pi-rifle-batteries/desktop-notify/config.json wins per-section. Create the file (and the ntfy section) to enable ntfy pushes — the channel is off while the section is absent.
| Option | Type | Default | Description |
|---|---|---|---|
desktop.enabled |
boolean | true |
Send notify-send desktop notifications |
herdr.enabled |
boolean | true |
Mirror notifications into herdr when HERDR_ENV=1 |
herdr.sound |
string | done |
herdr notification sound name |
ntfy |
object | — | ntfy section; presence enables the channel (unless enabled: false) |
ntfy.serverUrl |
string | — | Required. Base URL, e.g. https://ntfy.homelab.local |
ntfy.topic |
string | — | Required. Topic to publish to (secret topics work too) |
ntfy.token |
string | — | Bearer token for access control; PI_NTFY_TOKEN env wins over this |
ntfy.priority |
integer | 3 |
ntfy priority 1–5 (5 = max priority, persistent) |
ntfy.tags |
string[] | [] |
Emoji tags, e.g. ["robot", "white_check_mark"] |
ntfy.clickUrl |
string | — | URL opened when the notification is tapped |
ntfy.timeoutMs |
integer | 5000 |
HTTP timeout for the publish request |
notifyOnPrompt |
boolean | true |
Also notify when Pi shows a blocking user prompt |
{
"$schema": "https://raw.githubusercontent.com/gtheys/pi-my-rifle-ext/main/packages/rifle-batteries/desktop-notify/config.schema.json",
"desktop": {
"enabled": true
},
"herdr": {
"enabled": true,
"sound": "done"
},
"ntfy": {
"enabled": true,
"serverUrl": "https://ntfy.homelab.local",
"topic": "pi-notifications",
"priority": 3,
"tags": ["robot"],
"timeoutMs": 5000
},
"notifyOnPrompt": true
}
Minimal homelab setup:
{
"ntfy": {
"serverUrl": "https://ntfy.homelab.local",
"topic": "pi-notifications"
}
}
If your ntfy topic requires access control, prefer the PI_NTFY_TOKEN environment variable over putting the token in the config file.
All channels are best-effort: an unreachable ntfy server or missing notify-send never interrupts a Pi session. A present-but-malformed config file is reported as an error at session start instead of being silently ignored.
Library subpath (./notify)
The package also exports a node-only @gtheys/rifle-batteries/notify
subpath: dispatchNotification(config, summary, body) plus the re-exported
loadConfig and config types. It reuses the desktop-notify module's channel
dispatch (desktop / herdr / ntfy, best-effort per channel) without loading
the extension, so another extension can page through the same user channel
toggles. It is currently consumed by pi-flow,
which dynamically imports @gtheys/rifle-batteries/notify to send a desktop
notification on a waiting_human / halted flow transition (PMR-ZV9Y; the
subpath moved here from the retired @gtheys/pi-desktop-notify package in
PMR-8YDK 5.2). The subpath keeps the node-only bar: it never imports the pi
extension runtime directly — only node built-ins plus ./config.ts (which
reaches @earendil-works/pi-coding-agent for getAgentDir() transitively;
accepted, because the only consumer runs inside a Pi session already).