agents-inc 0.159.0 → 0.161.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 (151) hide show
  1. package/CHANGELOG.md +23 -0
  2. package/README.md +1 -1
  3. package/dist/{chunk-PEHYVSJG.js → chunk-264XDRU7.js} +2 -2
  4. package/dist/{chunk-WVKGO3Y5.js → chunk-2MPXMJ2O.js} +7 -7
  5. package/dist/{chunk-IO2DPRDS.js → chunk-3H42U56X.js} +2 -2
  6. package/dist/{chunk-FBRLHNUT.js → chunk-3M75HVIM.js} +3 -3
  7. package/dist/{chunk-YKRPWZ3G.js → chunk-3TM4FHTG.js} +2 -2
  8. package/dist/{chunk-5YOSLSQJ.js → chunk-5DWDT6GM.js} +115 -96
  9. package/dist/chunk-5DWDT6GM.js.map +1 -0
  10. package/dist/{chunk-4APXK7ZY.js → chunk-5MML3K36.js} +2 -2
  11. package/dist/{chunk-F35G42TF.js → chunk-6PVWDTEM.js} +12 -12
  12. package/dist/{chunk-VCUXNKOY.js → chunk-A2NA377T.js} +6 -6
  13. package/dist/{chunk-4RYWFQK7.js → chunk-ADDYIMWN.js} +3 -3
  14. package/dist/{chunk-V625APR6.js → chunk-AMZO4YJK.js} +10789 -18786
  15. package/dist/chunk-AMZO4YJK.js.map +1 -0
  16. package/dist/{chunk-4VMLCWLD.js → chunk-AO6DXJUK.js} +3 -3
  17. package/dist/{chunk-G7TYOPON.js → chunk-B3YSTZZC.js} +3 -3
  18. package/dist/{chunk-THLQS2AW.js → chunk-B7YTQVAF.js} +4 -4
  19. package/dist/{chunk-7Z4N4JWQ.js → chunk-BLGETWYI.js} +6 -113
  20. package/dist/chunk-BLGETWYI.js.map +1 -0
  21. package/dist/{chunk-ITEJARWI.js → chunk-BRHU6J3C.js} +3 -3
  22. package/dist/{chunk-AU5FS3QK.js → chunk-DGXW2ZFY.js} +3 -3
  23. package/dist/{chunk-LSSGS2QS.js → chunk-DHRW3MDM.js} +3 -3
  24. package/dist/{chunk-OJIQOVWB.js → chunk-DTCUZL7S.js} +2 -2
  25. package/dist/{chunk-SKDTGHCD.js → chunk-EEFTUZHZ.js} +5 -5
  26. package/dist/{chunk-BQJVHD6Y.js → chunk-EERGAAGE.js} +5 -10
  27. package/dist/chunk-EERGAAGE.js.map +1 -0
  28. package/dist/{chunk-Z6G24ROK.js → chunk-EQSMVZGS.js} +10 -10
  29. package/dist/{chunk-2Q65K6E3.js → chunk-EY7Z34Y4.js} +15 -15
  30. package/dist/{chunk-BNHD2GIB.js → chunk-F6LS2BQD.js} +11 -11
  31. package/dist/{chunk-SITF5EZM.js → chunk-HB3YIAFD.js} +2 -2
  32. package/dist/{chunk-GPZQCLZJ.js → chunk-LZPRLHUE.js} +9 -9
  33. package/dist/{chunk-YAHTF4NO.js → chunk-MED6GNV3.js} +288 -203
  34. package/dist/chunk-MED6GNV3.js.map +1 -0
  35. package/dist/chunk-N6CILY5A.js +35 -0
  36. package/dist/chunk-N6CILY5A.js.map +1 -0
  37. package/dist/{chunk-42PQKBVU.js → chunk-ODUACQLV.js} +6 -6
  38. package/dist/{chunk-VZRO7RYT.js → chunk-OI2H6M5I.js} +1 -103
  39. package/dist/chunk-OI2H6M5I.js.map +1 -0
  40. package/dist/{chunk-MPLWPWL4.js → chunk-QKMT6OOP.js} +2 -2
  41. package/dist/{chunk-WVBJRFFM.js → chunk-SX57ZIGM.js} +4 -4
  42. package/dist/{chunk-62XKTOUI.js → chunk-T4RVCFWN.js} +5 -15
  43. package/dist/chunk-T4RVCFWN.js.map +1 -0
  44. package/dist/{chunk-4VVKVOOP.js → chunk-UMYEY6BA.js} +2 -2
  45. package/dist/{chunk-X5PLVOJS.js → chunk-W2RXRWDB.js} +2 -2
  46. package/dist/{chunk-JV4P7BL4.js → chunk-WVCF7KFV.js} +5 -5
  47. package/dist/chunk-XA4SWA2Z.js +591 -0
  48. package/dist/chunk-XA4SWA2Z.js.map +1 -0
  49. package/dist/{chunk-LVA6XJGR.js → chunk-YOVUXONB.js} +9 -43
  50. package/dist/chunk-YOVUXONB.js.map +1 -0
  51. package/dist/chunk-YSQ76LWG.js +8734 -0
  52. package/dist/chunk-YSQ76LWG.js.map +1 -0
  53. package/dist/{chunk-Z6KROWH4.js → chunk-ZQZHDYHQ.js} +7 -7
  54. package/dist/commands/build/marketplace.js +8 -8
  55. package/dist/commands/build/plugins.js +8 -8
  56. package/dist/commands/compile.js +14 -14
  57. package/dist/commands/doctor.js +13 -13
  58. package/dist/commands/edit.js +45 -45
  59. package/dist/commands/eject.js +11 -11
  60. package/dist/commands/init.js +37 -37
  61. package/dist/commands/list.js +9 -9
  62. package/dist/commands/new/marketplace.js +8 -9
  63. package/dist/commands/new/marketplace.js.map +1 -1
  64. package/dist/commands/search.js +11 -11
  65. package/dist/commands/share.js +11 -10
  66. package/dist/commands/share.js.map +1 -1
  67. package/dist/commands/uninstall.js +12 -12
  68. package/dist/commands/update.js +7 -7
  69. package/dist/components/common/removal-plan-confirm.js +2 -2
  70. package/dist/components/common/select-list.js +2 -2
  71. package/dist/components/wizard/category-grid.js +4 -4
  72. package/dist/components/wizard/checkbox-grid.js +4 -4
  73. package/dist/components/wizard/domain-selection.js +10 -10
  74. package/dist/components/wizard/run-wizard-session.js +27 -27
  75. package/dist/components/wizard/scroll-affordance.js +2 -2
  76. package/dist/components/wizard/skill-agent-summary.js +6 -6
  77. package/dist/components/wizard/source-grid.js +5 -5
  78. package/dist/components/wizard/stack-selection.js +8 -8
  79. package/dist/components/wizard/step-agents.js +9 -9
  80. package/dist/components/wizard/step-build.js +8 -8
  81. package/dist/components/wizard/step-confirm.js +10 -10
  82. package/dist/components/wizard/step-sources.js +9 -9
  83. package/dist/components/wizard/step-stack.js +9 -9
  84. package/dist/components/wizard/summary-panel.js +9 -9
  85. package/dist/components/wizard/toast.js +2 -2
  86. package/dist/components/wizard/wizard-layout.js +13 -13
  87. package/dist/components/wizard/wizard-tabs.js +2 -2
  88. package/dist/components/wizard/wizard.js +26 -26
  89. package/dist/config-exports.js +1 -1
  90. package/dist/hooks/init.js +37 -37
  91. package/dist/load-agent-defs-LDSND43G.js +13 -0
  92. package/dist/recompile-project-agents-GQLODH24.js +17 -0
  93. package/dist/{source-loader-CC6ZWKTI.js → source-loader-TSF5VS6V.js} +5 -5
  94. package/dist/src/agents/_templates/methodologies/anti-over-engineering.liquid +14 -0
  95. package/dist/src/agents/_templates/methodologies/context-management.liquid +7 -154
  96. package/dist/src/agents/_templates/methodologies/investigation-requirements.liquid +12 -0
  97. package/dist/src/agents/_templates/methodologies/success-criteria.liquid +10 -0
  98. package/dist/stores/wizard-store.js +5 -5
  99. package/package.json +9 -4
  100. package/src/agents/_templates/methodologies/anti-over-engineering.liquid +14 -0
  101. package/src/agents/_templates/methodologies/context-management.liquid +7 -154
  102. package/src/agents/_templates/methodologies/investigation-requirements.liquid +12 -0
  103. package/src/agents/_templates/methodologies/success-criteria.liquid +10 -0
  104. package/dist/chunk-5KB4I5J7.js +0 -262
  105. package/dist/chunk-5KB4I5J7.js.map +0 -1
  106. package/dist/chunk-5YOSLSQJ.js.map +0 -1
  107. package/dist/chunk-62XKTOUI.js.map +0 -1
  108. package/dist/chunk-7Z4N4JWQ.js.map +0 -1
  109. package/dist/chunk-BQJVHD6Y.js.map +0 -1
  110. package/dist/chunk-LVA6XJGR.js.map +0 -1
  111. package/dist/chunk-NS5COBTT.js +0 -254
  112. package/dist/chunk-NS5COBTT.js.map +0 -1
  113. package/dist/chunk-V625APR6.js.map +0 -1
  114. package/dist/chunk-VZRO7RYT.js.map +0 -1
  115. package/dist/chunk-YAHTF4NO.js.map +0 -1
  116. package/dist/chunk-YVQSDBTK.js +0 -169
  117. package/dist/chunk-YVQSDBTK.js.map +0 -1
  118. package/dist/load-agent-defs-2H42B2OO.js +0 -13
  119. package/dist/recompile-project-agents-QIAMBCM4.js +0 -17
  120. /package/dist/{chunk-PEHYVSJG.js.map → chunk-264XDRU7.js.map} +0 -0
  121. /package/dist/{chunk-WVKGO3Y5.js.map → chunk-2MPXMJ2O.js.map} +0 -0
  122. /package/dist/{chunk-IO2DPRDS.js.map → chunk-3H42U56X.js.map} +0 -0
  123. /package/dist/{chunk-FBRLHNUT.js.map → chunk-3M75HVIM.js.map} +0 -0
  124. /package/dist/{chunk-YKRPWZ3G.js.map → chunk-3TM4FHTG.js.map} +0 -0
  125. /package/dist/{chunk-4APXK7ZY.js.map → chunk-5MML3K36.js.map} +0 -0
  126. /package/dist/{chunk-F35G42TF.js.map → chunk-6PVWDTEM.js.map} +0 -0
  127. /package/dist/{chunk-VCUXNKOY.js.map → chunk-A2NA377T.js.map} +0 -0
  128. /package/dist/{chunk-4RYWFQK7.js.map → chunk-ADDYIMWN.js.map} +0 -0
  129. /package/dist/{chunk-4VMLCWLD.js.map → chunk-AO6DXJUK.js.map} +0 -0
  130. /package/dist/{chunk-G7TYOPON.js.map → chunk-B3YSTZZC.js.map} +0 -0
  131. /package/dist/{chunk-THLQS2AW.js.map → chunk-B7YTQVAF.js.map} +0 -0
  132. /package/dist/{chunk-ITEJARWI.js.map → chunk-BRHU6J3C.js.map} +0 -0
  133. /package/dist/{chunk-AU5FS3QK.js.map → chunk-DGXW2ZFY.js.map} +0 -0
  134. /package/dist/{chunk-LSSGS2QS.js.map → chunk-DHRW3MDM.js.map} +0 -0
  135. /package/dist/{chunk-OJIQOVWB.js.map → chunk-DTCUZL7S.js.map} +0 -0
  136. /package/dist/{chunk-SKDTGHCD.js.map → chunk-EEFTUZHZ.js.map} +0 -0
  137. /package/dist/{chunk-Z6G24ROK.js.map → chunk-EQSMVZGS.js.map} +0 -0
  138. /package/dist/{chunk-2Q65K6E3.js.map → chunk-EY7Z34Y4.js.map} +0 -0
  139. /package/dist/{chunk-BNHD2GIB.js.map → chunk-F6LS2BQD.js.map} +0 -0
  140. /package/dist/{chunk-SITF5EZM.js.map → chunk-HB3YIAFD.js.map} +0 -0
  141. /package/dist/{chunk-GPZQCLZJ.js.map → chunk-LZPRLHUE.js.map} +0 -0
  142. /package/dist/{chunk-42PQKBVU.js.map → chunk-ODUACQLV.js.map} +0 -0
  143. /package/dist/{chunk-MPLWPWL4.js.map → chunk-QKMT6OOP.js.map} +0 -0
  144. /package/dist/{chunk-WVBJRFFM.js.map → chunk-SX57ZIGM.js.map} +0 -0
  145. /package/dist/{chunk-4VVKVOOP.js.map → chunk-UMYEY6BA.js.map} +0 -0
  146. /package/dist/{chunk-X5PLVOJS.js.map → chunk-W2RXRWDB.js.map} +0 -0
  147. /package/dist/{chunk-JV4P7BL4.js.map → chunk-WVCF7KFV.js.map} +0 -0
  148. /package/dist/{chunk-Z6KROWH4.js.map → chunk-ZQZHDYHQ.js.map} +0 -0
  149. /package/dist/{load-agent-defs-2H42B2OO.js.map → load-agent-defs-LDSND43G.js.map} +0 -0
  150. /package/dist/{recompile-project-agents-QIAMBCM4.js.map → recompile-project-agents-GQLODH24.js.map} +0 -0
  151. /package/dist/{source-loader-CC6ZWKTI.js.map → source-loader-TSF5VS6V.js.map} +0 -0
@@ -1,19 +1,18 @@
1
1
  #!/usr/bin/env node
2
2
  import {
3
3
  compileAgents
4
- } from "./chunk-VCUXNKOY.js";
4
+ } from "./chunk-A2NA377T.js";
5
5
  import {
6
6
  loadAgentDefs
7
- } from "./chunk-G7TYOPON.js";
7
+ } from "./chunk-B3YSTZZC.js";
8
8
  import {
9
9
  ConfigLoadError,
10
10
  GlobalPairWriteViolation,
11
- STACK_AGENT_CONFIG_LOOSE_LINE,
12
- activeProjectAgentNames,
13
- assembleConfigTypesSource,
11
+ INDENT_STEP,
14
12
  assertGateToken,
15
13
  buildAndMergeConfig,
16
14
  buildConfigTypesBackgroundData,
15
+ commentEntry,
17
16
  deriveCategories,
18
17
  deriveDomains,
19
18
  detectGlobalInstallation,
@@ -24,40 +23,50 @@ import {
24
23
  enableBuffering,
25
24
  ensureDir,
26
25
  fileExists,
26
+ generateBlankGlobalConfigTypesSource,
27
27
  generateConfigTypesSource,
28
28
  getErrorMessage,
29
29
  getProjectConfigPath,
30
- isActiveAt,
31
- isGlobalTombstone,
32
30
  isHomeDirectory,
33
- isSkillAssignment,
31
+ isKeyedRecord,
34
32
  loadProjectConfig,
35
33
  loadProjectConfigFromDir,
36
34
  loadSkillsMatrixFromSource,
37
35
  mergeConfigs,
38
36
  normalizeStackRecord,
37
+ quoteText,
39
38
  readFile,
40
39
  regenerateConfigTypes,
40
+ renderArrayLine,
41
+ renderKey,
42
+ renderTypeImportLine,
43
+ renderValueLine,
41
44
  resolveInstallPaths,
45
+ sourceEntry,
42
46
  splitConfigByScope,
47
+ valueEntries,
43
48
  verbose,
44
49
  withGateToken,
45
50
  writeFile
46
- } from "./chunk-V625APR6.js";
51
+ } from "./chunk-YSQ76LWG.js";
47
52
  import {
48
- byCategoryDeclarationOrder,
49
53
  matrix,
50
54
  typedEntries,
51
55
  typedKeys
52
- } from "./chunk-7Z4N4JWQ.js";
56
+ } from "./chunk-BLGETWYI.js";
53
57
  import {
54
58
  CLAUDE_SRC_DIR,
55
59
  CLI_INVOKE_COMMAND,
56
60
  DEFAULT_PLUGIN_NAME,
57
61
  GLOBAL_CONFIG_NAME,
58
62
  LOCAL_PSEUDO_CATEGORY,
59
- STANDARD_FILES
60
- } from "./chunk-5KB4I5J7.js";
63
+ STANDARD_FILES,
64
+ activeProjectAgentNames,
65
+ byCategoryDeclarationOrder,
66
+ isActiveAt,
67
+ isExclusiveCategory,
68
+ isGlobalTombstone
69
+ } from "./chunk-AMZO4YJK.js";
61
70
 
62
71
  // src/cli/lib/operations/source/load-source.ts
63
72
  async function loadSource(options) {
@@ -118,10 +127,13 @@ async function detectBothInstallations(projectDir) {
118
127
  import fs from "fs";
119
128
  import { isDeepEqual, unique } from "remeda";
120
129
 
121
- // src/cli/lib/configuration/config-writer.ts
122
- import os from "os";
123
- import path from "path";
124
- var EXTRACTED_FIELDS = /* @__PURE__ */ new Set(["skills", "agents", "stack", "selectedDomains"]);
130
+ // ../compile/src/config-source.ts
131
+ var EXTRACTED_FIELDS = /* @__PURE__ */ new Set([
132
+ "skills",
133
+ "agents",
134
+ "stack",
135
+ "selectedDomains"
136
+ ]);
125
137
  var CANONICAL_FIELD_ORDER = [
126
138
  "name",
127
139
  "description",
@@ -135,33 +147,94 @@ var CANONICAL_FIELD_ORDER = [
135
147
  "agentsSource",
136
148
  "projects"
137
149
  ];
138
- var CANONICAL_FIELDS = new Set(CANONICAL_FIELD_ORDER);
139
- function canonicalizeFieldOrder(cleaned) {
140
- const inSchemaOrder = CANONICAL_FIELD_ORDER.filter(
141
- (key) => key in cleaned
142
- ).map((key) => [key, cleaned[key]]);
143
- const passthrough = Object.entries(cleaned).filter(([key]) => !CANONICAL_FIELDS.has(key));
150
+ var CANONICAL_SKILL_ENTRY_ORDER = [
151
+ "id",
152
+ "scope",
153
+ "origin",
154
+ "excluded"
155
+ ];
156
+ var CANONICAL_AGENT_ENTRY_ORDER = [
157
+ "name",
158
+ "scope",
159
+ "model",
160
+ "effort",
161
+ "excluded"
162
+ ];
163
+ var CANONICAL_ASSIGNMENT_ORDER = [
164
+ "id",
165
+ "preloaded",
166
+ "local",
167
+ "path"
168
+ ];
169
+ function withKeysInSchemaOrder(record, schemaOrder) {
170
+ const named = new Set(schemaOrder);
171
+ const inSchemaOrder = schemaOrder.filter((key) => key in record).map((key) => [key, record[key]]);
172
+ const passthrough = Object.entries(record).filter(([key]) => !named.has(key));
144
173
  return Object.fromEntries([...inSchemaOrder, ...passthrough]);
145
174
  }
175
+ function canonicalizeFieldOrder(cleaned) {
176
+ return withKeysInSchemaOrder(cleaned, CANONICAL_FIELD_ORDER);
177
+ }
178
+ function withEntriesInSchemaOrder(cleaned) {
179
+ const reordered = { ...cleaned };
180
+ if (Array.isArray(reordered.skills)) {
181
+ reordered.skills = entriesInSchemaOrder(
182
+ reordered.skills,
183
+ CANONICAL_SKILL_ENTRY_ORDER
184
+ );
185
+ }
186
+ if (Array.isArray(reordered.agents)) {
187
+ reordered.agents = entriesInSchemaOrder(
188
+ reordered.agents,
189
+ CANONICAL_AGENT_ENTRY_ORDER
190
+ );
191
+ }
192
+ return reordered;
193
+ }
194
+ function entriesInSchemaOrder(entries, schemaOrder) {
195
+ return entries.map(
196
+ (entry) => isKeyedRecord(entry) ? withKeysInSchemaOrder(entry, schemaOrder) : entry
197
+ );
198
+ }
146
199
  function withKeysOrderedBy(record, compareKeys) {
147
- return Object.fromEntries(Object.entries(record).sort(([a], [b]) => compareKeys(a, b)));
200
+ return Object.fromEntries(
201
+ Object.entries(record).sort(([a], [b]) => compareKeys(a, b))
202
+ );
148
203
  }
149
204
  function compareNamesInCodeUnitOrder(a, b) {
150
205
  if (a === b) return 0;
151
206
  return a < b ? -1 : 1;
152
207
  }
153
- function canonicalizeStackOrder(stack) {
154
- const byDeclaration = byCategoryDeclarationOrder();
208
+ function canonicalizeStackOrder(stack, catalog) {
209
+ const byDeclaration = byCategoryDeclarationOrder(catalog);
155
210
  const withCategoriesInOrder = Object.entries(stack).map(
156
211
  ([agent, categories]) => [agent, withKeysOrderedBy(categories, byDeclaration)]
157
212
  );
158
- return withKeysOrderedBy(Object.fromEntries(withCategoriesInOrder), compareNamesInCodeUnitOrder);
213
+ return withKeysOrderedBy(
214
+ Object.fromEntries(withCategoriesInOrder),
215
+ compareNamesInCodeUnitOrder
216
+ );
159
217
  }
160
- function renderEntryLine(entry) {
161
- return ` ${JSON.stringify(entry)},`;
218
+ var CONFIG_TYPES_SPECIFIER = "./config-types";
219
+ var STACK_TYPE = "Partial<Record<ProjectAgentName, StackAgentConfig>>";
220
+ function declarationPosition(name, type) {
221
+ return { indent: 0, prefix: `const ${name}: ${type} = `, suffix: "" };
222
+ }
223
+ function declaration(name, type, value) {
224
+ return ["", renderValueLine(value, declarationPosition(name, type))];
225
+ }
226
+ function entryDeclaration(name, type, entries) {
227
+ return ["", renderArrayLine(entries, declarationPosition(name, type))];
228
+ }
229
+ function exportFieldPosition(key) {
230
+ return {
231
+ indent: INDENT_STEP,
232
+ prefix: `${renderKey(key)}: `,
233
+ suffix: ","
234
+ };
162
235
  }
163
236
  function renderScalarField(key, value) {
164
- return ` ${JSON.stringify(key)}: ${JSON.stringify(value)},`;
237
+ return renderValueLine(value, exportFieldPosition(key));
165
238
  }
166
239
  function extractConfigArrays(cleaned) {
167
240
  return {
@@ -171,33 +244,101 @@ function extractConfigArrays(cleaned) {
171
244
  selectedDomains: cleaned.selectedDomains ?? []
172
245
  };
173
246
  }
174
- function cleanForEmission(config, options) {
247
+ function cleanForEmission(config, catalog, options) {
175
248
  const cleaned = JSON.parse(JSON.stringify(config));
176
249
  if (options.dropProjects) {
177
250
  delete cleaned.projects;
178
251
  }
179
252
  if (cleaned.stack) {
180
253
  const compacted = compactStackAssignments(
181
- cleaned.stack
254
+ cleaned.stack,
255
+ catalog
182
256
  );
183
- cleaned.stack = canonicalizeStackOrder(compacted);
257
+ cleaned.stack = canonicalizeStackOrder(compacted, catalog);
184
258
  }
185
- return canonicalizeFieldOrder(cleaned);
259
+ return canonicalizeFieldOrder(withEntriesInSchemaOrder(cleaned));
186
260
  }
187
- function generateConfigSource(config, options) {
188
- if (options?.isProjectConfig && options.globalConfig) {
261
+ function generateConfigSource(config, catalog, options) {
262
+ if (options?.isProjectConfig) {
263
+ return generateProjectConfig(config, catalog, options);
264
+ }
265
+ return generateStandaloneConfig(
266
+ cleanForEmission(config, catalog, { dropProjects: false })
267
+ );
268
+ }
269
+ function generateProjectConfig(config, catalog, options) {
270
+ const cleaned = cleanForEmission(config, catalog, { dropProjects: true });
271
+ if (options.globalConfig) {
189
272
  return generateProjectConfigWithInlinedGlobal(
190
- cleanForEmission(config, { dropProjects: true }),
191
- cleanForEmission(options.globalConfig, { dropProjects: true })
273
+ cleaned,
274
+ cleanForEmission(options.globalConfig, catalog, { dropProjects: true })
192
275
  );
193
276
  }
194
- if (options?.isProjectConfig) {
277
+ if (options.globalImportPath !== void 0) {
195
278
  return generateProjectConfigWithGlobalImport(
196
- cleanForEmission(config, { dropProjects: true }),
197
- getGlobalConfigImportPath()
279
+ cleaned,
280
+ options.globalImportPath
198
281
  );
199
282
  }
200
- return generateStandaloneConfig(cleanForEmission(config, { dropProjects: false }));
283
+ throw new Error(
284
+ "A project config needs the global config it extends: pass `globalConfig` to inline its entries, or `globalImportPath` to import and spread them. Neither was given, and the standalone writer this used to fall through to emits a global-shaped config carrying the `projects` tracking array a project root must never hold."
285
+ );
286
+ }
287
+ function generateProjectConfigWithGlobalImport(cleaned, globalImportPath) {
288
+ const importPath = `${globalImportPath}/config`;
289
+ const { skills, agents, stack, selectedDomains } = extractConfigArrays(cleaned);
290
+ const hasProjectDomains = selectedDomains.length > 0;
291
+ const hasStack = stack != null && Object.keys(stack).length > 0;
292
+ const typeImports = buildTypeImports({
293
+ // Always present, spread from global.
294
+ hasSkills: true,
295
+ hasAgents: true,
296
+ hasStack,
297
+ hasSelectedDomains: hasProjectDomains
298
+ });
299
+ const lines = [
300
+ `import globalConfig from ${quoteText(importPath)}`,
301
+ renderTypeImportLine(typeImports, CONFIG_TYPES_SPECIFIER)
302
+ ];
303
+ lines.push(
304
+ ...entryDeclaration("skills", "SkillConfig[]", [
305
+ sourceEntry("...globalConfig.skills"),
306
+ ...valueEntries(skills)
307
+ ])
308
+ );
309
+ lines.push(
310
+ ...entryDeclaration("agents", "AgentScopeConfig[]", [
311
+ sourceEntry("...globalConfig.agents"),
312
+ ...valueEntries(agents)
313
+ ])
314
+ );
315
+ if (hasStack) {
316
+ lines.push(...declaration("stack", STACK_TYPE, stack));
317
+ }
318
+ if (hasProjectDomains) {
319
+ lines.push(
320
+ ...entryDeclaration("selectedDomains", "Domain[]", [
321
+ sourceEntry("...(globalConfig.selectedDomains ?? [])"),
322
+ ...valueEntries(selectedDomains)
323
+ ])
324
+ );
325
+ }
326
+ const scalarFields = Object.entries(cleaned).filter(([key]) => !EXTRACTED_FIELDS.has(key) && key !== "name").map(([key, value]) => renderScalarField(key, value));
327
+ const exportFields = [
328
+ ` ...globalConfig,`,
329
+ renderScalarField("name", resolveProjectName(cleaned)),
330
+ ` skills,`,
331
+ ` agents,`,
332
+ ...hasStack ? [` stack,`] : [],
333
+ ...hasProjectDomains ? [` selectedDomains,`] : [],
334
+ ...scalarFields
335
+ ];
336
+ lines.push(``);
337
+ lines.push(`export default {`);
338
+ lines.push(...exportFields);
339
+ lines.push(`} satisfies ProjectConfig`);
340
+ lines.push(``);
341
+ return lines.join("\n");
201
342
  }
202
343
  function generateStandaloneConfig(cleaned) {
203
344
  const { skills, agents, stack, selectedDomains } = extractConfigArrays(cleaned);
@@ -211,28 +352,20 @@ function generateStandaloneConfig(cleaned) {
211
352
  hasStack,
212
353
  hasSelectedDomains
213
354
  });
214
- const lines = [`import type { ${typeImports} } from "./config-types";`];
355
+ const lines = [
356
+ renderTypeImportLine(typeImports, CONFIG_TYPES_SPECIFIER)
357
+ ];
215
358
  if (hasSkills) {
216
- lines.push(``);
217
- lines.push(`const skills: SkillConfig[] = [`);
218
- lines.push(skills.map(renderEntryLine).join("\n"));
219
- lines.push(`];`);
359
+ lines.push(...declaration("skills", "SkillConfig[]", skills));
220
360
  }
221
361
  if (hasAgents) {
222
- lines.push(``);
223
- lines.push(`const agents: AgentScopeConfig[] = [`);
224
- lines.push(agents.map(renderEntryLine).join("\n"));
225
- lines.push(`];`);
362
+ lines.push(...declaration("agents", "AgentScopeConfig[]", agents));
226
363
  }
227
364
  if (hasStack) {
228
- lines.push(``);
229
- const stackBody = JSON.stringify(stack, null, 2);
230
- lines.push(`const stack: Partial<Record<ProjectAgentName, StackAgentConfig>> = ${stackBody};`);
365
+ lines.push(...declaration("stack", STACK_TYPE, stack));
231
366
  }
232
367
  if (hasSelectedDomains) {
233
- lines.push(``);
234
- const items = selectedDomains.map((d) => JSON.stringify(d)).join(", ");
235
- lines.push(`const selectedDomains: Domain[] = [${items}];`);
368
+ lines.push(...declaration("selectedDomains", "Domain[]", selectedDomains));
236
369
  }
237
370
  const renderExportField = (key, value) => {
238
371
  if (!EXTRACTED_FIELDS.has(key)) return [renderScalarField(key, value)];
@@ -247,7 +380,7 @@ function generateStandaloneConfig(cleaned) {
247
380
  lines.push(``);
248
381
  lines.push(`export default {`);
249
382
  lines.push(...exportFields);
250
- lines.push(`} satisfies ProjectConfig;`);
383
+ lines.push(`} satisfies ProjectConfig`);
251
384
  lines.push(``);
252
385
  return lines.join("\n");
253
386
  }
@@ -259,66 +392,7 @@ function buildTypeImports(flags) {
259
392
  flags.hasAgents && "AgentScopeConfig",
260
393
  flags.hasSkills && "SkillConfig",
261
394
  flags.hasStack && "StackAgentConfig"
262
- ].filter((t) => Boolean(t)).join(", ");
263
- }
264
- function generateProjectConfigWithGlobalImport(cleaned, globalImportPath) {
265
- const importPath = `${globalImportPath}/config`;
266
- const { skills, agents, stack, selectedDomains } = extractConfigArrays(cleaned);
267
- const hasProjectDomains = selectedDomains.length > 0;
268
- const hasStack = stack != null && Object.keys(stack).length > 0;
269
- const typeImports = buildTypeImports({
270
- hasSkills: true,
271
- // Always present (spread from global)
272
- hasAgents: true,
273
- // Always present (spread from global)
274
- hasStack,
275
- hasSelectedDomains: hasProjectDomains
276
- });
277
- const lines = [
278
- `import globalConfig from "${importPath}";`,
279
- `import type { ${typeImports} } from "./config-types";`
280
- ];
281
- lines.push(``);
282
- const skillItems = skills.map(renderEntryLine).join("\n");
283
- lines.push(`const skills: SkillConfig[] = [`);
284
- lines.push(` ...globalConfig.skills,`);
285
- if (skillItems) lines.push(skillItems);
286
- lines.push(`];`);
287
- lines.push(``);
288
- const agentItems = agents.map(renderEntryLine).join("\n");
289
- lines.push(`const agents: AgentScopeConfig[] = [`);
290
- lines.push(` ...globalConfig.agents,`);
291
- if (agentItems) lines.push(agentItems);
292
- lines.push(`];`);
293
- if (hasStack) {
294
- lines.push(``);
295
- const stackBody = JSON.stringify(stack, null, 2);
296
- lines.push(`const stack: Partial<Record<ProjectAgentName, StackAgentConfig>> = ${stackBody};`);
297
- }
298
- if (hasProjectDomains) {
299
- lines.push(``);
300
- const domainItems = selectedDomains.map(renderEntryLine).join("\n");
301
- lines.push(`const selectedDomains: Domain[] = [`);
302
- lines.push(` ...(globalConfig.selectedDomains ?? []),`);
303
- if (domainItems) lines.push(domainItems);
304
- lines.push(`];`);
305
- }
306
- const scalarFields = Object.entries(cleaned).filter(([key]) => !EXTRACTED_FIELDS.has(key) && key !== "name").map(([key, value]) => renderScalarField(key, value)).join("\n");
307
- const exportFields = [
308
- ` ...globalConfig,`,
309
- ` name: ${JSON.stringify(resolveProjectName(cleaned))},`,
310
- ` skills,`,
311
- ` agents,`,
312
- ...hasStack ? [` stack,`] : [],
313
- ...hasProjectDomains ? [` selectedDomains,`] : [],
314
- ...scalarFields ? [scalarFields] : []
315
- ];
316
- lines.push(``);
317
- lines.push(`export default {`);
318
- lines.push(...exportFields);
319
- lines.push(`} satisfies ProjectConfig;`);
320
- lines.push(``);
321
- return lines.join("\n");
395
+ ].filter((t) => Boolean(t));
322
396
  }
323
397
  function resolveProjectName(cleaned) {
324
398
  return cleaned.name && cleaned.name !== GLOBAL_CONFIG_NAME ? cleaned.name : DEFAULT_PLUGIN_NAME;
@@ -345,7 +419,9 @@ function partitionInlinedConfigEntries(cleaned, cleanedGlobal) {
345
419
  ];
346
420
  const projectAgentNames = new Set(projectAgents.map(nameOf));
347
421
  const filteredStack = project.stack ? Object.fromEntries(
348
- Object.entries(project.stack).filter(([agent]) => projectAgentNames.has(agent))
422
+ Object.entries(project.stack).filter(
423
+ ([agent]) => projectAgentNames.has(agent)
424
+ )
349
425
  ) : void 0;
350
426
  return {
351
427
  globalSkills,
@@ -353,17 +429,25 @@ function partitionInlinedConfigEntries(cleaned, cleanedGlobal) {
353
429
  projectSkills,
354
430
  projectAgents,
355
431
  filteredStack,
356
- selectedDomains: [.../* @__PURE__ */ new Set([...global.selectedDomains, ...project.selectedDomains])]
432
+ selectedDomains: [
433
+ .../* @__PURE__ */ new Set([...global.selectedDomains, ...project.selectedDomains])
434
+ ]
357
435
  };
358
436
  }
359
437
  function mergeInlinedScalarFields(cleaned, cleanedGlobal) {
360
- return Object.entries(canonicalizeFieldOrder({ ...cleanedGlobal, ...cleaned })).filter(
361
- ([key]) => !EXTRACTED_FIELDS.has(key) && key !== "name"
362
- );
438
+ return Object.entries(
439
+ canonicalizeFieldOrder({ ...cleanedGlobal, ...cleaned })
440
+ ).filter(([key]) => !EXTRACTED_FIELDS.has(key) && key !== "name");
363
441
  }
364
442
  function generateProjectConfigWithInlinedGlobal(cleaned, cleanedGlobal) {
365
443
  const partition = partitionInlinedConfigEntries(cleaned, cleanedGlobal);
366
- const { globalSkills, globalAgents, projectSkills, projectAgents, filteredStack } = partition;
444
+ const {
445
+ globalSkills,
446
+ globalAgents,
447
+ projectSkills,
448
+ projectAgents,
449
+ filteredStack
450
+ } = partition;
367
451
  const hasGlobalSkills = globalSkills.length > 0;
368
452
  const hasProjectSkills = projectSkills.length > 0;
369
453
  const hasSkills = hasGlobalSkills || hasProjectSkills;
@@ -378,38 +462,38 @@ function generateProjectConfigWithInlinedGlobal(cleaned, cleanedGlobal) {
378
462
  hasStack,
379
463
  hasSelectedDomains
380
464
  });
381
- const lines = [`import type { ${typeImports} } from "./config-types";`];
465
+ const lines = [
466
+ renderTypeImportLine(typeImports, CONFIG_TYPES_SPECIFIER)
467
+ ];
382
468
  if (hasSkills) {
383
- lines.push(``);
384
- lines.push(`const skills: SkillConfig[] = [`);
385
469
  lines.push(
386
- ...hasGlobalSkills ? [` // global`, ...globalSkills.map(renderEntryLine)] : [],
387
- ...hasProjectSkills ? [` // project`, ...projectSkills.map(renderEntryLine)] : []
470
+ ...entryDeclaration(
471
+ "skills",
472
+ "SkillConfig[]",
473
+ scopeSectionEntries(globalSkills, projectSkills)
474
+ )
388
475
  );
389
- lines.push(`];`);
390
476
  }
391
477
  if (hasAgents) {
392
- lines.push(``);
393
- lines.push(`const agents: AgentScopeConfig[] = [`);
394
478
  lines.push(
395
- ...hasGlobalAgents ? [` // global`, ...globalAgents.map(renderEntryLine)] : [],
396
- ...hasProjectAgents ? [` // project`, ...projectAgents.map(renderEntryLine)] : []
479
+ ...entryDeclaration(
480
+ "agents",
481
+ "AgentScopeConfig[]",
482
+ scopeSectionEntries(globalAgents, projectAgents)
483
+ )
397
484
  );
398
- lines.push(`];`);
399
485
  }
400
486
  if (hasStack) {
401
- lines.push(``);
402
- const stackBody = JSON.stringify(filteredStack, null, 2);
403
- lines.push(`const stack: Partial<Record<ProjectAgentName, StackAgentConfig>> = ${stackBody};`);
487
+ lines.push(...declaration("stack", STACK_TYPE, filteredStack));
404
488
  }
405
489
  if (hasSelectedDomains) {
406
- lines.push(``);
407
- const items = partition.selectedDomains.map((d) => JSON.stringify(d)).join(", ");
408
- lines.push(`const selectedDomains: Domain[] = [${items}];`);
490
+ lines.push(
491
+ ...declaration("selectedDomains", "Domain[]", partition.selectedDomains)
492
+ );
409
493
  }
410
494
  const scalarFields = mergeInlinedScalarFields(cleaned, cleanedGlobal);
411
495
  const exportFields = [
412
- ` name: ${JSON.stringify(resolveProjectName(cleaned))},`,
496
+ renderScalarField("name", resolveProjectName(cleaned)),
413
497
  ...scalarFields.map(([key, value]) => renderScalarField(key, value)),
414
498
  hasSkills ? ` skills,` : ` skills: [],`,
415
499
  hasAgents ? ` agents,` : ` agents: [],`,
@@ -419,23 +503,31 @@ function generateProjectConfigWithInlinedGlobal(cleaned, cleanedGlobal) {
419
503
  lines.push(``);
420
504
  lines.push(`export default {`);
421
505
  lines.push(...exportFields);
422
- lines.push(`} satisfies ProjectConfig;`);
506
+ lines.push(`} satisfies ProjectConfig`);
423
507
  lines.push(``);
424
508
  return lines.join("\n");
425
509
  }
510
+ function scopeSectionEntries(global, project) {
511
+ return [
512
+ ...global.length > 0 ? [commentEntry("global"), ...valueEntries(global)] : [],
513
+ ...project.length > 0 ? [commentEntry("project"), ...valueEntries(project)] : []
514
+ ];
515
+ }
426
516
  function carriesFlags(assignment) {
427
517
  return Boolean(assignment.preloaded || assignment.local || assignment.path);
428
518
  }
429
- function compactAssignment(assignment) {
430
- if (isSkillAssignment(assignment) && !carriesFlags(assignment)) return assignment.id;
431
- return assignment;
519
+ function isSkillAssignment(value) {
520
+ if (typeof value !== "object" || value === null) return false;
521
+ return typeof value.id === "string";
432
522
  }
433
- function isExclusiveCategory(category) {
434
- return matrix.categories[category]?.exclusive === true;
523
+ function compactAssignment(assignment) {
524
+ if (!isSkillAssignment(assignment)) return assignment;
525
+ if (!carriesFlags(assignment)) return assignment.id;
526
+ return withKeysInSchemaOrder(assignment, CANONICAL_ASSIGNMENT_ORDER);
435
527
  }
436
- function compactCategoryAssignments(category, assignments) {
528
+ function compactCategoryAssignments(category, assignments, catalog) {
437
529
  const compacted = assignments.map(compactAssignment);
438
- if (!isExclusiveCategory(category)) return compacted;
530
+ if (!isExclusiveCategory(catalog, category)) return compacted;
439
531
  if (compacted.length > 1) {
440
532
  throw new Error(
441
533
  `Category '${category}' is exclusive but holds ${compacted.length} skills: ${JSON.stringify(compacted)}`
@@ -443,48 +535,38 @@ function compactCategoryAssignments(category, assignments) {
443
535
  }
444
536
  return compacted[0];
445
537
  }
446
- function compactCategories(categories) {
538
+ function compactCategories(categories, catalog) {
447
539
  return Object.fromEntries(
448
- Object.entries(categories).filter(([, assignments]) => Array.isArray(assignments) && assignments.length > 0).map(([category, assignments]) => [
540
+ Object.entries(categories).filter(
541
+ ([, assignments]) => Array.isArray(assignments) && assignments.length > 0
542
+ ).map(([category, assignments]) => [
449
543
  category,
450
- compactCategoryAssignments(category, assignments)
544
+ compactCategoryAssignments(category, assignments, catalog)
451
545
  ])
452
546
  );
453
547
  }
454
- function compactStackAssignments(stack) {
548
+ function compactStackAssignments(stack, catalog) {
455
549
  return Object.fromEntries(
456
- Object.entries(stack).map(([agent, categories]) => [agent, compactCategories(categories)]).filter(([, categories]) => Object.keys(categories).length > 0)
550
+ Object.entries(stack).map(
551
+ ([agent, categories]) => [agent, compactCategories(categories, catalog)]
552
+ ).filter(([, categories]) => Object.keys(categories).length > 0)
457
553
  );
458
554
  }
459
- function getGlobalConfigImportPath() {
460
- return path.join(os.homedir(), CLAUDE_SRC_DIR);
461
- }
462
555
  function generateBlankGlobalConfigSource() {
463
- return `import type { ProjectConfig } from "./config-types";
556
+ return `import type { ProjectConfig } from ${quoteText(CONFIG_TYPES_SPECIFIER)}
464
557
 
465
558
  export default {
466
- "name": "${GLOBAL_CONFIG_NAME}",
467
- "skills": [],
468
- "agents": [],
469
- "selectedDomains": []
470
- } satisfies ProjectConfig;
559
+ name: ${quoteText(GLOBAL_CONFIG_NAME)},
560
+ skills: [],
561
+ agents: [],
562
+ selectedDomains: [],
563
+ } satisfies ProjectConfig
471
564
  `;
472
565
  }
473
- function generateBlankGlobalConfigTypesSource() {
474
- return assembleConfigTypesSource({
475
- skillId: "never",
476
- agentName: "never",
477
- selectedAgentName: "never",
478
- projectAgentName: "SelectedAgentName",
479
- domain: "never",
480
- category: "never",
481
- stackAgentConfig: STACK_AGENT_CONFIG_LOOSE_LINE
482
- });
483
- }
484
566
 
485
567
  // src/cli/lib/config-gate/propagate.ts
486
568
  async function writeConfigFile(config, configPath, options) {
487
- const source = generateConfigSource(config, options);
569
+ const source = generateConfigSource(config, matrix, options);
488
570
  await writeFile(configPath, source);
489
571
  }
490
572
  function additiveMergeStack(existing, incoming) {
@@ -820,8 +902,8 @@ function buildProjectTypesExtras(finalConfig, matrix2) {
820
902
  }
821
903
 
822
904
  // src/cli/lib/config-gate/index.ts
823
- import os3 from "os";
824
- import path3 from "path";
905
+ import os2 from "os";
906
+ import path2 from "path";
825
907
 
826
908
  // src/cli/lib/config-gate/classify.ts
827
909
  import { isDeepEqual as isDeepEqual2 } from "remeda";
@@ -940,17 +1022,17 @@ async function resolveGateDeps(deps, tier) {
940
1022
  var NO_AGENTS = Promise.resolve({});
941
1023
 
942
1024
  // src/cli/lib/config-gate/pair-writer.ts
943
- import os2 from "os";
944
- import path2 from "path";
1025
+ import os from "os";
1026
+ import path from "path";
945
1027
  function globalPairPaths() {
946
- const dir = path2.join(os2.homedir(), CLAUDE_SRC_DIR);
1028
+ const dir = path.join(os.homedir(), CLAUDE_SRC_DIR);
947
1029
  return {
948
- configPath: path2.join(dir, STANDARD_FILES.CONFIG_TS),
949
- typesPath: path2.join(dir, STANDARD_FILES.CONFIG_TYPES_TS)
1030
+ configPath: path.join(dir, STANDARD_FILES.CONFIG_TS),
1031
+ typesPath: path.join(dir, STANDARD_FILES.CONFIG_TYPES_TS)
950
1032
  };
951
1033
  }
952
1034
  function typesPathFor(configPath) {
953
- return path2.join(path2.dirname(configPath), STANDARD_FILES.CONFIG_TYPES_TS);
1035
+ return path.join(path.dirname(configPath), STANDARD_FILES.CONFIG_TYPES_TS);
954
1036
  }
955
1037
  async function writeIfChanged(filePath, source) {
956
1038
  assertGateToken(filePath);
@@ -969,7 +1051,7 @@ function renderStandaloneTypes(config, matrix2, agents, extras) {
969
1051
  );
970
1052
  }
971
1053
  async function writeGlobalConfigHalf(config, configPath) {
972
- return writeIfChanged(configPath, generateConfigSource(config));
1054
+ return writeIfChanged(configPath, generateConfigSource(config, matrix));
973
1055
  }
974
1056
  async function writeGlobalTypesHalf(config, configPath, matrix2, agents, extras) {
975
1057
  return writeIfChanged(
@@ -978,7 +1060,7 @@ async function writeGlobalTypesHalf(config, configPath, matrix2, agents, extras)
978
1060
  );
979
1061
  }
980
1062
  async function writeGlobalPair(config, configPath, matrix2, agents) {
981
- const configWritten = await writeIfChanged(configPath, generateConfigSource(config));
1063
+ const configWritten = await writeIfChanged(configPath, generateConfigSource(config, matrix2));
982
1064
  const typesWritten = await writeIfChanged(
983
1065
  typesPathFor(configPath),
984
1066
  renderStandaloneTypes(config, matrix2, agents)
@@ -991,10 +1073,10 @@ async function ensureBlankPair() {
991
1073
  verbose("Global config already exists, skipping blank creation");
992
1074
  return false;
993
1075
  }
994
- await ensureDir(path2.dirname(configPath));
1076
+ await ensureDir(path.dirname(configPath));
995
1077
  await writeIfChanged(configPath, generateBlankGlobalConfigSource());
996
1078
  await writeIfChanged(typesPath, generateBlankGlobalConfigTypesSource());
997
- verbose(`Created blank global config at ${path2.dirname(configPath)}`);
1079
+ verbose(`Created blank global config at ${path.dirname(configPath)}`);
998
1080
  return true;
999
1081
  }
1000
1082
 
@@ -1007,7 +1089,7 @@ var NOTHING_RECOMPILED = {
1007
1089
  };
1008
1090
  async function recompilePropagated(projectDirs) {
1009
1091
  if (projectDirs.length === 0) return NOTHING_RECOMPILED;
1010
- const { recompilePropagatedProjectAgents: recompilePropagatedProjectAgents2 } = await import("./recompile-project-agents-QIAMBCM4.js");
1092
+ const { recompilePropagatedProjectAgents: recompilePropagatedProjectAgents2 } = await import("./recompile-project-agents-GQLODH24.js");
1011
1093
  return recompilePropagatedProjectAgents2(projectDirs);
1012
1094
  }
1013
1095
 
@@ -1037,7 +1119,7 @@ async function applyConsequences(globalConfig, changes, deps, currentProjectDir)
1037
1119
  function lazyGateDeps(projectDir) {
1038
1120
  return {
1039
1121
  loadMatrix: async () => {
1040
- const { loadSkillsMatrixFromSource: loadSkillsMatrixFromSource2 } = await import("./source-loader-CC6ZWKTI.js");
1122
+ const { loadSkillsMatrixFromSource: loadSkillsMatrixFromSource2 } = await import("./source-loader-TSF5VS6V.js");
1041
1123
  const { matrix: matrix2 } = await loadSkillsMatrixFromSource2({
1042
1124
  projectDir,
1043
1125
  skipExtraSources: true,
@@ -1046,7 +1128,7 @@ function lazyGateDeps(projectDir) {
1046
1128
  return matrix2;
1047
1129
  },
1048
1130
  loadAgents: async () => {
1049
- const { loadAgentDefs: loadAgentDefs2 } = await import("./load-agent-defs-2H42B2OO.js");
1131
+ const { loadAgentDefs: loadAgentDefs2 } = await import("./load-agent-defs-LDSND43G.js");
1050
1132
  return (await loadAgentDefs2()).agents;
1051
1133
  }
1052
1134
  };
@@ -1054,7 +1136,7 @@ function lazyGateDeps(projectDir) {
1054
1136
  async function writeScopedFromWizard(args) {
1055
1137
  return withGateToken(async () => {
1056
1138
  const { finalConfig, matrix: matrix2, agents, projectDir, projectConfigPath } = args;
1057
- const homeDir = os3.homedir();
1139
+ const homeDir = os2.homedir();
1058
1140
  const deps = { matrix: matrix2, agents };
1059
1141
  if (!isHomeDirectory(projectDir)) {
1060
1142
  return writeFromProjectContext(args, homeDir, deps);
@@ -1081,7 +1163,7 @@ async function writeFromProjectContext(args, homeDir, deps) {
1081
1163
  const changes = classifyGlobalChange(existingGlobal?.config, effectiveGlobalConfig);
1082
1164
  let globalWritten = false;
1083
1165
  if (effective.changed) {
1084
- await ensureDir(path3.dirname(globalConfigPath));
1166
+ await ensureDir(path2.dirname(globalConfigPath));
1085
1167
  globalWritten = await writeGlobalPair(effectiveGlobalConfig, globalConfigPath, matrix2, agents);
1086
1168
  verbose(`Updated global config at ${globalConfigPath}`);
1087
1169
  } else {
@@ -1100,7 +1182,7 @@ async function writeFromProjectContext(args, homeDir, deps) {
1100
1182
  );
1101
1183
  const hasProjectItems = reconciledProjectConfig.skills.length > 0 || reconciledProjectConfig.agents.length > 0;
1102
1184
  if (args.projectInstallationExists || hasProjectItems) {
1103
- await ensureDir(path3.dirname(projectConfigPath));
1185
+ await ensureDir(path2.dirname(projectConfigPath));
1104
1186
  await writeProjectConfigPair(
1105
1187
  projectDir,
1106
1188
  reconciledProjectConfig,
@@ -1202,7 +1284,7 @@ function fallbackNameFor(mutation) {
1202
1284
  }
1203
1285
  async function mutateGlobal(mutation, deps) {
1204
1286
  return withGateToken(async () => {
1205
- const homeDir = os3.homedir();
1287
+ const homeDir = os2.homedir();
1206
1288
  const loadedGlobal = await loadProjectConfigFromDir(homeDir);
1207
1289
  if (!loadedGlobal) return report(false, NO_CHANGES);
1208
1290
  const current = loadedGlobal.config;
@@ -1247,19 +1329,22 @@ async function writeProjectPartial(projectDir, partial, options = {}) {
1247
1329
  throw new GlobalPairWriteViolation(getProjectConfigPath(projectDir));
1248
1330
  }
1249
1331
  const configPath = getProjectConfigPath(projectDir);
1250
- await ensureDir(path3.join(projectDir, CLAUDE_SRC_DIR));
1332
+ await ensureDir(path2.join(projectDir, CLAUDE_SRC_DIR));
1251
1333
  await writeFile(
1252
1334
  configPath,
1253
- generateConfigSource(fillRequiredFields(withNormalizedStack(partial), options.fallbackName))
1335
+ generateConfigSource(
1336
+ fillRequiredFields(withNormalizedStack(partial), options.fallbackName),
1337
+ matrix
1338
+ )
1254
1339
  );
1255
1340
  }
1256
1341
 
1257
1342
  // src/cli/lib/operations/project/write-project-config.ts
1258
- import path4 from "path";
1343
+ import path3 from "path";
1259
1344
  async function writeProjectConfig(options) {
1260
1345
  const { wizardResult, sourceResult, projectDir, sourceFlag } = options;
1261
1346
  const projectPaths = resolveInstallPaths(projectDir, "project");
1262
- await ensureDir(path4.dirname(projectPaths.configPath));
1347
+ await ensureDir(path3.dirname(projectPaths.configPath));
1263
1348
  const { agents } = options.agentDefs ?? await loadAgentDefs();
1264
1349
  const mergeResult = await buildAndMergeConfig(
1265
1350
  wizardResult,
@@ -1300,7 +1385,7 @@ async function writeProjectConfig(options) {
1300
1385
  }
1301
1386
 
1302
1387
  // src/cli/lib/operations/project/compile-agents-all-scopes.ts
1303
- import os4 from "os";
1388
+ import os3 from "os";
1304
1389
  async function compileAgentsAllScopes(options) {
1305
1390
  const { projectDir, sourcePath, skills, agentScopeMap } = options;
1306
1391
  const base = { sourcePath, skills, agentScopeMap };
@@ -1313,8 +1398,8 @@ async function compileAgentsAllScopes(options) {
1313
1398
  }
1314
1399
  const globalResult = await compileAgents({
1315
1400
  ...base,
1316
- projectDir: os4.homedir(),
1317
- outputDir: resolveInstallPaths(os4.homedir(), "global").agentsDir,
1401
+ projectDir: os3.homedir(),
1402
+ outputDir: resolveInstallPaths(os3.homedir(), "global").agentsDir,
1318
1403
  scopeFilter: "global"
1319
1404
  });
1320
1405
  const projectResult = await compileAgents({
@@ -1349,4 +1434,4 @@ export {
1349
1434
  writeProjectConfig,
1350
1435
  compileAgentsAllScopes
1351
1436
  };
1352
- //# sourceMappingURL=chunk-YAHTF4NO.js.map
1437
+ //# sourceMappingURL=chunk-MED6GNV3.js.map