@agents-inc/cli 0.35.0 → 0.41.1
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/CHANGELOG.md +103 -0
- package/config/skills-matrix.yaml +124 -132
- package/config/stacks.yaml +687 -687
- package/dist/{chunk-BLLXNFWP.js → chunk-2D6LKRHW.js} +2 -2
- package/dist/{chunk-KWF6D7ZP.js → chunk-342YB6TQ.js} +27 -19
- package/dist/chunk-342YB6TQ.js.map +1 -0
- package/dist/{chunk-OGXSTJP2.js → chunk-423MJ6DT.js} +66 -36
- package/dist/chunk-423MJ6DT.js.map +1 -0
- package/dist/{chunk-5LPPIT6H.js → chunk-4LT6RXMY.js} +4 -4
- package/dist/{chunk-LFHZBF6N.js → chunk-4SYXPG7L.js} +4 -3
- package/dist/chunk-4SYXPG7L.js.map +1 -0
- package/dist/{chunk-CXWPUVA7.js → chunk-4UTPJXUX.js} +9 -9
- package/dist/{chunk-CEWNZQMH.js → chunk-5TMB53BV.js} +9 -3
- package/dist/chunk-5TMB53BV.js.map +1 -0
- package/dist/chunk-7FBM7V3E.js +144 -0
- package/dist/chunk-7FBM7V3E.js.map +1 -0
- package/dist/chunk-ACVJVYMC.js +111 -0
- package/dist/chunk-ACVJVYMC.js.map +1 -0
- package/dist/{chunk-YN35L5NE.js → chunk-AH7XHAKN.js} +12 -12
- package/dist/chunk-AH7XHAKN.js.map +1 -0
- package/dist/{chunk-5YNZJ5TP.js → chunk-AVVYFEMF.js} +2 -2
- package/dist/{chunk-U36YCEBK.js → chunk-BFISETQG.js} +32 -23
- package/dist/chunk-BFISETQG.js.map +1 -0
- package/dist/{chunk-YCS7GF6Y.js → chunk-BK7TANUV.js} +6 -2
- package/dist/chunk-BK7TANUV.js.map +1 -0
- package/dist/{chunk-OGJ7DFCL.js → chunk-DV4ALU5I.js} +6 -6
- package/dist/{chunk-NJ775OJ4.js → chunk-FHBICUXB.js} +7 -7
- package/dist/chunk-FHBICUXB.js.map +1 -0
- package/dist/{chunk-OKILA27U.js → chunk-GEDWVX6Y.js} +87 -100
- package/dist/chunk-GEDWVX6Y.js.map +1 -0
- package/dist/{chunk-DC5AK3LW.js → chunk-GG4BSB6S.js} +5 -11
- package/dist/chunk-GG4BSB6S.js.map +1 -0
- package/dist/{chunk-BPD4VUAU.js → chunk-H6H3COI5.js} +5 -5
- package/dist/{chunk-AQQVSNUX.js → chunk-K77I4XGL.js} +20 -6
- package/dist/chunk-K77I4XGL.js.map +1 -0
- package/dist/chunk-KC2SIUIA.js +46 -0
- package/dist/chunk-KC2SIUIA.js.map +1 -0
- package/dist/{chunk-HTTPKSL6.js → chunk-KXM7KOPE.js} +2 -2
- package/dist/{chunk-GGHH3KR2.js → chunk-LJRP4SWY.js} +6 -5
- package/dist/chunk-LJRP4SWY.js.map +1 -0
- package/dist/{chunk-PKUIO2Z7.js → chunk-MNPPGIZQ.js} +8 -8
- package/dist/chunk-MNPPGIZQ.js.map +1 -0
- package/dist/{chunk-IG7CUREJ.js → chunk-NYP5SB2V.js} +2 -2
- package/dist/{chunk-JXMRTHDT.js → chunk-NZYKDVRL.js} +2 -2
- package/dist/{chunk-XNQJBQ5X.js → chunk-PURJZ72D.js} +2 -2
- package/dist/{chunk-VEZ2GZEK.js → chunk-R52N7DBG.js} +2 -2
- package/dist/chunk-SILUTTV7.js +113 -0
- package/dist/chunk-SILUTTV7.js.map +1 -0
- package/dist/{chunk-YIKBNGE3.js → chunk-TJAZ7QCF.js} +7 -7
- package/dist/chunk-TJAZ7QCF.js.map +1 -0
- package/dist/{chunk-WMVGRAFB.js → chunk-TTXV55NQ.js} +235 -117
- package/dist/chunk-TTXV55NQ.js.map +1 -0
- package/dist/{chunk-ZE355C6C.js → chunk-UKTYDNWJ.js} +9 -4
- package/dist/chunk-UKTYDNWJ.js.map +1 -0
- package/dist/{chunk-YPJKOM42.js → chunk-WS6OQIEN.js} +2 -2
- package/dist/{chunk-OI4WBRC7.js → chunk-XJXJZ2MJ.js} +113 -150
- package/dist/chunk-XJXJZ2MJ.js.map +1 -0
- package/dist/chunk-YLJYAQSG.js +210 -0
- package/dist/chunk-YLJYAQSG.js.map +1 -0
- package/dist/{chunk-MZB3GGOH.js → chunk-YRVTXSXP.js} +1 -2
- package/dist/chunk-YRVTXSXP.js.map +1 -0
- package/dist/{chunk-XYCN2GCV.js → chunk-ZLHGJSRK.js} +3 -3
- package/dist/cli/defaults/agent-mappings.yaml +16 -72
- package/dist/commands/build/marketplace.js +3 -3
- package/dist/commands/build/plugins.js +5 -5
- package/dist/commands/build/stack.js +5 -5
- package/dist/commands/compile.js +14 -18
- package/dist/commands/compile.js.map +1 -1
- package/dist/commands/config/get.js +8 -8
- package/dist/commands/config/get.js.map +1 -1
- package/dist/commands/config/index.js +5 -5
- package/dist/commands/config/path.js +4 -4
- package/dist/commands/config/set-project.js +7 -7
- package/dist/commands/config/set-project.js.map +1 -1
- package/dist/commands/config/show.js +5 -5
- package/dist/commands/config/unset-project.js +5 -5
- package/dist/commands/config/unset-project.js.map +1 -1
- package/dist/commands/diff.js +12 -9
- package/dist/commands/diff.js.map +1 -1
- package/dist/commands/doctor.js +8 -7
- package/dist/commands/doctor.js.map +1 -1
- package/dist/commands/edit.js +35 -29
- package/dist/commands/edit.js.map +1 -1
- package/dist/commands/eject.js +6 -6
- package/dist/commands/eject.js.map +1 -1
- package/dist/commands/import/skill.js +16 -16
- package/dist/commands/import/skill.js.map +1 -1
- package/dist/commands/info.js +7 -6
- package/dist/commands/info.js.map +1 -1
- package/dist/commands/init.js +42 -31
- package/dist/commands/init.js.map +1 -1
- package/dist/commands/list.js +6 -5
- package/dist/commands/list.js.map +1 -1
- package/dist/commands/new/agent.js +5 -5
- package/dist/commands/new/skill.js +12 -9
- package/dist/commands/new/skill.js.map +1 -1
- package/dist/commands/outdated.js +8 -5
- package/dist/commands/outdated.js.map +1 -1
- package/dist/commands/search.js +7 -7
- package/dist/commands/uninstall.js +122 -103
- package/dist/commands/uninstall.js.map +1 -1
- package/dist/commands/update.js +8 -7
- package/dist/commands/update.js.map +1 -1
- package/dist/commands/validate.js +5 -5
- package/dist/commands/version/bump.js +4 -4
- package/dist/commands/version/index.js +4 -4
- package/dist/commands/version/set.js +4 -4
- package/dist/commands/version/show.js +4 -4
- package/dist/components/skill-search/skill-search.js +3 -3
- package/dist/components/wizard/category-grid.js +3 -3
- package/dist/components/wizard/category-grid.test.js +79 -58
- package/dist/components/wizard/category-grid.test.js.map +1 -1
- package/dist/components/wizard/checkbox-grid.js +10 -0
- package/dist/components/wizard/checkbox-grid.test.js +270 -0
- package/dist/components/wizard/checkbox-grid.test.js.map +1 -0
- package/dist/components/wizard/domain-selection.js +7 -5
- package/dist/components/wizard/help-modal.js +2 -2
- package/dist/components/wizard/menu-item.js +2 -2
- package/dist/components/wizard/search-modal.js +2 -2
- package/dist/components/wizard/search-modal.test.js +2 -2
- package/dist/components/wizard/section-progress.js +2 -2
- package/dist/components/wizard/section-progress.test.js +2 -2
- package/dist/components/wizard/source-grid.js +4 -4
- package/dist/components/wizard/source-grid.test.js +4 -4
- package/dist/components/wizard/stack-selection.js +9 -8
- package/dist/components/wizard/step-agents.js +16 -0
- package/dist/components/wizard/step-agents.js.map +1 -0
- package/dist/components/wizard/step-agents.test.js +190 -0
- package/dist/components/wizard/step-agents.test.js.map +1 -0
- package/dist/components/wizard/step-build.js +10 -9
- package/dist/components/wizard/step-build.test.js +56 -53
- package/dist/components/wizard/step-build.test.js.map +1 -1
- package/dist/components/wizard/step-confirm.js +3 -3
- package/dist/components/wizard/step-confirm.test.js +19 -12
- package/dist/components/wizard/step-confirm.test.js.map +1 -1
- package/dist/components/wizard/step-refine.js +2 -2
- package/dist/components/wizard/step-refine.test.js +2 -2
- package/dist/components/wizard/step-settings.js +5 -5
- package/dist/components/wizard/step-settings.test.js +8 -8
- package/dist/components/wizard/step-sources.js +11 -10
- package/dist/components/wizard/step-sources.test.js +16 -15
- package/dist/components/wizard/step-sources.test.js.map +1 -1
- package/dist/components/wizard/step-stack.js +12 -10
- package/dist/components/wizard/step-stack.test.js +19 -19
- package/dist/components/wizard/step-stack.test.js.map +1 -1
- package/dist/components/wizard/view-title.js +2 -2
- package/dist/components/wizard/wizard-layout.js +8 -7
- package/dist/components/wizard/wizard-tabs.js +2 -2
- package/dist/components/wizard/wizard-tabs.test.js +6 -4
- package/dist/components/wizard/wizard-tabs.test.js.map +1 -1
- package/dist/components/wizard/wizard.js +27 -24
- package/dist/config/skills-matrix.yaml +124 -132
- package/dist/config/stacks.yaml +687 -687
- package/dist/hooks/init.js +3 -3
- package/dist/{source-manager-PTK4P6BF.js → source-manager-PPABS6BC.js} +4 -4
- package/dist/source-manager-PPABS6BC.js.map +1 -0
- package/dist/stores/wizard-store.js +5 -4
- package/dist/stores/wizard-store.test.js +336 -136
- package/dist/stores/wizard-store.test.js.map +1 -1
- package/package.json +1 -1
- package/src/schemas/agent.schema.json +3 -3
- package/src/schemas/metadata.schema.json +55 -15
- package/src/schemas/project-config.schema.json +42 -2
- package/src/schemas/project-source-config.schema.json +5 -5
- package/src/schemas/skills-matrix.schema.json +103 -104
- package/src/schemas/stack.schema.json +1 -1
- package/src/schemas/stacks.schema.json +41 -1
- package/dist/chunk-AQQVSNUX.js.map +0 -1
- package/dist/chunk-CEWNZQMH.js.map +0 -1
- package/dist/chunk-DC5AK3LW.js.map +0 -1
- package/dist/chunk-GGHH3KR2.js.map +0 -1
- package/dist/chunk-KWF6D7ZP.js.map +0 -1
- package/dist/chunk-LFHZBF6N.js.map +0 -1
- package/dist/chunk-MZB3GGOH.js.map +0 -1
- package/dist/chunk-NJ775OJ4.js.map +0 -1
- package/dist/chunk-NVQEHRJY.js +0 -120
- package/dist/chunk-NVQEHRJY.js.map +0 -1
- package/dist/chunk-OGXSTJP2.js.map +0 -1
- package/dist/chunk-OI4WBRC7.js.map +0 -1
- package/dist/chunk-OKILA27U.js.map +0 -1
- package/dist/chunk-PKUIO2Z7.js.map +0 -1
- package/dist/chunk-U36YCEBK.js.map +0 -1
- package/dist/chunk-UFUQUFV6.js +0 -256
- package/dist/chunk-UFUQUFV6.js.map +0 -1
- package/dist/chunk-WMVGRAFB.js.map +0 -1
- package/dist/chunk-YCS7GF6Y.js.map +0 -1
- package/dist/chunk-YIKBNGE3.js.map +0 -1
- package/dist/chunk-YN35L5NE.js.map +0 -1
- package/dist/chunk-ZE355C6C.js.map +0 -1
- /package/dist/{chunk-BLLXNFWP.js.map → chunk-2D6LKRHW.js.map} +0 -0
- /package/dist/{chunk-5LPPIT6H.js.map → chunk-4LT6RXMY.js.map} +0 -0
- /package/dist/{chunk-CXWPUVA7.js.map → chunk-4UTPJXUX.js.map} +0 -0
- /package/dist/{chunk-5YNZJ5TP.js.map → chunk-AVVYFEMF.js.map} +0 -0
- /package/dist/{chunk-OGJ7DFCL.js.map → chunk-DV4ALU5I.js.map} +0 -0
- /package/dist/{chunk-BPD4VUAU.js.map → chunk-H6H3COI5.js.map} +0 -0
- /package/dist/{chunk-HTTPKSL6.js.map → chunk-KXM7KOPE.js.map} +0 -0
- /package/dist/{chunk-IG7CUREJ.js.map → chunk-NYP5SB2V.js.map} +0 -0
- /package/dist/{chunk-JXMRTHDT.js.map → chunk-NZYKDVRL.js.map} +0 -0
- /package/dist/{chunk-XNQJBQ5X.js.map → chunk-PURJZ72D.js.map} +0 -0
- /package/dist/{chunk-VEZ2GZEK.js.map → chunk-R52N7DBG.js.map} +0 -0
- /package/dist/{chunk-YPJKOM42.js.map → chunk-WS6OQIEN.js.map} +0 -0
- /package/dist/{chunk-XYCN2GCV.js.map → chunk-ZLHGJSRK.js.map} +0 -0
- /package/dist/{source-manager-PTK4P6BF.js.map → components/wizard/checkbox-grid.js.map} +0 -0
|
@@ -42,7 +42,7 @@ import {
|
|
|
42
42
|
warn,
|
|
43
43
|
warnUnknownFields,
|
|
44
44
|
writeFile
|
|
45
|
-
} from "./chunk-
|
|
45
|
+
} from "./chunk-XJXJZ2MJ.js";
|
|
46
46
|
import {
|
|
47
47
|
ARCHIVED_SKILLS_DIR_NAME,
|
|
48
48
|
CACHE_DIR,
|
|
@@ -53,6 +53,7 @@ import {
|
|
|
53
53
|
DEFAULT_BRANDING,
|
|
54
54
|
DEFAULT_DISPLAY_VERSION,
|
|
55
55
|
DEFAULT_PLUGIN_NAME,
|
|
56
|
+
DEFAULT_PUBLIC_SOURCE_NAME,
|
|
56
57
|
DEFAULT_VERSION,
|
|
57
58
|
DIRS,
|
|
58
59
|
GITHUB_SOURCE,
|
|
@@ -75,7 +76,7 @@ import {
|
|
|
75
76
|
STANDARD_FILES,
|
|
76
77
|
YAML_FORMATTING,
|
|
77
78
|
yamlSchemaComment
|
|
78
|
-
} from "./chunk-
|
|
79
|
+
} from "./chunk-BK7TANUV.js";
|
|
79
80
|
import {
|
|
80
81
|
init_esm_shims
|
|
81
82
|
} from "./chunk-DHET7RCE.js";
|
|
@@ -196,10 +197,10 @@ async function resolveAgentsSource(flagValue, projectDir) {
|
|
|
196
197
|
return { agentsSource: flagValue, agentsSourceOrigin: "flag" };
|
|
197
198
|
}
|
|
198
199
|
const projectConfig = projectDir ? await loadProjectSourceConfig(projectDir) : null;
|
|
199
|
-
if (projectConfig?.
|
|
200
|
-
verbose(`Agents source from project config: ${projectConfig.
|
|
200
|
+
if (projectConfig?.agentsSource) {
|
|
201
|
+
verbose(`Agents source from project config: ${projectConfig.agentsSource}`);
|
|
201
202
|
return {
|
|
202
|
-
agentsSource: projectConfig.
|
|
203
|
+
agentsSource: projectConfig.agentsSource,
|
|
203
204
|
agentsSourceOrigin: "project"
|
|
204
205
|
};
|
|
205
206
|
}
|
|
@@ -413,6 +414,7 @@ function isLocalSource(source) {
|
|
|
413
414
|
init_esm_shims();
|
|
414
415
|
import { createHash as createHash2 } from "crypto";
|
|
415
416
|
import { downloadTemplate } from "giget";
|
|
417
|
+
import os2 from "os";
|
|
416
418
|
import path25 from "path";
|
|
417
419
|
|
|
418
420
|
// src/cli/lib/configuration/index.ts
|
|
@@ -603,12 +605,12 @@ import path22 from "path";
|
|
|
603
605
|
// src/cli/lib/metadata-keys.ts
|
|
604
606
|
init_esm_shims();
|
|
605
607
|
var METADATA_KEYS = {
|
|
606
|
-
CLI_NAME: "
|
|
607
|
-
CLI_DESCRIPTION: "
|
|
608
|
+
CLI_NAME: "cliName",
|
|
609
|
+
CLI_DESCRIPTION: "cliDescription",
|
|
608
610
|
CATEGORY: "category",
|
|
609
|
-
FORKED_FROM: "
|
|
610
|
-
CONTENT_HASH: "
|
|
611
|
-
USAGE_GUIDANCE: "
|
|
611
|
+
FORKED_FROM: "forkedFrom",
|
|
612
|
+
CONTENT_HASH: "contentHash",
|
|
613
|
+
USAGE_GUIDANCE: "usageGuidance"
|
|
612
614
|
};
|
|
613
615
|
var IMPORT_DEFAULTS = {
|
|
614
616
|
CATEGORY: "imported",
|
|
@@ -739,20 +741,7 @@ async function readForkedFromMetadata(skillDir) {
|
|
|
739
741
|
warn(`Invalid metadata.yaml at ${metadataPath}: ${formatZodErrors(result.error.issues)}`);
|
|
740
742
|
return null;
|
|
741
743
|
}
|
|
742
|
-
return result.data.
|
|
743
|
-
}
|
|
744
|
-
async function readLocalSkillMetadata(skillDir) {
|
|
745
|
-
const metadataPath = path4.join(skillDir, STANDARD_FILES.METADATA_YAML);
|
|
746
|
-
if (!await fileExists(metadataPath)) {
|
|
747
|
-
return null;
|
|
748
|
-
}
|
|
749
|
-
const content = await readFile(metadataPath);
|
|
750
|
-
const result = localSkillMetadataSchema.safeParse(parseYaml3(content));
|
|
751
|
-
if (!result.success) {
|
|
752
|
-
warn(`Invalid metadata.yaml at ${metadataPath}: ${formatZodErrors(result.error.issues)}`);
|
|
753
|
-
return null;
|
|
754
|
-
}
|
|
755
|
-
return result.data;
|
|
744
|
+
return result.data.forkedFrom ?? null;
|
|
756
745
|
}
|
|
757
746
|
async function getLocalSkillsWithMetadata(projectDir) {
|
|
758
747
|
const localSkillsPath = path4.join(projectDir, LOCAL_SKILLS_PATH);
|
|
@@ -764,7 +753,7 @@ async function getLocalSkillsWithMetadata(projectDir) {
|
|
|
764
753
|
for (const dirName of skillDirs) {
|
|
765
754
|
const skillDir = path4.join(localSkillsPath, dirName);
|
|
766
755
|
const forkedFrom = await readForkedFromMetadata(skillDir);
|
|
767
|
-
const skillId = forkedFrom?.
|
|
756
|
+
const skillId = forkedFrom?.skillId ?? dirName;
|
|
768
757
|
result.set(skillId, { dirName, forkedFrom });
|
|
769
758
|
}
|
|
770
759
|
return result;
|
|
@@ -790,11 +779,11 @@ async function compareLocalSkillsWithSource(projectDir, sourcePath, sourceSkills
|
|
|
790
779
|
});
|
|
791
780
|
continue;
|
|
792
781
|
}
|
|
793
|
-
const localHash = forkedFrom.
|
|
794
|
-
const sourceSkill = sourceSkills[forkedFrom.
|
|
782
|
+
const localHash = forkedFrom.contentHash;
|
|
783
|
+
const sourceSkill = sourceSkills[forkedFrom.skillId];
|
|
795
784
|
if (!sourceSkill) {
|
|
796
785
|
results.push({
|
|
797
|
-
id: forkedFrom.
|
|
786
|
+
id: forkedFrom.skillId,
|
|
798
787
|
localHash,
|
|
799
788
|
sourceHash: null,
|
|
800
789
|
status: "local-only",
|
|
@@ -805,7 +794,7 @@ async function compareLocalSkillsWithSource(projectDir, sourcePath, sourceSkills
|
|
|
805
794
|
const sourceHash = await computeSourceHash(sourcePath, sourceSkill.path);
|
|
806
795
|
if (sourceHash === null) {
|
|
807
796
|
results.push({
|
|
808
|
-
id: forkedFrom.
|
|
797
|
+
id: forkedFrom.skillId,
|
|
809
798
|
localHash,
|
|
810
799
|
sourceHash: null,
|
|
811
800
|
status: "local-only",
|
|
@@ -815,7 +804,7 @@ async function compareLocalSkillsWithSource(projectDir, sourcePath, sourceSkills
|
|
|
815
804
|
}
|
|
816
805
|
const status = localHash === sourceHash ? "current" : "outdated";
|
|
817
806
|
results.push({
|
|
818
|
-
id: forkedFrom.
|
|
807
|
+
id: forkedFrom.skillId,
|
|
819
808
|
localHash,
|
|
820
809
|
sourceHash,
|
|
821
810
|
status,
|
|
@@ -825,7 +814,7 @@ async function compareLocalSkillsWithSource(projectDir, sourcePath, sourceSkills
|
|
|
825
814
|
}
|
|
826
815
|
return sortBy(results, (r) => r.id);
|
|
827
816
|
}
|
|
828
|
-
async function injectForkedFromMetadata(destPath, skillId, contentHash) {
|
|
817
|
+
async function injectForkedFromMetadata(destPath, skillId, contentHash, source) {
|
|
829
818
|
const metadataPath = path4.join(destPath, STANDARD_FILES.METADATA_YAML);
|
|
830
819
|
const rawContent = await readFile(metadataPath);
|
|
831
820
|
const lines = rawContent.split("\n");
|
|
@@ -837,13 +826,13 @@ async function injectForkedFromMetadata(destPath, skillId, contentHash) {
|
|
|
837
826
|
if (!parseResult.success) {
|
|
838
827
|
warn(`Malformed metadata.yaml at '${metadataPath}' \u2014 existing fields may be lost`);
|
|
839
828
|
}
|
|
840
|
-
const metadata = parseResult.success ? parseResult.data : {
|
|
841
|
-
metadata.
|
|
842
|
-
|
|
843
|
-
|
|
844
|
-
date: getCurrentDate()
|
|
829
|
+
const metadata = parseResult.success ? parseResult.data : { forkedFrom: void 0 };
|
|
830
|
+
metadata.forkedFrom = {
|
|
831
|
+
skillId,
|
|
832
|
+
contentHash,
|
|
833
|
+
date: getCurrentDate(),
|
|
834
|
+
...source ? { source } : {}
|
|
845
835
|
};
|
|
846
|
-
metadata.generatedByAgentsInc = true;
|
|
847
836
|
const schemaComment = `${yamlSchemaComment(SCHEMA_PATHS.metadata)}
|
|
848
837
|
`;
|
|
849
838
|
const newYamlContent = stringifyYaml2(metadata, { lineWidth: YAML_FORMATTING.LINE_WIDTH_NONE });
|
|
@@ -888,7 +877,7 @@ async function copySkillToLocalFlattened(skill, localSkillsDir, sourceResult) {
|
|
|
888
877
|
const contentHash = await generateSkillHash(sourcePath);
|
|
889
878
|
await ensureDir(path5.dirname(destPath));
|
|
890
879
|
await copy(sourcePath, destPath);
|
|
891
|
-
await injectForkedFromMetadata(destPath, skill.id, contentHash);
|
|
880
|
+
await injectForkedFromMetadata(destPath, skill.id, contentHash, sourceResult.sourceConfig.source);
|
|
892
881
|
return {
|
|
893
882
|
skillId: skill.id,
|
|
894
883
|
contentHash,
|
|
@@ -1324,11 +1313,11 @@ function sanitizeCompiledAgentData(data) {
|
|
|
1324
1313
|
title: sanitizeLiquidSyntax(data.agent.title, "agent.title"),
|
|
1325
1314
|
description: sanitizeLiquidSyntax(data.agent.description, "agent.description"),
|
|
1326
1315
|
tools: sanitizeStringArray(data.agent.tools, "agent.tools") ?? data.agent.tools,
|
|
1327
|
-
|
|
1316
|
+
disallowedTools: sanitizeStringArray(data.agent.disallowedTools, "agent.disallowedTools"),
|
|
1328
1317
|
model: sanitizeString(data.agent.model, "agent.model"),
|
|
1329
|
-
|
|
1330
|
-
data.agent.
|
|
1331
|
-
"agent.
|
|
1318
|
+
permissionMode: sanitizeString(
|
|
1319
|
+
data.agent.permissionMode,
|
|
1320
|
+
"agent.permissionMode"
|
|
1332
1321
|
)
|
|
1333
1322
|
};
|
|
1334
1323
|
const sanitizedSkills = sanitizeSkills(data.skills);
|
|
@@ -1671,20 +1660,28 @@ async function loadMergedAgents(sourcePath) {
|
|
|
1671
1660
|
return { ...cliAgents, ...sourceAgents };
|
|
1672
1661
|
}
|
|
1673
1662
|
async function buildLocalConfig(wizardResult, sourceResult) {
|
|
1663
|
+
verbose(
|
|
1664
|
+
`buildLocalConfig: selectedStackId='${wizardResult.selectedStackId}', selectedSkills=[${wizardResult.selectedSkills.join(", ")}], selectedAgents=[${wizardResult.selectedAgents.join(", ")}], installMode='${wizardResult.installMode}'`
|
|
1665
|
+
);
|
|
1674
1666
|
let loadedStack = null;
|
|
1675
1667
|
if (wizardResult.selectedStackId) {
|
|
1676
1668
|
loadedStack = await loadStackById(wizardResult.selectedStackId, sourceResult.sourcePath);
|
|
1677
1669
|
if (!loadedStack) {
|
|
1678
1670
|
loadedStack = await loadStackById(wizardResult.selectedStackId, PROJECT_ROOT);
|
|
1679
1671
|
}
|
|
1672
|
+
verbose(
|
|
1673
|
+
`buildLocalConfig: loadedStack=${loadedStack ? `found (id='${loadedStack.id}')` : "NOT FOUND"}`
|
|
1674
|
+
);
|
|
1680
1675
|
}
|
|
1681
1676
|
let localConfig;
|
|
1677
|
+
const agentOptions = wizardResult.selectedAgents.length > 0 ? { selectedAgents: wizardResult.selectedAgents } : void 0;
|
|
1682
1678
|
if (wizardResult.selectedStackId) {
|
|
1683
1679
|
if (loadedStack) {
|
|
1684
1680
|
localConfig = generateProjectConfigFromSkills(
|
|
1685
1681
|
DEFAULT_PLUGIN_NAME,
|
|
1686
1682
|
wizardResult.selectedSkills,
|
|
1687
|
-
sourceResult.matrix
|
|
1683
|
+
sourceResult.matrix,
|
|
1684
|
+
agentOptions
|
|
1688
1685
|
);
|
|
1689
1686
|
if (localConfig.stack) {
|
|
1690
1687
|
const stackProperty = buildStackProperty(loadedStack);
|
|
@@ -1706,7 +1703,7 @@ async function buildLocalConfig(wizardResult, sourceResult) {
|
|
|
1706
1703
|
localConfig.description = loadedStack.description;
|
|
1707
1704
|
const stackAgentIds = typedKeys(loadedStack.agents);
|
|
1708
1705
|
for (const agentId of stackAgentIds) {
|
|
1709
|
-
if (!localConfig.agents.includes(agentId)) {
|
|
1706
|
+
if (!localConfig.agents.includes(agentId) && (wizardResult.selectedAgents.length === 0 || wizardResult.selectedAgents.includes(agentId))) {
|
|
1710
1707
|
localConfig.agents.push(agentId);
|
|
1711
1708
|
}
|
|
1712
1709
|
}
|
|
@@ -1720,9 +1717,13 @@ async function buildLocalConfig(wizardResult, sourceResult) {
|
|
|
1720
1717
|
localConfig = generateProjectConfigFromSkills(
|
|
1721
1718
|
DEFAULT_PLUGIN_NAME,
|
|
1722
1719
|
wizardResult.selectedSkills,
|
|
1723
|
-
sourceResult.matrix
|
|
1720
|
+
sourceResult.matrix,
|
|
1721
|
+
agentOptions
|
|
1724
1722
|
);
|
|
1725
1723
|
}
|
|
1724
|
+
verbose(
|
|
1725
|
+
`buildLocalConfig result: stack=${localConfig.stack ? Object.keys(localConfig.stack).length + " agents" : "UNDEFINED"}, agents=[${localConfig.agents.join(", ")}], skills=${localConfig.skills.length}`
|
|
1726
|
+
);
|
|
1726
1727
|
return { config: localConfig, loadedStack };
|
|
1727
1728
|
}
|
|
1728
1729
|
function setConfigMetadata(config, wizardResult, sourceResult, sourceFlag) {
|
|
@@ -1741,24 +1742,31 @@ function setConfigMetadata(config, wizardResult, sourceResult, sourceFlag) {
|
|
|
1741
1742
|
}
|
|
1742
1743
|
async function buildAndMergeConfig(wizardResult, sourceResult, projectDir, sourceFlag) {
|
|
1743
1744
|
const { config } = await buildLocalConfig(wizardResult, sourceResult);
|
|
1745
|
+
verbose(
|
|
1746
|
+
`buildAndMergeConfig: before merge \u2014 stack=${config.stack ? Object.keys(config.stack).length + " agents" : "UNDEFINED"}`
|
|
1747
|
+
);
|
|
1744
1748
|
setConfigMetadata(config, wizardResult, sourceResult, sourceFlag);
|
|
1745
|
-
|
|
1749
|
+
const result = await mergeWithExistingConfig(config, { projectDir });
|
|
1750
|
+
verbose(
|
|
1751
|
+
`buildAndMergeConfig: after merge \u2014 stack=${result.config.stack ? Object.keys(result.config.stack).length + " agents" : "UNDEFINED"}, merged=${result.merged}`
|
|
1752
|
+
);
|
|
1753
|
+
return result;
|
|
1746
1754
|
}
|
|
1747
1755
|
var CONFIG_OPTIONS_COMMENT = [
|
|
1748
1756
|
"",
|
|
1749
1757
|
"# Additional config options:",
|
|
1750
1758
|
`# source: ${DEFAULT_SOURCE}`,
|
|
1751
1759
|
"# marketplace: my-company",
|
|
1752
|
-
"#
|
|
1760
|
+
"# agentsSource: github:my-org/agents",
|
|
1753
1761
|
""
|
|
1754
1762
|
].join("\n");
|
|
1755
1763
|
var PATH_OVERRIDES_COMMENT = [
|
|
1756
1764
|
"",
|
|
1757
1765
|
"# Custom paths (for marketplace repos with non-standard layouts):",
|
|
1758
|
-
`#
|
|
1759
|
-
`#
|
|
1760
|
-
`#
|
|
1761
|
-
`#
|
|
1766
|
+
`# skillsDir: ${SKILLS_DIR_PATH}`,
|
|
1767
|
+
`# agentsDir: ${DIRS.agents}`,
|
|
1768
|
+
`# stacksFile: ${STACKS_FILE_PATH}`,
|
|
1769
|
+
`# matrixFile: ${SKILLS_MATRIX_PATH}`,
|
|
1762
1770
|
""
|
|
1763
1771
|
].join("\n");
|
|
1764
1772
|
async function writeConfigFile(config, configPath) {
|
|
@@ -2685,7 +2693,7 @@ async function extractLocalSkill(localSkillsPath, skillDirName) {
|
|
|
2685
2693
|
return null;
|
|
2686
2694
|
}
|
|
2687
2695
|
const metadata = parsed.data;
|
|
2688
|
-
if (!metadata.
|
|
2696
|
+
if (!metadata.cliName) {
|
|
2689
2697
|
warn(
|
|
2690
2698
|
`Skipping local skill '${skillDirName}': missing required '${METADATA_KEYS.CLI_NAME}' in metadata.yaml`
|
|
2691
2699
|
);
|
|
@@ -2708,17 +2716,17 @@ async function extractLocalSkill(localSkillsPath, skillDirName) {
|
|
|
2708
2716
|
const extracted = {
|
|
2709
2717
|
id: skillId,
|
|
2710
2718
|
directoryPath: skillDirName,
|
|
2711
|
-
description: metadata.
|
|
2712
|
-
usageGuidance: metadata.
|
|
2719
|
+
description: metadata.cliDescription || frontmatter.description,
|
|
2720
|
+
usageGuidance: metadata.usageGuidance,
|
|
2713
2721
|
category,
|
|
2714
|
-
categoryExclusive: metadata.
|
|
2722
|
+
categoryExclusive: metadata.categoryExclusive ?? false,
|
|
2715
2723
|
author: LOCAL_DEFAULTS.AUTHOR,
|
|
2716
2724
|
tags: metadata.tags ?? [],
|
|
2717
|
-
compatibleWith: metadata.
|
|
2718
|
-
conflictsWith: metadata.
|
|
2725
|
+
compatibleWith: metadata.compatibleWith ?? [],
|
|
2726
|
+
conflictsWith: metadata.conflictsWith ?? [],
|
|
2719
2727
|
requires: metadata.requires ?? [],
|
|
2720
|
-
requiresSetup: metadata.
|
|
2721
|
-
providesSetupFor: metadata.
|
|
2728
|
+
requiresSetup: metadata.requiresSetup ?? [],
|
|
2729
|
+
providesSetupFor: metadata.providesSetupFor ?? [],
|
|
2722
2730
|
path: relativePath,
|
|
2723
2731
|
local: true,
|
|
2724
2732
|
localPath: relativePath
|
|
@@ -2797,19 +2805,19 @@ import path20 from "path";
|
|
|
2797
2805
|
import { z as z3 } from "zod";
|
|
2798
2806
|
var rawMetadataSchema = z3.object({
|
|
2799
2807
|
category: categoryPathSchema,
|
|
2800
|
-
|
|
2808
|
+
categoryExclusive: z3.boolean().optional(),
|
|
2801
2809
|
author: z3.string(),
|
|
2802
2810
|
version: z3.coerce.string(),
|
|
2803
|
-
|
|
2804
|
-
|
|
2805
|
-
|
|
2811
|
+
cliName: z3.string().optional(),
|
|
2812
|
+
cliDescription: z3.string().optional(),
|
|
2813
|
+
usageGuidance: z3.string().optional(),
|
|
2806
2814
|
tags: z3.array(z3.string()).optional(),
|
|
2807
2815
|
// Lenient: accepts display names and skill IDs from YAML, resolved to canonical IDs during matrix merge
|
|
2808
|
-
|
|
2809
|
-
|
|
2816
|
+
compatibleWith: z3.array(z3.string()).optional(),
|
|
2817
|
+
conflictsWith: z3.array(z3.string()).optional(),
|
|
2810
2818
|
requires: z3.array(z3.string()).optional(),
|
|
2811
|
-
|
|
2812
|
-
|
|
2819
|
+
requiresSetup: z3.array(z3.string()).optional(),
|
|
2820
|
+
providesSetupFor: z3.array(z3.string()).optional()
|
|
2813
2821
|
});
|
|
2814
2822
|
async function loadSkillsMatrix(configPath) {
|
|
2815
2823
|
const content = await readFile(configPath);
|
|
@@ -2850,7 +2858,7 @@ async function extractAllSkills(skillsDir) {
|
|
|
2850
2858
|
verbose(`Skipping ${metadataFile}: Invalid SKILL.md frontmatter`);
|
|
2851
2859
|
continue;
|
|
2852
2860
|
}
|
|
2853
|
-
if (!metadata.
|
|
2861
|
+
if (!metadata.cliName) {
|
|
2854
2862
|
throw new Error(
|
|
2855
2863
|
`Skill at ${metadataFile} is missing required '${METADATA_KEYS.CLI_NAME}' field in metadata.yaml`
|
|
2856
2864
|
);
|
|
@@ -2859,17 +2867,17 @@ async function extractAllSkills(skillsDir) {
|
|
|
2859
2867
|
const extracted = {
|
|
2860
2868
|
id: skillId,
|
|
2861
2869
|
directoryPath: skillDir,
|
|
2862
|
-
description: metadata.
|
|
2863
|
-
usageGuidance: metadata.
|
|
2870
|
+
description: metadata.cliDescription || frontmatter.description,
|
|
2871
|
+
usageGuidance: metadata.usageGuidance,
|
|
2864
2872
|
category: metadata.category,
|
|
2865
|
-
categoryExclusive: metadata.
|
|
2873
|
+
categoryExclusive: metadata.categoryExclusive ?? true,
|
|
2866
2874
|
author: metadata.author,
|
|
2867
2875
|
tags: metadata.tags ?? [],
|
|
2868
|
-
compatibleWith: metadata.
|
|
2869
|
-
conflictsWith: metadata.
|
|
2876
|
+
compatibleWith: metadata.compatibleWith ?? [],
|
|
2877
|
+
conflictsWith: metadata.conflictsWith ?? [],
|
|
2870
2878
|
requires: metadata.requires ?? [],
|
|
2871
|
-
requiresSetup: metadata.
|
|
2872
|
-
providesSetupFor: metadata.
|
|
2879
|
+
requiresSetup: metadata.requiresSetup ?? [],
|
|
2880
|
+
providesSetupFor: metadata.providesSetupFor ?? [],
|
|
2873
2881
|
path: `skills/${skillDir}/`
|
|
2874
2882
|
};
|
|
2875
2883
|
skills.push(extracted);
|
|
@@ -2943,7 +2951,7 @@ function resolveToCanonicalId(nameOrId, displayNameToId, directoryPathToId = {},
|
|
|
2943
2951
|
return nameOrId;
|
|
2944
2952
|
}
|
|
2945
2953
|
async function mergeMatrixWithSkills(matrix, skills) {
|
|
2946
|
-
const displayNameToId = matrix.
|
|
2954
|
+
const displayNameToId = matrix.skillAliases;
|
|
2947
2955
|
const displayNames = buildReverseDisplayNames(displayNameToId);
|
|
2948
2956
|
const directoryPathToId = buildDirectoryPathToIdMap(skills);
|
|
2949
2957
|
const aliasTargetToSkillId = buildAliasTargetToSkillIdMap(displayNameToId, skills);
|
|
@@ -3022,7 +3030,7 @@ function resolveRequirements(skillId, metadataRequires, requireRules, resolve) {
|
|
|
3022
3030
|
if (resolve(rule.skill, "requires.skill") !== skillId) continue;
|
|
3023
3031
|
requires.push({
|
|
3024
3032
|
skillIds: rule.needs.map((id) => resolve(id, "requires.needs")),
|
|
3025
|
-
needsAny: rule.
|
|
3033
|
+
needsAny: rule.needsAny ?? false,
|
|
3026
3034
|
reason: rule.reason
|
|
3027
3035
|
});
|
|
3028
3036
|
}
|
|
@@ -3287,7 +3295,7 @@ function validateRequirements(resolvedSelections, selectedSet, matrix) {
|
|
|
3287
3295
|
const hasAny = requirement.skillIds.some((reqId) => selectedSet.has(reqId));
|
|
3288
3296
|
if (!hasAny) {
|
|
3289
3297
|
errors.push({
|
|
3290
|
-
type: "
|
|
3298
|
+
type: "missingRequirement",
|
|
3291
3299
|
message: `${getLabel(skill, skillId)} requires one of: ${requirement.skillIds.map((id) => getLabel(matrix.skills[id], id)).join(", ")}`,
|
|
3292
3300
|
skills: [skillId, ...requirement.skillIds]
|
|
3293
3301
|
});
|
|
@@ -3296,7 +3304,7 @@ function validateRequirements(resolvedSelections, selectedSet, matrix) {
|
|
|
3296
3304
|
const missingIds = requirement.skillIds.filter((reqId) => !selectedSet.has(reqId));
|
|
3297
3305
|
if (missingIds.length > 0) {
|
|
3298
3306
|
errors.push({
|
|
3299
|
-
type: "
|
|
3307
|
+
type: "missingRequirement",
|
|
3300
3308
|
message: `${getLabel(skill, skillId)} requires: ${missingIds.map((id) => getLabel(matrix.skills[id], id)).join(", ")}`,
|
|
3301
3309
|
skills: [skillId, ...missingIds]
|
|
3302
3310
|
});
|
|
@@ -3316,7 +3324,7 @@ function validateExclusivity(resolvedSelections, matrix) {
|
|
|
3316
3324
|
const category = matrix.categories[categoryId];
|
|
3317
3325
|
if (category?.exclusive) {
|
|
3318
3326
|
errors.push({
|
|
3319
|
-
type: "
|
|
3327
|
+
type: "categoryExclusive",
|
|
3320
3328
|
message: `Category "${category.displayName}" only allows one selection, but multiple selected: ${skillIds.map((id) => getLabel(matrix.skills[id], id)).join(", ")}`,
|
|
3321
3329
|
skills: skillIds
|
|
3322
3330
|
});
|
|
@@ -3555,22 +3563,29 @@ function checkStackSkillIds(matrix, skillIds, issues) {
|
|
|
3555
3563
|
// src/cli/lib/loading/multi-source-loader.ts
|
|
3556
3564
|
init_esm_shims();
|
|
3557
3565
|
import path21 from "path";
|
|
3558
|
-
|
|
3559
|
-
|
|
3560
|
-
|
|
3566
|
+
async function loadSkillsFromAllSources(primaryMatrix, sourceConfig, projectDir, forceRefresh = false, marketplace) {
|
|
3567
|
+
const resolvedMarketplace = marketplace ?? sourceConfig.marketplace;
|
|
3568
|
+
const isDefaultPublicSource = sourceConfig.source === DEFAULT_SOURCE;
|
|
3569
|
+
const primarySourceName = resolvedMarketplace ?? DEFAULT_PUBLIC_SOURCE_NAME;
|
|
3570
|
+
const primarySourceType = isDefaultPublicSource ? "public" : "private";
|
|
3571
|
+
tagPrimarySourceSkills(primaryMatrix, primarySourceName, primarySourceType);
|
|
3561
3572
|
tagLocalSkills(primaryMatrix);
|
|
3562
|
-
await tagPluginSkills(primaryMatrix, projectDir);
|
|
3563
|
-
|
|
3573
|
+
await tagPluginSkills(primaryMatrix, projectDir, primarySourceName, primarySourceType);
|
|
3574
|
+
if (!isDefaultPublicSource) {
|
|
3575
|
+
await tagPublicSourceSkills(primaryMatrix, forceRefresh);
|
|
3576
|
+
}
|
|
3577
|
+
await tagExtraSources(primaryMatrix, projectDir, forceRefresh);
|
|
3564
3578
|
setActiveSources(primaryMatrix);
|
|
3565
3579
|
}
|
|
3566
|
-
function tagPrimarySourceSkills(matrix) {
|
|
3580
|
+
function tagPrimarySourceSkills(matrix, sourceName, sourceType) {
|
|
3567
3581
|
for (const [, skill] of typedEntries(matrix.skills)) {
|
|
3568
3582
|
if (!skill) continue;
|
|
3569
3583
|
const source = {
|
|
3570
|
-
name:
|
|
3571
|
-
type:
|
|
3584
|
+
name: sourceName,
|
|
3585
|
+
type: sourceType,
|
|
3572
3586
|
version: skill.version,
|
|
3573
|
-
installed: false
|
|
3587
|
+
installed: false,
|
|
3588
|
+
primary: true
|
|
3574
3589
|
};
|
|
3575
3590
|
skill.availableSources = skill.availableSources ?? [];
|
|
3576
3591
|
skill.availableSources.push(source);
|
|
@@ -3593,7 +3608,7 @@ function tagLocalSkills(matrix) {
|
|
|
3593
3608
|
}
|
|
3594
3609
|
verbose(`Tagged ${count} local skills with local source`);
|
|
3595
3610
|
}
|
|
3596
|
-
async function tagPluginSkills(matrix, projectDir) {
|
|
3611
|
+
async function tagPluginSkills(matrix, projectDir, primarySourceName, primarySourceType) {
|
|
3597
3612
|
const allPluginSkillIds = await collectPluginSkillIds(matrix, projectDir);
|
|
3598
3613
|
if (allPluginSkillIds.length === 0) {
|
|
3599
3614
|
return;
|
|
@@ -3602,17 +3617,18 @@ async function tagPluginSkills(matrix, projectDir) {
|
|
|
3602
3617
|
const skill = matrix.skills[skillId];
|
|
3603
3618
|
if (!skill) continue;
|
|
3604
3619
|
skill.availableSources = skill.availableSources ?? [];
|
|
3605
|
-
const existingSource = skill.availableSources.find((s) => s.
|
|
3620
|
+
const existingSource = skill.availableSources.find((s) => s.name === primarySourceName);
|
|
3606
3621
|
if (existingSource && !existingSource.installMode) {
|
|
3607
3622
|
existingSource.installed = true;
|
|
3608
3623
|
existingSource.installMode = "plugin";
|
|
3609
3624
|
} else if (!skill.availableSources.some((s) => s.installMode === "plugin")) {
|
|
3610
3625
|
skill.availableSources.push({
|
|
3611
|
-
name:
|
|
3612
|
-
type:
|
|
3626
|
+
name: primarySourceName,
|
|
3627
|
+
type: primarySourceType,
|
|
3613
3628
|
version: skill.version,
|
|
3614
3629
|
installed: true,
|
|
3615
|
-
installMode: "plugin"
|
|
3630
|
+
installMode: "plugin",
|
|
3631
|
+
primary: true
|
|
3616
3632
|
});
|
|
3617
3633
|
}
|
|
3618
3634
|
}
|
|
@@ -3620,18 +3636,51 @@ async function tagPluginSkills(matrix, projectDir) {
|
|
|
3620
3636
|
}
|
|
3621
3637
|
async function collectPluginSkillIds(_matrix, projectDir) {
|
|
3622
3638
|
const pluginSkills = await discoverAllPluginSkills(projectDir);
|
|
3623
|
-
const skillIds =
|
|
3639
|
+
const skillIds = typedKeys(pluginSkills);
|
|
3624
3640
|
if (skillIds.length === 0) {
|
|
3625
3641
|
verbose("No plugin skills discovered from settings.json");
|
|
3626
3642
|
}
|
|
3627
3643
|
return skillIds;
|
|
3628
3644
|
}
|
|
3629
|
-
async function
|
|
3645
|
+
async function tagPublicSourceSkills(matrix, forceRefresh) {
|
|
3646
|
+
let publicSourceName = DEFAULT_PUBLIC_SOURCE_NAME;
|
|
3647
|
+
try {
|
|
3648
|
+
const marketplaceResult = await fetchMarketplace(DEFAULT_SOURCE, { forceRefresh });
|
|
3649
|
+
publicSourceName = marketplaceResult.marketplace.name;
|
|
3650
|
+
verbose(`Public marketplace name from marketplace.json: ${publicSourceName}`);
|
|
3651
|
+
} catch {
|
|
3652
|
+
verbose("Public source has no marketplace.json -- using default label");
|
|
3653
|
+
}
|
|
3654
|
+
try {
|
|
3655
|
+
const fetchResult = await fetchFromSource(DEFAULT_SOURCE, { forceRefresh });
|
|
3656
|
+
const skillsDir = path21.join(fetchResult.path, SKILLS_DIR_PATH);
|
|
3657
|
+
const publicSkills = await extractAllSkills(skillsDir);
|
|
3658
|
+
let matchCount = 0;
|
|
3659
|
+
for (const publicSkill of publicSkills) {
|
|
3660
|
+
const matrixSkill = matrix.skills[publicSkill.id];
|
|
3661
|
+
if (!matrixSkill) continue;
|
|
3662
|
+
const source = {
|
|
3663
|
+
name: publicSourceName,
|
|
3664
|
+
type: "public",
|
|
3665
|
+
installed: false
|
|
3666
|
+
};
|
|
3667
|
+
matrixSkill.availableSources = matrixSkill.availableSources ?? [];
|
|
3668
|
+
matrixSkill.availableSources.push(source);
|
|
3669
|
+
matchCount++;
|
|
3670
|
+
}
|
|
3671
|
+
verbose(
|
|
3672
|
+
`Public source: ${publicSkills.length} skills found, ${matchCount} matching primary matrix`
|
|
3673
|
+
);
|
|
3674
|
+
} catch (error) {
|
|
3675
|
+
warn(`Failed to load public source for alternative tagging: ${getErrorMessage(error)}`);
|
|
3676
|
+
}
|
|
3677
|
+
}
|
|
3678
|
+
async function tagExtraSources(matrix, projectDir, forceRefresh) {
|
|
3630
3679
|
let allSources;
|
|
3631
3680
|
try {
|
|
3632
3681
|
allSources = await resolveAllSources(projectDir);
|
|
3633
3682
|
} catch (error) {
|
|
3634
|
-
verbose(`Failed to resolve extra sources: ${error}`);
|
|
3683
|
+
verbose(`Failed to resolve extra sources: ${getErrorMessage(error)}`);
|
|
3635
3684
|
return;
|
|
3636
3685
|
}
|
|
3637
3686
|
if (allSources.extras.length === 0) {
|
|
@@ -3641,7 +3690,7 @@ async function tagExtraSources(matrix, projectDir) {
|
|
|
3641
3690
|
for (const extraSource of allSources.extras) {
|
|
3642
3691
|
verbose(`Loading extra source: ${extraSource.name} (${extraSource.url})`);
|
|
3643
3692
|
try {
|
|
3644
|
-
const fetchResult = await fetchFromSource(extraSource.url, { forceRefresh
|
|
3693
|
+
const fetchResult = await fetchFromSource(extraSource.url, { forceRefresh });
|
|
3645
3694
|
const skillsDir = path21.join(fetchResult.path, SKILLS_DIR_PATH);
|
|
3646
3695
|
const skills = await extractAllSkills(skillsDir);
|
|
3647
3696
|
let matchCount = 0;
|
|
@@ -3662,7 +3711,9 @@ async function tagExtraSources(matrix, projectDir) {
|
|
|
3662
3711
|
`Extra source '${extraSource.name}': ${skills.length} skills found, ${matchCount} matching`
|
|
3663
3712
|
);
|
|
3664
3713
|
} catch (error) {
|
|
3665
|
-
warn(
|
|
3714
|
+
warn(
|
|
3715
|
+
`Failed to load extra source '${extraSource.name}' ('${extraSource.url}'): ${getErrorMessage(error)}`
|
|
3716
|
+
);
|
|
3666
3717
|
}
|
|
3667
3718
|
}
|
|
3668
3719
|
}
|
|
@@ -3699,7 +3750,9 @@ async function searchExtraSources(alias, configuredSources) {
|
|
|
3699
3750
|
}
|
|
3700
3751
|
}
|
|
3701
3752
|
} catch (error) {
|
|
3702
|
-
warn(
|
|
3753
|
+
warn(
|
|
3754
|
+
`Failed to search extra source '${source.name}' ('${source.url}'): ${getErrorMessage(error)}`
|
|
3755
|
+
);
|
|
3703
3756
|
}
|
|
3704
3757
|
}
|
|
3705
3758
|
return candidates;
|
|
@@ -3726,7 +3779,13 @@ async function loadSkillsMatrixFromSource(options = {}) {
|
|
|
3726
3779
|
);
|
|
3727
3780
|
result.matrix = mergeLocalSkillsIntoMatrix(result.matrix, localSkillsResult);
|
|
3728
3781
|
}
|
|
3729
|
-
await loadSkillsFromAllSources(
|
|
3782
|
+
await loadSkillsFromAllSources(
|
|
3783
|
+
result.matrix,
|
|
3784
|
+
sourceConfig,
|
|
3785
|
+
resolvedProjectDir,
|
|
3786
|
+
forceRefresh,
|
|
3787
|
+
result.marketplace
|
|
3788
|
+
);
|
|
3730
3789
|
checkMatrixHealth(result.matrix);
|
|
3731
3790
|
return result;
|
|
3732
3791
|
}
|
|
@@ -3772,9 +3831,9 @@ async function loadFromRemote(source, sourceConfig, forceRefresh) {
|
|
|
3772
3831
|
}
|
|
3773
3832
|
async function loadAndMergeFromBasePath(basePath) {
|
|
3774
3833
|
const sourceProjectConfig = await loadProjectSourceConfig(basePath);
|
|
3775
|
-
const matrixRelPath = sourceProjectConfig?.
|
|
3776
|
-
const skillsDirRelPath = sourceProjectConfig?.
|
|
3777
|
-
const stacksRelFile = sourceProjectConfig?.
|
|
3834
|
+
const matrixRelPath = sourceProjectConfig?.matrixFile ?? SKILLS_MATRIX_PATH;
|
|
3835
|
+
const skillsDirRelPath = sourceProjectConfig?.skillsDir ?? SKILLS_DIR_PATH;
|
|
3836
|
+
const stacksRelFile = sourceProjectConfig?.stacksFile;
|
|
3778
3837
|
const sourceMatrixPath = path22.join(basePath, matrixRelPath);
|
|
3779
3838
|
const cliMatrixPath = path22.join(PROJECT_ROOT, SKILLS_MATRIX_PATH);
|
|
3780
3839
|
let matrixPath;
|
|
@@ -3886,7 +3945,8 @@ import { fileURLToPath } from "url";
|
|
|
3886
3945
|
var cachedDefaults = null;
|
|
3887
3946
|
function getDefaultsPath() {
|
|
3888
3947
|
const currentDir = path23.dirname(fileURLToPath(import.meta.url));
|
|
3889
|
-
|
|
3948
|
+
const isInDist = currentDir.includes("/dist");
|
|
3949
|
+
return isInDist ? path23.join(currentDir, "cli", "defaults", "agent-mappings.yaml") : path23.join(currentDir, "../..", "defaults", "agent-mappings.yaml");
|
|
3890
3950
|
}
|
|
3891
3951
|
async function loadDefaultMappings() {
|
|
3892
3952
|
if (cachedDefaults !== null) {
|
|
@@ -3911,8 +3971,8 @@ function getCachedDefaults() {
|
|
|
3911
3971
|
var DEFAULT_AGENTS = ["agent-summoner", "skill-summoner", "documentor"];
|
|
3912
3972
|
function getEffectiveSkillToAgents() {
|
|
3913
3973
|
const defaults = getCachedDefaults();
|
|
3914
|
-
if (defaults?.
|
|
3915
|
-
return defaults.
|
|
3974
|
+
if (defaults?.skillToAgents) {
|
|
3975
|
+
return defaults.skillToAgents;
|
|
3916
3976
|
}
|
|
3917
3977
|
return {};
|
|
3918
3978
|
}
|
|
@@ -3939,22 +3999,39 @@ function getAgentsForSkill(skillPath, category) {
|
|
|
3939
3999
|
}
|
|
3940
4000
|
function extractSubcategoryFromPath(categoryPath) {
|
|
3941
4001
|
if (categoryPath === "local") return void 0;
|
|
3942
|
-
|
|
3943
|
-
return parts.length >= 2 ? parts[1] : parts[0];
|
|
4002
|
+
return categoryPath;
|
|
3944
4003
|
}
|
|
3945
4004
|
function generateProjectConfigFromSkills(name, selectedSkillIds, matrix, options) {
|
|
3946
4005
|
const neededAgents = /* @__PURE__ */ new Set();
|
|
3947
4006
|
const stackProperty = {};
|
|
4007
|
+
const selectedAgentSet = options?.selectedAgents ? new Set(options.selectedAgents) : null;
|
|
4008
|
+
verbose(
|
|
4009
|
+
`generateProjectConfigFromSkills: ${selectedSkillIds.length} skills, matrix has ${Object.keys(matrix.skills).length} entries, selectedAgentSet=${selectedAgentSet ? `[${[...selectedAgentSet].join(", ")}]` : "null"}`
|
|
4010
|
+
);
|
|
4011
|
+
let foundCount = 0;
|
|
4012
|
+
let skippedCount = 0;
|
|
3948
4013
|
for (const skillId of selectedSkillIds) {
|
|
3949
4014
|
const skill = matrix.skills[skillId];
|
|
3950
4015
|
if (!skill) {
|
|
4016
|
+
skippedCount++;
|
|
4017
|
+
warn(`Skill '${skillId}' NOT FOUND in matrix`);
|
|
3951
4018
|
continue;
|
|
3952
4019
|
}
|
|
4020
|
+
foundCount++;
|
|
3953
4021
|
const skillPath = skill.path;
|
|
3954
4022
|
const category = skill.category;
|
|
3955
4023
|
const agents = getAgentsForSkill(skillPath, category);
|
|
3956
4024
|
const subcategory = extractSubcategoryFromPath(category);
|
|
3957
|
-
|
|
4025
|
+
const effectiveAgents = selectedAgentSet ? agents.filter((a) => selectedAgentSet.has(a)) : agents;
|
|
4026
|
+
verbose(
|
|
4027
|
+
` skill '${skillId}': category='${category}', subcategory=${subcategory ?? "none"}, agents=[${agents.join(", ")}], effectiveAgents=[${effectiveAgents.join(", ")}]`
|
|
4028
|
+
);
|
|
4029
|
+
if (effectiveAgents.length === 0) {
|
|
4030
|
+
warn(
|
|
4031
|
+
`Skill '${skillId}': all agents filtered out by selectedAgentSet \u2014 derived=[${agents.join(", ")}], selected=[${[...selectedAgentSet ?? []].join(", ")}]`
|
|
4032
|
+
);
|
|
4033
|
+
}
|
|
4034
|
+
for (const agentId of effectiveAgents) {
|
|
3958
4035
|
neededAgents.add(agentId);
|
|
3959
4036
|
if (subcategory) {
|
|
3960
4037
|
if (!stackProperty[agentId]) {
|
|
@@ -3964,9 +4041,19 @@ function generateProjectConfigFromSkills(name, selectedSkillIds, matrix, options
|
|
|
3964
4041
|
}
|
|
3965
4042
|
}
|
|
3966
4043
|
}
|
|
4044
|
+
verbose(
|
|
4045
|
+
`generateProjectConfigFromSkills: ${foundCount} found, ${skippedCount} not found, ${Object.keys(stackProperty).length} agents in stack`
|
|
4046
|
+
);
|
|
4047
|
+
if (skippedCount > 0) {
|
|
4048
|
+
const matrixSample = Object.keys(matrix.skills).slice(0, 5).join(", ");
|
|
4049
|
+
warn(
|
|
4050
|
+
`${skippedCount}/${selectedSkillIds.length} skills not found in matrix. Matrix keys sample: [${matrixSample}]`
|
|
4051
|
+
);
|
|
4052
|
+
}
|
|
4053
|
+
const agentList = options?.selectedAgents ? [...options.selectedAgents].sort() : Array.from(neededAgents).sort();
|
|
3967
4054
|
const config = {
|
|
3968
4055
|
name,
|
|
3969
|
-
agents:
|
|
4056
|
+
agents: agentList,
|
|
3970
4057
|
skills: [...selectedSkillIds]
|
|
3971
4058
|
};
|
|
3972
4059
|
if (Object.keys(stackProperty).length > 0) {
|
|
@@ -4131,8 +4218,8 @@ async function mergeWithExistingConfig(newConfig, context) {
|
|
|
4131
4218
|
if (existingConfig.author) {
|
|
4132
4219
|
localConfig.author = existingConfig.author;
|
|
4133
4220
|
}
|
|
4134
|
-
if (existingConfig.
|
|
4135
|
-
localConfig.
|
|
4221
|
+
if (existingConfig.agentsSource) {
|
|
4222
|
+
localConfig.agentsSource = existingConfig.agentsSource;
|
|
4136
4223
|
}
|
|
4137
4224
|
if (existingConfig.marketplace) {
|
|
4138
4225
|
localConfig.marketplace = existingConfig.marketplace;
|
|
@@ -4147,8 +4234,8 @@ async function mergeWithExistingConfig(newConfig, context) {
|
|
|
4147
4234
|
if (existingProjectConfig?.author) {
|
|
4148
4235
|
localConfig.author = existingProjectConfig.author;
|
|
4149
4236
|
}
|
|
4150
|
-
if (existingProjectConfig?.
|
|
4151
|
-
localConfig.
|
|
4237
|
+
if (existingProjectConfig?.agentsSource) {
|
|
4238
|
+
localConfig.agentsSource = existingProjectConfig.agentsSource;
|
|
4152
4239
|
}
|
|
4153
4240
|
return { config: localConfig, merged: false };
|
|
4154
4241
|
}
|
|
@@ -4163,6 +4250,8 @@ async function saveSourceToProjectConfig(projectDir, source) {
|
|
|
4163
4250
|
// src/cli/lib/loading/source-fetcher.ts
|
|
4164
4251
|
var SAFE_NAME_PATTERN = /^[a-zA-Z0-9@._/ -]+$/;
|
|
4165
4252
|
var MAX_NAME_LENGTH = 200;
|
|
4253
|
+
var SOURCE_PROTO_RE = /^([\w-.]+):/;
|
|
4254
|
+
var GIT_URI_RE = /^(?<repo>[\w.-]+\/[\w.-]+)(?<subdir>[^#]+)?(?<ref>#[\w./@-]+)?/;
|
|
4166
4255
|
function sanitizeSourceForCache(source) {
|
|
4167
4256
|
const hash = createHash2("sha256").update(source).digest("hex").slice(0, CACHE_HASH_LENGTH);
|
|
4168
4257
|
const readable = source.replace(/[^a-zA-Z0-9]/g, "-").replace(/--+/g, "-").replace(/^-|-$/g, "").slice(0, CACHE_READABLE_PREFIX_LENGTH);
|
|
@@ -4192,6 +4281,33 @@ async function fetchFromLocalSource(source, subdir) {
|
|
|
4192
4281
|
source
|
|
4193
4282
|
};
|
|
4194
4283
|
}
|
|
4284
|
+
function getGigetCacheDir(source) {
|
|
4285
|
+
let providerName = "github";
|
|
4286
|
+
let rawSource = source;
|
|
4287
|
+
const protoMatch = source.match(SOURCE_PROTO_RE);
|
|
4288
|
+
if (protoMatch) {
|
|
4289
|
+
providerName = protoMatch[1];
|
|
4290
|
+
rawSource = source.slice(protoMatch[0].length);
|
|
4291
|
+
if (providerName === "http" || providerName === "https") {
|
|
4292
|
+
return void 0;
|
|
4293
|
+
}
|
|
4294
|
+
}
|
|
4295
|
+
const uriMatch = rawSource.match(GIT_URI_RE);
|
|
4296
|
+
if (!uriMatch?.groups?.repo) {
|
|
4297
|
+
return void 0;
|
|
4298
|
+
}
|
|
4299
|
+
const templateName = uriMatch.groups.repo.replace("/", "-").replace(/[^\da-z-]/gi, "-");
|
|
4300
|
+
const gigetCacheRoot = process.env.XDG_CACHE_HOME ? path25.resolve(process.env.XDG_CACHE_HOME, "giget") : path25.resolve(os2.homedir(), ".cache", "giget");
|
|
4301
|
+
return path25.join(gigetCacheRoot, providerName, templateName);
|
|
4302
|
+
}
|
|
4303
|
+
async function clearGigetCache(source) {
|
|
4304
|
+
const gigetDir = getGigetCacheDir(source);
|
|
4305
|
+
if (!gigetDir) return;
|
|
4306
|
+
if (await directoryExists(gigetDir)) {
|
|
4307
|
+
verbose(`Clearing giget cache: ${gigetDir}`);
|
|
4308
|
+
await remove(gigetDir);
|
|
4309
|
+
}
|
|
4310
|
+
}
|
|
4195
4311
|
async function fetchFromRemoteSource(source, options) {
|
|
4196
4312
|
const { forceRefresh = false, subdir } = options;
|
|
4197
4313
|
const cacheDir = getCacheDir(source);
|
|
@@ -4206,6 +4322,9 @@ async function fetchFromRemoteSource(source, options) {
|
|
|
4206
4322
|
source: fullSource
|
|
4207
4323
|
};
|
|
4208
4324
|
}
|
|
4325
|
+
if (forceRefresh) {
|
|
4326
|
+
await clearGigetCache(source);
|
|
4327
|
+
}
|
|
4209
4328
|
await ensureDir(path25.dirname(cacheDir));
|
|
4210
4329
|
try {
|
|
4211
4330
|
const result = await downloadTemplate(fullSource, {
|
|
@@ -4442,7 +4561,6 @@ export {
|
|
|
4442
4561
|
determinePluginVersion,
|
|
4443
4562
|
writeContentHash,
|
|
4444
4563
|
readForkedFromMetadata,
|
|
4445
|
-
readLocalSkillMetadata,
|
|
4446
4564
|
compareLocalSkillsWithSource,
|
|
4447
4565
|
injectForkedFromMetadata,
|
|
4448
4566
|
copySkillsToLocalFlattened,
|
|
@@ -4490,4 +4608,4 @@ export {
|
|
|
4490
4608
|
validateAllPlugins,
|
|
4491
4609
|
printPluginValidationResult
|
|
4492
4610
|
};
|
|
4493
|
-
//# sourceMappingURL=chunk-
|
|
4611
|
+
//# sourceMappingURL=chunk-TTXV55NQ.js.map
|