tenjin-cli 0.1.0-alpha.7 → 0.1.0-alpha.9

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.
Files changed (126) hide show
  1. package/README.md +158 -236
  2. package/dist/{buy-XVOMNWKN.js → buy-3PPC2SRQ.js} +24 -22
  3. package/dist/{candidate-DJB2NNTG.js → candidate-FCBWDN4Y.js} +10 -8
  4. package/dist/{chunk-PLU3E63S.js → chunk-3MQSXDWS.js} +10 -11
  5. package/dist/chunk-3MQSXDWS.js.map +1 -0
  6. package/dist/{chunk-DH6D6QIO.js → chunk-6DWKU4RH.js} +11 -9
  7. package/dist/{chunk-DH6D6QIO.js.map → chunk-6DWKU4RH.js.map} +1 -1
  8. package/dist/{chunk-WDJTGVKN.js → chunk-6L34JW52.js} +5 -2
  9. package/dist/chunk-6L34JW52.js.map +1 -0
  10. package/dist/{chunk-6S44OLND.js → chunk-6RODLWPQ.js} +101 -36
  11. package/dist/chunk-6RODLWPQ.js.map +1 -0
  12. package/dist/{chunk-VZ3AJCO5.js → chunk-75G4REUY.js} +2 -2
  13. package/dist/{chunk-PIIWLEEG.js → chunk-7MJCZ2OX.js} +12 -12
  14. package/dist/{chunk-2KIDDWQO.js → chunk-ATSCQETF.js} +5 -5
  15. package/dist/{chunk-ZFE7STX7.js → chunk-AX5WQ3H5.js} +7 -5
  16. package/dist/{chunk-ZFE7STX7.js.map → chunk-AX5WQ3H5.js.map} +1 -1
  17. package/dist/{chunk-WRWCDLVK.js → chunk-BFAFOBO3.js} +23 -4
  18. package/dist/chunk-BFAFOBO3.js.map +1 -0
  19. package/dist/{chunk-DAJ56EUU.js → chunk-CTFFFQFH.js} +3 -3
  20. package/dist/{chunk-5X4EBGGU.js → chunk-E5PZEPUO.js} +11 -11
  21. package/dist/{chunk-GABYDXWL.js → chunk-FFTWWJRW.js} +21 -5
  22. package/dist/{chunk-GABYDXWL.js.map → chunk-FFTWWJRW.js.map} +1 -1
  23. package/dist/{chunk-WI5EOAQQ.js → chunk-G7ECLIN6.js} +21 -21
  24. package/dist/{chunk-CYRYVZPN.js → chunk-GJKDWZ6X.js} +3 -3
  25. package/dist/{chunk-RGFBBNGP.js → chunk-I4WQXOEL.js} +16 -13
  26. package/dist/chunk-I4WQXOEL.js.map +1 -0
  27. package/dist/{chunk-OTDI5FXG.js → chunk-JURZ2T2I.js} +3 -3
  28. package/dist/{chunk-UYP7G3GZ.js → chunk-KRHUDEIQ.js} +10 -172
  29. package/dist/chunk-KRHUDEIQ.js.map +1 -0
  30. package/dist/{chunk-2L73UI6T.js → chunk-MHRREGGN.js} +5 -10
  31. package/dist/chunk-MHRREGGN.js.map +1 -0
  32. package/dist/chunk-OQXHNWM3.js +47 -0
  33. package/dist/chunk-OQXHNWM3.js.map +1 -0
  34. package/dist/chunk-P74I3WH4.js +204 -0
  35. package/dist/chunk-P74I3WH4.js.map +1 -0
  36. package/dist/{chunk-ZEWY3RJ3.js → chunk-PT2NJUGG.js} +6 -6
  37. package/dist/{chunk-J6CVKC4M.js → chunk-PZRAAAY2.js} +4 -46
  38. package/dist/chunk-PZRAAAY2.js.map +1 -0
  39. package/dist/{chunk-XBJ3VLWX.js → chunk-PZSUWDF2.js} +2 -2
  40. package/dist/{chunk-BBUYCDSG.js → chunk-R2VLGNFD.js} +7 -2
  41. package/dist/chunk-R2VLGNFD.js.map +1 -0
  42. package/dist/{chunk-KT2DGKFT.js → chunk-S4IKXAUA.js} +5 -9
  43. package/dist/chunk-S4IKXAUA.js.map +1 -0
  44. package/dist/{chunk-E6BNARCS.js → chunk-TMZIXYPL.js} +7 -7
  45. package/dist/{chunk-YBMMV4Y4.js → chunk-TYVLXAB5.js} +26 -4
  46. package/dist/chunk-TYVLXAB5.js.map +1 -0
  47. package/dist/{chunk-GXYNLMUQ.js → chunk-V7BWPOKT.js} +38 -19
  48. package/dist/chunk-V7BWPOKT.js.map +1 -0
  49. package/dist/{chunk-L6AV2Q73.js → chunk-VE5BALOI.js} +5 -5
  50. package/dist/{chunk-GM4RZUVU.js → chunk-WGXUVCUF.js} +8 -6
  51. package/dist/{chunk-GM4RZUVU.js.map → chunk-WGXUVCUF.js.map} +1 -1
  52. package/dist/chunk-X3OOVSPX.js +154 -0
  53. package/dist/chunk-X3OOVSPX.js.map +1 -0
  54. package/dist/{chunk-2YX6LTCD.js → chunk-XDW6GOHO.js} +5 -5
  55. package/dist/{cli-7B2QNJG3.js → cli-ATFP3O6Y.js} +42 -29
  56. package/dist/{cli-7B2QNJG3.js.map → cli-ATFP3O6Y.js.map} +1 -1
  57. package/dist/{config-SAQEQRFB.js → config-VT5WU47R.js} +9 -6
  58. package/dist/dist-U4M6QCKE.js +2842 -0
  59. package/dist/dist-U4M6QCKE.js.map +1 -0
  60. package/dist/doctor-6PEYDTB5.js +24 -0
  61. package/dist/{edit-2QO5GQDU.js → edit-GKI37CRM.js} +21 -19
  62. package/dist/index.js +1 -1
  63. package/dist/{inspect-IPKKQB2S.js → inspect-ITZIRZDV.js} +19 -16
  64. package/dist/install-BMMUPFOK.js +922 -0
  65. package/dist/install-BMMUPFOK.js.map +1 -0
  66. package/dist/outcome-F5KN3K3Y.js +23 -0
  67. package/dist/{publish-7WIFFNFG.js → publish-F5G5WIFI.js} +22 -20
  68. package/dist/{read-5TQR7LCF.js → read-II2ZO4II.js} +21 -19
  69. package/dist/{read-5TQR7LCF.js.map → read-II2ZO4II.js.map} +1 -1
  70. package/dist/{run-NPKIP26Y.js → run-FJWMRXZ7.js} +68 -45
  71. package/dist/run-FJWMRXZ7.js.map +1 -0
  72. package/dist/search-Z2YALF6S.js +26 -0
  73. package/dist/{send-ENE47KQE.js → send-RWOBFOBK.js} +20 -18
  74. package/dist/{send-ENE47KQE.js.map → send-RWOBFOBK.js.map} +1 -1
  75. package/dist/{session-FZU4VFFE.js → session-DJV5T3BG.js} +17 -15
  76. package/dist/{session-FZU4VFFE.js.map → session-DJV5T3BG.js.map} +1 -1
  77. package/dist/skill-heal-OK6YALW6.js +85 -0
  78. package/dist/skill-heal-OK6YALW6.js.map +1 -0
  79. package/dist/{wallet-RBDVNZVR.js → wallet-AB4ISFMY.js} +8 -7
  80. package/dist/{wallet-OCCGEH6H.js → wallet-XVRLJZ63.js} +12 -10
  81. package/docs/agent-permissions.md +255 -0
  82. package/package.json +4 -1
  83. package/skills/tenjin/SKILL.md +126 -47
  84. package/skills/tenjin-search/SKILL.md +10 -6
  85. package/dist/chunk-2L73UI6T.js.map +0 -1
  86. package/dist/chunk-6S44OLND.js.map +0 -1
  87. package/dist/chunk-BBUYCDSG.js.map +0 -1
  88. package/dist/chunk-GXYNLMUQ.js.map +0 -1
  89. package/dist/chunk-J6CVKC4M.js.map +0 -1
  90. package/dist/chunk-KT2DGKFT.js.map +0 -1
  91. package/dist/chunk-PLU3E63S.js.map +0 -1
  92. package/dist/chunk-RGFBBNGP.js.map +0 -1
  93. package/dist/chunk-UYP7G3GZ.js.map +0 -1
  94. package/dist/chunk-WDJTGVKN.js.map +0 -1
  95. package/dist/chunk-WRWCDLVK.js.map +0 -1
  96. package/dist/chunk-YBMMV4Y4.js.map +0 -1
  97. package/dist/doctor-ENJ22XWN.js +0 -22
  98. package/dist/install-7ZIYISQ7.js +0 -589
  99. package/dist/install-7ZIYISQ7.js.map +0 -1
  100. package/dist/outcome-NSDE2KAJ.js +0 -20
  101. package/dist/run-NPKIP26Y.js.map +0 -1
  102. package/dist/search-63ELMRZH.js +0 -24
  103. /package/dist/{buy-XVOMNWKN.js.map → buy-3PPC2SRQ.js.map} +0 -0
  104. /package/dist/{candidate-DJB2NNTG.js.map → candidate-FCBWDN4Y.js.map} +0 -0
  105. /package/dist/{chunk-VZ3AJCO5.js.map → chunk-75G4REUY.js.map} +0 -0
  106. /package/dist/{chunk-PIIWLEEG.js.map → chunk-7MJCZ2OX.js.map} +0 -0
  107. /package/dist/{chunk-2KIDDWQO.js.map → chunk-ATSCQETF.js.map} +0 -0
  108. /package/dist/{chunk-DAJ56EUU.js.map → chunk-CTFFFQFH.js.map} +0 -0
  109. /package/dist/{chunk-5X4EBGGU.js.map → chunk-E5PZEPUO.js.map} +0 -0
  110. /package/dist/{chunk-WI5EOAQQ.js.map → chunk-G7ECLIN6.js.map} +0 -0
  111. /package/dist/{chunk-CYRYVZPN.js.map → chunk-GJKDWZ6X.js.map} +0 -0
  112. /package/dist/{chunk-OTDI5FXG.js.map → chunk-JURZ2T2I.js.map} +0 -0
  113. /package/dist/{chunk-ZEWY3RJ3.js.map → chunk-PT2NJUGG.js.map} +0 -0
  114. /package/dist/{chunk-XBJ3VLWX.js.map → chunk-PZSUWDF2.js.map} +0 -0
  115. /package/dist/{chunk-E6BNARCS.js.map → chunk-TMZIXYPL.js.map} +0 -0
  116. /package/dist/{chunk-L6AV2Q73.js.map → chunk-VE5BALOI.js.map} +0 -0
  117. /package/dist/{chunk-2YX6LTCD.js.map → chunk-XDW6GOHO.js.map} +0 -0
  118. /package/dist/{config-SAQEQRFB.js.map → config-VT5WU47R.js.map} +0 -0
  119. /package/dist/{doctor-ENJ22XWN.js.map → doctor-6PEYDTB5.js.map} +0 -0
  120. /package/dist/{edit-2QO5GQDU.js.map → edit-GKI37CRM.js.map} +0 -0
  121. /package/dist/{inspect-IPKKQB2S.js.map → inspect-ITZIRZDV.js.map} +0 -0
  122. /package/dist/{outcome-NSDE2KAJ.js.map → outcome-F5KN3K3Y.js.map} +0 -0
  123. /package/dist/{publish-7WIFFNFG.js.map → publish-F5G5WIFI.js.map} +0 -0
  124. /package/dist/{search-63ELMRZH.js.map → search-Z2YALF6S.js.map} +0 -0
  125. /package/dist/{wallet-OCCGEH6H.js.map → wallet-AB4ISFMY.js.map} +0 -0
  126. /package/dist/{wallet-RBDVNZVR.js.map → wallet-XVRLJZ63.js.map} +0 -0
@@ -0,0 +1,154 @@
1
+ import { createRequire as __tenjinCreateRequire } from 'node:module'; const require = __tenjinCreateRequire(import.meta.url);
2
+ import {
3
+ HOSTED_SKILL_NAME,
4
+ readSkillFile
5
+ } from "./chunk-P74I3WH4.js";
6
+ import {
7
+ hasCode
8
+ } from "./chunk-2I4QTOLB.js";
9
+ import {
10
+ CliError,
11
+ writeFileAtomic
12
+ } from "./chunk-PZRAAAY2.js";
13
+
14
+ // src/lib/skill-writer.ts
15
+ import { existsSync } from "fs";
16
+ import { lstat, readFile, readdir, realpath, stat } from "fs/promises";
17
+ import { dirname, join, relative } from "path";
18
+ async function installSkill(srcDir, destDir, dryRun, name, opts = {}) {
19
+ const src = await readTree(srcDir);
20
+ if (src === null) {
21
+ throw new CliError("INTERNAL", `Packaged skill source ${srcDir} is empty`);
22
+ }
23
+ const writeTo = /* @__PURE__ */ new Map();
24
+ await assertReachable(destDir, name);
25
+ await assertNoCaseCollision(destDir, name);
26
+ for (const rel of src.keys()) {
27
+ const declared = join(destDir, rel);
28
+ writeTo.set(
29
+ rel,
30
+ opts.followSymlinks === false ? declared : await resolveThroughLink(declared, name)
31
+ );
32
+ }
33
+ let differs = false;
34
+ let preexisting = false;
35
+ for (const [rel, content] of src) {
36
+ const current = await readShippedFile(writeTo.get(rel), name, destDir);
37
+ if (rel === "SKILL.md") preexisting = current !== null;
38
+ if (current === null || !current.equals(content)) differs = true;
39
+ }
40
+ const change = !preexisting ? "create" : differs ? "update" : "none";
41
+ if (!dryRun && change !== "none") {
42
+ for (const [rel, content] of src) {
43
+ const target = writeTo.get(rel);
44
+ try {
45
+ const current = await stat(target).catch(() => null);
46
+ await writeFileAtomic(
47
+ target,
48
+ content,
49
+ current === null ? {} : { mode: current.mode & 511 }
50
+ );
51
+ } catch (err) {
52
+ throw wrapWriteError(
53
+ err,
54
+ destDir,
55
+ `the ${name} skill`,
56
+ await deepestExisting(dirname(target)),
57
+ { expected: ": a skill is a directory holding SKILL.md" }
58
+ );
59
+ }
60
+ }
61
+ }
62
+ if (change === "create") return { status: dryRun ? "would-install" : "installed", preexisting };
63
+ if (change === "none") return { status: "up-to-date", preexisting };
64
+ return {
65
+ status: dryRun ? "would-update" : "updated",
66
+ preexisting,
67
+ // The hosted skill is a MIRROR of tenjin.blog/skills.md (roadmap G4), so a
68
+ // differing local copy is a replacement, not the drift warning the CLI skills
69
+ // get. Neither side carries a version or date, so the wording claims no
70
+ // direction: the local file may well be a newer fetch than this package's copy.
71
+ warning: name === HOSTED_SKILL_NAME ? `${destDir}: the hosted Tenjin skill differed and ${dryRun ? "would be" : "was"} replaced by this package's mirror of tenjin.blog/skills.md, which may be older; it stays as the zero-install fallback. Re-fetch it from tenjin.blog/skills.md if you need the current one.` : `${destDir}: local edits to ${name}'s SKILL.md ${dryRun ? "would be" : "were"} overwritten (the packaged copy is canonical).`
72
+ };
73
+ }
74
+ async function readShippedFile(path, name, destDir) {
75
+ const read = await readSkillFile(path);
76
+ if (read.kind === "absent") return null;
77
+ if (read.kind === "ok") return read.bytes;
78
+ if (read.kind === "not-regular") {
79
+ throw new CliError("INTERNAL", `${path} is not a regular file, so ${name} was not written.`, {
80
+ fix: `A skill file must be a regular file. Check what is there (\`ls -l ${path}\`) and remove or replace it, then re-run \`tenjin install\`.`
81
+ });
82
+ }
83
+ throw wrapWriteError(read.err, destDir, `the ${name} skill`, path, { verb: "read" });
84
+ }
85
+ async function resolveThroughLink(path, name) {
86
+ const entry = await lstat(path).catch(() => null);
87
+ if (entry === null || !entry.isSymbolicLink()) return path;
88
+ const target = await realpath(path).catch(() => null);
89
+ if (target !== null) return target;
90
+ throw new CliError("INTERNAL", `${path} is a broken symlink, so ${name} was not written.`, {
91
+ fix: `Point it at a path that exists, or remove it (\`ls -ld ${path}\`), then re-run \`tenjin install\`.`
92
+ });
93
+ }
94
+ async function assertNoCaseCollision(destDir, name) {
95
+ if (!existsSync(destDir)) return;
96
+ const entries = await readdir(dirname(destDir)).catch(() => null);
97
+ if (entries === null || entries.includes(name)) return;
98
+ const variant = entries.find((e) => e.toLowerCase() === name.toLowerCase());
99
+ if (variant === void 0) return;
100
+ const actual = join(dirname(destDir), variant);
101
+ throw new CliError(
102
+ "INTERNAL",
103
+ `${actual} is a case variant of the ${name} skill and this filesystem treats them as the same directory, so ${name} was not written.`,
104
+ {
105
+ fix: `Rename or remove ${actual}, then re-run \`tenjin install\`.`
106
+ }
107
+ );
108
+ }
109
+ async function assertReachable(destDir, name) {
110
+ const entry = await lstat(destDir).catch(() => null);
111
+ if (entry?.isSymbolicLink() !== true) return;
112
+ if (await realpath(destDir).catch(() => null) !== null) return;
113
+ throw new CliError("INTERNAL", `${destDir} is a broken symlink, so ${name} was not written.`, {
114
+ fix: `Point it at a directory that exists, or remove it (\`ls -ld ${destDir}\`), then re-run \`tenjin install\`.`
115
+ });
116
+ }
117
+ async function deepestExisting(dir) {
118
+ for (let cur = dir; ; cur = dirname(cur)) {
119
+ if (existsSync(cur)) return realpath(cur).catch(() => cur);
120
+ if (dirname(cur) === cur) return cur;
121
+ }
122
+ }
123
+ function wrapWriteError(err, dest, subject, culprit, opts = {}) {
124
+ const verb = opts.verb ?? "write";
125
+ const denied = hasCode(err, "EACCES") || hasCode(err, "EPERM");
126
+ const missing = hasCode(err, "ENOENT");
127
+ const wrongKind = hasCode(err, "ENOTDIR") || hasCode(err, "EISDIR");
128
+ if (!denied && !missing && !wrongKind) return err;
129
+ const fix = denied ? `Permission denied on ${culprit}. Check it (\`ls -ld ${culprit}\`), then re-run \`tenjin install\`.` : wrongKind ? `${dest} (or a path inside it) is not the kind of thing it needs to be${opts.expected ?? ""}. Check it (\`ls -ld ${dest}\`), then re-run \`tenjin install\`.` : `${dest} could not be created; if it is a symlink, check that its target exists (\`ls -ld ${dest}\`), then re-run \`tenjin install\`.`;
130
+ return new CliError(
131
+ "INTERNAL",
132
+ `Could not ${verb} ${subject} ${verb === "read" ? "at" : "to"} ${dest}.`,
133
+ { fix, cause: err }
134
+ );
135
+ }
136
+ async function readTree(dir) {
137
+ if (!existsSync(dir)) return null;
138
+ const entries = await readdir(dir, { recursive: true, withFileTypes: true });
139
+ const files = /* @__PURE__ */ new Map();
140
+ for (const entry of entries) {
141
+ if (!entry.isFile()) continue;
142
+ const full = join(entry.parentPath, entry.name);
143
+ files.set(relative(dir, full), await readFile(full));
144
+ }
145
+ return files;
146
+ }
147
+
148
+ export {
149
+ installSkill,
150
+ resolveThroughLink,
151
+ deepestExisting,
152
+ wrapWriteError
153
+ };
154
+ //# sourceMappingURL=chunk-X3OOVSPX.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../src/lib/skill-writer.ts"],"sourcesContent":["import { existsSync } from 'node:fs';\nimport { lstat, readFile, readdir, realpath, stat } from 'node:fs/promises';\nimport { dirname, join, relative } from 'node:path';\nimport { writeFileAtomic } from './atomic-json';\nimport { hasCode } from './errno';\nimport { CliError } from './errors';\nimport { HOSTED_SKILL_NAME, readSkillFile } from './skill-wiring';\n\n/**\n * Writing one packaged skill into one harness directory, and the path guards that\n * write needs. Its own module, free of the command layer's dependencies, because\n * `install` and the post-command self-heal both write skills and the heal runs on\n * every command: reaching into commands/install would parse the wallet's viem\n * chunk on a `tenjin config`.\n */\n\nexport type SkillInstallStatus =\n 'installed' | 'updated' | 'up-to-date' | 'would-install' | 'would-update';\n\nexport interface SkillInstallResult {\n status: SkillInstallStatus;\n warning?: string;\n /** Was a real copy (a SKILL.md, not just the directory) already on disk before this run? */\n preexisting: boolean;\n}\n\nexport interface SkillWriteOptions {\n /**\n * Write THROUGH a symlinked destination (default), or replace it. `install`\n * follows the link, because the operator pointed it somewhere on purpose. The\n * unattended self-heal does not, and passes false: it has already refused every\n * link it could see, and this closes the gap between that look and this write,\n * where a link appearing in between would otherwise be followed. `rename` never\n * follows its final component, so the worst a race can now do is leave our\n * regular file where the new link was.\n */\n followSymlinks?: boolean;\n}\n\nexport async function installSkill(\n srcDir: string,\n destDir: string,\n dryRun: boolean,\n name: string,\n opts: SkillWriteOptions = {},\n): Promise<SkillInstallResult> {\n const src = await readTree(srcDir);\n if (src === null) {\n // assertSkillsSource already guards SKILL.md; this is defensive for an empty dir.\n throw new CliError('INTERNAL', `Packaged skill source ${srcDir} is empty`);\n }\n\n // Only the files this package SHIPS are read and written. Everything else in the\n // directory belongs to the operator: never inspected, listed, or removed. That is\n // what package managers do (npm, dpkg, Homebrew all own their files, not the\n // directory), and wholesale replacement was the single cause behind a run of\n // data-loss, symlink and enumeration bugs.\n //\n // Resolved on BOTH paths, dry run included, so a dry run cannot promise a write\n // the real run refuses.\n const writeTo = new Map<string, string>();\n await assertReachable(destDir, name);\n await assertNoCaseCollision(destDir, name);\n for (const rel of src.keys()) {\n const declared = join(destDir, rel);\n writeTo.set(\n rel,\n opts.followSymlinks === false ? declared : await resolveThroughLink(declared, name),\n );\n }\n\n let differs = false;\n let preexisting = false;\n for (const [rel, content] of src) {\n const current = await readShippedFile(writeTo.get(rel)!, name, destDir);\n if (rel === 'SKILL.md') preexisting = current !== null;\n if (current === null || !current.equals(content)) differs = true;\n }\n const change = !preexisting ? 'create' : differs ? 'update' : 'none';\n\n if (!dryRun && change !== 'none') {\n for (const [rel, content] of src) {\n const target = writeTo.get(rel)!;\n try {\n // An existing file keeps the mode it has. A skill an operator (or their\n // dotfiles) made group-readable or read-only is theirs to have set that\n // way, and an update is no reason to hand it back at the default 0644.\n const current = await stat(target).catch(() => null);\n await writeFileAtomic(\n target,\n content,\n current === null ? {} : { mode: current.mode & 0o777 },\n );\n } catch (err) {\n // Culprit is derived from the file that FAILED, not assumed to be the\n // skills root: an existing skill directory that refuses the temp file is\n // itself the thing to chmod, and a symlinked SKILL.md fails in the link's\n // TARGET directory, which no path under destDir names.\n throw wrapWriteError(\n err,\n destDir,\n `the ${name} skill`,\n await deepestExisting(dirname(target)),\n { expected: ': a skill is a directory holding SKILL.md' },\n );\n }\n }\n }\n\n if (change === 'create') return { status: dryRun ? 'would-install' : 'installed', preexisting };\n if (change === 'none') return { status: 'up-to-date', preexisting };\n return {\n status: dryRun ? 'would-update' : 'updated',\n preexisting,\n // The hosted skill is a MIRROR of tenjin.blog/skills.md (roadmap G4), so a\n // differing local copy is a replacement, not the drift warning the CLI skills\n // get. Neither side carries a version or date, so the wording claims no\n // direction: the local file may well be a newer fetch than this package's copy.\n warning:\n name === HOSTED_SKILL_NAME\n ? `${destDir}: the hosted Tenjin skill differed and ${dryRun ? 'would be' : 'was'} replaced by this package's mirror of tenjin.blog/skills.md, which may be older; it stays as the zero-install fallback. Re-fetch it from tenjin.blog/skills.md if you need the current one.`\n : `${destDir}: local edits to ${name}'s SKILL.md ${dryRun ? 'would be' : 'were'} overwritten (the packaged copy is canonical).`,\n };\n}\n\n/**\n * Read a shipped file, or null when it is not there.\n *\n * The node-type guard lives in `readSkillFile`, shared with the wiring check and\n * the staleness check, because all three read the same operator-controlled paths\n * and a pipe at one of them used to hang whichever command got there first.\n */\nasync function readShippedFile(\n path: string,\n name: string,\n destDir: string,\n): Promise<Buffer | null> {\n const read = await readSkillFile(path);\n if (read.kind === 'absent') return null;\n if (read.kind === 'ok') return read.bytes;\n if (read.kind === 'not-regular') {\n throw new CliError('INTERNAL', `${path} is not a regular file, so ${name} was not written.`, {\n fix: `A skill file must be a regular file. Check what is there (\\`ls -l ${path}\\`) and remove or replace it, then re-run \\`tenjin install\\`.`,\n });\n }\n // Names the FILE, not its directory: this is a read failure, and pointing at a\n // perfectly writable parent is what sent operators to chmod the wrong thing.\n throw wrapWriteError(read.err, destDir, `the ${name} skill`, path, { verb: 'read' });\n}\n\n/**\n * A destination the operator manages through a symlink is written THROUGH it, so\n * their link survives and their target is what actually changes. Same call the\n * settings.json writer makes, and the same reason: committing with `rename` over a\n * link would replace it with a regular file and strand the target.\n */\nexport async function resolveThroughLink(path: string, name: string): Promise<string> {\n const entry = await lstat(path).catch(() => null);\n if (entry === null || !entry.isSymbolicLink()) return path;\n const target = await realpath(path).catch(() => null);\n if (target !== null) return target;\n throw new CliError('INTERNAL', `${path} is a broken symlink, so ${name} was not written.`, {\n fix: `Point it at a path that exists, or remove it (\\`ls -ld ${path}\\`), then re-run \\`tenjin install\\`.`,\n });\n}\n\n/**\n * On a case-insensitive filesystem (the macOS default), a user directory named a\n * case variant of a shipped skill ALIASES the skill's path, so the write would\n * replace the user's own SKILL.md under a warning naming a path that is not on\n * disk. Detected by the alias itself: the destination resolves but the parent\n * lists only a differently-cased entry, which also means a case-SENSITIVE\n * filesystem (where both names can coexist) never trips this. Dry runs too.\n */\nasync function assertNoCaseCollision(destDir: string, name: string): Promise<void> {\n if (!existsSync(destDir)) return;\n const entries = await readdir(dirname(destDir)).catch(() => null);\n if (entries === null || entries.includes(name)) return;\n const variant = entries.find((e) => e.toLowerCase() === name.toLowerCase());\n if (variant === undefined) return;\n const actual = join(dirname(destDir), variant);\n throw new CliError(\n 'INTERNAL',\n `${actual} is a case variant of the ${name} skill and this filesystem treats them as the same directory, so ${name} was not written.`,\n {\n fix: `Rename or remove ${actual}, then re-run \\`tenjin install\\`.`,\n },\n );\n}\n\n/**\n * Fail a destination directory that is a BROKEN SYMLINK, on dry runs too, so a dry\n * run cannot report `would-install` where the real run cannot write. It checks only\n * that: an unwritable but real directory passes here and fails at the write, with\n * the permission-denied error.\n */\nasync function assertReachable(destDir: string, name: string): Promise<void> {\n const entry = await lstat(destDir).catch(() => null);\n if (entry?.isSymbolicLink() !== true) return;\n if ((await realpath(destDir).catch(() => null)) !== null) return;\n throw new CliError('INTERNAL', `${destDir} is a broken symlink, so ${name} was not written.`, {\n fix: `Point it at a directory that exists, or remove it (\\`ls -ld ${destDir}\\`), then re-run \\`tenjin install\\`.`,\n });\n}\n\n/**\n * The directory a denied WRITE should point the operator at: the deepest existing\n * ancestor of the failed target's directory, RESOLVED. An existing skill directory\n * that refuses the temp file names itself; a directory that could not be created\n * names the ancestor that refused to create it, because `ls -ld` on a path that is\n * not there says nothing. Resolved because a destination managed through a symlink\n * denies the write in the link's TARGET, and telling the operator to chmod the\n * link's path leaves them staring at a healthy link.\n */\nexport async function deepestExisting(dir: string): Promise<string> {\n for (let cur = dir; ; cur = dirname(cur)) {\n if (existsSync(cur)) return realpath(cur).catch(() => cur);\n if (dirname(cur) === cur) return cur;\n }\n}\n\n/** A raw errno under INTERNAL reads as a CLI bug and carries no fix. */\nexport function wrapWriteError(\n err: unknown,\n /** The destination as the operator knows it (the declared path, pre-resolution). */\n dest: string,\n /** What could not be written, e.g. `the tenjin-search skill` or `the Tenjin pointer`. */\n subject: string,\n /**\n * The path to point the operator at. A READ failure names the file itself, which\n * is the thing whose mode is wrong. A WRITE failure names the deepest existing\n * directory on the failed target's resolved path.\n */\n culprit: string,\n opts: {\n /** Which side failed; a read error reported as \"could not write\" misleads. */\n verb?: 'read' | 'write';\n /** Sentence tail for the wrong-kind fix, telling the operator the expected shape. */\n expected?: string;\n } = {},\n): unknown {\n const verb = opts.verb ?? 'write';\n const denied = hasCode(err, 'EACCES') || hasCode(err, 'EPERM');\n const missing = hasCode(err, 'ENOENT');\n // A skills directory that resolves to a regular file, or a SKILL.md that resolves\n // to a directory. Pathological, but a raw ENOTDIR/EISDIR says nothing about which\n // path is the wrong kind of thing.\n const wrongKind = hasCode(err, 'ENOTDIR') || hasCode(err, 'EISDIR');\n if (!denied && !missing && !wrongKind) return err;\n const fix = denied\n ? `Permission denied on ${culprit}. Check it (\\`ls -ld ${culprit}\\`), then re-run \\`tenjin install\\`.`\n : wrongKind\n ? `${dest} (or a path inside it) is not the kind of thing it needs to be${opts.expected ?? ''}. Check it (\\`ls -ld ${dest}\\`), then re-run \\`tenjin install\\`.`\n : `${dest} could not be created; if it is a symlink, check that its target exists (\\`ls -ld ${dest}\\`), then re-run \\`tenjin install\\`.`;\n return new CliError(\n 'INTERNAL',\n `Could not ${verb} ${subject} ${verb === 'read' ? 'at' : 'to'} ${dest}.`,\n { fix, cause: err },\n );\n}\n\n/**\n * Read a directory tree into a rel-path -> content map, or null when it does not\n * exist. Reads as raw `Buffer`, not `utf8`: today's skills are markdown-only, but\n * this is a general recursive dir-copy, and decoding to a string here would\n * silently corrupt a future non-text asset (an image, a font) on write, or worse,\n * make two different corrupted binaries both decode to U+FFFD and compare equal.\n */\nasync function readTree(dir: string): Promise<Map<string, Buffer> | null> {\n if (!existsSync(dir)) return null;\n const entries = await readdir(dir, { recursive: true, withFileTypes: true });\n const files = new Map<string, Buffer>();\n for (const entry of entries) {\n if (!entry.isFile()) continue;\n const full = join(entry.parentPath, entry.name);\n files.set(relative(dir, full), await readFile(full));\n }\n return files;\n}\n"],"mappings":"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","names":[]}
@@ -3,19 +3,19 @@ import {
3
3
  createCandidate,
4
4
  dropCandidate,
5
5
  listCandidates
6
- } from "./chunk-VZ3AJCO5.js";
6
+ } from "./chunk-75G4REUY.js";
7
7
  import {
8
8
  UUID_RE
9
9
  } from "./chunk-WWX32ML4.js";
10
10
  import {
11
11
  sanitizeForTerminal
12
- } from "./chunk-BBUYCDSG.js";
12
+ } from "./chunk-R2VLGNFD.js";
13
13
  import {
14
14
  pathExists
15
- } from "./chunk-DAJ56EUU.js";
15
+ } from "./chunk-CTFFFQFH.js";
16
16
  import {
17
17
  CliError
18
- } from "./chunk-J6CVKC4M.js";
18
+ } from "./chunk-PZRAAAY2.js";
19
19
 
20
20
  // src/commands/candidate.ts
21
21
  import { readFile } from "fs/promises";
@@ -120,4 +120,4 @@ export {
120
120
  runCandidateList,
121
121
  runCandidateDrop
122
122
  };
123
- //# sourceMappingURL=chunk-2YX6LTCD.js.map
123
+ //# sourceMappingURL=chunk-XDW6GOHO.js.map
@@ -1,20 +1,22 @@
1
1
  import { createRequire as __tenjinCreateRequire } from 'node:module'; const require = __tenjinCreateRequire(import.meta.url);
2
2
  import {
3
3
  package_default
4
- } from "./chunk-WDJTGVKN.js";
4
+ } from "./chunk-6L34JW52.js";
5
5
  import {
6
6
  defaultIo,
7
7
  emitFailure,
8
8
  emitNotice,
9
9
  emitSuccess
10
- } from "./chunk-BBUYCDSG.js";
10
+ } from "./chunk-R2VLGNFD.js";
11
11
  import {
12
- CliError,
13
12
  dataDir,
13
+ updateCheckPath
14
+ } from "./chunk-OQXHNWM3.js";
15
+ import {
16
+ CliError,
14
17
  external_exports,
15
- updateCheckPath,
16
18
  writeFileAtomic
17
- } from "./chunk-J6CVKC4M.js";
19
+ } from "./chunk-PZRAAAY2.js";
18
20
  import {
19
21
  __commonJS,
20
22
  __require,
@@ -3619,6 +3621,13 @@ function buildProgram(io, setExit) {
3619
3621
  setExit(emitFailure(io, command, err, { json }).exitCode);
3620
3622
  }
3621
3623
  await maybeNudgeUpdate({ dir: dataDir(process.env), io, json });
3624
+ if (command !== "install") {
3625
+ try {
3626
+ const { healWiredSkills } = await import("./skill-heal-OK6YALW6.js");
3627
+ await healWiredSkills({ io });
3628
+ } catch {
3629
+ }
3630
+ }
3622
3631
  };
3623
3632
  program2.name("tenjin").description("Tenjin agent CLI for the x402 knowledge marketplace.").version(package_default.version, "-V, --version", "output the version number").option("--json", "emit machine JSON only (suppress human stderr rendering)").option("--base-url <url>", "Tenjin API base URL").option("--timeout <ms>", "request timeout in milliseconds", "10000").configureOutput({
3624
3633
  // --help / --version print here (stdout). Nothing else uses writeOut, so
@@ -3642,18 +3651,22 @@ function buildProgram(io, setExit) {
3642
3651
  ).option("--dry-run", "print what would change without writing anything").option(
3643
3652
  "--publish-mode <mode>",
3644
3653
  "set the publish consent mode non-interactively: review | auto | full-auto"
3645
- ).option("--no-wallet", "skip the wallet-setup step of the interactive walkthrough").option("--claude-md", "append the Tenjin search nudge to ~/.claude/CLAUDE.md").option("--no-claude-md", "skip the CLAUDE.md nudge (and its interactive question)").action(async function() {
3654
+ ).option("--no-wallet", "skip the wallet-setup step of the interactive walkthrough").option("--claude-md", "append the Tenjin search nudge to ~/.claude/CLAUDE.md").option("--no-claude-md", "skip the CLAUDE.md nudge").option(
3655
+ "--allow-free-verbs",
3656
+ "add the free Tenjin commands to Claude Code's ~/.claude/settings.json allowlist without asking; none can spend USDC or open the keystore, see `tenjin doctor` for the caveats"
3657
+ ).action(async function() {
3646
3658
  await runCommand("install", this, async (ctx) => {
3647
3659
  const o = this.opts();
3648
3660
  const claudeMdGiven = this.getOptionValueSource("claudeMd") !== "default";
3649
- const { runInstall } = await import("./install-7ZIYISQ7.js");
3661
+ const { runInstall } = await import("./install-BMMUPFOK.js");
3650
3662
  return runInstall(
3651
3663
  {
3652
3664
  ...Array.isArray(o.harness) && o.harness.length > 0 ? { harness: o.harness } : {},
3653
3665
  ...o.dryRun === true ? { dryRun: true } : {},
3654
3666
  ...typeof o.publishMode === "string" ? { publishMode: o.publishMode } : {},
3655
3667
  ...o.wallet === false ? { noWallet: true } : {},
3656
- ...claudeMdGiven && typeof o.claudeMd === "boolean" ? { claudeMd: o.claudeMd } : {}
3668
+ ...claudeMdGiven && typeof o.claudeMd === "boolean" ? { claudeMd: o.claudeMd } : {},
3669
+ ...o.allowFreeVerbs === true ? { allowFreeVerbs: true } : {}
3657
3670
  },
3658
3671
  ctx
3659
3672
  );
@@ -3661,7 +3674,7 @@ function buildProgram(io, setExit) {
3661
3674
  });
3662
3675
  addGlobalFlags(program2.command("doctor")).description("Check the local environment and Tenjin API reachability").action(async function() {
3663
3676
  await runCommand("doctor", this, async (ctx) => {
3664
- const { runDoctor } = await import("./doctor-ENJ22XWN.js");
3677
+ const { runDoctor } = await import("./doctor-6PEYDTB5.js");
3665
3678
  return runDoctor(ctx);
3666
3679
  });
3667
3680
  });
@@ -3670,19 +3683,19 @@ function buildProgram(io, setExit) {
3670
3683
  );
3671
3684
  config.action(async function() {
3672
3685
  await runCommand("config", this, async (ctx) => {
3673
- const { runConfigList } = await import("./config-SAQEQRFB.js");
3686
+ const { runConfigList } = await import("./config-VT5WU47R.js");
3674
3687
  return runConfigList(ctx);
3675
3688
  });
3676
3689
  });
3677
3690
  addGlobalFlags(config.command("get <key>")).description("Print one effective config value").action(async function(key) {
3678
3691
  await runCommand("config.get", this, async (ctx) => {
3679
- const { runConfigGet } = await import("./config-SAQEQRFB.js");
3692
+ const { runConfigGet } = await import("./config-VT5WU47R.js");
3680
3693
  return runConfigGet({ key }, ctx);
3681
3694
  });
3682
3695
  });
3683
3696
  addGlobalFlags(config.command("set <key> <value>")).description("Set a config value (decimal USD accepted for spend keys)").action(async function(key, value) {
3684
3697
  await runCommand("config.set", this, async (ctx) => {
3685
- const { runConfigSet } = await import("./config-SAQEQRFB.js");
3698
+ const { runConfigSet } = await import("./config-VT5WU47R.js");
3686
3699
  return runConfigSet({ key, value }, ctx);
3687
3700
  });
3688
3701
  });
@@ -3695,19 +3708,19 @@ function buildProgram(io, setExit) {
3695
3708
  ).action(async function() {
3696
3709
  await runCommand("wallet.create", this, async (ctx) => {
3697
3710
  const o = this.opts();
3698
- const { runWalletCreate } = await import("./wallet-OCCGEH6H.js");
3711
+ const { runWalletCreate } = await import("./wallet-XVRLJZ63.js");
3699
3712
  return runWalletCreate(ctx, o.replace === true ? { replace: true } : {});
3700
3713
  });
3701
3714
  });
3702
3715
  addGlobalFlags(wallet.command("show")).description("Show the wallet address and key source (never the key)").action(async function() {
3703
3716
  await runCommand("wallet.show", this, async (ctx) => {
3704
- const { runWalletShow } = await import("./wallet-OCCGEH6H.js");
3717
+ const { runWalletShow } = await import("./wallet-XVRLJZ63.js");
3705
3718
  return runWalletShow(ctx);
3706
3719
  });
3707
3720
  });
3708
3721
  addGlobalFlags(wallet.command("balance")).description("Show the wallet USDC balance on Base").action(async function() {
3709
3722
  await runCommand("wallet.balance", this, async (ctx) => {
3710
- const { runWalletBalance } = await import("./wallet-OCCGEH6H.js");
3723
+ const { runWalletBalance } = await import("./wallet-XVRLJZ63.js");
3711
3724
  return runWalletBalance(ctx);
3712
3725
  });
3713
3726
  });
@@ -3716,7 +3729,7 @@ function buildProgram(io, setExit) {
3716
3729
  ).option("--yes", "skip the interactive confirm (required to send when not at a TTY)").action(async function(amount, token, to) {
3717
3730
  await runCommand("send", this, async (ctx) => {
3718
3731
  const o = this.opts();
3719
- const { runSend } = await import("./send-ENE47KQE.js");
3732
+ const { runSend } = await import("./send-RWOBFOBK.js");
3720
3733
  return runSend({ amount, token, to, ...o.yes === true ? { yes: true } : {} }, ctx);
3721
3734
  });
3722
3735
  });
@@ -3725,7 +3738,7 @@ function buildProgram(io, setExit) {
3725
3738
  ).option("--max-price <usd>", "only candidates at or below this decimal-USD price").option("--fresh-within <window>", "freshness window, e.g. P30D, P2W, P1Y").option("--limit <n>", "maximum candidates (1-10, default 5)").option("--applies-to <pair>", "applicability filter key=value (repeatable)", collect, []).action(async function(question) {
3726
3739
  await runCommand("search", this, async (ctx) => {
3727
3740
  const o = this.opts();
3728
- const { runSearch } = await import("./search-63ELMRZH.js");
3741
+ const { runSearch } = await import("./search-Z2YALF6S.js");
3729
3742
  return runSearch(
3730
3743
  {
3731
3744
  question,
@@ -3742,7 +3755,7 @@ function buildProgram(io, setExit) {
3742
3755
  "Show a candidate's pre-purchase card / preview. Use after search, before buy, to check price, scope, and freshness; it never pays"
3743
3756
  ).action(async function(resource) {
3744
3757
  await runCommand("inspect", this, async (ctx) => {
3745
- const { runInspect } = await import("./inspect-IPKKQB2S.js");
3758
+ const { runInspect } = await import("./inspect-ITZIRZDV.js");
3746
3759
  return runInspect({ ref: resource }, ctx);
3747
3760
  });
3748
3761
  });
@@ -3754,7 +3767,7 @@ function buildProgram(io, setExit) {
3754
3767
  ).action(async function(resource) {
3755
3768
  await runCommand("read", this, async (ctx) => {
3756
3769
  const o = this.opts();
3757
- const { runRead } = await import("./read-5TQR7LCF.js");
3770
+ const { runRead } = await import("./read-II2ZO4II.js");
3758
3771
  return runRead(
3759
3772
  {
3760
3773
  ref: resource,
@@ -3775,7 +3788,7 @@ function buildProgram(io, setExit) {
3775
3788
  ).option("--scope <scope>", "session scope; this version mints `read` only (default: read)").action(async function() {
3776
3789
  await runCommand("session.start", this, async (ctx) => {
3777
3790
  const o = this.opts();
3778
- const { runSessionStart } = await import("./session-FZU4VFFE.js");
3791
+ const { runSessionStart } = await import("./session-DJV5T3BG.js");
3779
3792
  return runSessionStart(typeof o.scope === "string" ? { scope: o.scope } : {}, ctx);
3780
3793
  });
3781
3794
  });
@@ -3787,7 +3800,7 @@ function buildProgram(io, setExit) {
3787
3800
  ).action(async function(resource) {
3788
3801
  await runCommand("buy", this, async (ctx) => {
3789
3802
  const o = this.opts();
3790
- const { runBuy } = await import("./buy-XVOMNWKN.js");
3803
+ const { runBuy } = await import("./buy-3PPC2SRQ.js");
3791
3804
  return runBuy(
3792
3805
  {
3793
3806
  ref: resource,
@@ -3808,7 +3821,7 @@ function buildProgram(io, setExit) {
3808
3821
  ).option("--draft", "save as a private draft instead of publishing").option("--yes", "clear soft findings and the review confirm (never a hard block)").option("--mode <mode>", "consent mode for this run: review | auto | full-auto").option("--price <usd>", "post price in decimal USD (defaults to publish.defaultPrice)").option("--question <text>", "a question this piece answers (repeatable)", collect, []).option("--task <text>", "a task this piece supports (repeatable)", collect, []).option("--scope <text>", "what the piece covers (card scope)").option("--exclusions <text>", "what the piece does not cover (card exclusions)").option("--applies-to <pair>", "applicability key=value (repeatable)", collect, []).option("--as-of <iso>", "as-of timestamp, ISO-8601 with offset").option("--valid-until <iso>", "valid-until timestamp, ISO-8601 with offset").option("--artifact-type <type>", "document | skill | dataset").option("--temporal-mode <mode>", "snapshot | maintained | evergreen").option("--provenance <text>", "provenance summary (card)").option("--methodology <text>", "methodology summary (card)").action(async function(file) {
3809
3822
  await runCommand("publish", this, async (ctx) => {
3810
3823
  const o = this.opts();
3811
- const { runPublish } = await import("./publish-7WIFFNFG.js");
3824
+ const { runPublish } = await import("./publish-F5G5WIFI.js");
3812
3825
  return runPublish(
3813
3826
  {
3814
3827
  ...typeof file === "string" ? { file } : {},
@@ -3863,7 +3876,7 @@ function buildProgram(io, setExit) {
3863
3876
  ).action(async function(postId) {
3864
3877
  await runCommand("edit", this, async (ctx) => {
3865
3878
  const o = this.opts();
3866
- const { runEdit } = await import("./edit-2QO5GQDU.js");
3879
+ const { runEdit } = await import("./edit-GKI37CRM.js");
3867
3880
  return runEdit(
3868
3881
  {
3869
3882
  postId,
@@ -3900,7 +3913,7 @@ function buildProgram(io, setExit) {
3900
3913
  ).option("--resource <id>", "the resourceId the outcome concerns").option("--content-hash <hash>", "sha256:<64hex> of the exact body read").action(async function() {
3901
3914
  await runCommand("outcome", this, async (ctx) => {
3902
3915
  const o = this.opts();
3903
- const { runOutcome } = await import("./outcome-NSDE2KAJ.js");
3916
+ const { runOutcome } = await import("./outcome-F5KN3K3Y.js");
3904
3917
  return runOutcome(
3905
3918
  {
3906
3919
  status: String(o.status),
@@ -3921,7 +3934,7 @@ function buildProgram(io, setExit) {
3921
3934
  addGlobalFlags(candidate.command("add <file>")).description("Park a Markdown draft as a publish candidate, tied to a search").requiredOption("--search-id <id>", "the search whose unmet demand this draft answers").option("--question <q>", "the question this draft answers").action(async function(file) {
3922
3935
  await runCommand("candidate.add", this, async (ctx) => {
3923
3936
  const o = this.opts();
3924
- const { runCandidateAdd } = await import("./candidate-DJB2NNTG.js");
3937
+ const { runCandidateAdd } = await import("./candidate-FCBWDN4Y.js");
3925
3938
  return runCandidateAdd(
3926
3939
  {
3927
3940
  file,
@@ -3934,19 +3947,19 @@ function buildProgram(io, setExit) {
3934
3947
  });
3935
3948
  addGlobalFlags(candidate.command("list")).description("List pending candidates, newest first").action(async function() {
3936
3949
  await runCommand("candidate.list", this, async (ctx) => {
3937
- const { runCandidateList } = await import("./candidate-DJB2NNTG.js");
3950
+ const { runCandidateList } = await import("./candidate-FCBWDN4Y.js");
3938
3951
  return runCandidateList(ctx);
3939
3952
  });
3940
3953
  });
3941
3954
  addGlobalFlags(candidate.command("drop <id>")).description("Discard a pending candidate (never auto-deleted)").action(async function(id) {
3942
3955
  await runCommand("candidate.drop", this, async (ctx) => {
3943
- const { runCandidateDrop } = await import("./candidate-DJB2NNTG.js");
3956
+ const { runCandidateDrop } = await import("./candidate-FCBWDN4Y.js");
3944
3957
  return runCandidateDrop({ id }, ctx);
3945
3958
  });
3946
3959
  });
3947
3960
  addGlobalFlags(program2.command("mcp")).description("Run a local stdio MCP server exposing the Tenjin command cores to an MCP client").action(async function() {
3948
3961
  const ctx = buildContext(this, io);
3949
- const { runMcpServer } = await import("./run-NPKIP26Y.js");
3962
+ const { runMcpServer } = await import("./run-FJWMRXZ7.js");
3950
3963
  await runMcpServer({ dataDir: ctx.dataDir, flags: ctx.flags });
3951
3964
  });
3952
3965
  return program2;
@@ -3988,4 +4001,4 @@ export {
3988
4001
  buildProgram,
3989
4002
  main
3990
4003
  };
3991
- //# sourceMappingURL=cli-7B2QNJG3.js.map
4004
+ //# sourceMappingURL=cli-ATFP3O6Y.js.map