tenjin-cli 0.1.0-alpha.15 → 0.1.0-alpha.17
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 +43 -310
- 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-2BKS2FVE.js +93 -0
- package/dist/chunk-2BKS2FVE.js.map +1 -0
- package/dist/chunk-2G2WLVHB.js +102 -0
- package/dist/chunk-2G2WLVHB.js.map +1 -0
- package/dist/chunk-2I4QTOLB.js +11 -0
- package/dist/chunk-2I4QTOLB.js.map +1 -0
- package/dist/chunk-2JGT3KDW.js +172 -0
- package/dist/chunk-2JGT3KDW.js.map +1 -0
- package/dist/chunk-2QYORQBF.js +55 -0
- package/dist/chunk-2QYORQBF.js.map +1 -0
- package/dist/chunk-35M3VITA.js +102 -0
- package/dist/chunk-35M3VITA.js.map +1 -0
- package/dist/{chunk-KINZ23CV.js → chunk-3AUDA53C.js} +4740 -23
- 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-5QHHRMRA.js +227 -0
- package/dist/chunk-5QHHRMRA.js.map +1 -0
- package/dist/{chunk-JBIKAAT3.js → chunk-5UDD5VSY.js} +8 -8
- package/dist/chunk-5UDD5VSY.js.map +1 -0
- package/dist/chunk-7QKHZQKW.js +1680 -0
- package/dist/chunk-7QKHZQKW.js.map +1 -0
- package/dist/{chunk-ZFJJ3EXC.js → chunk-AR7U7BRG.js} +550 -182
- package/dist/chunk-AR7U7BRG.js.map +1 -0
- package/dist/chunk-AUKDYPPX.js +130 -0
- package/dist/chunk-AUKDYPPX.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-KYQVEKP5.js → chunk-BPMWXTFX.js} +8 -8
- package/dist/{chunk-47PP7TAG.js → chunk-EGELTSPU.js} +1356 -1356
- package/dist/chunk-EGELTSPU.js.map +1 -0
- package/dist/{chunk-S5RYMCV6.js → chunk-HPWO4O6S.js} +3 -3
- package/dist/chunk-J5INH7WB.js +299 -0
- package/dist/chunk-J5INH7WB.js.map +1 -0
- package/dist/chunk-JLEF5WHM.js +132 -0
- package/dist/chunk-JLEF5WHM.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-KK4YGYTV.js +808 -0
- package/dist/chunk-KK4YGYTV.js.map +1 -0
- package/dist/{chunk-CPCX67TI.js → chunk-KUBEYXSO.js} +1076 -1038
- package/dist/chunk-KUBEYXSO.js.map +1 -0
- package/dist/{chunk-QW2Q2KAH.js → chunk-LHHMV4GU.js} +2 -2
- package/dist/{chunk-NIKXHWOL.js → chunk-LJ4DMVFI.js} +16 -16
- package/dist/chunk-LJ4DMVFI.js.map +1 -0
- package/dist/{chunk-ZOBNS7CX.js → chunk-MEFB5KHA.js} +4 -18
- package/dist/chunk-MEFB5KHA.js.map +1 -0
- package/dist/{chunk-HPJGOLTN.js → chunk-MRGADYDD.js} +13 -8
- package/dist/chunk-MRGADYDD.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-O4ZNKFRU.js +366 -0
- package/dist/chunk-O4ZNKFRU.js.map +1 -0
- package/dist/chunk-PDA2BVFY.js +244 -0
- package/dist/chunk-PDA2BVFY.js.map +1 -0
- package/dist/{chunk-POJRB2AE.js → chunk-POUWHWID.js} +2 -2
- package/dist/chunk-QDD2RN7G.js +10238 -0
- package/dist/chunk-QDD2RN7G.js.map +1 -0
- package/dist/chunk-S2NRVRPF.js +171 -0
- package/dist/chunk-S2NRVRPF.js.map +1 -0
- package/dist/chunk-TGLKKLQG.js +11 -0
- package/dist/chunk-TGLKKLQG.js.map +1 -0
- package/dist/chunk-TP4D47BY.js +127 -0
- package/dist/chunk-TP4D47BY.js.map +1 -0
- package/dist/{chunk-KZAAWQNP.js → chunk-TTNESUPQ.js} +3 -3
- package/dist/{chunk-UO22YNY4.js → chunk-U2DZISAH.js} +43 -1
- package/dist/chunk-U2DZISAH.js.map +1 -0
- package/dist/chunk-WGQVJM56.js +165 -0
- package/dist/chunk-WGQVJM56.js.map +1 -0
- package/dist/{chunk-OLWTRUTS.js → chunk-WLMJE3GJ.js} +35 -16
- package/dist/chunk-WLMJE3GJ.js.map +1 -0
- package/dist/chunk-WS4JA6TC.js +137 -0
- package/dist/chunk-WS4JA6TC.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-XZOEUYMX.js +1784 -0
- package/dist/chunk-XZOEUYMX.js.map +1 -0
- package/dist/{cli-KKRKBU5T.js → cli-VHYYYYXM.js} +303 -374
- package/dist/cli-VHYYYYXM.js.map +1 -0
- package/dist/config-5ADBAAXU.js +42 -0
- package/dist/{dist-U4M6QCKE.js → dist-3LOO6M4U.js} +10 -10
- package/dist/doctor-Q35VQW3S.js +436 -0
- package/dist/doctor-Q35VQW3S.js.map +1 -0
- package/dist/{ethersCompat-Df4a6QIZ-WHYKB6HA.js → ethersCompat-Df4a6QIZ-THAVUGIJ.js} +5 -5
- package/dist/{chunk-KAJZHIQ4.js → fund-GDDPL2BB.js} +81 -24
- package/dist/fund-GDDPL2BB.js.map +1 -0
- package/dist/hook-command-PBERPRE3.js +763 -0
- package/dist/hook-command-PBERPRE3.js.map +1 -0
- package/dist/index.js +8 -3
- package/dist/index.js.map +1 -1
- package/dist/install-OKDKGUXM.js +60 -0
- package/dist/install-wallet-SI4LZ73K.js +106 -0
- package/dist/install-wallet-SI4LZ73K.js.map +1 -0
- package/dist/{run-XYTQ5TWQ.js → mcp-XX3WRQEZ.js} +3766 -10677
- package/dist/mcp-XX3WRQEZ.js.map +1 -0
- package/dist/paths-P2N4JTDZ.js +49 -0
- package/dist/pay-3SYKHKWJ.js +39 -0
- package/dist/redact-6W23GGJC.js +15 -0
- package/dist/{secp256k1-XRPVBC6V.js → secp256k1-ZZZT2CAX.js} +3 -3
- package/dist/{send-G746D7PQ.js → send-LQRKTEJT.js} +29 -29
- package/dist/send-LQRKTEJT.js.map +1 -0
- package/dist/{chunk-QZ6ROAJU.js → skill-placement-JMDPSKE6.js} +155 -10
- package/dist/skill-placement-JMDPSKE6.js.map +1 -0
- package/dist/status-FFC6FO72.js +64 -0
- package/dist/status-FFC6FO72.js.map +1 -0
- package/dist/status-line-SAXSU6CR.js +87 -0
- package/dist/status-line-SAXSU6CR.js.map +1 -0
- package/dist/status-line-wiring-L2WYIYBM.js +29 -0
- package/dist/tenjin-daemon.mjs +20421 -0
- package/dist/tenjin-shim.mjs +251 -0
- package/dist/tenjin-vitest-reporter.mjs +49 -0
- package/dist/uninstall-OACH27UV.js +147 -0
- package/dist/uninstall-OACH27UV.js.map +1 -0
- package/dist/{update-R76LHOZW.js → update-4W6EKLGZ.js} +132 -16
- package/dist/update-4W6EKLGZ.js.map +1 -0
- package/dist/{viemAdapter-By13KInL-TUQJBMHM.js → viemAdapter-By13KInL-X2VY6CY3.js} +5 -5
- package/dist/wallet-BMEXRR3P.js +32 -0
- package/dist/wallet-kdf-worker.mjs +980 -0
- package/docs/agent-permissions.md +71 -352
- package/docs/safety-model.md +16 -6
- package/package.json +8 -7
- package/LICENSE +0 -21
- package/dist/buy-VIRNSYGN.js +0 -47
- package/dist/chunk-2MYQN7HM.js +0 -247
- package/dist/chunk-2MYQN7HM.js.map +0 -1
- package/dist/chunk-2RF2GIJQ.js +0 -1188
- package/dist/chunk-2RF2GIJQ.js.map +0 -1
- package/dist/chunk-3GL2Z5QK.js +0 -57
- package/dist/chunk-3GL2Z5QK.js.map +0 -1
- package/dist/chunk-47PP7TAG.js.map +0 -1
- package/dist/chunk-4CQIDQOT.js +0 -167
- package/dist/chunk-4CQIDQOT.js.map +0 -1
- package/dist/chunk-4KG27W2S.js +0 -614
- package/dist/chunk-4KG27W2S.js.map +0 -1
- package/dist/chunk-5QQTYWEU.js +0 -199
- package/dist/chunk-5QQTYWEU.js.map +0 -1
- package/dist/chunk-65DTCCJ7.js +0 -21
- package/dist/chunk-65DTCCJ7.js.map +0 -1
- package/dist/chunk-A5DKHMUN.js +0 -173
- package/dist/chunk-A5DKHMUN.js.map +0 -1
- package/dist/chunk-B63XPWQ4.js +0 -246
- package/dist/chunk-B63XPWQ4.js.map +0 -1
- package/dist/chunk-CAR6FHK6.js +0 -105
- package/dist/chunk-CAR6FHK6.js.map +0 -1
- package/dist/chunk-CPCX67TI.js.map +0 -1
- package/dist/chunk-CQBVCYI2.js +0 -162
- package/dist/chunk-CQBVCYI2.js.map +0 -1
- package/dist/chunk-DBU5CXBV.js +0 -4731
- package/dist/chunk-DBU5CXBV.js.map +0 -1
- package/dist/chunk-DHJD77OW.js +0 -81
- package/dist/chunk-DHJD77OW.js.map +0 -1
- package/dist/chunk-EDZSNPE5.js +0 -35
- package/dist/chunk-EDZSNPE5.js.map +0 -1
- package/dist/chunk-EFWZPUTC.js +0 -65
- package/dist/chunk-EFWZPUTC.js.map +0 -1
- package/dist/chunk-EPFL6CTE.js +0 -448
- package/dist/chunk-EPFL6CTE.js.map +0 -1
- package/dist/chunk-GHLVXVZD.js +0 -142
- package/dist/chunk-GHLVXVZD.js.map +0 -1
- package/dist/chunk-H3SOOJ2I.js +0 -580
- package/dist/chunk-H3SOOJ2I.js.map +0 -1
- package/dist/chunk-HPJGOLTN.js.map +0 -1
- package/dist/chunk-HRGBS2PA.js +0 -203
- package/dist/chunk-HRGBS2PA.js.map +0 -1
- package/dist/chunk-ITUXPJIS.js +0 -314
- package/dist/chunk-ITUXPJIS.js.map +0 -1
- package/dist/chunk-JBIKAAT3.js.map +0 -1
- package/dist/chunk-KAJZHIQ4.js.map +0 -1
- package/dist/chunk-KINZ23CV.js.map +0 -1
- package/dist/chunk-LRYV3SK7.js +0 -235
- package/dist/chunk-LRYV3SK7.js.map +0 -1
- package/dist/chunk-M2O56UK7.js.map +0 -1
- package/dist/chunk-MJZZTKCC.js.map +0 -1
- package/dist/chunk-NIKXHWOL.js.map +0 -1
- package/dist/chunk-OKDRDT74.js +0 -209
- package/dist/chunk-OKDRDT74.js.map +0 -1
- package/dist/chunk-OKYSNAS3.js +0 -2144
- package/dist/chunk-OKYSNAS3.js.map +0 -1
- package/dist/chunk-OLWTRUTS.js.map +0 -1
- package/dist/chunk-QQ6ELLSA.js +0 -143
- package/dist/chunk-QQ6ELLSA.js.map +0 -1
- package/dist/chunk-QZ6ROAJU.js.map +0 -1
- package/dist/chunk-R7RSCBI7.js +0 -794
- package/dist/chunk-R7RSCBI7.js.map +0 -1
- package/dist/chunk-SGK2B724.js +0 -67
- package/dist/chunk-SGK2B724.js.map +0 -1
- package/dist/chunk-U6VPKMGC.js +0 -390
- package/dist/chunk-U6VPKMGC.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-US456VUI.js +0 -149
- package/dist/chunk-US456VUI.js.map +0 -1
- package/dist/chunk-V44J2MXV.js +0 -400
- package/dist/chunk-V44J2MXV.js.map +0 -1
- package/dist/chunk-VJQKL3YH.js +0 -216
- package/dist/chunk-VJQKL3YH.js.map +0 -1
- package/dist/chunk-VJSQSLBM.js +0 -1442
- package/dist/chunk-VJSQSLBM.js.map +0 -1
- package/dist/chunk-VYOJOX4Z.js +0 -165
- package/dist/chunk-VYOJOX4Z.js.map +0 -1
- package/dist/chunk-WY2K35OL.js +0 -269
- package/dist/chunk-WY2K35OL.js.map +0 -1
- package/dist/chunk-ZFJJ3EXC.js.map +0 -1
- package/dist/chunk-ZOBNS7CX.js.map +0 -1
- package/dist/cli-KKRKBU5T.js.map +0 -1
- package/dist/config-JMRUNYE6.js +0 -37
- package/dist/discover-B5HF6SHM.js +0 -102
- package/dist/discover-B5HF6SHM.js.map +0 -1
- package/dist/doctor-ZBG7X66D.js +0 -32
- package/dist/edit-PZJIILQE.js +0 -40
- package/dist/fund-EUDH5KPA.js +0 -40
- package/dist/inspect-QC6WEQPN.js +0 -37
- package/dist/install-GNK2W3PI.js +0 -972
- package/dist/install-GNK2W3PI.js.map +0 -1
- package/dist/outcome-KSGWZHUS.js +0 -24
- package/dist/pay-BC4UICPA.js +0 -361
- package/dist/pay-BC4UICPA.js.map +0 -1
- package/dist/publish-LXWFDIKF.js +0 -42
- package/dist/read-JMNUQ56P.js +0 -160
- package/dist/read-JMNUQ56P.js.map +0 -1
- package/dist/run-XYTQ5TWQ.js.map +0 -1
- package/dist/search-TSQAB45E.js +0 -25
- package/dist/secp256k1-XRPVBC6V.js.map +0 -1
- package/dist/send-G746D7PQ.js.map +0 -1
- package/dist/session-JBKWMJ24.js +0 -89
- package/dist/session-JBKWMJ24.js.map +0 -1
- package/dist/skill-heal-WKD67SLJ.js +0 -92
- package/dist/skill-heal-WKD67SLJ.js.map +0 -1
- package/dist/skill-placement-RIU4AMC2.js +0 -20
- package/dist/skill-placement-RIU4AMC2.js.map +0 -1
- package/dist/uninstall-5E263VTS.js +0 -73
- package/dist/uninstall-5E263VTS.js.map +0 -1
- package/dist/update-R76LHOZW.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-TQ7D5EQ7.js +0 -41
- package/dist/wallet-TQ7D5EQ7.js.map +0 -1
- package/dist/wallet-ZAVXWLWP.js +0 -32
- package/dist/wallet-ZAVXWLWP.js.map +0 -1
- package/docs/command-reference.md +0 -303
- package/skills/tenjin/SKILL.md +0 -373
- package/skills/tenjin-pay/SKILL.md +0 -76
- package/skills/tenjin-publish/SKILL.md +0 -227
- package/skills/tenjin-publish/references/maintain.md +0 -39
- package/skills/tenjin-search/SKILL.md +0 -154
- package/skills/tenjin-search/references/permissions.md +0 -112
- /package/dist/{_esm-N4KAVXQR.js.map → _esm-CE7KNONL.js.map} +0 -0
- /package/dist/{buy-VIRNSYGN.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-5ADBAAXU.js.map} +0 -0
- /package/dist/{dist-U4M6QCKE.js.map → dist-3LOO6M4U.js.map} +0 -0
- /package/dist/{config-JMRUNYE6.js.map → ethersCompat-Df4a6QIZ-THAVUGIJ.js.map} +0 -0
- /package/dist/{doctor-ZBG7X66D.js.map → install-OKDKGUXM.js.map} +0 -0
- /package/dist/{edit-PZJIILQE.js.map → paths-P2N4JTDZ.js.map} +0 -0
- /package/dist/{ethersCompat-Df4a6QIZ-WHYKB6HA.js.map → pay-3SYKHKWJ.js.map} +0 -0
- /package/dist/{fund-EUDH5KPA.js.map → redact-6W23GGJC.js.map} +0 -0
- /package/dist/{inspect-QC6WEQPN.js.map → secp256k1-ZZZT2CAX.js.map} +0 -0
- /package/dist/{outcome-KSGWZHUS.js.map → status-line-wiring-L2WYIYBM.js.map} +0 -0
- /package/dist/{publish-LXWFDIKF.js.map → viemAdapter-By13KInL-X2VY6CY3.js.map} +0 -0
- /package/dist/{search-TSQAB45E.js.map → wallet-BMEXRR3P.js.map} +0 -0
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/commands/install.ts"],"sourcesContent":["import { existsSync } from 'node:fs';\nimport { readFile } from 'node:fs/promises';\nimport { fileURLToPath } from 'node:url';\nimport { dirname, isAbsolute, join } from 'node:path';\nimport { homedir } from 'node:os';\nimport { z } from 'zod';\nimport { styleText } from 'node:util';\nimport { Stream } from 'node:stream';\nimport { CliError } from '../lib/errors';\nimport { hasCode } from '../lib/errno';\nimport { ownsAnyLock, releaseOwnedLocks } from '../lib/lock';\nimport { installSkill } from '../lib/skill-writer';\nimport { PRODUCTION_HOST } from '../lib/production-origin';\nimport type { SkillInstallStatus } from '../lib/skill-writer';\nimport { resolveSkillsSource, OPTIONAL_PAY_SKILL, SKILL_NAMES } from '../lib/skills-source';\nimport { placeOptionalSkill } from '../lib/skill-placement';\nimport {\n CLI_SKILL_NAMES,\n HARNESS_TARGETS,\n HOSTED_SKILL_NAME,\n harnessDetectedBy,\n harnessTargetDir,\n isModelInvocationDisabled,\n onPath,\n readSkillFile,\n} from '../lib/skill-wiring';\nimport type { HarnessTarget } from '../lib/skill-wiring';\nimport {\n CONFIG_DEFAULTS,\n loadRawConfig,\n PublishModeSchema,\n WebSearchModeSchema,\n parsePublishModeFlag,\n parseWebSearchHookModeFlag,\n} from '../lib/config';\nimport type { PublishMode, WebSearchMode } from '../lib/config';\nimport {\n persistAgentDispatchHookMode,\n persistBazaarPay,\n persistInstallHarness,\n persistPublishMode,\n persistWebSearchHookMode,\n} from './config';\nimport { runWalletCreate } from './wallet';\nimport { collectDoctorChecks, isNoWalletCheck } from './doctor';\nimport type { DoctorDeps, DoctorChecks } from './doctor';\nimport { describeWallet, resolveWalletProvider } from '../lib/wallet';\nimport type { PassphraseOverrides } from '../lib/wallet/local';\nimport { walletFileExists } from '../lib/wallet/store';\nimport { walletPath } from '../lib/paths';\nimport { PERMISSIONS_DOC_URL, recommendedPermissions } from '../lib/permissions';\nimport {\n FREE_VERB_RULES,\n inspectFreeVerbRules,\n MODE_GATED_RULES,\n permissionsSkipped,\n planFreeVerbAllowlist,\n retractModeGatedRules,\n rulesForPublishMode,\n wireFreeVerbAllowlist,\n} from '../lib/harness-permissions';\nimport type { PermissionsResult } from '../lib/harness-permissions';\nimport { hooksSkipped, hooksUndo, wireSearchHooks } from '../lib/harness-hooks';\nimport { removeMarkerLines } from '../lib/uninstall';\nimport type { HooksResult } from '../lib/harness-hooks';\nimport { resolveHermesHome, resolveHermesHomeLenient, wireHermesIntegration } from '../lib/hermes';\nimport type { HermesIntegrationResult } from '../lib/hermes';\nimport { confirmChoice, intro as clackIntro, outro as clackOutro, selectOne } from '../lib/clack';\nimport { sanitizeForTerminal } from '../lib/output';\nimport type { Io } from '../lib/output';\nimport type { CommandContext, CommandResult } from '../context';\n\n// The `--harness` vocabulary and its directory mapping are single-sourced in\n// skill-wiring beside the detection probes, because `doctor` maps a persisted choice\n// back to a directory with the same rules.\nconst HARNESSES = HARNESS_TARGETS;\ntype Harness = HarnessTarget;\n\nconst InstallInputSchema = z.object({\n harness: z.array(z.string()).optional(),\n dryRun: z.boolean().optional(),\n publishMode: z.string().optional(),\n noWallet: z.boolean().optional(),\n /**\n * ACCEPTED AND IGNORED. `install` writes no CLAUDE.md/AGENTS.md line any more —\n * a skill's own frontmatter description is the trigger surface the harness reads\n * at session start, so the line only duplicated it. Both spellings still parse so\n * a script or a released doc that passes one does not fail; neither does anything.\n */\n claudeMd: z.boolean().optional(),\n /**\n * Tri-state. `true` (`--allow-free-verbs`) wires the free-verb\n * allowlist without asking, which is now also what an unanswered non-interactive\n * run does, so the flag is kept for compatibility and as an explicit statement of\n * intent. `false` (`--no-allow-free-verbs`) is the opt-out and is the only way to\n * get a run that writes no permission rule. `undefined` asks when it can, and\n * writes when it cannot ask.\n */\n allowFreeVerbs: z.boolean().optional(),\n /** The harness search-hook behavior to install (`--search-hooks auto|remind|off`). */\n searchHooks: z.string().optional(),\n /**\n * `--no-hooks`: register no hooks THIS RUN, changing nothing persistent. It is\n * deliberately not the same as `--search-hooks off`, which is a durable\n * statement about behavior and writes `hooks.webSearch: off` (and\n * `hooks.agentDispatch: off`) to config.\n */\n noHooks: z.boolean().optional(),\n});\nexport type InstallInput = z.infer<typeof InstallInputSchema>;\n\n/**\n * The publish-mode question's seam: returns the chosen mode, or `null` when the\n * operator cancelled (which changes nothing and writes nothing). The choices\n * themselves are {@link PUBLISH_MODE_CHOICES}; the seam exists so tests answer\n * in-process and never render a prompt.\n */\nexport type PromptPublishModeFn = () => Promise<PublishMode | null>;\n\n/** A yes/no seam, same shape as buy's `confirm`. */\nexport type ConfirmFn = (label: string) => Promise<boolean>;\n\ntype PublishModeSource = 'flag' | 'existing' | 'prompt' | 'headless-default' | 'default-skipped';\ninterface PublishModeSelection {\n value: PublishMode;\n source: PublishModeSource;\n}\n\n/**\n * Why no wallet was created, when none was.\n *\n * `no-passphrase-store` is the one that matters: this machine has no OS\n * credential store that would hold a generated passphrase, and no\n * `TENJIN_WALLET_PASSPHRASE`. There is no fallback here BY DESIGN. A passphrase\n * written to a plain file beside the keystore it unlocks is not a passphrase, so\n * the run creates nothing and says so loudly with both remedies.\n */\ntype WalletSkipReason = 'no-passphrase-store' | 'create-failed' | 'dry-run' | 'flag';\n\n/**\n * How the wallet step resolved, so rendering stays separate from prompting.\n *\n * `declined` (an answer) and `skipped` (no answer, with a reason) are kept apart\n * deliberately: an install that could not create a key is a different state from\n * one the operator told not to, and only the first needs a remedy.\n */\ninterface WalletOutcome {\n status: 'existing' | 'created' | 'declined' | 'skipped';\n address?: string;\n /** Only ever set on `skipped`. */\n reason?: WalletSkipReason;\n /** The exact command that changes this outcome, mirroring the CliError contract. */\n fix?: string;\n /** The underlying failure, for a `create-failed` skip. */\n warning?: string;\n}\n\n/** The remedy for each skip, so no skipped state is ever a dead end. */\nfunction walletFix(reason: WalletSkipReason): string {\n switch (reason) {\n case 'no-passphrase-store':\n return 'No OS credential store is available to hold the wallet passphrase. Set TENJIN_WALLET_PASSPHRASE and re-run `tenjin install`, or run `tenjin wallet create` in a terminal to enter one.';\n case 'create-failed':\n return 'Fix the reported problem, then run `tenjin wallet create`.';\n case 'dry-run':\n case 'flag':\n return 'Create one with `tenjin wallet create`.';\n }\n}\n\n/**\n * The Codex config.toml rule the user must add by hand. We PRINT it, never edit\n * config.toml: Codex's default workspace-write sandbox blocks network, which would\n * make every paid x402 call fail (or prompt) until this is set.\n */\nconst CODEX_NETWORK_RULE = '[sandbox_workspace_write]\\nnetwork_access = true';\n\n/** Per-skill install outcome for one harness target. */\ninterface SkillResult {\n name: string;\n status: SkillInstallStatus;\n /** Was a real copy (a SKILL.md, not just the directory) already on disk before this run? */\n preexisting: boolean;\n /** Is this one of the two CLI adapter skills (as opposed to the hosted mirror)? */\n cli: boolean;\n /** Will a harness surface it to the model after this run? On a --dry-run nothing is\n * written, so it answers for the packaged copy that would land. */\n modelInvocable: boolean;\n}\n\ninterface HarnessResult {\n harness: Harness;\n detected: boolean;\n detectedBy: string[];\n skillsDir: string;\n skills: SkillResult[];\n /**\n * Was the hosted zero-install `tenjin` skill already in this target before the\n * run? Reported so an upgrade over a hosted-skill machine is visible in `--json`,\n * which is exactly the state #35 was invisible in.\n */\n hostedPreexisting: boolean;\n /**\n * Narrower than {@link HarnessResult.hostedPreexisting}: the hosted skill was here\n * AND the CLI adapters were not, which is the hosted-zero-install-first funnel\n * rather than a second run finding our own mirror. This is what gates the notice.\n */\n hostedArrivedFirst: boolean;\n codexNetworkRule?: string;\n notes: string[];\n warnings: string[];\n /** Native Hermes MCP/plugin wiring; present only for the Hermes target. */\n hermes?: HermesIntegrationResult;\n}\n\nexport interface InstallDeps {\n /** Home directory root for harness detection + skill destinations. Tests inject a temp dir. */\n homeDir?: string;\n /** The packaged skills source directory. Defaults to resolving it from this module's location. */\n skillsSourceDir?: string;\n /** PATH probe for `claude`/`codex` binaries. Injectable so tests never depend on the real PATH. */\n which?: (bin: string) => boolean;\n /** Environment (PATH for the default `which`). Defaults to process.env. */\n env?: NodeJS.ProcessEnv;\n /** Doctor check collector; defaults to the real one. Injected in tests to avoid the network. */\n collectChecks?: (ctx: CommandContext) => Promise<DoctorChecks>;\n /** Deps forwarded to the default doctor collector (e.g. a canned fetch). */\n doctorDeps?: DoctorDeps;\n /** Decision 1: the publish-mode select; defaults to the clack list. */\n promptPublishMode?: PromptPublishModeFn;\n /** Decision 2: the permissions confirm (default yes); defaults to the clack confirm. */\n confirmPermissions?: ConfirmFn;\n /** What a real run WOULD write, for `--dry-run`; defaults to the read-only plan pass. */\n planPermissions?: (home: string, mode: PublishMode) => Promise<PermissionsResult>;\n /** Whether decision 2 has anything left to grant; defaults to reading settings.json. */\n inspectPermissions?: (\n home: string,\n mode: PublishMode,\n ) => Promise<{ pending: string[] | null; satisfied?: PermissionsResult }>;\n /** The retraction-only pass `review` runs; defaults to the real writer. */\n retractModeGated?: (home: string) => Promise<PermissionsResult>;\n /** Decision 3: the search-hook mode select; defaults to the clack list. */\n promptSearchHooks?: () => Promise<WebSearchMode | null>;\n /** Decision 5: the Bazaar pay lane opt-in; defaults to the clack confirm (default no). */\n confirmBazaarPay?: (question: string) => Promise<boolean>;\n /** Decision 4: \"Create a wallet now?\"; defaults to the clack confirm (default yes). */\n confirmWallet?: ConfirmFn;\n /** Prompt-sequence chrome. Seams so tests never load the renderer. */\n intro?: (message: string) => Promise<void>;\n outro?: (message: string) => Promise<void>;\n /** Whether the human walkthrough runs (TTY, no --json, stdin is a TTY). Injected in tests. */\n isInteractive?: boolean;\n /** Does a wallet already exist? Defaults to walletFileExists(dataDir). */\n walletExists?: (dataDir: string) => Promise<boolean>;\n /** An existing wallet's address, for the \"(existing)\" line. Defaults to the local provider. */\n walletAddress?: (ctx: CommandContext) => Promise<string>;\n /** Create a wallet and return its address. Defaults to runWalletCreate. */\n createWallet?: (ctx: CommandContext) => Promise<string>;\n /**\n * Passphrase-resolution seam forwarded to `wallet create` (OS-store exec, TTY\n * prompt, platform). Tests MUST set it: without it a headless install now\n * creates a real wallet, and on macOS that writes to the developer's own login\n * keychain under the `tenjin-cli` service.\n */\n walletPassphrase?: PassphraseOverrides;\n /** Absolute CLI entrypoint embedded in Hermes' MCP config. */\n tenjinCommand?: string;\n /** Absolute Node executable embedded in the Hermes native plugin. */\n nodeCommand?: string;\n}\n\n/**\n * `tenjin install`: detect the installed harness(es), copy the packaged skills\n * into each one's skills directory, wire the AGENTS.md pointer, ask AT MOST FIVE\n * questions (publishing, harness permissions, search hooks, wallet, the Bazaar pay\n * lane), then run the doctor checks over the machine those answers just produced\n * and print a short summary. Everything that is not one of those decisions is display: the\n * security reference material lives in docs/agent-permissions.md, not in the\n * middle of a setup flow.\n *\n * A NON-INTERACTIVE RUN IS A USABLE INSTALL, not a stripped one. The permission\n * allowlist, the search hooks, the CLAUDE.md nudge and the wallet are all settled\n * by default when there is no one to ask, because the machine that most needs\n * them is exactly the one running headless. Each is disclosed in the output with\n * its undo and each has an opt-out flag.\n *\n * Like every command it is human-first (the global output contract): at a TTY\n * without `--json` it prompts and returns the walkthrough as humanLines, which\n * the dispatcher prints to stdout with no envelope. With `--json` or piped\n * stdout it returns the envelope and asks nothing. Idempotent: a re-run reports\n * up-to-date, never duplicates the AGENTS.md line, adds no permission rule twice,\n * and registers no hook twice. `--dry-run` writes nothing.\n */\nexport async function runInstall(\n input: InstallInput,\n ctx: CommandContext,\n deps: InstallDeps = {},\n): Promise<CommandResult> {\n return withInterruptGuard((markPhase) => installBody(input, ctx, deps, markPhase));\n}\n\n/** How far the command got, for the interrupt diagnostic. */\ntype InstallPhase = 'writing-skills' | 'wired';\n\n/**\n * Run `fn` with SIGINT/SIGTERM answered for the WHOLE command, not just the\n * blocks that hold a lock. The default signal action terminates without running\n * `finally`, stranding whichever lock the command holds so every later run times\n * out on it; install takes two (the config lock behind decision 1, and the\n * wallet-create lock behind decision 3, whose scrypt work is the longest\n * interruptible window this command has). Ownership is tracked by the lock\n * itself, so the handler releases exactly what this process holds and a run still\n * QUEUED behind another cannot touch that other run's lock.\n *\n * `markPhase` carries the diagnostic past the states no lock covers: the skills\n * write holds nothing (each file lands by its own atomic rename), so without it an\n * interrupt mid-copy would report that nothing changed.\n */\nasync function withInterruptGuard(\n fn: (markPhase: (phase: InstallPhase) => void) => Promise<CommandResult>,\n): Promise<CommandResult> {\n let phase: InstallPhase | undefined;\n const onSignal = (signal: NodeJS.Signals): void => {\n const wasWriting = ownsAnyLock() || phase === 'writing-skills';\n releaseOwnedLocks();\n // An external SIGINT/SIGTERM can land while a clack prompt has the terminal\n // in raw mode with the cursor hidden; process.exit skips clack's teardown.\n // (Ctrl-C at a prompt is unaffected: raw mode delivers it as a keypress.)\n if (process.stdin.isTTY) process.stdin.setRawMode?.(false);\n if (process.stdout.isTTY) process.stdout.write('\\x1b[?25h');\n process.stderr.write(\n wasWriting\n ? `\\nInterrupted mid-write. Some files may be half-written; re-run \\`tenjin install\\` to finish.\\n`\n : phase === 'wired'\n ? `\\nInterrupted after the skills were written; later setup steps may not have finished. Re-run \\`tenjin install\\` to finish.\\n`\n : '\\nInterrupted before anything was written; nothing changed.\\n',\n );\n process.exit(signal === 'SIGINT' ? 130 : 143);\n };\n process.on('SIGINT', onSignal);\n process.on('SIGTERM', onSignal);\n try {\n return await fn((p) => {\n phase = p;\n });\n } finally {\n process.off('SIGINT', onSignal);\n process.off('SIGTERM', onSignal);\n }\n}\n\nasync function installBody(\n input: InstallInput,\n ctx: CommandContext,\n deps: InstallDeps,\n markPhase: (phase: InstallPhase) => void,\n): Promise<CommandResult> {\n const parsed = InstallInputSchema.safeParse(input);\n if (!parsed.success) {\n throw new CliError('USAGE', 'Invalid install options', {\n fix: 'Run `tenjin install --help`.',\n details: parsed.error.issues,\n });\n }\n const dryRun = parsed.data.dryRun === true;\n const noWallet = parsed.data.noWallet === true;\n const noHooks = parsed.data.noHooks === true;\n const allowFreeVerbs = parsed.data.allowFreeVerbs;\n // Validate the enum flags UP FRONT so a bad value fails before any wiring.\n const publishModeFlag =\n parsed.data.publishMode !== undefined ? parseModeFlag(parsed.data.publishMode) : undefined;\n const searchHooksFlag =\n parsed.data.searchHooks !== undefined\n ? parseWebSearchHookModeFlag(parsed.data.searchHooks, '--search-hooks')\n : undefined;\n const env = deps.env ?? process.env;\n const home = deps.homeDir ?? homedir();\n // An empty or relative HOME (sudo/docker env_reset, systemd units) would make\n // every target below relative, silently installing into the current working\n // directory and reporting success while no harness reads a thing.\n if (!isAbsolute(home)) {\n throw new CliError(\n 'INTERNAL',\n 'The home directory did not resolve to an absolute path, so nothing was installed.',\n {\n fix: 'Set HOME to your home directory (`export HOME=...`), then re-run `tenjin install`.',\n },\n );\n }\n const which = deps.which ?? ((bin: string) => onPath(bin, env));\n // A relative HERMES_HOME is only fatal when the operator asked for Hermes. On any\n // other run it is a stray env var belonging to something else, and taking the\n // whole install down over it punishes the wrong machine.\n const targetsHermes = parsed.data.harness?.includes('hermes') === true;\n const hermesTarget = targetsHermes\n ? { home: resolveHermesHome(home, env), warning: undefined }\n : resolveHermesHomeLenient(home, env);\n const hermesHome = hermesTarget.home;\n\n // Human-first is the global output rule (emitSuccess renders humanLines at a TTY\n // without --json and no envelope). `humanOutput` matches that gate so install\n // returns its walkthrough as humanLines; `canPrompt` additionally needs stdin, so\n // a piped-stdin run still renders a walkthrough (with defaults, no wallet prompt).\n const humanOutput = ctx.flags.json === true ? false : (deps.isInteractive ?? ctx.io.isTTY);\n const canPrompt = humanOutput && (deps.isInteractive ?? Boolean(process.stdin.isTTY));\n\n const skillsSource =\n deps.skillsSourceDir ?? resolveSkillsSource(fileURLToPath(new URL('.', import.meta.url)));\n await assertSkillsSource(skillsSource);\n\n const plans = resolvePlans(parsed.data.harness, home, hermesHome, which);\n // Same condition resolvePlans treats as an override, so what gets recorded below is\n // exactly what overrode detection.\n const explicitHarness = parsed.data.harness !== undefined && parsed.data.harness.length > 0;\n // The CLAUDE.md nudge is written BY DEFAULT, on both paths, only\n // `--no-claude-md` suppresses it. Codex already got the same line in its\n const harnesses: HarnessResult[] = [];\n // Unlocked. What makes concurrent writers safe here is the per-file atomic\n // rename, not serialization: the rm-then-write this used to be had two runs\n // reading each other's half-built trees (7 of 15 concurrent runs failed on raw\n // ENOENT/ENOTEMPTY renames), and 24 concurrent runs pass without a lock. The\n // self-heal is the other writer, and it writes these same bytes to these same\n // paths through the same writer.\n const rawConfig = await loadRawConfig(ctx.dataDir);\n if (!dryRun) markPhase('writing-skills');\n for (const plan of plans) {\n harnesses.push(await applyPlan(plan, skillsSource, dryRun));\n }\n await assertSkillsLanded(plans, dryRun);\n if (!dryRun) markPhase('wired');\n // An explicit --harness is REMEMBERED, before the embedded doctor run so this run's\n // own check already honours it. Detection cannot see a harness we do not probe for,\n // so without the record a directory the user named by hand is a target for one run\n // and then invisible to every later doctor — including for the #35 shadowing defect\n // it was chosen to hold. `--dry-run` records nothing, like the publish-mode write.\n if (explicitHarness && !dryRun) {\n await underDataDir(ctx.dataDir, () =>\n persistInstallHarness(\n ctx.dataDir,\n plans.map((p) => p.harness),\n ),\n );\n }\n // One-time cleanup of the pointer line older versions wrote into the operator's\n // CLAUDE.md / AGENTS.md. `install` writes no such line now: a skill's own\n // frontmatter description is the trigger surface the harness loads at session\n // start, so the line only duplicated it. Removing it here is what gets the\n // footprint off machines that already have one, since most people re-run\n // `install` far more often than they would run a cleanup command.\n const pointerCleanup = dryRun ? [] : await removeMarkerLines(home);\n\n // The five decisions, in order. Each one is skipped (with its own recorded\n // reason) when a flag already settled it or when there is no one to ask.\n if (canPrompt) await (deps.intro ?? clackIntro)('tenjin install');\n const publishMode = await underDataDir(ctx.dataDir, () =>\n resolvePublishMode(publishModeFlag, ctx, deps, dryRun, canPrompt),\n );\n const permissions = await resolvePermissions({\n plans,\n home,\n deps,\n flag: allowFreeVerbs,\n dryRun,\n canPrompt,\n publishMode: publishMode.value,\n });\n const hooks = await underDataDir(ctx.dataDir, () =>\n resolveHooks({ plans, home, ctx, deps, flag: searchHooksFlag, noHooks, dryRun, canPrompt }),\n );\n const hermesResult = harnesses.find((result) => result.harness === 'hermes');\n if (hermesResult !== undefined) {\n const tenjinCommand = deps.tenjinCommand ?? process.argv[1];\n const nodeCommand = deps.nodeCommand ?? process.execPath;\n if (tenjinCommand === undefined || !isAbsolute(tenjinCommand) || !isAbsolute(nodeCommand)) {\n throw new CliError(\n 'INTERNAL',\n 'Hermes integration requires absolute Tenjin and Node executable paths.',\n { fix: 'Run `tenjin install --harness hermes` through the installed Tenjin CLI.' },\n );\n }\n hermesResult.hermes = await wireHermesIntegration({\n hermesHome,\n dataDir: ctx.dataDir,\n tenjinCommand,\n nodeCommand,\n dryRun,\n // Activation consent: the operator named Hermes on the command line.\n explicit: explicitHarness && targetsHermes,\n // Write consent, read off the SAME hooks decision that gates Claude's\n // settings.json, because `--no-hooks` promises \"writes no config\" in the\n // README and that promise cannot hold on only one of the two harnesses.\n hooks: { enabled: hermesHooksEnabled(hooks), fix: hooks.fix, mode: hooks.mode },\n });\n for (const part of [\n hermesResult.hermes.mcp,\n hermesResult.hermes.plugin,\n hermesResult.hermes.activation,\n ]) {\n if (part.warning !== undefined) hermesResult.warnings.push(part.warning);\n }\n if (hermesTarget.warning !== undefined) hermesResult.warnings.push(hermesTarget.warning);\n }\n // On BOTH paths now: the loop this command sets up needs a key, so a headless\n // run creates one rather than leaving the operator a setup that stops at the\n // first buy or publish.\n const wallet = await underDataDir(ctx.dataDir, () =>\n resolveWallet(ctx, deps, walletSkip(dryRun, noWallet), canPrompt),\n );\n // Decision five, the Bazaar pay lane (plan: tenjin-notes cli-x402-pay). Asked\n // once: a key already in the config (either answer) is remembered and never\n // re-asked, and a headless run never enables it, because paying non-Tenjin\n // sellers is an opt-in only a human makes.\n const bazaarPay = await underDataDir(ctx.dataDir, () =>\n resolveBazaarPay(ctx, deps, dryRun, canPrompt, rawConfig.bazaarPay),\n );\n // The Bazaar lane's teaching lives in its own OPTIONAL skill, and PRESENCE is\n // the whole mechanism: the tenjin-pay skill is on disk exactly while the\n // toggle is on, so an agent is never taught a lane the operator turned off.\n // Placed after the decisions so this run's own answer is what lands; the\n // doctor snapshot below then sees the final state. Per-plan best-effort like\n // the writer loop above: a placement failure is doctor's to report.\n if (!dryRun) {\n for (const plan of plans) {\n try {\n await placeOptionalSkill(\n OPTIONAL_PAY_SKILL,\n plan.skillsDir,\n skillsSource,\n bazaarPay.enabled,\n );\n } catch {\n // The skills check in the embedded doctor run reports what remains.\n }\n }\n }\n\n // AFTER every decision, never before (#101). The snapshot used to be taken\n // straight after the skills were written, so a run that created a wallet\n // reported \"No wallet\" in both the walkthrough and `data.doctor` — the checks\n // described a machine that had stopped existing three steps earlier. Collecting\n // here costs nothing extra (it is still one run) and is what makes the embedded\n // report describe the install it is reporting on: the wallet just created, and\n // the config `publish.mode` just written.\n //\n // It still inspects the same `home` install wrote into, so its skill-wiring\n // check reports THIS run's result rather than os.homedir()'s. `which` goes with\n // it: the check gates its verdicts on harness detection, and a different probe\n // there would judge directories this run never targeted.\n const doctorDeps: DoctorDeps = { ...(deps.doctorDeps ?? {}) };\n doctorDeps.homeDir ??= home;\n doctorDeps.which ??= which;\n const collect = deps.collectChecks ?? ((c) => collectDoctorChecks(c, doctorDeps));\n const doctor = await collect(ctx);\n\n if (canPrompt) await (deps.outro ?? clackOutro)('Setup complete.');\n\n const data = {\n dryRun,\n skillsSource,\n harnesses,\n // One-time cleanup, reported because it edits a file the operator owns. Older\n // versions wrote a pointer line into CLAUDE.md/AGENTS.md; nothing writes one\n // now, so an install that finds one removes it and says which file it touched.\n pointerCleanup,\n doctor: { status: doctor.failure !== undefined ? 'fail' : 'pass', checks: doctor.checks },\n publishMode,\n bazaarPay,\n // Shipped with the install rather than left for the operator to discover after\n // their first auto-mode denial (#33). Static constants, no config key: see\n // lib/permissions.ts for why this is deliberately not operator-editable state.\n // `wired` is the outcome of THIS run's settings.json write; the three\n // recommendation tiers beside it are unchanged, so a machine consumer that\n // read `alwaysSafe` / `optIn` / `neverAllowlisted` before still does.\n permissions: { ...recommendedPermissions(publishMode.value), wired: permissions },\n hooks,\n wallet,\n };\n\n // Machine path (--json or piped stdout): the envelope, no prompts.\n if (!humanOutput) return { data };\n\n // Human path: the walkthrough as humanLines (the global emitSuccess prints them\n // to stdout at a TTY and never an envelope).\n const humanLines = buildWalkthrough(ctx.io, {\n pointerCleanup,\n dryRun,\n dataDir: ctx.dataDir,\n harnesses,\n publishMode,\n permissions,\n hooks,\n wallet,\n doctor,\n });\n return { data, humanLines };\n}\n\n/**\n * Why no wallet is being created at all, or undefined when one is. Being unable\n * to prompt is NOT on this list any more: a headless run creates by default.\n */\nfunction walletSkip(dryRun: boolean, noWallet: boolean): 'dry-run' | 'flag' | undefined {\n if (dryRun) return 'dry-run';\n if (noWallet) return 'flag';\n return undefined;\n}\n\n/**\n * The two steps that write to the Tenjin data dir, with a denial there reported as\n * the directory it is rather than as a raw errno under INTERNAL. The skills are\n * already on disk by now, so the message says what failed, not that nothing\n * happened.\n */\nasync function underDataDir<T>(dataDir: string, fn: () => Promise<T>): Promise<T> {\n try {\n return await fn();\n } catch (err) {\n if (!hasCode(err, 'EACCES') && !hasCode(err, 'EPERM')) throw err;\n throw new CliError('INTERNAL', `Could not use the Tenjin data directory ${dataDir}.`, {\n fix: `Permission denied. Check that you can write to it (\\`ls -ld ${dataDir}\\`), then re-run \\`tenjin install\\`.`,\n cause: err,\n });\n }\n}\n\nconst EXAMPLE_QUESTION = \"what actually changed in <library> v3's public API\";\n\ninterface WalkthroughState {\n dryRun: boolean;\n /** Legacy pointer files this run cleaned; disclosed because they are the\n * operator's own notes and we edited them. */\n pointerCleanup: string[];\n /** Where the wallet keystore lives, for the create disclosure. */\n dataDir: string;\n harnesses: HarnessResult[];\n publishMode: PublishModeSelection;\n permissions: PermissionsResult;\n hooks: HooksResult;\n wallet: WalletOutcome;\n doctor: DoctorChecks;\n}\n\n/**\n * The human surface: what happened, then what still needs you (#80). The summary\n * of at most five lines comes FIRST — it used to sit under the warnings, so a\n * first-time reader met \"Some checks need attention\" before learning anything had\n * succeeded and the whole run read as failure-then-success. On a clean install\n * the summary IS the output.\n *\n * The dry-run banner stays on top: it qualifies every line below it, so it is not\n * an attention item but a statement about what the rest of the output means.\n */\nfunction buildWalkthrough(io: Io, s: WalkthroughState): string[] {\n const lines: string[] = [];\n if (s.dryRun) {\n lines.push(paint(io, 'yellow', 'Dry run: nothing was written.'));\n lines.push('');\n }\n lines.push(...summaryLines(io, s));\n const notices = noticeLines(io, s);\n if (notices.length > 0) lines.push('', ...notices);\n return lines;\n}\n\n/**\n * Everything below the summary: per-harness warnings, the Codex network rule,\n * the nudge disclosure and its undo, and any doctor check that is not ok. A\n * green doctor says nothing at all, so a clean run stays five lines.\n */\nfunction noticeLines(io: Io, s: WalkthroughState): string[] {\n const lines: string[] = [];\n for (const h of s.harnesses) {\n if (h.hostedArrivedFirst) {\n // Named by DIRECTORY: one line per harness, and the funnel puts the mirror\n // in both, so an unqualified line appears twice and reads as a stutter.\n lines.push(\n paint(\n io,\n 'dim',\n `The hosted ${HOSTED_SKILL_NAME} skill was already in ${h.skillsDir}: kept as the zero-install fallback, and the CLI skills now take precedence.`,\n ),\n );\n }\n if (h.codexNetworkRule !== undefined) {\n lines.push(paint(io, 'dim', 'Codex blocks network by default; add to ~/.codex/config.toml:'));\n for (const rl of h.codexNetworkRule.split('\\n')) lines.push(paint(io, 'dim', ` ${rl}`));\n }\n for (const w of h.warnings) lines.push(paint(io, 'yellow', `! ${w}`));\n }\n // Not dim: we edited a file the operator writes their own notes in, and a line\n // saying so is the only way they learn it happened.\n if (s.pointerCleanup.length > 0) {\n lines.push(\n `Removed the old Tenjin pointer line from ${s.pointerCleanup.join(' and ')}; the skills carry their own triggers now.`,\n );\n }\n // Same reason as the pointer line above: we edited the operator's settings.json\n // to REMOVE something, and the only way they learn it happened is a line here.\n // Two different removals, and calling them one thing made the honest half a lie:\n // `publish` and `edit` are current commands whose RULES the mode no longer\n // carries, and reporting them as \"commands that no longer exist\" told the\n // operator their publish verb had been retired.\n const stale = s.permissions.removed.filter((r) => !MODE_GATED_RULES.includes(r));\n if (stale.length > 0) {\n lines.push(\n `Removed ${stale.length} permission rule(s) an older tenjin left in ${s.permissions.path ?? 'your settings'} for commands that no longer exist.`,\n );\n }\n // A run that wired permissions without being asked has to say so, and say how to\n // take it back. This is the disclosure that makes the non-interactive default\n // defensible: nothing lands silently, whether it was answered or defaulted.\n if (s.permissions.planned !== true && s.permissions.added.length > 0) {\n // The undo only. The count, the file and the link are already on the\n // Permissions line above, and saying them twice in one screen is the noise\n // this walkthrough keeps getting trimmed of. The exact rules stay out of the\n // terminal entirely; the envelope carries them in `permissions.wired.added`.\n lines.push(paint(io, 'dim', `Undo anytime: remove those lines from ${s.permissions.path}.`));\n }\n if (s.hooks.added.length > 0 || s.hooks.updated.length > 0) {\n lines.push(paint(io, 'dim', hooksDisclosure(s.hooks)));\n lines.push(\n paint(io, 'dim', hooksUndo(s.hooks.path ?? '~/.claude/settings.json', s.hooks.scriptsDir)),\n );\n // NOT dim, unlike the disclosure above it: settings.json hooks are read once\n // at session start, so an operator who does not restart gets no hook activity\n // at all and nothing telling them why. That silence is the whole reason this\n // line exists, so it must not read as fine print.\n lines.push(\n `${paint(io, 'bold', 'Restart Claude Code')} to load them; hooks are read once at session start.`,\n );\n }\n if (s.hooks.warning !== undefined) {\n lines.push(paint(io, 'yellow', `! ${sanitizeForTerminal(s.hooks.warning)}`));\n }\n for (const line of walletDisclosure(s.wallet, s.dataDir)) lines.push(paint(io, 'dim', line));\n if (s.wallet.warning !== undefined) {\n lines.push(paint(io, 'yellow', `! ${sanitizeForTerminal(s.wallet.warning)}`));\n }\n if (s.permissions.warning !== undefined) {\n // Sanitized for the same reason doctorNotices sanitizes `detail`/`fix`: this\n // string embeds a V8 JSON parse error, and V8 quotes the offending input, so\n // ~20 bytes of whatever is in settings.json (escapes included) reach the\n // terminal at the moment we tell the operator we left their file alone.\n lines.push(paint(io, 'yellow', `! ${sanitizeForTerminal(s.permissions.warning)}`));\n }\n lines.push(...doctorNotices(io, s.doctor, s.wallet));\n return lines;\n}\n\n/**\n * The closing summary, capped at one line per subject: skills, publishing,\n * permissions, wallet, and the command to run next.\n */\nfunction summaryLines(io: Io, s: WalkthroughState): string[] {\n return [\n ...s.harnesses.map((h) => skillsLine(io, h, s.dryRun)),\n publishingLine(io, s.publishMode.value, s.permissions),\n permissionsLine(io, s.permissions),\n hooksLine(io, s.hooks),\n walletLine(io, s.wallet),\n `${paint(io, 'bold', 'Next:')} tenjin search \"${EXAMPLE_QUESTION}\"`,\n ];\n}\n\n/** What the hooks do, in one line each, at the moment they are written. */\nfunction hooksDisclosure(h: HooksResult): string {\n const shared =\n 'A Stop hook reminds you locally when a MISS you searched for is still unpublished, and a SessionStart hook prints one paragraph on when to search first; neither makes a network call.';\n if (h.mode === 'remind') {\n return `The WebSearch and dispatch hooks print a one-line reminder that Tenjin may have an answer; they send nothing off-machine. ${shared}`;\n }\n return `Before a web search or a subagent dispatch, the hooks ask ${PRODUCTION_HOST} the same question (free and anonymous, ~2s budget, 5s harness kill) and mention a tested answer if one exists; the query text, or at most 400 characters of the subagent prompt, leaves the machine. They can never block or change the tool call. ${shared}`;\n}\n\n/**\n * One line for the harness hooks. A skip is never silent, for the same reason the\n * permissions line is never silent: the operator would otherwise find out by\n * noticing that nothing ever happens.\n */\nfunction hooksLine(io: Io, h: HooksResult): string {\n const label = paint(io, 'bold', 'Search hooks:');\n const wrote = h.added.length + h.updated.length;\n if (wrote > 0) {\n return `${paint(io, 'green', '✓')} ${label} ${h.mode} mode, ${wrote} hook event(s) registered in ${h.path}. Change: tenjin config set hooks.webSearch <auto|remind|off> (or hooks.agentDispatch)`;\n }\n if (h.skipped === undefined) {\n return `${paint(io, 'green', '✓')} ${label} ${h.mode} mode, already registered in ${h.path}`;\n }\n if (h.skipped === 'harness-not-claude') {\n return `${paint(io, 'dim', '-')} ${label} not wired (Claude Code only).`;\n }\n if (h.skipped === 'native-harness') {\n return `${paint(io, 'green', '✓')} ${label} ${h.mode} mode through the native Hermes plugin. Change: tenjin config set hooks.webSearch <auto|remind|off> (or hooks.agentDispatch)`;\n }\n if (h.skipped === 'dry-run') {\n return `${paint(io, 'dim', '-')} ${label} unchanged (dry run).`;\n }\n if (h.skipped === 'mode-off') {\n return `${paint(io, 'dim', '-')} ${label} off (hooks.webSearch). Turn them on: tenjin config set hooks.webSearch auto, then tenjin install`;\n }\n if (h.skipped === 'declined') {\n return `${paint(io, 'dim', '-')} ${label} not registered this run; nothing was configured. Register them: tenjin install`;\n }\n if (h.skipped === 'changed-since-read') {\n return `${paint(io, 'yellow', '!')} ${label} ${h.path} changed while it was being updated, so nothing was written. Re-run: tenjin install`;\n }\n return `${paint(io, 'yellow', '!')} ${label} ${h.path} was left untouched. Fix it, then: tenjin install`;\n}\n\nfunction harnessLabel(h: Harness): string {\n return h === 'claude'\n ? 'Claude Code'\n : h === 'codex'\n ? 'Codex'\n : h === 'hermes'\n ? 'Hermes'\n : 'Agent Skills';\n}\n\n/**\n * One line per harness. It names the skills rather than counting them: #35\n * shipped as \"search worked, publish was simply absent\" on a machine that\n * already had the hosted skill, and a bare \"3 skills installed\" cannot tell you\n * publish is wired.\n */\nfunction skillsLine(io: Io, h: HarnessResult, dryRun: boolean): string {\n const changed = h.skills.some((s) => s.status !== 'up-to-date');\n const verb = dryRun ? 'would install' : changed ? 'installed' : 'up to date';\n const head = `${harnessLabel(h.harness)}: ${h.skills.length} skills ${verb}`;\n return `${paint(io, 'green', '✓')} ${paint(io, 'bold', head)} in ${h.skillsDir}. ${skillRoster(h)}.`;\n}\n\n/**\n * One line for the settled consent mode, with the same consequence the question\n * showed, and the way back out when this run actually granted something.\n *\n * The grant used to get two more lines of its own, reciting both rule strings and\n * all three undos. An operator meeting `Bash(tenjin publish:*)` for the first time\n * mid-install cannot act on it, and three undos for one decision is a menu, not a\n * disclosure. The full story (exact rules, keystore, session mint, flag caveats,\n * all three undos) is unchanged in docs/agent-permissions.md, `doctor --json`, and\n * this command's own `--json` envelope; the terminal gets the one command that\n * turns it off.\n */\nfunction publishingLine(io: Io, mode: PublishMode, wired: PermissionsResult): string {\n const undo =\n wired.modeGrant === undefined\n ? ''\n : ` ${paint(io, 'dim', wired.planned === true ? 'Would turn off:' : 'Turn off:')} tenjin config set publish.mode review`;\n return `${paint(io, 'green', '✓')} ${paint(io, 'bold', `Publishing: ${mode}`)}. ${modeBlurb(mode)}${undo}`;\n}\n\n/**\n * One line for the harness allowlist: what landed, or what to run to get it. A\n * skip is never silent, because the operator's next auto-mode session is where\n * they would otherwise find out (#33).\n *\n * The count is every rule of ours now in the file, and the word \"free\" is gone\n * with it: it was there to keep `publish` and `edit` out of a total that called\n * them free verbs, and a line that just says how many tenjin commands are allowed\n * needs no such qualifier. What the rules ARE, and what they clear, is one link\n * away rather than recited here.\n */\nfunction permissionsLine(io: Io, p: PermissionsResult): string {\n const label = paint(io, 'bold', 'Permissions:');\n const allowed = p.added.length + p.alreadyPresent.length;\n /**\n * What a `review` install took back, said on EVERY branch rather than on the\n * two that happened to be written first.\n *\n * The retraction runs above the guards that decline a write, so a run can\n * retract and then skip: `--no-allow-free-verbs` said \"unchanged\" and\n * `--harness shared` said \"not wired (Claude Code only)\", both over a\n * settings.json the same run had just deleted two rules from. The second was\n * the worse of the two, since it tells the operator their Claude settings were\n * left alone. Hoisted, so a branch that forgets it reads wrong at review time\n * rather than shipping.\n */\n const retracted = p.removed.filter((r) => MODE_GATED_RULES.includes(r));\n /**\n * PAST TENSE FOR A RUN, FUTURE FOR A PLAN. `planFreeVerbAllowlist` fills\n * `removed` with what a real run WOULD take back, so a dry run reaching the\n * past-tense sentence reports a deletion that never happened.\n */\n const gaveBack =\n retracted.length === 0\n ? ''\n : p.planned === true\n ? ` A real run would remove ${retracted.length} rule(s) for publish and edit from ${p.path ?? 'your settings'}.`\n : ` Publishing is back to asking first, so ${retracted.length} rule(s) for publish and edit were removed from ${p.path ?? 'your settings'}.`;\n /**\n * Nothing was written AND nothing was taken back: only then is \"unchanged\" the\n * honest word. Gated on `planned` too, because a dry run changes nothing by\n * definition, and \"otherwise unchanged\" there qualified against a retraction the\n * line never named.\n */\n const unchanged =\n retracted.length === 0 || p.planned === true ? 'unchanged' : 'otherwise unchanged';\n\n // A dry run reports the PLAN in the same fields, so it takes this branch and\n // says \"would allow\". An operator dry-running to find out whether publish and\n // edit get granted was previously told only \"unchanged (dry run)\".\n if (p.planned === true && p.added.length > 0) {\n return `${paint(io, 'dim', '-')} ${label} would allow ${allowed} tenjin commands in ${p.path}. Details: ${PERMISSIONS_DOC_URL}`;\n }\n if (p.added.length > 0) {\n return `${paint(io, 'green', '✓')} ${label} ${allowed} tenjin commands allowed in ${p.path}.${gaveBack} Details: ${PERMISSIONS_DOC_URL}`;\n }\n if (p.skipped === undefined) {\n return `${paint(io, 'green', '✓')} ${label} the ${FREE_VERB_RULES.length} free tenjin commands were already allowed in ${p.path}.${gaveBack}`;\n }\n if (p.skipped === 'harness-not-claude') {\n return `${paint(io, 'dim', '-')} ${label} not wired for this harness (Claude Code only).${gaveBack} The lines your harness needs: ${PERMISSIONS_DOC_URL}`;\n }\n if (p.skipped === 'dry-run') {\n return `${paint(io, 'dim', '-')} ${label} ${unchanged} (dry run); the ${FREE_VERB_RULES.length} rules a real run needs are already there.${gaveBack}`;\n }\n if (p.skipped === 'declined' || p.skipped === 'not-requested') {\n return `${paint(io, 'dim', '-')} ${label} ${unchanged}.${gaveBack} Allow the ${FREE_VERB_RULES.length} free tenjin commands with: tenjin install --allow-free-verbs`;\n }\n if (p.skipped === 'changed-since-read') {\n // Nothing is wrong with the file and the flag is not the remedy: another\n // writer touched it mid-run, so the merge has to be recomputed against what\n // is there now. The catch-all below says \"fix it\", which is wrong here.\n return `${paint(io, 'yellow', '!')} ${label} ${p.path} changed while it was being updated, so nothing was written.${gaveBack} Re-run: tenjin install`;\n }\n return `${paint(io, 'yellow', '!')} ${label} ${p.path} was left untouched.${gaveBack} Fix it, then: tenjin install --allow-free-verbs`;\n}\n\nfunction walletLine(io: Io, w: WalletOutcome): string {\n const label = paint(io, 'bold', 'Wallet:');\n if (w.status === 'existing') {\n return `${paint(io, 'green', '✓')} ${label} ${w.address} (existing). Check funds with: tenjin wallet balance`;\n }\n if (w.status === 'created') {\n return `${paint(io, 'green', '✓')} ${label} ${w.address}, holding $0. Fund it with a few dollars of USDC on Base, then: tenjin wallet balance`;\n }\n if (w.status === 'skipped') {\n const icon = w.reason === 'no-passphrase-store' || w.reason === 'create-failed' ? '!' : '-';\n const color = icon === '!' ? 'yellow' : 'dim';\n return `${paint(io, color, icon)} ${label} none (${w.reason}). ${w.fix}`;\n }\n return `${paint(io, 'dim', '-')} ${label} none. Create one later with: tenjin wallet create`;\n}\n\n/**\n * What a freshly created wallet means, at the moment it is created. Three things\n * an operator has to know and would otherwise learn the hard way: it is empty,\n * only a human can fund it, and where the key lives.\n */\nfunction walletDisclosure(w: WalletOutcome, dataDir: string): string[] {\n if (w.status !== 'created') return [];\n return [\n `A wallet was created at ${walletPath(dataDir)}: the key is encrypted at rest (keystore v3, scrypt, mode 0600) and never leaves this machine.`,\n 'It holds $0. Funding it is a human step: run `tenjin fund` (card checkout via Coinbase, opened in your browser), or send USDC on Base to that address.',\n ];\n}\n\n/** `tenjin-search, tenjin-publish (CLI); tenjin (hosted, zero-install fallback)`. */\nfunction skillRoster(h: HarnessResult): string {\n const cli = h.skills.filter((s) => s.cli).map((s) => s.name);\n const hosted = h.skills.filter((s) => !s.cli).map((s) => s.name);\n const parts: string[] = [];\n if (cli.length > 0) parts.push(`${cli.join(', ')} (CLI)`);\n if (hosted.length > 0) parts.push(`${hosted.join(', ')} (hosted, zero-install fallback)`);\n return parts.join('; ');\n}\n\n/**\n * The single line of consequence attached to a mode, wherever it is shown.\n *\n * `auto` used to end \"your harness still shows each command for approval\", which\n * stopped being true the moment the mode started writing its own harness rules.\n * The clause is gone rather than reworded: the thing an operator needs at this\n * moment is that publishing happens without them, under their name.\n */\nfunction modeBlurb(v: PublishMode): string {\n return v === 'auto'\n ? 'Your agent publishes and updates pieces on its own, under your identity.'\n : v === 'review'\n ? 'Your agent asks you in chat before every publish.'\n : 'Your agent publishes on its own, under your identity, and only a hard block stops it.';\n}\n\n/**\n * The wallet decision. A wallet is now created BY DEFAULT on both paths, because\n * the loop this command exists to set up does not close without one: `buy` needs\n * a funded key and publish-on-MISS needs a key to sign the write, so a walletless\n * install is a setup that stops at the first useful thing the agent tries.\n *\n * The headless path is the change. It creates without asking, using the\n * passphrase policy `resolvePassphraseForCreate` already enforces: an explicit\n * `TENJIN_WALLET_PASSPHRASE`, else a strong generated passphrase written to the\n * platform's OS credential store and verified by reading it back. When neither is\n * available it creates NOTHING and reports `skipped: no-passphrase-store` with\n * both remedies. There is deliberately no plain-file fallback: a passphrase\n * sitting next to the keystore it unlocks protects nothing, and an install is\n * never the right place to invent one.\n *\n * A creation failure never fails the install. The skills, hooks and permissions\n * this run just wired are all useful without a wallet, so the failure is reported\n * loudly and the command still succeeds.\n */\nasync function resolveWallet(\n ctx: CommandContext,\n deps: InstallDeps,\n skipReason: 'dry-run' | 'flag' | undefined,\n canPrompt: boolean,\n): Promise<WalletOutcome> {\n const exists = await (deps.walletExists ?? walletFileExists)(ctx.dataDir);\n if (exists) {\n return {\n status: 'existing',\n address: await (deps.walletAddress ?? existingWalletAddress)(ctx),\n };\n }\n if (skipReason !== undefined) {\n return { status: 'skipped', reason: skipReason, fix: walletFix(skipReason) };\n }\n\n // Interactive keeps the question (default yes); headless has nobody to ask and\n // takes the default rather than treating silence as a no.\n if (canPrompt) {\n const confirm = deps.confirmWallet ?? defaultConfirm;\n if (!(await confirm(WALLET_QUESTION))) return { status: 'declined' };\n }\n\n try {\n const create =\n deps.createWallet ??\n ((c: CommandContext) => defaultCreateWallet(c, deps.walletPassphrase, deps.env));\n return { status: 'created', address: await create(ctx) };\n } catch (err) {\n // The one failure with a real remedy: no env passphrase and no OS store, so\n // resolvePassphraseForCreate refused rather than encrypt with a passphrase\n // that has no durable copy. Anything else is reported as itself.\n const reason: WalletSkipReason = isNoPassphraseError(err)\n ? 'no-passphrase-store'\n : 'create-failed';\n return {\n status: 'skipped',\n reason,\n fix: walletFix(reason),\n ...(reason === 'create-failed'\n ? { warning: `The wallet could not be created: ${errorText(err)}` }\n : {}),\n };\n }\n}\n\n/** Is this the passphrase layer refusing because no durable store could serve? */\nfunction isNoPassphraseError(err: unknown): boolean {\n return (\n err instanceof CliError &&\n err.code === 'USAGE' &&\n err.message.includes('No wallet passphrase is available')\n );\n}\n\nfunction errorText(err: unknown): string {\n return err instanceof Error ? err.message : String(err);\n}\n\nasync function existingWalletAddress(ctx: CommandContext): Promise<string> {\n return (await describeWallet(resolveWalletProvider(ctx))).address;\n}\n\nasync function defaultCreateWallet(\n ctx: CommandContext,\n passphrase?: PassphraseOverrides,\n env?: NodeJS.ProcessEnv,\n): Promise<string> {\n const result = await runWalletCreate(ctx, {\n ...(passphrase !== undefined ? { passphrase } : {}),\n ...(env !== undefined ? { env } : {}),\n });\n return (result.data as { address: string }).address;\n}\n\n/** The shared confirm, defaulting to YES (setup ergonomics); cancel reads as no. */\nfunction defaultConfirm(label: string): Promise<boolean> {\n return confirmChoice(label, true);\n}\n\nexport const BAZAAR_QUESTION =\n 'Enable the Bazaar pay lane? x402 lets this wallet pay HTTP endpoints that answer with a priced 402, and the Bazaar (https://docs.cdp.coinbase.com/x402/bazaar) is the public catalog of them. When on, `tenjin pay` may pay Bazaar-listed non-Tenjin endpoints under your spend policy. More: https://x402.org';\n\ninterface BazaarPayOutcome {\n enabled: boolean;\n /** kept = the config already answered (never re-asked); not-asked = headless or dry run. */\n status: 'kept' | 'enabled' | 'declined' | 'not-asked';\n}\n\n/**\n * The one decision that is remembered in BOTH directions: a prompted yes or no\n * is persisted (`bazaarPay: true|false`), so the question is asked at most once\n * per machine. A headless run persists nothing, leaving the question for the\n * first interactive install. Default no: this gate opens spending at sellers\n * Tenjin does not operate.\n */\nasync function resolveBazaarPay(\n ctx: CommandContext,\n deps: InstallDeps,\n dryRun: boolean,\n canPrompt: boolean,\n existing: boolean | undefined,\n): Promise<BazaarPayOutcome> {\n if (existing !== undefined) return { enabled: existing, status: 'kept' };\n if (dryRun || !canPrompt) return { enabled: false, status: 'not-asked' };\n const confirm = deps.confirmBazaarPay ?? ((label: string) => confirmChoice(label, false));\n const yes = await confirm(BAZAAR_QUESTION);\n await persistBazaarPay(ctx.dataDir, yes);\n return { enabled: yes, status: yes ? 'enabled' : 'declined' };\n}\n\n/**\n * Doctor problems only. A fully green run prints nothing here: the summary is\n * the whole output, and \"everything checks out\" is what an absent warning means.\n *\n * The \"no wallet\" warn is dropped when the summary already carries it (#80): the\n * summary's own wallet line says `none` and names the same `tenjin wallet create`,\n * and someone who only wants `tenjin search` does not need it twice, in yellow,\n * for a wallet they were just told is optional. Every other wallet warn — a\n * keystore that will not open, an invalid TENJIN_WALLET_KEY, loose file\n * permissions — still prints, because nothing else in the output says it.\n *\n * Hence `isNoWalletCheck` rather than the check's NAME. `resolveWallet` probes for\n * a wallet FILE, so it reports no wallet for a machine whose credential is a\n * broken env key; matching on the name suppressed doctor's warning about it and\n * left the run silent about the only wallet state install cannot describe itself.\n *\n * `summaryAlreadySaysNoWallet` covers BOTH ways this run can end without one, and\n * both print the same `tenjin wallet create` pointer: `declined` (the operator\n * said no) and `skipped` (never asked, or the passphrase had nowhere to live).\n * `created` and `existing` never suppress, since there IS a wallet and any warn\n * about it is news.\n */\nfunction summaryAlreadySaysNoWallet(wallet: WalletOutcome): boolean {\n return wallet.status === 'declined' || wallet.status === 'skipped';\n}\n\nfunction doctorNotices(io: Io, doctor: DoctorChecks, wallet: WalletOutcome): string[] {\n const problems = doctor.checks.filter(\n (c) => c.status !== 'ok' && !(summaryAlreadySaysNoWallet(wallet) && isNoWalletCheck(c)),\n );\n if (problems.length === 0) return [];\n const lines = [paint(io, 'yellow', 'Some checks need attention:')];\n for (const c of problems) {\n const icon = c.status === 'fail' ? paint(io, 'red', '✗') : paint(io, 'yellow', '!');\n // Same seam as renderDoctorHuman: `detail`/`fix` carry server-sourced substrings.\n lines.push(` ${icon} ${c.name}: ${sanitizeForTerminal(c.detail)}`);\n if (c.fix !== undefined) {\n lines.push(paint(io, 'dim', ` fix: ${sanitizeForTerminal(c.fix)}`));\n }\n }\n return lines;\n}\n\n// --- Publish-mode selection (D38 setup) ------------------------------------------\n\n/**\n * The STORED default: what a `--dry-run` or a cancelled question leaves\n * `publish.mode` at, which is to say unset. A NON-INTERACTIVE run no longer lands\n * here; it settles RECOMMENDED_MODE below, because leaving the key unset made a\n * headless install the one path where the agent's publishing consent silently\n * differed from what the operator would have been shown. This value is now the\n * \"nobody chose anything and nothing was written\" answer only.\n */\nconst DEFAULT_MODE: PublishMode = CONFIG_DEFAULTS.publish.mode;\n\n/**\n * What a headless run settles on, and it is the SAME answer the interactive\n * select recommends (PUBLISH_MODE_CHOICES' initialValue), not the stored default.\n * That equality is the point: \"non-interactive is an interactive all-yes\" has to\n * be true of publishing too, or the sentence is wrong about the one decision\n * that governs what the agent puts on a public marketplace.\n */\nconst RECOMMENDED_MODE: PublishMode = 'auto';\n\n/** Decision 1's literal copy: one line of consequence per option, `auto` first. */\nexport const PUBLISH_MODE_CHOICES = [\n {\n value: 'auto',\n label: 'Auto (recommended)',\n hint: 'your agent publishes and updates pieces on its own, under your identity',\n },\n { value: 'review', label: 'Ask me in chat first' },\n { value: 'full-auto', label: 'Fully unattended', hint: 'only a hard block stops it' },\n] as const satisfies readonly { value: PublishMode; label: string; hint?: string }[];\n\nexport const PUBLISH_MODE_QUESTION = 'When your agent has something worth publishing:';\n\n/**\n * Resolve (and, for an explicit choice, persist) the publish consent mode at\n * install time. Precedence: `--publish-mode` flag > an already-configured global\n * mode > the interactive select > the headless settle > the untouched default.\n * A cancelled select and `--dry-run` write nothing and leave `publish.mode` unset\n * so its provenance stays `default`; a non-interactive run SETTLES the\n * recommended mode, which is the one case that writes without being asked.\n */\nasync function resolvePublishMode(\n flag: PublishMode | undefined,\n ctx: CommandContext,\n deps: InstallDeps,\n dryRun: boolean,\n interactive: boolean,\n): Promise<PublishModeSelection> {\n if (flag !== undefined) {\n if (!dryRun) await persistPublishMode(ctx.dataDir, flag); // --dry-run: would-set only\n return { value: flag, source: 'flag' };\n }\n\n // Only the GLOBAL config file counts as \"already configured\" for setup: env/flag\n // are per-run and a project `.tenjin.json` is not this machine's global choice.\n const config = await loadRawConfig(ctx.dataDir);\n if (config.publish?.mode !== undefined) {\n return { value: config.publish.mode, source: 'existing' };\n }\n\n // A dry run asks nothing and writes nothing, so it reports the untouched\n // default rather than the mode a real run would settle.\n if (dryRun) return { value: DEFAULT_MODE, source: 'default-skipped' };\n\n // `interactive` is the walkthrough gate (already false under --json or off a\n // TTY), so a machine consumer never sits behind a prompt. It SETTLES the\n // recommended mode rather than leaving the key unset: every other decision this\n // command makes headlessly lands on what an interactive yes would have chosen,\n // and leaving this one alone made a headless install the only path where the\n // agent's publishing consent silently differed from the one the operator was\n // shown. An already-configured mode was returned above, so this only ever\n // writes where nothing was set.\n if (!interactive) {\n await persistPublishMode(ctx.dataDir, RECOMMENDED_MODE);\n return { value: RECOMMENDED_MODE, source: 'headless-default' };\n }\n\n const answer = await (deps.promptPublishMode ?? defaultPromptPublishMode)();\n if (answer === null) return { value: DEFAULT_MODE, source: 'default-skipped' }; // cancelled: no write\n // The seam is injectable, so an answer is validated rather than trusted; an\n // unparseable one is a cancel, not a write of something unknown.\n const parsed = PublishModeSchema.safeParse(answer);\n if (!parsed.success) return { value: DEFAULT_MODE, source: 'default-skipped' };\n await persistPublishMode(ctx.dataDir, parsed.data);\n return { value: parsed.data, source: 'prompt' };\n}\n\nfunction defaultPromptPublishMode(): Promise<PublishMode | null> {\n return selectOne<PublishMode>({\n message: PUBLISH_MODE_QUESTION,\n choices: PUBLISH_MODE_CHOICES.map((c) => ({ ...c })),\n initialValue: 'auto',\n });\n}\n\nfunction parseModeFlag(value: string): PublishMode {\n return parsePublishModeFlag(value, '--publish-mode');\n}\n\n// --- Harness permissions (decision 2) ---------------------------------------------\n\n/**\n * Decision 2's literal copy: one question, and a consequence that lib/permissions.ts\n * would agree with. NOT \"read-only\" and NOT \"never touches your wallet\" — that\n * module refuses both claims in as many words (`search` and `outcome` POST\n * off-machine, `read` saves to the library and can present a cached\n * wallet-derived delegation, and two of the nine rules are `wallet show` /\n * `wallet balance`). What is actually true of the whole tier is that it cannot\n * spend and cannot move your keys, so that is what the question says.\n *\n * The pointer is how FLAG_CAVEAT reaches the consent moment: the walkthrough\n * prints neither the rules nor the flag caveat, so the yes/no that replaced them\n * names where both live in full. It used to point at `tenjin doctor`, which\n * printed them; doctor now points at the same page (#81).\n */\n/**\n * The consent moment, in two sentences and a link.\n *\n * This question used to recite the tier: a count of \"free\" commands, which of\n * them send data, what `doctor` does to the wallet, and (once the pair started\n * landing here) both rule strings verbatim. An operator meeting `Bash(tenjin\n * publish:*)` for the first time at a yes/no prompt cannot act on any of it, and\n * a prompt nobody finishes reading is not consent.\n *\n * Two facts survive, because they are the two a human can actually decide on:\n * this cannot spend their money, and on an auto mode their agent will publish\n * under their name without being asked. Everything else (the exact rules, the\n * keystore, the read+write session mint, the `--base-url` and `--yes` caveats,\n * all three undos) is unchanged one link away in docs/agent-permissions.md, and\n * in `doctor --json` and this command's `--json` envelope for an agent reading it.\n *\n * Counts come from the rule sets, so a verb added to either tier cannot make the\n * question lie.\n */\nfunction permissionsQuestionHead(mode: PublishMode): string {\n const count = rulesForPublishMode(mode).length;\n return `Let your agent use tenjin without permission popups? Adds ${count} command rules to ~/.claude/settings.json.`;\n}\n\nexport const PERMISSIONS_QUESTION = `${permissionsQuestionHead('review')} None of them can spend your money. Details: ${PERMISSIONS_DOC_URL}`;\n\n/** The same question, plus the one thing an auto mode changes about the answer. */\nexport function permissionsQuestion(mode: PublishMode): string {\n if (mode === 'review') return PERMISSIONS_QUESTION;\n return `${permissionsQuestionHead(mode)} None of them can spend your money, and on publish.mode ${mode} your agent will publish under your identity on its own. Details: ${PERMISSIONS_DOC_URL}`;\n}\n\n/** The wallet decision's literal copy. */\nexport const WALLET_QUESTION = 'Create a wallet now?';\n\n/**\n * Settle the harness allowlist. The write itself is free-verb only and cannot\n * widen (see lib/harness-permissions.ts); this decides ONLY whether to call it.\n *\n * Precedence: `--no-allow-free-verbs` refuses outright, `--allow-free-verbs`\n * wires it, an interactive run asks, and a NON-INTERACTIVE run wires it. That\n * last arm is the change #33 was really asking for: the machine most likely to be\n * denied mid-task is the headless one, and leaving it unwired because nobody was\n * there to say yes made a bare `tenjin install` produce an install that does not\n * work. The disclosure and the undo ride the output on both paths.\n *\n * INSTALLING TENJIN IS THE CONSENT for the mode-gated rules (owner call, PR #164\n * review round). The allowlist is written for the mode this run settles, on every\n * path including the headless one, and the FIRST install writes it — there is no\n * \"chosen vs defaulted\" distinction. What makes that defensible is that it is\n * DOCUMENTED, on the surface each reader is actually using. A human gets\n * `publishingLine`: what the agent will now do, in plain words, plus the one\n * command that turns it off. An agent, and any headless run, gets `modeGrant` on\n * the `--json` envelope, carrying both rule strings, the keystore sentence and\n * all three undos. docs/agent-permissions.md carries the rest. The terminal is\n * deliberately the leanest of the three (owner call): a rule string an operator\n * is meeting for the first time mid-install is not disclosure they can act on.\n * The bare CLI, with no install ever run, still defaults to `review` — install is\n * the consent anchor, so nothing is granted to someone who never ran it.\n *\n * The probe runs on EVERY path that might write, including the headless ones.\n * Nothing left to grant is not a question and not a write: it is the ordinary\n * state of a re-run, and returning the SNAPSHOT's own result is what makes a\n * re-run report `alreadyPresent` accurately instead of an empty pair. It also\n * keeps the consent gate honest, because calling the writer after a zero-pending\n * probe would re-read the file and silently re-add a rule revoked in between. An\n * unreadable file is \"unknown\", never \"already allowed\", so it falls through.\n */\nasync function resolvePermissions(args: {\n plans: HarnessPlan[];\n home: string;\n deps: InstallDeps;\n flag: boolean | undefined;\n dryRun: boolean;\n canPrompt: boolean;\n /**\n * The mode decision 1 just settled, never a raw flag or a project file: the\n * rule set follows what this install is putting the machine on, so the two\n * decisions cannot disagree.\n */\n publishMode: PublishMode;\n}): Promise<PermissionsResult> {\n const { plans, home, deps, flag, dryRun, canPrompt, publishMode } = args;\n\n // A dry run writes nothing, so it settles before the retraction rather than\n // after it: what it owes the operator is the plan, not a revocation.\n if (dryRun) return (deps.planPermissions ?? planFreeVerbAllowlist)(home, publishMode);\n\n /**\n * TIGHTENING FIRST, above every guard below, because none of them is about a\n * retraction. `--no-allow-free-verbs` declines a WRITE OF OURS; it is not a\n * request to keep a grant the operator just revoked by moving to `review`, and\n * ordering it first let `install --publish-mode review --no-allow-free-verbs`\n * write `mode: review` to config.json, leave both mode-gated rules allowed, and\n * report `skipped: declined` with a fix telling the operator to ADD rules on the\n * run where they asked to revoke. The `--harness` guard is the same shape: it\n * scopes a write to the harnesses this run targets, and a Claude rule this CLI\n * wrote is ours to reclaim whichever harness is being installed today.\n *\n * The one thing that CANNOT fall through is a file we could not read: the\n * additive writer refuses it for the same reason, so there is nothing to fall\n * through to, and the retraction's own `fix` names the pair where the writer's\n * does not.\n */\n let retractedRules: string[] = [];\n let retractedFrom: string | undefined;\n if (publishMode === 'review') {\n const retracted = await (deps.retractModeGated ?? retractModeGatedRules)(home);\n if (retracted.skipped !== undefined) return retracted;\n retractedRules = retracted.removed;\n retractedFrom = retracted.path;\n }\n\n /**\n * Carry what the retraction took back onto whatever the rest of this function\n * returns. It used to RETURN the retraction, which jumped the additive pass and\n * the legacy sweep both: a review-install on a machine holding only the pair\n * retracted them, reported \"the 9 free tenjin commands were already allowed\"\n * over a file holding none of them, left a stranded legacy rule in place, and\n * made the operator run install twice to get the tier.\n */\n const withRetraction = (result: PermissionsResult): PermissionsResult =>\n retractedRules.length === 0\n ? result\n : {\n ...result,\n removed: [...retractedRules, ...result.removed],\n // A non-Claude skip carries no `path`, deliberately: naming a Claude\n // file to a Codex-only operator points them at a file that is nothing\n // to do with their harness. Once we have RETRACTED from that file, the\n // reverse is true, and the operator needs to know which file changed.\n ...(result.path === undefined ? { path: retractedFrom } : {}),\n };\n\n // Only Claude Code has a settings file with this shape. Codex and the shared\n // Agent Skills location gate permissions elsewhere, so there is nothing here to\n // write for them, and guessing at another harness's config would be the kind of\n // uninvited write this whole module is careful about.\n const hasClaude = plans.some((p) => p.harness === 'claude');\n if (!hasClaude) {\n return withRetraction(\n permissionsSkipped(plans[0]?.harness ?? 'shared', home, 'harness-not-claude'),\n );\n }\n if (flag === false) return withRetraction(permissionsSkipped('claude', home, 'declined'));\n\n const probe = await (deps.inspectPermissions ?? inspectFreeVerbRules)(home, publishMode);\n if (probe.satisfied !== undefined) return withRetraction(probe.satisfied);\n // Nothing to GRANT, but something of ours to retract: an older version's rule\n // for a command that no longer exists, or the publish rule under a mode that\n // no longer carries it. That needs no consent — it only ever removes a rule\n // this CLI wrote — so it runs without the prompt.\n if (probe.pending !== null && probe.pending.length === 0) {\n return withRetraction(await wireFreeVerbAllowlist(home, publishMode));\n }\n\n if (flag === true || !canPrompt) {\n return withRetraction(await wireFreeVerbAllowlist(home, publishMode));\n }\n\n const confirm = deps.confirmPermissions ?? defaultConfirm;\n if (!(await confirm(permissionsQuestion(publishMode)))) {\n return withRetraction(permissionsSkipped('claude', home, 'declined'));\n }\n return withRetraction(await wireFreeVerbAllowlist(home, publishMode));\n}\n\n// --- Search hooks (decision 3) ----------------------------------------------------\n\n/**\n * The search-hook question's literal copy. It names both hooks, because they are\n * installed together and the second one is the surprising half: an operator who\n * agreed to \"check Tenjin before a web search\" has not thereby agreed to a\n * reminder at the end of every turn, so the question says both out loud.\n */\nexport const SEARCH_HOOKS_QUESTION = 'Let Tenjin ride along with your web searches?';\n\nexport const SEARCH_HOOKS_CHOICES = [\n {\n value: 'auto',\n label: 'Yes, check Tenjin first (recommended)',\n hint: `before a WebSearch or a subagent dispatch, ask ${PRODUCTION_HOST} the same question (free, anonymous, 2s budget) and mention a tested answer; the query or the first 400 chars of the prompt leaves the machine`,\n },\n {\n value: 'remind',\n label: 'Just remind me',\n hint: 'a one-line reminder, nothing sent off-machine',\n },\n { value: 'off', label: 'No hooks', hint: 'nothing is registered' },\n] as const satisfies readonly { value: WebSearchMode; label: string; hint?: string }[];\n\n/**\n * Settle the harness hooks. Same shape as the allowlist decision and the same\n * default posture: a flag settles it, an interactive run asks, and a\n * non-interactive run wires `auto` with the disclosure and undo in its output.\n *\n * The chosen mode is PERSISTED to config as BOTH `hooks.webSearch` and\n * `hooks.agentDispatch` (disjoint, both `auto` by default). One flag sets both\n * for the one-step install; `tenjin config set hooks.webSearch` or\n * `hooks.agentDispatch` can split them later without re-installing. A `--dry-run`\n * persists nothing, like the publish mode.\n */\nasync function resolveHooks(args: {\n plans: HarnessPlan[];\n home: string;\n ctx: CommandContext;\n deps: InstallDeps;\n flag: WebSearchMode | undefined;\n noHooks: boolean;\n dryRun: boolean;\n canPrompt: boolean;\n}): Promise<HooksResult> {\n const { plans, home, ctx, deps, flag, noHooks, dryRun, canPrompt } = args;\n const dataDir = ctx.dataDir;\n const rawHooks = (await loadRawConfig(dataDir)).hooks as\n | {\n webSearch?: WebSearchMode;\n searchMode?: WebSearchMode;\n agentDispatch?: WebSearchMode;\n dispatchMode?: string;\n }\n | undefined;\n const stored = rawHooks?.webSearch ?? rawHooks?.searchMode;\n const storedWebSearch = rawHooks?.webSearch ?? rawHooks?.searchMode;\n const storedAgentDispatchRaw =\n rawHooks?.agentDispatch ??\n (rawHooks?.dispatchMode === 'inherit'\n ? storedWebSearch\n : (rawHooks?.dispatchMode as WebSearchMode | undefined));\n const storedAgentDispatch =\n storedAgentDispatchRaw ?? (rawHooks?.searchMode !== undefined ? storedWebSearch : undefined);\n const storedWebSearchEff = storedWebSearch ?? DEFAULT_HOOK_MODE;\n const storedAgentDispatchEff = storedAgentDispatch ?? storedWebSearch ?? DEFAULT_HOOK_MODE;\n const hasClaude = plans.some((p) => p.harness === 'claude');\n const hasHermes = plans.some((p) => p.harness === 'hermes');\n\n if (!hasClaude && !hasHermes) {\n const harness = plans[0]?.harness ?? 'shared';\n return hooksSkipped(\n harness,\n home,\n dataDir,\n flag ?? stored ?? DEFAULT_HOOK_MODE,\n 'harness-not-claude',\n );\n }\n // `--no-hooks` is a decision about THIS RUN and writes no config, so the stored\n // mode is reported unchanged and a later bare re-run wires them. That is the\n // difference from `--search-hooks off`, which is a durable statement.\n if (noHooks) {\n return hooksSkipped(\n hasHermes ? 'hermes' : 'claude',\n home,\n dataDir,\n stored ?? DEFAULT_HOOK_MODE,\n 'declined',\n );\n }\n\n const mode = await chooseHookMode(flag, stored, deps, dryRun, canPrompt);\n // Cancelling the select is a decision NOT to decide, so it behaves exactly like\n // `--no-hooks`: nothing registered, nothing written. Every other decision in\n // this walkthrough already treats Escape that way, and this one used to be the\n // single prompt where backing out still wired and persisted a mode.\n if (mode === null) {\n return hooksSkipped(\n hasHermes ? 'hermes' : 'claude',\n home,\n dataDir,\n stored ?? DEFAULT_HOOK_MODE,\n 'declined',\n );\n }\n const resultHarness = hasHermes && !hasClaude ? 'hermes' : 'claude';\n if (dryRun) return hooksSkipped(resultHarness, home, dataDir, mode, 'dry-run');\n // Only sync agentDispatch on an explicit choice this run (flag or interactive\n // prompt). A flagless, non-interactive reinstall is just `mode = stored ?? DEFAULT`\n // and must never clobber a diverged agentDispatch (e.g. webSearch auto + agentDispatch off\n // -> flagless reinstall would otherwise silently re-enable dispatch). See A1igator R2 review.\n const isExplicitChoice = flag !== undefined || (canPrompt && !dryRun);\n const hasAnyHookKey =\n rawHooks?.webSearch !== undefined ||\n rawHooks?.agentDispatch !== undefined ||\n rawHooks?.searchMode !== undefined ||\n rawHooks?.dispatchMode !== undefined;\n const needsSync = isExplicitChoice\n ? rawHooks?.webSearch === undefined ||\n rawHooks?.agentDispatch === undefined ||\n mode !== storedWebSearchEff ||\n mode !== storedAgentDispatchEff\n : !hasAnyHookKey;\n if (needsSync) {\n await persistWebSearchHookMode(dataDir, mode);\n await persistAgentDispatchHookMode(dataDir, mode);\n }\n // `off` is a decision not to register anything, so settings.json is not touched\n // at all. It is NOT the same as an inert script: an operator who later sets the\n // mode back to `auto` re-runs install, which is what the fix string says.\n if (mode === 'off') return hooksSkipped(resultHarness, home, dataDir, mode, 'mode-off');\n if (!hasClaude) return hooksSkipped('hermes', home, dataDir, mode, 'native-harness');\n return wireSearchHooks({ homeDir: home, dataDir, mode });\n}\n\n/**\n * Whether THIS run may write Hermes hook code, read off the single hooks decision\n * so the native path can never be more permissive than Claude's.\n *\n * Only the three reasons that are an operator choice withhold it. A Claude\n * settings.json that could not be read or parsed is a Claude problem: on a machine\n * running both, it must not silently cancel the Hermes wiring as well.\n */\nfunction hermesHooksEnabled(hooks: HooksResult): boolean {\n return (\n hooks.skipped !== 'declined' &&\n hooks.skipped !== 'mode-off' &&\n hooks.skipped !== 'harness-not-claude'\n );\n}\n\n/** The stored default for a run that was never asked. */\nconst DEFAULT_HOOK_MODE: WebSearchMode = CONFIG_DEFAULTS.hooks.webSearch;\n\n/**\n * Precedence for the hook mode: `--search-hooks` > the interactive select > an\n * already-configured mode > the default.\n *\n * NULL means the operator cancelled (Escape, ctrl-C, or an answer the schema does\n * not recognize). That is not a mode and must not be resolved into one: the\n * caller treats it as `--no-hooks` for this run, registering nothing and writing\n * no config, which is what every other cancel in this walkthrough does.\n */\nasync function chooseHookMode(\n flag: WebSearchMode | undefined,\n stored: WebSearchMode | undefined,\n deps: InstallDeps,\n dryRun: boolean,\n canPrompt: boolean,\n): Promise<WebSearchMode | null> {\n if (flag !== undefined) return flag;\n if (dryRun || !canPrompt) return stored ?? DEFAULT_HOOK_MODE;\n const answer = await (deps.promptSearchHooks ?? defaultPromptSearchHooks)();\n if (answer === null) return null;\n // The seam is injectable, so an answer is validated rather than trusted; an\n // unrecognized one is a cancel, not a write of something unknown.\n const parsed = WebSearchModeSchema.safeParse(answer);\n return parsed.success ? parsed.data : null;\n}\n\nfunction defaultPromptSearchHooks(): Promise<WebSearchMode | null> {\n return selectOne<WebSearchMode>({\n message: SEARCH_HOOKS_QUESTION,\n choices: SEARCH_HOOKS_CHOICES.map((c) => ({ ...c })),\n initialValue: 'auto',\n });\n}\n\n// --- Detection + planning --------------------------------------------------------\n\ninterface HarnessPlan {\n harness: Harness;\n detected: boolean;\n detectedBy: string[];\n skillsDir: string;\n wiresAgentsMd: boolean;\n home: string;\n}\n\n/**\n * Turn detection (or an explicit --harness override) into the ordered, de-duped\n * list of targets to write. Codex and the shared fallback both land in\n * ~/.agents/skills (the harness-shared Agent Skills location), so a request for\n * both collapses to one target keyed by that directory.\n */\nfunction resolvePlans(\n override: string[] | undefined,\n home: string,\n hermesHome: string,\n which: (bin: string) => boolean,\n): HarnessPlan[] {\n if (override !== undefined && override.length > 0) {\n const plans = override.map((v) =>\n planFor(validateHarness(v), ['override'], true, home, hermesHome),\n );\n return dedupeBySkillsDir(plans);\n }\n\n const plans: HarnessPlan[] = [];\n // Same two probes doctor's skills check gates its per-directory verdicts on.\n const claudeBy = harnessDetectedBy(home, 'claude', which, hermesHome);\n const codexBy = harnessDetectedBy(home, 'codex', which, hermesHome);\n const hermesBy = harnessDetectedBy(home, 'hermes', which, hermesHome);\n if (claudeBy.length > 0) plans.push(planFor('claude', claudeBy, true, home, hermesHome));\n if (codexBy.length > 0) plans.push(planFor('codex', codexBy, true, home, hermesHome));\n if (hermesBy.length > 0) plans.push(planFor('hermes', hermesBy, true, home, hermesHome));\n if (plans.length === 0) {\n // Nothing detected: the shared Agent Skills location is the fallback target, so\n // a harness installed later still finds the skills.\n plans.push(planFor('shared', ['fallback'], false, home, hermesHome));\n }\n return dedupeBySkillsDir(plans);\n}\n\nfunction planFor(\n harness: Harness,\n detectedBy: string[],\n detected: boolean,\n home: string,\n hermesHome: string,\n): HarnessPlan {\n const skillsDir = harnessTargetDir(home, harness, hermesHome);\n return {\n harness,\n detected,\n detectedBy,\n skillsDir,\n wiresAgentsMd: harness !== 'claude' && harness !== 'hermes',\n home,\n };\n}\n\nfunction dedupeBySkillsDir(plans: HarnessPlan[]): HarnessPlan[] {\n const seen = new Set<string>();\n const out: HarnessPlan[] = [];\n for (const p of plans) {\n if (seen.has(p.skillsDir)) continue;\n seen.add(p.skillsDir);\n out.push(p);\n }\n return out;\n}\n\nfunction validateHarness(value: string): Harness {\n if ((HARNESSES as readonly string[]).includes(value)) return value as Harness;\n throw new CliError('USAGE', `Unknown harness \"${value}\"`, {\n fix: `--harness must be one of: ${HARNESSES.join(', ')}.`,\n });\n}\n\n// --- Applying a plan -------------------------------------------------------------\n\n/**\n * Wire one harness target. EVERY packaged skill is written on every run,\n * unconditionally: an existing Tenjin skill in the target (typically the hosted\n * zero-install one from tenjin.blog/skills.md) is never a reason to skip, because\n * install on such a machine is the UPGRADE path (#35). The hosted mirror is kept\n * and refreshed rather than removed (roadmap G4: it is the permanent zero-install\n * curriculum); the two CLI adapter skills land beside it and supersede it while\n * the CLI is present.\n */\nasync function applyPlan(\n plan: HarnessPlan,\n skillsSource: string,\n dryRun: boolean,\n): Promise<HarnessResult> {\n const skills: SkillResult[] = [];\n const warnings: string[] = [];\n for (const name of SKILL_NAMES) {\n const { status, warning, preexisting } = await installSkill(\n join(skillsSource, name),\n join(plan.skillsDir, name),\n dryRun,\n name,\n );\n skills.push({\n name,\n status,\n preexisting,\n cli: (CLI_SKILL_NAMES as readonly string[]).includes(name),\n modelInvocable: await landedInvocable(plan.skillsDir, skillsSource, name, dryRun),\n });\n if (warning !== undefined) warnings.push(warning);\n }\n\n const hostedPreexisting = skills.some((s) => s.name === HOSTED_SKILL_NAME && s.preexisting);\n // The notice is about arriving through the hosted skill, which is only news when\n // the CLI adapters were NOT already wired: after an earlier install the mirror on\n // disk is one we wrote, and announcing it is the CLI reporting its own footprint.\n const hostedArrivedFirst = hostedPreexisting && !skills.some((s) => s.cli && s.preexisting);\n const result: HarnessResult = {\n harness: plan.harness,\n detected: plan.detected,\n detectedBy: plan.detectedBy,\n skillsDir: plan.skillsDir,\n skills,\n hostedPreexisting,\n hostedArrivedFirst,\n notes: notesFor(plan, hostedArrivedFirst),\n warnings,\n };\n\n if (plan.wiresAgentsMd) result.codexNetworkRule = CODEX_NETWORK_RULE;\n return result;\n}\n\nfunction notesFor(plan: HarnessPlan, hostedArrivedFirst: boolean): string[] {\n const notes =\n plan.harness === 'claude'\n ? [\n 'Installed at the user level (~/.claude/skills). A Claude Code plugin will later make this automatic.',\n ]\n : [\n 'Copied into the shared Agent Skills location (~/.agents/skills). Codex and any Agent-Skills-compatible harness read it there.',\n ];\n if (hostedArrivedFirst) {\n // \"The skill stays\", never \"your copy is untouched\": the FILE is replaced by\n // this package's mirror, and a note reading as preservation beside a warning\n // saying replacement is worse than either alone.\n notes.push(\n `The hosted ${HOSTED_SKILL_NAME} skill was already here; the skill stays as the zero-install fallback (its file is replaced by this package's mirror) and the CLI skills (${CLI_SKILL_NAMES.join(', ')}) take precedence while the CLI is installed.`,\n );\n }\n return notes;\n}\n\n/**\n * Did the skill actually land model-invocable? Read back from the target so the\n * reported value is the file a harness will read, not what we intended to write.\n * A dry run wrote nothing, so it READS THE PACKAGED SOURCE — the file that would\n * land. Hardcoding `true` there was wrong for the one skill whose value can\n * legitimately be false: `assertSkillsSource` exempts the hosted mirror from the\n * invocability assertion, so a shadowed mirror ships and must report as shadowed on\n * both paths.\n */\nasync function landedInvocable(\n skillsDir: string,\n skillsSource: string,\n name: string,\n dryRun: boolean,\n): Promise<boolean> {\n // Guarded like every other read of this path. It is read back AFTER the write, so\n // an external writer can have swapped it for a pipe or a device in between, and a\n // raw read there would hang the command that just finished its work.\n const read = await readSkillFile(join(dryRun ? skillsSource : skillsDir, name, 'SKILL.md'));\n if (read.kind !== 'ok') return false;\n return !isModelInvocationDisabled(read.bytes.toString('utf8'));\n}\n\n/**\n * Every packaged skill landed in every target. Runs after ALL targets are written,\n * never mid-loop: a throw between two targets would leave target 1 rewritten and\n * target 2 untouched. (It still sits ahead of the doctor run, the publish-mode\n * question and the wallet step, so a throw here skips those either way.)\n *\n * Presence only. Whether a skill is model-invocable is a property of the PACKAGED\n * source, checked up front by `assertSkillsSource` before anything is written.\n */\nasync function assertSkillsLanded(plans: HarnessPlan[], dryRun: boolean): Promise<void> {\n if (dryRun) return;\n const missing: string[] = [];\n for (const plan of plans) {\n for (const name of SKILL_NAMES) {\n if (!existsSync(join(plan.skillsDir, name, 'SKILL.md'))) {\n missing.push(join(plan.skillsDir, name));\n }\n }\n }\n if (missing.length === 0) return;\n throw new CliError('INTERNAL', `Skills were not written: ${missing.join(', ')}`, {\n // Safe to point at permissions because nothing removes a landed file any more:\n // each shipped file arrives by its own atomic rename. When this was a\n // rm-then-write it also fired on a lost race, and sent people to chmod a\n // directory that was fine.\n fix: `Check that you can write to the skills directory (\\`ls -ld ${dirname(missing[0] ?? '')}\\`), then re-run \\`tenjin install\\`.`,\n });\n}\n\n// --- Human rendering -------------------------------------------------------------\n\nfunction paint(io: Io, format: Parameters<typeof styleText>[0], text: string): string {\n if (io.stdout instanceof Stream) return styleText(format, text, { stream: io.stdout });\n return styleText(format, text);\n}\n\n// --- Skills source guard ---------------------------------------------------------\n\n/**\n * Guard the packaged source BEFORE any target is touched, so a bad package aborts\n * with nothing written rather than mid-copy.\n *\n * The model-invocable assertion covers only CLI_SKILL_NAMES. The hosted `tenjin`\n * mirror is written verbatim from tenjin.blog/skills.md by scripts/sync-skill.mjs\n * and its frontmatter is not authored here: if upstream ever adds\n * `disable-model-invocation: true` (a plausible way to say \"prefer the CLI\n * skills\"), asserting on it would hard-fail every install with a fix that cannot\n * work, and skill-drift.yml would stay green because the mirror still matches\n * upstream. Doctor warns about the mirror instead.\n */\nasync function assertSkillsSource(dir: string): Promise<void> {\n for (const name of SKILL_NAMES) {\n if (!existsSync(join(dir, name, 'SKILL.md'))) {\n throw new CliError('INTERNAL', `Packaged skill \"${name}\" is missing under ${dir}`, {\n fix: 'Reinstall tenjin-cli; the published package must ship every skill under skills/.',\n });\n }\n }\n for (const name of CLI_SKILL_NAMES) {\n const text = await readFile(join(dir, name, 'SKILL.md'), 'utf8');\n if (isModelInvocationDisabled(text)) {\n throw new CliError(\n 'INTERNAL',\n `Packaged skill \"${name}\" carries disable-model-invocation: true, so no harness would surface it`,\n {\n fix: 'Reinstall tenjin-cli; the published CLI skills must be model-invocable.',\n },\n );\n }\n }\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,SAAS,kBAAkB;AAC3B,SAAS,gBAAgB;AACzB,SAAS,qBAAqB;AAC9B,SAAS,SAAS,YAAY,YAAY;AAC1C,SAAS,eAAe;AAExB,SAAS,iBAAiB;AAC1B,SAAS,cAAc;AAoEvB,IAAM,YAAY;AAGlB,IAAM,qBAAqB,iBAAE,OAAO;AAAA,EAClC,SAAS,iBAAE,MAAM,iBAAE,OAAO,CAAC,EAAE,SAAS;AAAA,EACtC,QAAQ,iBAAE,QAAQ,EAAE,SAAS;AAAA,EAC7B,aAAa,iBAAE,OAAO,EAAE,SAAS;AAAA,EACjC,UAAU,iBAAE,QAAQ,EAAE,SAAS;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,EAO/B,UAAU,iBAAE,QAAQ,EAAE,SAAS;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,E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ETED
|
@@ -1,24 +0,0 @@
|
|
|
1
|
-
import { createRequire as __tenjinCreateRequire } from 'node:module'; const require = __tenjinCreateRequire(import.meta.url);
|
|
2
|
-
import {
|
|
3
|
-
runOutcome
|
|
4
|
-
} from "./chunk-WY2K35OL.js";
|
|
5
|
-
import "./chunk-65DTCCJ7.js";
|
|
6
|
-
import "./chunk-ITUXPJIS.js";
|
|
7
|
-
import "./chunk-EDZSNPE5.js";
|
|
8
|
-
import "./chunk-5QQTYWEU.js";
|
|
9
|
-
import "./chunk-OLWTRUTS.js";
|
|
10
|
-
import "./chunk-VYOJOX4Z.js";
|
|
11
|
-
import "./chunk-EFWZPUTC.js";
|
|
12
|
-
import "./chunk-U6VPKMGC.js";
|
|
13
|
-
import "./chunk-UO22YNY4.js";
|
|
14
|
-
import "./chunk-A5DKHMUN.js";
|
|
15
|
-
import "./chunk-3GL2Z5QK.js";
|
|
16
|
-
import "./chunk-JBIKAAT3.js";
|
|
17
|
-
import "./chunk-2MYQN7HM.js";
|
|
18
|
-
import "./chunk-ZOBNS7CX.js";
|
|
19
|
-
import "./chunk-ZFJJ3EXC.js";
|
|
20
|
-
import "./chunk-ZXTAQYNA.js";
|
|
21
|
-
export {
|
|
22
|
-
runOutcome
|
|
23
|
-
};
|
|
24
|
-
//# sourceMappingURL=outcome-KSGWZHUS.js.map
|