tenjin-cli 0.1.0-alpha.8 → 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 (124) hide show
  1. package/README.md +26 -0
  2. package/dist/{buy-K2G6XQY2.js → buy-3PPC2SRQ.js} +23 -21
  3. package/dist/{candidate-DJB2NNTG.js → candidate-FCBWDN4Y.js} +10 -8
  4. package/dist/{chunk-NVHQCTIC.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-DQDGBWWH.js → chunk-6L34JW52.js} +3 -2
  9. package/dist/chunk-6L34JW52.js.map +1 -0
  10. package/dist/{chunk-XFHZWORF.js → chunk-6RODLWPQ.js} +101 -35
  11. package/dist/chunk-6RODLWPQ.js.map +1 -0
  12. package/dist/{chunk-VZ3AJCO5.js → chunk-75G4REUY.js} +2 -2
  13. package/dist/{chunk-C3S6725N.js → chunk-7MJCZ2OX.js} +12 -12
  14. package/dist/{chunk-PCLPVJ3J.js → chunk-7WDY4AXV.js} +15 -15
  15. package/dist/{chunk-RGTTACP3.js → chunk-ATSCQETF.js} +5 -5
  16. package/dist/{chunk-QB2NNV6C.js → chunk-AX5WQ3H5.js} +8 -6
  17. package/dist/{chunk-QB2NNV6C.js.map → chunk-AX5WQ3H5.js.map} +1 -1
  18. package/dist/{chunk-WRWCDLVK.js → chunk-BFAFOBO3.js} +23 -4
  19. package/dist/chunk-BFAFOBO3.js.map +1 -0
  20. package/dist/{chunk-DAJ56EUU.js → chunk-CTFFFQFH.js} +3 -3
  21. package/dist/{chunk-B7YB4MMU.js → chunk-E5PZEPUO.js} +9 -9
  22. package/dist/{chunk-GABYDXWL.js → chunk-FFTWWJRW.js} +21 -5
  23. package/dist/{chunk-GABYDXWL.js.map → chunk-FFTWWJRW.js.map} +1 -1
  24. package/dist/{chunk-6OE2IJMH.js → chunk-G7ECLIN6.js} +22 -22
  25. package/dist/{chunk-CYRYVZPN.js → chunk-GJKDWZ6X.js} +3 -3
  26. package/dist/{chunk-RGFBBNGP.js → chunk-I4WQXOEL.js} +16 -13
  27. package/dist/chunk-I4WQXOEL.js.map +1 -0
  28. package/dist/{chunk-OTDI5FXG.js → chunk-JURZ2T2I.js} +3 -3
  29. package/dist/{chunk-UYP7G3GZ.js → chunk-KRHUDEIQ.js} +10 -172
  30. package/dist/chunk-KRHUDEIQ.js.map +1 -0
  31. package/dist/{chunk-P3FBESBB.js → chunk-MHRREGGN.js} +5 -10
  32. package/dist/chunk-MHRREGGN.js.map +1 -0
  33. package/dist/chunk-OQXHNWM3.js +47 -0
  34. package/dist/chunk-OQXHNWM3.js.map +1 -0
  35. package/dist/chunk-P74I3WH4.js +204 -0
  36. package/dist/chunk-P74I3WH4.js.map +1 -0
  37. package/dist/{chunk-6ZBZCBR7.js → chunk-PT2NJUGG.js} +6 -6
  38. package/dist/{chunk-J6CVKC4M.js → chunk-PZRAAAY2.js} +4 -46
  39. package/dist/chunk-PZRAAAY2.js.map +1 -0
  40. package/dist/{chunk-XBJ3VLWX.js → chunk-PZSUWDF2.js} +2 -2
  41. package/dist/{chunk-BBUYCDSG.js → chunk-R2VLGNFD.js} +7 -2
  42. package/dist/chunk-R2VLGNFD.js.map +1 -0
  43. package/dist/{chunk-ZA3RFDAV.js → chunk-S4IKXAUA.js} +6 -10
  44. package/dist/chunk-S4IKXAUA.js.map +1 -0
  45. package/dist/{chunk-EDENZN2Q.js → chunk-TMZIXYPL.js} +7 -7
  46. package/dist/{chunk-YBMMV4Y4.js → chunk-TYVLXAB5.js} +26 -4
  47. package/dist/chunk-TYVLXAB5.js.map +1 -0
  48. package/dist/{chunk-URSGGRO4.js → chunk-V7BWPOKT.js} +38 -19
  49. package/dist/chunk-V7BWPOKT.js.map +1 -0
  50. package/dist/{chunk-L6AV2Q73.js → chunk-VE5BALOI.js} +5 -5
  51. package/dist/{chunk-GM4RZUVU.js → chunk-WGXUVCUF.js} +8 -6
  52. package/dist/{chunk-GM4RZUVU.js.map → chunk-WGXUVCUF.js.map} +1 -1
  53. package/dist/chunk-X3OOVSPX.js +154 -0
  54. package/dist/chunk-X3OOVSPX.js.map +1 -0
  55. package/dist/{chunk-2YX6LTCD.js → chunk-XDW6GOHO.js} +5 -5
  56. package/dist/{cli-KNCYWMAG.js → cli-ATFP3O6Y.js} +36 -27
  57. package/dist/{cli-KNCYWMAG.js.map → cli-ATFP3O6Y.js.map} +1 -1
  58. package/dist/{config-SAQEQRFB.js → config-VT5WU47R.js} +9 -6
  59. package/dist/doctor-6PEYDTB5.js +24 -0
  60. package/dist/{edit-IZZ2HIMR.js → edit-GKI37CRM.js} +21 -19
  61. package/dist/index.js +1 -1
  62. package/dist/{inspect-BFWZ5XOP.js → inspect-ITZIRZDV.js} +19 -16
  63. package/dist/{install-QXZCHIBT.js → install-BMMUPFOK.js} +217 -118
  64. package/dist/install-BMMUPFOK.js.map +1 -0
  65. package/dist/outcome-F5KN3K3Y.js +23 -0
  66. package/dist/{publish-5NTCRF2V.js → publish-F5G5WIFI.js} +22 -20
  67. package/dist/{read-T6OTMU72.js → read-II2ZO4II.js} +20 -18
  68. package/dist/{read-T6OTMU72.js.map → read-II2ZO4II.js.map} +1 -1
  69. package/dist/{run-5OGX64IY.js → run-FJWMRXZ7.js} +65 -42
  70. package/dist/run-FJWMRXZ7.js.map +1 -0
  71. package/dist/search-Z2YALF6S.js +26 -0
  72. package/dist/{send-ENE47KQE.js → send-RWOBFOBK.js} +20 -18
  73. package/dist/{send-ENE47KQE.js.map → send-RWOBFOBK.js.map} +1 -1
  74. package/dist/{session-HY4QIWHV.js → session-DJV5T3BG.js} +16 -14
  75. package/dist/{session-HY4QIWHV.js.map → session-DJV5T3BG.js.map} +1 -1
  76. package/dist/skill-heal-OK6YALW6.js +85 -0
  77. package/dist/skill-heal-OK6YALW6.js.map +1 -0
  78. package/dist/{wallet-RBDVNZVR.js → wallet-AB4ISFMY.js} +8 -7
  79. package/dist/{wallet-OCCGEH6H.js → wallet-XVRLJZ63.js} +12 -10
  80. package/package.json +2 -1
  81. package/skills/tenjin/SKILL.md +76 -41
  82. package/skills/tenjin-search/SKILL.md +10 -6
  83. package/dist/chunk-BBUYCDSG.js.map +0 -1
  84. package/dist/chunk-DQDGBWWH.js.map +0 -1
  85. package/dist/chunk-J6CVKC4M.js.map +0 -1
  86. package/dist/chunk-NVHQCTIC.js.map +0 -1
  87. package/dist/chunk-P3FBESBB.js.map +0 -1
  88. package/dist/chunk-RGFBBNGP.js.map +0 -1
  89. package/dist/chunk-URSGGRO4.js.map +0 -1
  90. package/dist/chunk-UYP7G3GZ.js.map +0 -1
  91. package/dist/chunk-WRWCDLVK.js.map +0 -1
  92. package/dist/chunk-XFHZWORF.js.map +0 -1
  93. package/dist/chunk-YBMMV4Y4.js.map +0 -1
  94. package/dist/chunk-ZA3RFDAV.js.map +0 -1
  95. package/dist/doctor-FBRQNOUQ.js +0 -22
  96. package/dist/install-QXZCHIBT.js.map +0 -1
  97. package/dist/outcome-VXCBEGNC.js +0 -20
  98. package/dist/run-5OGX64IY.js.map +0 -1
  99. package/dist/search-LIIWUMWV.js +0 -24
  100. /package/dist/{buy-K2G6XQY2.js.map → buy-3PPC2SRQ.js.map} +0 -0
  101. /package/dist/{candidate-DJB2NNTG.js.map → candidate-FCBWDN4Y.js.map} +0 -0
  102. /package/dist/{chunk-VZ3AJCO5.js.map → chunk-75G4REUY.js.map} +0 -0
  103. /package/dist/{chunk-C3S6725N.js.map → chunk-7MJCZ2OX.js.map} +0 -0
  104. /package/dist/{chunk-PCLPVJ3J.js.map → chunk-7WDY4AXV.js.map} +0 -0
  105. /package/dist/{chunk-RGTTACP3.js.map → chunk-ATSCQETF.js.map} +0 -0
  106. /package/dist/{chunk-DAJ56EUU.js.map → chunk-CTFFFQFH.js.map} +0 -0
  107. /package/dist/{chunk-B7YB4MMU.js.map → chunk-E5PZEPUO.js.map} +0 -0
  108. /package/dist/{chunk-6OE2IJMH.js.map → chunk-G7ECLIN6.js.map} +0 -0
  109. /package/dist/{chunk-CYRYVZPN.js.map → chunk-GJKDWZ6X.js.map} +0 -0
  110. /package/dist/{chunk-OTDI5FXG.js.map → chunk-JURZ2T2I.js.map} +0 -0
  111. /package/dist/{chunk-6ZBZCBR7.js.map → chunk-PT2NJUGG.js.map} +0 -0
  112. /package/dist/{chunk-XBJ3VLWX.js.map → chunk-PZSUWDF2.js.map} +0 -0
  113. /package/dist/{chunk-EDENZN2Q.js.map → chunk-TMZIXYPL.js.map} +0 -0
  114. /package/dist/{chunk-L6AV2Q73.js.map → chunk-VE5BALOI.js.map} +0 -0
  115. /package/dist/{chunk-2YX6LTCD.js.map → chunk-XDW6GOHO.js.map} +0 -0
  116. /package/dist/{config-SAQEQRFB.js.map → config-VT5WU47R.js.map} +0 -0
  117. /package/dist/{doctor-FBRQNOUQ.js.map → doctor-6PEYDTB5.js.map} +0 -0
  118. /package/dist/{edit-IZZ2HIMR.js.map → edit-GKI37CRM.js.map} +0 -0
  119. /package/dist/{inspect-BFWZ5XOP.js.map → inspect-ITZIRZDV.js.map} +0 -0
  120. /package/dist/{outcome-VXCBEGNC.js.map → outcome-F5KN3K3Y.js.map} +0 -0
  121. /package/dist/{publish-5NTCRF2V.js.map → publish-F5G5WIFI.js.map} +0 -0
  122. /package/dist/{search-LIIWUMWV.js.map → search-Z2YALF6S.js.map} +0 -0
  123. /package/dist/{wallet-OCCGEH6H.js.map → wallet-AB4ISFMY.js.map} +0 -0
  124. /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-DQDGBWWH.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
@@ -3649,7 +3658,7 @@ function buildProgram(io, setExit) {
3649
3658
  await runCommand("install", this, async (ctx) => {
3650
3659
  const o = this.opts();
3651
3660
  const claudeMdGiven = this.getOptionValueSource("claudeMd") !== "default";
3652
- const { runInstall } = await import("./install-QXZCHIBT.js");
3661
+ const { runInstall } = await import("./install-BMMUPFOK.js");
3653
3662
  return runInstall(
3654
3663
  {
3655
3664
  ...Array.isArray(o.harness) && o.harness.length > 0 ? { harness: o.harness } : {},
@@ -3665,7 +3674,7 @@ function buildProgram(io, setExit) {
3665
3674
  });
3666
3675
  addGlobalFlags(program2.command("doctor")).description("Check the local environment and Tenjin API reachability").action(async function() {
3667
3676
  await runCommand("doctor", this, async (ctx) => {
3668
- const { runDoctor } = await import("./doctor-FBRQNOUQ.js");
3677
+ const { runDoctor } = await import("./doctor-6PEYDTB5.js");
3669
3678
  return runDoctor(ctx);
3670
3679
  });
3671
3680
  });
@@ -3674,19 +3683,19 @@ function buildProgram(io, setExit) {
3674
3683
  );
3675
3684
  config.action(async function() {
3676
3685
  await runCommand("config", this, async (ctx) => {
3677
- const { runConfigList } = await import("./config-SAQEQRFB.js");
3686
+ const { runConfigList } = await import("./config-VT5WU47R.js");
3678
3687
  return runConfigList(ctx);
3679
3688
  });
3680
3689
  });
3681
3690
  addGlobalFlags(config.command("get <key>")).description("Print one effective config value").action(async function(key) {
3682
3691
  await runCommand("config.get", this, async (ctx) => {
3683
- const { runConfigGet } = await import("./config-SAQEQRFB.js");
3692
+ const { runConfigGet } = await import("./config-VT5WU47R.js");
3684
3693
  return runConfigGet({ key }, ctx);
3685
3694
  });
3686
3695
  });
3687
3696
  addGlobalFlags(config.command("set <key> <value>")).description("Set a config value (decimal USD accepted for spend keys)").action(async function(key, value) {
3688
3697
  await runCommand("config.set", this, async (ctx) => {
3689
- const { runConfigSet } = await import("./config-SAQEQRFB.js");
3698
+ const { runConfigSet } = await import("./config-VT5WU47R.js");
3690
3699
  return runConfigSet({ key, value }, ctx);
3691
3700
  });
3692
3701
  });
@@ -3699,19 +3708,19 @@ function buildProgram(io, setExit) {
3699
3708
  ).action(async function() {
3700
3709
  await runCommand("wallet.create", this, async (ctx) => {
3701
3710
  const o = this.opts();
3702
- const { runWalletCreate } = await import("./wallet-OCCGEH6H.js");
3711
+ const { runWalletCreate } = await import("./wallet-XVRLJZ63.js");
3703
3712
  return runWalletCreate(ctx, o.replace === true ? { replace: true } : {});
3704
3713
  });
3705
3714
  });
3706
3715
  addGlobalFlags(wallet.command("show")).description("Show the wallet address and key source (never the key)").action(async function() {
3707
3716
  await runCommand("wallet.show", this, async (ctx) => {
3708
- const { runWalletShow } = await import("./wallet-OCCGEH6H.js");
3717
+ const { runWalletShow } = await import("./wallet-XVRLJZ63.js");
3709
3718
  return runWalletShow(ctx);
3710
3719
  });
3711
3720
  });
3712
3721
  addGlobalFlags(wallet.command("balance")).description("Show the wallet USDC balance on Base").action(async function() {
3713
3722
  await runCommand("wallet.balance", this, async (ctx) => {
3714
- const { runWalletBalance } = await import("./wallet-OCCGEH6H.js");
3723
+ const { runWalletBalance } = await import("./wallet-XVRLJZ63.js");
3715
3724
  return runWalletBalance(ctx);
3716
3725
  });
3717
3726
  });
@@ -3720,7 +3729,7 @@ function buildProgram(io, setExit) {
3720
3729
  ).option("--yes", "skip the interactive confirm (required to send when not at a TTY)").action(async function(amount, token, to) {
3721
3730
  await runCommand("send", this, async (ctx) => {
3722
3731
  const o = this.opts();
3723
- const { runSend } = await import("./send-ENE47KQE.js");
3732
+ const { runSend } = await import("./send-RWOBFOBK.js");
3724
3733
  return runSend({ amount, token, to, ...o.yes === true ? { yes: true } : {} }, ctx);
3725
3734
  });
3726
3735
  });
@@ -3729,7 +3738,7 @@ function buildProgram(io, setExit) {
3729
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) {
3730
3739
  await runCommand("search", this, async (ctx) => {
3731
3740
  const o = this.opts();
3732
- const { runSearch } = await import("./search-LIIWUMWV.js");
3741
+ const { runSearch } = await import("./search-Z2YALF6S.js");
3733
3742
  return runSearch(
3734
3743
  {
3735
3744
  question,
@@ -3746,7 +3755,7 @@ function buildProgram(io, setExit) {
3746
3755
  "Show a candidate's pre-purchase card / preview. Use after search, before buy, to check price, scope, and freshness; it never pays"
3747
3756
  ).action(async function(resource) {
3748
3757
  await runCommand("inspect", this, async (ctx) => {
3749
- const { runInspect } = await import("./inspect-BFWZ5XOP.js");
3758
+ const { runInspect } = await import("./inspect-ITZIRZDV.js");
3750
3759
  return runInspect({ ref: resource }, ctx);
3751
3760
  });
3752
3761
  });
@@ -3758,7 +3767,7 @@ function buildProgram(io, setExit) {
3758
3767
  ).action(async function(resource) {
3759
3768
  await runCommand("read", this, async (ctx) => {
3760
3769
  const o = this.opts();
3761
- const { runRead } = await import("./read-T6OTMU72.js");
3770
+ const { runRead } = await import("./read-II2ZO4II.js");
3762
3771
  return runRead(
3763
3772
  {
3764
3773
  ref: resource,
@@ -3779,7 +3788,7 @@ function buildProgram(io, setExit) {
3779
3788
  ).option("--scope <scope>", "session scope; this version mints `read` only (default: read)").action(async function() {
3780
3789
  await runCommand("session.start", this, async (ctx) => {
3781
3790
  const o = this.opts();
3782
- const { runSessionStart } = await import("./session-HY4QIWHV.js");
3791
+ const { runSessionStart } = await import("./session-DJV5T3BG.js");
3783
3792
  return runSessionStart(typeof o.scope === "string" ? { scope: o.scope } : {}, ctx);
3784
3793
  });
3785
3794
  });
@@ -3791,7 +3800,7 @@ function buildProgram(io, setExit) {
3791
3800
  ).action(async function(resource) {
3792
3801
  await runCommand("buy", this, async (ctx) => {
3793
3802
  const o = this.opts();
3794
- const { runBuy } = await import("./buy-K2G6XQY2.js");
3803
+ const { runBuy } = await import("./buy-3PPC2SRQ.js");
3795
3804
  return runBuy(
3796
3805
  {
3797
3806
  ref: resource,
@@ -3812,7 +3821,7 @@ function buildProgram(io, setExit) {
3812
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) {
3813
3822
  await runCommand("publish", this, async (ctx) => {
3814
3823
  const o = this.opts();
3815
- const { runPublish } = await import("./publish-5NTCRF2V.js");
3824
+ const { runPublish } = await import("./publish-F5G5WIFI.js");
3816
3825
  return runPublish(
3817
3826
  {
3818
3827
  ...typeof file === "string" ? { file } : {},
@@ -3867,7 +3876,7 @@ function buildProgram(io, setExit) {
3867
3876
  ).action(async function(postId) {
3868
3877
  await runCommand("edit", this, async (ctx) => {
3869
3878
  const o = this.opts();
3870
- const { runEdit } = await import("./edit-IZZ2HIMR.js");
3879
+ const { runEdit } = await import("./edit-GKI37CRM.js");
3871
3880
  return runEdit(
3872
3881
  {
3873
3882
  postId,
@@ -3904,7 +3913,7 @@ function buildProgram(io, setExit) {
3904
3913
  ).option("--resource <id>", "the resourceId the outcome concerns").option("--content-hash <hash>", "sha256:<64hex> of the exact body read").action(async function() {
3905
3914
  await runCommand("outcome", this, async (ctx) => {
3906
3915
  const o = this.opts();
3907
- const { runOutcome } = await import("./outcome-VXCBEGNC.js");
3916
+ const { runOutcome } = await import("./outcome-F5KN3K3Y.js");
3908
3917
  return runOutcome(
3909
3918
  {
3910
3919
  status: String(o.status),
@@ -3925,7 +3934,7 @@ function buildProgram(io, setExit) {
3925
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) {
3926
3935
  await runCommand("candidate.add", this, async (ctx) => {
3927
3936
  const o = this.opts();
3928
- const { runCandidateAdd } = await import("./candidate-DJB2NNTG.js");
3937
+ const { runCandidateAdd } = await import("./candidate-FCBWDN4Y.js");
3929
3938
  return runCandidateAdd(
3930
3939
  {
3931
3940
  file,
@@ -3938,19 +3947,19 @@ function buildProgram(io, setExit) {
3938
3947
  });
3939
3948
  addGlobalFlags(candidate.command("list")).description("List pending candidates, newest first").action(async function() {
3940
3949
  await runCommand("candidate.list", this, async (ctx) => {
3941
- const { runCandidateList } = await import("./candidate-DJB2NNTG.js");
3950
+ const { runCandidateList } = await import("./candidate-FCBWDN4Y.js");
3942
3951
  return runCandidateList(ctx);
3943
3952
  });
3944
3953
  });
3945
3954
  addGlobalFlags(candidate.command("drop <id>")).description("Discard a pending candidate (never auto-deleted)").action(async function(id) {
3946
3955
  await runCommand("candidate.drop", this, async (ctx) => {
3947
- const { runCandidateDrop } = await import("./candidate-DJB2NNTG.js");
3956
+ const { runCandidateDrop } = await import("./candidate-FCBWDN4Y.js");
3948
3957
  return runCandidateDrop({ id }, ctx);
3949
3958
  });
3950
3959
  });
3951
3960
  addGlobalFlags(program2.command("mcp")).description("Run a local stdio MCP server exposing the Tenjin command cores to an MCP client").action(async function() {
3952
3961
  const ctx = buildContext(this, io);
3953
- const { runMcpServer } = await import("./run-5OGX64IY.js");
3962
+ const { runMcpServer } = await import("./run-FJWMRXZ7.js");
3954
3963
  await runMcpServer({ dataDir: ctx.dataDir, flags: ctx.flags });
3955
3964
  });
3956
3965
  return program2;
@@ -3992,4 +4001,4 @@ export {
3992
4001
  buildProgram,
3993
4002
  main
3994
4003
  };
3995
- //# sourceMappingURL=cli-KNCYWMAG.js.map
4004
+ //# sourceMappingURL=cli-ATFP3O6Y.js.map