@el-j/magic-helix-core 4.0.0-beta.2 → 4.0.0-beta.3

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 (165) hide show
  1. package/dist/index-B88j4AyE.js +13 -0
  2. package/dist/index-B88j4AyE.js.map +1 -0
  3. package/dist/index-CY-pQbuu.cjs +2 -0
  4. package/dist/index-CY-pQbuu.cjs.map +1 -0
  5. package/dist/index.cjs +75 -1
  6. package/dist/index.cjs.map +1 -1
  7. package/dist/index.d.ts +0 -1
  8. package/dist/index.mjs +2234 -51
  9. package/dist/index.mjs.map +1 -1
  10. package/dist/pattern-combiner.d.ts +1 -1
  11. package/dist/plugin-loader.d.ts +2 -1
  12. package/package.json +4 -4
  13. package/dist/BasePlugin-6wv0hYJ9.js +0 -98
  14. package/dist/BasePlugin-6wv0hYJ9.js.map +0 -1
  15. package/dist/BasePlugin-odQJAKA-.cjs +0 -2
  16. package/dist/BasePlugin-odQJAKA-.cjs.map +0 -1
  17. package/dist/builtin-plugins/base/BasePlugin.d.ts +0 -69
  18. package/dist/builtin-plugins/cpp/index.d.ts +0 -46
  19. package/dist/builtin-plugins/csharp/index.d.ts +0 -20
  20. package/dist/builtin-plugins/go/index.d.ts +0 -23
  21. package/dist/builtin-plugins/index.d.ts +0 -16
  22. package/dist/builtin-plugins/java/index.d.ts +0 -22
  23. package/dist/builtin-plugins/nodejs/index.d.ts +0 -44
  24. package/dist/builtin-plugins/php/index.d.ts +0 -20
  25. package/dist/builtin-plugins/python/index.d.ts +0 -27
  26. package/dist/builtin-plugins/ruby/index.d.ts +0 -20
  27. package/dist/builtin-plugins/rust/index.d.ts +0 -53
  28. package/dist/builtin-plugins/swift/index.d.ts +0 -22
  29. package/dist/default_templates/angular/angular-core.md +0 -19
  30. package/dist/default_templates/architecture/codeowners.md +0 -123
  31. package/dist/default_templates/architecture/monorepo.md +0 -146
  32. package/dist/default_templates/architecture/nx.md +0 -122
  33. package/dist/default_templates/architecture/turborepo.md +0 -114
  34. package/dist/default_templates/ci/github-actions.md +0 -268
  35. package/dist/default_templates/ci/gitlab-ci.md +0 -330
  36. package/dist/default_templates/containers/docker-multistage.md +0 -120
  37. package/dist/default_templates/containers/kubernetes-deploy.md +0 -210
  38. package/dist/default_templates/devops/docker-compose.md +0 -111
  39. package/dist/default_templates/devops/docker-dockerfile.md +0 -94
  40. package/dist/default_templates/devops/github-actions.md +0 -160
  41. package/dist/default_templates/devops/gitlab-ci.md +0 -210
  42. package/dist/default_templates/dotnet/framework-aspnetcore.md +0 -205
  43. package/dist/default_templates/dotnet/framework-blazor.md +0 -271
  44. package/dist/default_templates/dotnet/lang-csharp.md +0 -162
  45. package/dist/default_templates/generic/lang-typescript.md +0 -57
  46. package/dist/default_templates/generic/state-redux.md +0 -21
  47. package/dist/default_templates/generic/state-rxjs.md +0 -6
  48. package/dist/default_templates/generic/style-mui.md +0 -23
  49. package/dist/default_templates/generic/style-tailwind.md +0 -76
  50. package/dist/default_templates/generic/test-cypress.md +0 -21
  51. package/dist/default_templates/generic/test-jest.md +0 -20
  52. package/dist/default_templates/generic/test-playwright.md +0 -21
  53. package/dist/default_templates/generic/test-vitest.md +0 -131
  54. package/dist/default_templates/go/lang-go.md +0 -571
  55. package/dist/default_templates/java/build-gradle.md +0 -102
  56. package/dist/default_templates/java/build-maven.md +0 -86
  57. package/dist/default_templates/java/framework-spring-boot.md +0 -179
  58. package/dist/default_templates/java/lang-java.md +0 -78
  59. package/dist/default_templates/java/lang-kotlin.md +0 -88
  60. package/dist/default_templates/meta/magic-helix-meta.md +0 -213
  61. package/dist/default_templates/meta/meta-debug.md +0 -459
  62. package/dist/default_templates/meta/meta-implement.md +0 -450
  63. package/dist/default_templates/meta/meta-roadmap.md +0 -265
  64. package/dist/default_templates/nestjs/nestjs-core.md +0 -7
  65. package/dist/default_templates/patterns/architecture/clean-architecture.md +0 -469
  66. package/dist/default_templates/patterns/architecture/dependency-injection.md +0 -517
  67. package/dist/default_templates/patterns/architecture/domain-driven-design.md +0 -621
  68. package/dist/default_templates/patterns/architecture/layered-architecture.md +0 -382
  69. package/dist/default_templates/patterns/architecture/repository-pattern.md +0 -408
  70. package/dist/default_templates/patterns/domain-expertise/nextjs-rules.md +0 -115
  71. package/dist/default_templates/patterns/domain-expertise/react-patterns.md +0 -181
  72. package/dist/default_templates/patterns/domain-expertise/server-components.md +0 -212
  73. package/dist/default_templates/patterns/domain-expertise/shadcn-ui.md +0 -52
  74. package/dist/default_templates/patterns/domain-expertise/tailwind-patterns.md +0 -52
  75. package/dist/default_templates/patterns/environment/container-awareness.md +0 -17
  76. package/dist/default_templates/patterns/environment/ide-features.md +0 -17
  77. package/dist/default_templates/patterns/environment/os-commands.md +0 -17
  78. package/dist/default_templates/patterns/organization/heading-hierarchy.md +0 -103
  79. package/dist/default_templates/patterns/organization/sequential-workflows.md +0 -102
  80. package/dist/default_templates/patterns/organization/xml-rule-groups.md +0 -64
  81. package/dist/default_templates/patterns/reasoning/agent-loop.md +0 -151
  82. package/dist/default_templates/patterns/reasoning/confirmation-gates.md +0 -141
  83. package/dist/default_templates/patterns/reasoning/dependency-analysis.md +0 -132
  84. package/dist/default_templates/patterns/reasoning/one-tool-per-iteration.md +0 -152
  85. package/dist/default_templates/patterns/reasoning/preview-before-action.md +0 -194
  86. package/dist/default_templates/patterns/reasoning/reflection-checkpoints.md +0 -166
  87. package/dist/default_templates/patterns/reasoning/result-verification.md +0 -157
  88. package/dist/default_templates/patterns/reasoning/subtask-breakdown.md +0 -131
  89. package/dist/default_templates/patterns/reasoning/thinking-tags.md +0 -100
  90. package/dist/default_templates/patterns/role-definition/capability-declarations.md +0 -72
  91. package/dist/default_templates/patterns/role-definition/expert-identity.md +0 -45
  92. package/dist/default_templates/patterns/role-definition/scope-boundaries.md +0 -61
  93. package/dist/default_templates/patterns/safety/code-safety-rules.md +0 -17
  94. package/dist/default_templates/patterns/safety/credential-handling.md +0 -17
  95. package/dist/default_templates/patterns/safety/destructive-warnings.md +0 -17
  96. package/dist/default_templates/patterns/safety/refusal-messages.md +0 -17
  97. package/dist/default_templates/patterns/tone/adaptive-tone.md +0 -17
  98. package/dist/default_templates/patterns/tone/concise-communication.md +0 -17
  99. package/dist/default_templates/patterns/tone/forbidden-phrases.md +0 -17
  100. package/dist/default_templates/patterns/tool-guidelines/function-schemas.md +0 -143
  101. package/dist/default_templates/patterns/tool-guidelines/parameter-examples.md +0 -137
  102. package/dist/default_templates/patterns/tool-guidelines/usage-policies.md +0 -105
  103. package/dist/default_templates/php/framework-laravel.md +0 -112
  104. package/dist/default_templates/php/lang-php.md +0 -94
  105. package/dist/default_templates/python/lang-python.md +0 -508
  106. package/dist/default_templates/react/react-core.md +0 -677
  107. package/dist/default_templates/react/react-zustand.md +0 -7
  108. package/dist/default_templates/ruby/framework-rails.md +0 -309
  109. package/dist/default_templates/ruby/framework-sinatra.md +0 -227
  110. package/dist/default_templates/ruby/lang-ruby.md +0 -216
  111. package/dist/default_templates/rust/lang-rust.md +0 -89
  112. package/dist/default_templates/swift/framework-vapor.md +0 -352
  113. package/dist/default_templates/swift/lang-swift.md +0 -291
  114. package/dist/default_templates/vue/style-primevue.md +0 -6
  115. package/dist/default_templates/vue/style-quasar.md +0 -22
  116. package/dist/default_templates/vue/vue-core.md +0 -108
  117. package/dist/default_templates/vue/vue-pinia.md +0 -5
  118. package/dist/index-0GK4RlUx.js +0 -1748
  119. package/dist/index-0GK4RlUx.js.map +0 -1
  120. package/dist/index-AkVwRl-r.js +0 -92
  121. package/dist/index-AkVwRl-r.js.map +0 -1
  122. package/dist/index-B6BeG1yT.cjs +0 -68
  123. package/dist/index-B6BeG1yT.cjs.map +0 -1
  124. package/dist/index-B8pyjKdF.js +0 -94
  125. package/dist/index-B8pyjKdF.js.map +0 -1
  126. package/dist/index-BQ6v041y.js +0 -13
  127. package/dist/index-BQ6v041y.js.map +0 -1
  128. package/dist/index-Baxb1vI_.js +0 -210
  129. package/dist/index-Baxb1vI_.js.map +0 -1
  130. package/dist/index-Bg8DD8ku.js +0 -216
  131. package/dist/index-Bg8DD8ku.js.map +0 -1
  132. package/dist/index-BqTqxCpG.cjs +0 -89
  133. package/dist/index-BqTqxCpG.cjs.map +0 -1
  134. package/dist/index-Bv4Q1Pr7.cjs +0 -33
  135. package/dist/index-Bv4Q1Pr7.cjs.map +0 -1
  136. package/dist/index-CN8J45Nc.cjs +0 -24
  137. package/dist/index-CN8J45Nc.cjs.map +0 -1
  138. package/dist/index-CPbv2Od1.js +0 -62
  139. package/dist/index-CPbv2Od1.js.map +0 -1
  140. package/dist/index-Cf-MC6Al.js +0 -63
  141. package/dist/index-Cf-MC6Al.js.map +0 -1
  142. package/dist/index-DDPXXXDy.cjs +0 -19
  143. package/dist/index-DDPXXXDy.cjs.map +0 -1
  144. package/dist/index-DO30AzDe.cjs +0 -19
  145. package/dist/index-DO30AzDe.cjs.map +0 -1
  146. package/dist/index-DkvW5yBY.js +0 -2249
  147. package/dist/index-DkvW5yBY.js.map +0 -1
  148. package/dist/index-Dn1ehjIj.cjs +0 -80
  149. package/dist/index-Dn1ehjIj.cjs.map +0 -1
  150. package/dist/index-DqHvgoXJ.cjs +0 -19
  151. package/dist/index-DqHvgoXJ.cjs.map +0 -1
  152. package/dist/index-K39pdw94.cjs +0 -31
  153. package/dist/index-K39pdw94.cjs.map +0 -1
  154. package/dist/index-OT2XAJkc.js +0 -117
  155. package/dist/index-OT2XAJkc.js.map +0 -1
  156. package/dist/index-TPAX4XKg.cjs +0 -30
  157. package/dist/index-TPAX4XKg.cjs.map +0 -1
  158. package/dist/index-WmVSB57y.js +0 -107
  159. package/dist/index-WmVSB57y.js.map +0 -1
  160. package/dist/index-mYXvc3Fs.js +0 -68
  161. package/dist/index-mYXvc3Fs.js.map +0 -1
  162. package/dist/index-nioXOg4m.cjs +0 -76
  163. package/dist/index-nioXOg4m.cjs.map +0 -1
  164. package/dist/index-okhY3fWD.cjs +0 -2
  165. package/dist/index-okhY3fWD.cjs.map +0 -1
package/dist/index.mjs CHANGED
@@ -1,54 +1,2237 @@
1
- import "node:path";
2
- import "node:url";
3
- import { e as i, B as n, C as r, g as l, D as o, G as g, a as u, b as P, I, M as T, P as y, x as p, y as c, u as d, c as m, R, Q as C, T as E, U as L, d as M, q as N, J as _, K as f, H as A, k as B, O, f as h, n as G, S as U, i as b, h as z, o as F, z as k, L as v, N as D, A as V, E as H, F as Q, j as S, l as j, m as w, p as x, w as q, r as J, t as K, s as W, V as X, v as Y } from "./index-DkvW5yBY.js";
1
+ import * as f from "node:path";
2
+ import C, { dirname as L } from "node:path";
3
+ import { fileURLToPath as M } from "node:url";
4
+ import * as p from "node:fs";
5
+ import S from "node:fs";
6
+ import P from "picocolors";
7
+ import { glob as O } from "glob";
8
+ function R(n) {
9
+ if (n === "src/**/*.ts")
10
+ return /^src\/.*\.ts$/;
11
+ if (n === "src/**/*.vue")
12
+ return /^src\/.*\.vue$/;
13
+ const e = n.replace(/\*\*/g, ".*").replace(/\*/g, "[^/]*");
14
+ return new RegExp(`^${e.replace(/[.+^${}()|[\]\\]/g, "\\$&")}$`);
15
+ }
16
+ function _(n, e) {
17
+ const t = R(e);
18
+ return n.some((s) => t.test(s));
19
+ }
20
+ function ye(n, e, t, s) {
21
+ const i = /* @__PURE__ */ new Set();
22
+ for (const [r, o] of Object.entries(n.dependencies))
23
+ e[r] && i.add(e[r]);
24
+ for (const r of n.configFiles)
25
+ t[r] && i.add(t[r]);
26
+ for (const r in s) {
27
+ const o = s[r];
28
+ _(n.projectFiles, r) && i.add(o);
29
+ }
30
+ return i;
31
+ }
32
+ const A = {
33
+ target: "github-copilot",
34
+ templateDirectory: "ai_templates",
35
+ // User's custom template dir
36
+ outputDirectory: ".github/instructions",
37
+ // Default output dir
38
+ aiRefinement: {
39
+ quality: "standard",
40
+ contextLevel: "balanced",
41
+ outputFormat: "markdown",
42
+ tokenBudget: 4e3,
43
+ includeExamples: !0,
44
+ includeBestPractices: !0
45
+ },
46
+ dependencyTagMap: {
47
+ // Frameworks
48
+ vue: "framework-vue",
49
+ react: "framework-react",
50
+ "@angular/core": "framework-angular",
51
+ "@nestjs/core": "framework-nestjs",
52
+ // Styling
53
+ tailwindcss: "style-tailwind",
54
+ primevue: "style-primevue",
55
+ "@mui/material": "style-mui",
56
+ quasar: "style-quasar",
57
+ // Testing
58
+ vitest: "test-vitest",
59
+ jest: "test-jest",
60
+ cypress: "test-cypress",
61
+ playwright: "test-playwright",
62
+ // State
63
+ rxjs: "state-rxjs",
64
+ pinia: "state-pinia",
65
+ redux: "state-redux",
66
+ zustand: "state-zustand"
67
+ },
68
+ configFileTagMap: {
69
+ // Detect key configs
70
+ "tailwind.config.js": "style-tailwind",
71
+ "tailwind.config.ts": "style-tailwind",
72
+ "vite.config.ts": "build-vite",
73
+ "vite.config.js": "build-vite",
74
+ "tsconfig.json": "lang-typescript"
75
+ },
76
+ fileGlobTagMap: {
77
+ // Detect file types
78
+ "src/**/*.vue": "framework-vue",
79
+ "src/**/*.tsx": "framework-react",
80
+ "src/**/*.go": "lang-go",
81
+ "src/**/*.py": "lang-python"
82
+ },
83
+ tagTemplateMap: {
84
+ // Vue Projects
85
+ "framework-vue": [
86
+ { template: "vue/vue-core.md", suffix: "vue.instructions.md" }
87
+ ],
88
+ "state-pinia": [
89
+ { template: "vue/vue-pinia.md", suffix: "vue-pinia.instructions.md" }
90
+ ],
91
+ "style-primevue": [
92
+ {
93
+ template: "vue/style-primevue.md",
94
+ suffix: "vue-primevue.instructions.md"
95
+ }
96
+ ],
97
+ "style-quasar": [
98
+ { template: "vue/style-quasar.md", suffix: "vue-quasar.instructions.md" }
99
+ ],
100
+ // React Projects
101
+ "framework-react": [
102
+ { template: "react/react-core.md", suffix: "react.instructions.md" }
103
+ ],
104
+ "state-zustand": [
105
+ {
106
+ template: "react/react-zustand.md",
107
+ suffix: "react-zustand.instructions.md"
108
+ }
109
+ ],
110
+ // NestJS Projects
111
+ "framework-nestjs": [
112
+ { template: "nestjs/nestjs-core.md", suffix: "nestjs.instructions.md" }
113
+ ],
114
+ // Angular Projects
115
+ "framework-angular": [
116
+ {
117
+ template: "angular/angular-core.md",
118
+ suffix: "angular.instructions.md"
119
+ }
120
+ ],
121
+ // Generic
122
+ "style-tailwind": [
123
+ {
124
+ template: "generic/style-tailwind.md",
125
+ suffix: "tailwind.instructions.md"
126
+ }
127
+ ],
128
+ "style-mui": [
129
+ { template: "generic/style-mui.md", suffix: "mui.instructions.md" }
130
+ ],
131
+ "test-vitest": [
132
+ { template: "generic/test-vitest.md", suffix: "vitest.instructions.md" }
133
+ ],
134
+ "test-jest": [
135
+ { template: "generic/test-jest.md", suffix: "jest.instructions.md" }
136
+ ],
137
+ "test-cypress": [
138
+ {
139
+ template: "generic/test-cypress.md",
140
+ suffix: "cypress.instructions.md"
141
+ }
142
+ ],
143
+ "test-playwright": [
144
+ {
145
+ template: "generic/test-playwright.md",
146
+ suffix: "playwright.instructions.md"
147
+ }
148
+ ],
149
+ "lang-typescript": [
150
+ {
151
+ template: "generic/lang-typescript.md",
152
+ suffix: "typescript.instructions.md"
153
+ }
154
+ ],
155
+ "lang-python": [
156
+ { template: "python/lang-python.md", suffix: "python.instructions.md" }
157
+ ],
158
+ "lang-go": [{ template: "go/lang-go.md", suffix: "go.instructions.md" }],
159
+ "state-rxjs": [
160
+ { template: "generic/state-rxjs.md", suffix: "rxjs.instructions.md" }
161
+ ],
162
+ "state-redux": [
163
+ { template: "generic/state-redux.md", suffix: "redux.instructions.md" }
164
+ ]
165
+ }
166
+ }, T = {
167
+ quality: "standard",
168
+ contextLevel: "balanced",
169
+ outputFormat: "markdown",
170
+ tokenBudget: 4e3,
171
+ includeExamples: !0,
172
+ includeBestPractices: !0
173
+ };
174
+ function we(n, e) {
175
+ const t = { ...T, ...e };
176
+ let s = n;
177
+ return s = z(s, t.outputFormat), s = W(s, t.quality), s = N(s, t.contextLevel), t.includeExamples || (s = G(s)), t.includeBestPractices || (s = B(s)), s = q(s, t.tokenBudget), s;
178
+ }
179
+ function W(n, e) {
180
+ switch (e) {
181
+ case "basic":
182
+ return n.split(/\n(?=##? )/).filter((s) => {
183
+ s.toLowerCase();
184
+ const i = s.split(`
185
+ `)[0].toLowerCase();
186
+ return i.includes("# ") || // Keep top-level headers
187
+ i.includes("overview") || i.includes("basic") || i.includes("essential");
188
+ }).join(`
189
+ `);
190
+ case "comprehensive":
191
+ return n;
192
+ default:
193
+ return n.split(/\n(?=##? )/).filter((s) => {
194
+ const i = s.split(`
195
+ `)[0].toLowerCase();
196
+ return !i.includes("advanced") && !i.includes("deep dive");
197
+ }).join(`
198
+ `);
199
+ }
200
+ }
201
+ function N(n, e) {
202
+ switch (e) {
203
+ case "minimal":
204
+ return n.split(/\n(?=##? )/).filter((s) => {
205
+ const i = s.split(`
206
+ `)[0].toLowerCase();
207
+ return !i.includes("background") && !i.includes("why ") && !i.includes("explanation") && !i.includes("deep dive");
208
+ }).join(`
209
+ `);
210
+ case "extensive":
211
+ return n;
212
+ default:
213
+ return n.split(`
214
+ `).filter((t) => t.startsWith("#") || t.startsWith("-") || t.startsWith("*") || t.match(/^\d+\./) || // numbered lists
215
+ t.startsWith("```") || t.startsWith(" ") || t.trim().length === 0 || t.trim().length < 200).join(`
216
+ `);
217
+ }
218
+ }
219
+ function z(n, e) {
220
+ switch (e) {
221
+ case "structured":
222
+ return n.replace(/^### /gm, "#### ").replace(/^## /gm, "### ").replace(/^# /gm, "## ");
223
+ // Demote h1 to h2
224
+ case "conversational":
225
+ return n.replace(/^- (.+)$/gm, (t, s) => `${s}.`).replace(/\n{3,}/g, `
226
+
227
+ `);
228
+ case "code-focused": {
229
+ const t = n.split(`
230
+ `);
231
+ let s = !1;
232
+ return t.filter((i) => i.startsWith("```") ? (s = !s, !0) : s || i.startsWith("#") || i.trim().length === 0 ? !0 : i.match(/^[^.]+\./)).join(`
233
+ `);
234
+ }
235
+ default:
236
+ return n;
237
+ }
238
+ }
239
+ function G(n) {
240
+ let e = "", t = !1, s = !1;
241
+ for (const i of n.split(`
242
+ `)) {
243
+ if (i.startsWith("```")) {
244
+ t = !t;
245
+ continue;
246
+ }
247
+ if (!t) {
248
+ if (i.match(/^##+ .*example/i)) {
249
+ s = !0;
250
+ continue;
251
+ }
252
+ i.startsWith("##") && (s = !1);
253
+ }
254
+ !t && !s && (e += `${i}
255
+ `);
256
+ }
257
+ return e;
258
+ }
259
+ function B(n) {
260
+ return n.split(`
261
+ `).filter((e) => {
262
+ const t = e.toLowerCase();
263
+ return !(t.match(/^##+ .*best practice/i) || t.match(/^##+ .*recommendation/i) || t.match(/^##+ .*tip/i));
264
+ }).join(`
265
+ `);
266
+ }
267
+ function q(n, e) {
268
+ const t = e * 4;
269
+ if (n.length <= t) return n;
270
+ const s = n.substring(0, t), i = s.lastIndexOf(`
271
+ ## `);
272
+ return i > t * 0.7 ? `${s.substring(0, i)}
273
+
274
+ <!-- Content truncated to fit token budget -->` : `${s}
275
+
276
+ <!-- Content truncated to fit token budget -->`;
277
+ }
278
+ function ve(n) {
279
+ return Math.ceil(n.length / 4);
280
+ }
281
+ const x = "magic-helix.config.json", H = ["ai-aligner.config.json"];
282
+ function Pe(n) {
283
+ const t = (n ? [f.resolve(process.cwd(), n)] : [
284
+ f.resolve(process.cwd(), x),
285
+ ...H.map(
286
+ (s) => f.resolve(process.cwd(), s)
287
+ )
288
+ ]).find((s, i) => {
289
+ const r = p.existsSync(s);
290
+ return !n && r && i > 0 && console.warn(
291
+ P.yellow(
292
+ ` Detected legacy config file ${f.basename(s)}. Please rename it to ${x}.`
293
+ )
294
+ ), r;
295
+ });
296
+ if (!t)
297
+ return console.log(
298
+ P.gray(" No user config file found. Using built-in conventions only.")
299
+ ), {};
300
+ try {
301
+ return console.log(
302
+ P.blue(" User config file found. Merging with built-in conventions.")
303
+ ), JSON.parse(p.readFileSync(t, "utf-8"));
304
+ } catch (s) {
305
+ return console.error(
306
+ P.red(`❌ Error parsing config file: ${s.message}`)
307
+ ), console.warn(
308
+ P.yellow(
309
+ " Please fix the JSON or remove the file. Using built-in conventions only."
310
+ )
311
+ ), {};
312
+ }
313
+ }
314
+ function be(n) {
315
+ const e = A, t = U(
316
+ n.outputDirectory ?? e.outputDirectory
317
+ );
318
+ return {
319
+ target: n.target || e.target,
320
+ templateDirectory: n.templateDirectory ?? e.templateDirectory,
321
+ outputDirectory: t,
322
+ dependencyTagMap: {
323
+ ...e.dependencyTagMap,
324
+ ...n.dependencyTagMap || {}
325
+ },
326
+ configFileTagMap: {
327
+ ...e.configFileTagMap,
328
+ ...n.configFileTagMap || {}
329
+ },
330
+ fileGlobTagMap: {
331
+ ...e.fileGlobTagMap,
332
+ ...n.fileGlobTagMap || {}
333
+ },
334
+ tagTemplateMap: {
335
+ ...e.tagTemplateMap,
336
+ ...n.tagTemplateMap || {}
337
+ },
338
+ aiRefinement: {
339
+ ...T,
340
+ ...n.aiRefinement || {}
341
+ }
342
+ };
343
+ }
344
+ function U(n) {
345
+ const e = n.trim();
346
+ if (e.endsWith(".github/instruction") || /\binstruction\/?$/.test(e)) {
347
+ const t = e.replace(/instruction\/?$/, "instructions");
348
+ return console.warn(
349
+ P.yellow(
350
+ ` Normalized outputDirectory from "${e}" to "${t}". Using ".github/instructions" as the default convention.`
351
+ )
352
+ ), t;
353
+ }
354
+ return e;
355
+ }
356
+ class j {
357
+ format(e, t, s) {
358
+ return e;
359
+ }
360
+ getFileExtension() {
361
+ return ".md";
362
+ }
363
+ getFrontmatter(e, t) {
364
+ return `---
365
+ applyTo: "${e}"
366
+ ---
367
+
368
+ `;
369
+ }
370
+ }
371
+ class J {
372
+ format(e, t, s) {
373
+ return e.replace(/- \*\*([^*]+)\*\*/g, "- **$1** (important)");
374
+ }
375
+ getFileExtension() {
376
+ return ".md";
377
+ }
378
+ getFrontmatter(e, t) {
379
+ return `---
380
+ applyTo: "${e}"
381
+ assistant: claude
382
+ ---
383
+
384
+ `;
385
+ }
386
+ }
387
+ class V {
388
+ format(e, t, s) {
389
+ return e.replace(/- \*\*ALWAYS\*\*/g, "- 🔴").replace(/- \*\*NEVER\*\*/g, "- ❌");
390
+ }
391
+ getFileExtension() {
392
+ return ".md";
393
+ }
394
+ getFrontmatter(e, t) {
395
+ return `---
396
+ applyTo: "${e}"
397
+ context: chat
398
+ ---
399
+
400
+ `;
401
+ }
402
+ }
403
+ class Y {
404
+ format(e, t, s) {
405
+ return e;
406
+ }
407
+ getFileExtension() {
408
+ return ".md";
409
+ }
410
+ getFrontmatter(e, t) {
411
+ return `---
412
+ applyTo: "${e}"
413
+ ---
414
+
415
+ `;
416
+ }
417
+ }
418
+ function ke(n) {
419
+ switch (n) {
420
+ case "github-copilot":
421
+ return new j();
422
+ case "claude":
423
+ return new J();
424
+ case "copilot-chat":
425
+ return new V();
426
+ case "generic":
427
+ return new Y();
428
+ default:
429
+ return new j();
430
+ }
431
+ }
432
+ const v = {};
433
+ function Q() {
434
+ const n = require.resolve("@el-j/magic-helix-plugins"), e = v.dirname(n), t = v.join(e, "patterns"), s = /* @__PURE__ */ new Map(), i = [
435
+ "role-definition",
436
+ "organization",
437
+ "tool-guidelines",
438
+ "reasoning",
439
+ "domain-expertise",
440
+ "safety",
441
+ "tone",
442
+ "environment"
443
+ ];
444
+ for (const r of i) {
445
+ const o = v.join(t, r);
446
+ if (!v.existsSync(o)) continue;
447
+ const a = v.readdirSync(o).filter((c) => c.endsWith(".md"));
448
+ for (const c of a) {
449
+ const l = c.replace(".md", ""), u = v.readFileSync(v.join(o, c), "utf-8");
450
+ s.set(l, {
451
+ name: l,
452
+ category: r,
453
+ content: u,
454
+ priority: X(r)
455
+ });
456
+ }
457
+ }
458
+ return s;
459
+ }
460
+ function X(n) {
461
+ return {
462
+ "role-definition": 1,
463
+ organization: 2,
464
+ "tool-guidelines": 3,
465
+ reasoning: 4,
466
+ "domain-expertise": 5,
467
+ environment: 6,
468
+ tone: 7,
469
+ safety: 8
470
+ // Safety always highest priority (never overridden)
471
+ }[n];
472
+ }
473
+ function K(n, e) {
474
+ const t = [], s = n.get("expert-identity"), i = n.get("scope-boundaries");
475
+ s && t.push(s), i && t.push(i);
476
+ const r = n.get("heading-hierarchy");
477
+ r && t.push(r);
478
+ const o = n.get("function-schemas"), a = n.get("usage-policies");
479
+ if (o && t.push(o), a && t.push(a), e.framework === "react" || e.framework === "vue") {
480
+ const u = n.get("react-patterns");
481
+ u && t.push(u);
482
+ }
483
+ if (e.libraries) {
484
+ if (e.libraries.includes("tailwind")) {
485
+ const u = n.get("tailwind-patterns");
486
+ u && t.push(u);
487
+ }
488
+ if (e.libraries.includes("shadcn-ui")) {
489
+ const u = n.get("shadcn-ui");
490
+ u && t.push(u);
491
+ }
492
+ }
493
+ if (e.aiModel === "claude") {
494
+ const u = n.get("thinking-tags"), d = n.get("concise-communication");
495
+ u && t.push(u), d && t.push(d);
496
+ }
497
+ if (e.tone === "concise") {
498
+ const u = n.get("concise-communication"), d = n.get("forbidden-phrases");
499
+ u && t.push(u), d && t.push(d);
500
+ }
501
+ if (e.environment === "vscode") {
502
+ const u = n.get("ide-features");
503
+ u && t.push(u);
504
+ }
505
+ const c = n.get("refusal-messages"), l = n.get("destructive-warnings");
506
+ if (c && t.push(c), l && t.push(l), e.includePatterns)
507
+ for (const u of e.includePatterns) {
508
+ const d = n.get(u);
509
+ d && !t.includes(d) && t.push(d);
510
+ }
511
+ return e.excludePatterns ? t.filter((u) => !e.excludePatterns?.includes(u.name)) : t;
512
+ }
513
+ function Z(n) {
514
+ const e = n.sort((g, m) => g.priority - m.priority), t = [], s = /* @__PURE__ */ new Map();
515
+ for (const g of e) {
516
+ s.has(g.category) || s.set(g.category, []);
517
+ const m = s.get(g.category);
518
+ m && m.push(g);
519
+ }
520
+ t.push(`# AI Agent Instructions
521
+ `);
522
+ const i = s.get("role-definition");
523
+ if (i) {
524
+ t.push(`## Role & Identity
525
+ `);
526
+ for (const g of i)
527
+ t.push(w(g.content));
528
+ }
529
+ const r = s.get("organization");
530
+ if (r) {
531
+ t.push(`## Instruction Structure
532
+ `);
533
+ for (const g of r)
534
+ t.push(w(g.content));
535
+ }
536
+ const o = s.get("tool-guidelines");
537
+ if (o) {
538
+ t.push(`## Tool Usage Guidelines
539
+ `);
540
+ for (const g of o)
541
+ t.push(w(g.content));
542
+ }
543
+ const a = s.get("reasoning");
544
+ if (a) {
545
+ t.push(`## Reasoning & Execution Patterns
546
+ `);
547
+ for (const g of a)
548
+ t.push(w(g.content));
549
+ }
550
+ const c = s.get("domain-expertise");
551
+ if (c) {
552
+ t.push(`## Domain-Specific Guidelines
553
+ `);
554
+ for (const g of c)
555
+ t.push(w(g.content));
556
+ }
557
+ const l = s.get("environment");
558
+ if (l) {
559
+ t.push(`## Environment Context
560
+ `);
561
+ for (const g of l)
562
+ t.push(w(g.content));
563
+ }
564
+ const u = s.get("tone");
565
+ if (u) {
566
+ t.push(`## Communication Style
567
+ `);
568
+ for (const g of u)
569
+ t.push(w(g.content));
570
+ }
571
+ const d = s.get("safety");
572
+ if (d) {
573
+ t.push(`## Safety & Refusal Protocols
574
+ `);
575
+ for (const g of d)
576
+ t.push(w(g.content));
577
+ }
578
+ return t.join(`
579
+
580
+ `);
581
+ }
582
+ function w(n) {
583
+ let e = n.replace(/^# .+ Pattern\n+/, "");
584
+ const t = e.match(
585
+ /## Examples\n([\s\S]+?)(?=\n## |\n---|Z)/
586
+ );
587
+ return t ? t[1].trim() : (e = e.replace(/## Purpose\n.+?\n\n/, ""), e = e.replace(/## Template\n[\s\S]+?(?=\n## |$)/, ""), e = e.replace(/## Best Practices\n[\s\S]+$/, ""), e.trim());
588
+ }
589
+ function ee(n) {
590
+ const e = Q(), t = K(e, n);
591
+ return Z(t);
592
+ }
593
+ const te = [
594
+ // Role Definition (Critical)
595
+ {
596
+ name: "Expert Identity",
597
+ weight: 1,
598
+ required: !0,
599
+ check: (n) => /you are (an?|the) .+? (expert|specialist|assistant)/i.test(n)
600
+ },
601
+ {
602
+ name: "Capability Declarations",
603
+ weight: 0.8,
604
+ required: !0,
605
+ check: (n) => /you (can|excel at|have expertise in)/i.test(n)
606
+ },
607
+ {
608
+ name: "Scope Boundaries",
609
+ weight: 0.7,
610
+ required: !1,
611
+ check: (n) => /you (will not|won't|cannot|must not)/i.test(n)
612
+ },
613
+ // Organization Structure (Important)
614
+ {
615
+ name: "Clear Headings",
616
+ weight: 0.9,
617
+ required: !0,
618
+ check: (n) => (n.match(/^##? /gm) || []).length >= 3
619
+ },
620
+ {
621
+ name: "Structured Sections",
622
+ weight: 0.8,
623
+ required: !1,
624
+ check: (n) => /<rules>|<thinking>|```xml/i.test(n) || (n.match(/^###? /gm) || []).length >= 5
625
+ },
626
+ // Tool Guidelines (Critical for agentic AI)
627
+ {
628
+ name: "Tool Documentation",
629
+ weight: 1,
630
+ required: !0,
631
+ check: (n) => /tool|function|command|api/i.test(n) && /parameter|argument|input/i.test(n)
632
+ },
633
+ {
634
+ name: "Tool Usage Policies",
635
+ weight: 0.9,
636
+ required: !0,
637
+ check: (n) => /when to use|when not to use|prefer|avoid/i.test(n)
638
+ },
639
+ {
640
+ name: "Concrete Examples",
641
+ weight: 0.8,
642
+ required: !0,
643
+ check: (n) => (n.match(/```[\s\S]+?```/g) || []).length >= 2
644
+ },
645
+ // Reasoning Patterns (Important)
646
+ {
647
+ name: "Step-by-Step Process",
648
+ weight: 0.7,
649
+ required: !1,
650
+ check: (n) => /^\d+\. /gm.test(n) || /first|then|next|finally/i.test(n)
651
+ },
652
+ {
653
+ name: "Thinking/Planning Phase",
654
+ weight: 0.6,
655
+ required: !1,
656
+ check: (n) => /<thinking>|before .+?, (think|plan|analyze)/i.test(n)
657
+ },
658
+ {
659
+ name: "Confirmation Gates",
660
+ weight: 0.8,
661
+ required: !1,
662
+ check: (n) => /confirmation|preview|show .+? before|ask .+? before/i.test(n)
663
+ },
664
+ // Safety Protocols (Critical)
665
+ {
666
+ name: "Refusal Guidelines",
667
+ weight: 1,
668
+ required: !0,
669
+ check: (n) => /refuse|decline|cannot (assist|help) with|inappropriate/i.test(n)
670
+ },
671
+ {
672
+ name: "Destructive Action Warnings",
673
+ weight: 0.9,
674
+ required: !1,
675
+ check: (n) => /warning|caution|delete|remove|overwrite/i.test(n)
676
+ },
677
+ // Tone & Style (Moderate)
678
+ {
679
+ name: "Communication Style",
680
+ weight: 0.5,
681
+ required: !1,
682
+ check: (n) => /concise|brief|direct|friendly|professional|tone/i.test(n)
683
+ },
684
+ {
685
+ name: "Forbidden Phrases",
686
+ weight: 0.4,
687
+ required: !1,
688
+ check: (n) => /do not (say|use|start with)|avoid (saying|phrases like)/i.test(n)
689
+ }
690
+ ];
691
+ function $(n) {
692
+ const e = te.map((d) => ({
693
+ element: d,
694
+ passed: d.check(n)
695
+ })), t = e.filter(
696
+ (d) => ["Clear Headings", "Structured Sections"].includes(d.element.name)
697
+ ), s = F(t), i = e.filter(
698
+ (d) => ["Concrete Examples", "Communication Style", "Forbidden Phrases"].includes(
699
+ d.element.name
700
+ )
701
+ ), r = F(i), o = e.filter((d) => d.element.required), a = F(o), c = Math.round(
702
+ s * 0.3 + r * 0.2 + a * 0.5
703
+ ), l = e.filter((d) => d.element.required && !d.passed).map((d) => d.element.name), u = se(e, n);
704
+ return {
705
+ overallScore: c,
706
+ structureScore: s,
707
+ clarityScore: r,
708
+ completenessScore: a,
709
+ recommendations: u,
710
+ missingElements: l
711
+ };
712
+ }
713
+ function F(n) {
714
+ if (n.length === 0) return 100;
715
+ const e = n.reduce((s, i) => s + i.element.weight, 0), t = n.filter((s) => s.passed).reduce((s, i) => s + i.element.weight, 0);
716
+ return Math.round(t / e * 100);
717
+ }
718
+ function se(n, e) {
719
+ const t = [], s = n.filter(
720
+ (a) => a.element.required && !a.passed
721
+ );
722
+ s.length > 0 && t.push(
723
+ `Add ${s.length} critical element(s): ${s.map((a) => a.element.name).join(", ")}`
724
+ ), n.find((a) => a.element.name === "Expert Identity")?.passed || t.push(
725
+ 'Add expert identity: Start with "You are an expert [domain] specialist..."'
726
+ ), n.find((a) => a.element.name === "Tool Documentation")?.passed || t.push(
727
+ "Add tool documentation: Include function schemas with parameters and examples"
728
+ ), n.find((a) => a.element.name === "Refusal Guidelines")?.passed || t.push(
729
+ "Add refusal guidelines: Specify what requests should be declined and how"
730
+ );
731
+ const i = (e.match(/```[\s\S]+?```/g) || []).length;
732
+ i < 3 && t.push(
733
+ `Add more code examples: Currently ${i}, aim for at least 5 concrete examples`
734
+ ), /✅|❌|good:|bad:/i.test(e) || t.push(
735
+ "Add ✅/❌ comparisons: Show good vs bad examples for clarity"
736
+ );
737
+ const o = e.split(/\s+/).length;
738
+ return o < 500 ? t.push(
739
+ `Instructions may be too brief (${o} words). Aim for 1000-3000 words for comprehensive guidance.`
740
+ ) : o > 5e3 && t.push(
741
+ `Instructions may be too long (${o} words). Consider breaking into sections or modules.`
742
+ ), n.find((a) => a.element.name === "Confirmation Gates")?.passed || t.push(
743
+ "Consider adding confirmation gates for destructive operations (delete, overwrite)"
744
+ ), t.length === 0 && t.push(
745
+ "Instructions meet quality standards. Consider A/B testing variants for optimization."
746
+ ), t;
747
+ }
748
+ function Ce(n, e = 70) {
749
+ return $(n).overallScore >= e;
750
+ }
751
+ function ne(n) {
752
+ return n >= 90 ? "A" : n >= 80 ? "B" : n >= 70 ? "C" : n >= 60 ? "D" : "F";
753
+ }
754
+ function Fe(n) {
755
+ const e = [];
756
+ if (e.push(`=== Instruction Quality Report ===
757
+ `), e.push(
758
+ `Overall Score: ${n.overallScore}/100 (${ne(n.overallScore)})
759
+ `
760
+ ), e.push(` Structure: ${n.structureScore}/100`), e.push(` Clarity: ${n.clarityScore}/100`), e.push(` Completeness: ${n.completenessScore}/100
761
+ `), n.missingElements.length > 0) {
762
+ e.push("❌ Missing Critical Elements:");
763
+ for (const t of n.missingElements)
764
+ e.push(` - ${t}`);
765
+ e.push("");
766
+ }
767
+ if (n.recommendations.length > 0) {
768
+ e.push("💡 Recommendations:");
769
+ for (const t of n.recommendations)
770
+ e.push(` - ${t}`);
771
+ e.push("");
772
+ }
773
+ return e.join(`
774
+ `);
775
+ }
776
+ let ie = class {
777
+ constructor() {
778
+ this.plugins = /* @__PURE__ */ new Map();
779
+ }
780
+ /**
781
+ * Register a new detection plugin.
782
+ * @param plugin The plugin to register
783
+ */
784
+ register(e) {
785
+ this.plugins.has(e.name) && console.warn(
786
+ `Plugin "${e.name}" is already registered. Overwriting.`
787
+ ), this.plugins.set(e.name, e);
788
+ }
789
+ /**
790
+ * Unregister a plugin by name.
791
+ * @param name Plugin name to unregister
792
+ */
793
+ unregister(e) {
794
+ return this.plugins.delete(e);
795
+ }
796
+ /**
797
+ * Get a plugin by name.
798
+ * @param name Plugin name
799
+ */
800
+ get(e) {
801
+ return this.plugins.get(e);
802
+ }
803
+ /**
804
+ * Get all registered plugins.
805
+ */
806
+ getAll() {
807
+ return Array.from(this.plugins.values());
808
+ }
809
+ /**
810
+ * Clear all registered plugins.
811
+ */
812
+ clear() {
813
+ this.plugins.clear();
814
+ }
815
+ /**
816
+ * Get the number of registered plugins.
817
+ */
818
+ get size() {
819
+ return this.plugins.size;
820
+ }
821
+ };
822
+ const h = new ie();
823
+ class re {
824
+ constructor(e, t = /* @__PURE__ */ new Map()) {
825
+ this.analysisData = e, this.fileContentCache = t;
826
+ }
827
+ get files() {
828
+ return this.analysisData.projectFiles;
829
+ }
830
+ get dependencies() {
831
+ return this.analysisData.dependencies;
832
+ }
833
+ get configFiles() {
834
+ return this.analysisData.configFiles;
835
+ }
836
+ getTextFile(e) {
837
+ return this.fileContentCache.has(e) && this.fileContentCache.get(e) || null;
838
+ }
839
+ hasFile(e) {
840
+ return this.analysisData.projectFiles.includes(e) || this.analysisData.configFiles.includes(e);
841
+ }
842
+ matchesPattern(e) {
843
+ const t = this.globToRegex(e);
844
+ return this.analysisData.projectFiles.some((s) => t.test(s));
845
+ }
846
+ globToRegex(e) {
847
+ const t = e.replace(/\\/g, "\\\\").replace(/\*\*/g, "§DOUBLESTAR§").replace(/\*/g, "[^/]*").replace(/§DOUBLESTAR§/g, ".*").replace(/\./g, "\\.");
848
+ return new RegExp(`^${t}$`);
849
+ }
850
+ }
851
+ async function xe(n, e) {
852
+ const t = /* @__PURE__ */ new Set(), s = [], i = /* @__PURE__ */ new Map(), r = /* @__PURE__ */ new Map();
853
+ if (e)
854
+ for (const c of n.configFiles) {
855
+ const l = e(c);
856
+ l && r.set(c, l);
857
+ }
858
+ const o = new re(n, r);
859
+ if (e) {
860
+ const c = o.getTextFile.bind(o);
861
+ o.getTextFile = (l) => {
862
+ const u = c(l);
863
+ return u !== null ? u : e(l);
864
+ };
865
+ }
866
+ const a = h.getAll();
867
+ for (const c of a)
868
+ try {
869
+ const l = await Promise.resolve(c.detect(o));
870
+ if (l.detected) {
871
+ if (l.tags)
872
+ for (const d of l.tags)
873
+ t.add(d);
874
+ l.metadata && i.set(c.name, l.metadata);
875
+ const u = await Promise.resolve(
876
+ c.generateInstructions(o, l.metadata)
877
+ );
878
+ s.push(...u);
879
+ }
880
+ } catch (l) {
881
+ console.error(`Error running plugin ${c.name}:`, l);
882
+ }
883
+ return {
884
+ tags: t,
885
+ instructions: s,
886
+ metadata: i
887
+ };
888
+ }
889
+ function je() {
890
+ import("./index-B88j4AyE.js").then((n) => {
891
+ h.register(new n.GolangPlugin()), h.register(new n.PythonPlugin()), h.register(new n.RustPlugin()), h.register(new n.PHPPlugin()), h.register(new n.DockerPlugin()), h.register(new n.GitHubActionsPlugin()), h.register(new n.GitLabCIPlugin()), h.register(new n.MonorepoPlugin()), h.register(new n.CodeOwnersPlugin());
892
+ });
893
+ }
894
+ class Ee {
895
+ constructor() {
896
+ this.name = "codeowners", this.description = "Detects CODEOWNERS file and provides code ownership instructions", this.version = "1.0.0";
897
+ }
898
+ detect(e) {
899
+ if (!(e.hasFile(".github/CODEOWNERS") || e.hasFile("CODEOWNERS") || e.hasFile("docs/CODEOWNERS")))
900
+ return { detected: !1 };
901
+ const s = {
902
+ hasCodeOwners: !0
903
+ };
904
+ let i = "";
905
+ e.hasFile(".github/CODEOWNERS") ? i = ".github/CODEOWNERS" : e.hasFile("CODEOWNERS") ? i = "CODEOWNERS" : i = "docs/CODEOWNERS", s.location = i;
906
+ const r = e.getTextFile(i);
907
+ if (r) {
908
+ const a = r.split(`
909
+ `).filter(
910
+ (l) => l.trim() && !l.trim().startsWith("#")
911
+ );
912
+ s.ruleCount = a.length;
913
+ const c = /* @__PURE__ */ new Set();
914
+ for (const l of a) {
915
+ const u = l.trim().split(/\s+/);
916
+ if (u.length > 1)
917
+ for (const d of u.slice(1))
918
+ d.startsWith("@") && c.add(d);
919
+ }
920
+ s.ownerCount = c.size, s.owners = Array.from(c).slice(0, 10);
921
+ }
922
+ return {
923
+ detected: !0,
924
+ tags: ["architecture-codeowners"],
925
+ metadata: s
926
+ };
927
+ }
928
+ generateInstructions(e, t) {
929
+ return [
930
+ {
931
+ template: "architecture/codeowners.md",
932
+ suffix: "codeowners.md",
933
+ targetFiles: [".github/CODEOWNERS", "CODEOWNERS", "docs/CODEOWNERS"]
934
+ }
935
+ ];
936
+ }
937
+ }
938
+ class Te {
939
+ constructor() {
940
+ this.name = "docker", this.description = "Detects Docker usage and provides Docker-specific instructions", this.version = "1.0.0";
941
+ }
942
+ detect(e) {
943
+ const t = e.hasFile("Dockerfile") || e.matchesPattern("**/Dockerfile"), s = e.hasFile("docker-compose.yml") || e.hasFile("docker-compose.yaml") || e.hasFile("compose.yml") || e.hasFile("compose.yaml"), i = e.hasFile(".dockerignore");
944
+ if (!(t || s))
945
+ return { detected: !1 };
946
+ const o = {
947
+ hasDockerfile: t,
948
+ hasDockerCompose: s,
949
+ hasDockerignore: i
950
+ };
951
+ if (t) {
952
+ const a = e.getTextFile("Dockerfile");
953
+ if (a) {
954
+ const c = (a.match(/FROM\s+\S+\s+AS\s+\S+/gi) || []).length;
955
+ c > 0 && (o.multiStage = !0, o.stageCount = c);
956
+ }
957
+ }
958
+ return {
959
+ detected: !0,
960
+ tags: ["devops-docker"],
961
+ metadata: o
962
+ };
963
+ }
964
+ generateInstructions(e, t) {
965
+ const s = [];
966
+ return t?.hasDockerfile && s.push({
967
+ template: "devops/docker-dockerfile.md",
968
+ suffix: "docker-dockerfile.md",
969
+ targetFiles: ["**/Dockerfile"]
970
+ }), t?.hasDockerCompose && s.push({
971
+ template: "devops/docker-compose.md",
972
+ suffix: "docker-compose.md",
973
+ targetFiles: [
974
+ "**/docker-compose.yml",
975
+ "**/docker-compose.yaml",
976
+ "**/compose.yml",
977
+ "**/compose.yaml"
978
+ ]
979
+ }), s;
980
+ }
981
+ }
982
+ class $e {
983
+ constructor() {
984
+ this.name = "github-actions", this.description = "Detects GitHub Actions workflows and provides CI/CD-specific instructions", this.version = "1.0.0";
985
+ }
986
+ detect(e) {
987
+ if (!(e.matchesPattern(".github/workflows/*.yml") || e.matchesPattern(".github/workflows/*.yaml")))
988
+ return { detected: !1 };
989
+ const s = {
990
+ hasWorkflows: !0
991
+ }, i = e.files.filter(
992
+ (r) => r.startsWith(".github/workflows/") && (r.endsWith(".yml") || r.endsWith(".yaml"))
993
+ );
994
+ if (i.length > 0) {
995
+ s.workflowCount = i.length, s.workflowFiles = i;
996
+ const r = e.getTextFile(i[0]);
997
+ r && (s.hasMatrixStrategy = r.includes("strategy:") && r.includes("matrix:"), s.hasCaching = r.includes("actions/cache") || r.includes("cache:"), s.hasArtifacts = r.includes("actions/upload-artifact") || r.includes("actions/download-artifact"));
998
+ }
999
+ return {
1000
+ detected: !0,
1001
+ tags: ["devops-github-actions", "ci-cd"],
1002
+ metadata: s
1003
+ };
1004
+ }
1005
+ generateInstructions(e, t) {
1006
+ return [
1007
+ {
1008
+ template: "devops/github-actions.md",
1009
+ suffix: "github-actions.md",
1010
+ targetFiles: [".github/workflows/*.yml", ".github/workflows/*.yaml"]
1011
+ }
1012
+ ];
1013
+ }
1014
+ }
1015
+ class Ie {
1016
+ constructor() {
1017
+ this.name = "gitlab-ci", this.description = "Detects GitLab CI/CD configuration and provides CI/CD-specific instructions", this.version = "1.0.0";
1018
+ }
1019
+ detect(e) {
1020
+ if (!e.hasFile(".gitlab-ci.yml"))
1021
+ return { detected: !1 };
1022
+ const s = {
1023
+ hasGitLabCI: !0
1024
+ }, i = e.getTextFile(".gitlab-ci.yml");
1025
+ if (i) {
1026
+ i.match(/^stages:\s*$/m) && (s.hasStages = !0), s.hasCache = i.includes("cache:"), s.hasArtifacts = i.includes("artifacts:"), s.hasServices = i.includes("services:"), s.hasIncludes = i.includes("include:");
1027
+ const o = i.match(
1028
+ /^stages:\s*\n((?: {2}- .+\n?)+)/m
1029
+ );
1030
+ if (o) {
1031
+ const a = o[1].match(/- (.+)/g)?.map((c) => c.replace(/- /, "").trim());
1032
+ a && (s.stages = a);
1033
+ }
1034
+ }
1035
+ return {
1036
+ detected: !0,
1037
+ tags: ["devops-gitlab-ci", "ci-cd"],
1038
+ metadata: s
1039
+ };
1040
+ }
1041
+ generateInstructions(e, t) {
1042
+ return [
1043
+ {
1044
+ template: "devops/gitlab-ci.md",
1045
+ suffix: "gitlab-ci.md",
1046
+ targetFiles: [".gitlab-ci.yml"]
1047
+ }
1048
+ ];
1049
+ }
1050
+ }
1051
+ class De {
1052
+ constructor() {
1053
+ this.name = "golang", this.description = "Detects Go (Golang) projects and provides Go-specific instructions", this.version = "1.0.0";
1054
+ }
1055
+ detect(e) {
1056
+ const t = e.hasFile("go.mod"), s = e.matchesPattern("**/*.go");
1057
+ if (!(t || s))
1058
+ return { detected: !1 };
1059
+ const r = e.getTextFile("go.mod"), o = {
1060
+ hasGoMod: t,
1061
+ hasGoFiles: s
1062
+ };
1063
+ if (r) {
1064
+ const a = r.match(/^module\s+(.+)$/m);
1065
+ a && (o.moduleName = a[1].trim());
1066
+ const c = r.match(/^go\s+([\d.]+)$/m);
1067
+ c && (o.goVersion = c[1]);
1068
+ }
1069
+ return {
1070
+ detected: !0,
1071
+ tags: ["lang-go"],
1072
+ metadata: o
1073
+ };
1074
+ }
1075
+ generateInstructions(e, t) {
1076
+ return [
1077
+ {
1078
+ template: "go/lang-go.md",
1079
+ suffix: "lang-go.md",
1080
+ targetFiles: ["**/*.go"]
1081
+ }
1082
+ ];
1083
+ }
1084
+ }
1085
+ class Le {
1086
+ constructor() {
1087
+ this.name = "monorepo", this.description = "Detects monorepo structures and provides monorepo-specific instructions", this.version = "1.0.0";
1088
+ }
1089
+ detect(e) {
1090
+ const t = e.hasFile("turbo.json"), s = e.hasFile("nx.json"), i = e.hasFile("pnpm-workspace.yaml"), r = e.hasFile("lerna.json"), o = e.hasFile("package.json") && e.getTextFile("package.json")?.includes('"workspaces"');
1091
+ if (e.hasFile("package.json") && e.getTextFile("package.json")?.includes('"workspaces"'), !(t || s || i || r || o))
1092
+ return { detected: !1 };
1093
+ const c = {
1094
+ hasTurbo: t,
1095
+ hasNx: s,
1096
+ hasPnpmWorkspace: i,
1097
+ hasLerna: r,
1098
+ hasYarnWorkspaces: o
1099
+ };
1100
+ if (t) {
1101
+ c.tool = "turborepo";
1102
+ const d = e.getTextFile("turbo.json");
1103
+ d && (c.hasPipeline = d.includes('"pipeline"'));
1104
+ } else s ? c.tool = "nx" : i ? c.tool = "pnpm" : r ? c.tool = "lerna" : c.tool = "npm/yarn workspaces";
1105
+ const l = ["packages/*/package.json", "apps/*/package.json"], u = e.files.filter(
1106
+ (d) => l.some((g) => new RegExp(g.replace(/\*/g, "[^/]+")).test(d))
1107
+ );
1108
+ return u.length > 0 && (c.packageCount = u.length), {
1109
+ detected: !0,
1110
+ tags: ["architecture-monorepo"],
1111
+ metadata: c
1112
+ };
1113
+ }
1114
+ generateInstructions(e, t) {
1115
+ const s = [
1116
+ {
1117
+ template: "architecture/monorepo.md",
1118
+ suffix: "monorepo.md",
1119
+ targetFiles: [
1120
+ "package.json",
1121
+ "turbo.json",
1122
+ "nx.json",
1123
+ "pnpm-workspace.yaml",
1124
+ "lerna.json"
1125
+ ]
1126
+ }
1127
+ ];
1128
+ return t?.tool === "turborepo" ? s.push({
1129
+ template: "architecture/turborepo.md",
1130
+ suffix: "turborepo.md",
1131
+ targetFiles: ["turbo.json"]
1132
+ }) : t?.tool === "nx" && s.push({
1133
+ template: "architecture/nx.md",
1134
+ suffix: "nx.md",
1135
+ targetFiles: ["nx.json", "workspace.json"]
1136
+ }), s;
1137
+ }
1138
+ }
1139
+ class Me {
1140
+ constructor() {
1141
+ this.name = "php", this.description = "Detects PHP projects and provides PHP-specific instructions", this.version = "1.0.0";
1142
+ }
1143
+ detect(e) {
1144
+ const t = e.hasFile("composer.json"), s = e.hasFile("composer.lock"), i = e.matchesPattern("**/*.php");
1145
+ if (!(t || i))
1146
+ return { detected: !1 };
1147
+ const o = {
1148
+ hasComposerJson: t,
1149
+ hasComposerLock: s,
1150
+ hasPhpFiles: i
1151
+ }, a = e.getTextFile("composer.json");
1152
+ if (a) {
1153
+ a.includes('"laravel/framework"') ? (o.framework = "laravel", o.hasArtisan = e.hasFile("artisan")) : a.includes('"symfony/') && (o.framework = "symfony");
1154
+ const c = a.match(/"name"\s*:\s*"([^"]+)"/);
1155
+ c && (o.projectName = c[1]);
1156
+ }
1157
+ return {
1158
+ detected: !0,
1159
+ tags: ["lang-php"],
1160
+ metadata: o
1161
+ };
1162
+ }
1163
+ generateInstructions(e, t) {
1164
+ const s = [
1165
+ {
1166
+ template: "php/lang-php.md",
1167
+ suffix: "lang-php.md",
1168
+ targetFiles: ["**/*.php"]
1169
+ }
1170
+ ];
1171
+ return t?.framework === "laravel" && s.push({
1172
+ template: "php/framework-laravel.md",
1173
+ suffix: "framework-laravel.md",
1174
+ targetFiles: ["**/*.php"]
1175
+ }), s;
1176
+ }
1177
+ }
1178
+ class Oe {
1179
+ constructor() {
1180
+ this.name = "python", this.description = "Detects Python projects and provides Python-specific instructions", this.version = "1.0.0";
1181
+ }
1182
+ detect(e) {
1183
+ const t = e.hasFile("pyproject.toml"), s = e.hasFile("requirements.txt"), i = e.hasFile("setup.py"), r = e.hasFile("Pipfile"), o = e.matchesPattern("**/*.py");
1184
+ if (!(t || s || i || r || o))
1185
+ return { detected: !1 };
1186
+ const c = {
1187
+ hasPyprojectToml: t,
1188
+ hasRequirementsTxt: s,
1189
+ hasSetupPy: i,
1190
+ hasPipfile: r,
1191
+ hasPyFiles: o
1192
+ };
1193
+ if (t) {
1194
+ const d = e.getTextFile("pyproject.toml");
1195
+ d && (d.includes("[tool.poetry]") ? c.packageManager = "poetry" : d.includes("[build-system]") && (c.packageManager = "pip"));
1196
+ } else r ? c.packageManager = "pipenv" : s && (c.packageManager = "pip");
1197
+ const l = [], u = e.getTextFile("requirements.txt");
1198
+ return u && (u.includes("django") && l.push("django"), u.includes("flask") && l.push("flask"), u.includes("fastapi") && l.push("fastapi")), l.length > 0 && (c.frameworks = l), {
1199
+ detected: !0,
1200
+ tags: ["lang-python"],
1201
+ metadata: c
1202
+ };
1203
+ }
1204
+ generateInstructions(e, t) {
1205
+ return [
1206
+ {
1207
+ template: "python/lang-python.md",
1208
+ suffix: "lang-python.md",
1209
+ targetFiles: ["**/*.py"]
1210
+ }
1211
+ ];
1212
+ }
1213
+ }
1214
+ class Re {
1215
+ constructor() {
1216
+ this.name = "rust", this.description = "Detects Rust projects and provides Rust-specific instructions", this.version = "1.0.0";
1217
+ }
1218
+ detect(e) {
1219
+ const t = e.hasFile("Cargo.toml"), s = e.hasFile("Cargo.lock"), i = e.matchesPattern("**/*.rs");
1220
+ if (!(t || i))
1221
+ return { detected: !1 };
1222
+ const o = e.getTextFile("Cargo.toml"), a = {
1223
+ hasCargoToml: t,
1224
+ hasCargoLock: s,
1225
+ hasRustFiles: i
1226
+ };
1227
+ if (o) {
1228
+ const c = o.match(
1229
+ /^\[package\][\s\S]*?^name\s*=\s*"(.+?)"/m
1230
+ );
1231
+ c && (a.packageName = c[1]);
1232
+ const l = o.match(/^edition\s*=\s*"(\d+)"/m);
1233
+ l && (a.edition = l[1]), o.includes("[workspace]") && (a.isWorkspace = !0);
1234
+ }
1235
+ return {
1236
+ detected: !0,
1237
+ tags: ["lang-rust"],
1238
+ metadata: a
1239
+ };
1240
+ }
1241
+ generateInstructions(e, t) {
1242
+ return [
1243
+ {
1244
+ template: "rust/lang-rust.md",
1245
+ suffix: "lang-rust.md",
1246
+ targetFiles: ["**/*.rs"]
1247
+ }
1248
+ ];
1249
+ }
1250
+ }
1251
+ class E {
1252
+ constructor(e = {}) {
1253
+ this.loadedPlugins = /* @__PURE__ */ new Map(), this.loadErrors = [], this.verbose = e.verbose ?? !1;
1254
+ }
1255
+ /**
1256
+ * Load built-in plugins from the @el-j/magic-helix-plugins package
1257
+ * Loads all exported plugin classes from the package
1258
+ */
1259
+ async loadBuiltinPlugins(e) {
1260
+ const t = [];
1261
+ try {
1262
+ const s = await this.tryImport("@el-j/magic-helix-plugins");
1263
+ if (!s)
1264
+ return t;
1265
+ const i = Object.entries(s).filter(([r, o]) => r !== "BasePlugin" && typeof o == "function" && r.endsWith("Plugin")).map(([r, o]) => o);
1266
+ for (const r of i) {
1267
+ const o = new r();
1268
+ if (e && !e.includes(o.name))
1269
+ continue;
1270
+ const a = {
1271
+ plugin: o,
1272
+ source: {
1273
+ type: "npm",
1274
+ identifier: o.name,
1275
+ packageName: "@el-j/magic-helix-plugins"
1276
+ },
1277
+ loadTime: 0
1278
+ };
1279
+ this.loadedPlugins.set(o.name, a), t.push(a), this.log(
1280
+ `Loaded built-in plugin: ${o.displayName} (${o.name})`
1281
+ );
1282
+ }
1283
+ } catch (s) {
1284
+ this.handleLoadError(
1285
+ {
1286
+ type: "npm",
1287
+ identifier: "@el-j/magic-helix-plugins",
1288
+ packageName: "@el-j/magic-helix-plugins"
1289
+ },
1290
+ s
1291
+ );
1292
+ }
1293
+ return t;
1294
+ }
1295
+ /**
1296
+ * Load a plugin from an npm package
1297
+ */
1298
+ async loadNpmPlugin(e) {
1299
+ try {
1300
+ const t = Date.now(), s = await this.tryImport(e);
1301
+ if (!s)
1302
+ throw new Error(`Package "${e}" not found`);
1303
+ const i = s.default || s.Plugin || s;
1304
+ if (typeof i != "function")
1305
+ throw new Error(
1306
+ `Package "${e}" does not export a valid plugin class`
1307
+ );
1308
+ const r = new i(), o = Date.now() - t;
1309
+ this.validatePlugin(r);
1310
+ const a = {
1311
+ plugin: r,
1312
+ source: {
1313
+ type: "npm",
1314
+ identifier: e,
1315
+ packageName: e
1316
+ },
1317
+ loadTime: o
1318
+ };
1319
+ return this.loadedPlugins.set(r.name, a), this.log(
1320
+ `✓ Loaded npm plugin: ${r.displayName} from ${e} (${o}ms)`
1321
+ ), a;
1322
+ } catch (t) {
1323
+ return this.handleLoadError(
1324
+ {
1325
+ type: "npm",
1326
+ identifier: e,
1327
+ packageName: e
1328
+ },
1329
+ t
1330
+ ), null;
1331
+ }
1332
+ }
1333
+ /**
1334
+ * Load a plugin from a local file path
1335
+ */
1336
+ async loadLocalPlugin(e) {
1337
+ try {
1338
+ const t = f.resolve(e);
1339
+ if (!p.existsSync(t))
1340
+ throw new Error(`Plugin file not found: ${t}`);
1341
+ const s = Date.now(), i = await import(t), r = Date.now() - s, o = i.default || i.Plugin || i;
1342
+ if (typeof o != "function")
1343
+ throw new Error(
1344
+ `File "${e}" does not export a valid plugin class`
1345
+ );
1346
+ const a = new o();
1347
+ this.validatePlugin(a);
1348
+ const c = {
1349
+ plugin: a,
1350
+ source: {
1351
+ type: "local",
1352
+ identifier: e,
1353
+ path: t
1354
+ },
1355
+ loadTime: r
1356
+ };
1357
+ return this.loadedPlugins.set(a.name, c), this.log(
1358
+ `✓ Loaded local plugin: ${a.displayName} from ${e} (${r}ms)`
1359
+ ), c;
1360
+ } catch (t) {
1361
+ return this.handleLoadError(
1362
+ {
1363
+ type: "local",
1364
+ identifier: e,
1365
+ path: e
1366
+ },
1367
+ t
1368
+ ), null;
1369
+ }
1370
+ }
1371
+ /**
1372
+ * Load plugins from workspace directory
1373
+ */
1374
+ async loadWorkspacePlugins(e, t) {
1375
+ const s = [], i = t || [
1376
+ ".magic-helix/plugins/**/*.js",
1377
+ ".magic-helix/plugins/**/*.mjs"
1378
+ ];
1379
+ try {
1380
+ const { glob: r } = await import("glob");
1381
+ for (const o of i) {
1382
+ const a = await r(o, {
1383
+ cwd: e,
1384
+ absolute: !0
1385
+ });
1386
+ for (const c of a) {
1387
+ const l = await this.loadLocalPlugin(c);
1388
+ l && (l.source.type = "workspace", s.push(l));
1389
+ }
1390
+ }
1391
+ } catch (r) {
1392
+ this.logWarning(
1393
+ `Error loading workspace plugins: ${r.message}`
1394
+ );
1395
+ }
1396
+ return s;
1397
+ }
1398
+ /**
1399
+ * Get a loaded plugin by name
1400
+ */
1401
+ getPlugin(e) {
1402
+ return this.loadedPlugins.get(e)?.plugin;
1403
+ }
1404
+ /**
1405
+ * Get all loaded plugins sorted by priority (highest first)
1406
+ */
1407
+ getAllPlugins() {
1408
+ return Array.from(this.loadedPlugins.values()).map((e) => e.plugin).sort((e, t) => t.priority - e.priority);
1409
+ }
1410
+ /**
1411
+ * Get plugins filtered by name
1412
+ */
1413
+ getPluginsByNames(e) {
1414
+ return e.map((t) => this.getPlugin(t)).filter((t) => t !== void 0);
1415
+ }
1416
+ /**
1417
+ * Detect project using all loaded plugins
1418
+ * Returns the first successful detection from highest priority plugin
1419
+ */
1420
+ async detectProject(e) {
1421
+ const t = this.getAllPlugins();
1422
+ for (const s of t)
1423
+ try {
1424
+ this.log(`Trying plugin: ${s.displayName}`);
1425
+ const i = await s.detect(e);
1426
+ if (i)
1427
+ return this.log(
1428
+ `✓ Detected ${i.language} project with ${s.displayName}`
1429
+ ), { metadata: i, plugin: s };
1430
+ } catch (i) {
1431
+ this.logWarning(
1432
+ `Plugin ${s.name} detection failed: ${i.message}`
1433
+ );
1434
+ }
1435
+ return null;
1436
+ }
1437
+ /**
1438
+ * Recursively scan directories for project manifests
1439
+ */
1440
+ async scanForProjects(e, t = 5) {
1441
+ const s = /* @__PURE__ */ new Set(), i = /* @__PURE__ */ new Set(), r = [
1442
+ "package.json",
1443
+ "Cargo.toml",
1444
+ "go.mod",
1445
+ "go.sum",
1446
+ "setup.py",
1447
+ "pyproject.toml",
1448
+ "requirements.txt",
1449
+ "pom.xml",
1450
+ "build.gradle",
1451
+ "build.gradle.kts",
1452
+ "Package.swift",
1453
+ "Gemfile",
1454
+ "composer.json",
1455
+ "CMakeLists.txt",
1456
+ "Makefile",
1457
+ "platformio.ini"
1458
+ ], o = /* @__PURE__ */ new Set([
1459
+ "node_modules",
1460
+ "target",
1461
+ "dist",
1462
+ "build",
1463
+ ".git",
1464
+ ".svn",
1465
+ ".hg",
1466
+ "vendor",
1467
+ "__pycache__",
1468
+ ".venv",
1469
+ "venv",
1470
+ "env",
1471
+ ".cargo",
1472
+ ".gradle"
1473
+ ]), a = async (c, l) => {
1474
+ if (l > t) return;
1475
+ const u = f.normalize(c);
1476
+ if (!i.has(u)) {
1477
+ i.add(u);
1478
+ try {
1479
+ const d = await p.promises.readdir(c, {
1480
+ withFileTypes: !0
1481
+ });
1482
+ let g = !1;
1483
+ for (const m of d)
1484
+ if (!m.isDirectory() && r.includes(m.name)) {
1485
+ s.add(c), g = !0;
1486
+ break;
1487
+ }
1488
+ for (const m of d)
1489
+ if (m.isDirectory() && !o.has(m.name)) {
1490
+ const D = f.join(c, m.name);
1491
+ await a(D, l + 1);
1492
+ }
1493
+ } catch {
1494
+ return;
1495
+ }
1496
+ }
1497
+ };
1498
+ return await a(e, 0), Array.from(s).sort();
1499
+ }
1500
+ /**
1501
+ * Detect all projects in a directory (for monorepo support)
1502
+ * Enhanced version that recursively scans for ALL project types
1503
+ */
1504
+ async detectAllProjects(e) {
1505
+ const t = [], s = /* @__PURE__ */ new Set(), i = this.getAllPlugins();
1506
+ for (const r of i)
1507
+ try {
1508
+ const o = await r.detect(e);
1509
+ if (o && (s.add(o.projectPath), t.push({ metadata: o, plugin: r }), o.workspaceMembers && o.workspaceMembers.length > 0))
1510
+ for (const a of o.workspaceMembers) {
1511
+ const c = f.resolve(e, a);
1512
+ if (!s.has(c)) {
1513
+ const l = await this.detectProject(c);
1514
+ l && (s.add(l.metadata.projectPath), t.push(l));
1515
+ }
1516
+ }
1517
+ } catch (o) {
1518
+ this.logWarning(
1519
+ `Plugin ${r.name} failed: ${o.message}`
1520
+ );
1521
+ }
1522
+ try {
1523
+ const r = await this.scanForProjects(e);
1524
+ for (const o of r)
1525
+ if (!s.has(o)) {
1526
+ const a = await this.detectProject(o);
1527
+ a && (s.add(a.metadata.projectPath), t.push(a));
1528
+ }
1529
+ } catch (r) {
1530
+ this.logWarning(`Recursive scan failed: ${r.message}`);
1531
+ }
1532
+ return t;
1533
+ }
1534
+ /**
1535
+ * Get load errors
1536
+ */
1537
+ getLoadErrors() {
1538
+ return [...this.loadErrors];
1539
+ }
1540
+ /**
1541
+ * Clear all loaded plugins
1542
+ */
1543
+ clear() {
1544
+ this.loadedPlugins.clear(), this.loadErrors = [];
1545
+ }
1546
+ /**
1547
+ * Get statistics about loaded plugins
1548
+ */
1549
+ getStats() {
1550
+ const e = Array.from(this.loadedPlugins.values()), t = {};
1551
+ for (const s of e)
1552
+ t[s.source.type] = (t[s.source.type] || 0) + 1;
1553
+ return {
1554
+ totalLoaded: e.length,
1555
+ totalErrors: this.loadErrors.length,
1556
+ averageLoadTime: e.length > 0 ? e.reduce((s, i) => s + i.loadTime, 0) / e.length : 0,
1557
+ byType: t
1558
+ };
1559
+ }
1560
+ // Private helper methods
1561
+ validatePlugin(e) {
1562
+ if (!e || typeof e != "object")
1563
+ throw new Error("Plugin must be an object");
1564
+ const t = e;
1565
+ if (!t.name || typeof t.name != "string")
1566
+ throw new Error('Plugin must have a "name" property');
1567
+ if (!t.displayName || typeof t.displayName != "string")
1568
+ throw new Error('Plugin must have a "displayName" property');
1569
+ if (!t.version || typeof t.version != "string")
1570
+ throw new Error('Plugin must have a "version" property');
1571
+ if (typeof t.priority != "number")
1572
+ throw new Error('Plugin must have a "priority" property');
1573
+ if (typeof t.detect != "function")
1574
+ throw new Error('Plugin must implement "detect" method');
1575
+ if (typeof t.getTemplates != "function")
1576
+ throw new Error('Plugin must implement "getTemplates" method');
1577
+ }
1578
+ async tryImport(e) {
1579
+ try {
1580
+ return await import(e);
1581
+ } catch {
1582
+ return null;
1583
+ }
1584
+ }
1585
+ handleLoadError(e, t) {
1586
+ this.loadErrors.push({
1587
+ source: e,
1588
+ error: t,
1589
+ timestamp: /* @__PURE__ */ new Date()
1590
+ }), this.logWarning(
1591
+ `Failed to load plugin "${e.identifier}": ${t.message}`
1592
+ );
1593
+ }
1594
+ log(e) {
1595
+ this.verbose && console.log(`[PluginLoader] ${e}`);
1596
+ }
1597
+ logWarning(e) {
1598
+ this.verbose && console.warn(`[PluginLoader] ⚠️ ${e}`);
1599
+ }
1600
+ }
1601
+ const y = class y {
1602
+ constructor() {
1603
+ this.initialized = !1, this.loader = new E({ verbose: !1 }), this.config = {};
1604
+ }
1605
+ /**
1606
+ * Get the singleton instance
1607
+ */
1608
+ static getInstance() {
1609
+ return y.instance || (y.instance = new y()), y.instance;
1610
+ }
1611
+ /**
1612
+ * Initialize the registry with configuration
1613
+ */
1614
+ async initialize(e = {}) {
1615
+ if (!this.initialized && (this.config = e, this.loader = new E({ verbose: e.verbose }), await this.loadConfiguredPlugins(e.plugins), this.initialized = !0, e.verbose)) {
1616
+ const t = this.loader.getStats();
1617
+ console.log(
1618
+ `[PluginRegistry] Initialized with ${t.totalLoaded} plugins`
1619
+ ), console.log(
1620
+ `[PluginRegistry] Load time: ${t.averageLoadTime.toFixed(2)}ms avg`
1621
+ );
1622
+ }
1623
+ }
1624
+ /**
1625
+ * Reset the registry (useful for testing)
1626
+ */
1627
+ reset() {
1628
+ this.loader.clear(), this.initialized = !1, this.config = {};
1629
+ }
1630
+ /**
1631
+ * Ensure the registry is initialized before use
1632
+ */
1633
+ async ensureInitialized() {
1634
+ this.initialized || await this.initialize();
1635
+ }
1636
+ /**
1637
+ * Get a plugin by name
1638
+ */
1639
+ async getPlugin(e) {
1640
+ return await this.ensureInitialized(), this.loader.getPlugin(e);
1641
+ }
1642
+ /**
1643
+ * Get all loaded plugins
1644
+ */
1645
+ async getAllPlugins() {
1646
+ return await this.ensureInitialized(), this.loader.getAllPlugins();
1647
+ }
1648
+ /**
1649
+ * Detect the project type at the given path
1650
+ */
1651
+ async detectProject(e) {
1652
+ return await this.ensureInitialized(), this.loader.detectProject(e);
1653
+ }
1654
+ /**
1655
+ * Detect all projects in a directory (monorepo support)
1656
+ */
1657
+ async detectAllProjects(e) {
1658
+ return await this.ensureInitialized(), this.loader.detectAllProjects(e);
1659
+ }
1660
+ /**
1661
+ * Get the best plugin for a detected project language
1662
+ */
1663
+ async getPluginForLanguage(e) {
1664
+ await this.ensureInitialized();
1665
+ const t = this.loader.getAllPlugins();
1666
+ let s = t.find((i) => i.name === e.toLowerCase());
1667
+ return s || (s = t.find(
1668
+ (i) => i.displayName.toLowerCase() === e.toLowerCase()
1669
+ ), s) || (s = t.find(
1670
+ (i) => i.displayName.toLowerCase().includes(e.toLowerCase()) || e.toLowerCase().includes(i.name)
1671
+ )), s;
1672
+ }
1673
+ /**
1674
+ * Load a custom plugin at runtime
1675
+ */
1676
+ async loadPlugin(e) {
1677
+ return await this.ensureInitialized(), (e.type === "npm" ? await this.loader.loadNpmPlugin(e.path) : await this.loader.loadLocalPlugin(e.path))?.plugin ?? null;
1678
+ }
1679
+ /**
1680
+ * Get registry statistics
1681
+ */
1682
+ async getStats() {
1683
+ await this.ensureInitialized();
1684
+ const e = this.loader.getStats();
1685
+ return {
1686
+ totalPlugins: e.totalLoaded,
1687
+ loadErrors: e.totalErrors,
1688
+ averageLoadTime: e.averageLoadTime,
1689
+ pluginsByType: e.byType
1690
+ };
1691
+ }
1692
+ /**
1693
+ * Get load errors
1694
+ */
1695
+ async getLoadErrors() {
1696
+ return await this.ensureInitialized(), this.loader.getLoadErrors().map((e) => ({
1697
+ source: e.source.identifier,
1698
+ error: e.error.message,
1699
+ timestamp: e.timestamp
1700
+ }));
1701
+ }
1702
+ /**
1703
+ * Get plugin system statistics
1704
+ */
1705
+ getStatistics() {
1706
+ return this.loader.getStats();
1707
+ }
1708
+ // Private helper methods
1709
+ /**
1710
+ * Load plugins based on configuration
1711
+ */
1712
+ async loadConfiguredPlugins(e = {}) {
1713
+ const {
1714
+ builtin: t = [],
1715
+ npm: s = [],
1716
+ local: i = [],
1717
+ workspace: r = [],
1718
+ disabled: o = []
1719
+ } = e;
1720
+ if (t.length > 0) {
1721
+ const a = t.filter(
1722
+ (c) => !o.includes(c)
1723
+ );
1724
+ await this.loader.loadBuiltinPlugins(a);
1725
+ } else
1726
+ await this.loader.loadBuiltinPlugins();
1727
+ for (const a of s)
1728
+ o.includes(a) || await this.loader.loadNpmPlugin(a);
1729
+ for (const a of i)
1730
+ if (!o.includes(a)) {
1731
+ const c = this.resolvePath(a);
1732
+ await this.loader.loadLocalPlugin(c);
1733
+ }
1734
+ this.config.workspacePath && r.length > 0 && await this.loader.loadWorkspacePlugins(
1735
+ this.config.workspacePath,
1736
+ r
1737
+ ), e.priority && this.applyPriorityOverrides(e.priority);
1738
+ }
1739
+ /**
1740
+ * Resolve plugin path (handle ~/ and relative paths)
1741
+ */
1742
+ resolvePath(e) {
1743
+ if (e.startsWith("~/")) {
1744
+ const s = process.env.HOME || process.env.USERPROFILE || "";
1745
+ return f.join(s, e.slice(2));
1746
+ }
1747
+ if (f.isAbsolute(e))
1748
+ return e;
1749
+ const t = this.config.workspacePath || process.cwd();
1750
+ return f.resolve(t, e);
1751
+ }
1752
+ /**
1753
+ * Apply priority overrides from configuration
1754
+ */
1755
+ applyPriorityOverrides(e) {
1756
+ for (const [t, s] of Object.entries(e)) {
1757
+ const i = this.loader.getPlugin(t);
1758
+ i && (i.priority = s);
1759
+ }
1760
+ }
1761
+ /**
1762
+ * Load configuration from file
1763
+ */
1764
+ static async loadConfigFromFile(e) {
1765
+ try {
1766
+ if (!p.existsSync(e))
1767
+ return null;
1768
+ const t = p.readFileSync(e, "utf-8");
1769
+ return JSON.parse(t);
1770
+ } catch (t) {
1771
+ return console.warn(
1772
+ `Failed to load config from ${e}: ${t.message}`
1773
+ ), null;
1774
+ }
1775
+ }
1776
+ /**
1777
+ * Load configuration from workspace and global locations
1778
+ */
1779
+ static async loadConfig(e) {
1780
+ const t = [], s = process.env.HOME || process.env.USERPROFILE;
1781
+ if (s) {
1782
+ const i = f.join(
1783
+ s,
1784
+ ".magic-helix",
1785
+ "config.json"
1786
+ ), r = await y.loadConfigFromFile(i);
1787
+ r && t.push(r);
1788
+ }
1789
+ if (e) {
1790
+ const i = f.join(e, ".magic-helix.json"), r = await y.loadConfigFromFile(i);
1791
+ r && (r.workspacePath = e, t.push(r));
1792
+ }
1793
+ return t.length === 0 ? { workspacePath: e } : t.reduce(
1794
+ (i, r) => {
1795
+ const o = {
1796
+ ...i.plugins || {},
1797
+ ...r.plugins || {}
1798
+ }, a = {
1799
+ ...i.templates || {},
1800
+ ...r.templates || {}
1801
+ };
1802
+ return i.plugins = o, i.templates = a, Object.assign(i, r, {
1803
+ plugins: o,
1804
+ templates: a
1805
+ }), i;
1806
+ },
1807
+ { workspacePath: e }
1808
+ );
1809
+ }
1810
+ };
1811
+ y.instance = null;
1812
+ let b = y;
1813
+ function _e() {
1814
+ return b.getInstance();
1815
+ }
1816
+ async function Ae(n) {
1817
+ const e = b.getInstance();
1818
+ return await e.initialize(n), e;
1819
+ }
1820
+ class We {
1821
+ constructor(e = {}) {
1822
+ this.templateCache = /* @__PURE__ */ new Map(), this.config = e.config || {}, this.verbose = e.verbose ?? !1, this.cacheEnabled = e.cacheEnabled ?? !0;
1823
+ }
1824
+ /**
1825
+ * Load a template by name with priority resolution
1826
+ */
1827
+ async loadTemplate(e, t = []) {
1828
+ const s = `${e}:${t.map((i) => i.name).join(",")}`;
1829
+ if (this.cacheEnabled && this.templateCache.has(s)) {
1830
+ const i = this.templateCache.get(s);
1831
+ if (i)
1832
+ return {
1833
+ content: i,
1834
+ source: "plugin",
1835
+ path: "(cached)"
1836
+ };
1837
+ }
1838
+ if (this.config.overrides?.[e]) {
1839
+ const i = this.config.overrides[e], r = await this.loadFromPath(i, "override");
1840
+ if (r)
1841
+ return this.cacheTemplate(s, r.content), r;
1842
+ }
1843
+ if (this.config.searchPaths)
1844
+ for (const i of this.config.searchPaths) {
1845
+ const r = await this.searchInDirectory(
1846
+ i,
1847
+ e,
1848
+ i.includes(".magic-helix") ? "workspace" : "global"
1849
+ );
1850
+ if (r)
1851
+ return this.cacheTemplate(s, r.content), r;
1852
+ }
1853
+ for (const i of t) {
1854
+ const r = await this.loadFromPlugin(i, e);
1855
+ if (r)
1856
+ return this.cacheTemplate(s, r.content), r;
1857
+ }
1858
+ return this.log(`Template "${e}" not found`), null;
1859
+ }
1860
+ /**
1861
+ * Load all templates from a plugin
1862
+ */
1863
+ async loadPluginTemplates(e) {
1864
+ try {
1865
+ const t = await Promise.resolve(e.getTemplates());
1866
+ return this.log(
1867
+ `Loaded ${t.length} templates from ${e.displayName}`
1868
+ ), t;
1869
+ } catch (t) {
1870
+ return this.logWarning(
1871
+ `Failed to load templates from ${e.name}: ${t.message}`
1872
+ ), [];
1873
+ }
1874
+ }
1875
+ /**
1876
+ * Load multiple templates by names
1877
+ */
1878
+ async loadTemplates(e, t = []) {
1879
+ const s = /* @__PURE__ */ new Map();
1880
+ for (const i of e) {
1881
+ const r = await this.loadTemplate(i, t);
1882
+ r && s.set(i, r);
1883
+ }
1884
+ return s;
1885
+ }
1886
+ /**
1887
+ * Find templates matching specific tags
1888
+ */
1889
+ async findTemplatesByTags(e, t = []) {
1890
+ const s = [];
1891
+ for (const i of t) {
1892
+ const r = await this.loadPluginTemplates(i);
1893
+ s.push(...r);
1894
+ }
1895
+ return s.filter((i) => i.tags.some((r) => e.includes(r)));
1896
+ }
1897
+ /**
1898
+ * Resolve template content (handle lazy loading)
1899
+ */
1900
+ async resolveTemplateContent(e) {
1901
+ return typeof e.content == "string" ? e.content : await Promise.resolve(e.content());
1902
+ }
1903
+ /**
1904
+ * Clear the template cache
1905
+ */
1906
+ clearCache() {
1907
+ this.templateCache.clear(), this.log("Template cache cleared");
1908
+ }
1909
+ /**
1910
+ * Get cache statistics
1911
+ */
1912
+ getCacheStats() {
1913
+ return {
1914
+ size: this.templateCache.size,
1915
+ keys: Array.from(this.templateCache.keys())
1916
+ };
1917
+ }
1918
+ // Private helper methods
1919
+ /**
1920
+ * Load template from a specific file path
1921
+ */
1922
+ async loadFromPath(e, t) {
1923
+ try {
1924
+ const s = this.resolvePath(e);
1925
+ if (!p.existsSync(s))
1926
+ return this.log(`Template not found at: ${s}`), null;
1927
+ const i = p.readFileSync(s, "utf-8");
1928
+ return this.log(`✓ Loaded template from ${t}: ${s}`), {
1929
+ content: i,
1930
+ source: t,
1931
+ path: s
1932
+ };
1933
+ } catch (s) {
1934
+ return this.logWarning(
1935
+ `Failed to load template from ${e}: ${s.message}`
1936
+ ), null;
1937
+ }
1938
+ }
1939
+ /**
1940
+ * Search for template in a directory
1941
+ */
1942
+ async searchInDirectory(e, t, s) {
1943
+ const i = this.resolvePath(e);
1944
+ if (!p.existsSync(i))
1945
+ return null;
1946
+ const r = this.config.extensions || [".md", ".txt", ""];
1947
+ for (const o of r) {
1948
+ const a = t.endsWith(o) ? t : `${t}${o}`, c = f.join(i, a);
1949
+ if (p.existsSync(c))
1950
+ return this.loadFromPath(c, s);
1951
+ }
1952
+ return null;
1953
+ }
1954
+ /**
1955
+ * Load template from plugin
1956
+ */
1957
+ async loadFromPlugin(e, t) {
1958
+ try {
1959
+ const i = (await this.loadPluginTemplates(e)).find((o) => o.name === t);
1960
+ if (!i)
1961
+ return null;
1962
+ const r = await this.resolveTemplateContent(i);
1963
+ return this.log(
1964
+ `✓ Loaded template "${t}" from plugin: ${e.displayName}`
1965
+ ), {
1966
+ content: r,
1967
+ source: "plugin",
1968
+ path: `plugin:${e.name}/${t}`,
1969
+ plugin: e.name
1970
+ };
1971
+ } catch (s) {
1972
+ return this.logWarning(
1973
+ `Failed to load template "${t}" from plugin ${e.name}: ${s.message}`
1974
+ ), null;
1975
+ }
1976
+ }
1977
+ /**
1978
+ * Resolve path (handle ~/ and relative paths)
1979
+ */
1980
+ resolvePath(e) {
1981
+ if (e.startsWith("~/")) {
1982
+ const t = process.env.HOME || process.env.USERPROFILE || "";
1983
+ return f.join(t, e.slice(2));
1984
+ }
1985
+ return f.isAbsolute(e) ? e : f.resolve(process.cwd(), e);
1986
+ }
1987
+ /**
1988
+ * Cache a template
1989
+ */
1990
+ cacheTemplate(e, t) {
1991
+ this.cacheEnabled && this.templateCache.set(e, t);
1992
+ }
1993
+ log(e) {
1994
+ this.verbose && console.log(`[TemplateLoader] ${e}`);
1995
+ }
1996
+ logWarning(e) {
1997
+ this.verbose && console.warn(`[TemplateLoader] ⚠️ ${e}`);
1998
+ }
1999
+ }
2000
+ const k = ".magic-helix", I = "meta-instructions.json";
2001
+ function oe(n) {
2002
+ const e = f.join(n, k, I);
2003
+ if (!p.existsSync(e))
2004
+ return null;
2005
+ try {
2006
+ const t = p.readFileSync(e, "utf-8");
2007
+ return JSON.parse(t);
2008
+ } catch (t) {
2009
+ return console.warn(
2010
+ `Failed to load meta-instruction config: ${t.message}`
2011
+ ), null;
2012
+ }
2013
+ }
2014
+ function ae(n) {
2015
+ const e = f.join(n, k, "overrides"), t = /* @__PURE__ */ new Map();
2016
+ if (!p.existsSync(e))
2017
+ return t;
2018
+ const s = O.sync("**/*.md", { cwd: e, absolute: !0 });
2019
+ for (const i of s) {
2020
+ const r = f.basename(i, ".md"), o = p.readFileSync(i, "utf-8");
2021
+ t.set(r, o);
2022
+ }
2023
+ return t;
2024
+ }
2025
+ function ce(n, e, t) {
2026
+ const s = new Map(n);
2027
+ if (e.ignoreTags)
2028
+ for (const r of e.ignoreTags)
2029
+ s.delete(r);
2030
+ const i = ae(t);
2031
+ for (const [r, o] of i)
2032
+ s.set(r, o);
2033
+ if (e.overrides)
2034
+ for (const r of e.overrides) {
2035
+ const o = s.get(r.tag);
2036
+ switch (r.mode) {
2037
+ case "replace":
2038
+ s.set(r.tag, r.content);
2039
+ break;
2040
+ case "prepend":
2041
+ o ? s.set(r.tag, `${r.content}
2042
+
2043
+ ${o}`) : s.set(r.tag, r.content);
2044
+ break;
2045
+ case "append":
2046
+ o ? s.set(r.tag, `${o}
2047
+
2048
+ ${r.content}`) : s.set(r.tag, r.content);
2049
+ break;
2050
+ }
2051
+ }
2052
+ return s;
2053
+ }
2054
+ function le(n, e) {
2055
+ const t = new Map(n);
2056
+ let s = e.template;
2057
+ for (const i of e.tags) {
2058
+ const r = n.get(i);
2059
+ r && (s = s.replace(`{{${i}}}`, r));
2060
+ }
2061
+ return t.set(e.outputTag, s), t;
2062
+ }
2063
+ function Ne(n, e) {
2064
+ const t = oe(e);
2065
+ if (!t)
2066
+ return n;
2067
+ let s = ce(n, t, e);
2068
+ if (t.combiners)
2069
+ for (const i of t.combiners)
2070
+ s = le(s, i);
2071
+ return s;
2072
+ }
2073
+ function ze(n) {
2074
+ const e = f.join(n, k);
2075
+ return p.existsSync(e);
2076
+ }
2077
+ function Ge(n) {
2078
+ const e = f.join(n, k), t = f.join(e, "overrides");
2079
+ p.mkdirSync(e, { recursive: !0 }), p.mkdirSync(t, { recursive: !0 });
2080
+ const s = {
2081
+ overrides: [
2082
+ {
2083
+ tag: "example-tag",
2084
+ content: `# Custom Instruction
2085
+
2086
+ Your content here...`,
2087
+ mode: "replace"
2088
+ }
2089
+ ],
2090
+ combiners: [
2091
+ {
2092
+ tags: ["tag1", "tag2"],
2093
+ outputTag: "combined-tag",
2094
+ template: `# Combined Instructions
2095
+
2096
+ {{tag1}}
2097
+
2098
+ ---
2099
+
2100
+ {{tag2}}`
2101
+ }
2102
+ ],
2103
+ ignoreTags: ["unwanted-tag"]
2104
+ }, i = f.join(e, I);
2105
+ p.writeFileSync(i, JSON.stringify(s, null, 2)), p.writeFileSync(f.join(t, "example.md"), `# Example Override
2106
+
2107
+ This file overrides the default instructions for this tag.
2108
+ Create files like:
2109
+ - react-core.md → overrides "react-core" tag
2110
+ - style-tailwind.md → overrides "style-tailwind" tag
2111
+ `), console.log(
2112
+ `✅ Initialized .magic-helix/ directory structure at: ${e}`
2113
+ );
2114
+ }
2115
+ class ue {
2116
+ constructor(e = {}) {
2117
+ this.enabled = !!e.enabled;
2118
+ const t = e.dir || C.resolve(process.cwd(), ".magic-helix/telemetry");
2119
+ this.filePath = C.join(t, "events.jsonl"), this.sessionId = e.sessionId, this.variant = e.variant, this.projectRoot = e.projectRoot, this.enabled && S.mkdirSync(C.dirname(this.filePath), { recursive: !0 });
2120
+ }
2121
+ isEnabled() {
2122
+ return this.enabled;
2123
+ }
2124
+ track(e) {
2125
+ if (!this.enabled) return;
2126
+ const t = {
2127
+ ...e,
2128
+ timestamp: (/* @__PURE__ */ new Date()).toISOString(),
2129
+ sessionId: this.sessionId,
2130
+ projectRoot: this.projectRoot
2131
+ };
2132
+ "variant" in e && e.variant ? t.variant = e.variant : t.variant = this.variant;
2133
+ const s = `${JSON.stringify(t)}
2134
+ `;
2135
+ S.appendFileSync(this.filePath, s, "utf-8");
2136
+ }
2137
+ }
2138
+ function Be(n = {}) {
2139
+ const e = n.enabled ?? process.env.MAGIC_HELIX_TELEMETRY === "1", t = n.dir || process.env.MAGIC_HELIX_TELEMETRY_DIR, s = n.sessionId || process.env.MAGIC_HELIX_SESSION_ID || `${Date.now()}`, i = n.variant || process.env.MAGIC_HELIX_VARIANT || "default", r = n.projectRoot || process.cwd();
2140
+ return new ue({ enabled: e, dir: t, sessionId: s, variant: i, projectRoot: r });
2141
+ }
2142
+ function qe(n) {
2143
+ return n.map((e) => {
2144
+ const t = ee(e.context), s = $(t);
2145
+ return {
2146
+ variant: e.name,
2147
+ instructions: t,
2148
+ score: s.overallScore,
2149
+ structureScore: s.structureScore,
2150
+ clarityScore: s.clarityScore,
2151
+ completenessScore: s.completenessScore,
2152
+ missingCount: s.missingElements.length
2153
+ };
2154
+ });
2155
+ }
2156
+ function He(n) {
2157
+ return n.length === 0 ? {
2158
+ variant: "",
2159
+ instructions: "",
2160
+ score: 0,
2161
+ structureScore: 0,
2162
+ clarityScore: 0,
2163
+ completenessScore: 0,
2164
+ missingCount: 0
2165
+ } : n.reduce(
2166
+ (e, t) => t.score > e.score ? t : e,
2167
+ n[0]
2168
+ );
2169
+ }
2170
+ function Ue(n, e) {
2171
+ if (e?.isEnabled())
2172
+ for (const t of n) {
2173
+ const s = {
2174
+ type: "instruction_validation",
2175
+ file: `ab-test-variant-${t.variant}`,
2176
+ score: t.score,
2177
+ structureScore: t.structureScore,
2178
+ clarityScore: t.clarityScore,
2179
+ completenessScore: t.completenessScore,
2180
+ missingCount: t.missingCount,
2181
+ variant: t.variant
2182
+ };
2183
+ e.track(s);
2184
+ }
2185
+ }
2186
+ const de = M(import.meta.url);
2187
+ L(de);
4
2188
  export {
5
- i as BUILT_IN_CONFIG,
6
- n as BUILT_IN_TEMPLATE_DIR,
7
- r as CodeOwnersPlugin,
8
- l as DEFAULT_AI_REFINEMENT,
9
- o as DockerPlugin,
10
- g as GitHubActionsPlugin,
11
- u as GitLabCIPlugin,
12
- P as GolangPlugin,
13
- I as INSTRUCTION_ELEMENTS,
14
- T as MonorepoPlugin,
15
- y as PHPPlugin,
16
- p as PluginLoader,
17
- c as PluginRegistry,
18
- d as PluginRegistryOld,
19
- m as PythonPlugin,
20
- R as RustPlugin,
21
- C as TelemetryClient,
22
- E as TemplateLoader,
23
- L as analyzeBestVariant,
24
- M as analyzeProjectTags,
25
- N as analyzeWithPlugins,
26
- _ as applyCombiner,
27
- f as applyMetaInstructions,
28
- A as applyOverrides,
29
- B as combinePatterns,
30
- O as createTelemetry,
31
- h as estimateTokens,
32
- G as formatValidationReport,
33
- U as generateABVariants,
34
- b as generateInstructions,
35
- z as getFormatter,
36
- F as getQualityGrade,
37
- k as getRegistry,
38
- v as hasMetaInstructions,
39
- D as initMetaInstructions,
40
- V as initializeRegistry,
41
- H as loadMetaConfig,
42
- Q as loadOverrideInstructions,
43
- S as loadPatternTemplates,
44
- j as loadUserConfig,
45
- w as mergeConfigs,
46
- x as passesQualityThreshold,
47
- q as pluginRegistry,
48
- J as refineInstructions,
49
- K as registerBuiltInPlugins,
50
- W as selectPatterns,
51
- X as trackABTest,
52
- Y as validateInstructions
2189
+ A as BUILT_IN_CONFIG,
2190
+ Ee as CodeOwnersPlugin,
2191
+ T as DEFAULT_AI_REFINEMENT,
2192
+ Te as DockerPlugin,
2193
+ $e as GitHubActionsPlugin,
2194
+ Ie as GitLabCIPlugin,
2195
+ De as GolangPlugin,
2196
+ te as INSTRUCTION_ELEMENTS,
2197
+ Le as MonorepoPlugin,
2198
+ Me as PHPPlugin,
2199
+ E as PluginLoader,
2200
+ b as PluginRegistry,
2201
+ ie as PluginRegistryOld,
2202
+ Oe as PythonPlugin,
2203
+ Re as RustPlugin,
2204
+ ue as TelemetryClient,
2205
+ We as TemplateLoader,
2206
+ He as analyzeBestVariant,
2207
+ ye as analyzeProjectTags,
2208
+ xe as analyzeWithPlugins,
2209
+ le as applyCombiner,
2210
+ Ne as applyMetaInstructions,
2211
+ ce as applyOverrides,
2212
+ Z as combinePatterns,
2213
+ Be as createTelemetry,
2214
+ ve as estimateTokens,
2215
+ Fe as formatValidationReport,
2216
+ qe as generateABVariants,
2217
+ ee as generateInstructions,
2218
+ ke as getFormatter,
2219
+ ne as getQualityGrade,
2220
+ _e as getRegistry,
2221
+ ze as hasMetaInstructions,
2222
+ Ge as initMetaInstructions,
2223
+ Ae as initializeRegistry,
2224
+ oe as loadMetaConfig,
2225
+ ae as loadOverrideInstructions,
2226
+ Q as loadPatternTemplates,
2227
+ Pe as loadUserConfig,
2228
+ be as mergeConfigs,
2229
+ Ce as passesQualityThreshold,
2230
+ h as pluginRegistry,
2231
+ we as refineInstructions,
2232
+ je as registerBuiltInPlugins,
2233
+ K as selectPatterns,
2234
+ Ue as trackABTest,
2235
+ $ as validateInstructions
53
2236
  };
54
2237
  //# sourceMappingURL=index.mjs.map