zion 4.1.0 → 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 +77 -23
- 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";
|
|
@@ -478,6 +478,7 @@ var STOCK = "#ece6d6";
|
|
|
478
478
|
var INK = "#1f1d1a";
|
|
479
479
|
var SOFT = "#7d776b";
|
|
480
480
|
var BORDER = "#4d4a44";
|
|
481
|
+
var GRAIN = 14;
|
|
481
482
|
var WIDTH = 52;
|
|
482
483
|
var HEIGHT = 13;
|
|
483
484
|
var MARGIN = " ";
|
|
@@ -491,17 +492,17 @@ ${[name, null, email3].map((segment) => segment ? `${MARGIN}${draw(paint, segmen
|
|
|
491
492
|
`;
|
|
492
493
|
}
|
|
493
494
|
const inner = WIDTH - 2;
|
|
494
|
-
|
|
495
|
-
const rows = Array.from({ length: HEIGHT - 2 }, () => blank);
|
|
496
|
-
rows[3] = centered(paint, name, inner);
|
|
497
|
-
rows[7] = centered(paint, email3, inner);
|
|
498
|
-
if (paint.enabled) {
|
|
499
|
-
const stock = paint.bgHex(STOCK);
|
|
495
|
+
if (paint.enabled)
|
|
500
496
|
return `
|
|
501
|
-
${
|
|
497
|
+
${stock(paint, inner, [
|
|
498
|
+
[3, name],
|
|
499
|
+
[7, email3]
|
|
500
|
+
]).join("\n")}
|
|
502
501
|
|
|
503
502
|
`;
|
|
504
|
-
}
|
|
503
|
+
const rows = Array.from({ length: HEIGHT - 2 }, () => " ".repeat(inner));
|
|
504
|
+
rows[3] = centered(paint, name, inner);
|
|
505
|
+
rows[7] = centered(paint, email3, inner);
|
|
505
506
|
const edge = paint.hex(BORDER);
|
|
506
507
|
return `
|
|
507
508
|
${[
|
|
@@ -512,6 +513,42 @@ ${[
|
|
|
512
513
|
|
|
513
514
|
`;
|
|
514
515
|
}
|
|
516
|
+
function stock(paint, inner, lines) {
|
|
517
|
+
const placed = new Map(lines.map(([row, segment]) => [row + 1, segment]));
|
|
518
|
+
const ground = paint.bgHex(STOCK);
|
|
519
|
+
return Array.from({ length: HEIGHT }, (_, y) => {
|
|
520
|
+
const segment = placed.get(y);
|
|
521
|
+
const start = segment ? Math.floor((inner - segment.text.length) / 2) : -1;
|
|
522
|
+
let row = "";
|
|
523
|
+
for (let x = 0; x < inner; x++) {
|
|
524
|
+
if (segment && x === start) {
|
|
525
|
+
row += draw(paint, segment);
|
|
526
|
+
x += segment.text.length - 1;
|
|
527
|
+
continue;
|
|
528
|
+
}
|
|
529
|
+
const beside = segment && x >= start - 1 && x <= start + segment.text.length;
|
|
530
|
+
row += beside ? " " : fiber(paint, x, y);
|
|
531
|
+
}
|
|
532
|
+
return `${MARGIN}${ground(row)}`;
|
|
533
|
+
});
|
|
534
|
+
}
|
|
535
|
+
var FIBERS = ["\xB7", "\u02D9", ".", ",", "'", "`", "\xB8", "\u02DB"];
|
|
536
|
+
var DENSITY = 0.3;
|
|
537
|
+
function fiber(paint, x, y) {
|
|
538
|
+
if (noise(x, y) > DENSITY) return " ";
|
|
539
|
+
const glyph = FIBERS[Math.floor(noise(x * 1.7, y * 3.1) * FIBERS.length)];
|
|
540
|
+
return paint.hex(shade(STOCK, 1 + noise(x * 2.3, y * 0.7)))(glyph);
|
|
541
|
+
}
|
|
542
|
+
function noise(x, y) {
|
|
543
|
+
const n = Math.sin(x * 12.9898 + y * 78.233) * 43758.5453;
|
|
544
|
+
return n - Math.floor(n);
|
|
545
|
+
}
|
|
546
|
+
function shade(hex3, amount) {
|
|
547
|
+
const step = amount * GRAIN;
|
|
548
|
+
return `#${[1, 3, 5].map((at, i) => parseInt(hex3.slice(at, at + 2), 16) - step * (i === 2 ? 1.25 : 1)).map(
|
|
549
|
+
(c) => Math.round(Math.min(255, Math.max(0, c))).toString(16).padStart(2, "0")
|
|
550
|
+
).join("")}`;
|
|
551
|
+
}
|
|
515
552
|
function centered(paint, segment, inner) {
|
|
516
553
|
const before = Math.floor((inner - segment.text.length) / 2);
|
|
517
554
|
return `${" ".repeat(before)}${draw(paint, segment)}${" ".repeat(inner - before - segment.text.length)}`;
|
|
@@ -21498,7 +21535,9 @@ function inside(dir, relative) {
|
|
|
21498
21535
|
|
|
21499
21536
|
// src/commands/skills/SkillsApi.ts
|
|
21500
21537
|
var SKILL_NAME = /^\w[\w.-]*$/;
|
|
21501
|
-
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
|
+
});
|
|
21502
21541
|
var SkillBody = external_exports.object({
|
|
21503
21542
|
commit: external_exports.string(),
|
|
21504
21543
|
updatedAt: external_exports.string(),
|
|
@@ -21523,10 +21562,18 @@ var HttpSkillsApi = class {
|
|
|
21523
21562
|
return this.base.host;
|
|
21524
21563
|
}
|
|
21525
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) {
|
|
21526
21573
|
const url2 = new URL(this.base);
|
|
21527
21574
|
if (include.length > 0) url2.searchParams.set("include", include.join(","));
|
|
21528
21575
|
const { skills } = await getJson(this.fetchImpl, { url: url2, schema: SkillList, failure: "send the skills", signal });
|
|
21529
|
-
return skills
|
|
21576
|
+
return skills;
|
|
21530
21577
|
}
|
|
21531
21578
|
async get(name, signal) {
|
|
21532
21579
|
if (!SKILL_NAME.test(name)) throw new SkillNotFoundError(name);
|
|
@@ -22021,17 +22068,7 @@ var UpdateFlow = class {
|
|
|
22021
22068
|
const pick2 = ctx.interactive && options.names.length === 0 && !options.yes;
|
|
22022
22069
|
const checks = await ui.task(
|
|
22023
22070
|
`Checking ${plural(names.length, "skill")} for updates`,
|
|
22024
|
-
(signal) =>
|
|
22025
|
-
names.map(async (name) => {
|
|
22026
|
-
const locked = lock.skills[name];
|
|
22027
|
-
try {
|
|
22028
|
-
return { name, locked, latest: await api.get(name, signal) };
|
|
22029
|
-
} catch (error62) {
|
|
22030
|
-
if (error62 instanceof SkillNotFoundError) return { name, locked, latest: null };
|
|
22031
|
-
throw error62;
|
|
22032
|
-
}
|
|
22033
|
-
})
|
|
22034
|
-
),
|
|
22071
|
+
(signal) => this.check(names, lock.skills, signal),
|
|
22035
22072
|
(checks2) => describeChecks(ctx.paint.stderr, checks2, { listUpdates: !pick2 })
|
|
22036
22073
|
);
|
|
22037
22074
|
const outdated = checks.filter(isOutdated);
|
|
@@ -22054,6 +22091,23 @@ var UpdateFlow = class {
|
|
|
22054
22091
|
ui.outro(`Updated ${plural(chosen.length, "skill")}.`, { lines: ["Start a new agent session to use them."] });
|
|
22055
22092
|
return 0;
|
|
22056
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
|
+
}
|
|
22057
22111
|
async chooseUpdates(ui, outdated) {
|
|
22058
22112
|
const width = Math.max(...outdated.map((check2) => shortCommit(check2.locked.commit).length));
|
|
22059
22113
|
return ui.multiselect({
|
|
@@ -22072,7 +22126,7 @@ function isOutdated(check2) {
|
|
|
22072
22126
|
}
|
|
22073
22127
|
function describeChecks(paint, checks, { listUpdates }) {
|
|
22074
22128
|
const updates = checks.filter(isOutdated);
|
|
22075
|
-
const gone = checks.filter((check2) =>
|
|
22129
|
+
const gone = checks.filter((check2) => check2.gone);
|
|
22076
22130
|
if (updates.length === 0 && gone.length === 0) return { title: "Up to date" };
|
|
22077
22131
|
const shown = [...listUpdates ? updates : [], ...gone];
|
|
22078
22132
|
const width = Math.max(0, ...shown.map((check2) => check2.name.length));
|