@pushary/agent-hooks 0.62.5 → 0.62.6
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 +24 -0
- package/dist/bin/pushary-clean.js +30 -20
- package/dist/bin/pushary-doctor.js +29 -22
- package/dist/bin/pushary-logout.js +8 -7
- package/dist/bin/pushary-setup.js +26 -16
- package/dist/bin/pushary-upgrade.js +12 -9
- package/dist/{chunk-UXXRRXUS.js → chunk-6G2BC4ET.js} +1 -1
- package/dist/{chunk-ER657KRJ.js → chunk-RU3CIBXY.js} +31 -1
- package/package.json +1 -1
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,29 @@
|
|
|
1
1
|
# Changelog
|
|
2
2
|
|
|
3
|
+
## 0.62.6
|
|
4
|
+
|
|
5
|
+
### `clean` rewrote your project's Cursor config and left your own alone
|
|
6
|
+
|
|
7
|
+
`clean` built the Cursor MCP path without a home directory, so it resolved
|
|
8
|
+
against whatever directory you ran it from. Inside a repo that has a
|
|
9
|
+
`.cursor/mcp.json`, it rewrote that committed file, stripping the Pushary entry
|
|
10
|
+
and reformatting the rest. Meanwhile your real `~/.cursor/mcp.json` was never
|
|
11
|
+
touched, so the API key stayed in it.
|
|
12
|
+
|
|
13
|
+
Check `git status` in any project you ran `clean` from, and check
|
|
14
|
+
`~/.cursor/mcp.json` for a key you thought was gone.
|
|
15
|
+
|
|
16
|
+
### Every file the CLI touches is now named in one place
|
|
17
|
+
|
|
18
|
+
`setup`, `clean`, `doctor`, `logout` and `upgrade` each derived the same paths by
|
|
19
|
+
hand, and they drifted. That drift caused this bug and the `CODEX_HOME` one
|
|
20
|
+
before it. All twenty-three call sites now resolve through one module, and a test
|
|
21
|
+
fails any command that starts spelling a path out again.
|
|
22
|
+
|
|
23
|
+
No behaviour changed anywhere else: setup's output is byte-identical across every
|
|
24
|
+
mode before and after.
|
|
25
|
+
|
|
26
|
+
|
|
3
27
|
## 0.62.5
|
|
4
28
|
|
|
5
29
|
### `clean --dry-run` changed things again
|
|
@@ -10,12 +10,22 @@ import {
|
|
|
10
10
|
removeGeminiSettings
|
|
11
11
|
} from "../chunk-E2U35RLD.js";
|
|
12
12
|
import {
|
|
13
|
+
claudeJson,
|
|
14
|
+
claudeSettings,
|
|
15
|
+
claudeSettingsLocal,
|
|
16
|
+
claudeSkillDir,
|
|
13
17
|
codexAgentsMd,
|
|
14
18
|
codexConfigToml,
|
|
15
19
|
codexHooksJson,
|
|
16
20
|
codexSkillDir,
|
|
21
|
+
cursorPluginDir,
|
|
22
|
+
cursorUserHooks,
|
|
23
|
+
cursorUserMcp,
|
|
24
|
+
geminiMd,
|
|
25
|
+
geminiSettings,
|
|
26
|
+
pusharyDir,
|
|
17
27
|
removeCodexHooks
|
|
18
|
-
} from "../chunk-
|
|
28
|
+
} from "../chunk-RU3CIBXY.js";
|
|
19
29
|
import {
|
|
20
30
|
removeClaudeAlias
|
|
21
31
|
} from "../chunk-BC3VCZ3E.js";
|
|
@@ -63,14 +73,14 @@ var green = (s) => `\x1B[32m${s}\x1B[0m`;
|
|
|
63
73
|
var yellow = (s) => `\x1B[33m${s}\x1B[0m`;
|
|
64
74
|
var check = green("\u2713");
|
|
65
75
|
var skip = yellow("\u2013");
|
|
66
|
-
var CLAUDE_SETTINGS =
|
|
67
|
-
var CLAUDE_SETTINGS_LOCAL =
|
|
68
|
-
var CLAUDE_JSON =
|
|
69
|
-
var SKILL_DIR =
|
|
70
|
-
var CURSOR_MCP =
|
|
71
|
-
var CURSOR_PLUGIN_DIR =
|
|
72
|
-
var CURSOR_USER_HOOKS =
|
|
73
|
-
var PUSHARY_DIR =
|
|
76
|
+
var CLAUDE_SETTINGS = claudeSettings();
|
|
77
|
+
var CLAUDE_SETTINGS_LOCAL = claudeSettingsLocal();
|
|
78
|
+
var CLAUDE_JSON = claudeJson();
|
|
79
|
+
var SKILL_DIR = claudeSkillDir();
|
|
80
|
+
var CURSOR_MCP = cursorUserMcp();
|
|
81
|
+
var CURSOR_PLUGIN_DIR = cursorPluginDir();
|
|
82
|
+
var CURSOR_USER_HOOKS = cursorUserHooks();
|
|
83
|
+
var PUSHARY_DIR = pusharyDir();
|
|
74
84
|
var SHELL_FILES = [".zshrc", ".zprofile", ".bashrc", ".bash_profile"].map((f) => join(homedir(), f));
|
|
75
85
|
var resolveHermesPython = () => {
|
|
76
86
|
try {
|
|
@@ -157,10 +167,10 @@ var main = async () => {
|
|
|
157
167
|
console.log();
|
|
158
168
|
cleanSettingsFile(CLAUDE_SETTINGS, "Claude Code settings");
|
|
159
169
|
cleanSettingsFile(CLAUDE_SETTINGS_LOCAL, "Claude Code settings.local");
|
|
160
|
-
const
|
|
161
|
-
if (
|
|
162
|
-
if (removeClaudeMcpServers(
|
|
163
|
-
writeJson(CLAUDE_JSON,
|
|
170
|
+
const claudeJson2 = readJson(CLAUDE_JSON);
|
|
171
|
+
if (claudeJson2) {
|
|
172
|
+
if (removeClaudeMcpServers(claudeJson2)) {
|
|
173
|
+
writeJson(CLAUDE_JSON, claudeJson2);
|
|
164
174
|
console.log(` ${check} Claude Code MCP servers ${dim("(removed from ~/.claude.json)")}`);
|
|
165
175
|
} else {
|
|
166
176
|
console.log(` ${skip} Claude Code MCP servers ${dim("(no pushary entries)")}`);
|
|
@@ -257,11 +267,11 @@ var main = async () => {
|
|
|
257
267
|
} else {
|
|
258
268
|
console.log(` ${skip} Codex skill directory ${dim("(not found)")}`);
|
|
259
269
|
}
|
|
260
|
-
const geminiSettingsPath =
|
|
261
|
-
const
|
|
262
|
-
if (
|
|
263
|
-
if (removeGeminiSettings(
|
|
264
|
-
writeJson(geminiSettingsPath,
|
|
270
|
+
const geminiSettingsPath = geminiSettings();
|
|
271
|
+
const geminiSettings2 = readJson(geminiSettingsPath);
|
|
272
|
+
if (geminiSettings2) {
|
|
273
|
+
if (removeGeminiSettings(geminiSettings2)) {
|
|
274
|
+
writeJson(geminiSettingsPath, geminiSettings2);
|
|
265
275
|
console.log(` ${check} Gemini CLI settings ${dim(did("cleaned"))}`);
|
|
266
276
|
} else {
|
|
267
277
|
console.log(` ${skip} Gemini CLI settings ${dim("(no pushary entries)")}`);
|
|
@@ -269,8 +279,8 @@ var main = async () => {
|
|
|
269
279
|
} else {
|
|
270
280
|
console.log(` ${skip} Gemini CLI settings ${dim("(not found)")}`);
|
|
271
281
|
}
|
|
272
|
-
const
|
|
273
|
-
if (guardedInstructionBlockRemoval(
|
|
282
|
+
const geminiMd2 = geminiMd();
|
|
283
|
+
if (guardedInstructionBlockRemoval(geminiMd2)) {
|
|
274
284
|
console.log(` ${check} Gemini GEMINI.md ${dim("(removed Pushary block)")}`);
|
|
275
285
|
} else {
|
|
276
286
|
console.log(` ${skip} Gemini GEMINI.md ${dim("(no pushary block)")}`);
|
|
@@ -4,7 +4,7 @@ import {
|
|
|
4
4
|
} from "../chunk-IIENZE2J.js";
|
|
5
5
|
import {
|
|
6
6
|
detectAllAgents
|
|
7
|
-
} from "../chunk-
|
|
7
|
+
} from "../chunk-6G2BC4ET.js";
|
|
8
8
|
import {
|
|
9
9
|
hasInstructionBlock
|
|
10
10
|
} from "../chunk-N7XJ4L2W.js";
|
|
@@ -14,15 +14,22 @@ import {
|
|
|
14
14
|
missingGeminiHookEvents
|
|
15
15
|
} from "../chunk-E2U35RLD.js";
|
|
16
16
|
import {
|
|
17
|
+
claudeJson,
|
|
18
|
+
claudeSettings,
|
|
19
|
+
claudeSkillDir,
|
|
17
20
|
codexAgentsMd,
|
|
18
21
|
codexConfigToml,
|
|
19
22
|
codexHooksJson,
|
|
20
23
|
codexSkillDir,
|
|
24
|
+
cursorPluginDir,
|
|
25
|
+
cursorUserHooks,
|
|
26
|
+
geminiMd,
|
|
27
|
+
geminiSettings,
|
|
21
28
|
hasCodexHooks,
|
|
22
29
|
missingCodexHookEvents,
|
|
23
30
|
readCodexMcpAuth,
|
|
24
31
|
untrustedCodexHookEvents
|
|
25
|
-
} from "../chunk-
|
|
32
|
+
} from "../chunk-RU3CIBXY.js";
|
|
26
33
|
import {
|
|
27
34
|
describeReach,
|
|
28
35
|
fetchChannels,
|
|
@@ -159,8 +166,8 @@ var { bold, dim, green, yellow, red, cyan } = createIo();
|
|
|
159
166
|
var pass = green("\u2713");
|
|
160
167
|
var fail = red("\u2717");
|
|
161
168
|
var warn = yellow("!");
|
|
162
|
-
var CLAUDE_SETTINGS =
|
|
163
|
-
var SKILL_PATH = join(
|
|
169
|
+
var CLAUDE_SETTINGS = claudeSettings();
|
|
170
|
+
var SKILL_PATH = join(claudeSkillDir(), "SKILL.md");
|
|
164
171
|
var SHELL_FILES = [".zshrc", ".zprofile", ".bashrc", ".bash_profile"].map((f) => join(homedir2(), f));
|
|
165
172
|
var readJson = (path) => {
|
|
166
173
|
try {
|
|
@@ -277,9 +284,9 @@ var main = async () => {
|
|
|
277
284
|
break;
|
|
278
285
|
}
|
|
279
286
|
}
|
|
280
|
-
const CLAUDE_JSON =
|
|
281
|
-
const
|
|
282
|
-
const mcpServers =
|
|
287
|
+
const CLAUDE_JSON = claudeJson();
|
|
288
|
+
const claudeJson2 = readJson(CLAUDE_JSON);
|
|
289
|
+
const mcpServers = claudeJson2?.mcpServers ?? {};
|
|
283
290
|
const pusharyServer = mcpServers?.pushary;
|
|
284
291
|
check(!!pusharyServer, "Claude Code: MCP server configured");
|
|
285
292
|
if (pusharyServer) {
|
|
@@ -393,10 +400,10 @@ var main = async () => {
|
|
|
393
400
|
const hasCodexInstructions = hasInstructionBlock(codexAgentsMd2);
|
|
394
401
|
check(hasCodexInstructions, "Codex: proactive instructions (AGENTS.md)", hasCodexInstructions ? codexAgentsMd2 : "missing \u2014 re-run setup so Codex asks via push, not the terminal");
|
|
395
402
|
}
|
|
396
|
-
const geminiSettingsPath =
|
|
397
|
-
const
|
|
398
|
-
if (
|
|
399
|
-
const geminiServers =
|
|
403
|
+
const geminiSettingsPath = geminiSettings();
|
|
404
|
+
const geminiSettings2 = readJson(geminiSettingsPath);
|
|
405
|
+
if (geminiSettings2) {
|
|
406
|
+
const geminiServers = geminiSettings2.mcpServers ?? {};
|
|
400
407
|
const geminiPushary = geminiServers.pushary;
|
|
401
408
|
check(!!geminiPushary, "Gemini CLI: MCP server configured");
|
|
402
409
|
if (geminiPushary) {
|
|
@@ -413,11 +420,11 @@ var main = async () => {
|
|
|
413
420
|
}
|
|
414
421
|
}
|
|
415
422
|
}
|
|
416
|
-
const geminiHooksInstalled = hasGeminiHooks(
|
|
423
|
+
const geminiHooksInstalled = hasGeminiHooks(geminiSettings2);
|
|
417
424
|
if (geminiHooksInstalled) {
|
|
418
|
-
const missingEvents = missingGeminiHookEvents(
|
|
425
|
+
const missingEvents = missingGeminiHookEvents(geminiSettings2);
|
|
419
426
|
check(missingEvents.length === 0, "Gemini CLI: native hooks installed", missingEvents.length === 0 ? "all 5 events" : `missing ${missingEvents.join(", ")}, re-run setup`);
|
|
420
|
-
const geminiHooks =
|
|
427
|
+
const geminiHooks = geminiSettings2.hooks;
|
|
421
428
|
const hookCommand = extractHookCommand(geminiHooks?.BeforeTool, GEMINI_HOOK_BINARY) ?? extractHookCommand(geminiHooks?.AfterTool, GEMINI_HOOK_BINARY) ?? extractHookCommand(geminiHooks?.SessionStart, GEMINI_HOOK_BINARY);
|
|
422
429
|
if (hookCommand) {
|
|
423
430
|
const resolves = commandResolves(hookCommand);
|
|
@@ -431,14 +438,14 @@ var main = async () => {
|
|
|
431
438
|
} else {
|
|
432
439
|
check(false, "Gemini CLI: native hooks installed", "no Pushary hooks in ~/.gemini/settings.json \u2014 re-run setup");
|
|
433
440
|
}
|
|
434
|
-
const
|
|
435
|
-
const hasGeminiInstructions = hasInstructionBlock(
|
|
436
|
-
check(hasGeminiInstructions, "Gemini CLI: proactive instructions (GEMINI.md)", hasGeminiInstructions ?
|
|
441
|
+
const geminiMd2 = geminiMd();
|
|
442
|
+
const hasGeminiInstructions = hasInstructionBlock(geminiMd2);
|
|
443
|
+
check(hasGeminiInstructions, "Gemini CLI: proactive instructions (GEMINI.md)", hasGeminiInstructions ? geminiMd2 : "missing \u2014 re-run setup so Gemini asks via push, not the terminal");
|
|
437
444
|
}
|
|
438
|
-
const
|
|
439
|
-
if (existsSync(
|
|
440
|
-
const
|
|
441
|
-
const userHooks = readJson(
|
|
445
|
+
const cursorPluginDir2 = cursorPluginDir();
|
|
446
|
+
if (existsSync(cursorPluginDir2)) {
|
|
447
|
+
const cursorUserHooks2 = cursorUserHooks();
|
|
448
|
+
const userHooks = readJson(cursorUserHooks2);
|
|
442
449
|
const gateEntry = userHooks.hooks?.beforeShellExecution?.find(
|
|
443
450
|
(h) => String(h.command ?? "").includes("pushary-gate")
|
|
444
451
|
);
|
|
@@ -449,7 +456,7 @@ var main = async () => {
|
|
|
449
456
|
const resolves = scriptPath ? existsSync(scriptPath) : false;
|
|
450
457
|
check(resolves, "Cursor: permission gate registered", resolves ? `~/.cursor/hooks.json \u2192 ${scriptPath}` : `gate script not found: ${scriptPath || gateEntry.command} \u2014 re-run setup`);
|
|
451
458
|
}
|
|
452
|
-
const cursorMcp = readJson(join(
|
|
459
|
+
const cursorMcp = readJson(join(cursorPluginDir2, "mcp.json"));
|
|
453
460
|
const cursorServers = cursorMcp?.mcpServers ?? {};
|
|
454
461
|
const cursorAuth = cursorServers.pushary?.headers?.Authorization;
|
|
455
462
|
if (!cursorAuth) {
|
|
@@ -1,7 +1,10 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
2
|
import {
|
|
3
|
-
|
|
4
|
-
|
|
3
|
+
claudeJson,
|
|
4
|
+
codexConfigToml,
|
|
5
|
+
cursorUserMcp,
|
|
6
|
+
geminiSettings
|
|
7
|
+
} from "../chunk-RU3CIBXY.js";
|
|
5
8
|
import {
|
|
6
9
|
clearKey,
|
|
7
10
|
readKeySource
|
|
@@ -31,8 +34,6 @@ import {
|
|
|
31
34
|
|
|
32
35
|
// bin/pushary-logout.ts
|
|
33
36
|
import { existsSync } from "fs";
|
|
34
|
-
import { homedir } from "os";
|
|
35
|
-
import { join } from "path";
|
|
36
37
|
exitOnHelpFlag("logout");
|
|
37
38
|
var parseLogoutOptions = (argv) => {
|
|
38
39
|
const flags = parseFlags(argv, { bools: ["json", "revoke", "help", "h"], values: [] });
|
|
@@ -54,10 +55,10 @@ var say = options.json ? (line) => process.stderr.write(`${line}
|
|
|
54
55
|
`) : (line) => process.stdout.write(`${line}
|
|
55
56
|
`);
|
|
56
57
|
var AGENT_CONFIGS = [
|
|
57
|
-
{ label: "Claude Code", path:
|
|
58
|
+
{ label: "Claude Code", path: claudeJson() },
|
|
58
59
|
{ label: "Codex", path: codexConfigToml() },
|
|
59
|
-
{ label: "Gemini CLI", path:
|
|
60
|
-
{ label: "Cursor", path:
|
|
60
|
+
{ label: "Gemini CLI", path: geminiSettings() },
|
|
61
|
+
{ label: "Cursor", path: cursorUserMcp() }
|
|
61
62
|
];
|
|
62
63
|
var revokeRemotely = async (apiKey) => {
|
|
63
64
|
try {
|
|
@@ -11,7 +11,7 @@ import {
|
|
|
11
11
|
describeDetection,
|
|
12
12
|
detectAllAgents,
|
|
13
13
|
isDetected
|
|
14
|
-
} from "../chunk-
|
|
14
|
+
} from "../chunk-6G2BC4ET.js";
|
|
15
15
|
import {
|
|
16
16
|
renderAgentInstructions,
|
|
17
17
|
renderProjectAgentInstructions,
|
|
@@ -26,9 +26,19 @@ import {
|
|
|
26
26
|
addCodexHookTrust,
|
|
27
27
|
addCodexHooks,
|
|
28
28
|
addCodexMcpServer,
|
|
29
|
+
claudeJson,
|
|
30
|
+
claudeSettings,
|
|
31
|
+
claudeSkillDir,
|
|
32
|
+
codexAgentsMd2 as codexAgentsMd,
|
|
29
33
|
codexConfigToml,
|
|
30
|
-
codexHome
|
|
31
|
-
|
|
34
|
+
codexHome,
|
|
35
|
+
codexSkillDir2 as codexSkillDir,
|
|
36
|
+
cursorPluginDir,
|
|
37
|
+
cursorUserHooks,
|
|
38
|
+
geminiMd,
|
|
39
|
+
geminiSettings,
|
|
40
|
+
pusharyConfigFile
|
|
41
|
+
} from "../chunk-RU3CIBXY.js";
|
|
32
42
|
import {
|
|
33
43
|
confirmAppConnection,
|
|
34
44
|
connectDevice,
|
|
@@ -259,17 +269,17 @@ var parseSetupOptions = (input2) => {
|
|
|
259
269
|
};
|
|
260
270
|
|
|
261
271
|
// bin/pushary-setup.ts
|
|
262
|
-
var CLAUDE_SETTINGS =
|
|
263
|
-
var CLAUDE_JSON =
|
|
264
|
-
var CURSOR_PLUGIN_DIR =
|
|
265
|
-
var CURSOR_USER_HOOKS =
|
|
266
|
-
var CLAUDE_SKILL_DIR =
|
|
272
|
+
var CLAUDE_SETTINGS = claudeSettings();
|
|
273
|
+
var CLAUDE_JSON = claudeJson();
|
|
274
|
+
var CURSOR_PLUGIN_DIR = cursorPluginDir();
|
|
275
|
+
var CURSOR_USER_HOOKS = cursorUserHooks();
|
|
276
|
+
var CLAUDE_SKILL_DIR = claudeSkillDir();
|
|
267
277
|
var CODEX_HOME = codexHome();
|
|
268
|
-
var CODEX_SKILL_DIR =
|
|
269
|
-
var CODEX_AGENTS_MD =
|
|
270
|
-
var GEMINI_SETTINGS =
|
|
271
|
-
var GEMINI_MD =
|
|
272
|
-
var PUSHARY_CONFIG_FILE =
|
|
278
|
+
var CODEX_SKILL_DIR = codexSkillDir();
|
|
279
|
+
var CODEX_AGENTS_MD = codexAgentsMd();
|
|
280
|
+
var GEMINI_SETTINGS = geminiSettings();
|
|
281
|
+
var GEMINI_MD = geminiMd();
|
|
282
|
+
var PUSHARY_CONFIG_FILE = pusharyConfigFile();
|
|
273
283
|
var manualSteps = [];
|
|
274
284
|
var noteManual = (step) => {
|
|
275
285
|
manualSteps.push(step);
|
|
@@ -433,10 +443,10 @@ var setupClaudeCode = async (apiKey) => {
|
|
|
433
443
|
${bold("Setting up Claude Code")}
|
|
434
444
|
`);
|
|
435
445
|
await installGlobally2();
|
|
436
|
-
const
|
|
446
|
+
const claudeJson2 = readAgentJson(CLAUDE_JSON);
|
|
437
447
|
const settings = readAgentJson(CLAUDE_SETTINGS);
|
|
438
448
|
await spinner("Adding MCP server (type: http)", async () => {
|
|
439
|
-
addClaudeMcpServer(
|
|
449
|
+
addClaudeMcpServer(claudeJson2, apiKey);
|
|
440
450
|
});
|
|
441
451
|
await spinner("Auto-allowing Pushary tools", async () => {
|
|
442
452
|
addPusharyToolPermissions(settings);
|
|
@@ -445,7 +455,7 @@ var setupClaudeCode = async (apiKey) => {
|
|
|
445
455
|
addPusharyHooks(settings, resolveGlobalBinDir("pushary-hook"));
|
|
446
456
|
});
|
|
447
457
|
await spinner(`Writing ${CLAUDE_JSON}`, async () => {
|
|
448
|
-
writeJsonAtomic(CLAUDE_JSON,
|
|
458
|
+
writeJsonAtomic(CLAUDE_JSON, claudeJson2, 384);
|
|
449
459
|
});
|
|
450
460
|
await spinner(`Writing ${CLAUDE_SETTINGS}`, async () => {
|
|
451
461
|
writeJsonAtomic(CLAUDE_SETTINGS, settings);
|
|
@@ -15,10 +15,13 @@ import {
|
|
|
15
15
|
addCodexHookTrust,
|
|
16
16
|
addCodexHooks,
|
|
17
17
|
addCodexMcpServer,
|
|
18
|
+
claudeJson,
|
|
18
19
|
codexConfigToml,
|
|
19
20
|
codexHooksJson,
|
|
21
|
+
cursorPluginDir,
|
|
22
|
+
geminiSettings,
|
|
20
23
|
hasCodexHooks
|
|
21
|
-
} from "../chunk-
|
|
24
|
+
} from "../chunk-RU3CIBXY.js";
|
|
22
25
|
import {
|
|
23
26
|
readJsonSafe
|
|
24
27
|
} from "../chunk-6MTNS63X.js";
|
|
@@ -65,16 +68,16 @@ var writeJson = (filePath, data) => {
|
|
|
65
68
|
writeFileSync(filePath, JSON.stringify(data, null, 2) + "\n", "utf-8");
|
|
66
69
|
};
|
|
67
70
|
var hasPusharyClaudeHooks = (settings) => JSON.stringify(settings.hooks ?? {}).includes("pushary-hook");
|
|
68
|
-
var hasPusharyMcp = (
|
|
71
|
+
var hasPusharyMcp = (claudeJson2) => !!claudeJson2.mcpServers?.pushary;
|
|
69
72
|
var reapplyClaudeSettings = (apiKey, paths = {}) => {
|
|
70
73
|
const settingsPath = paths.settingsPath ?? CLAUDE_SETTINGS;
|
|
71
74
|
const claudeJsonPath = paths.claudeJsonPath ?? CLAUDE_JSON;
|
|
72
75
|
const settings = readJson(settingsPath);
|
|
73
|
-
const
|
|
74
|
-
const configured = settings != null && hasPusharyClaudeHooks(settings) ||
|
|
76
|
+
const claudeJson2 = readJson(claudeJsonPath);
|
|
77
|
+
const configured = settings != null && hasPusharyClaudeHooks(settings) || claudeJson2 != null && hasPusharyMcp(claudeJson2);
|
|
75
78
|
if (!configured) return { reapplied: false, hooks: false, mcp: false };
|
|
76
79
|
const settingsWritable = settings != null;
|
|
77
|
-
const claudeJsonWritable =
|
|
80
|
+
const claudeJsonWritable = claudeJson2 != null;
|
|
78
81
|
let hooks = false;
|
|
79
82
|
let mcp = false;
|
|
80
83
|
try {
|
|
@@ -89,7 +92,7 @@ var reapplyClaudeSettings = (apiKey, paths = {}) => {
|
|
|
89
92
|
if (apiKey) {
|
|
90
93
|
try {
|
|
91
94
|
if (!claudeJsonWritable) throw new Error(".claude.json could not be parsed");
|
|
92
|
-
const cj =
|
|
95
|
+
const cj = claudeJson2;
|
|
93
96
|
addClaudeMcpServer(cj, apiKey);
|
|
94
97
|
writeJson(claudeJsonPath, cj);
|
|
95
98
|
mcp = true;
|
|
@@ -197,7 +200,7 @@ var detectInstallModes = () => {
|
|
|
197
200
|
{
|
|
198
201
|
label: "Cursor plugin",
|
|
199
202
|
upgrade: "updates itself through Cursor",
|
|
200
|
-
present: existsSync2(
|
|
203
|
+
present: existsSync2(cursorPluginDir())
|
|
201
204
|
},
|
|
202
205
|
{
|
|
203
206
|
label: "Codex config",
|
|
@@ -207,12 +210,12 @@ var detectInstallModes = () => {
|
|
|
207
210
|
{
|
|
208
211
|
label: "Claude Code config",
|
|
209
212
|
upgrade: "npx @pushary/agent-hooks@latest setup --agents claude_code",
|
|
210
|
-
present: existsSync2(
|
|
213
|
+
present: existsSync2(claudeJson())
|
|
211
214
|
},
|
|
212
215
|
{
|
|
213
216
|
label: "Gemini config",
|
|
214
217
|
upgrade: "npx @pushary/agent-hooks@latest setup --agents gemini_cli",
|
|
215
|
-
present: existsSync2(
|
|
218
|
+
present: existsSync2(geminiSettings())
|
|
216
219
|
},
|
|
217
220
|
{
|
|
218
221
|
label: "Hermes plugin (pip)",
|
|
@@ -149,6 +149,23 @@ var addCodexHookTrust = (config, hooksJsonPath, command) => {
|
|
|
149
149
|
}
|
|
150
150
|
};
|
|
151
151
|
|
|
152
|
+
// src/setup/paths.ts
|
|
153
|
+
import { homedir as homedir2 } from "os";
|
|
154
|
+
import { join as join2 } from "path";
|
|
155
|
+
var claudeSettings = () => join2(homedir2(), ".claude", "settings.json");
|
|
156
|
+
var claudeJson = () => join2(homedir2(), ".claude.json");
|
|
157
|
+
var claudeSkillDir = () => join2(homedir2(), ".claude", "skills", "pushary");
|
|
158
|
+
var cursorPluginDir = () => join2(homedir2(), ".cursor", "plugins", "local", "pushary");
|
|
159
|
+
var cursorUserHooks = () => join2(homedir2(), ".cursor", "hooks.json");
|
|
160
|
+
var cursorUserMcp = () => join2(homedir2(), ".cursor", "mcp.json");
|
|
161
|
+
var claudeSettingsLocal = () => join2(homedir2(), ".claude", "settings.local.json");
|
|
162
|
+
var pusharyDir = () => join2(homedir2(), ".pushary");
|
|
163
|
+
var codexSkillDir2 = () => join2(codexHome(), "skills", "pushary");
|
|
164
|
+
var codexAgentsMd2 = () => join2(codexHome(), "AGENTS.md");
|
|
165
|
+
var geminiSettings = () => join2(homedir2(), ".gemini", "settings.json");
|
|
166
|
+
var geminiMd = () => join2(homedir2(), ".gemini", "GEMINI.md");
|
|
167
|
+
var pusharyConfigFile = () => join2(homedir2(), ".pushary", "config.json");
|
|
168
|
+
|
|
152
169
|
export {
|
|
153
170
|
CODEX_HOOK_BINARY,
|
|
154
171
|
codexHome,
|
|
@@ -164,5 +181,18 @@ export {
|
|
|
164
181
|
hasCodexHooks,
|
|
165
182
|
missingCodexHookEvents,
|
|
166
183
|
untrustedCodexHookEvents,
|
|
167
|
-
addCodexHookTrust
|
|
184
|
+
addCodexHookTrust,
|
|
185
|
+
claudeSettings,
|
|
186
|
+
claudeJson,
|
|
187
|
+
claudeSkillDir,
|
|
188
|
+
cursorPluginDir,
|
|
189
|
+
cursorUserHooks,
|
|
190
|
+
cursorUserMcp,
|
|
191
|
+
claudeSettingsLocal,
|
|
192
|
+
pusharyDir,
|
|
193
|
+
codexSkillDir2,
|
|
194
|
+
codexAgentsMd2,
|
|
195
|
+
geminiSettings,
|
|
196
|
+
geminiMd,
|
|
197
|
+
pusharyConfigFile
|
|
168
198
|
};
|