@pushary/agent-hooks 1.9.170 → 1.9.174
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 +20 -0
- package/dist/{api-3KBPIGV4.js → api-MNYX7TLY.js} +12 -12
- package/dist/bin/pushary-audit.js +4 -4
- package/dist/bin/pushary-bell-hook.js +31 -31
- package/dist/bin/pushary-bell.js +13 -12
- package/dist/bin/pushary-calls.js +16 -16
- package/dist/bin/pushary-claude.js +37 -39
- package/dist/bin/pushary-clean.js +49 -47
- package/dist/bin/pushary-codex-bridge.js +27 -27
- package/dist/bin/pushary-codex-hook.js +47 -49
- package/dist/bin/pushary-codex-session.js +8 -8
- package/dist/bin/pushary-codex.js +20 -19
- package/dist/bin/pushary-connect.js +37 -37
- package/dist/bin/pushary-cowork.js +5 -5
- package/dist/bin/pushary-daemon.js +57 -56
- package/dist/bin/pushary-disconnect.js +30 -30
- package/dist/bin/pushary-display-hook.js +26 -26
- package/dist/bin/pushary-doctor.js +54 -53
- package/dist/bin/pushary-elicitation-hook.js +34 -33
- package/dist/bin/pushary-gemini-bridge.js +25 -23
- package/dist/bin/pushary-gemini-hook.js +41 -43
- package/dist/bin/pushary-hook.js +39 -39
- package/dist/bin/pushary-login.js +32 -26
- package/dist/bin/pushary-logout.js +41 -33
- package/dist/bin/pushary-mcp.js +13 -13
- package/dist/bin/pushary-mode.js +17 -17
- package/dist/bin/pushary-notification-hook.js +30 -30
- package/dist/bin/pushary-opencode-hook.js +47 -56
- package/dist/bin/pushary-permission-denied-hook.js +39 -39
- package/dist/bin/pushary-permission-hook.js +39 -39
- package/dist/bin/pushary-post-hook.js +31 -31
- package/dist/bin/pushary-prompt-hook.js +30 -30
- package/dist/bin/pushary-session-end-hook.js +32 -32
- package/dist/bin/pushary-session-start-hook.js +42 -42
- package/dist/bin/pushary-sessions.js +15 -15
- package/dist/bin/pushary-setup.js +79 -68
- package/dist/bin/pushary-stats.js +5 -5
- package/dist/bin/pushary-status.js +38 -38
- package/dist/bin/pushary-stop-hook.js +30 -30
- package/dist/bin/pushary-stopfailure-hook.js +30 -30
- package/dist/bin/pushary-suggestions.js +17 -17
- package/dist/bin/pushary-transcript-register.js +21 -21
- package/dist/bin/pushary-transcripts.js +29 -29
- package/dist/bin/pushary-upgrade.js +46 -46
- package/dist/bin/pushary-wait.js +17 -17
- package/dist/bin/pushary.js +8 -8
- package/dist/{chunk-MPJAXUN2.js → chunk-2EHDZOJA.js} +14 -14
- package/dist/{chunk-BZILLAPJ.js → chunk-2IEU6RX5.js} +1 -1
- package/dist/{chunk-LEXVQXZU.js → chunk-3FOW4K2L.js} +4 -4
- package/dist/{chunk-UCND4JHN.js → chunk-3L5DXDPK.js} +1 -1
- package/dist/{chunk-3ZO7WCMV.js → chunk-4IOCYW6O.js} +3 -3
- package/dist/{chunk-NJSBHEEW.js → chunk-4NXEOPXZ.js} +1 -1
- package/dist/{chunk-352FIVVH.js → chunk-55L4JSPA.js} +1 -1
- package/dist/{chunk-EBHIVYSD.js → chunk-57C45LJT.js} +2 -2
- package/dist/{chunk-5OI4EW6G.js → chunk-5JCKVJC6.js} +5 -5
- package/dist/{chunk-GVIKF73A.js → chunk-5LIGHRBH.js} +1 -1
- package/dist/{chunk-TIRZZCS4.js → chunk-6355EUTT.js} +4 -4
- package/dist/{chunk-DXHRKDP7.js → chunk-6BZCNKCY.js} +5 -5
- package/dist/{chunk-7RNLPI6H.js → chunk-6HYQSAMW.js} +3 -3
- package/dist/{chunk-3UNQJ6AO.js → chunk-76T3UMRC.js} +32 -33
- package/dist/{chunk-65U6TH6P.js → chunk-7VG4JO77.js} +4 -4
- package/dist/{chunk-JNUZYDUC.js → chunk-7XALAS43.js} +3 -3
- package/dist/{chunk-W4NCWOVL.js → chunk-7YVSQ342.js} +1 -1
- package/dist/{chunk-TGYM6UQJ.js → chunk-A3JTWB74.js} +2 -2
- package/dist/{chunk-CNPTWWKJ.js → chunk-A3YA4EIY.js} +3 -3
- package/dist/{chunk-L6UCFQKZ.js → chunk-BHBHY35A.js} +4 -4
- package/dist/{chunk-IWKEIVDF.js → chunk-C7SKKHMD.js} +7 -5
- package/dist/{chunk-QJNI6MPV.js → chunk-CDUTYRXO.js} +4 -4
- package/dist/{chunk-DXUPOVJP.js → chunk-CPV25VW5.js} +1 -1
- package/dist/{chunk-2OMWK322.js → chunk-CTLI2HJE.js} +5 -5
- package/dist/{chunk-BX45H3DU.js → chunk-DJS7W4SC.js} +6 -6
- package/dist/{chunk-2TRYSF64.js → chunk-DNJKQHK2.js} +20 -1
- package/dist/{chunk-FTE5ECGI.js → chunk-DPHYIJNF.js} +4 -4
- package/dist/{chunk-57MF5I5V.js → chunk-E2WABTIY.js} +7 -7
- package/dist/{chunk-OKM76UDB.js → chunk-ET2BWLQX.js} +3 -3
- package/dist/{chunk-OJUW7QW2.js → chunk-FAMKGTCF.js} +1 -1
- package/dist/{chunk-HP5RU3OU.js → chunk-FPF7ZSH5.js} +3 -3
- package/dist/{chunk-SKDSU735.js → chunk-FS7WOHFO.js} +5 -5
- package/dist/{chunk-LILP3T24.js → chunk-GGNKMBCN.js} +4 -4
- package/dist/{chunk-NYDJHJIJ.js → chunk-GPHESUOZ.js} +6 -6
- package/dist/{chunk-TBH5WLIA.js → chunk-GTCNACQ2.js} +5 -5
- package/dist/{chunk-K5HACZJ3.js → chunk-H3MY3EQP.js} +4 -4
- package/dist/{chunk-DVBRMNFM.js → chunk-HGVGOGVD.js} +3 -3
- package/dist/{chunk-NWKXT7LC.js → chunk-HLK3ZELO.js} +2 -2
- package/dist/{chunk-CLT4J5N5.js → chunk-HUJWZIQ2.js} +2 -2
- package/dist/{chunk-HXVCULWA.js → chunk-HZGSGLK4.js} +6 -6
- package/dist/{chunk-7AENNOGX.js → chunk-IP4NJN6G.js} +1 -1
- package/dist/{chunk-MVWWEQQG.js → chunk-IQNM745W.js} +3 -3
- package/dist/{chunk-GZZ7XGL5.js → chunk-JG2ZVO5L.js} +1 -1
- package/dist/{chunk-RSVW634O.js → chunk-JXOVA3JW.js} +6 -6
- package/dist/{chunk-HZANYISD.js → chunk-K5NBHOE6.js} +2 -2
- package/dist/{chunk-3I3RUJRD.js → chunk-LH5JTAAH.js} +2 -2
- package/dist/{chunk-IHNII3GT.js → chunk-LIVVVKIZ.js} +3 -3
- package/dist/{chunk-AVN4A4A6.js → chunk-M4KQPSMS.js} +1 -1
- package/dist/{chunk-SDLL4YPS.js → chunk-MF6FSDM4.js} +3 -3
- package/dist/{chunk-SSKNRWWS.js → chunk-N73CKAC6.js} +1 -1
- package/dist/{chunk-YEZL4T4K.js → chunk-O4AAXXXP.js} +4 -4
- package/dist/{chunk-OHVQ75S7.js → chunk-OBNVYNPQ.js} +3 -3
- package/dist/{chunk-CFZUESTS.js → chunk-OFKKNHYJ.js} +1 -1
- package/dist/{chunk-EGPOBJZG.js → chunk-OLKAGHOO.js} +1 -1
- package/dist/{chunk-LML7I4FY.js → chunk-PAYK5BD7.js} +2 -2
- package/dist/{chunk-WI2WYKSE.js → chunk-PDIN6FE5.js} +1 -1
- package/dist/{chunk-TODDEIYG.js → chunk-PM2NRK6Y.js} +12 -2
- package/dist/{chunk-SADLXUUA.js → chunk-PWJ76P2L.js} +7 -7
- package/dist/{chunk-T33PQ3TE.js → chunk-PZNVSYIY.js} +6 -6
- package/dist/{chunk-UDPXX6YR.js → chunk-QCZMBOMF.js} +1 -1
- package/dist/{chunk-CXKAP6DR.js → chunk-R3EIRYON.js} +5 -5
- package/dist/{chunk-ZA7N6SUH.js → chunk-R4RL4UDT.js} +5 -5
- package/dist/{chunk-W4TTC7MU.js → chunk-RIHIXQAL.js} +12 -12
- package/dist/{chunk-XI7MSL4R.js → chunk-RT6FAMIF.js} +27 -26
- package/dist/{chunk-IV7WDCKS.js → chunk-S3X6WLW5.js} +1 -1
- package/dist/{chunk-6KL27ETS.js → chunk-SHLAHE46.js} +10 -10
- package/dist/{chunk-5TNFIUN3.js → chunk-SNY4ABHS.js} +4 -4
- package/dist/{chunk-CYTPQDQY.js → chunk-TCE3J44Z.js} +1 -1
- package/dist/{chunk-VX6ZYAOA.js → chunk-TRXYUOWW.js} +8 -8
- package/dist/{chunk-A2DVMIX4.js → chunk-TU5DTA2V.js} +1 -1
- package/dist/{chunk-TNYOSIAY.js → chunk-UJ6ZJNHK.js} +3 -3
- package/dist/{chunk-XR27HPYC.js → chunk-UOPOVQ2P.js} +2 -1
- package/dist/{chunk-L77OIGRB.js → chunk-US4LUIFU.js} +20 -0
- package/dist/{chunk-KE5ED475.js → chunk-VCWHZDP3.js} +3 -3
- package/dist/{chunk-FD7JHIET.js → chunk-VH2DDTBE.js} +12 -12
- package/dist/{chunk-2SMEEXDR.js → chunk-VLEKL3PF.js} +1 -1
- package/dist/{chunk-Y6ILCLKE.js → chunk-VRNGMRJA.js} +1 -1
- package/dist/{chunk-RGE64J2V.js → chunk-WAZIEUIG.js} +7 -5
- package/dist/{chunk-LT3B5432.js → chunk-WWVVLMPJ.js} +5 -3
- package/dist/{chunk-TTTMOX73.js → chunk-X5LTD4VA.js} +2 -2
- package/dist/{chunk-MPCJB6I7.js → chunk-XZOYXQ6J.js} +6 -6
- package/dist/{chunk-JTFD3KQ6.js → chunk-YDYKKSFU.js} +224 -75
- package/dist/{chunk-BFZHRQJU.js → chunk-YE7WPP7M.js} +1 -1
- package/dist/{chunk-IGKHWARK.js → chunk-YFOR2JQQ.js} +2 -2
- package/dist/{chunk-7E4OSMST.js → chunk-YXLWKFKC.js} +6 -6
- package/dist/{chunk-GFWQNXX7.js → chunk-Z6YRFNN3.js} +5 -5
- package/dist/{chunk-EPBS4KJR.js → chunk-ZLXN26UD.js} +6 -6
- package/dist/{codex-app-cards-switch-AKCQRBUP.js → codex-app-cards-switch-MJA47AZY.js} +13 -13
- package/dist/{codex-card-routing-QGOX4RNI.js → codex-card-routing-2MDDCMAO.js} +2 -2
- package/dist/{codex-desktop-launch-SCQW4KAV.js → codex-desktop-launch-7IVPOMSK.js} +1 -1
- package/dist/{codex-session-launch-4EVYIYEQ.js → codex-session-launch-U6JUH6X6.js} +24 -24
- package/dist/{config-QIHLQCEV.js → config-S2OVEI6F.js} +3 -3
- package/dist/{global-upgrade-WHSNOE3E.js → global-upgrade-XGDWDFQN.js} +11 -11
- package/dist/{identity-NEXDWMLO.js → identity-7LLNHIP3.js} +5 -5
- package/dist/{live-capabilities-CC7L4VDX.js → live-capabilities-CI46M4XO.js} +6 -6
- package/dist/{paths-J3MVJDQI.js → paths-FVQYVHLH.js} +4 -4
- package/dist/reapply-M4DKHUZX.js +69 -0
- package/dist/src/index.js +38 -38
- package/dist/{upgrade-lock-7PPYIRBP.js → upgrade-lock-DTWLFPH2.js} +5 -5
- package/dist/{usage-GDUDYZSV.js → usage-IHNVIPGZ.js} +3 -3
- package/package.json +1 -1
- package/dist/reapply-6FNUVXCL.js +0 -69
|
@@ -1,14 +1,14 @@
|
|
|
1
1
|
import {
|
|
2
2
|
autoUpdateLock
|
|
3
|
-
} from "./chunk-
|
|
3
|
+
} from "./chunk-MF6FSDM4.js";
|
|
4
4
|
import {
|
|
5
5
|
installPackageGlobally,
|
|
6
6
|
npmErrorMessage,
|
|
7
7
|
throwIfNpmRefusesInstall
|
|
8
|
-
} from "./chunk-
|
|
8
|
+
} from "./chunk-GGNKMBCN.js";
|
|
9
9
|
import {
|
|
10
10
|
writeJsonAtomic
|
|
11
|
-
} from "./chunk-
|
|
11
|
+
} from "./chunk-PM2NRK6Y.js";
|
|
12
12
|
import {
|
|
13
13
|
CLI_PACKAGE_NAMES
|
|
14
14
|
} from "./chunk-UQTQ6HPO.js";
|
|
@@ -3,13 +3,13 @@ import {
|
|
|
3
3
|
} from "./chunk-WHB622LP.js";
|
|
4
4
|
import {
|
|
5
5
|
ensureDaemonRunning
|
|
6
|
-
} from "./chunk-
|
|
6
|
+
} from "./chunk-TRXYUOWW.js";
|
|
7
7
|
import {
|
|
8
8
|
hookOwnerOf
|
|
9
|
-
} from "./chunk-
|
|
9
|
+
} from "./chunk-7VG4JO77.js";
|
|
10
10
|
import {
|
|
11
11
|
hookMeaning
|
|
12
|
-
} from "./chunk-
|
|
12
|
+
} from "./chunk-OFKKNHYJ.js";
|
|
13
13
|
import {
|
|
14
14
|
buildTranscriptRecords,
|
|
15
15
|
changedRecipientsMessage,
|
|
@@ -24,35 +24,35 @@ import {
|
|
|
24
24
|
uploadTranscriptRecords,
|
|
25
25
|
verifyAnchoredRecipients,
|
|
26
26
|
wrapSessionKey
|
|
27
|
-
} from "./chunk-
|
|
27
|
+
} from "./chunk-6BZCNKCY.js";
|
|
28
28
|
import {
|
|
29
29
|
external_exports,
|
|
30
30
|
ownedOnlyByThisUser,
|
|
31
31
|
savedTranscriptReadPositions
|
|
32
|
-
} from "./chunk-
|
|
32
|
+
} from "./chunk-55L4JSPA.js";
|
|
33
33
|
import {
|
|
34
34
|
transcriptEnvironmentPreference,
|
|
35
35
|
transcriptsEnabled
|
|
36
|
-
} from "./chunk-
|
|
36
|
+
} from "./chunk-YE7WPP7M.js";
|
|
37
37
|
import {
|
|
38
38
|
fetchAsCredential
|
|
39
|
-
} from "./chunk-
|
|
39
|
+
} from "./chunk-N73CKAC6.js";
|
|
40
40
|
import {
|
|
41
41
|
readTranscriptPreference
|
|
42
|
-
} from "./chunk-
|
|
42
|
+
} from "./chunk-YDYKKSFU.js";
|
|
43
43
|
import {
|
|
44
44
|
claudeConfigDir,
|
|
45
45
|
codexHome,
|
|
46
46
|
pusharyDir
|
|
47
|
-
} from "./chunk-
|
|
47
|
+
} from "./chunk-MF6FSDM4.js";
|
|
48
48
|
import {
|
|
49
49
|
getApiKey,
|
|
50
50
|
getBaseUrl
|
|
51
|
-
} from "./chunk-
|
|
51
|
+
} from "./chunk-TU5DTA2V.js";
|
|
52
52
|
import {
|
|
53
53
|
writeJsonAtomic,
|
|
54
54
|
writeJsonAtomicDurable
|
|
55
|
-
} from "./chunk-
|
|
55
|
+
} from "./chunk-PM2NRK6Y.js";
|
|
56
56
|
import {
|
|
57
57
|
PENDING_COMMAND_PREFIX,
|
|
58
58
|
SESSION_HISTORY_BACKFILL_LIMIT_BYTES,
|
|
@@ -60,7 +60,7 @@ import {
|
|
|
60
60
|
isHookSource,
|
|
61
61
|
isRecord,
|
|
62
62
|
redactSecretsFromContent
|
|
63
|
-
} from "./chunk-
|
|
63
|
+
} from "./chunk-US4LUIFU.js";
|
|
64
64
|
|
|
65
65
|
// src/transcript-registration.ts
|
|
66
66
|
import { createHash as createHash4 } from "crypto";
|
|
@@ -13,16 +13,16 @@ import {
|
|
|
13
13
|
} from "./chunk-WHB622LP.js";
|
|
14
14
|
import {
|
|
15
15
|
keyPrefix
|
|
16
|
-
} from "./chunk-
|
|
16
|
+
} from "./chunk-YDYKKSFU.js";
|
|
17
17
|
import {
|
|
18
18
|
getBaseUrl
|
|
19
|
-
} from "./chunk-
|
|
19
|
+
} from "./chunk-TU5DTA2V.js";
|
|
20
20
|
import {
|
|
21
21
|
NPX_LATEST_COMMAND
|
|
22
|
-
} from "./chunk-
|
|
22
|
+
} from "./chunk-S3X6WLW5.js";
|
|
23
23
|
import {
|
|
24
24
|
isValidApiKey
|
|
25
|
-
} from "./chunk-
|
|
25
|
+
} from "./chunk-US4LUIFU.js";
|
|
26
26
|
|
|
27
27
|
// src/cli/login-ui.ts
|
|
28
28
|
import { hostname } from "os";
|
|
@@ -265,7 +265,8 @@ var REUSED_KEY_SOURCE_LABELS = {
|
|
|
265
265
|
var maskKey = (key) => `${key.slice(0, 8)}...${key.slice(-4)}`;
|
|
266
266
|
var describeFoundKey = (reusable) => `Found ${REUSED_KEY_SOURCE_LABELS[reusable.source]}: ${maskKey(reusable.key)}`;
|
|
267
267
|
var describeUsedKey = (reusable) => `Using ${REUSED_KEY_SOURCE_LABELS[reusable.source]}: ${maskKey(reusable.key)}`;
|
|
268
|
-
var
|
|
268
|
+
var someoneIsAtTheTerminal = (context) => context.stdoutIsTty && !context.nonInteractive;
|
|
269
|
+
var canAskAtTheTerminal = (context) => someoneIsAtTheTerminal(context) && !context.dryRun;
|
|
269
270
|
var keyReuseConfirmation = (context) => canAskAtTheTerminal(context) && context.canPairWithApp ? "ask" : "announce";
|
|
270
271
|
var accountHandleOf = (identity) => identity.siteSlug ? `@${identity.siteSlug}` : identity.siteName || null;
|
|
271
272
|
var keyAccountHandle = (check) => check.kind === "ok" ? accountHandleOf(check.identity) : null;
|
|
@@ -314,6 +315,7 @@ export {
|
|
|
314
315
|
pickReusableKey,
|
|
315
316
|
describeFoundKey,
|
|
316
317
|
describeUsedKey,
|
|
318
|
+
someoneIsAtTheTerminal,
|
|
317
319
|
canAskAtTheTerminal,
|
|
318
320
|
keyReuseConfirmation,
|
|
319
321
|
keyAccountHandle,
|
|
@@ -1,6 +1,9 @@
|
|
|
1
|
+
import {
|
|
2
|
+
projectNameFor
|
|
3
|
+
} from "./chunk-DNJKQHK2.js";
|
|
1
4
|
import {
|
|
2
5
|
readConfigFileKey
|
|
3
|
-
} from "./chunk-
|
|
6
|
+
} from "./chunk-YDYKKSFU.js";
|
|
4
7
|
|
|
5
8
|
// src/bell/fleet.ts
|
|
6
9
|
import { closeSync, constants, futimesSync, lstatSync, mkdirSync, openSync, readdirSync, unlinkSync } from "fs";
|
|
@@ -155,7 +158,6 @@ var upgradeNotice = (context, deps = {}) => {
|
|
|
155
158
|
};
|
|
156
159
|
|
|
157
160
|
// src/bell/handler.ts
|
|
158
|
-
import { basename } from "path";
|
|
159
161
|
var FINISHED_NOTIFICATIONS = /* @__PURE__ */ new Set(["agent_completed"]);
|
|
160
162
|
var BLOCKED_NOTIFICATIONS = /* @__PURE__ */ new Set(["idle_prompt", "agent_needs_input"]);
|
|
161
163
|
var SUMMARY_MAX = 100;
|
|
@@ -165,7 +167,7 @@ var summarize = (message, fallback) => {
|
|
|
165
167
|
return collapsed ? collapsed.slice(0, SUMMARY_MAX) : fallback;
|
|
166
168
|
};
|
|
167
169
|
var decideBell = (input) => {
|
|
168
|
-
const project =
|
|
170
|
+
const project = projectNameFor(input.cwd);
|
|
169
171
|
const notifType = input.notification_type ?? input.type ?? "";
|
|
170
172
|
if (FINISHED_NOTIFICATIONS.has(notifType)) {
|
|
171
173
|
return {
|
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
import {
|
|
2
2
|
external_exports
|
|
3
|
-
} from "./chunk-
|
|
3
|
+
} from "./chunk-55L4JSPA.js";
|
|
4
4
|
import {
|
|
5
5
|
RETRY_ACK,
|
|
6
6
|
refusedReceiptMessage
|
|
7
|
-
} from "./chunk-
|
|
7
|
+
} from "./chunk-5LIGHRBH.js";
|
|
8
8
|
|
|
9
9
|
// src/command-receipts.ts
|
|
10
10
|
import { randomUUID } from "crypto";
|
|
@@ -1,25 +1,25 @@
|
|
|
1
1
|
import {
|
|
2
2
|
openClawLauncherCandidates
|
|
3
|
-
} from "./chunk-
|
|
3
|
+
} from "./chunk-O4AAXXXP.js";
|
|
4
4
|
import {
|
|
5
5
|
openCodeConfigDirFrom
|
|
6
|
-
} from "./chunk-
|
|
6
|
+
} from "./chunk-PWJ76P2L.js";
|
|
7
7
|
import {
|
|
8
8
|
nativeClaudeInstallPath
|
|
9
|
-
} from "./chunk-
|
|
9
|
+
} from "./chunk-TCE3J44Z.js";
|
|
10
10
|
import {
|
|
11
11
|
grokHome
|
|
12
|
-
} from "./chunk-
|
|
12
|
+
} from "./chunk-R3EIRYON.js";
|
|
13
13
|
import {
|
|
14
14
|
claudeConfigDir,
|
|
15
15
|
clineDataDirectory,
|
|
16
16
|
codexHomeFrom,
|
|
17
17
|
openClawEnvironmentOf,
|
|
18
18
|
openClawPathsFrom
|
|
19
|
-
} from "./chunk-
|
|
19
|
+
} from "./chunk-MF6FSDM4.js";
|
|
20
20
|
import {
|
|
21
21
|
HOOK_COMPATIBLE_PROFILES
|
|
22
|
-
} from "./chunk-
|
|
22
|
+
} from "./chunk-US4LUIFU.js";
|
|
23
23
|
|
|
24
24
|
// src/vscode-config.ts
|
|
25
25
|
import { homedir } from "os";
|
|
@@ -1,20 +1,21 @@
|
|
|
1
1
|
import {
|
|
2
2
|
resolveInstallSourceFor
|
|
3
|
-
} from "./chunk-
|
|
3
|
+
} from "./chunk-LH5JTAAH.js";
|
|
4
4
|
import {
|
|
5
5
|
configFilePath
|
|
6
|
-
} from "./chunk-
|
|
6
|
+
} from "./chunk-TU5DTA2V.js";
|
|
7
7
|
import {
|
|
8
8
|
backupFile,
|
|
9
|
+
backupFileInto,
|
|
9
10
|
readJsonSafe,
|
|
10
11
|
writeFileAtomic,
|
|
11
12
|
writeJsonAtomic
|
|
12
|
-
} from "./chunk-
|
|
13
|
+
} from "./chunk-PM2NRK6Y.js";
|
|
13
14
|
import {
|
|
14
15
|
API_KEY_PREFIX_PATTERN,
|
|
15
16
|
isRecord,
|
|
16
17
|
isValidApiKey
|
|
17
|
-
} from "./chunk-
|
|
18
|
+
} from "./chunk-US4LUIFU.js";
|
|
18
19
|
|
|
19
20
|
// src/shell-alias.ts
|
|
20
21
|
import { homedir } from "os";
|
|
@@ -98,9 +99,9 @@ var removeClaudeAlias = () => {
|
|
|
98
99
|
};
|
|
99
100
|
|
|
100
101
|
// src/keystore.ts
|
|
101
|
-
import { chmodSync, existsSync as existsSync2, readFileSync as readFileSync2, realpathSync, writeFileSync as writeFileSync2 } from "fs";
|
|
102
|
+
import { chmodSync, constants as fsConstants, copyFileSync, existsSync as existsSync2, lstatSync, mkdirSync, readdirSync, readFileSync as readFileSync2, realpathSync, rmSync, statSync, writeFileSync as writeFileSync2 } from "fs";
|
|
102
103
|
import { homedir as homedir2 } from "os";
|
|
103
|
-
import { join as join2 } from "path";
|
|
104
|
+
import { basename, dirname, isAbsolute, join as join2, relative } from "path";
|
|
104
105
|
var KEY_FILE_MODE = 384;
|
|
105
106
|
var FALLBACK_RCS = [".zshrc", ".zprofile", ".bashrc", ".bash_profile"];
|
|
106
107
|
var OUR_EXPORT = /^[ \t]*export[ \t]+PUSHARY_API_KEY=(['"]?)(pk_[a-f0-9]+\.[a-f0-9]+)\1[ \t]*$/;
|
|
@@ -108,12 +109,155 @@ var MENTIONS_KEY = /PUSHARY_API_KEY/;
|
|
|
108
109
|
var isComment = (line) => line.trimStart().startsWith("#");
|
|
109
110
|
var exportLine = (apiKey) => `export PUSHARY_API_KEY='${apiKey}'`;
|
|
110
111
|
var LOGOUT_MARK = "# removed by pushary logout";
|
|
111
|
-
var disabledExportLine = (line) => `# ${line.trim()} ${LOGOUT_MARK}`;
|
|
112
112
|
var isDisabledExport = (line) => {
|
|
113
113
|
const trimmed = line.trim();
|
|
114
114
|
if (!isComment(trimmed) || !trimmed.endsWith(LOGOUT_MARK)) return false;
|
|
115
115
|
return OUR_EXPORT.test(trimmed.slice(1, -LOGOUT_MARK.length).trim());
|
|
116
116
|
};
|
|
117
|
+
var KEY_ENV_FILE_NAME = "env";
|
|
118
|
+
var RC_BACKUP_DIRECTORY_NAME = "backups";
|
|
119
|
+
var PATH_SAFE_IN_DOUBLE_QUOTES = /^[A-Za-z0-9._\/-]+$/;
|
|
120
|
+
var OUR_KEY_LOADER = /^[ \t]*if \[ -f ("\$HOME\/[A-Za-z0-9._\/-]+"|'(?:[^']|'\\'')+') \]; then \. \1; fi[ \t]*$/;
|
|
121
|
+
var OLD_RC_BACKUP_MARK = ".pushary-backup-";
|
|
122
|
+
var INDENTATION = /^[ \t]*/;
|
|
123
|
+
var BLOCK_OPENER = /(?:^|[\s;])(?:then|else|do|\{|\()$/;
|
|
124
|
+
var TRAILING_SHELL_COMMENT = /[ \t]+#.*$/;
|
|
125
|
+
var SHELL_NO_OP = ":";
|
|
126
|
+
var MAX_BACKUP_NAME_ATTEMPTS = 100;
|
|
127
|
+
var keyEnvFilePath = () => join2(dirname(configFilePath()), KEY_ENV_FILE_NAME);
|
|
128
|
+
var rcBackupDirectory = () => join2(dirname(configFilePath()), RC_BACKUP_DIRECTORY_NAME);
|
|
129
|
+
var singleQuoted = (value) => `'${value.replaceAll("'", `'\\''`)}'`;
|
|
130
|
+
var homeRelativePathOf = (path, home) => {
|
|
131
|
+
const inHome = relative(home, path);
|
|
132
|
+
return inHome !== "" && !inHome.startsWith("..") && !isAbsolute(inHome) && PATH_SAFE_IN_DOUBLE_QUOTES.test(inHome) ? inHome : null;
|
|
133
|
+
};
|
|
134
|
+
var shellPathOf = (path, home) => {
|
|
135
|
+
const inHome = homeRelativePathOf(path, home);
|
|
136
|
+
return inHome === null ? singleQuoted(path) : `"$HOME/${inHome}"`;
|
|
137
|
+
};
|
|
138
|
+
var keyLoaderLine = (envFile = keyEnvFilePath(), home = homedir2()) => {
|
|
139
|
+
const path = shellPathOf(envFile, home);
|
|
140
|
+
return `if [ -f ${path} ]; then . ${path}; fi`;
|
|
141
|
+
};
|
|
142
|
+
var isKeyLoaderLine = (line) => OUR_KEY_LOADER.test(line);
|
|
143
|
+
var isActiveKeyExport = (line) => OUR_EXPORT.test(line);
|
|
144
|
+
var isPusharyKeyLine = (line) => isActiveKeyExport(line) || isDisabledExport(line);
|
|
145
|
+
var indentationOf = (line) => INDENTATION.exec(line)?.[0] ?? "";
|
|
146
|
+
var exportedKeyIn = (line) => {
|
|
147
|
+
const key = OUR_EXPORT.exec(line)?.[2];
|
|
148
|
+
return key === void 0 ? [] : [key];
|
|
149
|
+
};
|
|
150
|
+
var replaceKeyLinesWithLoader = (lines, loader, isReplacedLine = isPusharyKeyLine) => {
|
|
151
|
+
const next = lines.map((line) => isReplacedLine(line) ? `${indentationOf(line)}${loader}` : line);
|
|
152
|
+
return {
|
|
153
|
+
lines: next,
|
|
154
|
+
exportedKeys: lines.flatMap(exportedKeyIn),
|
|
155
|
+
replacedLineCount: lines.filter(isReplacedLine).length,
|
|
156
|
+
loaderPresent: next.some((line) => line.trim() === loader)
|
|
157
|
+
};
|
|
158
|
+
};
|
|
159
|
+
var opensABlock = (line) => line !== void 0 && [line, line.replace(TRAILING_SHELL_COMMENT, "")].some((candidate) => BLOCK_OPENER.test(candidate.trimEnd()));
|
|
160
|
+
var isMeaningfulShellLine = (line) => line.trim() !== "" && !isComment(line);
|
|
161
|
+
var isShellNoOp = (line) => line?.trim() === SHELL_NO_OP;
|
|
162
|
+
var needsABodyInPlaceOf = (removed, lastMeaningful) => !isShellNoOp(lastMeaningful) && (indentationOf(removed) !== "" || opensABlock(lastMeaningful));
|
|
163
|
+
var withoutKeyLines = (lines, isKeyLine) => {
|
|
164
|
+
const kept = [];
|
|
165
|
+
let lastMeaningful;
|
|
166
|
+
for (const line of lines) {
|
|
167
|
+
if (!isKeyLine(line)) {
|
|
168
|
+
kept.push(line);
|
|
169
|
+
if (isMeaningfulShellLine(line)) lastMeaningful = line;
|
|
170
|
+
} else if (needsABodyInPlaceOf(line, lastMeaningful)) {
|
|
171
|
+
lastMeaningful = `${indentationOf(line)}${SHELL_NO_OP}`;
|
|
172
|
+
kept.push(lastMeaningful);
|
|
173
|
+
}
|
|
174
|
+
}
|
|
175
|
+
return kept;
|
|
176
|
+
};
|
|
177
|
+
var keyLinesWereReplaced = (before, edit) => before.length !== edit.lines.length || before.some((line, index) => line !== edit.lines[index]);
|
|
178
|
+
var errorMessageOf = (err) => err instanceof Error ? err.message : String(err);
|
|
179
|
+
var existingModeOf = (path) => {
|
|
180
|
+
try {
|
|
181
|
+
return statSync(path).mode & 511;
|
|
182
|
+
} catch {
|
|
183
|
+
return void 0;
|
|
184
|
+
}
|
|
185
|
+
};
|
|
186
|
+
var writeKeyEnvFile = (apiKey, path = keyEnvFilePath()) => {
|
|
187
|
+
try {
|
|
188
|
+
writeFileAtomic(path, `${exportLine(apiKey)}
|
|
189
|
+
`, KEY_FILE_MODE);
|
|
190
|
+
return { kind: "written", path };
|
|
191
|
+
} catch (err) {
|
|
192
|
+
return { kind: "unavailable", path, detail: errorMessageOf(err) };
|
|
193
|
+
}
|
|
194
|
+
};
|
|
195
|
+
var removeKeyEnvFile = (path) => {
|
|
196
|
+
if (!existsSync2(path)) return { kind: "absent" };
|
|
197
|
+
try {
|
|
198
|
+
rmSync(path, { force: true });
|
|
199
|
+
return { kind: "removed" };
|
|
200
|
+
} catch (err) {
|
|
201
|
+
return { kind: "failed", detail: errorMessageOf(err) };
|
|
202
|
+
}
|
|
203
|
+
};
|
|
204
|
+
var isRegularFile = (path) => {
|
|
205
|
+
try {
|
|
206
|
+
return lstatSync(path).isFile();
|
|
207
|
+
} catch {
|
|
208
|
+
return false;
|
|
209
|
+
}
|
|
210
|
+
};
|
|
211
|
+
var holdsAPusharyKey = (file) => {
|
|
212
|
+
try {
|
|
213
|
+
return readFileSync2(file, "utf8").split(/\r?\n/).some(isPusharyKeyLine);
|
|
214
|
+
} catch {
|
|
215
|
+
return false;
|
|
216
|
+
}
|
|
217
|
+
};
|
|
218
|
+
var oldRcBackupsBeside = (file) => {
|
|
219
|
+
const prefix = `${basename(file)}${OLD_RC_BACKUP_MARK}`;
|
|
220
|
+
try {
|
|
221
|
+
return readdirSync(dirname(file)).filter((name) => name.startsWith(prefix)).map((name) => join2(dirname(file), name)).filter((path) => isRegularFile(path) && holdsAPusharyKey(path));
|
|
222
|
+
} catch {
|
|
223
|
+
return [];
|
|
224
|
+
}
|
|
225
|
+
};
|
|
226
|
+
var backupNameCandidates = (name) => Array.from({ length: MAX_BACKUP_NAME_ATTEMPTS }, (_, attempt) => attempt === 0 ? name : `${name}.${attempt}`);
|
|
227
|
+
var copiedWithoutOverwriting = (file, directory) => {
|
|
228
|
+
for (const candidate of backupNameCandidates(basename(file))) {
|
|
229
|
+
const destination = join2(directory, candidate);
|
|
230
|
+
try {
|
|
231
|
+
copyFileSync(file, destination, fsConstants.COPYFILE_EXCL);
|
|
232
|
+
return destination;
|
|
233
|
+
} catch (err) {
|
|
234
|
+
if (!(err instanceof Error && "code" in err && err.code === "EEXIST")) return null;
|
|
235
|
+
}
|
|
236
|
+
}
|
|
237
|
+
return null;
|
|
238
|
+
};
|
|
239
|
+
var movedIntoDirectory = (file, directory) => {
|
|
240
|
+
try {
|
|
241
|
+
mkdirSync(directory, { recursive: true, mode: 448 });
|
|
242
|
+
} catch {
|
|
243
|
+
return false;
|
|
244
|
+
}
|
|
245
|
+
const destination = copiedWithoutOverwriting(file, directory);
|
|
246
|
+
if (destination === null) return false;
|
|
247
|
+
try {
|
|
248
|
+
chmodSync(destination, KEY_FILE_MODE);
|
|
249
|
+
rmSync(file);
|
|
250
|
+
return true;
|
|
251
|
+
} catch {
|
|
252
|
+
rmSync(destination, { force: true });
|
|
253
|
+
return false;
|
|
254
|
+
}
|
|
255
|
+
};
|
|
256
|
+
var moveOldRcBackups = (rcPaths, directory) => {
|
|
257
|
+
const backups = [...new Map(rcPaths.flatMap(oldRcBackupsBeside).map((backup) => [realPathOf(backup), backup])).values()];
|
|
258
|
+
const leftInPlace = backups.filter((backup) => !movedIntoDirectory(backup, directory) && existsSync2(backup));
|
|
259
|
+
return { directory, moved: backups.length - leftInPlace.length, leftInPlace };
|
|
260
|
+
};
|
|
117
261
|
var keyPrefix = (key) => key.split(".")[0] ?? key;
|
|
118
262
|
var MAC_APP_KEY_PREFIX_FIELD = "macAppKeyPrefix";
|
|
119
263
|
var CLI_CREATED_KEY_PREFIX_FIELD = "cliCreatedKeyPrefix";
|
|
@@ -178,6 +322,7 @@ var rcResult = (kind, over = {}) => ({
|
|
|
178
322
|
declinedLine: null,
|
|
179
323
|
backupPath: null,
|
|
180
324
|
detail: null,
|
|
325
|
+
oldBackups: { directory: rcBackupDirectory(), moved: 0, leftInPlace: [] },
|
|
181
326
|
...over
|
|
182
327
|
});
|
|
183
328
|
var realPathOf = (filePath) => {
|
|
@@ -187,61 +332,52 @@ var realPathOf = (filePath) => {
|
|
|
187
332
|
return filePath;
|
|
188
333
|
}
|
|
189
334
|
};
|
|
190
|
-
var
|
|
191
|
-
|
|
192
|
-
let content = "";
|
|
335
|
+
var isMissingFileError = (err) => err instanceof Error && "code" in err && err.code === "ENOENT";
|
|
336
|
+
var readRcContents = (path) => {
|
|
193
337
|
try {
|
|
194
|
-
content
|
|
338
|
+
return { kind: "read", content: readFileSync2(path, "utf-8") };
|
|
195
339
|
} catch (err) {
|
|
196
|
-
|
|
197
|
-
if (error.code !== "ENOENT") {
|
|
198
|
-
return rcResult("unavailable", { path: target, shell, detail: error.message });
|
|
199
|
-
}
|
|
340
|
+
return isMissingFileError(err) ? { kind: "read", content: "" } : { kind: "unavailable", detail: errorMessageOf(err) };
|
|
200
341
|
}
|
|
201
|
-
|
|
202
|
-
|
|
342
|
+
};
|
|
343
|
+
var foreignKeyLineIndex = (lines) => lines.findIndex((line) => !isComment(line) && MENTIONS_KEY.test(line) && !OUR_EXPORT.test(line));
|
|
344
|
+
var keyPrefixInLine = (line) => /pk_[a-f0-9]+/.exec(line ?? "")?.[0] ?? null;
|
|
345
|
+
var withLineAppended = (content, line) => {
|
|
346
|
+
const gap = content.length === 0 || content.endsWith("\n") ? "" : "\n";
|
|
347
|
+
return `${content}${gap}${line}
|
|
348
|
+
`;
|
|
349
|
+
};
|
|
350
|
+
var lastKeyPrefixOf = (keys) => {
|
|
351
|
+
const last = keys.at(-1);
|
|
352
|
+
return last === void 0 ? null : keyPrefix(last);
|
|
353
|
+
};
|
|
354
|
+
var keyLoaderWriteOf = (target, loader, shell, backupDirectory) => {
|
|
355
|
+
const contents = readRcContents(target);
|
|
356
|
+
if (contents.kind === "unavailable") return rcResult("unavailable", { path: target, shell, detail: contents.detail });
|
|
357
|
+
const lines = contents.content.split("\n");
|
|
358
|
+
const foreign = foreignKeyLineIndex(lines);
|
|
203
359
|
if (foreign >= 0) {
|
|
204
|
-
|
|
205
|
-
return rcResult("declined", {
|
|
206
|
-
path: target,
|
|
207
|
-
shell,
|
|
208
|
-
declinedLine: foreign + 1,
|
|
209
|
-
previousKeyPrefix: match?.[0] ?? null
|
|
210
|
-
});
|
|
360
|
+
return rcResult("declined", { path: target, shell, declinedLine: foreign + 1, previousKeyPrefix: keyPrefixInLine(lines[foreign]) });
|
|
211
361
|
}
|
|
212
|
-
const
|
|
213
|
-
|
|
214
|
-
const previous = OUR_EXPORT.exec(ours[ours.length - 1].line)?.[2] ?? null;
|
|
215
|
-
if (ours.every((entry) => OUR_EXPORT.exec(entry.line)?.[2] === apiKey)) {
|
|
216
|
-
return rcResult("unchanged", {
|
|
217
|
-
path: target,
|
|
218
|
-
shell,
|
|
219
|
-
previousKeyPrefix: previous ? keyPrefix(previous) : null
|
|
220
|
-
});
|
|
221
|
-
}
|
|
222
|
-
const next = [...lines];
|
|
223
|
-
for (const entry of ours) next[entry.index] = exportLine(apiKey);
|
|
224
|
-
try {
|
|
225
|
-
const backupPath = backupFile(target);
|
|
226
|
-
writeFileAtomic(target, next.join("\n"), KEY_FILE_MODE);
|
|
227
|
-
return rcResult("updated", {
|
|
228
|
-
path: target,
|
|
229
|
-
shell,
|
|
230
|
-
previousKeyPrefix: previous ? keyPrefix(previous) : null,
|
|
231
|
-
backupPath
|
|
232
|
-
});
|
|
233
|
-
} catch (err) {
|
|
234
|
-
return rcResult("unavailable", { path: target, shell, detail: err.message });
|
|
235
|
-
}
|
|
236
|
-
}
|
|
237
|
-
const gap = content.length === 0 ? "" : content.endsWith("\n") ? "" : "\n";
|
|
362
|
+
const edit = replaceKeyLinesWithLoader(lines, loader);
|
|
363
|
+
const mode = existingModeOf(target);
|
|
238
364
|
try {
|
|
239
|
-
|
|
240
|
-
|
|
365
|
+
if (keyLinesWereReplaced(lines, edit)) {
|
|
366
|
+
const backupPath = backupFileInto(target, backupDirectory);
|
|
367
|
+
writeFileAtomic(target, edit.lines.join("\n"), mode);
|
|
368
|
+
return rcResult("updated", { path: target, shell, previousKeyPrefix: lastKeyPrefixOf(edit.exportedKeys), backupPath });
|
|
369
|
+
}
|
|
370
|
+
if (edit.loaderPresent) return rcResult("unchanged", { path: target, shell });
|
|
371
|
+
writeFileAtomic(target, withLineAppended(contents.content, loader), mode);
|
|
372
|
+
return rcResult("written", { path: target, shell });
|
|
241
373
|
} catch (err) {
|
|
242
|
-
return rcResult("unavailable", { path: target, shell, detail: err
|
|
374
|
+
return rcResult("unavailable", { path: target, shell, detail: errorMessageOf(err) });
|
|
243
375
|
}
|
|
244
|
-
|
|
376
|
+
};
|
|
377
|
+
var writeKeyLoader = (rcPath, loader, shell = null, backupDirectory = rcBackupDirectory()) => {
|
|
378
|
+
const target = realPathOf(rcPath);
|
|
379
|
+
const result = keyLoaderWriteOf(target, loader, shell, backupDirectory);
|
|
380
|
+
return { ...result, oldBackups: moveOldRcBackups([target, rcPath], backupDirectory) };
|
|
245
381
|
};
|
|
246
382
|
var resolveRcTarget = () => {
|
|
247
383
|
const resolved = resolveShellRc();
|
|
@@ -249,6 +385,11 @@ var resolveRcTarget = () => {
|
|
|
249
385
|
const fallback = FALLBACK_RCS.map((name) => join2(homedir2(), name)).find(existsSync2);
|
|
250
386
|
return fallback ? { path: fallback, shell: null } : null;
|
|
251
387
|
};
|
|
388
|
+
var keyLoaderWriteFor = (envFile, target) => {
|
|
389
|
+
const loaderWrite = target ? writeKeyLoader(target.path, keyLoaderLine(envFile.path), target.shell) : rcResult("no-rc");
|
|
390
|
+
if (envFile.kind === "written" || loaderWrite.kind === "declined") return loaderWrite;
|
|
391
|
+
return { ...loaderWrite, kind: "unavailable", path: envFile.path, detail: envFile.detail };
|
|
392
|
+
};
|
|
252
393
|
var writeKey = (apiKey, origin, options = {}) => {
|
|
253
394
|
const configPath = configFilePath();
|
|
254
395
|
const keyInForce = readKeySource().key;
|
|
@@ -278,12 +419,24 @@ var writeKey = (apiKey, origin, options = {}) => {
|
|
|
278
419
|
KEY_FILE_MODE
|
|
279
420
|
);
|
|
280
421
|
restrictFile(configPath);
|
|
422
|
+
const envFile = writeKeyEnvFile(apiKey);
|
|
281
423
|
const target = (options.resolveRc ?? resolveRcTarget)();
|
|
282
|
-
const rc =
|
|
424
|
+
const rc = keyLoaderWriteFor(envFile, target);
|
|
283
425
|
const replacedKey = replacedKeyRecordWasHonoured ? null : replacedKeyToRecord(keyInForce, apiKey, rc, process.platform);
|
|
284
426
|
if (replacedKey !== null) recordReplacedKey(configPath, replacedKey);
|
|
285
427
|
process.env.PUSHARY_API_KEY = apiKey;
|
|
286
|
-
return { configPath, rc, configBackupPath };
|
|
428
|
+
return { configPath, envFilePath: envFile.path, rc, configBackupPath };
|
|
429
|
+
};
|
|
430
|
+
var disableKeyLinesIn = (rcPath, loader, isReplacedLine) => {
|
|
431
|
+
try {
|
|
432
|
+
const real = realpathSync(rcPath);
|
|
433
|
+
const lines = readFileSync2(real, "utf8").split("\n");
|
|
434
|
+
const edit = replaceKeyLinesWithLoader(lines, loader, isReplacedLine);
|
|
435
|
+
if (keyLinesWereReplaced(lines, edit)) writeFileSync2(real, edit.lines.join("\n"));
|
|
436
|
+
return edit.replacedLineCount;
|
|
437
|
+
} catch {
|
|
438
|
+
return 0;
|
|
439
|
+
}
|
|
287
440
|
};
|
|
288
441
|
var clearKey = (options = {}) => {
|
|
289
442
|
const configPath = configFilePath();
|
|
@@ -295,28 +448,20 @@ var clearKey = (options = {}) => {
|
|
|
295
448
|
restrictFile(configPath);
|
|
296
449
|
removedFromConfig = true;
|
|
297
450
|
}
|
|
451
|
+
const envFilePath = keyEnvFilePath();
|
|
452
|
+
const envFileRemoval = removeKeyEnvFile(envFilePath);
|
|
298
453
|
const target = (options.resolveRc ?? resolveRcTarget)();
|
|
299
|
-
|
|
300
|
-
|
|
301
|
-
try {
|
|
302
|
-
const real = realpathSync(target.path);
|
|
303
|
-
const lines = readFileSync2(real, "utf8").split("\n");
|
|
304
|
-
const next = lines.map((line) => {
|
|
305
|
-
if (!OUR_EXPORT.test(line)) return line;
|
|
306
|
-
rcLinesDisabled += 1;
|
|
307
|
-
return disabledExportLine(line);
|
|
308
|
-
});
|
|
309
|
-
if (rcLinesDisabled > 0) writeFileSync2(real, next.join("\n"));
|
|
310
|
-
} catch {
|
|
311
|
-
rcLinesDisabled = 0;
|
|
312
|
-
}
|
|
313
|
-
}
|
|
454
|
+
const keyLinesToReplace = envFileRemoval.kind === "failed" ? isActiveKeyExport : isPusharyKeyLine;
|
|
455
|
+
const rcLinesDisabled = target ? disableKeyLinesIn(target.path, keyLoaderLine(envFilePath), keyLinesToReplace) : 0;
|
|
314
456
|
delete process.env.PUSHARY_API_KEY;
|
|
315
457
|
return {
|
|
316
458
|
removedFromConfig,
|
|
317
459
|
configPath,
|
|
318
460
|
rcPath: target?.path ?? null,
|
|
319
|
-
rcLinesDisabled
|
|
461
|
+
rcLinesDisabled,
|
|
462
|
+
envFilePath,
|
|
463
|
+
removedEnvFile: envFileRemoval.kind === "removed",
|
|
464
|
+
envFileRemovalError: envFileRemoval.kind === "failed" ? envFileRemoval.detail : null
|
|
320
465
|
};
|
|
321
466
|
};
|
|
322
467
|
var restrictFile = (filePath) => {
|
|
@@ -398,8 +543,9 @@ var exportedKeyLineIn = (path) => {
|
|
|
398
543
|
const found = contents === null ? null : findKeyExport(contents);
|
|
399
544
|
return found ? [{ path, ...found }] : [];
|
|
400
545
|
};
|
|
401
|
-
var
|
|
402
|
-
var
|
|
546
|
+
var exportedKeyFiles = () => [keyEnvFilePath(), ...shellProfileCandidates()];
|
|
547
|
+
var findExportedKeyLines = (profiles = exportedKeyFiles()) => profiles.flatMap(exportedKeyLineIn);
|
|
548
|
+
var findExportedKeyLine = (profiles = exportedKeyFiles()) => findExportedKeyLines(profiles)[0] ?? null;
|
|
403
549
|
|
|
404
550
|
export {
|
|
405
551
|
CANDIDATE_RCS,
|
|
@@ -408,6 +554,9 @@ export {
|
|
|
408
554
|
removeClaudeAlias,
|
|
409
555
|
KEY_FILE_MODE,
|
|
410
556
|
isDisabledExport,
|
|
557
|
+
keyEnvFilePath,
|
|
558
|
+
isKeyLoaderLine,
|
|
559
|
+
withoutKeyLines,
|
|
411
560
|
keyPrefix,
|
|
412
561
|
isCliCreatedKey,
|
|
413
562
|
shellKeyWasReplaced,
|
|
@@ -426,7 +575,7 @@ export {
|
|
|
426
575
|
readReplacedKeyPrefix,
|
|
427
576
|
replacedKeyRecordIsHonoured,
|
|
428
577
|
recordMacAppKeyPrefix,
|
|
429
|
-
|
|
578
|
+
exportedKeyFiles,
|
|
430
579
|
findExportedKeyLines,
|
|
431
580
|
findExportedKeyLine
|
|
432
581
|
};
|