pushary 1.8.0

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.
Files changed (186) hide show
  1. package/CHANGELOG.md +1943 -0
  2. package/LICENSE +21 -0
  3. package/README.md +330 -0
  4. package/data/SKILL.md +591 -0
  5. package/data/cowork/SKILL.md +77 -0
  6. package/data/cursor-plugin/.cursor-plugin/plugin.json +25 -0
  7. package/data/cursor-plugin/CHANGELOG.md +70 -0
  8. package/data/cursor-plugin/CONTRIBUTING.md +40 -0
  9. package/data/cursor-plugin/LICENSE +21 -0
  10. package/data/cursor-plugin/README.md +113 -0
  11. package/data/cursor-plugin/SECURITY.md +33 -0
  12. package/data/cursor-plugin/assets/logo.png +0 -0
  13. package/data/cursor-plugin/commands/notify-when-done.md +14 -0
  14. package/data/cursor-plugin/commands/pushary-test.md +13 -0
  15. package/data/cursor-plugin/hooks/hooks.json +75 -0
  16. package/data/cursor-plugin/mcp.json +11 -0
  17. package/data/cursor-plugin/rules/pushary.mdc +40 -0
  18. package/data/cursor-plugin/scripts/pushary-gate.mjs +724 -0
  19. package/data/cursor-plugin/scripts/pushary-gate.test.mjs +137 -0
  20. package/data/cursor-plugin/scripts/redaction.mjs +51 -0
  21. package/data/cursor-plugin/skills/pushary/SKILL.md +584 -0
  22. package/data/vscode-plugin/.claude-plugin/plugin.json +28 -0
  23. package/data/vscode-plugin/.mcp.json +11 -0
  24. package/data/vscode-plugin/CHANGELOG.md +49 -0
  25. package/data/vscode-plugin/CONTRIBUTING.md +40 -0
  26. package/data/vscode-plugin/LICENSE +21 -0
  27. package/data/vscode-plugin/README.md +128 -0
  28. package/data/vscode-plugin/SECURITY.md +56 -0
  29. package/data/vscode-plugin/assets/logo.png +0 -0
  30. package/data/vscode-plugin/commands/notify-when-done.md +14 -0
  31. package/data/vscode-plugin/commands/pushary-test.md +13 -0
  32. package/data/vscode-plugin/hooks/hooks.json +60 -0
  33. package/data/vscode-plugin/scripts/pushary-gate.mjs +762 -0
  34. package/data/vscode-plugin/scripts/redaction.mjs +51 -0
  35. package/data/vscode-plugin/skills/pushary/SKILL.md +584 -0
  36. package/dist/bin/pushary-bell-hook.d.ts +1 -0
  37. package/dist/bin/pushary-bell-hook.js +46 -0
  38. package/dist/bin/pushary-bell.d.ts +1 -0
  39. package/dist/bin/pushary-bell.js +146 -0
  40. package/dist/bin/pushary-claude.d.ts +1 -0
  41. package/dist/bin/pushary-claude.js +1916 -0
  42. package/dist/bin/pushary-clean.d.ts +1 -0
  43. package/dist/bin/pushary-clean.js +1300 -0
  44. package/dist/bin/pushary-codex-bridge.d.ts +1 -0
  45. package/dist/bin/pushary-codex-bridge.js +599 -0
  46. package/dist/bin/pushary-codex-hook.d.ts +1 -0
  47. package/dist/bin/pushary-codex-hook.js +886 -0
  48. package/dist/bin/pushary-codex.d.ts +1 -0
  49. package/dist/bin/pushary-codex.js +125 -0
  50. package/dist/bin/pushary-connect.d.ts +1 -0
  51. package/dist/bin/pushary-connect.js +100 -0
  52. package/dist/bin/pushary-cowork.d.ts +1 -0
  53. package/dist/bin/pushary-cowork.js +36 -0
  54. package/dist/bin/pushary-daemon-supervisor.d.ts +1 -0
  55. package/dist/bin/pushary-daemon-supervisor.js +27 -0
  56. package/dist/bin/pushary-daemon.d.ts +1 -0
  57. package/dist/bin/pushary-daemon.js +878 -0
  58. package/dist/bin/pushary-disconnect.d.ts +1 -0
  59. package/dist/bin/pushary-disconnect.js +264 -0
  60. package/dist/bin/pushary-doctor.d.ts +1 -0
  61. package/dist/bin/pushary-doctor.js +1433 -0
  62. package/dist/bin/pushary-elicitation-hook.d.ts +1 -0
  63. package/dist/bin/pushary-elicitation-hook.js +149 -0
  64. package/dist/bin/pushary-gemini-bridge.d.ts +1 -0
  65. package/dist/bin/pushary-gemini-bridge.js +339 -0
  66. package/dist/bin/pushary-gemini-hook.d.ts +1 -0
  67. package/dist/bin/pushary-gemini-hook.js +381 -0
  68. package/dist/bin/pushary-hook.d.ts +1 -0
  69. package/dist/bin/pushary-hook.js +95 -0
  70. package/dist/bin/pushary-login.d.ts +1 -0
  71. package/dist/bin/pushary-login.js +198 -0
  72. package/dist/bin/pushary-logout.d.ts +1 -0
  73. package/dist/bin/pushary-logout.js +147 -0
  74. package/dist/bin/pushary-mcp.d.ts +1 -0
  75. package/dist/bin/pushary-mcp.js +114 -0
  76. package/dist/bin/pushary-mode.d.ts +1 -0
  77. package/dist/bin/pushary-mode.js +130 -0
  78. package/dist/bin/pushary-notification-hook.d.ts +1 -0
  79. package/dist/bin/pushary-notification-hook.js +56 -0
  80. package/dist/bin/pushary-opencode-hook.d.ts +1 -0
  81. package/dist/bin/pushary-opencode-hook.js +338 -0
  82. package/dist/bin/pushary-permission-denied-hook.d.ts +1 -0
  83. package/dist/bin/pushary-permission-denied-hook.js +60 -0
  84. package/dist/bin/pushary-permission-hook.d.ts +1 -0
  85. package/dist/bin/pushary-permission-hook.js +65 -0
  86. package/dist/bin/pushary-post-hook.d.ts +1 -0
  87. package/dist/bin/pushary-post-hook.js +70 -0
  88. package/dist/bin/pushary-prompt-hook.d.ts +1 -0
  89. package/dist/bin/pushary-prompt-hook.js +61 -0
  90. package/dist/bin/pushary-session-end-hook.d.ts +1 -0
  91. package/dist/bin/pushary-session-end-hook.js +59 -0
  92. package/dist/bin/pushary-session-start-hook.d.ts +1 -0
  93. package/dist/bin/pushary-session-start-hook.js +72 -0
  94. package/dist/bin/pushary-setup.d.ts +1 -0
  95. package/dist/bin/pushary-setup.js +2660 -0
  96. package/dist/bin/pushary-stats.d.ts +1 -0
  97. package/dist/bin/pushary-stats.js +44 -0
  98. package/dist/bin/pushary-status.d.ts +1 -0
  99. package/dist/bin/pushary-status.js +262 -0
  100. package/dist/bin/pushary-stop-hook.d.ts +1 -0
  101. package/dist/bin/pushary-stop-hook.js +63 -0
  102. package/dist/bin/pushary-stopfailure-hook.d.ts +1 -0
  103. package/dist/bin/pushary-stopfailure-hook.js +56 -0
  104. package/dist/bin/pushary-suggestions.d.ts +1 -0
  105. package/dist/bin/pushary-suggestions.js +100 -0
  106. package/dist/bin/pushary-transcript-register.d.ts +1 -0
  107. package/dist/bin/pushary-transcript-register.js +40 -0
  108. package/dist/bin/pushary-transcripts.d.ts +1 -0
  109. package/dist/bin/pushary-transcripts.js +77 -0
  110. package/dist/bin/pushary-upgrade.d.ts +1 -0
  111. package/dist/bin/pushary-upgrade.js +599 -0
  112. package/dist/bin/pushary-wait.d.ts +1 -0
  113. package/dist/bin/pushary-wait.js +122 -0
  114. package/dist/bin/pushary.d.ts +1 -0
  115. package/dist/bin/pushary.js +74 -0
  116. package/dist/chunk-2ABTSGFT.js +173 -0
  117. package/dist/chunk-2OY3ZZ5N.js +124 -0
  118. package/dist/chunk-3EGEA4KH.js +44 -0
  119. package/dist/chunk-3EVPNIBE.js +185 -0
  120. package/dist/chunk-5OP5MQI7.js +45 -0
  121. package/dist/chunk-6J2JC2RT.js +149 -0
  122. package/dist/chunk-7QLSKOSU.js +19 -0
  123. package/dist/chunk-7Z7Q4GGS.js +88 -0
  124. package/dist/chunk-A2A2YTMG.js +835 -0
  125. package/dist/chunk-AHV4LNB5.js +377 -0
  126. package/dist/chunk-AXPCESYO.js +197 -0
  127. package/dist/chunk-C2WCPBF7.js +86 -0
  128. package/dist/chunk-CJVVKOSR.js +73 -0
  129. package/dist/chunk-CULUZTWQ.js +2117 -0
  130. package/dist/chunk-CVQYGMSR.js +142 -0
  131. package/dist/chunk-CVWG2N3Y.js +16 -0
  132. package/dist/chunk-D2FX3EPW.js +15 -0
  133. package/dist/chunk-DB3ONZB4.js +44 -0
  134. package/dist/chunk-DE4Y6TCC.js +160 -0
  135. package/dist/chunk-E4FJTUH4.js +249 -0
  136. package/dist/chunk-EPCXUP3P.js +41 -0
  137. package/dist/chunk-EX3GAPA4.js +44 -0
  138. package/dist/chunk-EYK3GSRH.js +143 -0
  139. package/dist/chunk-GMXKITVA.js +70 -0
  140. package/dist/chunk-GPEGOGRJ.js +49 -0
  141. package/dist/chunk-GU3EJCVV.js +43 -0
  142. package/dist/chunk-HQ6G3B5R.js +59 -0
  143. package/dist/chunk-HZVVNGEW.js +22 -0
  144. package/dist/chunk-IPVKH2ST.js +231 -0
  145. package/dist/chunk-J5TIV3J6.js +238 -0
  146. package/dist/chunk-JU6W3XAU.js +64 -0
  147. package/dist/chunk-JYG4B33G.js +227 -0
  148. package/dist/chunk-JZTHGAPA.js +503 -0
  149. package/dist/chunk-KGDWDSNL.js +102 -0
  150. package/dist/chunk-KVQBWI5T.js +99 -0
  151. package/dist/chunk-KZERVKTD.js +16 -0
  152. package/dist/chunk-LXQ5FBBD.js +47 -0
  153. package/dist/chunk-M5ICYGHT.js +138 -0
  154. package/dist/chunk-M5JDZ45W.js +943 -0
  155. package/dist/chunk-MDEPU45E.js +1226 -0
  156. package/dist/chunk-MPWXGONV.js +157 -0
  157. package/dist/chunk-N6IOSZOE.js +185 -0
  158. package/dist/chunk-NGDD6TXY.js +192 -0
  159. package/dist/chunk-NQTHFF4W.js +2830 -0
  160. package/dist/chunk-OKXS7WDZ.js +68 -0
  161. package/dist/chunk-OLQRRFBX.js +21 -0
  162. package/dist/chunk-P7WQEVWA.js +307 -0
  163. package/dist/chunk-POFBE6ZY.js +12 -0
  164. package/dist/chunk-PQ4K74WL.js +30 -0
  165. package/dist/chunk-PUZZELE6.js +37 -0
  166. package/dist/chunk-Q7E4I6UA.js +767 -0
  167. package/dist/chunk-QCGNGEGE.js +15 -0
  168. package/dist/chunk-R7437YI3.js +151 -0
  169. package/dist/chunk-RHR6NARM.js +305 -0
  170. package/dist/chunk-SAXBC4AZ.js +60 -0
  171. package/dist/chunk-SGZJ5LYH.js +76 -0
  172. package/dist/chunk-SIFVFP6T.js +70 -0
  173. package/dist/chunk-SLFABHW3.js +150 -0
  174. package/dist/chunk-T7E75EKA.js +67 -0
  175. package/dist/chunk-TY4JT7W3.js +38 -0
  176. package/dist/chunk-U4TMAANR.js +111 -0
  177. package/dist/chunk-UI36QSBI.js +177 -0
  178. package/dist/chunk-VQKRG3AC.js +339 -0
  179. package/dist/chunk-WE2J62NC.js +1131 -0
  180. package/dist/chunk-XHKBHWLX.js +14 -0
  181. package/dist/chunk-ZSZSSJCV.js +275 -0
  182. package/dist/chunk-ZVSKMPBZ.js +135 -0
  183. package/dist/reapply-CW3MA66V.js +34 -0
  184. package/dist/src/index.d.ts +204 -0
  185. package/dist/src/index.js +64 -0
  186. package/package.json +108 -0
@@ -0,0 +1,147 @@
1
+ #!/usr/bin/env node
2
+ import {
3
+ createIo
4
+ } from "../chunk-U4TMAANR.js";
5
+ import {
6
+ exitOnHelpFlag
7
+ } from "../chunk-HZVVNGEW.js";
8
+ import {
9
+ parseFlags
10
+ } from "../chunk-GMXKITVA.js";
11
+ import {
12
+ clearKey,
13
+ readKeySource
14
+ } from "../chunk-P7WQEVWA.js";
15
+ import {
16
+ UsageError
17
+ } from "../chunk-7QLSKOSU.js";
18
+ import {
19
+ EXIT
20
+ } from "../chunk-KZERVKTD.js";
21
+ import "../chunk-DB3ONZB4.js";
22
+ import {
23
+ claudeJson,
24
+ codexConfigToml,
25
+ cursorUserMcp,
26
+ geminiSettings
27
+ } from "../chunk-A2A2YTMG.js";
28
+ import "../chunk-T7E75EKA.js";
29
+ import {
30
+ getBaseUrl
31
+ } from "../chunk-GPEGOGRJ.js";
32
+ import "../chunk-E4FJTUH4.js";
33
+ import "../chunk-NQTHFF4W.js";
34
+
35
+ // bin/pushary-logout.ts
36
+ import { existsSync } from "fs";
37
+ exitOnHelpFlag("logout");
38
+ var parseLogoutOptions = (argv) => {
39
+ const flags = parseFlags(argv, { bools: ["json", "revoke", "help", "h"], values: [] });
40
+ if (flags.command !== void 0 && flags.command !== "logout") {
41
+ throw new UsageError(`logout takes no positional arguments (got ${flags.command})`);
42
+ }
43
+ return { json: flags.bools.has("json"), revoke: flags.bools.has("revoke") };
44
+ };
45
+ var options;
46
+ try {
47
+ options = parseLogoutOptions(process.argv.slice(2));
48
+ } catch (err) {
49
+ process.stderr.write(` ! ${err instanceof Error ? err.message : String(err)}
50
+ `);
51
+ process.exit(EXIT.USAGE);
52
+ }
53
+ var { bold, dim, green, cyan, yellow } = createIo();
54
+ var say = options.json ? (line) => process.stderr.write(`${line}
55
+ `) : (line) => process.stdout.write(`${line}
56
+ `);
57
+ var AGENT_CONFIGS = [
58
+ { label: "Claude Code", path: claudeJson() },
59
+ { label: "Codex", path: codexConfigToml() },
60
+ { label: "Gemini CLI", path: geminiSettings() },
61
+ { label: "Cursor", path: cursorUserMcp() }
62
+ ];
63
+ var revokeRemotely = async (apiKey) => {
64
+ try {
65
+ const res = await fetch(`${getBaseUrl()}/api/v1/server/keys/self/revoke`, {
66
+ method: "POST",
67
+ headers: { Authorization: `Bearer ${apiKey}`, "Content-Type": "application/json" },
68
+ signal: AbortSignal.timeout(1e4)
69
+ });
70
+ if (res.status === 401) return { ok: true, detail: "the server had already stopped accepting it" };
71
+ if (!res.ok) return { ok: false, detail: `the server answered ${res.status}` };
72
+ return { ok: true, detail: "revoked server-side" };
73
+ } catch (err) {
74
+ return { ok: false, detail: err instanceof Error ? err.message : "network error" };
75
+ }
76
+ };
77
+ var main = async () => {
78
+ const before = readKeySource();
79
+ let revoked = null;
80
+ if (options.revoke) {
81
+ if (before.key) {
82
+ revoked = await revokeRemotely(before.key);
83
+ } else {
84
+ revoked = { ok: false, detail: "no key was stored here, so there was nothing to revoke" };
85
+ }
86
+ }
87
+ const result = clearKey();
88
+ const remaining = AGENT_CONFIGS.filter((entry) => existsSync(entry.path));
89
+ say("");
90
+ if (!result.removedFromConfig && result.rcLinesDisabled === 0 && before.kind !== "env") {
91
+ say(` ${dim("No key was stored on this machine. Nothing to remove.")}`);
92
+ } else {
93
+ say(` ${green("\u2713")} ${bold("Signed out.")}`);
94
+ if (result.removedFromConfig) say(` ${dim(`Key removed from ${result.configPath}`)}`);
95
+ if (result.rcLinesDisabled > 0) {
96
+ say(` ${dim(`Commented out ${result.rcLinesDisabled} export line in ${result.rcPath}`)}`);
97
+ }
98
+ }
99
+ if (revoked) {
100
+ say("");
101
+ if (revoked.ok) {
102
+ say(` ${green("\u2713")} Key ${revoked.detail}. It will not work anywhere else either.`);
103
+ } else {
104
+ say(` ${yellow("!")} Could not revoke the key server-side: ${revoked.detail}`);
105
+ say(` ${dim("It is still valid. Revoke it at")} ${cyan("pushary.com/dashboard/agent/settings")}`);
106
+ }
107
+ }
108
+ if (before.kind === "env") {
109
+ say("");
110
+ say(` ${yellow("!")} PUSHARY_API_KEY is set in this shell, and a child process cannot unset it.`);
111
+ say(` ${dim("Run")} ${cyan("unset PUSHARY_API_KEY")} ${dim("here, or open a new terminal.")}`);
112
+ }
113
+ if (remaining.length > 0) {
114
+ say("");
115
+ say(` ${dim("Still holding a copy of the key, untouched by logout:")}`);
116
+ for (const entry of remaining) say(` ${dim(`\u2022 ${entry.label} ${entry.path}`)}`);
117
+ say(` ${dim("Run")} ${cyan("pushary clean")} ${dim("to remove Pushary from those too.")}`);
118
+ }
119
+ say("");
120
+ say(` ${dim("The key itself is still valid server-side. Revoke it at")} ${cyan("pushary.com/dashboard/agent/settings")}`);
121
+ say("");
122
+ if (options.json) {
123
+ process.stdout.write(
124
+ `${JSON.stringify(
125
+ {
126
+ ok: true,
127
+ removedFromConfig: result.removedFromConfig,
128
+ configPath: result.configPath,
129
+ rcPath: result.rcPath,
130
+ rcLinesDisabled: result.rcLinesDisabled,
131
+ envStillSet: before.kind === "env",
132
+ revoked: revoked === null ? null : revoked.ok,
133
+ agentConfigsRetainingKey: remaining.map((entry) => entry.path)
134
+ },
135
+ null,
136
+ 2
137
+ )}
138
+ `
139
+ );
140
+ }
141
+ process.exit(EXIT.OK);
142
+ };
143
+ main().catch((err) => {
144
+ process.stderr.write(` ! logout failed: ${err instanceof Error ? err.message : String(err)}
145
+ `);
146
+ process.exit(EXIT.FAILED);
147
+ });
@@ -0,0 +1 @@
1
+ #!/usr/bin/env node
@@ -0,0 +1,114 @@
1
+ #!/usr/bin/env node
2
+ import {
3
+ MCP_BRIDGE_PATH,
4
+ bridgeError,
5
+ createMcpStdioBridge,
6
+ parseBridgeLine
7
+ } from "../chunk-SLFABHW3.js";
8
+ import "../chunk-M5ICYGHT.js";
9
+ import "../chunk-2ABTSGFT.js";
10
+ import {
11
+ installNetworkDefaults
12
+ } from "../chunk-2OY3ZZ5N.js";
13
+ import "../chunk-LXQ5FBBD.js";
14
+ import "../chunk-7QLSKOSU.js";
15
+ import {
16
+ EXIT
17
+ } from "../chunk-KZERVKTD.js";
18
+ import "../chunk-A2A2YTMG.js";
19
+ import "../chunk-T7E75EKA.js";
20
+ import {
21
+ getApiKey,
22
+ getBaseUrl
23
+ } from "../chunk-GPEGOGRJ.js";
24
+ import "../chunk-E4FJTUH4.js";
25
+ import "../chunk-NQTHFF4W.js";
26
+
27
+ // src/mcp-stdio-stream.ts
28
+ var MCP_MAX_IN_FLIGHT = 16;
29
+ var MCP_CONTROL_RESERVE = 4;
30
+ var MCP_MAX_LINE_BYTES = 1024 * 1024;
31
+ var isControl = (line) => {
32
+ const parsed = parseBridgeLine(line);
33
+ if (!parsed.ok || typeof parsed.payload !== "object" || parsed.payload === null || Array.isArray(parsed.payload)) return false;
34
+ const message = parsed.payload;
35
+ if (!("method" in message)) return false;
36
+ if (message.method === "notifications/cancelled") return true;
37
+ if (message.method !== "tools/call" || !("params" in message)) return false;
38
+ const params = message.params;
39
+ return typeof params === "object" && params !== null && "name" in params && params.name === "cancel_question";
40
+ };
41
+ var writeMcpMessage = (output, message) => new Promise((resolve, reject) => {
42
+ output.write(`${JSON.stringify(message)}
43
+ `, (error) => error ? reject(error) : resolve());
44
+ });
45
+ var runMcpStdioStream = async (input, bridge2, emit) => {
46
+ const pending = /* @__PURE__ */ new Set();
47
+ let failure;
48
+ const line = Buffer.allocUnsafe(MCP_MAX_LINE_BYTES);
49
+ let lineLength = 0;
50
+ let discarding = false;
51
+ const forward = async (text) => {
52
+ if (!text.trim()) return;
53
+ const limit = MCP_MAX_IN_FLIGHT + (isControl(text) ? MCP_CONTROL_RESERVE : 0);
54
+ if (pending.size >= limit) {
55
+ await bridge2.reject(text, "Pushary MCP bridge is busy. Retry after an outstanding request finishes.");
56
+ return;
57
+ }
58
+ const task = bridge2.forward(text).catch((error) => {
59
+ failure = error;
60
+ }).finally(() => pending.delete(task));
61
+ pending.add(task);
62
+ };
63
+ try {
64
+ for await (const chunk of input) {
65
+ const bytes = Buffer.isBuffer(chunk) ? chunk : Buffer.from(chunk);
66
+ let start = 0;
67
+ while (start < bytes.length) {
68
+ if (failure) throw failure;
69
+ const newline = bytes.indexOf(10, start);
70
+ const end = newline < 0 ? bytes.length : newline;
71
+ if (!discarding) {
72
+ if (lineLength + end - start > MCP_MAX_LINE_BYTES) {
73
+ lineLength = 0;
74
+ discarding = true;
75
+ await emit(bridgeError(null, "MCP input line exceeds the 1 MiB limit."));
76
+ } else {
77
+ lineLength += bytes.copy(line, lineLength, start, end);
78
+ }
79
+ }
80
+ if (newline >= 0) {
81
+ if (!discarding) await forward(line.toString("utf8", 0, lineLength));
82
+ lineLength = 0;
83
+ discarding = false;
84
+ }
85
+ start = end + 1;
86
+ }
87
+ }
88
+ if (!discarding && lineLength > 0) await forward(line.toString("utf8", 0, lineLength));
89
+ } finally {
90
+ await Promise.all(pending);
91
+ }
92
+ if (failure) throw failure;
93
+ };
94
+
95
+ // bin/pushary-mcp.ts
96
+ installNetworkDefaults();
97
+ var readApiKey = () => {
98
+ try {
99
+ return getApiKey();
100
+ } catch {
101
+ return null;
102
+ }
103
+ };
104
+ var writeMessage = (message) => writeMcpMessage(process.stdout, message);
105
+ var bridge = createMcpStdioBridge({
106
+ endpoint: `${getBaseUrl()}${MCP_BRIDGE_PATH}`,
107
+ apiKey: readApiKey,
108
+ fetchImpl: globalThis.fetch,
109
+ emit: writeMessage
110
+ });
111
+ runMcpStdioStream(process.stdin, bridge, writeMessage).catch((error) => {
112
+ console.error(error instanceof Error ? error.message : String(error));
113
+ process.exitCode = EXIT.FAILED;
114
+ });
@@ -0,0 +1 @@
1
+ #!/usr/bin/env node
@@ -0,0 +1,130 @@
1
+ #!/usr/bin/env node
2
+ import {
3
+ exitOnFailedResponse
4
+ } from "../chunk-EX3GAPA4.js";
5
+ import {
6
+ createIo
7
+ } from "../chunk-U4TMAANR.js";
8
+ import {
9
+ exitOnHelpFlag
10
+ } from "../chunk-HZVVNGEW.js";
11
+ import {
12
+ rejectUnknownFlags
13
+ } from "../chunk-GMXKITVA.js";
14
+ import "../chunk-2ABTSGFT.js";
15
+ import "../chunk-2OY3ZZ5N.js";
16
+ import "../chunk-LXQ5FBBD.js";
17
+ import {
18
+ UsageError
19
+ } from "../chunk-7QLSKOSU.js";
20
+ import {
21
+ EXIT
22
+ } from "../chunk-KZERVKTD.js";
23
+ import "../chunk-A2A2YTMG.js";
24
+ import "../chunk-T7E75EKA.js";
25
+ import {
26
+ getApiKey,
27
+ getBaseUrl
28
+ } from "../chunk-GPEGOGRJ.js";
29
+ import "../chunk-E4FJTUH4.js";
30
+ import "../chunk-NQTHFF4W.js";
31
+
32
+ // src/cli/mode-request.ts
33
+ var parseDuration = (value) => {
34
+ const match = value.match(/^(\d+)(m|h)$/);
35
+ if (!match) return null;
36
+ const amount = Number(match[1]);
37
+ return match[2] === "h" ? amount * 3600 : amount * 60;
38
+ };
39
+ var modeRequestBody = (mode, duration) => {
40
+ if (duration === void 0) return { mode, permanent: true };
41
+ const ttlSeconds = parseDuration(duration);
42
+ return ttlSeconds ? { mode, ttlSeconds } : null;
43
+ };
44
+
45
+ // bin/pushary-mode.ts
46
+ exitOnHelpFlag("mode");
47
+ var VALID_MODES = ["push_only", "push_first", "terminal_only", "notify_only"];
48
+ var { dim, green, cyan, yellow } = createIo();
49
+ {
50
+ const raw = process.argv.slice(2);
51
+ const positional = raw[0] === "mode" ? raw.slice(1) : raw;
52
+ try {
53
+ rejectUnknownFlags(positional, ["--for"]);
54
+ } catch (err) {
55
+ process.stderr.write(` ! ${err instanceof Error ? err.message : String(err)}
56
+ `);
57
+ process.exit(EXIT.USAGE);
58
+ }
59
+ }
60
+ var main = async () => {
61
+ const apiKey = getApiKey();
62
+ const baseUrl = getBaseUrl();
63
+ const rest = process.argv.slice(2);
64
+ const args = rest[0] === "mode" ? rest.slice(1) : rest;
65
+ const mode = args[0];
66
+ const forFlag = args[1];
67
+ const forValue = args[2];
68
+ const headers = {
69
+ "Authorization": `Bearer ${apiKey}`,
70
+ "Content-Type": "application/json"
71
+ };
72
+ if (!mode || mode === "status") {
73
+ const res2 = await fetch(`${baseUrl}/api/mcp/mode`, { headers });
74
+ if (!res2.ok) await exitOnFailedResponse(res2, baseUrl);
75
+ const data2 = await res2.json();
76
+ if (!data2.override) {
77
+ console.log(` Mode: ${cyan("default")} ${dim("(using per-tool policies)")}`);
78
+ } else {
79
+ console.log(` Mode: ${green(data2.override.mode)}`);
80
+ if (data2.override.expiresAt) {
81
+ console.log(` Expires: ${new Date(data2.override.expiresAt).toLocaleString()}`);
82
+ } else {
83
+ console.log(` ${dim("Sticky (no expiry)")}`);
84
+ }
85
+ }
86
+ return;
87
+ }
88
+ if (mode === "clear" || mode === "reset") {
89
+ const res2 = await fetch(`${baseUrl}/api/mcp/mode`, { method: "DELETE", headers });
90
+ if (!res2.ok) await exitOnFailedResponse(res2, baseUrl);
91
+ console.log(` ${green("\u2713")} Mode override cleared \u2014 using per-tool policies`);
92
+ return;
93
+ }
94
+ if (!VALID_MODES.includes(mode)) {
95
+ console.log(` ${yellow("!")} Invalid mode: ${mode}`);
96
+ console.log(` Valid modes: ${VALID_MODES.join(", ")}`);
97
+ console.log(` ${dim("Usage: pushary mode <mode> [--for <duration>]")}`);
98
+ console.log(` ${dim("Example: pushary mode push_only --for 30m")}`);
99
+ process.exit(EXIT.USAGE);
100
+ }
101
+ if (forFlag === "--for" && !forValue) {
102
+ console.log(` ${yellow("!")} --for needs a duration ${dim("(use e.g. 30m, 1h)")}`);
103
+ process.exit(EXIT.USAGE);
104
+ }
105
+ const request = modeRequestBody(mode, forFlag === "--for" ? forValue : void 0);
106
+ if (!request) {
107
+ console.log(` ${yellow("!")} Invalid duration: ${forValue} ${dim("(use e.g. 30m, 1h)")}`);
108
+ process.exit(EXIT.USAGE);
109
+ }
110
+ const res = await fetch(`${baseUrl}/api/mcp/mode`, {
111
+ method: "PUT",
112
+ headers,
113
+ body: JSON.stringify(request)
114
+ });
115
+ if (!res.ok) await exitOnFailedResponse(res, baseUrl);
116
+ const data = await res.json();
117
+ console.log(` ${green("\u2713")} Mode set to ${cyan(data.override.mode)}${data.permanent ? dim(" (until you change it)") : ""}`);
118
+ if (data.override.expiresAt) {
119
+ console.log(` Expires: ${new Date(data.override.expiresAt).toLocaleString()}`);
120
+ }
121
+ };
122
+ main().catch((err) => {
123
+ if (err instanceof UsageError) {
124
+ process.stderr.write(` ! ${err.message}
125
+ `);
126
+ process.exit(EXIT.USAGE);
127
+ }
128
+ console.error(` ${yellow("!")} ${err instanceof Error ? err.message : err}`);
129
+ process.exit(1);
130
+ });
@@ -0,0 +1 @@
1
+ #!/usr/bin/env node
@@ -0,0 +1,56 @@
1
+ #!/usr/bin/env node
2
+ import {
3
+ activeHookSource,
4
+ activeIdentity
5
+ } from "../chunk-J5TIV3J6.js";
6
+ import "../chunk-AXPCESYO.js";
7
+ import {
8
+ readHookInput
9
+ } from "../chunk-KGDWDSNL.js";
10
+ import "../chunk-JZTHGAPA.js";
11
+ import "../chunk-SGZJ5LYH.js";
12
+ import "../chunk-EYK3GSRH.js";
13
+ import "../chunk-ZVSKMPBZ.js";
14
+ import "../chunk-C2WCPBF7.js";
15
+ import "../chunk-6J2JC2RT.js";
16
+ import "../chunk-WE2J62NC.js";
17
+ import "../chunk-3EVPNIBE.js";
18
+ import "../chunk-OKXS7WDZ.js";
19
+ import "../chunk-MPWXGONV.js";
20
+ import "../chunk-SAXBC4AZ.js";
21
+ import "../chunk-OLQRRFBX.js";
22
+ import "../chunk-XHKBHWLX.js";
23
+ import {
24
+ handleNotification
25
+ } from "../chunk-CULUZTWQ.js";
26
+ import "../chunk-N6IOSZOE.js";
27
+ import "../chunk-EPCXUP3P.js";
28
+ import "../chunk-NGDD6TXY.js";
29
+ import "../chunk-CVQYGMSR.js";
30
+ import "../chunk-POFBE6ZY.js";
31
+ import "../chunk-GMXKITVA.js";
32
+ import "../chunk-P7WQEVWA.js";
33
+ import "../chunk-M5ICYGHT.js";
34
+ import "../chunk-2ABTSGFT.js";
35
+ import "../chunk-2OY3ZZ5N.js";
36
+ import "../chunk-LXQ5FBBD.js";
37
+ import "../chunk-7QLSKOSU.js";
38
+ import "../chunk-KZERVKTD.js";
39
+ import "../chunk-DB3ONZB4.js";
40
+ import "../chunk-A2A2YTMG.js";
41
+ import "../chunk-T7E75EKA.js";
42
+ import "../chunk-GPEGOGRJ.js";
43
+ import "../chunk-E4FJTUH4.js";
44
+ import "../chunk-NQTHFF4W.js";
45
+
46
+ // bin/pushary-notification-hook.ts
47
+ var AGENT = activeIdentity(process.argv);
48
+ var main = async () => {
49
+ const input = await readHookInput(activeHookSource(process.argv), "Notification");
50
+ if (!input) return;
51
+ try {
52
+ await handleNotification(input, AGENT);
53
+ } catch {
54
+ }
55
+ };
56
+ main();
@@ -0,0 +1 @@
1
+ #!/usr/bin/env node