@wirecat/notion-cli 0.5.0 → 0.7.0
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/CHANGELOG.md +47 -0
- package/README.md +5 -0
- package/contracts/wirecat.json +55 -2
- package/dist/bin/notion.js +2 -2
- package/dist/bundle/agent-AILW4JPO.js +42 -0
- package/dist/bundle/{all-profiles-V37KCXH3.js → all-profiles-CKOACXTW.js} +64 -21
- package/dist/bundle/{anthropic-Q4S3BYXD.js → anthropic-DWBBVTU3.js} +6 -6
- package/dist/bundle/{app-server-43SR3ACI.js → app-server-BHFYNCDE.js} +86 -65
- package/dist/bundle/{bun-M3J2QTR3.js → bun-ICK2XT7J.js} +2 -2
- package/dist/bundle/{bun-sqlite-EJ3W2PSV.js → bun-sqlite-LU5V5Y4A.js} +7 -7
- package/dist/bundle/{chunk-KHWOLBHQ.js → chunk-2OZVCNU5.js} +2 -2
- package/dist/bundle/{chunk-O5YB7FQD.js → chunk-2RNJ2JP3.js} +4 -4
- package/dist/bundle/{chunk-TP7GDWVF.js → chunk-364ET7LV.js} +1 -1
- package/dist/bundle/{chunk-TDNURSU6.js → chunk-3AKMIKND.js} +19 -19
- package/dist/bundle/{chunk-O3DYRCIT.js → chunk-3DGHBXH2.js} +1 -1
- package/dist/bundle/chunk-3KOJNZH3.js +80 -0
- package/dist/bundle/{chunk-DSP36YHQ.js → chunk-3T3OAYL4.js} +2 -2
- package/dist/bundle/{chunk-W7HM2VGO.js → chunk-3YXYA6HB.js} +1 -1
- package/dist/bundle/chunk-3ZSUVFR7.js +398 -0
- package/dist/bundle/{chunk-GCZ6MAEN.js → chunk-46JBCXLI.js} +43 -64
- package/dist/bundle/{chunk-DB2XKHI4.js → chunk-4FHKSSXQ.js} +2 -2
- package/dist/bundle/chunk-4HP6KGBI.js +32 -0
- package/dist/bundle/chunk-4ZAQMDLD.js +1308 -0
- package/dist/bundle/chunk-4ZTB7LS3.js +87 -0
- package/dist/bundle/{chunk-BNEE35WD.js → chunk-5NFIUY2P.js} +4 -4
- package/dist/bundle/{chunk-E5WLE7BM.js → chunk-63SW4UXG.js} +3 -4
- package/dist/bundle/{chunk-NHHJHXMQ.js → chunk-64IK7JFO.js} +2 -2
- package/dist/bundle/{chunk-HZRQLAHO.js → chunk-6MQSBWWF.js} +1 -1
- package/dist/bundle/{chunk-2FJNMADN.js → chunk-6UZ5D2WP.js} +10 -10
- package/dist/bundle/chunk-6VPC5Z56.js +2145 -0
- package/dist/bundle/chunk-7COTHS6G.js +388 -0
- package/dist/bundle/{chunk-TOSCB4SO.js → chunk-A3RJ6FD5.js} +29 -10
- package/dist/bundle/chunk-ADCAWRRX.js +2366 -0
- package/dist/bundle/{chunk-PPHBRESD.js → chunk-ALAPDLCP.js} +2 -2
- package/dist/bundle/{chunk-ONZVPE24.js → chunk-B6DJQBZI.js} +6 -6
- package/dist/bundle/{chunk-N2XADGL4.js → chunk-BFCRGLOF.js} +4 -4
- package/dist/bundle/{chunk-5P5TXU2K.js → chunk-BFHPT67P.js} +9581 -10764
- package/dist/bundle/{chunk-NA6QLHBZ.js → chunk-BQ6CXCLP.js} +10 -8
- package/dist/bundle/{chunk-JCKWQGCD.js → chunk-BXXHUO7Y.js} +110 -862
- package/dist/bundle/chunk-DCSPCOPB.js +221 -0
- package/dist/bundle/chunk-DQSOYH6N.js +20 -0
- package/dist/bundle/chunk-ECYOTDJM.js +14 -0
- package/dist/bundle/chunk-EMIJVLOA.js +30 -0
- package/dist/bundle/{chunk-DFCHHR5M.js → chunk-EUF5JNPG.js} +1 -1
- package/dist/bundle/{chunk-RIGE67FR.js → chunk-EWXMIKZN.js} +43 -33
- package/dist/bundle/chunk-F4BX7TH2.js +15 -0
- package/dist/bundle/{chunk-QYXWRKNA.js → chunk-FHYV4VWY.js} +16 -9
- package/dist/bundle/{chunk-WE4UFASG.js → chunk-FNESLLZS.js} +29 -1
- package/dist/bundle/chunk-FO3XY2Y2.js +108 -0
- package/dist/bundle/chunk-HJDQTM3T.js +353 -0
- package/dist/bundle/chunk-HOO53OYK.js +561 -0
- package/dist/bundle/{chunk-KHZ2RGXI.js → chunk-HSVKU4OJ.js} +153 -572
- package/dist/bundle/{chunk-CDK5E45T.js → chunk-IEY7KS6Q.js} +2 -100
- package/dist/bundle/{chunk-RJMQGG3P.js → chunk-ITW26OBI.js} +65 -49
- package/dist/bundle/{chunk-FBZI4Z3Z.js → chunk-ITWINZ6R.js} +13 -26
- package/dist/bundle/{chunk-J3NKZ6MO.js → chunk-IYZWHCZJ.js} +155 -435
- package/dist/bundle/{chunk-W53EJOFQ.js → chunk-J3DZVB67.js} +1 -1
- package/dist/bundle/{chunk-FKA7DOCK.js → chunk-JEZJFQQW.js} +1 -1
- package/dist/bundle/chunk-JPGN473W.js +50 -0
- package/dist/bundle/{chunk-NTG657MI.js → chunk-JVRBW5LH.js} +7 -64
- package/dist/bundle/chunk-KBY42GKW.js +785 -0
- package/dist/bundle/{chunk-DO7BLXO3.js → chunk-KWBLDSRV.js} +16 -3
- package/dist/bundle/chunk-L7P3LUDQ.js +286 -0
- package/dist/bundle/{chunk-PWRRDDMZ.js → chunk-LBRTLZHI.js} +249 -555
- package/dist/bundle/{chunk-B3FSLAIU.js → chunk-LEPPRULN.js} +20 -6
- package/dist/bundle/{chunk-WPP76PSX.js → chunk-LVAFTQ45.js} +32 -24
- package/dist/bundle/{chunk-PAW6RRCW.js → chunk-MB4HXDBT.js} +8 -210
- package/dist/bundle/chunk-MEYYH47C.js +25 -0
- package/dist/bundle/{chunk-UZSBGECU.js → chunk-N3NJPHZB.js} +1 -65
- package/dist/bundle/{chunk-BWLBSQSU.js → chunk-NCCRLAAI.js} +4 -4
- package/dist/bundle/chunk-NMQRSEZM.js +37 -0
- package/dist/bundle/{chunk-H3E2PZ5Y.js → chunk-NV7NNL5T.js} +7 -7
- package/dist/bundle/chunk-OALFRUMI.js +67 -0
- package/dist/bundle/{chunk-CWXOXIWS.js → chunk-OCGNOJYD.js} +1 -1
- package/dist/bundle/chunk-OFMCU3BH.js +72 -0
- package/dist/bundle/{chunk-MGUEZYFA.js → chunk-OLAGFJDM.js} +13 -2143
- package/dist/bundle/{chunk-E2AFUJDR.js → chunk-OP2BH55P.js} +3 -3
- package/dist/bundle/{chunk-P5BHKKBI.js → chunk-OS4WPXPZ.js} +4 -4
- package/dist/bundle/{chunk-XUPN2EHR.js → chunk-OW5HW3TD.js} +23 -7
- package/dist/bundle/{chunk-ECC2UX7X.js → chunk-PDVXG3T3.js} +6 -6
- package/dist/bundle/{chunk-5D4AEUVA.js → chunk-PL5P7UKW.js} +434 -1
- package/dist/bundle/{chunk-G2MJYXZG.js → chunk-PSMRUOII.js} +4 -4
- package/dist/bundle/{chunk-DBEQI5YM.js → chunk-QK52ARAU.js} +3 -3
- package/dist/bundle/{chunk-QWYMXFKM.js → chunk-QMNEDK7Z.js} +3 -3
- package/dist/bundle/chunk-R4JV3VLU.js +714 -0
- package/dist/bundle/{chunk-C32AKHTY.js → chunk-REOBWSGV.js} +35 -12
- package/dist/bundle/{chunk-X2M6NIQG.js → chunk-RNVYNPXT.js} +1 -1
- package/dist/bundle/{chunk-HHVFIXDO.js → chunk-RXGX2CZX.js} +399 -399
- package/dist/bundle/{chunk-W5JZMXGW.js → chunk-S35UJBFZ.js} +75 -75
- package/dist/bundle/{chunk-MVA5HVKL.js → chunk-S4UUN6LD.js} +18 -0
- package/dist/bundle/chunk-S5P7THM5.js +72 -0
- package/dist/bundle/{chunk-NE43YXKL.js → chunk-SRVTGI3M.js} +3 -3
- package/dist/bundle/chunk-TRYYWV7J.js +291 -0
- package/dist/bundle/chunk-TWY543BS.js +39 -0
- package/dist/bundle/{chunk-KFVDL2QS.js → chunk-UC7JLE6J.js} +1 -89
- package/dist/bundle/{chunk-3RL2MIUF.js → chunk-UO4O6WQ4.js} +8 -8
- package/dist/bundle/chunk-UPL474OW.js +94 -0
- package/dist/bundle/chunk-UQVUXG7H.js +594 -0
- package/dist/bundle/chunk-UYEDQGMI.js +340 -0
- package/dist/bundle/chunk-VNWF4I7E.js +34 -0
- package/dist/bundle/{chunk-FPUGMDJV.js → chunk-VRBEYOJL.js} +1 -1
- package/dist/bundle/{chunk-BBSFQ3PU.js → chunk-VXKD533R.js} +1646 -1337
- package/dist/bundle/{chunk-ECEZOLOD.js → chunk-VYZ2J7DT.js} +4 -4
- package/dist/bundle/{chunk-TD2JZ25O.js → chunk-WJFQMOVM.js} +113 -80
- package/dist/bundle/{chunk-MNRMKWCN.js → chunk-WUNEJRLJ.js} +6 -6
- package/dist/bundle/chunk-WVN2KTNS.js +52 -0
- package/dist/bundle/{chunk-GTY6N5KZ.js → chunk-X5LUHN62.js} +2 -2
- package/dist/bundle/{chunk-LBYGJKXW.js → chunk-X737FHZP.js} +4 -4
- package/dist/bundle/chunk-YHWFF6DN.js +39 -0
- package/dist/bundle/chunk-YSF5JBRA.js +36 -0
- package/dist/bundle/{chunk-QIG55MZH.js → chunk-ZGUUP2T3.js} +12 -12
- package/dist/bundle/{chunk-AT5I34AN.js → chunk-ZMKAI3F3.js} +3 -3
- package/dist/bundle/command-contract-C2CF4QAH.js +41 -0
- package/dist/bundle/{command-server-entry-LJ627ZUA.js → command-server-entry-F3B2KSPO.js} +30 -27
- package/dist/bundle/{decode-PX2LZ5Y2.js → decode-FDHFF7GC.js} +6 -6
- package/dist/bundle/{definitions-M3U4UYHN.js → definitions-MB65223J.js} +72 -18
- package/dist/bundle/{dispatch-KOISQ5QJ.js → dispatch-IXKG5Z5Y.js} +8 -8
- package/dist/bundle/dist-PAKDDIBT.js +191 -0
- package/dist/bundle/{echarts-FVTUDXDU.js → echarts-PGJPVPA4.js} +2 -2
- package/dist/bundle/{embed-CCSDK43I.js → embed-U6X7CNNK.js} +7 -7
- package/dist/bundle/{embedder-VHI4DHB7.js → embedder-3ROL6ROQ.js} +10 -10
- package/dist/bundle/{failure-FZ6VYKEQ.js → failure-IYMRXM2X.js} +3 -3
- package/dist/bundle/first-run-PNVNHGR7.js +29 -0
- package/dist/bundle/first-screen-DEDD64YH.js +41 -0
- package/dist/bundle/hast-util-from-html-X2DCPS3T.js +10531 -0
- package/dist/bundle/hast-util-to-html-IIFHILP5.js +998 -0
- package/dist/bundle/hast-util-to-mdast-3CSMIWK2.js +2272 -0
- package/dist/bundle/{instructions-HET7BCYK.js → instructions-MJQWRI2D.js} +1 -1
- package/dist/bundle/{mcp-RGNRW77S.js → mcp-JNHOSK4L.js} +2 -2
- package/dist/bundle/{mdast-util-from-markdown-R66F4HZA.js → mdast-util-from-markdown-XCR5KW5S.js} +138 -195
- package/dist/bundle/{mdast-util-gfm-LN2ELINH.js → mdast-util-gfm-JO7PHUIB.js} +28 -357
- package/dist/bundle/mdast-util-to-hast-AYJV7KAE.js +879 -0
- package/dist/bundle/mdast-util-to-markdown-DOXGHRI7.js +1854 -0
- package/dist/bundle/meeting-combined-HEC25QPY.js +25 -0
- package/dist/bundle/meeting-model-R7QPDNZZ.js +27 -0
- package/dist/bundle/{meeting-semantic-UD26T37N.js → meeting-semantic-7WPLMBNT.js} +7 -7
- package/dist/bundle/{micromark-extension-gfm-5X7YT43T.js → micromark-extension-gfm-PQ7DWZM7.js} +12 -78
- package/dist/bundle/{node-CXZIFHZC.js → node-3UXNV3CD.js} +2 -2
- package/dist/bundle/{node-sqlite-ME7KMORI.js → node-sqlite-ULWDWM3I.js} +8 -8
- package/dist/bundle/notes-search-7PE3E3C7.js +64 -0
- package/dist/bundle/notion.js +14 -14
- package/dist/bundle/oauth-LNUZMA72.js +20 -0
- package/dist/bundle/{open-HA6D3SXR.js → open-HGHC35M4.js} +6 -6
- package/dist/bundle/{openai-H5AJPZBX.js → openai-ISSP57MV.js} +21 -18
- package/dist/bundle/{process-5RUXWGYS.js → process-PB2WCOR2.js} +1 -1
- package/dist/bundle/{program-F3NBTZ7J.js → program-GASBJRMG.js} +7574 -7047
- package/dist/bundle/{prompt-6XSUOLHK.js → prompt-3VGQVX2B.js} +6 -6
- package/dist/bundle/{recognize-2Y7AUVGG.js → recognize-7Q2P3NME.js} +5 -5
- package/dist/bundle/{remote-KCABPXQ3.js → remote-BBAWKVIT.js} +12 -11
- package/dist/bundle/{rerank-BTN7LUVA.js → rerank-H4PUS4HV.js} +8 -8
- package/dist/bundle/{schemas-VVLTLMXS.js → schemas-TTVUADHT.js} +39 -60
- package/dist/bundle/{serve-CYEMVRFC.js → serve-FZNSKY7R.js} +11 -11
- package/dist/bundle/{server-WFIICGMI.js → server-BRRNDW6L.js} +78 -56
- package/dist/bundle/server-CQJ4LKAZ.js +90 -0
- package/dist/bundle/{services-L4W6ZWDG.js → services-PEU557KZ.js} +103 -88
- package/dist/bundle/{sqlite-runtime-IKMYLRQC.js → sqlite-runtime-4IZJ4YUM.js} +7 -7
- package/dist/bundle/{state-LMUP636P.js → state-MX3JVT5Q.js} +7 -7
- package/dist/bundle/{store-W2JC2JP4.js → store-JUT34REM.js} +24 -20
- package/dist/bundle/{store-A2QZFBOX.js → store-PP4BPADZ.js} +30 -18
- package/dist/bundle/store-maintenance-command-GRFTJBSB.js +77 -0
- package/dist/bundle/surface-FPWES3NY.js +76 -0
- package/dist/commands/account.d.ts +3 -0
- package/dist/commands/account.d.ts.map +1 -0
- package/dist/commands/account.js +22 -0
- package/dist/commands/account.js.map +1 -0
- package/dist/commands/api.d.ts +7 -2
- package/dist/commands/api.d.ts.map +1 -1
- package/dist/commands/api.js +19 -141
- package/dist/commands/api.js.map +1 -1
- package/dist/commands/library.d.ts.map +1 -1
- package/dist/commands/library.js +14 -6
- package/dist/commands/library.js.map +1 -1
- package/dist/config.d.ts +11 -13
- package/dist/config.d.ts.map +1 -1
- package/dist/config.js +63 -54
- package/dist/config.js.map +1 -1
- package/dist/context.d.ts +11 -3
- package/dist/context.d.ts.map +1 -1
- package/dist/context.js +20 -7
- package/dist/context.js.map +1 -1
- package/dist/generated/definitions.d.ts.map +1 -1
- package/dist/generated/definitions.js +72 -18
- package/dist/generated/definitions.js.map +1 -1
- package/dist/generated/manifest.d.ts.map +1 -1
- package/dist/generated/manifest.js +49 -0
- package/dist/generated/manifest.js.map +1 -1
- package/dist/generated/schemas.d.ts.map +1 -1
- package/dist/generated/schemas.js +32 -32
- package/dist/generated/schemas.js.map +1 -1
- package/dist/generated/types.d.ts +125 -25
- package/dist/generated/types.d.ts.map +1 -1
- package/dist/generated/wirecat-config.d.ts +13 -0
- package/dist/generated/wirecat-config.d.ts.map +1 -0
- package/dist/generated/wirecat-config.js +82 -0
- package/dist/generated/wirecat-config.js.map +1 -0
- package/dist/library.d.ts +3 -0
- package/dist/library.d.ts.map +1 -1
- package/dist/library.js +11 -1
- package/dist/library.js.map +1 -1
- package/dist/notion/client.d.ts +2 -6
- package/dist/notion/client.d.ts.map +1 -1
- package/dist/notion/client.js +7 -8
- package/dist/notion/client.js.map +1 -1
- package/dist/notion/errors.d.ts +5 -0
- package/dist/notion/errors.d.ts.map +1 -1
- package/dist/notion/errors.js +21 -1
- package/dist/notion/errors.js.map +1 -1
- package/dist/notion/port.d.ts +10 -0
- package/dist/notion/port.d.ts.map +1 -1
- package/dist/notion/port.js +19 -0
- package/dist/notion/port.js.map +1 -1
- package/dist/program.d.ts.map +1 -1
- package/dist/program.js +2 -0
- package/dist/program.js.map +1 -1
- package/dist/sync/files.d.ts +12 -0
- package/dist/sync/files.d.ts.map +1 -1
- package/dist/sync/files.js.map +1 -1
- package/dist/sync/from-config.d.ts +13 -0
- package/dist/sync/from-config.d.ts.map +1 -0
- package/dist/sync/from-config.js +32 -0
- package/dist/sync/from-config.js.map +1 -0
- package/dist/sync/source.d.ts +2 -1
- package/dist/sync/source.d.ts.map +1 -1
- package/dist/sync/source.js +48 -48
- package/dist/sync/source.js.map +1 -1
- package/dist/sync/users.d.ts +4 -1
- package/dist/sync/users.d.ts.map +1 -1
- package/dist/sync/users.js +3 -1
- package/dist/sync/users.js.map +1 -1
- package/dist/version.d.ts +1 -1
- package/dist/version.js +1 -1
- package/package.json +8 -8
- package/dist/bundle/chunk-6EOZTUHT.js +0 -726
- package/dist/bundle/command-contract-TVRFW2IX.js +0 -38
- package/dist/bundle/first-run-7JKE5AHN.js +0 -29
- package/dist/bundle/first-screen-ZROHOEYJ.js +0 -38
- package/dist/bundle/meeting-combined-SSTOJUIJ.js +0 -24
- package/dist/bundle/meeting-model-K7TPS4S5.js +0 -26
- package/dist/bundle/oauth-XBTROXHB.js +0 -20
- package/dist/bundle/server-UC2FNNXX.js +0 -72
- package/dist/bundle/store-maintenance-command-LRGQJPSZ.js +0 -63
|
@@ -0,0 +1,388 @@
|
|
|
1
|
+
import { createRequire as __bundleRequire } from "node:module";
|
|
2
|
+
const require = __bundleRequire(import.meta.url);
|
|
3
|
+
import {
|
|
4
|
+
CHECK_EVERY_MS,
|
|
5
|
+
isNewer,
|
|
6
|
+
readNoticeState,
|
|
7
|
+
writeUpdateState
|
|
8
|
+
} from "./chunk-PSMRUOII.js";
|
|
9
|
+
import {
|
|
10
|
+
executableEnvironment,
|
|
11
|
+
executableOnPath
|
|
12
|
+
} from "./chunk-OCGNOJYD.js";
|
|
13
|
+
import {
|
|
14
|
+
Command,
|
|
15
|
+
Option,
|
|
16
|
+
annotate
|
|
17
|
+
} from "./chunk-LBRTLZHI.js";
|
|
18
|
+
import {
|
|
19
|
+
require_cross_spawn
|
|
20
|
+
} from "./chunk-D72URWJE.js";
|
|
21
|
+
import {
|
|
22
|
+
refuseOwnerHomeInTests
|
|
23
|
+
} from "./chunk-S35UJBFZ.js";
|
|
24
|
+
import {
|
|
25
|
+
CliError
|
|
26
|
+
} from "./chunk-4FHKSSXQ.js";
|
|
27
|
+
import {
|
|
28
|
+
__name,
|
|
29
|
+
__toESM
|
|
30
|
+
} from "./chunk-ZVVMGPBJ.js";
|
|
31
|
+
|
|
32
|
+
// node_modules/.pnpm/@wirecat+cli-base@0.125.0_commander@15.0.0_esbuild@0.28.2_typescript@7.0.2_vitest@5.0.5/node_modules/@wirecat/cli-base/dist/skill/index.js
|
|
33
|
+
import { existsSync, mkdirSync, readdirSync, readFileSync, rmSync, writeFileSync } from "node:fs";
|
|
34
|
+
import { homedir } from "node:os";
|
|
35
|
+
import { basename, dirname, join, relative, resolve, sep } from "node:path";
|
|
36
|
+
import { fileURLToPath, pathToFileURL } from "node:url";
|
|
37
|
+
var import_cross_spawn = __toESM(require_cross_spawn(), 1);
|
|
38
|
+
var SKILL_TARGETS = ["claude", "agents"];
|
|
39
|
+
var homeOf = /* @__PURE__ */ __name((env) => {
|
|
40
|
+
refuseOwnerHomeInTests(env);
|
|
41
|
+
return env.HOME || env.USERPROFILE || homedir();
|
|
42
|
+
}, "homeOf");
|
|
43
|
+
var skillPath = /* @__PURE__ */ __name((target, appName, env) => join(homeOf(env), target === "claude" ? ".claude" : ".agents", "skills", appName, "SKILL.md"), "skillPath");
|
|
44
|
+
var FRONTMATTER = /^---(\r?\n)([\s\S]*?\r?\n)?---(\r?\n|$)/;
|
|
45
|
+
var scalar = /* @__PURE__ */ __name((key, indent) => new RegExp(`^${indent}${key}:[ \\t]*["']?([^"'\\r\\n]*?)["']?[ \\t]*\\r?\\n?$`), "scalar");
|
|
46
|
+
var frontmatterLines = /* @__PURE__ */ __name((content) => (FRONTMATTER.exec(content)?.[2] ?? "").split(/(?<=\n)/), "frontmatterLines");
|
|
47
|
+
var metadataBlock = /* @__PURE__ */ __name((lines) => {
|
|
48
|
+
const start = lines.findIndex((line) => /^metadata:/.test(line));
|
|
49
|
+
if (start === -1)
|
|
50
|
+
return void 0;
|
|
51
|
+
if (!/^metadata:[ \t]*\r?\n?$/.test(lines[start])) {
|
|
52
|
+
throw new CliError("configuration_error", "SKILL.md: write `metadata` as an indented block, not on one line");
|
|
53
|
+
}
|
|
54
|
+
let end = start + 1;
|
|
55
|
+
while (end < lines.length && /^[ \t]/.test(lines[end]))
|
|
56
|
+
end++;
|
|
57
|
+
return [start, end];
|
|
58
|
+
}, "metadataBlock");
|
|
59
|
+
var skillVersion = /* @__PURE__ */ __name((content) => {
|
|
60
|
+
const lines = frontmatterLines(content);
|
|
61
|
+
const block = metadataBlock(lines);
|
|
62
|
+
const nested = block && lines.slice(block[0] + 1, block[1]).find((line2) => scalar("version", "[ \\t]+").test(line2));
|
|
63
|
+
const line = nested ?? lines.find((line2) => scalar("version", "").test(line2));
|
|
64
|
+
return line === void 0 ? void 0 : scalar("version", "[ \\t]*").exec(line)?.[1];
|
|
65
|
+
}, "skillVersion");
|
|
66
|
+
var skillName = /* @__PURE__ */ __name((content) => {
|
|
67
|
+
const line = frontmatterLines(content).find((line2) => scalar("name", "").test(line2));
|
|
68
|
+
return line === void 0 ? void 0 : scalar("name", "").exec(line)?.[1];
|
|
69
|
+
}, "skillName");
|
|
70
|
+
var withVersion = /* @__PURE__ */ __name((content, version) => {
|
|
71
|
+
const match = FRONTMATTER.exec(content);
|
|
72
|
+
if (!match)
|
|
73
|
+
return `---
|
|
74
|
+
metadata:
|
|
75
|
+
version: "${version}"
|
|
76
|
+
---
|
|
77
|
+
${content}`;
|
|
78
|
+
const [whole, eol = "\n", body = "", close = ""] = match;
|
|
79
|
+
const lines = body.split(/(?<=\n)/).filter((line) => line !== "");
|
|
80
|
+
const block = metadataBlock(lines);
|
|
81
|
+
if (!block) {
|
|
82
|
+
lines.push(`metadata:${eol}`, ` version: "${version}"${eol}`);
|
|
83
|
+
} else {
|
|
84
|
+
const [start, end] = block;
|
|
85
|
+
const indent = /^[ \t]+/.exec(lines[start + 1] ?? "")?.[0] ?? " ";
|
|
86
|
+
const at = lines.slice(start + 1, end).findIndex((line) => scalar("version", "[ \\t]+").test(line));
|
|
87
|
+
if (at === -1)
|
|
88
|
+
lines.splice(start + 1, 0, `${indent}version: "${version}"${eol}`);
|
|
89
|
+
else {
|
|
90
|
+
const old = lines[start + 1 + at];
|
|
91
|
+
const lineEol = /\r?\n$/.exec(old)?.[0] ?? "";
|
|
92
|
+
lines[start + 1 + at] = `${/^[ \t]+/.exec(old)?.[0]}version: "${version}"${lineEol}`;
|
|
93
|
+
}
|
|
94
|
+
}
|
|
95
|
+
return `---${eol}${lines.join("")}---${close}${content.slice(whole.length)}`;
|
|
96
|
+
}, "withVersion");
|
|
97
|
+
var skillFiles = /* @__PURE__ */ __name((skill) => {
|
|
98
|
+
const root = dirname(fileURLToPath(skill));
|
|
99
|
+
const found = [];
|
|
100
|
+
const walk = /* @__PURE__ */ __name((folder) => {
|
|
101
|
+
for (const entry of readdirSync(folder, { withFileTypes: true })) {
|
|
102
|
+
if (entry.name.startsWith("."))
|
|
103
|
+
continue;
|
|
104
|
+
const path = join(folder, entry.name);
|
|
105
|
+
if (entry.isDirectory())
|
|
106
|
+
walk(path);
|
|
107
|
+
else if (entry.isFile() && path !== join(root, "SKILL.md"))
|
|
108
|
+
found.push(relative(root, path).split(sep).join("/"));
|
|
109
|
+
}
|
|
110
|
+
}, "walk");
|
|
111
|
+
walk(root);
|
|
112
|
+
return found.sort();
|
|
113
|
+
}, "skillFiles");
|
|
114
|
+
var writeSkillFolder = /* @__PURE__ */ __name((app, skill, folder) => {
|
|
115
|
+
const source = readFileSync(skill, "utf8");
|
|
116
|
+
const name = skillName(source);
|
|
117
|
+
if (name !== app.appName) {
|
|
118
|
+
throw new CliError("configuration_error", `SKILL.md is named ${name === void 0 ? "nothing" : `"${name}"`}, but installs into a directory "${app.appName}"; the two must match`);
|
|
119
|
+
}
|
|
120
|
+
const root = dirname(fileURLToPath(skill));
|
|
121
|
+
for (const file of skillFiles(skill)) {
|
|
122
|
+
const target = join(folder, file);
|
|
123
|
+
mkdirSync(dirname(target), { recursive: true });
|
|
124
|
+
writeFileSync(target, readFileSync(join(root, file)));
|
|
125
|
+
}
|
|
126
|
+
const path = join(folder, "SKILL.md");
|
|
127
|
+
mkdirSync(folder, { recursive: true });
|
|
128
|
+
writeFileSync(path, withVersion(source, app.version));
|
|
129
|
+
return path;
|
|
130
|
+
}, "writeSkillFolder");
|
|
131
|
+
var installSkill = /* @__PURE__ */ __name((app, skill, { targets = SKILL_TARGETS, env = process.env } = {}) => targets.map((target) => writeSkillFolder(app, skill, dirname(skillPath(target, app.appName, env)))), "installSkill");
|
|
132
|
+
var skillStatus = /* @__PURE__ */ __name((app, env = process.env) => SKILL_TARGETS.map((target) => {
|
|
133
|
+
const path = skillPath(target, app.appName, env);
|
|
134
|
+
return { target, ...copyStatus(app, path) ?? { path, installed: null, state: "missing" } };
|
|
135
|
+
}), "skillStatus");
|
|
136
|
+
var copyStatus = /* @__PURE__ */ __name((app, path) => {
|
|
137
|
+
let content;
|
|
138
|
+
try {
|
|
139
|
+
content = readFileSync(path, "utf8");
|
|
140
|
+
} catch {
|
|
141
|
+
return void 0;
|
|
142
|
+
}
|
|
143
|
+
const installed = skillVersion(content);
|
|
144
|
+
if (installed === void 0)
|
|
145
|
+
return { path, installed: null, state: "unversioned" };
|
|
146
|
+
return { path, installed, state: isNewer(app.version, installed) ? "stale" : "current" };
|
|
147
|
+
}, "copyStatus");
|
|
148
|
+
var runProgram = /* @__PURE__ */ __name((file, args, env) => {
|
|
149
|
+
const result = import_cross_spawn.default.sync(executableOnPath(file, env), [...args], {
|
|
150
|
+
encoding: "utf8",
|
|
151
|
+
timeout: 3e4,
|
|
152
|
+
maxBuffer: 256e3,
|
|
153
|
+
env: executableEnvironment(env)
|
|
154
|
+
});
|
|
155
|
+
return { status: result.status, ...result.error ? { error: result.error } : {}, stdout: result.stdout ?? "" };
|
|
156
|
+
}, "runProgram");
|
|
157
|
+
var hermesHome = /* @__PURE__ */ __name((env, platform = process.platform) => {
|
|
158
|
+
refuseOwnerHomeInTests(env, platform);
|
|
159
|
+
const set = env.HERMES_HOME?.trim();
|
|
160
|
+
if (set)
|
|
161
|
+
return set;
|
|
162
|
+
if (platform === "win32")
|
|
163
|
+
return join(env.LOCALAPPDATA || join(homeOf(env), "AppData", "Local"), "hermes");
|
|
164
|
+
return join(homeOf(env), ".hermes");
|
|
165
|
+
}, "hermesHome");
|
|
166
|
+
var hermesCopyPath = /* @__PURE__ */ __name((appName, env) => join(hermesHome(env), "skills", appName, "SKILL.md"), "hermesCopyPath");
|
|
167
|
+
var EXTERNAL_DIRS = "skills.external_dirs";
|
|
168
|
+
var externalDirs = /* @__PURE__ */ __name((env, run) => {
|
|
169
|
+
const answer = run("hermes", ["config", "get", EXTERNAL_DIRS, "--json"], env);
|
|
170
|
+
if (answer.error || answer.status !== 0)
|
|
171
|
+
return void 0;
|
|
172
|
+
let value;
|
|
173
|
+
try {
|
|
174
|
+
value = JSON.parse(answer.stdout);
|
|
175
|
+
} catch {
|
|
176
|
+
return void 0;
|
|
177
|
+
}
|
|
178
|
+
if (value === null)
|
|
179
|
+
return [];
|
|
180
|
+
if (typeof value === "string")
|
|
181
|
+
return [value];
|
|
182
|
+
return Array.isArray(value) && value.every((entry) => typeof entry === "string") ? value : void 0;
|
|
183
|
+
}, "externalDirs");
|
|
184
|
+
var expanded = /* @__PURE__ */ __name((entry, env) => resolve(entry.replace(/^~(?=$|[\\/])/, homeOf(env)).replace(/\$\{(\w+)\}|\$(\w+)/g, (whole, braced, bare) => env[braced ?? bare ?? ""] ?? whole)), "expanded");
|
|
185
|
+
var lists = /* @__PURE__ */ __name((dirs, folder, env) => dirs.some((entry) => expanded(entry, env) === resolve(folder)), "lists");
|
|
186
|
+
var removeOwnCopy = /* @__PURE__ */ __name((app, skill, env) => {
|
|
187
|
+
const path = hermesCopyPath(app.appName, env);
|
|
188
|
+
const shipped = new Set(skillFiles(skill));
|
|
189
|
+
const top = /* @__PURE__ */ new Set(["SKILL.md", ...[...shipped].map((file) => file.split("/")[0])]);
|
|
190
|
+
try {
|
|
191
|
+
if (!readdirSync(dirname(path)).every((entry) => top.has(entry)))
|
|
192
|
+
return void 0;
|
|
193
|
+
if (!skillFiles(pathToFileURL(path)).every((file) => shipped.has(file)))
|
|
194
|
+
return void 0;
|
|
195
|
+
if (skillName(readFileSync(path, "utf8")) !== app.appName)
|
|
196
|
+
return void 0;
|
|
197
|
+
rmSync(dirname(path), { recursive: true });
|
|
198
|
+
return path;
|
|
199
|
+
} catch {
|
|
200
|
+
return void 0;
|
|
201
|
+
}
|
|
202
|
+
}, "removeOwnCopy");
|
|
203
|
+
var readFolder = /* @__PURE__ */ __name((folder, env, run) => {
|
|
204
|
+
const dirs = externalDirs(env, run);
|
|
205
|
+
if (dirs === void 0)
|
|
206
|
+
return "Hermes could not be asked for skills.external_dirs";
|
|
207
|
+
if (lists(dirs, folder, env))
|
|
208
|
+
return void 0;
|
|
209
|
+
const set = run("hermes", ["config", "set", EXTERNAL_DIRS, JSON.stringify([...dirs, folder])], env);
|
|
210
|
+
if (set.error || set.status !== 0)
|
|
211
|
+
return "hermes config set failed";
|
|
212
|
+
const after = externalDirs(env, run);
|
|
213
|
+
return after !== void 0 && lists(after, folder, env) ? void 0 : "Hermes did not keep the folder";
|
|
214
|
+
}, "readFolder");
|
|
215
|
+
var installHermesSkill = /* @__PURE__ */ __name((app, skill, { env = process.env, run = runProgram } = {}) => {
|
|
216
|
+
if (!existsSync(hermesHome(env)) && run("hermes", ["--version"], env).error)
|
|
217
|
+
throw new CliError("not_found", "Hermes is not installed here; install Hermes first, or set HERMES_HOME");
|
|
218
|
+
const [shared] = installSkill(app, skill, { targets: ["agents"], env });
|
|
219
|
+
const reason = readFolder(dirname(dirname(shared)), env, run);
|
|
220
|
+
if (reason === void 0) {
|
|
221
|
+
const removed = removeOwnCopy(app, skill, env);
|
|
222
|
+
return { written: [shared], hermes: { via: "external_dirs", path: shared, ...removed ? { removed } : {} } };
|
|
223
|
+
}
|
|
224
|
+
const copy = writeSkillFolder(app, skill, dirname(hermesCopyPath(app.appName, env)));
|
|
225
|
+
return { written: [shared, copy], hermes: { via: "copy", path: copy, reason } };
|
|
226
|
+
}, "installHermesSkill");
|
|
227
|
+
var hermesSkillStatus = /* @__PURE__ */ __name((app, { env = process.env, run = runProgram } = {}) => {
|
|
228
|
+
const own = copyStatus(app, hermesCopyPath(app.appName, env));
|
|
229
|
+
if (own)
|
|
230
|
+
return { ...own, via: "copy" };
|
|
231
|
+
const shared = skillPath("agents", app.appName, env);
|
|
232
|
+
const dirs = existsSync(hermesHome(env)) ? externalDirs(env, run) : void 0;
|
|
233
|
+
const read = dirs !== void 0 && lists(dirs, dirname(dirname(shared)), env) ? copyStatus(app, shared) : void 0;
|
|
234
|
+
if (read)
|
|
235
|
+
return { ...read, via: "external_dirs" };
|
|
236
|
+
return { path: shared, installed: null, state: "missing", via: null };
|
|
237
|
+
}, "hermesSkillStatus");
|
|
238
|
+
var skillParts = /* @__PURE__ */ __name((skill) => {
|
|
239
|
+
try {
|
|
240
|
+
return Object.fromEntries(skillFiles(skill).filter((file) => file.endsWith(".md")).reverse().map((file) => [basename(file, ".md"), new URL(file, skill)]));
|
|
241
|
+
} catch {
|
|
242
|
+
return {};
|
|
243
|
+
}
|
|
244
|
+
}, "skillParts");
|
|
245
|
+
var skillCommand = /* @__PURE__ */ __name((app, skill, environment, more = {}) => {
|
|
246
|
+
const command = new Command("skill").description("the instructions an agent is given for this tool");
|
|
247
|
+
const machine = /* @__PURE__ */ __name((self) => {
|
|
248
|
+
const { json, jsonl } = self.optsWithGlobals();
|
|
249
|
+
return json === true || jsonl === true;
|
|
250
|
+
}, "machine");
|
|
251
|
+
const shown = { ...skillParts(skill), ...more };
|
|
252
|
+
const named = Object.keys(shown);
|
|
253
|
+
const show = annotate(command.command("show"), { effects: { remote: "none", local: "read" } }).summary("print the tool's instructions for AI agents").description(`print SKILL.md \u2014 \`${app.command} skill install\` puts it where Claude Code, Codex, Gemini CLI and OpenClaw look for it, and where Hermes does on request; --for prints the copy already there`);
|
|
254
|
+
if (named.length > 0)
|
|
255
|
+
show.argument("[name]", `a part of this skill, or a skill shipped for a task: ${named.join(", ")}`);
|
|
256
|
+
show.addOption(new Option("--for <agents>", "print the copy installed for these agents instead of this version's").choices(SKILL_TARGETS));
|
|
257
|
+
show.action(function(given) {
|
|
258
|
+
const name = typeof given === "string" ? given : void 0;
|
|
259
|
+
const { renderer, streams, env } = environment(this);
|
|
260
|
+
const { for: target } = this.opts();
|
|
261
|
+
if (target !== void 0) {
|
|
262
|
+
if (name !== void 0)
|
|
263
|
+
throw new CliError("validation_error", `only ${app.appName} is installed; leave out "${name}" with --for`);
|
|
264
|
+
const path = skillPath(target, app.appName, env ?? process.env);
|
|
265
|
+
let content2;
|
|
266
|
+
try {
|
|
267
|
+
content2 = readFileSync(path, "utf8").trimEnd();
|
|
268
|
+
} catch {
|
|
269
|
+
throw new CliError("not_found", `no skill is installed for ${target} at ${path} \u2014 \`${app.command} skill install --for ${target}\` writes it`);
|
|
270
|
+
}
|
|
271
|
+
if (machine(this))
|
|
272
|
+
renderer.result({ name: app.appName, target, path, installed: skillVersion(content2) ?? null, content: content2 });
|
|
273
|
+
else
|
|
274
|
+
streams.data(content2);
|
|
275
|
+
return;
|
|
276
|
+
}
|
|
277
|
+
const source = name === void 0 ? skill : shown[name];
|
|
278
|
+
if (!source) {
|
|
279
|
+
throw new CliError("validation_error", `no skill "${name}" \u2014 there are: ${named.join(", ")}`);
|
|
280
|
+
}
|
|
281
|
+
const content = name === void 0 ? readFileSync(source, "utf8").trimEnd() : readFileSync(source, "utf8").trimEnd().replaceAll("{{command}}", app.command);
|
|
282
|
+
if (machine(this))
|
|
283
|
+
renderer.result({ name: name ?? app.appName, content });
|
|
284
|
+
else
|
|
285
|
+
streams.data(content);
|
|
286
|
+
});
|
|
287
|
+
annotate(command.command("install"), { effects: { remote: "none", local: "write" } }).summary("install the tool's instructions for AI agents").description(`write SKILL.md to ~/.claude/skills/${app.appName}/ (Claude Code) and ~/.agents/skills/${app.appName}/ (Codex, Gemini CLI, OpenClaw); --for hermes also has Hermes read ~/.agents/skills, which changes Hermes's own settings, so all leaves it out`).addOption(new Option("--for <agents>", "which agents to install for").choices(["claude", "agents", "hermes", "all"]).default("all")).action(function({ for: chosen }) {
|
|
288
|
+
const { renderer, env } = environment(this);
|
|
289
|
+
if (chosen === "hermes") {
|
|
290
|
+
const { written: written2, hermes } = installHermesSkill(app, skill, env ? { env } : {});
|
|
291
|
+
renderer.result({ name: app.appName, version: app.version, written: written2, hermes });
|
|
292
|
+
renderer.success(hermes.via === "external_dirs" ? `${app.appName} ${app.version} skill installed: ${hermes.path}; Hermes reads ${dirname(dirname(hermes.path))} (skills.external_dirs)` : `${app.appName} ${app.version} skill installed: ${hermes.path}, a copy for Hermes (${hermes.reason})`);
|
|
293
|
+
if (hermes.removed)
|
|
294
|
+
renderer.note(`removed the earlier copy Hermes would also have found: ${hermes.removed}`);
|
|
295
|
+
return;
|
|
296
|
+
}
|
|
297
|
+
const targets = chosen === "all" ? SKILL_TARGETS : [chosen];
|
|
298
|
+
const written = installSkill(app, skill, { targets, ...env ? { env } : {} });
|
|
299
|
+
renderer.result({ name: app.appName, version: app.version, written });
|
|
300
|
+
renderer.success(`${app.appName} ${app.version} skill installed: ${written.join(", ")}`);
|
|
301
|
+
});
|
|
302
|
+
annotate(command.command("status"), {
|
|
303
|
+
effects: { remote: "none", local: "read" },
|
|
304
|
+
examples: [`${app.command} skill status`, `${app.command} skill status --json`]
|
|
305
|
+
}).summary("whether the installed instructions for AI agents match this version").description(`for each place \`${app.command} skill install\` writes to, and for the copy Hermes reads: the path, the version installed there, and whether it is current, stale, missing or unversioned`).action(function() {
|
|
306
|
+
const { renderer, env } = environment(this);
|
|
307
|
+
const targets = skillStatus(app, env ?? process.env);
|
|
308
|
+
const hermes = hermesSkillStatus(app, env ? { env } : {});
|
|
309
|
+
renderer.result({ name: app.appName, version: app.version, targets, hermes });
|
|
310
|
+
});
|
|
311
|
+
return command;
|
|
312
|
+
}, "skillCommand");
|
|
313
|
+
var isAgent = /* @__PURE__ */ __name((env) => Boolean(env.AI_AGENT || env.CLAUDECODE), "isAgent");
|
|
314
|
+
var needsInstall = /* @__PURE__ */ __name((app, env) => {
|
|
315
|
+
const states = skillStatus(app, env).map(({ state }) => state);
|
|
316
|
+
return states.every((state) => state === "missing") || states.some((state) => state === "stale" || state === "unversioned");
|
|
317
|
+
}, "needsInstall");
|
|
318
|
+
var skillHint = /* @__PURE__ */ __name(({ app, argv, env, statePath, enabled = true, now = Date.now }) => {
|
|
319
|
+
try {
|
|
320
|
+
if (!enabled || !isAgent(env))
|
|
321
|
+
return void 0;
|
|
322
|
+
if (argv.includes("skill") || argv.includes("complete"))
|
|
323
|
+
return void 0;
|
|
324
|
+
const at = now();
|
|
325
|
+
const shown = readNoticeState(statePath).skillHintAt;
|
|
326
|
+
if (shown !== void 0 && at - shown < CHECK_EVERY_MS)
|
|
327
|
+
return void 0;
|
|
328
|
+
if (!needsInstall(app, env))
|
|
329
|
+
return void 0;
|
|
330
|
+
writeUpdateState(statePath, { skillHintAt: at });
|
|
331
|
+
return `agents: \`${app.command} skill install\` installs this tool's guide`;
|
|
332
|
+
} catch {
|
|
333
|
+
return void 0;
|
|
334
|
+
}
|
|
335
|
+
}, "skillHint");
|
|
336
|
+
var skillResource = /* @__PURE__ */ __name((app, skill) => {
|
|
337
|
+
const uri = `${app.command}://skill`;
|
|
338
|
+
return {
|
|
339
|
+
uri,
|
|
340
|
+
name: "skill",
|
|
341
|
+
title: `${app.appName} SKILL.md`,
|
|
342
|
+
description: `How to use ${app.command}: the guide an agent is given for this tool.`,
|
|
343
|
+
mimeType: "text/markdown",
|
|
344
|
+
read: /* @__PURE__ */ __name(() => ({ contents: [{ uri, mimeType: "text/markdown", text: readFileSync(skill, "utf8") }] }), "read"),
|
|
345
|
+
instruction: `- The full guide is the resource ${uri}; \`${app.command} skill install\` installs it as an agent skill.`
|
|
346
|
+
};
|
|
347
|
+
}, "skillResource");
|
|
348
|
+
var skillResources = /* @__PURE__ */ __name((app, skill) => {
|
|
349
|
+
const main = skillResource(app, skill);
|
|
350
|
+
let parts = [];
|
|
351
|
+
try {
|
|
352
|
+
parts = skillFiles(skill).filter((file) => file.endsWith(".md"));
|
|
353
|
+
} catch {
|
|
354
|
+
}
|
|
355
|
+
if (parts.length === 0)
|
|
356
|
+
return [main];
|
|
357
|
+
return [
|
|
358
|
+
{
|
|
359
|
+
...main,
|
|
360
|
+
instruction: `- The guide is the resource ${main.uri}; the parts it links are ${main.uri}/<path>, read only the one a task needs. \`${app.command} skill install\` installs it as an agent skill.`
|
|
361
|
+
},
|
|
362
|
+
...parts.map((file) => {
|
|
363
|
+
const uri = `${main.uri}/${file}`;
|
|
364
|
+
return {
|
|
365
|
+
uri,
|
|
366
|
+
name: `skill/${file}`,
|
|
367
|
+
title: `${app.appName} ${file}`,
|
|
368
|
+
description: `A part of the ${app.command} guide that ${main.uri} links to.`,
|
|
369
|
+
mimeType: "text/markdown",
|
|
370
|
+
read: /* @__PURE__ */ __name(() => ({
|
|
371
|
+
contents: [{ uri, mimeType: "text/markdown", text: readFileSync(new URL(file, skill), "utf8") }]
|
|
372
|
+
}), "read"),
|
|
373
|
+
instruction: ""
|
|
374
|
+
};
|
|
375
|
+
})
|
|
376
|
+
];
|
|
377
|
+
}, "skillResources");
|
|
378
|
+
|
|
379
|
+
export {
|
|
380
|
+
skillVersion,
|
|
381
|
+
writeSkillFolder,
|
|
382
|
+
installSkill,
|
|
383
|
+
skillStatus,
|
|
384
|
+
hermesCopyPath,
|
|
385
|
+
skillCommand,
|
|
386
|
+
skillHint,
|
|
387
|
+
skillResources
|
|
388
|
+
};
|
|
@@ -9,6 +9,7 @@ import {
|
|
|
9
9
|
isoTimestamp,
|
|
10
10
|
literal,
|
|
11
11
|
maxLength,
|
|
12
|
+
minLength,
|
|
12
13
|
minValue,
|
|
13
14
|
nullable,
|
|
14
15
|
number,
|
|
@@ -23,17 +24,17 @@ import {
|
|
|
23
24
|
union,
|
|
24
25
|
unknown,
|
|
25
26
|
variant
|
|
26
|
-
} from "./chunk-
|
|
27
|
+
} from "./chunk-S4UUN6LD.js";
|
|
27
28
|
import {
|
|
28
29
|
errorCodes,
|
|
29
30
|
isCliError,
|
|
30
31
|
visibleControls
|
|
31
|
-
} from "./chunk-
|
|
32
|
+
} from "./chunk-4FHKSSXQ.js";
|
|
32
33
|
import {
|
|
33
34
|
__name
|
|
34
35
|
} from "./chunk-ZVVMGPBJ.js";
|
|
35
36
|
|
|
36
|
-
// node_modules/.pnpm/@wirecat+cli-base@0.
|
|
37
|
+
// node_modules/.pnpm/@wirecat+cli-base@0.125.0_commander@15.0.0_esbuild@0.28.2_typescript@7.0.2_vitest@5.0.5/node_modules/@wirecat/cli-base/dist/exit-codes.js
|
|
37
38
|
var EXIT_CODES = {
|
|
38
39
|
validation_error: 2,
|
|
39
40
|
configuration_error: 3,
|
|
@@ -54,7 +55,7 @@ var EXIT_CODES = {
|
|
|
54
55
|
var exitCodeFor = /* @__PURE__ */ __name((code) => EXIT_CODES[code], "exitCodeFor");
|
|
55
56
|
var GENERIC_FAILURE = 1;
|
|
56
57
|
|
|
57
|
-
// node_modules/.pnpm/@wirecat+cli-base@0.
|
|
58
|
+
// node_modules/.pnpm/@wirecat+cli-base@0.125.0_commander@15.0.0_esbuild@0.28.2_typescript@7.0.2_vitest@5.0.5/node_modules/@wirecat/cli-base/dist/standards/effects.js
|
|
58
59
|
var EFFECT_LEVELS = ["none", "read", "write"];
|
|
59
60
|
var effectsSchema = strictObject({
|
|
60
61
|
remote: picklist(EFFECT_LEVELS),
|
|
@@ -691,7 +692,7 @@ function toStandardJsonSchema(schema) {
|
|
|
691
692
|
}
|
|
692
693
|
__name(toStandardJsonSchema, "toStandardJsonSchema");
|
|
693
694
|
|
|
694
|
-
// node_modules/.pnpm/@wirecat+cli-base@0.
|
|
695
|
+
// node_modules/.pnpm/@wirecat+cli-base@0.125.0_commander@15.0.0_esbuild@0.28.2_typescript@7.0.2_vitest@5.0.5/node_modules/@wirecat/cli-base/dist/standards/registry.js
|
|
695
696
|
var word = pipe(string(), regex(/^[a-z][a-z0-9]*(-[a-z0-9]+)*$/, "a lower-case word, words joined by -"));
|
|
696
697
|
var SNAKE_CASE = /^[a-z][a-z0-9]*(_[a-z0-9]+)*$/;
|
|
697
698
|
var text = pipe(string(), regex(/\S/, "must not be empty"));
|
|
@@ -733,7 +734,7 @@ var fill = /* @__PURE__ */ __name((template, values) => template.replace(PLACEHO
|
|
|
733
734
|
return String(value);
|
|
734
735
|
}), "fill");
|
|
735
736
|
|
|
736
|
-
// node_modules/.pnpm/@wirecat+cli-base@0.
|
|
737
|
+
// node_modules/.pnpm/@wirecat+cli-base@0.125.0_commander@15.0.0_esbuild@0.28.2_typescript@7.0.2_vitest@5.0.5/node_modules/@wirecat/cli-base/dist/standards/output.js
|
|
737
738
|
var MAX_NEXT_STEPS = 2;
|
|
738
739
|
var COMPACT_FLAG = "--compact";
|
|
739
740
|
var isoTime = pipe(string(), isoTimestamp("an ISO 8601 time in UTC"), endsWith("Z", "an ISO 8601 time in UTC, ending in `Z`"));
|
|
@@ -810,6 +811,22 @@ var rankingSchema = strictObject({
|
|
|
810
811
|
})),
|
|
811
812
|
ms: pipe(number(), integer(), minValue(0))
|
|
812
813
|
});
|
|
814
|
+
var count = pipe(number(), integer(), minValue(0));
|
|
815
|
+
var modelRunSchema = strictObject({
|
|
816
|
+
provider: text,
|
|
817
|
+
model: text,
|
|
818
|
+
endpoint: text,
|
|
819
|
+
sent: count,
|
|
820
|
+
done: count,
|
|
821
|
+
left: count,
|
|
822
|
+
usage: optional(strictObject({ input: count, output: count })),
|
|
823
|
+
cost_usd: nullable(pipe(number(), minValue(0))),
|
|
824
|
+
ms: count
|
|
825
|
+
});
|
|
826
|
+
var querySchema = strictObject({
|
|
827
|
+
chat: optional(strictObject({ word: text, chat_id: text, title: nullable(text) })),
|
|
828
|
+
respelled: optional(array(strictObject({ word: text, tried: pipe(array(text), minLength(1)) })))
|
|
829
|
+
});
|
|
813
830
|
var metaSchema = strictObject({
|
|
814
831
|
run_id: text,
|
|
815
832
|
duration_ms: pipe(number(), integer(), minValue(0)),
|
|
@@ -822,7 +839,9 @@ var metaSchema = strictObject({
|
|
|
822
839
|
now: optional(isoTime),
|
|
823
840
|
now_local: optional(localTime),
|
|
824
841
|
window: optional(strictObject({ since: optional(isoTime), until: optional(isoTime) })),
|
|
825
|
-
ranking: optional(rankingSchema)
|
|
842
|
+
ranking: optional(rankingSchema),
|
|
843
|
+
model_run: optional(modelRunSchema),
|
|
844
|
+
query: optional(querySchema)
|
|
826
845
|
});
|
|
827
846
|
var offsetOf = /* @__PURE__ */ __name((at, zone) => {
|
|
828
847
|
const name = new Intl.DateTimeFormat("en-US", { timeZone: zone, timeZoneName: "longOffset" }).formatToParts(at).find((part) => part.type === "timeZoneName")?.value ?? "GMT";
|
|
@@ -860,7 +879,7 @@ var jsonlOf = /* @__PURE__ */ __name(({ items, page, meta }) => [
|
|
|
860
879
|
JSON.stringify({ type: "end", complete: meta.complete, ...meta.issues ? { issues: meta.issues } : {}, page })
|
|
861
880
|
].join("\n"), "jsonlOf");
|
|
862
881
|
|
|
863
|
-
// node_modules/.pnpm/@wirecat+cli-base@0.
|
|
882
|
+
// node_modules/.pnpm/@wirecat+cli-base@0.125.0_commander@15.0.0_esbuild@0.28.2_typescript@7.0.2_vitest@5.0.5/node_modules/@wirecat/cli-base/dist/standards/errors.js
|
|
864
883
|
var CRASH_CODE = "internal_error";
|
|
865
884
|
var CRASH_REASON = "command.crashed";
|
|
866
885
|
var errorObjectSchema = strictObject({
|
|
@@ -959,7 +978,7 @@ var BASE_REASONS = defineReasons([
|
|
|
959
978
|
{ reason: CRASH_REASON, code: CRASH_CODE, message: "the command failed; this is a bug", details: [] }
|
|
960
979
|
]);
|
|
961
980
|
|
|
962
|
-
// node_modules/.pnpm/@wirecat+cli-base@0.
|
|
981
|
+
// node_modules/.pnpm/@wirecat+cli-base@0.125.0_commander@15.0.0_esbuild@0.28.2_typescript@7.0.2_vitest@5.0.5/node_modules/@wirecat/cli-base/dist/standards/steps.js
|
|
963
982
|
var SAME_COMMAND = "*";
|
|
964
983
|
var commandPath = pipe(string(), regex(/^[a-z][a-z0-9-]*( [a-z][a-z0-9-]*)*$/, "a command path such as `messages sync`"));
|
|
965
984
|
var stepSchema = union([
|
|
@@ -1038,7 +1057,7 @@ var STEPS = defineSteps([
|
|
|
1038
1057
|
}
|
|
1039
1058
|
]);
|
|
1040
1059
|
|
|
1041
|
-
// node_modules/.pnpm/@wirecat+cli-base@0.
|
|
1060
|
+
// node_modules/.pnpm/@wirecat+cli-base@0.125.0_commander@15.0.0_esbuild@0.28.2_typescript@7.0.2_vitest@5.0.5/node_modules/@wirecat/cli-base/dist/failure.js
|
|
1042
1061
|
var recognise = /* @__PURE__ */ __name((failure) => {
|
|
1043
1062
|
if (isCliError(failure))
|
|
1044
1063
|
return failure;
|