tenjin-cli 0.1.0-alpha.13 → 0.1.0-alpha.14
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +35 -2
- package/dist/{buy-X4VPHFUA.js → buy-2JBYPHAI.js} +16 -14
- package/dist/{chunk-6JKD46OJ.js → chunk-3ZW7HPY5.js} +4 -4
- package/dist/chunk-4UHNXY6B.js +786 -0
- package/dist/chunk-4UHNXY6B.js.map +1 -0
- package/dist/{chunk-IFPKA32J.js → chunk-4Y53PDH6.js} +2 -2
- package/dist/{chunk-SPUORKD7.js → chunk-54AJIO3E.js} +11 -12
- package/dist/chunk-54AJIO3E.js.map +1 -0
- package/dist/{chunk-JVBMPU5G.js → chunk-7GJQ5RGA.js} +5 -3
- package/dist/{chunk-JVBMPU5G.js.map → chunk-7GJQ5RGA.js.map} +1 -1
- package/dist/{chunk-BRAVLUGI.js → chunk-7NADDA2V.js} +9 -6
- package/dist/{chunk-BRAVLUGI.js.map → chunk-7NADDA2V.js.map} +1 -1
- package/dist/{chunk-T4UWMVKV.js → chunk-ACBEHJAH.js} +4 -4
- package/dist/{chunk-XXY77EZJ.js → chunk-DAZAXFSF.js} +7 -7
- package/dist/{chunk-OE36HRWG.js → chunk-DTCXO7HS.js} +257 -405
- package/dist/chunk-DTCXO7HS.js.map +1 -0
- package/dist/{chunk-CA3JV7FX.js → chunk-ETKZWJ4B.js} +2 -2
- package/dist/{chunk-CA3JV7FX.js.map → chunk-ETKZWJ4B.js.map} +1 -1
- package/dist/{chunk-NKN4YC5C.js → chunk-FDUD3W5V.js} +2 -2
- package/dist/{chunk-L4XNT3UW.js → chunk-GEHL43VE.js} +49 -17
- package/dist/chunk-GEHL43VE.js.map +1 -0
- package/dist/chunk-IU2HVT3Y.js +313 -0
- package/dist/chunk-IU2HVT3Y.js.map +1 -0
- package/dist/{chunk-OXUJ3FXU.js → chunk-IUQZ4Z7M.js} +36 -8
- package/dist/chunk-IUQZ4Z7M.js.map +1 -0
- package/dist/{chunk-YMUJZWHB.js → chunk-IXZJ3JOO.js} +5 -5
- package/dist/{chunk-47YKYDOF.js → chunk-L6G35FU5.js} +2 -2
- package/dist/{chunk-ELVDOTU7.js → chunk-LSWP7MU2.js} +4 -4
- package/dist/chunk-LSWP7MU2.js.map +1 -0
- package/dist/{chunk-OUJDDY5L.js → chunk-MJSXP4LW.js} +30 -28
- package/dist/chunk-MJSXP4LW.js.map +1 -0
- package/dist/{chunk-WVHPGQH5.js → chunk-NAAMHWSI.js} +5 -2
- package/dist/chunk-NAAMHWSI.js.map +1 -0
- package/dist/{chunk-IKAJSA7E.js → chunk-O75FOHXS.js} +29 -11
- package/dist/chunk-O75FOHXS.js.map +1 -0
- package/dist/{chunk-WMFRCSNC.js → chunk-PCX2JQ2J.js} +3 -3
- package/dist/{chunk-IGHSLJUF.js → chunk-PKW3H26Z.js} +5 -5
- package/dist/{chunk-3NZCU6SD.js → chunk-PQZVDCCA.js} +4 -4
- package/dist/{chunk-OC3EIDCP.js → chunk-QWBUKIP2.js} +7 -1
- package/dist/chunk-QWBUKIP2.js.map +1 -0
- package/dist/{chunk-FKSAUOJU.js → chunk-UO22YNY4.js} +1 -69
- package/dist/chunk-UO22YNY4.js.map +1 -0
- package/dist/chunk-VEAERJVJ.js +43 -0
- package/dist/chunk-VEAERJVJ.js.map +1 -0
- package/dist/{chunk-GCGMXA2O.js → chunk-VRPLZERE.js} +16 -5
- package/dist/chunk-VRPLZERE.js.map +1 -0
- package/dist/{chunk-IAR25V2E.js → chunk-W4VW5XYB.js} +4 -4
- package/dist/chunk-WYLMJQVH.js +240 -0
- package/dist/chunk-WYLMJQVH.js.map +1 -0
- package/dist/{chunk-TXVC46SA.js → chunk-XVPQGCH4.js} +11 -10
- package/dist/chunk-XVPQGCH4.js.map +1 -0
- package/dist/chunk-ZOBNS7CX.js +73 -0
- package/dist/chunk-ZOBNS7CX.js.map +1 -0
- package/dist/{cli-XK5JZWU6.js → cli-U2BEUA55.js} +34 -36
- package/dist/{cli-XK5JZWU6.js.map → cli-U2BEUA55.js.map} +1 -1
- package/dist/{config-CNK7MYUR.js → config-CNUIX23Q.js} +12 -6
- package/dist/{doctor-R7N7FUX5.js → doctor-QJJXRWTO.js} +11 -7
- package/dist/{edit-QSUEG7CL.js → edit-HJ44P44P.js} +13 -11
- package/dist/{fund-JF6A76YS.js → fund-Y5IAHZ5D.js} +10 -8
- package/dist/index.js +1 -1
- package/dist/{inspect-NFNAA4LA.js → inspect-NFQ6SQQQ.js} +14 -12
- package/dist/{install-YQVM3SUW.js → install-DXX7PVUP.js} +122 -401
- package/dist/install-DXX7PVUP.js.map +1 -0
- package/dist/outcome-ANV4QIED.js +24 -0
- package/dist/{publish-O2I6IAEL.js → publish-PCBTCXCZ.js} +14 -12
- package/dist/{read-UF7QVQOU.js → read-W7QVRBVD.js} +14 -12
- package/dist/{read-UF7QVQOU.js.map → read-W7QVRBVD.js.map} +1 -1
- package/dist/{run-GDZWHNWZ.js → run-CJWPGMIQ.js} +26 -24
- package/dist/{run-GDZWHNWZ.js.map → run-CJWPGMIQ.js.map} +1 -1
- package/dist/search-JGAVKTYJ.js +25 -0
- package/dist/{send-SI254H3R.js → send-C5EOKXOU.js} +7 -6
- package/dist/{send-SI254H3R.js.map → send-C5EOKXOU.js.map} +1 -1
- package/dist/{session-GJZJEXLJ.js → session-OBCUUIFX.js} +7 -6
- package/dist/{session-GJZJEXLJ.js.map → session-OBCUUIFX.js.map} +1 -1
- package/dist/{skill-heal-BPFT22XS.js → skill-heal-D6EPLPS6.js} +3 -3
- package/dist/skill-heal-D6EPLPS6.js.map +1 -0
- package/dist/{uninstall-7ZZG6WQ5.js → uninstall-OWJNJ5LI.js} +11 -5
- package/dist/uninstall-OWJNJ5LI.js.map +1 -0
- package/dist/{update-FPSBITLB.js → update-24Y2CQTT.js} +16 -13
- package/dist/update-24Y2CQTT.js.map +1 -0
- package/dist/{wallet-TZVD2M4I.js → wallet-OFXDIIGP.js} +7 -6
- package/dist/{wallet-NS7TYWNN.js → wallet-SLRIYJ2U.js} +4 -3
- package/docs/agent-permissions.md +100 -16
- package/docs/command-reference.md +21 -11
- package/package.json +1 -1
- package/skills/tenjin-publish/SKILL.md +181 -205
- package/skills/tenjin-publish/references/maintain.md +39 -0
- package/skills/tenjin-search/SKILL.md +86 -279
- package/skills/tenjin-search/references/permissions.md +106 -0
- package/dist/chunk-ELVDOTU7.js.map +0 -1
- package/dist/chunk-FKSAUOJU.js.map +0 -1
- package/dist/chunk-GCGMXA2O.js.map +0 -1
- package/dist/chunk-IKAJSA7E.js.map +0 -1
- package/dist/chunk-L4XNT3UW.js.map +0 -1
- package/dist/chunk-OC3EIDCP.js.map +0 -1
- package/dist/chunk-OE36HRWG.js.map +0 -1
- package/dist/chunk-OUJDDY5L.js.map +0 -1
- package/dist/chunk-OXUJ3FXU.js.map +0 -1
- package/dist/chunk-SPUORKD7.js.map +0 -1
- package/dist/chunk-TXVC46SA.js.map +0 -1
- package/dist/chunk-UUARTUY2.js +0 -349
- package/dist/chunk-UUARTUY2.js.map +0 -1
- package/dist/chunk-WVHPGQH5.js.map +0 -1
- package/dist/install-YQVM3SUW.js.map +0 -1
- package/dist/outcome-IUSYFJTN.js +0 -22
- package/dist/search-JVOHEF3E.js +0 -23
- package/dist/skill-heal-BPFT22XS.js.map +0 -1
- package/dist/uninstall-7ZZG6WQ5.js.map +0 -1
- package/dist/update-FPSBITLB.js.map +0 -1
- /package/dist/{buy-X4VPHFUA.js.map → buy-2JBYPHAI.js.map} +0 -0
- /package/dist/{chunk-6JKD46OJ.js.map → chunk-3ZW7HPY5.js.map} +0 -0
- /package/dist/{chunk-IFPKA32J.js.map → chunk-4Y53PDH6.js.map} +0 -0
- /package/dist/{chunk-T4UWMVKV.js.map → chunk-ACBEHJAH.js.map} +0 -0
- /package/dist/{chunk-XXY77EZJ.js.map → chunk-DAZAXFSF.js.map} +0 -0
- /package/dist/{chunk-NKN4YC5C.js.map → chunk-FDUD3W5V.js.map} +0 -0
- /package/dist/{chunk-YMUJZWHB.js.map → chunk-IXZJ3JOO.js.map} +0 -0
- /package/dist/{chunk-47YKYDOF.js.map → chunk-L6G35FU5.js.map} +0 -0
- /package/dist/{chunk-WMFRCSNC.js.map → chunk-PCX2JQ2J.js.map} +0 -0
- /package/dist/{chunk-IGHSLJUF.js.map → chunk-PKW3H26Z.js.map} +0 -0
- /package/dist/{chunk-3NZCU6SD.js.map → chunk-PQZVDCCA.js.map} +0 -0
- /package/dist/{chunk-IAR25V2E.js.map → chunk-W4VW5XYB.js.map} +0 -0
- /package/dist/{config-CNK7MYUR.js.map → config-CNUIX23Q.js.map} +0 -0
- /package/dist/{doctor-R7N7FUX5.js.map → doctor-QJJXRWTO.js.map} +0 -0
- /package/dist/{edit-QSUEG7CL.js.map → edit-HJ44P44P.js.map} +0 -0
- /package/dist/{fund-JF6A76YS.js.map → fund-Y5IAHZ5D.js.map} +0 -0
- /package/dist/{inspect-NFNAA4LA.js.map → inspect-NFQ6SQQQ.js.map} +0 -0
- /package/dist/{outcome-IUSYFJTN.js.map → outcome-ANV4QIED.js.map} +0 -0
- /package/dist/{publish-O2I6IAEL.js.map → publish-PCBTCXCZ.js.map} +0 -0
- /package/dist/{search-JVOHEF3E.js.map → search-JGAVKTYJ.js.map} +0 -0
- /package/dist/{wallet-NS7TYWNN.js.map → wallet-OFXDIIGP.js.map} +0 -0
- /package/dist/{wallet-TZVD2M4I.js.map → wallet-SLRIYJ2U.js.map} +0 -0
|
@@ -1,56 +1,66 @@
|
|
|
1
1
|
import { createRequire as __tenjinCreateRequire } from 'node:module'; const require = __tenjinCreateRequire(import.meta.url);
|
|
2
2
|
import {
|
|
3
3
|
runWalletCreate
|
|
4
|
-
} from "./chunk-
|
|
4
|
+
} from "./chunk-ACBEHJAH.js";
|
|
5
5
|
import "./chunk-MJZZTKCC.js";
|
|
6
6
|
import {
|
|
7
7
|
describeWallet,
|
|
8
8
|
resolveWalletProvider
|
|
9
|
-
} from "./chunk-
|
|
9
|
+
} from "./chunk-7GJQ5RGA.js";
|
|
10
10
|
import {
|
|
11
11
|
collectDoctorChecks,
|
|
12
12
|
isNoWalletCheck
|
|
13
|
-
} from "./chunk-
|
|
14
|
-
import {
|
|
15
|
-
PERMISSIONS_DOC_URL,
|
|
16
|
-
recommendedPermissions
|
|
17
|
-
} from "./chunk-OXUJ3FXU.js";
|
|
13
|
+
} from "./chunk-GEHL43VE.js";
|
|
18
14
|
import "./chunk-J6FUAIRR.js";
|
|
19
|
-
import "./chunk-
|
|
15
|
+
import "./chunk-54AJIO3E.js";
|
|
20
16
|
import "./chunk-XGZ5EVMB.js";
|
|
21
17
|
import {
|
|
22
18
|
walletFileExists
|
|
23
19
|
} from "./chunk-3P3ES4XU.js";
|
|
24
20
|
import {
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
WEBSEARCH_HOOK_FILE,
|
|
28
|
-
claudeSettingsPath,
|
|
29
|
-
inspectFreeVerbRules,
|
|
30
|
-
permissionsSkipped,
|
|
31
|
-
removeMarkerLines,
|
|
32
|
-
stopHookScript,
|
|
33
|
-
websearchHookScript,
|
|
34
|
-
wireFreeVerbAllowlist
|
|
35
|
-
} from "./chunk-OE36HRWG.js";
|
|
36
|
-
import "./chunk-CA3JV7FX.js";
|
|
21
|
+
removeMarkerLines
|
|
22
|
+
} from "./chunk-WYLMJQVH.js";
|
|
37
23
|
import {
|
|
38
24
|
installSkill
|
|
39
|
-
} from "./chunk-
|
|
25
|
+
} from "./chunk-NAAMHWSI.js";
|
|
40
26
|
import {
|
|
41
27
|
sanitizeForTerminal
|
|
42
28
|
} from "./chunk-B676GPS2.js";
|
|
43
29
|
import {
|
|
30
|
+
confirmChoice,
|
|
31
|
+
hooksSkipped,
|
|
32
|
+
hooksUndo,
|
|
33
|
+
intro,
|
|
34
|
+
outro,
|
|
44
35
|
persistInstallHarness,
|
|
45
36
|
persistPublishMode,
|
|
46
|
-
persistSearchHookMode
|
|
47
|
-
|
|
48
|
-
|
|
37
|
+
persistSearchHookMode,
|
|
38
|
+
selectOne,
|
|
39
|
+
wireSearchHooks
|
|
40
|
+
} from "./chunk-4UHNXY6B.js";
|
|
49
41
|
import {
|
|
50
42
|
ownsAnyLock,
|
|
51
43
|
releaseOwnedLocks
|
|
52
|
-
} from "./chunk-
|
|
44
|
+
} from "./chunk-ZOBNS7CX.js";
|
|
45
|
+
import {
|
|
46
|
+
PERMISSIONS_DOC_URL,
|
|
47
|
+
recommendedPermissions
|
|
48
|
+
} from "./chunk-IUQZ4Z7M.js";
|
|
49
|
+
import "./chunk-PKW3H26Z.js";
|
|
53
50
|
import "./chunk-736DW4V3.js";
|
|
51
|
+
import "./chunk-UO22YNY4.js";
|
|
52
|
+
import "./chunk-DTCXO7HS.js";
|
|
53
|
+
import {
|
|
54
|
+
FREE_VERB_RULES,
|
|
55
|
+
MODE_GATED_RULES,
|
|
56
|
+
inspectFreeVerbRules,
|
|
57
|
+
permissionsSkipped,
|
|
58
|
+
planFreeVerbAllowlist,
|
|
59
|
+
retractModeGatedRules,
|
|
60
|
+
rulesForPublishMode,
|
|
61
|
+
wireFreeVerbAllowlist
|
|
62
|
+
} from "./chunk-IU2HVT3Y.js";
|
|
63
|
+
import "./chunk-VEAERJVJ.js";
|
|
54
64
|
import {
|
|
55
65
|
CONFIG_DEFAULTS,
|
|
56
66
|
PublishModeSchema,
|
|
@@ -58,9 +68,9 @@ import {
|
|
|
58
68
|
loadRawConfig,
|
|
59
69
|
parsePublishModeFlag,
|
|
60
70
|
parseSearchHookModeFlag
|
|
61
|
-
} from "./chunk-
|
|
71
|
+
} from "./chunk-LSWP7MU2.js";
|
|
72
|
+
import "./chunk-ETKZWJ4B.js";
|
|
62
73
|
import {
|
|
63
|
-
hooksDir,
|
|
64
74
|
walletPath
|
|
65
75
|
} from "./chunk-ZQIQ55KK.js";
|
|
66
76
|
import {
|
|
@@ -74,12 +84,11 @@ import {
|
|
|
74
84
|
onPath,
|
|
75
85
|
readSkillFile,
|
|
76
86
|
resolveSkillsSource
|
|
77
|
-
} from "./chunk-
|
|
87
|
+
} from "./chunk-QWBUKIP2.js";
|
|
78
88
|
import {
|
|
79
89
|
CliError,
|
|
80
90
|
external_exports,
|
|
81
|
-
hasCode
|
|
82
|
-
writeFileAtomic
|
|
91
|
+
hasCode
|
|
83
92
|
} from "./chunk-PAOVPSP6.js";
|
|
84
93
|
import "./chunk-7FK2UN2T.js";
|
|
85
94
|
import "./chunk-M2O56UK7.js";
|
|
@@ -94,329 +103,12 @@ import "./chunk-ZXTAQYNA.js";
|
|
|
94
103
|
|
|
95
104
|
// src/commands/install.ts
|
|
96
105
|
import { existsSync } from "fs";
|
|
97
|
-
import { readFile
|
|
106
|
+
import { readFile } from "fs/promises";
|
|
98
107
|
import { fileURLToPath } from "url";
|
|
99
|
-
import { dirname, isAbsolute, join
|
|
108
|
+
import { dirname, isAbsolute, join } from "path";
|
|
100
109
|
import { homedir } from "os";
|
|
101
110
|
import { styleText } from "util";
|
|
102
111
|
import { Stream } from "stream";
|
|
103
|
-
|
|
104
|
-
// src/lib/harness-hooks.ts
|
|
105
|
-
import { lstat, readFile, realpath } from "fs/promises";
|
|
106
|
-
import { join } from "path";
|
|
107
|
-
var WEBSEARCH_MATCHER = "WebSearch";
|
|
108
|
-
var HOOK_TIMEOUT_SECONDS = 5;
|
|
109
|
-
function hooksUndo(settingsPath, scriptsDir) {
|
|
110
|
-
return `Undo anytime: \`tenjin config set hooks.searchMode off\` disarms them, or delete the tenjin hook entries from ${settingsPath} and the scripts in ${scriptsDir}.`;
|
|
111
|
-
}
|
|
112
|
-
function skip(reason, args) {
|
|
113
|
-
return {
|
|
114
|
-
harness: args.harness,
|
|
115
|
-
...args.path !== void 0 ? { path: args.path } : {},
|
|
116
|
-
scriptsDir: args.scriptsDir,
|
|
117
|
-
mode: args.mode,
|
|
118
|
-
added: [],
|
|
119
|
-
alreadyPresent: [],
|
|
120
|
-
updated: [],
|
|
121
|
-
scripts: [],
|
|
122
|
-
skipped: reason,
|
|
123
|
-
...args.warning !== void 0 ? { warning: args.warning } : {},
|
|
124
|
-
...args.fix !== void 0 ? { fix: args.fix } : {}
|
|
125
|
-
};
|
|
126
|
-
}
|
|
127
|
-
function hooksSkipped(harness, homeDir, dataDir, mode, reason) {
|
|
128
|
-
return skip(reason, {
|
|
129
|
-
harness,
|
|
130
|
-
...harness === "claude" ? { path: claudeSettingsPath(homeDir) } : {},
|
|
131
|
-
scriptsDir: hooksDir(dataDir),
|
|
132
|
-
mode,
|
|
133
|
-
fix: fixFor(reason)
|
|
134
|
-
});
|
|
135
|
-
}
|
|
136
|
-
function fixFor(reason) {
|
|
137
|
-
switch (reason) {
|
|
138
|
-
case "harness-not-claude":
|
|
139
|
-
return "Hooks are wired for Claude Code only. Re-run `tenjin install --harness claude` on a machine with Claude Code.";
|
|
140
|
-
case "mode-off":
|
|
141
|
-
return "Enable them with `tenjin config set hooks.searchMode auto`, then re-run `tenjin install`.";
|
|
142
|
-
case "declined":
|
|
143
|
-
case "dry-run":
|
|
144
|
-
return "Wire them with `tenjin install --search-hooks auto`.";
|
|
145
|
-
case "changed-since-read":
|
|
146
|
-
return "Another process changed the file mid-run; re-run `tenjin install`.";
|
|
147
|
-
default:
|
|
148
|
-
return "Fix the reported file, then re-run `tenjin install --search-hooks auto`.";
|
|
149
|
-
}
|
|
150
|
-
}
|
|
151
|
-
function isPlainObject(value) {
|
|
152
|
-
return typeof value === "object" && value !== null && !Array.isArray(value);
|
|
153
|
-
}
|
|
154
|
-
function quoteForShell(path, platform = process.platform) {
|
|
155
|
-
if (platform === "win32") return `"${path}"`;
|
|
156
|
-
return `'${path.replaceAll("'", `'\\''`)}'`;
|
|
157
|
-
}
|
|
158
|
-
function commandFor(scriptPath, platform) {
|
|
159
|
-
return `node ${quoteForShell(scriptPath, platform)}`;
|
|
160
|
-
}
|
|
161
|
-
function handlerFor(scriptPath, platform) {
|
|
162
|
-
return {
|
|
163
|
-
type: "command",
|
|
164
|
-
command: commandFor(scriptPath, platform),
|
|
165
|
-
timeout: HOOK_TIMEOUT_SECONDS
|
|
166
|
-
};
|
|
167
|
-
}
|
|
168
|
-
function ownsEntry(entry, scriptFile) {
|
|
169
|
-
if (!isPlainObject(entry)) return false;
|
|
170
|
-
const handlers = entry.hooks;
|
|
171
|
-
if (!Array.isArray(handlers)) return false;
|
|
172
|
-
return handlers.some(
|
|
173
|
-
(h) => isPlainObject(h) && typeof h.command === "string" && h.command.includes(scriptFile)
|
|
174
|
-
);
|
|
175
|
-
}
|
|
176
|
-
function specs(dataDir) {
|
|
177
|
-
return [
|
|
178
|
-
{
|
|
179
|
-
event: "PreToolUse",
|
|
180
|
-
scriptFile: WEBSEARCH_HOOK_FILE,
|
|
181
|
-
script: websearchHookScript(dataDir),
|
|
182
|
-
matcher: WEBSEARCH_MATCHER
|
|
183
|
-
},
|
|
184
|
-
{ event: "Stop", scriptFile: STOP_HOOK_FILE, script: stopHookScript(dataDir) }
|
|
185
|
-
];
|
|
186
|
-
}
|
|
187
|
-
async function wireSearchHooks(opts) {
|
|
188
|
-
const { homeDir, dataDir, mode, platform } = opts;
|
|
189
|
-
const scriptsDir = hooksDir(dataDir);
|
|
190
|
-
const plan = specs(dataDir);
|
|
191
|
-
const found = await inspectSettings(homeDir, scriptsDir, mode);
|
|
192
|
-
if ("result" in found) return found.result;
|
|
193
|
-
const { path, raw, settings, hooks } = found;
|
|
194
|
-
const added = [];
|
|
195
|
-
const alreadyPresent = [];
|
|
196
|
-
const updated = [];
|
|
197
|
-
const nextHooks = { ...hooks };
|
|
198
|
-
for (const spec of plan) {
|
|
199
|
-
const existing = hooks[spec.event];
|
|
200
|
-
if (existing !== void 0 && !Array.isArray(existing)) {
|
|
201
|
-
return refuse(
|
|
202
|
-
path,
|
|
203
|
-
scriptsDir,
|
|
204
|
-
mode,
|
|
205
|
-
"unexpected-shape",
|
|
206
|
-
`${path} has a "hooks.${spec.event}" key that is not an array; it was left exactly as it is.`
|
|
207
|
-
);
|
|
208
|
-
}
|
|
209
|
-
const list = existing ?? [];
|
|
210
|
-
const desired = {
|
|
211
|
-
...spec.matcher !== void 0 ? { matcher: spec.matcher } : {},
|
|
212
|
-
hooks: [handlerFor(join(scriptsDir, spec.scriptFile), platform)]
|
|
213
|
-
};
|
|
214
|
-
const idx = list.findIndex((e) => ownsEntry(e, spec.scriptFile));
|
|
215
|
-
if (idx === -1) {
|
|
216
|
-
nextHooks[spec.event] = [...list, desired];
|
|
217
|
-
added.push(spec.event);
|
|
218
|
-
continue;
|
|
219
|
-
}
|
|
220
|
-
if (JSON.stringify(list[idx]) === JSON.stringify(desired)) {
|
|
221
|
-
alreadyPresent.push(spec.event);
|
|
222
|
-
continue;
|
|
223
|
-
}
|
|
224
|
-
nextHooks[spec.event] = list.map((e, i) => i === idx ? desired : e);
|
|
225
|
-
updated.push(spec.event);
|
|
226
|
-
}
|
|
227
|
-
if (added.length === 0 && updated.length === 0) {
|
|
228
|
-
const scripts2 = await writeScripts(plan, scriptsDir);
|
|
229
|
-
return { harness: "claude", path, scriptsDir, mode, added, alreadyPresent, updated, scripts: scripts2 };
|
|
230
|
-
}
|
|
231
|
-
const next = { ...settings, hooks: nextHooks };
|
|
232
|
-
const changed = async () => await readFile(path, "utf8").catch(() => null) !== raw;
|
|
233
|
-
if (await changed()) return refuseChanged(path, scriptsDir, mode, []);
|
|
234
|
-
const scripts = await writeScripts(plan, scriptsDir);
|
|
235
|
-
if (await changed()) return refuseChanged(path, scriptsDir, mode, scripts);
|
|
236
|
-
await writeFileAtomic(path, `${JSON.stringify(next, null, 2)}
|
|
237
|
-
`);
|
|
238
|
-
return { harness: "claude", path, scriptsDir, mode, added, alreadyPresent, updated, scripts };
|
|
239
|
-
}
|
|
240
|
-
function refuseChanged(path, scriptsDir, mode, scripts) {
|
|
241
|
-
return {
|
|
242
|
-
...refuse(
|
|
243
|
-
path,
|
|
244
|
-
scriptsDir,
|
|
245
|
-
mode,
|
|
246
|
-
"changed-since-read",
|
|
247
|
-
`${path} changed while it was being updated, so no hooks were registered. Re-run \`tenjin install\`.`
|
|
248
|
-
),
|
|
249
|
-
scripts
|
|
250
|
-
};
|
|
251
|
-
}
|
|
252
|
-
async function writeScripts(plan, scriptsDir) {
|
|
253
|
-
const written = [];
|
|
254
|
-
for (const spec of plan) {
|
|
255
|
-
const target = join(scriptsDir, spec.scriptFile);
|
|
256
|
-
const onDisk = await readFile(target, "utf8").catch(() => null);
|
|
257
|
-
if (onDisk === spec.script) continue;
|
|
258
|
-
await writeFileAtomic(target, spec.script, { mode: 493, dirMode: 448 });
|
|
259
|
-
written.push(target);
|
|
260
|
-
}
|
|
261
|
-
return written;
|
|
262
|
-
}
|
|
263
|
-
function refuse(path, scriptsDir, mode, reason, warning) {
|
|
264
|
-
return skip(reason, { harness: "claude", path, scriptsDir, mode, warning, fix: fixFor(reason) });
|
|
265
|
-
}
|
|
266
|
-
async function inspectSettings(homeDir, scriptsDir, mode) {
|
|
267
|
-
const declaredPath = claudeSettingsPath(homeDir);
|
|
268
|
-
const entry = await lstat(declaredPath).catch(() => null);
|
|
269
|
-
let path = declaredPath;
|
|
270
|
-
if (entry !== null) {
|
|
271
|
-
try {
|
|
272
|
-
path = await realpath(declaredPath);
|
|
273
|
-
} catch (err) {
|
|
274
|
-
return {
|
|
275
|
-
result: refuse(
|
|
276
|
-
declaredPath,
|
|
277
|
-
scriptsDir,
|
|
278
|
-
mode,
|
|
279
|
-
"unresolvable",
|
|
280
|
-
`${declaredPath} could not be resolved (${err.message}); it was left exactly as it is.`
|
|
281
|
-
)
|
|
282
|
-
};
|
|
283
|
-
}
|
|
284
|
-
}
|
|
285
|
-
let settings = {};
|
|
286
|
-
let raw = null;
|
|
287
|
-
if (entry !== null) {
|
|
288
|
-
try {
|
|
289
|
-
raw = await readFile(path, "utf8");
|
|
290
|
-
} catch (err) {
|
|
291
|
-
return {
|
|
292
|
-
result: refuse(
|
|
293
|
-
path,
|
|
294
|
-
scriptsDir,
|
|
295
|
-
mode,
|
|
296
|
-
"unreadable",
|
|
297
|
-
`${path} could not be read (${err.message}); no hooks were registered.`
|
|
298
|
-
)
|
|
299
|
-
};
|
|
300
|
-
}
|
|
301
|
-
let parsed;
|
|
302
|
-
try {
|
|
303
|
-
parsed = JSON.parse(raw);
|
|
304
|
-
} catch (err) {
|
|
305
|
-
return {
|
|
306
|
-
result: refuse(
|
|
307
|
-
path,
|
|
308
|
-
scriptsDir,
|
|
309
|
-
mode,
|
|
310
|
-
"unparsable",
|
|
311
|
-
`${path} is not valid JSON (${err.message}); it was left exactly as it is.`
|
|
312
|
-
)
|
|
313
|
-
};
|
|
314
|
-
}
|
|
315
|
-
if (!isPlainObject(parsed)) {
|
|
316
|
-
return {
|
|
317
|
-
result: refuse(
|
|
318
|
-
path,
|
|
319
|
-
scriptsDir,
|
|
320
|
-
mode,
|
|
321
|
-
"unexpected-shape",
|
|
322
|
-
`${path} is not a JSON object; it was left exactly as it is.`
|
|
323
|
-
)
|
|
324
|
-
};
|
|
325
|
-
}
|
|
326
|
-
settings = parsed;
|
|
327
|
-
}
|
|
328
|
-
const hooksValue = settings.hooks;
|
|
329
|
-
if (hooksValue !== void 0 && !isPlainObject(hooksValue)) {
|
|
330
|
-
return {
|
|
331
|
-
result: refuse(
|
|
332
|
-
path,
|
|
333
|
-
scriptsDir,
|
|
334
|
-
mode,
|
|
335
|
-
"unexpected-shape",
|
|
336
|
-
`${path} has a "hooks" key that is not an object; it was left exactly as it is.`
|
|
337
|
-
)
|
|
338
|
-
};
|
|
339
|
-
}
|
|
340
|
-
return { path, raw, settings, hooks: hooksValue ?? {} };
|
|
341
|
-
}
|
|
342
|
-
|
|
343
|
-
// src/lib/clack.ts
|
|
344
|
-
var SHOW_CURSOR = "\x1B[?25h";
|
|
345
|
-
function withInputEnd(streams, onEnd, run) {
|
|
346
|
-
const controller = new AbortController();
|
|
347
|
-
let settleEnd;
|
|
348
|
-
const ended = new Promise((resolve) => {
|
|
349
|
-
settleEnd = () => {
|
|
350
|
-
streams.output.write(SHOW_CURSOR);
|
|
351
|
-
resolve(onEnd);
|
|
352
|
-
};
|
|
353
|
-
});
|
|
354
|
-
const end = () => {
|
|
355
|
-
controller.abort();
|
|
356
|
-
settleEnd?.();
|
|
357
|
-
};
|
|
358
|
-
const onKeypress = (_text, key) => {
|
|
359
|
-
if (key?.ctrl === true && key.name === "d") end();
|
|
360
|
-
};
|
|
361
|
-
streams.input.on("keypress", onKeypress);
|
|
362
|
-
if (streams.input.readableEnded) {
|
|
363
|
-
queueMicrotask(end);
|
|
364
|
-
} else {
|
|
365
|
-
streams.input.once("end", end);
|
|
366
|
-
streams.input.once("close", end);
|
|
367
|
-
}
|
|
368
|
-
return Promise.race([run(controller.signal), ended]).finally(() => {
|
|
369
|
-
streams.input.off("keypress", onKeypress);
|
|
370
|
-
streams.input.off("end", end);
|
|
371
|
-
streams.input.off("close", end);
|
|
372
|
-
});
|
|
373
|
-
}
|
|
374
|
-
function resolveStreams(streams) {
|
|
375
|
-
return { input: streams.input ?? process.stdin, output: streams.output ?? process.stderr };
|
|
376
|
-
}
|
|
377
|
-
async function selectOne(opts) {
|
|
378
|
-
const { select, isCancel } = await import("./dist-U4M6QCKE.js");
|
|
379
|
-
const streams = resolveStreams(opts.streams ?? {});
|
|
380
|
-
return withInputEnd(streams, null, async (signal) => {
|
|
381
|
-
const answer = await select({
|
|
382
|
-
message: opts.message,
|
|
383
|
-
options: opts.choices.map((c) => ({
|
|
384
|
-
value: c.value,
|
|
385
|
-
label: c.label,
|
|
386
|
-
...c.hint !== void 0 ? { hint: c.hint } : {}
|
|
387
|
-
})),
|
|
388
|
-
initialValue: opts.initialValue,
|
|
389
|
-
input: streams.input,
|
|
390
|
-
output: streams.output,
|
|
391
|
-
signal
|
|
392
|
-
});
|
|
393
|
-
return isCancel(answer) ? null : answer;
|
|
394
|
-
});
|
|
395
|
-
}
|
|
396
|
-
async function confirmChoice(message, initialValue = true, streams = {}) {
|
|
397
|
-
const { confirm, isCancel } = await import("./dist-U4M6QCKE.js");
|
|
398
|
-
const resolved = resolveStreams(streams);
|
|
399
|
-
return withInputEnd(resolved, false, async (signal) => {
|
|
400
|
-
const answer = await confirm({
|
|
401
|
-
message,
|
|
402
|
-
initialValue,
|
|
403
|
-
input: resolved.input,
|
|
404
|
-
output: resolved.output,
|
|
405
|
-
signal
|
|
406
|
-
});
|
|
407
|
-
return isCancel(answer) ? false : answer;
|
|
408
|
-
});
|
|
409
|
-
}
|
|
410
|
-
async function intro(message) {
|
|
411
|
-
const clack = await import("./dist-U4M6QCKE.js");
|
|
412
|
-
clack.intro(message, { output: process.stderr });
|
|
413
|
-
}
|
|
414
|
-
async function outro(message) {
|
|
415
|
-
const clack = await import("./dist-U4M6QCKE.js");
|
|
416
|
-
clack.outro(message, { output: process.stderr });
|
|
417
|
-
}
|
|
418
|
-
|
|
419
|
-
// src/commands/install.ts
|
|
420
112
|
var HARNESSES = HARNESS_TARGETS;
|
|
421
113
|
var InstallInputSchema = external_exports.object({
|
|
422
114
|
harness: external_exports.array(external_exports.string()).optional(),
|
|
@@ -550,7 +242,8 @@ async function installBody(input, ctx, deps, markPhase) {
|
|
|
550
242
|
deps,
|
|
551
243
|
flag: allowFreeVerbs,
|
|
552
244
|
dryRun,
|
|
553
|
-
canPrompt
|
|
245
|
+
canPrompt,
|
|
246
|
+
publishMode: publishMode.value
|
|
554
247
|
});
|
|
555
248
|
const hooks = await underDataDir(
|
|
556
249
|
ctx.dataDir,
|
|
@@ -582,7 +275,7 @@ async function installBody(input, ctx, deps, markPhase) {
|
|
|
582
275
|
// `wired` is the outcome of THIS run's settings.json write; the three
|
|
583
276
|
// recommendation tiers beside it are unchanged, so a machine consumer that
|
|
584
277
|
// read `alwaysSafe` / `optIn` / `neverAllowlisted` before still does.
|
|
585
|
-
permissions: { ...recommendedPermissions(), wired: permissions },
|
|
278
|
+
permissions: { ...recommendedPermissions(publishMode.value), wired: permissions },
|
|
586
279
|
hooks,
|
|
587
280
|
wallet
|
|
588
281
|
};
|
|
@@ -651,19 +344,13 @@ function noticeLines(io, s) {
|
|
|
651
344
|
`Removed the old Tenjin pointer line from ${s.pointerCleanup.join(" and ")}; the skills carry their own triggers now.`
|
|
652
345
|
);
|
|
653
346
|
}
|
|
654
|
-
|
|
347
|
+
const stale = s.permissions.removed.filter((r) => !MODE_GATED_RULES.includes(r));
|
|
348
|
+
if (stale.length > 0) {
|
|
655
349
|
lines.push(
|
|
656
|
-
`Removed ${
|
|
350
|
+
`Removed ${stale.length} permission rule(s) an older tenjin left in ${s.permissions.path ?? "your settings"} for commands that no longer exist.`
|
|
657
351
|
);
|
|
658
352
|
}
|
|
659
|
-
if (s.permissions.added.length > 0) {
|
|
660
|
-
lines.push(
|
|
661
|
-
paint(
|
|
662
|
-
io,
|
|
663
|
-
"dim",
|
|
664
|
-
`${s.permissions.added.length} free tenjin commands were allowed in ${s.permissions.path}. None can spend USDC or open your wallet keystore; see them with \`tenjin doctor\`.`
|
|
665
|
-
)
|
|
666
|
-
);
|
|
353
|
+
if (s.permissions.planned !== true && s.permissions.added.length > 0) {
|
|
667
354
|
lines.push(paint(io, "dim", `Undo anytime: remove those lines from ${s.permissions.path}.`));
|
|
668
355
|
}
|
|
669
356
|
if (s.hooks.added.length > 0 || s.hooks.updated.length > 0) {
|
|
@@ -691,7 +378,7 @@ function noticeLines(io, s) {
|
|
|
691
378
|
function summaryLines(io, s) {
|
|
692
379
|
return [
|
|
693
380
|
...s.harnesses.map((h) => skillsLine(io, h, s.dryRun)),
|
|
694
|
-
publishingLine(io, s.publishMode.value),
|
|
381
|
+
publishingLine(io, s.publishMode.value, s.permissions),
|
|
695
382
|
permissionsLine(io, s.permissions),
|
|
696
383
|
hooksLine(io, s.hooks),
|
|
697
384
|
walletLine(io, s.wallet),
|
|
@@ -740,30 +427,38 @@ function skillsLine(io, h, dryRun) {
|
|
|
740
427
|
const head = `${harnessLabel(h.harness)}: ${h.skills.length} skills ${verb}`;
|
|
741
428
|
return `${paint(io, "green", "\u2713")} ${paint(io, "bold", head)} in ${h.skillsDir}. ${skillRoster(h)}.`;
|
|
742
429
|
}
|
|
743
|
-
function publishingLine(io, mode) {
|
|
744
|
-
|
|
430
|
+
function publishingLine(io, mode, wired) {
|
|
431
|
+
const undo = wired.modeGrant === void 0 ? "" : ` ${paint(io, "dim", wired.planned === true ? "Would turn off:" : "Turn off:")} tenjin config set publish.mode review`;
|
|
432
|
+
return `${paint(io, "green", "\u2713")} ${paint(io, "bold", `Publishing: ${mode}`)}. ${modeBlurb(mode)}${undo}`;
|
|
745
433
|
}
|
|
746
434
|
function permissionsLine(io, p) {
|
|
747
435
|
const label = paint(io, "bold", "Permissions:");
|
|
436
|
+
const allowed = p.added.length + p.alreadyPresent.length;
|
|
437
|
+
const retracted = p.removed.filter((r) => MODE_GATED_RULES.includes(r));
|
|
438
|
+
const gaveBack = retracted.length === 0 ? "" : p.planned === true ? ` A real run would remove ${retracted.length} rule(s) for publish and edit from ${p.path ?? "your settings"}.` : ` Publishing is back to asking first, so ${retracted.length} rule(s) for publish and edit were removed from ${p.path ?? "your settings"}.`;
|
|
439
|
+
const unchanged = retracted.length === 0 || p.planned === true ? "unchanged" : "otherwise unchanged";
|
|
440
|
+
if (p.planned === true && p.added.length > 0) {
|
|
441
|
+
return `${paint(io, "dim", "-")} ${label} would allow ${allowed} tenjin commands in ${p.path}. Details: ${PERMISSIONS_DOC_URL}`;
|
|
442
|
+
}
|
|
748
443
|
if (p.added.length > 0) {
|
|
749
|
-
return `${paint(io, "green", "\u2713")} ${label} ${
|
|
444
|
+
return `${paint(io, "green", "\u2713")} ${label} ${allowed} tenjin commands allowed in ${p.path}.${gaveBack} Details: ${PERMISSIONS_DOC_URL}`;
|
|
750
445
|
}
|
|
751
446
|
if (p.skipped === void 0) {
|
|
752
|
-
return `${paint(io, "green", "\u2713")} ${label} the ${FREE_VERB_RULES.length} free tenjin commands were already allowed in ${p.path}`;
|
|
447
|
+
return `${paint(io, "green", "\u2713")} ${label} the ${FREE_VERB_RULES.length} free tenjin commands were already allowed in ${p.path}.${gaveBack}`;
|
|
753
448
|
}
|
|
754
449
|
if (p.skipped === "harness-not-claude") {
|
|
755
|
-
return `${paint(io, "dim", "-")} ${label} not wired (Claude Code only)
|
|
450
|
+
return `${paint(io, "dim", "-")} ${label} not wired for this harness (Claude Code only).${gaveBack} The lines your harness needs: ${PERMISSIONS_DOC_URL}`;
|
|
756
451
|
}
|
|
757
452
|
if (p.skipped === "dry-run") {
|
|
758
|
-
return `${paint(io, "dim", "-")} ${label} unchanged (dry run)
|
|
453
|
+
return `${paint(io, "dim", "-")} ${label} ${unchanged} (dry run); the ${FREE_VERB_RULES.length} rules a real run needs are already there.${gaveBack}`;
|
|
759
454
|
}
|
|
760
455
|
if (p.skipped === "declined" || p.skipped === "not-requested") {
|
|
761
|
-
return `${paint(io, "dim", "-")} ${label} unchanged
|
|
456
|
+
return `${paint(io, "dim", "-")} ${label} ${unchanged}.${gaveBack} Allow the ${FREE_VERB_RULES.length} free tenjin commands with: tenjin install --allow-free-verbs`;
|
|
762
457
|
}
|
|
763
458
|
if (p.skipped === "changed-since-read") {
|
|
764
|
-
return `${paint(io, "yellow", "!")} ${label} ${p.path} changed while it was being updated, so nothing was written
|
|
459
|
+
return `${paint(io, "yellow", "!")} ${label} ${p.path} changed while it was being updated, so nothing was written.${gaveBack} Re-run: tenjin install`;
|
|
765
460
|
}
|
|
766
|
-
return `${paint(io, "yellow", "!")} ${label} ${p.path} was left untouched
|
|
461
|
+
return `${paint(io, "yellow", "!")} ${label} ${p.path} was left untouched.${gaveBack} Fix it, then: tenjin install --allow-free-verbs`;
|
|
767
462
|
}
|
|
768
463
|
function walletLine(io, w) {
|
|
769
464
|
const label = paint(io, "bold", "Wallet:");
|
|
@@ -796,7 +491,7 @@ function skillRoster(h) {
|
|
|
796
491
|
return parts.join("; ");
|
|
797
492
|
}
|
|
798
493
|
function modeBlurb(v) {
|
|
799
|
-
return v === "auto" ? "Your agent publishes
|
|
494
|
+
return v === "auto" ? "Your agent publishes and updates pieces on its own, under your identity." : v === "review" ? "Your agent asks you in chat before every publish." : "Your agent publishes on its own, under your identity, and only a hard block stops it.";
|
|
800
495
|
}
|
|
801
496
|
async function resolveWallet(ctx, deps, skipReason, canPrompt) {
|
|
802
497
|
const exists = await (deps.walletExists ?? walletFileExists)(ctx.dataDir);
|
|
@@ -869,10 +564,10 @@ var PUBLISH_MODE_CHOICES = [
|
|
|
869
564
|
{
|
|
870
565
|
value: "auto",
|
|
871
566
|
label: "Auto (recommended)",
|
|
872
|
-
hint: "your agent publishes
|
|
567
|
+
hint: "your agent publishes and updates pieces on its own, under your identity"
|
|
873
568
|
},
|
|
874
569
|
{ value: "review", label: "Ask me in chat first" },
|
|
875
|
-
{ value: "full-auto", label: "Fully unattended", hint: "only hard
|
|
570
|
+
{ value: "full-auto", label: "Fully unattended", hint: "only a hard block stops it" }
|
|
876
571
|
];
|
|
877
572
|
var PUBLISH_MODE_QUESTION = "When your agent has something worth publishing:";
|
|
878
573
|
async function resolvePublishMode(flag, ctx, deps, dryRun, interactive) {
|
|
@@ -906,32 +601,57 @@ function defaultPromptPublishMode() {
|
|
|
906
601
|
function parseModeFlag(value) {
|
|
907
602
|
return parsePublishModeFlag(value, "--publish-mode");
|
|
908
603
|
}
|
|
909
|
-
|
|
910
|
-
|
|
911
|
-
`Adds ${
|
|
912
|
-
|
|
913
|
-
|
|
914
|
-
|
|
915
|
-
|
|
604
|
+
function permissionsQuestionHead(mode) {
|
|
605
|
+
const count = rulesForPublishMode(mode).length;
|
|
606
|
+
return `Let your agent use tenjin without permission popups? Adds ${count} command rules to ~/.claude/settings.json.`;
|
|
607
|
+
}
|
|
608
|
+
var PERMISSIONS_QUESTION = `${permissionsQuestionHead("review")} None of them can spend your money. Details: ${PERMISSIONS_DOC_URL}`;
|
|
609
|
+
function permissionsQuestion(mode) {
|
|
610
|
+
if (mode === "review") return PERMISSIONS_QUESTION;
|
|
611
|
+
return `${permissionsQuestionHead(mode)} None of them can spend your money, and on publish.mode ${mode} your agent will publish under your identity on its own. Details: ${PERMISSIONS_DOC_URL}`;
|
|
612
|
+
}
|
|
916
613
|
var WALLET_QUESTION = "Create a wallet now?";
|
|
917
614
|
async function resolvePermissions(args) {
|
|
918
|
-
const { plans, home, deps, flag, dryRun, canPrompt } = args;
|
|
615
|
+
const { plans, home, deps, flag, dryRun, canPrompt, publishMode } = args;
|
|
616
|
+
if (dryRun) return (deps.planPermissions ?? planFreeVerbAllowlist)(home, publishMode);
|
|
617
|
+
let retractedRules = [];
|
|
618
|
+
let retractedFrom;
|
|
619
|
+
if (publishMode === "review") {
|
|
620
|
+
const retracted = await (deps.retractModeGated ?? retractModeGatedRules)(home);
|
|
621
|
+
if (retracted.skipped !== void 0) return retracted;
|
|
622
|
+
retractedRules = retracted.removed;
|
|
623
|
+
retractedFrom = retracted.path;
|
|
624
|
+
}
|
|
625
|
+
const withRetraction = (result) => retractedRules.length === 0 ? result : {
|
|
626
|
+
...result,
|
|
627
|
+
removed: [...retractedRules, ...result.removed],
|
|
628
|
+
// A non-Claude skip carries no `path`, deliberately: naming a Claude
|
|
629
|
+
// file to a Codex-only operator points them at a file that is nothing
|
|
630
|
+
// to do with their harness. Once we have RETRACTED from that file, the
|
|
631
|
+
// reverse is true, and the operator needs to know which file changed.
|
|
632
|
+
...result.path === void 0 ? { path: retractedFrom } : {}
|
|
633
|
+
};
|
|
919
634
|
if (!plans.some((p) => p.harness === "claude")) {
|
|
920
|
-
return
|
|
635
|
+
return withRetraction(
|
|
636
|
+
permissionsSkipped(plans[0]?.harness ?? "shared", home, "harness-not-claude")
|
|
637
|
+
);
|
|
638
|
+
}
|
|
639
|
+
if (flag === false) return withRetraction(permissionsSkipped("claude", home, "declined"));
|
|
640
|
+
const probe = await (deps.inspectPermissions ?? inspectFreeVerbRules)(home, publishMode);
|
|
641
|
+
if (probe.satisfied !== void 0) return withRetraction(probe.satisfied);
|
|
642
|
+
if (probe.pending !== null && probe.pending.length === 0) {
|
|
643
|
+
return withRetraction(await wireFreeVerbAllowlist(home, publishMode));
|
|
644
|
+
}
|
|
645
|
+
if (flag === true || !canPrompt) {
|
|
646
|
+
return withRetraction(await wireFreeVerbAllowlist(home, publishMode));
|
|
921
647
|
}
|
|
922
|
-
if (dryRun) return permissionsSkipped("claude", home, "dry-run");
|
|
923
|
-
if (flag === false) return permissionsSkipped("claude", home, "declined");
|
|
924
|
-
const probe = await (deps.inspectPermissions ?? inspectFreeVerbRules)(home);
|
|
925
|
-
if (probe.satisfied !== void 0) return probe.satisfied;
|
|
926
|
-
if (probe.pending !== null && probe.pending.length === 0) return wireFreeVerbAllowlist(home);
|
|
927
|
-
if (flag === true || !canPrompt) return wireFreeVerbAllowlist(home);
|
|
928
648
|
const confirm = deps.confirmPermissions ?? defaultConfirm;
|
|
929
|
-
if (!await confirm(
|
|
930
|
-
return permissionsSkipped("claude", home, "declined");
|
|
649
|
+
if (!await confirm(permissionsQuestion(publishMode))) {
|
|
650
|
+
return withRetraction(permissionsSkipped("claude", home, "declined"));
|
|
931
651
|
}
|
|
932
|
-
return wireFreeVerbAllowlist(home);
|
|
652
|
+
return withRetraction(await wireFreeVerbAllowlist(home, publishMode));
|
|
933
653
|
}
|
|
934
|
-
var SEARCH_HOOKS_QUESTION = "Let Tenjin ride along with your web searches?
|
|
654
|
+
var SEARCH_HOOKS_QUESTION = "Let Tenjin ride along with your web searches?";
|
|
935
655
|
var SEARCH_HOOKS_CHOICES = [
|
|
936
656
|
{
|
|
937
657
|
value: "auto",
|
|
@@ -1029,8 +749,8 @@ async function applyPlan(plan, skillsSource, dryRun) {
|
|
|
1029
749
|
const warnings = [];
|
|
1030
750
|
for (const name of SKILL_NAMES) {
|
|
1031
751
|
const { status, warning, preexisting } = await installSkill(
|
|
1032
|
-
|
|
1033
|
-
|
|
752
|
+
join(skillsSource, name),
|
|
753
|
+
join(plan.skillsDir, name),
|
|
1034
754
|
dryRun,
|
|
1035
755
|
name
|
|
1036
756
|
);
|
|
@@ -1073,7 +793,7 @@ function notesFor(plan, hostedArrivedFirst) {
|
|
|
1073
793
|
return notes;
|
|
1074
794
|
}
|
|
1075
795
|
async function landedInvocable(skillsDir, skillsSource, name, dryRun) {
|
|
1076
|
-
const read = await readSkillFile(
|
|
796
|
+
const read = await readSkillFile(join(dryRun ? skillsSource : skillsDir, name, "SKILL.md"));
|
|
1077
797
|
if (read.kind !== "ok") return false;
|
|
1078
798
|
return !isModelInvocationDisabled(read.bytes.toString("utf8"));
|
|
1079
799
|
}
|
|
@@ -1082,8 +802,8 @@ async function assertSkillsLanded(plans, dryRun) {
|
|
|
1082
802
|
const missing = [];
|
|
1083
803
|
for (const plan of plans) {
|
|
1084
804
|
for (const name of SKILL_NAMES) {
|
|
1085
|
-
if (!existsSync(
|
|
1086
|
-
missing.push(
|
|
805
|
+
if (!existsSync(join(plan.skillsDir, name, "SKILL.md"))) {
|
|
806
|
+
missing.push(join(plan.skillsDir, name));
|
|
1087
807
|
}
|
|
1088
808
|
}
|
|
1089
809
|
}
|
|
@@ -1102,14 +822,14 @@ function paint(io, format, text) {
|
|
|
1102
822
|
}
|
|
1103
823
|
async function assertSkillsSource(dir) {
|
|
1104
824
|
for (const name of SKILL_NAMES) {
|
|
1105
|
-
if (!existsSync(
|
|
825
|
+
if (!existsSync(join(dir, name, "SKILL.md"))) {
|
|
1106
826
|
throw new CliError("INTERNAL", `Packaged skill "${name}" is missing under ${dir}`, {
|
|
1107
827
|
fix: "Reinstall tenjin-cli; the published package must ship every skill under skills/."
|
|
1108
828
|
});
|
|
1109
829
|
}
|
|
1110
830
|
}
|
|
1111
831
|
for (const name of CLI_SKILL_NAMES) {
|
|
1112
|
-
const text = await
|
|
832
|
+
const text = await readFile(join(dir, name, "SKILL.md"), "utf8");
|
|
1113
833
|
if (isModelInvocationDisabled(text)) {
|
|
1114
834
|
throw new CliError(
|
|
1115
835
|
"INTERNAL",
|
|
@@ -1128,6 +848,7 @@ export {
|
|
|
1128
848
|
SEARCH_HOOKS_CHOICES,
|
|
1129
849
|
SEARCH_HOOKS_QUESTION,
|
|
1130
850
|
WALLET_QUESTION,
|
|
851
|
+
permissionsQuestion,
|
|
1131
852
|
runInstall
|
|
1132
853
|
};
|
|
1133
|
-
//# sourceMappingURL=install-
|
|
854
|
+
//# sourceMappingURL=install-DXX7PVUP.js.map
|