tenjin-cli 0.1.0-alpha.5 → 0.1.0-alpha.8

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 (121) hide show
  1. package/README.md +169 -199
  2. package/dist/{buy-YMXXVNFH.js → buy-K2G6XQY2.js} +20 -18
  3. package/dist/{candidate-H7FR4AU5.js → candidate-DJB2NNTG.js} +7 -8
  4. package/dist/{chunk-ZW3B5LWX.js → chunk-2YX6LTCD.js} +5 -5
  5. package/dist/{chunk-4WVKXKDK.js → chunk-6OE2IJMH.js} +29 -238
  6. package/dist/chunk-6OE2IJMH.js.map +1 -0
  7. package/dist/{chunk-ADJYSM45.js → chunk-6ZBZCBR7.js} +27 -13
  8. package/dist/chunk-6ZBZCBR7.js.map +1 -0
  9. package/dist/{chunk-HTDALK7M.js → chunk-B7YB4MMU.js} +15 -12
  10. package/dist/{chunk-HTDALK7M.js.map → chunk-B7YB4MMU.js.map} +1 -1
  11. package/dist/{chunk-NFSOVL3C.js → chunk-BBUYCDSG.js} +12 -3
  12. package/dist/chunk-BBUYCDSG.js.map +1 -0
  13. package/dist/chunk-C3S6725N.js +337 -0
  14. package/dist/chunk-C3S6725N.js.map +1 -0
  15. package/dist/chunk-CYRYVZPN.js +213 -0
  16. package/dist/chunk-CYRYVZPN.js.map +1 -0
  17. package/dist/{chunk-MDDGEGSW.js → chunk-DAJ56EUU.js} +3 -3
  18. package/dist/{chunk-IOPWPMT2.js → chunk-DH6D6QIO.js} +5 -5
  19. package/dist/{chunk-NJF2WENW.js → chunk-DQDGBWWH.js} +4 -2
  20. package/dist/chunk-DQDGBWWH.js.map +1 -0
  21. package/dist/chunk-EDENZN2Q.js +614 -0
  22. package/dist/chunk-EDENZN2Q.js.map +1 -0
  23. package/dist/chunk-GABYDXWL.js +190 -0
  24. package/dist/chunk-GABYDXWL.js.map +1 -0
  25. package/dist/{chunk-LAM66WFJ.js → chunk-GM4RZUVU.js} +6 -8
  26. package/dist/{chunk-LAM66WFJ.js.map → chunk-GM4RZUVU.js.map} +1 -1
  27. package/dist/{chunk-PAUXMRSF.js → chunk-J6CVKC4M.js} +73 -2
  28. package/dist/chunk-J6CVKC4M.js.map +1 -0
  29. package/dist/chunk-L6AV2Q73.js +105 -0
  30. package/dist/chunk-L6AV2Q73.js.map +1 -0
  31. package/dist/{chunk-PYNSGYBE.js → chunk-NVHQCTIC.js} +249 -552
  32. package/dist/chunk-NVHQCTIC.js.map +1 -0
  33. package/dist/{chunk-CVX6JNGD.js → chunk-OTDI5FXG.js} +3 -5
  34. package/dist/{chunk-CVX6JNGD.js.map → chunk-OTDI5FXG.js.map} +1 -1
  35. package/dist/{chunk-3IRDP7TN.js → chunk-P3FBESBB.js} +6 -4
  36. package/dist/{chunk-3IRDP7TN.js.map → chunk-P3FBESBB.js.map} +1 -1
  37. package/dist/{chunk-FU6MCSLG.js → chunk-PCLPVJ3J.js} +16 -78
  38. package/dist/chunk-PCLPVJ3J.js.map +1 -0
  39. package/dist/chunk-QB2NNV6C.js +143 -0
  40. package/dist/chunk-QB2NNV6C.js.map +1 -0
  41. package/dist/{chunk-C444K6MI.js → chunk-RGFBBNGP.js} +42 -17
  42. package/dist/{chunk-C444K6MI.js.map → chunk-RGFBBNGP.js.map} +1 -1
  43. package/dist/{chunk-TXPPMK4L.js → chunk-RGTTACP3.js} +5 -5
  44. package/dist/chunk-SGK2B724.js +67 -0
  45. package/dist/chunk-SGK2B724.js.map +1 -0
  46. package/dist/{chunk-ZDY2KY5X.js → chunk-URSGGRO4.js} +28 -11
  47. package/dist/chunk-URSGGRO4.js.map +1 -0
  48. package/dist/{chunk-5SCU253N.js → chunk-UYP7G3GZ.js} +2 -2
  49. package/dist/{chunk-ZIYVN4CD.js → chunk-VZ3AJCO5.js} +3 -5
  50. package/dist/{chunk-ZIYVN4CD.js.map → chunk-VZ3AJCO5.js.map} +1 -1
  51. package/dist/{chunk-QONTBYQW.js → chunk-WRWCDLVK.js} +4 -6
  52. package/dist/{chunk-QONTBYQW.js.map → chunk-WRWCDLVK.js.map} +1 -1
  53. package/dist/chunk-XBJ3VLWX.js +35 -0
  54. package/dist/chunk-XBJ3VLWX.js.map +1 -0
  55. package/dist/{chunk-RTJLLPFA.js → chunk-XFHZWORF.js} +123 -24
  56. package/dist/chunk-XFHZWORF.js.map +1 -0
  57. package/dist/{chunk-BIKAUVC2.js → chunk-ZA3RFDAV.js} +40 -6
  58. package/dist/chunk-ZA3RFDAV.js.map +1 -0
  59. package/dist/{cli-IW76QTN3.js → cli-KNCYWMAG.js} +237 -25
  60. package/dist/cli-KNCYWMAG.js.map +1 -0
  61. package/dist/{config-VCOS7P5K.js → config-SAQEQRFB.js} +5 -6
  62. package/dist/dist-U4M6QCKE.js +2842 -0
  63. package/dist/dist-U4M6QCKE.js.map +1 -0
  64. package/dist/{doctor-WS65JG3V.js → doctor-FBRQNOUQ.js} +10 -9
  65. package/dist/{publish-DSFWQRUN.js → edit-IZZ2HIMR.js} +20 -18
  66. package/dist/index.js +1 -1
  67. package/dist/{inspect-SFJWUQHO.js → inspect-BFWZ5XOP.js} +17 -16
  68. package/dist/{install-RVPQPCKH.js → install-QXZCHIBT.js} +400 -166
  69. package/dist/install-QXZCHIBT.js.map +1 -0
  70. package/dist/outcome-VXCBEGNC.js +20 -0
  71. package/dist/publish-5NTCRF2V.js +40 -0
  72. package/dist/read-T6OTMU72.js +158 -0
  73. package/dist/read-T6OTMU72.js.map +1 -0
  74. package/dist/{run-OMPKA43G.js → run-5OGX64IY.js} +106 -32
  75. package/dist/{run-OMPKA43G.js.map → run-5OGX64IY.js.map} +1 -1
  76. package/dist/search-LIIWUMWV.js +24 -0
  77. package/dist/{send-3G4C64HJ.js → send-ENE47KQE.js} +7 -7
  78. package/dist/session-HY4QIWHV.js +87 -0
  79. package/dist/session-HY4QIWHV.js.map +1 -0
  80. package/dist/{wallet-PP22LAX7.js → wallet-OCCGEH6H.js} +7 -7
  81. package/dist/{wallet-B7KJS2R5.js → wallet-RBDVNZVR.js} +5 -5
  82. package/dist/wallet-RBDVNZVR.js.map +1 -0
  83. package/docs/agent-permissions.md +255 -0
  84. package/package.json +3 -1
  85. package/skills/tenjin/SKILL.md +57 -13
  86. package/skills/tenjin-publish/SKILL.md +12 -4
  87. package/skills/tenjin-search/SKILL.md +68 -12
  88. package/dist/chunk-2JQ5JSG6.js +0 -68
  89. package/dist/chunk-2JQ5JSG6.js.map +0 -1
  90. package/dist/chunk-4WVKXKDK.js.map +0 -1
  91. package/dist/chunk-ADJYSM45.js.map +0 -1
  92. package/dist/chunk-BIKAUVC2.js.map +0 -1
  93. package/dist/chunk-FU6MCSLG.js.map +0 -1
  94. package/dist/chunk-L4IHCN6B.js +0 -63
  95. package/dist/chunk-L4IHCN6B.js.map +0 -1
  96. package/dist/chunk-NFSOVL3C.js.map +0 -1
  97. package/dist/chunk-NJF2WENW.js.map +0 -1
  98. package/dist/chunk-PAUXMRSF.js.map +0 -1
  99. package/dist/chunk-PYNSGYBE.js.map +0 -1
  100. package/dist/chunk-RTJLLPFA.js.map +0 -1
  101. package/dist/chunk-ZDY2KY5X.js.map +0 -1
  102. package/dist/cli-IW76QTN3.js.map +0 -1
  103. package/dist/install-RVPQPCKH.js.map +0 -1
  104. package/dist/outcome-GNYCSZ7J.js +0 -20
  105. package/dist/search-KOI6Y7P6.js +0 -24
  106. /package/dist/{buy-YMXXVNFH.js.map → buy-K2G6XQY2.js.map} +0 -0
  107. /package/dist/{candidate-H7FR4AU5.js.map → candidate-DJB2NNTG.js.map} +0 -0
  108. /package/dist/{chunk-ZW3B5LWX.js.map → chunk-2YX6LTCD.js.map} +0 -0
  109. /package/dist/{chunk-MDDGEGSW.js.map → chunk-DAJ56EUU.js.map} +0 -0
  110. /package/dist/{chunk-IOPWPMT2.js.map → chunk-DH6D6QIO.js.map} +0 -0
  111. /package/dist/{chunk-TXPPMK4L.js.map → chunk-RGTTACP3.js.map} +0 -0
  112. /package/dist/{chunk-5SCU253N.js.map → chunk-UYP7G3GZ.js.map} +0 -0
  113. /package/dist/{config-VCOS7P5K.js.map → config-SAQEQRFB.js.map} +0 -0
  114. /package/dist/{doctor-WS65JG3V.js.map → doctor-FBRQNOUQ.js.map} +0 -0
  115. /package/dist/{inspect-SFJWUQHO.js.map → edit-IZZ2HIMR.js.map} +0 -0
  116. /package/dist/{outcome-GNYCSZ7J.js.map → inspect-BFWZ5XOP.js.map} +0 -0
  117. /package/dist/{publish-DSFWQRUN.js.map → outcome-VXCBEGNC.js.map} +0 -0
  118. /package/dist/{search-KOI6Y7P6.js.map → publish-5NTCRF2V.js.map} +0 -0
  119. /package/dist/{wallet-B7KJS2R5.js.map → search-LIIWUMWV.js.map} +0 -0
  120. /package/dist/{send-3G4C64HJ.js.map → send-ENE47KQE.js.map} +0 -0
  121. /package/dist/{wallet-PP22LAX7.js.map → wallet-OCCGEH6H.js.map} +0 -0
@@ -1,33 +1,31 @@
1
1
  import { createRequire as __tenjinCreateRequire } from 'node:module'; const require = __tenjinCreateRequire(import.meta.url);
2
2
  import {
3
3
  runWalletCreate
4
- } from "./chunk-IOPWPMT2.js";
4
+ } from "./chunk-DH6D6QIO.js";
5
5
  import {
6
6
  collectDoctorChecks,
7
- recommendedPermissions,
8
- renderPermissionsBlock
9
- } from "./chunk-RTJLLPFA.js";
10
- import {
11
- promptYesNo
12
- } from "./chunk-QW2Q2KAH.js";
7
+ recommendedPermissions
8
+ } from "./chunk-XFHZWORF.js";
9
+ import "./chunk-GABYDXWL.js";
13
10
  import {
14
11
  describeWallet,
15
12
  resolveWalletProvider
16
- } from "./chunk-C444K6MI.js";
13
+ } from "./chunk-RGFBBNGP.js";
17
14
  import {
18
15
  walletFileExists
19
- } from "./chunk-QONTBYQW.js";
20
- import "./chunk-ZDY2KY5X.js";
21
- import "./chunk-NJF2WENW.js";
16
+ } from "./chunk-WRWCDLVK.js";
17
+ import "./chunk-URSGGRO4.js";
18
+ import "./chunk-DQDGBWWH.js";
19
+ import "./chunk-XBJ3VLWX.js";
20
+ import "./chunk-2I4QTOLB.js";
22
21
  import {
23
22
  sanitizeForTerminal
24
- } from "./chunk-NFSOVL3C.js";
25
- import "./chunk-2I4QTOLB.js";
23
+ } from "./chunk-BBUYCDSG.js";
26
24
  import {
27
25
  persistInstallHarness,
28
26
  persistPublishMode
29
- } from "./chunk-LAM66WFJ.js";
30
- import "./chunk-MDDGEGSW.js";
27
+ } from "./chunk-GM4RZUVU.js";
28
+ import "./chunk-DAJ56EUU.js";
31
29
  import "./chunk-YBMMV4Y4.js";
32
30
  import "./chunk-UO22YNY4.js";
33
31
  import {
@@ -44,14 +42,12 @@ import {
44
42
  onPath,
45
43
  parsePublishModeFlag,
46
44
  resolveSkillsSource
47
- } from "./chunk-5SCU253N.js";
48
- import {
49
- writeFileAtomic
50
- } from "./chunk-2JQ5JSG6.js";
45
+ } from "./chunk-UYP7G3GZ.js";
51
46
  import {
52
47
  CliError,
53
- external_exports
54
- } from "./chunk-PAUXMRSF.js";
48
+ external_exports,
49
+ writeFileAtomic
50
+ } from "./chunk-J6CVKC4M.js";
55
51
  import "./chunk-MJZZTKCC.js";
56
52
  import "./chunk-7FK2UN2T.js";
57
53
  import "./chunk-M2O56UK7.js";
@@ -66,22 +62,220 @@ import "./chunk-ZXTAQYNA.js";
66
62
 
67
63
  // src/commands/install.ts
68
64
  import { existsSync } from "fs";
69
- import { readFile, readdir, rm } from "fs/promises";
70
- import { createInterface } from "readline";
65
+ import { readFile as readFile2, readdir, rm } from "fs/promises";
71
66
  import { fileURLToPath } from "url";
72
- import { join, relative } from "path";
67
+ import { join as join2, relative } from "path";
73
68
  import { homedir } from "os";
74
69
  import { styleText } from "util";
75
70
  import { Stream } from "stream";
71
+
72
+ // src/lib/harness-permissions.ts
73
+ import { lstat, readFile, realpath } from "fs/promises";
74
+ import { join } from "path";
75
+ function claudeSettingsPath(homeDir) {
76
+ return join(homeDir, ".claude", "settings.json");
77
+ }
78
+ var FREE_VERB_RULES = [
79
+ "Bash(tenjin search:*)",
80
+ "Bash(tenjin inspect:*)",
81
+ "Bash(tenjin read:*)",
82
+ "Bash(tenjin outcome:*)",
83
+ "Bash(tenjin doctor:*)",
84
+ "Bash(tenjin wallet show:*)",
85
+ "Bash(tenjin wallet balance:*)",
86
+ "Bash(tenjin config get:*)",
87
+ "Bash(tenjin candidate list:*)"
88
+ ];
89
+ function skip(harness, path, reason, warning) {
90
+ return {
91
+ harness,
92
+ ...path !== void 0 ? { path } : {},
93
+ added: [],
94
+ alreadyPresent: [],
95
+ skipped: reason,
96
+ ...warning !== void 0 ? { warning } : {}
97
+ };
98
+ }
99
+ function permissionsSkipped(harness, homeDir, reason) {
100
+ const path = harness === "claude" ? claudeSettingsPath(homeDir) : void 0;
101
+ return skip(harness, path, reason);
102
+ }
103
+ function isPlainObject(value) {
104
+ return typeof value === "object" && value !== null && !Array.isArray(value);
105
+ }
106
+ async function wireFreeVerbAllowlist(homeDir) {
107
+ const declaredPath = claudeSettingsPath(homeDir);
108
+ const harness = "claude";
109
+ const entry = await lstat(declaredPath).catch(() => null);
110
+ let path = declaredPath;
111
+ if (entry !== null) {
112
+ try {
113
+ path = await realpath(declaredPath);
114
+ } catch (err) {
115
+ return skip(
116
+ harness,
117
+ declaredPath,
118
+ "unresolvable",
119
+ `${declaredPath} could not be resolved (${err.message}); it was left exactly as it is.`
120
+ );
121
+ }
122
+ }
123
+ let settings = {};
124
+ if (entry !== null) {
125
+ let raw;
126
+ try {
127
+ raw = await readFile(path, "utf8");
128
+ } catch (err) {
129
+ return skip(
130
+ harness,
131
+ path,
132
+ "unreadable",
133
+ `${path} could not be read (${err.message}); no permissions were written.`
134
+ );
135
+ }
136
+ let parsed;
137
+ try {
138
+ parsed = JSON.parse(raw);
139
+ } catch (err) {
140
+ return skip(
141
+ harness,
142
+ path,
143
+ "unparsable",
144
+ `${path} is not valid JSON (${err.message}); it was left exactly as it is.`
145
+ );
146
+ }
147
+ if (!isPlainObject(parsed)) {
148
+ return skip(
149
+ harness,
150
+ path,
151
+ "unexpected-shape",
152
+ `${path} is not a JSON object; it was left exactly as it is.`
153
+ );
154
+ }
155
+ settings = parsed;
156
+ }
157
+ const permissionsValue = settings.permissions;
158
+ if (permissionsValue !== void 0 && !isPlainObject(permissionsValue)) {
159
+ return skip(
160
+ harness,
161
+ path,
162
+ "unexpected-shape",
163
+ `${path} has a "permissions" key that is not an object; it was left exactly as it is.`
164
+ );
165
+ }
166
+ const permissions = permissionsValue ?? {};
167
+ const allowValue = permissions.allow;
168
+ if (allowValue !== void 0 && !Array.isArray(allowValue)) {
169
+ return skip(
170
+ harness,
171
+ path,
172
+ "unexpected-shape",
173
+ `${path} has a "permissions.allow" key that is not an array; it was left exactly as it is.`
174
+ );
175
+ }
176
+ const allow = allowValue ?? [];
177
+ const present = new Set(allow.filter((e) => typeof e === "string"));
178
+ const added = FREE_VERB_RULES.filter((rule) => !present.has(rule));
179
+ const alreadyPresent = FREE_VERB_RULES.filter((rule) => present.has(rule));
180
+ if (added.length === 0) return { harness, path, added: [], alreadyPresent: [...alreadyPresent] };
181
+ const next = {
182
+ ...settings,
183
+ permissions: { ...permissions, allow: [...allow, ...added] }
184
+ };
185
+ await writeFileAtomic(path, `${JSON.stringify(next, null, 2)}
186
+ `);
187
+ return { harness, path, added, alreadyPresent: [...alreadyPresent] };
188
+ }
189
+
190
+ // src/lib/clack.ts
191
+ var SHOW_CURSOR = "\x1B[?25h";
192
+ function withInputEnd(streams, onEnd, run) {
193
+ const controller = new AbortController();
194
+ let settleEnd;
195
+ const ended = new Promise((resolve) => {
196
+ settleEnd = () => {
197
+ streams.output.write(SHOW_CURSOR);
198
+ resolve(onEnd);
199
+ };
200
+ });
201
+ const end = () => {
202
+ controller.abort();
203
+ settleEnd?.();
204
+ };
205
+ const onKeypress = (_text, key) => {
206
+ if (key?.ctrl === true && key.name === "d") end();
207
+ };
208
+ streams.input.on("keypress", onKeypress);
209
+ if (streams.input.readableEnded) {
210
+ queueMicrotask(end);
211
+ } else {
212
+ streams.input.once("end", end);
213
+ streams.input.once("close", end);
214
+ }
215
+ return Promise.race([run(controller.signal), ended]).finally(() => {
216
+ streams.input.off("keypress", onKeypress);
217
+ streams.input.off("end", end);
218
+ streams.input.off("close", end);
219
+ });
220
+ }
221
+ function resolveStreams(streams) {
222
+ return { input: streams.input ?? process.stdin, output: streams.output ?? process.stderr };
223
+ }
224
+ async function selectOne(opts) {
225
+ const { select, isCancel } = await import("./dist-U4M6QCKE.js");
226
+ const streams = resolveStreams(opts.streams ?? {});
227
+ return withInputEnd(streams, null, async (signal) => {
228
+ const answer = await select({
229
+ message: opts.message,
230
+ options: opts.choices.map((c) => ({
231
+ value: c.value,
232
+ label: c.label,
233
+ ...c.hint !== void 0 ? { hint: c.hint } : {}
234
+ })),
235
+ initialValue: opts.initialValue,
236
+ input: streams.input,
237
+ output: streams.output,
238
+ signal
239
+ });
240
+ return isCancel(answer) ? null : answer;
241
+ });
242
+ }
243
+ async function confirmChoice(message, initialValue = true, streams = {}) {
244
+ const { confirm, isCancel } = await import("./dist-U4M6QCKE.js");
245
+ const resolved = resolveStreams(streams);
246
+ return withInputEnd(resolved, false, async (signal) => {
247
+ const answer = await confirm({
248
+ message,
249
+ initialValue,
250
+ input: resolved.input,
251
+ output: resolved.output,
252
+ signal
253
+ });
254
+ return isCancel(answer) ? false : answer;
255
+ });
256
+ }
257
+ async function intro(message) {
258
+ const clack = await import("./dist-U4M6QCKE.js");
259
+ clack.intro(message, { output: process.stderr });
260
+ }
261
+ async function outro(message) {
262
+ const clack = await import("./dist-U4M6QCKE.js");
263
+ clack.outro(message, { output: process.stderr });
264
+ }
265
+
266
+ // src/commands/install.ts
76
267
  var HARNESSES = HARNESS_TARGETS;
77
268
  var InstallInputSchema = external_exports.object({
78
269
  harness: external_exports.array(external_exports.string()).optional(),
79
270
  dryRun: external_exports.boolean().optional(),
80
271
  publishMode: external_exports.string().optional(),
81
272
  noWallet: external_exports.boolean().optional(),
82
- /** Tri-state opt-in for the ~/.claude/CLAUDE.md nudge: true (--claude-md), false
83
- * (--no-claude-md), or undefined (ask interactively, else skip). */
84
- claudeMd: external_exports.boolean().optional()
273
+ /** Opt-in for the ~/.claude/CLAUDE.md nudge: true (--claude-md), false
274
+ * (--no-claude-md), or undefined (skip). Never a question: the walkthrough is
275
+ * capped at three decisions. */
276
+ claudeMd: external_exports.boolean().optional(),
277
+ /** Wire the free-verb harness allowlist without asking (`--allow-free-verbs`). */
278
+ allowFreeVerbs: external_exports.boolean().optional()
85
279
  });
86
280
  var SKILLS_MARKER = "<!-- tenjin-cli:skills -->";
87
281
  function nudgeLine(skillsDir) {
@@ -112,6 +306,7 @@ async function runInstall(input, ctx, deps = {}) {
112
306
  const dryRun = parsed.data.dryRun === true;
113
307
  const noWallet = parsed.data.noWallet === true;
114
308
  const claudeMdFlag = parsed.data.claudeMd;
309
+ const allowFreeVerbs = parsed.data.allowFreeVerbs === true;
115
310
  const publishModeFlag = parsed.data.publishMode !== void 0 ? parseModeFlag(parsed.data.publishMode) : void 0;
116
311
  const env = deps.env ?? process.env;
117
312
  const home = deps.homeDir ?? homedir();
@@ -122,7 +317,7 @@ async function runInstall(input, ctx, deps = {}) {
122
317
  await assertSkillsSource(skillsSource);
123
318
  const plans = resolvePlans(parsed.data.harness, home, which);
124
319
  const explicitHarness = parsed.data.harness !== void 0 && parsed.data.harness.length > 0;
125
- const claudeMdWrite = plans.some((p) => p.harness === "claude") ? await decideClaudeMd(claudeMdFlag, canPrompt, dryRun, deps) : false;
320
+ const claudeMdWrite = claudeMdFlag === true;
126
321
  const harnesses = [];
127
322
  for (const plan of plans) {
128
323
  harnesses.push(await applyPlan(plan, skillsSource, dryRun, claudeMdWrite));
@@ -139,7 +334,18 @@ async function runInstall(input, ctx, deps = {}) {
139
334
  doctorDeps.which ??= which;
140
335
  const collect = deps.collectChecks ?? ((c) => collectDoctorChecks(c, doctorDeps));
141
336
  const doctor = await collect(ctx);
142
- const publishMode = await selectPublishMode(publishModeFlag, ctx, deps, dryRun, canPrompt);
337
+ if (canPrompt) await (deps.intro ?? intro)("tenjin install");
338
+ const publishMode = await resolvePublishMode(publishModeFlag, ctx, deps, dryRun, canPrompt);
339
+ const permissions = await resolvePermissions({
340
+ plans,
341
+ home,
342
+ deps,
343
+ flag: allowFreeVerbs,
344
+ dryRun,
345
+ canPrompt
346
+ });
347
+ const wallet = humanOutput ? await resolveWallet(ctx, deps, dryRun || !canPrompt || noWallet) : void 0;
348
+ if (canPrompt) await (deps.outro ?? outro)("Setup complete.");
143
349
  const data = {
144
350
  dryRun,
145
351
  skillsSource,
@@ -149,62 +355,40 @@ async function runInstall(input, ctx, deps = {}) {
149
355
  // Shipped with the install rather than left for the operator to discover after
150
356
  // their first auto-mode denial (#33). Static constants, no config key: see
151
357
  // lib/permissions.ts for why this is deliberately not operator-editable state.
152
- permissions: recommendedPermissions()
358
+ // `wired` is the outcome of THIS run's optional settings.json write; the three
359
+ // recommendation tiers beside it are unchanged, so a machine consumer that
360
+ // read `alwaysSafe` / `optIn` / `neverAllowlisted` before still does.
361
+ permissions: { ...recommendedPermissions(), wired: permissions }
153
362
  };
154
363
  if (!humanOutput) return { data };
155
- const humanLines = await buildWalkthrough(ctx, deps, {
364
+ const humanLines = buildWalkthrough(ctx.io, {
156
365
  dryRun,
157
- noWallet,
158
- canPrompt,
159
366
  harnesses,
160
367
  publishMode,
368
+ permissions,
369
+ wallet: wallet ?? { status: "none" },
161
370
  doctor
162
371
  });
163
372
  return { data, humanLines };
164
373
  }
165
374
  var EXAMPLE_QUESTION = "what actually changed in <library> v3's public API";
166
- async function buildWalkthrough(ctx, deps, s) {
167
- const io = ctx.io;
375
+ function buildWalkthrough(io, s) {
168
376
  const lines = [];
169
377
  if (s.dryRun) lines.push(paint(io, "yellow", "Dry run: nothing was written."));
170
- lines.push(...skillsWalkthrough(io, s.harnesses, s.dryRun), "");
171
- lines.push(
172
- `${paint(io, "bold", `publish mode: ${s.publishMode.value}`)} ${paint(io, "dim", modeBlurb(s.publishMode.value))}`,
173
- ""
174
- );
175
- lines.push(...await walletWalkthrough(ctx, deps, s.dryRun || !s.canPrompt, s.noWallet, io), "");
176
- lines.push(...doctorSummary(io, s.doctor), "");
177
- lines.push(...permissionsWalkthrough(io), "");
178
- lines.push(`Done. Try: tenjin search "${EXAMPLE_QUESTION}"`);
378
+ lines.push(...noticeLines(io, s));
379
+ if (lines.length > 0) lines.push("");
380
+ lines.push(...summaryLines(io, s));
179
381
  return lines;
180
382
  }
181
- function permissionsWalkthrough(io) {
182
- const [heading, ...rest] = renderPermissionsBlock();
183
- return [paint(io, "bold", heading ?? ""), ...rest];
184
- }
185
- function harnessLabel(h) {
186
- return h === "claude" ? "Claude Code" : h === "codex" ? "Codex" : "Agent Skills";
187
- }
188
- function skillsWalkthrough(io, harnesses, dryRun) {
383
+ function noticeLines(io, s) {
189
384
  const lines = [];
190
- for (const h of harnesses) {
191
- const n = h.skills.length;
192
- const changed = h.skills.some((s) => s.status !== "up-to-date");
193
- const verb = dryRun ? "would install" : changed ? "installed" : "up to date";
194
- const wired = [];
195
- if (h.agentsMd !== void 0) wired.push("AGENTS.md nudge");
196
- if (h.claudeMd !== void 0 && h.claudeMd.status !== "skipped") wired.push("CLAUDE.md nudge");
197
- const suffix = wired.length > 0 ? ` + ${wired.join(" + ")}` : "";
198
- lines.push(
199
- `${paint(io, "green", "\u2713")} ${harnessLabel(h.harness)}: ${n} skills ${verb}${suffix}`
200
- );
201
- lines.push(paint(io, "dim", ` ${skillRoster(h)} in ${h.skillsDir}`));
385
+ for (const h of s.harnesses) {
202
386
  if (h.hostedPreexisting) {
203
387
  lines.push(
204
388
  paint(
205
389
  io,
206
390
  "dim",
207
- ` The hosted ${HOSTED_SKILL_NAME} skill was already here: kept as the zero-install fallback, and the CLI skills now take precedence.`
391
+ `The hosted ${HOSTED_SKILL_NAME} skill was already here: kept as the zero-install fallback, and the CLI skills now take precedence.`
208
392
  )
209
393
  );
210
394
  }
@@ -214,36 +398,86 @@ function skillsWalkthrough(io, harnesses, dryRun) {
214
398
  paint(
215
399
  io,
216
400
  "dim",
217
- " The nudge tells agents to run a free anonymous `tenjin search` before regenerating research; the generalized question text is sent to tenjin.blog."
218
- )
219
- );
220
- lines.push(
221
- paint(
222
- io,
223
- "dim",
224
- ` Undo anytime: delete the ${SKILLS_MARKER} line from ${nudgePaths.join(" and ")}.`
401
+ "The nudge tells agents to run a free anonymous `tenjin search` before regenerating research; the generalized question text is sent to tenjin.blog."
225
402
  )
226
403
  );
227
- }
228
- if (h.claudeMd?.status === "skipped") {
229
404
  lines.push(
230
405
  paint(
231
406
  io,
232
407
  "dim",
233
- " Add a Tenjin search nudge to ~/.claude/CLAUDE.md later: tenjin install --harness claude --claude-md"
408
+ `Undo anytime: delete the ${SKILLS_MARKER} line from ${nudgePaths.join(" and ")}.`
234
409
  )
235
410
  );
236
411
  }
237
412
  if (h.codexNetworkRule !== void 0) {
238
- lines.push(
239
- paint(io, "dim", " Codex blocks network by default; add to ~/.codex/config.toml:")
240
- );
241
- for (const rl of h.codexNetworkRule.split("\n")) lines.push(paint(io, "dim", ` ${rl}`));
413
+ lines.push(paint(io, "dim", "Codex blocks network by default; add to ~/.codex/config.toml:"));
414
+ for (const rl of h.codexNetworkRule.split("\n")) lines.push(paint(io, "dim", ` ${rl}`));
242
415
  }
243
- for (const w of h.warnings) lines.push(paint(io, "yellow", ` ! ${w}`));
416
+ for (const w of h.warnings) lines.push(paint(io, "yellow", `! ${w}`));
417
+ }
418
+ if (s.permissions.warning !== void 0) {
419
+ lines.push(paint(io, "yellow", `! ${sanitizeForTerminal(s.permissions.warning)}`));
244
420
  }
421
+ lines.push(...doctorNotices(io, s.doctor));
245
422
  return lines;
246
423
  }
424
+ function summaryLines(io, s) {
425
+ return [
426
+ ...s.harnesses.map((h) => skillsLine(io, h, s.dryRun)),
427
+ publishingLine(io, s.publishMode.value),
428
+ permissionsLine(io, s.permissions),
429
+ walletLine(io, s.wallet),
430
+ `${paint(io, "bold", "Next:")} tenjin search "${EXAMPLE_QUESTION}"`
431
+ ];
432
+ }
433
+ function harnessLabel(h) {
434
+ return h === "claude" ? "Claude Code" : h === "codex" ? "Codex" : "Agent Skills";
435
+ }
436
+ function skillsLine(io, h, dryRun) {
437
+ const changed = h.skills.some((s) => s.status !== "up-to-date");
438
+ const verb = dryRun ? "would install" : changed ? "installed" : "up to date";
439
+ const wired = [];
440
+ if (h.agentsMd !== void 0) wired.push("AGENTS.md nudge");
441
+ if (h.claudeMd !== void 0 && h.claudeMd.status !== "skipped") wired.push("CLAUDE.md nudge");
442
+ const suffix = wired.length > 0 ? ` + ${wired.join(" + ")}` : "";
443
+ const head = `${harnessLabel(h.harness)}: ${h.skills.length} skills ${verb}${suffix}`;
444
+ return `${paint(io, "green", "\u2713")} ${paint(io, "bold", head)} in ${h.skillsDir}. ${skillRoster(h)}.`;
445
+ }
446
+ function publishingLine(io, mode) {
447
+ return `${paint(io, "green", "\u2713")} ${paint(io, "bold", `Publishing: ${mode}`)}. ${modeBlurb(mode)}`;
448
+ }
449
+ function permissionsLine(io, p) {
450
+ const label = paint(io, "bold", "Permissions:");
451
+ if (p.added.length > 0) {
452
+ return `${paint(io, "green", "\u2713")} ${label} ${p.added.length} free tenjin commands added to ${p.path}. Full caveats: tenjin doctor`;
453
+ }
454
+ if (p.skipped === void 0) {
455
+ return `${paint(io, "green", "\u2713")} ${label} the ${FREE_VERB_RULES.length} free tenjin commands were already allowed in ${p.path}`;
456
+ }
457
+ if (p.skipped === "harness-not-claude") {
458
+ return `${paint(io, "dim", "-")} ${label} not wired (Claude Code only). Run \`tenjin doctor\` for the lines your harness needs.`;
459
+ }
460
+ if (p.skipped === "dry-run") {
461
+ return `${paint(io, "dim", "-")} ${label} unchanged (dry run).`;
462
+ }
463
+ if (p.skipped === "declined") {
464
+ return `${paint(io, "dim", "-")} ${label} unchanged. Add them anytime: tenjin install --allow-free-verbs`;
465
+ }
466
+ if (p.skipped === "not-requested") {
467
+ return `${paint(io, "dim", "-")} ${label} unchanged. Allow the ${FREE_VERB_RULES.length} free tenjin commands with: tenjin install --allow-free-verbs`;
468
+ }
469
+ return `${paint(io, "yellow", "!")} ${label} ${p.path} was left untouched. Fix it, then: tenjin install --allow-free-verbs`;
470
+ }
471
+ function walletLine(io, w) {
472
+ const label = paint(io, "bold", "Wallet:");
473
+ if (w.status === "existing") {
474
+ return `${paint(io, "green", "\u2713")} ${label} ${w.address} (existing). Check funds with: tenjin wallet balance`;
475
+ }
476
+ if (w.status === "created") {
477
+ return `${paint(io, "green", "\u2713")} ${label} ${w.address}. Fund it with a few dollars of USDC on Base, then: tenjin wallet balance`;
478
+ }
479
+ return `${paint(io, "dim", "-")} ${label} none. Create one later with: tenjin wallet create`;
480
+ }
247
481
  function skillRoster(h) {
248
482
  const cli = h.skills.filter((s) => s.cli).map((s) => s.name);
249
483
  const hosted = h.skills.filter((s) => !s.cli).map((s) => s.name);
@@ -263,25 +497,20 @@ function nudgeFilesTouched(h) {
263
497
  return paths;
264
498
  }
265
499
  function modeBlurb(v) {
266
- return v === "review" ? "asks before every publish" : v === "auto" ? "publishes clean scans automatically" : "only detected secrets stop a publish";
500
+ return v === "auto" ? "Your agent publishes clean pieces on its own; your harness still shows each command for approval." : v === "review" ? "Your agent asks you in chat before every publish." : "Fully unattended; only hard blocks stop it.";
267
501
  }
268
- async function walletWalkthrough(ctx, deps, skipCreate, noWallet, io) {
502
+ async function resolveWallet(ctx, deps, skipCreate) {
269
503
  const exists = await (deps.walletExists ?? walletFileExists)(ctx.dataDir);
270
504
  if (exists) {
271
- const address2 = await (deps.walletAddress ?? existingWalletAddress)(ctx);
272
- return [`${paint(io, "bold", "Wallet:")} ${address2} (existing)`];
273
- }
274
- const later = `${paint(io, "bold", "Wallet:")} none. Create one later with: tenjin wallet create`;
275
- if (skipCreate || noWallet) return [later];
276
- const confirm = deps.confirmWallet ?? defaultConfirmYesNo;
277
- if (!await confirm("Create a wallet now? [Y/n] ")) return [later];
278
- const address = await (deps.createWallet ?? defaultCreateWallet)(ctx);
279
- return [
280
- paint(io, "bold", "Wallet created:"),
281
- ` ${address}`,
282
- " Fund it: send a few dollars of USDC on Base to that address (this is a pocket-money wallet; keep it small).",
283
- " Check with: tenjin wallet balance"
284
- ];
505
+ return {
506
+ status: "existing",
507
+ address: await (deps.walletAddress ?? existingWalletAddress)(ctx)
508
+ };
509
+ }
510
+ if (skipCreate) return { status: "none" };
511
+ const confirm = deps.confirmWallet ?? defaultConfirm;
512
+ if (!await confirm(WALLET_QUESTION)) return { status: "none" };
513
+ return { status: "created", address: await (deps.createWallet ?? defaultCreateWallet)(ctx) };
285
514
  }
286
515
  async function existingWalletAddress(ctx) {
287
516
  return (await describeWallet(resolveWalletProvider(ctx))).address;
@@ -290,12 +519,12 @@ async function defaultCreateWallet(ctx) {
290
519
  const result = await runWalletCreate(ctx);
291
520
  return result.data.address;
292
521
  }
293
- function defaultConfirmYesNo(label) {
294
- return promptYesNo(label, { defaultYes: true });
522
+ function defaultConfirm(label) {
523
+ return confirmChoice(label, true);
295
524
  }
296
- function doctorSummary(io, doctor) {
525
+ function doctorNotices(io, doctor) {
297
526
  const problems = doctor.checks.filter((c) => c.status !== "ok");
298
- if (problems.length === 0) return [`${paint(io, "green", "\u2713")} Everything checks out`];
527
+ if (problems.length === 0) return [];
299
528
  const lines = [paint(io, "yellow", "Some checks need attention:")];
300
529
  for (const c of problems) {
301
530
  const icon = c.status === "fail" ? paint(io, "red", "\u2717") : paint(io, "yellow", "!");
@@ -307,14 +536,17 @@ function doctorSummary(io, doctor) {
307
536
  return lines;
308
537
  }
309
538
  var DEFAULT_MODE = CONFIG_DEFAULTS.publish.mode;
310
- var PUBLISH_MODE_PROMPT = [
311
- "Publish consent mode?",
312
- " review - asks a yes/no for every publish",
313
- " auto - publishes automatically when the secret-scan is clean (including answers your agent derives)",
314
- " full-auto - publishes even past warnings; only detected secrets stop it",
315
- `[${DEFAULT_MODE}]: `
316
- ].join("\n");
317
- async function selectPublishMode(flag, ctx, deps, dryRun, interactive) {
539
+ var PUBLISH_MODE_CHOICES = [
540
+ {
541
+ value: "auto",
542
+ label: "Auto (recommended)",
543
+ hint: "your agent publishes clean pieces on its own; your harness still shows each command for approval"
544
+ },
545
+ { value: "review", label: "Ask me in chat first" },
546
+ { value: "full-auto", label: "Fully unattended", hint: "only hard blocks stop it" }
547
+ ];
548
+ var PUBLISH_MODE_QUESTION = "When your agent has something worth publishing:";
549
+ async function resolvePublishMode(flag, ctx, deps, dryRun, interactive) {
318
550
  if (flag !== void 0) {
319
551
  if (!dryRun) await persistPublishMode(ctx.dataDir, flag);
320
552
  return { value: flag, source: "flag" };
@@ -324,38 +556,44 @@ async function selectPublishMode(flag, ctx, deps, dryRun, interactive) {
324
556
  return { value: config.publish.mode, source: "existing" };
325
557
  }
326
558
  if (dryRun || !interactive) return { value: DEFAULT_MODE, source: "default-skipped" };
327
- const prompt = deps.promptMode ?? defaultPromptMode;
328
- for (let attempt = 0; attempt < 2; attempt++) {
329
- const answer = (await prompt(PUBLISH_MODE_PROMPT)).trim();
330
- if (answer.length === 0) return { value: DEFAULT_MODE, source: "default-skipped" };
331
- const parsed = PublishModeSchema.safeParse(answer);
332
- if (parsed.success) {
333
- await persistPublishMode(ctx.dataDir, parsed.data);
334
- return { value: parsed.data, source: "prompt" };
335
- }
336
- }
337
- ctx.io.stderr.write(
338
- `Unrecognized mode; keeping the default (${DEFAULT_MODE}). Change it with \`tenjin config set publish.mode\`.
339
- `
340
- );
341
- return { value: DEFAULT_MODE, source: "default-skipped" };
559
+ const answer = await (deps.promptPublishMode ?? defaultPromptPublishMode)();
560
+ if (answer === null) return { value: DEFAULT_MODE, source: "default-skipped" };
561
+ const parsed = PublishModeSchema.safeParse(answer);
562
+ if (!parsed.success) return { value: DEFAULT_MODE, source: "default-skipped" };
563
+ await persistPublishMode(ctx.dataDir, parsed.data);
564
+ return { value: parsed.data, source: "prompt" };
565
+ }
566
+ function defaultPromptPublishMode() {
567
+ return selectOne({
568
+ message: PUBLISH_MODE_QUESTION,
569
+ choices: PUBLISH_MODE_CHOICES.map((c) => ({ ...c })),
570
+ initialValue: "auto"
571
+ });
342
572
  }
343
573
  function parseModeFlag(value) {
344
574
  return parsePublishModeFlag(value, "--publish-mode");
345
575
  }
346
- function defaultPromptMode(label) {
347
- return new Promise((resolve) => {
348
- const rl = createInterface({ input: process.stdin, output: process.stderr });
349
- let settled = false;
350
- const settle = (value) => {
351
- if (settled) return;
352
- settled = true;
353
- rl.close();
354
- resolve(value);
355
- };
356
- rl.once("close", () => settle(""));
357
- rl.question(label, (answer) => settle(answer));
358
- });
576
+ var PERMISSIONS_QUESTION = [
577
+ "Let your agent search tenjin without permission popups?",
578
+ `Adds ${FREE_VERB_RULES.length} free commands to ~/.claude/settings.json.`,
579
+ "None can spend USDC or open your wallet keystore;",
580
+ "three send or store data (search, outcome, read).",
581
+ "Full caveats: tenjin doctor."
582
+ ].join(" ");
583
+ var WALLET_QUESTION = "Create a wallet now?";
584
+ async function resolvePermissions(args) {
585
+ const { plans, home, deps, flag, dryRun, canPrompt } = args;
586
+ if (!plans.some((p) => p.harness === "claude")) {
587
+ return permissionsSkipped(plans[0]?.harness ?? "shared", home, "harness-not-claude");
588
+ }
589
+ if (dryRun) return permissionsSkipped("claude", home, "dry-run");
590
+ if (flag) return wireFreeVerbAllowlist(home);
591
+ if (!canPrompt) return permissionsSkipped("claude", home, "not-requested");
592
+ const confirm = deps.confirmPermissions ?? defaultConfirm;
593
+ if (!await confirm(PERMISSIONS_QUESTION)) {
594
+ return permissionsSkipped("claude", home, "declined");
595
+ }
596
+ return wireFreeVerbAllowlist(home);
359
597
  }
360
598
  function resolvePlans(override, home, which) {
361
599
  if (override !== void 0 && override.length > 0) {
@@ -397,8 +635,8 @@ async function applyPlan(plan, skillsSource, dryRun, claudeMdWrite) {
397
635
  const warnings = [];
398
636
  for (const name of SKILL_NAMES) {
399
637
  const { status, warning, preexisting } = await installSkill(
400
- join(skillsSource, name),
401
- join(plan.skillsDir, name),
638
+ join2(skillsSource, name),
639
+ join2(plan.skillsDir, name),
402
640
  dryRun,
403
641
  name
404
642
  );
@@ -430,18 +668,10 @@ async function applyPlan(plan, skillsSource, dryRun, claudeMdWrite) {
430
668
  }
431
669
  return result;
432
670
  }
433
- async function decideClaudeMd(flag, canPrompt, dryRun, deps) {
434
- if (flag !== void 0) return flag;
435
- if (dryRun || !canPrompt) return false;
436
- const confirm = deps.confirmClaudeMd ?? defaultConfirmYesNo;
437
- return confirm(
438
- "Add a one-line nudge to ~/.claude/CLAUDE.md telling agents to try a free Tenjin search before regenerating research? It sends only generalized question text to tenjin.blog. [Y/n] "
439
- );
440
- }
441
671
  async function wireClaudeMd(plan, dryRun, write) {
442
- const path = join(plan.home, ".claude", "CLAUDE.md");
672
+ const path = join2(plan.home, ".claude", "CLAUDE.md");
443
673
  if (!write) return { path, status: "skipped" };
444
- const existing = existsSync(path) ? await readFile(path, "utf8") : null;
674
+ const existing = existsSync(path) ? await readFile2(path, "utf8") : null;
445
675
  const { content, change } = upsertMarkerLine(existing, nudgeLine(plan.skillsDir));
446
676
  if (change === "none") return { path, status: "up-to-date" };
447
677
  if (!dryRun && content !== null) await writeFileAtomic(path, content);
@@ -462,10 +692,10 @@ function notesFor(plan, hostedPreexisting) {
462
692
  return notes;
463
693
  }
464
694
  async function landedInvocable(skillsDir, skillsSource, name, dryRun) {
465
- const path = join(dryRun ? skillsSource : skillsDir, name, "SKILL.md");
695
+ const path = join2(dryRun ? skillsSource : skillsDir, name, "SKILL.md");
466
696
  if (!existsSync(path)) return false;
467
697
  try {
468
- return !isModelInvocationDisabled(await readFile(path, "utf8"));
698
+ return !isModelInvocationDisabled(await readFile2(path, "utf8"));
469
699
  } catch {
470
700
  return false;
471
701
  }
@@ -475,8 +705,8 @@ async function assertSkillsLanded(plans, dryRun) {
475
705
  const missing = [];
476
706
  for (const plan of plans) {
477
707
  for (const name of SKILL_NAMES) {
478
- if (!existsSync(join(plan.skillsDir, name, "SKILL.md"))) {
479
- missing.push(join(plan.skillsDir, name));
708
+ if (!existsSync(join2(plan.skillsDir, name, "SKILL.md"))) {
709
+ missing.push(join2(plan.skillsDir, name));
480
710
  }
481
711
  }
482
712
  }
@@ -496,7 +726,7 @@ async function installSkill(srcDir, destDir, dryRun, name) {
496
726
  if (!dryRun && change !== "none") {
497
727
  await rm(destDir, { recursive: true, force: true });
498
728
  for (const [rel, content] of src) {
499
- await writeFileAtomic(join(destDir, rel), content);
729
+ await writeFileAtomic(join2(destDir, rel), content);
500
730
  }
501
731
  }
502
732
  if (change === "create") return { status: dryRun ? "would-install" : "installed", preexisting };
@@ -517,8 +747,8 @@ async function readTree(dir) {
517
747
  const files = /* @__PURE__ */ new Map();
518
748
  for (const entry of entries) {
519
749
  if (!entry.isFile()) continue;
520
- const full = join(entry.parentPath, entry.name);
521
- files.set(relative(dir, full), await readFile(full));
750
+ const full = join2(entry.parentPath, entry.name);
751
+ files.set(relative(dir, full), await readFile2(full));
522
752
  }
523
753
  return files;
524
754
  }
@@ -532,18 +762,18 @@ function treesEqual(a, b) {
532
762
  return true;
533
763
  }
534
764
  async function wireAgentsMd(plan, dryRun) {
535
- const shared = join(plan.home, ".agents", "AGENTS.md");
536
- const codex = join(plan.home, ".codex", "AGENTS.md");
765
+ const shared = join2(plan.home, ".agents", "AGENTS.md");
766
+ const codex = join2(plan.home, ".codex", "AGENTS.md");
537
767
  const line = nudgeLine(plan.skillsDir);
538
768
  for (const path of [shared, codex]) {
539
- if (existsSync(path) && (await readFile(path, "utf8")).includes(SKILLS_MARKER)) {
769
+ if (existsSync(path) && (await readFile2(path, "utf8")).includes(SKILLS_MARKER)) {
540
770
  return upsertAgentsMd(path, line, dryRun);
541
771
  }
542
772
  }
543
773
  return upsertAgentsMd(chooseAgentsMdPath(plan.home), line, dryRun);
544
774
  }
545
775
  async function upsertAgentsMd(path, line, dryRun) {
546
- const existing = existsSync(path) ? await readFile(path, "utf8") : null;
776
+ const existing = existsSync(path) ? await readFile2(path, "utf8") : null;
547
777
  const { content, change } = upsertMarkerLine(existing, line);
548
778
  if (change === "none") return { path, status: "already-present" };
549
779
  if (!dryRun && content !== null) await writeFileAtomic(path, content);
@@ -551,11 +781,11 @@ async function upsertAgentsMd(path, line, dryRun) {
551
781
  return { path, status: dryRun ? "would-update" : "updated" };
552
782
  }
553
783
  function chooseAgentsMdPath(home) {
554
- const shared = join(home, ".agents", "AGENTS.md");
555
- const codex = join(home, ".codex", "AGENTS.md");
784
+ const shared = join2(home, ".agents", "AGENTS.md");
785
+ const codex = join2(home, ".codex", "AGENTS.md");
556
786
  if (existsSync(shared)) return shared;
557
787
  if (existsSync(codex)) return codex;
558
- if (existsSync(join(home, ".codex"))) return codex;
788
+ if (existsSync(join2(home, ".codex"))) return codex;
559
789
  return shared;
560
790
  }
561
791
  function paint(io, format, text) {
@@ -564,14 +794,14 @@ function paint(io, format, text) {
564
794
  }
565
795
  async function assertSkillsSource(dir) {
566
796
  for (const name of SKILL_NAMES) {
567
- if (!existsSync(join(dir, name, "SKILL.md"))) {
797
+ if (!existsSync(join2(dir, name, "SKILL.md"))) {
568
798
  throw new CliError("INTERNAL", `Packaged skill "${name}" is missing under ${dir}`, {
569
799
  fix: "Reinstall tenjin-cli; the published package must ship every skill under skills/."
570
800
  });
571
801
  }
572
802
  }
573
803
  for (const name of CLI_SKILL_NAMES) {
574
- const text = await readFile(join(dir, name, "SKILL.md"), "utf8");
804
+ const text = await readFile2(join2(dir, name, "SKILL.md"), "utf8");
575
805
  if (isModelInvocationDisabled(text)) {
576
806
  throw new CliError(
577
807
  "INTERNAL",
@@ -584,6 +814,10 @@ async function assertSkillsSource(dir) {
584
814
  }
585
815
  }
586
816
  export {
817
+ PERMISSIONS_QUESTION,
818
+ PUBLISH_MODE_CHOICES,
819
+ PUBLISH_MODE_QUESTION,
820
+ WALLET_QUESTION,
587
821
  runInstall
588
822
  };
589
- //# sourceMappingURL=install-RVPQPCKH.js.map
823
+ //# sourceMappingURL=install-QXZCHIBT.js.map