@agents-inc/cli 0.82.4 → 0.84.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.
Files changed (156) hide show
  1. package/CHANGELOG.md +20 -0
  2. package/README.md +34 -22
  3. package/dist/{chunk-5BRHJD7Q.js → chunk-23UI23AW.js} +2 -2
  4. package/dist/{chunk-3PB7KSF7.js → chunk-2AHXUWHO.js} +4 -4
  5. package/dist/{chunk-32HQMUEJ.js → chunk-2BF4WAYU.js} +2 -2
  6. package/dist/{chunk-RTXJLZ7A.js → chunk-2EPX6D74.js} +4 -4
  7. package/dist/{chunk-KEW246HB.js → chunk-2PXXNFTL.js} +4 -4
  8. package/dist/{chunk-WYHFSJ7O.js → chunk-2XLBC3W6.js} +2 -2
  9. package/dist/{chunk-WYHFSJ7O.js.map → chunk-2XLBC3W6.js.map} +1 -1
  10. package/dist/{chunk-FBLRTXEA.js → chunk-33AA7KWH.js} +6 -6
  11. package/dist/{chunk-63E7LOLB.js → chunk-3JTBSJDE.js} +2 -2
  12. package/dist/{chunk-M2CS5EOK.js → chunk-3PECYFYB.js} +5 -5
  13. package/dist/{chunk-C4I4Q33M.js → chunk-4IAGARTF.js} +2 -2
  14. package/dist/{chunk-AD2UT2TN.js → chunk-AZLM7OCV.js} +2 -2
  15. package/dist/{chunk-IMO6EQKT.js → chunk-DFFH7HQZ.js} +2 -2
  16. package/dist/{chunk-5AHKXBNC.js → chunk-DGZ7HWIG.js} +3 -3
  17. package/dist/{chunk-SOEIE4VA.js → chunk-DIIL3ELZ.js} +2 -2
  18. package/dist/{chunk-FIXWR56O.js → chunk-GWXZSQUS.js} +3 -3
  19. package/dist/{chunk-3MXMYHO3.js → chunk-HQNFKBZW.js} +17 -17
  20. package/dist/{chunk-3MXMYHO3.js.map → chunk-HQNFKBZW.js.map} +1 -1
  21. package/dist/{chunk-LOB3OU2D.js → chunk-IG5B34MJ.js} +4 -4
  22. package/dist/{chunk-GEU62YD2.js → chunk-J7VVUJ6I.js} +2 -2
  23. package/dist/{chunk-LQ3EJBUN.js → chunk-KJX5G75S.js} +4 -4
  24. package/dist/{chunk-K76AXQ7A.js → chunk-LI5NJ4VQ.js} +3 -3
  25. package/dist/{chunk-35ESNSF5.js → chunk-LVIMGRFS.js} +5 -5
  26. package/dist/chunk-LVIMGRFS.js.map +1 -0
  27. package/dist/{chunk-FS4YWW36.js → chunk-ND4ZJOT7.js} +3 -3
  28. package/dist/{chunk-IMP35ETG.js → chunk-NPMMU4GY.js} +17 -17
  29. package/dist/chunk-NPMMU4GY.js.map +1 -0
  30. package/dist/{chunk-KB6LCTCD.js → chunk-PTKJKDYH.js} +186 -77
  31. package/dist/chunk-PTKJKDYH.js.map +1 -0
  32. package/dist/{chunk-X2HE3W74.js → chunk-SD3HTFUK.js} +2 -2
  33. package/dist/{chunk-AAW3PYXA.js → chunk-TE4LD3WR.js} +2 -2
  34. package/dist/{chunk-XTVWVOLD.js → chunk-XAVVPPWP.js} +2 -2
  35. package/dist/{chunk-JQDOUNHF.js → chunk-XCRX5WVX.js} +13 -13
  36. package/dist/{chunk-KZLGBHDZ.js → chunk-XGFLPLNO.js} +5 -5
  37. package/dist/{chunk-3BDCU5QB.js → chunk-ZYTLL3MM.js} +4 -3
  38. package/dist/chunk-ZYTLL3MM.js.map +1 -0
  39. package/dist/commands/build/marketplace.js +4 -4
  40. package/dist/commands/build/plugins.js +8 -8
  41. package/dist/commands/build/stack.js +8 -8
  42. package/dist/commands/compile.js +8 -8
  43. package/dist/commands/config/index.js +8 -8
  44. package/dist/commands/config/path.js +7 -7
  45. package/dist/commands/config/show.js +8 -8
  46. package/dist/commands/diff.js +7 -7
  47. package/dist/commands/doctor.js +7 -7
  48. package/dist/commands/edit.js +23 -23
  49. package/dist/commands/eject.js +7 -7
  50. package/dist/commands/import/skill.js +7 -7
  51. package/dist/commands/info.js +7 -7
  52. package/dist/commands/init.js +23 -23
  53. package/dist/commands/list.js +7 -7
  54. package/dist/commands/new/agent.js +8 -8
  55. package/dist/commands/new/marketplace.js +9 -9
  56. package/dist/commands/new/skill.js +8 -8
  57. package/dist/commands/outdated.js +7 -7
  58. package/dist/commands/search.js +7 -7
  59. package/dist/commands/uninstall.js +7 -7
  60. package/dist/commands/update.js +8 -8
  61. package/dist/commands/validate.js +7 -7
  62. package/dist/components/wizard/category-grid.js +2 -2
  63. package/dist/components/wizard/category-grid.test.js +11 -11
  64. package/dist/components/wizard/domain-selection.js +9 -9
  65. package/dist/components/wizard/help-modal.js +8 -8
  66. package/dist/components/wizard/source-grid.js +2 -2
  67. package/dist/components/wizard/source-grid.test.js +11 -11
  68. package/dist/components/wizard/stack-selection.js +8 -8
  69. package/dist/components/wizard/step-agents.js +9 -9
  70. package/dist/components/wizard/step-agents.test.js +13 -13
  71. package/dist/components/wizard/step-agents.test.js.map +1 -1
  72. package/dist/components/wizard/step-build.js +9 -9
  73. package/dist/components/wizard/step-build.test.js +12 -12
  74. package/dist/components/wizard/step-confirm.js +4 -4
  75. package/dist/components/wizard/step-confirm.test.js +10 -10
  76. package/dist/components/wizard/step-settings.js +7 -7
  77. package/dist/components/wizard/step-settings.test.js +10 -10
  78. package/dist/components/wizard/step-sources.js +9 -9
  79. package/dist/components/wizard/step-sources.test.js +12 -12
  80. package/dist/components/wizard/step-stack.js +9 -9
  81. package/dist/components/wizard/step-stack.test.js +10 -10
  82. package/dist/components/wizard/wizard-layout.js +10 -10
  83. package/dist/components/wizard/wizard.js +21 -21
  84. package/dist/config-exports.js +1 -1
  85. package/dist/hooks/init.js +23 -23
  86. package/dist/{loader-4XPDVCZK.js → loader-LI4IFZB7.js} +4 -4
  87. package/dist/{source-loader-FMDHHYDQ.js → source-loader-GHDWSV2H.js} +7 -7
  88. package/dist/source-manager-7RTGIBQK.js +19 -0
  89. package/dist/src/agents/meta/agent-summoner/workflow.md +10 -10
  90. package/{src/agents/meta/scribe → dist/src/agents/meta/codex-keeper}/intro.md +2 -0
  91. package/dist/src/agents/meta/codex-keeper/metadata.yaml +12 -0
  92. package/dist/src/agents/meta/{scribe → codex-keeper}/output-format.md +2 -2
  93. package/dist/src/agents/meta/{scribe → codex-keeper}/workflow.md +54 -29
  94. package/dist/src/agents/meta/convention-keeper/critical-reminders.md +3 -3
  95. package/dist/src/agents/meta/convention-keeper/critical-requirements.md +3 -3
  96. package/dist/src/agents/meta/convention-keeper/examples.md +3 -3
  97. package/dist/src/agents/meta/convention-keeper/intro.md +3 -3
  98. package/dist/src/agents/meta/convention-keeper/output-format.md +9 -9
  99. package/dist/src/agents/meta/convention-keeper/workflow.md +15 -15
  100. package/dist/src/agents/planning/web-pm/workflow.md +1 -1
  101. package/dist/stores/wizard-store.js +7 -7
  102. package/dist/stores/wizard-store.test.js +13 -13
  103. package/dist/stores/wizard-store.test.js.map +1 -1
  104. package/package.json +1 -1
  105. package/src/agents/meta/agent-summoner/workflow.md +10 -10
  106. package/{dist/src/agents/meta/scribe → src/agents/meta/codex-keeper}/intro.md +2 -0
  107. package/src/agents/meta/codex-keeper/metadata.yaml +12 -0
  108. package/src/agents/meta/{scribe → codex-keeper}/output-format.md +2 -2
  109. package/src/agents/meta/{scribe → codex-keeper}/workflow.md +54 -29
  110. package/src/agents/meta/convention-keeper/critical-reminders.md +3 -3
  111. package/src/agents/meta/convention-keeper/critical-requirements.md +3 -3
  112. package/src/agents/meta/convention-keeper/examples.md +3 -3
  113. package/src/agents/meta/convention-keeper/intro.md +3 -3
  114. package/src/agents/meta/convention-keeper/output-format.md +9 -9
  115. package/src/agents/meta/convention-keeper/workflow.md +15 -15
  116. package/src/agents/planning/web-pm/workflow.md +1 -1
  117. package/dist/chunk-35ESNSF5.js.map +0 -1
  118. package/dist/chunk-3BDCU5QB.js.map +0 -1
  119. package/dist/chunk-IMP35ETG.js.map +0 -1
  120. package/dist/chunk-KB6LCTCD.js.map +0 -1
  121. package/dist/source-manager-YMJ4Z5UG.js +0 -19
  122. package/dist/src/agents/meta/scribe/metadata.yaml +0 -12
  123. package/src/agents/meta/scribe/metadata.yaml +0 -12
  124. /package/dist/{chunk-5BRHJD7Q.js.map → chunk-23UI23AW.js.map} +0 -0
  125. /package/dist/{chunk-3PB7KSF7.js.map → chunk-2AHXUWHO.js.map} +0 -0
  126. /package/dist/{chunk-32HQMUEJ.js.map → chunk-2BF4WAYU.js.map} +0 -0
  127. /package/dist/{chunk-RTXJLZ7A.js.map → chunk-2EPX6D74.js.map} +0 -0
  128. /package/dist/{chunk-KEW246HB.js.map → chunk-2PXXNFTL.js.map} +0 -0
  129. /package/dist/{chunk-FBLRTXEA.js.map → chunk-33AA7KWH.js.map} +0 -0
  130. /package/dist/{chunk-63E7LOLB.js.map → chunk-3JTBSJDE.js.map} +0 -0
  131. /package/dist/{chunk-M2CS5EOK.js.map → chunk-3PECYFYB.js.map} +0 -0
  132. /package/dist/{chunk-C4I4Q33M.js.map → chunk-4IAGARTF.js.map} +0 -0
  133. /package/dist/{chunk-AD2UT2TN.js.map → chunk-AZLM7OCV.js.map} +0 -0
  134. /package/dist/{chunk-IMO6EQKT.js.map → chunk-DFFH7HQZ.js.map} +0 -0
  135. /package/dist/{chunk-5AHKXBNC.js.map → chunk-DGZ7HWIG.js.map} +0 -0
  136. /package/dist/{chunk-SOEIE4VA.js.map → chunk-DIIL3ELZ.js.map} +0 -0
  137. /package/dist/{chunk-FIXWR56O.js.map → chunk-GWXZSQUS.js.map} +0 -0
  138. /package/dist/{chunk-LOB3OU2D.js.map → chunk-IG5B34MJ.js.map} +0 -0
  139. /package/dist/{chunk-GEU62YD2.js.map → chunk-J7VVUJ6I.js.map} +0 -0
  140. /package/dist/{chunk-LQ3EJBUN.js.map → chunk-KJX5G75S.js.map} +0 -0
  141. /package/dist/{chunk-K76AXQ7A.js.map → chunk-LI5NJ4VQ.js.map} +0 -0
  142. /package/dist/{chunk-FS4YWW36.js.map → chunk-ND4ZJOT7.js.map} +0 -0
  143. /package/dist/{chunk-X2HE3W74.js.map → chunk-SD3HTFUK.js.map} +0 -0
  144. /package/dist/{chunk-AAW3PYXA.js.map → chunk-TE4LD3WR.js.map} +0 -0
  145. /package/dist/{chunk-XTVWVOLD.js.map → chunk-XAVVPPWP.js.map} +0 -0
  146. /package/dist/{chunk-JQDOUNHF.js.map → chunk-XCRX5WVX.js.map} +0 -0
  147. /package/dist/{chunk-KZLGBHDZ.js.map → chunk-XGFLPLNO.js.map} +0 -0
  148. /package/dist/{loader-4XPDVCZK.js.map → loader-LI4IFZB7.js.map} +0 -0
  149. /package/dist/{source-loader-FMDHHYDQ.js.map → source-loader-GHDWSV2H.js.map} +0 -0
  150. /package/dist/{source-manager-YMJ4Z5UG.js.map → source-manager-7RTGIBQK.js.map} +0 -0
  151. /package/dist/src/agents/meta/{scribe → codex-keeper}/critical-reminders.md +0 -0
  152. /package/dist/src/agents/meta/{scribe → codex-keeper}/critical-requirements.md +0 -0
  153. /package/dist/src/agents/meta/{scribe → codex-keeper}/examples.md +0 -0
  154. /package/src/agents/meta/{scribe → codex-keeper}/critical-reminders.md +0 -0
  155. /package/src/agents/meta/{scribe → codex-keeper}/critical-requirements.md +0 -0
  156. /package/src/agents/meta/{scribe → codex-keeper}/examples.md +0 -0
@@ -4,17 +4,16 @@ import {
4
4
  loadPluginSkills,
5
5
  loadSkillsByIds,
6
6
  parseFrontmatter
7
- } from "./chunk-XTVWVOLD.js";
7
+ } from "./chunk-XAVVPPWP.js";
8
8
  import {
9
9
  BUILT_IN_MATRIX,
10
- getCategoryDomain,
11
10
  getCustomSkillIds,
12
11
  getSkillById,
13
12
  initializeMatrix,
14
13
  matrix,
15
14
  typedEntries,
16
15
  typedKeys
17
- } from "./chunk-3MXMYHO3.js";
16
+ } from "./chunk-HQNFKBZW.js";
18
17
  import {
19
18
  SKILL_ID_PATTERN,
20
19
  agentFrontmatterValidationSchema,
@@ -53,7 +52,7 @@ import {
53
52
  warn,
54
53
  warnUnknownFields,
55
54
  writeFile
56
- } from "./chunk-32HQMUEJ.js";
55
+ } from "./chunk-2BF4WAYU.js";
57
56
  import {
58
57
  CACHE_DIR,
59
58
  CACHE_HASH_LENGTH,
@@ -94,7 +93,7 @@ import {
94
93
  defaultCategories,
95
94
  defaultRules,
96
95
  defaultStacks
97
- } from "./chunk-IMP35ETG.js";
96
+ } from "./chunk-NPMMU4GY.js";
98
97
  import {
99
98
  init_esm_shims
100
99
  } from "./chunk-DHET7RCE.js";
@@ -521,16 +520,17 @@ function generateProjectConfigFromSkills(name, selectedSkillIds, options) {
521
520
  `${skippedCount}/${selectedSkillIds.length} skills not found in matrix. Matrix keys sample: [${matrixSample}]`
522
521
  );
523
522
  }
524
- const stackProperty = agentList.length > 0 && validSkills.length > 0 ? Object.fromEntries(
523
+ const grouped = /* @__PURE__ */ new Map();
524
+ for (const { skillId, category } of validSkills) {
525
+ const arr = grouped.get(category) ?? [];
526
+ arr.push({ id: skillId, preloaded: false });
527
+ grouped.set(category, arr);
528
+ }
529
+ const stackProperty = agentList.length > 0 && grouped.size > 0 ? Object.fromEntries(
525
530
  agentList.map((agentId) => [
526
531
  agentId,
527
532
  // Structural cast: Object.fromEntries returns Record<string, V>, narrowing to typed keys
528
- Object.fromEntries(
529
- validSkills.map(({ skillId, category }) => [
530
- category,
531
- [{ id: skillId, preloaded: false }]
532
- ])
533
- )
533
+ Object.fromEntries(grouped)
534
534
  ])
535
535
  ) : void 0;
536
536
  const skills = options?.skillConfigs ?? selectedSkillIds.map((id) => ({ id, scope: "project", source: "local" }));
@@ -559,22 +559,6 @@ function buildStackProperty(stack) {
559
559
  }).filter(([, mappings]) => typedKeys(mappings).length > 0)
560
560
  );
561
561
  }
562
- function compactAssignment(assignment) {
563
- return assignment.preloaded ? { id: assignment.id, preloaded: true } : assignment.id;
564
- }
565
- function compactStackForYaml(stack) {
566
- return Object.fromEntries(
567
- typedEntries(stack).map(([agentId, agentConfig]) => {
568
- const compacted = Object.fromEntries(
569
- typedEntries(agentConfig).filter(([, assignments]) => assignments && assignments.length > 0).map(([category, assignments]) => [
570
- category,
571
- assignments.length === 1 ? compactAssignment(assignments[0]) : assignments.map(compactAssignment)
572
- ])
573
- );
574
- return [agentId, compacted];
575
- }).filter(([, compacted]) => Object.keys(compacted).length > 0)
576
- );
577
- }
578
562
  function splitConfigByScope(config) {
579
563
  const globalSkills = config.skills.filter((s) => s.scope === "global");
580
564
  const projectSkills = config.skills.filter((s) => s.scope === "project");
@@ -979,9 +963,11 @@ function formatSkillUnion(skills) {
979
963
  }
980
964
  function generateStackAgentConfig(skillsByCategory) {
981
965
  if (skillsByCategory.size === 0) {
982
- return "export type StackAgentConfig = Partial<Record<Category, SkillAssignment>>;";
966
+ return "export type StackAgentConfig = Partial<Record<Category, SkillAssignment[]>>;";
983
967
  }
984
- const properties = [...skillsByCategory.entries()].sort(([a], [b]) => a.localeCompare(b)).map(([category, skills]) => ` "${category}"?: SkillAssignment<${formatSkillUnion(skills)}>;`);
968
+ const properties = [...skillsByCategory.entries()].sort(([a], [b]) => a.localeCompare(b)).map(
969
+ ([category, skills]) => ` "${category}"?: SkillAssignment<${formatSkillUnion(skills)}>[];`
970
+ );
985
971
  return ["export type StackAgentConfig = {", ...properties, "};"].join("\n");
986
972
  }
987
973
  function buildSkillsByCategory(skillIds, categories, matrix2) {
@@ -1004,8 +990,8 @@ function loadConfigTypesDataInBackground(sourceFlag, projectDir) {
1004
990
  if (!await directoryExists(claudeSrcDir)) {
1005
991
  throw new Error(`${CLAUDE_SRC_DIR}/ not found \u2014 run '${CLI_BIN_NAME} init' first`);
1006
992
  }
1007
- const { loadSkillsMatrixFromSource: loadSkillsMatrixFromSource2 } = await import("./source-loader-FMDHHYDQ.js");
1008
- const { loadAllAgents: loadAllAgents2 } = await import("./loader-4XPDVCZK.js");
993
+ const { loadSkillsMatrixFromSource: loadSkillsMatrixFromSource2 } = await import("./source-loader-GHDWSV2H.js");
994
+ const { loadAllAgents: loadAllAgents2 } = await import("./loader-LI4IFZB7.js");
1009
995
  const sourceResult = await loadSkillsMatrixFromSource2({
1010
996
  sourceFlag,
1011
997
  projectDir,
@@ -1214,7 +1200,7 @@ export type Domain = ${domainUnion};
1214
1200
  export type Category = ${categoryUnion};
1215
1201
 
1216
1202
  ${PROJECT_CONFIG_TYPES_BEFORE}
1217
- export type StackAgentConfig = Partial<Record<Category, SkillAssignment>>;
1203
+ export type StackAgentConfig = Partial<Record<Category, SkillAssignment[]>>;
1218
1204
 
1219
1205
  ${PROJECT_CONFIG_INTERFACE_AFTER}`;
1220
1206
  }
@@ -1235,8 +1221,31 @@ function formatExtendedUnion(globalTypeName, projectMembers) {
1235
1221
  // src/cli/lib/configuration/config-writer.ts
1236
1222
  var EXTRACTED_FIELDS = /* @__PURE__ */ new Set(["skills", "agents", "stack", "domains"]);
1237
1223
  function generateConfigSource(config, options) {
1238
- const serializable = config.stack ? { ...config, stack: compactStackForYaml(config.stack) } : { ...config };
1239
- const cleaned = JSON.parse(JSON.stringify(serializable));
1224
+ if (options?.isProjectConfig) {
1225
+ if (options.globalConfig) {
1226
+ const cleanedProject = JSON.parse(JSON.stringify(config));
1227
+ const cleanedGlobal = JSON.parse(
1228
+ JSON.stringify(options.globalConfig)
1229
+ );
1230
+ if (cleanedProject.stack) {
1231
+ cleanedProject.stack = compactStackAssignments(
1232
+ cleanedProject.stack
1233
+ );
1234
+ }
1235
+ if (cleanedGlobal.stack) {
1236
+ cleanedGlobal.stack = compactStackAssignments(
1237
+ cleanedGlobal.stack
1238
+ );
1239
+ }
1240
+ return generateProjectConfigWithInlinedGlobal(cleanedProject, cleanedGlobal);
1241
+ }
1242
+ }
1243
+ const cleaned = JSON.parse(JSON.stringify(config));
1244
+ if (cleaned.stack) {
1245
+ cleaned.stack = compactStackAssignments(
1246
+ cleaned.stack
1247
+ );
1248
+ }
1240
1249
  if (options?.isProjectConfig) {
1241
1250
  return generateProjectConfigWithGlobalImport(cleaned, getGlobalConfigImportPath());
1242
1251
  }
@@ -1385,6 +1394,141 @@ function generateProjectConfigWithGlobalImport(cleaned, globalImportPath) {
1385
1394
  lines.push(``);
1386
1395
  return lines.join("\n");
1387
1396
  }
1397
+ function generateProjectConfigWithInlinedGlobal(cleaned, cleanedGlobal) {
1398
+ const projectSkillsArr = cleaned.skills ?? [];
1399
+ const projectAgentsArr = cleaned.agents ?? [];
1400
+ const projectStackObj = cleaned.stack;
1401
+ const projectDomainsArr = cleaned.domains ?? [];
1402
+ const projectSelectedAgentsArr = cleaned.selectedAgents ?? [];
1403
+ const globalSkillsArr = cleanedGlobal.skills ?? [];
1404
+ const globalAgentsArr = cleanedGlobal.agents ?? [];
1405
+ const globalDomainsArr = cleanedGlobal.domains ?? [];
1406
+ const globalSelectedAgentsArr = cleanedGlobal.selectedAgents ?? [];
1407
+ const hasGlobalSkills = globalSkillsArr.length > 0;
1408
+ const hasProjectSkills = projectSkillsArr.length > 0;
1409
+ const hasSkills = hasGlobalSkills || hasProjectSkills;
1410
+ const hasGlobalAgents = globalAgentsArr.length > 0;
1411
+ const hasProjectAgents = projectAgentsArr.length > 0;
1412
+ const hasAgents = hasGlobalAgents || hasProjectAgents;
1413
+ const projectAgentNames = new Set(projectAgentsArr.map((a) => a.name));
1414
+ const filteredStack = projectStackObj ? Object.fromEntries(
1415
+ Object.entries(projectStackObj).filter(([agent]) => projectAgentNames.has(agent))
1416
+ ) : void 0;
1417
+ const hasStack = filteredStack != null && Object.keys(filteredStack).length > 0;
1418
+ const hasGlobalDomains = globalDomainsArr.length > 0;
1419
+ const hasProjectDomains = projectDomainsArr.length > 0;
1420
+ const hasDomains = hasGlobalDomains || hasProjectDomains;
1421
+ const typeImports = buildTypeImports({ hasSkills, hasAgents, hasStack, hasDomains });
1422
+ const lines = [`import type { ${typeImports} } from "./config-types";`];
1423
+ if (hasSkills) {
1424
+ lines.push(``);
1425
+ lines.push(`const skills: SkillConfig[] = [`);
1426
+ if (hasGlobalSkills) {
1427
+ lines.push(` // global`);
1428
+ for (const s of globalSkillsArr) {
1429
+ lines.push(` ${JSON.stringify(s)},`);
1430
+ }
1431
+ }
1432
+ if (hasProjectSkills) {
1433
+ lines.push(` // project`);
1434
+ for (const s of projectSkillsArr) {
1435
+ lines.push(` ${JSON.stringify(s)},`);
1436
+ }
1437
+ }
1438
+ lines.push(`];`);
1439
+ }
1440
+ if (hasAgents) {
1441
+ lines.push(``);
1442
+ lines.push(`const agents: AgentScopeConfig[] = [`);
1443
+ if (hasGlobalAgents) {
1444
+ lines.push(` // global`);
1445
+ for (const a of globalAgentsArr) {
1446
+ lines.push(` ${JSON.stringify(a)},`);
1447
+ }
1448
+ }
1449
+ if (hasProjectAgents) {
1450
+ lines.push(` // project`);
1451
+ for (const a of projectAgentsArr) {
1452
+ lines.push(` ${JSON.stringify(a)},`);
1453
+ }
1454
+ }
1455
+ lines.push(`];`);
1456
+ }
1457
+ if (hasStack) {
1458
+ lines.push(``);
1459
+ const stackBody = JSON.stringify(filteredStack, null, 2);
1460
+ lines.push(`const stack: Partial<Record<AgentName, StackAgentConfig>> = ${stackBody};`);
1461
+ }
1462
+ if (hasDomains) {
1463
+ lines.push(``);
1464
+ const allDomains = [.../* @__PURE__ */ new Set([...globalDomainsArr, ...projectDomainsArr])];
1465
+ const items = allDomains.map((d) => JSON.stringify(d)).join(", ");
1466
+ lines.push(`const domains: Domain[] = [${items}];`);
1467
+ }
1468
+ const projectName = cleaned.name && cleaned.name !== "global" ? cleaned.name : DEFAULT_PLUGIN_NAME;
1469
+ const exportFields = [];
1470
+ exportFields.push(` name: ${JSON.stringify(projectName)},`);
1471
+ const projectScalarFields = Object.entries(cleaned).filter(
1472
+ ([key]) => !EXTRACTED_FIELDS.has(key) && key !== "name" && key !== "selectedAgents"
1473
+ );
1474
+ const projectScalarKeys = new Set(projectScalarFields.map(([key]) => key));
1475
+ const globalScalarFields = Object.entries(cleanedGlobal).filter(
1476
+ ([key]) => !EXTRACTED_FIELDS.has(key) && key !== "name" && key !== "selectedAgents" && !projectScalarKeys.has(key)
1477
+ );
1478
+ for (const [key, value] of globalScalarFields) {
1479
+ exportFields.push(` ${JSON.stringify(key)}: ${JSON.stringify(value)},`);
1480
+ }
1481
+ for (const [key, value] of projectScalarFields) {
1482
+ exportFields.push(` ${JSON.stringify(key)}: ${JSON.stringify(value)},`);
1483
+ }
1484
+ if (hasSkills) {
1485
+ exportFields.push(` skills,`);
1486
+ } else {
1487
+ exportFields.push(` skills: [],`);
1488
+ }
1489
+ if (hasAgents) {
1490
+ exportFields.push(` agents,`);
1491
+ } else {
1492
+ exportFields.push(` agents: [],`);
1493
+ }
1494
+ if (hasStack) {
1495
+ exportFields.push(` stack,`);
1496
+ }
1497
+ if (hasDomains) {
1498
+ exportFields.push(` domains,`);
1499
+ }
1500
+ const allSelectedAgents = [.../* @__PURE__ */ new Set([...globalSelectedAgentsArr, ...projectSelectedAgentsArr])];
1501
+ if (allSelectedAgents.length > 0) {
1502
+ const items = allSelectedAgents.map((a) => JSON.stringify(a)).join(", ");
1503
+ exportFields.push(` "selectedAgents": [${items}],`);
1504
+ }
1505
+ lines.push(``);
1506
+ lines.push(`export default {`);
1507
+ lines.push(...exportFields);
1508
+ lines.push(`} satisfies ProjectConfig;`);
1509
+ lines.push(``);
1510
+ return lines.join("\n");
1511
+ }
1512
+ function compactStackAssignments(stack) {
1513
+ const result = {};
1514
+ for (const [agent, categories] of Object.entries(stack)) {
1515
+ const compactedCategories = {};
1516
+ for (const [category, assignments] of Object.entries(categories)) {
1517
+ if (!Array.isArray(assignments) || assignments.length === 0) continue;
1518
+ compactedCategories[category] = assignments.map((a) => {
1519
+ if (typeof a === "object" && a !== null && "id" in a && "preloaded" in a) {
1520
+ const assignment = a;
1521
+ return assignment.preloaded ? { id: assignment.id, preloaded: true } : assignment.id;
1522
+ }
1523
+ return a;
1524
+ });
1525
+ }
1526
+ if (Object.keys(compactedCategories).length > 0) {
1527
+ result[agent] = compactedCategories;
1528
+ }
1529
+ }
1530
+ return result;
1531
+ }
1388
1532
  function getGlobalConfigImportPath() {
1389
1533
  return path6.join(os4.homedir(), CLAUDE_SRC_DIR);
1390
1534
  }
@@ -1411,7 +1555,7 @@ export type Domain = never;
1411
1555
  export type Category = never;
1412
1556
 
1413
1557
  ${PROJECT_CONFIG_TYPES_BEFORE}
1414
- export type StackAgentConfig = Partial<Record<Category, SkillAssignment>>;
1558
+ export type StackAgentConfig = Partial<Record<Category, SkillAssignment[]>>;
1415
1559
 
1416
1560
  ${PROJECT_CONFIG_INTERFACE_AFTER}`;
1417
1561
  }
@@ -3850,44 +3994,6 @@ async function writeStandaloneConfigTypes(configPath, matrix2, agents, finalConf
3850
3994
  );
3851
3995
  await writeFile(typesPath, source);
3852
3996
  }
3853
- async function writeProjectConfigTypes(projectConfigPath, projectDir, projectConfig, matrix2) {
3854
- const typesPath = path20.join(path20.dirname(projectConfigPath), STANDARD_FILES.CONFIG_TYPES_TS);
3855
- const projectClaudeSrc = path20.join(projectDir, CLAUDE_SRC_DIR);
3856
- const globalClaudeSrc = path20.join(os8.homedir(), CLAUDE_SRC_DIR);
3857
- const relativePath = path20.relative(projectClaudeSrc, globalClaudeSrc);
3858
- const globalTypesImportPath = relativePath.split(path20.sep).join("/");
3859
- const projectSkillIds = projectConfig?.skills.map((s) => s.id) ?? [];
3860
- const projectAgentNames = projectConfig?.agents.map((a) => a.name) ?? [];
3861
- let projectCategories = [];
3862
- let projectDomains = [];
3863
- if (matrix2 && projectSkillIds.length > 0) {
3864
- const categorySet = /* @__PURE__ */ new Set();
3865
- for (const id of projectSkillIds) {
3866
- const skill = matrix2.skills[id];
3867
- if (skill?.category && skill.category !== "local") {
3868
- categorySet.add(skill.category);
3869
- }
3870
- }
3871
- projectCategories = [...categorySet].sort();
3872
- const domainSet = /* @__PURE__ */ new Set();
3873
- for (const cat of projectCategories) {
3874
- const domain = getCategoryDomain(cat);
3875
- if (domain) {
3876
- domainSet.add(domain);
3877
- }
3878
- }
3879
- projectDomains = [...domainSet].sort();
3880
- }
3881
- const source = generateProjectConfigTypesSource({
3882
- globalTypesImportPath,
3883
- projectSkillIds,
3884
- projectAgentNames,
3885
- projectDomains,
3886
- projectCategories
3887
- });
3888
- await writeFile(typesPath, source);
3889
- verbose("Using project config-types.ts that imports from global");
3890
- }
3891
3997
  async function writeScopedConfigs(finalConfig, matrix2, agents, projectDir, projectConfigPath, projectInstallationExists) {
3892
3998
  const homeDir = os8.homedir();
3893
3999
  const isProjectContext = fs.realpathSync(projectDir) !== fs.realpathSync(homeDir);
@@ -3906,9 +4012,12 @@ async function writeScopedConfigs(finalConfig, matrix2, agents, projectDir, proj
3906
4012
  const hasProjectItems = projectSplitConfig.skills.length > 0 || projectSplitConfig.agents.length > 0;
3907
4013
  if (projectInstallationExists || hasProjectItems) {
3908
4014
  await ensureDir(path20.dirname(projectConfigPath));
3909
- await writeConfigFile(projectSplitConfig, projectConfigPath, { isProjectConfig: true });
4015
+ await writeConfigFile(projectSplitConfig, projectConfigPath, {
4016
+ isProjectConfig: true,
4017
+ globalConfig
4018
+ });
3910
4019
  verbose(`Updated project config at ${projectConfigPath}`);
3911
- await writeProjectConfigTypes(projectConfigPath, projectDir, projectSplitConfig, matrix2);
4020
+ await writeStandaloneConfigTypes(projectConfigPath, matrix2, agents, finalConfig);
3912
4021
  } else {
3913
4022
  verbose(
3914
4023
  "Skipped project config \u2014 no existing project installation and no project-scoped items"
@@ -5619,4 +5728,4 @@ export {
5619
5728
  validateAllPlugins,
5620
5729
  printPluginValidationResult
5621
5730
  };
5622
- //# sourceMappingURL=chunk-KB6LCTCD.js.map
5731
+ //# sourceMappingURL=chunk-PTKJKDYH.js.map