agentpacks 1.7.13 → 1.8.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 (147) hide show
  1. package/dist/api.js +48 -3658
  2. package/dist/cli/export-cmd.js +7 -1027
  3. package/dist/cli/generate.js +39 -2731
  4. package/dist/cli/import-cmd.js +19 -770
  5. package/dist/cli/info.js +4 -231
  6. package/dist/cli/init.js +9 -185
  7. package/dist/cli/install.js +4 -902
  8. package/dist/cli/login.js +6 -201
  9. package/dist/cli/models-explain.js +14 -1266
  10. package/dist/cli/pack/create.js +4 -146
  11. package/dist/cli/pack/enable.js +2 -65
  12. package/dist/cli/pack/list.js +5 -893
  13. package/dist/cli/pack/validate.js +4 -642
  14. package/dist/cli/publish.js +8 -679
  15. package/dist/cli/search.js +4 -209
  16. package/dist/core/config.d.ts +1 -1
  17. package/dist/core/config.js +1 -145
  18. package/dist/core/dependency-resolver.js +1 -126
  19. package/dist/core/feature-merger.js +3 -398
  20. package/dist/core/index.js +5 -1129
  21. package/dist/core/lockfile.js +2 -43
  22. package/dist/core/metarepo.js +1 -183
  23. package/dist/core/pack-loader.js +4 -841
  24. package/dist/core/profile-resolver.js +1 -110
  25. package/dist/exporters/cursor-plugin.js +6 -404
  26. package/dist/exporters/index.js +6 -404
  27. package/dist/features/agents.js +3 -161
  28. package/dist/features/commands.js +3 -161
  29. package/dist/features/hooks.js +3 -153
  30. package/dist/features/ignore.js +2 -43
  31. package/dist/features/index.js +4 -629
  32. package/dist/features/mcp.js +3 -143
  33. package/dist/features/models.js +3 -292
  34. package/dist/features/plugins.js +3 -139
  35. package/dist/features/rules.d.ts +0 -1
  36. package/dist/features/rules.js +3 -169
  37. package/dist/features/skills.js +3 -228
  38. package/dist/importers/claude-code.js +6 -195
  39. package/dist/importers/cursor.js +5 -355
  40. package/dist/importers/opencode.js +6 -346
  41. package/dist/importers/rulesync.js +5 -365
  42. package/dist/index.js +89 -4934
  43. package/dist/node/api.js +48 -3659
  44. package/dist/node/cli/export-cmd.js +7 -1028
  45. package/dist/node/cli/generate.js +39 -2732
  46. package/dist/node/cli/import-cmd.js +19 -771
  47. package/dist/node/cli/info.js +4 -232
  48. package/dist/node/cli/init.js +9 -186
  49. package/dist/node/cli/install.js +4 -903
  50. package/dist/node/cli/login.js +6 -202
  51. package/dist/node/cli/models-explain.js +14 -1267
  52. package/dist/node/cli/pack/create.js +4 -147
  53. package/dist/node/cli/pack/enable.js +2 -66
  54. package/dist/node/cli/pack/list.js +5 -894
  55. package/dist/node/cli/pack/validate.js +4 -643
  56. package/dist/node/cli/publish.js +8 -680
  57. package/dist/node/cli/search.js +4 -210
  58. package/dist/node/core/config.js +1 -146
  59. package/dist/node/core/dependency-resolver.js +1 -127
  60. package/dist/node/core/feature-merger.js +3 -399
  61. package/dist/node/core/index.js +5 -1130
  62. package/dist/node/core/lockfile.js +2 -44
  63. package/dist/node/core/metarepo.js +1 -184
  64. package/dist/node/core/pack-loader.js +4 -842
  65. package/dist/node/core/profile-resolver.js +1 -111
  66. package/dist/node/exporters/cursor-plugin.js +6 -405
  67. package/dist/node/exporters/index.js +6 -405
  68. package/dist/node/features/agents.js +3 -162
  69. package/dist/node/features/commands.js +3 -162
  70. package/dist/node/features/hooks.js +3 -154
  71. package/dist/node/features/ignore.js +2 -44
  72. package/dist/node/features/index.js +4 -630
  73. package/dist/node/features/mcp.js +3 -144
  74. package/dist/node/features/models.js +3 -293
  75. package/dist/node/features/plugins.js +3 -140
  76. package/dist/node/features/rules.js +3 -170
  77. package/dist/node/features/skills.js +3 -229
  78. package/dist/node/importers/claude-code.js +6 -196
  79. package/dist/node/importers/cursor.js +5 -356
  80. package/dist/node/importers/opencode.js +6 -347
  81. package/dist/node/importers/rulesync.js +5 -366
  82. package/dist/node/index.js +89 -4935
  83. package/dist/node/sources/git-ref.js +1 -56
  84. package/dist/node/sources/git.js +2 -222
  85. package/dist/node/sources/index.js +4 -714
  86. package/dist/node/sources/local.js +1 -24
  87. package/dist/node/sources/npm-ref.js +1 -56
  88. package/dist/node/sources/npm.js +2 -184
  89. package/dist/node/sources/registry-ref.js +1 -37
  90. package/dist/node/sources/registry.js +4 -355
  91. package/dist/node/targets/additional-targets.js +6 -587
  92. package/dist/node/targets/base-target.js +1 -23
  93. package/dist/node/targets/claude-code.js +6 -714
  94. package/dist/node/targets/codex-cli.js +3 -324
  95. package/dist/node/targets/copilot.js +5 -603
  96. package/dist/node/targets/cursor.js +6 -700
  97. package/dist/node/targets/gemini-cli.js +10 -319
  98. package/dist/node/targets/generic-md-target.js +6 -478
  99. package/dist/node/targets/index.js +32 -1873
  100. package/dist/node/targets/mistral-vibe.js +7 -661
  101. package/dist/node/targets/opencode.js +13 -723
  102. package/dist/node/targets/registry.js +32 -1864
  103. package/dist/node/utils/credentials.js +3 -38
  104. package/dist/node/utils/diff.js +5 -132
  105. package/dist/node/utils/filesystem.js +3 -124
  106. package/dist/node/utils/frontmatter.js +1 -24
  107. package/dist/node/utils/global.js +1 -53
  108. package/dist/node/utils/markdown.js +3 -30
  109. package/dist/node/utils/model-allowlist.js +1 -126
  110. package/dist/node/utils/model-guidance.js +2 -78
  111. package/dist/node/utils/registry-client.js +1 -142
  112. package/dist/node/utils/tarball.js +1 -49
  113. package/dist/sources/git-ref.js +1 -55
  114. package/dist/sources/git.js +2 -221
  115. package/dist/sources/index.js +4 -713
  116. package/dist/sources/local.js +1 -23
  117. package/dist/sources/npm-ref.js +1 -55
  118. package/dist/sources/npm.js +2 -183
  119. package/dist/sources/registry-ref.js +1 -36
  120. package/dist/sources/registry.js +4 -354
  121. package/dist/targets/additional-targets.js +6 -586
  122. package/dist/targets/base-target.js +1 -22
  123. package/dist/targets/claude-code.js +6 -713
  124. package/dist/targets/codex-cli.js +3 -323
  125. package/dist/targets/copilot.js +5 -602
  126. package/dist/targets/cursor.js +6 -699
  127. package/dist/targets/gemini-cli.js +10 -318
  128. package/dist/targets/generic-md-target.js +6 -477
  129. package/dist/targets/index.d.ts +0 -1
  130. package/dist/targets/index.js +32 -1872
  131. package/dist/targets/mistral-vibe.js +7 -660
  132. package/dist/targets/opencode.js +13 -722
  133. package/dist/targets/registry.js +32 -1863
  134. package/dist/utils/credentials.js +3 -37
  135. package/dist/utils/diff.js +5 -131
  136. package/dist/utils/filesystem.js +3 -123
  137. package/dist/utils/frontmatter.js +1 -23
  138. package/dist/utils/global.js +1 -52
  139. package/dist/utils/markdown.js +3 -29
  140. package/dist/utils/model-allowlist.js +1 -125
  141. package/dist/utils/model-guidance.js +2 -77
  142. package/dist/utils/registry-client.js +1 -141
  143. package/dist/utils/tarball.js +1 -48
  144. package/package.json +4 -16
  145. package/dist/node/targets/agents-md.js +0 -211
  146. package/dist/targets/agents-md.d.ts +0 -13
  147. package/dist/targets/agents-md.js +0 -211
@@ -1,715 +1,8 @@
1
1
  // @bun
2
- var __require = import.meta.require;
2
+ var Nq=import.meta.require;import{existsSync as F,mkdirSync as $q,readdirSync as D,readFileSync as Bq,rmSync as Uq,statSync as k,writeFileSync as Vq}from"fs";import{dirname as Yq,join as u,relative as Kq}from"path";var v="<!-- Generated by agentpacks. DO NOT EDIT. -->",h="// Generated by agentpacks. DO NOT EDIT.",g="// Generated by agentpacks. DO NOT EDIT.";function H(q,Q,Z={}){let{header:$=!0,type:B}=Z,U=B??Xq(q);w(Yq(q));let V=Q;if($){let K=zq(U);if(K)V=`${K}
3
+ ${Q}`}Vq(q,V,"utf-8")}function c(q,Q,Z={}){let $=JSON.stringify(Q,null,2);H(q,$+`
4
+ `,{...Z,type:"json"})}function m(q){if(!F(q))return null;return Bq(q,"utf-8")}function S(q){let Q=m(q);if(Q===null)return null;return JSON.parse(Q)}function w(q){if(!F(q))$q(q,{recursive:!0})}function R(q){if(F(q))Uq(q,{recursive:!0,force:!0})}function A(q,Q={}){let{extension:Z,recursive:$=!1}=Q;if(!F(q))return[];let B=[],U=D(q);for(let V of U){let K=u(q,V),J=k(K);if(J.isDirectory()&&$)B.push(...A(K,Q));else if(J.isFile()){if(!Z||V.endsWith(Z))B.push(K)}}return B}function p(q){if(!F(q))return[];return D(q).map((Q)=>u(q,Q)).filter((Q)=>k(Q).isDirectory())}function uq(q,Q){return Kq(q,Q)}function vq(q){let Q=m(q);if(!Q)return!1;return Q.startsWith(v)||Q.startsWith(h)||Q.startsWith(g)}function Xq(q){if(q.endsWith(".json")||q.endsWith(".jsonc"))return"json";if(q.endsWith(".ts")||q.endsWith(".mts"))return"ts";if(q.endsWith(".js")||q.endsWith(".mjs"))return"js";return"md"}function zq(q){switch(q){case"md":return v;case"json":return h;case"js":case"ts":return g;default:return null}}import f from"gray-matter";function b(q){let{data:Q,content:Z}=f(q);return{data:Q,content:Z.trim(),raw:q}}function T(q,Q){let Z=Object.fromEntries(Object.entries(q).filter(([,$])=>$!==void 0));if(Object.keys(Z).length===0)return Q;return f.stringify(Q,Z)}import{readFileSync as Jq}from"fs";import{basename as Lq}from"path";function nq(q,Q){return A(q,{extension:".md"}).map(($)=>Wq($,Q))}function Wq(q,Q){let Z=Jq(q,"utf-8"),{data:$,content:B}=b(Z);return{name:$.name??Lq(q,".md"),sourcePath:q,packName:Q,meta:$,content:B}}function d(q,Q){let{targets:Z}=q.meta;if(!Z||Z==="*")return!0;if(Array.isArray(Z)&&Z.includes("*"))return!0;return Array.isArray(Z)&&Z.includes(Q)}import{readFileSync as Oq}from"fs";import{basename as xq}from"path";function rq(q,Q){return A(q,{extension:".md"}).map(($)=>bq($,Q))}function bq(q,Q){let Z=Oq(q,"utf-8"),{data:$,content:B}=b(Z);return{name:xq(q,".md"),sourcePath:q,packName:Q,meta:$,content:B}}function n(q,Q){let{targets:Z}=q.meta;if(!Z||Z==="*")return!0;if(Array.isArray(Z)&&Z.includes("*"))return!0;return Array.isArray(Z)&&Z.includes(Q)}import{join as Cq}from"path";var Hq=["cursor","claudecode","codexcli","opencode"];function QQ(q,Q){let Z=Cq(q,"hooks","hooks.json"),$=S(Z);if(!$)return null;let B=$.hooks??{},U={};for(let V of Hq){let K=$[V];if(K&&typeof K==="object"&&"hooks"in K&&K.hooks)U[V]=K.hooks}return{packName:Q,sourcePath:Z,version:$.version,shared:B,targetOverrides:U}}function o(q,Q){let Z={};for(let[B,U]of Object.entries(q.shared))Z[B]=[...U];let $=q.targetOverrides[Q];if($)for(let[B,U]of Object.entries($))Z[B]=[...Z[B]??[],...U];return Z}import{readFileSync as wq}from"fs";import{basename as Gq}from"path";function YQ(q,Q){return A(q,{extension:".md"}).map(($)=>jq($,Q))}function jq(q,Q){let Z=wq(q,"utf-8"),{data:$,content:B}=b(Z);return{name:Gq(q,".md"),sourcePath:q,packName:Q,meta:$,content:B}}function a(q,Q){let{targets:Z}=q.meta;if(!Z||Z==="*")return!0;if(Array.isArray(Z)&&Z.includes("*"))return!0;return Array.isArray(Z)&&Z.includes(Q)}function s(q){return q.filter((Q)=>Q.meta.root===!0)}function l(q){return q.filter((Q)=>Q.meta.root!==!0)}import{existsSync as _q,readFileSync as Aq}from"fs";import{basename as r,join as Iq}from"path";var Fq=/^[a-z0-9]+(?:-[a-z0-9]+)*$/,i=64;function WQ(q,Q){let Z=p(q),$=[];for(let B of Z){let U=Iq(B,"SKILL.md");if(_q(U))$.push(Rq(U,B,Q))}return $}function Rq(q,Q,Z){let $=Aq(q,"utf-8"),{data:B,content:U}=b($);return{name:B.name??r(Q),sourcePath:q,sourceDir:Q,packName:Z,meta:B,content:U}}function Sq(q){return{...q.meta,name:q.name}}function t(q){return T(Sq(q),q.content)}function OQ(q,Q){let{data:Z,content:$}=b(q),B={...Z,name:Q},U=!1,V=B.description;if(typeof V!=="string"||V.trim().length===0)B.description=`Imported skill: ${Q}`,U=!0;return{content:T(B,$),addedDescription:U}}function xQ(q){let Q=[],Z=r(q.sourceDir),$=q.meta.name;if(typeof $!=="string"||$.trim().length===0)Q.push('Missing required frontmatter field "name".');else{if($.length>i)Q.push(`Invalid "name": must be at most ${i} characters.`);if(!Fq.test($))Q.push('Invalid "name": use lowercase letters, numbers, and single hyphens only.');if($!==Z)Q.push(`Invalid "name": must match containing directory "${Z}".`)}let B=q.meta.description;if(typeof B!=="string"||B.trim().length===0)Q.push('Missing required frontmatter field "description".');let U=q.meta["allowed-tools"];if(U!==void 0&&(!Array.isArray(U)||U.some((V)=>typeof V!=="string"||V.length===0)))Q.push('Invalid "allowed-tools": expected an array of non-empty strings.');return Q}function e(q,Q){let{targets:Z}=q.meta;if(!Z||Z==="*")return!0;if(Array.isArray(Z)&&Z.includes("*"))return!0;return Array.isArray(Z)&&Z.includes(Q)}function y(q,Q,Z){let{default:$,small:B}=q,U={...q.agents};if(Q&&q.profiles?.[Q]){let Y=Mq(Q,q.profiles);if(Y.default)$=Y.default;if(Y.small)B=Y.small;if(Y.agents)U={...U,...Y.agents}}if(Z){let Y=q.overrides?.[Z];if(Y){if(Y.default)$=Y.default;if(Y.small)B=Y.small;if(Y.agents)U={...U,...Y.agents}}}let V={};if(q.providers)for(let[Y,x]of Object.entries(q.providers))V[Y]={...x.options?{options:x.options}:{},...x.models?{models:x.models}:{}};let K=Object.keys(q.profiles??{}),J={};if(q.profiles)for(let[Y,x]of Object.entries(q.profiles))J[Y]={description:x.description,default:x.default,small:x.small};return{default:$,small:B,agents:U,providers:V,routing:q.routing??[],profileNames:K,activeProfile:Q,profiles:J}}function CQ(q,Q,Z){let $=q.agents[Q];if($)return{model:$.model,temperature:$.temperature,top_p:$.top_p};if(Z)return{model:Z};return{}}function Mq(q,Q){return Qq(q,Q,new Set,0)}var qq=10;function Qq(q,Q,Z,$){if($>qq)throw Error(`Profile inheritance too deep (max ${qq}): ${q}`);if(Z.has(q))throw Error(`Circular profile inheritance detected: ${[...Z,q].join(" \u2192 ")}`);let B=Q[q];if(!B)throw Error(`Profile "${q}" not found`);if(Z.add(q),!B.extends)return{...B};let U=Qq(B.extends,Q,Z,$+1);return{description:B.description??U.description,default:B.default??U.default,small:B.small??U.small,agents:{...U.agents,...B.agents}}}function Zq(q){if(!q.default&&!q.small&&Object.keys(q.agents).length===0&&Object.keys(q.profiles).length===0)return null;let Q=[];if(Q.push("# Model Configuration"),Q.push(""),Q.push("Use the following model preferences when working in this project."),Q.push(""),q.default||q.small){if(Q.push("## Default Models"),Q.push(""),q.default)Q.push(`- **Primary model**: ${q.default}`);if(q.small)Q.push(`- **Lightweight tasks** (titles, summaries): ${q.small}`);Q.push("")}let Z=Object.entries(q.agents);if(Z.length>0){Q.push("## Agent Model Assignments"),Q.push(""),Q.push("| Agent | Model | Temperature |"),Q.push("| --- | --- | --- |");for(let[$,B]of Z){let U=B.temperature!==void 0?String(B.temperature):"\u2014";Q.push(`| ${$} | ${B.model} | ${U} |`)}Q.push("")}if(Object.keys(q.profiles).length>0){Q.push("## Available Profiles"),Q.push(""),Q.push("| Profile | Description | Default Model |"),Q.push("| --- | --- | --- |");for(let[$,B]of Object.entries(q.profiles))Q.push(`| ${$} | ${B.description??"\u2014"} | ${B.default??"\u2014"} |`);Q.push("")}if(q.activeProfile)Q.push(`**Active profile**: \`${q.activeProfile}\``),Q.push("");if(q.routing.length>0){Q.push("## Task-Aware Routing"),Q.push(""),Q.push("Select the appropriate profile based on the task context:"),Q.push(""),Q.push("| Condition | Profile | Description |"),Q.push("| --- | --- | --- |");for(let $ of q.routing){let B=Object.entries($.when).map(([V,K])=>`${V}=${K}`).join(", "),U=$.description??"\u2014";Q.push(`| ${B} | ${$.use} | ${U} |`)}Q.push(""),Q.push("### Condition Reference"),Q.push(""),Q.push("- **complexity**: low | medium | high | critical"),Q.push("- **urgency**: low | normal | high"),Q.push("- **budget**: minimal | standard | premium"),Q.push("- **contextWindowNeed**: small | medium | large | max"),Q.push("- **toolUseIntensity**: none | light | heavy"),Q.push("")}return Q.join(`
5
+ `)}class P{supportsFeature(q){return this.supportedFeatures.includes(q)}getEffectiveFeatures(q){return q.filter((Q)=>this.supportsFeature(Q))}createResult(q=[],Q=[],Z=[]){return{targetId:this.id,filesWritten:q,filesDeleted:Q,warnings:Z}}}import{join as I,resolve as C}from"path";var G="claudecode";class Tq extends P{id=G;name="Claude Code";supportedFeatures=["rules","commands","agents","skills","hooks","mcp","ignore","models"];generate(q){let{projectRoot:Q,baseDir:Z,features:$,enabledFeatures:B,deleteExisting:U}=q,V=C(Q,Z),K=this.getEffectiveFeatures(B),J=[],Y=[],x=[],j=C(V,".claude");if(K.includes("rules")){let X=C(j,"rules");if(U)R(X),Y.push(X);w(X);let W=$.rules.filter((O)=>a(O,G)),L=s(W),z=l(W);if(L.length>0){let O=L.map((N)=>N.content).join(`
3
6
 
4
- // src/utils/filesystem.ts
5
- import {
6
- existsSync,
7
- mkdirSync,
8
- readdirSync,
9
- readFileSync,
10
- rmSync,
11
- statSync,
12
- writeFileSync
13
- } from "fs";
14
- import { dirname, join, relative } from "path";
15
- var GENERATED_HEADER_MD = "<!-- Generated by agentpacks. DO NOT EDIT. -->";
16
- var GENERATED_HEADER_JSON = "// Generated by agentpacks. DO NOT EDIT.";
17
- var GENERATED_HEADER_JS = "// Generated by agentpacks. DO NOT EDIT.";
18
- function writeGeneratedFile(filepath, content, options = {}) {
19
- const { header = true, type } = options;
20
- const ext = type ?? inferFileType(filepath);
21
- ensureDir(dirname(filepath));
22
- let output = content;
23
- if (header) {
24
- const headerComment = getHeader(ext);
25
- if (headerComment) {
26
- output = `${headerComment}
27
- ${content}`;
28
- }
29
- }
30
- writeFileSync(filepath, output, "utf-8");
31
- }
32
- function writeGeneratedJson(filepath, data, options = {}) {
33
- const json = JSON.stringify(data, null, 2);
34
- writeGeneratedFile(filepath, json + `
35
- `, { ...options, type: "json" });
36
- }
37
- function readFileOrNull(filepath) {
38
- if (!existsSync(filepath))
39
- return null;
40
- return readFileSync(filepath, "utf-8");
41
- }
42
- function readJsonOrNull(filepath) {
43
- const content = readFileOrNull(filepath);
44
- if (content === null)
45
- return null;
46
- return JSON.parse(content);
47
- }
48
- function ensureDir(dirPath) {
49
- if (!existsSync(dirPath)) {
50
- mkdirSync(dirPath, { recursive: true });
51
- }
52
- }
53
- function removeIfExists(targetPath) {
54
- if (existsSync(targetPath)) {
55
- rmSync(targetPath, { recursive: true, force: true });
56
- }
57
- }
58
- function listFiles(dirPath, options = {}) {
59
- const { extension, recursive = false } = options;
60
- if (!existsSync(dirPath))
61
- return [];
62
- const results = [];
63
- const entries = readdirSync(dirPath);
64
- for (const entry of entries) {
65
- const fullPath = join(dirPath, entry);
66
- const stat = statSync(fullPath);
67
- if (stat.isDirectory() && recursive) {
68
- results.push(...listFiles(fullPath, options));
69
- } else if (stat.isFile()) {
70
- if (!extension || entry.endsWith(extension)) {
71
- results.push(fullPath);
72
- }
73
- }
74
- }
75
- return results;
76
- }
77
- function listDirs(dirPath) {
78
- if (!existsSync(dirPath))
79
- return [];
80
- return readdirSync(dirPath).map((entry) => join(dirPath, entry)).filter((fullPath) => statSync(fullPath).isDirectory());
81
- }
82
- function relPath(projectRoot, filepath) {
83
- return relative(projectRoot, filepath);
84
- }
85
- function isGeneratedFile(filepath) {
86
- const content = readFileOrNull(filepath);
87
- if (!content)
88
- return false;
89
- return content.startsWith(GENERATED_HEADER_MD) || content.startsWith(GENERATED_HEADER_JSON) || content.startsWith(GENERATED_HEADER_JS);
90
- }
91
- function inferFileType(filepath) {
92
- if (filepath.endsWith(".json") || filepath.endsWith(".jsonc"))
93
- return "json";
94
- if (filepath.endsWith(".ts") || filepath.endsWith(".mts"))
95
- return "ts";
96
- if (filepath.endsWith(".js") || filepath.endsWith(".mjs"))
97
- return "js";
98
- return "md";
99
- }
100
- function getHeader(type) {
101
- switch (type) {
102
- case "md":
103
- return GENERATED_HEADER_MD;
104
- case "json":
105
- return GENERATED_HEADER_JSON;
106
- case "js":
107
- case "ts":
108
- return GENERATED_HEADER_JS;
109
- default:
110
- return null;
111
- }
112
- }
113
-
114
- // src/utils/frontmatter.ts
115
- import matter from "gray-matter";
116
- function parseFrontmatter(source) {
117
- const { data, content } = matter(source);
118
- return {
119
- data,
120
- content: content.trim(),
121
- raw: source
122
- };
123
- }
124
- function serializeFrontmatter(data, content) {
125
- const filtered = Object.fromEntries(Object.entries(data).filter(([, v]) => v !== undefined));
126
- if (Object.keys(filtered).length === 0) {
127
- return content;
128
- }
129
- return matter.stringify(content, filtered);
130
- }
131
-
132
- // src/features/agents.ts
133
- import { readFileSync as readFileSync2 } from "fs";
134
- import { basename } from "path";
135
- function parseAgents(agentsDir, packName) {
136
- const files = listFiles(agentsDir, { extension: ".md" });
137
- return files.map((filepath) => parseAgentFile(filepath, packName));
138
- }
139
- function parseAgentFile(filepath, packName) {
140
- const raw = readFileSync2(filepath, "utf-8");
141
- const { data, content } = parseFrontmatter(raw);
142
- return {
143
- name: data.name ?? basename(filepath, ".md"),
144
- sourcePath: filepath,
145
- packName,
146
- meta: data,
147
- content
148
- };
149
- }
150
- function agentMatchesTarget(agent, targetId) {
151
- const { targets } = agent.meta;
152
- if (!targets || targets === "*")
153
- return true;
154
- if (Array.isArray(targets) && targets.includes("*"))
155
- return true;
156
- return Array.isArray(targets) && targets.includes(targetId);
157
- }
158
-
159
- // src/features/commands.ts
160
- import { readFileSync as readFileSync3 } from "fs";
161
- import { basename as basename2 } from "path";
162
- function parseCommands(commandsDir, packName) {
163
- const files = listFiles(commandsDir, { extension: ".md" });
164
- return files.map((filepath) => parseCommandFile(filepath, packName));
165
- }
166
- function parseCommandFile(filepath, packName) {
167
- const raw = readFileSync3(filepath, "utf-8");
168
- const { data, content } = parseFrontmatter(raw);
169
- return {
170
- name: basename2(filepath, ".md"),
171
- sourcePath: filepath,
172
- packName,
173
- meta: data,
174
- content
175
- };
176
- }
177
- function commandMatchesTarget(cmd, targetId) {
178
- const { targets } = cmd.meta;
179
- if (!targets || targets === "*")
180
- return true;
181
- if (Array.isArray(targets) && targets.includes("*"))
182
- return true;
183
- return Array.isArray(targets) && targets.includes(targetId);
184
- }
185
-
186
- // src/features/hooks.ts
187
- import { join as join2 } from "path";
188
- var TARGET_OVERRIDE_KEYS = ["cursor", "claudecode", "opencode"];
189
- function parseHooks(packDir, packName) {
190
- const hooksPath = join2(packDir, "hooks", "hooks.json");
191
- const raw = readJsonOrNull(hooksPath);
192
- if (!raw)
193
- return null;
194
- const shared = raw.hooks ?? {};
195
- const targetOverrides = {};
196
- for (const key of TARGET_OVERRIDE_KEYS) {
197
- const override = raw[key];
198
- if (override && typeof override === "object" && "hooks" in override && override.hooks) {
199
- targetOverrides[key] = override.hooks;
200
- }
201
- }
202
- return {
203
- packName,
204
- sourcePath: hooksPath,
205
- version: raw.version,
206
- shared,
207
- targetOverrides
208
- };
209
- }
210
- function resolveHooksForTarget(hooks, targetId) {
211
- const merged = {};
212
- for (const [event, entries] of Object.entries(hooks.shared)) {
213
- merged[event] = [...entries];
214
- }
215
- const overrides = hooks.targetOverrides[targetId];
216
- if (overrides) {
217
- for (const [event, entries] of Object.entries(overrides)) {
218
- merged[event] = [...merged[event] ?? [], ...entries];
219
- }
220
- }
221
- return merged;
222
- }
223
-
224
- // src/features/rules.ts
225
- import { readFileSync as readFileSync4 } from "fs";
226
- import { basename as basename3 } from "path";
227
- function parseRules(rulesDir, packName) {
228
- const files = listFiles(rulesDir, { extension: ".md" });
229
- return files.map((filepath) => parseRuleFile(filepath, packName));
230
- }
231
- function parseRuleFile(filepath, packName) {
232
- const raw = readFileSync4(filepath, "utf-8");
233
- const { data, content } = parseFrontmatter(raw);
234
- return {
235
- name: basename3(filepath, ".md"),
236
- sourcePath: filepath,
237
- packName,
238
- meta: data,
239
- content
240
- };
241
- }
242
- function ruleMatchesTarget(rule, targetId) {
243
- const { targets } = rule.meta;
244
- if (!targets || targets === "*")
245
- return true;
246
- if (Array.isArray(targets) && targets.includes("*"))
247
- return true;
248
- return Array.isArray(targets) && targets.includes(targetId);
249
- }
250
- function getRootRules(rules) {
251
- return rules.filter((r) => r.meta.root === true);
252
- }
253
- function getDetailRules(rules) {
254
- return rules.filter((r) => r.meta.root !== true);
255
- }
256
-
257
- // src/features/skills.ts
258
- import { existsSync as existsSync2, readFileSync as readFileSync5 } from "fs";
259
- import { basename as basename4, join as join3 } from "path";
260
- var SKILL_NAME_PATTERN = /^[a-z0-9]+(?:-[a-z0-9]+)*$/;
261
- var SKILL_NAME_MAX_LENGTH = 64;
262
- function parseSkills(skillsDir, packName) {
263
- const dirs = listDirs(skillsDir);
264
- const skills = [];
265
- for (const dir of dirs) {
266
- const skillMd = join3(dir, "SKILL.md");
267
- if (existsSync2(skillMd)) {
268
- skills.push(parseSkillFile(skillMd, dir, packName));
269
- }
270
- }
271
- return skills;
272
- }
273
- function parseSkillFile(filepath, skillDir, packName) {
274
- const raw = readFileSync5(filepath, "utf-8");
275
- const { data, content } = parseFrontmatter(raw);
276
- return {
277
- name: data.name ?? basename4(skillDir),
278
- sourcePath: filepath,
279
- sourceDir: skillDir,
280
- packName,
281
- meta: data,
282
- content
283
- };
284
- }
285
- function buildSkillFrontmatter(skill) {
286
- return {
287
- ...skill.meta,
288
- name: skill.name
289
- };
290
- }
291
- function serializeSkill(skill) {
292
- return serializeFrontmatter(buildSkillFrontmatter(skill), skill.content);
293
- }
294
- function normalizeImportedSkillMarkdown(source, skillName) {
295
- const { data, content } = parseFrontmatter(source);
296
- const normalized = {
297
- ...data,
298
- name: skillName
299
- };
300
- let addedDescription = false;
301
- const description = normalized.description;
302
- if (typeof description !== "string" || description.trim().length === 0) {
303
- normalized.description = `Imported skill: ${skillName}`;
304
- addedDescription = true;
305
- }
306
- return {
307
- content: serializeFrontmatter(normalized, content),
308
- addedDescription
309
- };
310
- }
311
- function validateAgentSkillsFrontmatter(skill) {
312
- const errors = [];
313
- const dirName = basename4(skill.sourceDir);
314
- const declaredName = skill.meta.name;
315
- if (typeof declaredName !== "string" || declaredName.trim().length === 0) {
316
- errors.push('Missing required frontmatter field "name".');
317
- } else {
318
- if (declaredName.length > SKILL_NAME_MAX_LENGTH) {
319
- errors.push(`Invalid "name": must be at most ${SKILL_NAME_MAX_LENGTH} characters.`);
320
- }
321
- if (!SKILL_NAME_PATTERN.test(declaredName)) {
322
- errors.push('Invalid "name": use lowercase letters, numbers, and single hyphens only.');
323
- }
324
- if (declaredName !== dirName) {
325
- errors.push(`Invalid "name": must match containing directory "${dirName}".`);
326
- }
327
- }
328
- const description = skill.meta.description;
329
- if (typeof description !== "string" || description.trim().length === 0) {
330
- errors.push('Missing required frontmatter field "description".');
331
- }
332
- const allowedTools = skill.meta["allowed-tools"];
333
- if (allowedTools !== undefined && (!Array.isArray(allowedTools) || allowedTools.some((tool) => typeof tool !== "string" || tool.length === 0))) {
334
- errors.push('Invalid "allowed-tools": expected an array of non-empty strings.');
335
- }
336
- return errors;
337
- }
338
- function skillMatchesTarget(skill, targetId) {
339
- const { targets } = skill.meta;
340
- if (!targets || targets === "*")
341
- return true;
342
- if (Array.isArray(targets) && targets.includes("*"))
343
- return true;
344
- return Array.isArray(targets) && targets.includes(targetId);
345
- }
346
-
347
- // src/core/profile-resolver.ts
348
- function resolveModels(merged, modelProfile, targetId) {
349
- let defaultModel = merged.default;
350
- let smallModel = merged.small;
351
- let agents = { ...merged.agents };
352
- if (modelProfile && merged.profiles?.[modelProfile]) {
353
- const resolvedProfile = resolveProfileInheritance(modelProfile, merged.profiles);
354
- if (resolvedProfile.default)
355
- defaultModel = resolvedProfile.default;
356
- if (resolvedProfile.small)
357
- smallModel = resolvedProfile.small;
358
- if (resolvedProfile.agents) {
359
- agents = { ...agents, ...resolvedProfile.agents };
360
- }
361
- }
362
- if (targetId) {
363
- const targetOverride = merged.overrides?.[targetId];
364
- if (targetOverride) {
365
- if (targetOverride.default)
366
- defaultModel = targetOverride.default;
367
- if (targetOverride.small)
368
- smallModel = targetOverride.small;
369
- if (targetOverride.agents) {
370
- agents = { ...agents, ...targetOverride.agents };
371
- }
372
- }
373
- }
374
- const providers = {};
375
- if (merged.providers) {
376
- for (const [name, config] of Object.entries(merged.providers)) {
377
- providers[name] = {
378
- ...config.options ? { options: config.options } : {},
379
- ...config.models ? { models: config.models } : {}
380
- };
381
- }
382
- }
383
- const profileNames = Object.keys(merged.profiles ?? {});
384
- const profiles = {};
385
- if (merged.profiles) {
386
- for (const [name, profile] of Object.entries(merged.profiles)) {
387
- profiles[name] = {
388
- description: profile.description,
389
- default: profile.default,
390
- small: profile.small
391
- };
392
- }
393
- }
394
- return {
395
- default: defaultModel,
396
- small: smallModel,
397
- agents,
398
- providers,
399
- routing: merged.routing ?? [],
400
- profileNames,
401
- activeProfile: modelProfile,
402
- profiles
403
- };
404
- }
405
- function resolveAgentModel(resolved, agentName, frontmatterModel) {
406
- const fromModels = resolved.agents[agentName];
407
- if (fromModels) {
408
- return {
409
- model: fromModels.model,
410
- temperature: fromModels.temperature,
411
- top_p: fromModels.top_p
412
- };
413
- }
414
- if (frontmatterModel) {
415
- return { model: frontmatterModel };
416
- }
417
- return {};
418
- }
419
- function resolveProfileInheritance(profileName, profiles) {
420
- const visited = new Set;
421
- return resolveProfileChain(profileName, profiles, visited, 0);
422
- }
423
- var MAX_INHERITANCE_DEPTH = 10;
424
- function resolveProfileChain(name, profiles, visited, depth) {
425
- if (depth > MAX_INHERITANCE_DEPTH) {
426
- throw new Error(`Profile inheritance too deep (max ${MAX_INHERITANCE_DEPTH}): ${name}`);
427
- }
428
- if (visited.has(name)) {
429
- throw new Error(`Circular profile inheritance detected: ${[...visited, name].join(" \u2192 ")}`);
430
- }
431
- const profile = profiles[name];
432
- if (!profile) {
433
- throw new Error(`Profile "${name}" not found`);
434
- }
435
- visited.add(name);
436
- if (!profile.extends) {
437
- return { ...profile };
438
- }
439
- const parent = resolveProfileChain(profile.extends, profiles, visited, depth + 1);
440
- return {
441
- description: profile.description ?? parent.description,
442
- default: profile.default ?? parent.default,
443
- small: profile.small ?? parent.small,
444
- agents: {
445
- ...parent.agents,
446
- ...profile.agents
447
- }
448
- };
449
- }
450
-
451
- // src/utils/model-guidance.ts
452
- function generateModelGuidanceMarkdown(resolved) {
453
- if (!resolved.default && !resolved.small && Object.keys(resolved.agents).length === 0 && Object.keys(resolved.profiles).length === 0) {
454
- return null;
455
- }
456
- const lines = [];
457
- lines.push("# Model Configuration");
458
- lines.push("");
459
- lines.push("Use the following model preferences when working in this project.");
460
- lines.push("");
461
- if (resolved.default || resolved.small) {
462
- lines.push("## Default Models");
463
- lines.push("");
464
- if (resolved.default) {
465
- lines.push(`- **Primary model**: ${resolved.default}`);
466
- }
467
- if (resolved.small) {
468
- lines.push(`- **Lightweight tasks** (titles, summaries): ${resolved.small}`);
469
- }
470
- lines.push("");
471
- }
472
- const agentEntries = Object.entries(resolved.agents);
473
- if (agentEntries.length > 0) {
474
- lines.push("## Agent Model Assignments");
475
- lines.push("");
476
- lines.push("| Agent | Model | Temperature |");
477
- lines.push("| --- | --- | --- |");
478
- for (const [name, assignment] of agentEntries) {
479
- const temp = assignment.temperature !== undefined ? String(assignment.temperature) : "\u2014";
480
- lines.push(`| ${name} | ${assignment.model} | ${temp} |`);
481
- }
482
- lines.push("");
483
- }
484
- if (Object.keys(resolved.profiles).length > 0) {
485
- lines.push("## Available Profiles");
486
- lines.push("");
487
- lines.push("| Profile | Description | Default Model |");
488
- lines.push("| --- | --- | --- |");
489
- for (const [name, profile] of Object.entries(resolved.profiles)) {
490
- lines.push(`| ${name} | ${profile.description ?? "\u2014"} | ${profile.default ?? "\u2014"} |`);
491
- }
492
- lines.push("");
493
- }
494
- if (resolved.activeProfile) {
495
- lines.push(`**Active profile**: \`${resolved.activeProfile}\``);
496
- lines.push("");
497
- }
498
- if (resolved.routing.length > 0) {
499
- lines.push("## Task-Aware Routing");
500
- lines.push("");
501
- lines.push("Select the appropriate profile based on the task context:");
502
- lines.push("");
503
- lines.push("| Condition | Profile | Description |");
504
- lines.push("| --- | --- | --- |");
505
- for (const rule of resolved.routing) {
506
- const conditions = Object.entries(rule.when).map(([k, v]) => `${k}=${v}`).join(", ");
507
- const desc = rule.description ?? "\u2014";
508
- lines.push(`| ${conditions} | ${rule.use} | ${desc} |`);
509
- }
510
- lines.push("");
511
- lines.push("### Condition Reference");
512
- lines.push("");
513
- lines.push("- **complexity**: low | medium | high | critical");
514
- lines.push("- **urgency**: low | normal | high");
515
- lines.push("- **budget**: minimal | standard | premium");
516
- lines.push("- **contextWindowNeed**: small | medium | large | max");
517
- lines.push("- **toolUseIntensity**: none | light | heavy");
518
- lines.push("");
519
- }
520
- return lines.join(`
521
- `);
522
- }
523
-
524
- // src/targets/base-target.ts
525
- class BaseTarget {
526
- supportsFeature(feature) {
527
- return this.supportedFeatures.includes(feature);
528
- }
529
- getEffectiveFeatures(enabledFeatures) {
530
- return enabledFeatures.filter((f) => this.supportsFeature(f));
531
- }
532
- createResult(filesWritten = [], filesDeleted = [], warnings = []) {
533
- return {
534
- targetId: this.id,
535
- filesWritten,
536
- filesDeleted,
537
- warnings
538
- };
539
- }
540
- }
541
-
542
- // src/targets/claude-code.ts
543
- import { join as join4, resolve } from "path";
544
- var TARGET_ID = "claudecode";
545
-
546
- class ClaudeCodeTarget extends BaseTarget {
547
- id = TARGET_ID;
548
- name = "Claude Code";
549
- supportedFeatures = [
550
- "rules",
551
- "commands",
552
- "agents",
553
- "skills",
554
- "hooks",
555
- "mcp",
556
- "ignore",
557
- "models"
558
- ];
559
- generate(options) {
560
- const { projectRoot, baseDir, features, enabledFeatures, deleteExisting } = options;
561
- const root = resolve(projectRoot, baseDir);
562
- const effective = this.getEffectiveFeatures(enabledFeatures);
563
- const filesWritten = [];
564
- const filesDeleted = [];
565
- const warnings = [];
566
- const claudeDir = resolve(root, ".claude");
567
- if (effective.includes("rules")) {
568
- const rulesDir = resolve(claudeDir, "rules");
569
- if (deleteExisting) {
570
- removeIfExists(rulesDir);
571
- filesDeleted.push(rulesDir);
572
- }
573
- ensureDir(rulesDir);
574
- const rules = features.rules.filter((r) => ruleMatchesTarget(r, TARGET_ID));
575
- const rootRules = getRootRules(rules);
576
- const detailRules = getDetailRules(rules);
577
- if (rootRules.length > 0) {
578
- const claudeMd = rootRules.map((r) => r.content).join(`
579
-
580
- `);
581
- const filepath = resolve(claudeDir, "CLAUDE.md");
582
- writeGeneratedFile(filepath, claudeMd);
583
- filesWritten.push(filepath);
584
- }
585
- for (const rule of detailRules) {
586
- const filepath = join4(rulesDir, `${rule.name}.md`);
587
- writeGeneratedFile(filepath, rule.content);
588
- filesWritten.push(filepath);
589
- }
590
- }
591
- if (effective.includes("agents")) {
592
- const agentsDir = resolve(claudeDir, "agents");
593
- if (deleteExisting) {
594
- removeIfExists(agentsDir);
595
- filesDeleted.push(agentsDir);
596
- }
597
- ensureDir(agentsDir);
598
- const resolvedModels = features.models ? resolveModels(features.models, options.modelProfile, TARGET_ID) : null;
599
- const agents = features.agents.filter((a) => agentMatchesTarget(a, TARGET_ID));
600
- for (const agent of agents) {
601
- const filepath = join4(agentsDir, `${agent.name}.md`);
602
- const cc = agent.meta.claudecode ?? {};
603
- const modelsAgent = resolvedModels?.agents[agent.name];
604
- const agentModel = modelsAgent?.model ?? cc.model;
605
- let content = agent.content;
606
- if (agentModel) {
607
- content = `<!-- model: ${agentModel} -->
608
- ${content}`;
609
- }
610
- writeGeneratedFile(filepath, content);
611
- filesWritten.push(filepath);
612
- }
613
- }
614
- if (effective.includes("skills")) {
615
- const skillsDir = resolve(claudeDir, "skills");
616
- if (deleteExisting) {
617
- removeIfExists(skillsDir);
618
- filesDeleted.push(skillsDir);
619
- }
620
- ensureDir(skillsDir);
621
- const skills = features.skills.filter((s) => skillMatchesTarget(s, TARGET_ID));
622
- for (const skill of skills) {
623
- const skillSubDir = join4(skillsDir, skill.name);
624
- ensureDir(skillSubDir);
625
- const filepath = join4(skillSubDir, "SKILL.md");
626
- writeGeneratedFile(filepath, serializeSkill(skill));
627
- filesWritten.push(filepath);
628
- }
629
- }
630
- if (effective.includes("commands")) {
631
- const commandsDir = resolve(claudeDir, "commands");
632
- if (deleteExisting) {
633
- removeIfExists(commandsDir);
634
- filesDeleted.push(commandsDir);
635
- }
636
- ensureDir(commandsDir);
637
- const commands = features.commands.filter((c) => commandMatchesTarget(c, TARGET_ID));
638
- for (const cmd of commands) {
639
- const filepath = join4(commandsDir, `${cmd.name}.md`);
640
- writeGeneratedFile(filepath, cmd.content);
641
- filesWritten.push(filepath);
642
- }
643
- }
644
- if (effective.includes("models") && features.models) {
645
- const resolved = resolveModels(features.models, options.modelProfile, TARGET_ID);
646
- const guidance = generateModelGuidanceMarkdown(resolved);
647
- if (guidance) {
648
- const rulesDir = resolve(claudeDir, "rules");
649
- ensureDir(rulesDir);
650
- const filepath = join4(rulesDir, "model-config.md");
651
- writeGeneratedFile(filepath, guidance);
652
- filesWritten.push(filepath);
653
- }
654
- }
655
- if (effective.includes("hooks") || effective.includes("mcp") || effective.includes("ignore")) {
656
- const settings = buildClaudeSettings(options, effective);
657
- if (Object.keys(settings).length > 0) {
658
- const filepath = resolve(claudeDir, "settings.json");
659
- const existing = readJsonOrNull(filepath) ?? {};
660
- const merged = { ...existing, ...settings };
661
- writeGeneratedJson(filepath, merged, { header: false });
662
- filesWritten.push(filepath);
663
- }
664
- }
665
- return this.createResult(filesWritten, filesDeleted, warnings);
666
- }
667
- }
668
- function buildClaudeSettings(options, effective) {
669
- const settings = {};
670
- if (effective.includes("hooks")) {
671
- const allHookEntries = {};
672
- for (const hookSet of options.features.hooks) {
673
- const events = resolveHooksForTarget(hookSet, TARGET_ID);
674
- for (const [event, entries] of Object.entries(events)) {
675
- const pascalEvent = toPascalCase(event);
676
- if (!allHookEntries[pascalEvent]) {
677
- allHookEntries[pascalEvent] = [];
678
- }
679
- allHookEntries[pascalEvent].push(...entries.map((e) => ({
680
- type: e.type ?? "command",
681
- ...e.matcher ? { matcher: e.matcher } : {},
682
- command: e.command
683
- })));
684
- }
685
- }
686
- if (Object.keys(allHookEntries).length > 0) {
687
- settings.hooks = allHookEntries;
688
- }
689
- }
690
- if (effective.includes("mcp")) {
691
- const mcpEntries = Object.entries(options.features.mcpServers);
692
- if (mcpEntries.length > 0) {
693
- const mcpServers = {};
694
- for (const [name, entry] of mcpEntries) {
695
- if (entry.url) {
696
- mcpServers[name] = { url: entry.url };
697
- } else if (entry.command) {
698
- mcpServers[name] = {
699
- command: entry.command,
700
- ...entry.args ? { args: entry.args } : {},
701
- ...entry.env ? { env: entry.env } : {}
702
- };
703
- }
704
- }
705
- settings.mcpServers = mcpServers;
706
- }
707
- }
708
- return settings;
709
- }
710
- function toPascalCase(str) {
711
- return str.charAt(0).toUpperCase() + str.slice(1);
712
- }
713
- export {
714
- ClaudeCodeTarget
715
- };
7
+ `),_=C(j,"CLAUDE.md");H(_,O),J.push(_)}for(let O of z){let _=I(X,`${O.name}.md`);H(_,O.content),J.push(_)}}if(K.includes("agents")){let X=C(j,"agents");if(U)R(X),Y.push(X);w(X);let W=$.models?y($.models,q.modelProfile,G):null,L=$.agents.filter((z)=>d(z,G));for(let z of L){let O=I(X,`${z.name}.md`),_=z.meta.claudecode??{},E=W?.agents[z.name]?.model??_.model,M=z.content;if(E)M=`<!-- model: ${E} -->
8
+ ${M}`;H(O,M),J.push(O)}}if(K.includes("skills")){let X=C(j,"skills");if(U)R(X),Y.push(X);w(X);let W=$.skills.filter((L)=>e(L,G));for(let L of W){let z=I(X,L.name);w(z);let O=I(z,"SKILL.md");H(O,t(L)),J.push(O)}}if(K.includes("commands")){let X=C(j,"commands");if(U)R(X),Y.push(X);w(X);let W=$.commands.filter((L)=>n(L,G));for(let L of W){let z=I(X,`${L.name}.md`);H(z,L.content),J.push(z)}}if(K.includes("models")&&$.models){let X=y($.models,q.modelProfile,G),W=Zq(X);if(W){let L=C(j,"rules");w(L);let z=I(L,"model-config.md");H(z,W),J.push(z)}}if(K.includes("hooks")||K.includes("mcp")||K.includes("ignore")){let X=yq(q,K);if(Object.keys(X).length>0){let W=C(j,"settings.json"),z={...S(W)??{},...X};c(W,z,{header:!1}),J.push(W)}}return this.createResult(J,Y,x)}}function yq(q,Q){let Z={};if(Q.includes("hooks")){let $={};for(let B of q.features.hooks){let U=o(B,G);for(let[V,K]of Object.entries(U)){let J=Pq(V);if(!$[J])$[J]=[];$[J].push(...K.map((Y)=>({type:Y.type??"command",...Y.matcher?{matcher:Y.matcher}:{},command:Y.command})))}}if(Object.keys($).length>0)Z.hooks=$}if(Q.includes("mcp")){let $=Object.entries(q.features.mcpServers);if($.length>0){let B={};for(let[U,V]of $)if(V.url)B[U]={url:V.url};else if(V.command)B[U]={command:V.command,...V.args?{args:V.args}:{},...V.env?{env:V.env}:{}};Z.mcpServers=B}}return Z}function Pq(q){return q.charAt(0).toUpperCase()+q.slice(1)}export{Tq as ClaudeCodeTarget};