@el-j/magic-helix-plugins 4.0.0-beta.6 → 4.0.0-beta.7

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.
package/dist/index.mjs CHANGED
@@ -1,24 +1,577 @@
1
- import { B as p } from "./BasePlugin-6wv0hYJ9.js";
2
- import { NodeJSPlugin as P } from "./nodejs/index.mjs";
3
- import { GoPlugin as u } from "./go/index.mjs";
4
- import { PythonPlugin as i } from "./python/index.mjs";
5
- import { RustPlugin as g } from "./rust/index.mjs";
6
- import { JavaPlugin as m } from "./java/index.mjs";
7
- import { RubyPlugin as a } from "./ruby/index.mjs";
8
- import { PHPPlugin as S } from "./php/index.mjs";
9
- import { CSharpPlugin as y } from "./csharp/index.mjs";
10
- import { CppPlugin as C } from "./cpp/index.mjs";
11
- import { SwiftPlugin as R } from "./swift/index.mjs";
1
+ import { B as r } from "./BasePlugin-6wv0hYJ9.js";
2
+ import { NodeJSPlugin as k } from "./nodejs/index.mjs";
3
+ import { GoPlugin as U } from "./go/index.mjs";
4
+ import { PythonPlugin as S } from "./python/index.mjs";
5
+ import { RustPlugin as M } from "./rust/index.mjs";
6
+ import { JavaPlugin as N } from "./java/index.mjs";
7
+ import { RubyPlugin as L } from "./ruby/index.mjs";
8
+ import { PHPPlugin as C } from "./php/index.mjs";
9
+ import { CSharpPlugin as G } from "./csharp/index.mjs";
10
+ import { CppPlugin as K } from "./cpp/index.mjs";
11
+ import { SwiftPlugin as I } from "./swift/index.mjs";
12
+ import * as l from "node:path";
13
+ class d extends r {
14
+ constructor() {
15
+ super(...arguments), this.name = "elixir", this.displayName = "Elixir", this.version = "1.0.0", this.priority = 80;
16
+ }
17
+ async detect(e) {
18
+ if (!this.fileExists(e, "mix.exs"))
19
+ return null;
20
+ const t = this.readFile(e, "mix.exs"), i = ["elixir"], s = {};
21
+ if (t) {
22
+ const n = t.match(/app:\s*:(\w+)/), a = t.match(/version:\s*"([^"]+)"/);
23
+ return t.includes(":phoenix") && (i.push("phoenix"), s.phoenix = "*"), t.includes(":ecto") && (i.push("ecto"), s.ecto = "*"), {
24
+ language: "Elixir",
25
+ name: n?.[1] || this.getProjectName(e),
26
+ version: a?.[1] || "0.1.0",
27
+ dependencies: s,
28
+ manifestFile: "mix.exs",
29
+ projectPath: e,
30
+ tags: i
31
+ };
32
+ }
33
+ return {
34
+ language: "Elixir",
35
+ name: this.getProjectName(e),
36
+ dependencies: {},
37
+ manifestFile: "mix.exs",
38
+ projectPath: e,
39
+ tags: i
40
+ };
41
+ }
42
+ getTemplates() {
43
+ return [
44
+ {
45
+ name: "elixir-core",
46
+ tags: ["elixir"],
47
+ content: () => this.loadTemplateFromFile(
48
+ l.join(__dirname, "templates/lang-elixir.md")
49
+ ).then((e) => e || this.getElixirFallbackTemplate())
50
+ }
51
+ ];
52
+ }
53
+ getDependencyTagMap() {
54
+ return {
55
+ phoenix: "phoenix",
56
+ ecto: "ecto",
57
+ absinthe: "graphql",
58
+ plug: "plug"
59
+ };
60
+ }
61
+ getElixirFallbackTemplate() {
62
+ return `# Elixir Development Guidelines
63
+
64
+ ## Language-Specific Rules
65
+ - Use pattern matching and guards extensively
66
+ - Prefer immutable data structures
67
+ - Use pipe operator |> for data transformations
68
+ - Follow OTP principles for concurrent systems
69
+ - Use GenServer for stateful processes
70
+
71
+ ## Code Style
72
+ - Follow Elixir formatter conventions
73
+ - Use snake_case for functions and variables
74
+ - Use PascalCase for module names
75
+ - Keep functions small and focused
76
+ - Use \`with\` for complex case matching
77
+
78
+ ## Common Patterns
79
+ - Supervision trees for fault tolerance
80
+ - GenServer for state management
81
+ - Phoenix contexts for domain logic
82
+ - Ecto changesets for data validation
83
+ `;
84
+ }
85
+ }
86
+ class p extends r {
87
+ constructor() {
88
+ super(...arguments), this.name = "dart", this.displayName = "Dart", this.version = "1.0.0", this.priority = 80;
89
+ }
90
+ async detect(e) {
91
+ if (!this.fileExists(e, "pubspec.yaml"))
92
+ return null;
93
+ const t = this.readFile(e, "pubspec.yaml"), i = ["dart"], s = {};
94
+ if (t) {
95
+ const n = t.match(/name:\s*(.+)/), a = t.match(/version:\s*(.+)/);
96
+ return (t.includes("flutter:") || t.includes("flutter_test:")) && (i.push("flutter"), s.flutter = "*"), (t.includes("flutter_riverpod:") || t.includes("riverpod:")) && i.push("riverpod"), (t.includes("flutter_bloc:") || t.includes("bloc:")) && i.push("bloc"), {
97
+ language: "Dart",
98
+ name: n?.[1]?.trim() || this.getProjectName(e),
99
+ version: a?.[1]?.trim() || "1.0.0",
100
+ dependencies: s,
101
+ manifestFile: "pubspec.yaml",
102
+ projectPath: e,
103
+ tags: i
104
+ };
105
+ }
106
+ return {
107
+ language: "Dart",
108
+ name: this.getProjectName(e),
109
+ dependencies: {},
110
+ manifestFile: "pubspec.yaml",
111
+ projectPath: e,
112
+ tags: i
113
+ };
114
+ }
115
+ getTemplates() {
116
+ return [
117
+ {
118
+ name: "dart-core",
119
+ tags: ["dart"],
120
+ content: () => this.loadTemplateFromFile(
121
+ l.join(__dirname, "templates/lang-dart.md")
122
+ ).then((e) => e || this.getDartFallbackTemplate())
123
+ },
124
+ {
125
+ name: "flutter-core",
126
+ tags: ["flutter"],
127
+ content: () => this.loadTemplateFromFile(
128
+ l.join(__dirname, "templates/flutter.md")
129
+ ).then((e) => e || this.getFlutterFallbackTemplate())
130
+ }
131
+ ];
132
+ }
133
+ getDependencyTagMap() {
134
+ return {
135
+ flutter: "flutter",
136
+ flutter_riverpod: "riverpod",
137
+ riverpod: "riverpod",
138
+ flutter_bloc: "bloc",
139
+ bloc: "bloc",
140
+ provider: "provider"
141
+ };
142
+ }
143
+ getDartFallbackTemplate() {
144
+ return `# Dart Development Guidelines
145
+
146
+ ## Language-Specific Rules
147
+ - Use strong typing throughout
148
+ - Leverage null safety features
149
+ - Prefer const constructors where possible
150
+ - Use named parameters for clarity
151
+ - Follow effective Dart guidelines
152
+
153
+ ## Code Style
154
+ - Use dartfmt for formatting
155
+ - Follow Dart style guide
156
+ - Use camelCase for variables/functions
157
+ - Use PascalCase for classes
158
+ `;
159
+ }
160
+ getFlutterFallbackTemplate() {
161
+ return `# Flutter Development Guidelines
162
+
163
+ ## Widget Best Practices
164
+ - Keep widgets small and focused
165
+ - Use StatelessWidget when possible
166
+ - Implement proper dispose() methods
167
+ - Use const constructors for performance
168
+
169
+ ## State Management
170
+ - Choose appropriate state solution (Riverpod, Bloc, Provider)
171
+ - Keep business logic separate from UI
172
+ - Use ValueNotifier for simple state
173
+ `;
174
+ }
175
+ }
176
+ class g extends r {
177
+ constructor() {
178
+ super(...arguments), this.name = "scala", this.displayName = "Scala", this.version = "1.0.0", this.priority = 80;
179
+ }
180
+ async detect(e) {
181
+ return this.fileExists(e, "build.sbt") ? this.detectFromSbt(e) : this.fileExists(e, "build.sc") ? this.detectFromMill(e) : null;
182
+ }
183
+ getTemplates() {
184
+ return [
185
+ {
186
+ name: "scala-core",
187
+ tags: ["scala"],
188
+ content: () => this.loadTemplateFromFile(
189
+ l.join(__dirname, "templates/lang-scala.md")
190
+ ).then((e) => e || this.getScalaFallbackTemplate())
191
+ }
192
+ ];
193
+ }
194
+ getDependencyTagMap() {
195
+ return {
196
+ akka: "akka",
197
+ "akka-http": "akka-http",
198
+ play: "play",
199
+ "cats-effect": "cats",
200
+ zio: "zio",
201
+ scalatest: "scalatest"
202
+ };
203
+ }
204
+ detectFromSbt(e) {
205
+ const t = this.readFile(e, "build.sbt"), i = ["scala"], s = {};
206
+ if (t) {
207
+ const n = t.match(/name\s*:=\s*"([^"]+)"/), a = t.match(/version\s*:=\s*"([^"]+)"/);
208
+ return (t.includes("akka-actor") || t.includes("com.typesafe.akka")) && (i.push("akka"), s.akka = "*"), (t.includes("play") || t.includes("com.typesafe.play")) && (i.push("play"), s.play = "*"), t.includes("zio") && i.push("zio"), (t.includes("cats-effect") || t.includes("cats-core")) && i.push("cats"), {
209
+ language: "Scala",
210
+ name: n?.[1] || this.getProjectName(e),
211
+ version: a?.[1] || "0.1.0",
212
+ dependencies: s,
213
+ manifestFile: "build.sbt",
214
+ projectPath: e,
215
+ tags: i
216
+ };
217
+ }
218
+ return {
219
+ language: "Scala",
220
+ name: this.getProjectName(e),
221
+ dependencies: {},
222
+ manifestFile: "build.sbt",
223
+ projectPath: e,
224
+ tags: i
225
+ };
226
+ }
227
+ detectFromMill(e) {
228
+ return {
229
+ language: "Scala",
230
+ name: this.getProjectName(e),
231
+ dependencies: {},
232
+ manifestFile: "build.sc",
233
+ projectPath: e,
234
+ tags: ["scala"]
235
+ };
236
+ }
237
+ getScalaFallbackTemplate() {
238
+ return `# Scala Development Guidelines
239
+
240
+ ## Functional Programming
241
+ - Prefer immutable data structures
242
+ - Use case classes for data models
243
+ - Leverage pattern matching
244
+ - Use for-comprehensions for sequential operations
245
+
246
+ ## Collections
247
+ - Use immutable collections by default
248
+ - Leverage map, flatMap, filter, fold
249
+ - Understand lazy vs strict evaluation
250
+
251
+ ## Type System
252
+ - Use type inference where appropriate
253
+ - Leverage sealed traits for ADTs
254
+ - Use implicit conversions sparingly
255
+ `;
256
+ }
257
+ }
258
+ class f extends r {
259
+ constructor() {
260
+ super(...arguments), this.name = "kotlin", this.displayName = "Kotlin", this.version = "1.0.0", this.priority = 85;
261
+ }
262
+ async detect(e) {
263
+ if (!(this.fileExists(e, "build.gradle.kts") || this.fileExists(e, "settings.gradle.kts")))
264
+ return null;
265
+ const i = this.readFile(e, "build.gradle.kts"), s = ["kotlin"], n = {};
266
+ return i && (i.includes("ktor") && (s.push("ktor"), n.ktor = "*"), i.includes("spring-boot") && (s.push("spring-boot"), n["spring-boot"] = "*"), i.includes("exposed") && s.push("exposed"), i.includes("kotlinx-coroutines") && s.push("coroutines")), {
267
+ language: "Kotlin",
268
+ name: this.getProjectName(e),
269
+ dependencies: n,
270
+ manifestFile: "build.gradle.kts",
271
+ projectPath: e,
272
+ tags: s
273
+ };
274
+ }
275
+ getTemplates() {
276
+ return [
277
+ {
278
+ name: "kotlin-core",
279
+ tags: ["kotlin"],
280
+ content: () => this.loadTemplateFromFile(
281
+ l.join(__dirname, "templates/lang-kotlin.md")
282
+ ).then((e) => e || this.getKotlinFallbackTemplate())
283
+ }
284
+ ];
285
+ }
286
+ getDependencyTagMap() {
287
+ return {
288
+ ktor: "ktor",
289
+ "spring-boot": "spring-boot",
290
+ exposed: "exposed",
291
+ "kotlinx-coroutines": "coroutines"
292
+ };
293
+ }
294
+ getKotlinFallbackTemplate() {
295
+ return `# Kotlin Development Guidelines
296
+
297
+ ## Language Features
298
+ - Use data classes for simple data holders
299
+ - Leverage null safety with ?
300
+ - Use scope functions (let, apply, run, with, also)
301
+ - Prefer extension functions over utility classes
302
+
303
+ ## Coroutines
304
+ - Use suspend functions for async operations
305
+ - Leverage Flow for reactive streams
306
+ - Understand structured concurrency
307
+
308
+ ## Collections
309
+ - Use collection builders and operations
310
+ - Leverage sequences for large datasets
311
+ - Understand the difference between List/MutableList
312
+ `;
313
+ }
314
+ }
315
+ class h extends r {
316
+ constructor() {
317
+ super(...arguments), this.name = "lua", this.displayName = "Lua", this.version = "1.0.0", this.priority = 75;
318
+ }
319
+ async detect(e) {
320
+ const i = this.listFiles(e)?.find((s) => s.endsWith(".rockspec"));
321
+ if (i || this.fileExists(e, "lua_modules")) {
322
+ const s = ["lua"];
323
+ return {
324
+ language: "Lua",
325
+ name: this.getProjectName(e),
326
+ dependencies: {},
327
+ manifestFile: i || "lua_modules",
328
+ projectPath: e,
329
+ tags: s
330
+ };
331
+ }
332
+ return null;
333
+ }
334
+ getTemplates() {
335
+ return [
336
+ {
337
+ name: "lua-core",
338
+ tags: ["lua"],
339
+ content: () => this.loadTemplateFromFile(
340
+ l.join(__dirname, "templates/lang-lua.md")
341
+ ).then((e) => e || this.getLuaFallbackTemplate())
342
+ }
343
+ ];
344
+ }
345
+ getDependencyTagMap() {
346
+ return {
347
+ lapis: "lapis",
348
+ openresty: "openresty",
349
+ busted: "busted"
350
+ };
351
+ }
352
+ getLuaFallbackTemplate() {
353
+ return `# Lua Development Guidelines
354
+
355
+ ## Tables
356
+ - Tables are the primary data structure
357
+ - Use them for arrays, dictionaries, objects
358
+ - Arrays are 1-indexed
359
+
360
+ ## Metatables
361
+ - Use metatables for OOP patterns
362
+ - Implement __index for inheritance
363
+ - Leverage metamethods
364
+
365
+ ## Best Practices
366
+ - Keep functions small
367
+ - Use local variables for performance
368
+ - Understand upvalues and closures
369
+ `;
370
+ }
371
+ }
372
+ class y extends r {
373
+ constructor() {
374
+ super(...arguments), this.name = "r", this.displayName = "R", this.version = "1.0.0", this.priority = 75;
375
+ }
376
+ async detect(e) {
377
+ const i = this.listFiles(e)?.some((s) => s.endsWith(".Rproj"));
378
+ if (this.fileExists(e, "DESCRIPTION") || i) {
379
+ const s = ["r"], n = {}, a = this.readFile(e, "DESCRIPTION");
380
+ if (a) {
381
+ const c = a.match(/Package:\s*(.+)/), u = a.match(/Version:\s*(.+)/);
382
+ return (a.includes("tidyverse") || a.includes("dplyr")) && s.push("tidyverse"), a.includes("shiny") && (s.push("shiny"), n.shiny = "*"), {
383
+ language: "R",
384
+ name: c?.[1]?.trim() || this.getProjectName(e),
385
+ version: u?.[1]?.trim() || "0.1.0",
386
+ dependencies: n,
387
+ manifestFile: "DESCRIPTION",
388
+ projectPath: e,
389
+ tags: s
390
+ };
391
+ }
392
+ return {
393
+ language: "R",
394
+ name: this.getProjectName(e),
395
+ dependencies: {},
396
+ manifestFile: i ? ".Rproj" : "DESCRIPTION",
397
+ projectPath: e,
398
+ tags: s
399
+ };
400
+ }
401
+ return null;
402
+ }
403
+ getTemplates() {
404
+ return [
405
+ {
406
+ name: "r-core",
407
+ tags: ["r"],
408
+ content: () => this.loadTemplateFromFile(
409
+ l.join(__dirname, "templates/lang-r.md")
410
+ ).then((e) => e || this.getRFallbackTemplate())
411
+ }
412
+ ];
413
+ }
414
+ getDependencyTagMap() {
415
+ return {
416
+ tidyverse: "tidyverse",
417
+ shiny: "shiny",
418
+ ggplot2: "ggplot2",
419
+ "data.table": "data-table"
420
+ };
421
+ }
422
+ getRFallbackTemplate() {
423
+ return `# R Development Guidelines
424
+
425
+ ## Tidyverse Principles
426
+ - Use pipes (%>% or |>) for data transformations
427
+ - Prefer dplyr verbs (select, filter, mutate, summarize)
428
+ - Use ggplot2 for visualization
429
+
430
+ ## Vectorization
431
+ - Operate on entire vectors, not loops
432
+ - Use apply family functions
433
+ - Leverage data.table for performance
434
+
435
+ ## Best Practices
436
+ - Document functions with roxygen2
437
+ - Write unit tests with testthat
438
+ - Use consistent naming (snake_case)
439
+ `;
440
+ }
441
+ }
442
+ class b extends r {
443
+ constructor() {
444
+ super(...arguments), this.name = "perl", this.displayName = "Perl", this.version = "1.0.0", this.priority = 70;
445
+ }
446
+ async detect(e) {
447
+ if (this.fileExists(e, "Makefile.PL") || this.fileExists(e, "Build.PL") || this.fileExists(e, "cpanfile")) {
448
+ const t = this.fileExists(e, "Makefile.PL") ? "Makefile.PL" : this.fileExists(e, "Build.PL") ? "Build.PL" : "cpanfile";
449
+ return {
450
+ language: "Perl",
451
+ name: this.getProjectName(e),
452
+ dependencies: {},
453
+ manifestFile: t,
454
+ projectPath: e,
455
+ tags: ["perl"]
456
+ };
457
+ }
458
+ return null;
459
+ }
460
+ getTemplates() {
461
+ return [
462
+ {
463
+ name: "perl-core",
464
+ tags: ["perl"],
465
+ content: () => this.loadTemplateFromFile(
466
+ l.join(__dirname, "templates/lang-perl.md")
467
+ ).then((e) => e || this.getPerlFallbackTemplate())
468
+ }
469
+ ];
470
+ }
471
+ getDependencyTagMap() {
472
+ return {
473
+ Mojolicious: "mojolicious",
474
+ Dancer2: "dancer",
475
+ Catalyst: "catalyst"
476
+ };
477
+ }
478
+ getPerlFallbackTemplate() {
479
+ return `# Perl Development Guidelines
480
+
481
+ ## Modern Perl
482
+ - Use strict and warnings
483
+ - Leverage Moose/Moo for OOP
484
+ - Use Try::Tiny for exception handling
485
+
486
+ ## CPAN Modules
487
+ - Use cpanm for installation
488
+ - Declare dependencies in cpanfile
489
+ - Test with prove
490
+
491
+ ## Best Practices
492
+ - Follow PBP (Perl Best Practices)
493
+ - Use perlcritic for linting
494
+ - Write tests with Test::More
495
+ `;
496
+ }
497
+ }
498
+ class v extends r {
499
+ constructor() {
500
+ super(...arguments), this.name = "shell", this.displayName = "Shell", this.version = "1.0.0", this.priority = 60;
501
+ }
502
+ async detect(e) {
503
+ const t = this.listFiles(e);
504
+ if (t?.some(
505
+ (s) => s.endsWith(".sh") || s === "Makefile" || s.endsWith(".bash") || s.endsWith(".zsh")
506
+ )) {
507
+ const s = ["shell"];
508
+ if ((t?.filter(
509
+ (a) => a.endsWith(".sh") || a.endsWith(".bash") || a.endsWith(".zsh")
510
+ ).length || 0) >= 2 || t?.includes("install.sh") || t?.includes("setup.sh"))
511
+ return {
512
+ language: "Shell",
513
+ name: this.getProjectName(e),
514
+ dependencies: {},
515
+ manifestFile: "scripts",
516
+ projectPath: e,
517
+ tags: s
518
+ };
519
+ }
520
+ return null;
521
+ }
522
+ getTemplates() {
523
+ return [
524
+ {
525
+ name: "shell-core",
526
+ tags: ["shell"],
527
+ content: () => this.loadTemplateFromFile(
528
+ l.join(__dirname, "templates/lang-shell.md")
529
+ ).then((e) => e || this.getShellFallbackTemplate())
530
+ }
531
+ ];
532
+ }
533
+ getDependencyTagMap() {
534
+ return {};
535
+ }
536
+ getShellFallbackTemplate() {
537
+ return `# Shell Script Development Guidelines
538
+
539
+ ## Best Practices
540
+ - Use #!/usr/bin/env bash for portability
541
+ - Always quote variables: "$var"
542
+ - Use set -euo pipefail for safety
543
+ - Check command existence with command -v
544
+
545
+ ## Error Handling
546
+ - Use trap for cleanup
547
+ - Check exit codes: if ! command; then
548
+ - Provide meaningful error messages
549
+
550
+ ## Functions
551
+ - Keep functions focused
552
+ - Use local variables
553
+ - Return meaningful exit codes
554
+ `;
555
+ }
556
+ }
12
557
  export {
13
- p as BasePlugin,
14
- y as CSharpPlugin,
15
- C as CppPlugin,
16
- u as GoPlugin,
17
- m as JavaPlugin,
18
- P as NodeJSPlugin,
19
- S as PHPPlugin,
20
- i as PythonPlugin,
21
- a as RubyPlugin,
22
- g as RustPlugin,
23
- R as SwiftPlugin
558
+ r as BasePlugin,
559
+ G as CSharpPlugin,
560
+ K as CppPlugin,
561
+ p as DartPlugin,
562
+ d as ElixirPlugin,
563
+ U as GoPlugin,
564
+ N as JavaPlugin,
565
+ f as KotlinPlugin,
566
+ h as LuaPlugin,
567
+ k as NodeJSPlugin,
568
+ C as PHPPlugin,
569
+ b as PerlPlugin,
570
+ S as PythonPlugin,
571
+ y as RPlugin,
572
+ L as RubyPlugin,
573
+ M as RustPlugin,
574
+ g as ScalaPlugin,
575
+ v as ShellPlugin,
576
+ I as SwiftPlugin
24
577
  };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@el-j/magic-helix-plugins",
3
- "version": "4.0.0-beta.6",
3
+ "version": "4.0.0-beta.7",
4
4
  "description": "Official language detection plugins for MagicAgentHelix",
5
5
  "type": "module",
6
6
  "main": "./dist/index.js",