@pushary/agent-hooks 0.10.0 → 0.10.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.
@@ -88,11 +88,15 @@ var startSpinner = (getLabel) => {
88
88
  `);
89
89
  };
90
90
  };
91
- var printQr = (url) => new Promise((resolve) => {
92
- qrcodeTerminal.generate(url, { small: true }, (qr) => {
93
- process.stdout.write("\n" + qr.split("\n").map((line) => " " + line).join("\n") + "\n");
94
- resolve();
95
- });
91
+ var printQr = (url) => new Promise((resolve, reject) => {
92
+ try {
93
+ qrcodeTerminal.generate(url, { small: true }, (qr) => {
94
+ process.stdout.write("\n" + qr.split("\n").map((line) => " " + line).join("\n") + "\n");
95
+ resolve();
96
+ });
97
+ } catch (err) {
98
+ reject(err);
99
+ }
96
100
  });
97
101
  var waitForDevice = async (apiKey) => {
98
102
  const deadline = Date.now() + CONNECT_TIMEOUT_MS;
@@ -200,17 +204,17 @@ var isInstalled = (command) => {
200
204
  return false;
201
205
  }
202
206
  };
203
- var readJson = (path) => {
207
+ var readJson = (filePath) => {
204
208
  try {
205
- return JSON.parse(readFileSync(path, "utf-8"));
209
+ return JSON.parse(readFileSync(filePath, "utf-8"));
206
210
  } catch {
207
211
  return {};
208
212
  }
209
213
  };
210
- var writeJson = (path, data) => {
211
- const dir = path.substring(0, path.lastIndexOf("/"));
214
+ var writeJson = (filePath, data) => {
215
+ const dir = dirname(filePath);
212
216
  if (!existsSync(dir)) mkdirSync(dir, { recursive: true });
213
- writeFileSync(path, JSON.stringify(data, null, 2) + "\n", "utf-8");
217
+ writeFileSync(filePath, JSON.stringify(data, null, 2) + "\n", "utf-8");
214
218
  };
215
219
  var formatError = (err) => {
216
220
  if (err instanceof Error) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@pushary/agent-hooks",
3
- "version": "0.10.0",
3
+ "version": "0.10.1",
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",