zion 4.3.1 → 4.3.2
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/cli.js +105 -102
- package/package.json +1 -1
package/dist/cli.js
CHANGED
|
@@ -5,10 +5,10 @@ import {
|
|
|
5
5
|
|
|
6
6
|
// src/cli.tsx
|
|
7
7
|
import os3 from "os";
|
|
8
|
-
import
|
|
8
|
+
import path17 from "path";
|
|
9
9
|
|
|
10
10
|
// package.json
|
|
11
|
-
var version = "4.3.
|
|
11
|
+
var version = "4.3.2";
|
|
12
12
|
|
|
13
13
|
// src/lib/theme.ts
|
|
14
14
|
import { Chalk, supportsColor, supportsColorStderr } from "chalk";
|
|
@@ -585,6 +585,9 @@ var CardCommand = class {
|
|
|
585
585
|
}
|
|
586
586
|
};
|
|
587
587
|
|
|
588
|
+
// src/commands/dotfiles/DotfilesCommand.ts
|
|
589
|
+
import path4 from "path";
|
|
590
|
+
|
|
588
591
|
// src/lib/format.ts
|
|
589
592
|
var shortCommit = (commit) => commit.slice(0, 7);
|
|
590
593
|
function plural(count, noun) {
|
|
@@ -1129,10 +1132,18 @@ function tildify(input2) {
|
|
|
1129
1132
|
return input2.startsWith(home + path.sep) ? `~${input2.slice(home.length)}` : input2;
|
|
1130
1133
|
}
|
|
1131
1134
|
|
|
1135
|
+
// src/services/xdg.ts
|
|
1136
|
+
import os2 from "os";
|
|
1137
|
+
import path2 from "path";
|
|
1138
|
+
function stateHome(env) {
|
|
1139
|
+
const base = env.XDG_STATE_HOME;
|
|
1140
|
+
return base && path2.isAbsolute(base) ? base : path2.join(os2.homedir(), ".local", "state");
|
|
1141
|
+
}
|
|
1142
|
+
|
|
1132
1143
|
// src/commands/dotfiles/DotfilesRepository.ts
|
|
1133
1144
|
import { constants } from "fs";
|
|
1134
1145
|
import fs from "fs/promises";
|
|
1135
|
-
import
|
|
1146
|
+
import path3 from "path";
|
|
1136
1147
|
var NotACloneError = class extends CliError {
|
|
1137
1148
|
constructor(dir, slug) {
|
|
1138
1149
|
super(
|
|
@@ -1157,7 +1168,7 @@ var DotfilesRepository = class {
|
|
|
1157
1168
|
} catch {
|
|
1158
1169
|
return null;
|
|
1159
1170
|
}
|
|
1160
|
-
const suffix =
|
|
1171
|
+
const suffix = path3.sep + path3.normalize(this.source.installer);
|
|
1161
1172
|
if (!target.endsWith(suffix)) return null;
|
|
1162
1173
|
const location = await this.inspect(target.slice(0, -suffix.length));
|
|
1163
1174
|
return location.state === "clone" ? location : null;
|
|
@@ -1169,7 +1180,7 @@ var DotfilesRepository = class {
|
|
|
1169
1180
|
async sync({ dir, state }, { update, signal }) {
|
|
1170
1181
|
if (state === "foreign") throw new NotACloneError(dir, this.source.slug);
|
|
1171
1182
|
if (state === "clone") return this.update(dir, update, signal);
|
|
1172
|
-
await fs.mkdir(
|
|
1183
|
+
await fs.mkdir(path3.dirname(dir), { recursive: true });
|
|
1173
1184
|
try {
|
|
1174
1185
|
await this.git.clone(this.source.url, dir, signal);
|
|
1175
1186
|
} catch (error62) {
|
|
@@ -1182,7 +1193,7 @@ var DotfilesRepository = class {
|
|
|
1182
1193
|
return { kind: "cloned", commit: await this.head(dir) };
|
|
1183
1194
|
}
|
|
1184
1195
|
async installerPath(dir) {
|
|
1185
|
-
const installer =
|
|
1196
|
+
const installer = path3.join(dir, this.source.installer);
|
|
1186
1197
|
try {
|
|
1187
1198
|
await fs.access(installer, constants.R_OK);
|
|
1188
1199
|
} catch {
|
|
@@ -1338,7 +1349,7 @@ function parseDotfilesOptions(args, bin) {
|
|
|
1338
1349
|
|
|
1339
1350
|
// src/commands/dotfiles/DotfilesCommand.ts
|
|
1340
1351
|
var DIR_ENV = "ZION_DOTFILES_DIR";
|
|
1341
|
-
var
|
|
1352
|
+
var defaultDir = (env) => tildify(path4.join(stateHome(env), "zion", "dotfiles"));
|
|
1342
1353
|
var SUPPORTED_PLATFORMS = { darwin: "macOS", linux: "Linux" };
|
|
1343
1354
|
var DotfilesCommand = class {
|
|
1344
1355
|
constructor(deps) {
|
|
@@ -1346,10 +1357,10 @@ var DotfilesCommand = class {
|
|
|
1346
1357
|
const { slug } = deps.repository.source;
|
|
1347
1358
|
this.help = {
|
|
1348
1359
|
usage: "[action] [options]",
|
|
1349
|
-
description: `Clones github.com/${slug} (or updates an existing clone) and runs its dot installer. Without an action, you choose one interactively. The clone lives in --dir, $${DIR_ENV}, the clone an earlier install was made from, or ${
|
|
1360
|
+
description: `Clones github.com/${slug} (or updates an existing clone) and runs its dot installer. Without an action, you choose one interactively. The clone lives in --dir, $${DIR_ENV}, the clone an earlier install was made from, or ${defaultDir(this.deps.env)}, in that order.`,
|
|
1350
1361
|
arguments: { title: "Actions", rows: DOT_ACTIONS.map((action) => [action.id, action.hint]) },
|
|
1351
1362
|
options: [
|
|
1352
|
-
["-d, --dir <path>", `where the dotfiles live (default: ${
|
|
1363
|
+
["-d, --dir <path>", `where the dotfiles live (default: ${defaultDir(this.deps.env)})`],
|
|
1353
1364
|
["-y, --yes", "answer yes to every prompt, including uninstall"],
|
|
1354
1365
|
["-n, --dry-run", "show what would happen, change nothing"],
|
|
1355
1366
|
["--no-update", "use an existing clone as is, without pulling"]
|
|
@@ -1431,7 +1442,7 @@ var DotfilesCommand = class {
|
|
|
1431
1442
|
let checked;
|
|
1432
1443
|
const answer = await ui.text({
|
|
1433
1444
|
message: "Where should your dotfiles live?",
|
|
1434
|
-
defaultValue:
|
|
1445
|
+
defaultValue: defaultDir(env),
|
|
1435
1446
|
validate: async (value) => {
|
|
1436
1447
|
checked = await repository.inspect(expandHome(value));
|
|
1437
1448
|
return checked.state === "foreign" ? new NotACloneError(checked.dir, repository.source.slug).message : void 0;
|
|
@@ -2326,10 +2337,10 @@ function mergeDefs(...defs) {
|
|
|
2326
2337
|
function cloneDef(schema) {
|
|
2327
2338
|
return mergeDefs(schema._zod.def);
|
|
2328
2339
|
}
|
|
2329
|
-
function getElementAtPath(obj,
|
|
2330
|
-
if (!
|
|
2340
|
+
function getElementAtPath(obj, path18) {
|
|
2341
|
+
if (!path18)
|
|
2331
2342
|
return obj;
|
|
2332
|
-
return
|
|
2343
|
+
return path18.reduce((acc, key) => acc?.[key], obj);
|
|
2333
2344
|
}
|
|
2334
2345
|
function promiseAllObject(promisesObj) {
|
|
2335
2346
|
const keys = Object.keys(promisesObj);
|
|
@@ -2669,11 +2680,11 @@ function explicitlyAborted(x, startIndex = 0) {
|
|
|
2669
2680
|
}
|
|
2670
2681
|
return false;
|
|
2671
2682
|
}
|
|
2672
|
-
function prefixIssues(
|
|
2683
|
+
function prefixIssues(path18, issues) {
|
|
2673
2684
|
return issues.map((iss) => {
|
|
2674
2685
|
var _a3;
|
|
2675
2686
|
(_a3 = iss).path ?? (_a3.path = []);
|
|
2676
|
-
iss.path.unshift(
|
|
2687
|
+
iss.path.unshift(path18);
|
|
2677
2688
|
return iss;
|
|
2678
2689
|
});
|
|
2679
2690
|
}
|
|
@@ -3135,16 +3146,16 @@ function flattenError(error62, mapper = (issue2) => issue2.message) {
|
|
|
3135
3146
|
}
|
|
3136
3147
|
function formatError2(error62, mapper = (issue2) => issue2.message) {
|
|
3137
3148
|
const fieldErrors = { _errors: [] };
|
|
3138
|
-
const processError = (error63,
|
|
3149
|
+
const processError = (error63, path18 = []) => {
|
|
3139
3150
|
for (const issue2 of error63.issues) {
|
|
3140
3151
|
if (issue2.code === "invalid_union" && issue2.errors.length) {
|
|
3141
|
-
issue2.errors.map((issues) => processError({ issues }, [...
|
|
3152
|
+
issue2.errors.map((issues) => processError({ issues }, [...path18, ...issue2.path]));
|
|
3142
3153
|
} else if (issue2.code === "invalid_key") {
|
|
3143
|
-
processError({ issues: issue2.issues }, [...
|
|
3154
|
+
processError({ issues: issue2.issues }, [...path18, ...issue2.path]);
|
|
3144
3155
|
} else if (issue2.code === "invalid_element") {
|
|
3145
|
-
processError({ issues: issue2.issues }, [...
|
|
3156
|
+
processError({ issues: issue2.issues }, [...path18, ...issue2.path]);
|
|
3146
3157
|
} else {
|
|
3147
|
-
const fullpath = [...
|
|
3158
|
+
const fullpath = [...path18, ...issue2.path];
|
|
3148
3159
|
if (fullpath.length === 0) {
|
|
3149
3160
|
fieldErrors._errors.push(mapper(issue2));
|
|
3150
3161
|
} else {
|
|
@@ -3183,17 +3194,17 @@ function formatError2(error62, mapper = (issue2) => issue2.message) {
|
|
|
3183
3194
|
}
|
|
3184
3195
|
function treeifyError(error62, mapper = (issue2) => issue2.message) {
|
|
3185
3196
|
const result = { errors: [] };
|
|
3186
|
-
const processError = (error63,
|
|
3197
|
+
const processError = (error63, path18 = []) => {
|
|
3187
3198
|
var _a3;
|
|
3188
3199
|
for (const issue2 of error63.issues) {
|
|
3189
3200
|
if (issue2.code === "invalid_union" && issue2.errors.length) {
|
|
3190
|
-
issue2.errors.map((issues) => processError({ issues }, [...
|
|
3201
|
+
issue2.errors.map((issues) => processError({ issues }, [...path18, ...issue2.path]));
|
|
3191
3202
|
} else if (issue2.code === "invalid_key") {
|
|
3192
|
-
processError({ issues: issue2.issues }, [...
|
|
3203
|
+
processError({ issues: issue2.issues }, [...path18, ...issue2.path]);
|
|
3193
3204
|
} else if (issue2.code === "invalid_element") {
|
|
3194
|
-
processError({ issues: issue2.issues }, [...
|
|
3205
|
+
processError({ issues: issue2.issues }, [...path18, ...issue2.path]);
|
|
3195
3206
|
} else {
|
|
3196
|
-
const fullpath = [...
|
|
3207
|
+
const fullpath = [...path18, ...issue2.path];
|
|
3197
3208
|
if (fullpath.length === 0) {
|
|
3198
3209
|
result.errors.push(mapper(issue2));
|
|
3199
3210
|
continue;
|
|
@@ -3232,8 +3243,8 @@ function treeifyError(error62, mapper = (issue2) => issue2.message) {
|
|
|
3232
3243
|
}
|
|
3233
3244
|
function toDotPath(_path) {
|
|
3234
3245
|
const segs = [];
|
|
3235
|
-
const
|
|
3236
|
-
for (const seg of
|
|
3246
|
+
const path18 = _path.map((seg) => typeof seg === "object" ? seg.key : seg);
|
|
3247
|
+
for (const seg of path18) {
|
|
3237
3248
|
if (typeof seg === "number")
|
|
3238
3249
|
segs.push(`[${seg}]`);
|
|
3239
3250
|
else if (typeof seg === "symbol")
|
|
@@ -20371,13 +20382,13 @@ function resolveRef(ref, ctx) {
|
|
|
20371
20382
|
if (!ref.startsWith("#")) {
|
|
20372
20383
|
throw new Error("External $ref is not supported, only local refs (#/...) are allowed");
|
|
20373
20384
|
}
|
|
20374
|
-
const
|
|
20375
|
-
if (
|
|
20385
|
+
const path18 = ref.slice(1).split("/").filter(Boolean);
|
|
20386
|
+
if (path18.length === 0) {
|
|
20376
20387
|
return ctx.rootSchema;
|
|
20377
20388
|
}
|
|
20378
20389
|
const defsKey = ctx.version === "draft-2020-12" ? "$defs" : "definitions";
|
|
20379
|
-
if (
|
|
20380
|
-
const key =
|
|
20390
|
+
if (path18[0] === defsKey) {
|
|
20391
|
+
const key = path18[1] === void 0 ? void 0 : decodeJSONPointerSegment(path18[1]);
|
|
20381
20392
|
if (!key || !ctx.defs[key]) {
|
|
20382
20393
|
throw new Error(`Reference not found: ${ref}`);
|
|
20383
20394
|
}
|
|
@@ -21497,7 +21508,7 @@ function parseNowOptions(args, bin) {
|
|
|
21497
21508
|
|
|
21498
21509
|
// src/commands/skills/GitExclude.ts
|
|
21499
21510
|
import fs2 from "fs/promises";
|
|
21500
|
-
import
|
|
21511
|
+
import path5 from "path";
|
|
21501
21512
|
var START = "# >>> zion skills (private)";
|
|
21502
21513
|
var END = "# <<< zion skills (private)";
|
|
21503
21514
|
var GitExclude = class {
|
|
@@ -21517,9 +21528,9 @@ var GitExclude = class {
|
|
|
21517
21528
|
throw new CliError("This folder is not in a git repository", "private skills need one");
|
|
21518
21529
|
}
|
|
21519
21530
|
const { file: file2, root } = located;
|
|
21520
|
-
const prefix =
|
|
21531
|
+
const prefix = path5.relative(root, await fs2.realpath(this.dir));
|
|
21521
21532
|
const lines = paths.map(
|
|
21522
|
-
(target) => `/${
|
|
21533
|
+
(target) => `/${path5.join(prefix, path5.relative(this.dir, target)).split(path5.sep).join("/")}`
|
|
21523
21534
|
);
|
|
21524
21535
|
const current = await fs2.readFile(file2, "utf8").catch((error62) => {
|
|
21525
21536
|
if (errorCode(error62) === "ENOENT") return "";
|
|
@@ -21528,13 +21539,13 @@ var GitExclude = class {
|
|
|
21528
21539
|
const kept = withoutBlock(current.split("\n"));
|
|
21529
21540
|
while (kept.at(-1) === "") kept.pop();
|
|
21530
21541
|
const next = [...kept, ...lines.length > 0 ? [START, ...lines, END] : []];
|
|
21531
|
-
await fs2.mkdir(
|
|
21542
|
+
await fs2.mkdir(path5.dirname(file2), { recursive: true });
|
|
21532
21543
|
await fs2.writeFile(file2, next.length > 0 ? `${next.join("\n")}
|
|
21533
21544
|
` : "");
|
|
21534
|
-
const relative2 = paths.map((target) =>
|
|
21545
|
+
const relative2 = paths.map((target) => path5.relative(this.dir, target));
|
|
21535
21546
|
const files = await this.git.tracked(this.dir, relative2);
|
|
21536
21547
|
return paths.filter(
|
|
21537
|
-
(_, i) => files.some((tracked) => tracked === relative2[i] || tracked.startsWith(`${relative2[i]}${
|
|
21548
|
+
(_, i) => files.some((tracked) => tracked === relative2[i] || tracked.startsWith(`${relative2[i]}${path5.sep}`))
|
|
21538
21549
|
);
|
|
21539
21550
|
}
|
|
21540
21551
|
};
|
|
@@ -21625,12 +21636,12 @@ var HttpSkillsApi = class {
|
|
|
21625
21636
|
if (error62 instanceof HttpStatusError && error62.status === 404) throw new SkillNotFoundError(name);
|
|
21626
21637
|
throw error62;
|
|
21627
21638
|
}
|
|
21628
|
-
const files = body.files.map(({ path:
|
|
21639
|
+
const files = body.files.map(({ path: path18, sha, executable, content }) => {
|
|
21629
21640
|
const bytes = Buffer.from(content, "base64");
|
|
21630
21641
|
if (gitBlobSha(bytes) !== sha) {
|
|
21631
|
-
throw new CliError(`${this.host} sent a damaged copy of ${name}/${
|
|
21642
|
+
throw new CliError(`${this.host} sent a damaged copy of ${name}/${path18}`, "try again in a moment");
|
|
21632
21643
|
}
|
|
21633
|
-
return { path:
|
|
21644
|
+
return { path: path18, sha, executable, content: bytes };
|
|
21634
21645
|
});
|
|
21635
21646
|
return { name, commit: body.commit, tree: gitTreeShaOfFiles(files), files };
|
|
21636
21647
|
}
|
|
@@ -21717,8 +21728,8 @@ var GithubSkillsApi = class {
|
|
|
21717
21728
|
return latest?.sha ?? null;
|
|
21718
21729
|
}
|
|
21719
21730
|
/** `unreachable` says a 404 means the repository itself can't be read, not just the thing asked for. */
|
|
21720
|
-
async read(
|
|
21721
|
-
const url2 = new URL(`https://api.github.com/repos/${this.repo}${
|
|
21731
|
+
async read(path18, schema, failure2, signal, unreachable = false) {
|
|
21732
|
+
const url2 = new URL(`https://api.github.com/repos/${this.repo}${path18}`);
|
|
21722
21733
|
try {
|
|
21723
21734
|
return await getJson(this.fetchImpl, {
|
|
21724
21735
|
url: url2,
|
|
@@ -21784,7 +21795,7 @@ async function inBatches(items, work, size = 8) {
|
|
|
21784
21795
|
|
|
21785
21796
|
// src/commands/skills/SkillFiles.ts
|
|
21786
21797
|
import fs3 from "fs/promises";
|
|
21787
|
-
import
|
|
21798
|
+
import path6 from "path";
|
|
21788
21799
|
var NOISE = /* @__PURE__ */ new Set([".DS_Store"]);
|
|
21789
21800
|
var NodeSkillFiles = class {
|
|
21790
21801
|
async exists(dir) {
|
|
@@ -21802,7 +21813,7 @@ var NodeSkillFiles = class {
|
|
|
21802
21813
|
await fs3.rm(dir, { recursive: true, force: true });
|
|
21803
21814
|
for (const [i, file2] of files.entries()) {
|
|
21804
21815
|
const target = targets[i];
|
|
21805
|
-
await fs3.mkdir(
|
|
21816
|
+
await fs3.mkdir(path6.dirname(target), { recursive: true });
|
|
21806
21817
|
await fs3.writeFile(target, file2.content, { mode: file2.executable ? 493 : 420 });
|
|
21807
21818
|
}
|
|
21808
21819
|
}
|
|
@@ -21811,9 +21822,9 @@ var NodeSkillFiles = class {
|
|
|
21811
21822
|
}
|
|
21812
21823
|
async link(dir, target) {
|
|
21813
21824
|
await fs3.rm(dir, { recursive: true, force: true });
|
|
21814
|
-
await fs3.mkdir(
|
|
21825
|
+
await fs3.mkdir(path6.dirname(dir), { recursive: true });
|
|
21815
21826
|
const windows = process.platform === "win32";
|
|
21816
|
-
await fs3.symlink(windows ? target :
|
|
21827
|
+
await fs3.symlink(windows ? target : path6.relative(path6.dirname(dir), target), dir, windows ? "junction" : "dir");
|
|
21817
21828
|
}
|
|
21818
21829
|
};
|
|
21819
21830
|
var UNREADABLE = "unreadable";
|
|
@@ -21821,7 +21832,7 @@ async function hashDirectory(dir) {
|
|
|
21821
21832
|
const entries = [];
|
|
21822
21833
|
for (const entry of await fs3.readdir(dir, { withFileTypes: true })) {
|
|
21823
21834
|
if (NOISE.has(entry.name)) continue;
|
|
21824
|
-
const absolute =
|
|
21835
|
+
const absolute = path6.join(dir, entry.name);
|
|
21825
21836
|
if (entry.isDirectory()) {
|
|
21826
21837
|
const sha = await hashDirectory(absolute);
|
|
21827
21838
|
if (sha) entries.push({ name: entry.name, mode: DIRECTORY_MODE, sha });
|
|
@@ -21839,18 +21850,18 @@ async function hashDirectory(dir) {
|
|
|
21839
21850
|
return entries.length > 0 ? gitTreeSha(entries) : null;
|
|
21840
21851
|
}
|
|
21841
21852
|
function inside(dir, relative2) {
|
|
21842
|
-
const target =
|
|
21843
|
-
if (relative2.includes("\0") ||
|
|
21853
|
+
const target = path6.resolve(dir, relative2);
|
|
21854
|
+
if (relative2.includes("\0") || path6.isAbsolute(relative2) || !target.startsWith(path6.resolve(dir) + path6.sep)) {
|
|
21844
21855
|
throw new CliError(`Refusing to write ${relative2}`, `it would land outside ${tildify(dir)}`);
|
|
21845
21856
|
}
|
|
21846
21857
|
return target;
|
|
21847
21858
|
}
|
|
21848
21859
|
|
|
21849
21860
|
// src/commands/skills/SkillsCommand.ts
|
|
21850
|
-
import
|
|
21861
|
+
import path13 from "path";
|
|
21851
21862
|
|
|
21852
21863
|
// src/commands/skills/InstallFlow.ts
|
|
21853
|
-
import
|
|
21864
|
+
import path10 from "path";
|
|
21854
21865
|
|
|
21855
21866
|
// src/commands/skills/chooseMode.ts
|
|
21856
21867
|
async function chooseLink(ui, { store }, given, linked = false) {
|
|
@@ -21867,13 +21878,13 @@ async function chooseLink(ui, { store }, given, linked = false) {
|
|
|
21867
21878
|
}
|
|
21868
21879
|
|
|
21869
21880
|
// src/commands/skills/chooseTargets.ts
|
|
21870
|
-
import
|
|
21881
|
+
import path8 from "path";
|
|
21871
21882
|
|
|
21872
21883
|
// src/commands/skills/copies.ts
|
|
21873
|
-
import
|
|
21884
|
+
import path7 from "path";
|
|
21874
21885
|
var EDITED = "edited since zion installed it";
|
|
21875
21886
|
async function installedDirs({ files, targets }, name) {
|
|
21876
|
-
const dirs = targets.map((target) =>
|
|
21887
|
+
const dirs = targets.map((target) => path7.join(target.dir, name));
|
|
21877
21888
|
const present = await Promise.all(dirs.map((dir) => files.exists(dir)));
|
|
21878
21889
|
return dirs.filter((_, i) => present[i]);
|
|
21879
21890
|
}
|
|
@@ -21911,7 +21922,7 @@ async function confirmConflicts(ui, copies, { yes: yes2, retry }) {
|
|
|
21911
21922
|
async function writeCopies({ files, lockfile, store }, skills, copies, hidden = /* @__PURE__ */ new Map()) {
|
|
21912
21923
|
for (const skill of skills) {
|
|
21913
21924
|
const mine = copiesOf(skill, copies);
|
|
21914
|
-
const home =
|
|
21925
|
+
const home = path7.join(store, skill.name);
|
|
21915
21926
|
if (mine.some((copy) => copy.link)) await files.write(home, skill.files);
|
|
21916
21927
|
for (const copy of mine) {
|
|
21917
21928
|
if (copy.link) await files.link(copy.dir, home);
|
|
@@ -21945,7 +21956,7 @@ function copiesOf(skill, copies) {
|
|
|
21945
21956
|
return copies.filter((copy) => copy.skill === skill);
|
|
21946
21957
|
}
|
|
21947
21958
|
function describeDirs(dirs) {
|
|
21948
|
-
return dirs.map((dir) => tildify(
|
|
21959
|
+
return dirs.map((dir) => tildify(path7.dirname(dir))).join(", ");
|
|
21949
21960
|
}
|
|
21950
21961
|
function isNewer(latest, locked) {
|
|
21951
21962
|
return Boolean(latest && locked && latest.commit !== locked.commit);
|
|
@@ -21963,7 +21974,7 @@ async function chooseTargets(ui, deps, given, lock) {
|
|
|
21963
21974
|
return chosen;
|
|
21964
21975
|
}
|
|
21965
21976
|
const installed = await Promise.all(Object.keys(lock.skills).map((name) => installedDirs(deps, name)));
|
|
21966
|
-
const used = new Set(installed.flat().map((dir) =>
|
|
21977
|
+
const used = new Set(installed.flat().map((dir) => path8.dirname(dir)));
|
|
21967
21978
|
let suggested = targets.filter((target) => used.has(target.dir));
|
|
21968
21979
|
if (suggested.length === 0) {
|
|
21969
21980
|
const present = await Promise.all(targets.map((target) => files.exists(target.home)));
|
|
@@ -21977,12 +21988,12 @@ async function chooseTargets(ui, deps, given, lock) {
|
|
|
21977
21988
|
});
|
|
21978
21989
|
}
|
|
21979
21990
|
function shown(dir) {
|
|
21980
|
-
const relative2 =
|
|
21981
|
-
return relative2.startsWith("..") ||
|
|
21991
|
+
const relative2 = path8.relative(process.cwd(), dir);
|
|
21992
|
+
return relative2.startsWith("..") || path8.isAbsolute(relative2) ? tildify(dir) : `./${relative2}`;
|
|
21982
21993
|
}
|
|
21983
21994
|
|
|
21984
21995
|
// src/commands/skills/privacy.ts
|
|
21985
|
-
import
|
|
21996
|
+
import path9 from "path";
|
|
21986
21997
|
async function syncExclude(deps) {
|
|
21987
21998
|
const { exclude, lockfile, store } = deps;
|
|
21988
21999
|
if (!exclude) return [];
|
|
@@ -21990,16 +22001,16 @@ async function syncExclude(deps) {
|
|
|
21990
22001
|
const names = Object.keys(skills);
|
|
21991
22002
|
const hidden = names.filter((name) => skills[name].private);
|
|
21992
22003
|
const paths = (await Promise.all(hidden.map((name) => installedDirs(deps, name)))).flat();
|
|
21993
|
-
if (hidden.length > 0 && hidden.length === names.length) paths.push(
|
|
22004
|
+
if (hidden.length > 0 && hidden.length === names.length) paths.push(path9.dirname(lockfile.path));
|
|
21994
22005
|
else {
|
|
21995
|
-
paths.push(...hidden.filter((name) => skills[name].link).map((name) =>
|
|
22006
|
+
paths.push(...hidden.filter((name) => skills[name].link).map((name) => path9.join(store, name)));
|
|
21996
22007
|
if (hidden.length > 0 && lockfile.hiddenPath) paths.push(lockfile.hiddenPath);
|
|
21997
22008
|
}
|
|
21998
22009
|
return exclude.write(paths);
|
|
21999
22010
|
}
|
|
22000
22011
|
function warnTracked(ui, tracked) {
|
|
22001
22012
|
if (tracked.length === 0) return;
|
|
22002
|
-
const shown2 = tracked.map((target) =>
|
|
22013
|
+
const shown2 = tracked.map((target) => path9.relative(process.cwd(), target) || ".");
|
|
22003
22014
|
ui.step({
|
|
22004
22015
|
title: `${plural(tracked.length, "path")} already tracked by git`,
|
|
22005
22016
|
tone: "warning",
|
|
@@ -22059,7 +22070,7 @@ var InstallFlow = class {
|
|
|
22059
22070
|
this.deps,
|
|
22060
22071
|
skill,
|
|
22061
22072
|
lock.skills[skill.name],
|
|
22062
|
-
dirs.map((dir) =>
|
|
22073
|
+
dirs.map((dir) => path10.join(dir, skill.name)),
|
|
22063
22074
|
link
|
|
22064
22075
|
)
|
|
22065
22076
|
)
|
|
@@ -22146,15 +22157,15 @@ var InstallFlow = class {
|
|
|
22146
22157
|
};
|
|
22147
22158
|
|
|
22148
22159
|
// src/commands/skills/ManageFlow.ts
|
|
22149
|
-
import
|
|
22160
|
+
import path12 from "path";
|
|
22150
22161
|
|
|
22151
22162
|
// src/commands/skills/removals.ts
|
|
22152
|
-
import
|
|
22163
|
+
import path11 from "path";
|
|
22153
22164
|
async function planRemovals(deps, lock, names, only) {
|
|
22154
22165
|
const removals = [];
|
|
22155
22166
|
for (const name of names) {
|
|
22156
22167
|
for (const dir of await installedDirs(deps, name)) {
|
|
22157
|
-
if (only && !only.has(
|
|
22168
|
+
if (only && !only.has(path11.dirname(dir))) continue;
|
|
22158
22169
|
removals.push({ name, dir, edited: !isUnchanged(await deps.files.treeSha(dir), lock.skills[name].tree) });
|
|
22159
22170
|
}
|
|
22160
22171
|
}
|
|
@@ -22164,7 +22175,7 @@ async function applyRemovals(deps, names, removals) {
|
|
|
22164
22175
|
for (const removal of removals) await deps.files.remove(removal.dir);
|
|
22165
22176
|
for (const name of names) {
|
|
22166
22177
|
if ((await installedDirs(deps, name)).length > 0) continue;
|
|
22167
|
-
await deps.files.remove(
|
|
22178
|
+
await deps.files.remove(path11.join(deps.store, name));
|
|
22168
22179
|
await deps.lockfile.update((data) => {
|
|
22169
22180
|
delete data.skills[name];
|
|
22170
22181
|
});
|
|
@@ -22238,7 +22249,7 @@ var ManageFlow = class {
|
|
|
22238
22249
|
this.deps,
|
|
22239
22250
|
skill,
|
|
22240
22251
|
void 0,
|
|
22241
|
-
targets.map((target) =>
|
|
22252
|
+
targets.map((target) => path12.join(target.dir, skill.name)),
|
|
22242
22253
|
link
|
|
22243
22254
|
)
|
|
22244
22255
|
)
|
|
@@ -22640,7 +22651,7 @@ async function showSkill({ api }, ctx, name) {
|
|
|
22640
22651
|
|
|
22641
22652
|
// src/commands/skills/SkillsCommand.ts
|
|
22642
22653
|
function relative(file2) {
|
|
22643
|
-
return `./${
|
|
22654
|
+
return `./${path13.relative(process.cwd(), file2)}`;
|
|
22644
22655
|
}
|
|
22645
22656
|
var SkillsCommand = class {
|
|
22646
22657
|
constructor(base) {
|
|
@@ -22733,26 +22744,26 @@ var SkillsCommand = class {
|
|
|
22733
22744
|
};
|
|
22734
22745
|
|
|
22735
22746
|
// src/commands/skills/targets.ts
|
|
22736
|
-
import
|
|
22747
|
+
import path14 from "path";
|
|
22737
22748
|
function skillTargets(homedir) {
|
|
22738
22749
|
return [
|
|
22739
22750
|
{
|
|
22740
22751
|
id: "agents",
|
|
22741
|
-
dir:
|
|
22742
|
-
home:
|
|
22752
|
+
dir: path14.join(homedir, ".agents", "skills"),
|
|
22753
|
+
home: path14.join(homedir, ".agents"),
|
|
22743
22754
|
name: "Universal"
|
|
22744
22755
|
},
|
|
22745
22756
|
{
|
|
22746
22757
|
id: "claude",
|
|
22747
|
-
dir:
|
|
22748
|
-
home:
|
|
22758
|
+
dir: path14.join(homedir, ".claude", "skills"),
|
|
22759
|
+
home: path14.join(homedir, ".claude"),
|
|
22749
22760
|
name: "Claude Code"
|
|
22750
22761
|
}
|
|
22751
22762
|
];
|
|
22752
22763
|
}
|
|
22753
22764
|
|
|
22754
22765
|
// src/services/Git.ts
|
|
22755
|
-
import
|
|
22766
|
+
import path15 from "path";
|
|
22756
22767
|
var GitError = class extends Error {
|
|
22757
22768
|
constructor(args, stderr) {
|
|
22758
22769
|
super(stderr.split("\n").pop() || `git ${args.join(" ")} failed`);
|
|
@@ -22780,7 +22791,7 @@ var CliGit = class {
|
|
|
22780
22791
|
async excludeFile(dir) {
|
|
22781
22792
|
const root = await this.topLevel(dir);
|
|
22782
22793
|
const file2 = root && await this.query(["-C", dir, "rev-parse", "--git-path", "info/exclude"]);
|
|
22783
|
-
return root && file2 ? { file:
|
|
22794
|
+
return root && file2 ? { file: path15.resolve(dir, file2), root } : null;
|
|
22784
22795
|
}
|
|
22785
22796
|
async tracked(dir, paths) {
|
|
22786
22797
|
if (paths.length === 0) return [];
|
|
@@ -22824,7 +22835,7 @@ var CliGit = class {
|
|
|
22824
22835
|
|
|
22825
22836
|
// src/services/Lockfile.ts
|
|
22826
22837
|
import fs4 from "fs/promises";
|
|
22827
|
-
import
|
|
22838
|
+
import path16 from "path";
|
|
22828
22839
|
var VERSION = 2;
|
|
22829
22840
|
var LockedSkill = external_exports.looseObject({
|
|
22830
22841
|
/** The last commit in zion-off/skills that changed this skill. */
|
|
@@ -22843,8 +22854,8 @@ var LockData = external_exports.looseObject({
|
|
|
22843
22854
|
});
|
|
22844
22855
|
var Versioned = jsonText(external_exports.looseObject({ version: external_exports.number() }));
|
|
22845
22856
|
var JsonLockfile = class {
|
|
22846
|
-
constructor(
|
|
22847
|
-
this.path =
|
|
22857
|
+
constructor(path18) {
|
|
22858
|
+
this.path = path18;
|
|
22848
22859
|
}
|
|
22849
22860
|
path;
|
|
22850
22861
|
async read() {
|
|
@@ -22876,7 +22887,7 @@ var JsonLockfile = class {
|
|
|
22876
22887
|
return data.data;
|
|
22877
22888
|
}
|
|
22878
22889
|
async write(data) {
|
|
22879
|
-
await fs4.mkdir(
|
|
22890
|
+
await fs4.mkdir(path16.dirname(this.path), { recursive: true });
|
|
22880
22891
|
const temporary = `${this.path}.${process.pid}.tmp`;
|
|
22881
22892
|
try {
|
|
22882
22893
|
await fs4.writeFile(temporary, JSON.stringify(data, null, 2) + "\n");
|
|
@@ -22893,16 +22904,16 @@ var JsonLockfile = class {
|
|
|
22893
22904
|
);
|
|
22894
22905
|
}
|
|
22895
22906
|
};
|
|
22896
|
-
function describeIssue({ path:
|
|
22897
|
-
if (
|
|
22898
|
-
if (
|
|
22899
|
-
return `"${
|
|
22907
|
+
function describeIssue({ path: path18, code }) {
|
|
22908
|
+
if (path18.length === 0) return code === "custom" ? "it is not valid JSON" : "it is not an object";
|
|
22909
|
+
if (path18[0] === "version") return `its version isn't ${VERSION}`;
|
|
22910
|
+
return `"${path18.join(".")}" is not valid`;
|
|
22900
22911
|
}
|
|
22901
22912
|
var SplitLockfile = class {
|
|
22902
|
-
constructor(
|
|
22903
|
-
this.path =
|
|
22913
|
+
constructor(path18, hiddenPath) {
|
|
22914
|
+
this.path = path18;
|
|
22904
22915
|
this.hiddenPath = hiddenPath;
|
|
22905
|
-
this.shared = new JsonLockfile(
|
|
22916
|
+
this.shared = new JsonLockfile(path18);
|
|
22906
22917
|
this.local = new JsonLockfile(hiddenPath);
|
|
22907
22918
|
}
|
|
22908
22919
|
path;
|
|
@@ -22982,14 +22993,6 @@ var NodeProcessRunner = class {
|
|
|
22982
22993
|
}
|
|
22983
22994
|
};
|
|
22984
22995
|
|
|
22985
|
-
// src/services/xdg.ts
|
|
22986
|
-
import os2 from "os";
|
|
22987
|
-
import path15 from "path";
|
|
22988
|
-
function stateHome(env) {
|
|
22989
|
-
const base = env.XDG_STATE_HOME;
|
|
22990
|
-
return base && path15.isAbsolute(base) ? base : path15.join(os2.homedir(), ".local", "state");
|
|
22991
|
-
}
|
|
22992
|
-
|
|
22993
22996
|
// src/cli.tsx
|
|
22994
22997
|
for (const stream of [process.stdout, process.stderr]) {
|
|
22995
22998
|
stream.on("error", (error62) => {
|
|
@@ -23005,7 +23008,7 @@ var registry2 = new CommandRegistry().register(
|
|
|
23005
23008
|
slug: "zion-off/dotfiles",
|
|
23006
23009
|
url: "https://github.com/zion-off/dotfiles.git",
|
|
23007
23010
|
installer: "bin/dot",
|
|
23008
|
-
installerLink:
|
|
23011
|
+
installerLink: path17.join(os3.homedir(), ".local", "bin", "dot")
|
|
23009
23012
|
}),
|
|
23010
23013
|
git,
|
|
23011
23014
|
runner,
|
|
@@ -23021,17 +23024,17 @@ var registry2 = new CommandRegistry().register(
|
|
|
23021
23024
|
files: new NodeSkillFiles(),
|
|
23022
23025
|
scopes: {
|
|
23023
23026
|
global: {
|
|
23024
|
-
lockfile: new JsonLockfile(
|
|
23027
|
+
lockfile: new JsonLockfile(path17.join(stateHome(process.env), "zion", "zion.json")),
|
|
23025
23028
|
targets: skillTargets(os3.homedir()),
|
|
23026
|
-
store:
|
|
23029
|
+
store: path17.join(stateHome(process.env), "zion", "skills")
|
|
23027
23030
|
},
|
|
23028
23031
|
project: {
|
|
23029
23032
|
lockfile: new SplitLockfile(
|
|
23030
|
-
|
|
23031
|
-
|
|
23033
|
+
path17.join(process.cwd(), ".zion", "zion.json"),
|
|
23034
|
+
path17.join(process.cwd(), ".zion", "private.json")
|
|
23032
23035
|
),
|
|
23033
23036
|
targets: skillTargets(process.cwd()),
|
|
23034
|
-
store:
|
|
23037
|
+
store: path17.join(process.cwd(), ".zion", "skills"),
|
|
23035
23038
|
exclude: new GitExclude(git, process.cwd())
|
|
23036
23039
|
}
|
|
23037
23040
|
},
|