@pushary/agent-hooks 0.2.6 → 0.2.7

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.
@@ -176,6 +176,7 @@ export PUSHARY_API_KEY="${apiKey}"
176
176
  });
177
177
  };
178
178
  var sendTestNotification = async (apiKey) => {
179
+ let notifResult = "";
179
180
  await spinner("Sending test notification", async () => {
180
181
  const response = await fetch("https://pushary.com/api/v1/server/send", {
181
182
  method: "POST",
@@ -188,15 +189,19 @@ var sendTestNotification = async (apiKey) => {
188
189
  body: "Your AI agent can now send you push notifications."
189
190
  })
190
191
  });
192
+ const data = await response.json().catch(() => ({}));
191
193
  if (!response.ok) {
192
- const err = await response.json().catch(() => ({}));
193
- throw new Error(err.error ?? response.statusText);
194
- }
195
- const data = await response.json();
196
- if (!data.delivered || data.delivered === 0) {
197
- throw new Error("no subscribers");
194
+ notifResult = `Could not send: ${data.error ?? response.statusText}`;
195
+ return;
198
196
  }
197
+ notifResult = "sent";
199
198
  });
199
+ if (notifResult === "sent") {
200
+ console.log(` ${dim("Check your phone!")}`);
201
+ } else if (notifResult) {
202
+ console.log(` ${dim(notifResult)}`);
203
+ console.log(` ${dim("Make sure you enabled notifications at")} ${cyan("pushary.com")}`);
204
+ }
200
205
  };
201
206
  var main = async () => {
202
207
  console.log();
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@pushary/agent-hooks",
3
- "version": "0.2.6",
3
+ "version": "0.2.7",
4
4
  "description": "Permission hooks for AI coding agents — route tool approvals through Pushary push notifications",
5
5
  "author": "Pushary <business@pushary.com>",
6
6
  "homepage": "https://pushary.com",