@agents-inc/cli 0.61.0 → 0.65.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 +46 -0
- package/README.md +23 -172
- package/dist/{chunk-YHOHLNHM.js → chunk-3YNT3NX3.js} +13 -11
- package/dist/chunk-3YNT3NX3.js.map +1 -0
- package/dist/{chunk-IGM6HA3S.js → chunk-4C7CSZC5.js} +27 -149
- package/dist/chunk-4C7CSZC5.js.map +1 -0
- package/dist/{chunk-WHISPMAQ.js → chunk-4KVBH2X4.js} +33 -14
- package/dist/chunk-4KVBH2X4.js.map +1 -0
- package/dist/{chunk-KIWFEBKH.js → chunk-52THXN5G.js} +14 -5
- package/dist/chunk-52THXN5G.js.map +1 -0
- package/dist/{chunk-FWMWWE3X.js → chunk-53URJ5XK.js} +448 -152
- package/dist/chunk-53URJ5XK.js.map +1 -0
- package/dist/{chunk-H5DASUX5.js → chunk-6DEK3TDF.js} +10 -10
- package/dist/chunk-6DEK3TDF.js.map +1 -0
- package/dist/{chunk-SDKCQXWE.js → chunk-6IK2TCK7.js} +13 -6
- package/dist/chunk-6IK2TCK7.js.map +1 -0
- package/dist/chunk-6VIOO74O.js +51 -0
- package/dist/chunk-6VIOO74O.js.map +1 -0
- package/dist/{chunk-52XO4ULK.js → chunk-7DI3HGKL.js} +32 -14
- package/dist/chunk-7DI3HGKL.js.map +1 -0
- package/dist/{chunk-MGNYPVOJ.js → chunk-AQYAVLZK.js} +2 -2
- package/dist/{chunk-BNQ5O6LE.js → chunk-AUNBGZS4.js} +2 -2
- package/dist/chunk-BGPGQF35.js +248 -0
- package/dist/chunk-BGPGQF35.js.map +1 -0
- package/dist/chunk-BKL3DF2Q.js +45 -0
- package/dist/chunk-BKL3DF2Q.js.map +1 -0
- package/dist/{chunk-AX3SZZWA.js → chunk-BKTPEATV.js} +13 -6
- package/dist/chunk-BKTPEATV.js.map +1 -0
- package/dist/{chunk-H7WJK7NJ.js → chunk-CKPJTMNC.js} +13 -6
- package/dist/chunk-CKPJTMNC.js.map +1 -0
- package/dist/{chunk-MR6OBL3B.js → chunk-CXRVM7BA.js} +2 -4
- package/dist/chunk-CXRVM7BA.js.map +1 -0
- package/dist/{chunk-VR3CDXDT.js → chunk-EE5EPS32.js} +2 -2
- package/dist/{chunk-6OWHQ7HM.js → chunk-EGMQ3SXN.js} +2 -11
- package/dist/{chunk-6OWHQ7HM.js.map → chunk-EGMQ3SXN.js.map} +1 -1
- package/dist/{chunk-6DAZG54T.js → chunk-EZ35IPXZ.js} +10 -7
- package/dist/chunk-EZ35IPXZ.js.map +1 -0
- package/dist/{chunk-OCEFD7V6.js → chunk-F3REOP7N.js} +3 -3
- package/dist/{chunk-C577AJE7.js → chunk-FGLUQSVU.js} +3 -3
- package/dist/{chunk-Z3TM4N37.js → chunk-J4POGAJF.js} +24 -24
- package/dist/chunk-J4POGAJF.js.map +1 -0
- package/dist/{chunk-O6BA7Q2B.js → chunk-KFDTVSIC.js} +18 -8
- package/dist/chunk-KFDTVSIC.js.map +1 -0
- package/dist/{chunk-LWXRUR6B.js → chunk-LMZXL5RQ.js} +2 -2
- package/dist/{chunk-LWXRUR6B.js.map → chunk-LMZXL5RQ.js.map} +1 -1
- package/dist/{chunk-BFD5NZQ4.js → chunk-MVYJVKVT.js} +19 -11
- package/dist/chunk-MVYJVKVT.js.map +1 -0
- package/dist/{chunk-X5EG4EFP.js → chunk-MWGDG4QN.js} +2 -2
- package/dist/chunk-N4D43IOO.js +238 -0
- package/dist/chunk-N4D43IOO.js.map +1 -0
- package/dist/{chunk-KDO6WU76.js → chunk-O2HK3NTG.js} +10 -6
- package/dist/chunk-O2HK3NTG.js.map +1 -0
- package/dist/{chunk-46DQG2N7.js → chunk-OORWBS6F.js} +45 -52
- package/dist/chunk-OORWBS6F.js.map +1 -0
- package/dist/{chunk-CIG7IKX3.js → chunk-OV5UJWS5.js} +4 -4
- package/dist/{chunk-IEEVXLJB.js → chunk-R46CB36B.js} +5 -5
- package/dist/{chunk-GH2RQ4MI.js → chunk-RG3KDXMR.js} +16 -8
- package/dist/chunk-RG3KDXMR.js.map +1 -0
- package/dist/{chunk-MMFQNJPE.js → chunk-SXGBPQY6.js} +3 -3
- package/dist/chunk-SXGBPQY6.js.map +1 -0
- package/dist/{chunk-XUDTFI4M.js → chunk-T5DJCIUP.js} +2 -2
- package/dist/{chunk-AJJJE7F7.js → chunk-TQLDQ3XZ.js} +2 -2
- package/dist/{chunk-M6YWRMXH.js → chunk-WSMQ5GAP.js} +33 -21
- package/dist/chunk-WSMQ5GAP.js.map +1 -0
- package/dist/{chunk-WYVDNGJB.js → chunk-XMLCXRTS.js} +3 -3
- package/dist/{chunk-SDLDPFNV.js → chunk-YEGPTBX5.js} +4 -4
- package/dist/{chunk-SRBN6RRD.js → chunk-ZFY5EMDV.js} +5 -5
- package/dist/{chunk-BKJHAJQW.js → chunk-ZYUASJUN.js} +7 -4
- package/dist/chunk-ZYUASJUN.js.map +1 -0
- package/dist/commands/build/marketplace.js +4 -4
- package/dist/commands/build/plugins.js +7 -6
- package/dist/commands/build/plugins.js.map +1 -1
- package/dist/commands/build/stack.js +7 -6
- package/dist/commands/build/stack.js.map +1 -1
- package/dist/commands/compile.js +11 -80
- package/dist/commands/compile.js.map +1 -1
- package/dist/commands/config/index.js +7 -6
- package/dist/commands/config/index.js.map +1 -1
- package/dist/commands/config/path.js +6 -5
- package/dist/commands/config/path.js.map +1 -1
- package/dist/commands/config/show.js +7 -6
- package/dist/commands/diff.js +6 -5
- package/dist/commands/diff.js.map +1 -1
- package/dist/commands/doctor.js +11 -15
- package/dist/commands/doctor.js.map +1 -1
- package/dist/commands/edit.js +63 -69
- package/dist/commands/edit.js.map +1 -1
- package/dist/commands/eject.js +13 -13
- package/dist/commands/eject.js.map +1 -1
- package/dist/commands/import/skill.js +7 -6
- package/dist/commands/import/skill.js.map +1 -1
- package/dist/commands/info.js +14 -16
- package/dist/commands/info.js.map +1 -1
- package/dist/commands/init.js +32 -30
- package/dist/commands/list.js +6 -5
- package/dist/commands/list.js.map +1 -1
- package/dist/commands/new/agent.js +7 -6
- package/dist/commands/new/agent.js.map +1 -1
- package/dist/commands/new/marketplace.js +28 -11
- package/dist/commands/new/marketplace.js.map +1 -1
- package/dist/commands/new/skill.js +7 -6
- package/dist/commands/outdated.js +6 -5
- package/dist/commands/outdated.js.map +1 -1
- package/dist/commands/search.js +13 -11
- package/dist/commands/search.js.map +1 -1
- package/dist/commands/uninstall.js +9 -10
- package/dist/commands/uninstall.js.map +1 -1
- package/dist/commands/update.js +12 -8
- package/dist/commands/update.js.map +1 -1
- package/dist/commands/validate.js +20 -42
- package/dist/commands/validate.js.map +1 -1
- package/dist/components/skill-search/skill-search.js +4 -3
- package/dist/components/wizard/category-grid.js +5 -3
- package/dist/components/wizard/category-grid.test.js +242 -194
- package/dist/components/wizard/category-grid.test.js.map +1 -1
- package/dist/components/wizard/checkbox-grid.js +5 -5
- package/dist/components/wizard/checkbox-grid.test.js +5 -5
- package/dist/components/wizard/domain-selection.js +12 -11
- package/dist/components/wizard/help-modal.js +3 -2
- package/dist/components/wizard/menu-item.js +1 -1
- package/dist/components/wizard/search-modal.js +3 -2
- package/dist/components/wizard/search-modal.test.js +3 -2
- package/dist/components/wizard/search-modal.test.js.map +1 -1
- package/dist/components/wizard/section-progress.js +2 -2
- package/dist/components/wizard/section-progress.test.js +3 -3
- package/dist/components/wizard/section-progress.test.js.map +1 -1
- package/dist/components/wizard/selection-card.js +2 -2
- package/dist/components/wizard/source-grid.js +6 -4
- package/dist/components/wizard/source-grid.test.js +60 -40
- package/dist/components/wizard/source-grid.test.js.map +1 -1
- package/dist/components/wizard/stack-selection.js +9 -8
- package/dist/components/wizard/step-agents.js +11 -10
- package/dist/components/wizard/step-agents.test.js +29 -26
- package/dist/components/wizard/step-agents.test.js.map +1 -1
- package/dist/components/wizard/step-build.js +12 -10
- package/dist/components/wizard/step-build.test.js +79 -99
- package/dist/components/wizard/step-build.test.js.map +1 -1
- package/dist/components/wizard/step-confirm.js +6 -4
- package/dist/components/wizard/step-confirm.test.js +11 -15
- package/dist/components/wizard/step-confirm.test.js.map +1 -1
- package/dist/components/wizard/step-refine.js +3 -2
- package/dist/components/wizard/step-refine.test.js +3 -2
- package/dist/components/wizard/step-refine.test.js.map +1 -1
- package/dist/components/wizard/step-settings.js +10 -8
- package/dist/components/wizard/step-settings.test.js +17 -13
- package/dist/components/wizard/step-settings.test.js.map +1 -1
- package/dist/components/wizard/step-sources.js +13 -11
- package/dist/components/wizard/step-sources.test.js +20 -16
- package/dist/components/wizard/step-sources.test.js.map +1 -1
- package/dist/components/wizard/step-stack.js +15 -14
- package/dist/components/wizard/step-stack.test.js +53 -59
- package/dist/components/wizard/step-stack.test.js.map +1 -1
- package/dist/components/wizard/view-title.js +2 -2
- package/dist/components/wizard/wizard-layout.js +10 -8
- package/dist/components/wizard/wizard-tabs.js +2 -2
- package/dist/components/wizard/wizard-tabs.test.js +2 -2
- package/dist/components/wizard/wizard.js +29 -27
- package/dist/hooks/init.js +32 -30
- package/dist/hooks/init.js.map +1 -1
- package/dist/{loader-2O32KKAQ.js → loader-4YOZCFIP.js} +4 -4
- package/dist/plugins/dummy-skill/.claude-plugin/.content-hash +1 -0
- package/dist/plugins/dummy-skill/.claude-plugin/plugin.json +13 -0
- package/dist/{source-loader-KMEBBZCQ.js → source-loader-O5RMYUBW.js} +6 -5
- package/dist/{source-manager-5XBSPJNR.js → source-manager-NKLL6HCL.js} +6 -5
- package/dist/stores/matrix-store.js +15 -0
- package/dist/stores/matrix-store.js.map +1 -0
- package/dist/stores/matrix-store.test.js +123 -0
- package/dist/stores/matrix-store.test.js.map +1 -0
- package/dist/stores/wizard-store.js +6 -5
- package/dist/stores/wizard-store.test.js +150 -113
- package/dist/stores/wizard-store.test.js.map +1 -1
- package/package.json +1 -1
- package/dist/chunk-46DQG2N7.js.map +0 -1
- package/dist/chunk-52XO4ULK.js.map +0 -1
- package/dist/chunk-6DAZG54T.js.map +0 -1
- package/dist/chunk-7FMEMXJ4.js +0 -277
- package/dist/chunk-7FMEMXJ4.js.map +0 -1
- package/dist/chunk-AX3SZZWA.js.map +0 -1
- package/dist/chunk-BFD5NZQ4.js.map +0 -1
- package/dist/chunk-BKJHAJQW.js.map +0 -1
- package/dist/chunk-FWMWWE3X.js.map +0 -1
- package/dist/chunk-GH2RQ4MI.js.map +0 -1
- package/dist/chunk-H5DASUX5.js.map +0 -1
- package/dist/chunk-H7WJK7NJ.js.map +0 -1
- package/dist/chunk-IGM6HA3S.js.map +0 -1
- package/dist/chunk-KD2YS76O.js +0 -151
- package/dist/chunk-KD2YS76O.js.map +0 -1
- package/dist/chunk-KDO6WU76.js.map +0 -1
- package/dist/chunk-KIWFEBKH.js.map +0 -1
- package/dist/chunk-M6YWRMXH.js.map +0 -1
- package/dist/chunk-MMFQNJPE.js.map +0 -1
- package/dist/chunk-MR6OBL3B.js.map +0 -1
- package/dist/chunk-O6BA7Q2B.js.map +0 -1
- package/dist/chunk-SDKCQXWE.js.map +0 -1
- package/dist/chunk-WHISPMAQ.js.map +0 -1
- package/dist/chunk-YHOHLNHM.js.map +0 -1
- package/dist/chunk-Z3TM4N37.js.map +0 -1
- /package/dist/{chunk-MGNYPVOJ.js.map → chunk-AQYAVLZK.js.map} +0 -0
- /package/dist/{chunk-BNQ5O6LE.js.map → chunk-AUNBGZS4.js.map} +0 -0
- /package/dist/{chunk-VR3CDXDT.js.map → chunk-EE5EPS32.js.map} +0 -0
- /package/dist/{chunk-OCEFD7V6.js.map → chunk-F3REOP7N.js.map} +0 -0
- /package/dist/{chunk-C577AJE7.js.map → chunk-FGLUQSVU.js.map} +0 -0
- /package/dist/{chunk-X5EG4EFP.js.map → chunk-MWGDG4QN.js.map} +0 -0
- /package/dist/{chunk-CIG7IKX3.js.map → chunk-OV5UJWS5.js.map} +0 -0
- /package/dist/{chunk-IEEVXLJB.js.map → chunk-R46CB36B.js.map} +0 -0
- /package/dist/{chunk-XUDTFI4M.js.map → chunk-T5DJCIUP.js.map} +0 -0
- /package/dist/{chunk-AJJJE7F7.js.map → chunk-TQLDQ3XZ.js.map} +0 -0
- /package/dist/{chunk-WYVDNGJB.js.map → chunk-XMLCXRTS.js.map} +0 -0
- /package/dist/{chunk-SDLDPFNV.js.map → chunk-YEGPTBX5.js.map} +0 -0
- /package/dist/{chunk-SRBN6RRD.js.map → chunk-ZFY5EMDV.js.map} +0 -0
- /package/dist/{loader-2O32KKAQ.js.map → loader-4YOZCFIP.js.map} +0 -0
- /package/dist/{source-loader-KMEBBZCQ.js.map → source-loader-O5RMYUBW.js.map} +0 -0
- /package/dist/{source-manager-5XBSPJNR.js.map → source-manager-NKLL6HCL.js.map} +0 -0
|
@@ -4,11 +4,17 @@ import {
|
|
|
4
4
|
loadPluginSkills,
|
|
5
5
|
loadSkillsByIds,
|
|
6
6
|
parseFrontmatter
|
|
7
|
-
} from "./chunk-
|
|
7
|
+
} from "./chunk-F3REOP7N.js";
|
|
8
8
|
import {
|
|
9
9
|
typedEntries,
|
|
10
10
|
typedKeys
|
|
11
11
|
} from "./chunk-T4EXUIBY.js";
|
|
12
|
+
import {
|
|
13
|
+
findSkill,
|
|
14
|
+
getMatrix,
|
|
15
|
+
getSkill,
|
|
16
|
+
useMatrixStore
|
|
17
|
+
} from "./chunk-BKL3DF2Q.js";
|
|
12
18
|
import {
|
|
13
19
|
CATEGORY_VALUES,
|
|
14
20
|
DOMAIN_VALUES,
|
|
@@ -52,7 +58,7 @@ import {
|
|
|
52
58
|
warn,
|
|
53
59
|
warnUnknownFields,
|
|
54
60
|
writeFile
|
|
55
|
-
} from "./chunk-
|
|
61
|
+
} from "./chunk-LMZXL5RQ.js";
|
|
56
62
|
import {
|
|
57
63
|
CACHE_DIR,
|
|
58
64
|
CACHE_HASH_LENGTH,
|
|
@@ -88,7 +94,7 @@ import {
|
|
|
88
94
|
STANDARD_FILES,
|
|
89
95
|
YAML_FORMATTING,
|
|
90
96
|
yamlSchemaComment
|
|
91
|
-
} from "./chunk-
|
|
97
|
+
} from "./chunk-EGMQ3SXN.js";
|
|
92
98
|
import {
|
|
93
99
|
defaultCategories,
|
|
94
100
|
defaultRules,
|
|
@@ -100,7 +106,7 @@ import {
|
|
|
100
106
|
|
|
101
107
|
// src/cli/lib/loading/source-loader.ts
|
|
102
108
|
init_esm_shims();
|
|
103
|
-
import
|
|
109
|
+
import os9 from "os";
|
|
104
110
|
import path26 from "path";
|
|
105
111
|
import { unique as unique4 } from "remeda";
|
|
106
112
|
|
|
@@ -216,13 +222,17 @@ async function loadGlobalSourceConfig() {
|
|
|
216
222
|
verbose(`Loaded global config from ${homeDir}`);
|
|
217
223
|
return data;
|
|
218
224
|
}
|
|
219
|
-
async function
|
|
225
|
+
async function writeProjectSourceConfig(projectDir, config) {
|
|
220
226
|
const configPath = getProjectConfigPath(projectDir);
|
|
221
227
|
await ensureDir(path2.join(projectDir, CLAUDE_SRC_DIR));
|
|
222
228
|
const cleaned = JSON.parse(JSON.stringify(config));
|
|
223
229
|
const body = JSON.stringify(cleaned, null, 2);
|
|
224
|
-
const content =
|
|
225
|
-
|
|
230
|
+
const content = [
|
|
231
|
+
`import type { ProjectConfig } from "./config-types";`,
|
|
232
|
+
``,
|
|
233
|
+
`export default ${body} satisfies ProjectConfig;`,
|
|
234
|
+
``
|
|
235
|
+
].join("\n");
|
|
226
236
|
await writeFile(configPath, content);
|
|
227
237
|
verbose(`Saved project config to ${configPath}`);
|
|
228
238
|
}
|
|
@@ -504,13 +514,14 @@ function extractCategoryFromPath(categoryPath) {
|
|
|
504
514
|
if (categoryPath === "local") return void 0;
|
|
505
515
|
return categoryPath;
|
|
506
516
|
}
|
|
507
|
-
function generateProjectConfigFromSkills(name, selectedSkillIds,
|
|
517
|
+
function generateProjectConfigFromSkills(name, selectedSkillIds, options) {
|
|
518
|
+
const matrix = getMatrix();
|
|
508
519
|
const agentList = options?.selectedAgents ? [...options.selectedAgents].sort() : [];
|
|
509
520
|
verbose(
|
|
510
521
|
`generateProjectConfigFromSkills: ${selectedSkillIds.length} skills, matrix has ${typedKeys(matrix.skills).length} entries, agents=[${agentList.join(", ")}]`
|
|
511
522
|
);
|
|
512
523
|
const looked = selectedSkillIds.map((skillId) => {
|
|
513
|
-
const skill =
|
|
524
|
+
const skill = findSkill(skillId);
|
|
514
525
|
if (!skill) warn(`Skill '${skillId}' NOT FOUND in matrix`);
|
|
515
526
|
return { skillId, skill };
|
|
516
527
|
});
|
|
@@ -868,7 +879,7 @@ async function mergeWithExistingConfig(newConfig, context) {
|
|
|
868
879
|
init_esm_shims();
|
|
869
880
|
async function saveSourceToProjectConfig(projectDir, source) {
|
|
870
881
|
const existing = await loadProjectSourceConfig(projectDir) ?? {};
|
|
871
|
-
await
|
|
882
|
+
await writeProjectSourceConfig(projectDir, { ...existing, source });
|
|
872
883
|
}
|
|
873
884
|
|
|
874
885
|
// src/cli/lib/configuration/source-manager.ts
|
|
@@ -1431,23 +1442,25 @@ function resolveSuggestedStacks() {
|
|
|
1431
1442
|
// src/cli/lib/matrix/matrix-resolver.ts
|
|
1432
1443
|
init_esm_shims();
|
|
1433
1444
|
import { groupBy } from "remeda";
|
|
1434
|
-
function getLabel(skill
|
|
1435
|
-
return skill
|
|
1445
|
+
function getLabel(skill) {
|
|
1446
|
+
return skill.displayName;
|
|
1436
1447
|
}
|
|
1437
|
-
function resolveAlias(skillId
|
|
1448
|
+
function resolveAlias(skillId) {
|
|
1449
|
+
const matrix = getMatrix();
|
|
1438
1450
|
if (matrix.skills[skillId]) return skillId;
|
|
1439
1451
|
throw new Error(`Unknown skill ID: '${skillId}' \u2014 not found in the matrix`);
|
|
1440
1452
|
}
|
|
1441
|
-
function initializeSelectionContext(currentSelections
|
|
1442
|
-
const resolvedSelections = currentSelections.map((s) => resolveAlias(s
|
|
1453
|
+
function initializeSelectionContext(currentSelections) {
|
|
1454
|
+
const resolvedSelections = currentSelections.map((s) => resolveAlias(s));
|
|
1443
1455
|
const selectedSet = new Set(resolvedSelections);
|
|
1444
1456
|
return { resolvedSelections, selectedSet };
|
|
1445
1457
|
}
|
|
1446
|
-
function isDiscouraged(skillId, currentSelections
|
|
1447
|
-
const
|
|
1458
|
+
function isDiscouraged(skillId, currentSelections) {
|
|
1459
|
+
const matrix = getMatrix();
|
|
1460
|
+
const fullId = resolveAlias(skillId);
|
|
1448
1461
|
const skill = matrix.skills[fullId];
|
|
1449
1462
|
if (!skill) return false;
|
|
1450
|
-
const { resolvedSelections, selectedSet } = initializeSelectionContext(currentSelections
|
|
1463
|
+
const { resolvedSelections, selectedSet } = initializeSelectionContext(currentSelections);
|
|
1451
1464
|
for (const selectedId of resolvedSelections) {
|
|
1452
1465
|
const selectedSkill = matrix.skills[selectedId];
|
|
1453
1466
|
if (selectedSkill?.discourages.some((d) => d.skillId === fullId)) {
|
|
@@ -1481,11 +1494,12 @@ function isDiscouraged(skillId, currentSelections, matrix) {
|
|
|
1481
1494
|
}
|
|
1482
1495
|
return false;
|
|
1483
1496
|
}
|
|
1484
|
-
function getDiscourageReason(skillId, currentSelections
|
|
1485
|
-
const
|
|
1497
|
+
function getDiscourageReason(skillId, currentSelections) {
|
|
1498
|
+
const matrix = getMatrix();
|
|
1499
|
+
const fullId = resolveAlias(skillId);
|
|
1486
1500
|
const skill = matrix.skills[fullId];
|
|
1487
1501
|
if (!skill) return void 0;
|
|
1488
|
-
const { resolvedSelections, selectedSet } = initializeSelectionContext(currentSelections
|
|
1502
|
+
const { resolvedSelections, selectedSet } = initializeSelectionContext(currentSelections);
|
|
1489
1503
|
for (const selectedId of resolvedSelections) {
|
|
1490
1504
|
const selectedSkill = matrix.skills[selectedId];
|
|
1491
1505
|
if (selectedSkill) {
|
|
@@ -1502,14 +1516,13 @@ function getDiscourageReason(skillId, currentSelections, matrix) {
|
|
|
1502
1516
|
for (const selectedId of resolvedSelections) {
|
|
1503
1517
|
const conflict = skill.conflictsWith.find((c) => c.skillId === selectedId);
|
|
1504
1518
|
if (conflict) {
|
|
1505
|
-
|
|
1506
|
-
return `${conflict.reason} (conflicts with ${getLabel(selectedSkill2, selectedId)})`;
|
|
1519
|
+
return `${conflict.reason} (conflicts with ${getLabel(matrix.skills[selectedId])})`;
|
|
1507
1520
|
}
|
|
1508
1521
|
const selectedSkill = matrix.skills[selectedId];
|
|
1509
1522
|
if (selectedSkill) {
|
|
1510
1523
|
const reverseConflict = selectedSkill.conflictsWith.find((c) => c.skillId === fullId);
|
|
1511
1524
|
if (reverseConflict) {
|
|
1512
|
-
return `${reverseConflict.reason} (conflicts with ${getLabel(selectedSkill
|
|
1525
|
+
return `${reverseConflict.reason} (conflicts with ${getLabel(selectedSkill)})`;
|
|
1513
1526
|
}
|
|
1514
1527
|
}
|
|
1515
1528
|
}
|
|
@@ -1517,21 +1530,28 @@ function getDiscourageReason(skillId, currentSelections, matrix) {
|
|
|
1517
1530
|
if (requirement.needsAny) {
|
|
1518
1531
|
const hasAny = requirement.skillIds.some((reqId) => selectedSet.has(reqId));
|
|
1519
1532
|
if (!hasAny) {
|
|
1520
|
-
const requiredNames = requirement.skillIds.map((id) =>
|
|
1533
|
+
const requiredNames = requirement.skillIds.map((id) => {
|
|
1534
|
+
const s = findSkill(id);
|
|
1535
|
+
return s ? getLabel(s) : id;
|
|
1536
|
+
}).join(" or ");
|
|
1521
1537
|
return `${requirement.reason} (requires ${requiredNames})`;
|
|
1522
1538
|
}
|
|
1523
1539
|
} else {
|
|
1524
1540
|
const missingIds = requirement.skillIds.filter((reqId) => !selectedSet.has(reqId));
|
|
1525
1541
|
if (missingIds.length > 0) {
|
|
1526
|
-
const missingNames = missingIds.map((id) =>
|
|
1542
|
+
const missingNames = missingIds.map((id) => {
|
|
1543
|
+
const s = findSkill(id);
|
|
1544
|
+
return s ? getLabel(s) : id;
|
|
1545
|
+
}).join(", ");
|
|
1527
1546
|
return `${requirement.reason} (requires ${missingNames})`;
|
|
1528
1547
|
}
|
|
1529
1548
|
}
|
|
1530
1549
|
}
|
|
1531
1550
|
return void 0;
|
|
1532
1551
|
}
|
|
1533
|
-
function isRecommended(skillId, currentSelections
|
|
1534
|
-
const
|
|
1552
|
+
function isRecommended(skillId, currentSelections) {
|
|
1553
|
+
const matrix = getMatrix();
|
|
1554
|
+
const fullId = resolveAlias(skillId);
|
|
1535
1555
|
const skill = matrix.skills[fullId];
|
|
1536
1556
|
if (!skill) return false;
|
|
1537
1557
|
if (!skill.isRecommended) {
|
|
@@ -1540,7 +1560,7 @@ function isRecommended(skillId, currentSelections, matrix) {
|
|
|
1540
1560
|
if (currentSelections.length === 0) {
|
|
1541
1561
|
return true;
|
|
1542
1562
|
}
|
|
1543
|
-
const { resolvedSelections } = initializeSelectionContext(currentSelections
|
|
1563
|
+
const { resolvedSelections } = initializeSelectionContext(currentSelections);
|
|
1544
1564
|
if (skill.compatibleWith.length === 0) {
|
|
1545
1565
|
return true;
|
|
1546
1566
|
}
|
|
@@ -1551,13 +1571,15 @@ function isRecommended(skillId, currentSelections, matrix) {
|
|
|
1551
1571
|
}
|
|
1552
1572
|
return false;
|
|
1553
1573
|
}
|
|
1554
|
-
function getRecommendReason(skillId, _currentSelections
|
|
1555
|
-
const
|
|
1574
|
+
function getRecommendReason(skillId, _currentSelections) {
|
|
1575
|
+
const matrix = getMatrix();
|
|
1576
|
+
const fullId = resolveAlias(skillId);
|
|
1556
1577
|
const skill = matrix.skills[fullId];
|
|
1557
1578
|
if (!skill) return void 0;
|
|
1558
1579
|
return skill.recommendedReason;
|
|
1559
1580
|
}
|
|
1560
|
-
function validateConflicts(resolvedSelections
|
|
1581
|
+
function validateConflicts(resolvedSelections) {
|
|
1582
|
+
const matrix = getMatrix();
|
|
1561
1583
|
const errors = [];
|
|
1562
1584
|
for (let i = 0; i < resolvedSelections.length; i++) {
|
|
1563
1585
|
const skillA = matrix.skills[resolvedSelections[i]];
|
|
@@ -1568,7 +1590,7 @@ function validateConflicts(resolvedSelections, matrix) {
|
|
|
1568
1590
|
if (conflict) {
|
|
1569
1591
|
errors.push({
|
|
1570
1592
|
type: "conflict",
|
|
1571
|
-
message: `${getLabel(skillA
|
|
1593
|
+
message: `${getLabel(skillA)} conflicts with ${getLabel(matrix.skills[skillBId])}: ${conflict.reason}`,
|
|
1572
1594
|
skills: [skillA.id, skillBId]
|
|
1573
1595
|
});
|
|
1574
1596
|
}
|
|
@@ -1576,7 +1598,8 @@ function validateConflicts(resolvedSelections, matrix) {
|
|
|
1576
1598
|
}
|
|
1577
1599
|
return { errors, warnings: [] };
|
|
1578
1600
|
}
|
|
1579
|
-
function validateRequirements(resolvedSelections, selectedSet
|
|
1601
|
+
function validateRequirements(resolvedSelections, selectedSet) {
|
|
1602
|
+
const matrix = getMatrix();
|
|
1580
1603
|
const errors = [];
|
|
1581
1604
|
for (const skillId of resolvedSelections) {
|
|
1582
1605
|
const skill = matrix.skills[skillId];
|
|
@@ -1587,7 +1610,7 @@ function validateRequirements(resolvedSelections, selectedSet, matrix) {
|
|
|
1587
1610
|
if (!hasAny) {
|
|
1588
1611
|
errors.push({
|
|
1589
1612
|
type: "missingRequirement",
|
|
1590
|
-
message: `${getLabel(skill
|
|
1613
|
+
message: `${getLabel(skill)} requires one of: ${requirement.skillIds.map((id) => getLabel(matrix.skills[id])).join(", ")}`,
|
|
1591
1614
|
skills: [skillId, ...requirement.skillIds]
|
|
1592
1615
|
});
|
|
1593
1616
|
}
|
|
@@ -1596,7 +1619,7 @@ function validateRequirements(resolvedSelections, selectedSet, matrix) {
|
|
|
1596
1619
|
if (missingIds.length > 0) {
|
|
1597
1620
|
errors.push({
|
|
1598
1621
|
type: "missingRequirement",
|
|
1599
|
-
message: `${getLabel(skill
|
|
1622
|
+
message: `${getLabel(skill)} requires: ${missingIds.map((id) => getLabel(getSkill(id))).join(", ")}`,
|
|
1600
1623
|
skills: [skillId, ...missingIds]
|
|
1601
1624
|
});
|
|
1602
1625
|
}
|
|
@@ -1605,7 +1628,8 @@ function validateRequirements(resolvedSelections, selectedSet, matrix) {
|
|
|
1605
1628
|
}
|
|
1606
1629
|
return { errors, warnings: [] };
|
|
1607
1630
|
}
|
|
1608
|
-
function validateExclusivity(resolvedSelections
|
|
1631
|
+
function validateExclusivity(resolvedSelections) {
|
|
1632
|
+
const matrix = getMatrix();
|
|
1609
1633
|
const errors = [];
|
|
1610
1634
|
const validSkills = resolvedSelections.map((skillId) => ({ skillId, skill: matrix.skills[skillId] })).filter((entry) => entry.skill != null);
|
|
1611
1635
|
const categorySelections = groupBy(validSkills, (entry) => entry.skill.category);
|
|
@@ -1616,7 +1640,7 @@ function validateExclusivity(resolvedSelections, matrix) {
|
|
|
1616
1640
|
if (category?.exclusive) {
|
|
1617
1641
|
errors.push({
|
|
1618
1642
|
type: "categoryExclusive",
|
|
1619
|
-
message: `Category "${category.displayName}" only allows one selection, but multiple selected: ${skillIds.map((id) => getLabel(matrix.skills[id]
|
|
1643
|
+
message: `Category "${category.displayName}" only allows one selection, but multiple selected: ${skillIds.map((id) => getLabel(matrix.skills[id])).join(", ")}`,
|
|
1620
1644
|
skills: skillIds
|
|
1621
1645
|
});
|
|
1622
1646
|
}
|
|
@@ -1624,7 +1648,8 @@ function validateExclusivity(resolvedSelections, matrix) {
|
|
|
1624
1648
|
}
|
|
1625
1649
|
return { errors, warnings: [] };
|
|
1626
1650
|
}
|
|
1627
|
-
function validateRecommendations(resolvedSelections, selectedSet
|
|
1651
|
+
function validateRecommendations(resolvedSelections, selectedSet) {
|
|
1652
|
+
const matrix = getMatrix();
|
|
1628
1653
|
const warnings = [];
|
|
1629
1654
|
for (const [, skill] of typedEntries(matrix.skills)) {
|
|
1630
1655
|
if (!skill) continue;
|
|
@@ -1636,13 +1661,14 @@ function validateRecommendations(resolvedSelections, selectedSet, matrix) {
|
|
|
1636
1661
|
if (hasConflict) continue;
|
|
1637
1662
|
warnings.push({
|
|
1638
1663
|
type: "missing_recommendation",
|
|
1639
|
-
message: `${getLabel(skill
|
|
1664
|
+
message: `${getLabel(skill)} is recommended: ${skill.recommendedReason ?? ""}`,
|
|
1640
1665
|
skills: [skill.id]
|
|
1641
1666
|
});
|
|
1642
1667
|
}
|
|
1643
1668
|
return { errors: [], warnings };
|
|
1644
1669
|
}
|
|
1645
|
-
function validateSetupUsage(resolvedSelections, selectedSet
|
|
1670
|
+
function validateSetupUsage(resolvedSelections, selectedSet) {
|
|
1671
|
+
const matrix = getMatrix();
|
|
1646
1672
|
const warnings = [];
|
|
1647
1673
|
for (const skillId of resolvedSelections) {
|
|
1648
1674
|
const skill = matrix.skills[skillId];
|
|
@@ -1651,7 +1677,7 @@ function validateSetupUsage(resolvedSelections, selectedSet, matrix) {
|
|
|
1651
1677
|
if (!hasUsageSkill) {
|
|
1652
1678
|
warnings.push({
|
|
1653
1679
|
type: "unused_setup",
|
|
1654
|
-
message: `Setup skill "${getLabel(skill
|
|
1680
|
+
message: `Setup skill "${getLabel(skill)}" selected but no corresponding usage skills: ${skill.providesSetupFor.map((id) => getLabel(matrix.skills[id])).join(", ")}`,
|
|
1655
1681
|
skills: [skillId, ...skill.providesSetupFor]
|
|
1656
1682
|
});
|
|
1657
1683
|
}
|
|
@@ -1664,14 +1690,14 @@ function mergeValidationResults(results) {
|
|
|
1664
1690
|
warnings: results.flatMap((r) => r.warnings)
|
|
1665
1691
|
};
|
|
1666
1692
|
}
|
|
1667
|
-
function validateSelection(selections
|
|
1668
|
-
const { resolvedSelections, selectedSet } = initializeSelectionContext(selections
|
|
1693
|
+
function validateSelection(selections) {
|
|
1694
|
+
const { resolvedSelections, selectedSet } = initializeSelectionContext(selections);
|
|
1669
1695
|
const { errors, warnings } = mergeValidationResults([
|
|
1670
|
-
validateConflicts(resolvedSelections
|
|
1671
|
-
validateRequirements(resolvedSelections, selectedSet
|
|
1672
|
-
validateExclusivity(resolvedSelections
|
|
1673
|
-
validateRecommendations(resolvedSelections, selectedSet
|
|
1674
|
-
validateSetupUsage(resolvedSelections, selectedSet
|
|
1696
|
+
validateConflicts(resolvedSelections),
|
|
1697
|
+
validateRequirements(resolvedSelections, selectedSet),
|
|
1698
|
+
validateExclusivity(resolvedSelections),
|
|
1699
|
+
validateRecommendations(resolvedSelections, selectedSet),
|
|
1700
|
+
validateSetupUsage(resolvedSelections, selectedSet)
|
|
1675
1701
|
]);
|
|
1676
1702
|
return {
|
|
1677
1703
|
valid: errors.length === 0,
|
|
@@ -1679,25 +1705,23 @@ function validateSelection(selections, matrix) {
|
|
|
1679
1705
|
warnings
|
|
1680
1706
|
};
|
|
1681
1707
|
}
|
|
1682
|
-
function getAvailableSkills(categoryId, currentSelections
|
|
1708
|
+
function getAvailableSkills(categoryId, currentSelections) {
|
|
1709
|
+
const matrix = getMatrix();
|
|
1683
1710
|
const skillOptions = [];
|
|
1684
|
-
const { selectedSet } = initializeSelectionContext(currentSelections
|
|
1711
|
+
const { selectedSet } = initializeSelectionContext(currentSelections);
|
|
1685
1712
|
for (const skill of Object.values(matrix.skills)) {
|
|
1686
1713
|
if (!skill) continue;
|
|
1687
1714
|
if (skill.category !== categoryId) {
|
|
1688
1715
|
continue;
|
|
1689
1716
|
}
|
|
1690
|
-
const discouraged = isDiscouraged(skill.id, currentSelections
|
|
1691
|
-
const recommended = !discouraged && isRecommended(skill.id, currentSelections
|
|
1717
|
+
const discouraged = isDiscouraged(skill.id, currentSelections);
|
|
1718
|
+
const recommended = !discouraged && isRecommended(skill.id, currentSelections);
|
|
1692
1719
|
skillOptions.push({
|
|
1693
1720
|
id: skill.id,
|
|
1694
|
-
slug: skill.slug,
|
|
1695
|
-
displayName: skill.displayName,
|
|
1696
|
-
description: skill.description,
|
|
1697
1721
|
discouraged,
|
|
1698
|
-
discouragedReason: discouraged ? getDiscourageReason(skill.id, currentSelections
|
|
1722
|
+
discouragedReason: discouraged ? getDiscourageReason(skill.id, currentSelections) : void 0,
|
|
1699
1723
|
recommended,
|
|
1700
|
-
recommendedReason: recommended ? getRecommendReason(skill.id, currentSelections
|
|
1724
|
+
recommendedReason: recommended ? getRecommendReason(skill.id, currentSelections) : void 0,
|
|
1701
1725
|
selected: selectedSet.has(skill.id),
|
|
1702
1726
|
alternatives: skill.alternatives.map((a) => a.skillId)
|
|
1703
1727
|
});
|
|
@@ -1955,6 +1979,7 @@ async function detectInstallation(projectDir = process.cwd()) {
|
|
|
1955
1979
|
|
|
1956
1980
|
// src/cli/lib/installation/local-installer.ts
|
|
1957
1981
|
init_esm_shims();
|
|
1982
|
+
import os7 from "os";
|
|
1958
1983
|
import path19 from "path";
|
|
1959
1984
|
|
|
1960
1985
|
// src/cli/lib/skills/index.ts
|
|
@@ -3081,14 +3106,32 @@ async function claudePluginUninstall(pluginName, scope, projectDir) {
|
|
|
3081
3106
|
|
|
3082
3107
|
// src/cli/lib/configuration/config-writer.ts
|
|
3083
3108
|
init_esm_shims();
|
|
3084
|
-
import
|
|
3109
|
+
import os6 from "os";
|
|
3085
3110
|
import path18 from "path";
|
|
3086
3111
|
|
|
3087
3112
|
// src/cli/lib/configuration/config-types-writer.ts
|
|
3088
3113
|
init_esm_shims();
|
|
3114
|
+
import os5 from "os";
|
|
3089
3115
|
import path17 from "path";
|
|
3090
3116
|
import { unique as unique3 } from "remeda";
|
|
3091
3117
|
var MULTI_LINE_THRESHOLD = 6;
|
|
3118
|
+
async function getGlobalConfigTypesPath() {
|
|
3119
|
+
const globalConfigTypesPath = path17.join(
|
|
3120
|
+
GLOBAL_INSTALL_ROOT,
|
|
3121
|
+
CLAUDE_SRC_DIR,
|
|
3122
|
+
STANDARD_FILES.CONFIG_TYPES_TS
|
|
3123
|
+
);
|
|
3124
|
+
if (await fileExists(globalConfigTypesPath)) {
|
|
3125
|
+
return globalConfigTypesPath;
|
|
3126
|
+
}
|
|
3127
|
+
return null;
|
|
3128
|
+
}
|
|
3129
|
+
function computeGlobalTypesImportPath(projectDir) {
|
|
3130
|
+
const projectClaudeSrc = path17.join(projectDir, CLAUDE_SRC_DIR);
|
|
3131
|
+
const globalClaudeSrc = path17.join(GLOBAL_INSTALL_ROOT, CLAUDE_SRC_DIR);
|
|
3132
|
+
const relativePath = path17.relative(projectClaudeSrc, globalClaudeSrc);
|
|
3133
|
+
return relativePath.split(path17.sep).join("/");
|
|
3134
|
+
}
|
|
3092
3135
|
var PROJECT_CONFIG_INTERFACE_TEMPLATE = `export type InstallMode = "local" | "plugin" | "mixed";
|
|
3093
3136
|
|
|
3094
3137
|
export type SkillConfig = {
|
|
@@ -3150,8 +3193,8 @@ function loadConfigTypesDataInBackground(sourceFlag, projectDir) {
|
|
|
3150
3193
|
if (!await directoryExists(claudeSrcDir)) {
|
|
3151
3194
|
throw new Error(`${CLAUDE_SRC_DIR}/ not found \u2014 run '${CLI_BIN_NAME} init' first`);
|
|
3152
3195
|
}
|
|
3153
|
-
const { loadSkillsMatrixFromSource: loadSkillsMatrixFromSource2 } = await import("./source-loader-
|
|
3154
|
-
const { loadAllAgents: loadAllAgents2 } = await import("./loader-
|
|
3196
|
+
const { loadSkillsMatrixFromSource: loadSkillsMatrixFromSource2 } = await import("./source-loader-O5RMYUBW.js");
|
|
3197
|
+
const { loadAllAgents: loadAllAgents2 } = await import("./loader-4YOZCFIP.js");
|
|
3155
3198
|
const sourceResult = await loadSkillsMatrixFromSource2({
|
|
3156
3199
|
sourceFlag,
|
|
3157
3200
|
projectDir,
|
|
@@ -3171,25 +3214,48 @@ function loadConfigTypesDataInBackground(sourceFlag, projectDir) {
|
|
|
3171
3214
|
async function regenerateConfigTypes(projectDir, backgroundData, extras) {
|
|
3172
3215
|
const data = await backgroundData;
|
|
3173
3216
|
const claudeSrcDir = path17.join(projectDir, CLAUDE_SRC_DIR);
|
|
3174
|
-
const
|
|
3175
|
-
|
|
3176
|
-
|
|
3177
|
-
|
|
3178
|
-
|
|
3179
|
-
|
|
3217
|
+
const isProjectScope = path17.resolve(projectDir) !== path17.resolve(os5.homedir());
|
|
3218
|
+
const globalConfigTypes = isProjectScope ? await getGlobalConfigTypesPath() : null;
|
|
3219
|
+
let source;
|
|
3220
|
+
if (globalConfigTypes) {
|
|
3221
|
+
source = generateProjectConfigTypesSource({
|
|
3222
|
+
globalTypesImportPath: computeGlobalTypesImportPath(projectDir),
|
|
3223
|
+
projectSkillIds: extras?.extraSkillIds ?? [],
|
|
3224
|
+
projectAgentNames: extras?.extraAgentNames ?? [],
|
|
3225
|
+
projectDomains: extras?.extraDomains ?? []
|
|
3226
|
+
});
|
|
3227
|
+
verbose("Using project config-types.ts that imports from global");
|
|
3228
|
+
} else {
|
|
3229
|
+
source = generateConfigTypesSource(data.matrix, data.agentNames, data.customAgentNames, extras);
|
|
3230
|
+
}
|
|
3180
3231
|
const configTypesPath = path17.join(claudeSrcDir, STANDARD_FILES.CONFIG_TYPES_TS);
|
|
3181
3232
|
await writeFile(configTypesPath, source);
|
|
3182
3233
|
verbose(`Regenerated ${STANDARD_FILES.CONFIG_TYPES_TS}`);
|
|
3183
3234
|
}
|
|
3184
|
-
function generateConfigTypesSource(matrix, agentNames, customAgentNames = [], extras) {
|
|
3235
|
+
function generateConfigTypesSource(matrix, agentNames, customAgentNames = [], extras, config) {
|
|
3185
3236
|
const extraSkillIds = extras?.extraSkillIds ?? [];
|
|
3186
3237
|
const extraAgentNamesArr = extras?.extraAgentNames ?? [];
|
|
3187
3238
|
const extraDomainsArr = extras?.extraDomains ?? [];
|
|
3188
3239
|
const extraCategoriesArr = extras?.extraCategories ?? [];
|
|
3189
|
-
|
|
3190
|
-
|
|
3191
|
-
|
|
3192
|
-
|
|
3240
|
+
let skillIds;
|
|
3241
|
+
let sortedAgents;
|
|
3242
|
+
let domains;
|
|
3243
|
+
let categories;
|
|
3244
|
+
if (config) {
|
|
3245
|
+
const configSkillIds = config.skills.map((s) => s.id);
|
|
3246
|
+
skillIds = unique3([...configSkillIds, ...extraSkillIds]).sort();
|
|
3247
|
+
const configAgentNames = config.agents.map((a) => a.name);
|
|
3248
|
+
sortedAgents = unique3([...configAgentNames, ...extraAgentNamesArr]).sort();
|
|
3249
|
+
const configCategories = deriveCategories(configSkillIds, matrix);
|
|
3250
|
+
categories = unique3([...configCategories, ...extraCategoriesArr]).sort();
|
|
3251
|
+
const configDomains = deriveDomains(categories, matrix);
|
|
3252
|
+
domains = unique3([...configDomains, ...extraDomainsArr]).sort();
|
|
3253
|
+
} else {
|
|
3254
|
+
skillIds = unique3([...typedKeys(matrix.skills), ...extraSkillIds]).sort();
|
|
3255
|
+
sortedAgents = unique3([...agentNames, ...extraAgentNamesArr]).sort();
|
|
3256
|
+
domains = unique3([...extractDomains(matrix), ...extraDomainsArr]).sort();
|
|
3257
|
+
categories = unique3([...typedKeys(matrix.categories), ...extraCategoriesArr]).sort();
|
|
3258
|
+
}
|
|
3193
3259
|
const customSkillSet = new Set(extraSkillIds);
|
|
3194
3260
|
for (const id of typedKeys(matrix.skills)) {
|
|
3195
3261
|
const skill = matrix.skills[id];
|
|
@@ -3248,6 +3314,26 @@ function extractDomains(matrix) {
|
|
|
3248
3314
|
}
|
|
3249
3315
|
return [...domainSet].sort();
|
|
3250
3316
|
}
|
|
3317
|
+
function deriveCategories(skillIds, matrix) {
|
|
3318
|
+
const categorySet = /* @__PURE__ */ new Set();
|
|
3319
|
+
for (const id of skillIds) {
|
|
3320
|
+
const skill = matrix.skills[id];
|
|
3321
|
+
if (skill?.category && skill.category !== "local") {
|
|
3322
|
+
categorySet.add(skill.category);
|
|
3323
|
+
}
|
|
3324
|
+
}
|
|
3325
|
+
return [...categorySet];
|
|
3326
|
+
}
|
|
3327
|
+
function deriveDomains(categories, matrix) {
|
|
3328
|
+
const domainSet = /* @__PURE__ */ new Set();
|
|
3329
|
+
for (const cat of categories) {
|
|
3330
|
+
const def = matrix.categories[cat];
|
|
3331
|
+
if (def?.domain) {
|
|
3332
|
+
domainSet.add(def.domain);
|
|
3333
|
+
}
|
|
3334
|
+
}
|
|
3335
|
+
return [...domainSet];
|
|
3336
|
+
}
|
|
3251
3337
|
function formatSectionedUnion(custom, marketplace) {
|
|
3252
3338
|
if (custom.length === 0 && marketplace.length === 0) {
|
|
3253
3339
|
return "string";
|
|
@@ -3285,53 +3371,195 @@ function formatUnion(members) {
|
|
|
3285
3371
|
}
|
|
3286
3372
|
return "\n" + quoted.map((q) => ` | ${q}`).join("\n");
|
|
3287
3373
|
}
|
|
3374
|
+
function generateProjectConfigTypesSource(options) {
|
|
3375
|
+
const importPath = `${options.globalTypesImportPath}/config-types`;
|
|
3376
|
+
const skillIdUnion = formatExtendedUnion("GlobalSkillId", options.projectSkillIds);
|
|
3377
|
+
const agentNameUnion = formatExtendedUnion("GlobalAgentName", options.projectAgentNames);
|
|
3378
|
+
const domainUnion = formatExtendedUnion("GlobalDomain", options.projectDomains);
|
|
3379
|
+
const hasProjectCategories = options.projectCategories && options.projectCategories.length > 0;
|
|
3380
|
+
const categoryUnion = hasProjectCategories ? formatExtendedUnion("GlobalCategory", options.projectCategories) : "GlobalCategory";
|
|
3381
|
+
const categoryImport = ` Category as GlobalCategory,
|
|
3382
|
+
`;
|
|
3383
|
+
return `// AUTO-GENERATED by agentsinc \u2014 DO NOT EDIT
|
|
3384
|
+
|
|
3385
|
+
import type {
|
|
3386
|
+
SkillId as GlobalSkillId,
|
|
3387
|
+
AgentName as GlobalAgentName,
|
|
3388
|
+
Domain as GlobalDomain,
|
|
3389
|
+
${categoryImport}} from "${importPath}";
|
|
3390
|
+
|
|
3391
|
+
export type SkillId = ${skillIdUnion};
|
|
3392
|
+
|
|
3393
|
+
export type AgentName = ${agentNameUnion};
|
|
3394
|
+
|
|
3395
|
+
export type Domain = ${domainUnion};
|
|
3396
|
+
|
|
3397
|
+
export type Category = ${categoryUnion};
|
|
3398
|
+
|
|
3399
|
+
${PROJECT_CONFIG_INTERFACE_TEMPLATE}`;
|
|
3400
|
+
}
|
|
3401
|
+
function formatExtendedUnion(globalTypeName, projectMembers) {
|
|
3402
|
+
if (projectMembers.length === 0) {
|
|
3403
|
+
return globalTypeName;
|
|
3404
|
+
}
|
|
3405
|
+
const sorted = [...projectMembers].sort();
|
|
3406
|
+
const quoted = sorted.map((m) => `"${m}"`);
|
|
3407
|
+
if (quoted.length < MULTI_LINE_THRESHOLD) {
|
|
3408
|
+
return `${globalTypeName} | ${quoted.join(" | ")}`;
|
|
3409
|
+
}
|
|
3410
|
+
return `
|
|
3411
|
+
| ${globalTypeName}
|
|
3412
|
+
` + quoted.map((q) => ` | ${q}`).join("\n");
|
|
3413
|
+
}
|
|
3288
3414
|
|
|
3289
3415
|
// src/cli/lib/configuration/config-writer.ts
|
|
3416
|
+
var EXTRACTED_FIELDS = /* @__PURE__ */ new Set(["skills", "agents", "stack", "domains"]);
|
|
3290
3417
|
function generateConfigSource(config, options) {
|
|
3291
3418
|
const serializable = config.stack ? { ...config, stack: compactStackForYaml(config.stack) } : { ...config };
|
|
3292
3419
|
const cleaned = JSON.parse(JSON.stringify(serializable));
|
|
3293
3420
|
if (options?.isProjectConfig) {
|
|
3294
3421
|
return generateProjectConfigWithGlobalImport(cleaned, getGlobalConfigImportPath());
|
|
3295
3422
|
}
|
|
3296
|
-
|
|
3297
|
-
|
|
3298
|
-
|
|
3299
|
-
|
|
3300
|
-
|
|
3301
|
-
|
|
3302
|
-
]
|
|
3423
|
+
return generateStandaloneConfig(cleaned);
|
|
3424
|
+
}
|
|
3425
|
+
function generateStandaloneConfig(cleaned) {
|
|
3426
|
+
const skillsArr = cleaned.skills ?? [];
|
|
3427
|
+
const agentsArr = cleaned.agents ?? [];
|
|
3428
|
+
const stackObj = cleaned.stack;
|
|
3429
|
+
const domainsArr = cleaned.domains ?? [];
|
|
3430
|
+
const hasSkills = skillsArr.length > 0;
|
|
3431
|
+
const hasAgents = agentsArr.length > 0;
|
|
3432
|
+
const hasStack = stackObj != null && Object.keys(stackObj).length > 0;
|
|
3433
|
+
const hasDomains = domainsArr.length > 0;
|
|
3434
|
+
const typeImports = buildTypeImports({ hasSkills, hasAgents, hasStack, hasDomains });
|
|
3435
|
+
const lines = [`import type { ${typeImports} } from "./config-types";`];
|
|
3436
|
+
if (hasSkills) {
|
|
3437
|
+
lines.push(``);
|
|
3438
|
+
const items = skillsArr.map((s) => ` ${JSON.stringify(s)},`).join("\n");
|
|
3439
|
+
lines.push(`const skills: SkillConfig[] = [`);
|
|
3440
|
+
lines.push(items);
|
|
3441
|
+
lines.push(`];`);
|
|
3442
|
+
}
|
|
3443
|
+
if (hasAgents) {
|
|
3444
|
+
lines.push(``);
|
|
3445
|
+
const items = agentsArr.map((a) => ` ${JSON.stringify(a)},`).join("\n");
|
|
3446
|
+
lines.push(`const agents: AgentScopeConfig[] = [`);
|
|
3447
|
+
lines.push(items);
|
|
3448
|
+
lines.push(`];`);
|
|
3449
|
+
}
|
|
3450
|
+
if (hasStack) {
|
|
3451
|
+
lines.push(``);
|
|
3452
|
+
const stackBody = JSON.stringify(stackObj, null, 2);
|
|
3453
|
+
lines.push(`const stack: Partial<Record<AgentName, StackAgentConfig>> = ${stackBody};`);
|
|
3454
|
+
}
|
|
3455
|
+
if (hasDomains) {
|
|
3456
|
+
lines.push(``);
|
|
3457
|
+
const items = domainsArr.map((d) => JSON.stringify(d)).join(", ");
|
|
3458
|
+
lines.push(`const domains: Domain[] = [${items}];`);
|
|
3459
|
+
}
|
|
3460
|
+
const exportFields = [];
|
|
3461
|
+
for (const [key, value] of Object.entries(cleaned)) {
|
|
3462
|
+
if (EXTRACTED_FIELDS.has(key)) {
|
|
3463
|
+
if (key === "skills") {
|
|
3464
|
+
exportFields.push(` skills${hasSkills ? "" : ": []"},`);
|
|
3465
|
+
} else if (key === "agents") {
|
|
3466
|
+
exportFields.push(` agents${hasAgents ? "" : ": []"},`);
|
|
3467
|
+
} else if (key === "stack" && hasStack) {
|
|
3468
|
+
exportFields.push(` stack,`);
|
|
3469
|
+
} else if (key === "domains") {
|
|
3470
|
+
exportFields.push(` domains${hasDomains ? "" : ": []"},`);
|
|
3471
|
+
}
|
|
3472
|
+
} else {
|
|
3473
|
+
exportFields.push(` ${JSON.stringify(key)}: ${JSON.stringify(value)},`);
|
|
3474
|
+
}
|
|
3475
|
+
}
|
|
3476
|
+
lines.push(``);
|
|
3477
|
+
lines.push(`export default {`);
|
|
3478
|
+
lines.push(...exportFields);
|
|
3479
|
+
lines.push(`} satisfies ProjectConfig;`);
|
|
3480
|
+
lines.push(``);
|
|
3481
|
+
return lines.join("\n");
|
|
3482
|
+
}
|
|
3483
|
+
function buildTypeImports(flags) {
|
|
3484
|
+
const types = [];
|
|
3485
|
+
if (flags.hasStack) types.push("AgentName");
|
|
3486
|
+
if (flags.hasAgents) types.push("AgentScopeConfig");
|
|
3487
|
+
if (flags.hasDomains) types.push("Domain");
|
|
3488
|
+
types.push("ProjectConfig");
|
|
3489
|
+
if (flags.hasSkills) types.push("SkillConfig");
|
|
3490
|
+
if (flags.hasStack) types.push("StackAgentConfig");
|
|
3491
|
+
return types.join(", ");
|
|
3303
3492
|
}
|
|
3304
3493
|
function generateProjectConfigWithGlobalImport(cleaned, globalImportPath) {
|
|
3305
3494
|
const importPath = `${globalImportPath}/config`;
|
|
3306
|
-
const
|
|
3307
|
-
const
|
|
3308
|
-
const
|
|
3309
|
-
|
|
3310
|
-
|
|
3311
|
-
const
|
|
3312
|
-
const
|
|
3313
|
-
|
|
3314
|
-
|
|
3315
|
-
|
|
3316
|
-
|
|
3317
|
-
|
|
3318
|
-
|
|
3319
|
-
|
|
3320
|
-
|
|
3321
|
-
|
|
3322
|
-
`
|
|
3323
|
-
|
|
3324
|
-
|
|
3325
|
-
|
|
3326
|
-
|
|
3327
|
-
|
|
3328
|
-
|
|
3329
|
-
`
|
|
3330
|
-
|
|
3331
|
-
|
|
3495
|
+
const skillsArr = cleaned.skills ?? [];
|
|
3496
|
+
const agentsArr = cleaned.agents ?? [];
|
|
3497
|
+
const stackObj = cleaned.stack;
|
|
3498
|
+
const domainsArr = cleaned.domains ?? [];
|
|
3499
|
+
const hasProjectDomains = domainsArr.length > 0;
|
|
3500
|
+
const hasStack = stackObj != null && Object.keys(stackObj).length > 0;
|
|
3501
|
+
const typeImports = buildTypeImports({
|
|
3502
|
+
hasSkills: true,
|
|
3503
|
+
// Always present (spread from global)
|
|
3504
|
+
hasAgents: true,
|
|
3505
|
+
// Always present (spread from global)
|
|
3506
|
+
hasStack,
|
|
3507
|
+
hasDomains: hasProjectDomains
|
|
3508
|
+
});
|
|
3509
|
+
const lines = [
|
|
3510
|
+
`import globalConfig from "${importPath}";`,
|
|
3511
|
+
`import type { ${typeImports} } from "./config-types";`
|
|
3512
|
+
];
|
|
3513
|
+
lines.push(``);
|
|
3514
|
+
const skillItems = skillsArr.map((s) => ` ${JSON.stringify(s)},`).join("\n");
|
|
3515
|
+
lines.push(`const skills: SkillConfig[] = [`);
|
|
3516
|
+
lines.push(` ...globalConfig.skills,`);
|
|
3517
|
+
if (skillItems) lines.push(skillItems);
|
|
3518
|
+
lines.push(`];`);
|
|
3519
|
+
lines.push(``);
|
|
3520
|
+
const agentItems = agentsArr.map((a) => ` ${JSON.stringify(a)},`).join("\n");
|
|
3521
|
+
lines.push(`const agents: AgentScopeConfig[] = [`);
|
|
3522
|
+
lines.push(` ...globalConfig.agents,`);
|
|
3523
|
+
if (agentItems) lines.push(agentItems);
|
|
3524
|
+
lines.push(`];`);
|
|
3525
|
+
if (hasStack) {
|
|
3526
|
+
lines.push(``);
|
|
3527
|
+
const stackBody = JSON.stringify(stackObj, null, 2);
|
|
3528
|
+
lines.push(`const stack: Partial<Record<AgentName, StackAgentConfig>> = ${stackBody};`);
|
|
3529
|
+
}
|
|
3530
|
+
if (hasProjectDomains) {
|
|
3531
|
+
lines.push(``);
|
|
3532
|
+
const domainItems = domainsArr.map((d) => ` ${JSON.stringify(d)},`).join("\n");
|
|
3533
|
+
lines.push(`const domains: Domain[] = [`);
|
|
3534
|
+
lines.push(` ...(globalConfig.domains ?? []),`);
|
|
3535
|
+
if (domainItems) lines.push(domainItems);
|
|
3536
|
+
lines.push(`];`);
|
|
3537
|
+
}
|
|
3538
|
+
const scalarFields = Object.entries(cleaned).filter(([key]) => !EXTRACTED_FIELDS.has(key) && key !== "name").map(([key, value]) => ` ${JSON.stringify(key)}: ${JSON.stringify(value)},`).join("\n");
|
|
3539
|
+
const exportFields = [` ...globalConfig,`];
|
|
3540
|
+
if (cleaned.name) {
|
|
3541
|
+
exportFields.push(` name: ${JSON.stringify(cleaned.name)},`);
|
|
3542
|
+
}
|
|
3543
|
+
exportFields.push(` skills,`);
|
|
3544
|
+
exportFields.push(` agents,`);
|
|
3545
|
+
if (hasStack) {
|
|
3546
|
+
exportFields.push(` stack,`);
|
|
3547
|
+
}
|
|
3548
|
+
if (hasProjectDomains) {
|
|
3549
|
+
exportFields.push(` domains,`);
|
|
3550
|
+
}
|
|
3551
|
+
if (scalarFields) {
|
|
3552
|
+
exportFields.push(scalarFields);
|
|
3553
|
+
}
|
|
3554
|
+
lines.push(``);
|
|
3555
|
+
lines.push(`export default {`);
|
|
3556
|
+
lines.push(...exportFields);
|
|
3557
|
+
lines.push(`} satisfies ProjectConfig;`);
|
|
3558
|
+
lines.push(``);
|
|
3559
|
+
return lines.join("\n");
|
|
3332
3560
|
}
|
|
3333
3561
|
function getGlobalConfigImportPath() {
|
|
3334
|
-
return path18.join(
|
|
3562
|
+
return path18.join(os6.homedir(), CLAUDE_SRC_DIR);
|
|
3335
3563
|
}
|
|
3336
3564
|
function generateBlankGlobalConfigSource() {
|
|
3337
3565
|
return `import type { ProjectConfig } from "./config-types";
|
|
@@ -3358,7 +3586,7 @@ export type Category = never;
|
|
|
3358
3586
|
${PROJECT_CONFIG_INTERFACE_TEMPLATE}`;
|
|
3359
3587
|
}
|
|
3360
3588
|
async function ensureBlankGlobalConfig() {
|
|
3361
|
-
const globalConfigDir = path18.join(
|
|
3589
|
+
const globalConfigDir = path18.join(os6.homedir(), CLAUDE_SRC_DIR);
|
|
3362
3590
|
const configPath = path18.join(globalConfigDir, STANDARD_FILES.CONFIG_TS);
|
|
3363
3591
|
if (await fileExists(configPath)) {
|
|
3364
3592
|
verbose("Global config already exists, skipping blank creation");
|
|
@@ -3375,11 +3603,11 @@ async function ensureBlankGlobalConfig() {
|
|
|
3375
3603
|
|
|
3376
3604
|
// src/cli/lib/installation/local-installer.ts
|
|
3377
3605
|
function resolveInstallPaths(projectDir, scope = "project") {
|
|
3378
|
-
const baseDir = scope === "global" ?
|
|
3606
|
+
const baseDir = scope === "global" ? os7.homedir() : projectDir;
|
|
3379
3607
|
return {
|
|
3380
3608
|
skillsDir: path19.join(baseDir, LOCAL_SKILLS_PATH),
|
|
3381
3609
|
agentsDir: path19.join(baseDir, CLAUDE_DIR, "agents"),
|
|
3382
|
-
configPath: path19.join(
|
|
3610
|
+
configPath: path19.join(baseDir, CLAUDE_SRC_DIR, STANDARD_FILES.CONFIG_TS)
|
|
3383
3611
|
};
|
|
3384
3612
|
}
|
|
3385
3613
|
async function prepareDirectories(paths) {
|
|
@@ -3397,13 +3625,13 @@ async function deleteAndCopySkills(skills, sourceResult, projectDir, skillsDir)
|
|
|
3397
3625
|
const skillIds = skills.map((s) => s.id);
|
|
3398
3626
|
return copySkillsToLocalFlattened(skillIds, skillsDir, sourceResult.matrix, sourceResult);
|
|
3399
3627
|
}
|
|
3400
|
-
function buildLocalSkillsMap(copiedSkills
|
|
3628
|
+
function buildLocalSkillsMap(copiedSkills) {
|
|
3401
3629
|
return Object.fromEntries(
|
|
3402
|
-
copiedSkills.filter((cs) =>
|
|
3630
|
+
copiedSkills.filter((cs) => findSkill(cs.skillId)).map((cs) => [
|
|
3403
3631
|
cs.skillId,
|
|
3404
3632
|
{
|
|
3405
3633
|
id: cs.skillId,
|
|
3406
|
-
description:
|
|
3634
|
+
description: findSkill(cs.skillId).description,
|
|
3407
3635
|
path: cs.destPath,
|
|
3408
3636
|
content: ""
|
|
3409
3637
|
// Content not needed for skill references
|
|
@@ -3443,12 +3671,7 @@ async function buildLocalConfig(wizardResult, sourceResult) {
|
|
|
3443
3671
|
};
|
|
3444
3672
|
if (wizardResult.selectedStackId) {
|
|
3445
3673
|
if (loadedStack) {
|
|
3446
|
-
localConfig = generateProjectConfigFromSkills(
|
|
3447
|
-
DEFAULT_PLUGIN_NAME,
|
|
3448
|
-
skillIds,
|
|
3449
|
-
sourceResult.matrix,
|
|
3450
|
-
agentOptions
|
|
3451
|
-
);
|
|
3674
|
+
localConfig = generateProjectConfigFromSkills(DEFAULT_PLUGIN_NAME, skillIds, agentOptions);
|
|
3452
3675
|
if (localConfig.stack) {
|
|
3453
3676
|
const stackProperty = buildStackProperty(loadedStack);
|
|
3454
3677
|
for (const [agentId, agentConfig] of typedEntries(stackProperty)) {
|
|
@@ -3481,12 +3704,7 @@ async function buildLocalConfig(wizardResult, sourceResult) {
|
|
|
3481
3704
|
);
|
|
3482
3705
|
}
|
|
3483
3706
|
} else {
|
|
3484
|
-
localConfig = generateProjectConfigFromSkills(
|
|
3485
|
-
DEFAULT_PLUGIN_NAME,
|
|
3486
|
-
skillIds,
|
|
3487
|
-
sourceResult.matrix,
|
|
3488
|
-
agentOptions
|
|
3489
|
-
);
|
|
3707
|
+
localConfig = generateProjectConfigFromSkills(DEFAULT_PLUGIN_NAME, skillIds, agentOptions);
|
|
3490
3708
|
}
|
|
3491
3709
|
verbose(
|
|
3492
3710
|
`buildLocalConfig result: stack=${localConfig.stack ? Object.keys(localConfig.stack).length + " agents" : "UNDEFINED"}, agents=[${localConfig.agents.map((a) => a.name).join(", ")}], skills=${localConfig.skills.length}`
|
|
@@ -3551,12 +3769,76 @@ function buildAgentScopeMap(config) {
|
|
|
3551
3769
|
}
|
|
3552
3770
|
return map;
|
|
3553
3771
|
}
|
|
3554
|
-
async function
|
|
3772
|
+
async function writeStandaloneConfigTypes(configPath, matrix, agents, finalConfig) {
|
|
3555
3773
|
const typesPath = path19.join(path19.dirname(configPath), STANDARD_FILES.CONFIG_TYPES_TS);
|
|
3556
3774
|
const customAgentNames = typedKeys(agents).filter((name) => agents[name]?.custom === true);
|
|
3557
|
-
const source = generateConfigTypesSource(
|
|
3775
|
+
const source = generateConfigTypesSource(
|
|
3776
|
+
matrix,
|
|
3777
|
+
typedKeys(agents),
|
|
3778
|
+
customAgentNames,
|
|
3779
|
+
void 0,
|
|
3780
|
+
finalConfig
|
|
3781
|
+
);
|
|
3558
3782
|
await writeFile(typesPath, source);
|
|
3559
3783
|
}
|
|
3784
|
+
async function writeProjectConfigTypes(projectConfigPath, projectDir, projectConfig, matrix) {
|
|
3785
|
+
const typesPath = path19.join(path19.dirname(projectConfigPath), STANDARD_FILES.CONFIG_TYPES_TS);
|
|
3786
|
+
const projectClaudeSrc = path19.join(projectDir, CLAUDE_SRC_DIR);
|
|
3787
|
+
const globalClaudeSrc = path19.join(os7.homedir(), CLAUDE_SRC_DIR);
|
|
3788
|
+
const relativePath = path19.relative(projectClaudeSrc, globalClaudeSrc);
|
|
3789
|
+
const globalTypesImportPath = relativePath.split(path19.sep).join("/");
|
|
3790
|
+
const projectSkillIds = projectConfig?.skills.map((s) => s.id) ?? [];
|
|
3791
|
+
const projectAgentNames = projectConfig?.agents.map((a) => a.name) ?? [];
|
|
3792
|
+
let projectCategories = [];
|
|
3793
|
+
let projectDomains = [];
|
|
3794
|
+
if (matrix && projectSkillIds.length > 0) {
|
|
3795
|
+
const categorySet = /* @__PURE__ */ new Set();
|
|
3796
|
+
for (const id of projectSkillIds) {
|
|
3797
|
+
const skill = matrix.skills[id];
|
|
3798
|
+
if (skill?.category && skill.category !== "local") {
|
|
3799
|
+
categorySet.add(skill.category);
|
|
3800
|
+
}
|
|
3801
|
+
}
|
|
3802
|
+
projectCategories = [...categorySet].sort();
|
|
3803
|
+
const domainSet = /* @__PURE__ */ new Set();
|
|
3804
|
+
for (const cat of projectCategories) {
|
|
3805
|
+
const def = matrix.categories[cat];
|
|
3806
|
+
if (def?.domain) {
|
|
3807
|
+
domainSet.add(def.domain);
|
|
3808
|
+
}
|
|
3809
|
+
}
|
|
3810
|
+
projectDomains = [...domainSet].sort();
|
|
3811
|
+
}
|
|
3812
|
+
const source = generateProjectConfigTypesSource({
|
|
3813
|
+
globalTypesImportPath,
|
|
3814
|
+
projectSkillIds,
|
|
3815
|
+
projectAgentNames,
|
|
3816
|
+
projectDomains,
|
|
3817
|
+
projectCategories
|
|
3818
|
+
});
|
|
3819
|
+
await writeFile(typesPath, source);
|
|
3820
|
+
verbose("Using project config-types.ts that imports from global");
|
|
3821
|
+
}
|
|
3822
|
+
async function writeScopedConfigs(finalConfig, matrix, agents, projectDir, projectConfigPath) {
|
|
3823
|
+
const homeDir = os7.homedir();
|
|
3824
|
+
const isProjectContext = path19.resolve(projectDir) !== path19.resolve(homeDir);
|
|
3825
|
+
if (!isProjectContext) {
|
|
3826
|
+
await writeConfigFile(finalConfig, projectConfigPath);
|
|
3827
|
+
await writeStandaloneConfigTypes(projectConfigPath, matrix, agents, finalConfig);
|
|
3828
|
+
return;
|
|
3829
|
+
}
|
|
3830
|
+
const { global: globalConfig, project: projectSplitConfig } = splitConfigByScope(finalConfig);
|
|
3831
|
+
const globalConfigPath = path19.join(homeDir, CLAUDE_SRC_DIR, STANDARD_FILES.CONFIG_TS);
|
|
3832
|
+
await ensureDir(path19.dirname(globalConfigPath));
|
|
3833
|
+
await writeConfigFile(globalConfig, globalConfigPath);
|
|
3834
|
+
verbose(`Updated global config at ${globalConfigPath}`);
|
|
3835
|
+
await writeStandaloneConfigTypes(globalConfigPath, matrix, agents, globalConfig);
|
|
3836
|
+
verbose("Updated global config-types.ts with actual types");
|
|
3837
|
+
await ensureDir(path19.dirname(projectConfigPath));
|
|
3838
|
+
await writeConfigFile(projectSplitConfig, projectConfigPath, { isProjectConfig: true });
|
|
3839
|
+
verbose(`Updated project config at ${projectConfigPath}`);
|
|
3840
|
+
await writeProjectConfigTypes(projectConfigPath, projectDir, finalConfig, matrix);
|
|
3841
|
+
}
|
|
3560
3842
|
async function compileAndWriteAgents(compileConfig, agents, localSkills, sourceResult, projectDir, agentsDir, installMode, agentScopeMap) {
|
|
3561
3843
|
const engine = await createLiquidEngine(projectDir);
|
|
3562
3844
|
const resolvedAgents = await resolveAgents(
|
|
@@ -3565,7 +3847,7 @@ async function compileAndWriteAgents(compileConfig, agents, localSkills, sourceR
|
|
|
3565
3847
|
compileConfig,
|
|
3566
3848
|
sourceResult.sourcePath
|
|
3567
3849
|
);
|
|
3568
|
-
const globalAgentsDir = path19.join(
|
|
3850
|
+
const globalAgentsDir = path19.join(os7.homedir(), CLAUDE_DIR, "agents");
|
|
3569
3851
|
const compiledAgentNames = [];
|
|
3570
3852
|
for (const [name, agent] of typedEntries(resolvedAgents)) {
|
|
3571
3853
|
const output = await compileAgentForPlugin(
|
|
@@ -3587,14 +3869,22 @@ async function compileAndWriteAgents(compileConfig, agents, localSkills, sourceR
|
|
|
3587
3869
|
}
|
|
3588
3870
|
async function installPluginConfig(options) {
|
|
3589
3871
|
const { wizardResult, sourceResult, projectDir, sourceFlag } = options;
|
|
3590
|
-
const
|
|
3591
|
-
|
|
3592
|
-
|
|
3872
|
+
const projectPaths = resolveInstallPaths(projectDir, "project");
|
|
3873
|
+
const hasProjectAgents = wizardResult.skills.some((s) => s.scope !== "global") || (wizardResult.agentConfigs ?? []).some((a) => a.scope !== "global");
|
|
3874
|
+
if (hasProjectAgents) {
|
|
3875
|
+
await ensureDir(projectPaths.agentsDir);
|
|
3876
|
+
}
|
|
3877
|
+
await ensureDir(path19.dirname(projectPaths.configPath));
|
|
3593
3878
|
const agents = await loadMergedAgents(sourceResult.sourcePath);
|
|
3594
3879
|
const mergeResult = await buildAndMergeConfig(wizardResult, sourceResult, projectDir, sourceFlag);
|
|
3595
3880
|
const finalConfig = mergeResult.config;
|
|
3596
|
-
await
|
|
3597
|
-
|
|
3881
|
+
await writeScopedConfigs(
|
|
3882
|
+
finalConfig,
|
|
3883
|
+
sourceResult.matrix,
|
|
3884
|
+
agents,
|
|
3885
|
+
projectDir,
|
|
3886
|
+
projectPaths.configPath
|
|
3887
|
+
);
|
|
3598
3888
|
const compileAgentsConfig = buildCompileAgents(finalConfig, agents);
|
|
3599
3889
|
const compileConfig = {
|
|
3600
3890
|
name: DEFAULT_PLUGIN_NAME,
|
|
@@ -3612,17 +3902,17 @@ async function installPluginConfig(options) {
|
|
|
3612
3902
|
skillsForCompilation,
|
|
3613
3903
|
sourceResult,
|
|
3614
3904
|
projectDir,
|
|
3615
|
-
|
|
3905
|
+
projectPaths.agentsDir,
|
|
3616
3906
|
deriveInstallMode(finalConfig.skills),
|
|
3617
3907
|
buildAgentScopeMap(finalConfig)
|
|
3618
3908
|
);
|
|
3619
3909
|
return {
|
|
3620
3910
|
config: finalConfig,
|
|
3621
|
-
configPath:
|
|
3911
|
+
configPath: projectPaths.configPath,
|
|
3622
3912
|
compiledAgents: compiledAgentNames,
|
|
3623
3913
|
wasMerged: mergeResult.merged,
|
|
3624
3914
|
mergedConfigPath: mergeResult.existingConfigPath,
|
|
3625
|
-
agentsDir:
|
|
3915
|
+
agentsDir: projectPaths.agentsDir
|
|
3626
3916
|
};
|
|
3627
3917
|
}
|
|
3628
3918
|
async function installLocal(options) {
|
|
@@ -3631,19 +3921,29 @@ async function installLocal(options) {
|
|
|
3631
3921
|
const globalPaths = resolveInstallPaths(projectDir, "global");
|
|
3632
3922
|
const projectSkills = wizardResult.skills.filter((s) => s.scope !== "global");
|
|
3633
3923
|
const globalSkills = wizardResult.skills.filter((s) => s.scope === "global");
|
|
3634
|
-
|
|
3924
|
+
const hasProjectItems = projectSkills.length > 0 || (wizardResult.agentConfigs ?? []).some((a) => a.scope !== "global");
|
|
3925
|
+
if (hasProjectItems) {
|
|
3926
|
+
await prepareDirectories(projectPaths);
|
|
3927
|
+
} else {
|
|
3928
|
+
await ensureDir(path19.dirname(projectPaths.configPath));
|
|
3929
|
+
}
|
|
3635
3930
|
if (globalSkills.length > 0) {
|
|
3636
3931
|
await ensureDir(globalPaths.skillsDir);
|
|
3637
3932
|
}
|
|
3638
3933
|
const projectCopied = projectSkills.length > 0 ? await deleteAndCopySkills(projectSkills, sourceResult, projectDir, projectPaths.skillsDir) : [];
|
|
3639
3934
|
const globalCopied = globalSkills.length > 0 ? await deleteAndCopySkills(globalSkills, sourceResult, projectDir, globalPaths.skillsDir) : [];
|
|
3640
3935
|
const copiedSkills = [...projectCopied, ...globalCopied];
|
|
3641
|
-
const localSkillsForResolution = buildLocalSkillsMap(copiedSkills
|
|
3936
|
+
const localSkillsForResolution = buildLocalSkillsMap(copiedSkills);
|
|
3642
3937
|
const agents = await loadMergedAgents(sourceResult.sourcePath);
|
|
3643
3938
|
const mergeResult = await buildAndMergeConfig(wizardResult, sourceResult, projectDir, sourceFlag);
|
|
3644
3939
|
const finalConfig = mergeResult.config;
|
|
3645
|
-
await
|
|
3646
|
-
|
|
3940
|
+
await writeScopedConfigs(
|
|
3941
|
+
finalConfig,
|
|
3942
|
+
sourceResult.matrix,
|
|
3943
|
+
agents,
|
|
3944
|
+
projectDir,
|
|
3945
|
+
projectPaths.configPath
|
|
3946
|
+
);
|
|
3647
3947
|
const compileAgentsConfig = buildCompileAgents(finalConfig, agents);
|
|
3648
3948
|
const compileConfig = {
|
|
3649
3949
|
name: DEFAULT_PLUGIN_NAME,
|
|
@@ -3766,7 +4066,7 @@ init_esm_shims();
|
|
|
3766
4066
|
// src/cli/lib/plugins/plugin-settings.ts
|
|
3767
4067
|
init_esm_shims();
|
|
3768
4068
|
import path21 from "path";
|
|
3769
|
-
import
|
|
4069
|
+
import os8 from "os";
|
|
3770
4070
|
import { z as z2 } from "zod";
|
|
3771
4071
|
var pluginSettingsSchema = z2.object({
|
|
3772
4072
|
enabledPlugins: z2.record(z2.string(), z2.unknown()).optional()
|
|
@@ -3817,7 +4117,7 @@ async function resolvePluginInstallPaths(pluginKeys, projectDir) {
|
|
|
3817
4117
|
if (pluginKeys.length === 0) {
|
|
3818
4118
|
return [];
|
|
3819
4119
|
}
|
|
3820
|
-
const registryPath = path21.join(
|
|
4120
|
+
const registryPath = path21.join(os8.homedir(), CLAUDE_DIR, PLUGINS_SUBDIR, INSTALLED_PLUGINS_FILE);
|
|
3821
4121
|
if (!await fileExists(registryPath)) {
|
|
3822
4122
|
verbose(`Plugin registry not found at '${registryPath}'`);
|
|
3823
4123
|
return [];
|
|
@@ -4817,7 +5117,7 @@ async function addSource(projectDir, url) {
|
|
|
4817
5117
|
}
|
|
4818
5118
|
sources.push({ name, url });
|
|
4819
5119
|
config.sources = sources;
|
|
4820
|
-
await
|
|
5120
|
+
await writeProjectSourceConfig(projectDir, config);
|
|
4821
5121
|
verbose(`Added source "${name}" with ${skillCount} skills`);
|
|
4822
5122
|
return { name, skillCount };
|
|
4823
5123
|
}
|
|
@@ -4832,7 +5132,7 @@ async function removeSource(projectDir, name) {
|
|
|
4832
5132
|
throw new Error(`Source "${name}" not found`);
|
|
4833
5133
|
}
|
|
4834
5134
|
config.sources = filtered;
|
|
4835
|
-
await
|
|
5135
|
+
await writeProjectSourceConfig(projectDir, config);
|
|
4836
5136
|
verbose(`Removed source "${name}"`);
|
|
4837
5137
|
}
|
|
4838
5138
|
async function getSourceSummary(projectDir) {
|
|
@@ -4884,7 +5184,7 @@ async function loadSkillsMatrixFromSource(options = {}) {
|
|
|
4884
5184
|
const resolvedProjectDir = projectDir || process.cwd();
|
|
4885
5185
|
await discoverAndExtendFromLocalSkills(resolvedProjectDir);
|
|
4886
5186
|
let localSkillsResult = await discoverLocalSkills(resolvedProjectDir);
|
|
4887
|
-
const homeDir =
|
|
5187
|
+
const homeDir = os9.homedir();
|
|
4888
5188
|
if ((!localSkillsResult || localSkillsResult.skills.length === 0) && resolvedProjectDir !== homeDir) {
|
|
4889
5189
|
await discoverAndExtendFromLocalSkills(homeDir);
|
|
4890
5190
|
localSkillsResult = await discoverLocalSkills(homeDir);
|
|
@@ -4905,6 +5205,7 @@ async function loadSkillsMatrixFromSource(options = {}) {
|
|
|
4905
5205
|
);
|
|
4906
5206
|
}
|
|
4907
5207
|
checkMatrixHealth(result.matrix);
|
|
5208
|
+
useMatrixStore.getState().setMatrix(result.matrix);
|
|
4908
5209
|
return result;
|
|
4909
5210
|
}
|
|
4910
5211
|
async function loadFromLocal(source, sourceConfig) {
|
|
@@ -5276,13 +5577,11 @@ export {
|
|
|
5276
5577
|
SOURCE_ENV_VAR,
|
|
5277
5578
|
getProjectConfigPath,
|
|
5278
5579
|
loadProjectSourceConfig,
|
|
5279
|
-
saveProjectConfig,
|
|
5280
5580
|
resolveSource,
|
|
5281
5581
|
resolveAgentsSource,
|
|
5282
5582
|
formatOrigin,
|
|
5283
5583
|
resolveAuthor,
|
|
5284
5584
|
resolveAllSources,
|
|
5285
|
-
splitConfigByScope,
|
|
5286
5585
|
loadStacks,
|
|
5287
5586
|
getStackSkillIds,
|
|
5288
5587
|
loadProjectConfig,
|
|
@@ -5306,10 +5605,6 @@ export {
|
|
|
5306
5605
|
printCompilationSummary,
|
|
5307
5606
|
deleteLocalSkill,
|
|
5308
5607
|
migrateLocalSkillScope,
|
|
5309
|
-
loadSkillCategories,
|
|
5310
|
-
loadSkillRules,
|
|
5311
|
-
extractAllSkills,
|
|
5312
|
-
mergeMatrixWithSkills,
|
|
5313
5608
|
resolveAlias,
|
|
5314
5609
|
validateSelection,
|
|
5315
5610
|
getAvailableSkills,
|
|
@@ -5338,13 +5633,14 @@ export {
|
|
|
5338
5633
|
getSourceSummary,
|
|
5339
5634
|
loadConfigTypesDataInBackground,
|
|
5340
5635
|
regenerateConfigTypes,
|
|
5636
|
+
generateConfigSource,
|
|
5341
5637
|
ensureBlankGlobalConfig,
|
|
5342
5638
|
deriveInstallMode,
|
|
5343
5639
|
detectProjectInstallation,
|
|
5344
5640
|
detectGlobalInstallation,
|
|
5345
5641
|
detectInstallation,
|
|
5346
5642
|
buildAndMergeConfig,
|
|
5347
|
-
|
|
5643
|
+
writeScopedConfigs,
|
|
5348
5644
|
installPluginConfig,
|
|
5349
5645
|
installLocal,
|
|
5350
5646
|
detectMigrations,
|
|
@@ -5357,4 +5653,4 @@ export {
|
|
|
5357
5653
|
validateAllPlugins,
|
|
5358
5654
|
printPluginValidationResult
|
|
5359
5655
|
};
|
|
5360
|
-
//# sourceMappingURL=chunk-
|
|
5656
|
+
//# sourceMappingURL=chunk-53URJ5XK.js.map
|