tenjin-cli 0.1.0-alpha.30 → 0.1.0-alpha.31
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/README.md +65 -116
- package/dist/{_esm-CE7KNONL.js → _esm-MEXZI5DL.js} +4 -4
- package/dist/{alive-3J3CHOQP.js → alive-J64H46HI.js} +14 -4
- package/dist/{chunk-O2FRQ2L2.js → chunk-27EPWVOY.js} +4 -64
- package/dist/chunk-27EPWVOY.js.map +1 -0
- package/dist/{chunk-OSYTBCUC.js → chunk-2XLC3AEX.js} +16 -14
- package/dist/{chunk-OSYTBCUC.js.map → chunk-2XLC3AEX.js.map} +1 -1
- package/dist/chunk-3623BLPV.js +184 -0
- package/dist/chunk-3623BLPV.js.map +1 -0
- package/dist/chunk-3UCIG4TG.js +65 -0
- package/dist/chunk-3UCIG4TG.js.map +1 -0
- package/dist/{chunk-PAYV4XUA.js → chunk-4ZZO6ULA.js} +2 -2
- package/dist/{chunk-VUFAK2LW.js → chunk-5C32RLTA.js} +2 -2
- package/dist/{chunk-VUFAK2LW.js.map → chunk-5C32RLTA.js.map} +1 -1
- package/dist/{chunk-YHKXNYTB.js → chunk-5K5W4S66.js} +2 -2
- package/dist/{chunk-3O2BQIF6.js → chunk-5MARFNSB.js} +273 -482
- package/dist/chunk-5MARFNSB.js.map +1 -0
- package/dist/{chunk-HPWO4O6S.js → chunk-6E5R45ZO.js} +2 -2
- package/dist/{chunk-JMM6YE7J.js → chunk-77TCKDEC.js} +125 -312
- package/dist/chunk-77TCKDEC.js.map +1 -0
- package/dist/{chunk-LFZJM56J.js → chunk-7Q5FDF65.js} +2 -2
- package/dist/chunk-7WEQQJLG.js +68 -0
- package/dist/chunk-7WEQQJLG.js.map +1 -0
- package/dist/{chunk-AWFUPKTM.js → chunk-7WU4OPLP.js} +12 -6
- package/dist/{chunk-AWFUPKTM.js.map → chunk-7WU4OPLP.js.map} +1 -1
- package/dist/{chunk-AEG2PXBP.js → chunk-7ZRL2LBQ.js} +3 -3
- package/dist/{chunk-IOODYAXL.js → chunk-AGZ7PJKY.js} +6 -4
- package/dist/{chunk-IOODYAXL.js.map → chunk-AGZ7PJKY.js.map} +1 -1
- package/dist/{chunk-VFMQTSXG.js → chunk-B7HUUJOK.js} +3 -3
- package/dist/{chunk-EL56RW2J.js → chunk-BL3332HQ.js} +7 -7
- package/dist/{chunk-5LJCEMFD.js → chunk-D65GNPS3.js} +35 -27
- package/dist/{chunk-5LJCEMFD.js.map → chunk-D65GNPS3.js.map} +1 -1
- package/dist/{chunk-P7LABKCW.js → chunk-DOQGNFHM.js} +33 -2
- package/dist/{chunk-P7LABKCW.js.map → chunk-DOQGNFHM.js.map} +1 -1
- package/dist/{chunk-OK2TDZQU.js → chunk-FW75G2W4.js} +7 -5
- package/dist/chunk-FW75G2W4.js.map +1 -0
- package/dist/chunk-GA7JETVM.js +150 -0
- package/dist/chunk-GA7JETVM.js.map +1 -0
- package/dist/{chunk-6W5GYG3W.js → chunk-I3EQFHCD.js} +48 -1
- package/dist/chunk-I3EQFHCD.js.map +1 -0
- package/dist/{chunk-EBVIKMCH.js → chunk-JKKAIPTU.js} +2 -2
- package/dist/{chunk-N35E6CM2.js → chunk-K3I7C2MO.js} +6 -6
- package/dist/{chunk-KYFZTGMC.js → chunk-K72RURN3.js} +5 -3
- package/dist/{chunk-KYFZTGMC.js.map → chunk-K72RURN3.js.map} +1 -1
- package/dist/{chunk-RAULEAZ6.js → chunk-KXQ4UIP7.js} +3 -3
- package/dist/{chunk-VZGAONSJ.js → chunk-KXVP2VKA.js} +5 -5
- package/dist/chunk-LEFIX6RS.js +100 -0
- package/dist/chunk-LEFIX6RS.js.map +1 -0
- package/dist/{chunk-TTBKWWTV.js → chunk-MNXS2U45.js} +246 -83
- package/dist/chunk-MNXS2U45.js.map +1 -0
- package/dist/{chunk-AWQPGIR6.js → chunk-NEFNKLBE.js} +5 -5
- package/dist/chunk-OHRR5OYM.js +63 -0
- package/dist/chunk-OHRR5OYM.js.map +1 -0
- package/dist/{chunk-U6YQ6FRI.js → chunk-P4NH7OUK.js} +31 -11
- package/dist/chunk-P4NH7OUK.js.map +1 -0
- package/dist/chunk-QSCPK4F5.js +145 -0
- package/dist/chunk-QSCPK4F5.js.map +1 -0
- package/dist/chunk-QXP3Z3JN.js +131 -0
- package/dist/chunk-QXP3Z3JN.js.map +1 -0
- package/dist/{chunk-YFQOA5AU.js → chunk-R5LCN54M.js} +4 -4
- package/dist/{chunk-KHE6L6TD.js → chunk-UKY4CHNC.js} +92 -10
- package/dist/chunk-UKY4CHNC.js.map +1 -0
- package/dist/{chunk-QUVVWYJW.js → chunk-UQUOVWBG.js} +8 -6
- package/dist/{chunk-QUVVWYJW.js.map → chunk-UQUOVWBG.js.map} +1 -1
- package/dist/{chunk-HE2MS4QO.js → chunk-V6BSF6OC.js} +17 -13
- package/dist/{chunk-HE2MS4QO.js.map → chunk-V6BSF6OC.js.map} +1 -1
- package/dist/{chunk-WVUSXNIE.js → chunk-WJXLQXJY.js} +6 -2
- package/dist/{chunk-WVUSXNIE.js.map → chunk-WJXLQXJY.js.map} +1 -1
- package/dist/{chunk-NZIP4PA2.js → chunk-WK7F3B2E.js} +2 -2
- package/dist/chunk-XQJXNMSB.js +23 -0
- package/dist/chunk-XQJXNMSB.js.map +1 -0
- package/dist/chunk-Y527D4TV.js +56 -0
- package/dist/chunk-Y527D4TV.js.map +1 -0
- package/dist/{chunk-SPAVAYSW.js → chunk-YFPY4ONH.js} +6 -4
- package/dist/{chunk-SPAVAYSW.js.map → chunk-YFPY4ONH.js.map} +1 -1
- package/dist/{chunk-WO5BJNIB.js → chunk-YVFXE7RR.js} +9 -129
- package/dist/chunk-YVFXE7RR.js.map +1 -0
- package/dist/clack-EZ7TDWQU.js +19 -0
- package/dist/claude-cli-2YKABJJZ.js +31 -0
- package/dist/{cli-O5SN7ZJ4.js → cli-D5OE3URZ.js} +128 -56
- package/dist/{cli-O5SN7ZJ4.js.map → cli-D5OE3URZ.js.map} +1 -1
- package/dist/codex-event-PPNVRRDH.js +16 -0
- package/dist/codex-host-2RJOJW2B.js +28 -0
- package/dist/codex-install-UUZ6QMBQ.js +221 -0
- package/dist/codex-install-UUZ6QMBQ.js.map +1 -0
- package/dist/{config-OJQI27LT.js → config-ZD4OB2DO.js} +18 -12
- package/dist/{doctor-IQQJHGGM.js → doctor-KBR34Q4B.js} +48 -37
- package/dist/doctor-KBR34Q4B.js.map +1 -0
- package/dist/{fund-WEV6DMTD.js → fund-5ITKQGYF.js} +38 -31
- package/dist/{fund-WEV6DMTD.js.map → fund-5ITKQGYF.js.map} +1 -1
- package/dist/hook-command-4TYCHHRL.js +39 -0
- package/dist/hosts/claude/.claude-plugin/marketplace.json +2 -2
- package/dist/hosts/claude/tenjin/.claude-plugin/plugin.json +3 -2
- package/dist/hosts/claude/tenjin/hooks/hooks.json +4 -1
- package/dist/hosts/claude/tenjin/hooks/register.tsx +589 -0
- package/dist/hosts/claude/tenjin/types/index.d.ts +41 -0
- package/dist/hosts/codex/.agents/plugins/marketplace.json +20 -0
- package/dist/hosts/codex/tenjin/.codex-plugin/plugin.json +16 -0
- package/dist/hosts/codex/tenjin/.mcp.json +12 -0
- package/dist/hosts/codex/tenjin/hooks/hooks.json +52 -0
- package/dist/hosts-FWZOV26H.js +216 -0
- package/dist/hosts-FWZOV26H.js.map +1 -0
- package/dist/index.js +5 -5
- package/dist/{install-TUCRF32I.js → install-XWGE4Q7L.js} +38 -21
- package/dist/{install-identity-WHPNMNMQ.js → install-identity-K7EJIQFP.js} +11 -7
- package/dist/{install-wallet-MA27FTQ5.js → install-wallet-XQ6XFZV4.js} +27 -23
- package/dist/{install-wallet-MA27FTQ5.js.map → install-wallet-XQ6XFZV4.js.map} +1 -1
- package/dist/{mcp-QML7ZMPH.js → mcp-3LIJSSJB.js} +184 -58
- package/dist/mcp-3LIJSSJB.js.map +1 -0
- package/dist/{package-LGKYOEPV.js → package-ZKQFDWLE.js} +2 -2
- package/dist/{pay-2C2UBBXJ.js → pay-WHBERZ3W.js} +27 -23
- package/dist/{payments-C44QUFXU.js → payments-KVICEKD2.js} +14 -10
- package/dist/{payments-C44QUFXU.js.map → payments-KVICEKD2.js.map} +1 -1
- package/dist/plugin-registration-5TIA564H.js +54 -0
- package/dist/plugin-registration-5TIA564H.js.map +1 -0
- package/dist/{send-KVJX4XIR.js → send-7G7Y7DLN.js} +25 -19
- package/dist/{send-KVJX4XIR.js.map → send-7G7Y7DLN.js.map} +1 -1
- package/dist/{status-S7C3WMSH.js → status-OF7RH5HM.js} +26 -21
- package/dist/{status-S7C3WMSH.js.map → status-OF7RH5HM.js.map} +1 -1
- package/dist/{status-line-YR2T5HC4.js → status-line-XOUE6MPL.js} +10 -6
- package/dist/{status-line-YR2T5HC4.js.map → status-line-XOUE6MPL.js.map} +1 -1
- package/dist/{uninstall-HY6LKIIT.js → uninstall-JXUAFNDB.js} +30 -21
- package/dist/{uninstall-HY6LKIIT.js.map → uninstall-JXUAFNDB.js.map} +1 -1
- package/dist/update-ZKUERSO2.js +44 -0
- package/dist/update-ZKUERSO2.js.map +1 -0
- package/dist/{usdc-JK4RRFFQ.js → usdc-OGOGEHV2.js} +7 -6
- package/dist/usdc-OGOGEHV2.js.map +1 -0
- package/dist/{viemAdapter-By13KInL-X2VY6CY3.js → viemAdapter-By13KInL-S3DA7DFW.js} +2 -2
- package/dist/viemAdapter-By13KInL-S3DA7DFW.js.map +1 -0
- package/dist/{wallet-PD2IMZDU.js → wallet-2HA6W4R4.js} +24 -20
- package/dist/wallet-2HA6W4R4.js.map +1 -0
- package/docs/agent-permissions.md +21 -5
- package/package.json +1 -1
- package/dist/chunk-3O2BQIF6.js.map +0 -1
- package/dist/chunk-6W5GYG3W.js.map +0 -1
- package/dist/chunk-JMM6YE7J.js.map +0 -1
- package/dist/chunk-KHE6L6TD.js.map +0 -1
- package/dist/chunk-O2FRQ2L2.js.map +0 -1
- package/dist/chunk-OK2TDZQU.js.map +0 -1
- package/dist/chunk-TTBKWWTV.js.map +0 -1
- package/dist/chunk-U6YQ6FRI.js.map +0 -1
- package/dist/chunk-WO5BJNIB.js.map +0 -1
- package/dist/doctor-IQQJHGGM.js.map +0 -1
- package/dist/hook-command-D2P3ILRV.js +0 -32
- package/dist/mcp-QML7ZMPH.js.map +0 -1
- package/dist/update-OJV22LR3.js +0 -36
- /package/dist/{_esm-CE7KNONL.js.map → _esm-MEXZI5DL.js.map} +0 -0
- /package/dist/{alive-3J3CHOQP.js.map → alive-J64H46HI.js.map} +0 -0
- /package/dist/{chunk-PAYV4XUA.js.map → chunk-4ZZO6ULA.js.map} +0 -0
- /package/dist/{chunk-YHKXNYTB.js.map → chunk-5K5W4S66.js.map} +0 -0
- /package/dist/{chunk-HPWO4O6S.js.map → chunk-6E5R45ZO.js.map} +0 -0
- /package/dist/{chunk-LFZJM56J.js.map → chunk-7Q5FDF65.js.map} +0 -0
- /package/dist/{chunk-AEG2PXBP.js.map → chunk-7ZRL2LBQ.js.map} +0 -0
- /package/dist/{chunk-VFMQTSXG.js.map → chunk-B7HUUJOK.js.map} +0 -0
- /package/dist/{chunk-EL56RW2J.js.map → chunk-BL3332HQ.js.map} +0 -0
- /package/dist/{chunk-EBVIKMCH.js.map → chunk-JKKAIPTU.js.map} +0 -0
- /package/dist/{chunk-N35E6CM2.js.map → chunk-K3I7C2MO.js.map} +0 -0
- /package/dist/{chunk-RAULEAZ6.js.map → chunk-KXQ4UIP7.js.map} +0 -0
- /package/dist/{chunk-VZGAONSJ.js.map → chunk-KXVP2VKA.js.map} +0 -0
- /package/dist/{chunk-AWQPGIR6.js.map → chunk-NEFNKLBE.js.map} +0 -0
- /package/dist/{chunk-YFQOA5AU.js.map → chunk-R5LCN54M.js.map} +0 -0
- /package/dist/{chunk-NZIP4PA2.js.map → chunk-WK7F3B2E.js.map} +0 -0
- /package/dist/{config-OJQI27LT.js.map → clack-EZ7TDWQU.js.map} +0 -0
- /package/dist/{hook-command-D2P3ILRV.js.map → claude-cli-2YKABJJZ.js.map} +0 -0
- /package/dist/{install-TUCRF32I.js.map → codex-event-PPNVRRDH.js.map} +0 -0
- /package/dist/{install-identity-WHPNMNMQ.js.map → codex-host-2RJOJW2B.js.map} +0 -0
- /package/dist/{package-LGKYOEPV.js.map → config-ZD4OB2DO.js.map} +0 -0
- /package/dist/{pay-2C2UBBXJ.js.map → hook-command-4TYCHHRL.js.map} +0 -0
- /package/dist/{update-OJV22LR3.js.map → install-XWGE4Q7L.js.map} +0 -0
- /package/dist/{usdc-JK4RRFFQ.js.map → install-identity-K7EJIQFP.js.map} +0 -0
- /package/dist/{viemAdapter-By13KInL-X2VY6CY3.js.map → package-ZKQFDWLE.js.map} +0 -0
- /package/dist/{wallet-PD2IMZDU.js.map → pay-WHBERZ3W.js.map} +0 -0
|
@@ -1,17 +1,35 @@
|
|
|
1
1
|
import { createRequire as __tenjinCreateRequire } from 'node:module'; const require = __tenjinCreateRequire(import.meta.url);
|
|
2
|
+
import {
|
|
3
|
+
ROUTER_PATH
|
|
4
|
+
} from "./chunk-UKY4CHNC.js";
|
|
2
5
|
import {
|
|
3
6
|
NUDGE_OPT_OUT,
|
|
4
7
|
channelTag,
|
|
5
8
|
fetchDistTags,
|
|
6
9
|
isNewer,
|
|
7
10
|
resolveTarget
|
|
8
|
-
} from "./chunk-
|
|
11
|
+
} from "./chunk-KXVP2VKA.js";
|
|
12
|
+
import {
|
|
13
|
+
MOD_FILES,
|
|
14
|
+
OWNER_MARKER,
|
|
15
|
+
PLUGIN_DIR,
|
|
16
|
+
PLUGIN_FILES,
|
|
17
|
+
renderPluginFiles
|
|
18
|
+
} from "./chunk-GA7JETVM.js";
|
|
9
19
|
import {
|
|
10
20
|
underAgentHarness
|
|
11
21
|
} from "./chunk-KOGZDMHO.js";
|
|
12
22
|
import {
|
|
13
|
-
|
|
14
|
-
|
|
23
|
+
CLAUDE_CODE_FLOOR,
|
|
24
|
+
claudeConfigDir,
|
|
25
|
+
findClaudeBinary,
|
|
26
|
+
jsonList,
|
|
27
|
+
jsonResult,
|
|
28
|
+
readClaudeCode,
|
|
29
|
+
runClaude,
|
|
30
|
+
userMcpFile,
|
|
31
|
+
userSettingsPath
|
|
32
|
+
} from "./chunk-QXP3Z3JN.js";
|
|
15
33
|
import {
|
|
16
34
|
CLI_SKILL_NAMES,
|
|
17
35
|
FEE_APPROVAL,
|
|
@@ -29,76 +47,74 @@ import {
|
|
|
29
47
|
skillsDirsFor,
|
|
30
48
|
spendChoiceQuestion,
|
|
31
49
|
spendOptions
|
|
32
|
-
} from "./chunk-
|
|
33
|
-
import {
|
|
34
|
-
HOOK_TOOL,
|
|
35
|
-
hookToolInput
|
|
36
|
-
} from "./chunk-AKWGE6JQ.js";
|
|
50
|
+
} from "./chunk-5MARFNSB.js";
|
|
37
51
|
import {
|
|
38
52
|
LEGACY_HOOK_TOOL,
|
|
39
53
|
LEGACY_MCP_SERVER_NAME,
|
|
40
54
|
LEGACY_REQUEST_TOOL,
|
|
41
55
|
MARKETPLACE_NAME,
|
|
42
|
-
MCP_SERVER_NAME,
|
|
43
|
-
PLUGIN_HOOK_TOOL,
|
|
44
56
|
PLUGIN_ID,
|
|
45
57
|
PLUGIN_NAME,
|
|
46
|
-
PLUGIN_SERVER,
|
|
47
|
-
REQUEST_TOOL,
|
|
48
58
|
SKILLS_DIR_PLUGIN_ID
|
|
49
|
-
} from "./chunk-
|
|
50
|
-
import {
|
|
51
|
-
askText,
|
|
52
|
-
selectOne
|
|
53
|
-
} from "./chunk-P7LABKCW.js";
|
|
59
|
+
} from "./chunk-WJXLQXJY.js";
|
|
54
60
|
import {
|
|
55
61
|
SUGGESTED_FUND_USD
|
|
56
|
-
} from "./chunk-
|
|
62
|
+
} from "./chunk-4ZZO6ULA.js";
|
|
57
63
|
import {
|
|
58
64
|
emitWriteNotice,
|
|
59
65
|
paint,
|
|
60
66
|
sanitizeForTerminal
|
|
61
|
-
} from "./chunk-
|
|
67
|
+
} from "./chunk-K72RURN3.js";
|
|
68
|
+
import {
|
|
69
|
+
askText,
|
|
70
|
+
selectOne
|
|
71
|
+
} from "./chunk-DOQGNFHM.js";
|
|
62
72
|
import {
|
|
63
73
|
readAliveStamp
|
|
64
|
-
} from "./chunk-
|
|
74
|
+
} from "./chunk-I3EQFHCD.js";
|
|
65
75
|
import {
|
|
66
76
|
envProxySupported,
|
|
67
77
|
proxyVariable
|
|
68
78
|
} from "./chunk-S4SAZ7OD.js";
|
|
69
79
|
import {
|
|
70
80
|
httpRequest
|
|
71
|
-
} from "./chunk-
|
|
81
|
+
} from "./chunk-AGZ7PJKY.js";
|
|
72
82
|
import {
|
|
73
83
|
hasCode
|
|
74
84
|
} from "./chunk-2I4QTOLB.js";
|
|
75
85
|
import {
|
|
76
86
|
resolveContextSettings
|
|
77
|
-
} from "./chunk-
|
|
87
|
+
} from "./chunk-7WU4OPLP.js";
|
|
88
|
+
import {
|
|
89
|
+
parseUsdToAtomic,
|
|
90
|
+
toMoney
|
|
91
|
+
} from "./chunk-Y527D4TV.js";
|
|
78
92
|
import {
|
|
79
|
-
CliError,
|
|
80
93
|
MAX_AUTO_SPEND_FLOOR_ATOMIC,
|
|
81
94
|
MAX_AUTO_SPEND_FLOOR_WHY,
|
|
95
|
+
loadRawConfig
|
|
96
|
+
} from "./chunk-YVFXE7RR.js";
|
|
97
|
+
import {
|
|
82
98
|
PRODUCTION_ORIGIN,
|
|
83
|
-
isSameDeployment
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
} from "./chunk-
|
|
99
|
+
isSameDeployment
|
|
100
|
+
} from "./chunk-XQJXNMSB.js";
|
|
101
|
+
import {
|
|
102
|
+
CliError
|
|
103
|
+
} from "./chunk-3UCIG4TG.js";
|
|
88
104
|
import {
|
|
89
105
|
writeFileAtomic
|
|
90
|
-
} from "./chunk-
|
|
106
|
+
} from "./chunk-7WEQQJLG.js";
|
|
91
107
|
import {
|
|
92
108
|
defaultDataDir
|
|
93
109
|
} from "./chunk-SJLTEINJ.js";
|
|
94
110
|
import {
|
|
95
111
|
package_default
|
|
96
|
-
} from "./chunk-
|
|
112
|
+
} from "./chunk-5C32RLTA.js";
|
|
97
113
|
|
|
98
114
|
// src/commands/update.ts
|
|
99
115
|
import { spawn } from "node:child_process";
|
|
100
|
-
import { existsSync as existsSync2, statSync as
|
|
101
|
-
import { homedir as
|
|
116
|
+
import { existsSync as existsSync2, statSync as statSync2 } from "node:fs";
|
|
117
|
+
import { homedir as homedir2 } from "node:os";
|
|
102
118
|
import { resolve, sep as sep3 } from "node:path";
|
|
103
119
|
import { fileURLToPath as fileURLToPath3 } from "node:url";
|
|
104
120
|
|
|
@@ -256,8 +272,8 @@ function realpathOrNull(p) {
|
|
|
256
272
|
|
|
257
273
|
// src/router/install.ts
|
|
258
274
|
import { readFile as readFile4, realpath } from "node:fs/promises";
|
|
259
|
-
import { homedir
|
|
260
|
-
import { isAbsolute
|
|
275
|
+
import { homedir } from "node:os";
|
|
276
|
+
import { isAbsolute, join as join7 } from "node:path";
|
|
261
277
|
|
|
262
278
|
// src/lib/skill-placement.ts
|
|
263
279
|
import { lstatSync } from "node:fs";
|
|
@@ -312,133 +328,19 @@ async function removeRetiredSkills(home, project) {
|
|
|
312
328
|
return removed;
|
|
313
329
|
}
|
|
314
330
|
|
|
315
|
-
// src/router/claude-cli.ts
|
|
316
|
-
import { execFile } from "node:child_process";
|
|
317
|
-
import { statSync as statSync2 } from "node:fs";
|
|
318
|
-
import { homedir } from "node:os";
|
|
319
|
-
import { delimiter as delimiter2, isAbsolute, join as join3 } from "node:path";
|
|
320
|
-
var CLAUDE_CODE_FLOOR = "2.1.287";
|
|
321
|
-
function claudeConfigDir(env, home = homedir()) {
|
|
322
|
-
const dir = env.CLAUDE_CONFIG_DIR;
|
|
323
|
-
return dir !== void 0 && dir.length > 0 ? dir : join3(home, ".claude");
|
|
324
|
-
}
|
|
325
|
-
function userSettingsPath(env, home = homedir()) {
|
|
326
|
-
return join3(claudeConfigDir(env, home), "settings.json");
|
|
327
|
-
}
|
|
328
|
-
function userMcpFile(env, home = homedir()) {
|
|
329
|
-
const dir = env.CLAUDE_CONFIG_DIR;
|
|
330
|
-
return dir !== void 0 && dir.length > 0 ? join3(dir, ".claude.json") : join3(home, ".claude.json");
|
|
331
|
-
}
|
|
332
|
-
function isFile2(path) {
|
|
333
|
-
try {
|
|
334
|
-
return statSync2(path).isFile();
|
|
335
|
-
} catch {
|
|
336
|
-
return false;
|
|
337
|
-
}
|
|
338
|
-
}
|
|
339
|
-
function findClaudeBinary(env) {
|
|
340
|
-
const exts = process.platform === "win32" ? ["", ...(env.PATHEXT ?? ".EXE;.CMD;.BAT;.COM").split(";").filter((e) => e.length > 0)] : [""];
|
|
341
|
-
for (const part of (env.PATH ?? "").split(delimiter2)) {
|
|
342
|
-
if (part.length === 0) continue;
|
|
343
|
-
for (const ext of exts) {
|
|
344
|
-
const candidate = join3(part, `claude${ext}`);
|
|
345
|
-
if (isFile2(candidate)) return { path: candidate, source: "path" };
|
|
346
|
-
}
|
|
347
|
-
}
|
|
348
|
-
const exec2 = env.CLAUDE_CODE_EXECPATH;
|
|
349
|
-
if (exec2 !== void 0 && isAbsolute(exec2) && isFile2(exec2)) {
|
|
350
|
-
return { path: exec2, source: "execpath" };
|
|
351
|
-
}
|
|
352
|
-
return null;
|
|
353
|
-
}
|
|
354
|
-
function runClaude(bin, args, opts) {
|
|
355
|
-
return new Promise((resolve2) => {
|
|
356
|
-
execFile(
|
|
357
|
-
bin.path,
|
|
358
|
-
args,
|
|
359
|
-
{
|
|
360
|
-
env: opts.env,
|
|
361
|
-
cwd: opts.cwd,
|
|
362
|
-
timeout: opts.timeoutMs ?? 3e4,
|
|
363
|
-
maxBuffer: 4 * 1024 * 1024,
|
|
364
|
-
windowsHide: true
|
|
365
|
-
},
|
|
366
|
-
(err, stdout, stderr) => {
|
|
367
|
-
const code = err === null ? 0 : typeof err.code === "number" ? err.code : null;
|
|
368
|
-
resolve2({ code, stdout: String(stdout), stderr: String(stderr) });
|
|
369
|
-
}
|
|
370
|
-
);
|
|
371
|
-
});
|
|
372
|
-
}
|
|
373
|
-
function jsonResult(stdout) {
|
|
374
|
-
const lines2 = stdout.split("\n").map((l) => l.trim());
|
|
375
|
-
for (let i = lines2.length - 1; i >= 0; i -= 1) {
|
|
376
|
-
const line = lines2[i];
|
|
377
|
-
if (!line.startsWith("{")) continue;
|
|
378
|
-
try {
|
|
379
|
-
const parsed = JSON.parse(line);
|
|
380
|
-
if (parsed !== null && typeof parsed === "object" && !Array.isArray(parsed)) {
|
|
381
|
-
return parsed;
|
|
382
|
-
}
|
|
383
|
-
} catch {
|
|
384
|
-
continue;
|
|
385
|
-
}
|
|
386
|
-
}
|
|
387
|
-
return null;
|
|
388
|
-
}
|
|
389
|
-
function jsonList(stdout) {
|
|
390
|
-
const start = stdout.indexOf("[");
|
|
391
|
-
if (start === -1) return null;
|
|
392
|
-
try {
|
|
393
|
-
const parsed = JSON.parse(stdout.slice(start));
|
|
394
|
-
return Array.isArray(parsed) ? parsed.filter(
|
|
395
|
-
(row) => row !== null && typeof row === "object" && !Array.isArray(row)
|
|
396
|
-
) : null;
|
|
397
|
-
} catch {
|
|
398
|
-
return null;
|
|
399
|
-
}
|
|
400
|
-
}
|
|
401
|
-
function parseClaudeVersion(text) {
|
|
402
|
-
return /(\d+)\.(\d+)\.(\d+)/.exec(text)?.[0] ?? null;
|
|
403
|
-
}
|
|
404
|
-
function meetsFloor(version, floor = CLAUDE_CODE_FLOOR) {
|
|
405
|
-
const a = version.split(".").map(Number);
|
|
406
|
-
const b = floor.split(".").map(Number);
|
|
407
|
-
for (let i = 0; i < 3; i += 1) {
|
|
408
|
-
const x = a[i] ?? 0;
|
|
409
|
-
const y = b[i] ?? 0;
|
|
410
|
-
if (x !== y) return x > y;
|
|
411
|
-
}
|
|
412
|
-
return true;
|
|
413
|
-
}
|
|
414
|
-
var CLAUDE_UPDATE_FIX = "Run `claude update` in this session, then start a new Claude Code session so the newer version loads.";
|
|
415
|
-
async function readClaudeCode(env, cwd, find = findClaudeBinary) {
|
|
416
|
-
const binary = find(env);
|
|
417
|
-
if (binary === null) return { binary, version: null, meetsFloor: true };
|
|
418
|
-
const run = await runClaude(binary, ["--version"], { env, cwd, timeoutMs: 15e3 });
|
|
419
|
-
const version = run.code === 0 ? parseClaudeVersion(run.stdout) : null;
|
|
420
|
-
const ok = version === null || meetsFloor(version);
|
|
421
|
-
return {
|
|
422
|
-
binary,
|
|
423
|
-
version,
|
|
424
|
-
meetsFloor: ok,
|
|
425
|
-
...ok ? {} : { fix: CLAUDE_UPDATE_FIX }
|
|
426
|
-
};
|
|
427
|
-
}
|
|
428
|
-
|
|
429
331
|
// src/router/legacy-install.ts
|
|
430
332
|
import { readFile, stat } from "node:fs/promises";
|
|
431
|
-
import { join as
|
|
333
|
+
import { join as join3 } from "node:path";
|
|
432
334
|
|
|
433
335
|
// src/router/status-line-wiring.ts
|
|
434
336
|
var STATUS_LINE_COMMAND = "tenjin status-line";
|
|
435
337
|
var OUR_MARKER = STATUS_LINE_COMMAND;
|
|
436
338
|
function classifyStatusLine(value) {
|
|
437
339
|
if (value === null || value === void 0) return "absent";
|
|
438
|
-
const
|
|
439
|
-
if (typeof
|
|
440
|
-
if (
|
|
441
|
-
return
|
|
340
|
+
const command = typeof value === "string" ? value : typeof value === "object" && !Array.isArray(value) ? value.command : void 0;
|
|
341
|
+
if (typeof command !== "string" || command.trim().length === 0) return "foreign";
|
|
342
|
+
if (command.trim() === OUR_MARKER) return "ours";
|
|
343
|
+
return command.includes(OUR_MARKER) ? "composed" : "foreign";
|
|
442
344
|
}
|
|
443
345
|
var shUnquote = (value) => value.replaceAll(String.raw`'\''`, "'");
|
|
444
346
|
function composedScript(existing) {
|
|
@@ -449,8 +351,8 @@ function composedScript(existing) {
|
|
|
449
351
|
'printf %s "$yours${tenjin:+ \xB7 $tenjin}"'
|
|
450
352
|
].join("; ");
|
|
451
353
|
}
|
|
452
|
-
function decomposeCommand(
|
|
453
|
-
const trimmed =
|
|
354
|
+
function decomposeCommand(command) {
|
|
355
|
+
const trimmed = command.trim();
|
|
454
356
|
if (!trimmed.startsWith("sh -c '") || !trimmed.endsWith("'")) return null;
|
|
455
357
|
const script = shUnquote(trimmed.slice("sh -c '".length, -1));
|
|
456
358
|
const prefix = 'event=$(cat); yours=$(printf %s "$event" | ';
|
|
@@ -472,19 +374,19 @@ function ownsLegacyHandler(handler) {
|
|
|
472
374
|
if (handler.type === "mcp_tool") {
|
|
473
375
|
return handler.server === LEGACY_MCP_SERVER_NAME && handler.tool === "hook";
|
|
474
376
|
}
|
|
475
|
-
const
|
|
476
|
-
return typeof
|
|
377
|
+
const command = handler.command;
|
|
378
|
+
return typeof command === "string" && LEGACY_COMMAND_RE.test(command.trim());
|
|
477
379
|
}
|
|
478
380
|
function lookalike(handler) {
|
|
479
381
|
if (!isPlainObject(handler) || ownsLegacyHandler(handler)) return null;
|
|
480
|
-
const
|
|
481
|
-
return typeof
|
|
382
|
+
const command = handler.command;
|
|
383
|
+
return typeof command === "string" && command.includes("tenjin hook") ? command : null;
|
|
482
384
|
}
|
|
483
385
|
function classifyMcpEntry(entry) {
|
|
484
386
|
if (entry === null || typeof entry !== "object" || Array.isArray(entry)) return "absent";
|
|
485
|
-
const { command
|
|
486
|
-
if (typeof
|
|
487
|
-
const binary =
|
|
387
|
+
const { command, args } = entry;
|
|
388
|
+
if (typeof command !== "string" || command.length === 0) return "wrong-command";
|
|
389
|
+
const binary = command.split(/[\\/]/).pop();
|
|
488
390
|
const runsRouter = binary === "tenjin" && Array.isArray(args) && args.length === 1 && args[0] === "mcp";
|
|
489
391
|
return runsRouter ? "ok" : "wrong-command";
|
|
490
392
|
}
|
|
@@ -615,8 +517,8 @@ async function removeFromSettings(found, out) {
|
|
|
615
517
|
delete next.statusLine;
|
|
616
518
|
out.statusLine = "removed";
|
|
617
519
|
} else if (found.statusLine === "composed" && isPlainObject(read.settings.statusLine)) {
|
|
618
|
-
const
|
|
619
|
-
const original = typeof
|
|
520
|
+
const command = read.settings.statusLine.command;
|
|
521
|
+
const original = typeof command === "string" ? decomposeCommand(command) : null;
|
|
620
522
|
if (original !== null) {
|
|
621
523
|
next.statusLine = { ...read.settings.statusLine, command: original };
|
|
622
524
|
out.statusLine = "restored";
|
|
@@ -660,125 +562,26 @@ async function removeMcpEntry(opts, out) {
|
|
|
660
562
|
}
|
|
661
563
|
}
|
|
662
564
|
function projectMcpFile(cwd) {
|
|
663
|
-
return
|
|
565
|
+
return join3(cwd, ".mcp.json");
|
|
664
566
|
}
|
|
665
567
|
|
|
666
568
|
// src/router/plugin-registration.ts
|
|
667
569
|
import { readFile as readFile3, stat as stat2 } from "node:fs/promises";
|
|
668
|
-
import { dirname as dirname4, join as
|
|
570
|
+
import { dirname as dirname4, join as join5 } from "node:path";
|
|
669
571
|
import { fileURLToPath } from "node:url";
|
|
670
572
|
|
|
671
|
-
// src/router/plugin-files.ts
|
|
672
|
-
var ROUTE_HOOK_TIMEOUT_SECONDS = 5;
|
|
673
|
-
var AFTER_CALL_TIMEOUT_SECONDS = 15;
|
|
674
|
-
var LOCAL_HOOK_TIMEOUT_SECONDS = 5;
|
|
675
|
-
var DELEGATION_MATCHER = "Agent|Task";
|
|
676
|
-
var NATIVE_MATCHER = "WebSearch|WebFetch";
|
|
677
|
-
var ASK_MATCHER = "AskUserQuestion";
|
|
678
|
-
var PLUGIN_ROOT_ENTRY = "${CLAUDE_PLUGIN_ROOT}/../../../index.js";
|
|
679
|
-
function cliLaunch(args, entry = PLUGIN_ROOT_ENTRY) {
|
|
680
|
-
return { command: "node", args: [entry, ...args] };
|
|
681
|
-
}
|
|
682
|
-
var ALIVE_ARGS = ["hook", "alive"];
|
|
683
|
-
function permissionAnswer(decision, reason) {
|
|
684
|
-
return JSON.stringify({
|
|
685
|
-
hookSpecificOutput: {
|
|
686
|
-
hookEventName: "PreToolUse",
|
|
687
|
-
permissionDecision: decision,
|
|
688
|
-
permissionDecisionReason: reason
|
|
689
|
-
}
|
|
690
|
-
});
|
|
691
|
-
}
|
|
692
|
-
var PRINT_ARGUMENT = "process.stdout.write(process.argv[1])";
|
|
693
|
-
function printed(answer) {
|
|
694
|
-
return { command: "node", args: ["-e", PRINT_ARGUMENT, answer] };
|
|
695
|
-
}
|
|
696
|
-
var DENY_HOOK = printed(
|
|
697
|
-
permissionAnswer(
|
|
698
|
-
"deny",
|
|
699
|
-
`Only the Tenjin hooks call this tool. To make a lookup, call ${REQUEST_TOOL}.`
|
|
700
|
-
)
|
|
701
|
-
);
|
|
702
|
-
var ALLOW_HOOK = printed(permissionAnswer("allow", "Tenjin lookup"));
|
|
703
|
-
function leg(kind, timeout = ROUTE_HOOK_TIMEOUT_SECONDS) {
|
|
704
|
-
return [
|
|
705
|
-
{
|
|
706
|
-
type: "mcp_tool",
|
|
707
|
-
server: PLUGIN_SERVER,
|
|
708
|
-
tool: HOOK_TOOL,
|
|
709
|
-
input: hookToolInput(kind),
|
|
710
|
-
timeout
|
|
711
|
-
}
|
|
712
|
-
];
|
|
713
|
-
}
|
|
714
|
-
function command(launch) {
|
|
715
|
-
return [{ type: "command", ...launch, timeout: LOCAL_HOOK_TIMEOUT_SECONDS }];
|
|
716
|
-
}
|
|
717
|
-
function routerHookPlan() {
|
|
718
|
-
const afterCall = () => leg("shortfall", AFTER_CALL_TIMEOUT_SECONDS);
|
|
719
|
-
return [
|
|
720
|
-
{ event: "UserPromptSubmit", hooks: leg("prompt") },
|
|
721
|
-
{ event: "PreToolUse", matcher: NATIVE_MATCHER, hooks: leg("native") },
|
|
722
|
-
{ event: "PreToolUse", matcher: DELEGATION_MATCHER, hooks: leg("agent") },
|
|
723
|
-
{ event: "PostToolUse", matcher: NATIVE_MATCHER, hooks: afterCall() },
|
|
724
|
-
{ event: "PostToolUseFailure", matcher: NATIVE_MATCHER, hooks: afterCall() },
|
|
725
|
-
{ event: "PreToolUse", matcher: ASK_MATCHER, hooks: leg("ask") },
|
|
726
|
-
{ event: "PostToolUse", matcher: ASK_MATCHER, hooks: leg("answer") }
|
|
727
|
-
];
|
|
728
|
-
}
|
|
729
|
-
function renderPluginHooks(entry = PLUGIN_ROOT_ENTRY) {
|
|
730
|
-
const plan = [
|
|
731
|
-
{ event: "SessionStart", hooks: command(cliLaunch(ALIVE_ARGS, entry)) },
|
|
732
|
-
...routerHookPlan(),
|
|
733
|
-
{ event: "PreToolUse", matcher: PLUGIN_HOOK_TOOL, hooks: command(DENY_HOOK) },
|
|
734
|
-
{ event: "PreToolUse", matcher: REQUEST_TOOL, hooks: command(ALLOW_HOOK) }
|
|
735
|
-
];
|
|
736
|
-
const hooks = {};
|
|
737
|
-
for (const { event, hooks: handlers, ...rest } of plan) {
|
|
738
|
-
(hooks[event] ??= []).push({ ...rest, hooks: handlers });
|
|
739
|
-
}
|
|
740
|
-
return { hooks };
|
|
741
|
-
}
|
|
742
|
-
var PLUGIN_MCP_ARGS = ["mcp", "--plugin"];
|
|
743
|
-
function renderPluginMcp(entry = PLUGIN_ROOT_ENTRY) {
|
|
744
|
-
return { mcpServers: { [MCP_SERVER_NAME]: cliLaunch(PLUGIN_MCP_ARGS, entry) } };
|
|
745
|
-
}
|
|
746
|
-
var OWNER_MARKER = "tenjin-cli";
|
|
747
|
-
var UNBUILT = "source";
|
|
748
|
-
var DESCRIPTION = "Tenjin picks the right tool when your agent needs one, and one wallet on this machine pays for every call.";
|
|
749
|
-
function renderPluginManifest(version) {
|
|
750
|
-
return {
|
|
751
|
-
name: PLUGIN_NAME,
|
|
752
|
-
...version !== void 0 ? { version } : {},
|
|
753
|
-
description: DESCRIPTION,
|
|
754
|
-
author: { name: "Tenjin", url: PRODUCTION_ORIGIN },
|
|
755
|
-
homepage: `${PRODUCTION_ORIGIN}/agents`,
|
|
756
|
-
repository: "https://github.com/BackTrackCo/tenjin-agent",
|
|
757
|
-
metadata: { [OWNER_MARKER]: version ?? UNBUILT }
|
|
758
|
-
};
|
|
759
|
-
}
|
|
760
|
-
var PLUGIN_DIR = PLUGIN_NAME;
|
|
761
|
-
var PLUGIN_FILES = [
|
|
762
|
-
".mcp.json",
|
|
763
|
-
"hooks/hooks.json",
|
|
764
|
-
".claude-plugin/plugin.json"
|
|
765
|
-
];
|
|
766
|
-
var json = (value) => `${JSON.stringify(value, null, 2)}
|
|
767
|
-
`;
|
|
768
|
-
function renderPluginFiles(version, entry) {
|
|
769
|
-
return {
|
|
770
|
-
".mcp.json": json(renderPluginMcp(entry)),
|
|
771
|
-
"hooks/hooks.json": json(renderPluginHooks(entry)),
|
|
772
|
-
".claude-plugin/plugin.json": json(renderPluginManifest(version))
|
|
773
|
-
};
|
|
774
|
-
}
|
|
775
|
-
|
|
776
573
|
// src/router/plugin-folder.ts
|
|
777
574
|
import { lstat, readdir as readdir2, readFile as readFile2, rm as rm2, rmdir as rmdir2 } from "node:fs/promises";
|
|
778
|
-
import { dirname as dirname3, join as
|
|
575
|
+
import { dirname as dirname3, join as join4, relative, sep as sep2 } from "node:path";
|
|
779
576
|
var FOLDER_NAME = "tenjin-router";
|
|
577
|
+
async function readModSources(pluginDir) {
|
|
578
|
+
const entries = await Promise.all(
|
|
579
|
+
MOD_FILES.map(async (path) => [path, await readFile2(join4(pluginDir, path), "utf8")])
|
|
580
|
+
).catch(() => null);
|
|
581
|
+
return entries === null ? void 0 : Object.fromEntries(entries);
|
|
582
|
+
}
|
|
780
583
|
function pluginFolderPath(base) {
|
|
781
|
-
return
|
|
584
|
+
return join4(base, "skills", FOLDER_NAME);
|
|
782
585
|
}
|
|
783
586
|
async function inspectPluginFolder(dir) {
|
|
784
587
|
const entry = await lstat(dir).catch(() => null);
|
|
@@ -786,7 +589,7 @@ async function inspectPluginFolder(dir) {
|
|
|
786
589
|
if (!entry.isDirectory() || entry.isSymbolicLink()) return "foreign";
|
|
787
590
|
try {
|
|
788
591
|
const manifest = JSON.parse(
|
|
789
|
-
await readFile2(
|
|
592
|
+
await readFile2(join4(dir, ".claude-plugin", "plugin.json"), "utf8")
|
|
790
593
|
);
|
|
791
594
|
const marked = manifest.metadata !== null && typeof manifest.metadata === "object" && OWNER_MARKER in manifest.metadata;
|
|
792
595
|
return manifest.name === PLUGIN_NAME && marked ? "ours" : "foreign";
|
|
@@ -807,7 +610,7 @@ async function writePluginFolder(dir, files) {
|
|
|
807
610
|
for (const path of PLUGIN_FILES) {
|
|
808
611
|
const body = files[path];
|
|
809
612
|
if (body === void 0) continue;
|
|
810
|
-
await writeFileAtomic(
|
|
613
|
+
await writeFileAtomic(join4(dir, path), body);
|
|
811
614
|
}
|
|
812
615
|
} catch (err) {
|
|
813
616
|
return {
|
|
@@ -829,11 +632,11 @@ async function removePluginFolder(dir) {
|
|
|
829
632
|
reason: `${dir} is not a folder this CLI wrote, so nothing in it was removed`
|
|
830
633
|
};
|
|
831
634
|
}
|
|
832
|
-
for (const path of PLUGIN_FILES) await rm2(
|
|
635
|
+
for (const path of PLUGIN_FILES) await rm2(join4(dir, path), { force: true });
|
|
833
636
|
const subdirs = [...new Set(PLUGIN_FILES.map((p) => dirname3(p)).filter((d) => d !== "."))].sort(
|
|
834
637
|
(a, b) => b.split("/").length - a.split("/").length
|
|
835
638
|
);
|
|
836
|
-
for (const sub of subdirs) await rmdir2(
|
|
639
|
+
for (const sub of subdirs) await rmdir2(join4(dir, sub)).catch(() => void 0);
|
|
837
640
|
const left = await listFiles(dir);
|
|
838
641
|
if (left.length === 0) await rmdir2(dir).catch(() => void 0);
|
|
839
642
|
return { path: dir, removed: true, left };
|
|
@@ -842,7 +645,7 @@ async function listFiles(dir) {
|
|
|
842
645
|
const out = [];
|
|
843
646
|
const walk = async (current) => {
|
|
844
647
|
for (const entry of await readdir2(current, { withFileTypes: true }).catch(() => [])) {
|
|
845
|
-
const path =
|
|
648
|
+
const path = join4(current, entry.name);
|
|
846
649
|
if (entry.isDirectory()) await walk(path);
|
|
847
650
|
else out.push(relative(dir, path).split(sep2).join("/"));
|
|
848
651
|
}
|
|
@@ -853,7 +656,7 @@ async function listFiles(dir) {
|
|
|
853
656
|
|
|
854
657
|
// src/router/plugin-registration.ts
|
|
855
658
|
function folderFor(scope, env, home, cwd) {
|
|
856
|
-
return pluginFolderPath(scope === "local" ?
|
|
659
|
+
return pluginFolderPath(scope === "local" ? join5(cwd, ".claude") : claudeConfigDir(env, home));
|
|
857
660
|
}
|
|
858
661
|
async function registerPlugin(opts) {
|
|
859
662
|
const folder = folderFor(opts.scope, opts.env, opts.home, opts.cwd);
|
|
@@ -908,7 +711,11 @@ async function registerPlugin(opts) {
|
|
|
908
711
|
}
|
|
909
712
|
const written = await writePluginFolder(
|
|
910
713
|
folder,
|
|
911
|
-
renderPluginFiles(
|
|
714
|
+
renderPluginFiles(
|
|
715
|
+
opts.version,
|
|
716
|
+
opts.cliEntry ?? packageCliEntry(),
|
|
717
|
+
await packageMod(opts.hostsDir)
|
|
718
|
+
)
|
|
912
719
|
);
|
|
913
720
|
if (written.state === "written") {
|
|
914
721
|
return {
|
|
@@ -996,7 +803,7 @@ async function ownMarketplace(row) {
|
|
|
996
803
|
if (await stat2(path).catch(() => null) === null) {
|
|
997
804
|
return /tenjin-cli[\\/]dist[\\/]hosts[\\/]claude$/.test(path);
|
|
998
805
|
}
|
|
999
|
-
return await inspectPluginFolder(
|
|
806
|
+
return await inspectPluginFolder(join5(path, PLUGIN_DIR)) === "ours";
|
|
1000
807
|
}
|
|
1001
808
|
async function existingCopy(binary, env, home, cwd) {
|
|
1002
809
|
const out = await runClaude(binary, ["plugin", "list", "--json"], { env, cwd });
|
|
@@ -1010,7 +817,7 @@ async function existingCopy(binary, env, home, cwd) {
|
|
|
1010
817
|
async function installedThroughCommands(env, home) {
|
|
1011
818
|
try {
|
|
1012
819
|
const raw = await readFile3(
|
|
1013
|
-
|
|
820
|
+
join5(claudeConfigDir(env, home), "plugins", "installed_plugins.json"),
|
|
1014
821
|
"utf8"
|
|
1015
822
|
);
|
|
1016
823
|
const plugins = JSON.parse(raw).plugins;
|
|
@@ -1020,13 +827,17 @@ async function installedThroughCommands(env, home) {
|
|
|
1020
827
|
}
|
|
1021
828
|
}
|
|
1022
829
|
async function packageHostsDir(moduleDir = dirname4(fileURLToPath(import.meta.url))) {
|
|
1023
|
-
const catalog =
|
|
830
|
+
const catalog = join5(moduleDir, "hosts", "claude", ".claude-plugin", "marketplace.json");
|
|
1024
831
|
const stable = versionFreeEntry(catalog) ?? catalog;
|
|
1025
832
|
if ((await stat2(stable).catch(() => null))?.isFile() !== true) return null;
|
|
1026
833
|
return dirname4(dirname4(stable));
|
|
1027
834
|
}
|
|
835
|
+
async function packageMod(hostsDir) {
|
|
836
|
+
const hosts = hostsDir === void 0 ? await packageHostsDir() : hostsDir;
|
|
837
|
+
return hosts === null ? void 0 : readModSources(join5(hosts, PLUGIN_DIR));
|
|
838
|
+
}
|
|
1028
839
|
function packageCliEntry(moduleDir = dirname4(fileURLToPath(import.meta.url))) {
|
|
1029
|
-
const entry =
|
|
840
|
+
const entry = join5(moduleDir, "index.js");
|
|
1030
841
|
return versionFreeEntry(entry) ?? entry;
|
|
1031
842
|
}
|
|
1032
843
|
async function readPluginListing(binary, env, cwd) {
|
|
@@ -1162,12 +973,12 @@ function proxyCredentialsFix(env) {
|
|
|
1162
973
|
}
|
|
1163
974
|
|
|
1164
975
|
// src/router/mcp-processes.ts
|
|
1165
|
-
import { execFile
|
|
976
|
+
import { execFile } from "node:child_process";
|
|
1166
977
|
import { stat as stat3 } from "node:fs/promises";
|
|
1167
|
-
import { dirname as dirname5, join as
|
|
978
|
+
import { dirname as dirname5, join as join6 } from "node:path";
|
|
1168
979
|
import { fileURLToPath as fileURLToPath2 } from "node:url";
|
|
1169
980
|
import { promisify } from "node:util";
|
|
1170
|
-
var exec = promisify(
|
|
981
|
+
var exec = promisify(execFile);
|
|
1171
982
|
var listMcpProcesses = async () => {
|
|
1172
983
|
if (process.platform === "win32" || typeof process.getuid !== "function") return null;
|
|
1173
984
|
try {
|
|
@@ -1205,7 +1016,7 @@ var installedAt = async () => {
|
|
|
1205
1016
|
let dir = dirname5(fileURLToPath2(import.meta.url));
|
|
1206
1017
|
for (let i = 0; i < 6; i += 1) {
|
|
1207
1018
|
try {
|
|
1208
|
-
const st = await stat3(
|
|
1019
|
+
const st = await stat3(join6(dir, "package.json"));
|
|
1209
1020
|
return Math.max(st.ctimeMs, st.mtimeMs);
|
|
1210
1021
|
} catch {
|
|
1211
1022
|
dir = dirname5(dir);
|
|
@@ -1265,7 +1076,7 @@ function loadStep(settingsInstallPresent) {
|
|
|
1265
1076
|
}
|
|
1266
1077
|
function settingsInstallPaths(project, env, home, cwd) {
|
|
1267
1078
|
return project ? {
|
|
1268
|
-
settingsPath:
|
|
1079
|
+
settingsPath: join7(cwd, ".claude", "settings.json"),
|
|
1269
1080
|
mcpFile: projectMcpFile(cwd),
|
|
1270
1081
|
mcpScope: "project"
|
|
1271
1082
|
} : {
|
|
@@ -1314,7 +1125,7 @@ async function projectInstallHere(cwd, home, env) {
|
|
|
1314
1125
|
return projectInstallAt(cwd, home, env);
|
|
1315
1126
|
}
|
|
1316
1127
|
async function projectInstallAt(dir, home, env) {
|
|
1317
|
-
const local = await readFile4(
|
|
1128
|
+
const local = await readFile4(join7(dir, ".claude", "settings.local.json"), "utf8").then((raw) => JSON.parse(raw)).catch(() => null);
|
|
1318
1129
|
if (local?.enabledPlugins?.[PLUGIN_ID] === true) return true;
|
|
1319
1130
|
if (await isHome(dir, home)) return false;
|
|
1320
1131
|
if ((await folderState("local", env, home, dir)).state === "ours") return true;
|
|
@@ -1339,8 +1150,8 @@ async function somethingToRefresh(claude, scope, legacy, env, home, cwd) {
|
|
|
1339
1150
|
}
|
|
1340
1151
|
async function runRouterInstall(args, ctx, deps = {}) {
|
|
1341
1152
|
const env = deps.env ?? process.env;
|
|
1342
|
-
const home = deps.homeDir ??
|
|
1343
|
-
if (!
|
|
1153
|
+
const home = deps.homeDir ?? homedir();
|
|
1154
|
+
if (!isAbsolute(home)) {
|
|
1344
1155
|
throw new CliError("INTERNAL", "The home directory is not an absolute path.", {
|
|
1345
1156
|
fix: "Set HOME to your home directory (`export HOME=...`), then re-run `tenjin install`."
|
|
1346
1157
|
});
|
|
@@ -1421,7 +1232,7 @@ async function runRouterInstall(args, ctx, deps = {}) {
|
|
|
1421
1232
|
]
|
|
1422
1233
|
};
|
|
1423
1234
|
}
|
|
1424
|
-
const { resolveWallet } = await import("./install-wallet-
|
|
1235
|
+
const { resolveWallet } = await import("./install-wallet-XQ6XFZV4.js");
|
|
1425
1236
|
const wallet = await resolveWallet(ctx, deps, args.noWallet === true ? "flag" : void 0, false);
|
|
1426
1237
|
const effective = await resolveContextSettings(ctx);
|
|
1427
1238
|
const spendAsk = !canPrompt && !answered && unasked ? spendStep(args) : void 0;
|
|
@@ -1558,7 +1369,10 @@ function refreshNotices(plugin, claude, migration) {
|
|
|
1558
1369
|
}
|
|
1559
1370
|
var SHOW_NOT_RUN = "Show the person addresses as written, and never ask them to run a command.";
|
|
1560
1371
|
function spendStep(args) {
|
|
1561
|
-
|
|
1372
|
+
return spendStepFor(installCommand(args));
|
|
1373
|
+
}
|
|
1374
|
+
function spendStepFor(command) {
|
|
1375
|
+
const options = spendOptions(command);
|
|
1562
1376
|
const [byDefault, custom] = options;
|
|
1563
1377
|
return {
|
|
1564
1378
|
id: "spend",
|
|
@@ -1630,7 +1444,7 @@ async function fundStep(wallet, rpcUrl, deps) {
|
|
|
1630
1444
|
};
|
|
1631
1445
|
}
|
|
1632
1446
|
async function defaultBalance(address, rpcUrl) {
|
|
1633
|
-
const { getUsdcBalance } = await import("./usdc-
|
|
1447
|
+
const { getUsdcBalance } = await import("./usdc-OGOGEHV2.js");
|
|
1634
1448
|
return getUsdcBalance(address, rpcUrl);
|
|
1635
1449
|
}
|
|
1636
1450
|
function fundLines(fund) {
|
|
@@ -1889,7 +1703,7 @@ async function runUpdate(opts, ctx, deps = {}) {
|
|
|
1889
1703
|
const outcome = await (deps.spawnImpl ?? spawnCapture)(
|
|
1890
1704
|
resolved.cmd,
|
|
1891
1705
|
[...resolved.prefix, ...args],
|
|
1892
|
-
{ cwd:
|
|
1706
|
+
{ cwd: homedir2(), timeoutMs: INSTALL_TIMEOUT_MS },
|
|
1893
1707
|
onOutput
|
|
1894
1708
|
);
|
|
1895
1709
|
if (outcome.kind === "start-failed") {
|
|
@@ -1934,7 +1748,7 @@ async function runUpdate(opts, ctx, deps = {}) {
|
|
|
1934
1748
|
}
|
|
1935
1749
|
var REFRESH_TIMEOUT_MS = 6e4;
|
|
1936
1750
|
async function refreshProfiles(ctx, deps) {
|
|
1937
|
-
const home = deps.homeDir ??
|
|
1751
|
+
const home = deps.homeDir ?? homedir2();
|
|
1938
1752
|
const candidates = [ctx.dataDir];
|
|
1939
1753
|
const fixFor = (dataDir) => manualFix(dataDir, home, ctx.dataDir);
|
|
1940
1754
|
const profiles = [];
|
|
@@ -1966,7 +1780,7 @@ async function refreshProfiles(ctx, deps) {
|
|
|
1966
1780
|
}
|
|
1967
1781
|
};
|
|
1968
1782
|
for (const dataDir of profiles) {
|
|
1969
|
-
const { outcome, tail } = await refreshChild(entry,
|
|
1783
|
+
const { outcome, tail } = await refreshChild(entry, homedir2(), dataDir, deps);
|
|
1970
1784
|
if (outcome.kind !== "exit" || outcome.code !== 0) {
|
|
1971
1785
|
failed.push({ dataDir, reason: refreshReason(outcome, tail), fix: fixFor(dataDir) });
|
|
1972
1786
|
continue;
|
|
@@ -2061,12 +1875,12 @@ function envelopeMessage(output) {
|
|
|
2061
1875
|
return void 0;
|
|
2062
1876
|
}
|
|
2063
1877
|
function isExistingDir(path) {
|
|
2064
|
-
return
|
|
1878
|
+
return statSync2(path, { throwIfNoEntry: false })?.isDirectory() === true;
|
|
2065
1879
|
}
|
|
2066
1880
|
function manualFix(dataDir, home, invoking) {
|
|
2067
1881
|
const bare = resolve(dataDir) === resolve(defaultDataDir(home)) && resolve(dataDir) === resolve(invoking);
|
|
2068
|
-
const
|
|
2069
|
-
return `Run \`${
|
|
1882
|
+
const command = bare ? "tenjin install" : `TENJIN_DATA_DIR=${dataDir} tenjin install`;
|
|
1883
|
+
return `Run \`${command}\` to bring the Claude Code plugin up to this version.`;
|
|
2070
1884
|
}
|
|
2071
1885
|
function versionFreeEntry(entry) {
|
|
2072
1886
|
if (entry === void 0 || entry.length === 0) return null;
|
|
@@ -2136,24 +1950,19 @@ var spawnCapture = (cmd, args, opts, onOutput) => new Promise((res) => {
|
|
|
2136
1950
|
});
|
|
2137
1951
|
|
|
2138
1952
|
export {
|
|
2139
|
-
CLAUDE_CODE_FLOOR,
|
|
2140
|
-
claudeConfigDir,
|
|
2141
|
-
findClaudeBinary,
|
|
2142
|
-
runClaude,
|
|
2143
|
-
jsonResult,
|
|
2144
|
-
jsonList,
|
|
2145
|
-
readClaudeCode,
|
|
2146
1953
|
inspectLegacyInstall,
|
|
2147
1954
|
removeLegacyInstall,
|
|
2148
1955
|
readMcpServers,
|
|
2149
1956
|
runUpdate,
|
|
2150
1957
|
versionFreeEntry,
|
|
2151
1958
|
spawnCapture,
|
|
2152
|
-
ROUTE_HOOK_TIMEOUT_SECONDS,
|
|
2153
|
-
AFTER_CALL_TIMEOUT_SECONDS,
|
|
2154
1959
|
removePluginFolder,
|
|
2155
1960
|
folderFor,
|
|
1961
|
+
registerPlugin,
|
|
2156
1962
|
ownMarketplace,
|
|
1963
|
+
packageHostsDir,
|
|
1964
|
+
packageMod,
|
|
1965
|
+
packageCliEntry,
|
|
2157
1966
|
readPluginListing,
|
|
2158
1967
|
folderState,
|
|
2159
1968
|
probeRouter,
|
|
@@ -2168,7 +1977,11 @@ export {
|
|
|
2168
1977
|
projectInstallAt,
|
|
2169
1978
|
runRouterInstall,
|
|
2170
1979
|
SHOW_NOT_RUN,
|
|
1980
|
+
spendStepFor,
|
|
1981
|
+
namedLimits,
|
|
2171
1982
|
FUND_QUESTION,
|
|
2172
|
-
FUND_COMMAND
|
|
1983
|
+
FUND_COMMAND,
|
|
1984
|
+
approveLimits,
|
|
1985
|
+
effectiveLimits
|
|
2173
1986
|
};
|
|
2174
|
-
//# sourceMappingURL=chunk-
|
|
1987
|
+
//# sourceMappingURL=chunk-77TCKDEC.js.map
|