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

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