agentpacks 0.3.0 → 0.4.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 (166) hide show
  1. package/README.md +168 -8
  2. package/dist/api.d.ts +2 -0
  3. package/dist/api.js +929 -409
  4. package/dist/cli/export-cmd.js +281 -149
  5. package/dist/cli/generate.js +740 -247
  6. package/dist/cli/import-cmd.js +57 -85
  7. package/dist/cli/info.d.ts +4 -0
  8. package/dist/cli/info.js +232 -0
  9. package/dist/cli/init.js +8 -36
  10. package/dist/cli/install.js +414 -129
  11. package/dist/cli/login.d.ts +9 -0
  12. package/dist/cli/login.js +202 -0
  13. package/dist/cli/models-explain.d.ts +16 -0
  14. package/dist/cli/models-explain.js +1205 -0
  15. package/dist/cli/pack/create.js +4 -32
  16. package/dist/cli/pack/enable.js +1 -29
  17. package/dist/cli/pack/list.js +266 -134
  18. package/dist/cli/pack/validate.js +274 -127
  19. package/dist/cli/publish.d.ts +8 -0
  20. package/dist/cli/publish.js +672 -0
  21. package/dist/cli/search.d.ts +12 -0
  22. package/dist/cli/search.js +210 -0
  23. package/dist/core/config.d.ts +2 -1
  24. package/dist/core/config.js +74 -117
  25. package/dist/core/dependency-resolver.js +4 -28
  26. package/dist/core/feature-merger.d.ts +7 -0
  27. package/dist/core/feature-merger.js +289 -29
  28. package/dist/core/index.js +283 -140
  29. package/dist/core/lockfile.js +0 -28
  30. package/dist/core/metarepo.js +74 -116
  31. package/dist/core/pack-loader.d.ts +2 -0
  32. package/dist/core/pack-loader.js +266 -133
  33. package/dist/core/profile-resolver.d.ts +75 -0
  34. package/dist/core/profile-resolver.js +111 -0
  35. package/dist/exporters/cursor-plugin.js +4 -32
  36. package/dist/exporters/index.js +4 -32
  37. package/dist/features/agents.d.ts +5 -0
  38. package/dist/features/agents.js +2 -30
  39. package/dist/features/commands.js +2 -30
  40. package/dist/features/hooks.js +2 -30
  41. package/dist/features/ignore.js +0 -28
  42. package/dist/features/index.d.ts +1 -0
  43. package/dist/features/index.js +176 -31
  44. package/dist/features/mcp.js +2 -30
  45. package/dist/features/models.d.ts +167 -0
  46. package/dist/features/models.js +293 -0
  47. package/dist/features/plugins.js +2 -30
  48. package/dist/features/rules.js +2 -30
  49. package/dist/features/skills.js +2 -30
  50. package/dist/importers/claude-code.js +10 -38
  51. package/dist/importers/cursor.js +15 -43
  52. package/dist/importers/opencode.js +16 -44
  53. package/dist/importers/rulesync.js +22 -50
  54. package/dist/index.js +1710 -538
  55. package/dist/node/api.js +929 -409
  56. package/dist/node/cli/export-cmd.js +281 -149
  57. package/dist/node/cli/generate.js +740 -247
  58. package/dist/node/cli/import-cmd.js +57 -85
  59. package/dist/node/cli/info.js +232 -0
  60. package/dist/node/cli/init.js +8 -36
  61. package/dist/node/cli/install.js +414 -129
  62. package/dist/node/cli/login.js +202 -0
  63. package/dist/node/cli/models-explain.js +1205 -0
  64. package/dist/node/cli/pack/create.js +4 -32
  65. package/dist/node/cli/pack/enable.js +1 -29
  66. package/dist/node/cli/pack/list.js +266 -134
  67. package/dist/node/cli/pack/validate.js +274 -127
  68. package/dist/node/cli/publish.js +672 -0
  69. package/dist/node/cli/search.js +210 -0
  70. package/dist/node/core/config.js +74 -117
  71. package/dist/node/core/dependency-resolver.js +4 -28
  72. package/dist/node/core/feature-merger.js +289 -29
  73. package/dist/node/core/index.js +283 -140
  74. package/dist/node/core/lockfile.js +0 -28
  75. package/dist/node/core/metarepo.js +74 -116
  76. package/dist/node/core/pack-loader.js +266 -133
  77. package/dist/node/core/profile-resolver.js +111 -0
  78. package/dist/node/exporters/cursor-plugin.js +4 -32
  79. package/dist/node/exporters/index.js +4 -32
  80. package/dist/node/features/agents.js +2 -30
  81. package/dist/node/features/commands.js +2 -30
  82. package/dist/node/features/hooks.js +2 -30
  83. package/dist/node/features/ignore.js +0 -28
  84. package/dist/node/features/index.js +176 -31
  85. package/dist/node/features/mcp.js +2 -30
  86. package/dist/node/features/models.js +293 -0
  87. package/dist/node/features/plugins.js +2 -30
  88. package/dist/node/features/rules.js +2 -30
  89. package/dist/node/features/skills.js +2 -30
  90. package/dist/node/importers/claude-code.js +10 -38
  91. package/dist/node/importers/cursor.js +15 -43
  92. package/dist/node/importers/opencode.js +16 -44
  93. package/dist/node/importers/rulesync.js +22 -50
  94. package/dist/node/index.js +1710 -538
  95. package/dist/node/sources/git-ref.js +7 -30
  96. package/dist/node/sources/git.js +7 -30
  97. package/dist/node/sources/index.js +337 -39
  98. package/dist/node/sources/local.js +0 -28
  99. package/dist/node/sources/npm-ref.js +0 -28
  100. package/dist/node/sources/npm.js +10 -37
  101. package/dist/node/sources/registry-ref.js +37 -0
  102. package/dist/node/sources/registry.js +355 -0
  103. package/dist/node/targets/additional-targets.js +196 -37
  104. package/dist/node/targets/agents-md.js +5 -33
  105. package/dist/node/targets/base-target.js +0 -28
  106. package/dist/node/targets/claude-code.js +211 -41
  107. package/dist/node/targets/codex-cli.js +7 -35
  108. package/dist/node/targets/copilot.js +202 -41
  109. package/dist/node/targets/cursor.js +188 -40
  110. package/dist/node/targets/gemini-cli.js +10 -38
  111. package/dist/node/targets/generic-md-target.js +196 -37
  112. package/dist/node/targets/index.js +414 -106
  113. package/dist/node/targets/opencode.js +171 -51
  114. package/dist/node/targets/registry.js +414 -106
  115. package/dist/node/utils/credentials.js +38 -0
  116. package/dist/node/utils/diff.js +22 -34
  117. package/dist/node/utils/filesystem.js +2 -30
  118. package/dist/node/utils/frontmatter.js +0 -28
  119. package/dist/node/utils/global.js +3 -31
  120. package/dist/node/utils/markdown.js +0 -28
  121. package/dist/node/utils/model-allowlist.js +110 -0
  122. package/dist/node/utils/model-guidance.js +78 -0
  123. package/dist/node/utils/registry-client.js +142 -0
  124. package/dist/node/utils/tarball.js +49 -0
  125. package/dist/sources/git-ref.js +7 -30
  126. package/dist/sources/git.d.ts +2 -2
  127. package/dist/sources/git.js +7 -30
  128. package/dist/sources/index.d.ts +2 -0
  129. package/dist/sources/index.js +337 -39
  130. package/dist/sources/local.js +0 -28
  131. package/dist/sources/npm-ref.js +0 -28
  132. package/dist/sources/npm.js +10 -37
  133. package/dist/sources/registry-ref.d.ts +30 -0
  134. package/dist/sources/registry-ref.js +37 -0
  135. package/dist/sources/registry.d.ts +18 -0
  136. package/dist/sources/registry.js +355 -0
  137. package/dist/targets/additional-targets.js +196 -37
  138. package/dist/targets/agents-md.js +5 -33
  139. package/dist/targets/base-target.d.ts +2 -0
  140. package/dist/targets/base-target.js +0 -28
  141. package/dist/targets/claude-code.js +211 -41
  142. package/dist/targets/codex-cli.js +7 -35
  143. package/dist/targets/copilot.js +202 -41
  144. package/dist/targets/cursor.js +188 -40
  145. package/dist/targets/gemini-cli.js +10 -38
  146. package/dist/targets/generic-md-target.js +196 -37
  147. package/dist/targets/index.js +414 -106
  148. package/dist/targets/opencode.js +171 -51
  149. package/dist/targets/registry.js +414 -106
  150. package/dist/utils/credentials.d.ts +19 -0
  151. package/dist/utils/credentials.js +38 -0
  152. package/dist/utils/diff.js +22 -34
  153. package/dist/utils/filesystem.js +2 -30
  154. package/dist/utils/frontmatter.js +0 -28
  155. package/dist/utils/global.js +3 -31
  156. package/dist/utils/markdown.js +0 -28
  157. package/dist/utils/model-allowlist.d.ts +39 -0
  158. package/dist/utils/model-allowlist.js +110 -0
  159. package/dist/utils/model-guidance.d.ts +6 -0
  160. package/dist/utils/model-guidance.js +78 -0
  161. package/dist/utils/registry-client.d.ts +141 -0
  162. package/dist/utils/registry-client.js +142 -0
  163. package/dist/utils/tarball.d.ts +13 -0
  164. package/dist/utils/tarball.js +49 -0
  165. package/package.json +171 -5
  166. package/templates/pack/models.json +38 -0
@@ -1,32 +1,4 @@
1
1
  // @bun
2
- var __defProp = Object.defineProperty;
3
- var __getOwnPropNames = Object.getOwnPropertyNames;
4
- var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
5
- var __hasOwnProp = Object.prototype.hasOwnProperty;
6
- var __moduleCache = /* @__PURE__ */ new WeakMap;
7
- var __toCommonJS = (from) => {
8
- var entry = __moduleCache.get(from), desc;
9
- if (entry)
10
- return entry;
11
- entry = __defProp({}, "__esModule", { value: true });
12
- if (from && typeof from === "object" || typeof from === "function")
13
- __getOwnPropNames(from).map((key) => !__hasOwnProp.call(entry, key) && __defProp(entry, key, {
14
- get: () => from[key],
15
- enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable
16
- }));
17
- __moduleCache.set(from, entry);
18
- return entry;
19
- };
20
- var __export = (target, all) => {
21
- for (var name in all)
22
- __defProp(target, name, {
23
- get: all[name],
24
- enumerable: true,
25
- configurable: true,
26
- set: (newValue) => all[name] = () => newValue
27
- });
28
- };
29
- var __esm = (fn, res) => () => (fn && (res = fn(fn = 0)), res);
30
2
  var __require = import.meta.require;
31
3
 
32
4
  // src/utils/filesystem.ts
@@ -36,10 +8,10 @@ import {
36
8
  readFileSync,
37
9
  writeFileSync,
38
10
  readdirSync,
11
+ rmSync,
39
12
  statSync
40
13
  } from "fs";
41
14
  import { dirname, relative, join } from "path";
42
- import { removeSync } from "fs-extra";
43
15
  var GENERATED_HEADER_MD = "<!-- Generated by agentpacks. DO NOT EDIT. -->";
44
16
  var GENERATED_HEADER_JSON = "// Generated by agentpacks. DO NOT EDIT.";
45
17
  var GENERATED_HEADER_JS = "// Generated by agentpacks. DO NOT EDIT.";
@@ -80,7 +52,7 @@ function ensureDir(dirPath) {
80
52
  }
81
53
  function removeIfExists(targetPath) {
82
54
  if (existsSync(targetPath)) {
83
- removeSync(targetPath);
55
+ rmSync(targetPath, { recursive: true, force: true });
84
56
  }
85
57
  }
86
58
  function listFiles(dirPath, options = {}) {
@@ -236,7 +208,7 @@ class BaseTarget {
236
208
  }
237
209
 
238
210
  // src/targets/gemini-cli.ts
239
- import { resolve as resolve2, join as join2 } from "path";
211
+ import { resolve, join as join2 } from "path";
240
212
  var TARGET_ID = "geminicli";
241
213
 
242
214
  class GeminiCliTarget extends BaseTarget {
@@ -252,12 +224,12 @@ class GeminiCliTarget extends BaseTarget {
252
224
  ];
253
225
  generate(options) {
254
226
  const { projectRoot, baseDir, features, enabledFeatures, deleteExisting } = options;
255
- const root = resolve2(projectRoot, baseDir);
227
+ const root = resolve(projectRoot, baseDir);
256
228
  const effective = this.getEffectiveFeatures(enabledFeatures);
257
229
  const filesWritten = [];
258
230
  const filesDeleted = [];
259
231
  const warnings = [];
260
- const geminiDir = resolve2(root, ".gemini");
232
+ const geminiDir = resolve(root, ".gemini");
261
233
  if (effective.includes("rules")) {
262
234
  const rules = features.rules.filter((r) => ruleMatchesTarget(r, TARGET_ID));
263
235
  const rootRules = getRootRules(rules);
@@ -266,12 +238,12 @@ class GeminiCliTarget extends BaseTarget {
266
238
  const geminiMd = rootRules.map((r) => r.content).join(`
267
239
 
268
240
  `);
269
- const filepath = resolve2(root, "GEMINI.md");
241
+ const filepath = resolve(root, "GEMINI.md");
270
242
  writeGeneratedFile(filepath, geminiMd);
271
243
  filesWritten.push(filepath);
272
244
  }
273
245
  if (detailRules.length > 0) {
274
- const memoriesDir = resolve2(geminiDir, "memories");
246
+ const memoriesDir = resolve(geminiDir, "memories");
275
247
  if (deleteExisting) {
276
248
  removeIfExists(memoriesDir);
277
249
  filesDeleted.push(memoriesDir);
@@ -285,7 +257,7 @@ class GeminiCliTarget extends BaseTarget {
285
257
  }
286
258
  }
287
259
  if (effective.includes("commands")) {
288
- const commandsDir = resolve2(geminiDir, "commands");
260
+ const commandsDir = resolve(geminiDir, "commands");
289
261
  if (deleteExisting) {
290
262
  removeIfExists(commandsDir);
291
263
  filesDeleted.push(commandsDir);
@@ -303,14 +275,14 @@ class GeminiCliTarget extends BaseTarget {
303
275
  const mcpEntries = Object.entries(features.mcpServers);
304
276
  if (mcpEntries.length > 0) {
305
277
  const settings = buildGeminiSettings(features.mcpServers);
306
- const filepath = resolve2(geminiDir, "settings.json");
278
+ const filepath = resolve(geminiDir, "settings.json");
307
279
  writeGeneratedJson(filepath, settings, { header: false });
308
280
  filesWritten.push(filepath);
309
281
  }
310
282
  }
311
283
  if (effective.includes("ignore")) {
312
284
  if (features.ignorePatterns.length > 0) {
313
- const filepath = resolve2(root, ".geminiignore");
285
+ const filepath = resolve(root, ".geminiignore");
314
286
  const content = features.ignorePatterns.join(`
315
287
  `) + `
316
288
  `;
@@ -1,32 +1,4 @@
1
1
  // @bun
2
- var __defProp = Object.defineProperty;
3
- var __getOwnPropNames = Object.getOwnPropertyNames;
4
- var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
5
- var __hasOwnProp = Object.prototype.hasOwnProperty;
6
- var __moduleCache = /* @__PURE__ */ new WeakMap;
7
- var __toCommonJS = (from) => {
8
- var entry = __moduleCache.get(from), desc;
9
- if (entry)
10
- return entry;
11
- entry = __defProp({}, "__esModule", { value: true });
12
- if (from && typeof from === "object" || typeof from === "function")
13
- __getOwnPropNames(from).map((key) => !__hasOwnProp.call(entry, key) && __defProp(entry, key, {
14
- get: () => from[key],
15
- enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable
16
- }));
17
- __moduleCache.set(from, entry);
18
- return entry;
19
- };
20
- var __export = (target, all) => {
21
- for (var name in all)
22
- __defProp(target, name, {
23
- get: all[name],
24
- enumerable: true,
25
- configurable: true,
26
- set: (newValue) => all[name] = () => newValue
27
- });
28
- };
29
- var __esm = (fn, res) => () => (fn && (res = fn(fn = 0)), res);
30
2
  var __require = import.meta.require;
31
3
 
32
4
  // src/utils/filesystem.ts
@@ -36,10 +8,10 @@ import {
36
8
  readFileSync,
37
9
  writeFileSync,
38
10
  readdirSync,
11
+ rmSync,
39
12
  statSync
40
13
  } from "fs";
41
14
  import { dirname, relative, join } from "path";
42
- import { removeSync } from "fs-extra";
43
15
  var GENERATED_HEADER_MD = "<!-- Generated by agentpacks. DO NOT EDIT. -->";
44
16
  var GENERATED_HEADER_JSON = "// Generated by agentpacks. DO NOT EDIT.";
45
17
  var GENERATED_HEADER_JS = "// Generated by agentpacks. DO NOT EDIT.";
@@ -80,7 +52,7 @@ function ensureDir(dirPath) {
80
52
  }
81
53
  function removeIfExists(targetPath) {
82
54
  if (existsSync(targetPath)) {
83
- removeSync(targetPath);
55
+ rmSync(targetPath, { recursive: true, force: true });
84
56
  }
85
57
  }
86
58
  function listFiles(dirPath, options = {}) {
@@ -217,6 +189,110 @@ function commandMatchesTarget(cmd, targetId) {
217
189
  return Array.isArray(targets) && targets.includes(targetId);
218
190
  }
219
191
 
192
+ // src/core/profile-resolver.ts
193
+ function resolveModels(merged, modelProfile, targetId) {
194
+ let defaultModel = merged.default;
195
+ let smallModel = merged.small;
196
+ let agents = { ...merged.agents };
197
+ if (modelProfile && merged.profiles?.[modelProfile]) {
198
+ const resolvedProfile = resolveProfileInheritance(modelProfile, merged.profiles);
199
+ if (resolvedProfile.default)
200
+ defaultModel = resolvedProfile.default;
201
+ if (resolvedProfile.small)
202
+ smallModel = resolvedProfile.small;
203
+ if (resolvedProfile.agents) {
204
+ agents = { ...agents, ...resolvedProfile.agents };
205
+ }
206
+ }
207
+ if (targetId) {
208
+ const targetOverride = merged.overrides?.[targetId];
209
+ if (targetOverride) {
210
+ if (targetOverride.default)
211
+ defaultModel = targetOverride.default;
212
+ if (targetOverride.small)
213
+ smallModel = targetOverride.small;
214
+ if (targetOverride.agents) {
215
+ agents = { ...agents, ...targetOverride.agents };
216
+ }
217
+ }
218
+ }
219
+ const providers = {};
220
+ if (merged.providers) {
221
+ for (const [name, config] of Object.entries(merged.providers)) {
222
+ providers[name] = {
223
+ ...config.options ? { options: config.options } : {},
224
+ ...config.models ? { models: config.models } : {}
225
+ };
226
+ }
227
+ }
228
+ const profileNames = Object.keys(merged.profiles ?? {});
229
+ const profiles = {};
230
+ if (merged.profiles) {
231
+ for (const [name, profile] of Object.entries(merged.profiles)) {
232
+ profiles[name] = {
233
+ description: profile.description,
234
+ default: profile.default,
235
+ small: profile.small
236
+ };
237
+ }
238
+ }
239
+ return {
240
+ default: defaultModel,
241
+ small: smallModel,
242
+ agents,
243
+ providers,
244
+ routing: merged.routing ?? [],
245
+ profileNames,
246
+ activeProfile: modelProfile,
247
+ profiles
248
+ };
249
+ }
250
+ function resolveAgentModel(resolved, agentName, frontmatterModel) {
251
+ const fromModels = resolved.agents[agentName];
252
+ if (fromModels) {
253
+ return {
254
+ model: fromModels.model,
255
+ temperature: fromModels.temperature,
256
+ top_p: fromModels.top_p
257
+ };
258
+ }
259
+ if (frontmatterModel) {
260
+ return { model: frontmatterModel };
261
+ }
262
+ return {};
263
+ }
264
+ function resolveProfileInheritance(profileName, profiles) {
265
+ const visited = new Set;
266
+ return resolveProfileChain(profileName, profiles, visited, 0);
267
+ }
268
+ var MAX_INHERITANCE_DEPTH = 10;
269
+ function resolveProfileChain(name, profiles, visited, depth) {
270
+ if (depth > MAX_INHERITANCE_DEPTH) {
271
+ throw new Error(`Profile inheritance too deep (max ${MAX_INHERITANCE_DEPTH}): ${name}`);
272
+ }
273
+ if (visited.has(name)) {
274
+ throw new Error(`Circular profile inheritance detected: ${[...visited, name].join(" \u2192 ")}`);
275
+ }
276
+ const profile = profiles[name];
277
+ if (!profile) {
278
+ throw new Error(`Profile "${name}" not found`);
279
+ }
280
+ visited.add(name);
281
+ if (!profile.extends) {
282
+ return { ...profile };
283
+ }
284
+ const parent = resolveProfileChain(profile.extends, profiles, visited, depth + 1);
285
+ return {
286
+ description: profile.description ?? parent.description,
287
+ default: profile.default ?? parent.default,
288
+ small: profile.small ?? parent.small,
289
+ agents: {
290
+ ...parent.agents,
291
+ ...profile.agents
292
+ }
293
+ };
294
+ }
295
+
220
296
  // src/targets/base-target.ts
221
297
  class BaseTarget {
222
298
  supportsFeature(feature) {
@@ -235,8 +311,81 @@ class BaseTarget {
235
311
  }
236
312
  }
237
313
 
314
+ // src/utils/model-guidance.ts
315
+ function generateModelGuidanceMarkdown(resolved) {
316
+ if (!resolved.default && !resolved.small && Object.keys(resolved.agents).length === 0 && Object.keys(resolved.profiles).length === 0) {
317
+ return null;
318
+ }
319
+ const lines = [];
320
+ lines.push("# Model Configuration");
321
+ lines.push("");
322
+ lines.push("Use the following model preferences when working in this project.");
323
+ lines.push("");
324
+ if (resolved.default || resolved.small) {
325
+ lines.push("## Default Models");
326
+ lines.push("");
327
+ if (resolved.default) {
328
+ lines.push(`- **Primary model**: ${resolved.default}`);
329
+ }
330
+ if (resolved.small) {
331
+ lines.push(`- **Lightweight tasks** (titles, summaries): ${resolved.small}`);
332
+ }
333
+ lines.push("");
334
+ }
335
+ const agentEntries = Object.entries(resolved.agents);
336
+ if (agentEntries.length > 0) {
337
+ lines.push("## Agent Model Assignments");
338
+ lines.push("");
339
+ lines.push("| Agent | Model | Temperature |");
340
+ lines.push("| --- | --- | --- |");
341
+ for (const [name, assignment] of agentEntries) {
342
+ const temp = assignment.temperature !== undefined ? String(assignment.temperature) : "\u2014";
343
+ lines.push(`| ${name} | ${assignment.model} | ${temp} |`);
344
+ }
345
+ lines.push("");
346
+ }
347
+ if (Object.keys(resolved.profiles).length > 0) {
348
+ lines.push("## Available Profiles");
349
+ lines.push("");
350
+ lines.push("| Profile | Description | Default Model |");
351
+ lines.push("| --- | --- | --- |");
352
+ for (const [name, profile] of Object.entries(resolved.profiles)) {
353
+ lines.push(`| ${name} | ${profile.description ?? "\u2014"} | ${profile.default ?? "\u2014"} |`);
354
+ }
355
+ lines.push("");
356
+ }
357
+ if (resolved.activeProfile) {
358
+ lines.push(`**Active profile**: \`${resolved.activeProfile}\``);
359
+ lines.push("");
360
+ }
361
+ if (resolved.routing.length > 0) {
362
+ lines.push("## Task-Aware Routing");
363
+ lines.push("");
364
+ lines.push("Select the appropriate profile based on the task context:");
365
+ lines.push("");
366
+ lines.push("| Condition | Profile | Description |");
367
+ lines.push("| --- | --- | --- |");
368
+ for (const rule of resolved.routing) {
369
+ const conditions = Object.entries(rule.when).map(([k, v]) => `${k}=${v}`).join(", ");
370
+ const desc = rule.description ?? "\u2014";
371
+ lines.push(`| ${conditions} | ${rule.use} | ${desc} |`);
372
+ }
373
+ lines.push("");
374
+ lines.push("### Condition Reference");
375
+ lines.push("");
376
+ lines.push("- **complexity**: low | medium | high | critical");
377
+ lines.push("- **urgency**: low | normal | high");
378
+ lines.push("- **budget**: minimal | standard | premium");
379
+ lines.push("- **contextWindowNeed**: small | medium | large | max");
380
+ lines.push("- **toolUseIntensity**: none | light | heavy");
381
+ lines.push("");
382
+ }
383
+ return lines.join(`
384
+ `);
385
+ }
386
+
238
387
  // src/targets/generic-md-target.ts
239
- import { resolve as resolve2, join as join2 } from "path";
388
+ import { resolve, join as join2 } from "path";
240
389
  function createGenericMdTarget(config) {
241
390
  return new GenericMdTarget(config);
242
391
  }
@@ -255,16 +404,16 @@ class GenericMdTarget extends BaseTarget {
255
404
  }
256
405
  generate(options) {
257
406
  const { projectRoot, baseDir, features, enabledFeatures, deleteExisting } = options;
258
- const root = resolve2(projectRoot, baseDir);
407
+ const root = resolve(projectRoot, baseDir);
259
408
  const effective = this.getEffectiveFeatures(enabledFeatures);
260
409
  const filesWritten = [];
261
410
  const filesDeleted = [];
262
411
  const warnings = [];
263
- const configDir = resolve2(root, this.config.configDir);
412
+ const configDir = resolve(root, this.config.configDir);
264
413
  const rulesSubDir = this.config.rulesDir ?? "rules";
265
414
  const ext = this.config.ruleExtension ?? ".md";
266
415
  if (effective.includes("rules")) {
267
- const rulesDir = resolve2(configDir, rulesSubDir);
416
+ const rulesDir = resolve(configDir, rulesSubDir);
268
417
  if (deleteExisting) {
269
418
  removeIfExists(rulesDir);
270
419
  filesDeleted.push(rulesDir);
@@ -278,7 +427,7 @@ class GenericMdTarget extends BaseTarget {
278
427
  }
279
428
  }
280
429
  if (effective.includes("commands")) {
281
- const commandsDir = resolve2(configDir, "commands");
430
+ const commandsDir = resolve(configDir, "commands");
282
431
  if (deleteExisting) {
283
432
  removeIfExists(commandsDir);
284
433
  filesDeleted.push(commandsDir);
@@ -295,7 +444,7 @@ class GenericMdTarget extends BaseTarget {
295
444
  const mcpEntries = Object.entries(features.mcpServers);
296
445
  if (mcpEntries.length > 0) {
297
446
  const mcpDir = this.config.mcpInConfigDir ? configDir : root;
298
- const filepath = resolve2(mcpDir, "mcp.json");
447
+ const filepath = resolve(mcpDir, "mcp.json");
299
448
  writeGeneratedJson(filepath, { mcpServers: features.mcpServers }, {
300
449
  header: false
301
450
  });
@@ -304,13 +453,23 @@ class GenericMdTarget extends BaseTarget {
304
453
  }
305
454
  if (effective.includes("ignore") && this.config.ignoreFile) {
306
455
  if (features.ignorePatterns.length > 0) {
307
- const filepath = resolve2(root, this.config.ignoreFile);
456
+ const filepath = resolve(root, this.config.ignoreFile);
308
457
  writeGeneratedFile(filepath, features.ignorePatterns.join(`
309
458
  `) + `
310
459
  `);
311
460
  filesWritten.push(filepath);
312
461
  }
313
462
  }
463
+ if (effective.includes("models") && features.models) {
464
+ const resolved = resolveModels(features.models, options.modelProfile, this.id);
465
+ const guidance = generateModelGuidanceMarkdown(resolved);
466
+ if (guidance) {
467
+ ensureDir(configDir);
468
+ const filepath = join2(configDir, "model-config.md");
469
+ writeGeneratedFile(filepath, guidance);
470
+ filesWritten.push(filepath);
471
+ }
472
+ }
314
473
  return this.createResult(filesWritten, filesDeleted, warnings);
315
474
  }
316
475
  }