@agents-inc/cli 0.74.7 → 0.74.10

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 (115) hide show
  1. package/CHANGELOG.md +35 -0
  2. package/README.md +69 -111
  3. package/dist/{chunk-UKYWXIDT.js → chunk-2EXAK22V.js} +117 -112
  4. package/dist/chunk-2EXAK22V.js.map +1 -0
  5. package/dist/{chunk-HA35FGPO.js → chunk-54AECXSH.js} +2 -2
  6. package/dist/{chunk-2GD57LQE.js → chunk-C6YLN4AW.js} +5 -5
  7. package/dist/{chunk-6VIOO74O.js → chunk-CBYRFAUN.js} +1 -3
  8. package/dist/{chunk-6VIOO74O.js.map → chunk-CBYRFAUN.js.map} +1 -1
  9. package/dist/{chunk-BKTPEATV.js → chunk-EWKUUWYY.js} +6 -2
  10. package/dist/chunk-EWKUUWYY.js.map +1 -0
  11. package/dist/{chunk-JB2QTE7M.js → chunk-FW5C245M.js} +6 -7
  12. package/dist/chunk-FW5C245M.js.map +1 -0
  13. package/dist/{chunk-MVYJVKVT.js → chunk-HT5KOOUQ.js} +2 -2
  14. package/dist/{chunk-VMTZ5WC5.js → chunk-IYA5PSXU.js} +2 -2
  15. package/dist/{chunk-2ZQKORJI.js → chunk-M5IAGR5Z.js} +3 -3
  16. package/dist/{chunk-KYULKBFC.js → chunk-NA6I5P5P.js} +2 -2
  17. package/dist/{chunk-STC7IEVI.js → chunk-NDKIFVR4.js} +2 -2
  18. package/dist/{chunk-RO6BG4ZW.js → chunk-OINQ6OWM.js} +3 -5
  19. package/dist/chunk-OINQ6OWM.js.map +1 -0
  20. package/dist/{chunk-CJSCCLT5.js → chunk-PN65K3LH.js} +2 -2
  21. package/dist/{chunk-GFTBHBRQ.js → chunk-PUZLP4SL.js} +14 -3
  22. package/dist/chunk-PUZLP4SL.js.map +1 -0
  23. package/dist/{chunk-COZ75NET.js → chunk-TPXDHJDB.js} +2 -2
  24. package/dist/{chunk-2MHSOPIU.js → chunk-UFKDY45I.js} +2 -2
  25. package/dist/{chunk-MOWZ2FLG.js → chunk-VILTRTBT.js} +2 -2
  26. package/dist/{chunk-W3GHDONP.js → chunk-VIVOJASC.js} +4 -4
  27. package/dist/{chunk-RHAZARG3.js → chunk-VYHRCFMD.js} +5 -5
  28. package/dist/{chunk-JZPQI7YI.js → chunk-X6LXHVA6.js} +2 -2
  29. package/dist/{chunk-HIVZDWJC.js → chunk-XPRDNALD.js} +2 -2
  30. package/dist/{chunk-TJBOCGLR.js → chunk-YDBVG6RF.js} +11 -11
  31. package/dist/{chunk-FDIKV4ON.js → chunk-YZUAXX7F.js} +4 -88
  32. package/dist/chunk-YZUAXX7F.js.map +1 -0
  33. package/dist/commands/build/plugins.js +2 -2
  34. package/dist/commands/build/stack.js +2 -2
  35. package/dist/commands/compile.js +2 -2
  36. package/dist/commands/config/index.js +2 -2
  37. package/dist/commands/config/path.js +1 -1
  38. package/dist/commands/config/show.js +2 -2
  39. package/dist/commands/diff.js +1 -1
  40. package/dist/commands/doctor.js +1 -1
  41. package/dist/commands/edit.js +47 -40
  42. package/dist/commands/edit.js.map +1 -1
  43. package/dist/commands/eject.js +1 -1
  44. package/dist/commands/import/skill.js +1 -1
  45. package/dist/commands/info.js +1 -1
  46. package/dist/commands/init.js +18 -18
  47. package/dist/commands/list.js +1 -1
  48. package/dist/commands/new/agent.js +2 -2
  49. package/dist/commands/new/marketplace.js +2 -2
  50. package/dist/commands/new/skill.js +2 -2
  51. package/dist/commands/outdated.js +1 -1
  52. package/dist/commands/search.js +3 -3
  53. package/dist/commands/uninstall.js +1 -1
  54. package/dist/commands/update.js +2 -2
  55. package/dist/commands/validate.js +62 -44
  56. package/dist/commands/validate.js.map +1 -1
  57. package/dist/components/skill-search/skill-search.js +2 -2
  58. package/dist/components/wizard/category-grid.js +2 -2
  59. package/dist/components/wizard/category-grid.test.js +4 -4
  60. package/dist/components/wizard/domain-selection.js +3 -3
  61. package/dist/components/wizard/help-modal.js +2 -2
  62. package/dist/components/wizard/search-modal.js +2 -2
  63. package/dist/components/wizard/search-modal.test.js +2 -2
  64. package/dist/components/wizard/source-grid.js +3 -3
  65. package/dist/components/wizard/source-grid.test.js +5 -5
  66. package/dist/components/wizard/stack-selection.js +3 -3
  67. package/dist/components/wizard/step-agents.js +3 -3
  68. package/dist/components/wizard/step-agents.test.js +3 -3
  69. package/dist/components/wizard/step-build.js +5 -5
  70. package/dist/components/wizard/step-build.test.js +5 -5
  71. package/dist/components/wizard/step-confirm.js +2 -2
  72. package/dist/components/wizard/step-confirm.test.js +4 -4
  73. package/dist/components/wizard/step-refine.js +3 -2
  74. package/dist/components/wizard/step-refine.test.js +3 -2
  75. package/dist/components/wizard/step-refine.test.js.map +1 -1
  76. package/dist/components/wizard/step-settings.js +3 -3
  77. package/dist/components/wizard/step-settings.test.js +6 -6
  78. package/dist/components/wizard/step-sources.js +6 -6
  79. package/dist/components/wizard/step-sources.test.js +6 -6
  80. package/dist/components/wizard/step-stack.js +5 -5
  81. package/dist/components/wizard/step-stack.test.js +5 -5
  82. package/dist/components/wizard/wizard-layout.js +5 -5
  83. package/dist/components/wizard/wizard.js +17 -17
  84. package/dist/hooks/init.js +18 -18
  85. package/dist/source-loader-WBDPZJEW.js +23 -0
  86. package/dist/{source-manager-A3QLBYCU.js → source-manager-RRGK4SBP.js} +2 -2
  87. package/dist/stores/wizard-store.js +2 -2
  88. package/dist/stores/wizard-store.test.js +26 -5
  89. package/dist/stores/wizard-store.test.js.map +1 -1
  90. package/package.json +1 -1
  91. package/dist/chunk-BKTPEATV.js.map +0 -1
  92. package/dist/chunk-FDIKV4ON.js.map +0 -1
  93. package/dist/chunk-GFTBHBRQ.js.map +0 -1
  94. package/dist/chunk-JB2QTE7M.js.map +0 -1
  95. package/dist/chunk-RO6BG4ZW.js.map +0 -1
  96. package/dist/chunk-UKYWXIDT.js.map +0 -1
  97. package/dist/source-loader-HQTTAMS7.js +0 -17
  98. /package/dist/{chunk-HA35FGPO.js.map → chunk-54AECXSH.js.map} +0 -0
  99. /package/dist/{chunk-2GD57LQE.js.map → chunk-C6YLN4AW.js.map} +0 -0
  100. /package/dist/{chunk-MVYJVKVT.js.map → chunk-HT5KOOUQ.js.map} +0 -0
  101. /package/dist/{chunk-VMTZ5WC5.js.map → chunk-IYA5PSXU.js.map} +0 -0
  102. /package/dist/{chunk-2ZQKORJI.js.map → chunk-M5IAGR5Z.js.map} +0 -0
  103. /package/dist/{chunk-KYULKBFC.js.map → chunk-NA6I5P5P.js.map} +0 -0
  104. /package/dist/{chunk-STC7IEVI.js.map → chunk-NDKIFVR4.js.map} +0 -0
  105. /package/dist/{chunk-CJSCCLT5.js.map → chunk-PN65K3LH.js.map} +0 -0
  106. /package/dist/{chunk-COZ75NET.js.map → chunk-TPXDHJDB.js.map} +0 -0
  107. /package/dist/{chunk-2MHSOPIU.js.map → chunk-UFKDY45I.js.map} +0 -0
  108. /package/dist/{chunk-MOWZ2FLG.js.map → chunk-VILTRTBT.js.map} +0 -0
  109. /package/dist/{chunk-W3GHDONP.js.map → chunk-VIVOJASC.js.map} +0 -0
  110. /package/dist/{chunk-RHAZARG3.js.map → chunk-VYHRCFMD.js.map} +0 -0
  111. /package/dist/{chunk-JZPQI7YI.js.map → chunk-X6LXHVA6.js.map} +0 -0
  112. /package/dist/{chunk-HIVZDWJC.js.map → chunk-XPRDNALD.js.map} +0 -0
  113. /package/dist/{chunk-TJBOCGLR.js.map → chunk-YDBVG6RF.js.map} +0 -0
  114. /package/dist/{source-loader-HQTTAMS7.js.map → source-loader-WBDPZJEW.js.map} +0 -0
  115. /package/dist/{source-manager-A3QLBYCU.js.map → source-manager-RRGK4SBP.js.map} +0 -0
@@ -799,56 +799,60 @@ function validateProjectConfig(config) {
799
799
  }
800
800
 
801
801
  // src/cli/lib/configuration/config-merger.ts
802
+ function mergeConfigs(newConfig, existingConfig) {
803
+ const merged = { ...newConfig };
804
+ if (existingConfig.name) {
805
+ merged.name = existingConfig.name;
806
+ }
807
+ if (existingConfig.description) {
808
+ merged.description = existingConfig.description;
809
+ }
810
+ if (existingConfig.source) {
811
+ merged.source = existingConfig.source;
812
+ }
813
+ if (existingConfig.agents && existingConfig.agents.length > 0) {
814
+ const existingNames = new Set(existingConfig.agents.map((a) => a.name));
815
+ const newAgents = merged.agents.filter((a) => !existingNames.has(a.name));
816
+ merged.agents = [...existingConfig.agents, ...newAgents];
817
+ }
818
+ if (existingConfig.skills && existingConfig.skills.length > 0) {
819
+ const newSkillsById = indexBy(merged.skills, (s) => s.id);
820
+ const existingIds = new Set(existingConfig.skills.map((s) => s.id));
821
+ const updatedExisting = existingConfig.skills.map(
822
+ (existing) => newSkillsById[existing.id] ?? existing
823
+ );
824
+ const addedSkills = merged.skills.filter((s) => !existingIds.has(s.id));
825
+ merged.skills = [...updatedExisting, ...addedSkills];
826
+ }
827
+ if (existingConfig.stack) {
828
+ const mergedStack = { ...merged.stack };
829
+ for (const [agentId, agentConfig] of typedEntries(existingConfig.stack)) {
830
+ mergedStack[agentId] = { ...mergedStack[agentId], ...agentConfig };
831
+ }
832
+ merged.stack = mergedStack;
833
+ }
834
+ if (existingConfig.author) {
835
+ merged.author = existingConfig.author;
836
+ }
837
+ if (existingConfig.agentsSource) {
838
+ merged.agentsSource = existingConfig.agentsSource;
839
+ }
840
+ if (existingConfig.marketplace) {
841
+ merged.marketplace = existingConfig.marketplace;
842
+ }
843
+ return merged;
844
+ }
802
845
  async function mergeWithExistingConfig(newConfig, context) {
803
- const localConfig = { ...newConfig };
804
846
  const existingFullConfig = await loadProjectConfig(context.projectDir);
805
847
  if (existingFullConfig) {
806
- const existingConfig = existingFullConfig.config;
807
- if (existingConfig.name) {
808
- localConfig.name = existingConfig.name;
809
- }
810
- if (existingConfig.description) {
811
- localConfig.description = existingConfig.description;
812
- }
813
- if (existingConfig.source) {
814
- localConfig.source = existingConfig.source;
815
- }
816
- if (existingConfig.agents && existingConfig.agents.length > 0) {
817
- const existingNames = new Set(existingConfig.agents.map((a) => a.name));
818
- const newAgents = localConfig.agents.filter((a) => !existingNames.has(a.name));
819
- localConfig.agents = [...existingConfig.agents, ...newAgents];
820
- }
821
- if (existingConfig.skills && existingConfig.skills.length > 0) {
822
- const newSkillsById = indexBy(localConfig.skills, (s) => s.id);
823
- const existingIds = new Set(existingConfig.skills.map((s) => s.id));
824
- const updatedExisting = existingConfig.skills.map(
825
- (existing) => newSkillsById[existing.id] ?? existing
826
- );
827
- const addedSkills = localConfig.skills.filter((s) => !existingIds.has(s.id));
828
- localConfig.skills = [...updatedExisting, ...addedSkills];
829
- }
830
- if (existingConfig.stack) {
831
- const mergedStack = { ...localConfig.stack };
832
- for (const [agentId, agentConfig] of typedEntries(existingConfig.stack)) {
833
- mergedStack[agentId] = { ...mergedStack[agentId], ...agentConfig };
834
- }
835
- localConfig.stack = mergedStack;
836
- }
837
- if (existingConfig.author) {
838
- localConfig.author = existingConfig.author;
839
- }
840
- if (existingConfig.agentsSource) {
841
- localConfig.agentsSource = existingConfig.agentsSource;
842
- }
843
- if (existingConfig.marketplace) {
844
- localConfig.marketplace = existingConfig.marketplace;
845
- }
848
+ const config = mergeConfigs(newConfig, existingFullConfig.config);
846
849
  return {
847
- config: localConfig,
850
+ config,
848
851
  merged: true,
849
852
  existingConfigPath: existingFullConfig.configPath
850
853
  };
851
854
  }
855
+ const localConfig = { ...newConfig };
852
856
  const existingProjectConfig = await loadProjectSourceConfig(context.projectDir);
853
857
  if (existingProjectConfig?.author) {
854
858
  localConfig.author = existingProjectConfig.author;
@@ -980,7 +984,7 @@ function loadConfigTypesDataInBackground(sourceFlag, projectDir) {
980
984
  if (!await directoryExists(claudeSrcDir)) {
981
985
  throw new Error(`${CLAUDE_SRC_DIR}/ not found \u2014 run '${CLI_BIN_NAME} init' first`);
982
986
  }
983
- const { loadSkillsMatrixFromSource: loadSkillsMatrixFromSource2 } = await import("./source-loader-HQTTAMS7.js");
987
+ const { loadSkillsMatrixFromSource: loadSkillsMatrixFromSource2 } = await import("./source-loader-WBDPZJEW.js");
984
988
  const { loadAllAgents: loadAllAgents2 } = await import("./loader-NHUCFMFQ.js");
985
989
  const sourceResult = await loadSkillsMatrixFromSource2({
986
990
  sourceFlag,
@@ -1740,22 +1744,33 @@ function mergeMatrixWithSkills(categories, relationships, skills) {
1740
1744
  };
1741
1745
  return merged;
1742
1746
  }
1743
- function resolveConflicts(skillId, conflictRules, resolve) {
1744
- const conflicts = [];
1745
- for (const rule of conflictRules) {
1747
+ function resolveRelationships(skillId, relationships, resolve) {
1748
+ const conflictsWith = [];
1749
+ const discourages = [];
1750
+ const compatible = /* @__PURE__ */ new Set();
1751
+ const requires = [];
1752
+ const alternatives = [];
1753
+ for (const rule of relationships.conflicts) {
1746
1754
  const resolved = rule.skills.map((slug) => resolve(slug, "conflicts")).filter((id) => id !== null);
1747
1755
  if (!resolved.includes(skillId)) continue;
1748
1756
  for (const other of resolved) {
1749
- if (other !== skillId && !conflicts.some((c) => c.skillId === other)) {
1750
- conflicts.push({ skillId: other, reason: rule.reason });
1757
+ if (other !== skillId && !conflictsWith.some((c) => c.skillId === other)) {
1758
+ conflictsWith.push({ skillId: other, reason: rule.reason });
1751
1759
  }
1752
1760
  }
1753
1761
  }
1754
- return conflicts;
1755
- }
1756
- function resolveCompatibilityGroups(skillId, compatibilityGroups, resolve) {
1757
- const compatible = /* @__PURE__ */ new Set();
1758
- for (const group of compatibilityGroups) {
1762
+ if (relationships.discourages) {
1763
+ for (const rule of relationships.discourages) {
1764
+ const resolved = rule.skills.map((slug) => resolve(slug, "discourages")).filter((id) => id !== null);
1765
+ if (!resolved.includes(skillId)) continue;
1766
+ for (const other of resolved) {
1767
+ if (other !== skillId && !discourages.some((d) => d.skillId === other)) {
1768
+ discourages.push({ skillId: other, reason: rule.reason });
1769
+ }
1770
+ }
1771
+ }
1772
+ }
1773
+ for (const group of relationships.compatibleWith ?? []) {
1759
1774
  const resolved = group.skills.map((slug) => resolve(slug, "compatibleWith")).filter((id) => id !== null);
1760
1775
  if (!resolved.includes(skillId)) continue;
1761
1776
  for (const other of resolved) {
@@ -1764,11 +1779,7 @@ function resolveCompatibilityGroups(skillId, compatibilityGroups, resolve) {
1764
1779
  }
1765
1780
  }
1766
1781
  }
1767
- return [...compatible];
1768
- }
1769
- function resolveRequirements(skillId, requireRules, resolve) {
1770
- const requires = [];
1771
- for (const rule of requireRules) {
1782
+ for (const rule of relationships.requires) {
1772
1783
  const ruleSkillId = resolve(rule.skill, "requires.skill");
1773
1784
  if (ruleSkillId !== skillId) continue;
1774
1785
  const resolvedNeeds = rule.needs.map((slug) => resolve(slug, "requires.needs")).filter((id) => id !== null);
@@ -1779,11 +1790,7 @@ function resolveRequirements(skillId, requireRules, resolve) {
1779
1790
  reason: rule.reason
1780
1791
  });
1781
1792
  }
1782
- return requires;
1783
- }
1784
- function resolveAlternatives(skillId, alternativeGroups, resolve) {
1785
- const alternatives = [];
1786
- for (const group of alternativeGroups) {
1793
+ for (const group of relationships.alternatives) {
1787
1794
  const resolved = group.skills.map((slug) => resolve(slug, "alternatives")).filter((id) => id !== null);
1788
1795
  if (!resolved.includes(skillId)) continue;
1789
1796
  for (const alt of resolved) {
@@ -1792,26 +1799,19 @@ function resolveAlternatives(skillId, alternativeGroups, resolve) {
1792
1799
  }
1793
1800
  }
1794
1801
  }
1795
- return alternatives;
1796
- }
1797
- function resolveDiscourages(skillId, discourageRules, resolve) {
1798
- if (!discourageRules) return [];
1799
- const discourages = [];
1800
- for (const rule of discourageRules) {
1801
- const resolved = rule.skills.map((slug) => resolve(slug, "discourages")).filter((id) => id !== null);
1802
- if (!resolved.includes(skillId)) continue;
1803
- for (const other of resolved) {
1804
- if (other !== skillId && !discourages.some((d) => d.skillId === other)) {
1805
- discourages.push({ skillId: other, reason: rule.reason });
1806
- }
1807
- }
1808
- }
1809
- return discourages;
1802
+ return {
1803
+ conflictsWith,
1804
+ discourages,
1805
+ compatibleWith: [...compatible],
1806
+ requires,
1807
+ alternatives
1808
+ };
1810
1809
  }
1811
1810
  function buildResolvedSkill(skill, _categories, relationships, slugMap) {
1812
1811
  const resolve = (slug2, context) => resolveToCanonicalId(slug2, slugMap.slugToId, context ? `${skill.id} ${context}` : void 0);
1813
1812
  const slug = skill.slug;
1814
1813
  const recommendation = relationships.recommends.find((r) => r.skill === skill.slug);
1814
+ const resolved = resolveRelationships(skill.id, relationships, resolve);
1815
1815
  return {
1816
1816
  id: skill.id,
1817
1817
  slug,
@@ -1821,17 +1821,9 @@ function buildResolvedSkill(skill, _categories, relationships, slugMap) {
1821
1821
  category: skill.category,
1822
1822
  tags: skill.tags,
1823
1823
  author: skill.author,
1824
- conflictsWith: resolveConflicts(skill.id, relationships.conflicts, resolve),
1824
+ ...resolved,
1825
1825
  isRecommended: recommendation != null,
1826
1826
  recommendedReason: recommendation?.reason,
1827
- requires: resolveRequirements(skill.id, relationships.requires, resolve),
1828
- alternatives: resolveAlternatives(skill.id, relationships.alternatives, resolve),
1829
- discourages: resolveDiscourages(skill.id, relationships.discourages, resolve),
1830
- compatibleWith: resolveCompatibilityGroups(
1831
- skill.id,
1832
- relationships.compatibleWith ?? [],
1833
- resolve
1834
- ),
1835
1827
  path: skill.path,
1836
1828
  ...skill.custom === true ? { custom: true } : {}
1837
1829
  };
@@ -3676,28 +3668,30 @@ async function buildLocalConfig(wizardResult, sourceResult) {
3676
3668
  return { config: localConfig, loadedStack };
3677
3669
  }
3678
3670
  function setConfigMetadata(config, wizardResult, sourceResult, sourceFlag) {
3671
+ const result = { ...config };
3679
3672
  if (wizardResult.selectedDomains && wizardResult.selectedDomains.length > 0) {
3680
- config.domains = wizardResult.selectedDomains;
3673
+ result.domains = wizardResult.selectedDomains;
3681
3674
  }
3682
3675
  if (wizardResult.selectedAgents && wizardResult.selectedAgents.length > 0) {
3683
- config.selectedAgents = wizardResult.selectedAgents;
3676
+ result.selectedAgents = wizardResult.selectedAgents;
3684
3677
  }
3685
3678
  if (sourceFlag) {
3686
- config.source = sourceFlag;
3679
+ result.source = sourceFlag;
3687
3680
  } else if (sourceResult.sourceConfig.source) {
3688
- config.source = sourceResult.sourceConfig.source;
3681
+ result.source = sourceResult.sourceConfig.source;
3689
3682
  }
3690
3683
  if (sourceResult.marketplace) {
3691
- config.marketplace = sourceResult.marketplace;
3684
+ result.marketplace = sourceResult.marketplace;
3692
3685
  }
3686
+ return result;
3693
3687
  }
3694
3688
  async function buildAndMergeConfig(wizardResult, sourceResult, projectDir, sourceFlag) {
3695
3689
  const { config } = await buildLocalConfig(wizardResult, sourceResult);
3696
3690
  verbose(
3697
3691
  `buildAndMergeConfig: before merge \u2014 stack=${config.stack ? Object.keys(config.stack).length + " agents" : "UNDEFINED"}`
3698
3692
  );
3699
- setConfigMetadata(config, wizardResult, sourceResult, sourceFlag);
3700
- const result = await mergeWithExistingConfig(config, { projectDir });
3693
+ const configWithMetadata = setConfigMetadata(config, wizardResult, sourceResult, sourceFlag);
3694
+ const result = await mergeWithExistingConfig(configWithMetadata, { projectDir });
3701
3695
  verbose(
3702
3696
  `buildAndMergeConfig: after merge \u2014 stack=${result.config.stack ? Object.keys(result.config.stack).length + " agents" : "UNDEFINED"}, merged=${result.merged}`
3703
3697
  );
@@ -3783,7 +3777,7 @@ async function writeProjectConfigTypes(projectConfigPath, projectDir, projectCon
3783
3777
  await writeFile(typesPath, source);
3784
3778
  verbose("Using project config-types.ts that imports from global");
3785
3779
  }
3786
- async function writeScopedConfigs(finalConfig, matrix2, agents, projectDir, projectConfigPath) {
3780
+ async function writeScopedConfigs(finalConfig, matrix2, agents, projectDir, projectConfigPath, projectInstallationExists) {
3787
3781
  const homeDir = os8.homedir();
3788
3782
  const isProjectContext = path20.resolve(projectDir) !== path20.resolve(homeDir);
3789
3783
  if (!isProjectContext) {
@@ -3798,10 +3792,17 @@ async function writeScopedConfigs(finalConfig, matrix2, agents, projectDir, proj
3798
3792
  verbose(`Updated global config at ${globalConfigPath}`);
3799
3793
  await writeStandaloneConfigTypes(globalConfigPath, matrix2, agents, globalConfig);
3800
3794
  verbose("Updated global config-types.ts with actual types");
3801
- await ensureDir(path20.dirname(projectConfigPath));
3802
- await writeConfigFile(projectSplitConfig, projectConfigPath, { isProjectConfig: true });
3803
- verbose(`Updated project config at ${projectConfigPath}`);
3804
- await writeProjectConfigTypes(projectConfigPath, projectDir, projectSplitConfig, matrix2);
3795
+ const hasProjectItems = projectSplitConfig.skills.length > 0 || projectSplitConfig.agents.length > 0;
3796
+ if (projectInstallationExists || hasProjectItems) {
3797
+ await ensureDir(path20.dirname(projectConfigPath));
3798
+ await writeConfigFile(projectSplitConfig, projectConfigPath, { isProjectConfig: true });
3799
+ verbose(`Updated project config at ${projectConfigPath}`);
3800
+ await writeProjectConfigTypes(projectConfigPath, projectDir, projectSplitConfig, matrix2);
3801
+ } else {
3802
+ verbose(
3803
+ "Skipped project config \u2014 no existing project installation and no project-scoped items"
3804
+ );
3805
+ }
3805
3806
  }
3806
3807
  async function compileAndWriteAgents(compileConfig, agents, localSkills, sourceResult, projectDir, agentsDir, installMode, agentScopeMap) {
3807
3808
  const engine = await createLiquidEngine(projectDir);
@@ -3812,6 +3813,7 @@ async function compileAndWriteAgents(compileConfig, agents, localSkills, sourceR
3812
3813
  sourceResult.sourcePath
3813
3814
  );
3814
3815
  const globalAgentsDir = path20.join(os8.homedir(), CLAUDE_DIR, "agents");
3816
+ await ensureDir(globalAgentsDir);
3815
3817
  const compiledAgentNames = [];
3816
3818
  for (const [name, agent] of typedEntries(resolvedAgents)) {
3817
3819
  const output = await compileAgentForPlugin(
@@ -3823,9 +3825,6 @@ async function compileAndWriteAgents(compileConfig, agents, localSkills, sourceR
3823
3825
  );
3824
3826
  const scope = agentScopeMap?.get(name) ?? "project";
3825
3827
  const targetDir = scope === "global" ? globalAgentsDir : agentsDir;
3826
- if (scope === "global") {
3827
- await ensureDir(targetDir);
3828
- }
3829
3828
  await writeFile(path20.join(targetDir, `${name}.md`), output);
3830
3829
  compiledAgentNames.push(name);
3831
3830
  }
@@ -3834,20 +3833,22 @@ async function compileAndWriteAgents(compileConfig, agents, localSkills, sourceR
3834
3833
  async function installPluginConfig(options) {
3835
3834
  const { wizardResult, sourceResult, projectDir, sourceFlag } = options;
3836
3835
  const projectPaths = resolveInstallPaths(projectDir, "project");
3837
- const hasProjectAgents = wizardResult.skills.some((s) => s.scope !== "global") || wizardResult.agentConfigs.some((a) => a.scope !== "global");
3838
- if (hasProjectAgents) {
3836
+ const isProjectInstall = path20.resolve(projectDir) !== path20.resolve(os8.homedir());
3837
+ if (isProjectInstall) {
3839
3838
  await ensureDir(projectPaths.agentsDir);
3840
3839
  }
3841
3840
  await ensureDir(path20.dirname(projectPaths.configPath));
3842
3841
  const agents = await loadMergedAgents(sourceResult.sourcePath);
3843
3842
  const mergeResult = await buildAndMergeConfig(wizardResult, sourceResult, projectDir, sourceFlag);
3844
3843
  const finalConfig = mergeResult.config;
3844
+ const projectInstallationExists = path20.resolve(projectDir) !== path20.resolve(os8.homedir());
3845
3845
  await writeScopedConfigs(
3846
3846
  finalConfig,
3847
3847
  sourceResult.matrix,
3848
3848
  agents,
3849
3849
  projectDir,
3850
- projectPaths.configPath
3850
+ projectPaths.configPath,
3851
+ projectInstallationExists
3851
3852
  );
3852
3853
  const compileAgentsConfig = buildCompileAgents(finalConfig, agents);
3853
3854
  const compileConfig = {
@@ -3885,15 +3886,14 @@ async function installLocal(options) {
3885
3886
  const globalPaths = resolveInstallPaths(projectDir, "global");
3886
3887
  const projectSkills = wizardResult.skills.filter((s) => s.scope !== "global");
3887
3888
  const globalSkills = wizardResult.skills.filter((s) => s.scope === "global");
3888
- const hasProjectItems = projectSkills.length > 0 || wizardResult.agentConfigs.some((a) => a.scope !== "global");
3889
- if (hasProjectItems) {
3889
+ const homeDir = os8.homedir();
3890
+ const isProjectInstall = path20.resolve(projectDir) !== path20.resolve(homeDir);
3891
+ if (isProjectInstall) {
3890
3892
  await prepareDirectories(projectPaths);
3891
3893
  } else {
3892
3894
  await ensureDir(path20.dirname(projectPaths.configPath));
3893
3895
  }
3894
- if (globalSkills.length > 0) {
3895
- await ensureDir(globalPaths.skillsDir);
3896
- }
3896
+ await ensureDir(globalPaths.skillsDir);
3897
3897
  const projectCopied = projectSkills.length > 0 ? await deleteAndCopySkills(projectSkills, sourceResult, projectDir, projectPaths.skillsDir) : [];
3898
3898
  const globalCopied = globalSkills.length > 0 ? await deleteAndCopySkills(globalSkills, sourceResult, projectDir, globalPaths.skillsDir) : [];
3899
3899
  const copiedSkills = [...projectCopied, ...globalCopied];
@@ -3901,12 +3901,14 @@ async function installLocal(options) {
3901
3901
  const agents = await loadMergedAgents(sourceResult.sourcePath);
3902
3902
  const mergeResult = await buildAndMergeConfig(wizardResult, sourceResult, projectDir, sourceFlag);
3903
3903
  const finalConfig = mergeResult.config;
3904
+ const isProjectContext = path20.resolve(projectDir) !== path20.resolve(os8.homedir());
3904
3905
  await writeScopedConfigs(
3905
3906
  finalConfig,
3906
3907
  sourceResult.matrix,
3907
3908
  agents,
3908
3909
  projectDir,
3909
- projectPaths.configPath
3910
+ projectPaths.configPath,
3911
+ isProjectContext
3910
3912
  );
3911
3913
  const compileAgentsConfig = buildCompileAgents(finalConfig, agents);
3912
3914
  const compileConfig = {
@@ -5462,7 +5464,10 @@ export {
5462
5464
  claudePluginMarketplaceAdd,
5463
5465
  claudePluginUninstall,
5464
5466
  loadSkillsMatrixFromSource,
5467
+ convertStackToResolvedStack,
5468
+ extractSourceName,
5465
5469
  getMarketplaceLabel,
5470
+ mergeLocalSkillsIntoMatrix,
5466
5471
  loadConfigTypesDataInBackground,
5467
5472
  regenerateConfigTypes,
5468
5473
  generateConfigSource,
@@ -5491,4 +5496,4 @@ export {
5491
5496
  validateAllPlugins,
5492
5497
  printPluginValidationResult
5493
5498
  };
5494
- //# sourceMappingURL=chunk-UKYWXIDT.js.map
5499
+ //# sourceMappingURL=chunk-2EXAK22V.js.map