pi-agent-toolkit 0.2.0 → 0.3.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/index.js +111 -81
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -538,6 +538,8 @@ var registry = [
|
|
|
538
538
|
...externalSkills,
|
|
539
539
|
...packages,
|
|
540
540
|
...configs
|
|
541
|
+
// Placeholders: no items yet, but the categories are ready for content.
|
|
542
|
+
// Add prompts, agents, and themes entries here as they're created.
|
|
541
543
|
];
|
|
542
544
|
function getByCategory(category) {
|
|
543
545
|
return registry.filter((c) => c.category === category);
|
|
@@ -623,6 +625,9 @@ var AGENTS_SKILLS_DIR = resolve(homedir(), ".agents", "skills");
|
|
|
623
625
|
var MANIFEST_PATH = resolve(PI_AGENT_DIR, ".pi-toolkit.json");
|
|
624
626
|
var PI_EXTENSIONS_DIR = resolve(PI_AGENT_DIR, "extensions");
|
|
625
627
|
var PI_SKILLS_DIR = resolve(PI_AGENT_DIR, "skills");
|
|
628
|
+
var PI_PROMPTS_DIR = resolve(PI_AGENT_DIR, "prompts");
|
|
629
|
+
var PI_AGENTS_DIR = resolve(PI_AGENT_DIR, "agents");
|
|
630
|
+
var PI_THEMES_DIR = resolve(PI_AGENT_DIR, "themes");
|
|
626
631
|
|
|
627
632
|
// src/lib/manifest.ts
|
|
628
633
|
import { readFileSync, writeFileSync, existsSync, mkdirSync } from "fs";
|
|
@@ -633,6 +638,9 @@ function emptyManifest() {
|
|
|
633
638
|
installed: {
|
|
634
639
|
extensions: [],
|
|
635
640
|
skills: { bundled: [], external: [] },
|
|
641
|
+
prompts: [],
|
|
642
|
+
agents: [],
|
|
643
|
+
themes: [],
|
|
636
644
|
packages: [],
|
|
637
645
|
configs: []
|
|
638
646
|
},
|
|
@@ -655,6 +663,9 @@ function readManifest(path = MANIFEST_PATH) {
|
|
|
655
663
|
bundled: installed.skills?.bundled ?? defaults.installed.skills.bundled,
|
|
656
664
|
external: installed.skills?.external ?? defaults.installed.skills.external
|
|
657
665
|
},
|
|
666
|
+
prompts: installed.prompts ?? defaults.installed.prompts,
|
|
667
|
+
agents: installed.agents ?? defaults.installed.agents,
|
|
668
|
+
themes: installed.themes ?? defaults.installed.themes,
|
|
658
669
|
packages: installed.packages ?? defaults.installed.packages,
|
|
659
670
|
configs: installed.configs ?? defaults.installed.configs
|
|
660
671
|
},
|
|
@@ -679,6 +690,12 @@ function getList(manifest, category) {
|
|
|
679
690
|
return manifest.installed.skills.external;
|
|
680
691
|
case "packages":
|
|
681
692
|
return manifest.installed.packages;
|
|
693
|
+
case "prompts":
|
|
694
|
+
return manifest.installed.prompts;
|
|
695
|
+
case "agents":
|
|
696
|
+
return manifest.installed.agents;
|
|
697
|
+
case "themes":
|
|
698
|
+
return manifest.installed.themes;
|
|
682
699
|
case "configs":
|
|
683
700
|
return manifest.installed.configs;
|
|
684
701
|
default:
|
|
@@ -722,6 +739,14 @@ function resolveTarget(component) {
|
|
|
722
739
|
}
|
|
723
740
|
return resolve2(PI_SKILLS_DIR, component.name);
|
|
724
741
|
}
|
|
742
|
+
case "prompts":
|
|
743
|
+
return resolve2(PI_PROMPTS_DIR, component.name);
|
|
744
|
+
case "agents":
|
|
745
|
+
return resolve2(PI_AGENTS_DIR, component.name);
|
|
746
|
+
case "themes": {
|
|
747
|
+
const themeName = (component.source ?? component.name).endsWith(".json") ? basename(component.source ?? component.name) : component.name + ".json";
|
|
748
|
+
return resolve2(PI_THEMES_DIR, themeName);
|
|
749
|
+
}
|
|
725
750
|
case "configs": {
|
|
726
751
|
const name = (component.source ?? component.name).replace(".template", "");
|
|
727
752
|
return resolve2(PI_AGENT_DIR, name);
|
|
@@ -806,10 +831,17 @@ function installViaPi(component) {
|
|
|
806
831
|
}
|
|
807
832
|
async function installComponents(components, options) {
|
|
808
833
|
if (components.length === 0) return;
|
|
809
|
-
|
|
810
|
-
|
|
811
|
-
|
|
812
|
-
|
|
834
|
+
for (const dir of [
|
|
835
|
+
PI_AGENT_DIR,
|
|
836
|
+
PI_EXTENSIONS_DIR,
|
|
837
|
+
PI_SKILLS_DIR,
|
|
838
|
+
PI_PROMPTS_DIR,
|
|
839
|
+
PI_AGENTS_DIR,
|
|
840
|
+
PI_THEMES_DIR,
|
|
841
|
+
AGENTS_SKILLS_DIR
|
|
842
|
+
]) {
|
|
843
|
+
mkdirSync2(dir, { recursive: true });
|
|
844
|
+
}
|
|
813
845
|
const spinner3 = p2.spinner();
|
|
814
846
|
const results = [];
|
|
815
847
|
for (const component of components) {
|
|
@@ -883,22 +915,30 @@ function installExtensionDeps() {
|
|
|
883
915
|
}
|
|
884
916
|
|
|
885
917
|
// src/commands/install.ts
|
|
918
|
+
var SELECT_ALL = "__all__";
|
|
886
919
|
async function selectComponents(message, components) {
|
|
887
920
|
if (components.length === 0) return [];
|
|
888
921
|
const result = await p3.multiselect({
|
|
889
922
|
message,
|
|
890
|
-
options:
|
|
891
|
-
value:
|
|
892
|
-
|
|
893
|
-
|
|
894
|
-
|
|
923
|
+
options: [
|
|
924
|
+
{ value: SELECT_ALL, label: "* Select all", hint: `all ${components.length} items` },
|
|
925
|
+
...components.map((c) => ({
|
|
926
|
+
value: c.name,
|
|
927
|
+
label: c.name,
|
|
928
|
+
hint: c.description
|
|
929
|
+
}))
|
|
930
|
+
],
|
|
895
931
|
required: false
|
|
896
932
|
});
|
|
897
933
|
if (p3.isCancel(result)) {
|
|
898
934
|
p3.cancel("Installation cancelled.");
|
|
899
935
|
process.exit(0);
|
|
900
936
|
}
|
|
901
|
-
|
|
937
|
+
const selected = result;
|
|
938
|
+
if (selected.includes(SELECT_ALL)) {
|
|
939
|
+
return components.map((c) => c.name);
|
|
940
|
+
}
|
|
941
|
+
return selected;
|
|
902
942
|
}
|
|
903
943
|
async function interactivePicker() {
|
|
904
944
|
const selected = [];
|
|
@@ -909,6 +949,9 @@ async function interactivePicker() {
|
|
|
909
949
|
message: "Select external skills to install (fetched from source repos):",
|
|
910
950
|
components: getByCategory("skills-external")
|
|
911
951
|
},
|
|
952
|
+
{ message: "Select prompts to install:", components: getByCategory("prompts") },
|
|
953
|
+
{ message: "Select agents to install:", components: getByCategory("agents") },
|
|
954
|
+
{ message: "Select themes to install:", components: getByCategory("themes") },
|
|
912
955
|
{ message: "Select pi packages to install:", components: getByCategory("packages") },
|
|
913
956
|
{
|
|
914
957
|
message: "Select starter configs (copied as templates, won't overwrite existing):",
|
|
@@ -964,6 +1007,9 @@ async function runInstall(args) {
|
|
|
964
1007
|
const counts = [
|
|
965
1008
|
["extension", components.filter((c) => c.category === "extensions").length],
|
|
966
1009
|
["skill", components.filter((c) => c.category.startsWith("skills-")).length],
|
|
1010
|
+
["prompt", components.filter((c) => c.category === "prompts").length],
|
|
1011
|
+
["agent", components.filter((c) => c.category === "agents").length],
|
|
1012
|
+
["theme", components.filter((c) => c.category === "themes").length],
|
|
967
1013
|
["package", components.filter((c) => c.category === "packages").length],
|
|
968
1014
|
["config", components.filter((c) => c.category === "configs").length]
|
|
969
1015
|
];
|
|
@@ -998,6 +1044,17 @@ async function runInstall(args) {
|
|
|
998
1044
|
|
|
999
1045
|
// src/commands/list.ts
|
|
1000
1046
|
import pc2 from "picocolors";
|
|
1047
|
+
function printSection(category, title, subtitle) {
|
|
1048
|
+
const items = getByCategory(category);
|
|
1049
|
+
if (items.length === 0) return;
|
|
1050
|
+
const header = subtitle ? pc2.bold(pc2.cyan(title)) + pc2.dim(` (${subtitle})`) : pc2.bold(pc2.cyan(title));
|
|
1051
|
+
console.log(header);
|
|
1052
|
+
for (const c of items) {
|
|
1053
|
+
const suffix = c.remote ? pc2.dim(` [${c.remote}]`) : "";
|
|
1054
|
+
console.log(` ${pc2.green(c.name.padEnd(38))} ${pc2.dim(c.description)}${suffix}`);
|
|
1055
|
+
}
|
|
1056
|
+
console.log();
|
|
1057
|
+
}
|
|
1001
1058
|
function runList() {
|
|
1002
1059
|
console.log();
|
|
1003
1060
|
console.log(pc2.bold("pi-agent-toolkit: available components"));
|
|
@@ -1013,39 +1070,13 @@ function runList() {
|
|
|
1013
1070
|
}
|
|
1014
1071
|
}
|
|
1015
1072
|
console.log();
|
|
1016
|
-
|
|
1017
|
-
|
|
1018
|
-
|
|
1019
|
-
|
|
1020
|
-
|
|
1021
|
-
|
|
1022
|
-
|
|
1023
|
-
}
|
|
1024
|
-
const external = getByCategory("skills-external");
|
|
1025
|
-
if (external.length > 0) {
|
|
1026
|
-
console.log(pc2.bold(pc2.cyan("External Skills")) + pc2.dim(" (installed from source repos)"));
|
|
1027
|
-
for (const c of external) {
|
|
1028
|
-
const source = c.remote ? pc2.dim(` [${c.remote}]`) : "";
|
|
1029
|
-
console.log(` ${pc2.green(c.name.padEnd(38))} ${pc2.dim(c.description)}${source}`);
|
|
1030
|
-
}
|
|
1031
|
-
console.log();
|
|
1032
|
-
}
|
|
1033
|
-
const pkgs = getByCategory("packages");
|
|
1034
|
-
if (pkgs.length > 0) {
|
|
1035
|
-
console.log(pc2.bold(pc2.cyan("Packages")) + pc2.dim(" (installed via pi install)"));
|
|
1036
|
-
for (const c of pkgs) {
|
|
1037
|
-
console.log(` ${pc2.green(c.name.padEnd(38))} ${pc2.dim(c.description)}`);
|
|
1038
|
-
}
|
|
1039
|
-
console.log();
|
|
1040
|
-
}
|
|
1041
|
-
const configs2 = getByCategory("configs");
|
|
1042
|
-
if (configs2.length > 0) {
|
|
1043
|
-
console.log(pc2.bold(pc2.cyan("Starter Configs")) + pc2.dim(" (copied as templates)"));
|
|
1044
|
-
for (const c of configs2) {
|
|
1045
|
-
console.log(` ${pc2.green(c.name.padEnd(38))} ${pc2.dim(c.description)}`);
|
|
1046
|
-
}
|
|
1047
|
-
console.log();
|
|
1048
|
-
}
|
|
1073
|
+
printSection("skills-bundled", "Bundled Skills");
|
|
1074
|
+
printSection("skills-external", "External Skills", "installed from source repos");
|
|
1075
|
+
printSection("prompts", "Prompts", "custom prompt templates");
|
|
1076
|
+
printSection("agents", "Agents", "custom agent definitions");
|
|
1077
|
+
printSection("themes", "Themes", "TUI color themes");
|
|
1078
|
+
printSection("packages", "Packages", "installed via pi install");
|
|
1079
|
+
printSection("configs", "Starter Configs", "copied as templates");
|
|
1049
1080
|
}
|
|
1050
1081
|
|
|
1051
1082
|
// src/commands/status.ts
|
|
@@ -1070,6 +1101,14 @@ function expectedPath(component) {
|
|
|
1070
1101
|
if (existsSync3(piPath)) return piPath;
|
|
1071
1102
|
return agentsPath;
|
|
1072
1103
|
}
|
|
1104
|
+
case "prompts":
|
|
1105
|
+
return resolve3(PI_PROMPTS_DIR, component.name);
|
|
1106
|
+
case "agents":
|
|
1107
|
+
return resolve3(PI_AGENTS_DIR, component.name);
|
|
1108
|
+
case "themes": {
|
|
1109
|
+
const themeName = (component.source ?? component.name).endsWith(".json") ? basename2(component.source ?? component.name) : component.name + ".json";
|
|
1110
|
+
return resolve3(PI_THEMES_DIR, themeName);
|
|
1111
|
+
}
|
|
1073
1112
|
case "packages":
|
|
1074
1113
|
return null;
|
|
1075
1114
|
// Can't easily check pi packages on disk
|
|
@@ -1116,6 +1155,9 @@ function runStatus() {
|
|
|
1116
1155
|
...manifest.installed.extensions,
|
|
1117
1156
|
...manifest.installed.skills.bundled,
|
|
1118
1157
|
...manifest.installed.skills.external,
|
|
1158
|
+
...manifest.installed.prompts,
|
|
1159
|
+
...manifest.installed.agents,
|
|
1160
|
+
...manifest.installed.themes,
|
|
1119
1161
|
...manifest.installed.packages,
|
|
1120
1162
|
...manifest.installed.configs
|
|
1121
1163
|
]);
|
|
@@ -1152,6 +1194,9 @@ function runStatus() {
|
|
|
1152
1194
|
{ key: "extensions", label: "Extensions" },
|
|
1153
1195
|
{ key: "skills-bundled", label: "Bundled Skills" },
|
|
1154
1196
|
{ key: "skills-external", label: "External Skills" },
|
|
1197
|
+
{ key: "prompts", label: "Prompts" },
|
|
1198
|
+
{ key: "agents", label: "Agents" },
|
|
1199
|
+
{ key: "themes", label: "Themes" },
|
|
1155
1200
|
{ key: "packages", label: "Packages" },
|
|
1156
1201
|
{ key: "configs", label: "Configs" }
|
|
1157
1202
|
];
|
|
@@ -1270,51 +1315,36 @@ async function runSync(options) {
|
|
|
1270
1315
|
process.exit(1);
|
|
1271
1316
|
}
|
|
1272
1317
|
p4.log.info(`Repo: ${repoPath}`);
|
|
1273
|
-
p4.log.info("Scanning for unmanaged
|
|
1318
|
+
p4.log.info("Scanning for unmanaged components...");
|
|
1274
1319
|
const externalSkills2 = getExternalSkillNames();
|
|
1275
|
-
|
|
1276
|
-
|
|
1277
|
-
|
|
1278
|
-
|
|
1279
|
-
|
|
1280
|
-
|
|
1281
|
-
|
|
1282
|
-
|
|
1283
|
-
const agentSkillsDir = resolve4(dotfilesPath, "agent-skills");
|
|
1284
|
-
if (existsSync4(agentSkillsDir)) {
|
|
1285
|
-
for (const entry of readdirSync2(agentSkillsDir)) {
|
|
1286
|
-
knownAgentSkills.add(entry);
|
|
1287
|
-
}
|
|
1288
|
-
}
|
|
1289
|
-
const knownGlobalSkills = /* @__PURE__ */ new Set();
|
|
1290
|
-
const globalSkillsDir = resolve4(dotfilesPath, "global-skills");
|
|
1291
|
-
if (existsSync4(globalSkillsDir)) {
|
|
1292
|
-
for (const entry of readdirSync2(globalSkillsDir)) {
|
|
1293
|
-
knownGlobalSkills.add(entry);
|
|
1294
|
-
}
|
|
1295
|
-
}
|
|
1296
|
-
const found = [
|
|
1297
|
-
...findUnmanaged(
|
|
1298
|
-
PI_EXTENSIONS_DIR,
|
|
1299
|
-
resolve4(dotfilesPath, "extensions"),
|
|
1300
|
-
"extensions",
|
|
1301
|
-
knownExtensions
|
|
1302
|
-
),
|
|
1303
|
-
...findUnmanaged(
|
|
1320
|
+
function knownNames(subdir) {
|
|
1321
|
+
const dir = resolve4(dotfilesPath, subdir);
|
|
1322
|
+
if (!existsSync4(dir)) return /* @__PURE__ */ new Set();
|
|
1323
|
+
return new Set(readdirSync2(dir));
|
|
1324
|
+
}
|
|
1325
|
+
const scanTargets = [
|
|
1326
|
+
[PI_EXTENSIONS_DIR, "extensions", "extensions", knownNames("extensions")],
|
|
1327
|
+
[
|
|
1304
1328
|
PI_SKILLS_DIR,
|
|
1305
|
-
resolve4(dotfilesPath, "agent-skills"),
|
|
1306
1329
|
"agent-skills",
|
|
1307
|
-
|
|
1308
|
-
|
|
1309
|
-
|
|
1330
|
+
"agent-skills",
|
|
1331
|
+
/* @__PURE__ */ new Set([...knownNames("agent-skills"), ...externalSkills2])
|
|
1332
|
+
],
|
|
1333
|
+
[
|
|
1310
1334
|
AGENTS_SKILLS_DIR,
|
|
1311
|
-
resolve4(dotfilesPath, "global-skills"),
|
|
1312
1335
|
"global-skills",
|
|
1313
|
-
|
|
1314
|
-
|
|
1336
|
+
"global-skills",
|
|
1337
|
+
/* @__PURE__ */ new Set([...knownNames("global-skills"), ...externalSkills2])
|
|
1338
|
+
],
|
|
1339
|
+
[PI_PROMPTS_DIR, "prompts", "prompts", knownNames("prompts")],
|
|
1340
|
+
[PI_AGENTS_DIR, "agents", "agents", knownNames("agents")],
|
|
1341
|
+
[PI_THEMES_DIR, "themes", "themes", knownNames("themes")]
|
|
1315
1342
|
];
|
|
1343
|
+
const found = scanTargets.flatMap(
|
|
1344
|
+
([scanDir, dotfilesSub, category, skipNames]) => findUnmanaged(scanDir, resolve4(dotfilesPath, dotfilesSub), category, skipNames)
|
|
1345
|
+
);
|
|
1316
1346
|
if (found.length === 0) {
|
|
1317
|
-
p4.log.success("No unmanaged
|
|
1347
|
+
p4.log.success("No unmanaged components found. Everything is in sync.");
|
|
1318
1348
|
p4.outro("Done.");
|
|
1319
1349
|
return;
|
|
1320
1350
|
}
|