agents-inc 0.176.0 → 0.177.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/CHANGELOG.md +65 -0
- package/README.md +2 -2
- package/dist/{chunk-FACDJH6O.js → chunk-2FE4AJNC.js} +20 -26
- package/dist/chunk-2FE4AJNC.js.map +1 -0
- package/dist/{chunk-U46LYYRA.js → chunk-4SIBDIIO.js} +49 -13
- package/dist/chunk-4SIBDIIO.js.map +1 -0
- package/dist/chunk-5ZK4IND4.js +30 -0
- package/dist/chunk-5ZK4IND4.js.map +1 -0
- package/dist/{chunk-MQZNDK5F.js → chunk-77SHXTDD.js} +137 -56
- package/dist/chunk-77SHXTDD.js.map +1 -0
- package/dist/{chunk-U672FZVC.js → chunk-7OJ2SS4E.js} +10 -86
- package/dist/chunk-7OJ2SS4E.js.map +1 -0
- package/dist/{chunk-C2BSCEDN.js → chunk-7WN6TUZP.js} +7 -8
- package/dist/chunk-7WN6TUZP.js.map +1 -0
- package/dist/chunk-AVKX3IXF.js +117 -0
- package/dist/chunk-AVKX3IXF.js.map +1 -0
- package/dist/{chunk-ENET4IF6.js → chunk-D2PC7NIR.js} +1653 -1734
- package/dist/chunk-D2PC7NIR.js.map +1 -0
- package/dist/{chunk-JTMSFBCA.js → chunk-E6W3PYGF.js} +823 -72
- package/dist/chunk-E6W3PYGF.js.map +1 -0
- package/dist/chunk-H33ZAEKH.js +147 -0
- package/dist/chunk-H33ZAEKH.js.map +1 -0
- package/dist/{chunk-B7AVWSK2.js → chunk-JEFVFZAR.js} +39 -151
- package/dist/chunk-JEFVFZAR.js.map +1 -0
- package/dist/{chunk-UE4Z3YMB.js → chunk-KKGJH46C.js} +3 -21
- package/dist/chunk-KKGJH46C.js.map +1 -0
- package/dist/chunk-OIQKRXHH.js +142 -0
- package/dist/chunk-OIQKRXHH.js.map +1 -0
- package/dist/{chunk-CKBWEWHZ.js → chunk-TNN72UL6.js} +264 -247
- package/dist/chunk-TNN72UL6.js.map +1 -0
- package/dist/{chunk-XMQIWPIR.js → chunk-V3WJMNBF.js} +45 -18
- package/dist/chunk-V3WJMNBF.js.map +1 -0
- package/dist/chunk-VFD2XYM7.js +14 -0
- package/dist/chunk-VFD2XYM7.js.map +1 -0
- package/dist/{chunk-XYBHH3M5.js → chunk-WH7JXGDA.js} +2 -2
- package/dist/{chunk-JNRACLNS.js → chunk-XSR4WRXJ.js} +3 -3
- package/dist/{chunk-3F5LT433.js → chunk-Y5VMB73R.js} +202 -116
- package/dist/chunk-Y5VMB73R.js.map +1 -0
- package/dist/chunk-ZIBWVTLN.js +18 -0
- package/dist/chunk-ZIBWVTLN.js.map +1 -0
- package/dist/commands/build/marketplace.js +6 -10
- package/dist/commands/build/marketplace.js.map +1 -1
- package/dist/commands/build/plugins.js +10 -39
- package/dist/commands/build/plugins.js.map +1 -1
- package/dist/commands/compile.js +60 -81
- package/dist/commands/compile.js.map +1 -1
- package/dist/commands/doctor.js +234 -145
- package/dist/commands/doctor.js.map +1 -1
- package/dist/commands/edit.js +64 -159
- package/dist/commands/edit.js.map +1 -1
- package/dist/commands/eject.js +64 -54
- package/dist/commands/eject.js.map +1 -1
- package/dist/commands/init.js +19 -17
- package/dist/commands/list.js +10 -12
- package/dist/commands/list.js.map +1 -1
- package/dist/commands/new/marketplace.js +5 -5
- package/dist/commands/search.js +14 -13
- package/dist/commands/search.js.map +1 -1
- package/dist/commands/share.js +21 -44
- package/dist/commands/share.js.map +1 -1
- package/dist/commands/uninstall.js +139 -56
- package/dist/commands/uninstall.js.map +1 -1
- package/dist/commands/update.js +22 -37
- package/dist/commands/update.js.map +1 -1
- package/dist/components/common/header-row.js +9 -0
- package/dist/components/common/select-list.js +2 -2
- package/dist/components/common/skill-agent-summary.js +4 -4
- package/dist/components/common/summary-panel.js +6 -5
- package/dist/hooks/init.js +35 -22
- package/dist/hooks/init.js.map +1 -1
- package/dist/load-agent-defs-OCFWOZD2.js +14 -0
- package/dist/{recompile-project-agents-U3UGHPWG.js → recompile-project-agents-CXZBPIUS.js} +9 -9
- package/dist/{recompile-project-agents-U3UGHPWG.js.map → recompile-project-agents-CXZBPIUS.js.map} +1 -1
- package/dist/{source-loader-E2Y5MMN5.js → source-loader-GGDQDMN4.js} +6 -4
- package/dist/source-loader-GGDQDMN4.js.map +1 -0
- package/package.json +1 -1
- package/src/schemas/stacks.schema.json +105 -1
- package/dist/chunk-3F5LT433.js.map +0 -1
- package/dist/chunk-5CFHP6Z5.js +0 -109
- package/dist/chunk-5CFHP6Z5.js.map +0 -1
- package/dist/chunk-B7AVWSK2.js.map +0 -1
- package/dist/chunk-C2BSCEDN.js.map +0 -1
- package/dist/chunk-CKBWEWHZ.js.map +0 -1
- package/dist/chunk-EC3JXT23.js +0 -160
- package/dist/chunk-EC3JXT23.js.map +0 -1
- package/dist/chunk-ENET4IF6.js.map +0 -1
- package/dist/chunk-FACDJH6O.js.map +0 -1
- package/dist/chunk-H6WUOW5F.js +0 -35
- package/dist/chunk-H6WUOW5F.js.map +0 -1
- package/dist/chunk-JTMSFBCA.js.map +0 -1
- package/dist/chunk-MQZNDK5F.js.map +0 -1
- package/dist/chunk-SN64WNWE.js +0 -428
- package/dist/chunk-SN64WNWE.js.map +0 -1
- package/dist/chunk-U46LYYRA.js.map +0 -1
- package/dist/chunk-U672FZVC.js.map +0 -1
- package/dist/chunk-UE4Z3YMB.js.map +0 -1
- package/dist/chunk-XMQIWPIR.js.map +0 -1
- package/dist/chunk-ZBI6GFJD.js +0 -39
- package/dist/chunk-ZBI6GFJD.js.map +0 -1
- package/dist/load-agent-defs-5BSECHE6.js +0 -14
- /package/dist/{chunk-XYBHH3M5.js.map → chunk-WH7JXGDA.js.map} +0 -0
- /package/dist/{chunk-JNRACLNS.js.map → chunk-XSR4WRXJ.js.map} +0 -0
- /package/dist/{load-agent-defs-5BSECHE6.js.map → components/common/header-row.js.map} +0 -0
- /package/dist/{source-loader-E2Y5MMN5.js.map → load-agent-defs-OCFWOZD2.js.map} +0 -0
|
@@ -8,12 +8,8 @@ import {
|
|
|
8
8
|
matrix,
|
|
9
9
|
plural,
|
|
10
10
|
stripTerminalControls,
|
|
11
|
-
toTitleCase
|
|
12
|
-
|
|
13
|
-
typedFromEntries,
|
|
14
|
-
typedKeys,
|
|
15
|
-
typedValues
|
|
16
|
-
} from "./chunk-UE4Z3YMB.js";
|
|
11
|
+
toTitleCase
|
|
12
|
+
} from "./chunk-KKGJH46C.js";
|
|
17
13
|
import {
|
|
18
14
|
AGENT_NAMES,
|
|
19
15
|
AUTHOR_HANDLE_PATTERN,
|
|
@@ -69,8 +65,10 @@ import {
|
|
|
69
65
|
effectivelyExcludedSkillIds,
|
|
70
66
|
inAnEnglishList,
|
|
71
67
|
isActiveAt,
|
|
68
|
+
isAgentName,
|
|
72
69
|
isExclusiveCategory,
|
|
73
70
|
isGlobalTombstone,
|
|
71
|
+
isInCatalog,
|
|
74
72
|
isProjectOwned,
|
|
75
73
|
isSeedScopePairWritable,
|
|
76
74
|
marketplaceManifestPath,
|
|
@@ -80,9 +78,14 @@ import {
|
|
|
80
78
|
seatDiagnostics,
|
|
81
79
|
seatedCatalog,
|
|
82
80
|
seedAgentScope,
|
|
81
|
+
skillIdsByCategory,
|
|
83
82
|
sourceDirName,
|
|
83
|
+
typedEntries,
|
|
84
|
+
typedFromEntries,
|
|
85
|
+
typedKeys,
|
|
86
|
+
typedValues,
|
|
84
87
|
validateSelection
|
|
85
|
-
} from "./chunk-
|
|
88
|
+
} from "./chunk-4SIBDIIO.js";
|
|
86
89
|
import {
|
|
87
90
|
defaultCategories,
|
|
88
91
|
defaultRules,
|
|
@@ -91,8 +94,8 @@ import {
|
|
|
91
94
|
|
|
92
95
|
// src/cli/lib/loading/source-loader.ts
|
|
93
96
|
import os14 from "os";
|
|
94
|
-
import { partition as partition6, unique as
|
|
95
|
-
import
|
|
97
|
+
import { partition as partition6, unique as unique7 } from "remeda";
|
|
98
|
+
import path30 from "path";
|
|
96
99
|
|
|
97
100
|
// src/cli/lib/installation/is-home-directory.ts
|
|
98
101
|
import fs from "fs";
|
|
@@ -104,11 +107,14 @@ function isHomeDirectory(dir) {
|
|
|
104
107
|
return dir === os.homedir();
|
|
105
108
|
}
|
|
106
109
|
}
|
|
110
|
+
function scopeAt(dir) {
|
|
111
|
+
return isHomeDirectory(dir) ? "global" : "project";
|
|
112
|
+
}
|
|
107
113
|
|
|
108
114
|
// src/cli/lib/installation/install-layout.ts
|
|
109
115
|
import fs2 from "fs";
|
|
110
116
|
import os2 from "os";
|
|
111
|
-
import
|
|
117
|
+
import path2 from "path";
|
|
112
118
|
|
|
113
119
|
// ../compile/src/providers/codex/agent-role-toml.ts
|
|
114
120
|
var SHELL_TOOL = "Bash";
|
|
@@ -455,12 +461,18 @@ async function renderFromTemplate(engine, template, data, version) {
|
|
|
455
461
|
});
|
|
456
462
|
}
|
|
457
463
|
|
|
464
|
+
// src/cli/utils/posix-path.ts
|
|
465
|
+
import path from "path";
|
|
466
|
+
function toPosixPath(nativePath) {
|
|
467
|
+
return nativePath.split(path.sep).join(path.posix.sep);
|
|
468
|
+
}
|
|
469
|
+
|
|
458
470
|
// src/cli/lib/installation/install-layout.ts
|
|
459
471
|
function sourceDir(root, provider) {
|
|
460
|
-
return
|
|
472
|
+
return path2.join(root, SOURCE_ROOT_DIR, provider);
|
|
461
473
|
}
|
|
462
474
|
function sourceRootOf(root) {
|
|
463
|
-
return { dir:
|
|
475
|
+
return { dir: path2.join(root, SOURCE_ROOT_DIR), relName: SOURCE_ROOT_DIR };
|
|
464
476
|
}
|
|
465
477
|
var RETIRED_SOURCE_FOLDER = ".claude-src";
|
|
466
478
|
function rootsHoldingTheRetiredSourceFolder(cwd) {
|
|
@@ -468,7 +480,7 @@ function rootsHoldingTheRetiredSourceFolder(cwd) {
|
|
|
468
480
|
return roots.filter(holdsTheRetiredSourceFolder);
|
|
469
481
|
}
|
|
470
482
|
function holdsTheRetiredSourceFolder(root) {
|
|
471
|
-
return directoryExists(
|
|
483
|
+
return directoryExists(path2.join(root, RETIRED_SOURCE_FOLDER));
|
|
472
484
|
}
|
|
473
485
|
var PROVIDER_OF_A_NEW_INSTALLATION = "claude";
|
|
474
486
|
function isTheProviderOfANewInstallation(provider) {
|
|
@@ -507,8 +519,23 @@ function providerInUse(root) {
|
|
|
507
519
|
if (root === void 0) return PROVIDER_OF_A_NEW_INSTALLATION;
|
|
508
520
|
return providerOnDisk(root);
|
|
509
521
|
}
|
|
522
|
+
var projectBeingInstalled;
|
|
523
|
+
async function whileInstallingInto(projectDir, install) {
|
|
524
|
+
projectBeingInstalled = path2.resolve(projectDir);
|
|
525
|
+
try {
|
|
526
|
+
return await install();
|
|
527
|
+
} finally {
|
|
528
|
+
projectBeingInstalled = void 0;
|
|
529
|
+
}
|
|
530
|
+
}
|
|
510
531
|
function inheritedGlobalProvider(projectDir, own = providerInUse(projectDir)) {
|
|
511
|
-
return
|
|
532
|
+
return holdsOrIsGettingAnInstallation(projectDir, own) ? own : providerInUse(os2.homedir());
|
|
533
|
+
}
|
|
534
|
+
function holdsOrIsGettingAnInstallation(projectDir, provider) {
|
|
535
|
+
return isBeingInstalled(projectDir) || holdsAnInstallation(projectDir, provider);
|
|
536
|
+
}
|
|
537
|
+
function isBeingInstalled(projectDir) {
|
|
538
|
+
return path2.resolve(projectDir) === projectBeingInstalled;
|
|
512
539
|
}
|
|
513
540
|
function providerAtScope(projectDir, scope) {
|
|
514
541
|
return scope === "global" ? inheritedGlobalProvider(projectDir) : providerInUse(projectDir);
|
|
@@ -559,18 +586,18 @@ function hostRoles(provider, scope, projectDir) {
|
|
|
559
586
|
}
|
|
560
587
|
}
|
|
561
588
|
function claudeRoles(scopeRoot) {
|
|
562
|
-
const root =
|
|
563
|
-
const plugins =
|
|
589
|
+
const root = path2.join(scopeRoot, CLAUDE_DIR);
|
|
590
|
+
const plugins = path2.join(root, PLUGINS_SUBDIR);
|
|
564
591
|
return {
|
|
565
592
|
userConfigRoot: root,
|
|
566
|
-
agentsDir:
|
|
567
|
-
skillsDir:
|
|
593
|
+
agentsDir: path2.join(root, STANDARD_DIRS.AGENTS),
|
|
594
|
+
skillsDir: path2.join(root, STANDARD_DIRS.SKILLS),
|
|
568
595
|
pluginsDir: plugins,
|
|
569
|
-
pluginRegistry:
|
|
596
|
+
pluginRegistry: path2.join(plugins, INSTALLED_PLUGINS_FILE),
|
|
570
597
|
// The developer's local overlay is read too, though never written.
|
|
571
598
|
permissionFiles: [
|
|
572
|
-
|
|
573
|
-
|
|
599
|
+
path2.join(root, STANDARD_FILES.SETTINGS_JSON),
|
|
600
|
+
path2.join(root, STANDARD_FILES.SETTINGS_LOCAL_JSON)
|
|
574
601
|
]
|
|
575
602
|
};
|
|
576
603
|
}
|
|
@@ -578,35 +605,35 @@ function codexGlobalRoles() {
|
|
|
578
605
|
const root = codexUserRoot();
|
|
579
606
|
return {
|
|
580
607
|
userConfigRoot: root,
|
|
581
|
-
agentsDir:
|
|
582
|
-
skillsDir:
|
|
583
|
-
pluginsDir:
|
|
608
|
+
agentsDir: path2.join(root, STANDARD_DIRS.AGENTS),
|
|
609
|
+
skillsDir: path2.join(root, STANDARD_DIRS.SKILLS),
|
|
610
|
+
pluginsDir: path2.join(root, PLUGINS_SUBDIR),
|
|
584
611
|
pluginRegistry: null,
|
|
585
|
-
permissionFiles: [
|
|
612
|
+
permissionFiles: [path2.join(root, CODEX_CONFIG_FILE)]
|
|
586
613
|
};
|
|
587
614
|
}
|
|
588
615
|
function codexProjectRoles(projectDir) {
|
|
589
|
-
const root =
|
|
616
|
+
const root = path2.join(projectDir, CODEX_DIR);
|
|
590
617
|
return {
|
|
591
618
|
userConfigRoot: root,
|
|
592
|
-
agentsDir:
|
|
593
|
-
skillsDir:
|
|
619
|
+
agentsDir: path2.join(root, STANDARD_DIRS.AGENTS),
|
|
620
|
+
skillsDir: path2.join(projectDir, CODEX_PROJECT_SKILLS_PATH),
|
|
594
621
|
pluginsDir: null,
|
|
595
622
|
pluginRegistry: null,
|
|
596
|
-
permissionFiles: [
|
|
623
|
+
permissionFiles: [path2.join(root, CODEX_CONFIG_FILE)]
|
|
597
624
|
};
|
|
598
625
|
}
|
|
599
626
|
function codexUserRoot() {
|
|
600
|
-
return relocatedTo(process.env[CODEX_HOME_VAR]) ??
|
|
627
|
+
return relocatedTo(process.env[CODEX_HOME_VAR]) ?? path2.join(os2.homedir(), CODEX_DIR);
|
|
601
628
|
}
|
|
602
629
|
function relocatedTo(variableValue) {
|
|
603
630
|
return variableValue === "" ? void 0 : variableValue;
|
|
604
631
|
}
|
|
605
632
|
function codexGlobalConfigFile() {
|
|
606
|
-
return
|
|
633
|
+
return path2.join(codexUserRoot(), CODEX_CONFIG_FILE);
|
|
607
634
|
}
|
|
608
635
|
function claudeStateFile() {
|
|
609
|
-
return
|
|
636
|
+
return path2.join(claudeStateRoot(), CLAUDE_STATE_FILE);
|
|
610
637
|
}
|
|
611
638
|
function claudeStateRoot() {
|
|
612
639
|
return relocatedTo(process.env[CLAUDE_CONFIG_DIR_VAR]) ?? os2.homedir();
|
|
@@ -632,10 +659,10 @@ function skillsPathPrefix(provider, scope, projectDir) {
|
|
|
632
659
|
return fromScopeRoot ?? skills;
|
|
633
660
|
}
|
|
634
661
|
function pathUnder(root, dir) {
|
|
635
|
-
const relative =
|
|
636
|
-
const escapes = relative === ".." || relative.startsWith(`..${
|
|
637
|
-
if (relative === "" || escapes ||
|
|
638
|
-
return relative
|
|
662
|
+
const relative = path2.relative(root, dir);
|
|
663
|
+
const escapes = relative === ".." || relative.startsWith(`..${path2.sep}`);
|
|
664
|
+
if (relative === "" || escapes || path2.isAbsolute(relative)) return null;
|
|
665
|
+
return toPosixPath(relative);
|
|
639
666
|
}
|
|
640
667
|
function agentCodec(provider) {
|
|
641
668
|
switch (provider) {
|
|
@@ -680,7 +707,7 @@ function holdsAConfig(dir) {
|
|
|
680
707
|
return fs2.existsSync(configIn(dir));
|
|
681
708
|
}
|
|
682
709
|
function configIn(dir) {
|
|
683
|
-
return
|
|
710
|
+
return path2.join(dir, STANDARD_FILES.CONFIG_TS);
|
|
684
711
|
}
|
|
685
712
|
function holdsAnything(dir) {
|
|
686
713
|
return directoryExists(dir) && isNotEmpty(dir);
|
|
@@ -721,933 +748,248 @@ function getErrorMessage(error) {
|
|
|
721
748
|
import fs3 from "fs-extra";
|
|
722
749
|
import fg from "fast-glob";
|
|
723
750
|
import os3 from "os";
|
|
724
|
-
import path2 from "path";
|
|
725
|
-
|
|
726
|
-
// src/cli/lib/config-gate/gate-token.ts
|
|
727
|
-
import { AsyncLocalStorage } from "async_hooks";
|
|
728
|
-
var gateToken = new AsyncLocalStorage();
|
|
729
|
-
var GlobalPairWriteViolation = class extends Error {
|
|
730
|
-
constructor(targetPath) {
|
|
731
|
-
super(
|
|
732
|
-
`${targetPath} may only be written through config-gate \u2014 see src/cli/lib/config-gate/index.ts`
|
|
733
|
-
);
|
|
734
|
-
this.name = "GlobalPairWriteViolation";
|
|
735
|
-
}
|
|
736
|
-
};
|
|
737
|
-
function withGateToken(fn) {
|
|
738
|
-
return gateToken.run(true, fn);
|
|
739
|
-
}
|
|
740
|
-
function hasGateToken() {
|
|
741
|
-
return gateToken.getStore() === true;
|
|
742
|
-
}
|
|
743
|
-
function assertGateToken(targetPath) {
|
|
744
|
-
if (hasGateToken()) return;
|
|
745
|
-
throw new GlobalPairWriteViolation(targetPath);
|
|
746
|
-
}
|
|
747
|
-
|
|
748
|
-
// src/cli/utils/fs.ts
|
|
749
|
-
function isPathWithin(child, parent) {
|
|
750
|
-
const resolvedChild = path2.resolve(child);
|
|
751
|
-
const resolvedParent = path2.resolve(parent);
|
|
752
|
-
return resolvedChild === resolvedParent || resolvedChild.startsWith(resolvedParent + path2.sep);
|
|
753
|
-
}
|
|
754
|
-
async function readFile(filePath) {
|
|
755
|
-
return fs3.readFile(filePath, "utf-8");
|
|
756
|
-
}
|
|
757
|
-
async function readFileSafe(filePath, maxSizeBytes) {
|
|
758
|
-
const stats = await fs3.stat(filePath);
|
|
759
|
-
if (stats.size > maxSizeBytes) {
|
|
760
|
-
throw new Error(
|
|
761
|
-
`File too large: '${filePath}' is ${stats.size} bytes (limit: ${maxSizeBytes} bytes)`
|
|
762
|
-
);
|
|
763
|
-
}
|
|
764
|
-
return fs3.readFile(filePath, "utf-8");
|
|
765
|
-
}
|
|
766
|
-
async function readFileOptional(filePath, fallback = "") {
|
|
767
|
-
try {
|
|
768
|
-
return await fs3.readFile(filePath, "utf-8");
|
|
769
|
-
} catch {
|
|
770
|
-
return fallback;
|
|
771
|
-
}
|
|
772
|
-
}
|
|
773
|
-
async function fileExists(filePath) {
|
|
774
|
-
return fs3.pathExists(filePath);
|
|
775
|
-
}
|
|
776
|
-
async function directoryExists2(dirPath) {
|
|
777
|
-
try {
|
|
778
|
-
const stat2 = await fs3.stat(dirPath);
|
|
779
|
-
return stat2.isDirectory();
|
|
780
|
-
} catch {
|
|
781
|
-
return false;
|
|
782
|
-
}
|
|
783
|
-
}
|
|
784
|
-
async function isSymlink(filePath) {
|
|
785
|
-
try {
|
|
786
|
-
const entry = await fs3.lstat(filePath);
|
|
787
|
-
return entry.isSymbolicLink();
|
|
788
|
-
} catch {
|
|
789
|
-
return false;
|
|
790
|
-
}
|
|
791
|
-
}
|
|
792
|
-
async function listDirectories(dirPath) {
|
|
793
|
-
try {
|
|
794
|
-
const entries = await fs3.readdir(dirPath, { withFileTypes: true });
|
|
795
|
-
return entries.filter((e) => e.isDirectory()).map((e) => e.name).toSorted(bytewise);
|
|
796
|
-
} catch {
|
|
797
|
-
return [];
|
|
798
|
-
}
|
|
799
|
-
}
|
|
800
|
-
async function glob(pattern, cwd, { dot = false } = {}) {
|
|
801
|
-
const matches = await fg(pattern, { cwd, onlyFiles: true, dot });
|
|
802
|
-
return matches.toSorted(bytewise);
|
|
803
|
-
}
|
|
804
|
-
var PAIR_HALVES = [STANDARD_FILES.CONFIG_TS, STANDARD_FILES.CONFIG_TYPES_TS];
|
|
805
|
-
function globalPairFolders() {
|
|
806
|
-
const home = os3.homedir();
|
|
807
|
-
return PROVIDERS.map((provider) => sourceDir(home, provider));
|
|
808
|
-
}
|
|
809
|
-
function everyGlobalPairPath() {
|
|
810
|
-
return globalPairFolders().flatMap(
|
|
811
|
-
(folder) => PAIR_HALVES.map((half) => path2.join(folder, half))
|
|
812
|
-
);
|
|
813
|
-
}
|
|
814
|
-
async function writeFile(filePath, content) {
|
|
815
|
-
const resolvedPath = path2.resolve(filePath);
|
|
816
|
-
if (everyGlobalPairPath().includes(resolvedPath)) assertGateToken(resolvedPath);
|
|
817
|
-
await fs3.ensureDir(path2.dirname(filePath));
|
|
818
|
-
await fs3.writeFile(filePath, content, "utf-8");
|
|
819
|
-
}
|
|
820
|
-
async function ensureDir(dirPath) {
|
|
821
|
-
await fs3.ensureDir(dirPath);
|
|
822
|
-
}
|
|
823
|
-
async function remove(filePath) {
|
|
824
|
-
await fs3.remove(filePath);
|
|
825
|
-
}
|
|
826
|
-
async function isDirectoryEmpty(dirPath) {
|
|
827
|
-
try {
|
|
828
|
-
const entries = await fs3.readdir(dirPath);
|
|
829
|
-
return entries.length === 0;
|
|
830
|
-
} catch {
|
|
831
|
-
return true;
|
|
832
|
-
}
|
|
833
|
-
}
|
|
834
|
-
async function removeDirIfEmpty(dir) {
|
|
835
|
-
if (!await directoryExists2(dir)) return false;
|
|
836
|
-
if (!await isDirectoryEmpty(dir)) return false;
|
|
837
|
-
await remove(dir);
|
|
838
|
-
return true;
|
|
839
|
-
}
|
|
840
|
-
async function copy(src, dest) {
|
|
841
|
-
await fs3.copy(src, dest);
|
|
842
|
-
await grantOwnerWrite(dest);
|
|
843
|
-
}
|
|
844
|
-
var OWNER_WRITE = 128;
|
|
845
|
-
async function grantOwnerWrite(target) {
|
|
846
|
-
const entry = await fs3.stat(target);
|
|
847
|
-
await fs3.chmod(target, entry.mode | OWNER_WRITE);
|
|
848
|
-
if (!entry.isDirectory()) return;
|
|
849
|
-
const children = await fs3.readdir(target);
|
|
850
|
-
await Promise.all(children.map((child) => grantOwnerWrite(path2.join(target, child))));
|
|
851
|
-
}
|
|
852
|
-
|
|
853
|
-
// src/cli/utils/logger.ts
|
|
854
|
-
import { AsyncLocalStorage as AsyncLocalStorage2 } from "async_hooks";
|
|
855
|
-
var verboseMode = false;
|
|
856
|
-
function setVerbose(enabled) {
|
|
857
|
-
verboseMode = enabled;
|
|
858
|
-
}
|
|
859
|
-
function verbose(msg) {
|
|
860
|
-
if (verboseMode) {
|
|
861
|
-
console.log(` ${msg}`);
|
|
862
|
-
}
|
|
863
|
-
}
|
|
864
|
-
function log(msg) {
|
|
865
|
-
console.log(msg);
|
|
866
|
-
}
|
|
867
|
-
var bufferMode = false;
|
|
868
|
-
var messageBuffer = [];
|
|
869
|
-
var alreadySaid = /* @__PURE__ */ new Set();
|
|
870
|
-
var eachWarningOnce = new AsyncLocalStorage2();
|
|
871
|
-
function enableBuffering() {
|
|
872
|
-
bufferMode = true;
|
|
873
|
-
messageBuffer = [];
|
|
874
|
-
}
|
|
875
|
-
function drainBuffer() {
|
|
876
|
-
const messages = [...messageBuffer];
|
|
877
|
-
messageBuffer = [];
|
|
878
|
-
return messages;
|
|
879
|
-
}
|
|
880
|
-
function disableBuffering() {
|
|
881
|
-
bufferMode = false;
|
|
882
|
-
messageBuffer = [];
|
|
883
|
-
}
|
|
884
|
-
function warn(msg) {
|
|
885
|
-
if (isARepeatToHoldBack(msg)) return;
|
|
886
|
-
if (bufferMode) {
|
|
887
|
-
messageBuffer.push({ level: "warn", text: msg });
|
|
888
|
-
return;
|
|
889
|
-
}
|
|
890
|
-
alreadySaid.add(msg);
|
|
891
|
-
console.warn(` Warning: ${msg}`);
|
|
892
|
-
}
|
|
893
|
-
function isARepeatToHoldBack(msg) {
|
|
894
|
-
if (eachWarningOnce.getStore() !== true) return false;
|
|
895
|
-
return alreadySaid.has(msg) || messageBuffer.some((message) => message.text === msg);
|
|
896
|
-
}
|
|
897
|
-
function sayingEachWarningOnce(body) {
|
|
898
|
-
return eachWarningOnce.run(true, body);
|
|
899
|
-
}
|
|
900
|
-
function warnOnce(msg) {
|
|
901
|
-
sayingEachWarningOnce(() => warn(msg));
|
|
902
|
-
}
|
|
903
|
-
|
|
904
|
-
// src/cli/utils/messages.ts
|
|
905
751
|
import path3 from "path";
|
|
906
|
-
import { partition } from "remeda";
|
|
907
|
-
|
|
908
|
-
// src/cli/lib/validate-kebab-name.ts
|
|
909
|
-
import { unique } from "remeda";
|
|
910
|
-
var KEBAB_CASE_CHARACTER = /[a-z0-9-]/;
|
|
911
|
-
function charactersOutsideKebabCase(name) {
|
|
912
|
-
return unique([...name].filter((character) => !KEBAB_CASE_CHARACTER.test(character)));
|
|
913
|
-
}
|
|
914
|
-
function validateKebabCaseName(name, noun) {
|
|
915
|
-
if (!name || name.trim() === "") {
|
|
916
|
-
return `${noun} name is required`;
|
|
917
|
-
}
|
|
918
|
-
if (!KEBAB_CASE_PATTERN.test(name)) {
|
|
919
|
-
return `${noun} name must be kebab-case (lowercase letters, numbers, and hyphens, starting with a letter)`;
|
|
920
|
-
}
|
|
921
|
-
return null;
|
|
922
|
-
}
|
|
923
752
|
|
|
924
|
-
// src/cli/
|
|
925
|
-
var
|
|
926
|
-
|
|
927
|
-
|
|
928
|
-
|
|
929
|
-
|
|
930
|
-
|
|
931
|
-
|
|
932
|
-
|
|
933
|
-
|
|
934
|
-
|
|
935
|
-
|
|
936
|
-
|
|
937
|
-
|
|
938
|
-
|
|
939
|
-
|
|
940
|
-
|
|
941
|
-
|
|
942
|
-
|
|
943
|
-
|
|
944
|
-
|
|
945
|
-
|
|
946
|
-
|
|
947
|
-
|
|
948
|
-
|
|
949
|
-
|
|
950
|
-
|
|
951
|
-
|
|
952
|
-
|
|
953
|
-
|
|
954
|
-
|
|
955
|
-
|
|
956
|
-
|
|
957
|
-
|
|
958
|
-
|
|
959
|
-
|
|
960
|
-
|
|
961
|
-
|
|
962
|
-
|
|
963
|
-
|
|
964
|
-
|
|
965
|
-
|
|
966
|
-
|
|
967
|
-
|
|
968
|
-
|
|
969
|
-
|
|
970
|
-
|
|
971
|
-
|
|
972
|
-
|
|
973
|
-
|
|
974
|
-
|
|
975
|
-
|
|
976
|
-
|
|
977
|
-
|
|
978
|
-
|
|
979
|
-
|
|
980
|
-
|
|
981
|
-
|
|
982
|
-
|
|
983
|
-
|
|
984
|
-
|
|
985
|
-
|
|
986
|
-
|
|
987
|
-
|
|
988
|
-
|
|
989
|
-
|
|
990
|
-
|
|
991
|
-
|
|
992
|
-
|
|
993
|
-
|
|
994
|
-
|
|
995
|
-
|
|
996
|
-
|
|
997
|
-
|
|
998
|
-
|
|
999
|
-
|
|
1000
|
-
|
|
1001
|
-
|
|
1002
|
-
|
|
1003
|
-
|
|
1004
|
-
|
|
1005
|
-
|
|
1006
|
-
|
|
1007
|
-
|
|
1008
|
-
|
|
1009
|
-
|
|
1010
|
-
|
|
1011
|
-
|
|
1012
|
-
|
|
1013
|
-
|
|
1014
|
-
|
|
1015
|
-
|
|
1016
|
-
|
|
1017
|
-
|
|
1018
|
-
|
|
1019
|
-
|
|
1020
|
-
|
|
1021
|
-
|
|
1022
|
-
|
|
1023
|
-
|
|
1024
|
-
|
|
1025
|
-
|
|
1026
|
-
|
|
1027
|
-
|
|
1028
|
-
|
|
1029
|
-
|
|
1030
|
-
|
|
1031
|
-
|
|
1032
|
-
|
|
1033
|
-
|
|
1034
|
-
|
|
1035
|
-
|
|
1036
|
-
|
|
1037
|
-
|
|
1038
|
-
|
|
1039
|
-
|
|
1040
|
-
|
|
1041
|
-
|
|
1042
|
-
|
|
1043
|
-
|
|
1044
|
-
|
|
1045
|
-
|
|
1046
|
-
|
|
1047
|
-
|
|
1048
|
-
|
|
1049
|
-
|
|
1050
|
-
|
|
1051
|
-
|
|
1052
|
-
|
|
1053
|
-
|
|
1054
|
-
|
|
1055
|
-
|
|
1056
|
-
|
|
1057
|
-
|
|
1058
|
-
|
|
1059
|
-
|
|
1060
|
-
|
|
1061
|
-
|
|
1062
|
-
|
|
1063
|
-
|
|
1064
|
-
|
|
1065
|
-
|
|
1066
|
-
|
|
1067
|
-
|
|
1068
|
-
|
|
1069
|
-
|
|
1070
|
-
|
|
1071
|
-
|
|
1072
|
-
|
|
1073
|
-
|
|
1074
|
-
|
|
1075
|
-
|
|
1076
|
-
|
|
1077
|
-
|
|
1078
|
-
|
|
1079
|
-
|
|
1080
|
-
|
|
1081
|
-
|
|
1082
|
-
|
|
1083
|
-
|
|
1084
|
-
|
|
1085
|
-
|
|
1086
|
-
|
|
1087
|
-
|
|
1088
|
-
|
|
1089
|
-
|
|
1090
|
-
|
|
1091
|
-
|
|
1092
|
-
|
|
1093
|
-
|
|
1094
|
-
|
|
1095
|
-
|
|
1096
|
-
|
|
1097
|
-
|
|
1098
|
-
|
|
1099
|
-
|
|
1100
|
-
|
|
1101
|
-
|
|
1102
|
-
|
|
1103
|
-
|
|
1104
|
-
|
|
1105
|
-
|
|
1106
|
-
|
|
1107
|
-
|
|
1108
|
-
|
|
1109
|
-
|
|
1110
|
-
|
|
1111
|
-
|
|
1112
|
-
|
|
1113
|
-
|
|
1114
|
-
|
|
1115
|
-
|
|
1116
|
-
|
|
1117
|
-
|
|
1118
|
-
|
|
1119
|
-
|
|
1120
|
-
|
|
1121
|
-
|
|
1122
|
-
|
|
1123
|
-
|
|
1124
|
-
|
|
1125
|
-
|
|
1126
|
-
|
|
1127
|
-
|
|
1128
|
-
|
|
1129
|
-
|
|
1130
|
-
|
|
1131
|
-
|
|
1132
|
-
|
|
1133
|
-
|
|
1134
|
-
|
|
1135
|
-
|
|
1136
|
-
|
|
1137
|
-
|
|
1138
|
-
|
|
1139
|
-
|
|
1140
|
-
|
|
1141
|
-
|
|
1142
|
-
|
|
1143
|
-
|
|
1144
|
-
|
|
1145
|
-
|
|
1146
|
-
|
|
1147
|
-
|
|
1148
|
-
|
|
1149
|
-
|
|
1150
|
-
|
|
1151
|
-
|
|
1152
|
-
|
|
1153
|
-
|
|
1154
|
-
|
|
1155
|
-
|
|
1156
|
-
|
|
1157
|
-
|
|
1158
|
-
|
|
1159
|
-
|
|
1160
|
-
|
|
1161
|
-
|
|
1162
|
-
|
|
1163
|
-
|
|
1164
|
-
].join("\n");
|
|
1165
|
-
}
|
|
1166
|
-
function editorSkillMetadataUnusableError(entries) {
|
|
1167
|
-
return [
|
|
1168
|
-
metadataUnusableOpening(entries),
|
|
1169
|
-
`The editor opens on what these files describe, so no link is made until each one describes its skill.`,
|
|
1170
|
-
METADATA_UNUSABLE_WAY_OUT
|
|
1171
|
-
].join("\n");
|
|
1172
|
-
}
|
|
1173
|
-
var SHARED_CONFIG_GREENFIELD_HINT = "installing a shared configuration is a fresh setup, not a merge";
|
|
1174
|
-
function sharedConfigDestinations(id) {
|
|
1175
|
-
return [
|
|
1176
|
-
` Install it: ${CLI_INVOKE_COMMAND} init --from ${id}`,
|
|
1177
|
-
` Open it: ${editorConfigUrl(id)}`
|
|
1178
|
-
];
|
|
1179
|
-
}
|
|
1180
|
-
function applySharedConfigHere(id, installedHere, provider) {
|
|
1181
|
-
const command = `${CLI_INVOKE_COMMAND} ${installedHere ? "edit" : "init"} --from`;
|
|
1182
|
-
const verb = installedHere ? "apply" : "install";
|
|
1183
|
-
const named = providerArgument(provider);
|
|
1184
|
-
return id === void 0 ? `Then ${verb} what it gives you with '${command} <id>${named}'.` : `To ${verb} it here instead, run '${command} ${id}${named}'.`;
|
|
1185
|
-
}
|
|
1186
|
-
function shareRefusesEjectedSkills(skillIds, namedBy) {
|
|
1187
|
-
return [
|
|
1188
|
-
"This installation holds ejected skills, and ejected skills cannot be shared:",
|
|
1189
|
-
...skillIds.map((id) => ` ${skillName(id, namedBy)}`),
|
|
1190
|
-
"Only plugins can be shared."
|
|
1191
|
-
].join("\n");
|
|
1192
|
-
}
|
|
1193
|
-
function sharedIdNamesAFolder(folder) {
|
|
1194
|
-
return `This id names the marketplace folder ${folder}, so it installs only where that folder exists.`;
|
|
1195
|
-
}
|
|
1196
|
-
function sharedSkillsLeftBehind(skillIds, namedBy) {
|
|
1197
|
-
return `A shared id names one marketplace, and these skill(s) come from another, so they will not install elsewhere: ${skillNames(skillIds, namedBy)}`;
|
|
1198
|
-
}
|
|
1199
|
-
function sharedConfigExistingInstall(configPath, id, provider) {
|
|
1200
|
-
return `An installation already exists at ${configPath}. Run '${CLI_INVOKE_COMMAND} uninstall${providerArgument(provider)}' first \u2014 ${SHARED_CONFIG_GREENFIELD_HINT}. ${applySharedConfigHere(id, true, provider)}`;
|
|
1201
|
-
}
|
|
1202
|
-
function sharedConfigProjectScopeAtHome(skillIds, agentNames, installedHere, provider, namedBy) {
|
|
1203
|
-
return [
|
|
1204
|
-
"This configuration cannot be installed here: the home directory is the global scope, and a global installation holds only global-scoped content \u2014 so these project-scoped entries have nowhere to be written:",
|
|
1205
|
-
...skillIds.map((id) => ` skill ${skillName(id, namedBy)} (scope: project)`),
|
|
1206
|
-
...agentNames.map((name) => ` sub-agent ${name} (scope: project)`),
|
|
1207
|
-
installedHere ? changeTheGlobalInstallFromHome(providerArgument(provider)) : "Run this from inside a project directory, or re-share it with each entry above at global scope."
|
|
1208
|
-
].join("\n");
|
|
1209
|
-
}
|
|
1210
|
-
function changeTheGlobalInstallFromHome(named) {
|
|
1211
|
-
return `Run this from inside a project directory, or change the global install from here: run '${CLI_INVOKE_COMMAND} edit${named}', make the change in the editor, then apply the id it gives you with '${CLI_INVOKE_COMMAND} edit --from <id>${named}'.`;
|
|
1212
|
-
}
|
|
1213
|
-
function unknownKeys(keys) {
|
|
1214
|
-
return keys.map(inertLine).join(", ");
|
|
1215
|
-
}
|
|
1216
|
-
var SKIP_CAUSE = {
|
|
1217
|
-
UNLOADED: "could not load",
|
|
1218
|
-
UNKNOWN: "does not know"
|
|
1219
|
-
};
|
|
1220
|
-
function skippedSkills(skillIds, installedWithout, unloadedSkillIds) {
|
|
1221
|
-
const [unloaded, unknown] = partition(skillIds, (id) => unloadedSkillIds.has(id));
|
|
1222
|
-
return [
|
|
1223
|
-
...skippedFor(SKIP_CAUSE.UNLOADED, unloaded, installedWithout),
|
|
1224
|
-
...skippedFor(SKIP_CAUSE.UNKNOWN, unknown, installedWithout)
|
|
1225
|
-
].join("\n");
|
|
1226
|
-
}
|
|
1227
|
-
function skippedFor(cause, skillIds, installedWithout) {
|
|
1228
|
-
if (skillIds.length === 0) return [];
|
|
1229
|
-
return [
|
|
1230
|
-
`Skipped ${skillIds.length} skill(s) this catalog ${cause}: ${unknownKeys(skillIds)}`,
|
|
1231
|
-
...installedWithout.filter(({ skillId }) => skillIds.includes(skillId)).map(subAgentsInstalledWithout)
|
|
1232
|
-
];
|
|
1233
|
-
}
|
|
1234
|
-
function subAgentsInstalledWithout({ skillId, agentNames }) {
|
|
1235
|
-
return ` sub-agent(s) installed without ${unknownKeys([skillId])}, carrying nothing else this catalog knows: ${agentNames.join(", ")}`;
|
|
1236
|
-
}
|
|
1237
|
-
function skippedUnknownAgents(agentNames) {
|
|
1238
|
-
return `Skipped ${agentNames.length} unknown sub-agent(s): ${unknownKeys(agentNames)}`;
|
|
1239
|
-
}
|
|
1240
|
-
function carriedSkillsWritten(skillIds, namedBy) {
|
|
1241
|
-
return `Wrote ${skillIds.length} skill(s) this configuration carries: ${skillNames(skillIds, namedBy)}`;
|
|
1242
|
-
}
|
|
1243
|
-
function copiedSkillsRemovedAfterRefusedSave(count) {
|
|
1244
|
-
return `Removed the ${plural(count, "skill")} it copied, since the configuration could not be saved`;
|
|
1245
|
-
}
|
|
1246
|
-
function carriedSkillsRemovedAfterRefusedSave(count) {
|
|
1247
|
-
return `Removed the ${plural(count, "skill")} this configuration carried, since the configuration could not be saved`;
|
|
1248
|
-
}
|
|
1249
|
-
var SHARED_CONFIG_APPLY = {
|
|
1250
|
-
CONFIRM: "Apply this configuration?"
|
|
1251
|
-
};
|
|
1252
|
-
function idNamesAnotherMarketplace(named, used) {
|
|
1253
|
-
return `This id names the marketplace ${inertLine(named)}; its skills come from this installation's marketplace, ${used}.`;
|
|
1254
|
-
}
|
|
1255
|
-
function registeredProjectsRecompiled(projectPaths) {
|
|
1256
|
-
return [
|
|
1257
|
-
"Each project registered with this global install is recompiled to match:",
|
|
1258
|
-
...projectPaths.map((projectPath) => ` ${projectPath}`)
|
|
1259
|
-
].join("\n");
|
|
1260
|
-
}
|
|
1261
|
-
function sharedConfigNeedsTerminal(id, editProvider, initProvider) {
|
|
1262
|
-
return [
|
|
1263
|
-
`Applying configuration '${id}' removes whatever it leaves out, so it has to be confirmed \u2014 and there is no terminal here to confirm it at.`,
|
|
1264
|
-
`Run '${CLI_INVOKE_COMMAND} edit --from ${id}${providerArgument(editProvider)}' from a terminal, or '${CLI_INVOKE_COMMAND} init --from ${id}${providerArgument(initProvider)}' in a clean directory, which installs without removing anything.`
|
|
1265
|
-
].join("\n");
|
|
1266
|
-
}
|
|
1267
|
-
function nothingInstalledToApplyTo(id, provider) {
|
|
1268
|
-
return `No installation found. Run '${CLI_INVOKE_COMMAND} init --from ${id}${providerArgument(provider)}' to install configuration '${id}' here.`;
|
|
1269
|
-
}
|
|
1270
|
-
function uninstallNeedsTerminal(provider) {
|
|
1271
|
-
const named = providerArgument(provider);
|
|
1272
|
-
return [
|
|
1273
|
-
"Uninstalling removes files, so it has to be confirmed \u2014 and there is no terminal here to confirm it at.",
|
|
1274
|
-
`Run '${CLI_INVOKE_COMMAND} uninstall${named}' from a terminal, or '${CLI_INVOKE_COMMAND} uninstall --yes${named}' to remove it without being asked.`
|
|
1275
|
-
].join("\n");
|
|
1276
|
-
}
|
|
1277
|
-
function addMarketplaceInTheEditor(ref, isFolder) {
|
|
1278
|
-
return isFolder ? `${ref} is a folder on this machine, which the editor cannot read \u2014 push it to GitHub, then add it from the editor's Marketplace button.` : `Add ${ref} from the editor's Marketplace button.`;
|
|
1279
|
-
}
|
|
1280
|
-
var SHARED_CONFIG_ARRIVALS = {
|
|
1281
|
-
INSTALL_CONFIRM: "Install this configuration?"
|
|
1282
|
-
};
|
|
1283
|
-
function skillName(id, namedBy) {
|
|
1284
|
-
return getSkillEntryDisplayName(namedBy[id] ?? { id });
|
|
1285
|
-
}
|
|
1286
|
-
function skillNames(skillIds, namedBy) {
|
|
1287
|
-
return skillIds.map((id) => skillName(id, namedBy)).join(", ");
|
|
1288
|
-
}
|
|
1289
|
-
function keptAsInstalledGlobally(skillIds, agentNames, idAppliedAtHome, provider, namedBy) {
|
|
1290
|
-
return [
|
|
1291
|
-
"Kept as installed in the global install \u2014 this configuration states them differently or leaves them out, and a project run only adds to the global install:",
|
|
1292
|
-
...skillIds.map((id) => ` skill ${skillName(id, namedBy)}`),
|
|
1293
|
-
...agentNames.map((name) => ` sub-agent ${name}`),
|
|
1294
|
-
...idAppliedAtHome === void 0 ? [] : [
|
|
1295
|
-
`Change them with '${CLI_INVOKE_COMMAND} edit --from ${idAppliedAtHome}${providerArgument(provider)}' from your home directory.`
|
|
1296
|
-
]
|
|
1297
|
-
].join("\n");
|
|
1298
|
-
}
|
|
1299
|
-
function skillsMoved(verb, skillIds, namedBy) {
|
|
1300
|
-
const names = skillIds.map((id) => skillName(id, namedBy));
|
|
1301
|
-
return names.length === 0 ? [] : [`${verb} ${inAnEnglishList(names)}`];
|
|
1302
|
-
}
|
|
1303
|
-
function settingMoved({ setting, from, to }) {
|
|
1304
|
-
return `${setting} ${from ?? "default"} \u2192 ${to ?? "default"}`;
|
|
1305
|
-
}
|
|
1306
|
-
var SKILLS_REASSIGNED = "skills reassigned";
|
|
1307
|
-
function subAgentChanged({
|
|
1308
|
-
name,
|
|
1309
|
-
scope,
|
|
1310
|
-
gains,
|
|
1311
|
-
loses,
|
|
1312
|
-
settings,
|
|
1313
|
-
namedBy = {}
|
|
1314
|
-
}) {
|
|
1315
|
-
const details = [
|
|
1316
|
-
...skillsMoved("gains", gains, namedBy),
|
|
1317
|
-
...skillsMoved("loses", loses, namedBy),
|
|
1318
|
-
...settings.map(settingMoved)
|
|
1319
|
-
];
|
|
1320
|
-
const where = scope === "global" ? " (global)" : "";
|
|
1321
|
-
return `~ ${name}${where}: ${details.length > 0 ? details.join(", ") : SKILLS_REASSIGNED}`;
|
|
1322
|
-
}
|
|
1323
|
-
function addedToGlobalSubAgents(joined, namedBy) {
|
|
1324
|
-
return [
|
|
1325
|
-
"Added to sub-agents in the global install \u2014 each keeps everything it already has, since a project run only adds to the global install:",
|
|
1326
|
-
...joined.map(
|
|
1327
|
-
({ agentName, skillIds }) => ` sub-agent ${agentName}: + ${skillNames(skillIds, namedBy)}`
|
|
1328
|
-
)
|
|
1329
|
-
].join("\n");
|
|
1330
|
-
}
|
|
1331
|
-
function authoredHereKept(skillIds, namedBy) {
|
|
1332
|
-
return [
|
|
1333
|
-
"Kept \u2014 written here rather than installed, so a shared configuration never carried them:",
|
|
1334
|
-
...skillIds.map((id) => ` skill ${skillName(id, namedBy)}`)
|
|
1335
|
-
].join("\n");
|
|
1336
|
-
}
|
|
1337
|
-
function unplaceableKept(skillIds, namedBy) {
|
|
1338
|
-
return [
|
|
1339
|
-
"Kept \u2014 named by this configuration, and this catalogue cannot place them:",
|
|
1340
|
-
...skillIds.map((id) => ` skill ${skillName(id, namedBy)}`),
|
|
1341
|
-
`Run '${CLI_INVOKE_COMMAND} update' to refresh this installation's marketplace, then apply the configuration again.`
|
|
1342
|
-
].join("\n");
|
|
1343
|
-
}
|
|
1344
|
-
function keptUnassigned({ skillId, agentName, category }, namedBy) {
|
|
1345
|
-
return `${skillName(skillId, namedBy)}: kept, no longer assigned to ${agentName}'s ${category}`;
|
|
1346
|
-
}
|
|
1347
|
-
function doctorReportsTheSame(count) {
|
|
1348
|
-
return `'${CLI_INVOKE_COMMAND} doctor' reports the same ${count === 1 ? "file" : "files"}, alongside whatever else is wrong here.`;
|
|
1349
|
-
}
|
|
1350
|
-
function installationConfigsUnreadable(failures) {
|
|
1351
|
-
return [...failures.flatMap(whoseConfigAndItsWayOut), doctorReportsTheSame(failures.length)].join(
|
|
1352
|
-
"\n"
|
|
1353
|
-
);
|
|
1354
|
-
}
|
|
1355
|
-
function whoseConfigAndItsWayOut(failure) {
|
|
1356
|
-
return [
|
|
1357
|
-
`${scopeLabel(failure.scope)}'s config at '${failure.configPath}' could not be loaded: ${failure.reason}`,
|
|
1358
|
-
`There is no automatic repair for this \u2014 fix the file, or recreate the configuration by running ${recreateConfigFrom(failure)}.`
|
|
1359
|
-
];
|
|
1360
|
-
}
|
|
1361
|
-
function uninstallConfigUnreadable(failure) {
|
|
1362
|
-
return `Could not read the ${failure.scope} config \u2014 plugins and compiled agents it lists may be left behind: ${failure.message}`;
|
|
1363
|
-
}
|
|
1364
|
-
function uninstallSkillMetadataUnreadable(metadataPath) {
|
|
1365
|
-
return `Cannot read ${metadataPath}, so uninstall cannot tell whether it made that skill. Fix the file's permissions, or move the skill out, and run uninstall again.`;
|
|
1366
|
-
}
|
|
1367
|
-
function recreateConfigFrom({
|
|
1368
|
-
scopeRoot,
|
|
1369
|
-
providerToName,
|
|
1370
|
-
initProviderToName
|
|
1371
|
-
}) {
|
|
1372
|
-
return `'${CLI_INVOKE_COMMAND} uninstall${providerArgument(providerToName)}' from '${scopeRoot}', which still works on a config it cannot read, then '${CLI_INVOKE_COMMAND} init --from <id>${providerArgument(initProviderToName)}' with an id from ${EDITOR_URL}`;
|
|
1373
|
-
}
|
|
1374
|
-
function providerArgument(provider) {
|
|
1375
|
-
if (provider === void 0) return "";
|
|
1376
|
-
return ` --provider ${typeof provider === "string" ? provider : `<${provider.join("|")}>`}`;
|
|
1377
|
-
}
|
|
1378
|
-
function configUnreadableError(configLoadFailure3) {
|
|
1379
|
-
return [
|
|
1380
|
-
configLoadFailure3,
|
|
1381
|
-
"This is the marketplace's own config rather than an installation's, so it is fixed in the marketplace repository it comes from."
|
|
1382
|
-
].join("\n");
|
|
1383
|
-
}
|
|
1384
|
-
function registeredProjectsUpdateFailed(reason) {
|
|
1385
|
-
return `Could not update registered projects \u2014 their configs may still reference the uninstalled global content: ${reason}`;
|
|
1386
|
-
}
|
|
1387
|
-
function unmarkedAgentsKept(agentsDir2, count) {
|
|
1388
|
-
const object = count === 1 ? "it" : "them";
|
|
1389
|
-
return `Kept ${plural(count, "agent")} in ${agentsDir2}/ \u2014 no ${DEFAULT_PLUGIN_NAME} marker, so this CLI did not compile ${object}.`;
|
|
1390
|
-
}
|
|
1391
|
-
function configFileRemoved(filePath) {
|
|
1392
|
-
return `- ${filePath}`;
|
|
1393
|
-
}
|
|
1394
|
-
function scopeNoun(kind) {
|
|
1395
|
-
return kind === "project" ? "this project" : "the global installation";
|
|
1396
|
-
}
|
|
1397
|
-
function scopeLabel(kind) {
|
|
1398
|
-
return sentenceCase(scopeNoun(kind));
|
|
1399
|
-
}
|
|
1400
|
-
function sentenceCase(text) {
|
|
1401
|
-
return `${text.slice(0, 1).toUpperCase()}${text.slice(1)}`;
|
|
1402
|
-
}
|
|
1403
|
-
function layoutIsCurrent(label, to) {
|
|
1404
|
-
return `${label} is on ${to}/`;
|
|
1405
|
-
}
|
|
1406
|
-
function retiredSourceFolderIgnored(root, provider) {
|
|
1407
|
-
const named = isHomeDirectory(root) ? "~" : root;
|
|
1408
|
-
return `${path3.join(named, RETIRED_SOURCE_FOLDER)}/ is ignored; agents-inc reads ${path3.join(named, sourceDirName(provider))}/. Delete the old folder once you have kept anything you need from it.`;
|
|
1409
|
-
}
|
|
1410
|
-
|
|
1411
|
-
// src/cli/types/generated/source-types.ts
|
|
1412
|
-
var SKILL_SLUGS = [
|
|
1413
|
-
"ai-planning",
|
|
1414
|
-
"ai-reviewing",
|
|
1415
|
-
"angular-standalone",
|
|
1416
|
-
"ant-design",
|
|
1417
|
-
"anthropic-sdk",
|
|
1418
|
-
"api-performance",
|
|
1419
|
-
"api-planning",
|
|
1420
|
-
"api-reviewing",
|
|
1421
|
-
"apollo-server",
|
|
1422
|
-
"app-links",
|
|
1423
|
-
"appwrite",
|
|
1424
|
-
"astro",
|
|
1425
|
-
"auth-security",
|
|
1426
|
-
"aws-sdk",
|
|
1427
|
-
"axiom-pino-sentry",
|
|
1428
|
-
"base-ui",
|
|
1429
|
-
"better-auth-drizzle-hono",
|
|
1430
|
-
"biome",
|
|
1431
|
-
"ble-nfc",
|
|
1432
|
-
"bullmq",
|
|
1433
|
-
"chakra-ui",
|
|
1434
|
-
"changesets",
|
|
1435
|
-
"chroma",
|
|
1436
|
-
"clack",
|
|
1437
|
-
"claude-vision",
|
|
1438
|
-
"clerk",
|
|
1439
|
-
"cli-commander",
|
|
1440
|
-
"cli-planning",
|
|
1441
|
-
"cli-reviewing",
|
|
1442
|
-
"cloudflare-workers",
|
|
1443
|
-
"cockroachdb",
|
|
1444
|
-
"cohere-sdk",
|
|
1445
|
-
"component-library",
|
|
1446
|
-
"composable-components",
|
|
1447
|
-
"css-animations",
|
|
1448
|
-
"cva",
|
|
1449
|
-
"cypress-e2e",
|
|
1450
|
-
"d3",
|
|
1451
|
-
"date-fns",
|
|
1452
|
-
"design-tokens",
|
|
1453
|
-
"detox",
|
|
1454
|
-
"dnd-kit",
|
|
1455
|
-
"docker",
|
|
1456
|
-
"docusaurus",
|
|
1457
|
-
"drizzle",
|
|
1458
|
-
"eas",
|
|
1459
|
-
"edgedb",
|
|
1460
|
-
"elasticsearch",
|
|
1461
|
-
"electron",
|
|
1462
|
-
"electron-forge",
|
|
1463
|
-
"electron-ipc",
|
|
1464
|
-
"electron-multiwindow",
|
|
1465
|
-
"electron-security",
|
|
1466
|
-
"electron-storage",
|
|
1467
|
-
"electron-testing",
|
|
1468
|
-
"electron-ui",
|
|
1469
|
-
"electron-updater",
|
|
1470
|
-
"elevenlabs",
|
|
1471
|
-
"elysia",
|
|
1472
|
-
"error-boundaries",
|
|
1473
|
-
"eslint-prettier",
|
|
1474
|
-
"expo",
|
|
1475
|
-
"expo-router",
|
|
1476
|
-
"express",
|
|
1477
|
-
"expressive-typescript",
|
|
1478
|
-
"fastify",
|
|
1479
|
-
"file-upload-patterns",
|
|
1480
|
-
"firebase",
|
|
1481
|
-
"framer-motion",
|
|
1482
|
-
"gesture-handler",
|
|
1483
|
-
"git-hooks",
|
|
1484
|
-
"github-actions",
|
|
1485
|
-
"google-gemini-sdk",
|
|
1486
|
-
"graphql-apollo",
|
|
1487
|
-
"graphql-urql",
|
|
1488
|
-
"headless-ui",
|
|
1489
|
-
"hono",
|
|
1490
|
-
"huggingface-inference",
|
|
1491
|
-
"image-handling",
|
|
1492
|
-
"infra-reviewing",
|
|
1493
|
-
"jotai",
|
|
1494
|
-
"knex",
|
|
1495
|
-
"kubernetes",
|
|
1496
|
-
"langchain",
|
|
1497
|
-
"langfuse",
|
|
1498
|
-
"leaflet",
|
|
1499
|
-
"lexical",
|
|
1500
|
-
"litellm",
|
|
1501
|
-
"llamaindex",
|
|
1502
|
-
"maestro",
|
|
1503
|
-
"mantine",
|
|
1504
|
-
"mapbox",
|
|
1505
|
-
"meilisearch",
|
|
1506
|
-
"mercurius",
|
|
1507
|
-
"mistral-sdk",
|
|
1508
|
-
"mmkv",
|
|
1509
|
-
"mobx",
|
|
1510
|
-
"modal",
|
|
1511
|
-
"mongodb",
|
|
1512
|
-
"mongoose",
|
|
1513
|
-
"msw",
|
|
1514
|
-
"mui",
|
|
1515
|
-
"mysql",
|
|
1516
|
-
"native-js",
|
|
1517
|
-
"nativewind",
|
|
1518
|
-
"neon",
|
|
1519
|
-
"nestjs",
|
|
1520
|
-
"netlify",
|
|
1521
|
-
"next-intl",
|
|
1522
|
-
"nextauth",
|
|
1523
|
-
"nextjs",
|
|
1524
|
-
"ngrx-signalstore",
|
|
1525
|
-
"nuxt",
|
|
1526
|
-
"nx",
|
|
1527
|
-
"oclif-ink",
|
|
1528
|
-
"offline-first",
|
|
1529
|
-
"ollama",
|
|
1530
|
-
"openai-sdk",
|
|
1531
|
-
"openai-whisper",
|
|
1532
|
-
"openapi",
|
|
1533
|
-
"payload",
|
|
1534
|
-
"pinecone",
|
|
1535
|
-
"pinia",
|
|
1536
|
-
"planetscale",
|
|
1537
|
-
"playwright-e2e",
|
|
1538
|
-
"pnpm-workspaces",
|
|
1539
|
-
"postgresql",
|
|
1540
|
-
"posthog-analytics",
|
|
1541
|
-
"posthog-flags",
|
|
1542
|
-
"prisma",
|
|
1543
|
-
"promptfoo",
|
|
1544
|
-
"pulumi",
|
|
1545
|
-
"push",
|
|
1546
|
-
"qdrant",
|
|
1547
|
-
"qwik",
|
|
1548
|
-
"radix-ui",
|
|
1549
|
-
"react",
|
|
1550
|
-
"react-hook-form",
|
|
1551
|
-
"react-intl",
|
|
1552
|
-
"react-native",
|
|
1553
|
-
"react-native-paper",
|
|
1554
|
-
"react-native-performance",
|
|
1555
|
-
"react-native-security",
|
|
1556
|
-
"react-navigation",
|
|
1557
|
-
"react-query",
|
|
1558
|
-
"react-router",
|
|
1559
|
-
"react-testing-library",
|
|
1560
|
-
"react-three-fiber",
|
|
1561
|
-
"reanimated",
|
|
1562
|
-
"recharts",
|
|
1563
|
-
"redis",
|
|
1564
|
-
"redux-toolkit",
|
|
1565
|
-
"remix",
|
|
1566
|
-
"replicate",
|
|
1567
|
-
"research-methodology",
|
|
1568
|
-
"resend-react-email",
|
|
1569
|
-
"result-types",
|
|
1570
|
-
"reviewing",
|
|
1571
|
-
"rxjs",
|
|
1572
|
-
"sanity",
|
|
1573
|
-
"scss-modules",
|
|
1574
|
-
"sequelize",
|
|
1575
|
-
"service-workers",
|
|
1576
|
-
"setup-axiom-pino-sentry",
|
|
1577
|
-
"setup-env",
|
|
1578
|
-
"setup-posthog",
|
|
1579
|
-
"setup-resend",
|
|
1580
|
-
"shadcn-ui",
|
|
1581
|
-
"skia",
|
|
1582
|
-
"socket-io",
|
|
1583
|
-
"solidjs",
|
|
1584
|
-
"sqlite-powersync",
|
|
1585
|
-
"sse",
|
|
1586
|
-
"sst",
|
|
1587
|
-
"stack-detect",
|
|
1588
|
-
"storybook",
|
|
1589
|
-
"strapi",
|
|
1590
|
-
"strategies",
|
|
1591
|
-
"stripe",
|
|
1592
|
-
"supabase",
|
|
1593
|
-
"surrealdb",
|
|
1594
|
-
"svelte",
|
|
1595
|
-
"sveltekit",
|
|
1596
|
-
"swr",
|
|
1597
|
-
"tailwind",
|
|
1598
|
-
"tamagui",
|
|
1599
|
-
"tanstack-form",
|
|
1600
|
-
"tanstack-router",
|
|
1601
|
-
"tanstack-table",
|
|
1602
|
-
"tasks",
|
|
1603
|
-
"tauri",
|
|
1604
|
-
"tauri-backend",
|
|
1605
|
-
"tauri-bundling",
|
|
1606
|
-
"tauri-mobile",
|
|
1607
|
-
"tauri-multiwindow",
|
|
1608
|
-
"tauri-plugins",
|
|
1609
|
-
"tauri-security",
|
|
1610
|
-
"terraform",
|
|
1611
|
-
"theming",
|
|
1612
|
-
"tiptap",
|
|
1613
|
-
"together-ai",
|
|
1614
|
-
"tool-use-patterns",
|
|
1615
|
-
"trpc",
|
|
1616
|
-
"turborepo",
|
|
1617
|
-
"turborepo-ci",
|
|
1618
|
-
"turso",
|
|
1619
|
-
"typeorm",
|
|
1620
|
-
"typescript-config",
|
|
1621
|
-
"unistyles",
|
|
1622
|
-
"upstash",
|
|
1623
|
-
"vee-validate",
|
|
1624
|
-
"vercel",
|
|
1625
|
-
"vercel-ai-sdk",
|
|
1626
|
-
"vercel-kv",
|
|
1627
|
-
"vercel-postgres",
|
|
1628
|
-
"view-transitions",
|
|
1629
|
-
"vision-camera",
|
|
1630
|
-
"visual-regression",
|
|
1631
|
-
"vite",
|
|
1632
|
-
"vitepress",
|
|
1633
|
-
"vitest",
|
|
1634
|
-
"vue-composition-api",
|
|
1635
|
-
"vue-i18n",
|
|
1636
|
-
"vue-test-utils",
|
|
1637
|
-
"vuetify",
|
|
1638
|
-
"vueuse",
|
|
1639
|
-
"watermelondb",
|
|
1640
|
-
"weaviate",
|
|
1641
|
-
"web-accessibility",
|
|
1642
|
-
"web-performance",
|
|
1643
|
-
"web-planning",
|
|
1644
|
-
"web-reviewing",
|
|
1645
|
-
"webhooks",
|
|
1646
|
-
"websockets",
|
|
1647
|
-
"xquik",
|
|
1648
|
-
"yoga",
|
|
1649
|
-
"zod-validation",
|
|
1650
|
-
"zustand"
|
|
753
|
+
// src/cli/types/generated/source-types.ts
|
|
754
|
+
var SKILL_SLUGS = [
|
|
755
|
+
"ai-planning",
|
|
756
|
+
"ai-reviewing",
|
|
757
|
+
"angular-standalone",
|
|
758
|
+
"ant-design",
|
|
759
|
+
"anthropic-sdk",
|
|
760
|
+
"api-performance",
|
|
761
|
+
"api-planning",
|
|
762
|
+
"api-reviewing",
|
|
763
|
+
"apollo-server",
|
|
764
|
+
"app-links",
|
|
765
|
+
"appwrite",
|
|
766
|
+
"astro",
|
|
767
|
+
"auth-security",
|
|
768
|
+
"aws-sdk",
|
|
769
|
+
"axiom-pino-sentry",
|
|
770
|
+
"base-ui",
|
|
771
|
+
"better-auth-drizzle-hono",
|
|
772
|
+
"biome",
|
|
773
|
+
"ble-nfc",
|
|
774
|
+
"bullmq",
|
|
775
|
+
"chakra-ui",
|
|
776
|
+
"changesets",
|
|
777
|
+
"chroma",
|
|
778
|
+
"clack",
|
|
779
|
+
"claude-vision",
|
|
780
|
+
"clerk",
|
|
781
|
+
"cli-commander",
|
|
782
|
+
"cli-planning",
|
|
783
|
+
"cli-reviewing",
|
|
784
|
+
"cloudflare-workers",
|
|
785
|
+
"cockroachdb",
|
|
786
|
+
"cohere-sdk",
|
|
787
|
+
"component-library",
|
|
788
|
+
"composable-components",
|
|
789
|
+
"css-animations",
|
|
790
|
+
"cva",
|
|
791
|
+
"cypress-e2e",
|
|
792
|
+
"d3",
|
|
793
|
+
"date-fns",
|
|
794
|
+
"design-tokens",
|
|
795
|
+
"detox",
|
|
796
|
+
"dnd-kit",
|
|
797
|
+
"docker",
|
|
798
|
+
"docusaurus",
|
|
799
|
+
"drizzle",
|
|
800
|
+
"eas",
|
|
801
|
+
"edgedb",
|
|
802
|
+
"elasticsearch",
|
|
803
|
+
"electron",
|
|
804
|
+
"electron-forge",
|
|
805
|
+
"electron-ipc",
|
|
806
|
+
"electron-multiwindow",
|
|
807
|
+
"electron-security",
|
|
808
|
+
"electron-storage",
|
|
809
|
+
"electron-testing",
|
|
810
|
+
"electron-ui",
|
|
811
|
+
"electron-updater",
|
|
812
|
+
"elevenlabs",
|
|
813
|
+
"elysia",
|
|
814
|
+
"error-boundaries",
|
|
815
|
+
"eslint-prettier",
|
|
816
|
+
"expo",
|
|
817
|
+
"expo-router",
|
|
818
|
+
"express",
|
|
819
|
+
"expressive-typescript",
|
|
820
|
+
"fastify",
|
|
821
|
+
"file-upload-patterns",
|
|
822
|
+
"firebase",
|
|
823
|
+
"framer-motion",
|
|
824
|
+
"gesture-handler",
|
|
825
|
+
"git-hooks",
|
|
826
|
+
"github-actions",
|
|
827
|
+
"google-gemini-sdk",
|
|
828
|
+
"graphql-apollo",
|
|
829
|
+
"graphql-urql",
|
|
830
|
+
"headless-ui",
|
|
831
|
+
"hono",
|
|
832
|
+
"huggingface-inference",
|
|
833
|
+
"image-handling",
|
|
834
|
+
"infra-reviewing",
|
|
835
|
+
"jotai",
|
|
836
|
+
"knex",
|
|
837
|
+
"kubernetes",
|
|
838
|
+
"langchain",
|
|
839
|
+
"langfuse",
|
|
840
|
+
"leaflet",
|
|
841
|
+
"lexical",
|
|
842
|
+
"litellm",
|
|
843
|
+
"llamaindex",
|
|
844
|
+
"maestro",
|
|
845
|
+
"mantine",
|
|
846
|
+
"mapbox",
|
|
847
|
+
"meilisearch",
|
|
848
|
+
"mercurius",
|
|
849
|
+
"mistral-sdk",
|
|
850
|
+
"mmkv",
|
|
851
|
+
"mobx",
|
|
852
|
+
"modal",
|
|
853
|
+
"mongodb",
|
|
854
|
+
"mongoose",
|
|
855
|
+
"msw",
|
|
856
|
+
"mui",
|
|
857
|
+
"mysql",
|
|
858
|
+
"native-js",
|
|
859
|
+
"nativewind",
|
|
860
|
+
"neon",
|
|
861
|
+
"nestjs",
|
|
862
|
+
"netlify",
|
|
863
|
+
"next-intl",
|
|
864
|
+
"nextauth",
|
|
865
|
+
"nextjs",
|
|
866
|
+
"ngrx-signalstore",
|
|
867
|
+
"nuxt",
|
|
868
|
+
"nx",
|
|
869
|
+
"oclif-ink",
|
|
870
|
+
"offline-first",
|
|
871
|
+
"ollama",
|
|
872
|
+
"openai-sdk",
|
|
873
|
+
"openai-whisper",
|
|
874
|
+
"openapi",
|
|
875
|
+
"payload",
|
|
876
|
+
"pinecone",
|
|
877
|
+
"pinia",
|
|
878
|
+
"planetscale",
|
|
879
|
+
"playwright-e2e",
|
|
880
|
+
"pnpm-workspaces",
|
|
881
|
+
"postgresql",
|
|
882
|
+
"posthog-analytics",
|
|
883
|
+
"posthog-flags",
|
|
884
|
+
"prisma",
|
|
885
|
+
"promptfoo",
|
|
886
|
+
"pulumi",
|
|
887
|
+
"push",
|
|
888
|
+
"qdrant",
|
|
889
|
+
"qwik",
|
|
890
|
+
"radix-ui",
|
|
891
|
+
"react",
|
|
892
|
+
"react-hook-form",
|
|
893
|
+
"react-intl",
|
|
894
|
+
"react-native",
|
|
895
|
+
"react-native-paper",
|
|
896
|
+
"react-native-performance",
|
|
897
|
+
"react-native-security",
|
|
898
|
+
"react-navigation",
|
|
899
|
+
"react-query",
|
|
900
|
+
"react-router",
|
|
901
|
+
"react-testing-library",
|
|
902
|
+
"react-three-fiber",
|
|
903
|
+
"reanimated",
|
|
904
|
+
"recharts",
|
|
905
|
+
"redis",
|
|
906
|
+
"redux-toolkit",
|
|
907
|
+
"remix",
|
|
908
|
+
"replicate",
|
|
909
|
+
"research-methodology",
|
|
910
|
+
"resend-react-email",
|
|
911
|
+
"result-types",
|
|
912
|
+
"reviewing",
|
|
913
|
+
"rxjs",
|
|
914
|
+
"sanity",
|
|
915
|
+
"scss-modules",
|
|
916
|
+
"sequelize",
|
|
917
|
+
"service-workers",
|
|
918
|
+
"setup-axiom-pino-sentry",
|
|
919
|
+
"setup-env",
|
|
920
|
+
"setup-posthog",
|
|
921
|
+
"setup-resend",
|
|
922
|
+
"shadcn-ui",
|
|
923
|
+
"skia",
|
|
924
|
+
"socket-io",
|
|
925
|
+
"solidjs",
|
|
926
|
+
"sqlite-powersync",
|
|
927
|
+
"sse",
|
|
928
|
+
"sst",
|
|
929
|
+
"stack-detect",
|
|
930
|
+
"storybook",
|
|
931
|
+
"strapi",
|
|
932
|
+
"strategies",
|
|
933
|
+
"stripe",
|
|
934
|
+
"supabase",
|
|
935
|
+
"surrealdb",
|
|
936
|
+
"svelte",
|
|
937
|
+
"sveltekit",
|
|
938
|
+
"swr",
|
|
939
|
+
"tailwind",
|
|
940
|
+
"tamagui",
|
|
941
|
+
"tanstack-form",
|
|
942
|
+
"tanstack-router",
|
|
943
|
+
"tanstack-table",
|
|
944
|
+
"tasks",
|
|
945
|
+
"tauri",
|
|
946
|
+
"tauri-backend",
|
|
947
|
+
"tauri-bundling",
|
|
948
|
+
"tauri-mobile",
|
|
949
|
+
"tauri-multiwindow",
|
|
950
|
+
"tauri-plugins",
|
|
951
|
+
"tauri-security",
|
|
952
|
+
"terraform",
|
|
953
|
+
"theming",
|
|
954
|
+
"tiptap",
|
|
955
|
+
"together-ai",
|
|
956
|
+
"tool-use-patterns",
|
|
957
|
+
"trpc",
|
|
958
|
+
"turborepo",
|
|
959
|
+
"turborepo-ci",
|
|
960
|
+
"turso",
|
|
961
|
+
"typeorm",
|
|
962
|
+
"typescript-config",
|
|
963
|
+
"unistyles",
|
|
964
|
+
"upstash",
|
|
965
|
+
"vee-validate",
|
|
966
|
+
"vercel",
|
|
967
|
+
"vercel-ai-sdk",
|
|
968
|
+
"vercel-kv",
|
|
969
|
+
"vercel-postgres",
|
|
970
|
+
"view-transitions",
|
|
971
|
+
"vision-camera",
|
|
972
|
+
"visual-regression",
|
|
973
|
+
"vite",
|
|
974
|
+
"vitepress",
|
|
975
|
+
"vitest",
|
|
976
|
+
"vue-composition-api",
|
|
977
|
+
"vue-i18n",
|
|
978
|
+
"vue-test-utils",
|
|
979
|
+
"vuetify",
|
|
980
|
+
"vueuse",
|
|
981
|
+
"watermelondb",
|
|
982
|
+
"weaviate",
|
|
983
|
+
"web-accessibility",
|
|
984
|
+
"web-performance",
|
|
985
|
+
"web-planning",
|
|
986
|
+
"web-reviewing",
|
|
987
|
+
"webhooks",
|
|
988
|
+
"websockets",
|
|
989
|
+
"xquik",
|
|
990
|
+
"yoga",
|
|
991
|
+
"zod-validation",
|
|
992
|
+
"zustand"
|
|
1651
993
|
];
|
|
1652
994
|
var SKILL_IDS2 = [
|
|
1653
995
|
"ai-infrastructure-huggingface-inference",
|
|
@@ -2014,27 +1356,762 @@ var AGENT_NAMES2 = [
|
|
|
2014
1356
|
"web-tester"
|
|
2015
1357
|
];
|
|
2016
1358
|
|
|
2017
|
-
// src/cli/utils/type-guards.ts
|
|
2018
|
-
function isRecord(value) {
|
|
2019
|
-
return typeof value === "object" && value !== null && !Array.isArray(value);
|
|
1359
|
+
// src/cli/utils/type-guards.ts
|
|
1360
|
+
function isRecord(value) {
|
|
1361
|
+
return typeof value === "object" && value !== null && !Array.isArray(value);
|
|
1362
|
+
}
|
|
1363
|
+
function isAgentName2(value) {
|
|
1364
|
+
return AGENT_NAMES2.includes(value);
|
|
1365
|
+
}
|
|
1366
|
+
function isSkillId(value) {
|
|
1367
|
+
return SKILL_IDS2.includes(value);
|
|
1368
|
+
}
|
|
1369
|
+
function isSkillAssignment(value) {
|
|
1370
|
+
if (typeof value !== "object" || value === null) return false;
|
|
1371
|
+
return typeof value.id === "string";
|
|
1372
|
+
}
|
|
1373
|
+
|
|
1374
|
+
// src/cli/lib/config-gate/gate-token.ts
|
|
1375
|
+
import { AsyncLocalStorage } from "async_hooks";
|
|
1376
|
+
var gateToken = new AsyncLocalStorage();
|
|
1377
|
+
var GlobalPairWriteViolation = class extends Error {
|
|
1378
|
+
constructor(targetPath) {
|
|
1379
|
+
super(
|
|
1380
|
+
`${targetPath} may only be written through config-gate \u2014 see src/cli/lib/config-gate/index.ts`
|
|
1381
|
+
);
|
|
1382
|
+
this.name = "GlobalPairWriteViolation";
|
|
1383
|
+
}
|
|
1384
|
+
};
|
|
1385
|
+
function withGateToken(fn) {
|
|
1386
|
+
return gateToken.run(true, fn);
|
|
1387
|
+
}
|
|
1388
|
+
function hasGateToken() {
|
|
1389
|
+
return gateToken.getStore() === true;
|
|
1390
|
+
}
|
|
1391
|
+
function assertGateToken(targetPath) {
|
|
1392
|
+
if (hasGateToken()) return;
|
|
1393
|
+
throw new GlobalPairWriteViolation(targetPath);
|
|
1394
|
+
}
|
|
1395
|
+
|
|
1396
|
+
// src/cli/utils/fs.ts
|
|
1397
|
+
function isPathWithin(child, parent) {
|
|
1398
|
+
const resolvedChild = path3.resolve(child);
|
|
1399
|
+
const resolvedParent = path3.resolve(parent);
|
|
1400
|
+
return resolvedChild === resolvedParent || resolvedChild.startsWith(resolvedParent + path3.sep);
|
|
1401
|
+
}
|
|
1402
|
+
async function readFile(filePath) {
|
|
1403
|
+
return fs3.readFile(filePath, "utf-8");
|
|
1404
|
+
}
|
|
1405
|
+
async function readFileSafe(filePath, maxSizeBytes) {
|
|
1406
|
+
const stats = await fs3.stat(filePath);
|
|
1407
|
+
if (stats.size > maxSizeBytes) {
|
|
1408
|
+
throw new Error(
|
|
1409
|
+
`File too large: '${filePath}' is ${stats.size} bytes (limit: ${maxSizeBytes} bytes)`
|
|
1410
|
+
);
|
|
1411
|
+
}
|
|
1412
|
+
return fs3.readFile(filePath, "utf-8");
|
|
1413
|
+
}
|
|
1414
|
+
async function readFileOptional(filePath, fallback = "") {
|
|
1415
|
+
try {
|
|
1416
|
+
return await fs3.readFile(filePath, "utf-8");
|
|
1417
|
+
} catch {
|
|
1418
|
+
return fallback;
|
|
1419
|
+
}
|
|
1420
|
+
}
|
|
1421
|
+
async function fileExists(filePath) {
|
|
1422
|
+
return fs3.pathExists(filePath);
|
|
1423
|
+
}
|
|
1424
|
+
async function isKnownAbsent(filePath) {
|
|
1425
|
+
try {
|
|
1426
|
+
await fs3.lstat(filePath);
|
|
1427
|
+
return false;
|
|
1428
|
+
} catch (error) {
|
|
1429
|
+
return isRecord(error) && error.code === "ENOENT";
|
|
1430
|
+
}
|
|
1431
|
+
}
|
|
1432
|
+
async function jsonFileMatches(filePath, schema) {
|
|
1433
|
+
try {
|
|
1434
|
+
return schema.safeParse(JSON.parse(await readFile(filePath))).success;
|
|
1435
|
+
} catch {
|
|
1436
|
+
return false;
|
|
1437
|
+
}
|
|
1438
|
+
}
|
|
1439
|
+
async function isBlankFile(filePath) {
|
|
1440
|
+
try {
|
|
1441
|
+
return (await readFile(filePath)).trim() === "";
|
|
1442
|
+
} catch {
|
|
1443
|
+
return false;
|
|
1444
|
+
}
|
|
1445
|
+
}
|
|
1446
|
+
async function directoryExists2(dirPath) {
|
|
1447
|
+
try {
|
|
1448
|
+
const stat2 = await fs3.stat(dirPath);
|
|
1449
|
+
return stat2.isDirectory();
|
|
1450
|
+
} catch {
|
|
1451
|
+
return false;
|
|
1452
|
+
}
|
|
1453
|
+
}
|
|
1454
|
+
async function isSymlink(filePath) {
|
|
1455
|
+
try {
|
|
1456
|
+
const entry = await fs3.lstat(filePath);
|
|
1457
|
+
return entry.isSymbolicLink();
|
|
1458
|
+
} catch {
|
|
1459
|
+
return false;
|
|
1460
|
+
}
|
|
1461
|
+
}
|
|
1462
|
+
async function listDirectories(dirPath) {
|
|
1463
|
+
try {
|
|
1464
|
+
const entries = await fs3.readdir(dirPath, { withFileTypes: true });
|
|
1465
|
+
return entries.filter((e) => e.isDirectory()).map((e) => e.name).toSorted(bytewise);
|
|
1466
|
+
} catch {
|
|
1467
|
+
return [];
|
|
1468
|
+
}
|
|
1469
|
+
}
|
|
1470
|
+
async function glob(pattern, cwd, { dot = false } = {}) {
|
|
1471
|
+
const matches = await fg(pattern, { cwd, onlyFiles: true, dot });
|
|
1472
|
+
return matches.toSorted(bytewise);
|
|
1473
|
+
}
|
|
1474
|
+
var PAIR_HALVES = [STANDARD_FILES.CONFIG_TS, STANDARD_FILES.CONFIG_TYPES_TS];
|
|
1475
|
+
function globalPairFolders() {
|
|
1476
|
+
const home = os3.homedir();
|
|
1477
|
+
return PROVIDERS.map((provider) => sourceDir(home, provider));
|
|
1478
|
+
}
|
|
1479
|
+
function everyGlobalPairPath() {
|
|
1480
|
+
return globalPairFolders().flatMap(
|
|
1481
|
+
(folder) => PAIR_HALVES.map((half) => path3.join(folder, half))
|
|
1482
|
+
);
|
|
1483
|
+
}
|
|
1484
|
+
async function writeFile(filePath, content) {
|
|
1485
|
+
const resolvedPath = path3.resolve(filePath);
|
|
1486
|
+
if (everyGlobalPairPath().includes(resolvedPath)) assertGateToken(resolvedPath);
|
|
1487
|
+
await fs3.ensureDir(path3.dirname(filePath));
|
|
1488
|
+
await fs3.writeFile(filePath, content, "utf-8");
|
|
1489
|
+
}
|
|
1490
|
+
async function ensureDir(dirPath) {
|
|
1491
|
+
await fs3.ensureDir(dirPath);
|
|
1492
|
+
}
|
|
1493
|
+
async function remove(filePath) {
|
|
1494
|
+
await fs3.remove(filePath);
|
|
1495
|
+
}
|
|
1496
|
+
async function isDirectoryEmpty(dirPath) {
|
|
1497
|
+
try {
|
|
1498
|
+
const entries = await fs3.readdir(dirPath);
|
|
1499
|
+
return entries.length === 0;
|
|
1500
|
+
} catch {
|
|
1501
|
+
return true;
|
|
1502
|
+
}
|
|
1503
|
+
}
|
|
1504
|
+
async function removeDirIfEmpty(dir) {
|
|
1505
|
+
if (!await directoryExists2(dir)) return false;
|
|
1506
|
+
if (!await isDirectoryEmpty(dir)) return false;
|
|
1507
|
+
await remove(dir);
|
|
1508
|
+
return true;
|
|
1509
|
+
}
|
|
1510
|
+
async function copy(src, dest) {
|
|
1511
|
+
await fs3.copy(src, dest);
|
|
1512
|
+
await grantOwnerWrite(dest);
|
|
1513
|
+
}
|
|
1514
|
+
var OWNER_WRITE = 128;
|
|
1515
|
+
async function grantOwnerWrite(target) {
|
|
1516
|
+
const entry = await fs3.stat(target);
|
|
1517
|
+
await fs3.chmod(target, entry.mode | OWNER_WRITE);
|
|
1518
|
+
if (!entry.isDirectory()) return;
|
|
1519
|
+
const children = await fs3.readdir(target);
|
|
1520
|
+
await Promise.all(children.map((child) => grantOwnerWrite(path3.join(target, child))));
|
|
1521
|
+
}
|
|
1522
|
+
|
|
1523
|
+
// src/cli/utils/logger.ts
|
|
1524
|
+
import { AsyncLocalStorage as AsyncLocalStorage2 } from "async_hooks";
|
|
1525
|
+
var verboseMode = false;
|
|
1526
|
+
function setVerbose(enabled) {
|
|
1527
|
+
verboseMode = enabled;
|
|
1528
|
+
}
|
|
1529
|
+
function verbose(msg) {
|
|
1530
|
+
if (verboseMode) {
|
|
1531
|
+
console.log(` ${msg}`);
|
|
1532
|
+
}
|
|
1533
|
+
}
|
|
1534
|
+
function log(msg) {
|
|
1535
|
+
console.log(msg);
|
|
1536
|
+
}
|
|
1537
|
+
var bufferMode = false;
|
|
1538
|
+
var messageBuffer = [];
|
|
1539
|
+
var alreadySaid = /* @__PURE__ */ new Set();
|
|
1540
|
+
var eachWarningOnce = new AsyncLocalStorage2();
|
|
1541
|
+
function enableBuffering() {
|
|
1542
|
+
bufferMode = true;
|
|
1543
|
+
messageBuffer = [];
|
|
1544
|
+
}
|
|
1545
|
+
function drainBuffer() {
|
|
1546
|
+
const messages = [...messageBuffer];
|
|
1547
|
+
messageBuffer = [];
|
|
1548
|
+
return messages;
|
|
1549
|
+
}
|
|
1550
|
+
function disableBuffering() {
|
|
1551
|
+
bufferMode = false;
|
|
1552
|
+
messageBuffer = [];
|
|
1553
|
+
}
|
|
1554
|
+
function warn(msg) {
|
|
1555
|
+
if (isARepeatToHoldBack(msg)) return;
|
|
1556
|
+
if (bufferMode) {
|
|
1557
|
+
messageBuffer.push({ level: "warn", text: msg });
|
|
1558
|
+
return;
|
|
1559
|
+
}
|
|
1560
|
+
alreadySaid.add(msg);
|
|
1561
|
+
console.warn(` Warning: ${msg}`);
|
|
1562
|
+
}
|
|
1563
|
+
function isARepeatToHoldBack(msg) {
|
|
1564
|
+
if (eachWarningOnce.getStore() !== true) return false;
|
|
1565
|
+
return alreadySaid.has(msg) || messageBuffer.some((message) => message.text === msg);
|
|
1566
|
+
}
|
|
1567
|
+
function sayingEachWarningOnce(body) {
|
|
1568
|
+
return eachWarningOnce.run(true, body);
|
|
1569
|
+
}
|
|
1570
|
+
function warnOnce(msg) {
|
|
1571
|
+
sayingEachWarningOnce(() => warn(msg));
|
|
1572
|
+
}
|
|
1573
|
+
|
|
1574
|
+
// src/cli/utils/messages.ts
|
|
1575
|
+
import path4 from "path";
|
|
1576
|
+
import { partition } from "remeda";
|
|
1577
|
+
|
|
1578
|
+
// src/cli/lib/validate-kebab-name.ts
|
|
1579
|
+
import { unique } from "remeda";
|
|
1580
|
+
var KEBAB_CASE_CHARACTER = /[a-z0-9-]/;
|
|
1581
|
+
function charactersOutsideKebabCase(name) {
|
|
1582
|
+
return unique([...name].filter((character) => !KEBAB_CASE_CHARACTER.test(character)));
|
|
1583
|
+
}
|
|
1584
|
+
function validateKebabCaseName(name, noun) {
|
|
1585
|
+
if (!name || name.trim() === "") {
|
|
1586
|
+
return `${noun} name is required`;
|
|
1587
|
+
}
|
|
1588
|
+
if (!KEBAB_CASE_PATTERN.test(name)) {
|
|
1589
|
+
return `${noun} name must be kebab-case (lowercase letters, numbers, and hyphens, starting with a letter)`;
|
|
1590
|
+
}
|
|
1591
|
+
return null;
|
|
1592
|
+
}
|
|
1593
|
+
|
|
1594
|
+
// src/cli/utils/messages.ts
|
|
1595
|
+
var ERROR_MESSAGES = {
|
|
1596
|
+
UNKNOWN_ERROR: "Unknown error occurred",
|
|
1597
|
+
UNKNOWN_ERROR_SHORT: "Unknown error",
|
|
1598
|
+
NO_INSTALLATION: `No installation found. Run '${CLI_INVOKE_COMMAND} init' first to set up ${DEFAULT_BRANDING.NAME}`,
|
|
1599
|
+
FAILED_RESOLVE_SOURCE: "Failed to resolve marketplace",
|
|
1600
|
+
FAILED_LOAD_AGENT_PARTIALS: "Failed to load agent partials",
|
|
1601
|
+
FAILED_COMPILE_AGENTS: "Failed to compile agents",
|
|
1602
|
+
/** Names `init`, not `edit`: there are no installed skills to edit. */
|
|
1603
|
+
NO_SKILLS_TO_COMPILE: `No skills found. Run '${CLI_INVOKE_COMMAND} init' to choose skills, or add your own under ${LOCAL_SKILLS_PATH}/.`
|
|
1604
|
+
};
|
|
1605
|
+
var SUCCESS_MESSAGES = {
|
|
1606
|
+
UNINSTALL_COMPLETE: "Uninstall complete!",
|
|
1607
|
+
PLUGIN_COMPILE_COMPLETE: "Plugin compile complete!"
|
|
1608
|
+
};
|
|
1609
|
+
var HOST_CLI = {
|
|
1610
|
+
claude: { name: "Claude CLI", install: "Install Claude Code first: https://claude.ai/code" },
|
|
1611
|
+
codex: {
|
|
1612
|
+
name: "Codex CLI",
|
|
1613
|
+
install: "Install the '@openai/codex' package first, so that 'codex' is on PATH"
|
|
1614
|
+
}
|
|
1615
|
+
};
|
|
1616
|
+
function hostCliNotFound(provider) {
|
|
1617
|
+
const cli = HOST_CLI[provider];
|
|
1618
|
+
return `${cli.name} not found \u2014 '${CLI_INVOKE_COMMAND} update' refreshes marketplaces through it. ${cli.install}`;
|
|
1619
|
+
}
|
|
1620
|
+
function pluginLeftRegistered(pluginRef, provider) {
|
|
1621
|
+
const cli = HOST_CLI[provider];
|
|
1622
|
+
return `Could not unregister plugin '${pluginRef}': ${cli.name} not found, so it stays registered. ${cli.install}`;
|
|
1623
|
+
}
|
|
1624
|
+
function initSucceeded(brandingName) {
|
|
1625
|
+
return `${brandingName} initialized successfully!`;
|
|
1626
|
+
}
|
|
1627
|
+
var STATUS_MESSAGES = {
|
|
1628
|
+
INSTALLING_PLUGINS: "Installing skill plugins...",
|
|
1629
|
+
LOADING_SKILLS: "Loading skills...",
|
|
1630
|
+
LOADING_MARKETPLACE_SOURCE: "Loading marketplace...",
|
|
1631
|
+
RECOMPILING_AGENTS: "Recompiling agents...",
|
|
1632
|
+
COMPILING_AGENTS: "Compiling agents...",
|
|
1633
|
+
DISCOVERING_SKILLS: "Discovering skills...",
|
|
1634
|
+
RESOLVING_SOURCE: "Resolving marketplace...",
|
|
1635
|
+
RESOLVING_MARKETPLACE_SOURCE: "Resolving marketplace...",
|
|
1636
|
+
LOADING_AGENT_PARTIALS: "Loading agent partials...",
|
|
1637
|
+
FETCHING_REPOSITORY: "Fetching repository...",
|
|
1638
|
+
COPYING_SKILLS: "Copying skills...",
|
|
1639
|
+
/** Printed before the download starts: the only sign this load is not a cache read. */
|
|
1640
|
+
MARKETPLACE_HAS_NEWER_CONTENT: "Marketplace has newer content \u2014 fetching the update..."
|
|
1641
|
+
};
|
|
1642
|
+
var AGENT_PARTIAL_FILES = [
|
|
1643
|
+
STANDARD_FILES.IDENTITY_MD,
|
|
1644
|
+
STANDARD_FILES.PLAYBOOK_MD,
|
|
1645
|
+
STANDARD_FILES.CRITICAL_REQUIREMENTS_MD,
|
|
1646
|
+
STANDARD_FILES.CRITICAL_REMINDERS_MD,
|
|
1647
|
+
STANDARD_FILES.OUTPUT_MD
|
|
1648
|
+
];
|
|
1649
|
+
var INFO_MESSAGES = {
|
|
1650
|
+
NO_CHANGES_MADE: "No changes made.",
|
|
1651
|
+
RUN_COMPILE: `Run '${CLI_INVOKE_COMMAND} compile' to include imported skills in your agents.`,
|
|
1652
|
+
NO_AGENTS_TO_RECOMPILE: "No agents to recompile",
|
|
1653
|
+
NO_PLUGIN_INSTALLATION: "No plugin installation found.",
|
|
1654
|
+
NO_LOCAL_INSTALLATION: "No local installation found.",
|
|
1655
|
+
CONFIG_TYPES_REFRESHED: `Refreshed ${STANDARD_FILES.CONFIG_TYPES_TS}`,
|
|
1656
|
+
EJECTED_SKILLS_USER_OWNED: `Ejected skills are yours to own \u2014 '${CLI_INVOKE_COMMAND} update' does not change them.`,
|
|
1657
|
+
NO_PLUGIN_MARKETPLACES: "No plugin marketplaces are configured \u2014 nothing to refresh.",
|
|
1658
|
+
/** The owner's words, on stderr before the command's own output. */
|
|
1659
|
+
GLOBAL_INSTALLATION_STANDS_IN: "This project's config declares nothing, so this works on your global installation.",
|
|
1660
|
+
NO_GLOBAL_INSTALLATION_STANDS_IN: "This project's config declares nothing, and there is no global installation for this to work on.",
|
|
1661
|
+
DECLARES_NOTHING_TO_UNINSTALL: "This project's config declares nothing, so there is nothing to uninstall in this project.",
|
|
1662
|
+
DECLARES_NOTHING_TO_EJECT_FROM: "This project's config declares nothing; eject works on this project, not on a global installation.",
|
|
1663
|
+
DECLARES_NOTHING_TO_INIT_OVER: "This project's config declares nothing, so init treats this project as holding no installation.",
|
|
1664
|
+
DECLARES_NOTHING_TO_SEARCH_FROM: "This project's config declares nothing; search reads the marketplace it names, else the global installation's, else the default one.",
|
|
1665
|
+
/** Under doctor's marketplace row, when its download replaced a saved copy whose files differed. */
|
|
1666
|
+
SAVED_COPY_REPLACED: "The saved copy differed from the marketplace and has been replaced",
|
|
1667
|
+
/** Printed under the destination already named, so it names files only. */
|
|
1668
|
+
AGENT_PARTIALS_CUSTOMIZABLE: `Each sub-agent directory there holds up to ${plural(AGENT_PARTIAL_FILES.length, "partial")} (${AGENT_PARTIAL_FILES.join(", ")}) \u2014 edit those to customize that sub-agent.`
|
|
1669
|
+
};
|
|
1670
|
+
function notInstalledHere(brandingName) {
|
|
1671
|
+
return `${brandingName} is not installed in this project.`;
|
|
1672
|
+
}
|
|
1673
|
+
function pluginsInstalled(count) {
|
|
1674
|
+
return `Installed ${plural(count, "skill plugin")}`;
|
|
1675
|
+
}
|
|
1676
|
+
function localSkillsCopied(count) {
|
|
1677
|
+
return `Copied ${plural(count, "local skill")}`;
|
|
1678
|
+
}
|
|
1679
|
+
function recompileSummary({ compiled, rewritten: rewritten2, created: created2 }, subject) {
|
|
1680
|
+
const unchanged = compiled.length - rewritten2.length - created2.length;
|
|
1681
|
+
const createdPart = created2.length > 0 ? `, ${created2.length} created` : "";
|
|
1682
|
+
return `${plural(rewritten2.length, subject)} rewritten${createdPart}, ${unchanged} unchanged`;
|
|
1683
|
+
}
|
|
1684
|
+
function agentsNotCompiled(agentNames) {
|
|
1685
|
+
return `${plural(agentNames.length, "sub-agent")} did not compile: ${agentNames.join(", ")}`;
|
|
1686
|
+
}
|
|
1687
|
+
var INCOMPLETE_WORK_RECOVERY = {
|
|
1688
|
+
RECOMPILE: `Run '${CLI_INVOKE_COMMAND} compile' \u2014 the compiled agents on disk are stale until you do.`,
|
|
1689
|
+
INSPECT_INSTALLATION: `Run '${CLI_INVOKE_COMMAND} doctor' to see what this installation is left holding.`,
|
|
1690
|
+
DELETE_AGENT_FILE: "Delete the file by hand \u2014 Claude Code loads a compiled sub-agent this project no longer configures."
|
|
1691
|
+
};
|
|
1692
|
+
function completedWithFailures(failures) {
|
|
1693
|
+
return [
|
|
1694
|
+
`Completed with ${plural(failures.length, "failure")} \u2014 the changes above landed, these did not:`,
|
|
1695
|
+
...failures.flatMap(failureLines)
|
|
1696
|
+
].join("\n");
|
|
1697
|
+
}
|
|
1698
|
+
function failureLines({ what, recovery }) {
|
|
1699
|
+
return [` ${what}`, ` ${recovery}`];
|
|
1700
|
+
}
|
|
1701
|
+
function propagatedRecompileSummary(recompiled, failed) {
|
|
1702
|
+
const failureSuffix = failed > 0 ? ` (${failed} failed)` : "";
|
|
1703
|
+
return `Registered projects: ${recompiled} recompiled${failureSuffix}`;
|
|
1704
|
+
}
|
|
1705
|
+
function skillAssignedToNoAgent(skillId, namedBy) {
|
|
1706
|
+
return `Skill '${skillName(skillId, namedBy)}' is assigned to no sub-agent \u2014 nothing will load it.`;
|
|
1707
|
+
}
|
|
1708
|
+
function scopeBlockedStackAssignment(agentNames, skillId, namedBy) {
|
|
1709
|
+
const subject = agentNames.length === 1 ? "Sub-agent" : "Sub-agents";
|
|
1710
|
+
const named = agentNames.map((name) => `'${name}'`).join(", ");
|
|
1711
|
+
return `${subject} ${named} cannot carry project-scoped skill '${skillName(skillId, namedBy)}' \u2014 global-scoped sub-agents only carry global-scoped skills.`;
|
|
1712
|
+
}
|
|
1713
|
+
function globalScopedAgentsHint(count) {
|
|
1714
|
+
const [subject, object] = count === 1 ? ["agent is", "it"] : ["agents are", "them"];
|
|
1715
|
+
return `${count} ${subject} global-scoped \u2014 run '${CLI_INVOKE_COMMAND} compile' from your home directory to recompile ${object}.`;
|
|
1716
|
+
}
|
|
1717
|
+
function marketplaceRefreshFailed(marketplace, reason) {
|
|
1718
|
+
return `Could not update marketplace ${marketplace}: ${reason}`;
|
|
1719
|
+
}
|
|
1720
|
+
function sourceUnreachableUsingCache(source) {
|
|
1721
|
+
return `Could not reach ${source} \u2014 using the cached copy, which may be out of date.`;
|
|
1722
|
+
}
|
|
1723
|
+
function sourceRefusedUsingCache(source, status) {
|
|
1724
|
+
return `${source} refused the request (${status}) \u2014 using the cached copy, which may be out of date.`;
|
|
1725
|
+
}
|
|
1726
|
+
function marketplacesRefreshFailed(marketplaces) {
|
|
1727
|
+
return `${plural(marketplaces.length, "marketplace")} could not be updated: ${marketplaces.join(", ")}`;
|
|
1728
|
+
}
|
|
1729
|
+
function codexPluginLeftSwitchedOn(pluginKey, configFile, reason) {
|
|
1730
|
+
return `Codex switched plugin ${pluginKey} back on when it was updated, and it could not be switched off again in ${configFile}: ${reason}. To switch it off, set enabled = false in that file, in the table it already has for ${pluginKey}.`;
|
|
1731
|
+
}
|
|
1732
|
+
function pluginNotSwitchedBackOff(pluginKey) {
|
|
1733
|
+
return `Could not switch plugin ${pluginKey} back off after Codex switched it on`;
|
|
1734
|
+
}
|
|
1735
|
+
function switchItOffIn(configFile) {
|
|
1736
|
+
return `Set enabled = false in its existing table in ${configFile}.`;
|
|
1737
|
+
}
|
|
1738
|
+
function pluginsLeftSwitchedOn(pluginKeys) {
|
|
1739
|
+
const are = pluginKeys.length === 1 ? "is" : "are";
|
|
1740
|
+
return `${plural(pluginKeys.length, "plugin")} you had switched off ${are} switched on again: ${pluginKeys.join(", ")}`;
|
|
1741
|
+
}
|
|
1742
|
+
function marketplaceOwnerHasNoName(packageJsonPath) {
|
|
1743
|
+
return [
|
|
1744
|
+
`A marketplace's owner must have a name, and no name could be read from 'author' in ${packageJsonPath}.`,
|
|
1745
|
+
`Nothing was written: a ${MARKETPLACE_JSON} whose 'owner.name' is empty is refused by this CLI's own reader, so the build would have reported success for a marketplace nobody can install from.`,
|
|
1746
|
+
`Set 'author' in that file \u2014 either "Jane Doe <jane@example.com>" or { "name": "Jane Doe" } \u2014 and build again.`
|
|
1747
|
+
].join("\n\n");
|
|
1748
|
+
}
|
|
1749
|
+
function marketplaceHasNoVersion(packageJsonPath) {
|
|
1750
|
+
return [
|
|
1751
|
+
`A marketplace must have a version, and 'version' in ${packageJsonPath} is empty.`,
|
|
1752
|
+
`Nothing was written: a ${MARKETPLACE_JSON} whose 'version' is empty is refused by this CLI's own reader, so the build would have reported success for a marketplace nobody can install from.`,
|
|
1753
|
+
`Set 'version' in that file \u2014 "0.1.0" if this is its first release \u2014 and build again.`
|
|
1754
|
+
].join("\n\n");
|
|
1755
|
+
}
|
|
1756
|
+
function marketplaceNameNotPublishable(name, packageJsonPath) {
|
|
1757
|
+
return [
|
|
1758
|
+
`Marketplace name '${name}', read from 'name' in ${packageJsonPath}, is not a name a marketplace may publish under.`,
|
|
1759
|
+
...offendingCharactersStatement(name),
|
|
1760
|
+
`A marketplace name is kebab-case: lowercase letters, numbers and hyphens, starting with a letter.`,
|
|
1761
|
+
`Publish under a name of your own instead: '${CLI_INVOKE_COMMAND} build marketplace --name <your-marketplace>'.`
|
|
1762
|
+
].join("\n\n");
|
|
1763
|
+
}
|
|
1764
|
+
function offendingCharactersStatement(name) {
|
|
1765
|
+
const offenders = charactersOutsideKebabCase(name);
|
|
1766
|
+
if (offenders.length === 0) return [];
|
|
1767
|
+
const named = offenders.map((character) => `'${character}'`).join(" and ");
|
|
1768
|
+
return [`It carries ${named}, which a marketplace name may not.`];
|
|
1769
|
+
}
|
|
1770
|
+
var MARKETPLACE_MANIFEST = `${PLUGIN_MANIFEST_DIR}/${MARKETPLACE_JSON}`;
|
|
1771
|
+
var MARKETPLACE_MANIFEST_REQUIRED = [
|
|
1772
|
+
`Every marketplace other than the default one must publish a valid ${MARKETPLACE_MANIFEST}.`,
|
|
1773
|
+
`Run '${CLI_INVOKE_COMMAND} build plugins' and then '${CLI_INVOKE_COMMAND} build marketplace' in that marketplace's repository, which write it.`
|
|
1774
|
+
].join(" ");
|
|
1775
|
+
function marketplaceManifestMissing(source) {
|
|
1776
|
+
return [
|
|
1777
|
+
`'${source}' has no ${MARKETPLACE_MANIFEST}, so it is not a marketplace yet.`,
|
|
1778
|
+
MARKETPLACE_MANIFEST_REQUIRED
|
|
1779
|
+
].join("\n\n");
|
|
1780
|
+
}
|
|
1781
|
+
function marketplaceManifestUnreadable(source, reason) {
|
|
1782
|
+
return [
|
|
1783
|
+
`'${source}' has a ${MARKETPLACE_MANIFEST} this CLI cannot read:
|
|
1784
|
+
${reason}`,
|
|
1785
|
+
MARKETPLACE_MANIFEST_REQUIRED
|
|
1786
|
+
].join("\n\n");
|
|
1787
|
+
}
|
|
1788
|
+
function configTypesRefreshFailed(reason) {
|
|
1789
|
+
return `Could not refresh ${STANDARD_FILES.CONFIG_TYPES_TS} \u2014 type unions may be stale: ${reason}`;
|
|
1790
|
+
}
|
|
1791
|
+
function registeredProjectsUpdated(count) {
|
|
1792
|
+
return `Updated ${plural(count, "registered project")}`;
|
|
1793
|
+
}
|
|
1794
|
+
function registeredProjectUpdateSkipped(projectPath) {
|
|
1795
|
+
return `Could not update registered project at ${projectPath} \u2014 its config may still reference the uninstalled global content`;
|
|
1796
|
+
}
|
|
1797
|
+
function registeredProjectConfigUnreadable(projectPath) {
|
|
1798
|
+
return `Skipped ${projectPath}: its config.ts can't be read.`;
|
|
1799
|
+
}
|
|
1800
|
+
function registeredProjectGone(projectPath) {
|
|
1801
|
+
return `Skipped ${projectPath}: nothing is installed there any more.`;
|
|
1802
|
+
}
|
|
1803
|
+
function registeredProjectOnAnotherProvider(projectPath) {
|
|
1804
|
+
return `Skipped ${projectPath}: it is another provider's installation.`;
|
|
1805
|
+
}
|
|
1806
|
+
function registeredProjectUpdateFailed(projectPath) {
|
|
1807
|
+
return `Skipped ${projectPath}: updating it failed.`;
|
|
1808
|
+
}
|
|
1809
|
+
function unregisteredSkillsSkipped(count, folder) {
|
|
1810
|
+
const are = count === 1 ? "isn't" : "aren't";
|
|
1811
|
+
return `Skipped ${plural(count, "skill")} in '${folder}' that ${are} registered with the CLI (no ${STANDARD_FILES.METADATA_YAML}).`;
|
|
1812
|
+
}
|
|
1813
|
+
function skillMetadataUnusableDetail({
|
|
1814
|
+
skillDirName,
|
|
1815
|
+
metadataPath,
|
|
1816
|
+
reason
|
|
1817
|
+
}) {
|
|
1818
|
+
return ` ${skillDirName} \u2014 ${metadataPath}
|
|
1819
|
+
${reason}`;
|
|
1820
|
+
}
|
|
1821
|
+
function metadataUnusableOpening(entries) {
|
|
1822
|
+
const named = entries.map(({ skillDirName }) => `'${skillDirName}'`).join(", ");
|
|
1823
|
+
const subject = entries.length === 1 ? "that skill" : "those skills";
|
|
1824
|
+
return `The ${STANDARD_FILES.METADATA_YAML} of ${named} does not describe ${subject} \u2014 the file and the reason are named above.`;
|
|
1825
|
+
}
|
|
1826
|
+
var METADATA_UNUSABLE_WAY_OUT = `Fix the file, or delete the skill directory \u2014 '${CLI_INVOKE_COMMAND} doctor' reports every skill in this state.`;
|
|
1827
|
+
function skillMetadataUnusableError(entries) {
|
|
1828
|
+
return [
|
|
1829
|
+
metadataUnusableOpening(entries),
|
|
1830
|
+
`A skill this file cannot describe is skipped when ${STANDARD_FILES.CONFIG_TYPES_TS} is regenerated, so compiling it would write agents around a skill the generated types never carry.`,
|
|
1831
|
+
METADATA_UNUSABLE_WAY_OUT
|
|
1832
|
+
].join("\n");
|
|
1833
|
+
}
|
|
1834
|
+
function savedSkillMetadataUnusableError(entries) {
|
|
1835
|
+
return [
|
|
1836
|
+
metadataUnusableOpening(entries),
|
|
1837
|
+
`A config entry naming a skill this file cannot describe is dropped as one this marketplace does not carry \u2014 and a file that can be repaired must not cost an install its record.`,
|
|
1838
|
+
METADATA_UNUSABLE_WAY_OUT
|
|
1839
|
+
].join("\n");
|
|
1840
|
+
}
|
|
1841
|
+
function editorSkillMetadataUnusableError(entries) {
|
|
1842
|
+
return [
|
|
1843
|
+
metadataUnusableOpening(entries),
|
|
1844
|
+
`The editor opens on what these files describe, so no link is made until each one describes its skill.`,
|
|
1845
|
+
METADATA_UNUSABLE_WAY_OUT
|
|
1846
|
+
].join("\n");
|
|
1847
|
+
}
|
|
1848
|
+
var SHARED_CONFIG_GREENFIELD_HINT = "installing a shared configuration is a fresh setup, not a merge";
|
|
1849
|
+
function sharedConfigDestinations(id) {
|
|
1850
|
+
return [` Install it: ${CLI_INVOKE_COMMAND} init --from ${id}`, openItLine(id)];
|
|
1851
|
+
}
|
|
1852
|
+
function appliedBackDestinations(id, provider) {
|
|
1853
|
+
return [
|
|
1854
|
+
` Apply it: ${CLI_INVOKE_COMMAND} edit --from ${id}${providerArgument(provider)}`,
|
|
1855
|
+
openItLine(id)
|
|
1856
|
+
];
|
|
1857
|
+
}
|
|
1858
|
+
function openItLine(id) {
|
|
1859
|
+
return ` Open it: ${editorConfigUrl(id)}`;
|
|
1860
|
+
}
|
|
1861
|
+
function applySharedConfigHere(id, installedHere, provider) {
|
|
1862
|
+
const command = `${CLI_INVOKE_COMMAND} ${installedHere ? "edit" : "init"} --from`;
|
|
1863
|
+
const verb = installedHere ? "apply" : "install";
|
|
1864
|
+
const named = providerArgument(provider);
|
|
1865
|
+
return id === void 0 ? `Then ${verb} what it gives you with '${command} <id>${named}'.` : `To ${verb} it here instead, run '${command} ${id}${named}'.`;
|
|
1866
|
+
}
|
|
1867
|
+
function shareRefusesEjectedSkills(skillIds, namedBy) {
|
|
1868
|
+
return [
|
|
1869
|
+
"This installation holds ejected skills, and ejected skills cannot be shared:",
|
|
1870
|
+
...skillIds.map((id) => ` ${skillName(id, namedBy)}`),
|
|
1871
|
+
"Only plugins can be shared."
|
|
1872
|
+
].join("\n");
|
|
1873
|
+
}
|
|
1874
|
+
function sharedIdNamesAFolder(folder) {
|
|
1875
|
+
return `This id names the marketplace folder ${folder}, so it installs only where that folder exists.`;
|
|
1876
|
+
}
|
|
1877
|
+
function sharedSkillsLeftBehind(skillIds, namedBy) {
|
|
1878
|
+
const [subject, pronoun] = skillIds.length === 1 ? ["this skill comes", "it"] : ["these skills come", "they"];
|
|
1879
|
+
return `A shared id names one marketplace, and ${subject} from another, so ${pronoun} will not install elsewhere: ${skillNames(skillIds, namedBy)}`;
|
|
1880
|
+
}
|
|
1881
|
+
function sharedConfigExistingInstall(configPath, id, provider) {
|
|
1882
|
+
return `An installation already exists at ${configPath}. Run '${CLI_INVOKE_COMMAND} uninstall${providerArgument(provider)}' first \u2014 ${SHARED_CONFIG_GREENFIELD_HINT}. ${applySharedConfigHere(id, true, provider)}`;
|
|
1883
|
+
}
|
|
1884
|
+
function sharedConfigProjectScopeAtHome(skillIds, agentNames, installedHere, provider, namedBy) {
|
|
1885
|
+
return [
|
|
1886
|
+
"This configuration cannot be installed here: the home directory is the global scope, and a global installation holds only global-scoped content \u2014 so these project-scoped entries have nowhere to be written:",
|
|
1887
|
+
...skillIds.map((id) => ` skill ${skillName(id, namedBy)} (scope: project)`),
|
|
1888
|
+
...agentNames.map((name) => ` sub-agent ${name} (scope: project)`),
|
|
1889
|
+
installedHere ? changeTheGlobalInstallFromHome(providerArgument(provider)) : "Run this from inside a project directory, or re-share it with each entry above at global scope."
|
|
1890
|
+
].join("\n");
|
|
1891
|
+
}
|
|
1892
|
+
function changeTheGlobalInstallFromHome(named) {
|
|
1893
|
+
return `Run this from inside a project directory, or change the global install from here: run '${CLI_INVOKE_COMMAND} edit${named}', make the change in the editor, then apply the id it gives you with '${CLI_INVOKE_COMMAND} edit --from <id>${named}'.`;
|
|
1894
|
+
}
|
|
1895
|
+
function unknownKeys(keys) {
|
|
1896
|
+
return keys.map(inertLine).join(", ");
|
|
1897
|
+
}
|
|
1898
|
+
var SKIP_CAUSE = {
|
|
1899
|
+
UNLOADED: "could not load",
|
|
1900
|
+
UNKNOWN: "does not know"
|
|
1901
|
+
};
|
|
1902
|
+
function skippedSkills(skillIds, installedWithout, unloadedSkillIds) {
|
|
1903
|
+
const [unloaded, unknown] = partition(skillIds, (id) => unloadedSkillIds.has(id));
|
|
1904
|
+
return [
|
|
1905
|
+
...skippedFor(SKIP_CAUSE.UNLOADED, unloaded, installedWithout),
|
|
1906
|
+
...skippedFor(SKIP_CAUSE.UNKNOWN, unknown, installedWithout)
|
|
1907
|
+
].join("\n");
|
|
1908
|
+
}
|
|
1909
|
+
function skippedFor(cause, skillIds, installedWithout) {
|
|
1910
|
+
if (skillIds.length === 0) return [];
|
|
1911
|
+
return [
|
|
1912
|
+
`Skipped ${plural(skillIds.length, "skill")} this catalog ${cause}: ${unknownKeys(skillIds)}`,
|
|
1913
|
+
...installedWithout.filter(({ skillId }) => skillIds.includes(skillId)).map(subAgentsInstalledWithout)
|
|
1914
|
+
];
|
|
1915
|
+
}
|
|
1916
|
+
function subAgentsInstalledWithout({ skillId, agentNames }) {
|
|
1917
|
+
const subject = agentNames.length === 1 ? "sub-agent" : "sub-agents";
|
|
1918
|
+
return ` ${subject} installed without ${unknownKeys([skillId])}, carrying nothing else this catalog knows: ${agentNames.join(", ")}`;
|
|
1919
|
+
}
|
|
1920
|
+
function skippedUnknownAgents(agentNames) {
|
|
1921
|
+
return `Skipped ${plural(agentNames.length, "unknown sub-agent")}: ${unknownKeys(agentNames)}`;
|
|
1922
|
+
}
|
|
1923
|
+
function carriedSkillsWritten(skillIds, namedBy) {
|
|
1924
|
+
return `Wrote ${plural(skillIds.length, "skill")} this configuration carries: ${skillNames(skillIds, namedBy)}`;
|
|
1925
|
+
}
|
|
1926
|
+
function copiedSkillsRemovedAfterRefusedSave(count) {
|
|
1927
|
+
return `Removed the ${plural(count, "skill")} it copied, since the configuration could not be saved`;
|
|
1928
|
+
}
|
|
1929
|
+
function carriedSkillsRemovedAfterRefusedSave(count) {
|
|
1930
|
+
return `Removed the ${plural(count, "skill")} this configuration carried, since the configuration could not be saved`;
|
|
1931
|
+
}
|
|
1932
|
+
function marketplaceRemovedAfterRefusedSave(marketplace) {
|
|
1933
|
+
return `Removed the marketplace "${marketplace}" it registered, since the configuration could not be saved`;
|
|
1934
|
+
}
|
|
1935
|
+
function pluginKeptAfterRefusedSave(pluginRef) {
|
|
1936
|
+
return `Kept the plugin "${pluginRef}" it installed, since it could not tell whether the plugin was there before this run`;
|
|
1937
|
+
}
|
|
1938
|
+
var SHARED_CONFIG_APPLY = {
|
|
1939
|
+
CONFIRM: "Apply this configuration?"
|
|
1940
|
+
};
|
|
1941
|
+
function idNamesAnotherMarketplace(named, used) {
|
|
1942
|
+
return `This id names the marketplace ${inertLine(named)}; its skills come from this installation's marketplace, ${used}.`;
|
|
1943
|
+
}
|
|
1944
|
+
function registeredProjectsRecompiled(projectPaths) {
|
|
1945
|
+
return [
|
|
1946
|
+
"Each project registered with this global install is recompiled to match:",
|
|
1947
|
+
...projectPaths.map((projectPath) => ` ${projectPath}`)
|
|
1948
|
+
].join("\n");
|
|
1949
|
+
}
|
|
1950
|
+
function sharedConfigNeedsTerminal(id, editProvider, initProvider) {
|
|
1951
|
+
return [
|
|
1952
|
+
`Applying configuration '${id}' removes whatever it leaves out, so it has to be confirmed \u2014 and there is no terminal here to confirm it at.`,
|
|
1953
|
+
`Run '${CLI_INVOKE_COMMAND} edit --from ${id}${providerArgument(editProvider)}' from a terminal, or '${CLI_INVOKE_COMMAND} init --from ${id}${providerArgument(initProvider)}' in a clean directory, which installs without removing anything.`
|
|
1954
|
+
].join("\n");
|
|
1955
|
+
}
|
|
1956
|
+
function nothingInstalledToApplyTo(id, provider) {
|
|
1957
|
+
return `No installation found. Run '${CLI_INVOKE_COMMAND} init --from ${id}${providerArgument(provider)}' to install configuration '${id}' here.`;
|
|
1958
|
+
}
|
|
1959
|
+
function uninstallNeedsTerminal(provider) {
|
|
1960
|
+
const named = providerArgument(provider);
|
|
1961
|
+
return [
|
|
1962
|
+
"Uninstalling removes files, so it has to be confirmed \u2014 and there is no terminal here to confirm it at.",
|
|
1963
|
+
`Run '${CLI_INVOKE_COMMAND} uninstall${named}' from a terminal, or '${CLI_INVOKE_COMMAND} uninstall --yes${named}' to remove it without being asked.`
|
|
1964
|
+
].join("\n");
|
|
1965
|
+
}
|
|
1966
|
+
function addMarketplaceInTheEditor(ref, isFolder) {
|
|
1967
|
+
return isFolder ? `${ref} is a folder on this machine, which the editor cannot read \u2014 push it to GitHub, then add it from the editor's Marketplace button.` : `Add ${ref} from the editor's Marketplace button.`;
|
|
1968
|
+
}
|
|
1969
|
+
var SHARED_CONFIG_ARRIVALS = {
|
|
1970
|
+
INSTALL_CONFIRM: "Install this configuration?"
|
|
1971
|
+
};
|
|
1972
|
+
function skillName(id, namedBy) {
|
|
1973
|
+
return getSkillEntryDisplayName(namedBy[id] ?? { id });
|
|
1974
|
+
}
|
|
1975
|
+
function skillNames(skillIds, namedBy) {
|
|
1976
|
+
return skillIds.map((id) => skillName(id, namedBy)).join(", ");
|
|
1977
|
+
}
|
|
1978
|
+
function keptAsInstalledGlobally(skillIds, agentNames, idAppliedAtHome, provider, namedBy) {
|
|
1979
|
+
return [
|
|
1980
|
+
"Kept as installed in the global install \u2014 this configuration states them differently or leaves them out, and a project run only adds to the global install:",
|
|
1981
|
+
...skillIds.map((id) => ` skill ${skillName(id, namedBy)}`),
|
|
1982
|
+
...agentNames.map((name) => ` sub-agent ${name}`),
|
|
1983
|
+
...idAppliedAtHome === void 0 ? [] : [
|
|
1984
|
+
`Change them with '${CLI_INVOKE_COMMAND} edit --from ${idAppliedAtHome}${providerArgument(provider)}' from your home directory.`
|
|
1985
|
+
]
|
|
1986
|
+
].join("\n");
|
|
1987
|
+
}
|
|
1988
|
+
function skillsMoved(verb, skillIds, namedBy) {
|
|
1989
|
+
const names = skillIds.map((id) => skillName(id, namedBy));
|
|
1990
|
+
return names.length === 0 ? [] : [`${verb} ${inAnEnglishList(names)}`];
|
|
1991
|
+
}
|
|
1992
|
+
function settingMoved({ setting, from, to }) {
|
|
1993
|
+
return `${setting} ${from ?? "default"} \u2192 ${to ?? "default"}`;
|
|
1994
|
+
}
|
|
1995
|
+
var SKILLS_REASSIGNED = "skills reassigned";
|
|
1996
|
+
function subAgentChanged({
|
|
1997
|
+
name,
|
|
1998
|
+
scope,
|
|
1999
|
+
gains,
|
|
2000
|
+
loses,
|
|
2001
|
+
settings,
|
|
2002
|
+
namedBy = {}
|
|
2003
|
+
}) {
|
|
2004
|
+
const details = [
|
|
2005
|
+
...skillsMoved("gains", gains, namedBy),
|
|
2006
|
+
...skillsMoved("loses", loses, namedBy),
|
|
2007
|
+
...settings.map(settingMoved)
|
|
2008
|
+
];
|
|
2009
|
+
const where = scope === "global" ? " (global)" : "";
|
|
2010
|
+
return `~ ${name}${where}: ${details.length > 0 ? details.join(", ") : SKILLS_REASSIGNED}`;
|
|
2011
|
+
}
|
|
2012
|
+
function addedToGlobalSubAgents(joined, namedBy) {
|
|
2013
|
+
return [
|
|
2014
|
+
"Added to sub-agents in the global install \u2014 each keeps everything it already has, since a project run only adds to the global install:",
|
|
2015
|
+
...joined.map(
|
|
2016
|
+
({ agentName, skillIds }) => ` sub-agent ${agentName}: + ${skillNames(skillIds, namedBy)}`
|
|
2017
|
+
)
|
|
2018
|
+
].join("\n");
|
|
2019
|
+
}
|
|
2020
|
+
function authoredHereKept(skillIds, namedBy) {
|
|
2021
|
+
return [
|
|
2022
|
+
"Kept \u2014 written here rather than installed, so a shared configuration never carried them:",
|
|
2023
|
+
...skillIds.map((id) => ` skill ${skillName(id, namedBy)}`)
|
|
2024
|
+
].join("\n");
|
|
2025
|
+
}
|
|
2026
|
+
function unplaceableKept(skillIds, namedBy) {
|
|
2027
|
+
return [
|
|
2028
|
+
"Kept \u2014 named by this configuration, and this catalogue cannot place them:",
|
|
2029
|
+
...skillIds.map((id) => ` skill ${skillName(id, namedBy)}`),
|
|
2030
|
+
`Run '${CLI_INVOKE_COMMAND} update' to refresh this installation's marketplace, then apply the configuration again.`
|
|
2031
|
+
].join("\n");
|
|
2032
|
+
}
|
|
2033
|
+
function keptUnassigned({ skillId, agentName, category }, namedBy) {
|
|
2034
|
+
return `${skillName(skillId, namedBy)}: kept, no longer assigned to ${agentName}'s ${category}`;
|
|
2020
2035
|
}
|
|
2021
|
-
function
|
|
2022
|
-
return
|
|
2036
|
+
function doctorReportsTheSame(count) {
|
|
2037
|
+
return `'${CLI_INVOKE_COMMAND} doctor' reports the same ${count === 1 ? "file" : "files"}, alongside whatever else is wrong here.`;
|
|
2023
2038
|
}
|
|
2024
|
-
function
|
|
2025
|
-
return
|
|
2039
|
+
function installationConfigsUnreadable(failures) {
|
|
2040
|
+
return [...failures.flatMap(whoseConfigAndItsWayOut), doctorReportsTheSame(failures.length)].join(
|
|
2041
|
+
"\n"
|
|
2042
|
+
);
|
|
2026
2043
|
}
|
|
2027
|
-
function
|
|
2028
|
-
|
|
2029
|
-
|
|
2044
|
+
function whoseConfigAndItsWayOut(failure) {
|
|
2045
|
+
return [
|
|
2046
|
+
`${scopeLabel(failure.scope)}'s config at '${failure.configPath}' could not be loaded: ${failure.reason}`,
|
|
2047
|
+
`There is no automatic repair for this \u2014 fix the file, or recreate the configuration by running ${recreateConfigFrom(failure)}.`
|
|
2048
|
+
];
|
|
2049
|
+
}
|
|
2050
|
+
function uninstallConfigUnreadable(failure) {
|
|
2051
|
+
return `Could not read the ${failure.scope} config \u2014 plugins and compiled agents it lists may be left behind: ${failure.message}`;
|
|
2052
|
+
}
|
|
2053
|
+
function uninstallSkillMetadataUnreadable(metadataPath) {
|
|
2054
|
+
return `Cannot read ${metadataPath}, so uninstall cannot tell whether it made that skill. Fix the file's permissions, or move the skill out, and run uninstall again.`;
|
|
2055
|
+
}
|
|
2056
|
+
function recreateConfigFrom({
|
|
2057
|
+
scopeRoot,
|
|
2058
|
+
providerToName,
|
|
2059
|
+
initProviderToName
|
|
2060
|
+
}) {
|
|
2061
|
+
return `'${CLI_INVOKE_COMMAND} uninstall${providerArgument(providerToName)}' from '${scopeRoot}', which still works on a config it cannot read, then '${CLI_INVOKE_COMMAND} init --from <id>${providerArgument(initProviderToName)}' with an id from ${EDITOR_URL}`;
|
|
2062
|
+
}
|
|
2063
|
+
function providerArgument(provider) {
|
|
2064
|
+
if (provider === void 0) return "";
|
|
2065
|
+
return ` --provider ${typeof provider === "string" ? provider : `<${provider.join("|")}>`}`;
|
|
2066
|
+
}
|
|
2067
|
+
function configUnreadableError(configLoadFailure3) {
|
|
2068
|
+
return [
|
|
2069
|
+
configLoadFailure3,
|
|
2070
|
+
"This is the marketplace's own config rather than an installation's, so it is fixed in the marketplace repository it comes from."
|
|
2071
|
+
].join("\n");
|
|
2072
|
+
}
|
|
2073
|
+
function registeredProjectsUpdateFailed(reason) {
|
|
2074
|
+
return `Could not update registered projects \u2014 their configs may still reference the uninstalled global content: ${reason}`;
|
|
2075
|
+
}
|
|
2076
|
+
function unmarkedAgentsKept(agentsDir2, count) {
|
|
2077
|
+
const object = count === 1 ? "it" : "them";
|
|
2078
|
+
return `Kept ${plural(count, "agent")} in ${agentsDir2}/ \u2014 no ${DEFAULT_PLUGIN_NAME} marker, so this CLI did not compile ${object}.`;
|
|
2079
|
+
}
|
|
2080
|
+
function configFileRemoved(filePath) {
|
|
2081
|
+
return `- ${filePath}`;
|
|
2082
|
+
}
|
|
2083
|
+
function scopeNoun(kind) {
|
|
2084
|
+
return kind === "project" ? "this project" : "the global installation";
|
|
2085
|
+
}
|
|
2086
|
+
function scopeLabel(kind) {
|
|
2087
|
+
return sentenceCase(scopeNoun(kind));
|
|
2088
|
+
}
|
|
2089
|
+
function sentenceCase(text) {
|
|
2090
|
+
return `${text.slice(0, 1).toUpperCase()}${text.slice(1)}`;
|
|
2091
|
+
}
|
|
2092
|
+
function layoutIsCurrent(label, to) {
|
|
2093
|
+
return `${label} is on ${to}/`;
|
|
2094
|
+
}
|
|
2095
|
+
function retiredSourceFolderIgnored(root, provider) {
|
|
2096
|
+
const named = isHomeDirectory(root) ? "~" : root;
|
|
2097
|
+
return `${path4.join(named, RETIRED_SOURCE_FOLDER)}/ is ignored; agents-inc reads ${path4.join(named, sourceDirName(provider))}/. Delete the old folder once you have kept anything you need from it.`;
|
|
2030
2098
|
}
|
|
2031
2099
|
|
|
2032
2100
|
// src/cli/lib/configuration/config.ts
|
|
2033
2101
|
import { BlockList, isIPv4 } from "net";
|
|
2034
2102
|
import os4 from "os";
|
|
2035
|
-
import
|
|
2103
|
+
import path7 from "path";
|
|
2036
2104
|
import { z as z3 } from "zod";
|
|
2037
2105
|
|
|
2106
|
+
// src/cli/utils/json.ts
|
|
2107
|
+
function parseJsonOrUndefined(text) {
|
|
2108
|
+
try {
|
|
2109
|
+
return JSON.parse(text);
|
|
2110
|
+
} catch {
|
|
2111
|
+
return void 0;
|
|
2112
|
+
}
|
|
2113
|
+
}
|
|
2114
|
+
|
|
2038
2115
|
// src/cli/lib/schemas.ts
|
|
2039
2116
|
import { z as z2 } from "zod";
|
|
2040
2117
|
import { partition as partition2 } from "remeda";
|
|
@@ -2045,8 +2122,8 @@ function formatZodIssue(issue) {
|
|
|
2045
2122
|
if (issue.code === "unrecognized_keys") {
|
|
2046
2123
|
return `Unrecognized key: "${inertLine(issue.keys.join('", "'))}"`;
|
|
2047
2124
|
}
|
|
2048
|
-
const
|
|
2049
|
-
return
|
|
2125
|
+
const path31 = inertLine(issue.path.join("."));
|
|
2126
|
+
return path31 ? `${path31}: ${inertLine(issue.message)}` : inertLine(issue.message);
|
|
2050
2127
|
}
|
|
2051
2128
|
function formatZodErrors(error) {
|
|
2052
2129
|
return error.issues.map(formatZodIssue);
|
|
@@ -2188,12 +2265,12 @@ var RENAMED_SKILL_ENTRY_FIELDS = { source: "origin" };
|
|
|
2188
2265
|
function renamedFieldMessage(oldKey, newKey) {
|
|
2189
2266
|
return `"${oldKey}" was renamed to "${newKey}". Rename the key in this config \u2014 the CLI does not read "${oldKey}" any more and will not fall back to it.`;
|
|
2190
2267
|
}
|
|
2191
|
-
function reportRenamedKeys(record, renames,
|
|
2268
|
+
function reportRenamedKeys(record, renames, path31, ctx) {
|
|
2192
2269
|
for (const [oldKey, newKey] of Object.entries(renames)) {
|
|
2193
2270
|
if (!(oldKey in record)) continue;
|
|
2194
2271
|
ctx.addIssue({
|
|
2195
2272
|
code: "custom",
|
|
2196
|
-
path: [...
|
|
2273
|
+
path: [...path31, oldKey],
|
|
2197
2274
|
message: renamedFieldMessage(oldKey, newKey)
|
|
2198
2275
|
});
|
|
2199
2276
|
}
|
|
@@ -2584,11 +2661,11 @@ function warnUnknownFields(parsed, expectedKeys, context) {
|
|
|
2584
2661
|
}
|
|
2585
2662
|
|
|
2586
2663
|
// src/cli/lib/configuration/config-loader.ts
|
|
2587
|
-
import
|
|
2664
|
+
import path5 from "path";
|
|
2588
2665
|
import { fileURLToPath } from "url";
|
|
2589
2666
|
import { createJiti } from "jiti";
|
|
2590
|
-
var CONFIG_EXPORTS_PATH =
|
|
2591
|
-
|
|
2667
|
+
var CONFIG_EXPORTS_PATH = path5.resolve(
|
|
2668
|
+
path5.dirname(fileURLToPath(import.meta.url)),
|
|
2592
2669
|
"../../config-exports.ts"
|
|
2593
2670
|
);
|
|
2594
2671
|
var ConfigSchemaError = class extends Error {
|
|
@@ -2667,9 +2744,9 @@ async function importConfigModule(configPath) {
|
|
|
2667
2744
|
}
|
|
2668
2745
|
|
|
2669
2746
|
// src/cli/lib/installation/install-base-dir.ts
|
|
2670
|
-
import
|
|
2747
|
+
import path6 from "path";
|
|
2671
2748
|
function getProjectConfigPath(dir, provider) {
|
|
2672
|
-
return
|
|
2749
|
+
return path6.join(sourceFolderInUse(dir, provider).dir, STANDARD_FILES.CONFIG_TS);
|
|
2673
2750
|
}
|
|
2674
2751
|
function getInstalledConfigPath(dir) {
|
|
2675
2752
|
return getProjectConfigPath(dir, providerInUse(dir));
|
|
@@ -2757,7 +2834,7 @@ function describesItsOwnFault(error) {
|
|
|
2757
2834
|
}
|
|
2758
2835
|
var unreadableSourceRepoConfig = (reason, cause) => new Error(configUnreadableError(reason), { cause });
|
|
2759
2836
|
async function readSourceRepoConfig(basePath) {
|
|
2760
|
-
const configPath =
|
|
2837
|
+
const configPath = path7.join(basePath, SOURCE_ROOT_DIR, STANDARD_FILES.CONFIG_TS);
|
|
2761
2838
|
if (!await fileExists(configPath)) {
|
|
2762
2839
|
verbose(`Source config not found at ${configPath}`);
|
|
2763
2840
|
return { kind: "absent" };
|
|
@@ -2774,7 +2851,7 @@ async function loadSourceRepoConfig(basePath) {
|
|
|
2774
2851
|
return read.kind === "declared" ? read.config : null;
|
|
2775
2852
|
}
|
|
2776
2853
|
async function loadProjectSourceConfig(projectDir) {
|
|
2777
|
-
return loadSourceConfig(projectDir,
|
|
2854
|
+
return loadSourceConfig(projectDir, scopeAt(projectDir));
|
|
2778
2855
|
}
|
|
2779
2856
|
async function loadGlobalSourceConfig(provider) {
|
|
2780
2857
|
return loadSourceConfig(os4.homedir(), "global", provider);
|
|
@@ -3202,17 +3279,11 @@ function isDefaultSource(source) {
|
|
|
3202
3279
|
}
|
|
3203
3280
|
var packageIdentitySchema = z3.object({ name: z3.string() });
|
|
3204
3281
|
async function isPublicCatalogueCheckout(basePath) {
|
|
3205
|
-
const raw = await readFileOptional(
|
|
3282
|
+
const raw = await readFileOptional(path7.join(basePath, STANDARD_FILES.PACKAGE_JSON));
|
|
3206
3283
|
return declaredPackageName(raw) === PUBLIC_CATALOGUE_PACKAGE;
|
|
3207
3284
|
}
|
|
3208
3285
|
function declaredPackageName(raw) {
|
|
3209
|
-
|
|
3210
|
-
try {
|
|
3211
|
-
json = JSON.parse(raw);
|
|
3212
|
-
} catch {
|
|
3213
|
-
return null;
|
|
3214
|
-
}
|
|
3215
|
-
const parsed = packageIdentitySchema.safeParse(json);
|
|
3286
|
+
const parsed = packageIdentitySchema.safeParse(parseJsonOrUndefined(raw));
|
|
3216
3287
|
return parsed.success ? parsed.data.name : null;
|
|
3217
3288
|
}
|
|
3218
3289
|
async function offersBuiltInStacks(basePath, source) {
|
|
@@ -3811,17 +3882,6 @@ export default {
|
|
|
3811
3882
|
`;
|
|
3812
3883
|
}
|
|
3813
3884
|
|
|
3814
|
-
// ../compile/src/typed-object.ts
|
|
3815
|
-
function typedEntries2(obj) {
|
|
3816
|
-
return Object.entries(obj);
|
|
3817
|
-
}
|
|
3818
|
-
function typedKeys2(obj) {
|
|
3819
|
-
return Object.keys(obj);
|
|
3820
|
-
}
|
|
3821
|
-
function typedFromEntries2(entries) {
|
|
3822
|
-
return Object.fromEntries(entries);
|
|
3823
|
-
}
|
|
3824
|
-
|
|
3825
3885
|
// ../compile/src/seed-to-config.ts
|
|
3826
3886
|
var MATRIX_SAMPLE_SIZE = 5;
|
|
3827
3887
|
var SCOPE_CONFIG_NAMES = {
|
|
@@ -3837,7 +3897,7 @@ function generateProjectConfigFromSkills(name, selectedSkillIds, options) {
|
|
|
3837
3897
|
const skillConfigs = options?.skillConfigs ?? [];
|
|
3838
3898
|
const agentConfigs = options?.agentConfigs ?? [];
|
|
3839
3899
|
diagnostics().verbose(
|
|
3840
|
-
`generateProjectConfigFromSkills: ${selectedSkillIds.length}
|
|
3900
|
+
`generateProjectConfigFromSkills: ${plural2(selectedSkillIds.length, "skill")}, matrix has ${typedKeys(catalog.skills).length} entries, agents=[${agentList.join(", ")}]`
|
|
3841
3901
|
);
|
|
3842
3902
|
const { validSkills, foundCount, absentSkillIds } = resolveValidSkills(
|
|
3843
3903
|
selectedSkillIds,
|
|
@@ -3846,7 +3906,7 @@ function generateProjectConfigFromSkills(name, selectedSkillIds, options) {
|
|
|
3846
3906
|
);
|
|
3847
3907
|
reportAbsentSkills(absentSkillIds, catalog);
|
|
3848
3908
|
diagnostics().verbose(
|
|
3849
|
-
`generateProjectConfigFromSkills: ${foundCount} found, ${absentSkillIds.length} not found, ${agentList.length}
|
|
3909
|
+
`generateProjectConfigFromSkills: ${foundCount} found, ${absentSkillIds.length} not found, ${plural2(agentList.length, "agent")} in stack`
|
|
3850
3910
|
);
|
|
3851
3911
|
const stack = buildStackForSelection({
|
|
3852
3912
|
agentList,
|
|
@@ -3908,9 +3968,6 @@ function resolveValidSkills(selectedSkillIds, skillConfigs, catalog) {
|
|
|
3908
3968
|
absentSkillIds: absent.map((entry) => entry.skillId)
|
|
3909
3969
|
};
|
|
3910
3970
|
}
|
|
3911
|
-
function isInCatalog(entry) {
|
|
3912
|
-
return entry.skill != null;
|
|
3913
|
-
}
|
|
3914
3971
|
function hasCategory(entry) {
|
|
3915
3972
|
return entry.category != null;
|
|
3916
3973
|
}
|
|
@@ -3923,21 +3980,17 @@ function reportAbsentSkills(absentSkillIds, catalog) {
|
|
|
3923
3980
|
for (const skillId of absentSkillIds) {
|
|
3924
3981
|
diagnostics().warn(absentSkillWarning(skillId));
|
|
3925
3982
|
}
|
|
3926
|
-
const matrixSample =
|
|
3983
|
+
const matrixSample = typedKeys(catalog.skills).slice(0, MATRIX_SAMPLE_SIZE).join(", ");
|
|
3927
3984
|
diagnostics().verbose(
|
|
3928
|
-
`${absentSkillIds.length}
|
|
3985
|
+
`${plural2(absentSkillIds.length, "skill")} absent from the matrix. Matrix keys sample: [${matrixSample}]`
|
|
3929
3986
|
);
|
|
3930
3987
|
}
|
|
3988
|
+
function plural2(count, noun) {
|
|
3989
|
+
return `${count} ${noun}${count === 1 ? "" : "s"}`;
|
|
3990
|
+
}
|
|
3931
3991
|
function absentSkillWarning(skillId) {
|
|
3932
3992
|
return `Skill '${skillId}' is not in this marketplace \u2014 it stays in the configuration and no sub-agent is given it. Run '${CLI_INVOKE_COMMAND} update' to refresh the marketplace, or remove it with '${CLI_INVOKE_COMMAND} edit'.`;
|
|
3933
3993
|
}
|
|
3934
|
-
function skillIdsByCategory(skills) {
|
|
3935
|
-
return new Map(
|
|
3936
|
-
typedEntries2(groupBy(skills, (entry) => entry.category)).map(
|
|
3937
|
-
([category, entries]) => [category, entries.map((entry) => entry.skillId)]
|
|
3938
|
-
)
|
|
3939
|
-
);
|
|
3940
|
-
}
|
|
3941
3994
|
function buildSkillScopeMap(skillConfigs) {
|
|
3942
3995
|
const [excludedConfigs, activeConfigs] = partition3(
|
|
3943
3996
|
skillConfigs,
|
|
@@ -3954,19 +4007,19 @@ function buildStackForSelection(inputs) {
|
|
|
3954
4007
|
);
|
|
3955
4008
|
return void 0;
|
|
3956
4009
|
}
|
|
3957
|
-
return
|
|
4010
|
+
return typedFromEntries(
|
|
3958
4011
|
inputs.agentList.map((agent) => [agent, buildAgentStack(agent, inputs)]).filter(([, agentStack]) => hasCategories(agentStack))
|
|
3959
4012
|
);
|
|
3960
4013
|
}
|
|
3961
4014
|
function buildAgentStack(agent, inputs) {
|
|
3962
|
-
return
|
|
4015
|
+
return typedFromEntries(
|
|
3963
4016
|
inCanonicalCategoryOrder(inputs.activeSkillsByCategory, inputs.catalog).map(
|
|
3964
4017
|
([category, skillIds]) => [category, assignmentsFor(agent, category, skillIds, inputs)]
|
|
3965
4018
|
).filter(([, assignments]) => assignments.length > 0)
|
|
3966
4019
|
);
|
|
3967
4020
|
}
|
|
3968
4021
|
function hasCategories(agentStack) {
|
|
3969
|
-
return
|
|
4022
|
+
return typedKeys(agentStack).length > 0;
|
|
3970
4023
|
}
|
|
3971
4024
|
function inCanonicalCategoryOrder(activeSkillsByCategory, catalog) {
|
|
3972
4025
|
const byDeclaration = byCategoryDeclarationOrder(catalog);
|
|
@@ -4022,12 +4075,9 @@ function isInPriorStack(existingStack, agent, category, skillId) {
|
|
|
4022
4075
|
return priorLoadState(existingStack, agent, category, skillId) !== void 0;
|
|
4023
4076
|
}
|
|
4024
4077
|
function mappedLoadState(skillId, agent) {
|
|
4025
|
-
if (!isSkillId2(skillId) || !
|
|
4078
|
+
if (!isSkillId2(skillId) || !isAgentName(agent)) return "lazy";
|
|
4026
4079
|
return resolveLoadState({ skillId, agentId: agent });
|
|
4027
4080
|
}
|
|
4028
|
-
function isAgentName2(value) {
|
|
4029
|
-
return AGENT_NAMES.includes(value);
|
|
4030
|
-
}
|
|
4031
4081
|
function isSkillId2(value) {
|
|
4032
4082
|
return SKILL_IDS.includes(value);
|
|
4033
4083
|
}
|
|
@@ -4057,8 +4107,8 @@ function asProjectCopies(skillIds) {
|
|
|
4057
4107
|
}));
|
|
4058
4108
|
}
|
|
4059
4109
|
function buildStackProperty(stack) {
|
|
4060
|
-
return
|
|
4061
|
-
|
|
4110
|
+
return typedFromEntries(
|
|
4111
|
+
typedEntries(stack.agents).filter(([, agentConfig]) => agentConfig && hasCategories(agentConfig)).map(
|
|
4062
4112
|
([agent, agentConfig]) => [agent, withResolvedLoads(agent, agentConfig)]
|
|
4063
4113
|
).filter(([, agentStack]) => hasCategories(agentStack))
|
|
4064
4114
|
);
|
|
@@ -4077,8 +4127,8 @@ function toStackPropertyAssignment(assignment, agent) {
|
|
|
4077
4127
|
return { ...assignment, preloaded: true };
|
|
4078
4128
|
}
|
|
4079
4129
|
function mapCategoriesDroppingEmpty(agentStack, transform) {
|
|
4080
|
-
return
|
|
4081
|
-
|
|
4130
|
+
return typedFromEntries(
|
|
4131
|
+
typedEntries(agentStack).filter(([, assignments]) => assignments !== void 0).map(
|
|
4082
4132
|
([category, assignments]) => [category, transform(assignments)]
|
|
4083
4133
|
).filter(([, transformed]) => transformed.length > 0)
|
|
4084
4134
|
);
|
|
@@ -4120,8 +4170,8 @@ function splitStackByScope(stack, globalAgents, projectAgents, globalSkillIds) {
|
|
|
4120
4170
|
);
|
|
4121
4171
|
const nonEmptyHalves = (scope) => globalAgentSplits.map(([agent, split]) => [agent, split[scope]]).filter(([, half]) => hasCategories(half));
|
|
4122
4172
|
return {
|
|
4123
|
-
global:
|
|
4124
|
-
project:
|
|
4173
|
+
global: typedFromEntries(nonEmptyHalves("global")),
|
|
4174
|
+
project: typedFromEntries([
|
|
4125
4175
|
...nonEmptyHalves("project"),
|
|
4126
4176
|
...stackEntriesOf(stack, projectAgents)
|
|
4127
4177
|
])
|
|
@@ -4217,7 +4267,7 @@ function skippedAgentNamesOf(agentMap, rows) {
|
|
|
4217
4267
|
return [.../* @__PURE__ */ new Set([...agentMap.unknown, ...unknownAssignees])];
|
|
4218
4268
|
}
|
|
4219
4269
|
function agentsNamedBy(seedSkill, agentMap) {
|
|
4220
|
-
return Object.keys(seedSkill.assignments).filter(
|
|
4270
|
+
return Object.keys(seedSkill.assignments).filter(isAgentName).filter((name) => !agentMap.switchedOff.has(name));
|
|
4221
4271
|
}
|
|
4222
4272
|
function agentsOnlyItCarried(skill, agentMap, carried) {
|
|
4223
4273
|
const agentNames = agentsNamedBy(skill.seedSkill, agentMap).filter(
|
|
@@ -4230,7 +4280,7 @@ function readAgentMap(agents) {
|
|
|
4230
4280
|
const switchedOff2 = /* @__PURE__ */ new Set();
|
|
4231
4281
|
const unknown = [];
|
|
4232
4282
|
for (const [name, entry] of Object.entries(agents)) {
|
|
4233
|
-
if (!
|
|
4283
|
+
if (!isAgentName(name)) unknown.push(name);
|
|
4234
4284
|
else if (entry.on === false) switchedOff2.add(name);
|
|
4235
4285
|
else known.set(name, entry);
|
|
4236
4286
|
}
|
|
@@ -4283,7 +4333,7 @@ function assignmentRows(skill, agentMap) {
|
|
|
4283
4333
|
}
|
|
4284
4334
|
function assignmentRow(skill, agentName, load, agentMap) {
|
|
4285
4335
|
if (agentMap.switchedOff.has(agentName)) return void 0;
|
|
4286
|
-
if (!
|
|
4336
|
+
if (!isAgentName(agentName)) return { kind: "unknownAgent", agentName };
|
|
4287
4337
|
return {
|
|
4288
4338
|
kind: "placed",
|
|
4289
4339
|
agent: agentName,
|
|
@@ -4338,22 +4388,23 @@ import { indexBy as indexBy2, omit as omit3, pick, uniqueBy as uniqueBy2 } from
|
|
|
4338
4388
|
|
|
4339
4389
|
// src/cli/lib/configuration/project-config.ts
|
|
4340
4390
|
import os5 from "os";
|
|
4341
|
-
import
|
|
4391
|
+
import path9 from "path";
|
|
4342
4392
|
|
|
4343
4393
|
// src/cli/lib/stacks/stacks-loader.ts
|
|
4344
|
-
import
|
|
4394
|
+
import path8 from "path";
|
|
4345
4395
|
import { flatMap, groupBy as groupBy2, mapValues as mapValues2, partition as partition4, pipe, unique as unique2, uniqueBy } from "remeda";
|
|
4346
4396
|
var stacksCache = /* @__PURE__ */ new Map();
|
|
4347
4397
|
function normalizeAgentConfig(agentConfig) {
|
|
4348
|
-
return mapValues2(
|
|
4349
|
-
|
|
4350
|
-
|
|
4351
|
-
|
|
4352
|
-
|
|
4353
|
-
|
|
4354
|
-
|
|
4355
|
-
|
|
4356
|
-
});
|
|
4398
|
+
return mapValues2(
|
|
4399
|
+
agentConfig,
|
|
4400
|
+
(value) => (Array.isArray(value) ? value : [value]).map(toSkillAssignment2)
|
|
4401
|
+
);
|
|
4402
|
+
}
|
|
4403
|
+
function toSkillAssignment2(item) {
|
|
4404
|
+
if (typeof item === "string") return { id: item, preloaded: false };
|
|
4405
|
+
if (isSkillAssignment(item)) return item;
|
|
4406
|
+
warn(`Malformed skill assignment in stack data: ${JSON.stringify(item)}`);
|
|
4407
|
+
return item;
|
|
4357
4408
|
}
|
|
4358
4409
|
function liveCategoryOf(skillId) {
|
|
4359
4410
|
const category = matrix.skills[skillId]?.category;
|
|
@@ -4407,7 +4458,7 @@ async function loadStacks(configDir, stacksFile) {
|
|
|
4407
4458
|
const cacheKey = `${configDir}:${resolvedStacksFile}`;
|
|
4408
4459
|
const cached = stacksCache.get(cacheKey);
|
|
4409
4460
|
if (cached) return cached;
|
|
4410
|
-
const stacksPath =
|
|
4461
|
+
const stacksPath = path8.join(configDir, resolvedStacksFile);
|
|
4411
4462
|
try {
|
|
4412
4463
|
const raw = await loadConfig(stacksPath, stacksConfigSchema);
|
|
4413
4464
|
if (raw == null) {
|
|
@@ -4422,7 +4473,7 @@ async function loadStacks(configDir, stacksFile) {
|
|
|
4422
4473
|
)
|
|
4423
4474
|
}));
|
|
4424
4475
|
stacksCache.set(cacheKey, stacks);
|
|
4425
|
-
verbose(`Loaded ${stacks.length}
|
|
4476
|
+
verbose(`Loaded ${plural(stacks.length, "stack")} from ${stacksPath}`);
|
|
4426
4477
|
return stacks;
|
|
4427
4478
|
} catch (error) {
|
|
4428
4479
|
throw new StacksLoadError(stacksPath, getErrorMessage(error), { cause: error });
|
|
@@ -4488,6 +4539,22 @@ function getStackSkillIds(stack) {
|
|
|
4488
4539
|
);
|
|
4489
4540
|
}
|
|
4490
4541
|
|
|
4542
|
+
// src/cli/lib/validation-result.ts
|
|
4543
|
+
function validResult() {
|
|
4544
|
+
return { valid: true, errors: [], warnings: [] };
|
|
4545
|
+
}
|
|
4546
|
+
function invalidResult(message) {
|
|
4547
|
+
return { valid: false, errors: [message], warnings: [] };
|
|
4548
|
+
}
|
|
4549
|
+
function resultFrom(errors, warnings) {
|
|
4550
|
+
return { valid: errors.length === 0, errors, warnings };
|
|
4551
|
+
}
|
|
4552
|
+
function mergeValidationResults(results) {
|
|
4553
|
+
const errors = results.flatMap((r) => r.errors);
|
|
4554
|
+
const warnings = results.flatMap((r) => r.warnings);
|
|
4555
|
+
return { valid: errors.length === 0, errors, warnings };
|
|
4556
|
+
}
|
|
4557
|
+
|
|
4491
4558
|
// src/cli/lib/configuration/project-config.ts
|
|
4492
4559
|
var ConfigLoadError = class extends Error {
|
|
4493
4560
|
constructor(configPath, reason, scopeRoot, provider) {
|
|
@@ -4496,7 +4563,7 @@ var ConfigLoadError = class extends Error {
|
|
|
4496
4563
|
this.reason = reason;
|
|
4497
4564
|
this.scopeRoot = scopeRoot;
|
|
4498
4565
|
this.name = "ConfigLoadError";
|
|
4499
|
-
this.scope =
|
|
4566
|
+
this.scope = scopeAt(scopeRoot);
|
|
4500
4567
|
this.providerToName = providerToNameAt(scopeRoot, provider);
|
|
4501
4568
|
this.initProviderToName = initProviderToNameAt(scopeRoot, provider);
|
|
4502
4569
|
}
|
|
@@ -4518,7 +4585,7 @@ async function loadProjectConfigFromDir(projectDir, provider) {
|
|
|
4518
4585
|
return loadProjectConfigAt(getProjectConfigPath(projectDir, provider), projectDir, provider);
|
|
4519
4586
|
}
|
|
4520
4587
|
async function loadProjectConfigAt(configPath, projectDir, provider) {
|
|
4521
|
-
const scope =
|
|
4588
|
+
const scope = scopeAt(projectDir);
|
|
4522
4589
|
const scopeLabel2 = scope === "project" ? "Project" : "Global";
|
|
4523
4590
|
if (!await fileExists(configPath)) {
|
|
4524
4591
|
verbose(`${scopeLabel2} config not found at ${configPath}`);
|
|
@@ -4553,7 +4620,7 @@ function asProjectConfig(parsed, projectDir) {
|
|
|
4553
4620
|
const normalizedStack = parsed.stack ? normalizeStackRecord(parsed.stack) : void 0;
|
|
4554
4621
|
return {
|
|
4555
4622
|
...parsed,
|
|
4556
|
-
name: parsed.name ??
|
|
4623
|
+
name: parsed.name ?? path9.basename(projectDir),
|
|
4557
4624
|
skills: parsed.skills ?? [],
|
|
4558
4625
|
agents: parsed.agents ?? [],
|
|
4559
4626
|
...normalizedStack && { stack: normalizedStack }
|
|
@@ -4561,12 +4628,12 @@ function asProjectConfig(parsed, projectDir) {
|
|
|
4561
4628
|
}
|
|
4562
4629
|
function warnOfDefaultedFields(parsed, configPath) {
|
|
4563
4630
|
if (parsed.name === void 0) {
|
|
4564
|
-
|
|
4631
|
+
warnOnce(
|
|
4565
4632
|
`Project config at '${configPath}' is missing required 'name' field \u2014 defaulting to directory name`
|
|
4566
4633
|
);
|
|
4567
4634
|
}
|
|
4568
4635
|
if (parsed.skills === void 0) {
|
|
4569
|
-
|
|
4636
|
+
warnOnce(`Project config at '${configPath}' is missing 'skills' array \u2014 defaulting to empty`);
|
|
4570
4637
|
}
|
|
4571
4638
|
}
|
|
4572
4639
|
async function loadInstalledConfig(dir) {
|
|
@@ -4607,14 +4674,12 @@ async function loadConfigInPlay(projectDir) {
|
|
|
4607
4674
|
}
|
|
4608
4675
|
function validateProjectConfig(config) {
|
|
4609
4676
|
const result = projectConfigLoaderSchema.safeParse(config);
|
|
4610
|
-
if (!result.success)
|
|
4611
|
-
return { valid: false, errors: formatZodErrors(result.error), warnings: [] };
|
|
4612
|
-
}
|
|
4677
|
+
if (!result.success) return resultFrom(formatZodErrors(result.error), []);
|
|
4613
4678
|
const errors = [
|
|
4614
4679
|
...result.data.name ? [] : ["name is required and must be a string"],
|
|
4615
4680
|
...result.data.agents ? [] : ["agents is required and must be an array"]
|
|
4616
4681
|
];
|
|
4617
|
-
return
|
|
4682
|
+
return resultFrom(errors, []);
|
|
4618
4683
|
}
|
|
4619
4684
|
|
|
4620
4685
|
// src/cli/lib/configuration/config-merger.ts
|
|
@@ -4720,13 +4785,13 @@ async function mergeWithExistingConfig(newConfig, context) {
|
|
|
4720
4785
|
}
|
|
4721
4786
|
|
|
4722
4787
|
// src/cli/lib/skills/skill-metadata.ts
|
|
4723
|
-
import
|
|
4788
|
+
import path11 from "path";
|
|
4724
4789
|
import { parse as parseYaml, stringify as stringifyYaml } from "yaml";
|
|
4725
4790
|
|
|
4726
4791
|
// src/cli/lib/versioning.ts
|
|
4727
4792
|
import { createHash } from "crypto";
|
|
4728
4793
|
import { readFile as readFileBytes } from "fs/promises";
|
|
4729
|
-
import
|
|
4794
|
+
import path10 from "path";
|
|
4730
4795
|
var ISO_DATE_LENGTH = 10;
|
|
4731
4796
|
function getCurrentDate() {
|
|
4732
4797
|
return (/* @__PURE__ */ new Date()).toISOString().slice(0, ISO_DATE_LENGTH);
|
|
@@ -4741,27 +4806,24 @@ async function computeFileHash(filePath) {
|
|
|
4741
4806
|
return computeStringHash(content);
|
|
4742
4807
|
}
|
|
4743
4808
|
async function computeSkillFolderHash(skillPath) {
|
|
4744
|
-
const
|
|
4745
|
-
|
|
4746
|
-
|
|
4747
|
-
|
|
4748
|
-
|
|
4749
|
-
|
|
4750
|
-
|
|
4751
|
-
|
|
4752
|
-
|
|
4753
|
-
|
|
4754
|
-
|
|
4755
|
-
|
|
4756
|
-
|
|
4757
|
-
|
|
4758
|
-
|
|
4759
|
-
|
|
4760
|
-
|
|
4761
|
-
|
|
4762
|
-
}
|
|
4763
|
-
const combined = contents.join("\n---\n");
|
|
4764
|
-
return computeStringHash(combined);
|
|
4809
|
+
const entries = await Promise.all([
|
|
4810
|
+
...SKILL_CONTENT_FILES.map((fileName) => contentFileEntries(skillPath, fileName)),
|
|
4811
|
+
...SKILL_CONTENT_DIRS.map((dirName) => contentDirEntries(skillPath, dirName))
|
|
4812
|
+
]);
|
|
4813
|
+
return computeStringHash(entries.flat().join("\n---\n"));
|
|
4814
|
+
}
|
|
4815
|
+
async function contentFileEntries(skillPath, fileName) {
|
|
4816
|
+
const filePath = path10.join(skillPath, fileName);
|
|
4817
|
+
if (!await fileExists(filePath)) return [];
|
|
4818
|
+
return [`${fileName}:${await readFile(filePath)}`];
|
|
4819
|
+
}
|
|
4820
|
+
async function contentDirEntries(skillPath, dirName) {
|
|
4821
|
+
const dirPath = path10.join(skillPath, dirName);
|
|
4822
|
+
if (!await fileExists(dirPath)) return [];
|
|
4823
|
+
const files = (await glob("**/*", dirPath)).toSorted();
|
|
4824
|
+
return Promise.all(
|
|
4825
|
+
files.map(async (file) => `${dirName}/${file}:${await readFile(path10.join(dirPath, file))}`)
|
|
4826
|
+
);
|
|
4765
4827
|
}
|
|
4766
4828
|
var CONTENT_HASH_FILE = ".content-hash";
|
|
4767
4829
|
function contentHashFileBeside(manifestPath) {
|
|
@@ -4783,7 +4845,7 @@ async function computeBytesHash(filePath) {
|
|
|
4783
4845
|
return createHash("sha256").update(await readFileBytes(filePath)).digest("hex");
|
|
4784
4846
|
}
|
|
4785
4847
|
async function describeShippedFile(pluginDir, file) {
|
|
4786
|
-
return `${file}\0${await computeBytesHash(
|
|
4848
|
+
return `${file}\0${await computeBytesHash(path10.join(pluginDir, file))}\0`;
|
|
4787
4849
|
}
|
|
4788
4850
|
async function computeShippedHash(pluginDir) {
|
|
4789
4851
|
const files = await glob("**/*", pluginDir, { dot: true });
|
|
@@ -4827,7 +4889,7 @@ async function readForkedFromMetadata(skillDir) {
|
|
|
4827
4889
|
return metadata?.forkedFrom ?? null;
|
|
4828
4890
|
}
|
|
4829
4891
|
async function readLocalSkillMetadata(skillDir) {
|
|
4830
|
-
const metadataPath =
|
|
4892
|
+
const metadataPath = path11.join(skillDir, STANDARD_FILES.METADATA_YAML);
|
|
4831
4893
|
if (!await fileExists(metadataPath)) {
|
|
4832
4894
|
return null;
|
|
4833
4895
|
}
|
|
@@ -4845,7 +4907,7 @@ async function readLocalSkillMetadata(skillDir) {
|
|
|
4845
4907
|
return result.data;
|
|
4846
4908
|
}
|
|
4847
4909
|
async function injectForkedFromMetadata(destPath, skillId, contentHash, origin = {}) {
|
|
4848
|
-
const metadataPath =
|
|
4910
|
+
const metadataPath = path11.join(destPath, STANDARD_FILES.METADATA_YAML);
|
|
4849
4911
|
const rawContent = await readFile(metadataPath);
|
|
4850
4912
|
const { yamlContent } = stripYamlSchemaComment(rawContent);
|
|
4851
4913
|
const metadata = {
|
|
@@ -4883,7 +4945,7 @@ function existingMetadataFields(yamlContent, metadataPath) {
|
|
|
4883
4945
|
}
|
|
4884
4946
|
|
|
4885
4947
|
// src/cli/lib/skills/skill-copier.ts
|
|
4886
|
-
import
|
|
4948
|
+
import path12 from "path";
|
|
4887
4949
|
var NULL_BYTE_PATTERN2 = /\0/;
|
|
4888
4950
|
function validateSkillPath(resolvedPath, expectedParent, skillPath) {
|
|
4889
4951
|
if (NULL_BYTE_PATTERN2.test(skillPath)) {
|
|
@@ -4891,26 +4953,26 @@ function validateSkillPath(resolvedPath, expectedParent, skillPath) {
|
|
|
4891
4953
|
}
|
|
4892
4954
|
if (!isPathWithin(resolvedPath, expectedParent)) {
|
|
4893
4955
|
throw new Error(
|
|
4894
|
-
`Invalid skill path: '${skillPath}' escapes expected directory '${
|
|
4956
|
+
`Invalid skill path: '${skillPath}' escapes expected directory '${path12.resolve(expectedParent)}'`
|
|
4895
4957
|
);
|
|
4896
4958
|
}
|
|
4897
4959
|
}
|
|
4898
4960
|
function resolveSkillPath(basePath, skillPath) {
|
|
4899
|
-
const resolved =
|
|
4961
|
+
const resolved = path12.join(basePath, skillPath);
|
|
4900
4962
|
validateSkillPath(resolved, basePath, skillPath);
|
|
4901
4963
|
return resolved;
|
|
4902
4964
|
}
|
|
4903
4965
|
function getSkillSourcePath(skill, rootDir) {
|
|
4904
|
-
const srcDir =
|
|
4966
|
+
const srcDir = path12.join(rootDir, SOURCE_SRC_DIR);
|
|
4905
4967
|
return resolveSkillPath(srcDir, skill.path);
|
|
4906
4968
|
}
|
|
4907
4969
|
async function generateSkillHash(skillSourcePath) {
|
|
4908
|
-
const skillMdPath =
|
|
4970
|
+
const skillMdPath = path12.join(skillSourcePath, STANDARD_FILES.SKILL_MD);
|
|
4909
4971
|
return computeFileHash(skillMdPath);
|
|
4910
4972
|
}
|
|
4911
4973
|
async function copySkillTo(skill, sourcePath, destPath, source) {
|
|
4912
4974
|
const contentHash = await generateSkillHash(sourcePath);
|
|
4913
|
-
await ensureDir(
|
|
4975
|
+
await ensureDir(path12.dirname(destPath));
|
|
4914
4976
|
await copy(sourcePath, destPath);
|
|
4915
4977
|
await injectForkedFromMetadata(destPath, skill.id, contentHash, {
|
|
4916
4978
|
...source !== void 0 && { source }
|
|
@@ -4992,7 +5054,7 @@ async function copySelectedSkill(skillId, localSkillsDir, sourceResult, selected
|
|
|
4992
5054
|
return copySkillToLocalFlattened(skill, localSkillsDir, sourceResult);
|
|
4993
5055
|
}
|
|
4994
5056
|
const destPath = getFlattenedSkillDestPath(skill, localSkillsDir);
|
|
4995
|
-
if (
|
|
5057
|
+
if (path12.resolve(localPath) === path12.resolve(destPath)) {
|
|
4996
5058
|
return resolveLocalCopiedSkill(skill, localPath);
|
|
4997
5059
|
}
|
|
4998
5060
|
return copyLocalSkillTo(skill, localPath, destPath);
|
|
@@ -5005,33 +5067,33 @@ function localPathOf(skill) {
|
|
|
5005
5067
|
}
|
|
5006
5068
|
async function copyLocalSkillTo(skill, localPath, destPath) {
|
|
5007
5069
|
const contentHash = await generateSkillHash(localPath);
|
|
5008
|
-
await ensureDir(
|
|
5070
|
+
await ensureDir(path12.dirname(destPath));
|
|
5009
5071
|
await copy(localPath, destPath);
|
|
5010
5072
|
return { skillId: skill.id, sourcePath: localPath, destPath, contentHash };
|
|
5011
5073
|
}
|
|
5012
5074
|
|
|
5013
5075
|
// src/cli/lib/skills/skill-plugin-compiler.ts
|
|
5014
|
-
import
|
|
5076
|
+
import path25 from "path";
|
|
5015
5077
|
import { parse as parseYaml4 } from "yaml";
|
|
5016
5078
|
|
|
5017
5079
|
// src/cli/lib/plugins/plugin-manifest.ts
|
|
5018
|
-
import
|
|
5080
|
+
import path14 from "path";
|
|
5019
5081
|
|
|
5020
5082
|
// src/cli/lib/plugins/plugin-finder.ts
|
|
5021
5083
|
import os6 from "os";
|
|
5022
|
-
import
|
|
5084
|
+
import path13 from "path";
|
|
5023
5085
|
function getUserPluginsDir() {
|
|
5024
|
-
return
|
|
5086
|
+
return path13.join(os6.homedir(), CLAUDE_DIR, PLUGINS_SUBDIR);
|
|
5025
5087
|
}
|
|
5026
5088
|
function getProjectPluginsDir(projectDir) {
|
|
5027
5089
|
const dir = projectDir ?? process.cwd();
|
|
5028
|
-
return
|
|
5090
|
+
return path13.join(dir, CLAUDE_DIR, PLUGINS_SUBDIR);
|
|
5029
5091
|
}
|
|
5030
5092
|
function getPluginAgentsDir(pluginDir) {
|
|
5031
|
-
return
|
|
5093
|
+
return path13.join(pluginDir, STANDARD_DIRS.AGENTS);
|
|
5032
5094
|
}
|
|
5033
5095
|
function getPluginManifestPath(pluginDir) {
|
|
5034
|
-
return
|
|
5096
|
+
return path13.join(pluginDir, PLUGIN_MANIFEST_DIR, PLUGIN_MANIFEST_FILE);
|
|
5035
5097
|
}
|
|
5036
5098
|
async function readPluginManifest(pluginDir) {
|
|
5037
5099
|
const manifestPath = getPluginManifestPath(pluginDir);
|
|
@@ -5054,7 +5116,6 @@ async function readPluginManifest(pluginDir) {
|
|
|
5054
5116
|
}
|
|
5055
5117
|
|
|
5056
5118
|
// src/cli/lib/plugins/plugin-manifest.ts
|
|
5057
|
-
var AGENT_PLUGIN_PREFIX = "agent-";
|
|
5058
5119
|
function buildAuthor(name, email) {
|
|
5059
5120
|
if (!name) {
|
|
5060
5121
|
return void 0;
|
|
@@ -5073,20 +5134,9 @@ function generateSkillPluginManifest(options) {
|
|
|
5073
5134
|
...options.keywords?.length ? { keywords: options.keywords } : {}
|
|
5074
5135
|
};
|
|
5075
5136
|
}
|
|
5076
|
-
function agentPluginName(agentName) {
|
|
5077
|
-
return `${AGENT_PLUGIN_PREFIX}${agentName}`;
|
|
5078
|
-
}
|
|
5079
|
-
function generateAgentPluginManifest(options) {
|
|
5080
|
-
return {
|
|
5081
|
-
name: agentPluginName(options.agentName),
|
|
5082
|
-
version: options.version ?? DEFAULT_VERSION,
|
|
5083
|
-
agents: "./agents/",
|
|
5084
|
-
...options.description ? { description: options.description } : {}
|
|
5085
|
-
};
|
|
5086
|
-
}
|
|
5087
5137
|
async function writePluginManifest(outputDir, manifest) {
|
|
5088
5138
|
const manifestPath = getPluginManifestPath(outputDir);
|
|
5089
|
-
await ensureDir(
|
|
5139
|
+
await ensureDir(path14.dirname(manifestPath));
|
|
5090
5140
|
const content = JSON.stringify(manifest, null, 2);
|
|
5091
5141
|
await writeFile(manifestPath, content);
|
|
5092
5142
|
return manifestPath;
|
|
@@ -5101,18 +5151,6 @@ function parseMarketplacePluginRef(ref) {
|
|
|
5101
5151
|
return separator === -1 ? ref : ref.slice(0, separator);
|
|
5102
5152
|
}
|
|
5103
5153
|
|
|
5104
|
-
// src/cli/lib/plugins/earlier-build.ts
|
|
5105
|
-
async function isEarlierBuild(pluginDir) {
|
|
5106
|
-
return fileExists(getPluginManifestPath(pluginDir));
|
|
5107
|
-
}
|
|
5108
|
-
async function holdsContentNoBuildMade(pluginDir) {
|
|
5109
|
-
if (await isEarlierBuild(pluginDir)) return false;
|
|
5110
|
-
return !await isDirectoryEmpty(pluginDir);
|
|
5111
|
-
}
|
|
5112
|
-
async function clearEarlierBuild(pluginDir) {
|
|
5113
|
-
if (await isEarlierBuild(pluginDir)) await remove(pluginDir);
|
|
5114
|
-
}
|
|
5115
|
-
|
|
5116
5154
|
// src/cli/lib/plugins/plugin-info.ts
|
|
5117
5155
|
import { readdir } from "fs/promises";
|
|
5118
5156
|
|
|
@@ -5175,12 +5213,12 @@ async function detectInstallation(projectDir = process.cwd()) {
|
|
|
5175
5213
|
|
|
5176
5214
|
// src/cli/lib/installation/local-installer.ts
|
|
5177
5215
|
import os10 from "os";
|
|
5178
|
-
import
|
|
5216
|
+
import path18 from "path";
|
|
5179
5217
|
import { unique as unique4 } from "remeda";
|
|
5180
5218
|
|
|
5181
5219
|
// src/cli/lib/loading/loader.ts
|
|
5182
5220
|
import { parse as parseYaml3 } from "yaml";
|
|
5183
|
-
import
|
|
5221
|
+
import path15 from "path";
|
|
5184
5222
|
|
|
5185
5223
|
// src/cli/utils/frontmatter.ts
|
|
5186
5224
|
import { parse as parseYaml2 } from "yaml";
|
|
@@ -5253,7 +5291,7 @@ async function loadAgentsFromDir(agentsDir2, sourceRoot, options) {
|
|
|
5253
5291
|
return agents;
|
|
5254
5292
|
}
|
|
5255
5293
|
async function readAgentDefinition(agentsDir2, file, sourceRoot, options) {
|
|
5256
|
-
const fullPath =
|
|
5294
|
+
const fullPath = path15.join(agentsDir2, file);
|
|
5257
5295
|
try {
|
|
5258
5296
|
const content = await readFile(fullPath);
|
|
5259
5297
|
const parsed = agentYamlConfigSchema.safeParse(parseYaml3(content));
|
|
@@ -5286,7 +5324,7 @@ function toAgentDefinition(config, file, sourceRoot, options) {
|
|
|
5286
5324
|
...config.hooks !== void 0 && { hooks: config.hooks },
|
|
5287
5325
|
...config.experimental !== void 0 && { experimental: config.experimental },
|
|
5288
5326
|
...config.outputFormat !== void 0 && { outputFormat: config.outputFormat },
|
|
5289
|
-
path:
|
|
5327
|
+
path: path15.dirname(file),
|
|
5290
5328
|
sourceRoot,
|
|
5291
5329
|
...options.agentBaseDir ? { agentBaseDir: options.agentBaseDir } : {},
|
|
5292
5330
|
...config.domain ? { domain: config.domain } : {},
|
|
@@ -5294,7 +5332,7 @@ function toAgentDefinition(config, file, sourceRoot, options) {
|
|
|
5294
5332
|
};
|
|
5295
5333
|
}
|
|
5296
5334
|
async function loadAllAgents(projectRoot) {
|
|
5297
|
-
return loadAgentsFromDir(
|
|
5335
|
+
return loadAgentsFromDir(path15.join(projectRoot, DIRS.agents), projectRoot, {
|
|
5298
5336
|
includeCustomFlag: true,
|
|
5299
5337
|
verboseLabel: "agent"
|
|
5300
5338
|
});
|
|
@@ -5308,7 +5346,7 @@ async function loadMergedAgents(sourcePath) {
|
|
|
5308
5346
|
}
|
|
5309
5347
|
async function loadProjectAgents(projectRoot, provider = providerInUse(projectRoot)) {
|
|
5310
5348
|
const sourceFolder = sourceFolderInUse(projectRoot, provider);
|
|
5311
|
-
const projectAgentsDir =
|
|
5349
|
+
const projectAgentsDir = path15.join(sourceFolder.dir, STANDARD_DIRS.AGENTS);
|
|
5312
5350
|
if (!await directoryExists2(projectAgentsDir)) {
|
|
5313
5351
|
verbose(`No project agents directory at ${projectAgentsDir}`);
|
|
5314
5352
|
return {};
|
|
@@ -5343,19 +5381,19 @@ async function loadSkillsFromDir(skillsDir2, options = {}) {
|
|
|
5343
5381
|
return { skills, unusableMetadata };
|
|
5344
5382
|
}
|
|
5345
5383
|
function locateSkill(skillsDir2, skillFile, pathPrefix) {
|
|
5346
|
-
const skillMdPath =
|
|
5347
|
-
const skillDir =
|
|
5348
|
-
const relativePath =
|
|
5384
|
+
const skillMdPath = path15.join(skillsDir2, skillFile);
|
|
5385
|
+
const skillDir = path15.dirname(skillMdPath);
|
|
5386
|
+
const relativePath = path15.relative(skillsDir2, skillDir);
|
|
5349
5387
|
return {
|
|
5350
5388
|
skillFile,
|
|
5351
5389
|
skillMdPath,
|
|
5352
5390
|
skillDir,
|
|
5353
|
-
skillDirName:
|
|
5391
|
+
skillDirName: path15.basename(skillDir),
|
|
5354
5392
|
displayPath: pathPrefix ? `${pathPrefix}/${relativePath}/` : `${relativePath}/`
|
|
5355
5393
|
};
|
|
5356
5394
|
}
|
|
5357
5395
|
async function judgeSkillMetadata(skill) {
|
|
5358
|
-
const metadataPath =
|
|
5396
|
+
const metadataPath = path15.join(skill.skillDir, STANDARD_FILES.METADATA_YAML);
|
|
5359
5397
|
if (!await fileExists(metadataPath)) {
|
|
5360
5398
|
verbose(` No ${STANDARD_FILES.METADATA_YAML} in '${skill.skillDirName}'`);
|
|
5361
5399
|
return { kind: "unregistered" };
|
|
@@ -5395,7 +5433,7 @@ async function readSkillDefinition(skill) {
|
|
|
5395
5433
|
}
|
|
5396
5434
|
}
|
|
5397
5435
|
async function loadPluginSkills(pluginDir) {
|
|
5398
|
-
const { skills } = await loadSkillsFromDir(
|
|
5436
|
+
const { skills } = await loadSkillsFromDir(path15.join(pluginDir, "skills"), {
|
|
5399
5437
|
pathPrefix: "skills",
|
|
5400
5438
|
requireMetadata: false
|
|
5401
5439
|
});
|
|
@@ -5410,12 +5448,12 @@ import { open, rename, stat } from "fs/promises";
|
|
|
5410
5448
|
import { setTimeout as sleep } from "timers/promises";
|
|
5411
5449
|
import { downloadTemplate } from "giget";
|
|
5412
5450
|
import os8 from "os";
|
|
5413
|
-
import
|
|
5451
|
+
import path17 from "path";
|
|
5414
5452
|
import { isDeepEqual } from "remeda";
|
|
5415
5453
|
import { z as z4 } from "zod";
|
|
5416
5454
|
|
|
5417
5455
|
// src/cli/lib/marketplace-generator.ts
|
|
5418
|
-
import
|
|
5456
|
+
import path16 from "path";
|
|
5419
5457
|
import { countBy, sortBy } from "remeda";
|
|
5420
5458
|
var PLUGIN_MANIFEST_PATH = `${PLUGIN_MANIFEST_DIR}/${PLUGIN_MANIFEST_FILE}`;
|
|
5421
5459
|
var MARKETPLACE_SCHEMA_URL = "https://anthropic.com/claude-code/marketplace.schema.json";
|
|
@@ -5442,21 +5480,8 @@ function convertManifestToMarketplacePlugin(manifest, pluginRoot, pluginDirName)
|
|
|
5442
5480
|
async function generateMarketplace(pluginsDir2, options) {
|
|
5443
5481
|
verbose(`Scanning plugins directory: ${pluginsDir2}`);
|
|
5444
5482
|
const manifestFiles = await glob(`**/${PLUGIN_MANIFEST_PATH}`, pluginsDir2);
|
|
5445
|
-
verbose(`Found ${manifestFiles.length
|
|
5446
|
-
const plugins =
|
|
5447
|
-
const rootWithoutDotSlash = options.pluginRoot.replace(/^\.\//, "");
|
|
5448
|
-
for (const manifestFile of manifestFiles) {
|
|
5449
|
-
const pluginDirName = pluginDirNameOf(manifestFile);
|
|
5450
|
-
const pluginDir = path15.join(pluginsDir2, pluginDirName);
|
|
5451
|
-
const manifest = await readPluginManifest(pluginDir);
|
|
5452
|
-
if (!manifest) {
|
|
5453
|
-
warn(`Could not read plugin manifest: '${manifestFile}'`);
|
|
5454
|
-
continue;
|
|
5455
|
-
}
|
|
5456
|
-
const plugin = convertManifestToMarketplacePlugin(manifest, rootWithoutDotSlash, pluginDirName);
|
|
5457
|
-
plugins.push(plugin);
|
|
5458
|
-
verbose(` [OK] ${plugin.name}`);
|
|
5459
|
-
}
|
|
5483
|
+
verbose(`Found ${plural(manifestFiles.length, "plugin manifest")}`);
|
|
5484
|
+
const plugins = await readMarketplacePlugins(pluginsDir2, manifestFiles, options.pluginRoot);
|
|
5460
5485
|
const sortedPlugins = sortBy(plugins, (p) => p.name);
|
|
5461
5486
|
return {
|
|
5462
5487
|
$schema: MARKETPLACE_SCHEMA_URL,
|
|
@@ -5473,6 +5498,22 @@ async function generateMarketplace(pluginsDir2, options) {
|
|
|
5473
5498
|
...options.description ? { description: options.description } : {}
|
|
5474
5499
|
};
|
|
5475
5500
|
}
|
|
5501
|
+
async function readMarketplacePlugins(pluginsDir2, manifestFiles, pluginRoot) {
|
|
5502
|
+
const rootWithoutDotSlash = pluginRoot.replace(/^\.\//, "");
|
|
5503
|
+
const plugins = [];
|
|
5504
|
+
for (const manifestFile of manifestFiles) {
|
|
5505
|
+
const pluginDirName = pluginDirNameOf(manifestFile);
|
|
5506
|
+
const manifest = await readPluginManifest(path16.join(pluginsDir2, pluginDirName));
|
|
5507
|
+
if (!manifest) {
|
|
5508
|
+
warn(`Could not read plugin manifest: '${manifestFile}'`);
|
|
5509
|
+
continue;
|
|
5510
|
+
}
|
|
5511
|
+
const plugin = convertManifestToMarketplacePlugin(manifest, rootWithoutDotSlash, pluginDirName);
|
|
5512
|
+
plugins.push(plugin);
|
|
5513
|
+
verbose(` [OK] ${plugin.name}`);
|
|
5514
|
+
}
|
|
5515
|
+
return plugins;
|
|
5516
|
+
}
|
|
5476
5517
|
function pluginDirNameOf(manifestFile) {
|
|
5477
5518
|
const separator = manifestFile.indexOf("/");
|
|
5478
5519
|
return separator === -1 ? manifestFile : manifestFile.slice(0, separator);
|
|
@@ -5505,14 +5546,14 @@ function namespaceViolationError(foreignIds, marketplaceName) {
|
|
|
5505
5546
|
const listed = foreignIds.slice(0, MAX_REPORTED_NAMESPACE_VIOLATIONS).map((id) => ` ${id} -> ${marketplaceName}-${id}`);
|
|
5506
5547
|
const unlisted = foreignIds.length - listed.length;
|
|
5507
5548
|
return [
|
|
5508
|
-
`Marketplace '${marketplaceName}' ships ${foreignIds.length
|
|
5549
|
+
`Marketplace '${marketplaceName}' ships ${plural(foreignIds.length, "skill id")} outside its own namespace. Every skill id must begin with the marketplace's name:`,
|
|
5509
5550
|
...listed,
|
|
5510
5551
|
...unlisted > 0 ? [` ... and ${unlisted} more`] : [],
|
|
5511
5552
|
`Rename each skill directory and the 'name' in its SKILL.md, re-run 'build plugins', then build the marketplace again.`
|
|
5512
5553
|
].join("\n");
|
|
5513
5554
|
}
|
|
5514
5555
|
async function writeMarketplace(outputPath, marketplace) {
|
|
5515
|
-
await ensureDir(
|
|
5556
|
+
await ensureDir(path16.dirname(outputPath));
|
|
5516
5557
|
const content = `${JSON.stringify(marketplace, null, 2)}
|
|
5517
5558
|
`;
|
|
5518
5559
|
await writeFile(outputPath, content);
|
|
@@ -5589,7 +5630,7 @@ function sanitizeSourceForCache(source) {
|
|
|
5589
5630
|
}
|
|
5590
5631
|
function getCacheDir(source) {
|
|
5591
5632
|
const sanitized = sanitizeSourceForCache(source) || "unknown";
|
|
5592
|
-
return
|
|
5633
|
+
return path17.join(cacheRoot(), "sources", sanitized);
|
|
5593
5634
|
}
|
|
5594
5635
|
async function fetchFromSource(source, options = {}) {
|
|
5595
5636
|
const { subdir } = options;
|
|
@@ -5600,8 +5641,8 @@ async function fetchFromSource(source, options = {}) {
|
|
|
5600
5641
|
return fetchFromRemoteSource(source, subdir);
|
|
5601
5642
|
}
|
|
5602
5643
|
async function fetchFromLocalSource(source, subdir) {
|
|
5603
|
-
const fullPath = subdir ?
|
|
5604
|
-
const absolutePath =
|
|
5644
|
+
const fullPath = subdir ? path17.join(source, subdir) : source;
|
|
5645
|
+
const absolutePath = path17.isAbsolute(fullPath) ? fullPath : path17.resolve(process.cwd(), fullPath);
|
|
5605
5646
|
if (!await directoryExists2(absolutePath)) {
|
|
5606
5647
|
throw new Error(
|
|
5607
5648
|
`Local marketplace not found: '${absolutePath}'
|
|
@@ -5613,12 +5654,7 @@ Check it for a typo, or name a marketplace that exists:
|
|
|
5613
5654
|
);
|
|
5614
5655
|
}
|
|
5615
5656
|
verbose(`Using local marketplace: ${absolutePath}`);
|
|
5616
|
-
return
|
|
5617
|
-
path: absolutePath,
|
|
5618
|
-
fromCache: false,
|
|
5619
|
-
unreachable: false,
|
|
5620
|
-
source
|
|
5621
|
-
};
|
|
5657
|
+
return currentCopyAt(absolutePath, source);
|
|
5622
5658
|
}
|
|
5623
5659
|
function getGigetCacheDir(source) {
|
|
5624
5660
|
const protoMatch = source.match(SOURCE_PROTO_RE);
|
|
@@ -5632,16 +5668,16 @@ function getGigetCacheDir(source) {
|
|
|
5632
5668
|
return void 0;
|
|
5633
5669
|
}
|
|
5634
5670
|
const templateName = uriMatch.groups.repo.replace("/", "-").replace(/[^\da-z-]/gi, "-");
|
|
5635
|
-
return
|
|
5671
|
+
return path17.join(gigetCacheRoot(), providerName, templateName);
|
|
5636
5672
|
}
|
|
5637
5673
|
function gigetCacheRoot() {
|
|
5638
|
-
return process.env.XDG_CACHE_HOME ?
|
|
5674
|
+
return process.env.XDG_CACHE_HOME ? path17.resolve(process.env.XDG_CACHE_HOME, "giget") : path17.resolve(os8.homedir(), ".cache", "giget");
|
|
5639
5675
|
}
|
|
5640
5676
|
async function clearGigetCache(source) {
|
|
5641
5677
|
const gigetDir = getGigetCacheDir(source);
|
|
5642
5678
|
if (!gigetDir || !await directoryExists2(gigetDir)) return;
|
|
5643
5679
|
verbose(`Clearing giget cache: ${gigetDir}`);
|
|
5644
|
-
await holdingGigetFolder(
|
|
5680
|
+
await holdingGigetFolder(path17.dirname(gigetDir), () => remove(gigetDir));
|
|
5645
5681
|
}
|
|
5646
5682
|
async function fetchFromRemoteSource(source, subdir) {
|
|
5647
5683
|
const cacheDir = getCacheDir(source);
|
|
@@ -5657,6 +5693,9 @@ async function fetchFromRemoteSource(source, subdir) {
|
|
|
5657
5693
|
const differingCopiesReplaced = marketplaceMustAnswer.getStore();
|
|
5658
5694
|
return differingCopiesReplaced ? downloadAnsweredFor(cacheDir, source, fullSource, differingCopiesReplaced) : downloadFreshCopy(cacheDir, source, fullSource);
|
|
5659
5695
|
}
|
|
5696
|
+
function currentCopyAt(dir, source) {
|
|
5697
|
+
return { path: dir, fromCache: false, unreachable: false, source };
|
|
5698
|
+
}
|
|
5660
5699
|
function readSavedCopy(cacheDir, fullSource, verdict) {
|
|
5661
5700
|
verbose(`Using cached marketplace: ${cacheDir}`);
|
|
5662
5701
|
return {
|
|
@@ -5682,7 +5721,7 @@ async function refreshSavedCopy(cacheDir, source, fullSource, verdict) {
|
|
|
5682
5721
|
await moveIntoPlace(cacheDir, staged);
|
|
5683
5722
|
await recordFetchedCopy(cacheDir, download.result, download.savedTarball);
|
|
5684
5723
|
settleForThisRun(cacheDir, "current");
|
|
5685
|
-
return
|
|
5724
|
+
return currentCopyAt(cacheDir, fullSource);
|
|
5686
5725
|
} catch (error) {
|
|
5687
5726
|
throw createDetailedFetchError(error, source);
|
|
5688
5727
|
} finally {
|
|
@@ -5722,7 +5761,7 @@ async function verdictOnDownload({ result, savedTarball }, source) {
|
|
|
5722
5761
|
return savedTarball ? verdictOnSavedTarball(result, savedTarball, source) : "current";
|
|
5723
5762
|
}
|
|
5724
5763
|
async function downloadFreshCopy(cacheDir, source, fullSource) {
|
|
5725
|
-
await ensureDir(
|
|
5764
|
+
await ensureDir(path17.dirname(cacheDir));
|
|
5726
5765
|
try {
|
|
5727
5766
|
const download = await gigetDownload(source, fullSource, {
|
|
5728
5767
|
dir: cacheDir,
|
|
@@ -5739,12 +5778,7 @@ async function downloadFreshCopy(cacheDir, source, fullSource) {
|
|
|
5739
5778
|
}
|
|
5740
5779
|
await recordFetchedCopy(cacheDir, result, savedTarball);
|
|
5741
5780
|
settleForThisRun(cacheDir, "current");
|
|
5742
|
-
return
|
|
5743
|
-
path: result.dir,
|
|
5744
|
-
fromCache: false,
|
|
5745
|
-
unreachable: false,
|
|
5746
|
-
source: fullSource
|
|
5747
|
-
};
|
|
5781
|
+
return currentCopyAt(result.dir, fullSource);
|
|
5748
5782
|
} catch (error) {
|
|
5749
5783
|
throw createDetailedFetchError(error, source);
|
|
5750
5784
|
}
|
|
@@ -5782,7 +5816,7 @@ var SET_ASIDE_SUFFIX = ".set-aside";
|
|
|
5782
5816
|
async function downloadAnsweredFor(cacheDir, source, fullSource, differingCopiesReplaced) {
|
|
5783
5817
|
const staged = `${cacheDir}${STAGED_DOWNLOAD_SUFFIX}`;
|
|
5784
5818
|
const download = () => downloadStaged(source, fullSource, staged);
|
|
5785
|
-
await ensureDir(
|
|
5819
|
+
await ensureDir(path17.dirname(cacheDir));
|
|
5786
5820
|
try {
|
|
5787
5821
|
const { result, savedTarball } = await download();
|
|
5788
5822
|
const record = await askAfterTheDownload(result, source);
|
|
@@ -5791,7 +5825,7 @@ async function downloadAnsweredFor(cacheDir, source, fullSource, differingCopies
|
|
|
5791
5825
|
await replaceCopy(cacheDir, staged, record);
|
|
5792
5826
|
if (differed) differingCopiesReplaced.add(source);
|
|
5793
5827
|
settleForThisRun(cacheDir, "current");
|
|
5794
|
-
return
|
|
5828
|
+
return currentCopyAt(cacheDir, fullSource);
|
|
5795
5829
|
} catch (error) {
|
|
5796
5830
|
if (error instanceof MarketplaceUnreachableError) throw error;
|
|
5797
5831
|
throw createDetailedFetchError(error, source);
|
|
@@ -5850,7 +5884,7 @@ function everyFileIn(dir) {
|
|
|
5850
5884
|
return glob(EVERY_FILE, dir, { dot: true });
|
|
5851
5885
|
}
|
|
5852
5886
|
function sameBytesAt(file, left, right) {
|
|
5853
|
-
return readFileSync(
|
|
5887
|
+
return readFileSync(path17.join(left, file)).equals(readFileSync(path17.join(right, file)));
|
|
5854
5888
|
}
|
|
5855
5889
|
async function replaceCopy(cacheDir, staged, record) {
|
|
5856
5890
|
await moveIntoPlace(cacheDir, staged);
|
|
@@ -5873,7 +5907,7 @@ async function downloadOverMarkedRecords(providerDir, fullSource, options) {
|
|
|
5873
5907
|
const marks = await markSavedRecords(providerDir);
|
|
5874
5908
|
try {
|
|
5875
5909
|
const result = await downloadTemplate(fullSource, options);
|
|
5876
|
-
const tarball =
|
|
5910
|
+
const tarball = path17.join(providerDir, gigetTarballOf(result));
|
|
5877
5911
|
if (await writtenByThisDownload(marks.get(tarball))) return { result };
|
|
5878
5912
|
verbose(`giget extracted the tarball it saved earlier, not a download: ${tarball}`);
|
|
5879
5913
|
return { result, savedTarball: { path: tarball, etag: await etagSavedWith(tarball) } };
|
|
@@ -5884,7 +5918,7 @@ async function downloadOverMarkedRecords(providerDir, fullSource, options) {
|
|
|
5884
5918
|
function gigetProviderDir(source) {
|
|
5885
5919
|
const provider = SOURCE_PROTO_RE.exec(source)?.[1];
|
|
5886
5920
|
if (provider === void 0) throw new Error(`No provider named in '${source}'`);
|
|
5887
|
-
return
|
|
5921
|
+
return path17.join(gigetCacheRoot(), provider);
|
|
5888
5922
|
}
|
|
5889
5923
|
var GIGET_FOLDER_LOCK = "agents-inc.lock";
|
|
5890
5924
|
var EXCLUSIVE_CREATE = "wx";
|
|
@@ -5905,7 +5939,7 @@ async function holdingGigetFolder(folder, body) {
|
|
|
5905
5939
|
function lockFor(folder) {
|
|
5906
5940
|
const holder = `${process.pid} ${randomUUID()}`;
|
|
5907
5941
|
holdersInThisProcess.add(holder);
|
|
5908
|
-
return { path:
|
|
5942
|
+
return { path: path17.join(folder, GIGET_FOLDER_LOCK), holder };
|
|
5909
5943
|
}
|
|
5910
5944
|
async function letGo({ path: lockPath, holder }) {
|
|
5911
5945
|
try {
|
|
@@ -5975,7 +6009,7 @@ var NO_RECORD = "{}";
|
|
|
5975
6009
|
var UNMARKED_SUFFIX = ".unmarked";
|
|
5976
6010
|
async function markSavedRecords(providerDir) {
|
|
5977
6011
|
const tarballs = await glob(GIGET_TARBALLS, providerDir);
|
|
5978
|
-
const paths = tarballs.map((tarball) =>
|
|
6012
|
+
const paths = tarballs.map((tarball) => path17.join(providerDir, tarball));
|
|
5979
6013
|
return new Map(await Promise.all(paths.map(async (at) => [at, await markRecordOf(at)])));
|
|
5980
6014
|
}
|
|
5981
6015
|
async function markRecordOf(tarball) {
|
|
@@ -6013,7 +6047,7 @@ function gigetTarballOf(result) {
|
|
|
6013
6047
|
const version = result.version;
|
|
6014
6048
|
if (typeof name !== "string") throw new Error("the download named no template");
|
|
6015
6049
|
const stem = typeof version === "string" && version !== "" ? version : name;
|
|
6016
|
-
return
|
|
6050
|
+
return path17.join(name, `${stem}.tar.gz`);
|
|
6017
6051
|
}
|
|
6018
6052
|
function gigetRecordOf(tarball) {
|
|
6019
6053
|
return `${tarball}.json`;
|
|
@@ -6155,13 +6189,6 @@ function tarballOf(result) {
|
|
|
6155
6189
|
function fetchRecord(tar, etag) {
|
|
6156
6190
|
return { tar, ...etag !== void 0 && { etag } };
|
|
6157
6191
|
}
|
|
6158
|
-
function parseJsonOrUndefined(raw) {
|
|
6159
|
-
try {
|
|
6160
|
-
return JSON.parse(raw);
|
|
6161
|
-
} catch {
|
|
6162
|
-
return void 0;
|
|
6163
|
-
}
|
|
6164
|
-
}
|
|
6165
6192
|
function createDetailedFetchError(error, source) {
|
|
6166
6193
|
const message = getErrorMessage(error);
|
|
6167
6194
|
if (message.includes("404") || message.includes("Not Found")) {
|
|
@@ -6363,7 +6390,7 @@ function tagLocalSkills(matrix2) {
|
|
|
6363
6390
|
addAvailableSource(skill, source);
|
|
6364
6391
|
count++;
|
|
6365
6392
|
}
|
|
6366
|
-
verbose(`Tagged ${count
|
|
6393
|
+
verbose(`Tagged ${plural(count, "local skill")} with local source`);
|
|
6367
6394
|
}
|
|
6368
6395
|
async function tagPluginSkills(matrix2, projectDir, primarySourceName, primarySourceType) {
|
|
6369
6396
|
const allPluginSkillIds = await collectPluginSkillIds(projectDir);
|
|
@@ -6375,7 +6402,7 @@ async function tagPluginSkills(matrix2, projectDir, primarySourceName, primarySo
|
|
|
6375
6402
|
if (!skill) continue;
|
|
6376
6403
|
markInstalledAsPlugin(skill, primarySourceName, primarySourceType);
|
|
6377
6404
|
}
|
|
6378
|
-
verbose(`Tagged ${allPluginSkillIds.length
|
|
6405
|
+
verbose(`Tagged ${plural(allPluginSkillIds.length, "plugin-installed skill")}`);
|
|
6379
6406
|
}
|
|
6380
6407
|
function markInstalledAsPlugin(skill, primarySourceName, primarySourceType) {
|
|
6381
6408
|
skill.availableSources = skill.availableSources ?? [];
|
|
@@ -6398,7 +6425,7 @@ async function collectPluginSkillIds(projectDir) {
|
|
|
6398
6425
|
const projectSkillIds = await pluginSkillIdsIn(projectDir);
|
|
6399
6426
|
const globalSkillIds = isHomeDirectory(projectDir) ? [] : await pluginSkillIdsIn(os9.homedir(), inheritedGlobalProvider(projectDir));
|
|
6400
6427
|
if (globalSkillIds.length > 0) {
|
|
6401
|
-
verbose(`Found ${globalSkillIds.length
|
|
6428
|
+
verbose(`Found ${plural(globalSkillIds.length, "global plugin skill")}`);
|
|
6402
6429
|
return unique3([...projectSkillIds, ...globalSkillIds]);
|
|
6403
6430
|
}
|
|
6404
6431
|
if (projectSkillIds.length === 0) {
|
|
@@ -6419,88 +6446,12 @@ function setActiveSources(matrix2) {
|
|
|
6419
6446
|
}
|
|
6420
6447
|
}
|
|
6421
6448
|
|
|
6422
|
-
// src/cli/lib/resolver.ts
|
|
6423
|
-
function resolveSkillReference(ref, skills) {
|
|
6424
|
-
const definition = skills[ref.id];
|
|
6425
|
-
if (!definition) {
|
|
6426
|
-
verbose(`Skill '${ref.id}' not found in available skills, skipping`);
|
|
6427
|
-
return null;
|
|
6428
|
-
}
|
|
6429
|
-
return {
|
|
6430
|
-
...definition,
|
|
6431
|
-
usage: ref.usage,
|
|
6432
|
-
preloaded: ref.preloaded ?? false,
|
|
6433
|
-
...ref.source !== void 0 && { source: ref.source }
|
|
6434
|
-
};
|
|
6435
|
-
}
|
|
6436
|
-
function resolveSkillReferences(skillRefs, skills) {
|
|
6437
|
-
return skillRefs.map((ref) => resolveSkillReference(ref, skills)).filter((skill) => skill !== null);
|
|
6438
|
-
}
|
|
6439
|
-
function buildSkillRefsFromConfig(agentStack) {
|
|
6440
|
-
return resolveAgentConfigToSkills(agentStack);
|
|
6441
|
-
}
|
|
6442
|
-
async function resolveAgents(agents, skills, compileConfig) {
|
|
6443
|
-
const entries = typedEntries(compileConfig.agents).map(
|
|
6444
|
-
([agentName, agentConfig]) => [agentName, resolveAgent(agentName, agentConfig, agents, skills)]
|
|
6445
|
-
);
|
|
6446
|
-
return typedFromEntries(entries);
|
|
6447
|
-
}
|
|
6448
|
-
function resolveAgent(agentName, agentConfig, agents, skills) {
|
|
6449
|
-
const definition = agents[agentName];
|
|
6450
|
-
if (!definition) throw new Error(agentNotFoundError(agentName, agents));
|
|
6451
|
-
const resolvedSkills = resolveSkillReferences(agentConfig.skills ?? [], skills);
|
|
6452
|
-
return assembleAgentConfig(agentName, definition, agentConfig, resolvedSkills);
|
|
6453
|
-
}
|
|
6454
|
-
var MAX_LISTED_AVAILABLE_AGENTS = 5;
|
|
6455
|
-
function agentNotFoundError(agentName, agents) {
|
|
6456
|
-
const availableAgents = describeAvailableAgents(typedKeys(agents));
|
|
6457
|
-
return `Agent '${agentName}' referenced in compile config but not found in scanned agents. ${availableAgents}. Check that src/agents/${agentName}/metadata.yaml exists.`;
|
|
6458
|
-
}
|
|
6459
|
-
function describeAvailableAgents(availableAgents) {
|
|
6460
|
-
if (availableAgents.length === 0) return "No agents found in scanned directories";
|
|
6461
|
-
const listed = availableAgents.slice(0, MAX_LISTED_AVAILABLE_AGENTS).join(", ");
|
|
6462
|
-
const unlisted = availableAgents.length - MAX_LISTED_AVAILABLE_AGENTS;
|
|
6463
|
-
return unlisted > 0 ? `Available agents: ${listed} (and ${unlisted} more)` : `Available agents: ${listed}`;
|
|
6464
|
-
}
|
|
6465
|
-
function assembleAgentConfig(agentName, definition, agentConfig, resolvedSkills) {
|
|
6466
|
-
const model = agentConfig.model ?? definition.model;
|
|
6467
|
-
const effort = agentConfig.effort ?? definition.effort;
|
|
6468
|
-
return {
|
|
6469
|
-
name: agentName,
|
|
6470
|
-
title: definition.title,
|
|
6471
|
-
description: definition.description,
|
|
6472
|
-
...model !== void 0 && { model },
|
|
6473
|
-
...agentConfig.codexModel !== void 0 && { codexModel: agentConfig.codexModel },
|
|
6474
|
-
...effort !== void 0 && { effort },
|
|
6475
|
-
tools: definition.tools,
|
|
6476
|
-
// Spread conditionally: the template branches on presence, and `undefined` renders a key.
|
|
6477
|
-
...definition.disallowedTools !== void 0 && {
|
|
6478
|
-
disallowedTools: definition.disallowedTools
|
|
6479
|
-
},
|
|
6480
|
-
...definition.permissionMode !== void 0 && {
|
|
6481
|
-
permissionMode: definition.permissionMode
|
|
6482
|
-
},
|
|
6483
|
-
...definition.isolation !== void 0 && { isolation: definition.isolation },
|
|
6484
|
-
...definition.hooks !== void 0 && { hooks: definition.hooks },
|
|
6485
|
-
...definition.experimental !== void 0 && {
|
|
6486
|
-
experimental: definition.experimental
|
|
6487
|
-
},
|
|
6488
|
-
skills: resolvedSkills,
|
|
6489
|
-
...definition.path !== void 0 && { path: definition.path },
|
|
6490
|
-
...definition.sourceRoot !== void 0 && { sourceRoot: definition.sourceRoot },
|
|
6491
|
-
...definition.agentBaseDir !== void 0 && { agentBaseDir: definition.agentBaseDir }
|
|
6492
|
-
};
|
|
6493
|
-
}
|
|
6494
|
-
|
|
6495
6449
|
// src/cli/lib/installation/local-installer.ts
|
|
6496
6450
|
function resolveStackProperty(generated, assigned) {
|
|
6497
6451
|
return generated === void 0 ? void 0 : assigned;
|
|
6498
6452
|
}
|
|
6499
|
-
function resolveDescription(loadedStack, shared) {
|
|
6500
|
-
return shared ?? loadedStack?.description;
|
|
6501
|
-
}
|
|
6502
6453
|
function configNameFor(projectDir) {
|
|
6503
|
-
return isHomeDirectory(projectDir) ? DEFAULT_PLUGIN_NAME :
|
|
6454
|
+
return isHomeDirectory(projectDir) ? DEFAULT_PLUGIN_NAME : path18.basename(projectDir);
|
|
6504
6455
|
}
|
|
6505
6456
|
async function loadCuratedStack(projectDir, projectStack) {
|
|
6506
6457
|
const globalStack = isHomeDirectory(projectDir) ? void 0 : await loadGlobalStack(projectDir);
|
|
@@ -6527,7 +6478,7 @@ async function buildInstallConfig(selection, sourceResult, projectDir) {
|
|
|
6527
6478
|
}
|
|
6528
6479
|
function withSelectionCuration(generated, selection, loadedStack) {
|
|
6529
6480
|
const stack = resolveStackProperty(generated.stack, selection.assignedStack);
|
|
6530
|
-
const description =
|
|
6481
|
+
const description = selection.description ?? loadedStack?.description;
|
|
6531
6482
|
return {
|
|
6532
6483
|
...generated,
|
|
6533
6484
|
...stack && { stack },
|
|
@@ -6571,22 +6522,16 @@ function generatorOptionsFor(selection, existingStack) {
|
|
|
6571
6522
|
};
|
|
6572
6523
|
}
|
|
6573
6524
|
function stackSizeForLog(stack) {
|
|
6574
|
-
return stack ?
|
|
6525
|
+
return stack ? plural(Object.keys(stack).length, "agent") : "UNDEFINED";
|
|
6575
6526
|
}
|
|
6576
6527
|
function setConfigMetadata(config, selection, sourceResult, sourceFlag) {
|
|
6577
|
-
const
|
|
6578
|
-
|
|
6579
|
-
|
|
6580
|
-
|
|
6581
|
-
|
|
6582
|
-
|
|
6583
|
-
}
|
|
6584
|
-
result.marketplace = sourceResult.sourceConfig.source;
|
|
6585
|
-
}
|
|
6586
|
-
if (sourceResult.marketplace) {
|
|
6587
|
-
result.marketplaceName = sourceResult.marketplace;
|
|
6588
|
-
}
|
|
6589
|
-
return result;
|
|
6528
|
+
const marketplace = sourceFlag || sourceResult.sourceConfig.source;
|
|
6529
|
+
return {
|
|
6530
|
+
...config,
|
|
6531
|
+
...selection.selectedDomains.length > 0 ? { selectedDomains: selection.selectedDomains } : {},
|
|
6532
|
+
...marketplace ? { marketplace } : {},
|
|
6533
|
+
...sourceResult.marketplace ? { marketplaceName: sourceResult.marketplace } : {}
|
|
6534
|
+
};
|
|
6590
6535
|
}
|
|
6591
6536
|
async function buildAndMergeConfig(selection, sourceResult, projectDir, sourceFlag, authoritativeScope) {
|
|
6592
6537
|
const { config } = await buildInstallConfig(selection, sourceResult, projectDir);
|
|
@@ -6627,7 +6572,7 @@ function buildCompileAgents(config, agents) {
|
|
|
6627
6572
|
};
|
|
6628
6573
|
const agentStack = config.stack?.[agentConfig.name];
|
|
6629
6574
|
if (!agentStack) return tuning;
|
|
6630
|
-
const filteredRefs =
|
|
6575
|
+
const filteredRefs = resolveAgentConfigToSkills(agentStack).filter((ref) => compilesInto(ref, agentConfig)).map(withItsOrigin);
|
|
6631
6576
|
return { ...tuning, skills: filteredRefs };
|
|
6632
6577
|
};
|
|
6633
6578
|
return typedFromEntries(
|
|
@@ -6710,12 +6655,11 @@ function asInstallation({ provider, scope, configPath }) {
|
|
|
6710
6655
|
|
|
6711
6656
|
// src/cli/lib/hosts/claude-host.ts
|
|
6712
6657
|
import os12 from "os";
|
|
6713
|
-
import path20 from "path";
|
|
6714
6658
|
import { z as z6 } from "zod";
|
|
6715
6659
|
|
|
6716
6660
|
// src/cli/utils/exec.ts
|
|
6717
6661
|
import { spawn } from "child_process";
|
|
6718
|
-
import
|
|
6662
|
+
import path19 from "path";
|
|
6719
6663
|
var MAX_PLUGIN_PATH_LENGTH = 1024;
|
|
6720
6664
|
var MAX_PLUGIN_NAME_LENGTH = 256;
|
|
6721
6665
|
var MAX_MARKETPLACE_SOURCE_LENGTH = 1024;
|
|
@@ -6723,21 +6667,22 @@ var SAFE_NAME_PATTERN2 = /^[a-zA-Z0-9._@/-]+$/;
|
|
|
6723
6667
|
var SAFE_PLUGIN_PATH_PATTERN = /^[a-zA-Z0-9._@/:~-]+$/;
|
|
6724
6668
|
var OPENS_A_RELATIVE_PATH = /^\.\.?[/\\]/;
|
|
6725
6669
|
function namesADirectoryOnThisMachine(source) {
|
|
6726
|
-
return
|
|
6670
|
+
return path19.isAbsolute(source) || OPENS_A_RELATIVE_PATH.test(source);
|
|
6727
6671
|
}
|
|
6728
6672
|
var CONTROL_CHAR_PATTERN = /[\x00-\x08\x0E-\x1F\x7F]/u;
|
|
6729
|
-
function
|
|
6730
|
-
if (!
|
|
6731
|
-
throw new Error(
|
|
6673
|
+
function refuseEmptyOverlongOrControlCharacters(value, label, maxLength) {
|
|
6674
|
+
if (!value || value.trim().length === 0) {
|
|
6675
|
+
throw new Error(`${label} must not be empty.`);
|
|
6732
6676
|
}
|
|
6733
|
-
if (
|
|
6734
|
-
throw new Error(
|
|
6735
|
-
`Plugin path is too long (${pluginPath.length} characters, max ${MAX_PLUGIN_PATH_LENGTH}).`
|
|
6736
|
-
);
|
|
6677
|
+
if (value.length > maxLength) {
|
|
6678
|
+
throw new Error(`${label} is too long (${value.length} characters, max ${maxLength}).`);
|
|
6737
6679
|
}
|
|
6738
|
-
if (CONTROL_CHAR_PATTERN.test(
|
|
6739
|
-
throw new Error(
|
|
6680
|
+
if (CONTROL_CHAR_PATTERN.test(value)) {
|
|
6681
|
+
throw new Error(`${label} contains invalid control characters.`);
|
|
6740
6682
|
}
|
|
6683
|
+
}
|
|
6684
|
+
function validatePluginPath(pluginPath) {
|
|
6685
|
+
refuseEmptyOverlongOrControlCharacters(pluginPath, "Plugin path", MAX_PLUGIN_PATH_LENGTH);
|
|
6741
6686
|
if (!SAFE_PLUGIN_PATH_PATTERN.test(pluginPath)) {
|
|
6742
6687
|
throw new Error(
|
|
6743
6688
|
`Plugin path contains invalid characters: "${pluginPath}"
|
|
@@ -6746,17 +6691,7 @@ Plugin paths may only contain alphanumeric characters, dashes, underscores, dots
|
|
|
6746
6691
|
}
|
|
6747
6692
|
}
|
|
6748
6693
|
function validateMarketplaceSource(source) {
|
|
6749
|
-
|
|
6750
|
-
throw new Error("Marketplace must not be empty.");
|
|
6751
|
-
}
|
|
6752
|
-
if (source.length > MAX_MARKETPLACE_SOURCE_LENGTH) {
|
|
6753
|
-
throw new Error(
|
|
6754
|
-
`Marketplace is too long (${source.length} characters, max ${MAX_MARKETPLACE_SOURCE_LENGTH}).`
|
|
6755
|
-
);
|
|
6756
|
-
}
|
|
6757
|
-
if (CONTROL_CHAR_PATTERN.test(source)) {
|
|
6758
|
-
throw new Error("Marketplace contains invalid control characters.");
|
|
6759
|
-
}
|
|
6694
|
+
refuseEmptyOverlongOrControlCharacters(source, "Marketplace", MAX_MARKETPLACE_SOURCE_LENGTH);
|
|
6760
6695
|
if (namesADirectoryOnThisMachine(source)) return;
|
|
6761
6696
|
if (!SAFE_PLUGIN_PATH_PATTERN.test(source)) {
|
|
6762
6697
|
throw new Error(
|
|
@@ -6766,17 +6701,7 @@ Marketplaces may only contain alphanumeric characters, dashes, underscores, dots
|
|
|
6766
6701
|
}
|
|
6767
6702
|
}
|
|
6768
6703
|
function validatePluginName(pluginName) {
|
|
6769
|
-
|
|
6770
|
-
throw new Error("Plugin name must not be empty.");
|
|
6771
|
-
}
|
|
6772
|
-
if (pluginName.length > MAX_PLUGIN_NAME_LENGTH) {
|
|
6773
|
-
throw new Error(
|
|
6774
|
-
`Plugin name is too long (${pluginName.length} characters, max ${MAX_PLUGIN_NAME_LENGTH}).`
|
|
6775
|
-
);
|
|
6776
|
-
}
|
|
6777
|
-
if (CONTROL_CHAR_PATTERN.test(pluginName)) {
|
|
6778
|
-
throw new Error("Plugin name contains invalid control characters.");
|
|
6779
|
-
}
|
|
6704
|
+
refuseEmptyOverlongOrControlCharacters(pluginName, "Plugin name", MAX_PLUGIN_NAME_LENGTH);
|
|
6780
6705
|
if (!SAFE_NAME_PATTERN2.test(pluginName)) {
|
|
6781
6706
|
throw new Error(
|
|
6782
6707
|
`Plugin name contains invalid characters: "${pluginName}"
|
|
@@ -6813,7 +6738,8 @@ async function execCommand(command, args, options) {
|
|
|
6813
6738
|
}
|
|
6814
6739
|
|
|
6815
6740
|
// src/cli/lib/plugins/plugin-settings.ts
|
|
6816
|
-
import
|
|
6741
|
+
import path20 from "path";
|
|
6742
|
+
import { unique as unique5 } from "remeda";
|
|
6817
6743
|
import { z as z5 } from "zod";
|
|
6818
6744
|
var pluginSettingsSchema = z5.object({
|
|
6819
6745
|
// Absent when no plugin is enabled.
|
|
@@ -6834,7 +6760,7 @@ var installedPluginsSchema = z5.object({
|
|
|
6834
6760
|
plugins: z5.record(z5.string(), z5.array(pluginInstallationSchema))
|
|
6835
6761
|
}).passthrough();
|
|
6836
6762
|
function getInstalledPluginsRegistryPath(pluginsDir2) {
|
|
6837
|
-
return
|
|
6763
|
+
return path20.join(pluginsDir2, INSTALLED_PLUGINS_FILE);
|
|
6838
6764
|
}
|
|
6839
6765
|
async function readRegisteredInstallations(pluginsDir2) {
|
|
6840
6766
|
const registryPath = getInstalledPluginsRegistryPath(pluginsDir2);
|
|
@@ -6850,10 +6776,9 @@ async function readRegisteredInstallations(pluginsDir2) {
|
|
|
6850
6776
|
}
|
|
6851
6777
|
async function listRegisteredPluginInstalls(pluginsDir2) {
|
|
6852
6778
|
const installations = await readRegisteredInstallations(pluginsDir2);
|
|
6853
|
-
return typedEntries(installations).flatMap(
|
|
6854
|
-
|
|
6855
|
-
|
|
6856
|
-
});
|
|
6779
|
+
return typedEntries(installations).flatMap(
|
|
6780
|
+
([pluginKey, forKey]) => unique5(forKey.map((i) => i.installPath)).map((installPath) => ({ pluginKey, installPath }))
|
|
6781
|
+
);
|
|
6857
6782
|
}
|
|
6858
6783
|
async function listPluginInstallsForProject(pluginsDir2, projectDir) {
|
|
6859
6784
|
const installations = await readRegisteredInstallations(pluginsDir2);
|
|
@@ -6867,7 +6792,7 @@ async function listPluginInstallsForProject(pluginsDir2, projectDir) {
|
|
|
6867
6792
|
});
|
|
6868
6793
|
}
|
|
6869
6794
|
async function getEnabledPluginKeys(projectDir) {
|
|
6870
|
-
const settingsPath =
|
|
6795
|
+
const settingsPath = path20.join(projectDir, CLAUDE_DIR, STANDARD_FILES.SETTINGS_JSON);
|
|
6871
6796
|
if (!await fileExists(settingsPath)) {
|
|
6872
6797
|
verbose(`No settings.json found at '${settingsPath}'`);
|
|
6873
6798
|
return [];
|
|
@@ -6886,7 +6811,7 @@ async function getEnabledPluginKeys(projectDir) {
|
|
|
6886
6811
|
return [];
|
|
6887
6812
|
}
|
|
6888
6813
|
const enabledKeys = typedEntries(settings.enabledPlugins).filter(([, enabled]) => enabled === true).map(([key]) => key);
|
|
6889
|
-
verbose(`Found ${enabledKeys.length
|
|
6814
|
+
verbose(`Found ${plural(enabledKeys.length, "enabled plugin")} in settings.json`);
|
|
6890
6815
|
return enabledKeys;
|
|
6891
6816
|
} catch (error) {
|
|
6892
6817
|
verbose(`Failed to read settings.json: ${getErrorMessage(error)}`);
|
|
@@ -6897,6 +6822,13 @@ function pickInstallation(installations, projectDir) {
|
|
|
6897
6822
|
return installations.find((i) => i.scope === "project" && i.projectPath === projectDir) ?? installations.find((i) => i.scope === "user");
|
|
6898
6823
|
}
|
|
6899
6824
|
|
|
6825
|
+
// src/cli/lib/hosts/plugin-host.ts
|
|
6826
|
+
import path21 from "path";
|
|
6827
|
+
function pluginsRootFor(provider, projectDir, options) {
|
|
6828
|
+
if (options?.configDir !== void 0) return path21.join(options.configDir, PLUGINS_SUBDIR);
|
|
6829
|
+
return pluginsDir(provider, "global", projectDir);
|
|
6830
|
+
}
|
|
6831
|
+
|
|
6900
6832
|
// src/cli/lib/hosts/claude-host.ts
|
|
6901
6833
|
var CLAUDE = "claude";
|
|
6902
6834
|
var NOT_INSTALLED_MESSAGES = ["not installed", "not found"];
|
|
@@ -6918,20 +6850,21 @@ function configDirEnv(options) {
|
|
|
6918
6850
|
if (options?.configDir === void 0) return {};
|
|
6919
6851
|
return { env: { CLAUDE_CONFIG_DIR: options.configDir } };
|
|
6920
6852
|
}
|
|
6853
|
+
function runScopedPluginVerb(verb, pluginRef, scope, projectDir, options) {
|
|
6854
|
+
const cwd = resolvePluginCwd(scope, projectDir);
|
|
6855
|
+
const args = ["plugin", verb, pluginRef, "--scope", scope];
|
|
6856
|
+
return execCommand("claude", args, { cwd, ...configDirEnv(options) });
|
|
6857
|
+
}
|
|
6921
6858
|
async function claudePluginInstall(pluginPath, scope, projectDir, options) {
|
|
6922
6859
|
validatePluginPath(pluginPath);
|
|
6923
|
-
const
|
|
6924
|
-
const args = ["plugin", "install", pluginPath, "--scope", scope];
|
|
6925
|
-
const result = await execCommand("claude", args, { cwd, ...configDirEnv(options) });
|
|
6860
|
+
const result = await runScopedPluginVerb("install", pluginPath, scope, projectDir, options);
|
|
6926
6861
|
if (result.exitCode !== 0) {
|
|
6927
6862
|
throw new Error(`Plugin installation failed: ${whyClaudeFailed(result)}`);
|
|
6928
6863
|
}
|
|
6929
6864
|
}
|
|
6930
6865
|
async function claudePluginUpdate(pluginRef, scope, projectDir, options) {
|
|
6931
6866
|
validatePluginName(pluginRef);
|
|
6932
|
-
const
|
|
6933
|
-
const args = ["plugin", "update", pluginRef, "--scope", scope];
|
|
6934
|
-
const result = await execCommand("claude", args, { cwd, ...configDirEnv(options) });
|
|
6867
|
+
const result = await runScopedPluginVerb("update", pluginRef, scope, projectDir, options);
|
|
6935
6868
|
if (result.exitCode !== 0) throw new Error(whyClaudeFailed(result));
|
|
6936
6869
|
}
|
|
6937
6870
|
async function isClaudeCLIAvailable(options) {
|
|
@@ -6950,19 +6883,24 @@ var marketplaceInfoListSchema = z6.array(
|
|
|
6950
6883
|
path: z6.string().exactOptional()
|
|
6951
6884
|
})
|
|
6952
6885
|
);
|
|
6886
|
+
var MARKETPLACE_LIST_ARGS = ["plugin", "marketplace", "list", "--json"];
|
|
6953
6887
|
async function claudePluginMarketplaceList(options) {
|
|
6954
6888
|
try {
|
|
6955
|
-
const result = await execCommand(
|
|
6956
|
-
"claude",
|
|
6957
|
-
["plugin", "marketplace", "list", "--json"],
|
|
6958
|
-
configDirEnv(options)
|
|
6959
|
-
);
|
|
6889
|
+
const result = await execCommand("claude", MARKETPLACE_LIST_ARGS, configDirEnv(options));
|
|
6960
6890
|
if (result.exitCode !== 0) return [];
|
|
6961
6891
|
return marketplacesListedIn(result.stdout);
|
|
6962
6892
|
} catch {
|
|
6963
6893
|
return [];
|
|
6964
6894
|
}
|
|
6965
6895
|
}
|
|
6896
|
+
async function claudeMarketplacesHeld(options) {
|
|
6897
|
+
const result = await runClaude(MARKETPLACE_LIST_ARGS, options, "list marketplaces");
|
|
6898
|
+
if (result.exitCode !== 0) {
|
|
6899
|
+
throw new Error(`Failed to list marketplaces: ${whyClaudeFailed(result)}`);
|
|
6900
|
+
}
|
|
6901
|
+
const listed = marketplaceInfoListSchema.parse(JSON.parse(result.stdout));
|
|
6902
|
+
return listed.map(({ name }) => name);
|
|
6903
|
+
}
|
|
6966
6904
|
function marketplacesListedIn(stdout) {
|
|
6967
6905
|
let parsed;
|
|
6968
6906
|
try {
|
|
@@ -6991,6 +6929,15 @@ async function claudePluginMarketplaceAdd(source, options) {
|
|
|
6991
6929
|
if (said.includes("already installed")) return;
|
|
6992
6930
|
throw new Error(`Failed to add marketplace: ${said}`);
|
|
6993
6931
|
}
|
|
6932
|
+
async function claudePluginMarketplaceRemove(name, options) {
|
|
6933
|
+
validatePluginName(name);
|
|
6934
|
+
const args = ["plugin", "marketplace", "remove", name];
|
|
6935
|
+
const result = await runClaude(args, options, "remove marketplace");
|
|
6936
|
+
if (result.exitCode === 0) return;
|
|
6937
|
+
const said = whyClaudeFailed(result);
|
|
6938
|
+
if (namesNothingThere(said)) return;
|
|
6939
|
+
throw new Error(`Failed to remove marketplace: ${said}`);
|
|
6940
|
+
}
|
|
6994
6941
|
async function claudePluginMarketplaceUpdate(name, options) {
|
|
6995
6942
|
validatePluginName(name);
|
|
6996
6943
|
const args = ["plugin", "marketplace", "update", name];
|
|
@@ -7010,9 +6957,7 @@ function whyClaudeFailed(result) {
|
|
|
7010
6957
|
}
|
|
7011
6958
|
async function claudePluginUninstall(pluginName, scope, projectDir, options) {
|
|
7012
6959
|
validatePluginName(pluginName);
|
|
7013
|
-
const
|
|
7014
|
-
const args = ["plugin", "uninstall", pluginName, "--scope", scope];
|
|
7015
|
-
const result = await execCommand("claude", args, { cwd, ...configDirEnv(options) });
|
|
6960
|
+
const result = await runScopedPluginVerb("uninstall", pluginName, scope, projectDir, options);
|
|
7016
6961
|
if (result.exitCode === 0) return "removed";
|
|
7017
6962
|
const said = whyClaudeFailed(result);
|
|
7018
6963
|
if (namesNothingThere(said)) return "absent";
|
|
@@ -7021,12 +6966,8 @@ async function claudePluginUninstall(pluginName, scope, projectDir, options) {
|
|
|
7021
6966
|
function namesNothingThere(message) {
|
|
7022
6967
|
return NOT_INSTALLED_MESSAGES.some((phrase) => message.includes(phrase));
|
|
7023
6968
|
}
|
|
7024
|
-
function claudePluginsRoot(projectDir, options) {
|
|
7025
|
-
if (options?.configDir !== void 0) return path20.join(options.configDir, PLUGINS_SUBDIR);
|
|
7026
|
-
return pluginsDir(CLAUDE, "global", projectDir);
|
|
7027
|
-
}
|
|
7028
6969
|
async function claudeListPlugins(projectDir, options) {
|
|
7029
|
-
const pluginsRoot =
|
|
6970
|
+
const pluginsRoot = pluginsRootFor(CLAUDE, projectDir, options);
|
|
7030
6971
|
if (pluginsRoot === null) return [];
|
|
7031
6972
|
if (!await fileExists(getInstalledPluginsRegistryPath(pluginsRoot))) return [];
|
|
7032
6973
|
const [installs, enabled] = await Promise.all([
|
|
@@ -7040,6 +6981,9 @@ async function claudeListPlugins(projectDir, options) {
|
|
|
7040
6981
|
enabled: enabledKeys.has(pluginKey)
|
|
7041
6982
|
}));
|
|
7042
6983
|
}
|
|
6984
|
+
async function claudePluginsHeld(projectDir, options) {
|
|
6985
|
+
return (await claudeListPlugins(projectDir, options)).map(({ pluginKey }) => pluginKey);
|
|
6986
|
+
}
|
|
7043
6987
|
function claudeHost() {
|
|
7044
6988
|
return {
|
|
7045
6989
|
provider: CLAUDE,
|
|
@@ -7049,16 +6993,21 @@ function claudeHost() {
|
|
|
7049
6993
|
marketplaceExists: claudePluginMarketplaceExists,
|
|
7050
6994
|
addMarketplace: claudePluginMarketplaceAdd,
|
|
7051
6995
|
refreshMarketplace: claudePluginMarketplaceUpdate,
|
|
6996
|
+
marketplaceTakeBack: {
|
|
6997
|
+
marketplacesHeld: claudeMarketplacesHeld,
|
|
6998
|
+
removeMarketplace: claudePluginMarketplaceRemove
|
|
6999
|
+
},
|
|
7052
7000
|
installPlugin: (pluginRef, scope, projectDir, options) => claudePluginInstall(pluginRef, toClaudePluginScope(scope), projectDir, options),
|
|
7053
7001
|
updatePlugin: (pluginRef, scope, projectDir, options) => claudePluginUpdate(pluginRef, toClaudePluginScope(scope), projectDir, options),
|
|
7054
7002
|
uninstallPlugin: (pluginRef, scope, projectDir, options) => claudePluginUninstall(pluginRef, toClaudePluginScope(scope), projectDir, options),
|
|
7055
|
-
listPlugins: claudeListPlugins
|
|
7003
|
+
listPlugins: claudeListPlugins,
|
|
7004
|
+
pluginsHeld: claudePluginsHeld
|
|
7056
7005
|
};
|
|
7057
7006
|
}
|
|
7058
7007
|
|
|
7059
7008
|
// src/cli/lib/hosts/codex-host.ts
|
|
7060
7009
|
import os13 from "os";
|
|
7061
|
-
import
|
|
7010
|
+
import path22 from "path";
|
|
7062
7011
|
import { z as z7 } from "zod";
|
|
7063
7012
|
|
|
7064
7013
|
// src/cli/lib/hosts/codex-plugin-switch.ts
|
|
@@ -7222,10 +7171,6 @@ var pluginListingSchema = z7.object({
|
|
|
7222
7171
|
})
|
|
7223
7172
|
)
|
|
7224
7173
|
});
|
|
7225
|
-
function codexPluginsRoot(projectDir, options) {
|
|
7226
|
-
if (options?.configDir !== void 0) return path21.join(options.configDir, PLUGINS_SUBDIR);
|
|
7227
|
-
return pluginsDir(CODEX, "global", projectDir);
|
|
7228
|
-
}
|
|
7229
7174
|
async function isCodexCLIAvailable(options) {
|
|
7230
7175
|
try {
|
|
7231
7176
|
const result = await runCodex(["--version"], options, codexPluginCwd());
|
|
@@ -7249,21 +7194,30 @@ async function codexMarketplaces(options) {
|
|
|
7249
7194
|
return registry.marketplaces;
|
|
7250
7195
|
}
|
|
7251
7196
|
async function codexMarketplaceExists(name, options) {
|
|
7252
|
-
return await codexRegisteredMarketplace(name, options) !== null;
|
|
7253
|
-
}
|
|
7254
|
-
async function codexRegisteredMarketplace(name, options) {
|
|
7255
7197
|
let registered;
|
|
7256
7198
|
try {
|
|
7257
7199
|
registered = await codexMarketplaces(options);
|
|
7258
7200
|
} catch (error) {
|
|
7259
7201
|
if (!namesAnUnreadableMarketplace(error)) throw error;
|
|
7260
7202
|
warnOnce(sayWhatCodexRefused("list the marketplaces it knows", getErrorMessage(error)));
|
|
7261
|
-
return
|
|
7203
|
+
return false;
|
|
7262
7204
|
}
|
|
7263
|
-
return registered.
|
|
7205
|
+
return registered.some((marketplace) => marketplace.name === name);
|
|
7206
|
+
}
|
|
7207
|
+
async function codexMarketplacesHeld(options) {
|
|
7208
|
+
return (await codexMarketplaces(options)).map(({ name }) => name);
|
|
7209
|
+
}
|
|
7210
|
+
async function codexMarketplaceRemove(name, options) {
|
|
7211
|
+
validatePluginName(name);
|
|
7212
|
+
await runCodexOrThrow(
|
|
7213
|
+
["plugin", "marketplace", "remove", name, "--json"],
|
|
7214
|
+
options,
|
|
7215
|
+
"remove marketplace",
|
|
7216
|
+
codexPluginCwd()
|
|
7217
|
+
);
|
|
7264
7218
|
}
|
|
7265
7219
|
function sayWhatCodexRefused(attempt, said) {
|
|
7266
|
-
return `Codex could not ${attempt}
|
|
7220
|
+
return `Codex could not ${attempt}. It said: ${said}`;
|
|
7267
7221
|
}
|
|
7268
7222
|
async function codexMarketplaceAdd(source, options) {
|
|
7269
7223
|
validateMarketplaceSource(source);
|
|
@@ -7325,7 +7279,7 @@ async function switchBackOff(heldBefore, options) {
|
|
|
7325
7279
|
);
|
|
7326
7280
|
}
|
|
7327
7281
|
function codexConfigFile(options) {
|
|
7328
|
-
return
|
|
7282
|
+
return path22.join(codexStateRoot(options, codexPluginCwd()), CODEX_CONFIG_FILE);
|
|
7329
7283
|
}
|
|
7330
7284
|
async function codexInstallPlugin(pluginRef, _scope, _projectDir, options) {
|
|
7331
7285
|
await installCodexPlugin(pluginRef, options);
|
|
@@ -7386,10 +7340,13 @@ async function codexListPlugins(projectDir, options) {
|
|
|
7386
7340
|
warnOnce(sayWhatCodexRefused("list the plugins it has installed", listing.reason));
|
|
7387
7341
|
return [];
|
|
7388
7342
|
}
|
|
7343
|
+
async function codexPluginsHeld(projectDir, options) {
|
|
7344
|
+
return (await codexPluginListing(options, projectDir)).map(({ pluginId }) => pluginId);
|
|
7345
|
+
}
|
|
7389
7346
|
async function codexPluginsOrUnreadable(projectDir, options) {
|
|
7390
|
-
const pluginsRoot =
|
|
7347
|
+
const pluginsRoot = pluginsRootFor(CODEX, projectDir, options);
|
|
7391
7348
|
if (pluginsRoot === null) return { kind: "listed", plugins: [] };
|
|
7392
|
-
const cacheRoot2 =
|
|
7349
|
+
const cacheRoot2 = path22.join(pluginsRoot, PLUGIN_CACHE_SUBDIR);
|
|
7393
7350
|
let installed;
|
|
7394
7351
|
try {
|
|
7395
7352
|
installed = await codexPluginListing(options, projectDir);
|
|
@@ -7401,7 +7358,7 @@ async function codexPluginsOrUnreadable(projectDir, options) {
|
|
|
7401
7358
|
kind: "listed",
|
|
7402
7359
|
plugins: installed.map((plugin) => ({
|
|
7403
7360
|
pluginKey: plugin.pluginId,
|
|
7404
|
-
installPath:
|
|
7361
|
+
installPath: path22.join(cacheRoot2, plugin.marketplaceName, plugin.name, plugin.version),
|
|
7405
7362
|
enabled: plugin.enabled
|
|
7406
7363
|
}))
|
|
7407
7364
|
};
|
|
@@ -7415,10 +7372,15 @@ function codexHost() {
|
|
|
7415
7372
|
marketplaceExists: codexMarketplaceExists,
|
|
7416
7373
|
addMarketplace: codexMarketplaceAdd,
|
|
7417
7374
|
refreshMarketplace: refreshCodexMarketplace,
|
|
7375
|
+
marketplaceTakeBack: {
|
|
7376
|
+
marketplacesHeld: codexMarketplacesHeld,
|
|
7377
|
+
removeMarketplace: codexMarketplaceRemove
|
|
7378
|
+
},
|
|
7418
7379
|
installPlugin: codexInstallPlugin,
|
|
7419
7380
|
updatePlugin: codexUpdatePlugin,
|
|
7420
7381
|
uninstallPlugin: codexUninstallPlugin,
|
|
7421
|
-
listPlugins: codexListPlugins
|
|
7382
|
+
listPlugins: codexListPlugins,
|
|
7383
|
+
pluginsHeld: codexPluginsHeld
|
|
7422
7384
|
};
|
|
7423
7385
|
}
|
|
7424
7386
|
|
|
@@ -7477,7 +7439,7 @@ function hostAt(root) {
|
|
|
7477
7439
|
|
|
7478
7440
|
// src/cli/lib/installation/mode-migrator.ts
|
|
7479
7441
|
function ejectCopyFailureError(failedCount) {
|
|
7480
|
-
return `Failed to copy ${failedCount
|
|
7442
|
+
return `Failed to copy ${plural(failedCount, "skill")} for eject. Eject intent could not be honored. Check that the destination skills directory is writable, then apply the same id again with '${CLI_INVOKE_COMMAND} edit --from <id>' \u2014 or switch the affected skills back to plugin mode.`;
|
|
7481
7443
|
}
|
|
7482
7444
|
function copyingBesideGlobalPlugins(count) {
|
|
7483
7445
|
const kept = count === 1 ? "the global plugin stays" : "the global plugins stay";
|
|
@@ -7627,7 +7589,8 @@ async function getInstallationInfo() {
|
|
|
7627
7589
|
skillCount: loaded ? countManagedSkills(loaded.config) : 0,
|
|
7628
7590
|
agentCount: sumCounts(agentDirCounts),
|
|
7629
7591
|
configPath: installation.configPath,
|
|
7630
|
-
agentDirs: agentDirCounts.filter(hasEntries).map((scopeCount) => scopeCount.dir)
|
|
7592
|
+
agentDirs: agentDirCounts.filter(hasEntries).map((scopeCount) => scopeCount.dir),
|
|
7593
|
+
...loaded?.config.marketplace !== void 0 && { marketplace: loaded.config.marketplace }
|
|
7631
7594
|
};
|
|
7632
7595
|
}
|
|
7633
7596
|
async function getInstallationsByProvider(cwd) {
|
|
@@ -7652,10 +7615,9 @@ async function withItsConfig(installed, cwd) {
|
|
|
7652
7615
|
}
|
|
7653
7616
|
async function describeInstallation({ provider, scope, config }, cwd) {
|
|
7654
7617
|
const scopes = scope === "global" ? ["global"] : ["global", "project"];
|
|
7655
|
-
const { extension } = agentCodec(provider);
|
|
7656
7618
|
const counts = await Promise.all(
|
|
7657
7619
|
scopes.map(
|
|
7658
|
-
(agentScope) =>
|
|
7620
|
+
(agentScope) => countCompiledAgentsIn(agentsDir(provider, agentScope, cwd), provider)
|
|
7659
7621
|
)
|
|
7660
7622
|
);
|
|
7661
7623
|
return {
|
|
@@ -7680,24 +7642,18 @@ function sumCounts(scopeCounts) {
|
|
|
7680
7642
|
return scopeCounts.reduce((total, scopeCount) => total + scopeCount.count, 0);
|
|
7681
7643
|
}
|
|
7682
7644
|
async function countCompiledAgentsPerScope(installation, scopes) {
|
|
7683
|
-
return Promise.all(
|
|
7684
|
-
scopes.map(async (scope) => {
|
|
7685
|
-
const provider = providerAtScope(installation.projectDir, scope);
|
|
7686
|
-
const dir = agentsDir(provider, scope, installation.projectDir);
|
|
7687
|
-
return {
|
|
7688
|
-
dir,
|
|
7689
|
-
count: await countDirEntries(dir, isCompiledAgentFileIn(agentCodec(provider).extension))
|
|
7690
|
-
};
|
|
7691
|
-
})
|
|
7692
|
-
);
|
|
7645
|
+
return Promise.all(scopes.map((scope) => countCompiledAgentsAt(installation.projectDir, scope)));
|
|
7693
7646
|
}
|
|
7694
|
-
function
|
|
7695
|
-
|
|
7647
|
+
async function countCompiledAgentsAt(projectDir, scope) {
|
|
7648
|
+
const provider = providerAtScope(projectDir, scope);
|
|
7649
|
+
const dir = agentsDir(provider, scope, projectDir);
|
|
7650
|
+
return { dir, count: await countCompiledAgentsIn(dir, provider) };
|
|
7696
7651
|
}
|
|
7697
|
-
async function
|
|
7652
|
+
async function countCompiledAgentsIn(dir, provider) {
|
|
7653
|
+
const { extension } = agentCodec(provider);
|
|
7698
7654
|
try {
|
|
7699
7655
|
const entries = await readdir(dir, { withFileTypes: true });
|
|
7700
|
-
return entries.filter(
|
|
7656
|
+
return entries.filter((entry) => entry.isFile() && entry.name.endsWith(extension)).length;
|
|
7701
7657
|
} catch {
|
|
7702
7658
|
return 0;
|
|
7703
7659
|
}
|
|
@@ -7707,163 +7663,111 @@ function formatInstallationDisplay(info, skillLines = []) {
|
|
|
7707
7663
|
${line2}`).join("");
|
|
7708
7664
|
const agentDirLines = info.agentDirs.map((dir) => `
|
|
7709
7665
|
Agents: ${dir}`).join("");
|
|
7666
|
+
const marketplaceLine = info.marketplace === void 0 ? "" : `
|
|
7667
|
+
Marketplace: ${info.marketplace}`;
|
|
7710
7668
|
return `Installation: ${info.name}
|
|
7711
|
-
Mode: ${INSTALL_MODE_LABELS[info.mode]}
|
|
7669
|
+
Mode: ${INSTALL_MODE_LABELS[info.mode]}${marketplaceLine}
|
|
7712
7670
|
Skills: ${info.skillCount}${namedSkillLines}
|
|
7713
7671
|
Agents: ${info.agentCount}
|
|
7714
7672
|
Config: ${info.configPath}${agentDirLines}`;
|
|
7715
7673
|
}
|
|
7716
7674
|
|
|
7717
7675
|
// src/cli/lib/plugins/plugin-validator.ts
|
|
7718
|
-
import
|
|
7719
|
-
|
|
7720
|
-
// src/cli/lib/validation-result.ts
|
|
7721
|
-
function validResult() {
|
|
7722
|
-
return { valid: true, errors: [], warnings: [] };
|
|
7723
|
-
}
|
|
7724
|
-
function invalidResult(message) {
|
|
7725
|
-
return { valid: false, errors: [message], warnings: [] };
|
|
7726
|
-
}
|
|
7727
|
-
function mergeValidationResults(results) {
|
|
7728
|
-
const errors = results.flatMap((r) => r.errors);
|
|
7729
|
-
const warnings = results.flatMap((r) => r.warnings);
|
|
7730
|
-
return { valid: errors.length === 0, errors, warnings };
|
|
7731
|
-
}
|
|
7732
|
-
|
|
7733
|
-
// src/cli/lib/plugins/plugin-validator.ts
|
|
7676
|
+
import path23 from "path";
|
|
7734
7677
|
var SEMVER_REGEX = /^(0|[1-9]\d*)\.(0|[1-9]\d*)\.(0|[1-9]\d*)(?:-((?:0|[1-9]\d*|\d*[a-zA-Z-][0-9a-zA-Z-]*)(?:\.(?:0|[1-9]\d*|\d*[a-zA-Z-][0-9a-zA-Z-]*))*))?(?:\+([0-9a-zA-Z-]+(?:\.[0-9a-zA-Z-]+)*))?$/;
|
|
7735
|
-
function isKebabCase(str) {
|
|
7736
|
-
return KEBAB_CASE_PATTERN.test(str);
|
|
7737
|
-
}
|
|
7738
|
-
function isValidSemver(str) {
|
|
7739
|
-
return SEMVER_REGEX.test(str);
|
|
7740
|
-
}
|
|
7741
7678
|
function isNonEmptyString(value) {
|
|
7742
7679
|
return typeof value === "string" && value !== "";
|
|
7743
7680
|
}
|
|
7744
7681
|
async function validatePluginStructure(pluginPath) {
|
|
7745
|
-
const errors = [];
|
|
7746
|
-
const warnings = [];
|
|
7747
7682
|
if (!await directoryExists2(pluginPath)) {
|
|
7748
7683
|
return invalidResult(`Plugin directory does not exist: ${pluginPath}`);
|
|
7749
7684
|
}
|
|
7750
|
-
const pluginDir =
|
|
7751
|
-
|
|
7752
|
-
|
|
7753
|
-
|
|
7754
|
-
|
|
7755
|
-
|
|
7756
|
-
|
|
7757
|
-
|
|
7758
|
-
|
|
7759
|
-
|
|
7760
|
-
|
|
7761
|
-
|
|
7762
|
-
|
|
7763
|
-
valid: errors.length === 0,
|
|
7764
|
-
errors,
|
|
7765
|
-
warnings
|
|
7766
|
-
};
|
|
7685
|
+
const pluginDir = path23.join(pluginPath, PLUGIN_MANIFEST_DIR);
|
|
7686
|
+
const [hasManifestDir, hasManifest, hasReadme] = await Promise.all([
|
|
7687
|
+
directoryExists2(pluginDir),
|
|
7688
|
+
fileExists(path23.join(pluginDir, STANDARD_FILES.PLUGIN_JSON)),
|
|
7689
|
+
fileExists(path23.join(pluginPath, STANDARD_FILES.README_MD))
|
|
7690
|
+
]);
|
|
7691
|
+
return resultFrom(
|
|
7692
|
+
[
|
|
7693
|
+
...hasManifestDir ? [] : [`Missing ${PLUGIN_MANIFEST_DIR}/ directory`],
|
|
7694
|
+
...hasManifest ? [] : [`Missing ${PLUGIN_MANIFEST_DIR}/${STANDARD_FILES.PLUGIN_JSON}`]
|
|
7695
|
+
],
|
|
7696
|
+
hasReadme ? [] : ["Missing README.md (recommended for documentation)"]
|
|
7697
|
+
);
|
|
7767
7698
|
}
|
|
7768
|
-
async function
|
|
7769
|
-
const errors = [];
|
|
7770
|
-
const warnings = [];
|
|
7771
|
-
let manifest;
|
|
7699
|
+
async function readManifestForValidation(manifestPath) {
|
|
7772
7700
|
try {
|
|
7773
|
-
const
|
|
7774
|
-
const parsed = JSON.parse(content);
|
|
7701
|
+
const parsed = JSON.parse(await readFileSafe(manifestPath, MAX_PLUGIN_FILE_SIZE));
|
|
7775
7702
|
if (!isRecord(parsed)) {
|
|
7776
|
-
return
|
|
7703
|
+
return {
|
|
7704
|
+
ok: false,
|
|
7705
|
+
refusal: invalidResult(`${STANDARD_FILES.PLUGIN_JSON} must contain a JSON object`)
|
|
7706
|
+
};
|
|
7777
7707
|
}
|
|
7778
|
-
manifest
|
|
7708
|
+
return { ok: true, manifest: parsed };
|
|
7779
7709
|
} catch (err) {
|
|
7780
|
-
return
|
|
7781
|
-
|
|
7782
|
-
|
|
7783
|
-
|
|
7784
|
-
|
|
7785
|
-
|
|
7786
|
-
if (isNonEmptyString(manifest.name)) {
|
|
7787
|
-
if (!isKebabCase(manifest.name)) {
|
|
7788
|
-
errors.push(`name must be kebab-case: "${manifest.name}"`);
|
|
7789
|
-
}
|
|
7790
|
-
}
|
|
7791
|
-
if (isNonEmptyString(manifest.version)) {
|
|
7792
|
-
if (!isValidSemver(manifest.version)) {
|
|
7793
|
-
errors.push(
|
|
7794
|
-
`version "${manifest.version}" is not valid semver (expected: major.minor.patch)`
|
|
7795
|
-
);
|
|
7796
|
-
}
|
|
7797
|
-
}
|
|
7798
|
-
if (!manifest.description) {
|
|
7799
|
-
warnings.push("Missing description field (recommended for discoverability)");
|
|
7800
|
-
}
|
|
7801
|
-
const pluginDir = path22.dirname(path22.dirname(manifestPath));
|
|
7802
|
-
if (isNonEmptyString(manifest.skills)) {
|
|
7803
|
-
const skillsPath = path22.join(pluginDir, manifest.skills);
|
|
7804
|
-
if (!await directoryExists2(skillsPath)) {
|
|
7805
|
-
errors.push(`Skills path does not exist: ${manifest.skills}`);
|
|
7806
|
-
}
|
|
7807
|
-
}
|
|
7808
|
-
if (isNonEmptyString(manifest.agents)) {
|
|
7809
|
-
const agentsPath = path22.join(pluginDir, manifest.agents);
|
|
7810
|
-
if (!await directoryExists2(agentsPath)) {
|
|
7811
|
-
errors.push(`Agents path does not exist: ${manifest.agents}`);
|
|
7812
|
-
}
|
|
7710
|
+
return {
|
|
7711
|
+
ok: false,
|
|
7712
|
+
refusal: invalidResult(
|
|
7713
|
+
`Invalid JSON in ${STANDARD_FILES.PLUGIN_JSON}: ${getErrorMessage(err)}`
|
|
7714
|
+
)
|
|
7715
|
+
};
|
|
7813
7716
|
}
|
|
7814
|
-
|
|
7815
|
-
|
|
7816
|
-
|
|
7817
|
-
|
|
7818
|
-
|
|
7717
|
+
}
|
|
7718
|
+
async function validateManifestFields(manifest, pluginDir) {
|
|
7719
|
+
const [skillsPathErrors, agentsPathErrors] = await Promise.all([
|
|
7720
|
+
missingDeclaredPathErrors(pluginDir, manifest.skills, "Skills"),
|
|
7721
|
+
missingDeclaredPathErrors(pluginDir, manifest.agents, "Agents")
|
|
7722
|
+
]);
|
|
7723
|
+
return resultFrom(
|
|
7724
|
+
[
|
|
7725
|
+
...schemaErrors(pluginManifestValidationSchema, manifest),
|
|
7726
|
+
...kebabNameErrors(manifest.name),
|
|
7727
|
+
...semverErrors(manifest.version),
|
|
7728
|
+
...skillsPathErrors,
|
|
7729
|
+
...agentsPathErrors
|
|
7730
|
+
],
|
|
7731
|
+
manifest.description ? [] : ["Missing description field (recommended for discoverability)"]
|
|
7732
|
+
);
|
|
7733
|
+
}
|
|
7734
|
+
function schemaErrors(schema, value) {
|
|
7735
|
+
const result = schema.safeParse(value);
|
|
7736
|
+
return result.success ? [] : formatZodErrors(result.error);
|
|
7737
|
+
}
|
|
7738
|
+
function kebabNameErrors(name) {
|
|
7739
|
+
return isNonEmptyString(name) && !KEBAB_CASE_PATTERN.test(name) ? [`name must be kebab-case: "${name}"`] : [];
|
|
7740
|
+
}
|
|
7741
|
+
function semverErrors(version) {
|
|
7742
|
+
return isNonEmptyString(version) && !SEMVER_REGEX.test(version) ? [`version "${version}" is not valid semver (expected: major.minor.patch)`] : [];
|
|
7743
|
+
}
|
|
7744
|
+
async function missingDeclaredPathErrors(pluginDir, declaredRelPath, label) {
|
|
7745
|
+
if (!isNonEmptyString(declaredRelPath)) return [];
|
|
7746
|
+
if (await directoryExists2(path23.join(pluginDir, declaredRelPath))) return [];
|
|
7747
|
+
return [`${label} path does not exist: ${declaredRelPath}`];
|
|
7819
7748
|
}
|
|
7820
7749
|
async function validateSkillFrontmatter(skillPath) {
|
|
7821
|
-
|
|
7822
|
-
|
|
7823
|
-
|
|
7824
|
-
|
|
7825
|
-
|
|
7826
|
-
const content = await readFile(skillPath);
|
|
7827
|
-
const frontmatter = extractFrontmatter(content);
|
|
7828
|
-
if (frontmatter === null) {
|
|
7829
|
-
return invalidResult("Missing or invalid YAML frontmatter");
|
|
7830
|
-
}
|
|
7831
|
-
const result = skillFrontmatterValidationSchema.safeParse(frontmatter);
|
|
7832
|
-
if (!result.success) {
|
|
7833
|
-
errors.push(...formatZodErrors(result.error));
|
|
7834
|
-
}
|
|
7835
|
-
return {
|
|
7836
|
-
valid: errors.length === 0,
|
|
7837
|
-
errors,
|
|
7838
|
-
warnings
|
|
7839
|
-
};
|
|
7750
|
+
return validateFrontmatterFile(
|
|
7751
|
+
skillPath,
|
|
7752
|
+
"Skill",
|
|
7753
|
+
(frontmatter) => schemaErrors(skillFrontmatterValidationSchema, frontmatter)
|
|
7754
|
+
);
|
|
7840
7755
|
}
|
|
7841
7756
|
async function validateAgentFrontmatter(agentPath) {
|
|
7842
|
-
|
|
7843
|
-
|
|
7844
|
-
|
|
7845
|
-
|
|
7757
|
+
return validateFrontmatterFile(agentPath, "Agent", (frontmatter) => [
|
|
7758
|
+
...schemaErrors(agentFrontmatterValidationSchema, frontmatter),
|
|
7759
|
+
...kebabNameErrors(isRecord(frontmatter) ? frontmatter.name : void 0)
|
|
7760
|
+
]);
|
|
7761
|
+
}
|
|
7762
|
+
async function validateFrontmatterFile(filePath, kind, frontmatterErrors) {
|
|
7763
|
+
if (!await fileExists(filePath)) {
|
|
7764
|
+
return invalidResult(`${kind} file not found: ${filePath}`);
|
|
7846
7765
|
}
|
|
7847
|
-
const
|
|
7848
|
-
const frontmatter = extractFrontmatter(content);
|
|
7766
|
+
const frontmatter = extractFrontmatter(await readFile(filePath));
|
|
7849
7767
|
if (frontmatter === null) {
|
|
7850
7768
|
return invalidResult("Missing or invalid YAML frontmatter");
|
|
7851
7769
|
}
|
|
7852
|
-
|
|
7853
|
-
if (!result.success) {
|
|
7854
|
-
errors.push(...formatZodErrors(result.error));
|
|
7855
|
-
}
|
|
7856
|
-
const fm = frontmatter;
|
|
7857
|
-
if (isNonEmptyString(fm.name)) {
|
|
7858
|
-
if (!isKebabCase(fm.name)) {
|
|
7859
|
-
errors.push(`name must be kebab-case: "${fm.name}"`);
|
|
7860
|
-
}
|
|
7861
|
-
}
|
|
7862
|
-
return {
|
|
7863
|
-
valid: errors.length === 0,
|
|
7864
|
-
errors,
|
|
7865
|
-
warnings
|
|
7866
|
-
};
|
|
7770
|
+
return resultFrom(frontmatterErrors(frontmatter), []);
|
|
7867
7771
|
}
|
|
7868
7772
|
function prefixResult(result, prefix) {
|
|
7869
7773
|
return {
|
|
@@ -7875,70 +7779,41 @@ function prefixResult(result, prefix) {
|
|
|
7875
7779
|
async function validateEachFile(pluginPath, scannedDir, files, validate) {
|
|
7876
7780
|
const results = await Promise.all(
|
|
7877
7781
|
files.map(async (file) => {
|
|
7878
|
-
const filePath =
|
|
7879
|
-
return prefixResult(await validate(filePath),
|
|
7782
|
+
const filePath = path23.join(scannedDir, file);
|
|
7783
|
+
return prefixResult(await validate(filePath), path23.relative(pluginPath, filePath));
|
|
7880
7784
|
})
|
|
7881
7785
|
);
|
|
7882
7786
|
return mergeValidationResults(results);
|
|
7883
7787
|
}
|
|
7884
|
-
|
|
7885
|
-
|
|
7886
|
-
|
|
7887
|
-
|
|
7888
|
-
|
|
7889
|
-
|
|
7890
|
-
|
|
7891
|
-
|
|
7892
|
-
|
|
7893
|
-
|
|
7894
|
-
}
|
|
7895
|
-
return validateEachFile(pluginPath, skillsDir2, files, validateSkillFrontmatter);
|
|
7896
|
-
}
|
|
7897
|
-
async function validatePluginAgentFiles(pluginPath, agentsRelPath) {
|
|
7898
|
-
const agentsDir2 = path22.join(pluginPath, agentsRelPath);
|
|
7899
|
-
if (!await directoryExists2(agentsDir2)) return validResult();
|
|
7900
|
-
const files = await glob(agentCodec("claude").listGlob, agentsDir2);
|
|
7901
|
-
if (files.length === 0) {
|
|
7902
|
-
return {
|
|
7903
|
-
valid: true,
|
|
7904
|
-
errors: [],
|
|
7905
|
-
warnings: [`Agents directory exists but contains no .md files: ${agentsRelPath}`]
|
|
7906
|
-
};
|
|
7907
|
-
}
|
|
7908
|
-
return validateEachFile(pluginPath, agentsDir2, files, validateAgentFrontmatter);
|
|
7909
|
-
}
|
|
7910
|
-
async function loadManifestForValidation(manifestPath) {
|
|
7911
|
-
try {
|
|
7912
|
-
const content = await readFileSafe(manifestPath, MAX_PLUGIN_FILE_SIZE);
|
|
7913
|
-
const parsed = JSON.parse(content);
|
|
7914
|
-
return isRecord(parsed) ? parsed : null;
|
|
7915
|
-
} catch {
|
|
7916
|
-
return null;
|
|
7917
|
-
}
|
|
7918
|
-
}
|
|
7788
|
+
var SKILL_FILE_SCAN = {
|
|
7789
|
+
pattern: `**/${STANDARD_FILES.SKILL_MD}`,
|
|
7790
|
+
emptyDirWarning: "Skills directory exists but contains no SKILL.md files",
|
|
7791
|
+
validate: validateSkillFrontmatter
|
|
7792
|
+
};
|
|
7793
|
+
var AGENT_FILE_SCAN = {
|
|
7794
|
+
pattern: agentCodec("claude").listGlob,
|
|
7795
|
+
emptyDirWarning: "Agents directory exists but contains no .md files",
|
|
7796
|
+
validate: validateAgentFrontmatter
|
|
7797
|
+
};
|
|
7919
7798
|
async function validatePlugin(pluginPath) {
|
|
7920
7799
|
const structureResult = await validatePluginStructure(pluginPath);
|
|
7921
7800
|
if (!structureResult.valid) return structureResult;
|
|
7922
|
-
const
|
|
7923
|
-
|
|
7924
|
-
|
|
7925
|
-
|
|
7801
|
+
const read = await readManifestForValidation(getPluginManifestPath(pluginPath));
|
|
7802
|
+
if (!read.ok) return mergeValidationResults([structureResult, read.refusal]);
|
|
7803
|
+
const contentResults = await Promise.all([
|
|
7804
|
+
validateManifestFields(read.manifest, pluginPath),
|
|
7805
|
+
validateDeclaredFiles(pluginPath, read.manifest.skills, SKILL_FILE_SCAN),
|
|
7806
|
+
validateDeclaredFiles(pluginPath, read.manifest.agents, AGENT_FILE_SCAN)
|
|
7926
7807
|
]);
|
|
7927
|
-
|
|
7928
|
-
pluginPath,
|
|
7929
|
-
manifest?.skills,
|
|
7930
|
-
validatePluginSkillFiles
|
|
7931
|
-
);
|
|
7932
|
-
const agentsResult = await validateDeclaredDir(
|
|
7933
|
-
pluginPath,
|
|
7934
|
-
manifest?.agents,
|
|
7935
|
-
validatePluginAgentFiles
|
|
7936
|
-
);
|
|
7937
|
-
return mergeValidationResults([structureResult, manifestResult, skillsResult, agentsResult]);
|
|
7808
|
+
return mergeValidationResults([structureResult, ...contentResults]);
|
|
7938
7809
|
}
|
|
7939
|
-
async function
|
|
7810
|
+
async function validateDeclaredFiles(pluginPath, declaredRelPath, scan) {
|
|
7940
7811
|
if (!isNonEmptyString(declaredRelPath)) return validResult();
|
|
7941
|
-
|
|
7812
|
+
const scannedDir = path23.join(pluginPath, declaredRelPath);
|
|
7813
|
+
if (!await directoryExists2(scannedDir)) return validResult();
|
|
7814
|
+
const files = await glob(scan.pattern, scannedDir);
|
|
7815
|
+
if (files.length === 0) return resultFrom([], [`${scan.emptyDirWarning}: ${declaredRelPath}`]);
|
|
7816
|
+
return validateEachFile(pluginPath, scannedDir, files, scan.validate);
|
|
7942
7817
|
}
|
|
7943
7818
|
async function validateAllPlugins(pluginsDir2) {
|
|
7944
7819
|
if (!await directoryExists2(pluginsDir2)) {
|
|
@@ -7966,18 +7841,18 @@ async function listPluginDirNames(pluginsDir2) {
|
|
|
7966
7841
|
const dirChecks = await Promise.all(
|
|
7967
7842
|
allDirs.map(async (dirName) => ({
|
|
7968
7843
|
dirName,
|
|
7969
|
-
isPlugin: await directoryExists2(
|
|
7844
|
+
isPlugin: await directoryExists2(path23.join(pluginsDir2, dirName, PLUGIN_MANIFEST_DIR))
|
|
7970
7845
|
}))
|
|
7971
7846
|
);
|
|
7972
7847
|
return dirChecks.filter((c) => c.isPlugin).map((c) => c.dirName);
|
|
7973
7848
|
}
|
|
7974
7849
|
async function validateEachPlugin(pluginsDir2, pluginDirs) {
|
|
7975
|
-
|
|
7976
|
-
|
|
7977
|
-
|
|
7978
|
-
|
|
7979
|
-
|
|
7980
|
-
|
|
7850
|
+
return Promise.all(
|
|
7851
|
+
pluginDirs.map(async (name) => ({
|
|
7852
|
+
name,
|
|
7853
|
+
result: await validatePlugin(path23.join(pluginsDir2, name))
|
|
7854
|
+
}))
|
|
7855
|
+
);
|
|
7981
7856
|
}
|
|
7982
7857
|
function summarizePluginValidations(results) {
|
|
7983
7858
|
const validCount = results.filter((r) => r.result.valid).length;
|
|
@@ -7996,17 +7871,35 @@ function summarizePluginValidations(results) {
|
|
|
7996
7871
|
|
|
7997
7872
|
// src/cli/lib/plugins/plugin-discovery.ts
|
|
7998
7873
|
async function getVerifiedPluginInstallPaths(projectDir, provider = providerInUse(projectDir)) {
|
|
7999
|
-
|
|
7874
|
+
return (await getPluginsBySwitch(projectDir, provider)).enabled;
|
|
7875
|
+
}
|
|
7876
|
+
async function getPluginsBySwitch(projectDir, provider = providerInUse(projectDir)) {
|
|
7877
|
+
const installed = await listInstalledPlugins(projectDir, provider);
|
|
7878
|
+
if (installed === null) return { enabled: [], switchedOff: [] };
|
|
7879
|
+
return {
|
|
7880
|
+
enabled: await verifiedOnDisk(installed.filter((plugin) => plugin.enabled).map(toResolved)),
|
|
7881
|
+
switchedOff: switchedOffPlugins(installed, provider)
|
|
7882
|
+
};
|
|
7883
|
+
}
|
|
7884
|
+
function switchedOffPlugins(installed, provider) {
|
|
7885
|
+
if (provider !== "codex") return [];
|
|
7886
|
+
return installed.filter((plugin) => !plugin.enabled).map(toResolved);
|
|
7887
|
+
}
|
|
7888
|
+
async function listInstalledPlugins(projectDir, provider) {
|
|
8000
7889
|
try {
|
|
8001
|
-
|
|
8002
|
-
enabled = installed.filter((plugin) => plugin.enabled).map(({ pluginKey, installPath }) => ({ pluginKey, installPath }));
|
|
7890
|
+
return await hostFor(provider).listPlugins(projectDir);
|
|
8003
7891
|
} catch (error) {
|
|
8004
7892
|
verbose(`Failed to list installed plugins: ${getErrorMessage(error)}`);
|
|
8005
|
-
return
|
|
7893
|
+
return null;
|
|
8006
7894
|
}
|
|
8007
|
-
|
|
8008
|
-
|
|
8009
|
-
|
|
7895
|
+
}
|
|
7896
|
+
function toResolved({ pluginKey, installPath }) {
|
|
7897
|
+
return { pluginKey, installPath };
|
|
7898
|
+
}
|
|
7899
|
+
async function verifiedOnDisk(plugins) {
|
|
7900
|
+
const onDisk = await Promise.all(plugins.map(hasManifestOnDisk));
|
|
7901
|
+
const verified = plugins.filter((_, index) => onDisk[index] === true);
|
|
7902
|
+
verbose(`Verified ${plural(verified.length, "plugin install path")}`);
|
|
8010
7903
|
return verified;
|
|
8011
7904
|
}
|
|
8012
7905
|
async function hasManifestOnDisk({ pluginKey, installPath }) {
|
|
@@ -8052,16 +7945,47 @@ async function listPluginNames(projectDir) {
|
|
|
8052
7945
|
return pluginPaths.map(({ pluginKey }) => pluginKey);
|
|
8053
7946
|
}
|
|
8054
7947
|
|
|
7948
|
+
// src/cli/lib/plugins/earlier-build.ts
|
|
7949
|
+
import path24 from "path";
|
|
7950
|
+
async function isEarlierBuild(pluginDir) {
|
|
7951
|
+
return fileExists(getPluginManifestPath(pluginDir));
|
|
7952
|
+
}
|
|
7953
|
+
async function holdsContentNoBuildMade(pluginDir) {
|
|
7954
|
+
if (await isEarlierBuild(pluginDir)) return false;
|
|
7955
|
+
return !await isDirectoryEmpty(pluginDir);
|
|
7956
|
+
}
|
|
7957
|
+
async function refuseContentNoBuildMade(pluginDir, subject, file) {
|
|
7958
|
+
if (!await holdsContentNoBuildMade(pluginDir)) return;
|
|
7959
|
+
throw new Error(
|
|
7960
|
+
`${subject} would be built into ${pluginDir}, which holds no ${path24.join(PLUGIN_MANIFEST_DIR, PLUGIN_MANIFEST_FILE)} and is not empty, so no earlier build made it and a rebuild would delete what it holds. Move its contents out, or build into another output directory. ${file}`
|
|
7961
|
+
);
|
|
7962
|
+
}
|
|
7963
|
+
async function clearEarlierBuild(pluginDir) {
|
|
7964
|
+
if (await isEarlierBuild(pluginDir)) await remove(pluginDir);
|
|
7965
|
+
}
|
|
7966
|
+
async function rebuildPlugin(pluginDir, { manifestAt, computeContentHash, writeContents }) {
|
|
7967
|
+
const earlierBuild = await readEarlierBuild(pluginDir, getPluginManifestPath);
|
|
7968
|
+
await clearEarlierBuild(pluginDir);
|
|
7969
|
+
await writePluginManifest(pluginDir, manifestAt(earlierBuild?.version ?? DEFAULT_VERSION));
|
|
7970
|
+
await writeContentHash(pluginDir, await computeContentHash(), getPluginManifestPath);
|
|
7971
|
+
await writeContents();
|
|
7972
|
+
const manifest = manifestAt(
|
|
7973
|
+
versionAfterRebuild(earlierBuild, await computeShippedHash(pluginDir))
|
|
7974
|
+
);
|
|
7975
|
+
await writePluginManifest(pluginDir, manifest);
|
|
7976
|
+
return manifest;
|
|
7977
|
+
}
|
|
7978
|
+
|
|
8055
7979
|
// src/cli/lib/skills/skill-plugin-compiler.ts
|
|
8056
7980
|
function sanitizeSkillName(name) {
|
|
8057
7981
|
return name.replace(/\+/g, "-");
|
|
8058
7982
|
}
|
|
8059
7983
|
function isSingleFolderName(name) {
|
|
8060
|
-
return name !== "" && name !== "." && name !== ".." &&
|
|
7984
|
+
return name !== "" && name !== "." && name !== ".." && path25.basename(name) === name;
|
|
8061
7985
|
}
|
|
8062
7986
|
async function assertClearable(pluginDir, skillPath, skillName2) {
|
|
8063
|
-
const skill = `Skill '${
|
|
8064
|
-
const file = `File: ${
|
|
7987
|
+
const skill = `Skill '${path25.basename(skillPath)}'`;
|
|
7988
|
+
const file = `File: ${path25.join(skillPath, STANDARD_FILES.SKILL_MD)}`;
|
|
8065
7989
|
if (!isSingleFolderName(skillName2)) {
|
|
8066
7990
|
throw new Error(
|
|
8067
7991
|
`${skill} is named '${skillName2}', which is not a single folder name, so its plugin cannot be built inside the output directory. ${file}`
|
|
@@ -8072,14 +7996,10 @@ async function assertClearable(pluginDir, skillPath, skillName2) {
|
|
|
8072
7996
|
`${skill} would be built into ${pluginDir}, which holds its own source, so building it would overwrite that source. Build into an output directory outside the skills directory. ${file}`
|
|
8073
7997
|
);
|
|
8074
7998
|
}
|
|
8075
|
-
|
|
8076
|
-
throw new Error(
|
|
8077
|
-
`${skill} would be built into ${pluginDir}, which holds no ${path23.join(PLUGIN_MANIFEST_DIR, PLUGIN_MANIFEST_FILE)} and is not empty, so no earlier build made it and a rebuild would delete what it holds. Move its contents out, or build into another output directory. ${file}`
|
|
8078
|
-
);
|
|
8079
|
-
}
|
|
7999
|
+
await refuseContentNoBuildMade(pluginDir, skill, file);
|
|
8080
8000
|
}
|
|
8081
8001
|
async function readPluginSkillMetadata(skillPath) {
|
|
8082
|
-
const metadataPath =
|
|
8002
|
+
const metadataPath = path25.join(skillPath, STANDARD_FILES.METADATA_YAML);
|
|
8083
8003
|
if (!await fileExists(metadataPath)) {
|
|
8084
8004
|
return null;
|
|
8085
8005
|
}
|
|
@@ -8123,28 +8043,28 @@ This skill is automatically available when installed.
|
|
|
8123
8043
|
}
|
|
8124
8044
|
async function writeSkillFiles(skillPath, pluginSkillDir, skillMdContent) {
|
|
8125
8045
|
await ensureDir(pluginSkillDir);
|
|
8126
|
-
await writeFile(
|
|
8046
|
+
await writeFile(path25.join(pluginSkillDir, STANDARD_FILES.SKILL_MD), skillMdContent);
|
|
8127
8047
|
verbose(` Copied ${STANDARD_FILES.SKILL_MD}`);
|
|
8128
8048
|
for (const fileName of SKILL_CONTENT_FILES) {
|
|
8129
8049
|
if (fileName === STANDARD_FILES.SKILL_MD) continue;
|
|
8130
|
-
const sourcePath =
|
|
8050
|
+
const sourcePath = path25.join(skillPath, fileName);
|
|
8131
8051
|
if (await fileExists(sourcePath)) {
|
|
8132
8052
|
const content = await readFile(sourcePath);
|
|
8133
|
-
await writeFile(
|
|
8053
|
+
await writeFile(path25.join(pluginSkillDir, fileName), content);
|
|
8134
8054
|
verbose(` Copied ${fileName}`);
|
|
8135
8055
|
}
|
|
8136
8056
|
}
|
|
8137
8057
|
for (const dirName of SKILL_CONTENT_DIRS) {
|
|
8138
|
-
const sourceDir2 =
|
|
8058
|
+
const sourceDir2 = path25.join(skillPath, dirName);
|
|
8139
8059
|
if (await fileExists(sourceDir2)) {
|
|
8140
|
-
await copy(sourceDir2,
|
|
8060
|
+
await copy(sourceDir2, path25.join(pluginSkillDir, dirName));
|
|
8141
8061
|
verbose(` Copied ${dirName}/`);
|
|
8142
8062
|
}
|
|
8143
8063
|
}
|
|
8144
8064
|
}
|
|
8145
8065
|
async function readSkillMdToBuild(skillPath) {
|
|
8146
|
-
const dirBasename =
|
|
8147
|
-
const skillMdPath =
|
|
8066
|
+
const dirBasename = path25.basename(skillPath);
|
|
8067
|
+
const skillMdPath = path25.join(skillPath, STANDARD_FILES.SKILL_MD);
|
|
8148
8068
|
if (!await fileExists(skillMdPath)) {
|
|
8149
8069
|
throw new Error(
|
|
8150
8070
|
`Skill '${dirBasename}' is missing required ${STANDARD_FILES.SKILL_MD} file. Expected at: ${skillMdPath}`
|
|
@@ -8159,37 +8079,36 @@ async function readSkillMdToBuild(skillPath) {
|
|
|
8159
8079
|
}
|
|
8160
8080
|
return { skillMdContent, frontmatter };
|
|
8161
8081
|
}
|
|
8082
|
+
async function writePluginContents(pluginDir, skillName2, skillPath, { skillMdContent, frontmatter }) {
|
|
8083
|
+
await writeSkillFiles(
|
|
8084
|
+
skillPath,
|
|
8085
|
+
path25.join(pluginDir, STANDARD_DIRS.SKILLS, skillName2),
|
|
8086
|
+
skillMdContent
|
|
8087
|
+
);
|
|
8088
|
+
const readme = generateReadme(skillName2, frontmatter);
|
|
8089
|
+
await writeFile(path25.join(pluginDir, STANDARD_FILES.README_MD), readme);
|
|
8090
|
+
verbose(" Generated README.md");
|
|
8091
|
+
}
|
|
8162
8092
|
async function compileSkillPlugin(options) {
|
|
8163
8093
|
const { skillPath, outputDir, skillName: overrideName } = options;
|
|
8164
|
-
const
|
|
8094
|
+
const skillMd = await readSkillMdToBuild(skillPath);
|
|
8095
|
+
const { frontmatter } = skillMd;
|
|
8165
8096
|
const skillName2 = overrideName ?? sanitizeSkillName(frontmatter.name);
|
|
8166
|
-
const pluginDir =
|
|
8097
|
+
const pluginDir = path25.join(outputDir, skillName2);
|
|
8167
8098
|
await assertClearable(pluginDir, skillPath, skillName2);
|
|
8168
8099
|
verbose(`Compiling skill plugin: ${skillName2} from ${skillPath}`);
|
|
8169
8100
|
const metadata = await readPluginSkillMetadata(skillPath);
|
|
8170
|
-
const
|
|
8171
|
-
|
|
8172
|
-
|
|
8173
|
-
|
|
8174
|
-
|
|
8175
|
-
|
|
8101
|
+
const manifest = await rebuildPlugin(pluginDir, {
|
|
8102
|
+
manifestAt: (version) => generateSkillPluginManifest({
|
|
8103
|
+
skillName: skillName2,
|
|
8104
|
+
description: frontmatter.description,
|
|
8105
|
+
...metadata?.author !== void 0 && { author: metadata.author },
|
|
8106
|
+
...metadata?.category !== void 0 && { category: metadata.category },
|
|
8107
|
+
version
|
|
8108
|
+
}),
|
|
8109
|
+
computeContentHash: () => computeSkillFolderHash(skillPath),
|
|
8110
|
+
writeContents: () => writePluginContents(pluginDir, skillName2, skillPath, skillMd)
|
|
8176
8111
|
});
|
|
8177
|
-
const earlierBuild = await readEarlierBuild(pluginDir, getPluginManifestPath);
|
|
8178
|
-
await clearEarlierBuild(pluginDir);
|
|
8179
|
-
await writePluginManifest(pluginDir, manifestAt(earlierBuild?.version ?? DEFAULT_VERSION));
|
|
8180
|
-
await writeContentHash(pluginDir, await computeSkillFolderHash(skillPath), getPluginManifestPath);
|
|
8181
|
-
await writeSkillFiles(
|
|
8182
|
-
skillPath,
|
|
8183
|
-
path23.join(pluginDir, STANDARD_DIRS.SKILLS, skillName2),
|
|
8184
|
-
skillMdContent
|
|
8185
|
-
);
|
|
8186
|
-
const readme = generateReadme(skillName2, frontmatter);
|
|
8187
|
-
await writeFile(path23.join(pluginDir, STANDARD_FILES.README_MD), readme);
|
|
8188
|
-
verbose(" Generated README.md");
|
|
8189
|
-
const manifest = manifestAt(
|
|
8190
|
-
versionAfterRebuild(earlierBuild, await computeShippedHash(pluginDir))
|
|
8191
|
-
);
|
|
8192
|
-
await writePluginManifest(pluginDir, manifest);
|
|
8193
8112
|
verbose(` Wrote plugin.json for ${skillName2} (v${manifest.version})`);
|
|
8194
8113
|
return {
|
|
8195
8114
|
pluginPath: pluginDir,
|
|
@@ -8202,7 +8121,7 @@ async function compileAllSkillPlugins(skillsDir2, outputDir) {
|
|
|
8202
8121
|
const failed = [];
|
|
8203
8122
|
const skillMdFiles = await glob(`**/${STANDARD_FILES.SKILL_MD}`, skillsDir2);
|
|
8204
8123
|
for (const skillMdFile of skillMdFiles) {
|
|
8205
|
-
const skillPath =
|
|
8124
|
+
const skillPath = path25.join(skillsDir2, path25.dirname(skillMdFile));
|
|
8206
8125
|
try {
|
|
8207
8126
|
const result = await compileSkillPlugin({
|
|
8208
8127
|
skillPath,
|
|
@@ -8212,7 +8131,7 @@ async function compileAllSkillPlugins(skillsDir2, outputDir) {
|
|
|
8212
8131
|
log(` [OK] ${result.skillName}`);
|
|
8213
8132
|
} catch (error) {
|
|
8214
8133
|
const errorMessage = getErrorMessage(error);
|
|
8215
|
-
const dirBasename =
|
|
8134
|
+
const dirBasename = path25.basename(skillPath);
|
|
8216
8135
|
failed.push(dirBasename);
|
|
8217
8136
|
warn(`Failed to compile skill from '${dirBasename}': ${errorMessage}`);
|
|
8218
8137
|
}
|
|
@@ -8228,9 +8147,9 @@ Compiled ${plural(results.length, "skill plugin")}:`);
|
|
|
8228
8147
|
}
|
|
8229
8148
|
|
|
8230
8149
|
// src/cli/lib/skills/local-skill-loader.ts
|
|
8231
|
-
import
|
|
8150
|
+
import path26 from "path";
|
|
8232
8151
|
function copiedInSkillsAt(root, provider) {
|
|
8233
|
-
const scope =
|
|
8152
|
+
const scope = scopeAt(root);
|
|
8234
8153
|
return {
|
|
8235
8154
|
dir: skillsDir(provider, scope, root),
|
|
8236
8155
|
pathPrefix: skillsPathPrefix(provider, scope, root)
|
|
@@ -8254,9 +8173,9 @@ async function discoverLocalSkills(root, provider = providerInUse(root)) {
|
|
|
8254
8173
|
};
|
|
8255
8174
|
}
|
|
8256
8175
|
async function extractLocalSkill(localSkillsPath, pathPrefix, skillDirName) {
|
|
8257
|
-
const skillDir =
|
|
8258
|
-
const metadataPath =
|
|
8259
|
-
const skillMdPath =
|
|
8176
|
+
const skillDir = path26.join(localSkillsPath, skillDirName);
|
|
8177
|
+
const metadataPath = path26.join(skillDir, STANDARD_FILES.METADATA_YAML);
|
|
8178
|
+
const skillMdPath = path26.join(skillDir, STANDARD_FILES.SKILL_MD);
|
|
8260
8179
|
if (!await fileExists(metadataPath)) {
|
|
8261
8180
|
verbose(`Skipping local skill '${skillDirName}': No metadata.yaml found`);
|
|
8262
8181
|
return null;
|
|
@@ -8286,7 +8205,7 @@ async function extractLocalSkill(localSkillsPath, pathPrefix, skillDirName) {
|
|
|
8286
8205
|
return null;
|
|
8287
8206
|
}
|
|
8288
8207
|
const relativePath = `${pathPrefix}/${skillDirName}/`;
|
|
8289
|
-
const absolutePath =
|
|
8208
|
+
const absolutePath = path26.join(localSkillsPath, skillDirName) + path26.sep;
|
|
8290
8209
|
const skillId = frontmatter.name;
|
|
8291
8210
|
const extracted = {
|
|
8292
8211
|
id: skillId,
|
|
@@ -8309,7 +8228,7 @@ async function extractLocalSkill(localSkillsPath, pathPrefix, skillDirName) {
|
|
|
8309
8228
|
}
|
|
8310
8229
|
|
|
8311
8230
|
// src/cli/lib/skills/unresolved-skill-entries.ts
|
|
8312
|
-
import
|
|
8231
|
+
import path27 from "path";
|
|
8313
8232
|
async function findUnusableSavedSkillMetadata(savedSkills, projectDir) {
|
|
8314
8233
|
const verdicts = await Promise.all(
|
|
8315
8234
|
savedSkills.map((saved) => unusableMetadataOf(saved, projectDir))
|
|
@@ -8328,11 +8247,11 @@ function claimsLocalCopy(saved) {
|
|
|
8328
8247
|
}
|
|
8329
8248
|
function installedMetadataPath(saved, projectDir) {
|
|
8330
8249
|
const { skillsDir: skillsDir2 } = resolveInstallPaths(projectDir, saved.scope);
|
|
8331
|
-
return
|
|
8250
|
+
return path27.join(skillsDir2, saved.id, STANDARD_FILES.METADATA_YAML);
|
|
8332
8251
|
}
|
|
8333
8252
|
|
|
8334
8253
|
// src/cli/lib/skills/local-skill-mover.ts
|
|
8335
|
-
import
|
|
8254
|
+
import path28 from "path";
|
|
8336
8255
|
var THE_DIRECTORY_ITSELF = ".";
|
|
8337
8256
|
function validateSkillId(skillId) {
|
|
8338
8257
|
return !(skillId.length === 0 || skillId === THE_DIRECTORY_ITSELF || skillId.includes("\0") || skillId.includes("..") || skillId.includes("/") || skillId.includes("\\"));
|
|
@@ -8342,8 +8261,8 @@ async function deleteLocalSkill(projectDir, skillId, scope = "project") {
|
|
|
8342
8261
|
warn(`Invalid skill ID for deletion: '${skillId}'`);
|
|
8343
8262
|
return;
|
|
8344
8263
|
}
|
|
8345
|
-
const skillsDir2 =
|
|
8346
|
-
const skillPath =
|
|
8264
|
+
const skillsDir2 = path28.resolve(resolveInstallPaths(projectDir, scope).skillsDir);
|
|
8265
|
+
const skillPath = path28.resolve(skillsDir2, skillId);
|
|
8347
8266
|
if (!isPathWithin(skillPath, skillsDir2)) {
|
|
8348
8267
|
warn(`Skill ID '${skillId}' resolves outside the skills directory.`);
|
|
8349
8268
|
return;
|
|
@@ -8361,10 +8280,10 @@ async function migrateLocalSkillScope(skillId, fromScope, projectDir) {
|
|
|
8361
8280
|
return;
|
|
8362
8281
|
}
|
|
8363
8282
|
const toScope = fromScope === "global" ? "project" : "global";
|
|
8364
|
-
const fromSkillsDir =
|
|
8365
|
-
const toSkillsDir =
|
|
8366
|
-
const fromPath =
|
|
8367
|
-
const toPath =
|
|
8283
|
+
const fromSkillsDir = path28.resolve(resolveInstallPaths(projectDir, fromScope).skillsDir);
|
|
8284
|
+
const toSkillsDir = path28.resolve(resolveInstallPaths(projectDir, toScope).skillsDir);
|
|
8285
|
+
const fromPath = path28.resolve(fromSkillsDir, skillId);
|
|
8286
|
+
const toPath = path28.resolve(toSkillsDir, skillId);
|
|
8368
8287
|
if (!isPathWithin(fromPath, fromSkillsDir)) {
|
|
8369
8288
|
warn(`Skill ID '${skillId}' resolves outside the source skills directory.`);
|
|
8370
8289
|
return;
|
|
@@ -8391,7 +8310,7 @@ async function migrateLocalSkillScope(skillId, fromScope, projectDir) {
|
|
|
8391
8310
|
|
|
8392
8311
|
// src/cli/lib/matrix/matrix-loader.ts
|
|
8393
8312
|
import { parse as parseYaml5 } from "yaml";
|
|
8394
|
-
import
|
|
8313
|
+
import path29 from "path";
|
|
8395
8314
|
async function loadSkillCategories(configPath) {
|
|
8396
8315
|
const data = await loadConfig(configPath, skillCategoriesFileSchema);
|
|
8397
8316
|
if (!data) {
|
|
@@ -8439,13 +8358,13 @@ async function extractAllSkills(skillsDir2) {
|
|
|
8439
8358
|
};
|
|
8440
8359
|
}
|
|
8441
8360
|
async function readSkillFolder(skillsDir2, metadataFile) {
|
|
8442
|
-
const skillDir =
|
|
8443
|
-
const skillMdPath =
|
|
8361
|
+
const skillDir = path29.dirname(metadataFile);
|
|
8362
|
+
const skillMdPath = path29.join(skillsDir2, skillDir, STANDARD_FILES.SKILL_MD);
|
|
8444
8363
|
if (!await fileExists(skillMdPath)) {
|
|
8445
8364
|
warn(`Skipping '${metadataFile}': No ${STANDARD_FILES.SKILL_MD} found`);
|
|
8446
8365
|
return { kind: "unnamed" };
|
|
8447
8366
|
}
|
|
8448
|
-
const metadata = await readMatrixMetadataOrWarn(metadataFile,
|
|
8367
|
+
const metadata = await readMatrixMetadataOrWarn(metadataFile, path29.join(skillsDir2, metadataFile));
|
|
8449
8368
|
if (!metadata) return unloadedSkillNamedBy(skillMdPath);
|
|
8450
8369
|
const frontmatter = parseFrontmatterOrWarn(skillDir, skillMdPath, await readFile(skillMdPath));
|
|
8451
8370
|
if (!frontmatter) return { kind: "unnamed" };
|
|
@@ -8508,14 +8427,14 @@ function parseFrontmatterOrWarn(skillDir, skillMdPath, skillMdContent) {
|
|
|
8508
8427
|
const unreadable = unreadableFrontmatter(skillMdContent);
|
|
8509
8428
|
if (unreadable !== void 0) {
|
|
8510
8429
|
warn(
|
|
8511
|
-
`Skipping '${
|
|
8430
|
+
`Skipping '${path29.join(skillDir, STANDARD_FILES.SKILL_MD)}': unparseable ${STANDARD_FILES.SKILL_MD} frontmatter at ${skillMdPath} \u2014 ${unreadable}`
|
|
8512
8431
|
);
|
|
8513
8432
|
}
|
|
8514
8433
|
return null;
|
|
8515
8434
|
}
|
|
8516
8435
|
|
|
8517
8436
|
// src/cli/lib/matrix/skill-resolution.ts
|
|
8518
|
-
import { unique as
|
|
8437
|
+
import { unique as unique6, uniqueBy as uniqueBy3 } from "remeda";
|
|
8519
8438
|
var AUTO_SYNTH_ORDER = 999;
|
|
8520
8439
|
function warnOnDomainDisagreement(skill, decidedBy) {
|
|
8521
8440
|
if (skill.domain === decidedBy.domain) return;
|
|
@@ -8583,7 +8502,7 @@ function slugsNamedByRules(relationships) {
|
|
|
8583
8502
|
];
|
|
8584
8503
|
}
|
|
8585
8504
|
function collectUnresolvedSlugs(relationships, slugToId) {
|
|
8586
|
-
return
|
|
8505
|
+
return unique6(slugsNamedByRules(relationships).filter((slug) => slugToId[slug] === void 0));
|
|
8587
8506
|
}
|
|
8588
8507
|
function mergeRelationships(source, defaults) {
|
|
8589
8508
|
return {
|
|
@@ -8618,7 +8537,7 @@ function mergeMatrixWithSkills(categories, relationships, skills) {
|
|
|
8618
8537
|
const resolvedSkills = buildResolvedSkillMap(skills, relationships, slugMap);
|
|
8619
8538
|
const synthesizedCategories = withUndeclaredCategoriesSynthesized(categories, skills);
|
|
8620
8539
|
const unresolvedSlugs = collectUnresolvedSlugs(relationships, slugMap.slugToId);
|
|
8621
|
-
|
|
8540
|
+
return {
|
|
8622
8541
|
version: DEFAULT_VERSION,
|
|
8623
8542
|
categories: synthesizedCategories,
|
|
8624
8543
|
skills: resolvedSkills,
|
|
@@ -8627,7 +8546,6 @@ function mergeMatrixWithSkills(categories, relationships, skills) {
|
|
|
8627
8546
|
...unresolvedSlugs.length > 0 && { unresolvedSlugs },
|
|
8628
8547
|
generatedAt: (/* @__PURE__ */ new Date()).toISOString()
|
|
8629
8548
|
};
|
|
8630
|
-
return merged;
|
|
8631
8549
|
}
|
|
8632
8550
|
function withUndeclaredCategoriesSynthesized(categories, skills) {
|
|
8633
8551
|
const synthesizedCategories = { ...categories };
|
|
@@ -10320,14 +10238,17 @@ function checkSkillRelationRefs(matrix2) {
|
|
|
10320
10238
|
return typedEntries(matrix2.skills).flatMap(
|
|
10321
10239
|
([skillId, skill]) => (
|
|
10322
10240
|
// eslint-disable-next-line @typescript-eslint/no-unnecessary-condition -- Object.entries drops the `| undefined` a Partial<Record> admits
|
|
10323
|
-
skill === void 0 ? [] :
|
|
10324
|
-
severity: "warning",
|
|
10325
|
-
finding: "skill-unresolved-relation-ref",
|
|
10326
|
-
details: `Skill '${skillId}' has unresolved reference '${ref}' in '${field}'`
|
|
10327
|
-
}))
|
|
10241
|
+
skill === void 0 ? [] : unresolvedRelationIssues(matrix2, skillId, skill)
|
|
10328
10242
|
)
|
|
10329
10243
|
);
|
|
10330
10244
|
}
|
|
10245
|
+
function unresolvedRelationIssues(matrix2, skillId, skill) {
|
|
10246
|
+
return relationRefs(skill).filter(({ ref }) => !matrix2.skills[ref]).map(({ field, ref }) => ({
|
|
10247
|
+
severity: "warning",
|
|
10248
|
+
finding: "skill-unresolved-relation-ref",
|
|
10249
|
+
details: `Skill '${skillId}' has unresolved reference '${ref}' in '${field}'`
|
|
10250
|
+
}));
|
|
10251
|
+
}
|
|
10331
10252
|
function checkUnresolvedRuleSlugs(matrix2) {
|
|
10332
10253
|
return (matrix2.unresolvedSlugs ?? []).map((slug) => ({
|
|
10333
10254
|
severity: "error",
|
|
@@ -10335,15 +10256,13 @@ function checkUnresolvedRuleSlugs(matrix2) {
|
|
|
10335
10256
|
details: `Unresolved slug '${slug}' in the relationship rules \u2014 no skill carries it, so every rule naming it states nothing`
|
|
10336
10257
|
}));
|
|
10337
10258
|
}
|
|
10338
|
-
function
|
|
10339
|
-
|
|
10340
|
-
const definition = matrix2.categories[category];
|
|
10341
|
-
return definition !== void 0 && definition.exclusive;
|
|
10259
|
+
function fencesByCategory(matrix2, category) {
|
|
10260
|
+
return category !== LOCAL_PSEUDO_CATEGORY && isExclusiveCategory(matrix2, category);
|
|
10342
10261
|
}
|
|
10343
10262
|
function isFencedByMatrix(matrix2, skillId) {
|
|
10344
10263
|
const skill = matrix2.skills[skillId];
|
|
10345
10264
|
if (skill === void 0) return false;
|
|
10346
|
-
return skill.requires.length > 0 ||
|
|
10265
|
+
return skill.requires.length > 0 || fencesByCategory(matrix2, skill.category);
|
|
10347
10266
|
}
|
|
10348
10267
|
function auditEntryFor(skillId) {
|
|
10349
10268
|
return Object.hasOwn(skillAudit, skillId) ? skillAudit[skillId] : void 0;
|
|
@@ -10353,16 +10272,16 @@ function fenceDescription(skill) {
|
|
|
10353
10272
|
return `its category '${skill.category}' is exclusive`;
|
|
10354
10273
|
}
|
|
10355
10274
|
function checkAuditVerdictContradictions(matrix2) {
|
|
10356
|
-
return typedEntries(matrix2.skills).filter(([skillId, skill]) => {
|
|
10357
|
-
if (skill === void 0 || auditVerdictsPendingApply[skillId]) return false;
|
|
10358
|
-
const audit = auditEntryFor(skillId);
|
|
10359
|
-
return audit?.verdict === "universal" && isFencedByMatrix(matrix2, skillId);
|
|
10360
|
-
}).map(([skillId, skill]) => ({
|
|
10275
|
+
return typedEntries(matrix2.skills).filter(([skillId]) => contradictsItsAudit(matrix2, skillId)).map(([skillId, skill]) => ({
|
|
10361
10276
|
severity: "error",
|
|
10362
10277
|
finding: "audit-verdict-contradiction",
|
|
10363
10278
|
details: `Skill '${skillId}' is audited 'universal' but ${fenceDescription(skill)}`
|
|
10364
10279
|
}));
|
|
10365
10280
|
}
|
|
10281
|
+
function contradictsItsAudit(matrix2, skillId) {
|
|
10282
|
+
if (auditVerdictsPendingApply[skillId]) return false;
|
|
10283
|
+
return auditEntryFor(skillId)?.verdict === "universal" && isFencedByMatrix(matrix2, skillId);
|
|
10284
|
+
}
|
|
10366
10285
|
function checkUnauditedSkills(matrix2) {
|
|
10367
10286
|
return typedEntries(matrix2.skills).filter(
|
|
10368
10287
|
([skillId, skill]) => (
|
|
@@ -10400,11 +10319,7 @@ async function loadCatalogue(options) {
|
|
|
10400
10319
|
const { source } = sourceConfig;
|
|
10401
10320
|
verbose(`Loading skills from source: ${source}`);
|
|
10402
10321
|
const catalogue = await resolveBaseResult(sourceConfig, { purpose, devMode, matrixOnly });
|
|
10403
|
-
const result =
|
|
10404
|
-
...catalogue,
|
|
10405
|
-
marketplaceSkillIds: new Set(typedKeys(catalogue.matrix.skills)),
|
|
10406
|
-
marketplaceSkills: { ...catalogue.matrix.skills }
|
|
10407
|
-
};
|
|
10322
|
+
const result = withMarketplaceSkills(catalogue);
|
|
10408
10323
|
const globalProvider = provider ?? inheritedGlobalProvider(resolvedProjectDir);
|
|
10409
10324
|
result.matrix = await mergeLocalSkills(
|
|
10410
10325
|
result.matrix,
|
|
@@ -10426,6 +10341,13 @@ async function loadCatalogue(options) {
|
|
|
10426
10341
|
initializeMatrix(result.matrix);
|
|
10427
10342
|
return result;
|
|
10428
10343
|
}
|
|
10344
|
+
function withMarketplaceSkills(catalogue) {
|
|
10345
|
+
return {
|
|
10346
|
+
...catalogue,
|
|
10347
|
+
marketplaceSkillIds: new Set(typedKeys(catalogue.matrix.skills)),
|
|
10348
|
+
marketplaceSkills: { ...catalogue.matrix.skills }
|
|
10349
|
+
};
|
|
10350
|
+
}
|
|
10429
10351
|
async function seatGlobalInstallationSkills(matrix2, loadedSource, purpose, globalProvider) {
|
|
10430
10352
|
const uncarried = await globalPluginSkillsUncarried(matrix2, globalProvider);
|
|
10431
10353
|
if (uncarried.length === 0) return;
|
|
@@ -10507,22 +10429,23 @@ var NOTHING_FETCHED = { path: "", unreachable: false };
|
|
|
10507
10429
|
async function resolveBaseResult(sourceConfig, { purpose, devMode, matrixOnly }) {
|
|
10508
10430
|
refuseReservedRecordedName(sourceConfig);
|
|
10509
10431
|
const { source } = sourceConfig;
|
|
10510
|
-
if (isDefaultSource(source) && !devMode)
|
|
10511
|
-
const fetched = matrixOnly ? NOTHING_FETCHED : await fetchFromSource(source);
|
|
10512
|
-
return {
|
|
10513
|
-
matrix: copyOfBuiltInMatrix(),
|
|
10514
|
-
// Checked when it was generated, so nothing in it failed to load.
|
|
10515
|
-
unloadedSkillIds: /* @__PURE__ */ new Set(),
|
|
10516
|
-
sourceConfig,
|
|
10517
|
-
sourcePath: fetched.path,
|
|
10518
|
-
isLocal: false,
|
|
10519
|
-
unreachable: fetched.unreachable,
|
|
10520
|
-
...sourceConfig.marketplace !== void 0 && { marketplace: sourceConfig.marketplace }
|
|
10521
|
-
};
|
|
10522
|
-
}
|
|
10432
|
+
if (isDefaultSource(source) && !devMode) return readBuiltInCatalogue(sourceConfig, matrixOnly);
|
|
10523
10433
|
const isLocal = isLocalSource(source) || devMode;
|
|
10524
10434
|
return isLocal ? loadFromLocal(source, sourceConfig, purpose) : loadFromRemote(source, sourceConfig, purpose);
|
|
10525
10435
|
}
|
|
10436
|
+
async function readBuiltInCatalogue(sourceConfig, matrixOnly) {
|
|
10437
|
+
const fetched = matrixOnly ? NOTHING_FETCHED : await fetchFromSource(sourceConfig.source);
|
|
10438
|
+
return {
|
|
10439
|
+
matrix: copyOfBuiltInMatrix(),
|
|
10440
|
+
// Checked when it was generated, so nothing in it failed to load.
|
|
10441
|
+
unloadedSkillIds: /* @__PURE__ */ new Set(),
|
|
10442
|
+
sourceConfig,
|
|
10443
|
+
sourcePath: fetched.path,
|
|
10444
|
+
isLocal: false,
|
|
10445
|
+
unreachable: fetched.unreachable,
|
|
10446
|
+
...configuredLabel(sourceConfig)
|
|
10447
|
+
};
|
|
10448
|
+
}
|
|
10526
10449
|
function recordedNameWayOut(configPath) {
|
|
10527
10450
|
return `set this installation up again, or correct the marketplaceName it recorded in '${configPath}'`;
|
|
10528
10451
|
}
|
|
@@ -10591,40 +10514,34 @@ async function mergeDiscoveredLocalSkills(matrix2, dir, label, provider) {
|
|
|
10591
10514
|
const discovered = await discoverLocalSkills(dir, provider);
|
|
10592
10515
|
if (!discovered || discovered.skills.length === 0) return matrix2;
|
|
10593
10516
|
verbose(
|
|
10594
|
-
`Found ${discovered.skills.length
|
|
10517
|
+
`Found ${plural(discovered.skills.length, `${label} local skill`)} in ${discovered.localSkillsPath}`
|
|
10595
10518
|
);
|
|
10596
10519
|
return mergeLocalSkillsIntoMatrix(matrix2, discovered);
|
|
10597
10520
|
}
|
|
10598
10521
|
async function loadFromLocal(source, sourceConfig, purpose) {
|
|
10599
10522
|
const skillsPath = isLocalSource(source) ? (await fetchFromSource(source)).path : PROJECT_ROOT;
|
|
10600
10523
|
verbose(`Loading skills from local path: ${skillsPath}`);
|
|
10601
|
-
const {
|
|
10602
|
-
|
|
10603
|
-
return {
|
|
10604
|
-
matrix: matrix2,
|
|
10605
|
-
unloadedSkillIds,
|
|
10606
|
-
sourceConfig,
|
|
10607
|
-
sourcePath: skillsPath,
|
|
10608
|
-
isLocal: true,
|
|
10609
|
-
unreachable: false,
|
|
10610
|
-
...labels
|
|
10611
|
-
};
|
|
10524
|
+
const fetched = { sourcePath: skillsPath, isLocal: true, unreachable: false };
|
|
10525
|
+
return readMarketplaceFolder(fetched, skillsPath, sourceConfig, purpose);
|
|
10612
10526
|
}
|
|
10613
10527
|
async function loadFromRemote(source, sourceConfig, purpose) {
|
|
10614
10528
|
verbose(`Fetching skills from remote source: ${source}`);
|
|
10615
10529
|
const fetchResult = await fetchFromSource(source);
|
|
10616
10530
|
verbose(`Fetched to: ${fetchResult.path}`);
|
|
10617
|
-
const
|
|
10618
|
-
const labels = await resolveMarketplaceLabels(source, sourceConfig, purpose);
|
|
10619
|
-
return {
|
|
10620
|
-
matrix: matrix2,
|
|
10621
|
-
unloadedSkillIds,
|
|
10622
|
-
sourceConfig,
|
|
10531
|
+
const fetched = {
|
|
10623
10532
|
sourcePath: fetchResult.path,
|
|
10624
10533
|
isLocal: false,
|
|
10625
|
-
unreachable: fetchResult.unreachable
|
|
10626
|
-
...labels
|
|
10534
|
+
unreachable: fetchResult.unreachable
|
|
10627
10535
|
};
|
|
10536
|
+
return readMarketplaceFolder(fetched, source, sourceConfig, purpose);
|
|
10537
|
+
}
|
|
10538
|
+
async function readMarketplaceFolder(fetched, manifestRoot, sourceConfig, purpose) {
|
|
10539
|
+
const { matrix: matrix2, unloadedSkillIds } = await loadAndMergeFromBasePath(
|
|
10540
|
+
fetched.sourcePath,
|
|
10541
|
+
sourceConfig.source
|
|
10542
|
+
);
|
|
10543
|
+
const labels = await resolveMarketplaceLabels(manifestRoot, sourceConfig, purpose);
|
|
10544
|
+
return { matrix: matrix2, unloadedSkillIds, sourceConfig, ...fetched, ...labels };
|
|
10628
10545
|
}
|
|
10629
10546
|
async function loadMarketplaceMatrix(marketplaceDir) {
|
|
10630
10547
|
const { matrix: matrix2 } = await loadAndMergeFromBasePath(marketplaceDir, marketplaceDir);
|
|
@@ -10643,7 +10560,7 @@ async function loadAndMergeFromBasePath(basePath, source) {
|
|
|
10643
10560
|
const skillsDirRelPath = sourceProjectConfig?.skillsDir ?? SKILLS_DIR_PATH;
|
|
10644
10561
|
const stacksRelFile = sourceProjectConfig?.stacksFile;
|
|
10645
10562
|
const { categories, sourceRules } = await loadSourceTaxonomy(basePath);
|
|
10646
|
-
const skillsDir2 =
|
|
10563
|
+
const skillsDir2 = path30.join(basePath, skillsDirRelPath);
|
|
10647
10564
|
verbose(`Skills from source: ${skillsDir2}`);
|
|
10648
10565
|
const { skills, unloadedSkillIds } = await extractAllSkills(skillsDir2);
|
|
10649
10566
|
await refuseCatalogueCollisions(basePath, source, skills);
|
|
@@ -10667,16 +10584,17 @@ async function loadSourceTaxonomy(basePath) {
|
|
|
10667
10584
|
return { categories, sourceRules };
|
|
10668
10585
|
}
|
|
10669
10586
|
async function loadSourceCategories(basePath) {
|
|
10670
|
-
const categoriesPath =
|
|
10587
|
+
const categoriesPath = path30.join(basePath, SKILL_CATEGORIES_PATH);
|
|
10671
10588
|
if (!await fileExists(categoriesPath)) return void 0;
|
|
10672
10589
|
const categories = await loadSkillCategories(categoriesPath);
|
|
10590
|
+
const count = typedKeys(categories).length;
|
|
10673
10591
|
verbose(
|
|
10674
|
-
`Loaded source categories: ${categoriesPath} (${
|
|
10592
|
+
`Loaded source categories: ${categoriesPath} (${count} ${count === 1 ? "category" : "categories"})`
|
|
10675
10593
|
);
|
|
10676
10594
|
return categories;
|
|
10677
10595
|
}
|
|
10678
10596
|
async function loadSourceRules(basePath) {
|
|
10679
|
-
const rulesPath =
|
|
10597
|
+
const rulesPath = path30.join(basePath, SKILL_RULES_PATH);
|
|
10680
10598
|
if (!await fileExists(rulesPath)) return void 0;
|
|
10681
10599
|
const rules = await loadSkillRules(rulesPath);
|
|
10682
10600
|
verbose(`Loaded source rules: ${rulesPath}`);
|
|
@@ -10693,17 +10611,18 @@ async function refuseCatalogueCollisions(basePath, source, skills) {
|
|
|
10693
10611
|
function catalogueCollisionError(collidingIds, source) {
|
|
10694
10612
|
const listed = collidingIds.slice(0, MAX_REPORTED_COLLISIONS).map((id) => ` ${id}`);
|
|
10695
10613
|
const unlisted = collidingIds.length - listed.length;
|
|
10614
|
+
const shadows = collidingIds.length === 1 ? "it would shadow the public catalogue's own skill" : "these would shadow the public catalogue's own skills";
|
|
10696
10615
|
return [
|
|
10697
|
-
`Marketplace '${source}' ships ${collidingIds.length
|
|
10616
|
+
`Marketplace '${source}' ships ${plural(collidingIds.length, "skill id")} the public catalogue already owns:`,
|
|
10698
10617
|
...listed,
|
|
10699
10618
|
...unlisted > 0 ? [` ... and ${unlisted} more`] : [],
|
|
10700
|
-
`A skill id is the directory the skill installs into, so
|
|
10619
|
+
`A skill id is the directory the skill installs into, so ${shadows}. Every id must carry its marketplace's name as a namespace \u2014 '<marketplace>-<id>'. Rename each skill and the 'name' in its SKILL.md, then re-run 'build marketplace', which refuses the same ids before they are published.`
|
|
10701
10620
|
].join("\n");
|
|
10702
10621
|
}
|
|
10703
10622
|
async function resolveOfferedStacks(basePath, stacksFile, source) {
|
|
10704
10623
|
const sourceStacks = await loadStacks(basePath, stacksFile);
|
|
10705
10624
|
if (sourceStacks.length > 0) {
|
|
10706
|
-
verbose(`Offering the ${sourceStacks.length}
|
|
10625
|
+
verbose(`Offering the ${plural(sourceStacks.length, "stack")} the source ships`);
|
|
10707
10626
|
return sourceStacks;
|
|
10708
10627
|
}
|
|
10709
10628
|
if (await offersBuiltInStacks(basePath, source)) {
|
|
@@ -10718,17 +10637,17 @@ async function resolveOfferedStacks(basePath, stacksFile, source) {
|
|
|
10718
10637
|
function declaredAgentsIn(stack) {
|
|
10719
10638
|
const named = typedKeys(stack.agents);
|
|
10720
10639
|
return {
|
|
10721
|
-
declared: named.filter(
|
|
10722
|
-
undeclared: named.filter((name) => !
|
|
10640
|
+
declared: named.filter(isAgentName2),
|
|
10641
|
+
undeclared: named.filter((name) => !isAgentName2(name))
|
|
10723
10642
|
};
|
|
10724
10643
|
}
|
|
10725
10644
|
function undeclaredAgentsWarning(stack, undeclared) {
|
|
10726
10645
|
const named = undeclared.map((name) => `'${name}'`).join(", ");
|
|
10727
|
-
return `Stack '${stack.id}' names ${undeclared.length
|
|
10646
|
+
return `Stack '${stack.id}' names ${plural(undeclared.length, "sub-agent")} this CLI does not define: ${named}. Left out of the stack \u2014 a sub-agent must be one the CLI ships.`;
|
|
10728
10647
|
}
|
|
10729
10648
|
function withdrawnSkillsWarning(stack, withdrawn) {
|
|
10730
10649
|
const named = withdrawn.map((id) => `'${id}'`).join(", ");
|
|
10731
|
-
return `Stack '${stack.id}' names ${withdrawn.length
|
|
10650
|
+
return `Stack '${stack.id}' names ${plural(withdrawn.length, "skill")} this marketplace's catalogue does not carry: ${named}. Left out of the stack \u2014 selecting it would install nothing.`;
|
|
10732
10651
|
}
|
|
10733
10652
|
function convertStackToResolvedStack(stack, catalogue) {
|
|
10734
10653
|
const { declared, undeclared } = declaredAgentsIn(stack);
|
|
@@ -10738,7 +10657,7 @@ function convertStackToResolvedStack(stack, catalogue) {
|
|
|
10738
10657
|
const [allSkillIds, withdrawn] = partition6(namedSkillIds(agentConfigs), isCarried);
|
|
10739
10658
|
if (withdrawn.length > 0) warn(withdrawnSkillsWarning(stack, withdrawn));
|
|
10740
10659
|
verbose(
|
|
10741
|
-
`Stack '${stack.id}' has ${allSkillIds.length}
|
|
10660
|
+
`Stack '${stack.id}' has ${plural(allSkillIds.length, "skill")} from ${plural(agentConfigs.length, "agent")}`
|
|
10742
10661
|
);
|
|
10743
10662
|
return {
|
|
10744
10663
|
id: stack.id,
|
|
@@ -10756,7 +10675,7 @@ function agentConfigsFor(stack, declared) {
|
|
|
10756
10675
|
});
|
|
10757
10676
|
}
|
|
10758
10677
|
function namedSkillIds(agentConfigs) {
|
|
10759
|
-
return
|
|
10678
|
+
return unique7(
|
|
10760
10679
|
agentConfigs.flatMap(
|
|
10761
10680
|
({ agentConfig }) => resolveAgentConfigToSkills(agentConfig).map((ref) => ref.id)
|
|
10762
10681
|
)
|
|
@@ -10788,7 +10707,7 @@ function undeclaredCategoryRefusal(metadata, category) {
|
|
|
10788
10707
|
if (metadata.localPath === void 0) {
|
|
10789
10708
|
throw new Error(`Local skill '${metadata.id}' was discovered without its directory`);
|
|
10790
10709
|
}
|
|
10791
|
-
const metadataPath =
|
|
10710
|
+
const metadataPath = path30.join(metadata.localPath, STANDARD_FILES.METADATA_YAML);
|
|
10792
10711
|
return `Skipping local skill '${metadata.id}': ${METADATA_KEYS.CATEGORY} '${category}' is not one this installation declares, so the skill belongs in no grid tab and can be given to no sub-agent. Set ${METADATA_KEYS.CATEGORY} in ${metadataPath} to a category that already exists \u2014 a skill is placed in the taxonomy, it does not extend it.`;
|
|
10793
10712
|
}
|
|
10794
10713
|
function mergeLocalSkillsIntoMatrix(matrix2, localResult) {
|
|
@@ -10847,7 +10766,6 @@ export {
|
|
|
10847
10766
|
getErrorMessage,
|
|
10848
10767
|
setVerbose,
|
|
10849
10768
|
verbose,
|
|
10850
|
-
log,
|
|
10851
10769
|
enableBuffering,
|
|
10852
10770
|
drainBuffer,
|
|
10853
10771
|
disableBuffering,
|
|
@@ -10861,20 +10779,26 @@ export {
|
|
|
10861
10779
|
renderAgent,
|
|
10862
10780
|
renderAgentBody,
|
|
10863
10781
|
isHomeDirectory,
|
|
10782
|
+
scopeAt,
|
|
10783
|
+
toPosixPath,
|
|
10864
10784
|
sourceRootOf,
|
|
10865
10785
|
rootsHoldingTheRetiredSourceFolder,
|
|
10866
10786
|
chooseProviderForThisRun,
|
|
10867
10787
|
forgetTheProviderChosenForThisRun,
|
|
10868
10788
|
declaresNoContent,
|
|
10869
10789
|
providerInUse,
|
|
10790
|
+
whileInstallingInto,
|
|
10870
10791
|
inheritedGlobalProvider,
|
|
10871
10792
|
providerAtScope,
|
|
10872
10793
|
sourceFolderInUse,
|
|
10873
10794
|
relativeConfigPath,
|
|
10874
10795
|
sourceFolderName,
|
|
10875
10796
|
installBaseDir,
|
|
10797
|
+
CODEX_CONFIG_FILE,
|
|
10798
|
+
INSTALLED_PLUGINS_FILE,
|
|
10876
10799
|
codexGlobalConfigFile,
|
|
10877
10800
|
claudeStateFile,
|
|
10801
|
+
userConfigRoot,
|
|
10878
10802
|
agentsDir,
|
|
10879
10803
|
skillsDir,
|
|
10880
10804
|
permissionFiles,
|
|
@@ -10904,6 +10828,8 @@ export {
|
|
|
10904
10828
|
marketplaceRefreshFailed,
|
|
10905
10829
|
marketplacesRefreshFailed,
|
|
10906
10830
|
codexPluginLeftSwitchedOn,
|
|
10831
|
+
pluginNotSwitchedBackOff,
|
|
10832
|
+
switchItOffIn,
|
|
10907
10833
|
pluginsLeftSwitchedOn,
|
|
10908
10834
|
marketplaceOwnerHasNoName,
|
|
10909
10835
|
marketplaceHasNoVersion,
|
|
@@ -10920,6 +10846,7 @@ export {
|
|
|
10920
10846
|
savedSkillMetadataUnusableError,
|
|
10921
10847
|
editorSkillMetadataUnusableError,
|
|
10922
10848
|
sharedConfigDestinations,
|
|
10849
|
+
appliedBackDestinations,
|
|
10923
10850
|
applySharedConfigHere,
|
|
10924
10851
|
shareRefusesEjectedSkills,
|
|
10925
10852
|
sharedIdNamesAFolder,
|
|
@@ -10931,6 +10858,8 @@ export {
|
|
|
10931
10858
|
carriedSkillsWritten,
|
|
10932
10859
|
copiedSkillsRemovedAfterRefusedSave,
|
|
10933
10860
|
carriedSkillsRemovedAfterRefusedSave,
|
|
10861
|
+
marketplaceRemovedAfterRefusedSave,
|
|
10862
|
+
pluginKeptAfterRefusedSave,
|
|
10934
10863
|
SHARED_CONFIG_APPLY,
|
|
10935
10864
|
idNamesAnotherMarketplace,
|
|
10936
10865
|
registeredProjectsRecompiled,
|
|
@@ -10958,14 +10887,19 @@ export {
|
|
|
10958
10887
|
scopeLabel,
|
|
10959
10888
|
layoutIsCurrent,
|
|
10960
10889
|
retiredSourceFolderIgnored,
|
|
10890
|
+
execCommand,
|
|
10891
|
+
isRecord,
|
|
10892
|
+
isAgentName2 as isAgentName,
|
|
10961
10893
|
GlobalPairWriteViolation,
|
|
10962
10894
|
withGateToken,
|
|
10963
10895
|
assertGateToken,
|
|
10964
|
-
isPathWithin,
|
|
10965
10896
|
readFile,
|
|
10966
10897
|
readFileSafe,
|
|
10967
10898
|
readFileOptional,
|
|
10968
10899
|
fileExists,
|
|
10900
|
+
isKnownAbsent,
|
|
10901
|
+
jsonFileMatches,
|
|
10902
|
+
isBlankFile,
|
|
10969
10903
|
directoryExists2 as directoryExists,
|
|
10970
10904
|
isSymlink,
|
|
10971
10905
|
listDirectories,
|
|
@@ -10976,18 +10910,15 @@ export {
|
|
|
10976
10910
|
isDirectoryEmpty,
|
|
10977
10911
|
removeDirIfEmpty,
|
|
10978
10912
|
copy,
|
|
10913
|
+
parseJsonOrUndefined,
|
|
10979
10914
|
formatZodErrors,
|
|
10980
|
-
isRecord,
|
|
10981
|
-
isAgentName,
|
|
10982
10915
|
skillCategoriesFileSchema,
|
|
10983
10916
|
skillRulesFileSchema,
|
|
10984
10917
|
stacksConfigSchema,
|
|
10985
10918
|
settingsFileSchema,
|
|
10986
10919
|
agentYamlGenerationSchema,
|
|
10987
|
-
agentFrontmatterValidationSchema,
|
|
10988
10920
|
metadataValidationSchema,
|
|
10989
10921
|
stackConfigValidationSchema,
|
|
10990
|
-
formatZodIssues,
|
|
10991
10922
|
validateSkillMetadata,
|
|
10992
10923
|
splitMetadataValidationIssues,
|
|
10993
10924
|
ConfigSchemaError,
|
|
@@ -11016,6 +10947,10 @@ export {
|
|
|
11016
10947
|
defaultUsageGuidance,
|
|
11017
10948
|
resolveAgentConfigToSkills,
|
|
11018
10949
|
getStackSkillIds,
|
|
10950
|
+
validResult,
|
|
10951
|
+
invalidResult,
|
|
10952
|
+
resultFrom,
|
|
10953
|
+
mergeValidationResults,
|
|
11019
10954
|
ConfigLoadError,
|
|
11020
10955
|
configDeclaresNothing,
|
|
11021
10956
|
loadProjectConfigFromDir,
|
|
@@ -11034,6 +10969,7 @@ export {
|
|
|
11034
10969
|
detectGlobalInstallation,
|
|
11035
10970
|
detectInstallation,
|
|
11036
10971
|
INDENT_STEP,
|
|
10972
|
+
isKeyedRecord,
|
|
11037
10973
|
quoteText,
|
|
11038
10974
|
renderKey,
|
|
11039
10975
|
unionLayout,
|
|
@@ -11046,8 +10982,6 @@ export {
|
|
|
11046
10982
|
generateConfigSource,
|
|
11047
10983
|
refuseUnwritableStack,
|
|
11048
10984
|
generateBlankGlobalConfigSource,
|
|
11049
|
-
typedEntries2 as typedEntries,
|
|
11050
|
-
typedKeys2 as typedKeys,
|
|
11051
10985
|
isScopePairCompatible,
|
|
11052
10986
|
splitConfigByScope,
|
|
11053
10987
|
seedToInstallSelection,
|
|
@@ -11060,11 +10994,6 @@ export {
|
|
|
11060
10994
|
loadProjectAgents,
|
|
11061
10995
|
loadSkillsFromDir,
|
|
11062
10996
|
getCurrentDate,
|
|
11063
|
-
computeStringHash,
|
|
11064
|
-
computeShippedHash,
|
|
11065
|
-
readEarlierBuild,
|
|
11066
|
-
versionAfterRebuild,
|
|
11067
|
-
writeContentHash,
|
|
11068
10997
|
readForkedFromMetadata,
|
|
11069
10998
|
readLocalSkillMetadata,
|
|
11070
10999
|
validateSkillPath,
|
|
@@ -11073,27 +11002,17 @@ export {
|
|
|
11073
11002
|
getUserPluginsDir,
|
|
11074
11003
|
getProjectPluginsDir,
|
|
11075
11004
|
getPluginAgentsDir,
|
|
11076
|
-
getPluginManifestPath,
|
|
11077
11005
|
readPluginManifest,
|
|
11078
|
-
agentPluginName,
|
|
11079
|
-
generateAgentPluginManifest,
|
|
11080
|
-
writePluginManifest,
|
|
11081
11006
|
buildMarketplacePluginRef,
|
|
11082
11007
|
parseMarketplacePluginRef,
|
|
11083
|
-
holdsContentNoBuildMade,
|
|
11084
|
-
clearEarlierBuild,
|
|
11085
11008
|
getInstallationInfo,
|
|
11086
11009
|
getInstallationsByProvider,
|
|
11087
11010
|
formatInstallationDisplay,
|
|
11088
|
-
validResult,
|
|
11089
|
-
invalidResult,
|
|
11090
|
-
mergeValidationResults,
|
|
11091
11011
|
validateSkillFrontmatter,
|
|
11092
11012
|
validateAgentFrontmatter,
|
|
11093
11013
|
validatePlugin,
|
|
11094
11014
|
validateAllPlugins,
|
|
11095
11015
|
listPluginDirNames,
|
|
11096
|
-
execCommand,
|
|
11097
11016
|
getInstalledPluginsRegistryPath,
|
|
11098
11017
|
listRegisteredPluginInstalls,
|
|
11099
11018
|
PluginsLeftSwitchedOnError,
|
|
@@ -11101,7 +11020,7 @@ export {
|
|
|
11101
11020
|
refuseUnofferedPlacements,
|
|
11102
11021
|
hostFor,
|
|
11103
11022
|
hostAt,
|
|
11104
|
-
|
|
11023
|
+
getPluginsBySwitch,
|
|
11105
11024
|
discoverAllPluginSkills,
|
|
11106
11025
|
listPluginNames,
|
|
11107
11026
|
compileSkillPlugin,
|
|
@@ -11127,9 +11046,9 @@ export {
|
|
|
11127
11046
|
loadSkillsMatrixFromSource,
|
|
11128
11047
|
MarketplaceManifestRequiredError,
|
|
11129
11048
|
loadMarketplaceMatrix,
|
|
11049
|
+
CATALOGUE_SKILL_IDS,
|
|
11130
11050
|
convertStackToResolvedStack,
|
|
11131
11051
|
mergeLocalSkillsIntoMatrix,
|
|
11132
|
-
resolveAgents,
|
|
11133
11052
|
refuseUnofferedStack,
|
|
11134
11053
|
buildAndMergeConfig,
|
|
11135
11054
|
buildCompileAgents,
|
|
@@ -11146,4 +11065,4 @@ export {
|
|
|
11146
11065
|
executeMigration,
|
|
11147
11066
|
keepsGlobalInstall
|
|
11148
11067
|
};
|
|
11149
|
-
//# sourceMappingURL=chunk-
|
|
11068
|
+
//# sourceMappingURL=chunk-D2PC7NIR.js.map
|