agents-inc 0.176.0 → 0.177.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (104) hide show
  1. package/CHANGELOG.md +65 -0
  2. package/README.md +2 -2
  3. package/dist/{chunk-FACDJH6O.js → chunk-2FE4AJNC.js} +20 -26
  4. package/dist/chunk-2FE4AJNC.js.map +1 -0
  5. package/dist/{chunk-U46LYYRA.js → chunk-4SIBDIIO.js} +49 -13
  6. package/dist/chunk-4SIBDIIO.js.map +1 -0
  7. package/dist/chunk-5ZK4IND4.js +30 -0
  8. package/dist/chunk-5ZK4IND4.js.map +1 -0
  9. package/dist/{chunk-MQZNDK5F.js → chunk-77SHXTDD.js} +137 -56
  10. package/dist/chunk-77SHXTDD.js.map +1 -0
  11. package/dist/{chunk-U672FZVC.js → chunk-7OJ2SS4E.js} +10 -86
  12. package/dist/chunk-7OJ2SS4E.js.map +1 -0
  13. package/dist/{chunk-C2BSCEDN.js → chunk-7WN6TUZP.js} +7 -8
  14. package/dist/chunk-7WN6TUZP.js.map +1 -0
  15. package/dist/chunk-AVKX3IXF.js +117 -0
  16. package/dist/chunk-AVKX3IXF.js.map +1 -0
  17. package/dist/{chunk-ENET4IF6.js → chunk-D2PC7NIR.js} +1653 -1734
  18. package/dist/chunk-D2PC7NIR.js.map +1 -0
  19. package/dist/{chunk-JTMSFBCA.js → chunk-E6W3PYGF.js} +823 -72
  20. package/dist/chunk-E6W3PYGF.js.map +1 -0
  21. package/dist/chunk-H33ZAEKH.js +147 -0
  22. package/dist/chunk-H33ZAEKH.js.map +1 -0
  23. package/dist/{chunk-B7AVWSK2.js → chunk-JEFVFZAR.js} +39 -151
  24. package/dist/chunk-JEFVFZAR.js.map +1 -0
  25. package/dist/{chunk-UE4Z3YMB.js → chunk-KKGJH46C.js} +3 -21
  26. package/dist/chunk-KKGJH46C.js.map +1 -0
  27. package/dist/chunk-OIQKRXHH.js +142 -0
  28. package/dist/chunk-OIQKRXHH.js.map +1 -0
  29. package/dist/{chunk-CKBWEWHZ.js → chunk-TNN72UL6.js} +264 -247
  30. package/dist/chunk-TNN72UL6.js.map +1 -0
  31. package/dist/{chunk-XMQIWPIR.js → chunk-V3WJMNBF.js} +45 -18
  32. package/dist/chunk-V3WJMNBF.js.map +1 -0
  33. package/dist/chunk-VFD2XYM7.js +14 -0
  34. package/dist/chunk-VFD2XYM7.js.map +1 -0
  35. package/dist/{chunk-XYBHH3M5.js → chunk-WH7JXGDA.js} +2 -2
  36. package/dist/{chunk-JNRACLNS.js → chunk-XSR4WRXJ.js} +3 -3
  37. package/dist/{chunk-3F5LT433.js → chunk-Y5VMB73R.js} +202 -116
  38. package/dist/chunk-Y5VMB73R.js.map +1 -0
  39. package/dist/chunk-ZIBWVTLN.js +18 -0
  40. package/dist/chunk-ZIBWVTLN.js.map +1 -0
  41. package/dist/commands/build/marketplace.js +6 -10
  42. package/dist/commands/build/marketplace.js.map +1 -1
  43. package/dist/commands/build/plugins.js +10 -39
  44. package/dist/commands/build/plugins.js.map +1 -1
  45. package/dist/commands/compile.js +60 -81
  46. package/dist/commands/compile.js.map +1 -1
  47. package/dist/commands/doctor.js +234 -145
  48. package/dist/commands/doctor.js.map +1 -1
  49. package/dist/commands/edit.js +64 -159
  50. package/dist/commands/edit.js.map +1 -1
  51. package/dist/commands/eject.js +64 -54
  52. package/dist/commands/eject.js.map +1 -1
  53. package/dist/commands/init.js +19 -17
  54. package/dist/commands/list.js +10 -12
  55. package/dist/commands/list.js.map +1 -1
  56. package/dist/commands/new/marketplace.js +5 -5
  57. package/dist/commands/search.js +14 -13
  58. package/dist/commands/search.js.map +1 -1
  59. package/dist/commands/share.js +21 -44
  60. package/dist/commands/share.js.map +1 -1
  61. package/dist/commands/uninstall.js +139 -56
  62. package/dist/commands/uninstall.js.map +1 -1
  63. package/dist/commands/update.js +22 -37
  64. package/dist/commands/update.js.map +1 -1
  65. package/dist/components/common/header-row.js +9 -0
  66. package/dist/components/common/select-list.js +2 -2
  67. package/dist/components/common/skill-agent-summary.js +4 -4
  68. package/dist/components/common/summary-panel.js +6 -5
  69. package/dist/hooks/init.js +35 -22
  70. package/dist/hooks/init.js.map +1 -1
  71. package/dist/load-agent-defs-OCFWOZD2.js +14 -0
  72. package/dist/{recompile-project-agents-U3UGHPWG.js → recompile-project-agents-CXZBPIUS.js} +9 -9
  73. package/dist/{recompile-project-agents-U3UGHPWG.js.map → recompile-project-agents-CXZBPIUS.js.map} +1 -1
  74. package/dist/{source-loader-E2Y5MMN5.js → source-loader-GGDQDMN4.js} +6 -4
  75. package/dist/source-loader-GGDQDMN4.js.map +1 -0
  76. package/package.json +1 -1
  77. package/src/schemas/stacks.schema.json +105 -1
  78. package/dist/chunk-3F5LT433.js.map +0 -1
  79. package/dist/chunk-5CFHP6Z5.js +0 -109
  80. package/dist/chunk-5CFHP6Z5.js.map +0 -1
  81. package/dist/chunk-B7AVWSK2.js.map +0 -1
  82. package/dist/chunk-C2BSCEDN.js.map +0 -1
  83. package/dist/chunk-CKBWEWHZ.js.map +0 -1
  84. package/dist/chunk-EC3JXT23.js +0 -160
  85. package/dist/chunk-EC3JXT23.js.map +0 -1
  86. package/dist/chunk-ENET4IF6.js.map +0 -1
  87. package/dist/chunk-FACDJH6O.js.map +0 -1
  88. package/dist/chunk-H6WUOW5F.js +0 -35
  89. package/dist/chunk-H6WUOW5F.js.map +0 -1
  90. package/dist/chunk-JTMSFBCA.js.map +0 -1
  91. package/dist/chunk-MQZNDK5F.js.map +0 -1
  92. package/dist/chunk-SN64WNWE.js +0 -428
  93. package/dist/chunk-SN64WNWE.js.map +0 -1
  94. package/dist/chunk-U46LYYRA.js.map +0 -1
  95. package/dist/chunk-U672FZVC.js.map +0 -1
  96. package/dist/chunk-UE4Z3YMB.js.map +0 -1
  97. package/dist/chunk-XMQIWPIR.js.map +0 -1
  98. package/dist/chunk-ZBI6GFJD.js +0 -39
  99. package/dist/chunk-ZBI6GFJD.js.map +0 -1
  100. package/dist/load-agent-defs-5BSECHE6.js +0 -14
  101. /package/dist/{chunk-XYBHH3M5.js.map → chunk-WH7JXGDA.js.map} +0 -0
  102. /package/dist/{chunk-JNRACLNS.js.map → chunk-XSR4WRXJ.js.map} +0 -0
  103. /package/dist/{load-agent-defs-5BSECHE6.js.map → components/common/header-row.js.map} +0 -0
  104. /package/dist/{source-loader-E2Y5MMN5.js.map → load-agent-defs-OCFWOZD2.js.map} +0 -0
@@ -0,0 +1,30 @@
1
+ #!/usr/bin/env node
2
+ import {
3
+ directoryExists,
4
+ verbose
5
+ } from "./chunk-D2PC7NIR.js";
6
+ import {
7
+ DIRS,
8
+ PROJECT_ROOT
9
+ } from "./chunk-4SIBDIIO.js";
10
+
11
+ // src/cli/lib/agents/agent-fetcher.ts
12
+ import path from "path";
13
+ async function getLocalAgentDefinitions() {
14
+ const agentsDir = path.join(PROJECT_ROOT, DIRS.agents);
15
+ if (!await directoryExists(agentsDir)) {
16
+ throw new Error(
17
+ `Agent partials not found at '${agentsDir}'. Ensure the CLI is properly installed.`
18
+ );
19
+ }
20
+ verbose(`Agent partials loaded from CLI: ${agentsDir}`);
21
+ return {
22
+ agentsDir,
23
+ sourcePath: PROJECT_ROOT
24
+ };
25
+ }
26
+
27
+ export {
28
+ getLocalAgentDefinitions
29
+ };
30
+ //# sourceMappingURL=chunk-5ZK4IND4.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../src/cli/lib/agents/agent-fetcher.ts"],"sourcesContent":["import path from \"path\";\nimport { directoryExists } from \"../../utils/fs\";\nimport { verbose } from \"../../utils/logger\";\nimport { PROJECT_ROOT, DIRS } from \"../../consts\";\nimport type { AgentSourcePaths } from \"../../types\";\n\nexport async function getLocalAgentDefinitions(): Promise<AgentSourcePaths> {\n const agentsDir = path.join(PROJECT_ROOT, DIRS.agents);\n\n if (!(await directoryExists(agentsDir))) {\n throw new Error(\n `Agent partials not found at '${agentsDir}'. Ensure the CLI is properly installed.`,\n );\n }\n\n verbose(`Agent partials loaded from CLI: ${agentsDir}`);\n\n return {\n agentsDir,\n sourcePath: PROJECT_ROOT,\n };\n}\n"],"mappings":";;;;;;;;;;;AAAA,OAAO,UAAU;AAMjB,eAAsB,2BAAsD;AAC1E,QAAM,YAAY,KAAK,KAAK,cAAc,KAAK,MAAM;AAErD,MAAI,CAAE,MAAM,gBAAgB,SAAS,GAAI;AACvC,UAAM,IAAI;AAAA,MACR,gCAAgC,SAAS;AAAA,IAC3C;AAAA,EACF;AAEA,UAAQ,mCAAmC,SAAS,EAAE;AAEtD,SAAO;AAAA,IACL;AAAA,IACA,YAAY;AAAA,EACd;AACF;","names":[]}
@@ -25,25 +25,25 @@ import {
25
25
  renderAgent,
26
26
  renderAgentBody,
27
27
  renderAgentRoleToml,
28
- resolveAgents,
29
28
  sourceFolderInUse,
30
29
  sourceFolderName,
31
30
  verbose,
32
31
  writeFile
33
- } from "./chunk-ENET4IF6.js";
32
+ } from "./chunk-D2PC7NIR.js";
34
33
  import {
35
- typedEntries,
36
- typedFromEntries,
37
- typedKeys
38
- } from "./chunk-UE4Z3YMB.js";
34
+ plural
35
+ } from "./chunk-KKGJH46C.js";
39
36
  import {
40
37
  CLAUDE_DIR,
41
38
  DIRS,
42
39
  PROJECT_ROOT,
43
40
  STANDARD_DIRS,
44
41
  STANDARD_FILES,
45
- effectivelyExcludedSkillIds
46
- } from "./chunk-U46LYYRA.js";
42
+ effectivelyExcludedSkillIds,
43
+ typedEntries,
44
+ typedFromEntries,
45
+ typedKeys
46
+ } from "./chunk-4SIBDIIO.js";
47
47
 
48
48
  // src/cli/lib/agents/list-compiled-agents.ts
49
49
  import path from "path";
@@ -116,24 +116,25 @@ async function readOwnVersion() {
116
116
 
117
117
  // src/cli/lib/compiler.ts
118
118
  async function readAgentFiles(name, agent, projectRoot) {
119
+ const { agentDir, categoryDir } = agentSourceDirs(name, agent, projectRoot);
120
+ const [identity, playbook, criticalRequirementsTop, criticalReminders, output] = await Promise.all([
121
+ readFile(path3.join(agentDir, STANDARD_FILES.IDENTITY_MD)),
122
+ readFile(path3.join(agentDir, STANDARD_FILES.PLAYBOOK_MD)),
123
+ readFileOptional(path3.join(agentDir, STANDARD_FILES.CRITICAL_REQUIREMENTS_MD), ""),
124
+ readFileOptional(path3.join(agentDir, STANDARD_FILES.CRITICAL_REMINDERS_MD), ""),
125
+ readOutputPartial(agentDir, categoryDir)
126
+ ]);
127
+ return { identity, playbook, output, criticalRequirementsTop, criticalReminders };
128
+ }
129
+ function agentSourceDirs(name, agent, projectRoot) {
119
130
  const agentSourceRoot = agent.sourceRoot || projectRoot;
120
131
  const agentBaseDir = agent.agentBaseDir || DIRS.agents;
121
132
  const agentPath = agent.path || name;
122
- const agentDir = path3.join(agentSourceRoot, agentBaseDir, agentPath);
123
- const identity = await readFile(path3.join(agentDir, STANDARD_FILES.IDENTITY_MD));
124
- const playbook = await readFile(path3.join(agentDir, STANDARD_FILES.PLAYBOOK_MD));
125
- const criticalRequirementsTop = await readFileOptional(
126
- path3.join(agentDir, STANDARD_FILES.CRITICAL_REQUIREMENTS_MD),
127
- ""
128
- );
129
- const criticalReminders = await readFileOptional(
130
- path3.join(agentDir, STANDARD_FILES.CRITICAL_REMINDERS_MD),
131
- ""
132
- );
133
133
  const category = agentPath.split("/")[0] || name;
134
- const categoryDir = path3.join(agentSourceRoot, agentBaseDir, category);
135
- const output = await readOutputPartial(agentDir, categoryDir);
136
- return { identity, playbook, output, criticalRequirementsTop, criticalReminders };
134
+ return {
135
+ agentDir: path3.join(agentSourceRoot, agentBaseDir, agentPath),
136
+ categoryDir: path3.join(agentSourceRoot, agentBaseDir, category)
137
+ };
137
138
  }
138
139
  async function readOutputPartial(agentDir, categoryDir) {
139
140
  const own = await readFileOptional(path3.join(agentDir, STANDARD_FILES.OUTPUT_MD), "");
@@ -141,40 +142,43 @@ async function readOutputPartial(agentDir, categoryDir) {
141
142
  return readFileOptional(path3.join(categoryDir, STANDARD_FILES.OUTPUT_MD), "");
142
143
  }
143
144
  async function createLiquidEngine(projectDir, provider = providerInUse(projectDir)) {
144
- const roots = [];
145
- if (projectDir) {
146
- const srcTemplatesDir = path3.join(
147
- sourceFolderInUse(projectDir, provider).dir,
148
- STANDARD_DIRS.AGENTS,
149
- path3.basename(DIRS.templates)
150
- );
151
- if (await directoryExists(srcTemplatesDir)) {
152
- roots.push(srcTemplatesDir);
153
- verbose(`Using local templates from: ${srcTemplatesDir}`);
154
- }
155
- const legacyTemplatesDir = path3.join(projectDir, CLAUDE_DIR, STANDARD_DIRS.TEMPLATES);
156
- if (await directoryExists(legacyTemplatesDir)) {
157
- roots.push(legacyTemplatesDir);
158
- verbose(`Using legacy templates from: ${legacyTemplatesDir}`);
159
- }
160
- }
161
- roots.push(path3.join(PROJECT_ROOT, DIRS.templates));
145
+ const overrideRoots = projectDir ? await templateOverrideRoots(projectDir, provider) : [];
162
146
  return new Liquid({
163
- root: roots,
147
+ root: [...overrideRoots, path3.join(PROJECT_ROOT, DIRS.templates)],
164
148
  extname: ".liquid",
165
149
  strictVariables: false,
166
150
  strictFilters: true,
167
151
  globals: { sourceFolder: sourceFolderName(projectDir, provider) }
168
152
  });
169
153
  }
154
+ async function templateOverrideRoots(projectDir, provider) {
155
+ const sourceTemplatesDir = path3.join(
156
+ sourceFolderInUse(projectDir, provider).dir,
157
+ STANDARD_DIRS.AGENTS,
158
+ path3.basename(DIRS.templates)
159
+ );
160
+ const legacyTemplatesDir = path3.join(projectDir, CLAUDE_DIR, STANDARD_DIRS.TEMPLATES);
161
+ const [hasSourceTemplates, hasLegacyTemplates] = await Promise.all([
162
+ directoryExists(sourceTemplatesDir),
163
+ directoryExists(legacyTemplatesDir)
164
+ ]);
165
+ if (hasSourceTemplates) verbose(`Using local templates from: ${sourceTemplatesDir}`);
166
+ if (hasLegacyTemplates) verbose(`Using legacy templates from: ${legacyTemplatesDir}`);
167
+ return [
168
+ ...hasSourceTemplates ? [sourceTemplatesDir] : [],
169
+ ...hasLegacyTemplates ? [legacyTemplatesDir] : []
170
+ ];
171
+ }
170
172
  async function compileAgentForHost(provider, name, agent, fallbackRoot, engine) {
171
173
  verbose(`Compiling agent: ${name} (${provider})`);
172
- const files = await readAgentFiles(name, agent, fallbackRoot);
174
+ const [files, version] = await Promise.all([
175
+ readAgentFiles(name, agent, fallbackRoot),
176
+ cliVersion()
177
+ ]);
173
178
  const data = buildAgentTemplateContext(name, agent, files, (skill) => ({
174
179
  ...skill,
175
180
  ...pluginRefFor(skill)
176
181
  }));
177
- const version = await cliVersion();
178
182
  switch (provider) {
179
183
  case "claude":
180
184
  return renderAgent(engine, data, version);
@@ -188,8 +192,9 @@ async function compileAgentForHost(provider, name, agent, fallbackRoot, engine)
188
192
  }
189
193
 
190
194
  // src/cli/lib/agents/write-compiled-agents.ts
191
- async function holdsExactly(filePath, content) {
192
- return await fileExists(filePath) && await readFile(filePath) === content;
195
+ async function changeTo(filePath, content) {
196
+ if (!await fileExists(filePath)) return "created";
197
+ return await readFile(filePath) === content ? "unchanged" : "rewritten";
193
198
  }
194
199
  var UNROUTED_AGENT_SCOPE = "project";
195
200
  async function writeCompiledAgentsByScope(params) {
@@ -219,9 +224,9 @@ async function writeOneAgent(params) {
219
224
  params.engine
220
225
  );
221
226
  const targetPath = path4.join(host.agentsDir, fileNameFor(name, host.provider));
222
- const rewritten = !await holdsExactly(targetPath, output);
223
- if (rewritten) await writeFile(targetPath, output);
224
- return { name, ok: true, scope, targetDir: host.agentsDir, rewritten };
227
+ const file = await changeTo(targetPath, output);
228
+ if (file !== "unchanged") await writeFile(targetPath, output);
229
+ return { name, ok: true, scope, targetDir: host.agentsDir, file };
225
230
  } catch (error) {
226
231
  return { name, ok: false, error };
227
232
  }
@@ -232,9 +237,78 @@ function fileNameFor(name, provider) {
232
237
 
233
238
  // src/cli/lib/agents/agent-recompiler.ts
234
239
  import path5 from "path";
235
- async function getExistingAgentNames(pluginDir) {
236
- return listCompiledAgentNames(getPluginAgentsDir(pluginDir));
240
+
241
+ // src/cli/lib/resolver.ts
242
+ function resolveSkillReference(ref, skills) {
243
+ const definition = skills[ref.id];
244
+ if (!definition) {
245
+ verbose(`Skill '${ref.id}' not found in available skills, skipping`);
246
+ return null;
247
+ }
248
+ return {
249
+ ...definition,
250
+ usage: ref.usage,
251
+ preloaded: ref.preloaded ?? false,
252
+ ...ref.source !== void 0 && { source: ref.source }
253
+ };
254
+ }
255
+ function resolveSkillReferences(skillRefs, skills) {
256
+ return skillRefs.map((ref) => resolveSkillReference(ref, skills)).filter((skill) => skill !== null);
257
+ }
258
+ async function resolveAgents(agents, skills, compileConfig) {
259
+ const entries = typedEntries(compileConfig.agents).map(
260
+ ([agentName, agentConfig]) => [agentName, resolveAgent(agentName, agentConfig, agents, skills)]
261
+ );
262
+ return typedFromEntries(entries);
263
+ }
264
+ function resolveAgent(agentName, agentConfig, agents, skills) {
265
+ const definition = agents[agentName];
266
+ if (!definition) throw new Error(agentNotFoundError(agentName, agents));
267
+ const resolvedSkills = resolveSkillReferences(agentConfig.skills ?? [], skills);
268
+ return assembleAgentConfig(agentName, definition, agentConfig, resolvedSkills);
237
269
  }
270
+ var MAX_LISTED_AVAILABLE_AGENTS = 5;
271
+ function agentNotFoundError(agentName, agents) {
272
+ const availableAgents = describeAvailableAgents(typedKeys(agents));
273
+ return `Agent '${agentName}' referenced in compile config but not found in scanned agents. ${availableAgents}. Check that src/agents/${agentName}/metadata.yaml exists.`;
274
+ }
275
+ function describeAvailableAgents(availableAgents) {
276
+ if (availableAgents.length === 0) return "No agents found in scanned directories";
277
+ const listed = availableAgents.slice(0, MAX_LISTED_AVAILABLE_AGENTS).join(", ");
278
+ const unlisted = availableAgents.length - MAX_LISTED_AVAILABLE_AGENTS;
279
+ return unlisted > 0 ? `Available agents: ${listed} (and ${unlisted} more)` : `Available agents: ${listed}`;
280
+ }
281
+ function assembleAgentConfig(agentName, definition, agentConfig, resolvedSkills) {
282
+ const model = agentConfig.model ?? definition.model;
283
+ const effort = agentConfig.effort ?? definition.effort;
284
+ return {
285
+ name: agentName,
286
+ title: definition.title,
287
+ description: definition.description,
288
+ ...model !== void 0 && { model },
289
+ ...agentConfig.codexModel !== void 0 && { codexModel: agentConfig.codexModel },
290
+ ...effort !== void 0 && { effort },
291
+ tools: definition.tools,
292
+ // Spread conditionally: the template branches on presence, and `undefined` renders a key.
293
+ ...definition.disallowedTools !== void 0 && {
294
+ disallowedTools: definition.disallowedTools
295
+ },
296
+ ...definition.permissionMode !== void 0 && {
297
+ permissionMode: definition.permissionMode
298
+ },
299
+ ...definition.isolation !== void 0 && { isolation: definition.isolation },
300
+ ...definition.hooks !== void 0 && { hooks: definition.hooks },
301
+ ...definition.experimental !== void 0 && {
302
+ experimental: definition.experimental
303
+ },
304
+ skills: resolvedSkills,
305
+ ...definition.path !== void 0 && { path: definition.path },
306
+ ...definition.sourceRoot !== void 0 && { sourceRoot: definition.sourceRoot },
307
+ ...definition.agentBaseDir !== void 0 && { agentBaseDir: definition.agentBaseDir }
308
+ };
309
+ }
310
+
311
+ // src/cli/lib/agents/agent-recompiler.ts
238
312
  async function resolveAgentNames(params) {
239
313
  const { specifiedAgents, projectConfig, allAgents, outputDir, pluginDir } = params;
240
314
  if (specifiedAgents) {
@@ -250,8 +324,13 @@ async function resolveAgentNames(params) {
250
324
  verbose(`Using all available agents from source: ${names.join(", ")}`);
251
325
  return names;
252
326
  }
253
- return getExistingAgentNames(pluginDir);
327
+ return listCompiledAgentNames(getPluginAgentsDir(pluginDir));
254
328
  }
329
+ var FILE_CHANGE_VERB = {
330
+ created: "Created",
331
+ rewritten: "Rewrote",
332
+ unchanged: "Unchanged"
333
+ };
255
334
  function buildRecompileResult(outcomes, priorWarnings) {
256
335
  const [succeeded, failedOutcomes] = partition2(
257
336
  outcomes,
@@ -259,12 +338,14 @@ function buildRecompileResult(outcomes, priorWarnings) {
259
338
  );
260
339
  succeeded.forEach(
261
340
  (outcome) => verbose(
262
- ` ${outcome.rewritten ? "Rewrote" : "Unchanged"}: ${outcome.name} (${outcome.scope} -> ${outcome.targetDir})`
341
+ ` ${FILE_CHANGE_VERB[outcome.file]}: ${outcome.name} (${outcome.scope} -> ${outcome.targetDir})`
263
342
  )
264
343
  );
344
+ const namesWhoseFile = (file) => succeeded.filter((outcome) => outcome.file === file).map((outcome) => outcome.name);
265
345
  return {
266
346
  compiled: succeeded.map((outcome) => outcome.name),
267
- rewritten: succeeded.filter((outcome) => outcome.rewritten).map((outcome) => outcome.name),
347
+ rewritten: namesWhoseFile("rewritten"),
348
+ created: namesWhoseFile("created"),
268
349
  failed: failedOutcomes.map((outcome) => outcome.name),
269
350
  warnings: [
270
351
  ...priorWarnings,
@@ -308,9 +389,9 @@ async function recompileAgents(options) {
308
389
  pluginDir
309
390
  });
310
391
  if (agentNames.length === 0) {
311
- return { compiled: [], rewritten: [], failed: [], warnings: [] };
392
+ return { compiled: [], rewritten: [], created: [], failed: [], warnings: [] };
312
393
  }
313
- verbose(`Recompiling ${agentNames.length} agents in ${outputDir ?? pluginDir}`);
394
+ verbose(`Recompiling ${plural(agentNames.length, "agent")} in ${outputDir ?? pluginDir}`);
314
395
  const pluginSkills = providedSkills ?? await discoverAllPluginSkills(configDir, provider);
315
396
  const { configAgents, missingWarnings } = compileEntriesFor(
316
397
  agentNames,
@@ -373,4 +454,4 @@ export {
373
454
  withoutExcludedAssignments,
374
455
  recompileAgents
375
456
  };
376
- //# sourceMappingURL=chunk-MQZNDK5F.js.map
457
+ //# sourceMappingURL=chunk-77SHXTDD.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../src/cli/lib/agents/list-compiled-agents.ts","../src/cli/lib/agents/agent-recompiler.ts","../src/cli/lib/agents/write-compiled-agents.ts","../src/cli/lib/compiler.ts","../src/cli/lib/agents/agent-provenance.ts","../src/cli/lib/resolver.ts"],"sourcesContent":["import path from \"path\";\nimport { partition } from \"remeda\";\nimport { glob, readFileOptional, remove } from \"../../utils/fs\";\nimport { isAgentName } from \"../../utils/type-guards\";\nimport { type AgentCodec, agentCodec } from \"../installation/install-layout\";\nimport type { AgentName } from \"../../types\";\n\n/**\n * The default codec; a caller on another host passes that host's\n * (`agentCodec(providerInUse(dir))`).\n */\nconst CLAUDE_AGENTS = agentCodec(\"claude\");\n\ntype AgentProvenanceSplit = {\n marked: string[];\n unmarked: string[];\n};\n\nexport async function listAgentMdFiles(agentsDir: string): Promise<string[]> {\n return listAgentFilesOf(agentsDir, CLAUDE_AGENTS);\n}\n\nexport async function listAgentFilesOf(agentsDir: string, codec: AgentCodec): Promise<string[]> {\n return glob(codec.listGlob, agentsDir);\n}\n\n/** An unreadable file lands in `unmarked`: \"cannot prove it is ours\" means leave it alone. */\nexport async function splitAgentsByProvenance(\n agentsDir: string,\n codec: AgentCodec = CLAUDE_AGENTS,\n): Promise<AgentProvenanceSplit> {\n const files = await listAgentFilesOf(agentsDir, codec);\n const classified = await Promise.all(\n files.map((file) => readAgentProvenance(agentsDir, file, codec)),\n );\n const [marked, unmarked] = partition(classified, (agent) => agent.compiledHere);\n\n return {\n marked: marked.map((agent) => agent.name),\n unmarked: unmarked.map((agent) => agent.name),\n };\n}\n\ntype ClassifiedAgent = { name: string; compiledHere: boolean };\n\nasync function readAgentProvenance(\n agentsDir: string,\n file: string,\n codec: AgentCodec,\n): Promise<ClassifiedAgent> {\n const content = await readFileOptional(path.join(agentsDir, file));\n return { name: path.basename(file, codec.extension), compiledHere: codec.hasMarker(content) };\n}\n\nexport async function listCompiledAgentNames(agentsDir: string): Promise<AgentName[]> {\n const files = await listAgentMdFiles(agentsDir);\n // Boundary cast: custom marketplace agents may fall outside the AgentName union.\n return files.map((f) => path.basename(f, CLAUDE_AGENTS.extension) as AgentName);\n}\n\n/**\n * Deletes built-in-named agent files not in `keep`, which must be the complete set for `agentsDir`.\n */\nexport async function pruneStaleCompiledAgents(\n agentsDir: string,\n keep: ReadonlySet<AgentName>,\n codec: AgentCodec = CLAUDE_AGENTS,\n): Promise<void> {\n const isStaleCompiledAgent = (file: string): boolean => {\n const name = path.basename(file, codec.extension);\n return isAgentName(name) && !keep.has(name);\n };\n\n const files = await listAgentFilesOf(agentsDir, codec);\n await Promise.all(\n files.filter(isStaleCompiledAgent).map((file) => remove(path.join(agentsDir, file))),\n );\n}\n","import { partition } from \"remeda\";\nimport { writeCompiledAgentsByScope, type AgentWriteOutcome } from \"./write-compiled-agents\";\nimport { listCompiledAgentNames } from \"./list-compiled-agents\";\nimport path from \"path\";\n\nimport { getErrorMessage } from \"../../utils/errors\";\nimport type {\n AgentDefinition,\n AgentName,\n CompileAgentConfig,\n CompileConfig,\n ProjectConfig,\n SkillDefinitionMap,\n SkillId,\n SkillScope,\n} from \"../../types\";\n\nimport { buildCompileAgents } from \"../installation/local-installer\";\nimport { ensureDir } from \"../../utils/fs\";\nimport { verbose } from \"../../utils/logger\";\nimport { plural } from \"../../utils/string\";\nimport { typedEntries, typedFromEntries, typedKeys } from \"../../utils/typed-object\";\nimport { createLiquidEngine } from \"../compiler\";\nimport { loadProjectConfig, effectivelyExcludedSkillIds } from \"../configuration\";\nimport { loadAllAgents, loadProjectAgents } from \"../loading\";\nimport { getPluginAgentsDir } from \"../plugins\";\nimport { discoverAllPluginSkills } from \"../plugins/plugin-discovery\";\nimport { resolveAgents } from \"../resolver\";\nimport { providerInUse } from \"../installation/install-layout\";\nimport type { Provider } from \"../../consts\";\n\nexport type RecompileAgentsOptions = {\n pluginDir: string;\n sourcePath: string;\n agents?: AgentName[];\n skills?: SkillDefinitionMap;\n projectDir?: string;\n /** The installation recompiled, where its directory holds two; the default is the one in use. */\n provider?: Provider;\n outputDir?: string;\n /**\n * When provided, routes agents by scope: global ones to the agents folder of the global\n * installation inherited, project ones to `outputDir`.\n */\n agentScopeMap?: Map<AgentName, SkillScope>;\n};\n\nexport type RecompileAgentsResult = {\n compiled: AgentName[];\n /** The subset of `compiled` whose file was there and moved. */\n rewritten: AgentName[];\n /** The subset whose file was not there; the rest of `compiled` is unchanged. */\n created: AgentName[];\n failed: AgentName[];\n warnings: string[];\n};\n\ntype ResolveAgentNamesParams = {\n specifiedAgents?: AgentName[];\n projectConfig: ProjectConfig | null;\n allAgents: Partial<Record<AgentName, AgentDefinition>>;\n outputDir?: string;\n pluginDir: string;\n};\n\nasync function resolveAgentNames(params: ResolveAgentNamesParams): Promise<AgentName[]> {\n const { specifiedAgents, projectConfig, allAgents, outputDir, pluginDir } = params;\n\n if (specifiedAgents) {\n return specifiedAgents;\n }\n\n // A present config is authoritative even when its roster is empty.\n if (projectConfig) {\n const agentNames = projectConfig.agents.map((a) => a.name);\n verbose(`Using agents from config: ${agentNames.join(\", \")}`);\n return agentNames;\n }\n\n if (outputDir) {\n const names = typedKeys<AgentName>(allAgents);\n verbose(`Using all available agents from source: ${names.join(\", \")}`);\n return names;\n }\n\n return listCompiledAgentNames(getPluginAgentsDir(pluginDir));\n}\n\ntype SucceededOutcome = Extract<AgentWriteOutcome, { ok: true }>;\n\nconst FILE_CHANGE_VERB: Record<SucceededOutcome[\"file\"], string> = {\n created: \"Created\",\n rewritten: \"Rewrote\",\n unchanged: \"Unchanged\",\n};\n\nfunction buildRecompileResult(\n outcomes: AgentWriteOutcome[],\n priorWarnings: string[],\n): RecompileAgentsResult {\n const [succeeded, failedOutcomes] = partition(\n outcomes,\n (outcome): outcome is SucceededOutcome => outcome.ok,\n );\n succeeded.forEach((outcome) =>\n verbose(\n ` ${FILE_CHANGE_VERB[outcome.file]}: ${outcome.name} (${outcome.scope} -> ${outcome.targetDir})`,\n ),\n );\n const namesWhoseFile = (file: SucceededOutcome[\"file\"]) =>\n succeeded.filter((outcome) => outcome.file === file).map((outcome) => outcome.name);\n return {\n compiled: succeeded.map((outcome) => outcome.name),\n rewritten: namesWhoseFile(\"rewritten\"),\n created: namesWhoseFile(\"created\"),\n failed: failedOutcomes.map((outcome) => outcome.name),\n warnings: [\n ...priorWarnings,\n ...failedOutcomes.map(\n (outcome) => `Failed to compile ${outcome.name}: ${getErrorMessage(outcome.error)}`,\n ),\n ],\n };\n}\n\nexport function filterExcludedEntries(config: ProjectConfig): ProjectConfig {\n const excludedIds = effectivelyExcludedSkillIds(config.skills);\n const activeSkills = config.skills.filter((s) => !s.excluded);\n const activeAgents = config.agents.filter((a) => !a.excluded);\n\n // No stack stays absent rather than an explicit `undefined`.\n const filteredStack =\n config.stack === undefined\n ? {}\n : { stack: withoutExcludedAssignments(config.stack, excludedIds) };\n\n return { ...config, skills: activeSkills, agents: activeAgents, ...filteredStack };\n}\n\n/** Each agent and category keeps its key, even when left with no assignments. */\nexport function withoutExcludedAssignments(\n stack: NonNullable<ProjectConfig[\"stack\"]>,\n excludedIds: ReadonlySet<SkillId>,\n): NonNullable<ProjectConfig[\"stack\"]> {\n return Object.fromEntries(\n typedEntries(stack).map(([agentName, agentStack]) => [\n agentName,\n Object.fromEntries(\n typedEntries(agentStack).map(([category, assignments]) => [\n category,\n assignments.filter((assignment) => !excludedIds.has(assignment.id)),\n ]),\n ),\n ]),\n );\n}\n\nexport async function recompileAgents(\n options: RecompileAgentsOptions,\n): Promise<RecompileAgentsResult> {\n const { pluginDir, sourcePath, skills: providedSkills, projectDir, outputDir } = options;\n\n const configDir = projectDir ?? pluginDir;\n const provider = options.provider ?? providerInUse(configDir);\n const filteredConfig = await loadConfigWithoutExclusions(configDir, provider);\n const allAgents = await loadAgentDefinitions(sourcePath, projectDir, provider);\n\n const agentNames = await resolveAgentNames({\n ...(options.agents !== undefined && { specifiedAgents: options.agents }),\n projectConfig: filteredConfig,\n allAgents,\n ...(outputDir !== undefined && { outputDir }),\n pluginDir,\n });\n\n // An empty pass is not a warning: callers report it off `compiled`.\n if (agentNames.length === 0) {\n return { compiled: [], rewritten: [], created: [], failed: [], warnings: [] };\n }\n\n verbose(`Recompiling ${plural(agentNames.length, \"agent\")} in ${outputDir ?? pluginDir}`);\n\n const pluginSkills: SkillDefinitionMap =\n providedSkills ?? (await discoverAllPluginSkills(configDir, provider));\n\n const { configAgents, missingWarnings } = compileEntriesFor(\n agentNames,\n filteredConfig,\n allAgents,\n );\n const compileConfig = compileConfigFor(filteredConfig, configAgents, pluginDir);\n\n const engine = await createLiquidEngine(projectDir, provider);\n const resolvedAgents = await resolveAgents(allAgents, pluginSkills, compileConfig);\n\n const agentsDir = outputDir ?? getPluginAgentsDir(pluginDir);\n await ensureDir(agentsDir);\n\n const outcomes = await writeCompiledAgentsByScope({\n resolvedAgents,\n sourcePath,\n engine,\n projectAgentsDir: agentsDir,\n // The config's own installation, so format and configuration agree.\n projectDir: configDir,\n provider,\n ...(options.agentScopeMap !== undefined && { agentScopeMap: options.agentScopeMap }),\n });\n return buildRecompileResult(outcomes, missingWarnings);\n}\n\nasync function loadConfigWithoutExclusions(\n configDir: string,\n provider: Provider,\n): Promise<ProjectConfig | null> {\n const loaded = await loadProjectConfig(configDir, provider);\n return loaded ? filterExcludedEntries(loaded.config) : null;\n}\n\n/** A project agent wins over a built-in one of the same name. */\nasync function loadAgentDefinitions(\n sourcePath: string,\n projectDir: string | undefined,\n provider: Provider,\n): Promise<Partial<Record<AgentName, AgentDefinition>>> {\n const builtinAgents = await loadAllAgents(sourcePath);\n const projectAgents = projectDir ? await loadProjectAgents(projectDir, provider) : {};\n\n return { ...builtinAgents, ...projectAgents };\n}\n\nfunction compileConfigFor(\n config: ProjectConfig | null,\n agents: Partial<Record<AgentName, CompileAgentConfig>>,\n pluginDir: string,\n): CompileConfig {\n return {\n name: config?.name || path.basename(pluginDir),\n description: config?.description || \"Recompiled plugin\",\n agents,\n };\n}\n\n/** Only agents the scope filter matches: a project pass must not overwrite stackless globals. */\nfunction compileEntriesFor(\n agentNames: AgentName[],\n config: ProjectConfig | null,\n allAgents: Partial<Record<AgentName, AgentDefinition>>,\n): { configAgents: Partial<Record<AgentName, CompileAgentConfig>>; missingWarnings: string[] } {\n const allConfigAgents = config ? buildCompileAgents(config, allAgents) : {};\n\n const [knownAgents, missingAgents] = partition(agentNames, (name) =>\n Boolean(allConfigAgents[name] || allAgents[name]),\n );\n\n return {\n configAgents: typedFromEntries<AgentName, CompileAgentConfig>(\n knownAgents.map((name) => [name, allConfigAgents[name] ?? {}]),\n ),\n missingWarnings: missingAgents.map((name) => `Agent \"${name}\" not found in source definitions`),\n };\n}\n","import path from \"path\";\nimport type { Liquid } from \"liquidjs\";\nimport { compileAgentForHost } from \"../compiler.js\";\nimport {\n agentCodec,\n agentsDir,\n hostCompilesAgent,\n inheritedGlobalProvider,\n providerInUse,\n} from \"../installation/install-layout.js\";\nimport { writeFile, fileExists, readFile } from \"../../utils/fs.js\";\nimport { typedEntries } from \"../../utils/typed-object.js\";\nimport type { Provider } from \"../../consts.js\";\nimport type { AgentConfig, AgentName, SkillScope } from \"../../types/index.js\";\n\nexport type AgentWriteOutcome =\n | {\n name: AgentName;\n ok: true;\n scope: SkillScope;\n targetDir: string;\n file: CompiledFileChange;\n }\n | { name: AgentName; ok: false; error: unknown };\n\n/** \"unchanged\" writes nothing: the kept mtime is the only trace telling it from \"rewritten\". */\ntype CompiledFileChange = \"created\" | \"rewritten\" | \"unchanged\";\n\nasync function changeTo(filePath: string, content: string): Promise<CompiledFileChange> {\n if (!(await fileExists(filePath))) return \"created\";\n return (await readFile(filePath)) === content ? \"unchanged\" : \"rewritten\";\n}\n\n/**\n * Routing for an agent the scope map does not name: the caller's `projectAgentsDir`. Deliberately\n * not the selection default, which would move unrouted agents into `~/.claude/agents`.\n */\nconst UNROUTED_AGENT_SCOPE: SkillScope = \"project\";\n\n/**\n * Per-agent failures come back as outcomes; a directory appears only when an agent routes into it.\n */\nexport async function writeCompiledAgentsByScope(params: {\n resolvedAgents: Partial<Record<AgentName, AgentConfig>>;\n sourcePath: string;\n engine: Liquid;\n projectAgentsDir: string;\n /** The root whose folder says which host the PROJECT scope's sub-agents are written for. */\n projectDir: string;\n /** The installation at `projectDir`, where it holds two; the default is the one in use. */\n provider?: Provider;\n agentScopeMap?: Map<AgentName, SkillScope>;\n}): Promise<AgentWriteOutcome[]> {\n const own = params.provider ?? providerInUse(params.projectDir);\n const inherited = inheritedGlobalProvider(params.projectDir, own);\n const hosts: Record<SkillScope, AgentHost> = {\n global: { provider: inherited, agentsDir: agentsDir(inherited, \"global\", params.projectDir) },\n project: { provider: own, agentsDir: params.projectAgentsDir },\n };\n\n const outcomes: AgentWriteOutcome[] = [];\n for (const [name, agent] of typedEntries<AgentName, AgentConfig>(params.resolvedAgents)) {\n const scope = params.agentScopeMap?.get(name) ?? UNROUTED_AGENT_SCOPE;\n const host = hosts[scope];\n\n // No outcome for a sub-agent this host does not carry: it was neither compiled nor failed.\n if (!hostCompilesAgent(host.provider, name)) continue;\n\n outcomes.push(await writeOneAgent({ ...params, name, agent, scope, host }));\n }\n return outcomes;\n}\n\n/** Returns the failure rather than throwing: the policy is the caller's. */\nasync function writeOneAgent(params: {\n name: AgentName;\n agent: AgentConfig;\n scope: SkillScope;\n host: AgentHost;\n sourcePath: string;\n engine: Liquid;\n}): Promise<AgentWriteOutcome> {\n const { name, scope, host } = params;\n\n try {\n const output = await compileAgentForHost(\n host.provider,\n name,\n params.agent,\n params.sourcePath,\n params.engine,\n );\n const targetPath = path.join(host.agentsDir, fileNameFor(name, host.provider));\n const file = await changeTo(targetPath, output);\n if (file !== \"unchanged\") await writeFile(targetPath, output);\n\n return { name, ok: true, scope, targetDir: host.agentsDir, file };\n } catch (error) {\n return { name, ok: false, error };\n }\n}\n\ntype AgentHost = { provider: Provider; agentsDir: string };\n\n/** The extension comes from `agentCodec`, so a `.md` never lands where Codex reads `.toml`. */\nfunction fileNameFor(name: AgentName, provider: Provider): string {\n return `${name}${agentCodec(provider).extension}`;\n}\n","import { Liquid } from \"liquidjs\";\nimport path from \"path\";\nimport {\n buildAgentTemplateContext,\n pluginRefFor,\n renderAgent,\n renderAgentBody,\n renderAgentRoleToml,\n type AgentFiles,\n} from \"@workspace/compile/agent-source\";\nimport { readFile, readFileOptional, directoryExists } from \"../utils/fs\";\nimport { verbose } from \"../utils/logger\";\nimport {\n CLAUDE_DIR,\n DIRS,\n PROJECT_ROOT,\n STANDARD_FILES,\n STANDARD_DIRS,\n type Provider,\n} from \"../consts\";\nimport { providerInUse, sourceFolderInUse, sourceFolderName } from \"./installation/install-layout\";\nimport { cliVersion } from \"./agents/agent-provenance\";\nimport \"./compile-seat.js\";\nimport type { AgentConfig, AgentName } from \"../types\";\n\nexport {\n buildAgentTemplateContext,\n sanitizeCompiledAgentData,\n sanitizeLiquidSyntax,\n} from \"@workspace/compile/agent-source\";\n\nasync function readAgentFiles(\n name: AgentName,\n agent: AgentConfig,\n projectRoot: string,\n): Promise<AgentFiles> {\n const { agentDir, categoryDir } = agentSourceDirs(name, agent, projectRoot);\n\n const [identity, playbook, criticalRequirementsTop, criticalReminders, output] =\n await Promise.all([\n readFile(path.join(agentDir, STANDARD_FILES.IDENTITY_MD)),\n readFile(path.join(agentDir, STANDARD_FILES.PLAYBOOK_MD)),\n readFileOptional(path.join(agentDir, STANDARD_FILES.CRITICAL_REQUIREMENTS_MD), \"\"),\n readFileOptional(path.join(agentDir, STANDARD_FILES.CRITICAL_REMINDERS_MD), \"\"),\n readOutputPartial(agentDir, categoryDir),\n ]);\n\n return { identity, playbook, output, criticalRequirementsTop, criticalReminders };\n}\n\nfunction agentSourceDirs(\n name: AgentName,\n agent: AgentConfig,\n projectRoot: string,\n): { agentDir: string; categoryDir: string } {\n const agentSourceRoot = agent.sourceRoot || projectRoot;\n const agentBaseDir = agent.agentBaseDir || DIRS.agents;\n const agentPath = agent.path || name;\n const category = agentPath.split(\"/\")[0] || name;\n\n return {\n agentDir: path.join(agentSourceRoot, agentBaseDir, agentPath),\n categoryDir: path.join(agentSourceRoot, agentBaseDir, category),\n };\n}\n\n/** The agent's own `output.md`, or its category's where the agent's is absent or empty. */\nasync function readOutputPartial(agentDir: string, categoryDir: string): Promise<string> {\n const own = await readFileOptional(path.join(agentDir, STANDARD_FILES.OUTPUT_MD), \"\");\n if (own) return own;\n return readFileOptional(path.join(categoryDir, STANDARD_FILES.OUTPUT_MD), \"\");\n}\n\n/**\n * Template roots, first match wins: the project source folder's `agents/_templates/`, legacy\n * `.claude/templates/`, then the built-ins. The options mirror `createEngineFromTemplates` in\n * `@workspace/compile/engine`; keep the two in sync.\n */\nexport async function createLiquidEngine(\n projectDir?: string,\n // One read for both: template overrides and source folder must name one installation.\n provider: Provider = providerInUse(projectDir),\n): Promise<Liquid> {\n const overrideRoots = projectDir ? await templateOverrideRoots(projectDir, provider) : [];\n\n return new Liquid({\n root: [...overrideRoots, path.join(PROJECT_ROOT, DIRS.templates)],\n extname: \".liquid\",\n strictVariables: false,\n strictFilters: true,\n globals: { sourceFolder: sourceFolderName(projectDir, provider) },\n });\n}\n\nasync function templateOverrideRoots(projectDir: string, provider: Provider): Promise<string[]> {\n const sourceTemplatesDir = path.join(\n sourceFolderInUse(projectDir, provider).dir,\n STANDARD_DIRS.AGENTS,\n path.basename(DIRS.templates),\n );\n const legacyTemplatesDir = path.join(projectDir, CLAUDE_DIR, STANDARD_DIRS.TEMPLATES);\n const [hasSourceTemplates, hasLegacyTemplates] = await Promise.all([\n directoryExists(sourceTemplatesDir),\n directoryExists(legacyTemplatesDir),\n ]);\n\n if (hasSourceTemplates) verbose(`Using local templates from: ${sourceTemplatesDir}`);\n if (hasLegacyTemplates) verbose(`Using legacy templates from: ${legacyTemplatesDir}`);\n return [\n ...(hasSourceTemplates ? [sourceTemplatesDir] : []),\n ...(hasLegacyTemplates ? [legacyTemplatesDir] : []),\n ];\n}\n\n/** Both hosts render from one template context; only the wrapper differs (markdown or TOML). */\nexport async function compileAgentForHost(\n provider: Provider,\n name: AgentName,\n agent: AgentConfig,\n fallbackRoot: string,\n engine: Liquid,\n): Promise<string> {\n verbose(`Compiling agent: ${name} (${provider})`);\n\n const [files, version] = await Promise.all([\n readAgentFiles(name, agent, fallbackRoot),\n cliVersion(),\n ]);\n\n // Each skill's own `source` decides `${id}:${id}` versus a bare id; no `source` means bare.\n const data = buildAgentTemplateContext(name, agent, files, (skill) => ({\n ...skill,\n ...pluginRefFor(skill),\n }));\n\n switch (provider) {\n case \"claude\":\n return renderAgent(engine, data, version);\n case \"codex\":\n return renderAgentRoleToml(agent, await renderAgentBody(engine, data, version));\n default: {\n const _exhaustive: never = provider;\n return _exhaustive;\n }\n }\n}\n","import path from \"path\";\nimport { z } from \"zod\";\n\nimport { PROJECT_ROOT, STANDARD_FILES } from \"../../consts\";\nimport { readFile } from \"../../utils/fs\";\n\nconst ownPackageJsonSchema = z.object({ version: z.string().min(1) });\n\nexport {\n hasProvenanceMarker,\n provenanceMarker,\n stampProvenanceMarker,\n} from \"@workspace/compile/agent-source\";\n\nlet ownVersion: Promise<string> | undefined;\n\n/**\n * Rendered in the trailing `<system-reminder>`, not the provenance marker, so a version bump leaves\n * the first cacheable bytes of every compiled agent unchanged.\n */\nexport function cliVersion(): Promise<string> {\n ownVersion ??= readOwnVersion();\n return ownVersion;\n}\n\nasync function readOwnVersion(): Promise<string> {\n const manifestPath = path.join(PROJECT_ROOT, STANDARD_FILES.PACKAGE_JSON);\n const raw: unknown = JSON.parse(await readFile(manifestPath));\n\n const parsed = ownPackageJsonSchema.safeParse(raw);\n if (!parsed.success) {\n throw new Error(`Could not read this CLI's own version from ${manifestPath}`);\n }\n return parsed.data.version;\n}\n","import type {\n AgentConfig,\n AgentDefinition,\n AgentName,\n CompileAgentConfig,\n CompileConfig,\n Skill,\n SkillDefinitionMap,\n SkillReference,\n} from \"../types\";\nimport { verbose } from \"../utils/logger\";\nimport { typedEntries, typedFromEntries, typedKeys } from \"../utils/typed-object\";\n\nfunction resolveSkillReference(ref: SkillReference, skills: SkillDefinitionMap): Skill | null {\n const definition = skills[ref.id];\n if (!definition) {\n verbose(`Skill '${ref.id}' not found in available skills, skipping`);\n return null;\n }\n return {\n ...definition,\n usage: ref.usage,\n preloaded: ref.preloaded ?? false,\n ...(ref.source !== undefined && { source: ref.source }),\n };\n}\n\nfunction resolveSkillReferences(skillRefs: SkillReference[], skills: SkillDefinitionMap): Skill[] {\n return skillRefs\n .map((ref) => resolveSkillReference(ref, skills))\n .filter((skill): skill is Skill => skill !== null);\n}\n\n/** Throws when the compile config names an agent no scanned directory defines. */\n// eslint-disable-next-line @typescript-eslint/require-await -- callers await it\nexport async function resolveAgents(\n agents: Partial<Record<AgentName, AgentDefinition>>,\n skills: SkillDefinitionMap,\n compileConfig: CompileConfig,\n): Promise<Partial<Record<AgentName, AgentConfig>>> {\n const entries = typedEntries<AgentName, CompileAgentConfig>(compileConfig.agents).map(\n ([agentName, agentConfig]) =>\n [agentName, resolveAgent(agentName, agentConfig, agents, skills)] as const,\n );\n\n return typedFromEntries(entries);\n}\n\nfunction resolveAgent(\n agentName: AgentName,\n agentConfig: CompileAgentConfig,\n agents: Partial<Record<AgentName, AgentDefinition>>,\n skills: SkillDefinitionMap,\n): AgentConfig {\n const definition = agents[agentName];\n if (!definition) throw new Error(agentNotFoundError(agentName, agents));\n\n // `buildCompileAgents` has already expanded the stack into `skills`.\n const resolvedSkills = resolveSkillReferences(agentConfig.skills ?? [], skills);\n return assembleAgentConfig(agentName, definition, agentConfig, resolvedSkills);\n}\n\nconst MAX_LISTED_AVAILABLE_AGENTS = 5;\n\nfunction agentNotFoundError(\n agentName: AgentName,\n agents: Partial<Record<AgentName, AgentDefinition>>,\n): string {\n const availableAgents = describeAvailableAgents(typedKeys<AgentName>(agents));\n return `Agent '${agentName}' referenced in compile config but not found in scanned agents. ${availableAgents}. Check that src/agents/${agentName}/metadata.yaml exists.`;\n}\n\nfunction describeAvailableAgents(availableAgents: AgentName[]): string {\n if (availableAgents.length === 0) return \"No agents found in scanned directories\";\n\n const listed = availableAgents.slice(0, MAX_LISTED_AVAILABLE_AGENTS).join(\", \");\n const unlisted = availableAgents.length - MAX_LISTED_AVAILABLE_AGENTS;\n return unlisted > 0\n ? `Available agents: ${listed} (and ${unlisted} more)`\n : `Available agents: ${listed}`;\n}\n\nfunction assembleAgentConfig(\n agentName: AgentName,\n definition: AgentDefinition,\n agentConfig: CompileAgentConfig,\n resolvedSkills: Skill[],\n): AgentConfig {\n const model = agentConfig.model ?? definition.model;\n const effort = agentConfig.effort ?? definition.effort;\n\n return {\n name: agentName,\n title: definition.title,\n description: definition.description,\n ...(model !== undefined && { model }),\n ...(agentConfig.codexModel !== undefined && { codexModel: agentConfig.codexModel }),\n ...(effort !== undefined && { effort }),\n tools: definition.tools,\n // Spread conditionally: the template branches on presence, and `undefined` renders a key.\n ...(definition.disallowedTools !== undefined && {\n disallowedTools: definition.disallowedTools,\n }),\n ...(definition.permissionMode !== undefined && {\n permissionMode: definition.permissionMode,\n }),\n ...(definition.isolation !== undefined && { isolation: definition.isolation }),\n ...(definition.hooks !== undefined && { hooks: definition.hooks }),\n ...(definition.experimental !== undefined && {\n experimental: definition.experimental,\n }),\n skills: resolvedSkills,\n ...(definition.path !== undefined && { path: definition.path }),\n ...(definition.sourceRoot !== undefined && { sourceRoot: definition.sourceRoot }),\n ...(definition.agentBaseDir !== undefined && { agentBaseDir: definition.agentBaseDir }),\n };\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,OAAO,UAAU;AACjB,SAAS,iBAAiB;AAU1B,IAAM,gBAAgB,WAAW,QAAQ;AAOzC,eAAsB,iBAAiBA,YAAsC;AAC3E,SAAO,iBAAiBA,YAAW,aAAa;AAClD;AAEA,eAAsB,iBAAiBA,YAAmB,OAAsC;AAC9F,SAAO,KAAK,MAAM,UAAUA,UAAS;AACvC;AAGA,eAAsB,wBACpBA,YACA,QAAoB,eACW;AAC/B,QAAM,QAAQ,MAAM,iBAAiBA,YAAW,KAAK;AACrD,QAAM,aAAa,MAAM,QAAQ;AAAA,IAC/B,MAAM,IAAI,CAAC,SAAS,oBAAoBA,YAAW,MAAM,KAAK,CAAC;AAAA,EACjE;AACA,QAAM,CAAC,QAAQ,QAAQ,IAAI,UAAU,YAAY,CAAC,UAAU,MAAM,YAAY;AAE9E,SAAO;AAAA,IACL,QAAQ,OAAO,IAAI,CAAC,UAAU,MAAM,IAAI;AAAA,IACxC,UAAU,SAAS,IAAI,CAAC,UAAU,MAAM,IA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UAAU;AACpD,QAAM,gBAAgB,aAAa,MAAM,kBAAkB,YAAY,QAAQ,IAAI,CAAC;AAEpF,SAAO,EAAE,GAAG,eAAe,GAAG,cAAc;AAC9C;AAEA,SAAS,iBACP,QACA,QACA,WACe;AACf,SAAO;AAAA,IACL,MAAM,QAAQ,QAAQC,MAAK,SAAS,SAAS;AAAA,IAC7C,aAAa,QAAQ,eAAe;AAAA,IACpC;AAAA,EACF;AACF;AAGA,SAAS,kBACP,YACA,QACA,WAC6F;AAC7F,QAAM,kBAAkB,SAAS,mBAAmB,QAAQ,SAAS,IAAI,CAAC;AAE1E,QAAM,CAAC,aAAa,aAAa,IAAIF;AAAA,IAAU;AAAA,IAAY,CAAC,SAC1D,QAAQ,gBAAgB,IAAI,KAAK,UAAU,IAAI,CAAC;AAAA,EAClD;AAEA,SAAO;AAAA,IACL,cAAc;AAAA,MACZ,YAAY,IAAI,CAAC,SAAS,CAAC,MAAM,gBAAgB,IAAI,KAAK,CAAC,CAAC,CAAC;AAAA,IAC/D;AAAA,IACA,iBAAiB,cAAc,IAAI,CAAC,SAAS,UAAU,IAAI,mCAAmC;AAAA,EAChG;AACF;","names":["agentsDir","partition","path","path","path","path","path","path","path","partition","agentsDir","path"]}
@@ -1,20 +1,22 @@
1
1
  #!/usr/bin/env node
2
+ import {
3
+ codexProjectTrustMessage,
4
+ trustCodexProject
5
+ } from "./chunk-H33ZAEKH.js";
2
6
  import {
3
7
  agentCodec,
4
8
  agentsDir,
5
9
  agentsLeftOutOfCodexMessage,
6
10
  claudeStateFile,
7
- codexGlobalConfigFile,
8
- ensureDir,
9
11
  extractFrontmatter,
10
12
  fileExists,
11
13
  glob,
12
14
  isHomeDirectory,
15
+ parseJsonOrUndefined,
13
16
  readFile,
14
17
  readFileOptional,
15
- unexpressibleOnCodexMessage,
16
- writeFile
17
- } from "./chunk-ENET4IF6.js";
18
+ unexpressibleOnCodexMessage
19
+ } from "./chunk-D2PC7NIR.js";
18
20
 
19
21
  // src/cli/lib/hosts/claude-project-trust.ts
20
22
  import path from "path";
@@ -69,18 +71,11 @@ async function claudeTrustOf(projectDir) {
69
71
  async function trustRecord() {
70
72
  const stateFile = claudeStateFile();
71
73
  if (!await fileExists(stateFile)) return () => false;
72
- const state = claudeStateSchema.safeParse(parsedOrUndefined(await readFile(stateFile)));
74
+ const state = claudeStateSchema.safeParse(parseJsonOrUndefined(await readFile(stateFile)));
73
75
  if (!state.success) return () => false;
74
76
  const { projects } = state.data;
75
77
  return (folder) => trustedProjectSchema.safeParse(projects[folder]).success;
76
78
  }
77
- function parsedOrUndefined(json) {
78
- try {
79
- return JSON.parse(json);
80
- } catch {
81
- return void 0;
82
- }
83
- }
84
79
  function foldersUpTo(folder, top) {
85
80
  const parent = path.dirname(folder);
86
81
  if (folder === top || parent === folder) return [folder];
@@ -133,78 +128,6 @@ function declaresAHook(agentMarkdown) {
133
128
  return frontmatter.success && Object.values(frontmatter.data.hooks).some((definitions) => definitions.length > 0);
134
129
  }
135
130
 
136
- // src/cli/lib/hosts/codex-project-trust.ts
137
- import path2 from "path";
138
- var TRUST_KEY = "trust_level";
139
- var TRUSTED = "trusted";
140
- var TRUST_ASSIGNMENT = `${TRUST_KEY} = "${TRUSTED}"`;
141
- async function trustCodexProject(projectDir) {
142
- const configFile = codexGlobalConfigFile();
143
- const dir = path2.resolve(projectDir);
144
- const config = await fileExists(configFile) ? await readFile(configFile) : "";
145
- if (declaresTrust(config, dir)) return { kind: "already trusted" };
146
- const level = declaredLevel(config, dir);
147
- if (level !== void 0) return { kind: "left as the user set it", configFile, level };
148
- await ensureDir(path2.dirname(configFile));
149
- await writeFile(configFile, withTrustFor(config, dir));
150
- return { kind: "trusted now", configFile };
151
- }
152
- function codexProjectTrustMessage(projectDir, trust) {
153
- const table = projectTableHeader(path2.resolve(projectDir));
154
- switch (trust.kind) {
155
- case "already trusted":
156
- return void 0;
157
- case "trusted now":
158
- return `Trusted this project in your Codex configuration, so Codex reads its sub-agents: added ${table} with ${TRUST_KEY} = "${TRUSTED}" to ${trust.configFile}.`;
159
- case "left as the user set it":
160
- return `Codex reads this project's sub-agents only once it is trusted, and ${trust.configFile} sets ${TRUST_KEY} = "${trust.level}" under ${table}. Left as you set it \u2014 change it to "${TRUSTED}" for Codex to read them.`;
161
- default: {
162
- const _exhaustive = trust;
163
- return _exhaustive;
164
- }
165
- }
166
- }
167
- function declaresTrust(config, projectDir) {
168
- return linesForProject(config, projectDir).includes(TRUST_ASSIGNMENT);
169
- }
170
- var TRUST_LEVEL_LINE = new RegExp(`^${TRUST_KEY}\\s*=\\s*"([^"]*)"$`);
171
- function declaredLevel(config, projectDir) {
172
- return linesForProject(config, projectDir).map((line) => TRUST_LEVEL_LINE.exec(line)?.[1]).find((level) => level !== void 0);
173
- }
174
- function linesForProject(config, projectDir) {
175
- const lines = config.split("\n").map((line) => line.trim());
176
- const dottedPrefix = `projects."${projectDir}".`;
177
- const dotted = lines.filter((line) => line.startsWith(dottedPrefix)).map((line) => line.slice(dottedPrefix.length));
178
- return [...linesUnderProjectTable(lines, projectDir), ...dotted];
179
- }
180
- function linesUnderProjectTable(lines, projectDir) {
181
- const header = lines.indexOf(projectTableHeader(projectDir));
182
- if (header === -1) return [];
183
- const after = lines.slice(header + 1);
184
- const nextTable = after.findIndex(opensATable);
185
- return nextTable === -1 ? after : after.slice(0, nextTable);
186
- }
187
- function opensATable(line) {
188
- return line.startsWith("[");
189
- }
190
- function projectTableHeader(projectDir) {
191
- return `[projects."${projectDir}"]`;
192
- }
193
- function withTrustFor(config, projectDir) {
194
- const lines = config.split("\n");
195
- const header = lines.findIndex((line) => line.trim() === projectTableHeader(projectDir));
196
- if (header !== -1) {
197
- return [...lines.slice(0, header + 1), TRUST_ASSIGNMENT, ...lines.slice(header + 1)].join("\n");
198
- }
199
- const theirs = config.trimEnd();
200
- const table = `${projectTableHeader(projectDir)}
201
- ${TRUST_ASSIGNMENT}
202
- `;
203
- return theirs === "" ? table : `${theirs}
204
-
205
- ${table}`;
206
- }
207
-
208
131
  // src/cli/lib/hosts/codex-compile-notices.ts
209
132
  async function codexCompileNotices(provider, projectDir) {
210
133
  if (provider !== "codex") return [];
@@ -220,6 +143,7 @@ async function trustNotice(projectDir) {
220
143
  return said === void 0 ? [] : [said];
221
144
  }
222
145
  async function holdsProjectRoles(projectDir) {
146
+ if (isHomeDirectory(projectDir)) return false;
223
147
  const roles = await glob(agentCodec("codex").listGlob, agentsDir("codex", "project", projectDir));
224
148
  return roles.length > 0;
225
149
  }
@@ -241,4 +165,4 @@ async function hostCompileNotices(provider, projectDir) {
241
165
  export {
242
166
  hostCompileNotices
243
167
  };
244
- //# sourceMappingURL=chunk-U672FZVC.js.map
168
+ //# sourceMappingURL=chunk-7OJ2SS4E.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../src/cli/lib/hosts/claude-project-trust.ts","../src/cli/lib/hosts/codex-compile-notices.ts","../src/cli/lib/hosts/host-compile-notices.ts"],"sourcesContent":["import path from \"path\";\nimport { realpath } from \"fs/promises\";\n\nimport { z } from \"zod\";\n\nimport { agentCodec, agentsDir, claudeStateFile } from \"../installation/install-layout.js\";\nimport { isHomeDirectory } from \"../installation/is-home-directory.js\";\nimport { fileExists, glob, readFile, readFileOptional } from \"../../utils/fs.js\";\nimport { extractFrontmatter } from \"../../utils/frontmatter.js\";\nimport { parseJsonOrUndefined } from \"../../utils/json.js\";\nimport type { Provider } from \"../../consts.js\";\n\n/**\n * Warns when Claude Code will drop a project sub-agent's hooks, on every event: project hooks run\n * only once `~/.claude.json` records `projects[<key>].hasTrustDialogAccepted`, keyed by the git\n * repository root (a linked worktree's main checkout). Reads that state, never writes it.\n */\n\nconst claudeStateSchema = z.object({ projects: z.record(z.string(), z.unknown()) });\n\nconst trustedProjectSchema = z.object({ hasTrustDialogAccepted: z.literal(true) });\n\n/** Claude Code reads only a top-level `hooks:` key: event name to its definitions. */\nconst declaredHooksSchema = z.object({ hooks: z.record(z.string(), z.array(z.unknown())) });\n\nconst GIT_ENTRY = \".git\";\nconst GITDIR_PREFIX = \"gitdir:\";\nconst COMMONDIR_FILE = \"commondir\";\nconst BACK_LINK_FILE = \"gitdir\";\nconst WORKTREES_DIR = \"worktrees\";\n\n/** \"never asks\": a folder above is trusted, so no prompt appears and only the record can fix it. */\ntype ClaudeTrust =\n | { readonly kind: \"trusted\" }\n | { readonly kind: \"asks\" }\n | { readonly kind: \"never asks\"; readonly recordKey: string };\n\ntype TrustRecord = (folder: string) => boolean;\n\n/** Empty from the home directory: `~/.claude/agents/` is trusted unconditionally. */\nexport async function claudeCompileNotices(\n provider: Provider,\n projectDir: string,\n): Promise<string[]> {\n if (provider !== \"claude\") return [];\n if (isHomeDirectory(projectDir)) return [];\n\n const agentsWithHooks = await countProjectAgentsDeclaringHooks(projectDir);\n if (agentsWithHooks === 0) return [];\n\n const trust = await claudeTrustOf(projectDir);\n switch (trust.kind) {\n case \"trusted\":\n return [];\n case \"asks\":\n return [claudeProjectNeedsTrustMessage(projectDir, agentsWithHooks)];\n case \"never asks\":\n return [claudeProjectNeverAskedMessage(trust.recordKey, agentsWithHooks)];\n default: {\n const _exhaustive: never = trust;\n return _exhaustive;\n }\n }\n}\n\nexport function claudeProjectNeedsTrustMessage(projectDir: string, count: number): string {\n return (\n `Claude Code runs a project sub-agent's hooks only once you trust the folder: open Claude ` +\n `Code in ${projectDir} and accept the trust prompt. Until then, ${hooksOf(count)} will not ` +\n `run, and nothing will say so.`\n );\n}\n\nexport function claudeProjectNeverAskedMessage(recordKey: string, count: number): string {\n return (\n `Claude Code runs ${hooksOf(count)} only once you trust the folder, and will not ask here: ` +\n `set projects[${JSON.stringify(recordKey)}].hasTrustDialogAccepted to true in ` +\n `${claudeStateFile()}.`\n );\n}\n\nfunction hooksOf(count: number): string {\n return count === 1 ? \"1 sub-agent's hooks\" : `${count} sub-agents' hooks`;\n}\n\nasync function claudeTrustOf(projectDir: string): Promise<ClaudeTrust> {\n const [isTrusted, repositoryRoot] = await Promise.all([\n trustRecord(),\n gitRepositoryRoot(projectDir),\n ]);\n const recordKey =\n repositoryRoot === undefined ? projectDir : await canonicalRepositoryRoot(repositoryRoot);\n if (isTrusted(recordKey)) return { kind: \"trusted\" };\n\n const promptSuppressed = foldersUpTo(projectDir, repositoryRoot).some(isTrusted);\n return promptSuppressed ? { kind: \"never asks\", recordKey } : { kind: \"asks\" };\n}\n\n/** Unreadable counts as untrusted: a wrong \"untrusted\" costs one line of advice. */\nasync function trustRecord(): Promise<TrustRecord> {\n const stateFile = claudeStateFile();\n if (!(await fileExists(stateFile))) return () => false;\n\n const state = claudeStateSchema.safeParse(parseJsonOrUndefined(await readFile(stateFile)));\n if (!state.success) return () => false;\n\n const { projects } = state.data;\n return (folder) => trustedProjectSchema.safeParse(projects[folder]).success;\n}\n\nfunction foldersUpTo(folder: string, top?: string): string[] {\n const parent = path.dirname(folder);\n if (folder === top || parent === folder) return [folder];\n return [folder, ...foldersUpTo(parent, top)];\n}\n\nasync function gitRepositoryRoot(folder: string): Promise<string | undefined> {\n const candidates = foldersUpTo(folder);\n const holdsGit = await Promise.all(\n candidates.map((candidate) => fileExists(path.join(candidate, GIT_ENTRY))),\n );\n return candidates.find((_, index) => holdsGit[index]);\n}\n\n/**\n * A linked worktree (`.git` file pointing into `<main>/.git/worktrees/`, which points back) is\n * keyed by its main checkout; anything else by `root` itself.\n */\nasync function canonicalRepositoryRoot(root: string): Promise<string> {\n // A `.git` directory reads as empty, as a missing file does.\n const pointer = (await readFileOptional(path.join(root, GIT_ENTRY))).trim();\n if (!pointer.startsWith(GITDIR_PREFIX)) return root;\n\n const gitDir = path.resolve(root, pointer.slice(GITDIR_PREFIX.length).trim());\n const [commonDir, backLink] = await Promise.all([\n pathRecordedIn(gitDir, COMMONDIR_FILE),\n pathRecordedIn(gitDir, BACK_LINK_FILE),\n ]);\n const isLinkedWorktree =\n path.dirname(gitDir) === path.join(commonDir, WORKTREES_DIR) &&\n (await pointsBackAt(backLink, root));\n if (!isLinkedWorktree) return root;\n\n // A worktree of a bare repository is keyed by the bare repository's own folder.\n return path.basename(commonDir) === GIT_ENTRY ? path.dirname(commonDir) : commonDir;\n}\n\nasync function pathRecordedIn(dir: string, file: string): Promise<string> {\n return path.resolve(dir, (await readFileOptional(path.join(dir, file))).trim());\n}\n\nasync function pointsBackAt(backLink: string, root: string): Promise<boolean> {\n const [linked, realRoot] = await Promise.all([\n realpathOrUndefined(backLink),\n realpathOrUndefined(root),\n ]);\n return realRoot !== undefined && linked === path.join(realRoot, GIT_ENTRY);\n}\n\nasync function realpathOrUndefined(file: string): Promise<string | undefined> {\n try {\n return await realpath(file);\n } catch {\n return undefined;\n }\n}\n\nasync function countProjectAgentsDeclaringHooks(projectDir: string): Promise<number> {\n const dir = agentsDir(\"claude\", \"project\", projectDir);\n const files = await glob(agentCodec(\"claude\").listGlob, dir);\n const agents = await Promise.all(files.map((file) => readFile(path.join(dir, file))));\n return agents.filter(declaresAHook).length;\n}\n\n/** An event with no definition runs nothing, so it is not a hook to warn about. */\nfunction declaresAHook(agentMarkdown: string): boolean {\n const frontmatter = declaredHooksSchema.safeParse(extractFrontmatter(agentMarkdown));\n return (\n frontmatter.success &&\n Object.values(frontmatter.data.hooks).some((definitions) => definitions.length > 0)\n );\n}\n","import {\n agentsLeftOutOfCodexMessage,\n unexpressibleOnCodexMessage,\n} from \"@workspace/compile/agent-source\";\n\nimport { codexProjectTrustMessage, trustCodexProject } from \"./codex-project-trust.js\";\nimport { agentCodec, agentsDir } from \"../installation/install-layout.js\";\nimport { isHomeDirectory } from \"../installation/is-home-directory.js\";\nimport { glob } from \"../../utils/fs.js\";\nimport type { Provider } from \"../../consts.js\";\n\n/** Once per run, not per sub-agent or scope: each notice is true of the whole installation. */\nexport async function codexCompileNotices(\n provider: Provider,\n projectDir: string,\n): Promise<string[]> {\n if (provider !== \"codex\") return [];\n\n return [\n agentsLeftOutOfCodexMessage(),\n unexpressibleOnCodexMessage(),\n ...(await trustNotice(projectDir)),\n ];\n}\n\n/** Only when role files exist: trusting a project with nothing for Codex to read grants nothing. */\nasync function trustNotice(projectDir: string): Promise<string[]> {\n if (!(await holdsProjectRoles(projectDir))) return [];\n\n const said = codexProjectTrustMessage(projectDir, await trustCodexProject(projectDir));\n return said === undefined ? [] : [said];\n}\n\n/** The home folder is the global scope, whose roles Codex reads without a trust entry. */\nasync function holdsProjectRoles(projectDir: string): Promise<boolean> {\n if (isHomeDirectory(projectDir)) return false;\n\n const roles = await glob(agentCodec(\"codex\").listGlob, agentsDir(\"codex\", \"project\", projectDir));\n\n return roles.length > 0;\n}\n","import { claudeCompileNotices } from \"./claude-project-trust.js\";\nimport { codexCompileNotices } from \"./codex-compile-notices.js\";\nimport type { Provider } from \"../../consts.js\";\n\n/** The one source `init` and `compile` share, so they cannot say different things. */\nexport async function hostCompileNotices(\n provider: Provider,\n projectDir: string,\n): Promise<string[]> {\n switch (provider) {\n case \"claude\":\n return claudeCompileNotices(provider, projectDir);\n case \"codex\":\n return codexCompileNotices(provider, projectDir);\n default: {\n const _exhaustive: never = provider;\n return _exhaustive;\n }\n }\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;AAAA,OAAO,UAAU;AACjB,SAAS,gBAAgB;AAEzB,SAAS,SAAS;AAelB,IAAM,oBAAoB,EAAE,OAAO,EAAE,UAAU,EAAE,OAAO,EAAE,OAAO,GAAG,EAAE,QAAQ,CAAC,EAAE,CAAC;AAElF,IAAM,uBAAuB,EAAE,OAAO,EAAE,wBAAwB,EAAE,QAAQ,IAAI,EAAE,CAAC;AAGjF,IAAM,sBAAsB,EAAE,OAAO,EAAE,OAAO,EAAE,OAAO,EAAE,OAAO,GAAG,EAAE,MAAM,EAAE,QAAQ,CAAC,CAAC,EAAE,CAAC;AAE1F,IAAM,YAAY;AAClB,IAAM,gBAAgB;AACtB,IAAM,iBAAiB;AACvB,IAAM,iBAAiB;AACvB,IAAM,gBAAgB;AAWtB,eAAsB,qBACpB,UACA,YACmB;AACnB,MAAI,aAAa,SAAU,QAAO,CAAC;AACnC,MAAI,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,kBAAkB,UAAU,CAAC;AACrF,SAAO,SAAS,SAAY,CAAC,IAAI,CAAC,IAAI;AACxC;AAGA,eAAe,kBAAkB,YAAsC;AACrE,MAAI,gBAAgB,UAAU,EAAG,QAAO;AAExC,QAAM,QAAQ,MAAM,KAAK,WAAW,OAAO,EAAE,UAAU,UAAU,SAAS,WAAW,UAAU,CAAC;AAEhG,SAAO,MAAM,SAAS;AACxB;;;ACnCA,eAAsB,mBACpB,UACA,YACmB;AACnB,UAAQ,UAAU;AAAA,IAChB,KAAK;AACH,aAAO,qBAAqB,UAAU,UAAU;AAAA,IAClD,KAAK;AACH,aAAO,oBAAoB,UAAU,UAAU;AAAA,IACjD,SAAS;AACP,YAAM,cAAqB;AAC3B,aAAO;AAAA,IACT;AAAA,EACF;AACF;","names":[]}
@@ -1,17 +1,20 @@
1
1
  #!/usr/bin/env node
2
+ import {
3
+ HeaderRow
4
+ } from "./chunk-ZIBWVTLN.js";
2
5
  import {
3
6
  SkillAgentSummary
4
- } from "./chunk-5CFHP6Z5.js";
7
+ } from "./chunk-OIQKRXHH.js";
5
8
  import {
6
9
  ALL_SKILLS_EJECTED_LABEL,
7
10
  CLI_COLORS,
8
11
  DEFAULT_PUBLIC_SOURCE_NAME,
9
12
  EJECT_SOURCE,
10
13
  formatSourceDisplayName
11
- } from "./chunk-U46LYYRA.js";
14
+ } from "./chunk-4SIBDIIO.js";
12
15
 
13
16
  // src/cli/components/common/summary-panel.tsx
14
- import { Box, Text, renderToString } from "ink";
17
+ import { Box, renderToString } from "ink";
15
18
  import "react";
16
19
  import { unique } from "remeda";
17
20
 
@@ -57,10 +60,6 @@ function formatSkillMarketplaces(skillConfigs) {
57
60
  if (marketplaceNames.length === 0) return ALL_SKILLS_EJECTED_LABEL;
58
61
  return marketplaceNames.map((name) => formatSourceDisplayName(name)).sort().join(" \xB7 ");
59
62
  }
60
- var HeaderRow = ({ label, value }) => /* @__PURE__ */ jsxs(Box, { flexDirection: "row", columnGap: 1, children: [
61
- /* @__PURE__ */ jsx(Box, { flexShrink: 0, children: /* @__PURE__ */ jsx(Text, { color: CLI_COLORS.WARNING, bold: true, children: label }) }),
62
- /* @__PURE__ */ jsx(Text, { color: CLI_COLORS.NEUTRAL, children: value })
63
- ] });
64
63
  var PanelHeader = ({ sourceNames, stackName }) => /* @__PURE__ */ jsxs(
65
64
  Box,
66
65
  {
@@ -111,4 +110,4 @@ export {
111
110
  summaryPanelText,
112
111
  summaryPanelBlock
113
112
  };
114
- //# sourceMappingURL=chunk-C2BSCEDN.js.map
113
+ //# sourceMappingURL=chunk-7WN6TUZP.js.map