@aerok/pi-toolkit 0.1.0 → 0.1.1

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 CHANGED
@@ -1,5 +1,10 @@
1
1
  # Changelog
2
2
 
3
+ ## [0.1.1] - 2026-09-02
4
+
5
+ - Added `/toolkit:bark-toggle` for global or project-level `on`, `off`, `status`, and no-argument toggle operations.
6
+ - Disabling Bark through the shortcut clears any armed urgent notification.
7
+
3
8
  ## [0.1.0] - 2026-09-02
4
9
 
5
10
  Initial public release of pi-toolkit.
package/README.md CHANGED
@@ -85,6 +85,7 @@ The wizard does not save or activate new encryption credentials until this devic
85
85
  |---|---|
86
86
  | `/toolkit:bark-setup` | Configure the Bark server, device key, delivery defaults, and encryption |
87
87
  | `/toolkit:bark-test` | Send a test using the active encryption mode |
88
+ | `/toolkit:bark-toggle` | Quickly enable, disable, toggle, or inspect Bark notifications |
88
89
  | `/toolkit:bark-encryption-rotate` | Generate and verify a new encryption Key and IV |
89
90
  | `/toolkit:bark-urgent` | Toggle continuous ringing for the next completed task only |
90
91
  | `/toolkit:bark-notify-settings` | Configure notification events, encryption mode, and recap behavior |
@@ -92,6 +93,33 @@ The wizard does not save or activate new encryption credentials until this devic
92
93
 
93
94
  All Bark commands use the `toolkit:bark-*` namespace so other pi-toolkit extensions can add their own command groups later.
94
95
 
96
+ ## Quick enable and disable
97
+
98
+ Toggle global Bark notifications with no arguments:
99
+
100
+ ```text
101
+ /toolkit:bark-toggle
102
+ ```
103
+
104
+ Use an explicit action when the desired result must be unambiguous:
105
+
106
+ ```text
107
+ /toolkit:bark-toggle on
108
+ /toolkit:bark-toggle off
109
+ /toolkit:bark-toggle status
110
+ ```
111
+
112
+ Add `--project` to target the current project's non-secret enabled override:
113
+
114
+ ```text
115
+ /toolkit:bark-toggle --project
116
+ /toolkit:bark-toggle --project on
117
+ /toolkit:bark-toggle --project off
118
+ /toolkit:bark-toggle --project status
119
+ ```
120
+
121
+ Enabling is refused until the inherited Bark server, device key, and encryption credentials are valid. Disabling clears any armed urgent notification. Status reports global, project, and effective values without changing configuration.
122
+
95
123
  ## Default completion notification
96
124
 
97
125
  When `agent_settled` fires, pi-toolkit sends:
@@ -3,7 +3,14 @@ import type { ExtensionAPI, ExtensionContext, Theme } from "@earendil-works/pi-c
3
3
  import { Type } from "typebox";
4
4
 
5
5
  import { createBarkClient } from "./client.js";
6
- import { loadResolvedConfig, validateResolvedConfig } from "./config.js";
6
+ import {
7
+ loadGlobalConfig,
8
+ loadProjectConfig,
9
+ loadResolvedConfig,
10
+ saveGlobalConfig,
11
+ saveProjectConfig,
12
+ validateResolvedConfig,
13
+ } from "./config.js";
7
14
  import { fallbackSummary, summarizeForNotification } from "./recap.js";
8
15
  import type { BarkEventKey, BarkLevel, CachedModel, NotifyPriority, ResolvedBarkConfig } from "./types.js";
9
16
  import { RecapModelSelectorOverlay } from "./tui/model-selector.js";
@@ -211,6 +218,63 @@ export default function barkExtension(pi: ExtensionAPI): void {
211
218
  },
212
219
  });
213
220
 
221
+ pi.registerCommand("toolkit:bark-toggle", {
222
+ description: "Toggle Bark notifications globally or for the current project",
223
+ handler: async (args, ctx) => {
224
+ const tokens = args.trim().split(/\s+/).filter(Boolean);
225
+ const project = tokens.includes("--project");
226
+ const actions = tokens.filter((token) => token !== "--project");
227
+ const action = actions[0] as "on" | "off" | "status" | undefined;
228
+ if (actions.length > 1 || (action && !["on", "off", "status"].includes(action)) || tokens.filter((token) => token === "--project").length > 1) {
229
+ ctx.ui.notify("Usage: /toolkit:bark-toggle [on|off|status] [--project]", "error");
230
+ return;
231
+ }
232
+
233
+ const status = (): { global: boolean; project?: boolean; effective: boolean } => {
234
+ const global = loadGlobalConfig().enabled;
235
+ const projectEnabled = loadProjectConfig(ctx.cwd)?.enabled;
236
+ return { global, project: projectEnabled, effective: projectEnabled ?? global };
237
+ };
238
+ if (action === "status") {
239
+ const current = status();
240
+ ctx.ui.notify(
241
+ `Bark: ${current.effective ? "on" : "off"} effective · global ${current.global ? "on" : "off"} · project ${current.project === undefined ? "inherited" : current.project ? "on" : "off"}`,
242
+ "info",
243
+ );
244
+ return;
245
+ }
246
+
247
+ const before = status();
248
+ const current = project ? before.effective : before.global;
249
+ const enabled = action ? action === "on" : !current;
250
+ if (enabled) {
251
+ const errors = validateResolvedConfig(loadResolvedConfig(ctx.cwd));
252
+ if (errors.length > 0) {
253
+ ctx.ui.notify(`Cannot enable Bark: ${errors.join("; ")}. Run /toolkit:bark-setup first.`, "error");
254
+ return;
255
+ }
256
+ }
257
+
258
+ if (project) {
259
+ saveProjectConfig(ctx.cwd, { ...(loadProjectConfig(ctx.cwd) ?? { version: 1 }), enabled });
260
+ } else {
261
+ saveGlobalConfig({ ...loadGlobalConfig(), enabled });
262
+ }
263
+ if (!enabled) {
264
+ urgentNextTask = false;
265
+ ctx.ui.setStatus("pi-toolkit-urgent", undefined);
266
+ }
267
+
268
+ const after = status();
269
+ const scope = project ? "project" : "global";
270
+ const overridden = !project && after.effective !== enabled;
271
+ ctx.ui.notify(
272
+ `Bark notifications ${enabled ? "enabled" : "disabled"} (${scope})${overridden ? `; current project remains ${after.effective ? "on" : "off"}` : ""}.`,
273
+ overridden ? "warning" : "info",
274
+ );
275
+ },
276
+ });
277
+
214
278
  pi.registerCommand("toolkit:bark-urgent", {
215
279
  description: "Toggle continuous ringing for the next completed task",
216
280
  handler: async (_args, ctx) => {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@aerok/pi-toolkit",
3
- "version": "0.1.0",
3
+ "version": "0.1.1",
4
4
  "description": "Encrypted Bark notifications and image paste placeholders for Pi",
5
5
  "type": "module",
6
6
  "license": "MIT",
@@ -47,10 +47,10 @@
47
47
  "node": ">=22.19.0"
48
48
  },
49
49
  "peerDependencies": {
50
- "@earendil-works/pi-ai": "^0.84.0",
51
- "@earendil-works/pi-coding-agent": "^0.84.0",
52
- "@earendil-works/pi-tui": "^0.84.0",
53
- "typebox": "^1.1.38"
50
+ "@earendil-works/pi-ai": "*",
51
+ "@earendil-works/pi-coding-agent": "*",
52
+ "@earendil-works/pi-tui": "*",
53
+ "typebox": "*"
54
54
  },
55
55
  "devDependencies": {
56
56
  "@earendil-works/pi-ai": "^0.84.0",