tenjin-cli 0.1.0-alpha.1 → 0.1.0-alpha.11
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/NOTICE.md +33 -0
- package/README.md +596 -79
- package/dist/{_esm-ZH2J4QEH.js → _esm-C5CRWCYU.js} +2 -2
- package/dist/_esm-N4KAVXQR.js +881 -0
- package/dist/buy-THMVOPUH.js +44 -0
- package/dist/ccip-RPPPKTJR.js +19 -0
- package/dist/{ccip-UCLT5VOW.js → ccip-ZGGWQN4X.js} +6 -5
- package/dist/chunk-2I4QTOLB.js +11 -0
- package/dist/chunk-2I4QTOLB.js.map +1 -0
- package/dist/chunk-2SDUV6MQ.js +352 -0
- package/dist/chunk-2SDUV6MQ.js.map +1 -0
- package/dist/chunk-3GSZUADW.js +199 -0
- package/dist/chunk-3GSZUADW.js.map +1 -0
- package/dist/{chunk-BRJHUQSY.js → chunk-47PP7TAG.js} +908 -812
- package/dist/chunk-47PP7TAG.js.map +1 -0
- package/dist/chunk-4NTZETIL.js +158 -0
- package/dist/chunk-4NTZETIL.js.map +1 -0
- package/dist/chunk-4TCU3YRD.js +130 -0
- package/dist/chunk-4TCU3YRD.js.map +1 -0
- package/dist/chunk-6BGYHARE.js +14620 -0
- package/dist/chunk-6BGYHARE.js.map +1 -0
- package/dist/chunk-6UY2UQMY.js +213 -0
- package/dist/chunk-6UY2UQMY.js.map +1 -0
- package/dist/{chunk-IPOWB3G3.js → chunk-7FK2UN2T.js} +3515 -507
- package/dist/chunk-7FK2UN2T.js.map +1 -0
- package/dist/chunk-ALUNME53.js +306 -0
- package/dist/chunk-ALUNME53.js.map +1 -0
- package/dist/{chunk-EXBMF5X7.js → chunk-CNUXRXI2.js} +526 -79
- package/dist/chunk-CNUXRXI2.js.map +1 -0
- package/dist/chunk-E6YOODH7.js +913 -0
- package/dist/chunk-E6YOODH7.js.map +1 -0
- package/dist/chunk-EDVI7RRD.js +317 -0
- package/dist/chunk-EDVI7RRD.js.map +1 -0
- package/dist/chunk-FKSAUOJU.js +137 -0
- package/dist/chunk-FKSAUOJU.js.map +1 -0
- package/dist/chunk-GKV6VZSZ.js +125 -0
- package/dist/chunk-GKV6VZSZ.js.map +1 -0
- package/dist/chunk-GUUAYR3K.js +175 -0
- package/dist/chunk-GUUAYR3K.js.map +1 -0
- package/dist/chunk-IAFYUFIC.js +1408 -0
- package/dist/chunk-IAFYUFIC.js.map +1 -0
- package/dist/chunk-IB63U6BM.js +185 -0
- package/dist/chunk-IB63U6BM.js.map +1 -0
- package/dist/chunk-IXTENA2H.js +235 -0
- package/dist/chunk-IXTENA2H.js.map +1 -0
- package/dist/chunk-JTYIX6OD.js +161 -0
- package/dist/chunk-JTYIX6OD.js.map +1 -0
- package/dist/chunk-KYQVEKP5.js +209 -0
- package/dist/chunk-KYQVEKP5.js.map +1 -0
- package/dist/chunk-KZAAWQNP.js +6199 -0
- package/dist/chunk-KZAAWQNP.js.map +1 -0
- package/dist/{chunk-T4LKNY7T.js → chunk-M2O56UK7.js} +225 -70
- package/dist/chunk-M2O56UK7.js.map +1 -0
- package/dist/chunk-MJZZTKCC.js +323 -0
- package/dist/chunk-MJZZTKCC.js.map +1 -0
- package/dist/chunk-NUF2PKJO.js +207 -0
- package/dist/chunk-NUF2PKJO.js.map +1 -0
- package/dist/chunk-O25VWJCG.js +1357 -0
- package/dist/chunk-O25VWJCG.js.map +1 -0
- package/dist/chunk-OCN27NJV.js +612 -0
- package/dist/chunk-OCN27NJV.js.map +1 -0
- package/dist/chunk-OZHJ3FLR.js +105 -0
- package/dist/chunk-OZHJ3FLR.js.map +1 -0
- package/dist/chunk-P74I3WH4.js +204 -0
- package/dist/chunk-P74I3WH4.js.map +1 -0
- package/dist/chunk-POJRB2AE.js +83 -0
- package/dist/chunk-POJRB2AE.js.map +1 -0
- package/dist/{chunk-YG2DO46P.js → chunk-PZRAAAY2.js} +107 -22
- package/dist/chunk-PZRAAAY2.js.map +1 -0
- package/dist/chunk-PZSUWDF2.js +35 -0
- package/dist/chunk-PZSUWDF2.js.map +1 -0
- package/dist/chunk-QW2Q2KAH.js +27 -0
- package/dist/chunk-QW2Q2KAH.js.map +1 -0
- package/dist/{chunk-CUWUHTIL.js → chunk-RBJPAZFI.js} +16 -202
- package/dist/chunk-RBJPAZFI.js.map +1 -0
- package/dist/chunk-RSBN67PA.js +152 -0
- package/dist/chunk-RSBN67PA.js.map +1 -0
- package/dist/chunk-S5RYMCV6.js +70 -0
- package/dist/chunk-S5RYMCV6.js.map +1 -0
- package/dist/chunk-SFGXAZ3M.js +316 -0
- package/dist/chunk-SFGXAZ3M.js.map +1 -0
- package/dist/chunk-SGK2B724.js +67 -0
- package/dist/chunk-SGK2B724.js.map +1 -0
- package/dist/chunk-TDDN5GXR.js +145 -0
- package/dist/chunk-TDDN5GXR.js.map +1 -0
- package/dist/{chunk-LPRVHM7P.js → chunk-U5S527PP.js} +1655 -114
- package/dist/chunk-U5S527PP.js.map +1 -0
- package/dist/chunk-UFPJBS4C.js +242 -0
- package/dist/chunk-UFPJBS4C.js.map +1 -0
- package/dist/chunk-UHTVXQ2O.js +140 -0
- package/dist/chunk-UHTVXQ2O.js.map +1 -0
- package/dist/chunk-UY6CGULW.js +83 -0
- package/dist/chunk-UY6CGULW.js.map +1 -0
- package/dist/chunk-VWY3U732.js +674 -0
- package/dist/chunk-VWY3U732.js.map +1 -0
- package/dist/{chunk-Q53IYV2G.js → chunk-W6R3HAAG.js} +20 -17
- package/dist/{chunk-Q53IYV2G.js.map → chunk-W6R3HAAG.js.map} +1 -1
- package/dist/chunk-XJN5WUKL.js +204 -0
- package/dist/chunk-XJN5WUKL.js.map +1 -0
- package/dist/chunk-XWHXX2BI.js +149 -0
- package/dist/chunk-XWHXX2BI.js.map +1 -0
- package/dist/{chunk-DXPYFVKG.js → chunk-Y7ERTA7D.js} +35 -15
- package/dist/chunk-Y7ERTA7D.js.map +1 -0
- package/dist/chunk-YLYINX2H.js +7806 -0
- package/dist/chunk-YLYINX2H.js.map +1 -0
- package/dist/chunk-ZE7KOO7A.js +233 -0
- package/dist/chunk-ZE7KOO7A.js.map +1 -0
- package/dist/chunk-ZQIQ55KK.js +51 -0
- package/dist/chunk-ZQIQ55KK.js.map +1 -0
- package/dist/{chunk-3IMLRUZE.js → chunk-ZXTAQYNA.js} +6 -2
- package/dist/{cli-WA65NP4Y.js → cli-Y2HBOSGK.js} +437 -175
- package/dist/cli-Y2HBOSGK.js.map +1 -0
- package/dist/config-WDGMZKHU.js +26 -0
- package/dist/config-WDGMZKHU.js.map +1 -0
- package/dist/dist-U4M6QCKE.js +2842 -0
- package/dist/dist-U4M6QCKE.js.map +1 -0
- package/dist/doctor-CSIWKWM2.js +27 -0
- package/dist/doctor-CSIWKWM2.js.map +1 -0
- package/dist/edit-E7N6F3OY.js +38 -0
- package/dist/edit-E7N6F3OY.js.map +1 -0
- package/dist/ethersCompat-Df4a6QIZ-WHYKB6HA.js +18 -0
- package/dist/ethersCompat-Df4a6QIZ-WHYKB6HA.js.map +1 -0
- package/dist/fund-OKK627GL.js +38 -0
- package/dist/fund-OKK627GL.js.map +1 -0
- package/dist/index.js +1 -1
- package/dist/inspect-573WHEV4.js +35 -0
- package/dist/inspect-573WHEV4.js.map +1 -0
- package/dist/install-SQAYMNQC.js +1134 -0
- package/dist/install-SQAYMNQC.js.map +1 -0
- package/dist/{mine.wasm-GQECMSGN.js → mine.wasm-6PIT3DK6.js} +2 -2
- package/dist/outcome-W3KYGF23.js +22 -0
- package/dist/outcome-W3KYGF23.js.map +1 -0
- package/dist/publish-N5U4XYVA.js +40 -0
- package/dist/publish-N5U4XYVA.js.map +1 -0
- package/dist/read-PJ7Z6UGF.js +158 -0
- package/dist/read-PJ7Z6UGF.js.map +1 -0
- package/dist/run-FSO3MMXN.js +16883 -0
- package/dist/run-FSO3MMXN.js.map +1 -0
- package/dist/search-ZWOP4EGK.js +23 -0
- package/dist/search-ZWOP4EGK.js.map +1 -0
- package/dist/{secp256k1-BEZS642W.js → secp256k1-XRPVBC6V.js} +5 -4
- package/dist/secp256k1-XRPVBC6V.js.map +1 -0
- package/dist/send-F34ZDXDZ.js +223 -0
- package/dist/send-F34ZDXDZ.js.map +1 -0
- package/dist/session-4N4ZT3AH.js +88 -0
- package/dist/session-4N4ZT3AH.js.map +1 -0
- package/dist/skill-heal-XBEK272G.js +85 -0
- package/dist/skill-heal-XBEK272G.js.map +1 -0
- package/dist/uninstall-BTKPHPDL.js +68 -0
- package/dist/uninstall-BTKPHPDL.js.map +1 -0
- package/dist/usdc-4VCDHFWX.js +38 -0
- package/dist/usdc-4VCDHFWX.js.map +1 -0
- package/dist/viemAdapter-By13KInL-TUQJBMHM.js +14 -0
- package/dist/viemAdapter-By13KInL-TUQJBMHM.js.map +1 -0
- package/dist/wallet-UL4P2JRO.js +42 -0
- package/dist/wallet-UL4P2JRO.js.map +1 -0
- package/dist/wallet-WJ6UP5OU.js +32 -0
- package/dist/wallet-WJ6UP5OU.js.map +1 -0
- package/docs/agent-permissions.md +294 -0
- package/package.json +25 -18
- package/skills/tenjin/SKILL.md +364 -0
- package/skills/tenjin-publish/SKILL.md +232 -0
- package/skills/tenjin-search/SKILL.md +341 -0
- package/dist/chunk-BRJHUQSY.js.map +0 -1
- package/dist/chunk-CUWUHTIL.js.map +0 -1
- package/dist/chunk-DXPYFVKG.js.map +0 -1
- package/dist/chunk-EXBMF5X7.js.map +0 -1
- package/dist/chunk-EZROUI5U.js +0 -135
- package/dist/chunk-EZROUI5U.js.map +0 -1
- package/dist/chunk-IPOWB3G3.js.map +0 -1
- package/dist/chunk-LPRVHM7P.js.map +0 -1
- package/dist/chunk-T4LKNY7T.js.map +0 -1
- package/dist/chunk-YBMMV4Y4.js +0 -51
- package/dist/chunk-YBMMV4Y4.js.map +0 -1
- package/dist/chunk-YG2DO46P.js.map +0 -1
- package/dist/chunk-ZPZFPVDN.js +0 -67
- package/dist/chunk-ZPZFPVDN.js.map +0 -1
- package/dist/cli-WA65NP4Y.js.map +0 -1
- package/dist/config-CEFTL5ZL.js +0 -164
- package/dist/config-CEFTL5ZL.js.map +0 -1
- package/dist/doctor-3QBYN46N.js +0 -338
- package/dist/doctor-3QBYN46N.js.map +0 -1
- package/dist/usdc-44R6XZF2.js +0 -18
- package/dist/wallet-ELBTBMXO.js +0 -20
- package/dist/wallet-XD576HF3.js +0 -173
- package/dist/wallet-XD576HF3.js.map +0 -1
- /package/dist/{_esm-ZH2J4QEH.js.map → _esm-C5CRWCYU.js.map} +0 -0
- /package/dist/{ccip-UCLT5VOW.js.map → _esm-N4KAVXQR.js.map} +0 -0
- /package/dist/{chunk-3IMLRUZE.js.map → buy-THMVOPUH.js.map} +0 -0
- /package/dist/{secp256k1-BEZS642W.js.map → ccip-RPPPKTJR.js.map} +0 -0
- /package/dist/{usdc-44R6XZF2.js.map → ccip-ZGGWQN4X.js.map} +0 -0
- /package/dist/{wallet-ELBTBMXO.js.map → chunk-ZXTAQYNA.js.map} +0 -0
- /package/dist/{mine.wasm-GQECMSGN.js.map → mine.wasm-6PIT3DK6.js.map} +0 -0
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
import { createRequire as __tenjinCreateRequire } from 'node:module'; const require = __tenjinCreateRequire(import.meta.url);
|
|
2
|
+
import {
|
|
3
|
+
runBuy
|
|
4
|
+
} from "./chunk-O25VWJCG.js";
|
|
5
|
+
import "./chunk-QW2Q2KAH.js";
|
|
6
|
+
import "./chunk-OZHJ3FLR.js";
|
|
7
|
+
import "./chunk-ZE7KOO7A.js";
|
|
8
|
+
import "./chunk-SGK2B724.js";
|
|
9
|
+
import "./chunk-6UY2UQMY.js";
|
|
10
|
+
import "./chunk-4NTZETIL.js";
|
|
11
|
+
import "./chunk-EDVI7RRD.js";
|
|
12
|
+
import "./chunk-6BGYHARE.js";
|
|
13
|
+
import "./chunk-S5RYMCV6.js";
|
|
14
|
+
import "./chunk-POJRB2AE.js";
|
|
15
|
+
import "./chunk-YLYINX2H.js";
|
|
16
|
+
import "./chunk-MJZZTKCC.js";
|
|
17
|
+
import "./chunk-CNUXRXI2.js";
|
|
18
|
+
import "./chunk-3GSZUADW.js";
|
|
19
|
+
import "./chunk-UY6CGULW.js";
|
|
20
|
+
import "./chunk-PZSUWDF2.js";
|
|
21
|
+
import "./chunk-Y7ERTA7D.js";
|
|
22
|
+
import "./chunk-KZAAWQNP.js";
|
|
23
|
+
import "./chunk-IB63U6BM.js";
|
|
24
|
+
import "./chunk-JTYIX6OD.js";
|
|
25
|
+
import "./chunk-FKSAUOJU.js";
|
|
26
|
+
import "./chunk-ALUNME53.js";
|
|
27
|
+
import "./chunk-ZQIQ55KK.js";
|
|
28
|
+
import "./chunk-P74I3WH4.js";
|
|
29
|
+
import "./chunk-2I4QTOLB.js";
|
|
30
|
+
import "./chunk-PZRAAAY2.js";
|
|
31
|
+
import "./chunk-7FK2UN2T.js";
|
|
32
|
+
import "./chunk-M2O56UK7.js";
|
|
33
|
+
import "./chunk-UHTVXQ2O.js";
|
|
34
|
+
import "./chunk-W6R3HAAG.js";
|
|
35
|
+
import "./chunk-U5S527PP.js";
|
|
36
|
+
import "./chunk-47PP7TAG.js";
|
|
37
|
+
import "./chunk-XJN5WUKL.js";
|
|
38
|
+
import "./chunk-RBJPAZFI.js";
|
|
39
|
+
import "./chunk-KYQVEKP5.js";
|
|
40
|
+
import "./chunk-ZXTAQYNA.js";
|
|
41
|
+
export {
|
|
42
|
+
runBuy
|
|
43
|
+
};
|
|
44
|
+
//# sourceMappingURL=buy-THMVOPUH.js.map
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import { createRequire as __tenjinCreateRequire } from 'node:module'; const require = __tenjinCreateRequire(import.meta.url);
|
|
2
|
+
import {
|
|
3
|
+
ccipRequest,
|
|
4
|
+
offchainLookup,
|
|
5
|
+
offchainLookupAbiItem,
|
|
6
|
+
offchainLookupSignature
|
|
7
|
+
} from "./chunk-U5S527PP.js";
|
|
8
|
+
import "./chunk-47PP7TAG.js";
|
|
9
|
+
import "./chunk-XJN5WUKL.js";
|
|
10
|
+
import "./chunk-RBJPAZFI.js";
|
|
11
|
+
import "./chunk-KYQVEKP5.js";
|
|
12
|
+
import "./chunk-ZXTAQYNA.js";
|
|
13
|
+
export {
|
|
14
|
+
ccipRequest,
|
|
15
|
+
offchainLookup,
|
|
16
|
+
offchainLookupAbiItem,
|
|
17
|
+
offchainLookupSignature
|
|
18
|
+
};
|
|
19
|
+
//# sourceMappingURL=ccip-RPPPKTJR.js.map
|
|
@@ -4,14 +4,15 @@ import {
|
|
|
4
4
|
offchainLookup,
|
|
5
5
|
offchainLookupAbiItem,
|
|
6
6
|
offchainLookupSignature
|
|
7
|
-
} from "./chunk-
|
|
8
|
-
import "./chunk-
|
|
9
|
-
import "./chunk-
|
|
10
|
-
import "./chunk-
|
|
7
|
+
} from "./chunk-KZAAWQNP.js";
|
|
8
|
+
import "./chunk-XJN5WUKL.js";
|
|
9
|
+
import "./chunk-RBJPAZFI.js";
|
|
10
|
+
import "./chunk-KYQVEKP5.js";
|
|
11
|
+
import "./chunk-ZXTAQYNA.js";
|
|
11
12
|
export {
|
|
12
13
|
ccipRequest,
|
|
13
14
|
offchainLookup,
|
|
14
15
|
offchainLookupAbiItem,
|
|
15
16
|
offchainLookupSignature
|
|
16
17
|
};
|
|
17
|
-
//# sourceMappingURL=ccip-
|
|
18
|
+
//# sourceMappingURL=ccip-ZGGWQN4X.js.map
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import { createRequire as __tenjinCreateRequire } from 'node:module'; const require = __tenjinCreateRequire(import.meta.url);
|
|
2
|
+
|
|
3
|
+
// src/lib/errno.ts
|
|
4
|
+
function hasCode(err, code) {
|
|
5
|
+
return typeof err === "object" && err !== null && "code" in err && err.code === code;
|
|
6
|
+
}
|
|
7
|
+
|
|
8
|
+
export {
|
|
9
|
+
hasCode
|
|
10
|
+
};
|
|
11
|
+
//# sourceMappingURL=chunk-2I4QTOLB.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../src/lib/errno.ts"],"sourcesContent":["/**\n * True when `err` is a Node system error carrying the given `code` (ENOENT,\n * EEXIST, …). One definition so the fs-error checks scattered across the wallet\n * store, config loader, and session cache stay identical.\n */\nexport function hasCode(err: unknown, code: string): boolean {\n return (\n typeof err === 'object' &&\n err !== null &&\n 'code' in err &&\n (err as { code?: unknown }).code === code\n );\n}\n"],"mappings":";;;AAKO,SAAS,QAAQ,KAAc,MAAuB;AAC3D,SACE,OAAO,QAAQ,YACf,QAAQ,QACR,UAAU,OACT,IAA2B,SAAS;AAEzC;","names":[]}
|
|
@@ -0,0 +1,352 @@
|
|
|
1
|
+
import { createRequire as __tenjinCreateRequire } from 'node:module'; const require = __tenjinCreateRequire(import.meta.url);
|
|
2
|
+
import {
|
|
3
|
+
EXCERPT_MAX_LENGTH,
|
|
4
|
+
PUBLISH_STATUSES,
|
|
5
|
+
dedupeFindings,
|
|
6
|
+
deriveCard,
|
|
7
|
+
deriveProjectMarkers,
|
|
8
|
+
describeFindings,
|
|
9
|
+
localCardEligibility,
|
|
10
|
+
missingSentences,
|
|
11
|
+
needsConfirmation,
|
|
12
|
+
parseAppliesToFlags,
|
|
13
|
+
parseFrontmatter,
|
|
14
|
+
publicFinding,
|
|
15
|
+
publishPost,
|
|
16
|
+
resolveWriteAuth,
|
|
17
|
+
scan,
|
|
18
|
+
writeModeNotices
|
|
19
|
+
} from "./chunk-IAFYUFIC.js";
|
|
20
|
+
import {
|
|
21
|
+
headingOutline
|
|
22
|
+
} from "./chunk-SGK2B724.js";
|
|
23
|
+
import {
|
|
24
|
+
loadSearches,
|
|
25
|
+
markSearchResolved
|
|
26
|
+
} from "./chunk-4NTZETIL.js";
|
|
27
|
+
import {
|
|
28
|
+
describeWallet,
|
|
29
|
+
resolveWalletProvider
|
|
30
|
+
} from "./chunk-CNUXRXI2.js";
|
|
31
|
+
import {
|
|
32
|
+
trimSlash
|
|
33
|
+
} from "./chunk-PZSUWDF2.js";
|
|
34
|
+
import {
|
|
35
|
+
sanitizeForTerminal,
|
|
36
|
+
sanitizeWireText
|
|
37
|
+
} from "./chunk-IB63U6BM.js";
|
|
38
|
+
import {
|
|
39
|
+
resolveContextSettings,
|
|
40
|
+
resolvePublishSettings
|
|
41
|
+
} from "./chunk-JTYIX6OD.js";
|
|
42
|
+
import {
|
|
43
|
+
UUID_RE,
|
|
44
|
+
parsePublishModeFlag,
|
|
45
|
+
parseUsdToAtomic,
|
|
46
|
+
toMoney
|
|
47
|
+
} from "./chunk-ALUNME53.js";
|
|
48
|
+
import {
|
|
49
|
+
CliError
|
|
50
|
+
} from "./chunk-PZRAAAY2.js";
|
|
51
|
+
|
|
52
|
+
// src/commands/publish.ts
|
|
53
|
+
import { readFile } from "fs/promises";
|
|
54
|
+
import { dirname, resolve } from "path";
|
|
55
|
+
async function runPublish(args, ctx, deps = {}) {
|
|
56
|
+
const env = deps.env ?? process.env;
|
|
57
|
+
const cwd = deps.cwd ?? process.cwd();
|
|
58
|
+
if (args.mode !== void 0) parsePublishModeFlag(args.mode, "--mode");
|
|
59
|
+
validateSearchId(args);
|
|
60
|
+
const raw = await readSource(args);
|
|
61
|
+
const storedSearch = args.searchId !== void 0 ? (await loadSearches(ctx.dataDir)).find((s) => s.searchId === args.searchId) ?? null : null;
|
|
62
|
+
const { frontmatter, body } = parseFrontmatter(raw);
|
|
63
|
+
const status = resolveStatus(args, frontmatter);
|
|
64
|
+
const title = resolveTitle(frontmatter, body);
|
|
65
|
+
const tags = resolveTags(frontmatter);
|
|
66
|
+
const excerpt = resolveExcerpt(args, frontmatter);
|
|
67
|
+
const handle = expectString(frontmatter, "handle");
|
|
68
|
+
const cardFlags = cardFlagsFrom(args);
|
|
69
|
+
const wanted = storedSearch?.question;
|
|
70
|
+
const prefillQuestion = wanted === void 0 ? void 0 : cardQuestion(wanted);
|
|
71
|
+
const roomForPrefill = cardFlags.question === void 0 && frontmatter.questionsAnswered === void 0;
|
|
72
|
+
if (prefillQuestion !== void 0 && roomForPrefill) cardFlags.question = [prefillQuestion];
|
|
73
|
+
const prefill = wanted === void 0 || !roomForPrefill ? "none" : prefillQuestion !== void 0 ? "applied" : "dropped-too-long";
|
|
74
|
+
if (prefill === "dropped-too-long") {
|
|
75
|
+
ctx.io.stderr.write(
|
|
76
|
+
`The searched question is longer than ${CARD_QUESTION_MAX} characters, so it was not added to the answer card; pass --question to set a shorter one.
|
|
77
|
+
`
|
|
78
|
+
);
|
|
79
|
+
}
|
|
80
|
+
const card = deriveCard(frontmatter, cardFlags);
|
|
81
|
+
const settings = await resolvePublishSettings({
|
|
82
|
+
dataDir: ctx.dataDir,
|
|
83
|
+
cwd,
|
|
84
|
+
...args.mode !== void 0 ? { flag: args.mode } : {},
|
|
85
|
+
env
|
|
86
|
+
});
|
|
87
|
+
writeModeNotices(
|
|
88
|
+
ctx.io.stderr,
|
|
89
|
+
settings,
|
|
90
|
+
env,
|
|
91
|
+
"each publish asks you once. Set auto to publish clean scans automatically"
|
|
92
|
+
);
|
|
93
|
+
const priceAtomic = resolvePrice(args, frontmatter, settings.defaultPriceAtomic);
|
|
94
|
+
const markerRoot = args.file !== void 0 ? dirname(resolve(cwd, args.file)) : cwd;
|
|
95
|
+
const scanContext = { projectMarkers: await deriveProjectMarkers(markerRoot) };
|
|
96
|
+
const findings = dedupeFindings([
|
|
97
|
+
...scan(raw, scanContext),
|
|
98
|
+
...scan(cardScanText(card), scanContext)
|
|
99
|
+
]);
|
|
100
|
+
const blocking = findings.filter((f) => f.severity === "block");
|
|
101
|
+
const warns = findings.filter((f) => f.severity === "warn");
|
|
102
|
+
const eligibility = localCardEligibility(card);
|
|
103
|
+
const price = toMoney(priceAtomic);
|
|
104
|
+
if (blocking.length > 0) {
|
|
105
|
+
throw new CliError("PUBLISH_BLOCKED", blockMessage(blocking), {
|
|
106
|
+
fix: "Remove the secret from the file (it is never masked away by --yes), then re-run.",
|
|
107
|
+
details: {
|
|
108
|
+
mode: settings.mode,
|
|
109
|
+
findings: blocking.map(publicFinding),
|
|
110
|
+
price: { atomic: price.atomic, usd: price.usd }
|
|
111
|
+
}
|
|
112
|
+
});
|
|
113
|
+
}
|
|
114
|
+
if (needsConfirmation(settings.mode, warns.length) && args.yes !== true) {
|
|
115
|
+
throw new CliError("NEEDS_CONFIRMATION", confirmMessage(warns.length, price.usd), {
|
|
116
|
+
fix: "Review the findings, then re-run with --yes (or resolve the source and re-run).",
|
|
117
|
+
details: {
|
|
118
|
+
mode: settings.mode,
|
|
119
|
+
price: { atomic: price.atomic, usd: price.usd },
|
|
120
|
+
findings: warns.map(publicFinding),
|
|
121
|
+
card: eligibility,
|
|
122
|
+
target: { status, titlePreview: sanitizeForTerminal(title ?? "(untitled draft)") }
|
|
123
|
+
}
|
|
124
|
+
});
|
|
125
|
+
}
|
|
126
|
+
const runtime = await resolveContextSettings(ctx);
|
|
127
|
+
const provider = resolveWalletProvider(
|
|
128
|
+
ctx,
|
|
129
|
+
deps.provider !== void 0 ? { provider: deps.provider } : {}
|
|
130
|
+
);
|
|
131
|
+
await describeWallet(provider);
|
|
132
|
+
const signer = await provider.getSigner();
|
|
133
|
+
const auth = resolveWriteAuth({
|
|
134
|
+
signer,
|
|
135
|
+
baseUrl: runtime.baseUrl,
|
|
136
|
+
dataDir: ctx.dataDir,
|
|
137
|
+
// A publish always writes.
|
|
138
|
+
scope: "read+write",
|
|
139
|
+
...deps.useSession !== void 0 ? { useSession: deps.useSession } : {},
|
|
140
|
+
env
|
|
141
|
+
});
|
|
142
|
+
const input = {
|
|
143
|
+
...title !== void 0 ? { title } : {},
|
|
144
|
+
bodyMd: body,
|
|
145
|
+
...excerpt !== void 0 ? { excerpt } : {},
|
|
146
|
+
...tags !== void 0 ? { tags } : {},
|
|
147
|
+
priceAtomic,
|
|
148
|
+
...handle !== void 0 ? { handle } : {},
|
|
149
|
+
status,
|
|
150
|
+
...card !== void 0 ? { resource: card } : {}
|
|
151
|
+
};
|
|
152
|
+
const result = await publishPost(input, auth, {
|
|
153
|
+
baseUrl: runtime.baseUrl,
|
|
154
|
+
timeoutMs: ctx.flags.timeout,
|
|
155
|
+
...deps.fetchImpl !== void 0 ? { fetchImpl: deps.fetchImpl } : {}
|
|
156
|
+
});
|
|
157
|
+
const parksPrivately = status === "draft";
|
|
158
|
+
let searchInfo;
|
|
159
|
+
if (args.searchId !== void 0) {
|
|
160
|
+
searchInfo = await closeNamedSearch(ctx, args.searchId, storedSearch, parksPrivately, prefill);
|
|
161
|
+
}
|
|
162
|
+
return receipt(result, runtime.baseUrl, searchInfo);
|
|
163
|
+
}
|
|
164
|
+
function validateSearchId(args) {
|
|
165
|
+
if (args.searchId === void 0) return;
|
|
166
|
+
if (!UUID_RE.test(args.searchId)) {
|
|
167
|
+
throw new CliError("USAGE", `Invalid --search-id: ${JSON.stringify(args.searchId)}.`, {
|
|
168
|
+
fix: "Pass the searchId from a prior `tenjin search` (a uuid)."
|
|
169
|
+
});
|
|
170
|
+
}
|
|
171
|
+
}
|
|
172
|
+
async function closeNamedSearch(ctx, searchId, stored, parksPrivately, prefill) {
|
|
173
|
+
const open = (reason) => {
|
|
174
|
+
ctx.io.stderr.write(`${reason}
|
|
175
|
+
`);
|
|
176
|
+
return { id: searchId, closed: false, prefill };
|
|
177
|
+
};
|
|
178
|
+
if (parksPrivately) return open(`Saved as a draft, so search ${searchId} stays open.`);
|
|
179
|
+
if (stored === null) {
|
|
180
|
+
return open(`Published, but search ${searchId} is not in the local store.`);
|
|
181
|
+
}
|
|
182
|
+
const outcome = await markSearchResolved(ctx.dataDir, searchId, "publish");
|
|
183
|
+
if (outcome === "failed") {
|
|
184
|
+
return open(
|
|
185
|
+
`Published, but the local record for search ${searchId} could not be updated, so the open-loop reminder may repeat. Close it with \`tenjin outcome --search-id ${searchId} --status used\`.`
|
|
186
|
+
);
|
|
187
|
+
}
|
|
188
|
+
if (outcome === "not-found") {
|
|
189
|
+
return open(`Published, but search ${searchId} is no longer in the local store.`);
|
|
190
|
+
}
|
|
191
|
+
return { id: searchId, closed: true, prefill };
|
|
192
|
+
}
|
|
193
|
+
async function readSource(args) {
|
|
194
|
+
if (args.file === void 0) {
|
|
195
|
+
throw new CliError("USAGE", "Nothing to publish.", {
|
|
196
|
+
fix: "Pass a Markdown file, e.g. `tenjin publish post.md`."
|
|
197
|
+
});
|
|
198
|
+
}
|
|
199
|
+
return readMarkdown(args.file);
|
|
200
|
+
}
|
|
201
|
+
function receipt(result, baseUrl, searchInfo) {
|
|
202
|
+
const price = toMoney(result.priceAtomic);
|
|
203
|
+
const missing = missingSentences(result.cacheEligibleMissing).map(sanitizeForTerminal);
|
|
204
|
+
const cacheEligible = result.cacheEligible ?? false;
|
|
205
|
+
const deskUrl = `${trimSlash(baseUrl)}/desk`;
|
|
206
|
+
const title = sanitizeForTerminal(result.title);
|
|
207
|
+
const human = [
|
|
208
|
+
`Published ${title} (${sanitizeForTerminal(result.status)}) for ${price.usd} USD \u2192 ${sanitizeForTerminal(result.url)}`,
|
|
209
|
+
cacheEligible ? "Answer card is search-eligible." : missing.length > 0 ? `Answer card not search-eligible yet: ${missing.join(" ")}` : "Published as a browse-only document (no answer card).",
|
|
210
|
+
...searchInfo?.closed === true ? [`Closed the loop on search ${searchInfo.id}.`] : [],
|
|
211
|
+
...result.warnings.map((w) => `warning: ${sanitizeForTerminal(w)}`)
|
|
212
|
+
];
|
|
213
|
+
return {
|
|
214
|
+
data: {
|
|
215
|
+
resourceId: result.resourceId,
|
|
216
|
+
url: result.url,
|
|
217
|
+
status: result.status,
|
|
218
|
+
price,
|
|
219
|
+
cacheEligible,
|
|
220
|
+
missing,
|
|
221
|
+
deskUrl,
|
|
222
|
+
...searchInfo !== void 0 ? { search: searchInfo } : {},
|
|
223
|
+
...result.warnings.length > 0 ? { warnings: result.warnings } : {}
|
|
224
|
+
},
|
|
225
|
+
humanLines: human
|
|
226
|
+
};
|
|
227
|
+
}
|
|
228
|
+
async function readMarkdown(file) {
|
|
229
|
+
try {
|
|
230
|
+
return await readFile(file, "utf8");
|
|
231
|
+
} catch (err) {
|
|
232
|
+
throw new CliError("USAGE", `Could not read ${JSON.stringify(file)}`, {
|
|
233
|
+
fix: "Pass a path to a readable Markdown file, e.g. `tenjin publish post.md`.",
|
|
234
|
+
cause: err
|
|
235
|
+
});
|
|
236
|
+
}
|
|
237
|
+
}
|
|
238
|
+
function resolveStatus(args, frontmatter) {
|
|
239
|
+
if (args.draft === true) return "draft";
|
|
240
|
+
const fm = frontmatter.status;
|
|
241
|
+
if (fm === void 0) return "published";
|
|
242
|
+
if (typeof fm !== "string" || !PUBLISH_STATUSES.includes(fm)) {
|
|
243
|
+
throw new CliError("USAGE", `Invalid status ${JSON.stringify(fm)} in frontmatter.`, {
|
|
244
|
+
fix: "Use status: draft | published | unlisted, or pass --draft."
|
|
245
|
+
});
|
|
246
|
+
}
|
|
247
|
+
return fm;
|
|
248
|
+
}
|
|
249
|
+
function resolveTitle(frontmatter, body) {
|
|
250
|
+
const fm = frontmatter.title;
|
|
251
|
+
if (fm !== void 0) {
|
|
252
|
+
if (typeof fm !== "string") {
|
|
253
|
+
throw new CliError("USAGE", "frontmatter title must be a single string.");
|
|
254
|
+
}
|
|
255
|
+
return fm.trim();
|
|
256
|
+
}
|
|
257
|
+
const headings = headingOutline(body);
|
|
258
|
+
const h1 = headings.find((h) => h.level === 1) ?? headings[0];
|
|
259
|
+
return h1?.text;
|
|
260
|
+
}
|
|
261
|
+
var CARD_QUESTION_MAX = 200;
|
|
262
|
+
function cardQuestion(raw) {
|
|
263
|
+
const question = sanitizeWireText(raw);
|
|
264
|
+
return question.length > 0 && question.length <= CARD_QUESTION_MAX ? question : void 0;
|
|
265
|
+
}
|
|
266
|
+
function resolveExcerpt(args, frontmatter) {
|
|
267
|
+
const raw = args.excerpt ?? expectString(frontmatter, "excerpt");
|
|
268
|
+
if (raw === void 0) return void 0;
|
|
269
|
+
const excerpt = sanitizeWireText(raw);
|
|
270
|
+
if (excerpt.length > EXCERPT_MAX_LENGTH) {
|
|
271
|
+
throw new CliError(
|
|
272
|
+
"USAGE",
|
|
273
|
+
`excerpt must be at most ${EXCERPT_MAX_LENGTH} characters (got ${excerpt.length}).`,
|
|
274
|
+
{ fix: `Shorten it to ${EXCERPT_MAX_LENGTH} characters or fewer.` }
|
|
275
|
+
);
|
|
276
|
+
}
|
|
277
|
+
return excerpt;
|
|
278
|
+
}
|
|
279
|
+
function resolveTags(frontmatter) {
|
|
280
|
+
const fm = frontmatter.tags;
|
|
281
|
+
if (fm === void 0) return void 0;
|
|
282
|
+
if (typeof fm === "string") return [fm];
|
|
283
|
+
if (Array.isArray(fm)) return fm;
|
|
284
|
+
throw new CliError("USAGE", "frontmatter tags must be a list of strings.");
|
|
285
|
+
}
|
|
286
|
+
function expectString(frontmatter, key) {
|
|
287
|
+
const fm = frontmatter[key];
|
|
288
|
+
if (fm === void 0) return void 0;
|
|
289
|
+
if (typeof fm !== "string") {
|
|
290
|
+
throw new CliError("USAGE", `frontmatter ${key} must be a single string.`);
|
|
291
|
+
}
|
|
292
|
+
return fm;
|
|
293
|
+
}
|
|
294
|
+
function resolvePrice(args, frontmatter, defaultAtomic) {
|
|
295
|
+
if (args.price !== void 0) return parseUsdToAtomic(args.price);
|
|
296
|
+
const fm = frontmatter.price;
|
|
297
|
+
if (fm !== void 0) {
|
|
298
|
+
if (typeof fm !== "string") {
|
|
299
|
+
throw new CliError("USAGE", 'frontmatter price must be a decimal-USD string, e.g. "0.10".');
|
|
300
|
+
}
|
|
301
|
+
return parseUsdToAtomic(fm);
|
|
302
|
+
}
|
|
303
|
+
return defaultAtomic;
|
|
304
|
+
}
|
|
305
|
+
function cardFlagsFrom(args) {
|
|
306
|
+
return {
|
|
307
|
+
...args.question !== void 0 && args.question.length > 0 ? { question: args.question } : {},
|
|
308
|
+
...args.task !== void 0 && args.task.length > 0 ? { task: args.task } : {},
|
|
309
|
+
...args.scope !== void 0 ? { scope: args.scope } : {},
|
|
310
|
+
...args.exclusions !== void 0 ? { exclusions: args.exclusions } : {},
|
|
311
|
+
...args.asOf !== void 0 ? { asOf: args.asOf } : {},
|
|
312
|
+
...args.validUntil !== void 0 ? { validUntil: args.validUntil } : {},
|
|
313
|
+
...args.artifactType !== void 0 ? { artifactType: args.artifactType } : {},
|
|
314
|
+
...args.temporalMode !== void 0 ? { temporalMode: args.temporalMode } : {},
|
|
315
|
+
...args.provenance !== void 0 ? { provenance: args.provenance } : {},
|
|
316
|
+
...args.methodology !== void 0 ? { methodology: args.methodology } : {},
|
|
317
|
+
...args.appliesTo !== void 0 && args.appliesTo.length > 0 ? { appliesTo: parseAppliesToFlags(args.appliesTo) } : {}
|
|
318
|
+
};
|
|
319
|
+
}
|
|
320
|
+
function cardScanText(card) {
|
|
321
|
+
if (card === void 0) return "";
|
|
322
|
+
const parts = [];
|
|
323
|
+
const add = (v) => {
|
|
324
|
+
if (v !== void 0) parts.push(v);
|
|
325
|
+
};
|
|
326
|
+
add(card.scope);
|
|
327
|
+
add(card.exclusions);
|
|
328
|
+
add(card.provenanceSummary);
|
|
329
|
+
add(card.methodologySummary);
|
|
330
|
+
add(card.mediaType);
|
|
331
|
+
add(card.maintenanceCadence);
|
|
332
|
+
add(card.asOf);
|
|
333
|
+
add(card.validUntil);
|
|
334
|
+
add(card.estimatedPaidInputCost);
|
|
335
|
+
if (card.questionsAnswered !== void 0) parts.push(...card.questionsAnswered);
|
|
336
|
+
if (card.tasksSupported !== void 0) parts.push(...card.tasksSupported);
|
|
337
|
+
if (card.appliesTo !== void 0) {
|
|
338
|
+
for (const values of Object.values(card.appliesTo)) parts.push(...values);
|
|
339
|
+
}
|
|
340
|
+
return parts.join("\n");
|
|
341
|
+
}
|
|
342
|
+
function blockMessage(blocking) {
|
|
343
|
+
return `Publish blocked: the file contains ${describeFindings(blocking)}.`;
|
|
344
|
+
}
|
|
345
|
+
function confirmMessage(warnCount, priceUsd) {
|
|
346
|
+
return warnCount > 0 ? `Publish needs confirmation: ${warnCount} finding(s), price $${priceUsd}.` : `Publish needs confirmation: price $${priceUsd}.`;
|
|
347
|
+
}
|
|
348
|
+
|
|
349
|
+
export {
|
|
350
|
+
runPublish
|
|
351
|
+
};
|
|
352
|
+
//# sourceMappingURL=chunk-2SDUV6MQ.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../src/commands/publish.ts"],"sourcesContent":["import { readFile } from 'node:fs/promises';\nimport { dirname, resolve } from 'node:path';\nimport { CliError } from '../lib/errors';\nimport { parseUsdToAtomic, toMoney } from '../lib/money';\nimport { resolveContextSettings, resolvePublishSettings } from '../lib/settings';\nimport { parsePublishModeFlag } from '../lib/config';\nimport { loadSearches, markSearchResolved, type StoredSearch } from '../lib/search-store';\nimport { UUID_RE } from '../lib/ids';\nimport { scan, type ScanContext, type ScanFinding } from '../lib/scan';\nimport { deriveProjectMarkers } from '../lib/scan-context';\nimport { headingOutline } from '../lib/markdown';\nimport { sanitizeForTerminal, sanitizeWireText } from '../lib/output';\nimport { trimSlash } from '../lib/url';\nimport {\n deriveCard,\n localCardEligibility,\n missingSentences,\n parseAppliesToFlags,\n parseFrontmatter,\n type CardFlags,\n type Frontmatter,\n type ResourceCardInput,\n} from '../lib/card';\nimport {\n publishPost,\n EXCERPT_MAX_LENGTH,\n PUBLISH_STATUSES,\n type PublishInput,\n type PublishStatus,\n} from '../lib/posts-api';\nimport {\n dedupeFindings,\n describeFindings,\n needsConfirmation,\n publicFinding,\n resolveWriteAuth,\n writeModeNotices,\n} from '../lib/consent';\nimport { describeWallet, resolveWalletProvider, type WalletProvider } from '../lib/wallet';\nimport type { CommandContext, CommandResult } from '../context';\n\n/**\n * `tenjin publish <file.md>`: read the Markdown, parse\n * frontmatter for post + answer-card fields, run the deterministic scan (every\n * mode), gate on the D38\n * consent cascade, then write via the session key (minted on first use) or the\n * plain-SIWX fallback and return a compact receipt. The ordering is the point and\n * is enforced here: scan and consent BEFORE any wallet touch or network write.\n *\n * Exit codes: 0 success (incl. an ineligible-but-published card), 2 usage, 3\n * needs_confirmation / non-bypassable publish_blocked, 4 a write failure after\n * approval.\n */\n\nexport interface PublishArgs {\n /** The Markdown file to publish. */\n file?: string;\n /** The search this publish answers; closes its open loop. */\n searchId?: string;\n draft?: boolean;\n yes?: boolean;\n /** Raw `--mode` (review|auto|full-auto); validated at the edge (USAGE on a bad value). */\n mode?: string;\n /** Top-level post price, decimal USD at the edge (O1). */\n price?: string;\n /** The public preview text; overrides frontmatter `excerpt`. Absent, the server\n * derives one from the body's leading prose. */\n excerpt?: string;\n question?: string[];\n task?: string[];\n scope?: string;\n exclusions?: string;\n appliesTo?: string[];\n asOf?: string;\n validUntil?: string;\n artifactType?: string;\n temporalMode?: string;\n provenance?: string;\n methodology?: string;\n}\n\nexport interface PublishDeps {\n fetchImpl?: typeof fetch;\n provider?: WalletProvider;\n /** Force the plain-SIWX write path (default: session key unless TENJIN_NO_SESSION=1). */\n useSession?: boolean;\n /** Environment seam (mode, base-url, TENJIN_NO_SESSION); defaults to process.env. */\n env?: NodeJS.ProcessEnv;\n /** Working directory for the `.tenjin.json` walk; defaults to process.cwd(). */\n cwd?: string;\n}\n\nexport async function runPublish(\n args: PublishArgs,\n ctx: CommandContext,\n deps: PublishDeps = {},\n): Promise<CommandResult> {\n const env = deps.env ?? process.env;\n const cwd = deps.cwd ?? process.cwd();\n // Validate --mode at the edge (USAGE, exit 2) BEFORE any consent resolution: a\n // typo like `--mode Review` must never be silently dropped onto a looser mode\n // and publish unconfirmed. Mirrors install's --publish-mode edge check.\n if (args.mode !== undefined) parsePublishModeFlag(args.mode, '--mode');\n validateSearchId(args);\n\n const raw = await readSource(args);\n // Read the named search ONCE, here: it prefills the card's question below, and\n // whether it was found decides what the post-publish close reports. Local read,\n // and a missing store reads as no entry rather than failing the publish.\n const storedSearch =\n args.searchId !== undefined\n ? ((await loadSearches(ctx.dataDir)).find((s) => s.searchId === args.searchId) ?? null)\n : null;\n const { frontmatter, body } = parseFrontmatter(raw);\n\n const status = resolveStatus(args, frontmatter);\n const title = resolveTitle(frontmatter, body);\n const tags = resolveTags(frontmatter);\n const excerpt = resolveExcerpt(args, frontmatter);\n const handle = expectString(frontmatter, 'handle');\n // The named search's question prefills questionsAnswered, but only as a\n // fallback: an explicit --question OR a frontmatter questionsAnswered still\n // wins. That phrasing is what the next searcher will send.\n const cardFlags = cardFlagsFrom(args);\n const wanted = storedSearch?.question;\n const prefillQuestion = wanted === undefined ? undefined : cardQuestion(wanted);\n const roomForPrefill =\n cardFlags.question === undefined && frontmatter.questionsAnswered === undefined;\n if (prefillQuestion !== undefined && roomForPrefill) cardFlags.question = [prefillQuestion];\n // A prefill that was WANTED, had room, and was dropped anyway is the one case a\n // caller cannot infer: the card simply comes back without the question it asked\n // for. Reported on both surfaces, because --json never sees the stderr line.\n const prefill: PrefillOutcome =\n wanted === undefined || !roomForPrefill\n ? 'none'\n : prefillQuestion !== undefined\n ? 'applied'\n : 'dropped-too-long';\n if (prefill === 'dropped-too-long') {\n ctx.io.stderr.write(\n `The searched question is longer than ${CARD_QUESTION_MAX} characters, so it was not added to the answer card; pass --question to set a shorter one.\\n`,\n );\n }\n const card = deriveCard(frontmatter, cardFlags);\n\n // The consent cascade + resolved price (global < project < env < flag), with the\n // full-auto loosening gate. Its downgrade warnings go to stderr, not the receipt.\n const settings = await resolvePublishSettings({\n dataDir: ctx.dataDir,\n cwd,\n ...(args.mode !== undefined ? { flag: args.mode } : {}),\n env,\n });\n // The resolver's downgrade warnings, a mistyped env mode, and the one-line\n // explainer for an unconfigured mode: all stderr, all invisible to --json.\n writeModeNotices(\n ctx.io.stderr,\n settings,\n env,\n 'each publish asks you once. Set auto to publish clean scans automatically',\n );\n const priceAtomic = resolvePrice(args, frontmatter, settings.defaultPriceAtomic);\n\n // The scan runs in EVERY mode (D38): it gates the gate, it does not replace it.\n // Scan the whole file AND the derived card's text, so a secret reaches the same\n // gates whether it arrives in the body, in frontmatter, or via a card-authoring\n // flag (--provenance, --scope, …) — the card ships to the PUBLIC card, so a flag\n // secret must block exactly like an in-file one. Dedupe by check+excerpt so a\n // frontmatter value (present in both raw and the card) is not double-counted.\n // The scan context carries the source project's git remote slugs (offline FS\n // read, best-effort): a draft quoting its own project's repo/org warns as a\n // private-by-default reference (open-questions publishing-safety check-set).\n // Markers derive from the DRAFT's project, not the shell's cwd (review r5): a\n // file publish walks up from the file's own directory, so the process cwd is\n // unrelated to where the draft actually lives.\n const markerRoot = args.file !== undefined ? dirname(resolve(cwd, args.file)) : cwd;\n const scanContext: ScanContext = { projectMarkers: await deriveProjectMarkers(markerRoot) };\n const findings = dedupeFindings([\n ...scan(raw, scanContext),\n ...scan(cardScanText(card), scanContext),\n ]);\n const blocking = findings.filter((f) => f.severity === 'block');\n const warns = findings.filter((f) => f.severity === 'warn');\n\n const eligibility = localCardEligibility(card);\n const price = toMoney(priceAtomic);\n\n // A hard-block finding refuses in EVERY mode and is never clearable by --yes or\n // full-auto — the same non-bypassable posture as buy's price cap.\n if (blocking.length > 0) {\n throw new CliError('PUBLISH_BLOCKED', blockMessage(blocking), {\n fix: 'Remove the secret from the file (it is never masked away by --yes), then re-run.',\n details: {\n mode: settings.mode,\n findings: blocking.map(publicFinding),\n price: { atomic: price.atomic, usd: price.usd },\n },\n });\n }\n\n // --yes clears the soft findings and the review confirm alike.\n if (needsConfirmation(settings.mode, warns.length) && args.yes !== true) {\n throw new CliError('NEEDS_CONFIRMATION', confirmMessage(warns.length, price.usd), {\n fix: 'Review the findings, then re-run with --yes (or resolve the source and re-run).',\n details: {\n mode: settings.mode,\n price: { atomic: price.atomic, usd: price.usd },\n findings: warns.map(publicFinding),\n card: eligibility,\n target: { status, titlePreview: sanitizeForTerminal(title ?? '(untitled draft)') },\n },\n });\n }\n\n // Approved (or nothing to confirm): from here a wallet is required. The write\n // base URL is resolved through the shared settings seam and used for BOTH the\n // SIWX/session header domain and the POST host, so the two never diverge.\n const runtime = await resolveContextSettings(ctx);\n const provider = resolveWalletProvider(\n ctx,\n deps.provider !== undefined ? { provider: deps.provider } : {},\n );\n await describeWallet(provider); // surfaces WALLET_MISSING with its own fix\n const signer = await provider.getSigner();\n const auth = resolveWriteAuth({\n signer,\n baseUrl: runtime.baseUrl,\n dataDir: ctx.dataDir,\n // A publish always writes.\n scope: 'read+write',\n ...(deps.useSession !== undefined ? { useSession: deps.useSession } : {}),\n env,\n });\n\n const input: PublishInput = {\n ...(title !== undefined ? { title } : {}),\n bodyMd: body,\n ...(excerpt !== undefined ? { excerpt } : {}),\n ...(tags !== undefined ? { tags } : {}),\n priceAtomic,\n ...(handle !== undefined ? { handle } : {}),\n status,\n ...(card !== undefined ? { resource: card } : {}),\n };\n\n const result = await publishPost(input, auth, {\n baseUrl: runtime.baseUrl,\n timeoutMs: ctx.flags.timeout,\n ...(deps.fetchImpl !== undefined ? { fetchImpl: deps.fetchImpl } : {}),\n });\n\n // A DRAFT answered nobody. It parks the piece privately, so it clears no parked\n // loop: the draft is still the pending answer, and the later real publish is\n // what resolves it.\n const parksPrivately = status === 'draft';\n\n let searchInfo: SearchReceipt | undefined;\n if (args.searchId !== undefined) {\n searchInfo = await closeNamedSearch(ctx, args.searchId, storedSearch, parksPrivately, prefill);\n }\n return receipt(result, runtime.baseUrl, searchInfo);\n}\n\n/**\n * What `--search-id` did, as a machine field. `--json` suppresses every stderr\n * note below, so without this an agent that named a search had no way to learn\n * whether its loop actually closed — the same silent-flag failure the draft note\n * fixes for a human.\n */\ninterface SearchReceipt {\n id: string;\n closed: boolean;\n prefill: PrefillOutcome;\n}\n\n/**\n * What became of the searched question as a card entry. `none` covers both \"no\n * stored question\" and \"the draft named its own\", which are the cases where\n * nothing was expected; `dropped-too-long` is the one a caller has to be told.\n */\ntype PrefillOutcome = 'applied' | 'dropped-too-long' | 'none';\n\n/**\n * `--search-id` at the edge: a uuid, refused before any wallet touch so a typo\n * costs a message rather than a signing prompt.\n */\nfunction validateSearchId(args: PublishArgs): void {\n if (args.searchId === undefined) return;\n if (!UUID_RE.test(args.searchId)) {\n throw new CliError('USAGE', `Invalid --search-id: ${JSON.stringify(args.searchId)}.`, {\n fix: 'Pass the searchId from a prior `tenjin search` (a uuid).',\n });\n }\n}\n\n/**\n * Close the loop a `--search-id` file publish named, and say what happened in\n * both registers: a stderr line for a human, the returned receipt for `--json`.\n *\n * Two outcomes close nothing, and neither is an error — the piece is already\n * published, and bookkeeping never fails the write that ran. A `--draft` parks\n * privately and answers nobody, and an unknown id (aged out of the local store,\n * or from another machine) has no loop here to close.\n *\n * `closed: true` describes the LOOP, not this call: `markSearchResolved` keeps\n * the first resolution, so a search an `outcome` already closed reports closed\n * here too, which is what the caller is actually asking about. It reports the\n * OUTCOME of the write rather than the intent to write, so a swallowed lock\n * timeout comes back as `closed: false` and a stderr line instead of a receipt\n * claiming a close that never landed.\n */\nasync function closeNamedSearch(\n ctx: CommandContext,\n searchId: string,\n stored: StoredSearch | null,\n parksPrivately: boolean,\n prefill: PrefillOutcome,\n): Promise<SearchReceipt> {\n const open = (reason: string): SearchReceipt => {\n ctx.io.stderr.write(`${reason}\\n`);\n return { id: searchId, closed: false, prefill };\n };\n if (parksPrivately) return open(`Saved as a draft, so search ${searchId} stays open.`);\n if (stored === null) {\n return open(`Published, but search ${searchId} is not in the local store.`);\n }\n const outcome = await markSearchResolved(ctx.dataDir, searchId, 'publish');\n if (outcome === 'failed') {\n return open(\n `Published, but the local record for search ${searchId} could not be updated, so the open-loop reminder may repeat. Close it with \\`tenjin outcome --search-id ${searchId} --status used\\`.`,\n );\n }\n // `not-found` here means the entry was evicted between the read above and this\n // write: nothing was closed, so nothing claims to have been.\n if (outcome === 'not-found') {\n return open(`Published, but search ${searchId} is no longer in the local store.`);\n }\n return { id: searchId, closed: true, prefill };\n}\n\n/** The Markdown to publish. A missing path is USAGE before any wallet touch. */\nasync function readSource(args: PublishArgs): Promise<string> {\n if (args.file === undefined) {\n throw new CliError('USAGE', 'Nothing to publish.', {\n fix: 'Pass a Markdown file, e.g. `tenjin publish post.md`.',\n });\n }\n return readMarkdown(args.file);\n}\n\nfunction receipt(\n result: Awaited<ReturnType<typeof publishPost>>,\n baseUrl: string,\n searchInfo?: SearchReceipt,\n): CommandResult {\n const price = toMoney(result.priceAtomic);\n const missing = missingSentences(result.cacheEligibleMissing).map(sanitizeForTerminal);\n const cacheEligible = result.cacheEligible ?? false;\n const deskUrl = `${trimSlash(baseUrl)}/desk`;\n const title = sanitizeForTerminal(result.title);\n // status and url are server-sent open strings (posts-api declares both as bare\n // z.string()), so they get the same treatment as the title beside them: this\n // line is what an author reads to learn where their piece went.\n const human = [\n `Published ${title} (${sanitizeForTerminal(result.status)}) for ${price.usd} USD → ${sanitizeForTerminal(result.url)}`,\n cacheEligible\n ? 'Answer card is search-eligible.'\n : missing.length > 0\n ? `Answer card not search-eligible yet: ${missing.join(' ')}`\n : 'Published as a browse-only document (no answer card).',\n ...(searchInfo?.closed === true ? [`Closed the loop on search ${searchInfo.id}.`] : []),\n ...result.warnings.map((w) => `warning: ${sanitizeForTerminal(w)}`),\n ];\n return {\n data: {\n resourceId: result.resourceId,\n url: result.url,\n status: result.status,\n price,\n cacheEligible,\n missing,\n deskUrl,\n ...(searchInfo !== undefined ? { search: searchInfo } : {}),\n ...(result.warnings.length > 0 ? { warnings: result.warnings } : {}),\n },\n humanLines: human,\n };\n}\n\n// ---------------------------------------------------------------------------\n// Field resolution.\n// ---------------------------------------------------------------------------\n\nasync function readMarkdown(file: string): Promise<string> {\n try {\n return await readFile(file, 'utf8');\n } catch (err) {\n throw new CliError('USAGE', `Could not read ${JSON.stringify(file)}`, {\n fix: 'Pass a path to a readable Markdown file, e.g. `tenjin publish post.md`.',\n cause: err,\n });\n }\n}\n\nfunction resolveStatus(args: PublishArgs, frontmatter: Frontmatter): PublishStatus {\n if (args.draft === true) return 'draft';\n const fm = frontmatter.status;\n if (fm === undefined) return 'published';\n if (typeof fm !== 'string' || !(PUBLISH_STATUSES as readonly string[]).includes(fm)) {\n throw new CliError('USAGE', `Invalid status ${JSON.stringify(fm)} in frontmatter.`, {\n fix: 'Use status: draft | published | unlisted, or pass --draft.',\n });\n }\n return fm as PublishStatus;\n}\n\nfunction resolveTitle(frontmatter: Frontmatter, body: string): string | undefined {\n const fm = frontmatter.title;\n if (fm !== undefined) {\n if (typeof fm !== 'string') {\n throw new CliError('USAGE', 'frontmatter title must be a single string.');\n }\n return fm.trim();\n }\n // Fall back to the first heading (level 1 preferred) so a plain `# Title` post\n // needs no frontmatter.\n const headings = headingOutline(body);\n const h1 = headings.find((h) => h.level === 1) ?? headings[0];\n return h1?.text;\n}\n\n/** The server's per-item bound on `questionsAnswered` (mirrored by deriveCard). */\nconst CARD_QUESTION_MAX = 200;\n\n/**\n * A stored question as a card entry, or undefined when it cannot be one.\n *\n * Dropped rather than cut over the item bound: a search question may run to the\n * server's 512, and a prefill that fails card validation would turn a publish\n * that was fine into a usage error the caller never asked for. Truncating is\n * worse still — half a question is a different question, and this text is what\n * the next searcher matches against.\n */\nfunction cardQuestion(raw: string): string | undefined {\n const question = sanitizeWireText(raw);\n return question.length > 0 && question.length <= CARD_QUESTION_MAX ? question : undefined;\n}\n\n/**\n * The public preview text: `--excerpt` over frontmatter `excerpt`, or undefined\n * to let the server derive one from the body's leading prose.\n *\n * The bound is checked HERE as well as in the request builder, because the\n * builder runs after a wallet signature has been collected and this is the edge:\n * a too-long excerpt should cost a message, not a signing prompt. Refused rather\n * than truncated — a silently cut preview is a different preview, and the whole\n * point of setting one is controlling exactly what a non-buyer reads. Sanitized\n * before the bound for the same reason the builder is: the stripped text is what\n * ships, so it is what the length has to describe.\n */\nfunction resolveExcerpt(args: PublishArgs, frontmatter: Frontmatter): string | undefined {\n const raw = args.excerpt ?? expectString(frontmatter, 'excerpt');\n if (raw === undefined) return undefined;\n const excerpt = sanitizeWireText(raw);\n if (excerpt.length > EXCERPT_MAX_LENGTH) {\n throw new CliError(\n 'USAGE',\n `excerpt must be at most ${EXCERPT_MAX_LENGTH} characters (got ${excerpt.length}).`,\n { fix: `Shorten it to ${EXCERPT_MAX_LENGTH} characters or fewer.` },\n );\n }\n return excerpt;\n}\n\nfunction resolveTags(frontmatter: Frontmatter): string[] | undefined {\n const fm = frontmatter.tags;\n if (fm === undefined) return undefined;\n if (typeof fm === 'string') return [fm];\n if (Array.isArray(fm)) return fm;\n throw new CliError('USAGE', 'frontmatter tags must be a list of strings.');\n}\n\nfunction expectString(frontmatter: Frontmatter, key: string): string | undefined {\n const fm = frontmatter[key];\n if (fm === undefined) return undefined;\n if (typeof fm !== 'string') {\n throw new CliError('USAGE', `frontmatter ${key} must be a single string.`);\n }\n return fm;\n}\n\nfunction resolvePrice(args: PublishArgs, frontmatter: Frontmatter, defaultAtomic: string): string {\n if (args.price !== undefined) return parseUsdToAtomic(args.price);\n const fm = frontmatter.price;\n if (fm !== undefined) {\n if (typeof fm !== 'string') {\n throw new CliError('USAGE', 'frontmatter price must be a decimal-USD string, e.g. \"0.10\".');\n }\n return parseUsdToAtomic(fm);\n }\n return defaultAtomic;\n}\n\nfunction cardFlagsFrom(args: PublishArgs): CardFlags {\n return {\n ...(args.question !== undefined && args.question.length > 0 ? { question: args.question } : {}),\n ...(args.task !== undefined && args.task.length > 0 ? { task: args.task } : {}),\n ...(args.scope !== undefined ? { scope: args.scope } : {}),\n ...(args.exclusions !== undefined ? { exclusions: args.exclusions } : {}),\n ...(args.asOf !== undefined ? { asOf: args.asOf } : {}),\n ...(args.validUntil !== undefined ? { validUntil: args.validUntil } : {}),\n ...(args.artifactType !== undefined ? { artifactType: args.artifactType } : {}),\n ...(args.temporalMode !== undefined ? { temporalMode: args.temporalMode } : {}),\n ...(args.provenance !== undefined ? { provenance: args.provenance } : {}),\n ...(args.methodology !== undefined ? { methodology: args.methodology } : {}),\n ...(args.appliesTo !== undefined && args.appliesTo.length > 0\n ? { appliesTo: parseAppliesToFlags(args.appliesTo) }\n : {}),\n };\n}\n\n/**\n * The derived card's free-text values as one newline-joined document, so the scan\n * covers card-flag input (which never touches the file) at the same severity as\n * the body. Empty when there is no card.\n */\nfunction cardScanText(card: ResourceCardInput | undefined): string {\n if (card === undefined) return '';\n const parts: string[] = [];\n const add = (v: string | undefined): void => {\n if (v !== undefined) parts.push(v);\n };\n add(card.scope);\n add(card.exclusions);\n add(card.provenanceSummary);\n add(card.methodologySummary);\n add(card.mediaType);\n add(card.maintenanceCadence);\n add(card.asOf);\n add(card.validUntil);\n add(card.estimatedPaidInputCost);\n if (card.questionsAnswered !== undefined) parts.push(...card.questionsAnswered);\n if (card.tasksSupported !== undefined) parts.push(...card.tasksSupported);\n if (card.appliesTo !== undefined) {\n for (const values of Object.values(card.appliesTo)) parts.push(...values);\n }\n return parts.join('\\n');\n}\n\n// ---------------------------------------------------------------------------\n// Finding + message shaping.\n// ---------------------------------------------------------------------------\n\nfunction blockMessage(blocking: ScanFinding[]): string {\n return `Publish blocked: the file contains ${describeFindings(blocking)}.`;\n}\n\nfunction confirmMessage(warnCount: number, priceUsd: string): string {\n return warnCount > 0\n ? `Publish needs confirmation: ${warnCount} finding(s), price $${priceUsd}.`\n : `Publish needs confirmation: price $${priceUsd}.`;\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,SAAS,gBAAgB;AACzB,SAAS,SAAS,eAAe;AA2FjC,eAAsB,WACpB,MACA,KACA,OAAoB,CAAC,GACG;AACxB,QAAM,MAAM,KAAK,OAAO,QAAQ;AAChC,QAAM,MAAM,KAAK,OAAO,QAAQ,IAAI;AAIpC,MAAI,KAAK,SAAS,OAAW,sBAAqB,KAAK,MAAM,QAAQ;AACrE,mBAAiB,IAAI;AAErB,QAAM,MAAM,MAAM,WAAW,IAAI;AAIjC,QAAM,eACJ,KAAK,aAAa,UACZ,MAAM,aAAa,IAAI,OAAO,GAAG,KAAK,CAAC,MAAM,EAAE,aAAa,KAAK,QAAQ,KAAK,OAChF;AACN,QAAM,EAAE,aAAa,KAAK,IAAI,iBAAiB,GAAG;AAElD,QAAM,SAAS,cAAc,MAAM,WAAW;AAC9C,QAAM,QAAQ,aAAa,aAAa,IAAI;AAC5C,QAAM,OAAO,YAAY,WA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