pushary 1.9.51 → 1.9.53

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 (91) hide show
  1. package/CHANGELOG.md +16 -0
  2. package/README.md +9 -0
  3. package/dist/{api-PPNFRSJC.js → api-K6ZROHYB.js} +7 -7
  4. package/dist/bin/pushary-bell-hook.js +15 -15
  5. package/dist/bin/pushary-bell.js +3 -3
  6. package/dist/bin/pushary-claude.js +16 -16
  7. package/dist/bin/pushary-clean.js +28 -26
  8. package/dist/bin/pushary-codex-bridge.js +10 -10
  9. package/dist/bin/pushary-codex-hook.js +20 -20
  10. package/dist/bin/pushary-codex-session.js +6 -6
  11. package/dist/bin/pushary-codex.js +8 -8
  12. package/dist/bin/pushary-connect.js +16 -16
  13. package/dist/bin/pushary-daemon.js +23 -21
  14. package/dist/bin/pushary-disconnect.js +17 -17
  15. package/dist/bin/pushary-doctor.js +25 -25
  16. package/dist/bin/pushary-elicitation-hook.js +17 -17
  17. package/dist/bin/pushary-gemini-bridge.js +5 -5
  18. package/dist/bin/pushary-gemini-hook.js +18 -18
  19. package/dist/bin/pushary-hook.js +18 -18
  20. package/dist/bin/pushary-login.js +6 -6
  21. package/dist/bin/pushary-logout.js +16 -16
  22. package/dist/bin/pushary-mcp.js +12 -7
  23. package/dist/bin/pushary-mode.js +6 -6
  24. package/dist/bin/pushary-notification-hook.js +15 -15
  25. package/dist/bin/pushary-opencode-hook.js +17 -17
  26. package/dist/bin/pushary-permission-denied-hook.js +18 -18
  27. package/dist/bin/pushary-permission-hook.js +18 -18
  28. package/dist/bin/pushary-post-hook.js +15 -15
  29. package/dist/bin/pushary-prompt-hook.js +15 -15
  30. package/dist/bin/pushary-session-end-hook.js +15 -15
  31. package/dist/bin/pushary-session-start-hook.js +21 -19
  32. package/dist/bin/pushary-setup.js +97 -92
  33. package/dist/bin/pushary-status.js +18 -18
  34. package/dist/bin/pushary-stop-hook.js +15 -15
  35. package/dist/bin/pushary-stopfailure-hook.js +15 -15
  36. package/dist/bin/pushary-suggestions.js +6 -6
  37. package/dist/bin/pushary-transcript-register.js +8 -8
  38. package/dist/bin/pushary-upgrade.js +53 -27
  39. package/dist/bin/pushary-wait.js +6 -6
  40. package/dist/bin/pushary.js +4 -4
  41. package/dist/{chunk-WVSM3G4C.js → chunk-2LEH5IGX.js} +1 -1
  42. package/dist/{chunk-X5GHIFST.js → chunk-46TC24ET.js} +1 -1
  43. package/dist/{chunk-EJCPHLY2.js → chunk-56ZTIY6D.js} +1 -1
  44. package/dist/{chunk-AA2K3H7Y.js → chunk-63IQRYVP.js} +3 -3
  45. package/dist/{chunk-3ICRY72Q.js → chunk-6C4S3QYD.js} +1 -1
  46. package/dist/{chunk-PVDSN6TB.js → chunk-ABGN5RN2.js} +6 -3
  47. package/dist/{chunk-ZXGDBCIH.js → chunk-ALZZVC3E.js} +1 -1
  48. package/dist/{chunk-5CRQCIHR.js → chunk-BL3WAGIK.js} +3 -3
  49. package/dist/{chunk-26MUPAKS.js → chunk-DHJSBK63.js} +1 -1
  50. package/dist/{chunk-UR7XX2DV.js → chunk-EK7SZJ4K.js} +1 -1
  51. package/dist/{chunk-3YAOJEHG.js → chunk-EPOD7QHT.js} +4 -4
  52. package/dist/{chunk-6QPRQVQM.js → chunk-FCMWUYIE.js} +2 -2
  53. package/dist/{chunk-K3BIMGP4.js → chunk-H57DXSHR.js} +2 -2
  54. package/dist/{chunk-UKX5WIB5.js → chunk-IHUFRAHB.js} +3 -3
  55. package/dist/{chunk-VD2OAF7Q.js → chunk-JOWF4Y4P.js} +1 -1
  56. package/dist/{chunk-PMJEN6CX.js → chunk-JPABKXK6.js} +5 -5
  57. package/dist/{chunk-DT5Y55FI.js → chunk-K23WMLPY.js} +3 -3
  58. package/dist/{chunk-SRXBOMSR.js → chunk-L5YTS2BP.js} +1 -1
  59. package/dist/{chunk-GTSI6NG6.js → chunk-LD4MWJMD.js} +3 -3
  60. package/dist/{chunk-EGKD4S5H.js → chunk-LIESRXK5.js} +1 -1
  61. package/dist/{chunk-PTNSIGLB.js → chunk-MHQB62K5.js} +2 -2
  62. package/dist/{chunk-AZHTI5JX.js → chunk-MTKV4RUQ.js} +79 -13
  63. package/dist/{chunk-4JM2CK2A.js → chunk-N77BH7H2.js} +9 -3
  64. package/dist/{chunk-DUMZORSL.js → chunk-NECZKPJN.js} +27 -4
  65. package/dist/{chunk-43NXSBNZ.js → chunk-NELH25J7.js} +6 -6
  66. package/dist/{chunk-TQ6AGJVH.js → chunk-NHVEQLQC.js} +1 -1
  67. package/dist/{chunk-YQDZ7ZIL.js → chunk-OML4YFBN.js} +1 -1
  68. package/dist/{chunk-3OLEGCMU.js → chunk-P2546BBI.js} +2 -2
  69. package/dist/{chunk-2YSCVT6Q.js → chunk-Q7OXI6VS.js} +3 -3
  70. package/dist/{chunk-RLADRNPV.js → chunk-QKU46TK5.js} +1 -1
  71. package/dist/{chunk-7DBTOPOT.js → chunk-RH6KR6EH.js} +3 -3
  72. package/dist/{chunk-W26Q2DTD.js → chunk-RL7EOD6I.js} +80 -19
  73. package/dist/{chunk-7YAVKENV.js → chunk-SUIB4O3S.js} +53 -13
  74. package/dist/{chunk-KQBXPGXO.js → chunk-T6RIKJUO.js} +1 -1
  75. package/dist/{chunk-DT5CACWZ.js → chunk-U2L42GVI.js} +4 -4
  76. package/dist/{chunk-VZRCM362.js → chunk-VQPSWD3A.js} +3 -3
  77. package/dist/{chunk-LXRQLDGW.js → chunk-XDCXTDHH.js} +3 -3
  78. package/dist/{chunk-JZDRR7BL.js → chunk-XUW2DRAQ.js} +3 -3
  79. package/dist/{chunk-XQHPHJHR.js → chunk-XZRLFBEA.js} +1 -1
  80. package/dist/{chunk-2QPHUCXU.js → chunk-ZMPR436Z.js} +6 -6
  81. package/dist/{codex-app-cards-switch-ZQRT7MXB.js → codex-app-cards-switch-RENOSSDD.js} +14 -6
  82. package/dist/{codex-desktop-launch-X7UKQ4VR.js → codex-desktop-launch-I2D6QATK.js} +5 -1
  83. package/dist/{codex-session-launch-IX33LOQZ.js → codex-session-launch-KLH2FSSJ.js} +10 -10
  84. package/dist/{global-upgrade-DGP2E2NE.js → global-upgrade-AZN3BPI3.js} +5 -5
  85. package/dist/{identity-YISWVJ2A.js → identity-AQIMUWYN.js} +3 -3
  86. package/dist/{live-capabilities-44KFBOD4.js → live-capabilities-4IIFAMHU.js} +2 -2
  87. package/dist/{paths-VLGX4GJA.js → paths-X4IPV2WJ.js} +2 -2
  88. package/dist/{reapply-35F3WDTB.js → reapply-CXODG53B.js} +18 -15
  89. package/dist/src/index.js +13 -13
  90. package/dist/{upgrade-lock-LMO3DSSU.js → upgrade-lock-AHISGKER.js} +3 -3
  91. package/package.json +1 -1
@@ -1,15 +1,27 @@
1
1
  import {
2
2
  ensureCodexTrustsPusharyHooks
3
- } from "./chunk-6QPRQVQM.js";
3
+ } from "./chunk-FCMWUYIE.js";
4
+ import {
5
+ CODEX_INSTRUCTIONS_LABEL,
6
+ GEMINI_INSTRUCTIONS_LABEL,
7
+ OPENCODE_INSTRUCTIONS_LABEL,
8
+ fxIgnoresInstructionsFile,
9
+ fxInstructionsBody,
10
+ fxServerHolder,
11
+ macAppFxBridge,
12
+ refreshInstructionBlock,
13
+ renderAgentInstructions
14
+ } from "./chunk-MTKV4RUQ.js";
4
15
  import {
5
16
  OPENCODE_HOOK_BINARY,
6
17
  agentHookOwner,
7
18
  installOpenCodePlugin,
8
19
  macAppBridgeAvailable,
9
20
  openCodeHookArgv,
21
+ openCodeInstructionsFile,
10
22
  openCodePluginDir,
11
23
  openCodeWired
12
- } from "./chunk-DT5Y55FI.js";
24
+ } from "./chunk-K23WMLPY.js";
13
25
  import {
14
26
  detectClaudeVersion
15
27
  } from "./chunk-RIVNNBEK.js";
@@ -19,8 +31,9 @@ import {
19
31
  addPusharyHooks,
20
32
  addPusharyToolPermissions,
21
33
  compatibleConfigFile,
34
+ compatibleInstructionsFile,
22
35
  hasCompatibleHooks
23
- } from "./chunk-4JM2CK2A.js";
36
+ } from "./chunk-N77BH7H2.js";
24
37
  import {
25
38
  claudeUnprovenHolds,
26
39
  claudeWired,
@@ -28,7 +41,7 @@ import {
28
41
  codexWired,
29
42
  geminiWired,
30
43
  planHooks
31
- } from "./chunk-2YSCVT6Q.js";
44
+ } from "./chunk-Q7OXI6VS.js";
32
45
  import {
33
46
  CLAUDE_HOOK_BINARY,
34
47
  CLAUDE_HOOK_EVENTS,
@@ -39,7 +52,7 @@ import {
39
52
  needsReregistration,
40
53
  registrationSignatures,
41
54
  supportedClaudeEvents
42
- } from "./chunk-3ICRY72Q.js";
55
+ } from "./chunk-6C4S3QYD.js";
43
56
  import {
44
57
  formatVersion
45
58
  } from "./chunk-6ICPEJY5.js";
@@ -49,23 +62,29 @@ import {
49
62
  addCodexHooks,
50
63
  addCodexMcpServer,
51
64
  claudeRegistrationReceipt,
65
+ codexAgentsMd,
52
66
  codexConfigToml,
53
67
  codexHookPositions,
54
68
  codexHooksJson,
55
69
  codexRegistrationHolder,
56
70
  codexVacatedIndexes,
57
71
  dropVacatedCodexHookTrust,
72
+ fxAgentsMd,
73
+ fxConfigDir,
74
+ fxMcpProfile,
75
+ geminiMd,
58
76
  guardBinary,
59
77
  hasCodexHooks,
60
78
  namesOurBinary,
79
+ pusharyDir,
61
80
  registeredCommands,
62
81
  registrationHolderOf,
63
82
  vscodePluginMcp
64
- } from "./chunk-YQDZ7ZIL.js";
83
+ } from "./chunk-OML4YFBN.js";
65
84
  import {
66
85
  resolveGlobalBinDir,
67
86
  resolveGlobalBinary
68
- } from "./chunk-JZDRR7BL.js";
87
+ } from "./chunk-XUW2DRAQ.js";
69
88
  import {
70
89
  readJsonSafe,
71
90
  writeFileAtomic,
@@ -352,31 +371,71 @@ var reapplyCompatibleHooks = (profile, paths = {}) => {
352
371
  return CONFIGURED_BUT_FAILED;
353
372
  }
354
373
  };
374
+ var CONFIGURED_AND_UNCHANGED = { configured: true, reapplied: false, hooks: false, mcp: false };
375
+ var fxHolder = () => fxServerHolder(fxMcpProfile(), macAppFxBridge(pusharyDir()));
376
+ var inspectFxWiring = () => fxHolder() === "cli" ? CONFIGURED_AND_UNCHANGED : NOT_CONFIGURED;
377
+ var compatibleInstructionTarget = (profile) => {
378
+ const file = compatibleInstructionsFile(profile);
379
+ return file && profile.instructions ? { file, body: renderAgentInstructions(profile.instructions.label) } : null;
380
+ };
381
+ var fxInstructionTarget = () => fxIgnoresInstructionsFile(fxAgentsMd(), fxConfigDir()) ? null : { file: fxAgentsMd(), body: fxInstructionsBody() };
382
+ var instructionTargetOrNull = (target) => {
383
+ try {
384
+ return target();
385
+ } catch {
386
+ return null;
387
+ }
388
+ };
389
+ var refreshAgentInstructions = (target) => {
390
+ const resolved = instructionTargetOrNull(target);
391
+ return resolved ? { file: resolved.file, outcome: refreshInstructionBlock(resolved.file, resolved.body) } : null;
392
+ };
355
393
  var SETUP_CHOICE_BY_REAPPLY_ID = {
356
394
  claude: "claude_code",
357
395
  codex: "codex",
358
396
  gemini: "gemini_cli",
359
397
  cursor: "cursor",
360
398
  vscode: "vscode",
361
- opencode: "opencode"
399
+ opencode: "opencode",
400
+ fx: "fx"
362
401
  };
363
402
  var setupChoiceOf = (id) => isCompatibleAgentType(id) ? id : SETUP_CHOICE_BY_REAPPLY_ID[id];
364
403
  var reapplyHookOwner = (id, appAvailable) => agentHookOwner(setupChoiceOf(id), appAvailable);
365
- var reapplyHolder = (id, appAvailable) => planHooks({ owner: reapplyHookOwner(id, appAvailable), takeOverHooks: false, nonInteractive: true }) === "keep" ? "app" : "cli";
404
+ var hooksHeldByApp = (id, appAvailable) => planHooks({ owner: reapplyHookOwner(id, appAvailable), takeOverHooks: false, nonInteractive: true }) === "keep";
405
+ var fxHeldByApp = (appAvailable) => appAvailable && fxHolder() === "app";
406
+ var reapplyHolder = (id, appAvailable) => (id === "fx" ? fxHeldByApp(appAvailable) : hooksHeldByApp(id, appAvailable)) ? "app" : "cli";
366
407
  var KEPT_FOR_APP = { configured: true, reapplied: false, hooks: false, mcp: false };
367
408
  var FAILED_REAPPLY = { configured: false, reapplied: false, hooks: false, mcp: false, failed: true };
409
+ var noInstructionBlock = () => null;
368
410
  var reapplyAllAgents = (apiKey, options = {}) => {
369
411
  const runners = [
370
- { id: "claude", label: "Claude Code", run: () => reapplyClaudeSettings(apiKey) },
371
- { id: "codex", label: "Codex", run: () => reapplyCodexSettings(apiKey) },
372
- { id: "gemini", label: "Gemini CLI", run: () => reapplyGeminiSettings(apiKey) },
373
- { id: "cursor", label: "Cursor", run: () => reapplyCursorPlugin(apiKey) },
374
- { id: "vscode", label: "VS Code", run: () => reapplyVsCodePlugin(apiKey) },
375
- { id: "opencode", label: "OpenCode", run: () => reapplyOpenCodePlugin() },
412
+ { id: "claude", label: "Claude Code", run: () => reapplyClaudeSettings(apiKey), instructions: noInstructionBlock },
413
+ {
414
+ id: "codex",
415
+ label: "Codex",
416
+ run: () => reapplyCodexSettings(apiKey),
417
+ instructions: () => ({ file: codexAgentsMd(), body: renderAgentInstructions(CODEX_INSTRUCTIONS_LABEL) })
418
+ },
419
+ {
420
+ id: "gemini",
421
+ label: "Gemini CLI",
422
+ run: () => reapplyGeminiSettings(apiKey),
423
+ instructions: () => ({ file: geminiMd(), body: renderAgentInstructions(GEMINI_INSTRUCTIONS_LABEL) })
424
+ },
425
+ { id: "cursor", label: "Cursor", run: () => reapplyCursorPlugin(apiKey), instructions: noInstructionBlock },
426
+ { id: "vscode", label: "VS Code", run: () => reapplyVsCodePlugin(apiKey), instructions: noInstructionBlock },
427
+ {
428
+ id: "opencode",
429
+ label: "OpenCode",
430
+ run: () => reapplyOpenCodePlugin(),
431
+ instructions: () => ({ file: openCodeInstructionsFile(), body: renderAgentInstructions(OPENCODE_INSTRUCTIONS_LABEL) })
432
+ },
433
+ { id: "fx", label: "fx", run: inspectFxWiring, instructions: fxInstructionTarget },
376
434
  ...HOOK_COMPATIBLE_PROFILES.map((profile) => ({
377
435
  id: profile.agentType,
378
436
  label: profile.label,
379
- run: () => reapplyCompatibleHooks(profile)
437
+ run: () => reapplyCompatibleHooks(profile),
438
+ instructions: () => compatibleInstructionTarget(profile)
380
439
  }))
381
440
  ];
382
441
  const appAvailable = (options.appAvailable ?? macAppBridgeAvailable)();
@@ -384,13 +443,15 @@ var reapplyAllAgents = (apiKey, options = {}) => {
384
443
  for (const runner of runners) {
385
444
  try {
386
445
  if (reapplyHolder(runner.id, appAvailable) === "app") {
387
- done.push({ id: runner.id, label: runner.label, heldBy: "app", result: KEPT_FOR_APP });
446
+ done.push({ id: runner.id, label: runner.label, heldBy: "app", result: KEPT_FOR_APP, instructions: null });
388
447
  continue;
389
448
  }
390
449
  const result = runner.run();
391
- if (result.configured) done.push({ id: runner.id, label: runner.label, heldBy: "cli", result });
450
+ if (result.configured) {
451
+ done.push({ id: runner.id, label: runner.label, heldBy: "cli", result, instructions: refreshAgentInstructions(runner.instructions) });
452
+ }
392
453
  } catch {
393
- done.push({ id: runner.id, label: runner.label, heldBy: "cli", result: FAILED_REAPPLY });
454
+ done.push({ id: runner.id, label: runner.label, heldBy: "cli", result: FAILED_REAPPLY, instructions: null });
394
455
  }
395
456
  }
396
457
  return done;
@@ -1,16 +1,18 @@
1
1
  import {
2
+ codexAppOnThisMac,
2
3
  codexPassThroughScript,
3
4
  desktopEngine,
4
5
  desktopProxyScript,
6
+ everyProgramFileIsThere,
5
7
  installedCodexApp,
6
8
  shellQuoted
7
- } from "./chunk-PVDSN6TB.js";
9
+ } from "./chunk-ABGN5RN2.js";
8
10
  import {
9
11
  writeHuman
10
12
  } from "./chunk-QCGNGEGE.js";
11
13
  import {
12
14
  xml
13
- } from "./chunk-5CRQCIHR.js";
15
+ } from "./chunk-BL3WAGIK.js";
14
16
  import {
15
17
  CODEX_APP_LAUNCH_VARIABLE
16
18
  } from "./chunk-36NGFHE4.js";
@@ -28,6 +30,7 @@ var CODEX_APP_CARDS_DIRECTORY = "codex-app";
28
30
  var LAUNCHCTL = "/bin/launchctl";
29
31
  var LAUNCHER_NAME = "codex";
30
32
  var RECEIPT_NAME = "turned-on.json";
33
+ var TURNED_OFF_NAME = "turned-off";
31
34
  var PRIVATE_DIRECTORY_MODE = 448;
32
35
  var PRIVATE_PROGRAM_MODE = 448;
33
36
  var PRIVATE_FILE_MODE = 384;
@@ -42,17 +45,18 @@ var codexAppCardsPaths = (homeDir, uid) => {
42
45
  launcherDirectory,
43
46
  launcherPath: join(launcherDirectory, LAUNCHER_NAME),
44
47
  receiptPath: join(launcherDirectory, RECEIPT_NAME),
48
+ turnedOffPath: join(launcherDirectory, TURNED_OFF_NAME),
45
49
  loginItemDirectory,
46
50
  loginItemPath: join(loginItemDirectory, `${CODEX_APP_CARDS_LOGIN_ITEM}.plist`),
47
51
  loginItemTarget: `gui/${uid}/${CODEX_APP_CARDS_LOGIN_ITEM}`
48
52
  };
49
53
  };
50
- var codexAppCardsLoginScript = (launcherPath, engine) => [
51
- `if [ -x ${shellQuoted(launcherPath)} ] && [ -x ${shellQuoted(engine)} ]`,
54
+ var codexAppCardsLoginScript = (launcherPath, engine, entry) => [
55
+ `if [ -x ${shellQuoted(launcherPath)} ] && [ -x ${shellQuoted(engine)} ] && ${everyProgramFileIsThere(entry)}`,
52
56
  `&& [ -z "$(${LAUNCHCTL} getenv ${CODEX_APP_LAUNCH_VARIABLE})" ];`,
53
57
  `then ${LAUNCHCTL} setenv ${CODEX_APP_LAUNCH_VARIABLE} ${shellQuoted(launcherPath)}; fi`
54
58
  ].join(" ");
55
- var codexAppCardsLoginItem = (launcherPath, engine) => `<?xml version="1.0" encoding="UTF-8"?>
59
+ var codexAppCardsLoginItem = (launcherPath, engine, entry) => `<?xml version="1.0" encoding="UTF-8"?>
56
60
  <!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
57
61
  <plist version="1.0">
58
62
  <dict>
@@ -62,7 +66,7 @@ var codexAppCardsLoginItem = (launcherPath, engine) => `<?xml version="1.0" enco
62
66
  <array>
63
67
  <string>/bin/sh</string>
64
68
  <string>-c</string>
65
- <string>${xml(codexAppCardsLoginScript(launcherPath, engine))}</string>
69
+ <string>${xml(codexAppCardsLoginScript(launcherPath, engine, entry))}</string>
66
70
  </array>
67
71
  <key>RunAtLoad</key>
68
72
  <true/>
@@ -87,7 +91,7 @@ var codexAppCardsInstallation = (input) => {
87
91
  return {
88
92
  paths,
89
93
  launcherScript: desktopProxyScript(input.entry, input.app, input.engine, { turnsItselfOffWithoutTheEngine: true }),
90
- loginItem: codexAppCardsLoginItem(paths.launcherPath, input.engine),
94
+ loginItem: codexAppCardsLoginItem(paths.launcherPath, input.engine, input.entry),
91
95
  receipt: { entry: input.entry, app: input.app, engine: input.engine }
92
96
  };
93
97
  };
@@ -118,6 +122,7 @@ var turnCodexAppCardsOn = (installation, machine) => {
118
122
  machine.writeFile(paths.launcherPath, installation.launcherScript, PRIVATE_PROGRAM_MODE);
119
123
  machine.writeFile(paths.receiptPath, `${JSON.stringify(installation.receipt, null, 2)}
120
124
  `, PRIVATE_FILE_MODE);
125
+ if (machine.exists(paths.turnedOffPath)) machine.remove(paths.turnedOffPath);
121
126
  machine.makeDirectory(paths.loginItemDirectory, LOGIN_ITEM_DIRECTORY_MODE);
122
127
  machine.writeFile(paths.loginItemPath, installation.loginItem, LOGIN_ITEM_MODE);
123
128
  machine.setLaunchVariable(paths.launcherPath);
@@ -142,15 +147,38 @@ var turnCodexAppCardsOff = (paths, machine) => {
142
147
  }
143
148
  return { wasOn: ours || loginItemIsThere, launchLeftToAnotherProgram: value.length > 0 && !ours ? value : null };
144
149
  };
145
- var turnedOnByTheMacApp = (receipt) => receipt !== null && receipt.entry[0].endsWith(MAC_APP_HELPER);
150
+ var rememberCodexAppCardsWereTurnedOff = (paths, machine) => {
151
+ if (machine.exists(paths.turnedOffPath)) return;
152
+ machine.makeDirectory(paths.launcherDirectory, PRIVATE_DIRECTORY_MODE);
153
+ machine.writeFile(paths.turnedOffPath, "", PRIVATE_FILE_MODE);
154
+ };
155
+ var isTheMacAppsHelper = (entry) => entry.length > 0 && entry[0].endsWith(MAC_APP_HELPER);
156
+ var turnedOnByTheMacApp = (receipt) => receipt !== null && isTheMacAppsHelper(receipt.entry);
157
+ var codexAppCardsReport = (paths, machine) => ({
158
+ status: codexAppCardsStatus(paths, machine),
159
+ codexApp: machine.codexApp(),
160
+ turnedOnByTheMacApp: turnedOnByTheMacApp(codexAppCardsReceiptFrom(machine.readFile(paths.receiptPath))),
161
+ turnedOffOnPurpose: machine.exists(paths.turnedOffPath)
162
+ });
163
+ var isKeptOnForTheMacApp = (request, paths, machine) => request.keepWhatTheMacAppTurnedOn && turnedOnByTheMacApp(codexAppCardsReceiptFrom(machine.readFile(paths.receiptPath))) && codexAppCardsStatus(paths, machine).kind !== "off";
164
+ var isKeptOffForTheMacApp = (request, paths, machine) => request.keepWhatTheMacAppTurnedOn && machine.exists(paths.turnedOffPath);
165
+ var codexAppCardsFolderStays = (request, machine) => {
166
+ const paths = codexAppCardsPaths(request.homeDir, request.uid);
167
+ return isKeptOnForTheMacApp(request, paths, machine) || isKeptOffForTheMacApp(request, paths, machine);
168
+ };
169
+ var nothingIsTurnedOn = (paths, machine) => !machine.exists(paths.launcherPath) && !machine.exists(paths.loginItemPath) && machine.launchVariable() !== paths.launcherPath;
146
170
  var removeCodexAppCards = (request, machine) => {
147
171
  const paths = codexAppCardsPaths(request.homeDir, request.uid);
148
- if (!machine.exists(paths.launcherDirectory) && !machine.exists(paths.loginItemPath)) return "absent";
149
- const keptOnForTheMacApp = request.keepWhatTheMacAppTurnedOn && turnedOnByTheMacApp(codexAppCardsReceiptFrom(machine.readFile(paths.receiptPath))) && codexAppCardsStatus(paths, machine).kind !== "off";
150
- if (keptOnForTheMacApp) return "kept_for_the_mac_app";
172
+ const keepsTheOff = isKeptOffForTheMacApp(request, paths, machine);
173
+ if (nothingIsTurnedOn(paths, machine)) {
174
+ if (!request.dryRun && !keepsTheOff && machine.exists(paths.launcherDirectory)) machine.remove(paths.launcherDirectory);
175
+ return "absent";
176
+ }
177
+ if (isKeptOnForTheMacApp(request, paths, machine)) return "kept_for_the_mac_app";
151
178
  if (request.dryRun) return "removed";
152
179
  turnCodexAppCardsOff(paths, machine);
153
180
  machine.remove(paths.launcherDirectory);
181
+ if (keepsTheOff) rememberCodexAppCardsWereTurnedOff(paths, machine);
154
182
  return "removed";
155
183
  };
156
184
  var launchctl = (args) => execFileSync(LAUNCHCTL, [...args], { encoding: "utf8", stdio: ["ignore", "pipe", "pipe"] });
@@ -169,6 +197,7 @@ var fileContents = (path) => {
169
197
  }
170
198
  };
171
199
  var thisMacsCodexAppCardsMachine = () => ({
200
+ codexApp: codexAppOnThisMac,
172
201
  launchVariable: () => launchctlIgnoringFailure(["getenv", CODEX_APP_LAUNCH_VARIABLE]).trim(),
173
202
  setLaunchVariable: (value) => {
174
203
  launchctl(["setenv", CODEX_APP_LAUNCH_VARIABLE, value]);
@@ -192,7 +221,9 @@ var thisMacsCodexAppCardsMachine = () => ({
192
221
  }
193
222
  });
194
223
  var removeCodexAppCardsFromThisMac = (request) => removeCodexAppCards(request, thisMacsCodexAppCardsMachine());
195
- var USAGE = "Usage: pushary codex --app-cards on [path/to/Codex.app] | off | status";
224
+ var codexAppCardsFolderStaysOnThisMac = (request) => codexAppCardsFolderStays(request, thisMacsCodexAppCardsMachine());
225
+ var USAGE = "Usage: pushary codex --app-cards on [path/to/Codex.app] | off | status [--json]";
226
+ var AS_JSON = "--json";
196
227
  var TAKES_EFFECT_AFTER_REOPENING = "Quit Codex and open it again.";
197
228
  var TURN_THEM_ON_AGAIN = "Run the same command with on to repair it.";
198
229
  var runsFromATemporaryFolder = (entry) => entry.some((part) => part.includes(TEMPORARY_NPX_FOLDER));
@@ -220,17 +251,22 @@ var codexAppCardsCommand = async (args, entry, readAccount, machine, say) => {
220
251
  const uid = process.getuid?.();
221
252
  if (uid === void 0) throw new Error("Codex app cards need macOS");
222
253
  const paths = codexAppCardsPaths(homedir(), uid);
254
+ if (action === "status" && chosenApp === AS_JSON && rest.length === 0) {
255
+ say(JSON.stringify(codexAppCardsReport(paths, machine)));
256
+ return 0;
257
+ }
223
258
  if (action === "status" && chosenApp === void 0) {
224
259
  say(codexAppCardsStatusLine(codexAppCardsStatus(paths, machine)));
225
260
  return 0;
226
261
  }
227
262
  if (action === "off" && chosenApp === void 0) {
228
263
  const turnedOff = turnCodexAppCardsOff(paths, machine);
264
+ if (!isTheMacAppsHelper(entry)) rememberCodexAppCardsWereTurnedOff(paths, machine);
229
265
  say(turnedOff.wasOn ? `Codex app cards are off. ${TAKES_EFFECT_AFTER_REOPENING}` : "Codex app cards were already off.");
230
266
  if (turnedOff.launchLeftToAnotherProgram) say(ownedByAnotherProgram(turnedOff.launchLeftToAnotherProgram));
231
267
  return 0;
232
268
  }
233
- if (action !== "on" || rest.length > 0) throw new Error(USAGE);
269
+ if (action !== "on" || rest.length > 0 || chosenApp?.startsWith("--")) throw new Error(USAGE);
234
270
  if (!await readAccount()) throw new Error("Connect Pushary before turning Codex app cards on");
235
271
  const app = installedCodexApp(chosenApp);
236
272
  const engine = await desktopEngine(app);
@@ -262,8 +298,12 @@ export {
262
298
  codexAppCardsStatus,
263
299
  turnCodexAppCardsOn,
264
300
  turnCodexAppCardsOff,
301
+ rememberCodexAppCardsWereTurnedOff,
302
+ codexAppCardsReport,
303
+ codexAppCardsFolderStays,
265
304
  removeCodexAppCards,
266
305
  removeCodexAppCardsFromThisMac,
306
+ codexAppCardsFolderStaysOnThisMac,
267
307
  runsFromATemporaryFolder,
268
308
  codexAppCardsStatusLine,
269
309
  codexAppCardsCommand,
@@ -1,6 +1,6 @@
1
1
  import {
2
2
  pusharyDir
3
- } from "./chunk-YQDZ7ZIL.js";
3
+ } from "./chunk-OML4YFBN.js";
4
4
  import {
5
5
  writeFileAtomic
6
6
  } from "./chunk-AQFEP65J.js";
@@ -13,19 +13,19 @@ import {
13
13
  reportClientError,
14
14
  sendNotification,
15
15
  waitForAnswer
16
- } from "./chunk-2QPHUCXU.js";
16
+ } from "./chunk-ZMPR436Z.js";
17
17
  import {
18
18
  withRetry
19
- } from "./chunk-3OLEGCMU.js";
19
+ } from "./chunk-P2546BBI.js";
20
20
  import {
21
21
  getMachineId
22
- } from "./chunk-KQBXPGXO.js";
22
+ } from "./chunk-T6RIKJUO.js";
23
23
  import {
24
24
  reportedInstallSource
25
25
  } from "./chunk-4QQEUJL4.js";
26
26
  import {
27
27
  canonicalJson
28
- } from "./chunk-YQDZ7ZIL.js";
28
+ } from "./chunk-OML4YFBN.js";
29
29
  import {
30
30
  writeFileAtomic
31
31
  } from "./chunk-AQFEP65J.js";
@@ -6,10 +6,10 @@ import {
6
6
  } from "./chunk-DWQYCOPI.js";
7
7
  import {
8
8
  ensureDaemonRunning
9
- } from "./chunk-5CRQCIHR.js";
9
+ } from "./chunk-BL3WAGIK.js";
10
10
  import {
11
11
  hookOwnerOf
12
- } from "./chunk-2YSCVT6Q.js";
12
+ } from "./chunk-Q7OXI6VS.js";
13
13
  import {
14
14
  buildTranscriptRecords,
15
15
  decodePublicKey,
@@ -30,7 +30,7 @@ import {
30
30
  import {
31
31
  codexHome,
32
32
  pusharyDir
33
- } from "./chunk-YQDZ7ZIL.js";
33
+ } from "./chunk-OML4YFBN.js";
34
34
  import {
35
35
  writeJsonAtomic
36
36
  } from "./chunk-AQFEP65J.js";
@@ -3,21 +3,21 @@ import {
3
3
  expectedLaunchCapabilities,
4
4
  hasSpawnProvider,
5
5
  resolveControlPolicy
6
- } from "./chunk-WVSM3G4C.js";
6
+ } from "./chunk-2LEH5IGX.js";
7
7
  import {
8
8
  daemonHasRemoteProof,
9
9
  daemonServiceManagerAvailable,
10
10
  hasDaemonServiceDefinition,
11
11
  readDaemonNeedsLogin,
12
12
  readDaemonStatus
13
- } from "./chunk-5CRQCIHR.js";
13
+ } from "./chunk-BL3WAGIK.js";
14
14
  import {
15
15
  readControlMode,
16
16
  readKeySource
17
17
  } from "./chunk-VYBH6D4X.js";
18
18
  import {
19
19
  getMachineId
20
- } from "./chunk-KQBXPGXO.js";
20
+ } from "./chunk-T6RIKJUO.js";
21
21
  import {
22
22
  getBaseUrl
23
23
  } from "./chunk-CQ5JGRML.js";
@@ -360,9 +360,9 @@ var installGlobally = (options) => {
360
360
  }
361
361
  const started = (async () => {
362
362
  if (!npmIsOnPath()) throw new NpmMissingError();
363
- const { withUpgradeLock } = await import("./global-upgrade-DGP2E2NE.js");
364
- const { installWithUpgradeLock, ownsUpgradeLock } = await import("./upgrade-lock-LMO3DSSU.js");
365
- const { autoUpdateLock } = await import("./paths-VLGX4GJA.js");
363
+ const { withUpgradeLock } = await import("./global-upgrade-AZN3BPI3.js");
364
+ const { installWithUpgradeLock, ownsUpgradeLock } = await import("./upgrade-lock-AHISGKER.js");
365
+ const { autoUpdateLock } = await import("./paths-X4IPV2WJ.js");
366
366
  let result = "skipped";
367
367
  const install = async () => {
368
368
  const platform = process.platform;
@@ -14,7 +14,7 @@ import {
14
14
  } from "./chunk-FO3MDD26.js";
15
15
  import {
16
16
  callMcpTool
17
- } from "./chunk-3OLEGCMU.js";
17
+ } from "./chunk-P2546BBI.js";
18
18
  import {
19
19
  reportedInstallSource
20
20
  } from "./chunk-4QQEUJL4.js";
@@ -1,18 +1,18 @@
1
+ import {
2
+ SubscriptionRequiredError,
3
+ callMcpTool
4
+ } from "./chunk-P2546BBI.js";
1
5
  import {
2
6
  CLIENT_REPORT_DISABLE_ENV,
3
7
  isDisabledByEnv
4
8
  } from "./chunk-POFBE6ZY.js";
5
- import {
6
- SubscriptionRequiredError,
7
- callMcpTool
8
- } from "./chunk-3OLEGCMU.js";
9
9
  import {
10
10
  installNetworkDefaults,
11
11
  isNetworkFailure
12
- } from "./chunk-UR7XX2DV.js";
12
+ } from "./chunk-EK7SZJ4K.js";
13
13
  import {
14
14
  clientReportClaims
15
- } from "./chunk-YQDZ7ZIL.js";
15
+ } from "./chunk-OML4YFBN.js";
16
16
  import {
17
17
  getApiKey,
18
18
  getBaseUrl
@@ -3,30 +3,34 @@ import {
3
3
  CODEX_APP_CARDS_LOGIN_ITEM,
4
4
  codexAppCardsCommand,
5
5
  codexAppCardsCommandOnThisMac,
6
+ codexAppCardsFolderStays,
7
+ codexAppCardsFolderStaysOnThisMac,
6
8
  codexAppCardsInstallation,
7
9
  codexAppCardsLoginItem,
8
10
  codexAppCardsLoginScript,
9
11
  codexAppCardsPaths,
10
12
  codexAppCardsReceiptFrom,
13
+ codexAppCardsReport,
11
14
  codexAppCardsStatus,
12
15
  codexAppCardsStatusLine,
16
+ rememberCodexAppCardsWereTurnedOff,
13
17
  removeCodexAppCards,
14
18
  removeCodexAppCardsFromThisMac,
15
19
  runsFromATemporaryFolder,
16
20
  turnCodexAppCardsOff,
17
21
  turnCodexAppCardsOn
18
- } from "./chunk-7YAVKENV.js";
19
- import "./chunk-PVDSN6TB.js";
22
+ } from "./chunk-SUIB4O3S.js";
23
+ import "./chunk-ABGN5RN2.js";
20
24
  import "./chunk-XCEN33UP.js";
21
25
  import "./chunk-QCGNGEGE.js";
22
- import "./chunk-5CRQCIHR.js";
26
+ import "./chunk-BL3WAGIK.js";
23
27
  import "./chunk-XHKBHWLX.js";
24
28
  import "./chunk-VYBH6D4X.js";
25
29
  import "./chunk-36NGFHE4.js";
26
- import "./chunk-KQBXPGXO.js";
30
+ import "./chunk-T6RIKJUO.js";
27
31
  import "./chunk-4QQEUJL4.js";
28
- import "./chunk-YQDZ7ZIL.js";
29
- import "./chunk-JZDRR7BL.js";
32
+ import "./chunk-OML4YFBN.js";
33
+ import "./chunk-XUW2DRAQ.js";
30
34
  import "./chunk-AQFEP65J.js";
31
35
  import "./chunk-CQ5JGRML.js";
32
36
  import "./chunk-MC4VY5LK.js";
@@ -37,13 +41,17 @@ export {
37
41
  CODEX_APP_CARDS_LOGIN_ITEM,
38
42
  codexAppCardsCommand,
39
43
  codexAppCardsCommandOnThisMac,
44
+ codexAppCardsFolderStays,
45
+ codexAppCardsFolderStaysOnThisMac,
40
46
  codexAppCardsInstallation,
41
47
  codexAppCardsLoginItem,
42
48
  codexAppCardsLoginScript,
43
49
  codexAppCardsPaths,
44
50
  codexAppCardsReceiptFrom,
51
+ codexAppCardsReport,
45
52
  codexAppCardsStatus,
46
53
  codexAppCardsStatusLine,
54
+ rememberCodexAppCardsWereTurnedOff,
47
55
  removeCodexAppCards,
48
56
  removeCodexAppCardsFromThisMac,
49
57
  runsFromATemporaryFolder,
@@ -1,26 +1,30 @@
1
1
  import {
2
+ codexAppOnThisMac,
2
3
  codexDesktopCommand,
3
4
  codexEngineBehindLauncher,
4
5
  codexPassThroughScript,
5
6
  desktopEngine,
6
7
  desktopEngineFromManifest,
7
8
  desktopProxyScript,
9
+ everyProgramFileIsThere,
8
10
  installedCodexApp,
9
11
  shellQuoted,
10
12
  writeDesktopProxy
11
- } from "./chunk-PVDSN6TB.js";
13
+ } from "./chunk-ABGN5RN2.js";
12
14
  import "./chunk-XCEN33UP.js";
13
15
  import {
14
16
  CODEX_APP_LAUNCH_VARIABLE
15
17
  } from "./chunk-36NGFHE4.js";
16
18
  export {
17
19
  CODEX_APP_LAUNCH_VARIABLE,
20
+ codexAppOnThisMac,
18
21
  codexDesktopCommand,
19
22
  codexEngineBehindLauncher,
20
23
  codexPassThroughScript,
21
24
  desktopEngine,
22
25
  desktopEngineFromManifest,
23
26
  desktopProxyScript,
27
+ everyProgramFileIsThere,
24
28
  installedCodexApp,
25
29
  shellQuoted,
26
30
  writeDesktopProxy
@@ -11,11 +11,11 @@ import {
11
11
  isCodexQuestionLeftWithTheLocalClient,
12
12
  planCodexElicitation,
13
13
  reportOwnedQuestion
14
- } from "./chunk-GTSI6NG6.js";
14
+ } from "./chunk-LD4MWJMD.js";
15
15
  import "./chunk-UVT6B6XN.js";
16
- import "./chunk-WVSM3G4C.js";
16
+ import "./chunk-2LEH5IGX.js";
17
17
  import "./chunk-RIVNNBEK.js";
18
- import "./chunk-EJCPHLY2.js";
18
+ import "./chunk-56ZTIY6D.js";
19
19
  import "./chunk-5463UUO2.js";
20
20
  import "./chunk-GCN73COS.js";
21
21
  import "./chunk-XHKBHWLX.js";
@@ -23,16 +23,16 @@ import "./chunk-6ICPEJY5.js";
23
23
  import "./chunk-JBT3ZSJS.js";
24
24
  import {
25
25
  writeDegraded
26
- } from "./chunk-2QPHUCXU.js";
26
+ } from "./chunk-ZMPR436Z.js";
27
+ import "./chunk-P2546BBI.js";
27
28
  import "./chunk-POFBE6ZY.js";
28
- import "./chunk-3OLEGCMU.js";
29
- import "./chunk-SRXBOMSR.js";
30
- import "./chunk-UR7XX2DV.js";
31
- import "./chunk-KQBXPGXO.js";
29
+ import "./chunk-L5YTS2BP.js";
30
+ import "./chunk-EK7SZJ4K.js";
31
+ import "./chunk-T6RIKJUO.js";
32
32
  import "./chunk-7QLSKOSU.js";
33
33
  import "./chunk-KZERVKTD.js";
34
- import "./chunk-YQDZ7ZIL.js";
35
- import "./chunk-JZDRR7BL.js";
34
+ import "./chunk-OML4YFBN.js";
35
+ import "./chunk-XUW2DRAQ.js";
36
36
  import "./chunk-AQFEP65J.js";
37
37
  import "./chunk-CQ5JGRML.js";
38
38
  import "./chunk-MC4VY5LK.js";
@@ -5,13 +5,13 @@ import {
5
5
  readGlobalUpgradeSubject,
6
6
  upgradeInstalledPackage,
7
7
  withUpgradeLock
8
- } from "./chunk-DUMZORSL.js";
9
- import "./chunk-K3BIMGP4.js";
10
- import "./chunk-RLADRNPV.js";
8
+ } from "./chunk-NECZKPJN.js";
9
+ import "./chunk-H57DXSHR.js";
10
+ import "./chunk-QKU46TK5.js";
11
11
  import "./chunk-POFBE6ZY.js";
12
12
  import "./chunk-KZERVKTD.js";
13
- import "./chunk-YQDZ7ZIL.js";
14
- import "./chunk-JZDRR7BL.js";
13
+ import "./chunk-OML4YFBN.js";
14
+ import "./chunk-XUW2DRAQ.js";
15
15
  import "./chunk-AQFEP65J.js";
16
16
  import "./chunk-MC4VY5LK.js";
17
17
  import "./chunk-QTOLNRET.js";
@@ -2,9 +2,9 @@ import {
2
2
  getMachineId,
3
3
  getOrCreateMachineId,
4
4
  readExistingMachineId
5
- } from "./chunk-KQBXPGXO.js";
6
- import "./chunk-YQDZ7ZIL.js";
7
- import "./chunk-JZDRR7BL.js";
5
+ } from "./chunk-T6RIKJUO.js";
6
+ import "./chunk-OML4YFBN.js";
7
+ import "./chunk-XUW2DRAQ.js";
8
8
  import "./chunk-AQFEP65J.js";
9
9
  import "./chunk-QTOLNRET.js";
10
10
  import "./chunk-LF3TLC7B.js";