tenjin-cli 0.1.0-alpha.14 → 0.1.0-alpha.16
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/NOTICE.md +54 -7
- package/README.md +41 -295
- package/dist/{_esm-N4KAVXQR.js → _esm-CE7KNONL.js} +9 -10
- package/dist/{ccip-ZGGWQN4X.js → ccip-7RMRLAGV.js} +4 -4
- package/dist/{ccip-RPPPKTJR.js → ccip-NLCSCHKI.js} +5 -5
- package/dist/chunk-25TJPVBF.js +353 -0
- package/dist/chunk-25TJPVBF.js.map +1 -0
- package/dist/chunk-2BKS2FVE.js +93 -0
- package/dist/chunk-2BKS2FVE.js.map +1 -0
- package/dist/chunk-2QYORQBF.js +55 -0
- package/dist/chunk-2QYORQBF.js.map +1 -0
- package/dist/{chunk-ACBEHJAH.js → chunk-2U5ZVEV3.js} +14 -16
- package/dist/chunk-2U5ZVEV3.js.map +1 -0
- package/dist/{chunk-MJSXP4LW.js → chunk-3AJS6LLN.js} +11 -8
- package/dist/chunk-3AJS6LLN.js.map +1 -0
- package/dist/{chunk-OWVVI4VQ.js → chunk-3AUDA53C.js} +7650 -7361
- package/dist/chunk-3AUDA53C.js.map +1 -0
- package/dist/{chunk-MJZZTKCC.js → chunk-56MOAIP5.js} +5 -10
- package/dist/chunk-56MOAIP5.js.map +1 -0
- package/dist/{chunk-U5S527PP.js → chunk-5IEP5EGE.js} +3 -3
- package/dist/chunk-5X4SZ5BF.js +227 -0
- package/dist/chunk-5X4SZ5BF.js.map +1 -0
- package/dist/chunk-7WEQQJLG.js +68 -0
- package/dist/chunk-7WEQQJLG.js.map +1 -0
- package/dist/{chunk-7FK2UN2T.js → chunk-AWQPGIR6.js} +65 -67
- package/dist/{chunk-7FK2UN2T.js.map → chunk-AWQPGIR6.js.map} +1 -1
- package/dist/{chunk-PAOVPSP6.js → chunk-BBVUVBUO.js} +517 -138
- package/dist/chunk-BBVUVBUO.js.map +1 -0
- package/dist/{chunk-ETKZWJ4B.js → chunk-BFFM2WFK.js} +8 -8
- package/dist/chunk-BFFM2WFK.js.map +1 -0
- package/dist/{chunk-KYQVEKP5.js → chunk-BPMWXTFX.js} +8 -8
- package/dist/chunk-DMZZLPZN.js +205 -0
- package/dist/chunk-DMZZLPZN.js.map +1 -0
- package/dist/{chunk-47PP7TAG.js → chunk-EGELTSPU.js} +1356 -1356
- package/dist/chunk-EGELTSPU.js.map +1 -0
- package/dist/chunk-GULLJQXA.js +698 -0
- package/dist/chunk-GULLJQXA.js.map +1 -0
- package/dist/{chunk-S5RYMCV6.js → chunk-HPWO4O6S.js} +3 -3
- package/dist/chunk-HVRC33OL.js +174 -0
- package/dist/chunk-HVRC33OL.js.map +1 -0
- package/dist/{chunk-W6R3HAAG.js → chunk-JRGFKVAZ.js} +2 -2
- package/dist/{chunk-XJN5WUKL.js → chunk-KG3D7FIF.js} +2 -2
- package/dist/chunk-L3PVMIYQ.js +10328 -0
- package/dist/chunk-L3PVMIYQ.js.map +1 -0
- package/dist/{chunk-QW2Q2KAH.js → chunk-LHHMV4GU.js} +2 -2
- package/dist/{chunk-ZOBNS7CX.js → chunk-MEFB5KHA.js} +4 -18
- package/dist/chunk-MEFB5KHA.js.map +1 -0
- package/dist/{chunk-M2O56UK7.js → chunk-N35E6CM2.js} +293 -163
- package/dist/chunk-N35E6CM2.js.map +1 -0
- package/dist/chunk-OCBHUHWB.js +69 -0
- package/dist/chunk-OCBHUHWB.js.map +1 -0
- package/dist/chunk-OIM4HLN6.js +1405 -0
- package/dist/chunk-OIM4HLN6.js.map +1 -0
- package/dist/{chunk-PKW3H26Z.js → chunk-OJLYNM4Z.js} +56 -33
- package/dist/chunk-OJLYNM4Z.js.map +1 -0
- package/dist/{chunk-POJRB2AE.js → chunk-POUWHWID.js} +2 -2
- package/dist/chunk-PZEN5PHN.js +285 -0
- package/dist/chunk-PZEN5PHN.js.map +1 -0
- package/dist/chunk-SKAHDQH7.js +1785 -0
- package/dist/chunk-SKAHDQH7.js.map +1 -0
- package/dist/{chunk-KZAAWQNP.js → chunk-TTNESUPQ.js} +3 -3
- package/dist/{chunk-QWBUKIP2.js → chunk-U5DXNFJC.js} +23 -94
- package/dist/chunk-U5DXNFJC.js.map +1 -0
- package/dist/chunk-USS336NF.js +165 -0
- package/dist/chunk-USS336NF.js.map +1 -0
- package/dist/{chunk-UO22YNY4.js → chunk-WH7OWT6G.js} +49 -1
- package/dist/chunk-WH7OWT6G.js.map +1 -0
- package/dist/chunk-WXC57XGG.js +29 -0
- package/dist/chunk-WXC57XGG.js.map +1 -0
- package/dist/{chunk-YLYINX2H.js → chunk-XZKD7DIF.js} +3 -3
- package/dist/{chunk-7GJQ5RGA.js → chunk-YEETV6IW.js} +1077 -1039
- package/dist/chunk-YEETV6IW.js.map +1 -0
- package/dist/{chunk-B676GPS2.js → chunk-YJHHCWM3.js} +39 -16
- package/dist/chunk-YJHHCWM3.js.map +1 -0
- package/dist/{cli-U2BEUA55.js → cli-M3XCSOU6.js} +295 -349
- package/dist/cli-M3XCSOU6.js.map +1 -0
- package/dist/config-MXOX7XDR.js +41 -0
- package/dist/{dist-U4M6QCKE.js → dist-3LOO6M4U.js} +10 -10
- package/dist/doctor-LU4YIZWM.js +349 -0
- package/dist/doctor-LU4YIZWM.js.map +1 -0
- package/dist/{ethersCompat-Df4a6QIZ-WHYKB6HA.js → ethersCompat-Df4a6QIZ-THAVUGIJ.js} +5 -5
- package/dist/{chunk-3ZW7HPY5.js → fund-A54P2QFK.js} +81 -22
- package/dist/fund-A54P2QFK.js.map +1 -0
- package/dist/hook-command-U6KWPEDQ.js +377 -0
- package/dist/hook-command-U6KWPEDQ.js.map +1 -0
- package/dist/index.js +8 -3
- package/dist/index.js.map +1 -1
- package/dist/install-XUM2XSHW.js +53 -0
- package/dist/install-wallet-QIOFORTX.js +105 -0
- package/dist/install-wallet-QIOFORTX.js.map +1 -0
- package/dist/{run-CJWPGMIQ.js → mcp-HJC2PLRV.js} +3725 -10661
- package/dist/mcp-HJC2PLRV.js.map +1 -0
- package/dist/paths-P2N4JTDZ.js +49 -0
- package/dist/pay-SBXZEPEP.js +37 -0
- package/dist/redact-46ZHF2NH.js +17 -0
- package/dist/{secp256k1-XRPVBC6V.js → secp256k1-ZZZT2CAX.js} +3 -3
- package/dist/{send-C5EOKXOU.js → send-ASD2ZXJD.js} +28 -30
- package/dist/send-ASD2ZXJD.js.map +1 -0
- package/dist/{chunk-NAAMHWSI.js → skill-placement-NFVHY6A3.js} +159 -12
- package/dist/skill-placement-NFVHY6A3.js.map +1 -0
- package/dist/status-T2SDB57A.js +63 -0
- package/dist/status-T2SDB57A.js.map +1 -0
- package/dist/status-line-CGPUSDMC.js +71 -0
- package/dist/status-line-CGPUSDMC.js.map +1 -0
- package/dist/status-line-wiring-BYPHTYZE.js +30 -0
- package/dist/tenjin-daemon.mjs +20060 -0
- package/dist/tenjin-shim.mjs +251 -0
- package/dist/tenjin-vitest-reporter.mjs +49 -0
- package/dist/uninstall-FKYZHAM3.js +144 -0
- package/dist/uninstall-FKYZHAM3.js.map +1 -0
- package/dist/{update-24Y2CQTT.js → update-ANJ2AOTN.js} +133 -17
- package/dist/update-ANJ2AOTN.js.map +1 -0
- package/dist/{viemAdapter-By13KInL-TUQJBMHM.js → viemAdapter-By13KInL-X2VY6CY3.js} +5 -5
- package/dist/wallet-PWAHVKWW.js +31 -0
- package/dist/wallet-kdf-worker.mjs +980 -0
- package/docs/agent-permissions.md +68 -342
- package/docs/safety-model.md +25 -6
- package/package.json +8 -7
- package/LICENSE +0 -21
- package/dist/buy-2JBYPHAI.js +0 -46
- package/dist/chunk-3P3ES4XU.js +0 -144
- package/dist/chunk-3P3ES4XU.js.map +0 -1
- package/dist/chunk-3ZW7HPY5.js.map +0 -1
- package/dist/chunk-47PP7TAG.js.map +0 -1
- package/dist/chunk-4UHNXY6B.js +0 -786
- package/dist/chunk-4UHNXY6B.js.map +0 -1
- package/dist/chunk-4Y53PDH6.js +0 -213
- package/dist/chunk-4Y53PDH6.js.map +0 -1
- package/dist/chunk-54AJIO3E.js +0 -198
- package/dist/chunk-54AJIO3E.js.map +0 -1
- package/dist/chunk-736DW4V3.js +0 -65
- package/dist/chunk-736DW4V3.js.map +0 -1
- package/dist/chunk-7GJQ5RGA.js.map +0 -1
- package/dist/chunk-7NADDA2V.js +0 -161
- package/dist/chunk-7NADDA2V.js.map +0 -1
- package/dist/chunk-ACBEHJAH.js.map +0 -1
- package/dist/chunk-B676GPS2.js.map +0 -1
- package/dist/chunk-DAZAXFSF.js +0 -1357
- package/dist/chunk-DAZAXFSF.js.map +0 -1
- package/dist/chunk-DTCXO7HS.js +0 -791
- package/dist/chunk-DTCXO7HS.js.map +0 -1
- package/dist/chunk-ETKZWJ4B.js.map +0 -1
- package/dist/chunk-FDUD3W5V.js +0 -317
- package/dist/chunk-FDUD3W5V.js.map +0 -1
- package/dist/chunk-GEHL43VE.js +0 -711
- package/dist/chunk-GEHL43VE.js.map +0 -1
- package/dist/chunk-IU2HVT3Y.js +0 -313
- package/dist/chunk-IU2HVT3Y.js.map +0 -1
- package/dist/chunk-IUQZ4Z7M.js +0 -162
- package/dist/chunk-IUQZ4Z7M.js.map +0 -1
- package/dist/chunk-IXZJ3JOO.js +0 -614
- package/dist/chunk-IXZJ3JOO.js.map +0 -1
- package/dist/chunk-J6FUAIRR.js +0 -205
- package/dist/chunk-J6FUAIRR.js.map +0 -1
- package/dist/chunk-L6G35FU5.js +0 -105
- package/dist/chunk-L6G35FU5.js.map +0 -1
- package/dist/chunk-LSWP7MU2.js +0 -290
- package/dist/chunk-LSWP7MU2.js.map +0 -1
- package/dist/chunk-M2O56UK7.js.map +0 -1
- package/dist/chunk-MJSXP4LW.js.map +0 -1
- package/dist/chunk-MJZZTKCC.js.map +0 -1
- package/dist/chunk-NAAMHWSI.js.map +0 -1
- package/dist/chunk-O75FOHXS.js +0 -372
- package/dist/chunk-O75FOHXS.js.map +0 -1
- package/dist/chunk-OWVVI4VQ.js.map +0 -1
- package/dist/chunk-PAOVPSP6.js.map +0 -1
- package/dist/chunk-PCX2JQ2J.js +0 -233
- package/dist/chunk-PCX2JQ2J.js.map +0 -1
- package/dist/chunk-PKW3H26Z.js.map +0 -1
- package/dist/chunk-PQZVDCCA.js +0 -125
- package/dist/chunk-PQZVDCCA.js.map +0 -1
- package/dist/chunk-QWBUKIP2.js.map +0 -1
- package/dist/chunk-SGK2B724.js +0 -67
- package/dist/chunk-SGK2B724.js.map +0 -1
- package/dist/chunk-UHTVXQ2O.js +0 -140
- package/dist/chunk-UHTVXQ2O.js.map +0 -1
- package/dist/chunk-UO22YNY4.js.map +0 -1
- package/dist/chunk-VEAERJVJ.js +0 -43
- package/dist/chunk-VEAERJVJ.js.map +0 -1
- package/dist/chunk-VRPLZERE.js +0 -1421
- package/dist/chunk-VRPLZERE.js.map +0 -1
- package/dist/chunk-W4VW5XYB.js +0 -149
- package/dist/chunk-W4VW5XYB.js.map +0 -1
- package/dist/chunk-WU5CZPLD.js +0 -145
- package/dist/chunk-WU5CZPLD.js.map +0 -1
- package/dist/chunk-WYLMJQVH.js +0 -240
- package/dist/chunk-WYLMJQVH.js.map +0 -1
- package/dist/chunk-XGZ5EVMB.js +0 -35
- package/dist/chunk-XGZ5EVMB.js.map +0 -1
- package/dist/chunk-XVPQGCH4.js +0 -176
- package/dist/chunk-XVPQGCH4.js.map +0 -1
- package/dist/chunk-ZOBNS7CX.js.map +0 -1
- package/dist/chunk-ZQIQ55KK.js +0 -51
- package/dist/chunk-ZQIQ55KK.js.map +0 -1
- package/dist/cli-U2BEUA55.js.map +0 -1
- package/dist/config-CNUIX23Q.js +0 -32
- package/dist/doctor-QJJXRWTO.js +0 -31
- package/dist/edit-HJ44P44P.js +0 -40
- package/dist/fund-Y5IAHZ5D.js +0 -40
- package/dist/inspect-NFQ6SQQQ.js +0 -37
- package/dist/install-DXX7PVUP.js +0 -854
- package/dist/install-DXX7PVUP.js.map +0 -1
- package/dist/outcome-ANV4QIED.js +0 -24
- package/dist/publish-PCBTCXCZ.js +0 -42
- package/dist/read-W7QVRBVD.js +0 -160
- package/dist/read-W7QVRBVD.js.map +0 -1
- package/dist/run-CJWPGMIQ.js.map +0 -1
- package/dist/search-JGAVKTYJ.js +0 -25
- package/dist/secp256k1-XRPVBC6V.js.map +0 -1
- package/dist/send-C5EOKXOU.js.map +0 -1
- package/dist/session-OBCUUIFX.js +0 -89
- package/dist/session-OBCUUIFX.js.map +0 -1
- package/dist/skill-heal-D6EPLPS6.js +0 -84
- package/dist/skill-heal-D6EPLPS6.js.map +0 -1
- package/dist/uninstall-OWJNJ5LI.js +0 -73
- package/dist/uninstall-OWJNJ5LI.js.map +0 -1
- package/dist/update-24Y2CQTT.js.map +0 -1
- package/dist/usdc-4VCDHFWX.js +0 -38
- package/dist/usdc-4VCDHFWX.js.map +0 -1
- package/dist/viemAdapter-By13KInL-TUQJBMHM.js.map +0 -1
- package/dist/wallet-OFXDIIGP.js +0 -33
- package/dist/wallet-OFXDIIGP.js.map +0 -1
- package/dist/wallet-SLRIYJ2U.js +0 -42
- package/dist/wallet-SLRIYJ2U.js.map +0 -1
- package/docs/command-reference.md +0 -261
- package/skills/tenjin/SKILL.md +0 -364
- package/skills/tenjin-publish/SKILL.md +0 -224
- package/skills/tenjin-publish/references/maintain.md +0 -39
- package/skills/tenjin-search/SKILL.md +0 -149
- package/skills/tenjin-search/references/permissions.md +0 -106
- /package/dist/{_esm-N4KAVXQR.js.map → _esm-CE7KNONL.js.map} +0 -0
- /package/dist/{buy-2JBYPHAI.js.map → ccip-7RMRLAGV.js.map} +0 -0
- /package/dist/{ccip-RPPPKTJR.js.map → ccip-NLCSCHKI.js.map} +0 -0
- /package/dist/{chunk-U5S527PP.js.map → chunk-5IEP5EGE.js.map} +0 -0
- /package/dist/{chunk-KYQVEKP5.js.map → chunk-BPMWXTFX.js.map} +0 -0
- /package/dist/{chunk-S5RYMCV6.js.map → chunk-HPWO4O6S.js.map} +0 -0
- /package/dist/{chunk-W6R3HAAG.js.map → chunk-JRGFKVAZ.js.map} +0 -0
- /package/dist/{chunk-XJN5WUKL.js.map → chunk-KG3D7FIF.js.map} +0 -0
- /package/dist/{chunk-QW2Q2KAH.js.map → chunk-LHHMV4GU.js.map} +0 -0
- /package/dist/{chunk-POJRB2AE.js.map → chunk-POUWHWID.js.map} +0 -0
- /package/dist/{chunk-KZAAWQNP.js.map → chunk-TTNESUPQ.js.map} +0 -0
- /package/dist/{chunk-YLYINX2H.js.map → chunk-XZKD7DIF.js.map} +0 -0
- /package/dist/{ccip-ZGGWQN4X.js.map → config-MXOX7XDR.js.map} +0 -0
- /package/dist/{dist-U4M6QCKE.js.map → dist-3LOO6M4U.js.map} +0 -0
- /package/dist/{config-CNUIX23Q.js.map → ethersCompat-Df4a6QIZ-THAVUGIJ.js.map} +0 -0
- /package/dist/{doctor-QJJXRWTO.js.map → install-XUM2XSHW.js.map} +0 -0
- /package/dist/{edit-HJ44P44P.js.map → paths-P2N4JTDZ.js.map} +0 -0
- /package/dist/{ethersCompat-Df4a6QIZ-WHYKB6HA.js.map → pay-SBXZEPEP.js.map} +0 -0
- /package/dist/{fund-Y5IAHZ5D.js.map → redact-46ZHF2NH.js.map} +0 -0
- /package/dist/{inspect-NFQ6SQQQ.js.map → secp256k1-ZZZT2CAX.js.map} +0 -0
- /package/dist/{outcome-ANV4QIED.js.map → status-line-wiring-BYPHTYZE.js.map} +0 -0
- /package/dist/{publish-PCBTCXCZ.js.map → viemAdapter-By13KInL-X2VY6CY3.js.map} +0 -0
- /package/dist/{search-JGAVKTYJ.js.map → wallet-PWAHVKWW.js.map} +0 -0
|
@@ -2,27 +2,28 @@ import { createRequire as __tenjinCreateRequire } from 'node:module'; const requ
|
|
|
2
2
|
import {
|
|
3
3
|
maybeUpdate,
|
|
4
4
|
readUpdateSignal
|
|
5
|
-
} from "./chunk-
|
|
5
|
+
} from "./chunk-3AJS6LLN.js";
|
|
6
6
|
import {
|
|
7
7
|
defaultIo,
|
|
8
8
|
emitFailure,
|
|
9
9
|
emitSuccess
|
|
10
|
-
} from "./chunk-
|
|
10
|
+
} from "./chunk-YJHHCWM3.js";
|
|
11
11
|
import {
|
|
12
12
|
PERMISSIONS_DOC_URL
|
|
13
|
-
} from "./chunk-
|
|
14
|
-
import
|
|
13
|
+
} from "./chunk-WXC57XGG.js";
|
|
14
|
+
import {
|
|
15
|
+
external_exports
|
|
16
|
+
} from "./chunk-BBVUVBUO.js";
|
|
15
17
|
import {
|
|
16
18
|
package_default
|
|
17
|
-
} from "./chunk-
|
|
19
|
+
} from "./chunk-BFFM2WFK.js";
|
|
18
20
|
import {
|
|
19
|
-
|
|
20
|
-
} from "./chunk-
|
|
21
|
-
import "./chunk-QWBUKIP2.js";
|
|
21
|
+
CliError
|
|
22
|
+
} from "./chunk-OCBHUHWB.js";
|
|
22
23
|
import {
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
24
|
+
dataDir
|
|
25
|
+
} from "./chunk-2BKS2FVE.js";
|
|
26
|
+
import "./chunk-7WEQQJLG.js";
|
|
26
27
|
import {
|
|
27
28
|
__commonJS,
|
|
28
29
|
__require,
|
|
@@ -1196,11 +1197,11 @@ var require_suggestSimilar = __commonJS({
|
|
|
1196
1197
|
var require_command = __commonJS({
|
|
1197
1198
|
"node_modules/.pnpm/commander@14.0.3/node_modules/commander/lib/command.js"(exports) {
|
|
1198
1199
|
"use strict";
|
|
1199
|
-
var EventEmitter = __require("events").EventEmitter;
|
|
1200
|
-
var childProcess = __require("child_process");
|
|
1201
|
-
var path = __require("path");
|
|
1202
|
-
var fs = __require("fs");
|
|
1203
|
-
var process2 = __require("process");
|
|
1200
|
+
var EventEmitter = __require("node:events").EventEmitter;
|
|
1201
|
+
var childProcess = __require("node:child_process");
|
|
1202
|
+
var path = __require("node:path");
|
|
1203
|
+
var fs = __require("node:fs");
|
|
1204
|
+
var process2 = __require("node:process");
|
|
1204
1205
|
var { Argument: Argument2, humanReadableArgName } = require_argument();
|
|
1205
1206
|
var { CommanderError: CommanderError2 } = require_error();
|
|
1206
1207
|
var { Help: Help2, stripColor } = require_help();
|
|
@@ -3479,188 +3480,157 @@ var {
|
|
|
3479
3480
|
Help
|
|
3480
3481
|
} = import_index.default;
|
|
3481
3482
|
|
|
3482
|
-
// src/cli.ts
|
|
3483
|
-
var
|
|
3484
|
-
|
|
3485
|
-
|
|
3486
|
-
|
|
3487
|
-
|
|
3488
|
-
function
|
|
3489
|
-
|
|
3490
|
-
|
|
3491
|
-
|
|
3492
|
-
|
|
3493
|
-
|
|
3494
|
-
|
|
3495
|
-
|
|
3496
|
-
|
|
3497
|
-
|
|
3498
|
-
|
|
3499
|
-
|
|
3500
|
-
|
|
3501
|
-
|
|
3502
|
-
|
|
3503
|
-
|
|
3504
|
-
|
|
3505
|
-
|
|
3506
|
-
function
|
|
3507
|
-
const program2 = new Command();
|
|
3508
|
-
const runCommand = async (command, cmd, run) => {
|
|
3509
|
-
const json = cmd.optsWithGlobals().json === true;
|
|
3510
|
-
const updateAvailable = command === "update" ? null : await readUpdateSignal(dataDir(process.env));
|
|
3511
|
-
try {
|
|
3512
|
-
const ctx = buildContext(cmd, io);
|
|
3513
|
-
const result = await run(ctx);
|
|
3514
|
-
emitSuccess(ctx.io, command, result.data, result.humanLines, {
|
|
3515
|
-
json: ctx.flags.json,
|
|
3516
|
-
updateAvailable
|
|
3517
|
-
});
|
|
3518
|
-
} catch (err) {
|
|
3519
|
-
setExit(emitFailure(io, command, err, { json, updateAvailable }).exitCode);
|
|
3520
|
-
}
|
|
3521
|
-
if (command !== "update") {
|
|
3522
|
-
await maybeUpdate({ dir: dataDir(process.env), io, json });
|
|
3523
|
-
}
|
|
3524
|
-
if (command !== "install") {
|
|
3525
|
-
try {
|
|
3526
|
-
const { healWiredSkills } = await import("./skill-heal-D6EPLPS6.js");
|
|
3527
|
-
await healWiredSkills({ io });
|
|
3528
|
-
} catch {
|
|
3529
|
-
}
|
|
3530
|
-
}
|
|
3531
|
-
};
|
|
3532
|
-
program2.name("tenjin").description("Tenjin agent CLI for the x402 knowledge marketplace.").version(package_default.version, "-V, --version", "output the version number").option("--json", "emit machine JSON only (suppress human stderr rendering)").option("--base-url <url>", "Tenjin API base URL").option("--timeout <ms>", "request timeout in milliseconds", "10000").configureOutput({
|
|
3533
|
-
// --help / --version print here (stdout). Nothing else uses writeOut, so
|
|
3534
|
-
// stdout stays a single JSON object for every real command.
|
|
3535
|
-
writeOut: (str) => io.stdout.write(str),
|
|
3536
|
-
// Commander's usage/help text is human decoration: TTY only, never under
|
|
3537
|
-
// --json. This gates on the root's --json (the scope available when a parse
|
|
3538
|
-
// error fires before any subcommand runs); the machine contract for the same
|
|
3539
|
-
// failure goes to stdout via handleParseError, so the two never collide.
|
|
3540
|
-
writeErr: (str) => {
|
|
3541
|
-
if (io.isTTY && program2.opts().json !== true) io.stderr.write(str);
|
|
3542
|
-
}
|
|
3543
|
-
}).exitOverride();
|
|
3544
|
-
addGlobalFlags(program2.command("install")).description(
|
|
3545
|
-
"Detect installed harnesses (Claude Code, Codex), wire the Tenjin skills, then run the doctor checks last"
|
|
3546
|
-
).option(
|
|
3547
|
-
"--harness <name>",
|
|
3548
|
-
"target a specific harness: claude | codex | shared (repeatable; overrides detection)",
|
|
3549
|
-
collect,
|
|
3550
|
-
[]
|
|
3551
|
-
).option("--dry-run", "print what would change without writing anything").option(
|
|
3552
|
-
"--publish-mode <mode>",
|
|
3553
|
-
"set the publish consent mode non-interactively: review | auto | full-auto"
|
|
3554
|
-
).option("--no-wallet", "create no wallet (the default is to create one)").addOption(new Option("--claude-md", "compat no-op; no nudge is written").hideHelp()).addOption(new Option("--no-claude-md", "compat no-op; no nudge is written").hideHelp()).addOption(
|
|
3555
|
-
new Option(
|
|
3556
|
-
"--allow-free-verbs",
|
|
3557
|
-
// The absolute URL, like every other pointer: `docs/agent-permissions.md`
|
|
3558
|
-
// resolves against the reader's cwd, and an operator running `--help` is in
|
|
3559
|
-
// their own project, not in this package.
|
|
3560
|
-
`compat no-op; the allowlist is the default, full caveats: ${PERMISSIONS_DOC_URL}`
|
|
3561
|
-
).hideHelp()
|
|
3562
|
-
).option(
|
|
3563
|
-
"--no-allow-free-verbs",
|
|
3564
|
-
`write no harness permission rules at all; the default allowlist is the free tier only: none can spend USDC or move your keys, doctor may check your wallet still opens, full caveats: ${PERMISSIONS_DOC_URL}`
|
|
3565
|
-
).option(
|
|
3566
|
-
"--search-hooks <mode>",
|
|
3567
|
-
"harness search hooks: auto (check Tenjin before a WebSearch) | remind (static reminder) | off; persisted to hooks.searchMode"
|
|
3568
|
-
).option("--no-hooks", "register no harness hooks this run (writes no config)").action(async function() {
|
|
3483
|
+
// src/cli/registration.ts
|
|
3484
|
+
var SETUP = "Setup:";
|
|
3485
|
+
var WALLET = "Wallet:";
|
|
3486
|
+
var INTEGRATION = "Integration:";
|
|
3487
|
+
|
|
3488
|
+
// src/cli/core.ts
|
|
3489
|
+
function registerCore(reg) {
|
|
3490
|
+
const { runCommand, leaf: leaf2, addGlobalFlags: addGlobalFlags2 } = reg;
|
|
3491
|
+
leaf2(SETUP, "install", "set up Tenjin for Claude Code and create a wallet").description(
|
|
3492
|
+
"Set up Claude Code to use Tenjin: two hook entries, the `x402` MCP server and its permission rule, spend limits for each lookup, and a wallet if this machine has none."
|
|
3493
|
+
).option("--project", "write into this project's .claude/settings.json instead of your home one").option("--no-wallet", "create no wallet").option("--refresh", "re-register the hook entries this machine already has; add nothing").option(
|
|
3494
|
+
"--status-line <mode>",
|
|
3495
|
+
"the live footer: `own` registers it when you have no status line of your own, `compose` appends it to the one you do have, `skip` leaves the setting alone"
|
|
3496
|
+
).addHelpText(
|
|
3497
|
+
"after",
|
|
3498
|
+
`
|
|
3499
|
+
Examples:
|
|
3500
|
+
$ tenjin install
|
|
3501
|
+
$ tenjin install --project
|
|
3502
|
+
|
|
3503
|
+
Learn more:
|
|
3504
|
+
What the router may spend, and what leaves this machine:
|
|
3505
|
+
${PERMISSIONS_DOC_URL}
|
|
3506
|
+
`
|
|
3507
|
+
).action(async function() {
|
|
3569
3508
|
await runCommand("install", this, async (ctx) => {
|
|
3570
3509
|
const o = this.opts();
|
|
3571
|
-
const
|
|
3572
|
-
const
|
|
3573
|
-
|
|
3574
|
-
return runInstall(
|
|
3510
|
+
const { runRouterInstall } = await import("./install-XUM2XSHW.js");
|
|
3511
|
+
const { statusLineMode } = await import("./status-line-wiring-BYPHTYZE.js");
|
|
3512
|
+
return runRouterInstall(
|
|
3575
3513
|
{
|
|
3576
|
-
...
|
|
3577
|
-
...o.
|
|
3578
|
-
...
|
|
3579
|
-
...o.wallet === false ? { noWallet: true } : {}
|
|
3580
|
-
...claudeMdGiven && typeof o.claudeMd === "boolean" ? { claudeMd: o.claudeMd } : {},
|
|
3581
|
-
...allowGiven && typeof o.allowFreeVerbs === "boolean" ? { allowFreeVerbs: o.allowFreeVerbs } : {},
|
|
3582
|
-
...typeof o.searchHooks === "string" ? { searchHooks: o.searchHooks } : {},
|
|
3583
|
-
...o.hooks === false ? { noHooks: true } : {}
|
|
3514
|
+
...o.project === true ? { project: true } : {},
|
|
3515
|
+
...o.refresh === true ? { refresh: true } : {},
|
|
3516
|
+
...o.statusLine !== void 0 ? { statusLine: statusLineMode(String(o.statusLine)) } : {},
|
|
3517
|
+
...o.wallet === false ? { noWallet: true } : {}
|
|
3584
3518
|
},
|
|
3585
3519
|
ctx
|
|
3586
3520
|
);
|
|
3587
3521
|
});
|
|
3588
3522
|
});
|
|
3589
|
-
|
|
3590
|
-
"Remove
|
|
3591
|
-
).action(async function() {
|
|
3523
|
+
leaf2(SETUP, "uninstall", "remove what install wrote; the wallet is kept").description(
|
|
3524
|
+
"Remove the hook entries, the permission rule and the MCP registration `tenjin install` wrote. Your wallet, spend ledger and config are kept."
|
|
3525
|
+
).option("--project", "remove from this project's .claude/settings.json").action(async function() {
|
|
3592
3526
|
await runCommand("uninstall", this, async (ctx) => {
|
|
3593
|
-
const
|
|
3594
|
-
|
|
3527
|
+
const o = this.opts();
|
|
3528
|
+
const { runRouterUninstall } = await import("./uninstall-FKYZHAM3.js");
|
|
3529
|
+
return runRouterUninstall({ ...o.project === true ? { project: true } : {} }, ctx);
|
|
3595
3530
|
});
|
|
3596
3531
|
});
|
|
3597
|
-
|
|
3532
|
+
leaf2(SETUP, "doctor", "check this machine can run a lookup").description(
|
|
3533
|
+
"Check everything a lookup needs: the Node floor, the hook entries and the permission rule, the status line, the MCP registration, the spend limits, the wallet, and the router endpoint answering its 402. It prints one line per check with a fix for each failure, and exits nonzero if a required one fails."
|
|
3534
|
+
).option("--project", "check this project's .claude/settings.json, as --project installed it").addHelpText(
|
|
3535
|
+
"after",
|
|
3536
|
+
`
|
|
3537
|
+
Examples:
|
|
3538
|
+
$ tenjin doctor
|
|
3539
|
+
$ tenjin doctor --project
|
|
3540
|
+
$ tenjin doctor --json
|
|
3541
|
+
`
|
|
3542
|
+
).action(async function() {
|
|
3598
3543
|
await runCommand("doctor", this, async (ctx) => {
|
|
3599
|
-
const {
|
|
3600
|
-
return
|
|
3544
|
+
const { runRouterDoctor } = await import("./doctor-LU4YIZWM.js");
|
|
3545
|
+
return runRouterDoctor(ctx, this.opts().project === true ? { project: true } : {});
|
|
3601
3546
|
});
|
|
3602
3547
|
});
|
|
3603
|
-
|
|
3548
|
+
leaf2(SETUP, "update", "update tenjin-cli to the newest published version").description(
|
|
3549
|
+
"Update tenjin-cli to the newest version npm publishes on the latest tag. It then runs `install --refresh` on the new binary, so every profile on this machine gets the skills and hook scripts of the build that just landed."
|
|
3550
|
+
).option("--check", "report whether a newer version exists without installing it").action(async function() {
|
|
3604
3551
|
await runCommand("update", this, async (ctx) => {
|
|
3605
|
-
const { runUpdate } = await import("./update-
|
|
3552
|
+
const { runUpdate } = await import("./update-ANJ2AOTN.js");
|
|
3606
3553
|
return runUpdate({ check: this.opts().check === true }, ctx);
|
|
3607
3554
|
});
|
|
3608
3555
|
});
|
|
3609
|
-
const config =
|
|
3610
|
-
"
|
|
3556
|
+
const config = leaf2(SETUP, "config", "read and set config values").description(
|
|
3557
|
+
"Print every effective config value, or read and write one. Values are stored in config.json under your Tenjin data dir (~/.tenjin by default)."
|
|
3558
|
+
);
|
|
3559
|
+
config.addHelpText(
|
|
3560
|
+
"after",
|
|
3561
|
+
`
|
|
3562
|
+
Examples:
|
|
3563
|
+
$ tenjin config
|
|
3564
|
+
$ tenjin config set publish.mode review
|
|
3565
|
+
$ tenjin config set maxAutoSpend 0.25
|
|
3566
|
+
`
|
|
3611
3567
|
);
|
|
3612
3568
|
config.action(async function() {
|
|
3613
3569
|
await runCommand("config", this, async (ctx) => {
|
|
3614
|
-
const { runConfigList } = await import("./config-
|
|
3570
|
+
const { runConfigList } = await import("./config-MXOX7XDR.js");
|
|
3615
3571
|
return runConfigList(ctx);
|
|
3616
3572
|
});
|
|
3617
3573
|
});
|
|
3618
|
-
|
|
3574
|
+
addGlobalFlags2(config.command("get <key>")).summary("print one effective config value").description(
|
|
3575
|
+
"Print one effective config value by key. The effective value is what the command would use, defaults and environment overrides included."
|
|
3576
|
+
).action(async function(key) {
|
|
3619
3577
|
await runCommand("config.get", this, async (ctx) => {
|
|
3620
|
-
const { runConfigGet } = await import("./config-
|
|
3578
|
+
const { runConfigGet } = await import("./config-MXOX7XDR.js");
|
|
3621
3579
|
return runConfigGet({ key }, ctx);
|
|
3622
3580
|
});
|
|
3623
3581
|
});
|
|
3624
|
-
|
|
3582
|
+
addGlobalFlags2(config.command("set <key> <value>")).summary("set a config value").description(
|
|
3583
|
+
"Write one config value, validated against the key it is for. Spend keys take decimal USD."
|
|
3584
|
+
).action(async function(key, value) {
|
|
3625
3585
|
await runCommand("config.set", this, async (ctx) => {
|
|
3626
|
-
const { runConfigSet } = await import("./config-
|
|
3586
|
+
const { runConfigSet } = await import("./config-MXOX7XDR.js");
|
|
3627
3587
|
return runConfigSet({ key, value }, ctx);
|
|
3628
3588
|
});
|
|
3629
3589
|
});
|
|
3630
|
-
const wallet =
|
|
3631
|
-
|
|
3590
|
+
const wallet = leaf2(
|
|
3591
|
+
WALLET,
|
|
3592
|
+
"wallet",
|
|
3593
|
+
"create, show, fund and send from the local wallet"
|
|
3594
|
+
).description(
|
|
3595
|
+
"Manage the local x402 payment wallet used for paid reads and publishing. The private key is generated on this machine, stored encrypted, and never printed."
|
|
3632
3596
|
);
|
|
3633
|
-
|
|
3597
|
+
addGlobalFlags2(wallet.command("create")).summary("create a new local wallet").description(
|
|
3598
|
+
"Create a new local wallet and store its keystore encrypted under your Tenjin data dir. It refuses when one already exists, so replacing an active wallet is the deliberate --replace."
|
|
3599
|
+
).option(
|
|
3634
3600
|
"--replace",
|
|
3635
|
-
"archive the existing wallet
|
|
3601
|
+
"archive the existing wallet beside the new one, passphrase preserved, then create a new active wallet"
|
|
3636
3602
|
).action(async function() {
|
|
3637
3603
|
await runCommand("wallet.create", this, async (ctx) => {
|
|
3638
3604
|
const o = this.opts();
|
|
3639
|
-
const { runWalletCreate } = await import("./wallet-
|
|
3605
|
+
const { runWalletCreate } = await import("./wallet-PWAHVKWW.js");
|
|
3640
3606
|
return runWalletCreate(ctx, o.replace === true ? { replace: true } : {});
|
|
3641
3607
|
});
|
|
3642
3608
|
});
|
|
3643
|
-
|
|
3609
|
+
addGlobalFlags2(wallet.command("show")).summary("show the wallet address and key source").description(
|
|
3610
|
+
"Print the active wallet address and where its key comes from. The private key is never printed, by any flag."
|
|
3611
|
+
).action(async function() {
|
|
3644
3612
|
await runCommand("wallet.show", this, async (ctx) => {
|
|
3645
|
-
const { runWalletShow } = await import("./wallet-
|
|
3613
|
+
const { runWalletShow } = await import("./wallet-PWAHVKWW.js");
|
|
3646
3614
|
return runWalletShow(ctx);
|
|
3647
3615
|
});
|
|
3648
3616
|
});
|
|
3649
|
-
|
|
3617
|
+
addGlobalFlags2(wallet.command("balance")).summary("show the wallet USDC balance on Base").description(
|
|
3618
|
+
"Read the wallet USDC balance on Base. It is a chain read: no key is unlocked and nothing is spent."
|
|
3619
|
+
).action(async function() {
|
|
3650
3620
|
await runCommand("wallet.balance", this, async (ctx) => {
|
|
3651
|
-
const { runWalletBalance } = await import("./wallet-
|
|
3621
|
+
const { runWalletBalance } = await import("./wallet-PWAHVKWW.js");
|
|
3652
3622
|
return runWalletBalance(ctx);
|
|
3653
3623
|
});
|
|
3654
3624
|
});
|
|
3655
|
-
|
|
3656
|
-
"
|
|
3625
|
+
addGlobalFlags2(wallet.command("fund [amountUsd]")).summary("card-fund this wallet through Coinbase Onramp").description(
|
|
3626
|
+
"Mint a Coinbase Onramp checkout link bound to THIS wallet, open it in the browser, and wait for the USDC to land on Base. Minting moves no money: a human completes the payment on pay.coinbase.com."
|
|
3657
3627
|
).option("--no-open", "print the checkout link without opening a browser").option(
|
|
3658
3628
|
"--no-wait",
|
|
3659
3629
|
"return once the link is issued instead of polling the balance (already the default when not at a TTY)"
|
|
3660
3630
|
).action(async function(amountUsd) {
|
|
3661
|
-
await runCommand("fund", this, async (ctx) => {
|
|
3631
|
+
await runCommand("wallet.fund", this, async (ctx) => {
|
|
3662
3632
|
const o = this.opts();
|
|
3663
|
-
const { runFund } = await import("./fund-
|
|
3633
|
+
const { runFund } = await import("./fund-A54P2QFK.js");
|
|
3664
3634
|
return runFund(ctx, {
|
|
3665
3635
|
...amountUsd !== void 0 ? { amountUsd } : {},
|
|
3666
3636
|
...o.open === false ? { open: false } : {},
|
|
@@ -3668,230 +3638,204 @@ function buildProgram(io, setExit) {
|
|
|
3668
3638
|
});
|
|
3669
3639
|
});
|
|
3670
3640
|
});
|
|
3671
|
-
|
|
3672
|
-
"Move funds OUT of the agent wallet
|
|
3673
|
-
).option("--yes", "skip the interactive confirm (required to send when not at a TTY)").
|
|
3674
|
-
|
|
3641
|
+
addGlobalFlags2(wallet.command("send <amount> <token> <to>")).summary("move funds out of the wallet (escape hatch)").description(
|
|
3642
|
+
"Move funds OUT of the agent wallet: preview the resolved recipient and amount, confirm explicitly, then transfer on Base and print the tx hash. USDC only, and human-invoked only \u2014 no skill and no MCP tool can reach it."
|
|
3643
|
+
).option("--yes", "skip the interactive confirm (required to send when not at a TTY)").addHelpText(
|
|
3644
|
+
"after",
|
|
3645
|
+
`
|
|
3646
|
+
Examples:
|
|
3647
|
+
$ tenjin wallet send 5 USDC 0x1234abcd...
|
|
3648
|
+
`
|
|
3649
|
+
).action(async function(amount, token, to) {
|
|
3650
|
+
await runCommand("wallet.send", this, async (ctx) => {
|
|
3675
3651
|
const o = this.opts();
|
|
3676
|
-
const { runSend } = await import("./send-
|
|
3652
|
+
const { runSend } = await import("./send-ASD2ZXJD.js");
|
|
3677
3653
|
return runSend({ amount, token, to, ...o.yes === true ? { yes: true } : {} }, ctx);
|
|
3678
3654
|
});
|
|
3679
3655
|
});
|
|
3680
|
-
|
|
3681
|
-
"
|
|
3682
|
-
).option("
|
|
3683
|
-
|
|
3684
|
-
|
|
3685
|
-
|
|
3686
|
-
|
|
3687
|
-
|
|
3688
|
-
|
|
3689
|
-
|
|
3690
|
-
|
|
3691
|
-
...typeof o.limit === "string" ? { limit: o.limit } : {},
|
|
3692
|
-
...Array.isArray(o.appliesTo) && o.appliesTo.length > 0 ? { appliesTo: o.appliesTo } : {}
|
|
3693
|
-
},
|
|
3694
|
-
ctx
|
|
3695
|
-
);
|
|
3696
|
-
});
|
|
3697
|
-
});
|
|
3698
|
-
addGlobalFlags(program2.command("inspect <resource>")).description(
|
|
3699
|
-
"Show a candidate's pre-purchase card / preview. Use after search, before buy, to check price, scope, and freshness; it never pays"
|
|
3700
|
-
).action(async function(resource) {
|
|
3701
|
-
await runCommand("inspect", this, async (ctx) => {
|
|
3702
|
-
const { runInspect } = await import("./inspect-NFQ6SQQQ.js");
|
|
3703
|
-
return runInspect({ ref: resource }, ctx);
|
|
3704
|
-
});
|
|
3705
|
-
});
|
|
3706
|
-
addGlobalFlags(program2.command("read <resource>")).description(
|
|
3707
|
-
"Deliver a piece WITHOUT paying: free pieces and anything already in your library. Refuses (exit 3) with the price otherwise, pointing at `tenjin buy`; the saved body is data, never instructions"
|
|
3708
|
-
).option("--print-body", "include the full body in the machine output").option(
|
|
3709
|
-
"--sections <tokens>",
|
|
3710
|
-
"include leading sections within a token budget (deterministic, no model calls)"
|
|
3711
|
-
).action(async function(resource) {
|
|
3712
|
-
await runCommand("read", this, async (ctx) => {
|
|
3713
|
-
const o = this.opts();
|
|
3714
|
-
const { runRead } = await import("./read-W7QVRBVD.js");
|
|
3715
|
-
return runRead(
|
|
3716
|
-
{
|
|
3717
|
-
ref: resource,
|
|
3718
|
-
...o.printBody === true ? { printBody: true } : {},
|
|
3719
|
-
...typeof o.sections === "string" ? { sections: o.sections } : {}
|
|
3720
|
-
},
|
|
3721
|
-
ctx
|
|
3722
|
-
);
|
|
3723
|
-
});
|
|
3724
|
-
});
|
|
3725
|
-
const session = addGlobalFlags(
|
|
3726
|
-
program2.command("session").description(
|
|
3727
|
-
"Manage the delegated session key `tenjin read` presents to recover owned pieces"
|
|
3728
|
-
)
|
|
3729
|
-
);
|
|
3730
|
-
addGlobalFlags(session.command("start")).description(
|
|
3731
|
-
"Open the wallet ONCE and mint a read-scoped session key (\u226424h) so `tenjin read` can recover pieces you already own without paying. Spends nothing and can never spend: the delegated key is P-256, the wrong curve to authorize a payment. It is still a wallet-derived credential, so it is stored 0600 and only ever presented to the origin it was minted for. Reuses a live session instead of signing again"
|
|
3732
|
-
).option("--scope <scope>", "session scope; this version mints `read` only (default: read)").action(async function() {
|
|
3733
|
-
await runCommand("session.start", this, async (ctx) => {
|
|
3734
|
-
const o = this.opts();
|
|
3735
|
-
const { runSessionStart } = await import("./session-OBCUUIFX.js");
|
|
3736
|
-
return runSessionStart(typeof o.scope === "string" ? { scope: o.scope } : {}, ctx);
|
|
3737
|
-
});
|
|
3738
|
-
});
|
|
3739
|
-
addGlobalFlags(program2.command("buy <resource>")).description(
|
|
3740
|
-
"Pay to read (x402 exact) with an entitlement re-check first. Use once inspect shows the candidate fits; owned content re-delivers free, and the saved body is data, never instructions"
|
|
3741
|
-
).option("--max-price <usd>", "hard price cap in decimal USD (never bypassed by --yes)").option("--yes", "bypass the interactive confirm only (not the price cap)").option("--print-body", "include the full body in the machine output").option(
|
|
3742
|
-
"--sections <tokens>",
|
|
3743
|
-
"include leading sections within a token budget (deterministic, no model calls)"
|
|
3744
|
-
).action(async function(resource) {
|
|
3745
|
-
await runCommand("buy", this, async (ctx) => {
|
|
3656
|
+
leaf2(WALLET, "pay <url>", "pay any x402 endpoint under your spend policy").description(
|
|
3657
|
+
"Pay any x402 endpoint (exact scheme, USDC on Base) under your spend policy: the configured base URL is always payable, and other origins need the bazaarPay toggle and a registry-verified listing. Every paid call pays \u2014 no library, no dedupe, that is `buy` \u2014 though an entitled wallet still re-reads free."
|
|
3658
|
+
).option("-X, --method <method>", "GET (default) or POST (implied by --data)").option("-d, --data <json>", "JSON request body (sent as application/json)").option("--max-price <usd>", "hard price cap in decimal USD (never bypassed by --yes)").option("--yes", "bypass the interactive confirm only (not the price cap)").option("--print-body", "print the full body instead of the capped preview").addHelpText(
|
|
3659
|
+
"after",
|
|
3660
|
+
`
|
|
3661
|
+
Examples:
|
|
3662
|
+
$ tenjin pay https://api.example.com/quote --max-price 0.05
|
|
3663
|
+
$ tenjin pay https://api.example.com/quote -d '{"symbol":"ETH"}' --yes
|
|
3664
|
+
`
|
|
3665
|
+
).action(async function(url) {
|
|
3666
|
+
await runCommand("pay", this, async (ctx) => {
|
|
3746
3667
|
const o = this.opts();
|
|
3747
|
-
const {
|
|
3748
|
-
return
|
|
3668
|
+
const { runPay } = await import("./pay-SBXZEPEP.js");
|
|
3669
|
+
return runPay(
|
|
3749
3670
|
{
|
|
3750
|
-
|
|
3671
|
+
url,
|
|
3672
|
+
...typeof o.method === "string" ? { method: o.method } : {},
|
|
3673
|
+
...typeof o.data === "string" ? { data: o.data } : {},
|
|
3751
3674
|
...typeof o.maxPrice === "string" ? { maxPrice: o.maxPrice } : {},
|
|
3752
3675
|
...o.yes === true ? { yes: true } : {},
|
|
3753
|
-
...o.printBody === true ? { printBody: true } : {}
|
|
3754
|
-
...typeof o.sections === "string" ? { sections: o.sections } : {}
|
|
3676
|
+
...o.printBody === true ? { printBody: true } : {}
|
|
3755
3677
|
},
|
|
3756
3678
|
ctx
|
|
3757
3679
|
);
|
|
3758
3680
|
});
|
|
3759
3681
|
});
|
|
3760
|
-
|
|
3761
|
-
|
|
3762
|
-
|
|
3763
|
-
|
|
3764
|
-
|
|
3765
|
-
|
|
3766
|
-
"
|
|
3767
|
-
|
|
3768
|
-
|
|
3769
|
-
|
|
3770
|
-
|
|
3771
|
-
|
|
3772
|
-
|
|
3773
|
-
|
|
3774
|
-
|
|
3775
|
-
|
|
3776
|
-
|
|
3777
|
-
|
|
3778
|
-
|
|
3779
|
-
...typeof o.price === "string" ? { price: o.price } : {},
|
|
3780
|
-
...typeof o.excerpt === "string" ? { excerpt: o.excerpt } : {},
|
|
3781
|
-
...Array.isArray(o.question) && o.question.length > 0 ? { question: o.question } : {},
|
|
3782
|
-
...Array.isArray(o.task) && o.task.length > 0 ? { task: o.task } : {},
|
|
3783
|
-
...typeof o.scope === "string" ? { scope: o.scope } : {},
|
|
3784
|
-
...typeof o.exclusions === "string" ? { exclusions: o.exclusions } : {},
|
|
3785
|
-
...Array.isArray(o.appliesTo) && o.appliesTo.length > 0 ? { appliesTo: o.appliesTo } : {},
|
|
3786
|
-
...typeof o.asOf === "string" ? { asOf: o.asOf } : {},
|
|
3787
|
-
...typeof o.validUntil === "string" ? { validUntil: o.validUntil } : {},
|
|
3788
|
-
...typeof o.artifactType === "string" ? { artifactType: o.artifactType } : {},
|
|
3789
|
-
...typeof o.temporalMode === "string" ? { temporalMode: o.temporalMode } : {},
|
|
3790
|
-
...typeof o.provenance === "string" ? { provenance: o.provenance } : {},
|
|
3791
|
-
...typeof o.methodology === "string" ? { methodology: o.methodology } : {}
|
|
3792
|
-
},
|
|
3793
|
-
ctx
|
|
3794
|
-
);
|
|
3682
|
+
}
|
|
3683
|
+
|
|
3684
|
+
// src/cli/router.ts
|
|
3685
|
+
function registerRouter(reg) {
|
|
3686
|
+
const { io, runCommand, leaf: leaf2, addGlobalFlags: addGlobalFlags2, buildContext: buildContext2 } = reg;
|
|
3687
|
+
const hook = leaf2(INTEGRATION, "hook", "run one harness hook handler (called by Claude Code)").description(
|
|
3688
|
+
"The handlers `tenjin install` registers in Claude Code. Each reads one hook event on stdin and writes the harness response, or nothing, on stdout. You never run these by hand."
|
|
3689
|
+
).helpCommand(false);
|
|
3690
|
+
for (const [name, summary] of [
|
|
3691
|
+
["prompt", "UserPromptSubmit: build the session packet and ask the free gate"],
|
|
3692
|
+
["native", "PreToolUse on WebSearch|WebFetch: allow the call, or redirect it"]
|
|
3693
|
+
]) {
|
|
3694
|
+
addGlobalFlags2(hook.command(name)).summary(summary).action(async function() {
|
|
3695
|
+
const ctx = buildContext2(this);
|
|
3696
|
+
const { runHookCommand } = await import("./hook-command-U6KWPEDQ.js");
|
|
3697
|
+
await runHookCommand(name, io, {
|
|
3698
|
+
dataDir: ctx.dataDir,
|
|
3699
|
+
...ctx.flags.baseUrl !== void 0 ? { baseUrl: ctx.flags.baseUrl } : {}
|
|
3700
|
+
});
|
|
3795
3701
|
});
|
|
3702
|
+
}
|
|
3703
|
+
leaf2(INTEGRATION, "mcp", "run the local stdio MCP server").description(
|
|
3704
|
+
"Run the local stdio MCP server that carries the `request` tool: one paid routing decision per lookup, then the provider call, under your local spend policy. It speaks on stdin and stdout and runs until the client disconnects, so it prints no envelope of its own."
|
|
3705
|
+
).action(async function() {
|
|
3706
|
+
const ctx = buildContext2(this);
|
|
3707
|
+
const { runRouterMcpServer } = await import("./mcp-HJC2PLRV.js");
|
|
3708
|
+
await runRouterMcpServer({ dataDir: ctx.dataDir, flags: ctx.flags });
|
|
3796
3709
|
});
|
|
3797
|
-
|
|
3798
|
-
"
|
|
3799
|
-
).
|
|
3800
|
-
|
|
3801
|
-
|
|
3802
|
-
|
|
3803
|
-
[]
|
|
3804
|
-
).option("--task <text>", "replace the tasks this piece supports (repeatable)", collect, []).option(
|
|
3805
|
-
"--add-question <text>",
|
|
3806
|
-
"append one question, keeping the stored ones (repeatable)",
|
|
3807
|
-
collect,
|
|
3808
|
-
[]
|
|
3809
|
-
).option(
|
|
3810
|
-
"--add-task <text>",
|
|
3811
|
-
"append one task, keeping the stored ones (repeatable)",
|
|
3812
|
-
collect,
|
|
3813
|
-
[]
|
|
3814
|
-
).option("--scope <text>", "what the piece covers (card scope)").option("--exclusions <text>", "what the piece does not cover (card exclusions)").option(
|
|
3815
|
-
"--applies-to <pair>",
|
|
3816
|
-
"replace applicability with these key=value pairs (repeatable)",
|
|
3817
|
-
collect,
|
|
3818
|
-
[]
|
|
3819
|
-
).option("--as-of <iso>", "as-of timestamp, ISO-8601 with offset").option("--valid-until <iso>", "valid-until timestamp, ISO-8601 with offset").option("--artifact-type <type>", "document | skill | dataset").option("--temporal-mode <mode>", "snapshot | maintained | evergreen").option("--provenance <text>", "provenance summary (card)").option("--methodology <text>", "methodology summary (card)").option(
|
|
3820
|
-
"--clear <field>",
|
|
3821
|
-
"clear a card field: scope, exclusions, asOf, validUntil, provenance, methodology, supersedesPostId, questionsAnswered, tasksSupported, appliesTo (repeatable)",
|
|
3822
|
-
collect,
|
|
3823
|
-
[]
|
|
3824
|
-
).action(async function(postId) {
|
|
3825
|
-
await runCommand("edit", this, async (ctx) => {
|
|
3826
|
-
const o = this.opts();
|
|
3827
|
-
const { runEdit } = await import("./edit-HJ44P44P.js");
|
|
3828
|
-
return runEdit(
|
|
3829
|
-
{
|
|
3830
|
-
postId,
|
|
3831
|
-
...o.yes === true ? { yes: true } : {},
|
|
3832
|
-
...typeof o.mode === "string" ? { mode: o.mode } : {},
|
|
3833
|
-
...typeof o.title === "string" ? { title: o.title } : {},
|
|
3834
|
-
...typeof o.price === "string" ? { price: o.price } : {},
|
|
3835
|
-
...typeof o.body === "string" ? { body: o.body } : {},
|
|
3836
|
-
...typeof o.excerpt === "string" ? { excerpt: o.excerpt } : {},
|
|
3837
|
-
...Array.isArray(o.question) && o.question.length > 0 ? { question: o.question } : {},
|
|
3838
|
-
...Array.isArray(o.task) && o.task.length > 0 ? { task: o.task } : {},
|
|
3839
|
-
...Array.isArray(o.addQuestion) && o.addQuestion.length > 0 ? { addQuestion: o.addQuestion } : {},
|
|
3840
|
-
...Array.isArray(o.addTask) && o.addTask.length > 0 ? { addTask: o.addTask } : {},
|
|
3841
|
-
...typeof o.scope === "string" ? { scope: o.scope } : {},
|
|
3842
|
-
...typeof o.exclusions === "string" ? { exclusions: o.exclusions } : {},
|
|
3843
|
-
...Array.isArray(o.appliesTo) && o.appliesTo.length > 0 ? { appliesTo: o.appliesTo } : {},
|
|
3844
|
-
...typeof o.asOf === "string" ? { asOf: o.asOf } : {},
|
|
3845
|
-
...typeof o.validUntil === "string" ? { validUntil: o.validUntil } : {},
|
|
3846
|
-
...typeof o.artifactType === "string" ? { artifactType: o.artifactType } : {},
|
|
3847
|
-
...typeof o.temporalMode === "string" ? { temporalMode: o.temporalMode } : {},
|
|
3848
|
-
...typeof o.provenance === "string" ? { provenance: o.provenance } : {},
|
|
3849
|
-
...typeof o.methodology === "string" ? { methodology: o.methodology } : {},
|
|
3850
|
-
...Array.isArray(o.clear) && o.clear.length > 0 ? { clear: o.clear } : {}
|
|
3851
|
-
},
|
|
3852
|
-
ctx
|
|
3853
|
-
);
|
|
3854
|
-
});
|
|
3710
|
+
leaf2(INTEGRATION, "status-line", "the live footer, for Claude Code's status line").description(
|
|
3711
|
+
"Print one line naming what this session is looking up right now: the provider actually being called, its bounded parameters, and what it cost. It reads Claude Code's status event on stdin for the session identity, reads that session's own progress records, writes nothing, and prints `x402 \xB7 ready` when this session has no activity. `tenjin install` registers it; you never run it by hand."
|
|
3712
|
+
).action(async function() {
|
|
3713
|
+
const ctx = buildContext2(this);
|
|
3714
|
+
const { runStatusLine } = await import("./status-line-CGPUSDMC.js");
|
|
3715
|
+
await runStatusLine(io, { dataDir: ctx.dataDir });
|
|
3855
3716
|
});
|
|
3856
|
-
|
|
3857
|
-
"Report
|
|
3858
|
-
).
|
|
3859
|
-
"
|
|
3860
|
-
|
|
3861
|
-
|
|
3862
|
-
"--status <status>",
|
|
3863
|
-
"used | partially_used | rejected | regenerated | purchase_declined"
|
|
3864
|
-
).option("--resource <id>", "the resourceId the outcome concerns").option("--content-hash <hash>", "sha256:<64hex> of the exact body read").action(async function() {
|
|
3865
|
-
await runCommand("outcome", this, async (ctx) => {
|
|
3866
|
-
const o = this.opts();
|
|
3867
|
-
const { runOutcome } = await import("./outcome-ANV4QIED.js");
|
|
3868
|
-
return runOutcome(
|
|
3869
|
-
{
|
|
3870
|
-
status: String(o.status),
|
|
3871
|
-
...typeof o.searchId === "string" ? { searchId: o.searchId } : {},
|
|
3872
|
-
...o.last === true ? { last: true } : {},
|
|
3873
|
-
...typeof o.resource === "string" ? { resource: o.resource } : {},
|
|
3874
|
-
...typeof o.contentHash === "string" ? { contentHash: o.contentHash } : {}
|
|
3875
|
-
},
|
|
3876
|
-
ctx
|
|
3877
|
-
);
|
|
3717
|
+
leaf2(SETUP, "status", "what this machine has spent, and what is still open").description(
|
|
3718
|
+
"Report the rolling 24h spend window from spend.json: what has settled, what is reserved by a request still in flight, and the per-call and per-day caps in force."
|
|
3719
|
+
).action(async function() {
|
|
3720
|
+
await runCommand("status", this, async (ctx) => {
|
|
3721
|
+
const { runRouterStatus } = await import("./status-T2SDB57A.js");
|
|
3722
|
+
return runRouterStatus(ctx);
|
|
3878
3723
|
});
|
|
3879
3724
|
});
|
|
3880
|
-
addGlobalFlags(program2.command("mcp")).description("Run a local stdio MCP server exposing the Tenjin command cores to an MCP client").action(async function() {
|
|
3881
|
-
const ctx = buildContext(this, io);
|
|
3882
|
-
const { runMcpServer } = await import("./run-CJWPGMIQ.js");
|
|
3883
|
-
await runMcpServer({ dataDir: ctx.dataDir, flags: ctx.flags });
|
|
3884
|
-
});
|
|
3885
|
-
return program2;
|
|
3886
3725
|
}
|
|
3887
|
-
|
|
3888
|
-
|
|
3726
|
+
|
|
3727
|
+
// src/cli.ts
|
|
3728
|
+
var GlobalOptsSchema = external_exports.object({
|
|
3729
|
+
json: external_exports.boolean().default(false),
|
|
3730
|
+
baseUrl: external_exports.url().optional(),
|
|
3731
|
+
timeout: external_exports.coerce.number().int().positive().default(1e4)
|
|
3732
|
+
});
|
|
3733
|
+
var GLOBAL_FLAGS = [
|
|
3734
|
+
["--json", "emit one machine JSON envelope on stdout instead of the human rendering"],
|
|
3735
|
+
["--base-url <url>", "Tenjin API base URL"],
|
|
3736
|
+
["--timeout <ms>", "request timeout in milliseconds", "10000"]
|
|
3737
|
+
];
|
|
3738
|
+
function addGlobalFlags(cmd) {
|
|
3739
|
+
for (const [flags, help] of GLOBAL_FLAGS) cmd.addOption(new Option(flags, help).hideHelp());
|
|
3740
|
+
return cmd;
|
|
3741
|
+
}
|
|
3742
|
+
function leaf(program2, group, nameAndArgs, summary) {
|
|
3743
|
+
return addGlobalFlags(
|
|
3744
|
+
program2.command(nameAndArgs).helpGroup(group).summary(summary).helpCommand(false).helpOption("-h, --help", "show this help")
|
|
3745
|
+
);
|
|
3746
|
+
}
|
|
3747
|
+
function rootHelpCommand() {
|
|
3748
|
+
return new Command("help").argument("[command]", "the command to show help for").helpGroup(SETUP).summary("show help for a command").description("Show help for a command. `tenjin <command> --help` says the same thing.").helpOption(false);
|
|
3889
3749
|
}
|
|
3890
|
-
|
|
3750
|
+
function buildContext(cmd, io) {
|
|
3751
|
+
const parsed = GlobalOptsSchema.safeParse(cmd.optsWithGlobals());
|
|
3752
|
+
if (!parsed.success) {
|
|
3753
|
+
throw new CliError("USAGE", "Invalid global option", {
|
|
3754
|
+
fix: "Run `tenjin --help` for usage.",
|
|
3755
|
+
details: parsed.error.issues
|
|
3756
|
+
});
|
|
3757
|
+
}
|
|
3758
|
+
const flags = {
|
|
3759
|
+
json: parsed.data.json,
|
|
3760
|
+
timeout: parsed.data.timeout,
|
|
3761
|
+
baseUrl: parsed.data.baseUrl
|
|
3762
|
+
};
|
|
3763
|
+
return { flags, dataDir: dataDir(process.env), io };
|
|
3764
|
+
}
|
|
3765
|
+
var PRODUCTS = [registerCore, registerRouter];
|
|
3766
|
+
function buildProgram(io, setExit, products = PRODUCTS) {
|
|
3767
|
+
const program2 = new Command();
|
|
3768
|
+
const runCommand = async (command, cmd, run) => {
|
|
3769
|
+
const json = cmd.optsWithGlobals().json === true;
|
|
3770
|
+
const refreshRun = command === "install" && cmd.optsWithGlobals().refresh === true;
|
|
3771
|
+
const updateAvailable = command === "update" ? null : await readUpdateSignal(dataDir(process.env));
|
|
3772
|
+
try {
|
|
3773
|
+
const ctx = buildContext(cmd, io);
|
|
3774
|
+
const result = await run(ctx);
|
|
3775
|
+
emitSuccess(ctx.io, command, result.data, result.humanLines, {
|
|
3776
|
+
json: ctx.flags.json,
|
|
3777
|
+
updateAvailable
|
|
3778
|
+
});
|
|
3779
|
+
} catch (err) {
|
|
3780
|
+
setExit(emitFailure(io, command, err, { json, updateAvailable }).exitCode);
|
|
3781
|
+
}
|
|
3782
|
+
if (command !== "update" && !refreshRun) {
|
|
3783
|
+
await maybeUpdate({ dir: dataDir(process.env), io, json });
|
|
3784
|
+
}
|
|
3785
|
+
};
|
|
3786
|
+
program2.name("tenjin").description(
|
|
3787
|
+
"x402 router for coding agents: one paid decision per lookup, a local wallet that pays each provider per call in USDC on Base."
|
|
3788
|
+
).optionsGroup("Global options:").addHelpCommand(rootHelpCommand()).configureOutput({
|
|
3789
|
+
// --help / --version print here (stdout). Nothing else uses writeOut, so
|
|
3790
|
+
// stdout stays a single JSON object for every real command.
|
|
3791
|
+
writeOut: (str) => io.stdout.write(str),
|
|
3792
|
+
// Commander's usage/help text is human decoration: TTY only, never under
|
|
3793
|
+
// --json. This gates on the root's --json (the scope available when a parse
|
|
3794
|
+
// error fires before any subcommand runs); the machine contract for the same
|
|
3795
|
+
// failure goes to stdout via handleParseError, so the two never collide.
|
|
3796
|
+
writeErr: (str) => {
|
|
3797
|
+
if (io.isTTY && program2.opts().json !== true) io.stderr.write(str);
|
|
3798
|
+
}
|
|
3799
|
+
}).exitOverride();
|
|
3800
|
+
for (const [flags, help, fallback] of GLOBAL_FLAGS) {
|
|
3801
|
+
const option = new Option(flags, help);
|
|
3802
|
+
program2.addOption(fallback === void 0 ? option : option.default(fallback));
|
|
3803
|
+
}
|
|
3804
|
+
program2.version(package_default.version, "-V, --version", "output the version number").helpOption("-h, --help", "show this help");
|
|
3805
|
+
const registration = {
|
|
3806
|
+
program: program2,
|
|
3807
|
+
io,
|
|
3808
|
+
runCommand,
|
|
3809
|
+
leaf: (group, nameAndArgs, summary) => leaf(program2, group, nameAndArgs, summary),
|
|
3810
|
+
addGlobalFlags,
|
|
3811
|
+
buildContext: (cmd) => buildContext(cmd, io)
|
|
3812
|
+
};
|
|
3813
|
+
for (const register of products) register(registration);
|
|
3814
|
+
program2.addHelpText(
|
|
3815
|
+
"after",
|
|
3816
|
+
`
|
|
3817
|
+
Examples:
|
|
3818
|
+
$ tenjin install
|
|
3819
|
+
$ tenjin wallet fund
|
|
3820
|
+
$ tenjin status
|
|
3821
|
+
|
|
3822
|
+
Learn more:
|
|
3823
|
+
Run \`tenjin <command> --help\` for one command.
|
|
3824
|
+
Permissions: ${PERMISSIONS_DOC_URL}
|
|
3825
|
+
Issues: ${package_default.bugs}
|
|
3826
|
+
`
|
|
3827
|
+
);
|
|
3828
|
+
return program2;
|
|
3829
|
+
}
|
|
3830
|
+
async function main(argv, io = defaultIo(), products = PRODUCTS) {
|
|
3891
3831
|
let exitCode = 0;
|
|
3892
|
-
const program2 = buildProgram(
|
|
3893
|
-
|
|
3894
|
-
|
|
3832
|
+
const program2 = buildProgram(
|
|
3833
|
+
io,
|
|
3834
|
+
(code) => {
|
|
3835
|
+
exitCode = code;
|
|
3836
|
+
},
|
|
3837
|
+
products
|
|
3838
|
+
);
|
|
3895
3839
|
try {
|
|
3896
3840
|
await program2.parseAsync(argv, { from: "user" });
|
|
3897
3841
|
} catch (err) {
|
|
@@ -3906,6 +3850,7 @@ function handleParseError(err, io, program2) {
|
|
|
3906
3850
|
if (err.code === "commander.version" || err.code === "commander.helpDisplayed") {
|
|
3907
3851
|
return 0;
|
|
3908
3852
|
}
|
|
3853
|
+
if (err.code === "commander.help" && err.exitCode === 0) return 0;
|
|
3909
3854
|
if (!humanFirst) {
|
|
3910
3855
|
const message = err.code === "commander.help" ? "No command specified" : err.message.replace(/^error:\s*/i, "");
|
|
3911
3856
|
const usageErr = new CliError("USAGE", message, {
|
|
@@ -3918,7 +3863,8 @@ function handleParseError(err, io, program2) {
|
|
|
3918
3863
|
return emitFailure(io, "tenjin", err, { json }).exitCode;
|
|
3919
3864
|
}
|
|
3920
3865
|
export {
|
|
3866
|
+
PRODUCTS,
|
|
3921
3867
|
buildProgram,
|
|
3922
3868
|
main
|
|
3923
3869
|
};
|
|
3924
|
-
//# sourceMappingURL=cli-
|
|
3870
|
+
//# sourceMappingURL=cli-M3XCSOU6.js.map
|