tenjin-cli 0.1.0-alpha.4 → 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 +168 -11
- package/dist/{buy-OOOLUDND.js → buy-YMXXVNFH.js} +18 -17
- package/dist/{candidate-TWCWTFGA.js → candidate-H7FR4AU5.js} +8 -8
- 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-NXCJN2FJ.js → chunk-3IRDP7TN.js} +48 -41
- package/dist/chunk-3IRDP7TN.js.map +1 -0
- package/dist/{chunk-4GR7DGD6.js → chunk-4WVKXKDK.js} +14 -28
- 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-ADJYSM45.js +135 -0
- package/dist/chunk-ADJYSM45.js.map +1 -0
- package/dist/{chunk-5JH7ZB6Z.js → chunk-BIKAUVC2.js} +40 -8
- package/dist/chunk-BIKAUVC2.js.map +1 -0
- package/dist/{chunk-S3KZ3PPK.js → chunk-C444K6MI.js} +254 -47
- package/dist/chunk-C444K6MI.js.map +1 -0
- package/dist/{chunk-XNNOR7F7.js → chunk-CVX6JNGD.js} +3 -3
- package/dist/{chunk-H5ETJRQD.js → chunk-HTDALK7M.js} +16 -11
- 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-MM4TGTST.js → chunk-L4IHCN6B.js} +8 -4
- package/dist/chunk-L4IHCN6B.js.map +1 -0
- package/dist/{chunk-EUQN3L5X.js → chunk-LAM66WFJ.js} +20 -6
- package/dist/chunk-LAM66WFJ.js.map +1 -0
- package/dist/{chunk-FHB3VKZW.js → chunk-MDDGEGSW.js} +5 -3
- package/dist/chunk-MDDGEGSW.js.map +1 -0
- package/dist/{chunk-333FOTUJ.js → chunk-MJZZTKCC.js} +108 -2
- package/dist/chunk-MJZZTKCC.js.map +1 -0
- package/dist/{chunk-VV4P5RVK.js → chunk-NFSOVL3C.js} +6 -3
- package/dist/{chunk-VV4P5RVK.js.map → chunk-NFSOVL3C.js.map} +1 -1
- package/dist/{chunk-QH6677FJ.js → chunk-NJF2WENW.js} +2 -2
- package/dist/{chunk-QH6677FJ.js.map → chunk-NJF2WENW.js.map} +1 -1
- package/dist/{chunk-6WWVYYSB.js → chunk-PAUXMRSF.js} +14 -3
- package/dist/{chunk-6WWVYYSB.js.map → chunk-PAUXMRSF.js.map} +1 -1
- package/dist/{chunk-ULLWHHIT.js → chunk-PYNSGYBE.js} +244 -32
- package/dist/chunk-PYNSGYBE.js.map +1 -0
- package/dist/{chunk-DPET3TW5.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-KXIX7YDV.js → chunk-TXPPMK4L.js} +5 -5
- package/dist/{chunk-C4TIWOAM.js → chunk-ZDY2KY5X.js} +2 -2
- package/dist/{chunk-DPUMEMGM.js → chunk-ZIYVN4CD.js} +3 -3
- package/dist/{chunk-OJD54DIU.js → chunk-ZW3B5LWX.js} +5 -5
- package/dist/{cli-AFSLAKR6.js → cli-IW76QTN3.js} +38 -25
- package/dist/{cli-AFSLAKR6.js.map → cli-IW76QTN3.js.map} +1 -1
- package/dist/{config-DBEEM3UA.js → config-VCOS7P5K.js} +8 -6
- package/dist/{doctor-XDA3YU6H.js → doctor-WS65JG3V.js} +9 -8
- package/dist/index.js +1 -1
- package/dist/{inspect-YBGDAG47.js → inspect-SFJWUQHO.js} +14 -14
- package/dist/{install-7J6KKEEP.js → install-RVPQPCKH.js} +177 -130
- package/dist/install-RVPQPCKH.js.map +1 -0
- package/dist/outcome-GNYCSZ7J.js +20 -0
- package/dist/{publish-IH7RJXGB.js → publish-DSFWQRUN.js} +14 -14
- package/dist/{run-DCZFEW2C.js → run-OMPKA43G.js} +29 -28
- package/dist/{run-DCZFEW2C.js.map → run-OMPKA43G.js.map} +1 -1
- package/dist/search-KOI6Y7P6.js +24 -0
- package/dist/send-3G4C64HJ.js +222 -0
- package/dist/send-3G4C64HJ.js.map +1 -0
- package/dist/{usdc-AU6ZIKA6.js → usdc-4VCDHFWX.js} +20 -4
- package/dist/{wallet-HKG3GSTX.js → wallet-B7KJS2R5.js} +17 -7
- package/dist/{wallet-UWHSHWC6.js → wallet-PP22LAX7.js} +8 -8
- package/package.json +1 -1
- package/skills/tenjin/SKILL.md +32 -7
- package/skills/tenjin-publish/SKILL.md +97 -12
- package/skills/tenjin-search/SKILL.md +115 -12
- package/dist/chunk-333FOTUJ.js.map +0 -1
- package/dist/chunk-4GR7DGD6.js.map +0 -1
- package/dist/chunk-5JH7ZB6Z.js.map +0 -1
- package/dist/chunk-BXUS5UCT.js +0 -212
- package/dist/chunk-BXUS5UCT.js.map +0 -1
- package/dist/chunk-CJU555P5.js +0 -333
- package/dist/chunk-CJU555P5.js.map +0 -1
- package/dist/chunk-DPET3TW5.js.map +0 -1
- package/dist/chunk-EUQN3L5X.js.map +0 -1
- package/dist/chunk-FHB3VKZW.js.map +0 -1
- package/dist/chunk-H5ETJRQD.js.map +0 -1
- package/dist/chunk-MM4TGTST.js.map +0 -1
- package/dist/chunk-NXCJN2FJ.js.map +0 -1
- package/dist/chunk-R7BMDJZM.js +0 -167
- package/dist/chunk-R7BMDJZM.js.map +0 -1
- package/dist/chunk-S3KZ3PPK.js.map +0 -1
- package/dist/chunk-ULLWHHIT.js.map +0 -1
- package/dist/chunk-YFREUEUI.js +0 -78
- package/dist/chunk-YFREUEUI.js.map +0 -1
- package/dist/install-7J6KKEEP.js.map +0 -1
- package/dist/outcome-ZFGHX2XW.js +0 -20
- package/dist/search-R6NIQFXI.js +0 -24
- /package/dist/{buy-OOOLUDND.js.map → buy-YMXXVNFH.js.map} +0 -0
- /package/dist/{candidate-TWCWTFGA.js.map → candidate-H7FR4AU5.js.map} +0 -0
- /package/dist/{chunk-XNNOR7F7.js.map → chunk-CVX6JNGD.js.map} +0 -0
- /package/dist/{chunk-KXIX7YDV.js.map → chunk-TXPPMK4L.js.map} +0 -0
- /package/dist/{chunk-C4TIWOAM.js.map → chunk-ZDY2KY5X.js.map} +0 -0
- /package/dist/{chunk-DPUMEMGM.js.map → chunk-ZIYVN4CD.js.map} +0 -0
- /package/dist/{chunk-OJD54DIU.js.map → chunk-ZW3B5LWX.js.map} +0 -0
- /package/dist/{config-DBEEM3UA.js.map → config-VCOS7P5K.js.map} +0 -0
- /package/dist/{doctor-XDA3YU6H.js.map → doctor-WS65JG3V.js.map} +0 -0
- /package/dist/{inspect-YBGDAG47.js.map → inspect-SFJWUQHO.js.map} +0 -0
- /package/dist/{outcome-ZFGHX2XW.js.map → outcome-GNYCSZ7J.js.map} +0 -0
- /package/dist/{publish-IH7RJXGB.js.map → publish-DSFWQRUN.js.map} +0 -0
- /package/dist/{search-R6NIQFXI.js.map → search-KOI6Y7P6.js.map} +0 -0
- /package/dist/{usdc-AU6ZIKA6.js.map → usdc-4VCDHFWX.js.map} +0 -0
- /package/dist/{wallet-HKG3GSTX.js.map → wallet-B7KJS2R5.js.map} +0 -0
- /package/dist/{wallet-UWHSHWC6.js.map → wallet-PP22LAX7.js.map} +0 -0
|
@@ -1,21 +1,23 @@
|
|
|
1
1
|
import { createRequire as __tenjinCreateRequire } from 'node:module'; const require = __tenjinCreateRequire(import.meta.url);
|
|
2
2
|
import {
|
|
3
|
+
persistInstallHarness,
|
|
3
4
|
persistPublishMode,
|
|
4
5
|
runConfigGet,
|
|
5
6
|
runConfigList,
|
|
6
7
|
runConfigSet
|
|
7
|
-
} from "./chunk-
|
|
8
|
-
import "./chunk-
|
|
8
|
+
} from "./chunk-LAM66WFJ.js";
|
|
9
|
+
import "./chunk-MDDGEGSW.js";
|
|
9
10
|
import "./chunk-YBMMV4Y4.js";
|
|
10
11
|
import "./chunk-UO22YNY4.js";
|
|
11
|
-
import "./chunk-
|
|
12
|
-
import "./chunk-
|
|
13
|
-
import "./chunk-
|
|
12
|
+
import "./chunk-5SCU253N.js";
|
|
13
|
+
import "./chunk-2JQ5JSG6.js";
|
|
14
|
+
import "./chunk-PAUXMRSF.js";
|
|
14
15
|
import "./chunk-ZXTAQYNA.js";
|
|
15
16
|
export {
|
|
17
|
+
persistInstallHarness,
|
|
16
18
|
persistPublishMode,
|
|
17
19
|
runConfigGet,
|
|
18
20
|
runConfigList,
|
|
19
21
|
runConfigSet
|
|
20
22
|
};
|
|
21
|
-
//# sourceMappingURL=config-
|
|
23
|
+
//# sourceMappingURL=config-VCOS7P5K.js.map
|
|
@@ -3,18 +3,19 @@ import {
|
|
|
3
3
|
collectDoctorChecks,
|
|
4
4
|
renderDoctorHuman,
|
|
5
5
|
runDoctor
|
|
6
|
-
} from "./chunk-
|
|
7
|
-
import "./chunk-
|
|
8
|
-
import "./chunk-
|
|
9
|
-
import "./chunk-
|
|
6
|
+
} from "./chunk-RTJLLPFA.js";
|
|
7
|
+
import "./chunk-QONTBYQW.js";
|
|
8
|
+
import "./chunk-ZDY2KY5X.js";
|
|
9
|
+
import "./chunk-NJF2WENW.js";
|
|
10
|
+
import "./chunk-NFSOVL3C.js";
|
|
10
11
|
import "./chunk-2I4QTOLB.js";
|
|
11
|
-
import "./chunk-
|
|
12
|
-
import "./chunk-
|
|
13
|
-
import "./chunk-
|
|
12
|
+
import "./chunk-5SCU253N.js";
|
|
13
|
+
import "./chunk-2JQ5JSG6.js";
|
|
14
|
+
import "./chunk-PAUXMRSF.js";
|
|
14
15
|
import "./chunk-ZXTAQYNA.js";
|
|
15
16
|
export {
|
|
16
17
|
collectDoctorChecks,
|
|
17
18
|
renderDoctorHuman,
|
|
18
19
|
runDoctor
|
|
19
20
|
};
|
|
20
|
-
//# sourceMappingURL=doctor-
|
|
21
|
+
//# sourceMappingURL=doctor-WS65JG3V.js.map
|
package/dist/index.js
CHANGED
|
@@ -21,6 +21,6 @@ if (Number.isNaN(nodeMajor) || nodeMajor < MIN_NODE_MAJOR) {
|
|
|
21
21
|
`);
|
|
22
22
|
process.exit(1);
|
|
23
23
|
}
|
|
24
|
-
var { main } = await import("./cli-
|
|
24
|
+
var { main } = await import("./cli-IW76QTN3.js");
|
|
25
25
|
process.exit(await main(process.argv.slice(2)));
|
|
26
26
|
//# sourceMappingURL=index.js.map
|
|
@@ -1,26 +1,26 @@
|
|
|
1
1
|
import { createRequire as __tenjinCreateRequire } from 'node:module'; const require = __tenjinCreateRequire(import.meta.url);
|
|
2
2
|
import {
|
|
3
3
|
runInspect
|
|
4
|
-
} from "./chunk-
|
|
5
|
-
import "./chunk-
|
|
4
|
+
} from "./chunk-ADJYSM45.js";
|
|
5
|
+
import "./chunk-BIKAUVC2.js";
|
|
6
6
|
import "./chunk-FU6MCSLG.js";
|
|
7
|
-
import "./chunk-
|
|
8
|
-
import "./chunk-
|
|
9
|
-
import "./chunk-
|
|
7
|
+
import "./chunk-POJRB2AE.js";
|
|
8
|
+
import "./chunk-L4IHCN6B.js";
|
|
9
|
+
import "./chunk-CVX6JNGD.js";
|
|
10
|
+
import "./chunk-3IRDP7TN.js";
|
|
10
11
|
import "./chunk-WWX32ML4.js";
|
|
11
|
-
import "./chunk-
|
|
12
|
-
import "./chunk-
|
|
13
|
-
import "./chunk-
|
|
12
|
+
import "./chunk-ZDY2KY5X.js";
|
|
13
|
+
import "./chunk-NJF2WENW.js";
|
|
14
|
+
import "./chunk-NFSOVL3C.js";
|
|
14
15
|
import "./chunk-KZAAWQNP.js";
|
|
15
16
|
import "./chunk-S5RYMCV6.js";
|
|
16
|
-
import "./chunk-POJRB2AE.js";
|
|
17
17
|
import "./chunk-YLYINX2H.js";
|
|
18
|
-
import "./chunk-
|
|
18
|
+
import "./chunk-MDDGEGSW.js";
|
|
19
19
|
import "./chunk-YBMMV4Y4.js";
|
|
20
20
|
import "./chunk-UO22YNY4.js";
|
|
21
|
-
import "./chunk-
|
|
22
|
-
import "./chunk-
|
|
23
|
-
import "./chunk-
|
|
21
|
+
import "./chunk-5SCU253N.js";
|
|
22
|
+
import "./chunk-2JQ5JSG6.js";
|
|
23
|
+
import "./chunk-PAUXMRSF.js";
|
|
24
24
|
import "./chunk-UHTVXQ2O.js";
|
|
25
25
|
import "./chunk-W6R3HAAG.js";
|
|
26
26
|
import "./chunk-XJN5WUKL.js";
|
|
@@ -30,4 +30,4 @@ import "./chunk-ZXTAQYNA.js";
|
|
|
30
30
|
export {
|
|
31
31
|
runInspect
|
|
32
32
|
};
|
|
33
|
-
//# sourceMappingURL=inspect-
|
|
33
|
+
//# sourceMappingURL=inspect-SFJWUQHO.js.map
|
|
@@ -1,40 +1,58 @@
|
|
|
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-IOPWPMT2.js";
|
|
5
|
+
import {
|
|
6
|
+
collectDoctorChecks,
|
|
7
|
+
recommendedPermissions,
|
|
8
|
+
renderPermissionsBlock
|
|
9
|
+
} from "./chunk-RTJLLPFA.js";
|
|
10
|
+
import {
|
|
11
|
+
promptYesNo
|
|
12
|
+
} from "./chunk-QW2Q2KAH.js";
|
|
5
13
|
import {
|
|
6
14
|
describeWallet,
|
|
7
15
|
resolveWalletProvider
|
|
8
|
-
} from "./chunk-
|
|
9
|
-
import {
|
|
10
|
-
collectDoctorChecks
|
|
11
|
-
} from "./chunk-CJU555P5.js";
|
|
16
|
+
} from "./chunk-C444K6MI.js";
|
|
12
17
|
import {
|
|
13
18
|
walletFileExists
|
|
14
|
-
} from "./chunk-
|
|
15
|
-
import "./chunk-
|
|
16
|
-
import "./chunk-
|
|
19
|
+
} from "./chunk-QONTBYQW.js";
|
|
20
|
+
import "./chunk-ZDY2KY5X.js";
|
|
21
|
+
import "./chunk-NJF2WENW.js";
|
|
22
|
+
import {
|
|
23
|
+
sanitizeForTerminal
|
|
24
|
+
} from "./chunk-NFSOVL3C.js";
|
|
17
25
|
import "./chunk-2I4QTOLB.js";
|
|
18
26
|
import {
|
|
27
|
+
persistInstallHarness,
|
|
19
28
|
persistPublishMode
|
|
20
|
-
} from "./chunk-
|
|
21
|
-
import "./chunk-
|
|
29
|
+
} from "./chunk-LAM66WFJ.js";
|
|
30
|
+
import "./chunk-MDDGEGSW.js";
|
|
22
31
|
import "./chunk-YBMMV4Y4.js";
|
|
23
32
|
import "./chunk-UO22YNY4.js";
|
|
24
33
|
import {
|
|
34
|
+
CLI_SKILL_NAMES,
|
|
25
35
|
CONFIG_DEFAULTS,
|
|
36
|
+
HARNESS_TARGETS,
|
|
37
|
+
HOSTED_SKILL_NAME,
|
|
26
38
|
PublishModeSchema,
|
|
39
|
+
SKILL_NAMES,
|
|
40
|
+
harnessDetectedBy,
|
|
41
|
+
harnessTargetDir,
|
|
42
|
+
isModelInvocationDisabled,
|
|
27
43
|
loadRawConfig,
|
|
28
|
-
|
|
29
|
-
|
|
44
|
+
onPath,
|
|
45
|
+
parsePublishModeFlag,
|
|
46
|
+
resolveSkillsSource
|
|
47
|
+
} from "./chunk-5SCU253N.js";
|
|
30
48
|
import {
|
|
31
49
|
writeFileAtomic
|
|
32
|
-
} from "./chunk-
|
|
50
|
+
} from "./chunk-2JQ5JSG6.js";
|
|
33
51
|
import {
|
|
34
52
|
CliError,
|
|
35
53
|
external_exports
|
|
36
|
-
} from "./chunk-
|
|
37
|
-
import "./chunk-
|
|
54
|
+
} from "./chunk-PAUXMRSF.js";
|
|
55
|
+
import "./chunk-MJZZTKCC.js";
|
|
38
56
|
import "./chunk-7FK2UN2T.js";
|
|
39
57
|
import "./chunk-M2O56UK7.js";
|
|
40
58
|
import "./chunk-UHTVXQ2O.js";
|
|
@@ -47,37 +65,15 @@ import "./chunk-KYQVEKP5.js";
|
|
|
47
65
|
import "./chunk-ZXTAQYNA.js";
|
|
48
66
|
|
|
49
67
|
// src/commands/install.ts
|
|
50
|
-
import { existsSync
|
|
68
|
+
import { existsSync } from "fs";
|
|
51
69
|
import { readFile, readdir, rm } from "fs/promises";
|
|
52
70
|
import { createInterface } from "readline";
|
|
53
71
|
import { fileURLToPath } from "url";
|
|
54
|
-
import {
|
|
72
|
+
import { join, relative } from "path";
|
|
55
73
|
import { homedir } from "os";
|
|
56
74
|
import { styleText } from "util";
|
|
57
75
|
import { Stream } from "stream";
|
|
58
|
-
|
|
59
|
-
// src/lib/skills-source.ts
|
|
60
|
-
import { existsSync } from "fs";
|
|
61
|
-
import { dirname, join } from "path";
|
|
62
|
-
var SKILL_NAMES = ["tenjin-search", "tenjin-publish", "tenjin"];
|
|
63
|
-
var SENTINEL = join("tenjin", "SKILL.md");
|
|
64
|
-
function resolveSkillsSource(startDir) {
|
|
65
|
-
let dir = startDir;
|
|
66
|
-
for (let i = 0; i < 8; i += 1) {
|
|
67
|
-
const candidate = join(dir, "skills");
|
|
68
|
-
if (existsSync(join(candidate, SENTINEL))) return candidate;
|
|
69
|
-
const parent = dirname(dir);
|
|
70
|
-
if (parent === dir) break;
|
|
71
|
-
dir = parent;
|
|
72
|
-
}
|
|
73
|
-
throw new CliError("INTERNAL", "Could not locate the packaged Tenjin skills directory", {
|
|
74
|
-
fix: "Reinstall tenjin-cli; the published package must ship the skills/ directory (files array).",
|
|
75
|
-
details: { startDir }
|
|
76
|
-
});
|
|
77
|
-
}
|
|
78
|
-
|
|
79
|
-
// src/commands/install.ts
|
|
80
|
-
var HARNESSES = ["claude", "codex", "shared"];
|
|
76
|
+
var HARNESSES = HARNESS_TARGETS;
|
|
81
77
|
var InstallInputSchema = external_exports.object({
|
|
82
78
|
harness: external_exports.array(external_exports.string()).optional(),
|
|
83
79
|
dryRun: external_exports.boolean().optional(),
|
|
@@ -125,12 +121,23 @@ async function runInstall(input, ctx, deps = {}) {
|
|
|
125
121
|
const skillsSource = deps.skillsSourceDir ?? resolveSkillsSource(fileURLToPath(new URL(".", import.meta.url)));
|
|
126
122
|
await assertSkillsSource(skillsSource);
|
|
127
123
|
const plans = resolvePlans(parsed.data.harness, home, which);
|
|
124
|
+
const explicitHarness = parsed.data.harness !== void 0 && parsed.data.harness.length > 0;
|
|
128
125
|
const claudeMdWrite = plans.some((p) => p.harness === "claude") ? await decideClaudeMd(claudeMdFlag, canPrompt, dryRun, deps) : false;
|
|
129
126
|
const harnesses = [];
|
|
130
127
|
for (const plan of plans) {
|
|
131
128
|
harnesses.push(await applyPlan(plan, skillsSource, dryRun, claudeMdWrite));
|
|
132
129
|
}
|
|
133
|
-
|
|
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));
|
|
134
141
|
const doctor = await collect(ctx);
|
|
135
142
|
const publishMode = await selectPublishMode(publishModeFlag, ctx, deps, dryRun, canPrompt);
|
|
136
143
|
const data = {
|
|
@@ -138,7 +145,11 @@ async function runInstall(input, ctx, deps = {}) {
|
|
|
138
145
|
skillsSource,
|
|
139
146
|
harnesses,
|
|
140
147
|
doctor: { status: doctor.failure !== void 0 ? "fail" : "pass", checks: doctor.checks },
|
|
141
|
-
publishMode
|
|
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()
|
|
142
153
|
};
|
|
143
154
|
if (!humanOutput) return { data };
|
|
144
155
|
const humanLines = await buildWalkthrough(ctx, deps, {
|
|
@@ -163,9 +174,14 @@ async function buildWalkthrough(ctx, deps, s) {
|
|
|
163
174
|
);
|
|
164
175
|
lines.push(...await walletWalkthrough(ctx, deps, s.dryRun || !s.canPrompt, s.noWallet, io), "");
|
|
165
176
|
lines.push(...doctorSummary(io, s.doctor), "");
|
|
177
|
+
lines.push(...permissionsWalkthrough(io), "");
|
|
166
178
|
lines.push(`Done. Try: tenjin search "${EXAMPLE_QUESTION}"`);
|
|
167
179
|
return lines;
|
|
168
180
|
}
|
|
181
|
+
function permissionsWalkthrough(io) {
|
|
182
|
+
const [heading, ...rest] = renderPermissionsBlock();
|
|
183
|
+
return [paint(io, "bold", heading ?? ""), ...rest];
|
|
184
|
+
}
|
|
169
185
|
function harnessLabel(h) {
|
|
170
186
|
return h === "claude" ? "Claude Code" : h === "codex" ? "Codex" : "Agent Skills";
|
|
171
187
|
}
|
|
@@ -182,6 +198,16 @@ function skillsWalkthrough(io, harnesses, dryRun) {
|
|
|
182
198
|
lines.push(
|
|
183
199
|
`${paint(io, "green", "\u2713")} ${harnessLabel(h.harness)}: ${n} skills ${verb}${suffix}`
|
|
184
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
|
+
}
|
|
185
211
|
const nudgePaths = nudgeFilesTouched(h);
|
|
186
212
|
if (nudgePaths.length > 0) {
|
|
187
213
|
lines.push(
|
|
@@ -218,6 +244,14 @@ function skillsWalkthrough(io, harnesses, dryRun) {
|
|
|
218
244
|
}
|
|
219
245
|
return lines;
|
|
220
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
|
+
}
|
|
221
255
|
function nudgeFilesTouched(h) {
|
|
222
256
|
const paths = [];
|
|
223
257
|
if (h.agentsMd !== void 0 && ["appended", "updated", "would-append", "would-update"].includes(h.agentsMd.status)) {
|
|
@@ -257,21 +291,7 @@ async function defaultCreateWallet(ctx) {
|
|
|
257
291
|
return result.data.address;
|
|
258
292
|
}
|
|
259
293
|
function defaultConfirmYesNo(label) {
|
|
260
|
-
return
|
|
261
|
-
const rl = createInterface({ input: process.stdin, output: process.stderr });
|
|
262
|
-
let settled = false;
|
|
263
|
-
const settle = (value) => {
|
|
264
|
-
if (settled) return;
|
|
265
|
-
settled = true;
|
|
266
|
-
rl.close();
|
|
267
|
-
resolve(value);
|
|
268
|
-
};
|
|
269
|
-
rl.once("close", () => settle(false));
|
|
270
|
-
rl.question(label, (answer) => {
|
|
271
|
-
const a = answer.trim().toLowerCase();
|
|
272
|
-
settle(a === "" || a === "y" || a === "yes");
|
|
273
|
-
});
|
|
274
|
-
});
|
|
294
|
+
return promptYesNo(label, { defaultYes: true });
|
|
275
295
|
}
|
|
276
296
|
function doctorSummary(io, doctor) {
|
|
277
297
|
const problems = doctor.checks.filter((c) => c.status !== "ok");
|
|
@@ -279,8 +299,10 @@ function doctorSummary(io, doctor) {
|
|
|
279
299
|
const lines = [paint(io, "yellow", "Some checks need attention:")];
|
|
280
300
|
for (const c of problems) {
|
|
281
301
|
const icon = c.status === "fail" ? paint(io, "red", "\u2717") : paint(io, "yellow", "!");
|
|
282
|
-
lines.push(` ${icon} ${c.name}: ${c.detail}`);
|
|
283
|
-
if (c.fix !== void 0)
|
|
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
|
+
}
|
|
284
306
|
}
|
|
285
307
|
return lines;
|
|
286
308
|
}
|
|
@@ -336,33 +358,22 @@ function defaultPromptMode(label) {
|
|
|
336
358
|
});
|
|
337
359
|
}
|
|
338
360
|
function resolvePlans(override, home, which) {
|
|
339
|
-
const claudeDir = join2(home, ".claude", "skills");
|
|
340
|
-
const sharedDir = join2(home, ".agents", "skills");
|
|
341
361
|
if (override !== void 0 && override.length > 0) {
|
|
342
|
-
const plans2 = override.map(
|
|
343
|
-
(v) => planFor(validateHarness(v), ["override"], true, home, claudeDir, sharedDir)
|
|
344
|
-
);
|
|
362
|
+
const plans2 = override.map((v) => planFor(validateHarness(v), ["override"], true, home));
|
|
345
363
|
return dedupeBySkillsDir(plans2);
|
|
346
364
|
}
|
|
347
365
|
const plans = [];
|
|
348
|
-
const claudeBy =
|
|
349
|
-
const codexBy =
|
|
350
|
-
if (claudeBy.length > 0)
|
|
351
|
-
|
|
352
|
-
if (codexBy.length > 0) plans.push(planFor("codex", codexBy, true, home, claudeDir, sharedDir));
|
|
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));
|
|
353
370
|
if (plans.length === 0) {
|
|
354
|
-
plans.push(planFor("shared", ["fallback"], false, home
|
|
371
|
+
plans.push(planFor("shared", ["fallback"], false, home));
|
|
355
372
|
}
|
|
356
373
|
return dedupeBySkillsDir(plans);
|
|
357
374
|
}
|
|
358
|
-
function
|
|
359
|
-
const
|
|
360
|
-
if (homeDirPresent) reasons.push("home-dir");
|
|
361
|
-
if (onPathPresent) reasons.push("binary");
|
|
362
|
-
return reasons;
|
|
363
|
-
}
|
|
364
|
-
function planFor(harness, detectedBy, detected, home, claudeDir, sharedDir) {
|
|
365
|
-
const skillsDir = harness === "claude" ? claudeDir : sharedDir;
|
|
375
|
+
function planFor(harness, detectedBy, detected, home) {
|
|
376
|
+
const skillsDir = harnessTargetDir(home, harness);
|
|
366
377
|
return { harness, detected, detectedBy, skillsDir, wiresAgentsMd: harness !== "claude", home };
|
|
367
378
|
}
|
|
368
379
|
function dedupeBySkillsDir(plans) {
|
|
@@ -385,21 +396,30 @@ async function applyPlan(plan, skillsSource, dryRun, claudeMdWrite) {
|
|
|
385
396
|
const skills = [];
|
|
386
397
|
const warnings = [];
|
|
387
398
|
for (const name of SKILL_NAMES) {
|
|
388
|
-
const { status, warning } = await installSkill(
|
|
389
|
-
|
|
390
|
-
|
|
391
|
-
dryRun
|
|
399
|
+
const { status, warning, preexisting } = await installSkill(
|
|
400
|
+
join(skillsSource, name),
|
|
401
|
+
join(plan.skillsDir, name),
|
|
402
|
+
dryRun,
|
|
403
|
+
name
|
|
392
404
|
);
|
|
393
|
-
skills.push({
|
|
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
|
+
});
|
|
394
412
|
if (warning !== void 0) warnings.push(warning);
|
|
395
413
|
}
|
|
414
|
+
const hostedPreexisting = skills.some((s) => s.name === HOSTED_SKILL_NAME && s.preexisting);
|
|
396
415
|
const result = {
|
|
397
416
|
harness: plan.harness,
|
|
398
417
|
detected: plan.detected,
|
|
399
418
|
detectedBy: plan.detectedBy,
|
|
400
419
|
skillsDir: plan.skillsDir,
|
|
401
420
|
skills,
|
|
402
|
-
|
|
421
|
+
hostedPreexisting,
|
|
422
|
+
notes: notesFor(plan, hostedPreexisting),
|
|
403
423
|
warnings
|
|
404
424
|
};
|
|
405
425
|
if (plan.wiresAgentsMd) {
|
|
@@ -419,52 +439,85 @@ async function decideClaudeMd(flag, canPrompt, dryRun, deps) {
|
|
|
419
439
|
);
|
|
420
440
|
}
|
|
421
441
|
async function wireClaudeMd(plan, dryRun, write) {
|
|
422
|
-
const path =
|
|
442
|
+
const path = join(plan.home, ".claude", "CLAUDE.md");
|
|
423
443
|
if (!write) return { path, status: "skipped" };
|
|
424
|
-
const existing =
|
|
444
|
+
const existing = existsSync(path) ? await readFile(path, "utf8") : null;
|
|
425
445
|
const { content, change } = upsertMarkerLine(existing, nudgeLine(plan.skillsDir));
|
|
426
446
|
if (change === "none") return { path, status: "up-to-date" };
|
|
427
447
|
if (!dryRun && content !== null) await writeFileAtomic(path, content);
|
|
428
448
|
if (change === "append") return { path, status: dryRun ? "would-write" : "written" };
|
|
429
449
|
return { path, status: dryRun ? "would-update" : "updated" };
|
|
430
450
|
}
|
|
431
|
-
function notesFor(plan) {
|
|
432
|
-
|
|
433
|
-
|
|
434
|
-
|
|
435
|
-
];
|
|
436
|
-
}
|
|
437
|
-
return [
|
|
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
|
+
] : [
|
|
438
455
|
"Copied into the shared Agent Skills location (~/.agents/skills). Codex and any Agent-Skills-compatible harness read it there."
|
|
439
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
|
+
}
|
|
440
472
|
}
|
|
441
|
-
async function
|
|
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) {
|
|
442
489
|
const src = await readTree(srcDir);
|
|
443
490
|
const dest = await readTree(destDir);
|
|
444
491
|
if (src === null) {
|
|
445
492
|
throw new CliError("INTERNAL", `Packaged skill source ${srcDir} is empty`);
|
|
446
493
|
}
|
|
447
|
-
const
|
|
494
|
+
const preexisting = dest?.has("SKILL.md") === true;
|
|
495
|
+
const change = dest === null || dest.size === 0 ? "create" : treesEqual(src, dest) ? "none" : "update";
|
|
448
496
|
if (!dryRun && change !== "none") {
|
|
449
497
|
await rm(destDir, { recursive: true, force: true });
|
|
450
498
|
for (const [rel, content] of src) {
|
|
451
|
-
await writeFileAtomic(
|
|
499
|
+
await writeFileAtomic(join(destDir, rel), content);
|
|
452
500
|
}
|
|
453
501
|
}
|
|
454
|
-
if (change === "create") return { status: dryRun ? "would-install" : "installed" };
|
|
455
|
-
if (change === "none") return { status: "up-to-date" };
|
|
502
|
+
if (change === "create") return { status: dryRun ? "would-install" : "installed", preexisting };
|
|
503
|
+
if (change === "none") return { status: "up-to-date", preexisting };
|
|
456
504
|
return {
|
|
457
505
|
status: dryRun ? "would-update" : "updated",
|
|
458
|
-
|
|
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).`
|
|
459
512
|
};
|
|
460
513
|
}
|
|
461
514
|
async function readTree(dir) {
|
|
462
|
-
if (!
|
|
515
|
+
if (!existsSync(dir)) return null;
|
|
463
516
|
const entries = await readdir(dir, { recursive: true, withFileTypes: true });
|
|
464
517
|
const files = /* @__PURE__ */ new Map();
|
|
465
518
|
for (const entry of entries) {
|
|
466
519
|
if (!entry.isFile()) continue;
|
|
467
|
-
const full =
|
|
520
|
+
const full = join(entry.parentPath, entry.name);
|
|
468
521
|
files.set(relative(dir, full), await readFile(full));
|
|
469
522
|
}
|
|
470
523
|
return files;
|
|
@@ -479,18 +532,18 @@ function treesEqual(a, b) {
|
|
|
479
532
|
return true;
|
|
480
533
|
}
|
|
481
534
|
async function wireAgentsMd(plan, dryRun) {
|
|
482
|
-
const shared =
|
|
483
|
-
const codex =
|
|
535
|
+
const shared = join(plan.home, ".agents", "AGENTS.md");
|
|
536
|
+
const codex = join(plan.home, ".codex", "AGENTS.md");
|
|
484
537
|
const line = nudgeLine(plan.skillsDir);
|
|
485
538
|
for (const path of [shared, codex]) {
|
|
486
|
-
if (
|
|
539
|
+
if (existsSync(path) && (await readFile(path, "utf8")).includes(SKILLS_MARKER)) {
|
|
487
540
|
return upsertAgentsMd(path, line, dryRun);
|
|
488
541
|
}
|
|
489
542
|
}
|
|
490
543
|
return upsertAgentsMd(chooseAgentsMdPath(plan.home), line, dryRun);
|
|
491
544
|
}
|
|
492
545
|
async function upsertAgentsMd(path, line, dryRun) {
|
|
493
|
-
const existing =
|
|
546
|
+
const existing = existsSync(path) ? await readFile(path, "utf8") : null;
|
|
494
547
|
const { content, change } = upsertMarkerLine(existing, line);
|
|
495
548
|
if (change === "none") return { path, status: "already-present" };
|
|
496
549
|
if (!dryRun && content !== null) await writeFileAtomic(path, content);
|
|
@@ -498,45 +551,39 @@ async function upsertAgentsMd(path, line, dryRun) {
|
|
|
498
551
|
return { path, status: dryRun ? "would-update" : "updated" };
|
|
499
552
|
}
|
|
500
553
|
function chooseAgentsMdPath(home) {
|
|
501
|
-
const shared =
|
|
502
|
-
const codex =
|
|
503
|
-
if (
|
|
504
|
-
if (
|
|
505
|
-
if (
|
|
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;
|
|
506
559
|
return shared;
|
|
507
560
|
}
|
|
508
|
-
function onPath(bin, env) {
|
|
509
|
-
const raw = env.PATH ?? "";
|
|
510
|
-
const exts = process.platform === "win32" ? ["", ...(env.PATHEXT ?? ".EXE;.CMD;.BAT;.COM").split(";").filter((e) => e.length > 0)] : [""];
|
|
511
|
-
for (const part of raw.split(delimiter)) {
|
|
512
|
-
if (part.length === 0) continue;
|
|
513
|
-
for (const ext of exts) {
|
|
514
|
-
if (isFile(join2(part, bin + ext))) return true;
|
|
515
|
-
}
|
|
516
|
-
}
|
|
517
|
-
return false;
|
|
518
|
-
}
|
|
519
|
-
function isFile(p) {
|
|
520
|
-
try {
|
|
521
|
-
return statSync(p).isFile();
|
|
522
|
-
} catch {
|
|
523
|
-
return false;
|
|
524
|
-
}
|
|
525
|
-
}
|
|
526
561
|
function paint(io, format, text) {
|
|
527
562
|
if (io.stdout instanceof Stream) return styleText(format, text, { stream: io.stdout });
|
|
528
563
|
return styleText(format, text);
|
|
529
564
|
}
|
|
530
565
|
async function assertSkillsSource(dir) {
|
|
531
566
|
for (const name of SKILL_NAMES) {
|
|
532
|
-
if (!
|
|
567
|
+
if (!existsSync(join(dir, name, "SKILL.md"))) {
|
|
533
568
|
throw new CliError("INTERNAL", `Packaged skill "${name}" is missing under ${dir}`, {
|
|
534
569
|
fix: "Reinstall tenjin-cli; the published package must ship every skill under skills/."
|
|
535
570
|
});
|
|
536
571
|
}
|
|
537
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
|
+
}
|
|
538
585
|
}
|
|
539
586
|
export {
|
|
540
587
|
runInstall
|
|
541
588
|
};
|
|
542
|
-
//# sourceMappingURL=install-
|
|
589
|
+
//# sourceMappingURL=install-RVPQPCKH.js.map
|