tenjin-cli 0.1.0-alpha.1 → 0.1.0-alpha.10
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 +33 -0
- package/README.md +572 -79
- package/dist/{_esm-ZH2J4QEH.js → _esm-C5CRWCYU.js} +2 -2
- package/dist/_esm-N4KAVXQR.js +881 -0
- package/dist/buy-FMDBZ4NY.js +44 -0
- package/dist/candidate-7LAELUQD.js +23 -0
- package/dist/ccip-RPPPKTJR.js +19 -0
- package/dist/{ccip-UCLT5VOW.js → ccip-ZGGWQN4X.js} +6 -5
- package/dist/chunk-2GSRYTZS.js +127 -0
- package/dist/chunk-2GSRYTZS.js.map +1 -0
- package/dist/chunk-2I4QTOLB.js +11 -0
- package/dist/chunk-2I4QTOLB.js.map +1 -0
- package/dist/chunk-36X2CA3N.js +311 -0
- package/dist/chunk-36X2CA3N.js.map +1 -0
- package/dist/{chunk-BRJHUQSY.js → chunk-47PP7TAG.js} +908 -812
- package/dist/chunk-47PP7TAG.js.map +1 -0
- package/dist/chunk-5JMKIDMM.js +316 -0
- package/dist/chunk-5JMKIDMM.js.map +1 -0
- package/dist/chunk-5JXAZP7H.js +206 -0
- package/dist/chunk-5JXAZP7H.js.map +1 -0
- package/dist/chunk-5SE6BJRP.js +135 -0
- package/dist/chunk-5SE6BJRP.js.map +1 -0
- package/dist/chunk-6BZLSRNU.js +149 -0
- package/dist/chunk-6BZLSRNU.js.map +1 -0
- package/dist/{chunk-IPOWB3G3.js → chunk-7FK2UN2T.js} +3515 -507
- package/dist/chunk-7FK2UN2T.js.map +1 -0
- package/dist/chunk-7WDY4AXV.js +14620 -0
- package/dist/chunk-7WDY4AXV.js.map +1 -0
- package/dist/chunk-A6KCZPNQ.js +83 -0
- package/dist/chunk-A6KCZPNQ.js.map +1 -0
- package/dist/chunk-AWQ6A4CI.js +341 -0
- package/dist/chunk-AWQ6A4CI.js.map +1 -0
- package/dist/chunk-BJJ5BQO6.js +162 -0
- package/dist/chunk-BJJ5BQO6.js.map +1 -0
- package/dist/chunk-BUDHTDKL.js +612 -0
- package/dist/chunk-BUDHTDKL.js.map +1 -0
- package/dist/chunk-DKQMJTG7.js +188 -0
- package/dist/chunk-DKQMJTG7.js.map +1 -0
- package/dist/chunk-FKSAUOJU.js +137 -0
- package/dist/chunk-FKSAUOJU.js.map +1 -0
- package/dist/{chunk-EXBMF5X7.js → chunk-GECSWJ7O.js} +526 -79
- package/dist/chunk-GECSWJ7O.js.map +1 -0
- package/dist/chunk-GSDZRCGF.js +105 -0
- package/dist/chunk-GSDZRCGF.js.map +1 -0
- package/dist/chunk-JSSIMGQT.js +174 -0
- package/dist/chunk-JSSIMGQT.js.map +1 -0
- package/dist/chunk-KYH4KPE5.js +1357 -0
- package/dist/chunk-KYH4KPE5.js.map +1 -0
- package/dist/chunk-KYQVEKP5.js +209 -0
- package/dist/chunk-KYQVEKP5.js.map +1 -0
- package/dist/chunk-KZAAWQNP.js +6199 -0
- package/dist/chunk-KZAAWQNP.js.map +1 -0
- package/dist/{chunk-T4LKNY7T.js → chunk-M2O56UK7.js} +225 -70
- package/dist/chunk-M2O56UK7.js.map +1 -0
- package/dist/chunk-MD7WGYYI.js +125 -0
- package/dist/chunk-MD7WGYYI.js.map +1 -0
- package/dist/chunk-MJZZTKCC.js +323 -0
- package/dist/chunk-MJZZTKCC.js.map +1 -0
- package/dist/chunk-O6CAUZGY.js +317 -0
- package/dist/chunk-O6CAUZGY.js.map +1 -0
- package/dist/chunk-P74I3WH4.js +204 -0
- package/dist/chunk-P74I3WH4.js.map +1 -0
- package/dist/chunk-POF7HPRV.js +145 -0
- package/dist/chunk-POF7HPRV.js.map +1 -0
- package/dist/chunk-POJRB2AE.js +83 -0
- package/dist/chunk-POJRB2AE.js.map +1 -0
- package/dist/{chunk-YG2DO46P.js → chunk-PZRAAAY2.js} +107 -22
- package/dist/chunk-PZRAAAY2.js.map +1 -0
- package/dist/chunk-PZSUWDF2.js +35 -0
- package/dist/chunk-PZSUWDF2.js.map +1 -0
- package/dist/chunk-QW2Q2KAH.js +27 -0
- package/dist/chunk-QW2Q2KAH.js.map +1 -0
- package/dist/chunk-R2VLGNFD.js +181 -0
- package/dist/chunk-R2VLGNFD.js.map +1 -0
- package/dist/{chunk-CUWUHTIL.js → chunk-RBJPAZFI.js} +16 -202
- package/dist/chunk-RBJPAZFI.js.map +1 -0
- package/dist/chunk-S5RYMCV6.js +70 -0
- package/dist/chunk-S5RYMCV6.js.map +1 -0
- package/dist/chunk-SGK2B724.js +67 -0
- package/dist/chunk-SGK2B724.js.map +1 -0
- package/dist/chunk-STND72DS.js +242 -0
- package/dist/chunk-STND72DS.js.map +1 -0
- package/dist/chunk-TEL27PR5.js +124 -0
- package/dist/chunk-TEL27PR5.js.map +1 -0
- package/dist/chunk-TWRYSGAW.js +134 -0
- package/dist/chunk-TWRYSGAW.js.map +1 -0
- package/dist/{chunk-LPRVHM7P.js → chunk-U5S527PP.js} +1655 -114
- package/dist/chunk-U5S527PP.js.map +1 -0
- package/dist/chunk-UHTVXQ2O.js +140 -0
- package/dist/chunk-UHTVXQ2O.js.map +1 -0
- package/dist/chunk-UOJRKQTZ.js +213 -0
- package/dist/chunk-UOJRKQTZ.js.map +1 -0
- package/dist/chunk-V4WWTZHZ.js +233 -0
- package/dist/chunk-V4WWTZHZ.js.map +1 -0
- package/dist/chunk-VRRLTZ2Q.js +651 -0
- package/dist/chunk-VRRLTZ2Q.js.map +1 -0
- package/dist/{chunk-Q53IYV2G.js → chunk-W6R3HAAG.js} +20 -17
- package/dist/{chunk-Q53IYV2G.js.map → chunk-W6R3HAAG.js.map} +1 -1
- package/dist/chunk-X3OOVSPX.js +154 -0
- package/dist/chunk-X3OOVSPX.js.map +1 -0
- package/dist/chunk-XJN5WUKL.js +204 -0
- package/dist/chunk-XJN5WUKL.js.map +1 -0
- package/dist/{chunk-DXPYFVKG.js → chunk-Y7ERTA7D.js} +35 -15
- package/dist/chunk-Y7ERTA7D.js.map +1 -0
- package/dist/chunk-YLYINX2H.js +7806 -0
- package/dist/chunk-YLYINX2H.js.map +1 -0
- package/dist/chunk-ZQIQ55KK.js +51 -0
- package/dist/chunk-ZQIQ55KK.js.map +1 -0
- package/dist/chunk-ZUAQRIVP.js +1369 -0
- package/dist/chunk-ZUAQRIVP.js.map +1 -0
- package/dist/{chunk-3IMLRUZE.js → chunk-ZXTAQYNA.js} +6 -2
- package/dist/chunk-ZXTAQYNA.js.map +1 -0
- package/dist/{cli-WA65NP4Y.js → cli-HK2XAWNW.js} +440 -175
- package/dist/cli-HK2XAWNW.js.map +1 -0
- package/dist/config-LYCHHNAJ.js +26 -0
- package/dist/config-LYCHHNAJ.js.map +1 -0
- package/dist/dist-U4M6QCKE.js +2842 -0
- package/dist/dist-U4M6QCKE.js.map +1 -0
- package/dist/doctor-2KPUQURC.js +27 -0
- package/dist/doctor-2KPUQURC.js.map +1 -0
- package/dist/edit-TST3OCKQ.js +38 -0
- package/dist/edit-TST3OCKQ.js.map +1 -0
- package/dist/ethersCompat-Df4a6QIZ-WHYKB6HA.js +18 -0
- package/dist/ethersCompat-Df4a6QIZ-WHYKB6HA.js.map +1 -0
- package/dist/index.js +1 -1
- package/dist/inspect-TPTHVPBB.js +35 -0
- package/dist/inspect-TPTHVPBB.js.map +1 -0
- package/dist/install-PT3XEDJ6.js +1869 -0
- package/dist/install-PT3XEDJ6.js.map +1 -0
- package/dist/{mine.wasm-GQECMSGN.js → mine.wasm-6PIT3DK6.js} +2 -2
- package/dist/outcome-NPNSF2Q7.js +22 -0
- package/dist/outcome-NPNSF2Q7.js.map +1 -0
- package/dist/publish-XP5SEWST.js +41 -0
- package/dist/publish-XP5SEWST.js.map +1 -0
- package/dist/read-D4VXRWOG.js +158 -0
- package/dist/read-D4VXRWOG.js.map +1 -0
- package/dist/run-3IPGEXW7.js +16902 -0
- package/dist/run-3IPGEXW7.js.map +1 -0
- package/dist/search-YOBD6VDI.js +24 -0
- package/dist/search-YOBD6VDI.js.map +1 -0
- package/dist/{secp256k1-BEZS642W.js → secp256k1-XRPVBC6V.js} +5 -4
- package/dist/secp256k1-XRPVBC6V.js.map +1 -0
- package/dist/send-BWNP6WN4.js +223 -0
- package/dist/send-BWNP6WN4.js.map +1 -0
- package/dist/session-GZEZBOMI.js +88 -0
- package/dist/session-GZEZBOMI.js.map +1 -0
- package/dist/skill-heal-OK6YALW6.js +85 -0
- package/dist/skill-heal-OK6YALW6.js.map +1 -0
- package/dist/usdc-4VCDHFWX.js +38 -0
- package/dist/usdc-4VCDHFWX.js.map +1 -0
- package/dist/viemAdapter-By13KInL-TUQJBMHM.js +14 -0
- package/dist/viemAdapter-By13KInL-TUQJBMHM.js.map +1 -0
- package/dist/wallet-5RHDFPN2.js +32 -0
- package/dist/wallet-5RHDFPN2.js.map +1 -0
- package/dist/wallet-YEGQBWWL.js +42 -0
- package/dist/wallet-YEGQBWWL.js.map +1 -0
- package/docs/agent-permissions.md +281 -0
- package/package.json +25 -18
- package/skills/tenjin/SKILL.md +364 -0
- package/skills/tenjin-publish/SKILL.md +219 -0
- package/skills/tenjin-search/SKILL.md +335 -0
- package/dist/chunk-BRJHUQSY.js.map +0 -1
- package/dist/chunk-CUWUHTIL.js.map +0 -1
- package/dist/chunk-DXPYFVKG.js.map +0 -1
- package/dist/chunk-EXBMF5X7.js.map +0 -1
- package/dist/chunk-EZROUI5U.js +0 -135
- package/dist/chunk-EZROUI5U.js.map +0 -1
- package/dist/chunk-IPOWB3G3.js.map +0 -1
- package/dist/chunk-LPRVHM7P.js.map +0 -1
- package/dist/chunk-T4LKNY7T.js.map +0 -1
- package/dist/chunk-YBMMV4Y4.js +0 -51
- package/dist/chunk-YBMMV4Y4.js.map +0 -1
- package/dist/chunk-YG2DO46P.js.map +0 -1
- package/dist/chunk-ZPZFPVDN.js +0 -67
- package/dist/chunk-ZPZFPVDN.js.map +0 -1
- package/dist/cli-WA65NP4Y.js.map +0 -1
- package/dist/config-CEFTL5ZL.js +0 -164
- package/dist/config-CEFTL5ZL.js.map +0 -1
- package/dist/doctor-3QBYN46N.js +0 -338
- package/dist/doctor-3QBYN46N.js.map +0 -1
- package/dist/usdc-44R6XZF2.js +0 -18
- package/dist/wallet-ELBTBMXO.js +0 -20
- package/dist/wallet-XD576HF3.js +0 -173
- package/dist/wallet-XD576HF3.js.map +0 -1
- /package/dist/{_esm-ZH2J4QEH.js.map → _esm-C5CRWCYU.js.map} +0 -0
- /package/dist/{ccip-UCLT5VOW.js.map → _esm-N4KAVXQR.js.map} +0 -0
- /package/dist/{chunk-3IMLRUZE.js.map → buy-FMDBZ4NY.js.map} +0 -0
- /package/dist/{secp256k1-BEZS642W.js.map → candidate-7LAELUQD.js.map} +0 -0
- /package/dist/{usdc-44R6XZF2.js.map → ccip-RPPPKTJR.js.map} +0 -0
- /package/dist/{wallet-ELBTBMXO.js.map → ccip-ZGGWQN4X.js.map} +0 -0
- /package/dist/{mine.wasm-GQECMSGN.js.map → mine.wasm-6PIT3DK6.js.map} +0 -0
|
@@ -1,14 +1,30 @@
|
|
|
1
1
|
import { createRequire as __tenjinCreateRequire } from 'node:module'; const require = __tenjinCreateRequire(import.meta.url);
|
|
2
2
|
import {
|
|
3
|
-
|
|
3
|
+
PERMISSIONS_DOC_URL
|
|
4
|
+
} from "./chunk-TWRYSGAW.js";
|
|
5
|
+
import {
|
|
6
|
+
package_default
|
|
7
|
+
} from "./chunk-A6KCZPNQ.js";
|
|
8
|
+
import {
|
|
9
|
+
defaultIo,
|
|
10
|
+
emitFailure,
|
|
11
|
+
emitNotice,
|
|
12
|
+
emitSuccess
|
|
13
|
+
} from "./chunk-R2VLGNFD.js";
|
|
14
|
+
import {
|
|
4
15
|
dataDir,
|
|
5
|
-
|
|
6
|
-
} from "./chunk-
|
|
16
|
+
updateCheckPath
|
|
17
|
+
} from "./chunk-ZQIQ55KK.js";
|
|
18
|
+
import {
|
|
19
|
+
CliError,
|
|
20
|
+
external_exports,
|
|
21
|
+
writeFileAtomic
|
|
22
|
+
} from "./chunk-PZRAAAY2.js";
|
|
7
23
|
import {
|
|
8
24
|
__commonJS,
|
|
9
25
|
__require,
|
|
10
26
|
__toESM
|
|
11
|
-
} from "./chunk-
|
|
27
|
+
} from "./chunk-ZXTAQYNA.js";
|
|
12
28
|
|
|
13
29
|
// node_modules/.pnpm/commander@14.0.3/node_modules/commander/lib/error.js
|
|
14
30
|
var require_error = __commonJS({
|
|
@@ -3460,171 +3476,116 @@ var {
|
|
|
3460
3476
|
Help
|
|
3461
3477
|
} = import_index.default;
|
|
3462
3478
|
|
|
3463
|
-
//
|
|
3464
|
-
|
|
3465
|
-
|
|
3466
|
-
|
|
3467
|
-
|
|
3468
|
-
|
|
3469
|
-
|
|
3470
|
-
|
|
3471
|
-
|
|
3472
|
-
|
|
3473
|
-
},
|
|
3474
|
-
homepage: "https://tenjin.blog/agents",
|
|
3475
|
-
bugs: "https://github.com/BackTrackCo/tenjin-agent/issues",
|
|
3476
|
-
keywords: [
|
|
3477
|
-
"x402",
|
|
3478
|
-
"usdc",
|
|
3479
|
-
"base",
|
|
3480
|
-
"ai-agents",
|
|
3481
|
-
"agent-payments",
|
|
3482
|
-
"mcp",
|
|
3483
|
-
"knowledge-marketplace",
|
|
3484
|
-
"micropayments",
|
|
3485
|
-
"claude",
|
|
3486
|
-
"codex",
|
|
3487
|
-
"cli"
|
|
3488
|
-
],
|
|
3489
|
-
bin: {
|
|
3490
|
-
tenjin: "dist/index.js"
|
|
3491
|
-
},
|
|
3492
|
-
engines: {
|
|
3493
|
-
node: ">=22"
|
|
3494
|
-
},
|
|
3495
|
-
files: [
|
|
3496
|
-
"dist",
|
|
3497
|
-
"NOTICE.md"
|
|
3498
|
-
],
|
|
3499
|
-
packageManager: "pnpm@11.11.0",
|
|
3500
|
-
scripts: {
|
|
3501
|
-
build: "tsup",
|
|
3502
|
-
test: "vitest run",
|
|
3503
|
-
typecheck: "tsc --noEmit",
|
|
3504
|
-
lint: "eslint .",
|
|
3505
|
-
format: "prettier --write .",
|
|
3506
|
-
"format:check": "prettier --check .",
|
|
3507
|
-
check: "pnpm run build && pnpm run test",
|
|
3508
|
-
"sync:skill": "node scripts/sync-skill.mjs",
|
|
3509
|
-
"pack-smoke": "bash scripts/pack-smoke.sh",
|
|
3510
|
-
prepare: "git config core.hooksPath .githooks || true"
|
|
3511
|
-
},
|
|
3512
|
-
dependencies: {},
|
|
3513
|
-
devDependencies: {
|
|
3514
|
-
"@eslint/js": "^9",
|
|
3515
|
-
"@types/node": "^25",
|
|
3516
|
-
commander: "^14.0.1",
|
|
3517
|
-
eslint: "^9",
|
|
3518
|
-
"eslint-config-prettier": "^10",
|
|
3519
|
-
ox: "0.14.30",
|
|
3520
|
-
prettier: "^3",
|
|
3521
|
-
tsup: "^8.5.0",
|
|
3522
|
-
typescript: "^6",
|
|
3523
|
-
"typescript-eslint": "^8",
|
|
3524
|
-
viem: "^2.53.1",
|
|
3525
|
-
vitest: "^4.1.9",
|
|
3526
|
-
zod: "^4.4.3"
|
|
3527
|
-
}
|
|
3528
|
-
};
|
|
3529
|
-
|
|
3530
|
-
// src/lib/output.ts
|
|
3531
|
-
import { styleText } from "util";
|
|
3532
|
-
import { Stream } from "stream";
|
|
3533
|
-
|
|
3534
|
-
// src/schemas.ts
|
|
3535
|
-
var SCHEMA_VERSION = 1;
|
|
3536
|
-
var ErrorCodeSchema = external_exports.enum([
|
|
3537
|
-
"NODE_UNSUPPORTED",
|
|
3538
|
-
"USAGE",
|
|
3539
|
-
"CONFIG_INVALID",
|
|
3540
|
-
"WALLET_EXISTS",
|
|
3541
|
-
"WALLET_MISSING",
|
|
3542
|
-
"WALLET_INVALID_KEY",
|
|
3543
|
-
"PROVIDER_ERROR",
|
|
3544
|
-
"RPC_ERROR",
|
|
3545
|
-
"API_UNREACHABLE",
|
|
3546
|
-
"CONTRACT_MISMATCH",
|
|
3547
|
-
"REFUSED",
|
|
3548
|
-
"NETWORK_ERROR",
|
|
3549
|
-
"INTERNAL",
|
|
3550
|
-
"NOT_IMPLEMENTED"
|
|
3551
|
-
]);
|
|
3552
|
-
var MoneySchema = external_exports.object({
|
|
3553
|
-
atomic: external_exports.string(),
|
|
3554
|
-
usd: external_exports.string()
|
|
3555
|
-
});
|
|
3556
|
-
var OutputErrorSchema = external_exports.object({
|
|
3557
|
-
code: ErrorCodeSchema,
|
|
3558
|
-
message: external_exports.string(),
|
|
3559
|
-
fix: external_exports.string().optional(),
|
|
3560
|
-
details: external_exports.unknown().optional()
|
|
3479
|
+
// src/lib/update-check.ts
|
|
3480
|
+
import { readFile } from "fs/promises";
|
|
3481
|
+
var CHECK_INTERVAL_MS = 864e5;
|
|
3482
|
+
var FETCH_TIMEOUT_MS = 1500;
|
|
3483
|
+
var DIST_TAGS_URL = "https://registry.npmjs.org/-/package/tenjin-cli/dist-tags";
|
|
3484
|
+
var TagEntrySchema = external_exports.object({
|
|
3485
|
+
checkedAtMs: external_exports.number(),
|
|
3486
|
+
latest: external_exports.string(),
|
|
3487
|
+
/** When the nudge was last PRINTED for this tag. Absent until one has been. */
|
|
3488
|
+
notifiedAtMs: external_exports.number().optional()
|
|
3561
3489
|
});
|
|
3562
|
-
var
|
|
3563
|
-
schemaVersion: external_exports.literal(
|
|
3564
|
-
|
|
3565
|
-
ok: external_exports.literal(true),
|
|
3566
|
-
data: external_exports.unknown()
|
|
3490
|
+
var CacheSchema = external_exports.object({
|
|
3491
|
+
schemaVersion: external_exports.literal(1),
|
|
3492
|
+
tags: external_exports.record(external_exports.string(), TagEntrySchema)
|
|
3567
3493
|
});
|
|
3568
|
-
var
|
|
3569
|
-
|
|
3570
|
-
|
|
3571
|
-
|
|
3572
|
-
|
|
3573
|
-
|
|
3574
|
-
|
|
3575
|
-
|
|
3576
|
-
|
|
3577
|
-
|
|
3578
|
-
|
|
3579
|
-
|
|
3580
|
-
|
|
3581
|
-
|
|
3582
|
-
|
|
3583
|
-
|
|
3584
|
-
|
|
3585
|
-
|
|
3586
|
-
|
|
3587
|
-
|
|
3588
|
-
|
|
3589
|
-
|
|
3590
|
-
|
|
3494
|
+
var DistTagsSchema = external_exports.record(external_exports.string(), external_exports.string());
|
|
3495
|
+
async function maybeNudgeUpdate(deps) {
|
|
3496
|
+
try {
|
|
3497
|
+
const env = deps.env ?? process.env;
|
|
3498
|
+
if (!deps.io.isTTY || deps.json) return;
|
|
3499
|
+
if (env.CI !== void 0 && env.CI.length > 0) return;
|
|
3500
|
+
const nowMs = (deps.now ?? Date.now)();
|
|
3501
|
+
const current = deps.currentVersion ?? package_default.version;
|
|
3502
|
+
const path = updateCheckPath(deps.dir);
|
|
3503
|
+
const tag = parseVersion(current)?.alpha !== null ? "alpha" : "latest";
|
|
3504
|
+
const cached = await readCache(path);
|
|
3505
|
+
const entry = cached?.tags[tag];
|
|
3506
|
+
const fresh = entry !== void 0 && nowMs - entry.checkedAtMs < CHECK_INTERVAL_MS;
|
|
3507
|
+
const latest = fresh ? entry.latest : await fetchLatest(deps, tag);
|
|
3508
|
+
if (latest === null) return;
|
|
3509
|
+
const notifiedAtMs = entry?.notifiedAtMs;
|
|
3510
|
+
const due = isNewer(latest, current) && (notifiedAtMs === void 0 || nowMs - notifiedAtMs >= CHECK_INTERVAL_MS);
|
|
3511
|
+
const nudgedAtMs = due ? nowMs : notifiedAtMs;
|
|
3512
|
+
if (!fresh || due) {
|
|
3513
|
+
await writeCache(path, {
|
|
3514
|
+
schemaVersion: 1,
|
|
3515
|
+
// Read-modify-write: the tag this run did not ask about keeps whatever it
|
|
3516
|
+
// knew, including its own nudge clock.
|
|
3517
|
+
tags: {
|
|
3518
|
+
...cached?.tags,
|
|
3519
|
+
[tag]: {
|
|
3520
|
+
checkedAtMs: fresh ? entry.checkedAtMs : nowMs,
|
|
3521
|
+
latest,
|
|
3522
|
+
...nudgedAtMs !== void 0 ? { notifiedAtMs: nudgedAtMs } : {}
|
|
3523
|
+
}
|
|
3524
|
+
}
|
|
3525
|
+
});
|
|
3526
|
+
}
|
|
3527
|
+
if (!due) return;
|
|
3528
|
+
const target = parseVersion(latest)?.alpha === null ? "tenjin-cli" : "tenjin-cli@alpha";
|
|
3529
|
+
emitNotice(
|
|
3530
|
+
deps.io,
|
|
3531
|
+
`tenjin-cli ${latest} is available (you have ${current}). Update: npm i -g ${target}`,
|
|
3532
|
+
{ json: deps.json }
|
|
3533
|
+
);
|
|
3534
|
+
} catch {
|
|
3591
3535
|
}
|
|
3592
3536
|
}
|
|
3593
|
-
function
|
|
3594
|
-
const
|
|
3595
|
-
|
|
3596
|
-
|
|
3597
|
-
|
|
3598
|
-
|
|
3599
|
-
|
|
3600
|
-
}
|
|
3601
|
-
|
|
3602
|
-
if (shouldRenderHuman(io, opts)) {
|
|
3603
|
-
const lines = [paint(io, "red", `error: ${cliErr.message}`)];
|
|
3604
|
-
if (cliErr.fix !== void 0) lines.push(paint(io, "dim", `fix: ${cliErr.fix}`));
|
|
3605
|
-
writeLines(io.stderr, lines);
|
|
3537
|
+
async function fetchLatest(deps, tag) {
|
|
3538
|
+
const doFetch = deps.fetchImpl ?? fetch;
|
|
3539
|
+
let json;
|
|
3540
|
+
try {
|
|
3541
|
+
const res = await doFetch(DIST_TAGS_URL, { signal: AbortSignal.timeout(FETCH_TIMEOUT_MS) });
|
|
3542
|
+
if (!res.ok) return null;
|
|
3543
|
+
json = await res.json();
|
|
3544
|
+
} catch {
|
|
3545
|
+
return null;
|
|
3606
3546
|
}
|
|
3607
|
-
|
|
3547
|
+
const parsed = DistTagsSchema.safeParse(json);
|
|
3548
|
+
if (!parsed.success) return null;
|
|
3549
|
+
return parsed.data[tag] ?? null;
|
|
3608
3550
|
}
|
|
3609
|
-
function
|
|
3610
|
-
|
|
3611
|
-
|
|
3612
|
-
|
|
3613
|
-
|
|
3614
|
-
|
|
3615
|
-
return io.isTTY && opts.json !== true;
|
|
3551
|
+
async function writeCache(path, cache) {
|
|
3552
|
+
await writeFileAtomic(path, `${JSON.stringify(cache, null, 2)}
|
|
3553
|
+
`, {
|
|
3554
|
+
mode: 384,
|
|
3555
|
+
dirMode: 448
|
|
3556
|
+
});
|
|
3616
3557
|
}
|
|
3617
|
-
function
|
|
3618
|
-
|
|
3619
|
-
|
|
3558
|
+
async function readCache(path) {
|
|
3559
|
+
try {
|
|
3560
|
+
const parsed = CacheSchema.safeParse(JSON.parse(await readFile(path, "utf8")));
|
|
3561
|
+
return parsed.success ? parsed.data : null;
|
|
3562
|
+
} catch {
|
|
3563
|
+
return null;
|
|
3564
|
+
}
|
|
3620
3565
|
}
|
|
3621
|
-
|
|
3622
|
-
|
|
3623
|
-
|
|
3566
|
+
var VERSION_RE = /^(\d+)\.(\d+)\.(\d+)(?:-alpha\.(\d+))?$/;
|
|
3567
|
+
function parseVersion(raw) {
|
|
3568
|
+
const m = VERSION_RE.exec(raw);
|
|
3569
|
+
if (m === null) return null;
|
|
3570
|
+
const [, major, minor, patch, alpha] = m;
|
|
3571
|
+
if (major === void 0 || minor === void 0 || patch === void 0) return null;
|
|
3572
|
+
return {
|
|
3573
|
+
major: Number(major),
|
|
3574
|
+
minor: Number(minor),
|
|
3575
|
+
patch: Number(patch),
|
|
3576
|
+
alpha: alpha !== void 0 ? Number(alpha) : null
|
|
3577
|
+
};
|
|
3624
3578
|
}
|
|
3625
|
-
function
|
|
3626
|
-
|
|
3627
|
-
|
|
3579
|
+
function isNewer(candidate, current) {
|
|
3580
|
+
const a = parseVersion(candidate);
|
|
3581
|
+
const b = parseVersion(current);
|
|
3582
|
+
if (a === null || b === null) return false;
|
|
3583
|
+
if (a.major !== b.major) return a.major > b.major;
|
|
3584
|
+
if (a.minor !== b.minor) return a.minor > b.minor;
|
|
3585
|
+
if (a.patch !== b.patch) return a.patch > b.patch;
|
|
3586
|
+
if (a.alpha === null) return b.alpha !== null;
|
|
3587
|
+
if (b.alpha === null) return false;
|
|
3588
|
+
return a.alpha > b.alpha;
|
|
3628
3589
|
}
|
|
3629
3590
|
|
|
3630
3591
|
// src/cli.ts
|
|
@@ -3662,6 +3623,14 @@ function buildProgram(io, setExit) {
|
|
|
3662
3623
|
} catch (err) {
|
|
3663
3624
|
setExit(emitFailure(io, command, err, { json }).exitCode);
|
|
3664
3625
|
}
|
|
3626
|
+
await maybeNudgeUpdate({ dir: dataDir(process.env), io, json });
|
|
3627
|
+
if (command !== "install") {
|
|
3628
|
+
try {
|
|
3629
|
+
const { healWiredSkills } = await import("./skill-heal-OK6YALW6.js");
|
|
3630
|
+
await healWiredSkills({ io });
|
|
3631
|
+
} catch {
|
|
3632
|
+
}
|
|
3633
|
+
}
|
|
3665
3634
|
};
|
|
3666
3635
|
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({
|
|
3667
3636
|
// --help / --version print here (stdout). Nothing else uses writeOut, so
|
|
@@ -3675,9 +3644,54 @@ function buildProgram(io, setExit) {
|
|
|
3675
3644
|
if (io.isTTY && program2.opts().json !== true) io.stderr.write(str);
|
|
3676
3645
|
}
|
|
3677
3646
|
}).exitOverride();
|
|
3647
|
+
addGlobalFlags(program2.command("install")).description(
|
|
3648
|
+
"Detect installed harnesses (Claude Code, Codex), wire the Tenjin skills, then run the doctor checks last"
|
|
3649
|
+
).option(
|
|
3650
|
+
"--harness <name>",
|
|
3651
|
+
"target a specific harness: claude | codex | shared (repeatable; overrides detection)",
|
|
3652
|
+
collect,
|
|
3653
|
+
[]
|
|
3654
|
+
).option("--dry-run", "print what would change without writing anything").option(
|
|
3655
|
+
"--publish-mode <mode>",
|
|
3656
|
+
"set the publish consent mode non-interactively: review | auto | full-auto"
|
|
3657
|
+
).option("--no-wallet", "create no wallet (the default is to create one)").addOption(new Option("--claude-md", "compat no-op; the nudge is the default").hideHelp()).option("--no-claude-md", "write no CLAUDE.md nudge").addOption(
|
|
3658
|
+
new Option(
|
|
3659
|
+
"--allow-free-verbs",
|
|
3660
|
+
// The absolute URL, like every other pointer: `docs/agent-permissions.md`
|
|
3661
|
+
// resolves against the reader's cwd, and an operator running `--help` is in
|
|
3662
|
+
// their own project, not in this package.
|
|
3663
|
+
`compat no-op; the allowlist is the default, full caveats: ${PERMISSIONS_DOC_URL}`
|
|
3664
|
+
).hideHelp()
|
|
3665
|
+
).option(
|
|
3666
|
+
"--no-allow-free-verbs",
|
|
3667
|
+
`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}`
|
|
3668
|
+
).option(
|
|
3669
|
+
"--search-hooks <mode>",
|
|
3670
|
+
"harness search hooks: auto (check Tenjin before a WebSearch) | remind (static reminder) | off; persisted to hooks.searchMode"
|
|
3671
|
+
).option("--no-hooks", "register no harness hooks this run (writes no config)").action(async function() {
|
|
3672
|
+
await runCommand("install", this, async (ctx) => {
|
|
3673
|
+
const o = this.opts();
|
|
3674
|
+
const claudeMdGiven = this.getOptionValueSource("claudeMd") !== "default";
|
|
3675
|
+
const allowGiven = this.getOptionValueSource("allowFreeVerbs") !== "default";
|
|
3676
|
+
const { runInstall } = await import("./install-PT3XEDJ6.js");
|
|
3677
|
+
return runInstall(
|
|
3678
|
+
{
|
|
3679
|
+
...Array.isArray(o.harness) && o.harness.length > 0 ? { harness: o.harness } : {},
|
|
3680
|
+
...o.dryRun === true ? { dryRun: true } : {},
|
|
3681
|
+
...typeof o.publishMode === "string" ? { publishMode: o.publishMode } : {},
|
|
3682
|
+
...o.wallet === false ? { noWallet: true } : {},
|
|
3683
|
+
...claudeMdGiven && typeof o.claudeMd === "boolean" ? { claudeMd: o.claudeMd } : {},
|
|
3684
|
+
...allowGiven && typeof o.allowFreeVerbs === "boolean" ? { allowFreeVerbs: o.allowFreeVerbs } : {},
|
|
3685
|
+
...typeof o.searchHooks === "string" ? { searchHooks: o.searchHooks } : {},
|
|
3686
|
+
...o.hooks === false ? { noHooks: true } : {}
|
|
3687
|
+
},
|
|
3688
|
+
ctx
|
|
3689
|
+
);
|
|
3690
|
+
});
|
|
3691
|
+
});
|
|
3678
3692
|
addGlobalFlags(program2.command("doctor")).description("Check the local environment and Tenjin API reachability").action(async function() {
|
|
3679
3693
|
await runCommand("doctor", this, async (ctx) => {
|
|
3680
|
-
const { runDoctor } = await import("./doctor-
|
|
3694
|
+
const { runDoctor } = await import("./doctor-2KPUQURC.js");
|
|
3681
3695
|
return runDoctor(ctx);
|
|
3682
3696
|
});
|
|
3683
3697
|
});
|
|
@@ -3686,45 +3700,293 @@ function buildProgram(io, setExit) {
|
|
|
3686
3700
|
);
|
|
3687
3701
|
config.action(async function() {
|
|
3688
3702
|
await runCommand("config", this, async (ctx) => {
|
|
3689
|
-
const { runConfigList } = await import("./config-
|
|
3703
|
+
const { runConfigList } = await import("./config-LYCHHNAJ.js");
|
|
3690
3704
|
return runConfigList(ctx);
|
|
3691
3705
|
});
|
|
3692
3706
|
});
|
|
3693
3707
|
addGlobalFlags(config.command("get <key>")).description("Print one effective config value").action(async function(key) {
|
|
3694
3708
|
await runCommand("config.get", this, async (ctx) => {
|
|
3695
|
-
const { runConfigGet } = await import("./config-
|
|
3709
|
+
const { runConfigGet } = await import("./config-LYCHHNAJ.js");
|
|
3696
3710
|
return runConfigGet({ key }, ctx);
|
|
3697
3711
|
});
|
|
3698
3712
|
});
|
|
3699
3713
|
addGlobalFlags(config.command("set <key> <value>")).description("Set a config value (decimal USD accepted for spend keys)").action(async function(key, value) {
|
|
3700
3714
|
await runCommand("config.set", this, async (ctx) => {
|
|
3701
|
-
const { runConfigSet } = await import("./config-
|
|
3715
|
+
const { runConfigSet } = await import("./config-LYCHHNAJ.js");
|
|
3702
3716
|
return runConfigSet({ key, value }, ctx);
|
|
3703
3717
|
});
|
|
3704
3718
|
});
|
|
3705
3719
|
const wallet = addGlobalFlags(
|
|
3706
3720
|
program2.command("wallet").description("Manage the local x402 payment wallet")
|
|
3707
3721
|
);
|
|
3708
|
-
addGlobalFlags(wallet.command("create")).description("Create a new local wallet").
|
|
3722
|
+
addGlobalFlags(wallet.command("create")).description("Create a new local wallet (refuses if one exists; see --replace)").option(
|
|
3723
|
+
"--replace",
|
|
3724
|
+
"archive the existing wallet first \u2014 keystore parked beside the new one, passphrase verified and preserved under its address \u2014 then create a new active wallet"
|
|
3725
|
+
).action(async function() {
|
|
3709
3726
|
await runCommand("wallet.create", this, async (ctx) => {
|
|
3710
|
-
const
|
|
3711
|
-
|
|
3727
|
+
const o = this.opts();
|
|
3728
|
+
const { runWalletCreate } = await import("./wallet-5RHDFPN2.js");
|
|
3729
|
+
return runWalletCreate(ctx, o.replace === true ? { replace: true } : {});
|
|
3712
3730
|
});
|
|
3713
3731
|
});
|
|
3714
3732
|
addGlobalFlags(wallet.command("show")).description("Show the wallet address and key source (never the key)").action(async function() {
|
|
3715
3733
|
await runCommand("wallet.show", this, async (ctx) => {
|
|
3716
|
-
const { runWalletShow } = await import("./wallet-
|
|
3734
|
+
const { runWalletShow } = await import("./wallet-5RHDFPN2.js");
|
|
3717
3735
|
return runWalletShow(ctx);
|
|
3718
3736
|
});
|
|
3719
3737
|
});
|
|
3720
3738
|
addGlobalFlags(wallet.command("balance")).description("Show the wallet USDC balance on Base").action(async function() {
|
|
3721
3739
|
await runCommand("wallet.balance", this, async (ctx) => {
|
|
3722
|
-
const { runWalletBalance } = await import("./wallet-
|
|
3740
|
+
const { runWalletBalance } = await import("./wallet-5RHDFPN2.js");
|
|
3723
3741
|
return runWalletBalance(ctx);
|
|
3724
3742
|
});
|
|
3725
3743
|
});
|
|
3744
|
+
addGlobalFlags(program2.command("send <amount> <token> <to>")).description(
|
|
3745
|
+
"Move funds OUT of the agent wallet (escape hatch): preview the resolved recipient and amount, confirm explicitly, then transfer on Base and print the tx hash. USDC only"
|
|
3746
|
+
).option("--yes", "skip the interactive confirm (required to send when not at a TTY)").action(async function(amount, token, to) {
|
|
3747
|
+
await runCommand("send", this, async (ctx) => {
|
|
3748
|
+
const o = this.opts();
|
|
3749
|
+
const { runSend } = await import("./send-BWNP6WN4.js");
|
|
3750
|
+
return runSend({ amount, token, to, ...o.yes === true ? { yes: true } : {} }, ctx);
|
|
3751
|
+
});
|
|
3752
|
+
});
|
|
3753
|
+
addGlobalFlags(program2.command("search <question>")).description(
|
|
3754
|
+
"Ask for payable candidates or an honest MISS. Use when a task needs public knowledge someone may already have published; send only a generalized public question, never secrets or private context"
|
|
3755
|
+
).option("--max-price <usd>", "only candidates at or below this decimal-USD price").option("--fresh-within <window>", "freshness window, e.g. P30D, P2W, P1Y").option("--limit <n>", "maximum candidates (1-10, default 5)").option("--applies-to <pair>", "applicability filter key=value (repeatable)", collect, []).action(async function(question) {
|
|
3756
|
+
await runCommand("search", this, async (ctx) => {
|
|
3757
|
+
const o = this.opts();
|
|
3758
|
+
const { runSearch } = await import("./search-YOBD6VDI.js");
|
|
3759
|
+
return runSearch(
|
|
3760
|
+
{
|
|
3761
|
+
question,
|
|
3762
|
+
...typeof o.maxPrice === "string" ? { maxPrice: o.maxPrice } : {},
|
|
3763
|
+
...typeof o.freshWithin === "string" ? { freshWithin: o.freshWithin } : {},
|
|
3764
|
+
...typeof o.limit === "string" ? { limit: o.limit } : {},
|
|
3765
|
+
...Array.isArray(o.appliesTo) && o.appliesTo.length > 0 ? { appliesTo: o.appliesTo } : {}
|
|
3766
|
+
},
|
|
3767
|
+
ctx
|
|
3768
|
+
);
|
|
3769
|
+
});
|
|
3770
|
+
});
|
|
3771
|
+
addGlobalFlags(program2.command("inspect <resource>")).description(
|
|
3772
|
+
"Show a candidate's pre-purchase card / preview. Use after search, before buy, to check price, scope, and freshness; it never pays"
|
|
3773
|
+
).action(async function(resource) {
|
|
3774
|
+
await runCommand("inspect", this, async (ctx) => {
|
|
3775
|
+
const { runInspect } = await import("./inspect-TPTHVPBB.js");
|
|
3776
|
+
return runInspect({ ref: resource }, ctx);
|
|
3777
|
+
});
|
|
3778
|
+
});
|
|
3779
|
+
addGlobalFlags(program2.command("read <resource>")).description(
|
|
3780
|
+
"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"
|
|
3781
|
+
).option("--print-body", "include the full body in the machine output").option(
|
|
3782
|
+
"--sections <tokens>",
|
|
3783
|
+
"include leading sections within a token budget (deterministic, no model calls)"
|
|
3784
|
+
).action(async function(resource) {
|
|
3785
|
+
await runCommand("read", this, async (ctx) => {
|
|
3786
|
+
const o = this.opts();
|
|
3787
|
+
const { runRead } = await import("./read-D4VXRWOG.js");
|
|
3788
|
+
return runRead(
|
|
3789
|
+
{
|
|
3790
|
+
ref: resource,
|
|
3791
|
+
...o.printBody === true ? { printBody: true } : {},
|
|
3792
|
+
...typeof o.sections === "string" ? { sections: o.sections } : {}
|
|
3793
|
+
},
|
|
3794
|
+
ctx
|
|
3795
|
+
);
|
|
3796
|
+
});
|
|
3797
|
+
});
|
|
3798
|
+
const session = addGlobalFlags(
|
|
3799
|
+
program2.command("session").description(
|
|
3800
|
+
"Manage the delegated session key `tenjin read` presents to recover owned pieces"
|
|
3801
|
+
)
|
|
3802
|
+
);
|
|
3803
|
+
addGlobalFlags(session.command("start")).description(
|
|
3804
|
+
"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"
|
|
3805
|
+
).option("--scope <scope>", "session scope; this version mints `read` only (default: read)").action(async function() {
|
|
3806
|
+
await runCommand("session.start", this, async (ctx) => {
|
|
3807
|
+
const o = this.opts();
|
|
3808
|
+
const { runSessionStart } = await import("./session-GZEZBOMI.js");
|
|
3809
|
+
return runSessionStart(typeof o.scope === "string" ? { scope: o.scope } : {}, ctx);
|
|
3810
|
+
});
|
|
3811
|
+
});
|
|
3812
|
+
addGlobalFlags(program2.command("buy <resource>")).description(
|
|
3813
|
+
"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"
|
|
3814
|
+
).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(
|
|
3815
|
+
"--sections <tokens>",
|
|
3816
|
+
"include leading sections within a token budget (deterministic, no model calls)"
|
|
3817
|
+
).action(async function(resource) {
|
|
3818
|
+
await runCommand("buy", this, async (ctx) => {
|
|
3819
|
+
const o = this.opts();
|
|
3820
|
+
const { runBuy } = await import("./buy-FMDBZ4NY.js");
|
|
3821
|
+
return runBuy(
|
|
3822
|
+
{
|
|
3823
|
+
ref: resource,
|
|
3824
|
+
...typeof o.maxPrice === "string" ? { maxPrice: o.maxPrice } : {},
|
|
3825
|
+
...o.yes === true ? { yes: true } : {},
|
|
3826
|
+
...o.printBody === true ? { printBody: true } : {},
|
|
3827
|
+
...typeof o.sections === "string" ? { sections: o.sections } : {}
|
|
3828
|
+
},
|
|
3829
|
+
ctx
|
|
3830
|
+
);
|
|
3831
|
+
});
|
|
3832
|
+
});
|
|
3833
|
+
addGlobalFlags(program2.command("publish [file]")).description(
|
|
3834
|
+
"Publish a Markdown file (or a parked --candidate) as a paid or free piece with an optional answer card, gated by the local scan and your publish.mode consent. Use to ship knowledge others can buy; a secret in the file hard-blocks, and soft findings need --yes"
|
|
3835
|
+
).option(
|
|
3836
|
+
"--candidate <id>",
|
|
3837
|
+
"publish a parked candidate by id instead of a file (clears it on success)"
|
|
3838
|
+
).option("--draft", "save as a private draft instead of publishing").option("--yes", "clear soft findings and the review confirm (never a hard block)").option("--mode <mode>", "consent mode for this run: review | auto | full-auto").option("--price <usd>", "post price in decimal USD (defaults to publish.defaultPrice)").option("--question <text>", "a question this piece answers (repeatable)", collect, []).option("--task <text>", "a task this piece supports (repeatable)", collect, []).option("--scope <text>", "what the piece covers (card scope)").option("--exclusions <text>", "what the piece does not cover (card exclusions)").option("--applies-to <pair>", "applicability key=value (repeatable)", collect, []).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)").action(async function(file) {
|
|
3839
|
+
await runCommand("publish", this, async (ctx) => {
|
|
3840
|
+
const o = this.opts();
|
|
3841
|
+
const { runPublish } = await import("./publish-XP5SEWST.js");
|
|
3842
|
+
return runPublish(
|
|
3843
|
+
{
|
|
3844
|
+
...typeof file === "string" ? { file } : {},
|
|
3845
|
+
...typeof o.candidate === "string" ? { candidate: o.candidate } : {},
|
|
3846
|
+
...o.draft === true ? { draft: true } : {},
|
|
3847
|
+
...o.yes === true ? { yes: true } : {},
|
|
3848
|
+
...typeof o.mode === "string" ? { mode: o.mode } : {},
|
|
3849
|
+
...typeof o.price === "string" ? { price: o.price } : {},
|
|
3850
|
+
...Array.isArray(o.question) && o.question.length > 0 ? { question: o.question } : {},
|
|
3851
|
+
...Array.isArray(o.task) && o.task.length > 0 ? { task: o.task } : {},
|
|
3852
|
+
...typeof o.scope === "string" ? { scope: o.scope } : {},
|
|
3853
|
+
...typeof o.exclusions === "string" ? { exclusions: o.exclusions } : {},
|
|
3854
|
+
...Array.isArray(o.appliesTo) && o.appliesTo.length > 0 ? { appliesTo: o.appliesTo } : {},
|
|
3855
|
+
...typeof o.asOf === "string" ? { asOf: o.asOf } : {},
|
|
3856
|
+
...typeof o.validUntil === "string" ? { validUntil: o.validUntil } : {},
|
|
3857
|
+
...typeof o.artifactType === "string" ? { artifactType: o.artifactType } : {},
|
|
3858
|
+
...typeof o.temporalMode === "string" ? { temporalMode: o.temporalMode } : {},
|
|
3859
|
+
...typeof o.provenance === "string" ? { provenance: o.provenance } : {},
|
|
3860
|
+
...typeof o.methodology === "string" ? { methodology: o.methodology } : {}
|
|
3861
|
+
},
|
|
3862
|
+
ctx
|
|
3863
|
+
);
|
|
3864
|
+
});
|
|
3865
|
+
});
|
|
3866
|
+
addGlobalFlags(program2.command("edit <postId>")).description(
|
|
3867
|
+
"Show or update one of your own posts: with no change flags it prints the stored post and answer card, with them it merge-updates (omitted field = kept). Use to fix a price, sharpen a card, or ship a revised body; changes need --yes under your publish.mode consent. Reading is owner-scoped, so even the no-flag show signs with your wallet on first use, minting a read-scoped 24h session"
|
|
3868
|
+
).option("--yes", "apply the update without the confirmation stop").option("--mode <mode>", "consent mode for this run: review | auto | full-auto").option("--title <text>", "new post title").option("--price <usd>", "new post price in decimal USD").option("--body <file>", "replace the body with this Markdown file (frontmatter ignored)").option("--excerpt <text>", "new excerpt").option(
|
|
3869
|
+
"--question <text>",
|
|
3870
|
+
"replace the questions this piece answers (repeatable)",
|
|
3871
|
+
collect,
|
|
3872
|
+
[]
|
|
3873
|
+
).option("--task <text>", "replace the tasks this piece supports (repeatable)", collect, []).option(
|
|
3874
|
+
"--add-question <text>",
|
|
3875
|
+
"append one question, keeping the stored ones (repeatable)",
|
|
3876
|
+
collect,
|
|
3877
|
+
[]
|
|
3878
|
+
).option(
|
|
3879
|
+
"--add-task <text>",
|
|
3880
|
+
"append one task, keeping the stored ones (repeatable)",
|
|
3881
|
+
collect,
|
|
3882
|
+
[]
|
|
3883
|
+
).option("--scope <text>", "what the piece covers (card scope)").option("--exclusions <text>", "what the piece does not cover (card exclusions)").option(
|
|
3884
|
+
"--applies-to <pair>",
|
|
3885
|
+
"replace applicability with these key=value pairs (repeatable)",
|
|
3886
|
+
collect,
|
|
3887
|
+
[]
|
|
3888
|
+
).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(
|
|
3889
|
+
"--clear <field>",
|
|
3890
|
+
"clear a card field: scope, exclusions, asOf, validUntil, provenance, methodology, supersedesPostId, questionsAnswered, tasksSupported, appliesTo (repeatable)",
|
|
3891
|
+
collect,
|
|
3892
|
+
[]
|
|
3893
|
+
).action(async function(postId) {
|
|
3894
|
+
await runCommand("edit", this, async (ctx) => {
|
|
3895
|
+
const o = this.opts();
|
|
3896
|
+
const { runEdit } = await import("./edit-TST3OCKQ.js");
|
|
3897
|
+
return runEdit(
|
|
3898
|
+
{
|
|
3899
|
+
postId,
|
|
3900
|
+
...o.yes === true ? { yes: true } : {},
|
|
3901
|
+
...typeof o.mode === "string" ? { mode: o.mode } : {},
|
|
3902
|
+
...typeof o.title === "string" ? { title: o.title } : {},
|
|
3903
|
+
...typeof o.price === "string" ? { price: o.price } : {},
|
|
3904
|
+
...typeof o.body === "string" ? { body: o.body } : {},
|
|
3905
|
+
...typeof o.excerpt === "string" ? { excerpt: o.excerpt } : {},
|
|
3906
|
+
...Array.isArray(o.question) && o.question.length > 0 ? { question: o.question } : {},
|
|
3907
|
+
...Array.isArray(o.task) && o.task.length > 0 ? { task: o.task } : {},
|
|
3908
|
+
...Array.isArray(o.addQuestion) && o.addQuestion.length > 0 ? { addQuestion: o.addQuestion } : {},
|
|
3909
|
+
...Array.isArray(o.addTask) && o.addTask.length > 0 ? { addTask: o.addTask } : {},
|
|
3910
|
+
...typeof o.scope === "string" ? { scope: o.scope } : {},
|
|
3911
|
+
...typeof o.exclusions === "string" ? { exclusions: o.exclusions } : {},
|
|
3912
|
+
...Array.isArray(o.appliesTo) && o.appliesTo.length > 0 ? { appliesTo: o.appliesTo } : {},
|
|
3913
|
+
...typeof o.asOf === "string" ? { asOf: o.asOf } : {},
|
|
3914
|
+
...typeof o.validUntil === "string" ? { validUntil: o.validUntil } : {},
|
|
3915
|
+
...typeof o.artifactType === "string" ? { artifactType: o.artifactType } : {},
|
|
3916
|
+
...typeof o.temporalMode === "string" ? { temporalMode: o.temporalMode } : {},
|
|
3917
|
+
...typeof o.provenance === "string" ? { provenance: o.provenance } : {},
|
|
3918
|
+
...typeof o.methodology === "string" ? { methodology: o.methodology } : {},
|
|
3919
|
+
...Array.isArray(o.clear) && o.clear.length > 0 ? { clear: o.clear } : {}
|
|
3920
|
+
},
|
|
3921
|
+
ctx
|
|
3922
|
+
);
|
|
3923
|
+
});
|
|
3924
|
+
});
|
|
3925
|
+
addGlobalFlags(program2.command("outcome")).description(
|
|
3926
|
+
"Report how a search ended, honestly (used, partially_used, rejected, regenerated, purchase_declined). Use after acting on a search; this closes the loop the marketplace learns from"
|
|
3927
|
+
).option("--search-id <id>", "the search to report against").option(
|
|
3928
|
+
"--last",
|
|
3929
|
+
"target the most recent tenjin search (entries the WebSearch hook recorded are skipped; use --search-id for those)"
|
|
3930
|
+
).requiredOption(
|
|
3931
|
+
"--status <status>",
|
|
3932
|
+
"used | partially_used | rejected | regenerated | purchase_declined"
|
|
3933
|
+
).option("--resource <id>", "the resourceId the outcome concerns").option("--content-hash <hash>", "sha256:<64hex> of the exact body read").action(async function() {
|
|
3934
|
+
await runCommand("outcome", this, async (ctx) => {
|
|
3935
|
+
const o = this.opts();
|
|
3936
|
+
const { runOutcome } = await import("./outcome-NPNSF2Q7.js");
|
|
3937
|
+
return runOutcome(
|
|
3938
|
+
{
|
|
3939
|
+
status: String(o.status),
|
|
3940
|
+
...typeof o.searchId === "string" ? { searchId: o.searchId } : {},
|
|
3941
|
+
...o.last === true ? { last: true } : {},
|
|
3942
|
+
...typeof o.resource === "string" ? { resource: o.resource } : {},
|
|
3943
|
+
...typeof o.contentHash === "string" ? { contentHash: o.contentHash } : {}
|
|
3944
|
+
},
|
|
3945
|
+
ctx
|
|
3946
|
+
);
|
|
3947
|
+
});
|
|
3948
|
+
});
|
|
3949
|
+
const candidate = addGlobalFlags(
|
|
3950
|
+
program2.command("candidate").description(
|
|
3951
|
+
"Manage local publish candidates (parked drafts; nothing uploads until publish)"
|
|
3952
|
+
)
|
|
3953
|
+
);
|
|
3954
|
+
addGlobalFlags(candidate.command("add <file>")).description("Park a Markdown draft as a publish candidate, tied to a search").requiredOption("--search-id <id>", "the search whose unmet demand this draft answers").option("--question <q>", "the question this draft answers").action(async function(file) {
|
|
3955
|
+
await runCommand("candidate.add", this, async (ctx) => {
|
|
3956
|
+
const o = this.opts();
|
|
3957
|
+
const { runCandidateAdd } = await import("./candidate-7LAELUQD.js");
|
|
3958
|
+
return runCandidateAdd(
|
|
3959
|
+
{
|
|
3960
|
+
file,
|
|
3961
|
+
searchId: String(o.searchId),
|
|
3962
|
+
...typeof o.question === "string" ? { question: o.question } : {}
|
|
3963
|
+
},
|
|
3964
|
+
ctx
|
|
3965
|
+
);
|
|
3966
|
+
});
|
|
3967
|
+
});
|
|
3968
|
+
addGlobalFlags(candidate.command("list")).description("List pending candidates, newest first").action(async function() {
|
|
3969
|
+
await runCommand("candidate.list", this, async (ctx) => {
|
|
3970
|
+
const { runCandidateList } = await import("./candidate-7LAELUQD.js");
|
|
3971
|
+
return runCandidateList(ctx);
|
|
3972
|
+
});
|
|
3973
|
+
});
|
|
3974
|
+
addGlobalFlags(candidate.command("drop <id>")).description("Discard a pending candidate (never auto-deleted)").action(async function(id) {
|
|
3975
|
+
await runCommand("candidate.drop", this, async (ctx) => {
|
|
3976
|
+
const { runCandidateDrop } = await import("./candidate-7LAELUQD.js");
|
|
3977
|
+
return runCandidateDrop({ id }, ctx);
|
|
3978
|
+
});
|
|
3979
|
+
});
|
|
3980
|
+
addGlobalFlags(program2.command("mcp")).description("Run a local stdio MCP server exposing the Tenjin command cores to an MCP client").action(async function() {
|
|
3981
|
+
const ctx = buildContext(this, io);
|
|
3982
|
+
const { runMcpServer } = await import("./run-3IPGEXW7.js");
|
|
3983
|
+
await runMcpServer({ dataDir: ctx.dataDir, flags: ctx.flags });
|
|
3984
|
+
});
|
|
3726
3985
|
return program2;
|
|
3727
3986
|
}
|
|
3987
|
+
function collect(value, previous) {
|
|
3988
|
+
return [...previous, value];
|
|
3989
|
+
}
|
|
3728
3990
|
async function main(argv, io = defaultIo()) {
|
|
3729
3991
|
let exitCode = 0;
|
|
3730
3992
|
const program2 = buildProgram(io, (code) => {
|
|
@@ -3739,15 +4001,18 @@ async function main(argv, io = defaultIo()) {
|
|
|
3739
4001
|
}
|
|
3740
4002
|
function handleParseError(err, io, program2) {
|
|
3741
4003
|
const json = program2.opts().json === true;
|
|
4004
|
+
const humanFirst = io.isTTY && !json;
|
|
3742
4005
|
if (err instanceof CommanderError) {
|
|
3743
4006
|
if (err.code === "commander.version" || err.code === "commander.helpDisplayed") {
|
|
3744
4007
|
return 0;
|
|
3745
4008
|
}
|
|
3746
|
-
|
|
3747
|
-
|
|
3748
|
-
|
|
3749
|
-
|
|
3750
|
-
|
|
4009
|
+
if (!humanFirst) {
|
|
4010
|
+
const message = err.code === "commander.help" ? "No command specified" : err.message.replace(/^error:\s*/i, "");
|
|
4011
|
+
const usageErr = new CliError("USAGE", message, {
|
|
4012
|
+
fix: "Run `tenjin --help` for available commands."
|
|
4013
|
+
});
|
|
4014
|
+
emitFailure(io, "tenjin", usageErr, { json: true });
|
|
4015
|
+
}
|
|
3751
4016
|
return 2;
|
|
3752
4017
|
}
|
|
3753
4018
|
return emitFailure(io, "tenjin", err, { json }).exitCode;
|
|
@@ -3756,4 +4021,4 @@ export {
|
|
|
3756
4021
|
buildProgram,
|
|
3757
4022
|
main
|
|
3758
4023
|
};
|
|
3759
|
-
//# sourceMappingURL=cli-
|
|
4024
|
+
//# sourceMappingURL=cli-HK2XAWNW.js.map
|