rrskill 0.1.2 → 0.1.4
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/dist/index.js +72 -66
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -3,18 +3,18 @@ import * as u from "node:fs/promises";
|
|
|
3
3
|
import { fileURLToPath as _, pathToFileURL as kt } from "node:url";
|
|
4
4
|
import { readFileSync as wt } from "node:fs";
|
|
5
5
|
import { createHash as yt } from "node:crypto";
|
|
6
|
-
import * as
|
|
6
|
+
import * as Q from "node:os";
|
|
7
7
|
import * as vt from "node:zlib";
|
|
8
8
|
import { promisify as St } from "node:util";
|
|
9
|
-
const
|
|
10
|
-
function
|
|
9
|
+
const X = ["search", "install", "list", "upgrade", "bootstrap", "doctor", "version"], Y = new Set(X), Dt = "--host", xt = "--output", jt = /* @__PURE__ */ new Set([Dt, xt]), Ct = /* @__PURE__ */ new Set(["--openclaw", "--codex", "--claude-code"]);
|
|
10
|
+
function tt(t) {
|
|
11
11
|
const s = [];
|
|
12
12
|
for (let e = 0; e < t.length; e += 1) {
|
|
13
13
|
const r = t[e];
|
|
14
14
|
if (r) {
|
|
15
15
|
if (jt.has(r)) {
|
|
16
16
|
const i = t[e + 1];
|
|
17
|
-
i && !i.startsWith("--") && !
|
|
17
|
+
i && !i.startsWith("--") && !Y.has(i) && (e += 1);
|
|
18
18
|
continue;
|
|
19
19
|
}
|
|
20
20
|
Ct.has(r) || r.startsWith("--") || s.push(r);
|
|
@@ -23,8 +23,8 @@ function Y(t) {
|
|
|
23
23
|
return s;
|
|
24
24
|
}
|
|
25
25
|
function Et(t) {
|
|
26
|
-
const s =
|
|
27
|
-
return e ? e === "help" ? { command: "help" } :
|
|
26
|
+
const s = tt(t), e = s[0] ?? "";
|
|
27
|
+
return e ? e === "help" ? { command: "help" } : Y.has(e) ? { command: e } : s.length === 1 ? { command: "install", slug: e } : { command: "unknown", input: e } : { command: "help" };
|
|
28
28
|
}
|
|
29
29
|
async function b(t) {
|
|
30
30
|
const s = t.fsImpl ?? u;
|
|
@@ -55,7 +55,7 @@ async function _t(t) {
|
|
|
55
55
|
};
|
|
56
56
|
}
|
|
57
57
|
}
|
|
58
|
-
function
|
|
58
|
+
function B(t, s) {
|
|
59
59
|
let e = t;
|
|
60
60
|
for (const r of s) {
|
|
61
61
|
if (!e || typeof e != "object")
|
|
@@ -64,7 +64,7 @@ function J(t, s) {
|
|
|
64
64
|
}
|
|
65
65
|
return e;
|
|
66
66
|
}
|
|
67
|
-
async function
|
|
67
|
+
async function st(t, s = {}) {
|
|
68
68
|
const e = s.fs ?? u, r = [], i = ["find-skills", "rrskill-preference"];
|
|
69
69
|
for (const f of i) {
|
|
70
70
|
const d = l.join(t.skillsDir, f, "SKILL.md");
|
|
@@ -77,7 +77,7 @@ async function tt(t, s = {}) {
|
|
|
77
77
|
const c = await _t({ fsImpl: e, path: t.hostConfigPath });
|
|
78
78
|
if (!c.ok)
|
|
79
79
|
return r.push(c.issue), { ok: !1, issues: r };
|
|
80
|
-
const a =
|
|
80
|
+
const a = B(c.value, ["plugins", "entries", "rrskill"]);
|
|
81
81
|
if (!a || typeof a != "object")
|
|
82
82
|
r.push({ code: "missing_host_plugin_entry", path: t.hostConfigPath });
|
|
83
83
|
else {
|
|
@@ -87,7 +87,7 @@ async function tt(t, s = {}) {
|
|
|
87
87
|
{ key: ["plugins", "entries", "rrskill", "config", "primaryLabel"], expected: "official-registry" }
|
|
88
88
|
];
|
|
89
89
|
for (const d of f) {
|
|
90
|
-
const h =
|
|
90
|
+
const h = B(c.value, d.key);
|
|
91
91
|
h !== d.expected && r.push({
|
|
92
92
|
code: "host_plugin_policy_mismatch",
|
|
93
93
|
path: t.hostConfigPath,
|
|
@@ -128,14 +128,14 @@ async function U(t) {
|
|
|
128
128
|
}
|
|
129
129
|
return await s.mkdir(l.dirname(t.path), { recursive: !0 }), await s.writeFile(t.path, e, "utf8"), !0;
|
|
130
130
|
}
|
|
131
|
-
const
|
|
131
|
+
const q = ["find-skills", "rrskill-preference"];
|
|
132
132
|
function Lt(t) {
|
|
133
133
|
return t === "find-skills" ? "skills/find-skills.md" : "skills/rrskill-preference.md";
|
|
134
134
|
}
|
|
135
135
|
async function bt(t, s = {}) {
|
|
136
136
|
const e = s.fs ?? u;
|
|
137
137
|
let r = !1;
|
|
138
|
-
for (const i of
|
|
138
|
+
for (const i of q) {
|
|
139
139
|
const o = await P({
|
|
140
140
|
candidates: O(import.meta.url, Lt(i)),
|
|
141
141
|
fsImpl: e,
|
|
@@ -143,7 +143,7 @@ async function bt(t, s = {}) {
|
|
|
143
143
|
}), n = l.join(t.skillsDir, i, "SKILL.md"), c = await U({ path: n, content: o, fsImpl: e });
|
|
144
144
|
r = r || c;
|
|
145
145
|
}
|
|
146
|
-
return { installed: [...
|
|
146
|
+
return { installed: [...q], changed: r };
|
|
147
147
|
}
|
|
148
148
|
async function $t(t, s = {}) {
|
|
149
149
|
const e = s.fs ?? u;
|
|
@@ -160,12 +160,12 @@ async function $t(t, s = {}) {
|
|
|
160
160
|
}), o = l.join(t.pluginDir, "index.ts"), n = l.join(t.pluginDir, "openclaw.plugin.json"), c = await U({ path: o, content: r, fsImpl: e }), a = await U({ path: n, content: i, fsImpl: e });
|
|
161
161
|
return { installed: !0, changed: c || a };
|
|
162
162
|
}
|
|
163
|
-
function
|
|
163
|
+
function et(t) {
|
|
164
164
|
return !!t && typeof t == "object" && !Array.isArray(t);
|
|
165
165
|
}
|
|
166
166
|
function x(t, s) {
|
|
167
167
|
const e = t[s];
|
|
168
|
-
if (
|
|
168
|
+
if (et(e))
|
|
169
169
|
return e;
|
|
170
170
|
const r = {};
|
|
171
171
|
return t[s] = r, r;
|
|
@@ -176,7 +176,7 @@ async function It(t) {
|
|
|
176
176
|
const e = await s.readFile(t.path, "utf8");
|
|
177
177
|
try {
|
|
178
178
|
const r = JSON.parse(e);
|
|
179
|
-
return
|
|
179
|
+
return et(r) ? { object: r, exists: !0, parseOk: !0, rawText: e } : { object: {}, exists: !0, parseOk: !1, rawText: e, parseError: "root is not a JSON object" };
|
|
180
180
|
} catch (r) {
|
|
181
181
|
return {
|
|
182
182
|
object: {},
|
|
@@ -219,7 +219,7 @@ async function Ut(t, s = {}) {
|
|
|
219
219
|
hostConfigRepaired: o
|
|
220
220
|
};
|
|
221
221
|
}
|
|
222
|
-
async function
|
|
222
|
+
async function R(t, s = {}) {
|
|
223
223
|
if (t.host !== "openclaw")
|
|
224
224
|
return {
|
|
225
225
|
builtinsInstalled: [],
|
|
@@ -238,7 +238,7 @@ async function et(t, s = {}) {
|
|
|
238
238
|
hostConfigPath: t.hostConfigPath
|
|
239
239
|
},
|
|
240
240
|
{ fs: e }
|
|
241
|
-
), i = await
|
|
241
|
+
), i = await st(
|
|
242
242
|
{
|
|
243
243
|
host: t.host,
|
|
244
244
|
skillsDir: t.skillsDir,
|
|
@@ -334,7 +334,7 @@ async function Rt(t, s = {}, e = {}) {
|
|
|
334
334
|
nextCommands: ["rrskill search <query>", "rrskill install <slug>"],
|
|
335
335
|
paths: i
|
|
336
336
|
};
|
|
337
|
-
const o = await
|
|
337
|
+
const o = await st(t, {
|
|
338
338
|
fs: r
|
|
339
339
|
});
|
|
340
340
|
if (o.ok)
|
|
@@ -364,7 +364,7 @@ async function Rt(t, s = {}, e = {}) {
|
|
|
364
364
|
verification: o
|
|
365
365
|
};
|
|
366
366
|
if (s.fix) {
|
|
367
|
-
const n = await
|
|
367
|
+
const n = await R(t, {
|
|
368
368
|
fs: r
|
|
369
369
|
});
|
|
370
370
|
return {
|
|
@@ -399,7 +399,7 @@ async function Rt(t, s = {}, e = {}) {
|
|
|
399
399
|
function At(t) {
|
|
400
400
|
return t.HOME ?? t.USERPROFILE ?? process.env.HOME ?? process.env.USERPROFILE ?? process.cwd();
|
|
401
401
|
}
|
|
402
|
-
function
|
|
402
|
+
function K(t, s) {
|
|
403
403
|
const e = t?.trim();
|
|
404
404
|
if (e)
|
|
405
405
|
return e === "~" ? s : e.startsWith("~/") ? l.resolve(s, e.slice(2)) : l.resolve(e);
|
|
@@ -419,13 +419,13 @@ function Tt(t, s) {
|
|
|
419
419
|
return t;
|
|
420
420
|
}
|
|
421
421
|
async function Ft(t) {
|
|
422
|
-
const s = At(t.env), e =
|
|
422
|
+
const s = At(t.env), e = K(t.env.RRSKILL_CONFIG_PATH, s) ?? l.resolve(s, ".rrskill", "config.json");
|
|
423
423
|
try {
|
|
424
424
|
const r = await u.readFile(e, "utf8"), i = Tt(JSON.parse(r), e);
|
|
425
425
|
return {
|
|
426
426
|
configPath: e,
|
|
427
427
|
host: $(i, ["host"]),
|
|
428
|
-
stateDir:
|
|
428
|
+
stateDir: K(
|
|
429
429
|
$(i, ["stateDir", "state_dir"]),
|
|
430
430
|
s
|
|
431
431
|
),
|
|
@@ -442,7 +442,7 @@ async function Ft(t) {
|
|
|
442
442
|
) : r;
|
|
443
443
|
}
|
|
444
444
|
}
|
|
445
|
-
const Nt = "openclaw", Ht = "--host",
|
|
445
|
+
const Nt = "openclaw", Ht = "--host", W = {
|
|
446
446
|
"--openclaw": "openclaw",
|
|
447
447
|
"--codex": "codex",
|
|
448
448
|
"--claude-code": "claude-code"
|
|
@@ -450,7 +450,7 @@ const Nt = "openclaw", Ht = "--host", K = {
|
|
|
450
450
|
"openclaw",
|
|
451
451
|
"codex",
|
|
452
452
|
"claude-code"
|
|
453
|
-
], zt = new Set(rt), Mt = new Set(
|
|
453
|
+
], zt = new Set(rt), Mt = new Set(X);
|
|
454
454
|
function Jt(t) {
|
|
455
455
|
if (!t)
|
|
456
456
|
return;
|
|
@@ -479,7 +479,7 @@ function Bt(t) {
|
|
|
479
479
|
return e;
|
|
480
480
|
}
|
|
481
481
|
function qt(t) {
|
|
482
|
-
const s = t.filter((r) => r in
|
|
482
|
+
const s = t.filter((r) => r in W).map((r) => W[r]);
|
|
483
483
|
if (s.length === 0)
|
|
484
484
|
return;
|
|
485
485
|
const e = Array.from(new Set(s));
|
|
@@ -539,7 +539,7 @@ const Vt = {
|
|
|
539
539
|
};
|
|
540
540
|
}
|
|
541
541
|
};
|
|
542
|
-
async function
|
|
542
|
+
async function V(t) {
|
|
543
543
|
const s = await Ft({ env: t.env }), e = Kt({ argv: t.argv, env: t.env, config: s }), r = Wt({ env: t.env, config: s }), i = e === "openclaw" ? Vt.getDefaultPaths({ homeDir: r.homeDir, stateDir: r.stateDir }) : e === "codex" ? Gt.getDefaultPaths({ homeDir: r.homeDir, stateDir: r.stateDir }) : Zt.getDefaultPaths({ homeDir: r.homeDir, stateDir: r.stateDir });
|
|
544
544
|
return {
|
|
545
545
|
argv: t.argv,
|
|
@@ -555,7 +555,7 @@ async function W(t) {
|
|
|
555
555
|
};
|
|
556
556
|
}
|
|
557
557
|
const Qt = ".rrskill_lock.json";
|
|
558
|
-
function
|
|
558
|
+
function A() {
|
|
559
559
|
return { version: 1, skills: {} };
|
|
560
560
|
}
|
|
561
561
|
function it(t) {
|
|
@@ -570,7 +570,7 @@ function nt(t, s) {
|
|
|
570
570
|
function w(t) {
|
|
571
571
|
return typeof t == "object" && t !== null;
|
|
572
572
|
}
|
|
573
|
-
function
|
|
573
|
+
function G(t, s) {
|
|
574
574
|
if (!w(s)) return;
|
|
575
575
|
const e = typeof s.slug == "string" ? s.slug : t, r = typeof s.installedAt == "string" ? s.installedAt : void 0, i = typeof s.version == "string" ? s.version : void 0, o = w(s.source) || i ? {
|
|
576
576
|
type: "registry",
|
|
@@ -579,32 +579,32 @@ function V(t, s) {
|
|
|
579
579
|
return { slug: e, installedAt: r, source: o };
|
|
580
580
|
}
|
|
581
581
|
function Xt(t) {
|
|
582
|
-
if (!w(t)) return
|
|
582
|
+
if (!w(t)) return A();
|
|
583
583
|
if (t.version === 1 && w(t.skills)) {
|
|
584
584
|
const i = {};
|
|
585
585
|
for (const [o, n] of Object.entries(t.skills)) {
|
|
586
|
-
const c =
|
|
586
|
+
const c = G(o, n);
|
|
587
587
|
c && (i[o] = c);
|
|
588
588
|
}
|
|
589
589
|
return { version: 1, skills: i };
|
|
590
590
|
}
|
|
591
591
|
const s = Object.hasOwn(t, "version"), e = Object.hasOwn(t, "skills");
|
|
592
592
|
if (s || e)
|
|
593
|
-
return
|
|
593
|
+
return A();
|
|
594
594
|
const r = {};
|
|
595
595
|
for (const [i, o] of Object.entries(t)) {
|
|
596
|
-
const n =
|
|
596
|
+
const n = G(i, o);
|
|
597
597
|
n && (r[i] = n);
|
|
598
598
|
}
|
|
599
599
|
return { version: 1, skills: r };
|
|
600
600
|
}
|
|
601
|
-
async function
|
|
601
|
+
async function H(t) {
|
|
602
602
|
const s = it(t.skillsDir);
|
|
603
603
|
try {
|
|
604
604
|
const e = await t.fs.readFile(s, "utf8"), r = JSON.parse(e);
|
|
605
605
|
return Xt(r);
|
|
606
606
|
} catch (e) {
|
|
607
|
-
if ((w(e) && typeof e.code == "string" ? e.code : void 0) === "ENOENT") return
|
|
607
|
+
if ((w(e) && typeof e.code == "string" ? e.code : void 0) === "ENOENT") return A();
|
|
608
608
|
throw e;
|
|
609
609
|
}
|
|
610
610
|
}
|
|
@@ -646,7 +646,7 @@ async function ss(t, s, e = {}) {
|
|
|
646
646
|
const n = nt(t.skillsDir, s);
|
|
647
647
|
let c = o?.version;
|
|
648
648
|
e.downloadSkill ? (await r.mkdir(n, { recursive: !0 }), c = (await e.downloadSkill({ slug: s, targetDir: n, registrySkill: o })).version ?? c) : await ts({ slug: s, targetDir: n, fsImpl: r });
|
|
649
|
-
const a = await
|
|
649
|
+
const a = await H({ skillsDir: t.skillsDir, fs: r }), f = at(a, {
|
|
650
650
|
slug: s,
|
|
651
651
|
installedAt: i().toISOString(),
|
|
652
652
|
source: { type: "registry", version: c }
|
|
@@ -658,14 +658,14 @@ async function ss(t, s, e = {}) {
|
|
|
658
658
|
};
|
|
659
659
|
}
|
|
660
660
|
async function es(t, s = {}) {
|
|
661
|
-
const e = s.fs ?? u, r = await
|
|
661
|
+
const e = s.fs ?? u, r = await H({ skillsDir: t.skillsDir, fs: e });
|
|
662
662
|
return Object.keys(r.skills).sort();
|
|
663
663
|
}
|
|
664
664
|
async function rs(t, s, e) {
|
|
665
665
|
return e.searchSkills({ query: s });
|
|
666
666
|
}
|
|
667
667
|
async function is(t, s = {}) {
|
|
668
|
-
const e = s.fs ?? u, r = s.now ?? (() => /* @__PURE__ */ new Date()), i = await
|
|
668
|
+
const e = s.fs ?? u, r = s.now ?? (() => /* @__PURE__ */ new Date()), i = await H({ skillsDir: t.skillsDir, fs: e }), o = Object.keys(i.skills).sort();
|
|
669
669
|
if (!s.downloadSkill)
|
|
670
670
|
return { upgraded: [] };
|
|
671
671
|
const n = [];
|
|
@@ -863,12 +863,12 @@ async function ct(t, s) {
|
|
|
863
863
|
throw new Error(
|
|
864
864
|
"Downloaded skill package has an invalid zip central directory."
|
|
865
865
|
);
|
|
866
|
-
const d = t.readUInt16LE(a + 10), h = t.readUInt32LE(a + 20), ft = t.readUInt32LE(a + 24),
|
|
866
|
+
const d = t.readUInt16LE(a + 10), h = t.readUInt32LE(a + 20), ft = t.readUInt32LE(a + 24), z = t.readUInt16LE(a + 28), dt = t.readUInt16LE(a + 30), pt = t.readUInt16LE(a + 32), v = t.readUInt32LE(a + 42), S = t.toString(
|
|
867
867
|
"utf8",
|
|
868
868
|
a + 46,
|
|
869
|
-
a + 46 +
|
|
869
|
+
a + 46 + z
|
|
870
870
|
);
|
|
871
|
-
a += 46 +
|
|
871
|
+
a += 46 + z + dt + pt;
|
|
872
872
|
const k = S.replaceAll("\\", "/");
|
|
873
873
|
if (!k || k.startsWith("/") || k.includes("../"))
|
|
874
874
|
throw new Error(`Unsafe zip path entry detected: ${S}`);
|
|
@@ -879,9 +879,9 @@ async function ct(t, s) {
|
|
|
879
879
|
throw new Error(
|
|
880
880
|
"Downloaded skill package has an invalid zip local header."
|
|
881
881
|
);
|
|
882
|
-
const mt = t.readUInt16LE(v + 26), gt = t.readUInt16LE(v + 28),
|
|
883
|
-
|
|
884
|
-
|
|
882
|
+
const mt = t.readUInt16LE(v + 26), gt = t.readUInt16LE(v + 28), M = v + 30 + mt + gt, J = t.subarray(
|
|
883
|
+
M,
|
|
884
|
+
M + h
|
|
885
885
|
);
|
|
886
886
|
if (k.endsWith("/")) {
|
|
887
887
|
await u.mkdir(y, { recursive: !0 });
|
|
@@ -889,9 +889,9 @@ async function ct(t, s) {
|
|
|
889
889
|
}
|
|
890
890
|
let D;
|
|
891
891
|
if (d === 0)
|
|
892
|
-
D = Buffer.from(
|
|
892
|
+
D = Buffer.from(J);
|
|
893
893
|
else if (d === 8)
|
|
894
|
-
D = Buffer.from(await as(
|
|
894
|
+
D = Buffer.from(await as(J));
|
|
895
895
|
else
|
|
896
896
|
throw new Error(
|
|
897
897
|
`Unsupported zip compression method: ${d}`
|
|
@@ -902,20 +902,20 @@ async function ct(t, s) {
|
|
|
902
902
|
}
|
|
903
903
|
return e;
|
|
904
904
|
}
|
|
905
|
-
async function
|
|
905
|
+
async function T(t, s) {
|
|
906
906
|
await u.rm(s, { recursive: !0, force: !0 }), await u.mkdir(l.dirname(s), { recursive: !0 }), await u.cp(t, s, { recursive: !0 });
|
|
907
907
|
}
|
|
908
908
|
async function gs(t, s, e) {
|
|
909
909
|
if ((await u.stat(t)).isDirectory())
|
|
910
|
-
return await
|
|
910
|
+
return await T(t, s), [];
|
|
911
911
|
const i = await u.readFile(t);
|
|
912
912
|
lt(i, e, t);
|
|
913
913
|
const o = await u.mkdtemp(
|
|
914
|
-
l.join(
|
|
914
|
+
l.join(Q.tmpdir(), "rrskill-registry-stage-")
|
|
915
915
|
);
|
|
916
916
|
try {
|
|
917
917
|
const n = await ct(i, o);
|
|
918
|
-
return await
|
|
918
|
+
return await T(o, s), n;
|
|
919
919
|
} finally {
|
|
920
920
|
await u.rm(o, { recursive: !0, force: !0 });
|
|
921
921
|
}
|
|
@@ -933,11 +933,11 @@ async function ks(t, s, e) {
|
|
|
933
933
|
const i = Buffer.from(await r.arrayBuffer());
|
|
934
934
|
lt(i, e, t);
|
|
935
935
|
const o = await u.mkdtemp(
|
|
936
|
-
l.join(
|
|
936
|
+
l.join(Q.tmpdir(), "rrskill-registry-stage-")
|
|
937
937
|
);
|
|
938
938
|
try {
|
|
939
939
|
const n = await ct(i, o);
|
|
940
|
-
return await
|
|
940
|
+
return await T(o, s), n;
|
|
941
941
|
} finally {
|
|
942
942
|
await u.rm(o, { recursive: !0, force: !0 });
|
|
943
943
|
}
|
|
@@ -1117,21 +1117,21 @@ function xs(t) {
|
|
|
1117
1117
|
].join(`
|
|
1118
1118
|
`);
|
|
1119
1119
|
}
|
|
1120
|
-
function
|
|
1120
|
+
function F(t) {
|
|
1121
1121
|
process.stdout.write(`${JSON.stringify(t, null, 2)}
|
|
1122
1122
|
`);
|
|
1123
1123
|
}
|
|
1124
|
-
function
|
|
1124
|
+
function N(t) {
|
|
1125
1125
|
process.stdout.write(t.endsWith(`
|
|
1126
1126
|
`) ? t : `${t}
|
|
1127
1127
|
`);
|
|
1128
1128
|
}
|
|
1129
1129
|
function m(t, s, e) {
|
|
1130
1130
|
if (s === "json") {
|
|
1131
|
-
|
|
1131
|
+
F(t);
|
|
1132
1132
|
return;
|
|
1133
1133
|
}
|
|
1134
|
-
|
|
1134
|
+
N(e(t));
|
|
1135
1135
|
}
|
|
1136
1136
|
function js(t) {
|
|
1137
1137
|
return [
|
|
@@ -1218,9 +1218,9 @@ function ut(t, s = "json") {
|
|
|
1218
1218
|
nextCommands: ["rrskill --help"]
|
|
1219
1219
|
});
|
|
1220
1220
|
}
|
|
1221
|
-
function
|
|
1221
|
+
function Z(t, s) {
|
|
1222
1222
|
if (t instanceof g && s === "json") {
|
|
1223
|
-
|
|
1223
|
+
F({
|
|
1224
1224
|
ok: !1,
|
|
1225
1225
|
error: {
|
|
1226
1226
|
code: t.code,
|
|
@@ -1245,7 +1245,7 @@ function G(t, s) {
|
|
|
1245
1245
|
}
|
|
1246
1246
|
const e = t instanceof Error ? t.message : String(t);
|
|
1247
1247
|
if (s === "json") {
|
|
1248
|
-
|
|
1248
|
+
F({
|
|
1249
1249
|
ok: !1,
|
|
1250
1250
|
error: {
|
|
1251
1251
|
code: "unexpected_error",
|
|
@@ -1259,7 +1259,7 @@ function G(t, s) {
|
|
|
1259
1259
|
`);
|
|
1260
1260
|
}
|
|
1261
1261
|
async function Os(t) {
|
|
1262
|
-
const s = ut(t, "json"), e = Et(t), r =
|
|
1262
|
+
const s = ut(t, "json"), e = Et(t), r = tt(t), i = E(t, "--help", "-h");
|
|
1263
1263
|
if (e.command === "unknown")
|
|
1264
1264
|
throw new g({
|
|
1265
1265
|
code: "unknown_command",
|
|
@@ -1269,10 +1269,10 @@ async function Os(t) {
|
|
|
1269
1269
|
});
|
|
1270
1270
|
if (e.command === "help" || i) {
|
|
1271
1271
|
const a = e.command === "help" ? r[1] : e.command !== "install" ? e.command : void 0;
|
|
1272
|
-
return a && ["search", "install", "list", "upgrade", "bootstrap", "doctor", "version"].includes(a) ? (
|
|
1272
|
+
return a && ["search", "install", "list", "upgrade", "bootstrap", "doctor", "version"].includes(a) ? (N(xs(a)), 0) : (N(Ds()), 0);
|
|
1273
1273
|
}
|
|
1274
1274
|
if (e.command === "doctor") {
|
|
1275
|
-
const a = await
|
|
1275
|
+
const a = await V({ argv: t, env: process.env }), f = await Rt(
|
|
1276
1276
|
a,
|
|
1277
1277
|
{
|
|
1278
1278
|
fix: E(t, "--fix"),
|
|
@@ -1283,9 +1283,15 @@ async function Os(t) {
|
|
|
1283
1283
|
}
|
|
1284
1284
|
if (e.command === "version")
|
|
1285
1285
|
return m(os(), s, js), 0;
|
|
1286
|
-
const o = await
|
|
1286
|
+
const o = await V({ argv: t, env: process.env });
|
|
1287
|
+
if (e.command === "install" && o.host === "openclaw")
|
|
1288
|
+
try {
|
|
1289
|
+
await R(o);
|
|
1290
|
+
} catch {
|
|
1291
|
+
}
|
|
1292
|
+
const n = ms({ config: o.config, env: o.env }), c = vs(n);
|
|
1287
1293
|
if (e.command === "bootstrap") {
|
|
1288
|
-
const a = await
|
|
1294
|
+
const a = await R(o);
|
|
1289
1295
|
return m(a, s, bs), a.verification.ok ? 0 : 1;
|
|
1290
1296
|
}
|
|
1291
1297
|
if (e.command === "search") {
|
|
@@ -1332,10 +1338,10 @@ if (Ss()) {
|
|
|
1332
1338
|
try {
|
|
1333
1339
|
e = ut(t, "text");
|
|
1334
1340
|
} catch (r) {
|
|
1335
|
-
|
|
1341
|
+
Z(r, "text"), process.exitCode = 1;
|
|
1336
1342
|
return;
|
|
1337
1343
|
}
|
|
1338
|
-
|
|
1344
|
+
Z(s, e), process.exitCode = 1;
|
|
1339
1345
|
});
|
|
1340
1346
|
}
|
|
1341
1347
|
export {
|