zion 4.1.1 → 4.1.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 +32 -15
- package/package.json +1 -1
package/dist/cli.js
CHANGED
|
@@ -8,7 +8,7 @@ import os3 from "os";
|
|
|
8
8
|
import path12 from "path";
|
|
9
9
|
|
|
10
10
|
// package.json
|
|
11
|
-
var version = "4.1.
|
|
11
|
+
var version = "4.1.2";
|
|
12
12
|
|
|
13
13
|
// src/lib/theme.ts
|
|
14
14
|
import { Chalk, supportsColor, supportsColorStderr } from "chalk";
|
|
@@ -21535,7 +21535,9 @@ function inside(dir, relative) {
|
|
|
21535
21535
|
|
|
21536
21536
|
// src/commands/skills/SkillsApi.ts
|
|
21537
21537
|
var SKILL_NAME = /^\w[\w.-]*$/;
|
|
21538
|
-
var SkillList = external_exports.object({
|
|
21538
|
+
var SkillList = external_exports.object({
|
|
21539
|
+
skills: external_exports.array(external_exports.object({ name: external_exports.string().regex(SKILL_NAME), commit: external_exports.string().nullable().optional() }))
|
|
21540
|
+
});
|
|
21539
21541
|
var SkillBody = external_exports.object({
|
|
21540
21542
|
commit: external_exports.string(),
|
|
21541
21543
|
updatedAt: external_exports.string(),
|
|
@@ -21560,10 +21562,18 @@ var HttpSkillsApi = class {
|
|
|
21560
21562
|
return this.base.host;
|
|
21561
21563
|
}
|
|
21562
21564
|
async list({ include = [], signal } = {}) {
|
|
21565
|
+
return (await this.listWithCommits(include, signal)).map((skill) => skill.name);
|
|
21566
|
+
}
|
|
21567
|
+
async latestCommits(names, signal) {
|
|
21568
|
+
const wanted = new Set(names);
|
|
21569
|
+
const skills = await this.listWithCommits(names, signal);
|
|
21570
|
+
return new Map(skills.filter((skill) => wanted.has(skill.name)).map((skill) => [skill.name, skill.commit ?? null]));
|
|
21571
|
+
}
|
|
21572
|
+
async listWithCommits(include, signal) {
|
|
21563
21573
|
const url2 = new URL(this.base);
|
|
21564
21574
|
if (include.length > 0) url2.searchParams.set("include", include.join(","));
|
|
21565
21575
|
const { skills } = await getJson(this.fetchImpl, { url: url2, schema: SkillList, failure: "send the skills", signal });
|
|
21566
|
-
return skills
|
|
21576
|
+
return skills;
|
|
21567
21577
|
}
|
|
21568
21578
|
async get(name, signal) {
|
|
21569
21579
|
if (!SKILL_NAME.test(name)) throw new SkillNotFoundError(name);
|
|
@@ -22058,17 +22068,7 @@ var UpdateFlow = class {
|
|
|
22058
22068
|
const pick2 = ctx.interactive && options.names.length === 0 && !options.yes;
|
|
22059
22069
|
const checks = await ui.task(
|
|
22060
22070
|
`Checking ${plural(names.length, "skill")} for updates`,
|
|
22061
|
-
(signal) =>
|
|
22062
|
-
names.map(async (name) => {
|
|
22063
|
-
const locked = lock.skills[name];
|
|
22064
|
-
try {
|
|
22065
|
-
return { name, locked, latest: await api.get(name, signal) };
|
|
22066
|
-
} catch (error62) {
|
|
22067
|
-
if (error62 instanceof SkillNotFoundError) return { name, locked, latest: null };
|
|
22068
|
-
throw error62;
|
|
22069
|
-
}
|
|
22070
|
-
})
|
|
22071
|
-
),
|
|
22071
|
+
(signal) => this.check(names, lock.skills, signal),
|
|
22072
22072
|
(checks2) => describeChecks(ctx.paint.stderr, checks2, { listUpdates: !pick2 })
|
|
22073
22073
|
);
|
|
22074
22074
|
const outdated = checks.filter(isOutdated);
|
|
@@ -22091,6 +22091,23 @@ var UpdateFlow = class {
|
|
|
22091
22091
|
ui.outro(`Updated ${plural(chosen.length, "skill")}.`, { lines: ["Start a new agent session to use them."] });
|
|
22092
22092
|
return 0;
|
|
22093
22093
|
}
|
|
22094
|
+
// Only skills whose commit differs from the locked one are downloaded.
|
|
22095
|
+
async check(names, locks, signal) {
|
|
22096
|
+
const commits = await this.deps.api.latestCommits(names, signal);
|
|
22097
|
+
return Promise.all(
|
|
22098
|
+
names.map(async (name) => {
|
|
22099
|
+
const locked = locks[name];
|
|
22100
|
+
if (commits.has(name) && commits.get(name) === locked.commit)
|
|
22101
|
+
return { name, locked, latest: null, gone: false };
|
|
22102
|
+
try {
|
|
22103
|
+
return { name, locked, latest: await this.deps.api.get(name, signal), gone: false };
|
|
22104
|
+
} catch (error62) {
|
|
22105
|
+
if (error62 instanceof SkillNotFoundError) return { name, locked, latest: null, gone: true };
|
|
22106
|
+
throw error62;
|
|
22107
|
+
}
|
|
22108
|
+
})
|
|
22109
|
+
);
|
|
22110
|
+
}
|
|
22094
22111
|
async chooseUpdates(ui, outdated) {
|
|
22095
22112
|
const width = Math.max(...outdated.map((check2) => shortCommit(check2.locked.commit).length));
|
|
22096
22113
|
return ui.multiselect({
|
|
@@ -22109,7 +22126,7 @@ function isOutdated(check2) {
|
|
|
22109
22126
|
}
|
|
22110
22127
|
function describeChecks(paint, checks, { listUpdates }) {
|
|
22111
22128
|
const updates = checks.filter(isOutdated);
|
|
22112
|
-
const gone = checks.filter((check2) =>
|
|
22129
|
+
const gone = checks.filter((check2) => check2.gone);
|
|
22113
22130
|
if (updates.length === 0 && gone.length === 0) return { title: "Up to date" };
|
|
22114
22131
|
const shown = [...listUpdates ? updates : [], ...gone];
|
|
22115
22132
|
const width = Math.max(0, ...shown.map((check2) => check2.name.length));
|