@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/dart/templates/flutter.md +340 -0
- package/dist/dart/templates/lang-dart.md +233 -0
- package/dist/elixir/templates/lang-elixir.md +147 -0
- package/dist/index.cjs +147 -1
- package/dist/index.mjs +575 -22
- package/package.json +1 -1
package/dist/index.cjs
CHANGED
|
@@ -1 +1,147 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const o=require("./BasePlugin-odQJAKA-.cjs"),d=require("./nodejs/index.cjs"),m=require("./go/index.cjs"),p=require("./python/index.cjs"),g=require("./rust/index.cjs"),f=require("./java/index.cjs"),h=require("./ruby/index.cjs"),y=require("./php/index.cjs"),b=require("./csharp/index.cjs"),v=require("./cpp/index.cjs"),x=require("./swift/index.cjs"),F=require("node:path");function P(a){const e=Object.create(null,{[Symbol.toStringTag]:{value:"Module"}});if(a){for(const t in a)if(t!=="default"){const i=Object.getOwnPropertyDescriptor(a,t);Object.defineProperty(e,t,i.get?i:{enumerable:!0,get:()=>a[t]})}}return e.default=a,Object.freeze(e)}const r=P(F);class k extends o.BasePlugin{constructor(){super(...arguments),this.name="elixir",this.displayName="Elixir",this.version="1.0.0",this.priority=80}async detect(e){if(!this.fileExists(e,"mix.exs"))return null;const t=this.readFile(e,"mix.exs"),i=["elixir"],s={};if(t){const l=t.match(/app:\s*:(\w+)/),n=t.match(/version:\s*"([^"]+)"/);return t.includes(":phoenix")&&(i.push("phoenix"),s.phoenix="*"),t.includes(":ecto")&&(i.push("ecto"),s.ecto="*"),{language:"Elixir",name:l?.[1]||this.getProjectName(e),version:n?.[1]||"0.1.0",dependencies:s,manifestFile:"mix.exs",projectPath:e,tags:i}}return{language:"Elixir",name:this.getProjectName(e),dependencies:{},manifestFile:"mix.exs",projectPath:e,tags:i}}getTemplates(){return[{name:"elixir-core",tags:["elixir"],content:()=>this.loadTemplateFromFile(r.join(__dirname,"templates/lang-elixir.md")).then(e=>e||this.getElixirFallbackTemplate())}]}getDependencyTagMap(){return{phoenix:"phoenix",ecto:"ecto",absinthe:"graphql",plug:"plug"}}getElixirFallbackTemplate(){return`# Elixir Development Guidelines
|
|
2
|
+
|
|
3
|
+
## Language-Specific Rules
|
|
4
|
+
- Use pattern matching and guards extensively
|
|
5
|
+
- Prefer immutable data structures
|
|
6
|
+
- Use pipe operator |> for data transformations
|
|
7
|
+
- Follow OTP principles for concurrent systems
|
|
8
|
+
- Use GenServer for stateful processes
|
|
9
|
+
|
|
10
|
+
## Code Style
|
|
11
|
+
- Follow Elixir formatter conventions
|
|
12
|
+
- Use snake_case for functions and variables
|
|
13
|
+
- Use PascalCase for module names
|
|
14
|
+
- Keep functions small and focused
|
|
15
|
+
- Use \`with\` for complex case matching
|
|
16
|
+
|
|
17
|
+
## Common Patterns
|
|
18
|
+
- Supervision trees for fault tolerance
|
|
19
|
+
- GenServer for state management
|
|
20
|
+
- Phoenix contexts for domain logic
|
|
21
|
+
- Ecto changesets for data validation
|
|
22
|
+
`}}class T extends o.BasePlugin{constructor(){super(...arguments),this.name="dart",this.displayName="Dart",this.version="1.0.0",this.priority=80}async detect(e){if(!this.fileExists(e,"pubspec.yaml"))return null;const t=this.readFile(e,"pubspec.yaml"),i=["dart"],s={};if(t){const l=t.match(/name:\s*(.+)/),n=t.match(/version:\s*(.+)/);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"),{language:"Dart",name:l?.[1]?.trim()||this.getProjectName(e),version:n?.[1]?.trim()||"1.0.0",dependencies:s,manifestFile:"pubspec.yaml",projectPath:e,tags:i}}return{language:"Dart",name:this.getProjectName(e),dependencies:{},manifestFile:"pubspec.yaml",projectPath:e,tags:i}}getTemplates(){return[{name:"dart-core",tags:["dart"],content:()=>this.loadTemplateFromFile(r.join(__dirname,"templates/lang-dart.md")).then(e=>e||this.getDartFallbackTemplate())},{name:"flutter-core",tags:["flutter"],content:()=>this.loadTemplateFromFile(r.join(__dirname,"templates/flutter.md")).then(e=>e||this.getFlutterFallbackTemplate())}]}getDependencyTagMap(){return{flutter:"flutter",flutter_riverpod:"riverpod",riverpod:"riverpod",flutter_bloc:"bloc",bloc:"bloc",provider:"provider"}}getDartFallbackTemplate(){return`# Dart Development Guidelines
|
|
23
|
+
|
|
24
|
+
## Language-Specific Rules
|
|
25
|
+
- Use strong typing throughout
|
|
26
|
+
- Leverage null safety features
|
|
27
|
+
- Prefer const constructors where possible
|
|
28
|
+
- Use named parameters for clarity
|
|
29
|
+
- Follow effective Dart guidelines
|
|
30
|
+
|
|
31
|
+
## Code Style
|
|
32
|
+
- Use dartfmt for formatting
|
|
33
|
+
- Follow Dart style guide
|
|
34
|
+
- Use camelCase for variables/functions
|
|
35
|
+
- Use PascalCase for classes
|
|
36
|
+
`}getFlutterFallbackTemplate(){return`# Flutter Development Guidelines
|
|
37
|
+
|
|
38
|
+
## Widget Best Practices
|
|
39
|
+
- Keep widgets small and focused
|
|
40
|
+
- Use StatelessWidget when possible
|
|
41
|
+
- Implement proper dispose() methods
|
|
42
|
+
- Use const constructors for performance
|
|
43
|
+
|
|
44
|
+
## State Management
|
|
45
|
+
- Choose appropriate state solution (Riverpod, Bloc, Provider)
|
|
46
|
+
- Keep business logic separate from UI
|
|
47
|
+
- Use ValueNotifier for simple state
|
|
48
|
+
`}}class S extends o.BasePlugin{constructor(){super(...arguments),this.name="scala",this.displayName="Scala",this.version="1.0.0",this.priority=80}async detect(e){return this.fileExists(e,"build.sbt")?this.detectFromSbt(e):this.fileExists(e,"build.sc")?this.detectFromMill(e):null}getTemplates(){return[{name:"scala-core",tags:["scala"],content:()=>this.loadTemplateFromFile(r.join(__dirname,"templates/lang-scala.md")).then(e=>e||this.getScalaFallbackTemplate())}]}getDependencyTagMap(){return{akka:"akka","akka-http":"akka-http",play:"play","cats-effect":"cats",zio:"zio",scalatest:"scalatest"}}detectFromSbt(e){const t=this.readFile(e,"build.sbt"),i=["scala"],s={};if(t){const l=t.match(/name\s*:=\s*"([^"]+)"/),n=t.match(/version\s*:=\s*"([^"]+)"/);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"),{language:"Scala",name:l?.[1]||this.getProjectName(e),version:n?.[1]||"0.1.0",dependencies:s,manifestFile:"build.sbt",projectPath:e,tags:i}}return{language:"Scala",name:this.getProjectName(e),dependencies:{},manifestFile:"build.sbt",projectPath:e,tags:i}}detectFromMill(e){return{language:"Scala",name:this.getProjectName(e),dependencies:{},manifestFile:"build.sc",projectPath:e,tags:["scala"]}}getScalaFallbackTemplate(){return`# Scala Development Guidelines
|
|
49
|
+
|
|
50
|
+
## Functional Programming
|
|
51
|
+
- Prefer immutable data structures
|
|
52
|
+
- Use case classes for data models
|
|
53
|
+
- Leverage pattern matching
|
|
54
|
+
- Use for-comprehensions for sequential operations
|
|
55
|
+
|
|
56
|
+
## Collections
|
|
57
|
+
- Use immutable collections by default
|
|
58
|
+
- Leverage map, flatMap, filter, fold
|
|
59
|
+
- Understand lazy vs strict evaluation
|
|
60
|
+
|
|
61
|
+
## Type System
|
|
62
|
+
- Use type inference where appropriate
|
|
63
|
+
- Leverage sealed traits for ADTs
|
|
64
|
+
- Use implicit conversions sparingly
|
|
65
|
+
`}}class U extends o.BasePlugin{constructor(){super(...arguments),this.name="kotlin",this.displayName="Kotlin",this.version="1.0.0",this.priority=85}async detect(e){if(!(this.fileExists(e,"build.gradle.kts")||this.fileExists(e,"settings.gradle.kts")))return null;const i=this.readFile(e,"build.gradle.kts"),s=["kotlin"],l={};return i&&(i.includes("ktor")&&(s.push("ktor"),l.ktor="*"),i.includes("spring-boot")&&(s.push("spring-boot"),l["spring-boot"]="*"),i.includes("exposed")&&s.push("exposed"),i.includes("kotlinx-coroutines")&&s.push("coroutines")),{language:"Kotlin",name:this.getProjectName(e),dependencies:l,manifestFile:"build.gradle.kts",projectPath:e,tags:s}}getTemplates(){return[{name:"kotlin-core",tags:["kotlin"],content:()=>this.loadTemplateFromFile(r.join(__dirname,"templates/lang-kotlin.md")).then(e=>e||this.getKotlinFallbackTemplate())}]}getDependencyTagMap(){return{ktor:"ktor","spring-boot":"spring-boot",exposed:"exposed","kotlinx-coroutines":"coroutines"}}getKotlinFallbackTemplate(){return`# Kotlin Development Guidelines
|
|
66
|
+
|
|
67
|
+
## Language Features
|
|
68
|
+
- Use data classes for simple data holders
|
|
69
|
+
- Leverage null safety with ?
|
|
70
|
+
- Use scope functions (let, apply, run, with, also)
|
|
71
|
+
- Prefer extension functions over utility classes
|
|
72
|
+
|
|
73
|
+
## Coroutines
|
|
74
|
+
- Use suspend functions for async operations
|
|
75
|
+
- Leverage Flow for reactive streams
|
|
76
|
+
- Understand structured concurrency
|
|
77
|
+
|
|
78
|
+
## Collections
|
|
79
|
+
- Use collection builders and operations
|
|
80
|
+
- Leverage sequences for large datasets
|
|
81
|
+
- Understand the difference between List/MutableList
|
|
82
|
+
`}}class _ extends o.BasePlugin{constructor(){super(...arguments),this.name="lua",this.displayName="Lua",this.version="1.0.0",this.priority=75}async detect(e){const i=this.listFiles(e)?.find(s=>s.endsWith(".rockspec"));if(i||this.fileExists(e,"lua_modules")){const s=["lua"];return{language:"Lua",name:this.getProjectName(e),dependencies:{},manifestFile:i||"lua_modules",projectPath:e,tags:s}}return null}getTemplates(){return[{name:"lua-core",tags:["lua"],content:()=>this.loadTemplateFromFile(r.join(__dirname,"templates/lang-lua.md")).then(e=>e||this.getLuaFallbackTemplate())}]}getDependencyTagMap(){return{lapis:"lapis",openresty:"openresty",busted:"busted"}}getLuaFallbackTemplate(){return`# Lua Development Guidelines
|
|
83
|
+
|
|
84
|
+
## Tables
|
|
85
|
+
- Tables are the primary data structure
|
|
86
|
+
- Use them for arrays, dictionaries, objects
|
|
87
|
+
- Arrays are 1-indexed
|
|
88
|
+
|
|
89
|
+
## Metatables
|
|
90
|
+
- Use metatables for OOP patterns
|
|
91
|
+
- Implement __index for inheritance
|
|
92
|
+
- Leverage metamethods
|
|
93
|
+
|
|
94
|
+
## Best Practices
|
|
95
|
+
- Keep functions small
|
|
96
|
+
- Use local variables for performance
|
|
97
|
+
- Understand upvalues and closures
|
|
98
|
+
`}}class D extends o.BasePlugin{constructor(){super(...arguments),this.name="r",this.displayName="R",this.version="1.0.0",this.priority=75}async detect(e){const i=this.listFiles(e)?.some(s=>s.endsWith(".Rproj"));if(this.fileExists(e,"DESCRIPTION")||i){const s=["r"],l={},n=this.readFile(e,"DESCRIPTION");if(n){const c=n.match(/Package:\s*(.+)/),u=n.match(/Version:\s*(.+)/);return(n.includes("tidyverse")||n.includes("dplyr"))&&s.push("tidyverse"),n.includes("shiny")&&(s.push("shiny"),l.shiny="*"),{language:"R",name:c?.[1]?.trim()||this.getProjectName(e),version:u?.[1]?.trim()||"0.1.0",dependencies:l,manifestFile:"DESCRIPTION",projectPath:e,tags:s}}return{language:"R",name:this.getProjectName(e),dependencies:{},manifestFile:i?".Rproj":"DESCRIPTION",projectPath:e,tags:s}}return null}getTemplates(){return[{name:"r-core",tags:["r"],content:()=>this.loadTemplateFromFile(r.join(__dirname,"templates/lang-r.md")).then(e=>e||this.getRFallbackTemplate())}]}getDependencyTagMap(){return{tidyverse:"tidyverse",shiny:"shiny",ggplot2:"ggplot2","data.table":"data-table"}}getRFallbackTemplate(){return`# R Development Guidelines
|
|
99
|
+
|
|
100
|
+
## Tidyverse Principles
|
|
101
|
+
- Use pipes (%>% or |>) for data transformations
|
|
102
|
+
- Prefer dplyr verbs (select, filter, mutate, summarize)
|
|
103
|
+
- Use ggplot2 for visualization
|
|
104
|
+
|
|
105
|
+
## Vectorization
|
|
106
|
+
- Operate on entire vectors, not loops
|
|
107
|
+
- Use apply family functions
|
|
108
|
+
- Leverage data.table for performance
|
|
109
|
+
|
|
110
|
+
## Best Practices
|
|
111
|
+
- Document functions with roxygen2
|
|
112
|
+
- Write unit tests with testthat
|
|
113
|
+
- Use consistent naming (snake_case)
|
|
114
|
+
`}}class M extends o.BasePlugin{constructor(){super(...arguments),this.name="perl",this.displayName="Perl",this.version="1.0.0",this.priority=70}async detect(e){if(this.fileExists(e,"Makefile.PL")||this.fileExists(e,"Build.PL")||this.fileExists(e,"cpanfile")){const t=this.fileExists(e,"Makefile.PL")?"Makefile.PL":this.fileExists(e,"Build.PL")?"Build.PL":"cpanfile";return{language:"Perl",name:this.getProjectName(e),dependencies:{},manifestFile:t,projectPath:e,tags:["perl"]}}return null}getTemplates(){return[{name:"perl-core",tags:["perl"],content:()=>this.loadTemplateFromFile(r.join(__dirname,"templates/lang-perl.md")).then(e=>e||this.getPerlFallbackTemplate())}]}getDependencyTagMap(){return{Mojolicious:"mojolicious",Dancer2:"dancer",Catalyst:"catalyst"}}getPerlFallbackTemplate(){return`# Perl Development Guidelines
|
|
115
|
+
|
|
116
|
+
## Modern Perl
|
|
117
|
+
- Use strict and warnings
|
|
118
|
+
- Leverage Moose/Moo for OOP
|
|
119
|
+
- Use Try::Tiny for exception handling
|
|
120
|
+
|
|
121
|
+
## CPAN Modules
|
|
122
|
+
- Use cpanm for installation
|
|
123
|
+
- Declare dependencies in cpanfile
|
|
124
|
+
- Test with prove
|
|
125
|
+
|
|
126
|
+
## Best Practices
|
|
127
|
+
- Follow PBP (Perl Best Practices)
|
|
128
|
+
- Use perlcritic for linting
|
|
129
|
+
- Write tests with Test::More
|
|
130
|
+
`}}class N extends o.BasePlugin{constructor(){super(...arguments),this.name="shell",this.displayName="Shell",this.version="1.0.0",this.priority=60}async detect(e){const t=this.listFiles(e);if(t?.some(s=>s.endsWith(".sh")||s==="Makefile"||s.endsWith(".bash")||s.endsWith(".zsh"))){const s=["shell"];if((t?.filter(n=>n.endsWith(".sh")||n.endsWith(".bash")||n.endsWith(".zsh")).length||0)>=2||t?.includes("install.sh")||t?.includes("setup.sh"))return{language:"Shell",name:this.getProjectName(e),dependencies:{},manifestFile:"scripts",projectPath:e,tags:s}}return null}getTemplates(){return[{name:"shell-core",tags:["shell"],content:()=>this.loadTemplateFromFile(r.join(__dirname,"templates/lang-shell.md")).then(e=>e||this.getShellFallbackTemplate())}]}getDependencyTagMap(){return{}}getShellFallbackTemplate(){return`# Shell Script Development Guidelines
|
|
131
|
+
|
|
132
|
+
## Best Practices
|
|
133
|
+
- Use #!/usr/bin/env bash for portability
|
|
134
|
+
- Always quote variables: "$var"
|
|
135
|
+
- Use set -euo pipefail for safety
|
|
136
|
+
- Check command existence with command -v
|
|
137
|
+
|
|
138
|
+
## Error Handling
|
|
139
|
+
- Use trap for cleanup
|
|
140
|
+
- Check exit codes: if ! command; then
|
|
141
|
+
- Provide meaningful error messages
|
|
142
|
+
|
|
143
|
+
## Functions
|
|
144
|
+
- Keep functions focused
|
|
145
|
+
- Use local variables
|
|
146
|
+
- Return meaningful exit codes
|
|
147
|
+
`}}exports.BasePlugin=o.BasePlugin;exports.NodeJSPlugin=d.NodeJSPlugin;exports.GoPlugin=m.GoPlugin;exports.PythonPlugin=p.PythonPlugin;exports.RustPlugin=g.RustPlugin;exports.JavaPlugin=f.JavaPlugin;exports.RubyPlugin=h.RubyPlugin;exports.PHPPlugin=y.PHPPlugin;exports.CSharpPlugin=b.CSharpPlugin;exports.CppPlugin=v.CppPlugin;exports.SwiftPlugin=x.SwiftPlugin;exports.DartPlugin=T;exports.ElixirPlugin=k;exports.KotlinPlugin=U;exports.LuaPlugin=_;exports.PerlPlugin=M;exports.RPlugin=D;exports.ScalaPlugin=S;exports.ShellPlugin=N;
|