tenjin-cli 0.1.0-alpha.3 → 0.1.0-alpha.5
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 +322 -197
- package/dist/{_esm-FEASBWRP.js → _esm-N4KAVXQR.js} +9 -9
- package/dist/buy-YMXXVNFH.js +42 -0
- package/dist/candidate-H7FR4AU5.js +22 -0
- package/dist/{ccip-XR5NE5QK.js → ccip-RPPPKTJR.js} +5 -5
- package/dist/{ccip-NQXCEK2U.js → ccip-ZGGWQN4X.js} +4 -4
- package/dist/{chunk-MUBUQVC3.js → chunk-2JQ5JSG6.js} +3 -2
- package/dist/{chunk-MUBUQVC3.js.map → chunk-2JQ5JSG6.js.map} +1 -1
- package/dist/{chunk-662MSGZB.js → chunk-3IRDP7TN.js} +100 -66
- package/dist/chunk-3IRDP7TN.js.map +1 -0
- package/dist/{chunk-YALGASEU.js → chunk-47PP7TAG.js} +1610 -1610
- package/dist/chunk-47PP7TAG.js.map +1 -0
- package/dist/{buy-EE6SEXP6.js → chunk-4WVKXKDK.js} +27 -59
- package/dist/chunk-4WVKXKDK.js.map +1 -0
- package/dist/chunk-5SCU253N.js +412 -0
- package/dist/chunk-5SCU253N.js.map +1 -0
- package/dist/{chunk-UGX7YPX2.js → chunk-7FK2UN2T.js} +65 -65
- package/dist/{chunk-UGX7YPX2.js.map → chunk-7FK2UN2T.js.map} +1 -1
- package/dist/chunk-ADJYSM45.js +135 -0
- package/dist/chunk-ADJYSM45.js.map +1 -0
- package/dist/{chunk-DXTQ3CSI.js → chunk-BIKAUVC2.js} +43 -11
- package/dist/chunk-BIKAUVC2.js.map +1 -0
- package/dist/{chunk-Z6MFJV5Z.js → chunk-C444K6MI.js} +266 -55
- package/dist/chunk-C444K6MI.js.map +1 -0
- package/dist/{chunk-JPHG2JW3.js → chunk-CVX6JNGD.js} +26 -26
- package/dist/chunk-CVX6JNGD.js.map +1 -0
- package/dist/{chunk-S3IGX57D.js → chunk-FU6MCSLG.js} +9 -9
- package/dist/{lookup-ZPN2Q67N.js → chunk-HTDALK7M.js} +46 -32
- package/dist/chunk-HTDALK7M.js.map +1 -0
- package/dist/chunk-IOPWPMT2.js +239 -0
- package/dist/chunk-IOPWPMT2.js.map +1 -0
- package/dist/{chunk-5CLSD5YN.js → chunk-KYQVEKP5.js} +7 -7
- package/dist/{chunk-RRN3YTK7.js → chunk-KZAAWQNP.js} +3 -3
- package/dist/{chunk-7KUW4MJD.js → chunk-L4IHCN6B.js} +11 -7
- package/dist/chunk-L4IHCN6B.js.map +1 -0
- package/dist/{chunk-XHC6FCGZ.js → chunk-LAM66WFJ.js} +25 -11
- package/dist/chunk-LAM66WFJ.js.map +1 -0
- package/dist/{chunk-NCE5NSN6.js → chunk-M2O56UK7.js} +158 -158
- package/dist/chunk-M2O56UK7.js.map +1 -0
- package/dist/{chunk-GO75V3NZ.js → chunk-MDDGEGSW.js} +8 -6
- package/dist/chunk-MDDGEGSW.js.map +1 -0
- package/dist/{chunk-XJIW7USF.js → chunk-MJZZTKCC.js} +112 -6
- package/dist/chunk-MJZZTKCC.js.map +1 -0
- package/dist/{chunk-Z52RA3NC.js → chunk-NFSOVL3C.js} +51 -21
- package/dist/chunk-NFSOVL3C.js.map +1 -0
- package/dist/{chunk-FJPLRISB.js → chunk-NJF2WENW.js} +5 -4
- package/dist/chunk-NJF2WENW.js.map +1 -0
- package/dist/{chunk-OYMYCW7J.js → chunk-PAUXMRSF.js} +45 -4
- package/dist/{chunk-OYMYCW7J.js.map → chunk-PAUXMRSF.js.map} +1 -1
- package/dist/{chunk-ZABPQJ3M.js → chunk-POJRB2AE.js} +2 -2
- package/dist/{publish-BKBQQAW4.js → chunk-PYNSGYBE.js} +254 -57
- package/dist/chunk-PYNSGYBE.js.map +1 -0
- package/dist/{chunk-YN5SHIXQ.js → chunk-QONTBYQW.js} +12 -9
- package/dist/chunk-QONTBYQW.js.map +1 -0
- package/dist/chunk-QW2Q2KAH.js +27 -0
- package/dist/chunk-QW2Q2KAH.js.map +1 -0
- package/dist/chunk-RTJLLPFA.js +599 -0
- package/dist/chunk-RTJLLPFA.js.map +1 -0
- package/dist/{chunk-CYOF7ROH.js → chunk-S5RYMCV6.js} +3 -3
- package/dist/chunk-TXPPMK4L.js +59 -0
- package/dist/chunk-TXPPMK4L.js.map +1 -0
- package/dist/{chunk-ZMHYXMO6.js → chunk-U5S527PP.js} +3 -3
- package/dist/{chunk-RY4XKNV3.js → chunk-UHTVXQ2O.js} +3 -3
- package/dist/{chunk-QVX5MWJZ.js → chunk-W6R3HAAG.js} +2 -2
- package/dist/{chunk-3OV7E5G5.js → chunk-WWX32ML4.js} +1 -1
- package/dist/{chunk-3OV7E5G5.js.map → chunk-WWX32ML4.js.map} +1 -1
- package/dist/{chunk-HIVZG55D.js → chunk-XJN5WUKL.js} +2 -2
- package/dist/{chunk-HSDCI7OV.js → chunk-YLYINX2H.js} +3 -3
- package/dist/{chunk-4ONXEEQL.js → chunk-ZDY2KY5X.js} +2 -2
- package/dist/{chunk-4ONXEEQL.js.map → chunk-ZDY2KY5X.js.map} +1 -1
- package/dist/{chunk-TLCMMYLY.js → chunk-ZIYVN4CD.js} +6 -6
- package/dist/chunk-ZIYVN4CD.js.map +1 -0
- package/dist/{candidate-ERMSYYQZ.js → chunk-ZW3B5LWX.js} +15 -19
- package/dist/{candidate-ERMSYYQZ.js.map → chunk-ZW3B5LWX.js.map} +1 -1
- package/dist/{cli-SBXI5AMS.js → cli-IW76QTN3.js} +64 -40
- package/dist/{cli-SBXI5AMS.js.map → cli-IW76QTN3.js.map} +1 -1
- package/dist/{config-VELDKLHY.js → config-VCOS7P5K.js} +8 -6
- package/dist/{doctor-T3KWNNP2.js → doctor-WS65JG3V.js} +9 -8
- package/dist/{ethersCompat-Df4a6QIZ-3YZIAXDK.js → ethersCompat-Df4a6QIZ-WHYKB6HA.js} +5 -5
- package/dist/index.js +1 -1
- package/dist/inspect-SFJWUQHO.js +33 -0
- package/dist/install-RVPQPCKH.js +589 -0
- package/dist/install-RVPQPCKH.js.map +1 -0
- package/dist/outcome-GNYCSZ7J.js +20 -0
- package/dist/publish-DSFWQRUN.js +36 -0
- package/dist/publish-DSFWQRUN.js.map +1 -0
- package/dist/run-OMPKA43G.js +16807 -0
- package/dist/run-OMPKA43G.js.map +1 -0
- package/dist/search-KOI6Y7P6.js +24 -0
- package/dist/search-KOI6Y7P6.js.map +1 -0
- package/dist/{secp256k1-N3ZHU7LB.js → secp256k1-XRPVBC6V.js} +3 -3
- package/dist/secp256k1-XRPVBC6V.js.map +1 -0
- package/dist/send-3G4C64HJ.js +222 -0
- package/dist/send-3G4C64HJ.js.map +1 -0
- package/dist/usdc-4VCDHFWX.js +38 -0
- package/dist/usdc-4VCDHFWX.js.map +1 -0
- package/dist/{viemAdapter-By13KInL-ZZE6UV4Y.js → viemAdapter-By13KInL-TUQJBMHM.js} +5 -5
- package/dist/viemAdapter-By13KInL-TUQJBMHM.js.map +1 -0
- package/dist/wallet-B7KJS2R5.js +40 -0
- package/dist/wallet-B7KJS2R5.js.map +1 -0
- package/dist/wallet-PP22LAX7.js +31 -0
- package/dist/wallet-PP22LAX7.js.map +1 -0
- package/package.json +4 -3
- package/skills/tenjin/SKILL.md +83 -15
- package/skills/tenjin-publish/SKILL.md +118 -18
- package/skills/tenjin-search/SKILL.md +149 -31
- package/dist/buy-EE6SEXP6.js.map +0 -1
- package/dist/chunk-662MSGZB.js.map +0 -1
- package/dist/chunk-7KUW4MJD.js.map +0 -1
- package/dist/chunk-AWPAWHNX.js +0 -333
- package/dist/chunk-AWPAWHNX.js.map +0 -1
- package/dist/chunk-DXTQ3CSI.js.map +0 -1
- package/dist/chunk-ESPNTPQ2.js +0 -207
- package/dist/chunk-ESPNTPQ2.js.map +0 -1
- package/dist/chunk-FJPLRISB.js.map +0 -1
- package/dist/chunk-GO75V3NZ.js.map +0 -1
- package/dist/chunk-JPHG2JW3.js.map +0 -1
- package/dist/chunk-NCE5NSN6.js.map +0 -1
- package/dist/chunk-TLCMMYLY.js.map +0 -1
- package/dist/chunk-XHC6FCGZ.js.map +0 -1
- package/dist/chunk-XJIW7USF.js.map +0 -1
- package/dist/chunk-YALGASEU.js.map +0 -1
- package/dist/chunk-YN5SHIXQ.js.map +0 -1
- package/dist/chunk-Z52RA3NC.js.map +0 -1
- package/dist/chunk-Z6MFJV5Z.js.map +0 -1
- package/dist/inspect-LMKOXE4Y.js +0 -96
- package/dist/inspect-LMKOXE4Y.js.map +0 -1
- package/dist/install-LEX3ENQ6.js +0 -387
- package/dist/install-LEX3ENQ6.js.map +0 -1
- package/dist/lookup-ZPN2Q67N.js.map +0 -1
- package/dist/outcome-N7TAK6WR.js +0 -66
- package/dist/outcome-N7TAK6WR.js.map +0 -1
- package/dist/publish-BKBQQAW4.js.map +0 -1
- package/dist/usdc-JIAJW4SV.js +0 -22
- package/dist/wallet-CWEMYVIH.js +0 -179
- package/dist/wallet-CWEMYVIH.js.map +0 -1
- package/dist/wallet-PA54CRBL.js +0 -30
- /package/dist/{_esm-FEASBWRP.js.map → _esm-N4KAVXQR.js.map} +0 -0
- /package/dist/{ccip-NQXCEK2U.js.map → buy-YMXXVNFH.js.map} +0 -0
- /package/dist/{ccip-XR5NE5QK.js.map → candidate-H7FR4AU5.js.map} +0 -0
- /package/dist/{config-VELDKLHY.js.map → ccip-RPPPKTJR.js.map} +0 -0
- /package/dist/{doctor-T3KWNNP2.js.map → ccip-ZGGWQN4X.js.map} +0 -0
- /package/dist/{chunk-S3IGX57D.js.map → chunk-FU6MCSLG.js.map} +0 -0
- /package/dist/{chunk-5CLSD5YN.js.map → chunk-KYQVEKP5.js.map} +0 -0
- /package/dist/{chunk-RRN3YTK7.js.map → chunk-KZAAWQNP.js.map} +0 -0
- /package/dist/{chunk-ZABPQJ3M.js.map → chunk-POJRB2AE.js.map} +0 -0
- /package/dist/{chunk-CYOF7ROH.js.map → chunk-S5RYMCV6.js.map} +0 -0
- /package/dist/{chunk-ZMHYXMO6.js.map → chunk-U5S527PP.js.map} +0 -0
- /package/dist/{chunk-RY4XKNV3.js.map → chunk-UHTVXQ2O.js.map} +0 -0
- /package/dist/{chunk-QVX5MWJZ.js.map → chunk-W6R3HAAG.js.map} +0 -0
- /package/dist/{chunk-HIVZG55D.js.map → chunk-XJN5WUKL.js.map} +0 -0
- /package/dist/{chunk-HSDCI7OV.js.map → chunk-YLYINX2H.js.map} +0 -0
- /package/dist/{ethersCompat-Df4a6QIZ-3YZIAXDK.js.map → config-VCOS7P5K.js.map} +0 -0
- /package/dist/{secp256k1-N3ZHU7LB.js.map → doctor-WS65JG3V.js.map} +0 -0
- /package/dist/{usdc-JIAJW4SV.js.map → ethersCompat-Df4a6QIZ-WHYKB6HA.js.map} +0 -0
- /package/dist/{viemAdapter-By13KInL-ZZE6UV4Y.js.map → inspect-SFJWUQHO.js.map} +0 -0
- /package/dist/{wallet-PA54CRBL.js.map → outcome-GNYCSZ7J.js.map} +0 -0
|
@@ -0,0 +1,589 @@
|
|
|
1
|
+
import { createRequire as __tenjinCreateRequire } from 'node:module'; const require = __tenjinCreateRequire(import.meta.url);
|
|
2
|
+
import {
|
|
3
|
+
runWalletCreate
|
|
4
|
+
} from "./chunk-IOPWPMT2.js";
|
|
5
|
+
import {
|
|
6
|
+
collectDoctorChecks,
|
|
7
|
+
recommendedPermissions,
|
|
8
|
+
renderPermissionsBlock
|
|
9
|
+
} from "./chunk-RTJLLPFA.js";
|
|
10
|
+
import {
|
|
11
|
+
promptYesNo
|
|
12
|
+
} from "./chunk-QW2Q2KAH.js";
|
|
13
|
+
import {
|
|
14
|
+
describeWallet,
|
|
15
|
+
resolveWalletProvider
|
|
16
|
+
} from "./chunk-C444K6MI.js";
|
|
17
|
+
import {
|
|
18
|
+
walletFileExists
|
|
19
|
+
} from "./chunk-QONTBYQW.js";
|
|
20
|
+
import "./chunk-ZDY2KY5X.js";
|
|
21
|
+
import "./chunk-NJF2WENW.js";
|
|
22
|
+
import {
|
|
23
|
+
sanitizeForTerminal
|
|
24
|
+
} from "./chunk-NFSOVL3C.js";
|
|
25
|
+
import "./chunk-2I4QTOLB.js";
|
|
26
|
+
import {
|
|
27
|
+
persistInstallHarness,
|
|
28
|
+
persistPublishMode
|
|
29
|
+
} from "./chunk-LAM66WFJ.js";
|
|
30
|
+
import "./chunk-MDDGEGSW.js";
|
|
31
|
+
import "./chunk-YBMMV4Y4.js";
|
|
32
|
+
import "./chunk-UO22YNY4.js";
|
|
33
|
+
import {
|
|
34
|
+
CLI_SKILL_NAMES,
|
|
35
|
+
CONFIG_DEFAULTS,
|
|
36
|
+
HARNESS_TARGETS,
|
|
37
|
+
HOSTED_SKILL_NAME,
|
|
38
|
+
PublishModeSchema,
|
|
39
|
+
SKILL_NAMES,
|
|
40
|
+
harnessDetectedBy,
|
|
41
|
+
harnessTargetDir,
|
|
42
|
+
isModelInvocationDisabled,
|
|
43
|
+
loadRawConfig,
|
|
44
|
+
onPath,
|
|
45
|
+
parsePublishModeFlag,
|
|
46
|
+
resolveSkillsSource
|
|
47
|
+
} from "./chunk-5SCU253N.js";
|
|
48
|
+
import {
|
|
49
|
+
writeFileAtomic
|
|
50
|
+
} from "./chunk-2JQ5JSG6.js";
|
|
51
|
+
import {
|
|
52
|
+
CliError,
|
|
53
|
+
external_exports
|
|
54
|
+
} from "./chunk-PAUXMRSF.js";
|
|
55
|
+
import "./chunk-MJZZTKCC.js";
|
|
56
|
+
import "./chunk-7FK2UN2T.js";
|
|
57
|
+
import "./chunk-M2O56UK7.js";
|
|
58
|
+
import "./chunk-UHTVXQ2O.js";
|
|
59
|
+
import "./chunk-W6R3HAAG.js";
|
|
60
|
+
import "./chunk-U5S527PP.js";
|
|
61
|
+
import "./chunk-47PP7TAG.js";
|
|
62
|
+
import "./chunk-XJN5WUKL.js";
|
|
63
|
+
import "./chunk-RBJPAZFI.js";
|
|
64
|
+
import "./chunk-KYQVEKP5.js";
|
|
65
|
+
import "./chunk-ZXTAQYNA.js";
|
|
66
|
+
|
|
67
|
+
// src/commands/install.ts
|
|
68
|
+
import { existsSync } from "fs";
|
|
69
|
+
import { readFile, readdir, rm } from "fs/promises";
|
|
70
|
+
import { createInterface } from "readline";
|
|
71
|
+
import { fileURLToPath } from "url";
|
|
72
|
+
import { join, relative } from "path";
|
|
73
|
+
import { homedir } from "os";
|
|
74
|
+
import { styleText } from "util";
|
|
75
|
+
import { Stream } from "stream";
|
|
76
|
+
var HARNESSES = HARNESS_TARGETS;
|
|
77
|
+
var InstallInputSchema = external_exports.object({
|
|
78
|
+
harness: external_exports.array(external_exports.string()).optional(),
|
|
79
|
+
dryRun: external_exports.boolean().optional(),
|
|
80
|
+
publishMode: external_exports.string().optional(),
|
|
81
|
+
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()
|
|
85
|
+
});
|
|
86
|
+
var SKILLS_MARKER = "<!-- tenjin-cli:skills -->";
|
|
87
|
+
function nudgeLine(skillsDir) {
|
|
88
|
+
return `${SKILLS_MARKER} Tenjin: before regenerating public research (version-specific compatibility, integration gotchas, benchmarks, dated probes), run 'tenjin search "<question>" --json' first; it is free and anonymous but sends the generalized question text to tenjin.blog, so strip private identifiers. Skills (tenjin-search, tenjin-publish, tenjin) are installed at ${skillsDir}; read the relevant SKILL.md before using the CLI.`;
|
|
89
|
+
}
|
|
90
|
+
function upsertMarkerLine(existing, line) {
|
|
91
|
+
const text = existing ?? "";
|
|
92
|
+
if (!text.includes(SKILLS_MARKER)) {
|
|
93
|
+
const prefix = text.length === 0 || text.endsWith("\n") ? "" : "\n";
|
|
94
|
+
return { content: `${text}${prefix}${line}
|
|
95
|
+
`, change: "append" };
|
|
96
|
+
}
|
|
97
|
+
const lines = text.split("\n");
|
|
98
|
+
const idx = lines.findIndex((l) => l.includes(SKILLS_MARKER));
|
|
99
|
+
if (lines[idx] === line) return { content: null, change: "none" };
|
|
100
|
+
lines[idx] = line;
|
|
101
|
+
return { content: lines.join("\n"), change: "replace" };
|
|
102
|
+
}
|
|
103
|
+
var CODEX_NETWORK_RULE = "[sandbox_workspace_write]\nnetwork_access = true";
|
|
104
|
+
async function runInstall(input, ctx, deps = {}) {
|
|
105
|
+
const parsed = InstallInputSchema.safeParse(input);
|
|
106
|
+
if (!parsed.success) {
|
|
107
|
+
throw new CliError("USAGE", "Invalid install options", {
|
|
108
|
+
fix: "Run `tenjin install --help`.",
|
|
109
|
+
details: parsed.error.issues
|
|
110
|
+
});
|
|
111
|
+
}
|
|
112
|
+
const dryRun = parsed.data.dryRun === true;
|
|
113
|
+
const noWallet = parsed.data.noWallet === true;
|
|
114
|
+
const claudeMdFlag = parsed.data.claudeMd;
|
|
115
|
+
const publishModeFlag = parsed.data.publishMode !== void 0 ? parseModeFlag(parsed.data.publishMode) : void 0;
|
|
116
|
+
const env = deps.env ?? process.env;
|
|
117
|
+
const home = deps.homeDir ?? homedir();
|
|
118
|
+
const which = deps.which ?? ((bin) => onPath(bin, env));
|
|
119
|
+
const humanOutput = ctx.flags.json === true ? false : deps.isInteractive ?? ctx.io.isTTY;
|
|
120
|
+
const canPrompt = humanOutput && (deps.isInteractive ?? Boolean(process.stdin.isTTY));
|
|
121
|
+
const skillsSource = deps.skillsSourceDir ?? resolveSkillsSource(fileURLToPath(new URL(".", import.meta.url)));
|
|
122
|
+
await assertSkillsSource(skillsSource);
|
|
123
|
+
const plans = resolvePlans(parsed.data.harness, home, which);
|
|
124
|
+
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;
|
|
126
|
+
const harnesses = [];
|
|
127
|
+
for (const plan of plans) {
|
|
128
|
+
harnesses.push(await applyPlan(plan, skillsSource, dryRun, claudeMdWrite));
|
|
129
|
+
}
|
|
130
|
+
await assertSkillsLanded(plans, dryRun);
|
|
131
|
+
if (explicitHarness && !dryRun) {
|
|
132
|
+
await persistInstallHarness(
|
|
133
|
+
ctx.dataDir,
|
|
134
|
+
plans.map((p) => p.harness)
|
|
135
|
+
);
|
|
136
|
+
}
|
|
137
|
+
const doctorDeps = { ...deps.doctorDeps ?? {} };
|
|
138
|
+
doctorDeps.homeDir ??= home;
|
|
139
|
+
doctorDeps.which ??= which;
|
|
140
|
+
const collect = deps.collectChecks ?? ((c) => collectDoctorChecks(c, doctorDeps));
|
|
141
|
+
const doctor = await collect(ctx);
|
|
142
|
+
const publishMode = await selectPublishMode(publishModeFlag, ctx, deps, dryRun, canPrompt);
|
|
143
|
+
const data = {
|
|
144
|
+
dryRun,
|
|
145
|
+
skillsSource,
|
|
146
|
+
harnesses,
|
|
147
|
+
doctor: { status: doctor.failure !== void 0 ? "fail" : "pass", checks: doctor.checks },
|
|
148
|
+
publishMode,
|
|
149
|
+
// Shipped with the install rather than left for the operator to discover after
|
|
150
|
+
// their first auto-mode denial (#33). Static constants, no config key: see
|
|
151
|
+
// lib/permissions.ts for why this is deliberately not operator-editable state.
|
|
152
|
+
permissions: recommendedPermissions()
|
|
153
|
+
};
|
|
154
|
+
if (!humanOutput) return { data };
|
|
155
|
+
const humanLines = await buildWalkthrough(ctx, deps, {
|
|
156
|
+
dryRun,
|
|
157
|
+
noWallet,
|
|
158
|
+
canPrompt,
|
|
159
|
+
harnesses,
|
|
160
|
+
publishMode,
|
|
161
|
+
doctor
|
|
162
|
+
});
|
|
163
|
+
return { data, humanLines };
|
|
164
|
+
}
|
|
165
|
+
var EXAMPLE_QUESTION = "what actually changed in <library> v3's public API";
|
|
166
|
+
async function buildWalkthrough(ctx, deps, s) {
|
|
167
|
+
const io = ctx.io;
|
|
168
|
+
const lines = [];
|
|
169
|
+
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}"`);
|
|
179
|
+
return lines;
|
|
180
|
+
}
|
|
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) {
|
|
189
|
+
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}`));
|
|
202
|
+
if (h.hostedPreexisting) {
|
|
203
|
+
lines.push(
|
|
204
|
+
paint(
|
|
205
|
+
io,
|
|
206
|
+
"dim",
|
|
207
|
+
` The hosted ${HOSTED_SKILL_NAME} skill was already here: kept as the zero-install fallback, and the CLI skills now take precedence.`
|
|
208
|
+
)
|
|
209
|
+
);
|
|
210
|
+
}
|
|
211
|
+
const nudgePaths = nudgeFilesTouched(h);
|
|
212
|
+
if (nudgePaths.length > 0) {
|
|
213
|
+
lines.push(
|
|
214
|
+
paint(
|
|
215
|
+
io,
|
|
216
|
+
"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 ")}.`
|
|
225
|
+
)
|
|
226
|
+
);
|
|
227
|
+
}
|
|
228
|
+
if (h.claudeMd?.status === "skipped") {
|
|
229
|
+
lines.push(
|
|
230
|
+
paint(
|
|
231
|
+
io,
|
|
232
|
+
"dim",
|
|
233
|
+
" Add a Tenjin search nudge to ~/.claude/CLAUDE.md later: tenjin install --harness claude --claude-md"
|
|
234
|
+
)
|
|
235
|
+
);
|
|
236
|
+
}
|
|
237
|
+
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}`));
|
|
242
|
+
}
|
|
243
|
+
for (const w of h.warnings) lines.push(paint(io, "yellow", ` ! ${w}`));
|
|
244
|
+
}
|
|
245
|
+
return lines;
|
|
246
|
+
}
|
|
247
|
+
function skillRoster(h) {
|
|
248
|
+
const cli = h.skills.filter((s) => s.cli).map((s) => s.name);
|
|
249
|
+
const hosted = h.skills.filter((s) => !s.cli).map((s) => s.name);
|
|
250
|
+
const parts = [];
|
|
251
|
+
if (cli.length > 0) parts.push(`${cli.join(", ")} (CLI)`);
|
|
252
|
+
if (hosted.length > 0) parts.push(`${hosted.join(", ")} (hosted, zero-install fallback)`);
|
|
253
|
+
return parts.join("; ");
|
|
254
|
+
}
|
|
255
|
+
function nudgeFilesTouched(h) {
|
|
256
|
+
const paths = [];
|
|
257
|
+
if (h.agentsMd !== void 0 && ["appended", "updated", "would-append", "would-update"].includes(h.agentsMd.status)) {
|
|
258
|
+
paths.push(h.agentsMd.path);
|
|
259
|
+
}
|
|
260
|
+
if (h.claudeMd !== void 0 && ["written", "updated", "would-write", "would-update"].includes(h.claudeMd.status)) {
|
|
261
|
+
paths.push(h.claudeMd.path);
|
|
262
|
+
}
|
|
263
|
+
return paths;
|
|
264
|
+
}
|
|
265
|
+
function modeBlurb(v) {
|
|
266
|
+
return v === "review" ? "asks before every publish" : v === "auto" ? "publishes clean scans automatically" : "only detected secrets stop a publish";
|
|
267
|
+
}
|
|
268
|
+
async function walletWalkthrough(ctx, deps, skipCreate, noWallet, io) {
|
|
269
|
+
const exists = await (deps.walletExists ?? walletFileExists)(ctx.dataDir);
|
|
270
|
+
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
|
+
];
|
|
285
|
+
}
|
|
286
|
+
async function existingWalletAddress(ctx) {
|
|
287
|
+
return (await describeWallet(resolveWalletProvider(ctx))).address;
|
|
288
|
+
}
|
|
289
|
+
async function defaultCreateWallet(ctx) {
|
|
290
|
+
const result = await runWalletCreate(ctx);
|
|
291
|
+
return result.data.address;
|
|
292
|
+
}
|
|
293
|
+
function defaultConfirmYesNo(label) {
|
|
294
|
+
return promptYesNo(label, { defaultYes: true });
|
|
295
|
+
}
|
|
296
|
+
function doctorSummary(io, doctor) {
|
|
297
|
+
const problems = doctor.checks.filter((c) => c.status !== "ok");
|
|
298
|
+
if (problems.length === 0) return [`${paint(io, "green", "\u2713")} Everything checks out`];
|
|
299
|
+
const lines = [paint(io, "yellow", "Some checks need attention:")];
|
|
300
|
+
for (const c of problems) {
|
|
301
|
+
const icon = c.status === "fail" ? paint(io, "red", "\u2717") : paint(io, "yellow", "!");
|
|
302
|
+
lines.push(` ${icon} ${c.name}: ${sanitizeForTerminal(c.detail)}`);
|
|
303
|
+
if (c.fix !== void 0) {
|
|
304
|
+
lines.push(paint(io, "dim", ` fix: ${sanitizeForTerminal(c.fix)}`));
|
|
305
|
+
}
|
|
306
|
+
}
|
|
307
|
+
return lines;
|
|
308
|
+
}
|
|
309
|
+
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) {
|
|
318
|
+
if (flag !== void 0) {
|
|
319
|
+
if (!dryRun) await persistPublishMode(ctx.dataDir, flag);
|
|
320
|
+
return { value: flag, source: "flag" };
|
|
321
|
+
}
|
|
322
|
+
const config = await loadRawConfig(ctx.dataDir);
|
|
323
|
+
if (config.publish?.mode !== void 0) {
|
|
324
|
+
return { value: config.publish.mode, source: "existing" };
|
|
325
|
+
}
|
|
326
|
+
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" };
|
|
342
|
+
}
|
|
343
|
+
function parseModeFlag(value) {
|
|
344
|
+
return parsePublishModeFlag(value, "--publish-mode");
|
|
345
|
+
}
|
|
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
|
+
});
|
|
359
|
+
}
|
|
360
|
+
function resolvePlans(override, home, which) {
|
|
361
|
+
if (override !== void 0 && override.length > 0) {
|
|
362
|
+
const plans2 = override.map((v) => planFor(validateHarness(v), ["override"], true, home));
|
|
363
|
+
return dedupeBySkillsDir(plans2);
|
|
364
|
+
}
|
|
365
|
+
const plans = [];
|
|
366
|
+
const claudeBy = harnessDetectedBy(home, "claude", which);
|
|
367
|
+
const codexBy = harnessDetectedBy(home, "codex", which);
|
|
368
|
+
if (claudeBy.length > 0) plans.push(planFor("claude", claudeBy, true, home));
|
|
369
|
+
if (codexBy.length > 0) plans.push(planFor("codex", codexBy, true, home));
|
|
370
|
+
if (plans.length === 0) {
|
|
371
|
+
plans.push(planFor("shared", ["fallback"], false, home));
|
|
372
|
+
}
|
|
373
|
+
return dedupeBySkillsDir(plans);
|
|
374
|
+
}
|
|
375
|
+
function planFor(harness, detectedBy, detected, home) {
|
|
376
|
+
const skillsDir = harnessTargetDir(home, harness);
|
|
377
|
+
return { harness, detected, detectedBy, skillsDir, wiresAgentsMd: harness !== "claude", home };
|
|
378
|
+
}
|
|
379
|
+
function dedupeBySkillsDir(plans) {
|
|
380
|
+
const seen = /* @__PURE__ */ new Set();
|
|
381
|
+
const out = [];
|
|
382
|
+
for (const p of plans) {
|
|
383
|
+
if (seen.has(p.skillsDir)) continue;
|
|
384
|
+
seen.add(p.skillsDir);
|
|
385
|
+
out.push(p);
|
|
386
|
+
}
|
|
387
|
+
return out;
|
|
388
|
+
}
|
|
389
|
+
function validateHarness(value) {
|
|
390
|
+
if (HARNESSES.includes(value)) return value;
|
|
391
|
+
throw new CliError("USAGE", `Unknown harness "${value}"`, {
|
|
392
|
+
fix: `--harness must be one of: ${HARNESSES.join(", ")}.`
|
|
393
|
+
});
|
|
394
|
+
}
|
|
395
|
+
async function applyPlan(plan, skillsSource, dryRun, claudeMdWrite) {
|
|
396
|
+
const skills = [];
|
|
397
|
+
const warnings = [];
|
|
398
|
+
for (const name of SKILL_NAMES) {
|
|
399
|
+
const { status, warning, preexisting } = await installSkill(
|
|
400
|
+
join(skillsSource, name),
|
|
401
|
+
join(plan.skillsDir, name),
|
|
402
|
+
dryRun,
|
|
403
|
+
name
|
|
404
|
+
);
|
|
405
|
+
skills.push({
|
|
406
|
+
name,
|
|
407
|
+
status,
|
|
408
|
+
preexisting,
|
|
409
|
+
cli: CLI_SKILL_NAMES.includes(name),
|
|
410
|
+
modelInvocable: await landedInvocable(plan.skillsDir, skillsSource, name, dryRun)
|
|
411
|
+
});
|
|
412
|
+
if (warning !== void 0) warnings.push(warning);
|
|
413
|
+
}
|
|
414
|
+
const hostedPreexisting = skills.some((s) => s.name === HOSTED_SKILL_NAME && s.preexisting);
|
|
415
|
+
const result = {
|
|
416
|
+
harness: plan.harness,
|
|
417
|
+
detected: plan.detected,
|
|
418
|
+
detectedBy: plan.detectedBy,
|
|
419
|
+
skillsDir: plan.skillsDir,
|
|
420
|
+
skills,
|
|
421
|
+
hostedPreexisting,
|
|
422
|
+
notes: notesFor(plan, hostedPreexisting),
|
|
423
|
+
warnings
|
|
424
|
+
};
|
|
425
|
+
if (plan.wiresAgentsMd) {
|
|
426
|
+
result.agentsMd = await wireAgentsMd(plan, dryRun);
|
|
427
|
+
result.codexNetworkRule = CODEX_NETWORK_RULE;
|
|
428
|
+
} else if (plan.harness === "claude") {
|
|
429
|
+
result.claudeMd = await wireClaudeMd(plan, dryRun, claudeMdWrite);
|
|
430
|
+
}
|
|
431
|
+
return result;
|
|
432
|
+
}
|
|
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
|
+
async function wireClaudeMd(plan, dryRun, write) {
|
|
442
|
+
const path = join(plan.home, ".claude", "CLAUDE.md");
|
|
443
|
+
if (!write) return { path, status: "skipped" };
|
|
444
|
+
const existing = existsSync(path) ? await readFile(path, "utf8") : null;
|
|
445
|
+
const { content, change } = upsertMarkerLine(existing, nudgeLine(plan.skillsDir));
|
|
446
|
+
if (change === "none") return { path, status: "up-to-date" };
|
|
447
|
+
if (!dryRun && content !== null) await writeFileAtomic(path, content);
|
|
448
|
+
if (change === "append") return { path, status: dryRun ? "would-write" : "written" };
|
|
449
|
+
return { path, status: dryRun ? "would-update" : "updated" };
|
|
450
|
+
}
|
|
451
|
+
function notesFor(plan, hostedPreexisting) {
|
|
452
|
+
const notes = plan.harness === "claude" ? [
|
|
453
|
+
"Installed at the user level (~/.claude/skills). A Claude Code plugin will later make this automatic."
|
|
454
|
+
] : [
|
|
455
|
+
"Copied into the shared Agent Skills location (~/.agents/skills). Codex and any Agent-Skills-compatible harness read it there."
|
|
456
|
+
];
|
|
457
|
+
if (hostedPreexisting) {
|
|
458
|
+
notes.push(
|
|
459
|
+
`The hosted ${HOSTED_SKILL_NAME} skill was already here; it stays as the zero-install fallback and the CLI skills (${CLI_SKILL_NAMES.join(", ")}) take precedence while the CLI is installed.`
|
|
460
|
+
);
|
|
461
|
+
}
|
|
462
|
+
return notes;
|
|
463
|
+
}
|
|
464
|
+
async function landedInvocable(skillsDir, skillsSource, name, dryRun) {
|
|
465
|
+
const path = join(dryRun ? skillsSource : skillsDir, name, "SKILL.md");
|
|
466
|
+
if (!existsSync(path)) return false;
|
|
467
|
+
try {
|
|
468
|
+
return !isModelInvocationDisabled(await readFile(path, "utf8"));
|
|
469
|
+
} catch {
|
|
470
|
+
return false;
|
|
471
|
+
}
|
|
472
|
+
}
|
|
473
|
+
async function assertSkillsLanded(plans, dryRun) {
|
|
474
|
+
if (dryRun) return;
|
|
475
|
+
const missing = [];
|
|
476
|
+
for (const plan of plans) {
|
|
477
|
+
for (const name of SKILL_NAMES) {
|
|
478
|
+
if (!existsSync(join(plan.skillsDir, name, "SKILL.md"))) {
|
|
479
|
+
missing.push(join(plan.skillsDir, name));
|
|
480
|
+
}
|
|
481
|
+
}
|
|
482
|
+
}
|
|
483
|
+
if (missing.length === 0) return;
|
|
484
|
+
throw new CliError("INTERNAL", `Skills were not written: ${missing.join(", ")}`, {
|
|
485
|
+
fix: "Check permissions on the skills directory and re-run `tenjin install`."
|
|
486
|
+
});
|
|
487
|
+
}
|
|
488
|
+
async function installSkill(srcDir, destDir, dryRun, name) {
|
|
489
|
+
const src = await readTree(srcDir);
|
|
490
|
+
const dest = await readTree(destDir);
|
|
491
|
+
if (src === null) {
|
|
492
|
+
throw new CliError("INTERNAL", `Packaged skill source ${srcDir} is empty`);
|
|
493
|
+
}
|
|
494
|
+
const preexisting = dest?.has("SKILL.md") === true;
|
|
495
|
+
const change = dest === null || dest.size === 0 ? "create" : treesEqual(src, dest) ? "none" : "update";
|
|
496
|
+
if (!dryRun && change !== "none") {
|
|
497
|
+
await rm(destDir, { recursive: true, force: true });
|
|
498
|
+
for (const [rel, content] of src) {
|
|
499
|
+
await writeFileAtomic(join(destDir, rel), content);
|
|
500
|
+
}
|
|
501
|
+
}
|
|
502
|
+
if (change === "create") return { status: dryRun ? "would-install" : "installed", preexisting };
|
|
503
|
+
if (change === "none") return { status: "up-to-date", preexisting };
|
|
504
|
+
return {
|
|
505
|
+
status: dryRun ? "would-update" : "updated",
|
|
506
|
+
preexisting,
|
|
507
|
+
// The hosted skill is a MIRROR of tenjin.blog/skills.md (roadmap G4), so a
|
|
508
|
+
// differing local copy is a replacement, not the drift warning the CLI skills
|
|
509
|
+
// get. Neither side carries a version or date, so the wording claims no
|
|
510
|
+
// direction: the local file may well be a newer fetch than this package's copy.
|
|
511
|
+
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 skill copy differed and ${dryRun ? "would be" : "was"} overwritten (the packaged copy is canonical).`
|
|
512
|
+
};
|
|
513
|
+
}
|
|
514
|
+
async function readTree(dir) {
|
|
515
|
+
if (!existsSync(dir)) return null;
|
|
516
|
+
const entries = await readdir(dir, { recursive: true, withFileTypes: true });
|
|
517
|
+
const files = /* @__PURE__ */ new Map();
|
|
518
|
+
for (const entry of entries) {
|
|
519
|
+
if (!entry.isFile()) continue;
|
|
520
|
+
const full = join(entry.parentPath, entry.name);
|
|
521
|
+
files.set(relative(dir, full), await readFile(full));
|
|
522
|
+
}
|
|
523
|
+
return files;
|
|
524
|
+
}
|
|
525
|
+
function treesEqual(a, b) {
|
|
526
|
+
if (b === null) return false;
|
|
527
|
+
if (a.size !== b.size) return false;
|
|
528
|
+
for (const [k, v] of a) {
|
|
529
|
+
const other = b.get(k);
|
|
530
|
+
if (other === void 0 || !v.equals(other)) return false;
|
|
531
|
+
}
|
|
532
|
+
return true;
|
|
533
|
+
}
|
|
534
|
+
async function wireAgentsMd(plan, dryRun) {
|
|
535
|
+
const shared = join(plan.home, ".agents", "AGENTS.md");
|
|
536
|
+
const codex = join(plan.home, ".codex", "AGENTS.md");
|
|
537
|
+
const line = nudgeLine(plan.skillsDir);
|
|
538
|
+
for (const path of [shared, codex]) {
|
|
539
|
+
if (existsSync(path) && (await readFile(path, "utf8")).includes(SKILLS_MARKER)) {
|
|
540
|
+
return upsertAgentsMd(path, line, dryRun);
|
|
541
|
+
}
|
|
542
|
+
}
|
|
543
|
+
return upsertAgentsMd(chooseAgentsMdPath(plan.home), line, dryRun);
|
|
544
|
+
}
|
|
545
|
+
async function upsertAgentsMd(path, line, dryRun) {
|
|
546
|
+
const existing = existsSync(path) ? await readFile(path, "utf8") : null;
|
|
547
|
+
const { content, change } = upsertMarkerLine(existing, line);
|
|
548
|
+
if (change === "none") return { path, status: "already-present" };
|
|
549
|
+
if (!dryRun && content !== null) await writeFileAtomic(path, content);
|
|
550
|
+
if (change === "append") return { path, status: dryRun ? "would-append" : "appended" };
|
|
551
|
+
return { path, status: dryRun ? "would-update" : "updated" };
|
|
552
|
+
}
|
|
553
|
+
function chooseAgentsMdPath(home) {
|
|
554
|
+
const shared = join(home, ".agents", "AGENTS.md");
|
|
555
|
+
const codex = join(home, ".codex", "AGENTS.md");
|
|
556
|
+
if (existsSync(shared)) return shared;
|
|
557
|
+
if (existsSync(codex)) return codex;
|
|
558
|
+
if (existsSync(join(home, ".codex"))) return codex;
|
|
559
|
+
return shared;
|
|
560
|
+
}
|
|
561
|
+
function paint(io, format, text) {
|
|
562
|
+
if (io.stdout instanceof Stream) return styleText(format, text, { stream: io.stdout });
|
|
563
|
+
return styleText(format, text);
|
|
564
|
+
}
|
|
565
|
+
async function assertSkillsSource(dir) {
|
|
566
|
+
for (const name of SKILL_NAMES) {
|
|
567
|
+
if (!existsSync(join(dir, name, "SKILL.md"))) {
|
|
568
|
+
throw new CliError("INTERNAL", `Packaged skill "${name}" is missing under ${dir}`, {
|
|
569
|
+
fix: "Reinstall tenjin-cli; the published package must ship every skill under skills/."
|
|
570
|
+
});
|
|
571
|
+
}
|
|
572
|
+
}
|
|
573
|
+
for (const name of CLI_SKILL_NAMES) {
|
|
574
|
+
const text = await readFile(join(dir, name, "SKILL.md"), "utf8");
|
|
575
|
+
if (isModelInvocationDisabled(text)) {
|
|
576
|
+
throw new CliError(
|
|
577
|
+
"INTERNAL",
|
|
578
|
+
`Packaged skill "${name}" carries disable-model-invocation: true, so no harness would surface it`,
|
|
579
|
+
{
|
|
580
|
+
fix: "Reinstall tenjin-cli; the published CLI skills must be model-invocable."
|
|
581
|
+
}
|
|
582
|
+
);
|
|
583
|
+
}
|
|
584
|
+
}
|
|
585
|
+
}
|
|
586
|
+
export {
|
|
587
|
+
runInstall
|
|
588
|
+
};
|
|
589
|
+
//# sourceMappingURL=install-RVPQPCKH.js.map
|