@pushary/agent-hooks 0.60.0 → 0.62.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.
- package/CHANGELOG.md +161 -0
- package/README.md +52 -9
- package/dist/bin/pushary-claude.js +6 -6
- package/dist/bin/pushary-clean.js +83 -38
- package/dist/bin/pushary-codex-hook.js +6 -6
- package/dist/bin/pushary-codex.js +4 -4
- package/dist/bin/pushary-connect.d.ts +1 -0
- package/dist/bin/pushary-connect.js +92 -0
- package/dist/bin/pushary-daemon.js +42 -5
- package/dist/bin/pushary-doctor.js +246 -71
- package/dist/bin/pushary-gemini-hook.js +6 -6
- package/dist/bin/pushary-hook.js +10 -5
- package/dist/bin/pushary-login.d.ts +1 -0
- package/dist/bin/pushary-login.js +156 -0
- package/dist/bin/pushary-logout.d.ts +1 -0
- package/dist/bin/pushary-logout.js +144 -0
- package/dist/bin/pushary-mode.js +24 -13
- package/dist/bin/pushary-notification-hook.js +4 -4
- package/dist/bin/pushary-permission-denied-hook.js +5 -5
- package/dist/bin/pushary-permission-hook.js +5 -5
- package/dist/bin/pushary-post-hook.js +4 -4
- package/dist/bin/pushary-prompt-hook.js +4 -4
- package/dist/bin/pushary-session-end-hook.js +4 -4
- package/dist/bin/pushary-session-start-hook.js +4 -4
- package/dist/bin/pushary-setup.js +769 -518
- package/dist/bin/pushary-stats.js +6 -1
- package/dist/bin/pushary-status.d.ts +1 -0
- package/dist/bin/pushary-status.js +206 -0
- package/dist/bin/pushary-stop-hook.js +4 -4
- package/dist/bin/pushary-stopfailure-hook.js +4 -4
- package/dist/bin/pushary-suggestions.js +10 -5
- package/dist/bin/pushary-upgrade.js +184 -14
- package/dist/bin/pushary-wait.js +21 -12
- package/dist/bin/pushary.js +42 -60
- package/dist/chunk-247C4RE5.js +236 -0
- package/dist/{chunk-NKXSILEW.js → chunk-2UMNXADU.js} +18 -2
- package/dist/chunk-3EGEA4KH.js +44 -0
- package/dist/chunk-3O27ZSRE.js +569 -0
- package/dist/{chunk-BE5X3WXL.js → chunk-5SO3CEGJ.js} +5 -5
- package/dist/chunk-7QLSKOSU.js +19 -0
- package/dist/chunk-E2U35RLD.js +108 -0
- package/dist/chunk-ER657KRJ.js +168 -0
- package/dist/{chunk-WNRYRN2R.js → chunk-HIIBSYFJ.js} +5 -5
- package/dist/{chunk-DWED7BS3.js → chunk-HNTKTK5B.js} +1 -1
- package/dist/chunk-IIZZYUWK.js +18 -0
- package/dist/{chunk-J7JWI3KU.js → chunk-MUEW424A.js} +19 -1
- package/dist/chunk-N4DA4CJB.js +57 -0
- package/dist/chunk-N7XJ4L2W.js +79 -0
- package/dist/chunk-ONVEYEVR.js +44 -0
- package/dist/chunk-QHOVJXOT.js +255 -0
- package/dist/chunk-SP7OZXCQ.js +224 -0
- package/dist/chunk-TX7KBKT7.js +79 -0
- package/dist/chunk-UXXRRXUS.js +93 -0
- package/dist/chunk-YJ7YZRVV.js +217 -0
- package/dist/src/index.js +5 -5
- package/package.json +11 -4
- package/dist/chunk-BQLCELYC.js +0 -332
|
@@ -0,0 +1,156 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
import {
|
|
3
|
+
runBrowserLogin
|
|
4
|
+
} from "../chunk-QHOVJXOT.js";
|
|
5
|
+
import "../chunk-3EGEA4KH.js";
|
|
6
|
+
import {
|
|
7
|
+
parseFlags
|
|
8
|
+
} from "../chunk-N4DA4CJB.js";
|
|
9
|
+
import {
|
|
10
|
+
readKeySource,
|
|
11
|
+
writeKey
|
|
12
|
+
} from "../chunk-247C4RE5.js";
|
|
13
|
+
import {
|
|
14
|
+
checkApiKey,
|
|
15
|
+
describeKeyCheck
|
|
16
|
+
} from "../chunk-YJ7YZRVV.js";
|
|
17
|
+
import {
|
|
18
|
+
createIo
|
|
19
|
+
} from "../chunk-TX7KBKT7.js";
|
|
20
|
+
import {
|
|
21
|
+
UsageError
|
|
22
|
+
} from "../chunk-7QLSKOSU.js";
|
|
23
|
+
import "../chunk-BC3VCZ3E.js";
|
|
24
|
+
import {
|
|
25
|
+
exitOnHelpFlag
|
|
26
|
+
} from "../chunk-IIZZYUWK.js";
|
|
27
|
+
import {
|
|
28
|
+
EXIT,
|
|
29
|
+
getPackageVersion
|
|
30
|
+
} from "../chunk-SP7OZXCQ.js";
|
|
31
|
+
import {
|
|
32
|
+
isValidApiKey
|
|
33
|
+
} from "../chunk-DQAN3JQP.js";
|
|
34
|
+
import "../chunk-2UMNXADU.js";
|
|
35
|
+
|
|
36
|
+
// bin/pushary-login.ts
|
|
37
|
+
exitOnHelpFlag("login");
|
|
38
|
+
var parseLoginOptions = (argv) => {
|
|
39
|
+
const flags = parseFlags(argv, {
|
|
40
|
+
bools: ["with-token", "no-browser", "json", "force", "help", "h"],
|
|
41
|
+
values: []
|
|
42
|
+
});
|
|
43
|
+
if (flags.command !== void 0 && flags.command !== "login") {
|
|
44
|
+
throw new UsageError(`login takes no positional arguments (got ${flags.command})`);
|
|
45
|
+
}
|
|
46
|
+
return {
|
|
47
|
+
withToken: flags.bools.has("with-token"),
|
|
48
|
+
noBrowser: flags.bools.has("no-browser"),
|
|
49
|
+
json: flags.bools.has("json"),
|
|
50
|
+
force: flags.bools.has("force")
|
|
51
|
+
};
|
|
52
|
+
};
|
|
53
|
+
var options;
|
|
54
|
+
try {
|
|
55
|
+
options = parseLoginOptions(process.argv.slice(2));
|
|
56
|
+
} catch (err) {
|
|
57
|
+
process.stderr.write(` ! ${err instanceof Error ? err.message : String(err)}
|
|
58
|
+
`);
|
|
59
|
+
process.stderr.write(" Run `pushary login --help` for the full list.\n");
|
|
60
|
+
process.exit(EXIT.USAGE);
|
|
61
|
+
}
|
|
62
|
+
var { bold, dim, green, cyan, yellow } = createIo();
|
|
63
|
+
var check = green("\u2713");
|
|
64
|
+
var say = options.json ? (line) => process.stderr.write(`${line}
|
|
65
|
+
`) : (line) => process.stdout.write(`${line}
|
|
66
|
+
`);
|
|
67
|
+
var emit = (payload) => {
|
|
68
|
+
if (options.json) process.stdout.write(`${JSON.stringify(payload, null, 2)}
|
|
69
|
+
`);
|
|
70
|
+
};
|
|
71
|
+
var readStdin = async () => {
|
|
72
|
+
const chunks = [];
|
|
73
|
+
for await (const chunk of process.stdin) chunks.push(Buffer.from(chunk));
|
|
74
|
+
return Buffer.concat(chunks).toString("utf8").trim();
|
|
75
|
+
};
|
|
76
|
+
var store = (apiKey, siteSlug, keyName) => {
|
|
77
|
+
const result = writeKey(apiKey);
|
|
78
|
+
say("");
|
|
79
|
+
say(` ${check} ${bold("Signed in.")}${siteSlug ? ` ${dim(`Site ${siteSlug}`)}` : ""}`);
|
|
80
|
+
say(` ${dim(`Key saved to ${result.configPath}`)}`);
|
|
81
|
+
if (result.rc.kind === "written" || result.rc.kind === "updated") {
|
|
82
|
+
say(` ${dim(`Shell export ${result.rc.kind} in ${result.rc.path}`)}`);
|
|
83
|
+
} else if (result.rc.kind === "declined") {
|
|
84
|
+
say(` ${yellow("!")} ${dim(`Left ${result.rc.path} alone: line ${result.rc.declinedLine} already sets PUSHARY_API_KEY.`)}`);
|
|
85
|
+
}
|
|
86
|
+
emit({ ok: true, siteSlug, keyName, configPath: result.configPath, rc: result.rc.kind });
|
|
87
|
+
};
|
|
88
|
+
var loginWithToken = async () => {
|
|
89
|
+
const token = await readStdin();
|
|
90
|
+
if (!token) {
|
|
91
|
+
say(` ${yellow("!")} Nothing arrived on stdin. Pipe the key in: pushary login --with-token < key.txt`);
|
|
92
|
+
emit({ ok: false, reason: "no_input" });
|
|
93
|
+
process.exit(EXIT.INPUT_REQUIRED);
|
|
94
|
+
}
|
|
95
|
+
if (!isValidApiKey(token)) {
|
|
96
|
+
say(` ${yellow("!")} That does not look like a Pushary key. Expected pk_xxx.xxx`);
|
|
97
|
+
emit({ ok: false, reason: "malformed" });
|
|
98
|
+
process.exit(EXIT.USAGE);
|
|
99
|
+
}
|
|
100
|
+
const verdict = await checkApiKey(token);
|
|
101
|
+
if (verdict.kind !== "ok") {
|
|
102
|
+
const report = describeKeyCheck(verdict);
|
|
103
|
+
say(` ${yellow("!")} ${report.message}`);
|
|
104
|
+
for (const line of report.next) say(` ${dim(line)}`);
|
|
105
|
+
emit({ ok: false, reason: verdict.kind });
|
|
106
|
+
if (verdict.kind !== "unreachable") process.exit(report.exitCode);
|
|
107
|
+
}
|
|
108
|
+
store(token, verdict.kind === "ok" ? verdict.identity.siteSlug : "", "pasted key");
|
|
109
|
+
process.exit(EXIT.OK);
|
|
110
|
+
};
|
|
111
|
+
var main = async () => {
|
|
112
|
+
if (options.withToken) await loginWithToken();
|
|
113
|
+
if (!options.force) {
|
|
114
|
+
const existing = readKeySource();
|
|
115
|
+
if (existing.key) {
|
|
116
|
+
const verdict = await checkApiKey(existing.key);
|
|
117
|
+
if (verdict.kind === "ok") {
|
|
118
|
+
say("");
|
|
119
|
+
say(` ${check} Already signed in ${dim(`(${verdict.identity.siteSlug})`)}`);
|
|
120
|
+
say(` ${dim("Run")} ${cyan("pushary login --force")} ${dim("to replace this key.")}`);
|
|
121
|
+
emit({ ok: true, reused: true, siteSlug: verdict.identity.siteSlug });
|
|
122
|
+
process.exit(EXIT.OK);
|
|
123
|
+
}
|
|
124
|
+
}
|
|
125
|
+
}
|
|
126
|
+
const outcome = await runBrowserLogin(
|
|
127
|
+
{ say, bold, dim, cyan, yellow },
|
|
128
|
+
{ cliVersion: getPackageVersion(), noBrowser: options.noBrowser }
|
|
129
|
+
);
|
|
130
|
+
if (outcome.kind === "ok") {
|
|
131
|
+
store(outcome.apiKey, outcome.siteSlug, outcome.keyName);
|
|
132
|
+
process.exit(EXIT.OK);
|
|
133
|
+
}
|
|
134
|
+
if (outcome.kind === "unavailable") {
|
|
135
|
+
say(` ${yellow("!")} Couldn't start a login ${dim(`(${outcome.detail})`)}`);
|
|
136
|
+
say(` ${dim("Check your connection, or paste a key with")} ${cyan("pushary login --with-token < key.txt")}`);
|
|
137
|
+
emit({ ok: false, reason: "unreachable", detail: outcome.detail });
|
|
138
|
+
process.exit(EXIT.UNREACHABLE);
|
|
139
|
+
}
|
|
140
|
+
if (outcome.kind === "rejected") {
|
|
141
|
+
say("");
|
|
142
|
+
say(` ${yellow("!")} That request was rejected in the browser. Nothing was written.`);
|
|
143
|
+
emit({ ok: false, reason: "rejected" });
|
|
144
|
+
process.exit(EXIT.NOT_CONFIGURED);
|
|
145
|
+
}
|
|
146
|
+
say("");
|
|
147
|
+
say(` ${yellow("!")} The code expired before it was approved.`);
|
|
148
|
+
say(` ${dim("Run")} ${cyan("pushary login")} ${dim("for a fresh one.")}`);
|
|
149
|
+
emit({ ok: false, reason: "expired" });
|
|
150
|
+
process.exit(EXIT.NOT_CONFIGURED);
|
|
151
|
+
};
|
|
152
|
+
main().catch((err) => {
|
|
153
|
+
process.stderr.write(` ! login failed: ${err instanceof Error ? err.message : String(err)}
|
|
154
|
+
`);
|
|
155
|
+
process.exit(EXIT.FAILED);
|
|
156
|
+
});
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
@@ -0,0 +1,144 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
import {
|
|
3
|
+
codexConfigToml
|
|
4
|
+
} from "../chunk-ER657KRJ.js";
|
|
5
|
+
import {
|
|
6
|
+
parseFlags
|
|
7
|
+
} from "../chunk-N4DA4CJB.js";
|
|
8
|
+
import {
|
|
9
|
+
clearKey,
|
|
10
|
+
readKeySource
|
|
11
|
+
} from "../chunk-247C4RE5.js";
|
|
12
|
+
import {
|
|
13
|
+
createIo
|
|
14
|
+
} from "../chunk-TX7KBKT7.js";
|
|
15
|
+
import {
|
|
16
|
+
UsageError
|
|
17
|
+
} from "../chunk-7QLSKOSU.js";
|
|
18
|
+
import "../chunk-BC3VCZ3E.js";
|
|
19
|
+
import {
|
|
20
|
+
exitOnHelpFlag
|
|
21
|
+
} from "../chunk-IIZZYUWK.js";
|
|
22
|
+
import {
|
|
23
|
+
EXIT
|
|
24
|
+
} from "../chunk-SP7OZXCQ.js";
|
|
25
|
+
import "../chunk-DQAN3JQP.js";
|
|
26
|
+
import {
|
|
27
|
+
getBaseUrl
|
|
28
|
+
} from "../chunk-2UMNXADU.js";
|
|
29
|
+
|
|
30
|
+
// bin/pushary-logout.ts
|
|
31
|
+
import { existsSync } from "fs";
|
|
32
|
+
import { homedir } from "os";
|
|
33
|
+
import { join } from "path";
|
|
34
|
+
exitOnHelpFlag("logout");
|
|
35
|
+
var parseLogoutOptions = (argv) => {
|
|
36
|
+
const flags = parseFlags(argv, { bools: ["json", "revoke", "help", "h"], values: [] });
|
|
37
|
+
if (flags.command !== void 0 && flags.command !== "logout") {
|
|
38
|
+
throw new UsageError(`logout takes no positional arguments (got ${flags.command})`);
|
|
39
|
+
}
|
|
40
|
+
return { json: flags.bools.has("json"), revoke: flags.bools.has("revoke") };
|
|
41
|
+
};
|
|
42
|
+
var options;
|
|
43
|
+
try {
|
|
44
|
+
options = parseLogoutOptions(process.argv.slice(2));
|
|
45
|
+
} catch (err) {
|
|
46
|
+
process.stderr.write(` ! ${err instanceof Error ? err.message : String(err)}
|
|
47
|
+
`);
|
|
48
|
+
process.exit(EXIT.USAGE);
|
|
49
|
+
}
|
|
50
|
+
var { bold, dim, green, cyan, yellow } = createIo();
|
|
51
|
+
var say = options.json ? (line) => process.stderr.write(`${line}
|
|
52
|
+
`) : (line) => process.stdout.write(`${line}
|
|
53
|
+
`);
|
|
54
|
+
var AGENT_CONFIGS = [
|
|
55
|
+
{ label: "Claude Code", path: join(homedir(), ".claude.json") },
|
|
56
|
+
{ label: "Codex", path: codexConfigToml() },
|
|
57
|
+
{ label: "Gemini CLI", path: join(homedir(), ".gemini", "settings.json") },
|
|
58
|
+
{ label: "Cursor", path: join(homedir(), ".cursor", "mcp.json") }
|
|
59
|
+
];
|
|
60
|
+
var revokeRemotely = async (apiKey) => {
|
|
61
|
+
try {
|
|
62
|
+
const res = await fetch(`${getBaseUrl()}/api/v1/server/keys/self/revoke`, {
|
|
63
|
+
method: "POST",
|
|
64
|
+
headers: { Authorization: `Bearer ${apiKey}`, "Content-Type": "application/json" },
|
|
65
|
+
signal: AbortSignal.timeout(1e4)
|
|
66
|
+
});
|
|
67
|
+
if (res.status === 401) return { ok: true, detail: "the server had already stopped accepting it" };
|
|
68
|
+
if (!res.ok) return { ok: false, detail: `the server answered ${res.status}` };
|
|
69
|
+
return { ok: true, detail: "revoked server-side" };
|
|
70
|
+
} catch (err) {
|
|
71
|
+
return { ok: false, detail: err instanceof Error ? err.message : "network error" };
|
|
72
|
+
}
|
|
73
|
+
};
|
|
74
|
+
var main = async () => {
|
|
75
|
+
const before = readKeySource();
|
|
76
|
+
let revoked = null;
|
|
77
|
+
if (options.revoke) {
|
|
78
|
+
if (before.key) {
|
|
79
|
+
revoked = await revokeRemotely(before.key);
|
|
80
|
+
} else {
|
|
81
|
+
revoked = { ok: false, detail: "no key was stored here, so there was nothing to revoke" };
|
|
82
|
+
}
|
|
83
|
+
}
|
|
84
|
+
const result = clearKey();
|
|
85
|
+
const remaining = AGENT_CONFIGS.filter((entry) => existsSync(entry.path));
|
|
86
|
+
say("");
|
|
87
|
+
if (!result.removedFromConfig && result.rcLinesDisabled === 0 && before.kind !== "env") {
|
|
88
|
+
say(` ${dim("No key was stored on this machine. Nothing to remove.")}`);
|
|
89
|
+
} else {
|
|
90
|
+
say(` ${green("\u2713")} ${bold("Signed out.")}`);
|
|
91
|
+
if (result.removedFromConfig) say(` ${dim(`Key removed from ${result.configPath}`)}`);
|
|
92
|
+
if (result.rcLinesDisabled > 0) {
|
|
93
|
+
say(` ${dim(`Commented out ${result.rcLinesDisabled} export line in ${result.rcPath}`)}`);
|
|
94
|
+
}
|
|
95
|
+
}
|
|
96
|
+
if (revoked) {
|
|
97
|
+
say("");
|
|
98
|
+
if (revoked.ok) {
|
|
99
|
+
say(` ${green("\u2713")} Key ${revoked.detail}. It will not work anywhere else either.`);
|
|
100
|
+
} else {
|
|
101
|
+
say(` ${yellow("!")} Could not revoke the key server-side: ${revoked.detail}`);
|
|
102
|
+
say(` ${dim("It is still valid. Revoke it at")} ${cyan("pushary.com/dashboard/agent/settings")}`);
|
|
103
|
+
}
|
|
104
|
+
}
|
|
105
|
+
if (before.kind === "env") {
|
|
106
|
+
say("");
|
|
107
|
+
say(` ${yellow("!")} PUSHARY_API_KEY is set in this shell, and a child process cannot unset it.`);
|
|
108
|
+
say(` ${dim("Run")} ${cyan("unset PUSHARY_API_KEY")} ${dim("here, or open a new terminal.")}`);
|
|
109
|
+
}
|
|
110
|
+
if (remaining.length > 0) {
|
|
111
|
+
say("");
|
|
112
|
+
say(` ${dim("Still holding a copy of the key, untouched by logout:")}`);
|
|
113
|
+
for (const entry of remaining) say(` ${dim(`\u2022 ${entry.label} ${entry.path}`)}`);
|
|
114
|
+
say(` ${dim("Run")} ${cyan("pushary clean")} ${dim("to remove Pushary from those too.")}`);
|
|
115
|
+
}
|
|
116
|
+
say("");
|
|
117
|
+
say(` ${dim("The key itself is still valid server-side. Revoke it at")} ${cyan("pushary.com/dashboard/agent/settings")}`);
|
|
118
|
+
say("");
|
|
119
|
+
if (options.json) {
|
|
120
|
+
process.stdout.write(
|
|
121
|
+
`${JSON.stringify(
|
|
122
|
+
{
|
|
123
|
+
ok: true,
|
|
124
|
+
removedFromConfig: result.removedFromConfig,
|
|
125
|
+
configPath: result.configPath,
|
|
126
|
+
rcPath: result.rcPath,
|
|
127
|
+
rcLinesDisabled: result.rcLinesDisabled,
|
|
128
|
+
envStillSet: before.kind === "env",
|
|
129
|
+
revoked: revoked === null ? null : revoked.ok,
|
|
130
|
+
agentConfigsRetainingKey: remaining.map((entry) => entry.path)
|
|
131
|
+
},
|
|
132
|
+
null,
|
|
133
|
+
2
|
|
134
|
+
)}
|
|
135
|
+
`
|
|
136
|
+
);
|
|
137
|
+
}
|
|
138
|
+
process.exit(EXIT.OK);
|
|
139
|
+
};
|
|
140
|
+
main().catch((err) => {
|
|
141
|
+
process.stderr.write(` ! logout failed: ${err instanceof Error ? err.message : String(err)}
|
|
142
|
+
`);
|
|
143
|
+
process.exit(EXIT.FAILED);
|
|
144
|
+
});
|
package/dist/bin/pushary-mode.js
CHANGED
|
@@ -1,15 +1,28 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
|
+
import {
|
|
3
|
+
exitOnFailedResponse
|
|
4
|
+
} from "../chunk-ONVEYEVR.js";
|
|
5
|
+
import "../chunk-YJ7YZRVV.js";
|
|
6
|
+
import {
|
|
7
|
+
createIo
|
|
8
|
+
} from "../chunk-TX7KBKT7.js";
|
|
9
|
+
import "../chunk-7QLSKOSU.js";
|
|
10
|
+
import {
|
|
11
|
+
exitOnHelpFlag
|
|
12
|
+
} from "../chunk-IIZZYUWK.js";
|
|
13
|
+
import {
|
|
14
|
+
EXIT
|
|
15
|
+
} from "../chunk-SP7OZXCQ.js";
|
|
16
|
+
import "../chunk-DQAN3JQP.js";
|
|
2
17
|
import {
|
|
3
18
|
getApiKey,
|
|
4
19
|
getBaseUrl
|
|
5
|
-
} from "../chunk-
|
|
20
|
+
} from "../chunk-2UMNXADU.js";
|
|
6
21
|
|
|
7
22
|
// bin/pushary-mode.ts
|
|
23
|
+
exitOnHelpFlag("mode");
|
|
8
24
|
var VALID_MODES = ["push_only", "push_first", "terminal_only", "notify_only"];
|
|
9
|
-
var dim = (
|
|
10
|
-
var green = (s) => `\x1B[32m${s}\x1B[0m`;
|
|
11
|
-
var cyan = (s) => `\x1B[36m${s}\x1B[0m`;
|
|
12
|
-
var yellow = (s) => `\x1B[33m${s}\x1B[0m`;
|
|
25
|
+
var { dim, green, cyan, yellow } = createIo();
|
|
13
26
|
var parseDuration = (value) => {
|
|
14
27
|
const match = value.match(/^(\d+)(m|h)$/);
|
|
15
28
|
if (!match) return null;
|
|
@@ -30,6 +43,7 @@ var main = async () => {
|
|
|
30
43
|
};
|
|
31
44
|
if (!mode || mode === "status") {
|
|
32
45
|
const res2 = await fetch(`${baseUrl}/api/mcp/mode`, { headers });
|
|
46
|
+
if (!res2.ok) await exitOnFailedResponse(res2, baseUrl);
|
|
33
47
|
const data2 = await res2.json();
|
|
34
48
|
if (!data2.override) {
|
|
35
49
|
console.log(` Mode: ${cyan("default")} ${dim("(using per-tool policies)")}`);
|
|
@@ -44,7 +58,8 @@ var main = async () => {
|
|
|
44
58
|
return;
|
|
45
59
|
}
|
|
46
60
|
if (mode === "clear" || mode === "reset") {
|
|
47
|
-
await fetch(`${baseUrl}/api/mcp/mode`, { method: "DELETE", headers });
|
|
61
|
+
const res2 = await fetch(`${baseUrl}/api/mcp/mode`, { method: "DELETE", headers });
|
|
62
|
+
if (!res2.ok) await exitOnFailedResponse(res2, baseUrl);
|
|
48
63
|
console.log(` ${green("\u2713")} Mode override cleared \u2014 using per-tool policies`);
|
|
49
64
|
return;
|
|
50
65
|
}
|
|
@@ -53,14 +68,14 @@ var main = async () => {
|
|
|
53
68
|
console.log(` Valid modes: ${VALID_MODES.join(", ")}`);
|
|
54
69
|
console.log(` ${dim("Usage: pushary mode <mode> [--for <duration>]")}`);
|
|
55
70
|
console.log(` ${dim("Example: pushary mode push_only --for 30m")}`);
|
|
56
|
-
|
|
71
|
+
process.exit(EXIT.USAGE);
|
|
57
72
|
}
|
|
58
73
|
let ttlSeconds;
|
|
59
74
|
if (forFlag === "--for" && forValue) {
|
|
60
75
|
const parsed = parseDuration(forValue);
|
|
61
76
|
if (!parsed) {
|
|
62
77
|
console.log(` ${yellow("!")} Invalid duration: ${forValue} ${dim("(use e.g. 30m, 1h)")}`);
|
|
63
|
-
|
|
78
|
+
process.exit(EXIT.USAGE);
|
|
64
79
|
}
|
|
65
80
|
ttlSeconds = parsed;
|
|
66
81
|
}
|
|
@@ -69,11 +84,7 @@ var main = async () => {
|
|
|
69
84
|
headers,
|
|
70
85
|
body: JSON.stringify({ mode, ttlSeconds })
|
|
71
86
|
});
|
|
72
|
-
if (!res.ok)
|
|
73
|
-
const err = await res.json();
|
|
74
|
-
console.log(` ${yellow("!")} Failed: ${err.error ?? res.statusText}`);
|
|
75
|
-
return;
|
|
76
|
-
}
|
|
87
|
+
if (!res.ok) await exitOnFailedResponse(res, baseUrl);
|
|
77
88
|
const data = await res.json();
|
|
78
89
|
console.log(` ${green("\u2713")} Mode set to ${cyan(data.override.mode)}`);
|
|
79
90
|
if (data.override.expiresAt) {
|
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
2
|
import {
|
|
3
3
|
handleNotification
|
|
4
|
-
} from "../chunk-
|
|
5
|
-
import "../chunk-
|
|
6
|
-
import "../chunk-DWED7BS3.js";
|
|
4
|
+
} from "../chunk-HIIBSYFJ.js";
|
|
5
|
+
import "../chunk-HNTKTK5B.js";
|
|
7
6
|
import "../chunk-DQAN3JQP.js";
|
|
8
|
-
import "../chunk-
|
|
7
|
+
import "../chunk-RN3NOEJF.js";
|
|
8
|
+
import "../chunk-2UMNXADU.js";
|
|
9
9
|
|
|
10
10
|
// bin/pushary-notification-hook.ts
|
|
11
11
|
var main = async () => {
|
|
@@ -1,15 +1,15 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
2
|
import {
|
|
3
3
|
handlePermissionDenied
|
|
4
|
-
} from "../chunk-
|
|
4
|
+
} from "../chunk-5SO3CEGJ.js";
|
|
5
5
|
import "../chunk-CAJZAFVS.js";
|
|
6
6
|
import "../chunk-YHG74UFF.js";
|
|
7
|
-
import "../chunk-
|
|
8
|
-
import "../chunk-RN3NOEJF.js";
|
|
7
|
+
import "../chunk-HIIBSYFJ.js";
|
|
9
8
|
import "../chunk-WLGEY4UX.js";
|
|
10
|
-
import "../chunk-
|
|
9
|
+
import "../chunk-HNTKTK5B.js";
|
|
11
10
|
import "../chunk-DQAN3JQP.js";
|
|
12
|
-
import "../chunk-
|
|
11
|
+
import "../chunk-RN3NOEJF.js";
|
|
12
|
+
import "../chunk-2UMNXADU.js";
|
|
13
13
|
|
|
14
14
|
// bin/pushary-permission-denied-hook.ts
|
|
15
15
|
var main = async () => {
|
|
@@ -1,15 +1,15 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
2
|
import {
|
|
3
3
|
handlePermissionRequest
|
|
4
|
-
} from "../chunk-
|
|
4
|
+
} from "../chunk-5SO3CEGJ.js";
|
|
5
5
|
import "../chunk-CAJZAFVS.js";
|
|
6
6
|
import "../chunk-YHG74UFF.js";
|
|
7
|
-
import "../chunk-
|
|
8
|
-
import "../chunk-RN3NOEJF.js";
|
|
7
|
+
import "../chunk-HIIBSYFJ.js";
|
|
9
8
|
import "../chunk-WLGEY4UX.js";
|
|
10
|
-
import "../chunk-
|
|
9
|
+
import "../chunk-HNTKTK5B.js";
|
|
11
10
|
import "../chunk-DQAN3JQP.js";
|
|
12
|
-
import "../chunk-
|
|
11
|
+
import "../chunk-RN3NOEJF.js";
|
|
12
|
+
import "../chunk-2UMNXADU.js";
|
|
13
13
|
|
|
14
14
|
// bin/pushary-permission-hook.ts
|
|
15
15
|
var main = async () => {
|
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
2
|
import {
|
|
3
3
|
handlePostToolUse
|
|
4
|
-
} from "../chunk-
|
|
5
|
-
import "../chunk-
|
|
6
|
-
import "../chunk-DWED7BS3.js";
|
|
4
|
+
} from "../chunk-HIIBSYFJ.js";
|
|
5
|
+
import "../chunk-HNTKTK5B.js";
|
|
7
6
|
import "../chunk-DQAN3JQP.js";
|
|
8
|
-
import "../chunk-
|
|
7
|
+
import "../chunk-RN3NOEJF.js";
|
|
8
|
+
import "../chunk-2UMNXADU.js";
|
|
9
9
|
|
|
10
10
|
// bin/pushary-post-hook.ts
|
|
11
11
|
var main = async () => {
|
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
2
|
import {
|
|
3
3
|
handleUserPrompt
|
|
4
|
-
} from "../chunk-
|
|
5
|
-
import "../chunk-
|
|
6
|
-
import "../chunk-DWED7BS3.js";
|
|
4
|
+
} from "../chunk-HIIBSYFJ.js";
|
|
5
|
+
import "../chunk-HNTKTK5B.js";
|
|
7
6
|
import "../chunk-DQAN3JQP.js";
|
|
8
|
-
import "../chunk-
|
|
7
|
+
import "../chunk-RN3NOEJF.js";
|
|
8
|
+
import "../chunk-2UMNXADU.js";
|
|
9
9
|
|
|
10
10
|
// bin/pushary-prompt-hook.ts
|
|
11
11
|
var main = async () => {
|
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
2
|
import {
|
|
3
3
|
handleSessionEnd
|
|
4
|
-
} from "../chunk-
|
|
5
|
-
import "../chunk-
|
|
6
|
-
import "../chunk-DWED7BS3.js";
|
|
4
|
+
} from "../chunk-HIIBSYFJ.js";
|
|
5
|
+
import "../chunk-HNTKTK5B.js";
|
|
7
6
|
import "../chunk-DQAN3JQP.js";
|
|
8
|
-
import "../chunk-
|
|
7
|
+
import "../chunk-RN3NOEJF.js";
|
|
8
|
+
import "../chunk-2UMNXADU.js";
|
|
9
9
|
|
|
10
10
|
// bin/pushary-session-end-hook.ts
|
|
11
11
|
var main = async () => {
|
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
2
|
import {
|
|
3
3
|
handleSessionStart
|
|
4
|
-
} from "../chunk-
|
|
5
|
-
import "../chunk-
|
|
6
|
-
import "../chunk-DWED7BS3.js";
|
|
4
|
+
} from "../chunk-HIIBSYFJ.js";
|
|
5
|
+
import "../chunk-HNTKTK5B.js";
|
|
7
6
|
import "../chunk-DQAN3JQP.js";
|
|
8
|
-
import "../chunk-
|
|
7
|
+
import "../chunk-RN3NOEJF.js";
|
|
8
|
+
import "../chunk-2UMNXADU.js";
|
|
9
9
|
|
|
10
10
|
// bin/pushary-session-start-hook.ts
|
|
11
11
|
var main = async () => {
|