yourskills 0.3.1 → 0.4.0
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/main.js +223 -20
- package/package.json +1 -1
package/dist/main.js
CHANGED
|
@@ -925,15 +925,24 @@ function flattenCommands(groups) {
|
|
|
925
925
|
}
|
|
926
926
|
var POINTER = 2;
|
|
927
927
|
var GAP2 = 2;
|
|
928
|
+
var LABEL_CAP = 22;
|
|
929
|
+
function valueColumn(items) {
|
|
930
|
+
return Math.min(items.reduce((wide, item) => Math.max(wide, item.label.length), 0), LABEL_CAP);
|
|
931
|
+
}
|
|
928
932
|
function CommandRow({
|
|
929
933
|
item,
|
|
930
934
|
width,
|
|
935
|
+
column,
|
|
931
936
|
active
|
|
932
937
|
}) {
|
|
933
938
|
const hint = item.hint ?? "";
|
|
934
939
|
const room = width - POINTER - (hint ? hint.length + GAP2 : 0);
|
|
935
940
|
const label = clip(item.label, Math.max(room, 0));
|
|
936
|
-
const
|
|
941
|
+
const shows = item.shows ?? "";
|
|
942
|
+
const pad = Math.max(column - label.length, 0) + GAP2;
|
|
943
|
+
const value = shows && label.length + pad + shows.length <= room ? shows : "";
|
|
944
|
+
const left = label.length + (value ? pad + value.length : 0);
|
|
945
|
+
const gap = Math.max(width - POINTER - left - hint.length, hint ? 1 : 0);
|
|
937
946
|
return /* @__PURE__ */ jsxs5(Text4, {
|
|
938
947
|
children: [
|
|
939
948
|
/* @__PURE__ */ jsx5(Text4, {
|
|
@@ -945,6 +954,9 @@ function CommandRow({
|
|
|
945
954
|
color: active ? tone.primary : undefined,
|
|
946
955
|
children: label
|
|
947
956
|
}),
|
|
957
|
+
value ? /* @__PURE__ */ jsx5(Text4, {
|
|
958
|
+
children: `${" ".repeat(pad)}${value}`
|
|
959
|
+
}) : null,
|
|
948
960
|
/* @__PURE__ */ jsx5(Text4, {
|
|
949
961
|
dimColor: true,
|
|
950
962
|
children: `${" ".repeat(gap)}${hint}`
|
|
@@ -964,6 +976,7 @@ function CommandPalette({
|
|
|
964
976
|
const rows = flattenCommands(visible);
|
|
965
977
|
const current = rows[cursor];
|
|
966
978
|
const interior = width - FRAME_CHROME;
|
|
979
|
+
const column = valueColumn(rows);
|
|
967
980
|
return /* @__PURE__ */ jsxs5(Box3, {
|
|
968
981
|
flexDirection: "column",
|
|
969
982
|
children: [
|
|
@@ -998,6 +1011,7 @@ function CommandPalette({
|
|
|
998
1011
|
group.items.map((item) => /* @__PURE__ */ jsx5(CommandRow, {
|
|
999
1012
|
item,
|
|
1000
1013
|
width: interior,
|
|
1014
|
+
column,
|
|
1001
1015
|
active: item.value === current?.value
|
|
1002
1016
|
}, item.value))
|
|
1003
1017
|
]
|
|
@@ -5754,7 +5768,7 @@ import { realpathSync } from "node:fs";
|
|
|
5754
5768
|
// package.json
|
|
5755
5769
|
var package_default = {
|
|
5756
5770
|
name: "yourskills",
|
|
5757
|
-
version: "0.
|
|
5771
|
+
version: "0.4.0",
|
|
5758
5772
|
description: "Browse, install and keep up to date the agent skills and bundles your team publishes on yourskills.",
|
|
5759
5773
|
license: "UNLICENSED",
|
|
5760
5774
|
homepage: "https://yourskills.store",
|
|
@@ -6934,6 +6948,7 @@ function noSuchPass(id, passes) {
|
|
|
6934
6948
|
};
|
|
6935
6949
|
}
|
|
6936
6950
|
// src/commands/facts.ts
|
|
6951
|
+
var NO_FEED = {};
|
|
6937
6952
|
function count2(n, one, many = `${one}s`) {
|
|
6938
6953
|
return `${n} ${n === 1 ? one : many}`;
|
|
6939
6954
|
}
|
|
@@ -7026,6 +7041,7 @@ var TABLE = {
|
|
|
7026
7041
|
value: "catalog.bundles",
|
|
7027
7042
|
label: "browse bundles",
|
|
7028
7043
|
hint: "browse",
|
|
7044
|
+
shows: (facts) => facts.feed.bundles === undefined ? "" : count2(facts.feed.bundles, "bundle"),
|
|
7029
7045
|
when: (facts) => facts.signedIn,
|
|
7030
7046
|
opens: { kind: "browse" }
|
|
7031
7047
|
}
|
|
@@ -7132,6 +7148,7 @@ var TABLE = {
|
|
|
7132
7148
|
value: "account.org",
|
|
7133
7149
|
label: "switch org",
|
|
7134
7150
|
hint: "org <name>",
|
|
7151
|
+
shows: (facts) => facts.feed.organizations === undefined ? "" : facts.feed.organizations <= 1 ? "only this one" : count2(facts.feed.organizations - 1, "other"),
|
|
7135
7152
|
when: (facts) => facts.signedIn,
|
|
7136
7153
|
says: (facts) => facts.organization ? `switch this machine out of ${facts.organization}` : "choose which organization this machine installs from"
|
|
7137
7154
|
}
|
|
@@ -7156,6 +7173,7 @@ var TABLE = {
|
|
|
7156
7173
|
value: "catalog.skills",
|
|
7157
7174
|
label: "browse skills",
|
|
7158
7175
|
hint: "list",
|
|
7176
|
+
shows: (facts) => facts.feed.skills === undefined ? "" : count2(facts.feed.skills, "skill"),
|
|
7159
7177
|
when: (facts) => facts.signedIn,
|
|
7160
7178
|
opens: { kind: "list" }
|
|
7161
7179
|
}
|
|
@@ -7333,6 +7351,7 @@ var TABLE = {
|
|
|
7333
7351
|
value: "installed.update",
|
|
7334
7352
|
label: "update all",
|
|
7335
7353
|
hint: "update --all",
|
|
7354
|
+
shows: (facts) => updateScope(facts.bundles, facts.loose),
|
|
7336
7355
|
when: (facts) => facts.skills > 0 && facts.signedIn,
|
|
7337
7356
|
opens: { kind: "update", all: true }
|
|
7338
7357
|
}
|
|
@@ -7422,6 +7441,7 @@ var TABLE = {
|
|
|
7422
7441
|
value: "installed.list",
|
|
7423
7442
|
label: "list installed",
|
|
7424
7443
|
hint: "installed",
|
|
7444
|
+
shows: (facts) => count2(facts.skills, "skill"),
|
|
7425
7445
|
when: (facts) => facts.skills > 0,
|
|
7426
7446
|
opens: { kind: "installed" }
|
|
7427
7447
|
}
|
|
@@ -7451,6 +7471,7 @@ var TABLE = {
|
|
|
7451
7471
|
value: "installed.outdated",
|
|
7452
7472
|
label: "outdated",
|
|
7453
7473
|
hint: "outdated",
|
|
7474
|
+
shows: (facts) => facts.feed.outdated === undefined ? "" : facts.feed.outdated === 0 ? "all current" : `${facts.feed.outdated} behind`,
|
|
7454
7475
|
when: (facts) => facts.skills > 0 && facts.signedIn,
|
|
7455
7476
|
opens: { kind: "outdated" }
|
|
7456
7477
|
}
|
|
@@ -7485,6 +7506,7 @@ var TABLE = {
|
|
|
7485
7506
|
value: "catalog.pending",
|
|
7486
7507
|
label: "waiting for a review",
|
|
7487
7508
|
hint: "pending",
|
|
7509
|
+
shows: (facts) => facts.feed.pending === undefined ? "" : facts.feed.pending === 0 ? "none open" : `${facts.feed.pending} open`,
|
|
7488
7510
|
when: (facts) => facts.signedIn,
|
|
7489
7511
|
opens: { kind: "pending" }
|
|
7490
7512
|
}
|
|
@@ -7591,20 +7613,21 @@ var TABLE = {
|
|
|
7591
7613
|
value: "setup.scope",
|
|
7592
7614
|
label: "scope",
|
|
7593
7615
|
hint: "config set scope project",
|
|
7594
|
-
|
|
7616
|
+
shows: (facts) => facts.scope,
|
|
7595
7617
|
says: (facts) => `where installs land: ${facts.scope} right now`
|
|
7596
7618
|
},
|
|
7597
7619
|
{
|
|
7598
7620
|
value: "setup.agents",
|
|
7599
7621
|
label: "agents",
|
|
7600
7622
|
hint: "config set agents <name>",
|
|
7601
|
-
|
|
7602
|
-
says: () => "which agents
|
|
7623
|
+
shows: (facts) => facts.agents.length > 0 ? count2(facts.agents.length, "agent") : "unset",
|
|
7624
|
+
says: (facts) => facts.agents.length > 0 ? `which agents an install writes for: ${facts.agents.join(", ")}` : "which agents an install writes for; nothing pinned, so `skills` looks"
|
|
7603
7625
|
},
|
|
7604
7626
|
{
|
|
7605
7627
|
value: "setup.explain",
|
|
7606
7628
|
label: "explain",
|
|
7607
7629
|
hint: "config get --explain",
|
|
7630
|
+
shows: (facts) => `${count2(facts.settings, "setting")} set`,
|
|
7608
7631
|
opens: { kind: "config", action: "get", explain: true }
|
|
7609
7632
|
}
|
|
7610
7633
|
],
|
|
@@ -7682,6 +7705,7 @@ var TABLE = {
|
|
|
7682
7705
|
value: "setup.upgrade",
|
|
7683
7706
|
label: "upgrade",
|
|
7684
7707
|
hint: "upgrade",
|
|
7708
|
+
shows: (facts) => facts.feed.upgrade === undefined ? "" : facts.feed.upgrade === null ? "up to date" : `${facts.feed.upgrade} is out`,
|
|
7685
7709
|
opens: { kind: "upgrade" }
|
|
7686
7710
|
}
|
|
7687
7711
|
],
|
|
@@ -7778,6 +7802,9 @@ function refuseCommand(command) {
|
|
|
7778
7802
|
code: EXIT.usage
|
|
7779
7803
|
});
|
|
7780
7804
|
}
|
|
7805
|
+
function doorShows(door, facts) {
|
|
7806
|
+
return door.shows?.(facts) ?? "";
|
|
7807
|
+
}
|
|
7781
7808
|
function doorSays(door, facts) {
|
|
7782
7809
|
if (door.opens === undefined)
|
|
7783
7810
|
return door.says(facts);
|
|
@@ -8079,13 +8106,19 @@ var PALETTE = [
|
|
|
8079
8106
|
]
|
|
8080
8107
|
}
|
|
8081
8108
|
];
|
|
8082
|
-
function item(door) {
|
|
8083
|
-
|
|
8109
|
+
function item(door, facts) {
|
|
8110
|
+
const shows = doorShows(door, facts);
|
|
8111
|
+
return {
|
|
8112
|
+
value: door.value,
|
|
8113
|
+
label: door.label,
|
|
8114
|
+
hint: door.hint,
|
|
8115
|
+
...shows ? { shows } : {}
|
|
8116
|
+
};
|
|
8084
8117
|
}
|
|
8085
8118
|
function paletteGroups(facts) {
|
|
8086
8119
|
const groups = [];
|
|
8087
8120
|
for (const place of PALETTE) {
|
|
8088
|
-
const items = place.doors.map((value) => DOORS[value]).filter((door) => door.when?.(facts) ?? true).map(item);
|
|
8121
|
+
const items = place.doors.map((value) => DOORS[value]).filter((door) => door.when?.(facts) ?? true).map((door) => item(door, facts));
|
|
8089
8122
|
if (items.length > 0)
|
|
8090
8123
|
groups.push({ group: place.group, items });
|
|
8091
8124
|
}
|
|
@@ -8113,13 +8146,59 @@ async function paletteFacts(scope, server) {
|
|
|
8113
8146
|
manifest: nearest.path,
|
|
8114
8147
|
skills,
|
|
8115
8148
|
bundles: Object.keys(nearest.manifest.bundles).length,
|
|
8116
|
-
loose: looseSkills(nearest.manifest).length
|
|
8149
|
+
loose: looseSkills(nearest.manifest).length,
|
|
8150
|
+
settings: CONFIG_KEYS.filter((key) => configValue(config, key) !== UNSET).length,
|
|
8151
|
+
feed: NO_FEED
|
|
8117
8152
|
};
|
|
8118
8153
|
}
|
|
8119
8154
|
// src/shell/screens/home.tsx
|
|
8120
8155
|
import { Box as Box14, Text as Text16, useApp as useApp7, useInput as useInput8 } from "ink";
|
|
8121
8156
|
import { useCallback as useCallback3, useEffect as useEffect9, useMemo as useMemo4, useRef, useState as useState11 } from "react";
|
|
8122
8157
|
|
|
8158
|
+
// src/shell/feed.ts
|
|
8159
|
+
async function feedFacts(client, where, server) {
|
|
8160
|
+
const installed = Object.keys(where.manifest.skills).length > 0;
|
|
8161
|
+
const [skills, bundles, passes, drift, orgs] = await Promise.allSettled([
|
|
8162
|
+
client.skills.list.query({}),
|
|
8163
|
+
client.bundles.list.query({}),
|
|
8164
|
+
client.mirror.passes.query(),
|
|
8165
|
+
installed ? driftNow(client, where) : Promise.resolve(null),
|
|
8166
|
+
organizationChoices(server)
|
|
8167
|
+
]);
|
|
8168
|
+
return {
|
|
8169
|
+
...skills.status === "fulfilled" ? { skills: skills.value.length } : {},
|
|
8170
|
+
...bundles.status === "fulfilled" ? { bundles: bundles.value.length } : {},
|
|
8171
|
+
...passes.status === "fulfilled" ? { pending: passes.value.length } : {},
|
|
8172
|
+
...drift.status === "fulfilled" && drift.value ? { outdated: drift.value.moved.length } : {},
|
|
8173
|
+
...orgs.status === "fulfilled" ? { organizations: orgs.value.length } : {}
|
|
8174
|
+
};
|
|
8175
|
+
}
|
|
8176
|
+
|
|
8177
|
+
// src/shell/probe.ts
|
|
8178
|
+
var importProbe = async (where) => {
|
|
8179
|
+
const found = await listInstalled(where.scope);
|
|
8180
|
+
const recorded = new Set(Object.keys(where.manifest.skills));
|
|
8181
|
+
const news = found.filter((skill) => !recorded.has(skill.name)).length;
|
|
8182
|
+
if (found.length === 0)
|
|
8183
|
+
return "nothing on this machine to adopt";
|
|
8184
|
+
return news === 0 ? `${count2(found.length, "skill")} on this machine, all recorded here already` : `${count2(found.length, "skill")} on this machine, ${news} not recorded here`;
|
|
8185
|
+
};
|
|
8186
|
+
var doctorProbe = async (where, server) => {
|
|
8187
|
+
const checks = await diagnose(where, {
|
|
8188
|
+
local: true,
|
|
8189
|
+
...server ? { server } : {}
|
|
8190
|
+
});
|
|
8191
|
+
const bad = checks.filter((check) => !check.ok);
|
|
8192
|
+
return bad.length === 0 ? `${count2(checks.length, "local check")}, all passing` : `${bad.length} of ${checks.length} local checks failing: ${bad.map((check) => check.name).join(", ")}`;
|
|
8193
|
+
};
|
|
8194
|
+
var PROBES = {
|
|
8195
|
+
"setup.import": importProbe,
|
|
8196
|
+
"setup.doctor": doctorProbe
|
|
8197
|
+
};
|
|
8198
|
+
function probeFor(value) {
|
|
8199
|
+
return value ? PROBES[value] : undefined;
|
|
8200
|
+
}
|
|
8201
|
+
|
|
8123
8202
|
// src/args.ts
|
|
8124
8203
|
function configCommand2(rest, explain) {
|
|
8125
8204
|
const [action, key, ...value] = rest;
|
|
@@ -8449,13 +8528,14 @@ function PickScreen({
|
|
|
8449
8528
|
verb,
|
|
8450
8529
|
single = false,
|
|
8451
8530
|
marked,
|
|
8531
|
+
preset,
|
|
8452
8532
|
onPick,
|
|
8453
8533
|
onBack
|
|
8454
8534
|
}) {
|
|
8455
8535
|
const width = useFrameWidth();
|
|
8456
8536
|
const [query, setQuery] = useState9("");
|
|
8457
8537
|
const [cursor, setCursor] = useState9(0);
|
|
8458
|
-
const [picked, setPicked] = useState9(new Set);
|
|
8538
|
+
const [picked, setPicked] = useState9(() => new Set(preset ?? []));
|
|
8459
8539
|
const visible = useMemo3(() => {
|
|
8460
8540
|
if (query.length === 0)
|
|
8461
8541
|
return rows;
|
|
@@ -8663,11 +8743,30 @@ function failure(title, error) {
|
|
|
8663
8743
|
json: { error: message }
|
|
8664
8744
|
};
|
|
8665
8745
|
}
|
|
8746
|
+
var HEAD_FLOOR = 14;
|
|
8747
|
+
var AGENTS_FLOOR = 9;
|
|
8748
|
+
function agentsIn(agents, room) {
|
|
8749
|
+
if (agents.length === 0)
|
|
8750
|
+
return "agents unset";
|
|
8751
|
+
const full = agents.join(",");
|
|
8752
|
+
if (full.length <= room)
|
|
8753
|
+
return full;
|
|
8754
|
+
for (let keep = agents.length - 1;keep > 0; keep--) {
|
|
8755
|
+
const text = `${agents.slice(0, keep).join(",")} +${agents.length - keep}`;
|
|
8756
|
+
if (text.length <= room)
|
|
8757
|
+
return text;
|
|
8758
|
+
}
|
|
8759
|
+
return `${agents.length} agents`;
|
|
8760
|
+
}
|
|
8666
8761
|
function AccountLine({ facts, width }) {
|
|
8667
|
-
const agents = facts.agents.length > 0 ? facts.agents.join(",") : "agents unset";
|
|
8668
|
-
const right = `${agents} ${facts.scope} ${facts.skills} installed`;
|
|
8669
8762
|
const head = facts.signedIn ? facts.email ?? "signed in" : "not signed in";
|
|
8670
|
-
const
|
|
8763
|
+
const stat = `${facts.scope} ${facts.skills} installed`;
|
|
8764
|
+
const inner = width - FRAME_CHROME;
|
|
8765
|
+
const spent = Math.min(head.length, 24) + 2 + stat.length + 4;
|
|
8766
|
+
const forAgents = inner - spent;
|
|
8767
|
+
const agents = forAgents >= AGENTS_FLOOR ? agentsIn(facts.agents, forAgents) : "";
|
|
8768
|
+
const right = agents ? `${agents} ${stat}` : stat;
|
|
8769
|
+
const room = Math.max(inner - right.length - 2, HEAD_FLOOR);
|
|
8671
8770
|
const tail = facts.signedIn ? ` ${hostOf(facts.server)}` : " — the catalog needs a session";
|
|
8672
8771
|
const org = facts.signedIn && facts.organization ? ` ${facts.organization}` : "";
|
|
8673
8772
|
const spare = room - 2 - head.length;
|
|
@@ -8699,7 +8798,7 @@ function AccountLine({ facts, width }) {
|
|
|
8699
8798
|
}),
|
|
8700
8799
|
/* @__PURE__ */ jsx18(Text16, {
|
|
8701
8800
|
dimColor: true,
|
|
8702
|
-
children: right
|
|
8801
|
+
children: clip(right, inner - room)
|
|
8703
8802
|
})
|
|
8704
8803
|
]
|
|
8705
8804
|
});
|
|
@@ -8715,7 +8814,9 @@ function StaleLine({ stale, width }) {
|
|
|
8715
8814
|
});
|
|
8716
8815
|
}
|
|
8717
8816
|
var RUN = "run";
|
|
8817
|
+
var REST_MS = 250;
|
|
8718
8818
|
var ASK_NPM = () => upgradeCheck();
|
|
8819
|
+
var ASK_REGISTRY = feedFacts;
|
|
8719
8820
|
var NO_EXIT_CODE = () => {
|
|
8720
8821
|
return;
|
|
8721
8822
|
};
|
|
@@ -8731,19 +8832,20 @@ function HomeScreen({
|
|
|
8731
8832
|
onWelcomed = async () => {
|
|
8732
8833
|
return;
|
|
8733
8834
|
},
|
|
8734
|
-
checkUpgrade = ASK_NPM
|
|
8835
|
+
checkUpgrade = ASK_NPM,
|
|
8836
|
+
loadFeed = ASK_REGISTRY,
|
|
8837
|
+
probes: probeSet = probeFor
|
|
8735
8838
|
}) {
|
|
8736
8839
|
const { exit } = useApp7();
|
|
8737
8840
|
const width = useFrameWidth();
|
|
8738
8841
|
const [facts, setFacts] = useState11(initial);
|
|
8739
8842
|
const [where, setWhere] = useState11(initialWhere);
|
|
8740
|
-
const groups = useMemo4(() => paletteGroups(facts), [facts]);
|
|
8741
8843
|
const [query, setQuery] = useState11("");
|
|
8742
8844
|
const [cursor, setCursor] = useState11(0);
|
|
8743
8845
|
const [route, setRoute] = useState11(null);
|
|
8744
8846
|
const [welcome, setWelcome] = useState11(initial.firstRun);
|
|
8745
8847
|
const [wizard, setWizard] = useState11(false);
|
|
8746
|
-
const [stale, setStale] = useState11(
|
|
8848
|
+
const [stale, setStale] = useState11(undefined);
|
|
8747
8849
|
useEffect9(() => {
|
|
8748
8850
|
let live = true;
|
|
8749
8851
|
checkUpgrade().then((found) => {
|
|
@@ -8756,6 +8858,17 @@ function HomeScreen({
|
|
|
8756
8858
|
live = false;
|
|
8757
8859
|
};
|
|
8758
8860
|
}, [checkUpgrade]);
|
|
8861
|
+
const [feed, setFeed] = useState11(NO_FEED);
|
|
8862
|
+
const [probes, setProbes] = useState11({});
|
|
8863
|
+
const [probing, setProbing] = useState11(null);
|
|
8864
|
+
const shown = useMemo4(() => ({
|
|
8865
|
+
...facts,
|
|
8866
|
+
feed: {
|
|
8867
|
+
...feed,
|
|
8868
|
+
...stale === undefined ? {} : { upgrade: stale ? stale.latest : null }
|
|
8869
|
+
}
|
|
8870
|
+
}), [facts, feed, stale]);
|
|
8871
|
+
const groups = useMemo4(() => paletteGroups(shown), [shown]);
|
|
8759
8872
|
const typed = useMemo4(() => typedCommand(query), [query]);
|
|
8760
8873
|
const visible = useMemo4(() => {
|
|
8761
8874
|
const filtered = filterCommands(groups, query);
|
|
@@ -8778,6 +8891,20 @@ function HomeScreen({
|
|
|
8778
8891
|
held.current ??= await openClient();
|
|
8779
8892
|
return held.current;
|
|
8780
8893
|
}, [openClient]);
|
|
8894
|
+
useEffect9(() => {
|
|
8895
|
+
if (!facts.signedIn)
|
|
8896
|
+
return;
|
|
8897
|
+
let live = true;
|
|
8898
|
+
connect().then((client) => loadFeed(client, where, server)).then((found) => {
|
|
8899
|
+
if (live)
|
|
8900
|
+
setFeed(found);
|
|
8901
|
+
}).catch(() => {
|
|
8902
|
+
return;
|
|
8903
|
+
});
|
|
8904
|
+
return () => {
|
|
8905
|
+
live = false;
|
|
8906
|
+
};
|
|
8907
|
+
}, [facts.signedIn, connect, loadFeed, where, server]);
|
|
8781
8908
|
const checkSession = useCallback3(async () => facts.signedIn, [facts.signedIn]);
|
|
8782
8909
|
const answering = useCallback3((title, working, load) => ({
|
|
8783
8910
|
kind: "report",
|
|
@@ -8873,6 +9000,52 @@ function HomeScreen({
|
|
|
8873
9000
|
verb: "remove",
|
|
8874
9001
|
command: (names) => ({ kind: "remove", names })
|
|
8875
9002
|
};
|
|
9003
|
+
case "setup.scope":
|
|
9004
|
+
return {
|
|
9005
|
+
kind: "pick",
|
|
9006
|
+
title: "scope",
|
|
9007
|
+
rows: [
|
|
9008
|
+
{
|
|
9009
|
+
name: "global",
|
|
9010
|
+
description: "installs land in your home directory, where every project sees them"
|
|
9011
|
+
},
|
|
9012
|
+
{
|
|
9013
|
+
name: "project",
|
|
9014
|
+
description: "installs land in this project's yourskills.json, and travel with the repo"
|
|
9015
|
+
}
|
|
9016
|
+
],
|
|
9017
|
+
empty: "",
|
|
9018
|
+
verb: "set",
|
|
9019
|
+
single: true,
|
|
9020
|
+
marked: facts.scope,
|
|
9021
|
+
command: (names) => ({
|
|
9022
|
+
kind: "config",
|
|
9023
|
+
action: "set",
|
|
9024
|
+
key: "scope",
|
|
9025
|
+
value: names[0] ?? ""
|
|
9026
|
+
})
|
|
9027
|
+
};
|
|
9028
|
+
case "setup.agents": {
|
|
9029
|
+
const valid = await knownAgents() ?? [];
|
|
9030
|
+
const onDisk = new Set(facts.agentsOnDisk);
|
|
9031
|
+
return {
|
|
9032
|
+
kind: "pick",
|
|
9033
|
+
title: "agents",
|
|
9034
|
+
rows: valid.map((name) => ({
|
|
9035
|
+
name,
|
|
9036
|
+
description: onDisk.has(name) ? "on this machine" : ""
|
|
9037
|
+
})),
|
|
9038
|
+
empty: "Could not ask the `skills` CLI which agent names it accepts. Run `yourskills doctor`.",
|
|
9039
|
+
verb: "set",
|
|
9040
|
+
preset: facts.agents,
|
|
9041
|
+
command: (names) => ({
|
|
9042
|
+
kind: "config",
|
|
9043
|
+
action: "set",
|
|
9044
|
+
key: "agents",
|
|
9045
|
+
value: names.join(",")
|
|
9046
|
+
})
|
|
9047
|
+
};
|
|
9048
|
+
}
|
|
8876
9049
|
case "account.org": {
|
|
8877
9050
|
const orgs = await organizationChoices(server);
|
|
8878
9051
|
const active = orgs.find((org) => org.active)?.name;
|
|
@@ -8891,7 +9064,7 @@ function HomeScreen({
|
|
|
8891
9064
|
};
|
|
8892
9065
|
}
|
|
8893
9066
|
}
|
|
8894
|
-
}, [where, server]);
|
|
9067
|
+
}, [where, server, facts]);
|
|
8895
9068
|
const routeForDoor = useCallback3(async (door) => door.opens === undefined ? ownRoute(door.value) : routeForCommand(door.opens), [ownRoute, routeForCommand]);
|
|
8896
9069
|
const open = useCallback3((pending, title) => {
|
|
8897
9070
|
pending.then((next) => {
|
|
@@ -8908,6 +9081,29 @@ function HomeScreen({
|
|
|
8908
9081
|
open(routeForCommand(parsed.command), parsed.text);
|
|
8909
9082
|
}, [open, routeForCommand]);
|
|
8910
9083
|
const current = rows[cursor];
|
|
9084
|
+
useEffect9(() => {
|
|
9085
|
+
const value = current?.value;
|
|
9086
|
+
const probe = probeSet(value);
|
|
9087
|
+
if (!value || !probe || probes[value] !== undefined)
|
|
9088
|
+
return;
|
|
9089
|
+
let live = true;
|
|
9090
|
+
const timer = setTimeout(() => {
|
|
9091
|
+
setProbing(value);
|
|
9092
|
+
probe(where, server).then((text) => {
|
|
9093
|
+
if (live)
|
|
9094
|
+
setProbes((was) => ({ ...was, [value]: text }));
|
|
9095
|
+
}).catch(() => {
|
|
9096
|
+
return;
|
|
9097
|
+
}).finally(() => {
|
|
9098
|
+
if (live)
|
|
9099
|
+
setProbing(null);
|
|
9100
|
+
});
|
|
9101
|
+
}, REST_MS);
|
|
9102
|
+
return () => {
|
|
9103
|
+
live = false;
|
|
9104
|
+
clearTimeout(timer);
|
|
9105
|
+
};
|
|
9106
|
+
}, [current?.value, probes, probeSet, where, server]);
|
|
8911
9107
|
const activate = useCallback3(() => {
|
|
8912
9108
|
const item = rows[cursor];
|
|
8913
9109
|
if (!item)
|
|
@@ -8934,6 +9130,7 @@ function HomeScreen({
|
|
|
8934
9130
|
setRoute(null);
|
|
8935
9131
|
setQuery("");
|
|
8936
9132
|
setCursor(0);
|
|
9133
|
+
setProbes({});
|
|
8937
9134
|
reload().then(setFacts).catch(() => {
|
|
8938
9135
|
return;
|
|
8939
9136
|
});
|
|
@@ -9049,6 +9246,7 @@ function HomeScreen({
|
|
|
9049
9246
|
verb: picked.verb,
|
|
9050
9247
|
...picked.single ? { single: true } : {},
|
|
9051
9248
|
...picked.marked ? { marked: picked.marked } : {},
|
|
9249
|
+
...picked.preset ? { preset: picked.preset } : {},
|
|
9052
9250
|
onPick: (names) => {
|
|
9053
9251
|
open(routeForCommand(picked.command(names)), picked.title);
|
|
9054
9252
|
},
|
|
@@ -9081,14 +9279,15 @@ function HomeScreen({
|
|
|
9081
9279
|
});
|
|
9082
9280
|
}
|
|
9083
9281
|
const highlighted = current ? doorFor(current.value) : undefined;
|
|
9084
|
-
const description = current?.value === RUN && runnable(typed) ? say(typed.command,
|
|
9282
|
+
const description = current?.value === RUN && runnable(typed) ? say(typed.command, shown) : highlighted ? doorSays(highlighted, shown) : typed ? say(typed.command, shown) : "";
|
|
9283
|
+
const found = current ? probes[current.value] ?? (probing === current.value ? "looking..." : "") : "";
|
|
9085
9284
|
const empty = typed?.command.kind === "error" && typed.command.next ? `${mark.fail} ${typed.command.message} try: ${typed.command.next.replace(/^yourskills /, "")}` : "No matching commands.";
|
|
9086
9285
|
return /* @__PURE__ */ jsxs16(Frame, {
|
|
9087
9286
|
title: "yourskills",
|
|
9088
9287
|
width,
|
|
9089
9288
|
children: [
|
|
9090
9289
|
/* @__PURE__ */ jsx18(AccountLine, {
|
|
9091
|
-
facts,
|
|
9290
|
+
facts: shown,
|
|
9092
9291
|
width
|
|
9093
9292
|
}),
|
|
9094
9293
|
stale ? /* @__PURE__ */ jsx18(StaleLine, {
|
|
@@ -9112,6 +9311,10 @@ function HomeScreen({
|
|
|
9112
9311
|
dimColor: true,
|
|
9113
9312
|
children: clip(description, width - FRAME_CHROME)
|
|
9114
9313
|
}),
|
|
9314
|
+
/* @__PURE__ */ jsx18(Text16, {
|
|
9315
|
+
dimColor: true,
|
|
9316
|
+
children: found ? clip(` ${found}`, width - FRAME_CHROME) : " "
|
|
9317
|
+
}),
|
|
9115
9318
|
/* @__PURE__ */ jsx18(Hints, {
|
|
9116
9319
|
hints: [
|
|
9117
9320
|
["^v", "move"],
|
package/package.json
CHANGED