@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.
- package/dist/index-B88j4AyE.js +13 -0
- package/dist/index-B88j4AyE.js.map +1 -0
- package/dist/index-CY-pQbuu.cjs +2 -0
- package/dist/index-CY-pQbuu.cjs.map +1 -0
- package/dist/index.cjs +75 -1
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.ts +0 -1
- package/dist/index.mjs +2214 -51
- package/dist/index.mjs.map +1 -1
- package/dist/pattern-combiner.d.ts +1 -1
- package/dist/plugin-loader.d.ts +2 -1
- package/package.json +4 -4
- package/dist/BasePlugin-6wv0hYJ9.js +0 -98
- package/dist/BasePlugin-6wv0hYJ9.js.map +0 -1
- package/dist/BasePlugin-odQJAKA-.cjs +0 -2
- package/dist/BasePlugin-odQJAKA-.cjs.map +0 -1
- package/dist/builtin-plugins/base/BasePlugin.d.ts +0 -69
- package/dist/builtin-plugins/cpp/index.d.ts +0 -46
- package/dist/builtin-plugins/csharp/index.d.ts +0 -20
- package/dist/builtin-plugins/go/index.d.ts +0 -23
- package/dist/builtin-plugins/index.d.ts +0 -16
- package/dist/builtin-plugins/java/index.d.ts +0 -22
- package/dist/builtin-plugins/nodejs/index.d.ts +0 -44
- package/dist/builtin-plugins/php/index.d.ts +0 -20
- package/dist/builtin-plugins/python/index.d.ts +0 -27
- package/dist/builtin-plugins/ruby/index.d.ts +0 -20
- package/dist/builtin-plugins/rust/index.d.ts +0 -53
- package/dist/builtin-plugins/swift/index.d.ts +0 -22
- package/dist/default_templates/angular/angular-core.md +0 -19
- package/dist/default_templates/architecture/codeowners.md +0 -123
- package/dist/default_templates/architecture/monorepo.md +0 -146
- package/dist/default_templates/architecture/nx.md +0 -122
- package/dist/default_templates/architecture/turborepo.md +0 -114
- package/dist/default_templates/ci/github-actions.md +0 -268
- package/dist/default_templates/ci/gitlab-ci.md +0 -330
- package/dist/default_templates/containers/docker-multistage.md +0 -120
- package/dist/default_templates/containers/kubernetes-deploy.md +0 -210
- package/dist/default_templates/devops/docker-compose.md +0 -111
- package/dist/default_templates/devops/docker-dockerfile.md +0 -94
- package/dist/default_templates/devops/github-actions.md +0 -160
- package/dist/default_templates/devops/gitlab-ci.md +0 -210
- package/dist/default_templates/dotnet/framework-aspnetcore.md +0 -205
- package/dist/default_templates/dotnet/framework-blazor.md +0 -271
- package/dist/default_templates/dotnet/lang-csharp.md +0 -162
- package/dist/default_templates/generic/lang-typescript.md +0 -57
- package/dist/default_templates/generic/state-redux.md +0 -21
- package/dist/default_templates/generic/state-rxjs.md +0 -6
- package/dist/default_templates/generic/style-mui.md +0 -23
- package/dist/default_templates/generic/style-tailwind.md +0 -76
- package/dist/default_templates/generic/test-cypress.md +0 -21
- package/dist/default_templates/generic/test-jest.md +0 -20
- package/dist/default_templates/generic/test-playwright.md +0 -21
- package/dist/default_templates/generic/test-vitest.md +0 -131
- package/dist/default_templates/go/lang-go.md +0 -571
- package/dist/default_templates/java/build-gradle.md +0 -102
- package/dist/default_templates/java/build-maven.md +0 -86
- package/dist/default_templates/java/framework-spring-boot.md +0 -179
- package/dist/default_templates/java/lang-java.md +0 -78
- package/dist/default_templates/java/lang-kotlin.md +0 -88
- package/dist/default_templates/meta/magic-helix-meta.md +0 -213
- package/dist/default_templates/meta/meta-debug.md +0 -459
- package/dist/default_templates/meta/meta-implement.md +0 -450
- package/dist/default_templates/meta/meta-roadmap.md +0 -265
- package/dist/default_templates/nestjs/nestjs-core.md +0 -7
- package/dist/default_templates/patterns/architecture/clean-architecture.md +0 -469
- package/dist/default_templates/patterns/architecture/dependency-injection.md +0 -517
- package/dist/default_templates/patterns/architecture/domain-driven-design.md +0 -621
- package/dist/default_templates/patterns/architecture/layered-architecture.md +0 -382
- package/dist/default_templates/patterns/architecture/repository-pattern.md +0 -408
- package/dist/default_templates/patterns/domain-expertise/nextjs-rules.md +0 -115
- package/dist/default_templates/patterns/domain-expertise/react-patterns.md +0 -181
- package/dist/default_templates/patterns/domain-expertise/server-components.md +0 -212
- package/dist/default_templates/patterns/domain-expertise/shadcn-ui.md +0 -52
- package/dist/default_templates/patterns/domain-expertise/tailwind-patterns.md +0 -52
- package/dist/default_templates/patterns/environment/container-awareness.md +0 -17
- package/dist/default_templates/patterns/environment/ide-features.md +0 -17
- package/dist/default_templates/patterns/environment/os-commands.md +0 -17
- package/dist/default_templates/patterns/organization/heading-hierarchy.md +0 -103
- package/dist/default_templates/patterns/organization/sequential-workflows.md +0 -102
- package/dist/default_templates/patterns/organization/xml-rule-groups.md +0 -64
- package/dist/default_templates/patterns/reasoning/agent-loop.md +0 -151
- package/dist/default_templates/patterns/reasoning/confirmation-gates.md +0 -141
- package/dist/default_templates/patterns/reasoning/dependency-analysis.md +0 -132
- package/dist/default_templates/patterns/reasoning/one-tool-per-iteration.md +0 -152
- package/dist/default_templates/patterns/reasoning/preview-before-action.md +0 -194
- package/dist/default_templates/patterns/reasoning/reflection-checkpoints.md +0 -166
- package/dist/default_templates/patterns/reasoning/result-verification.md +0 -157
- package/dist/default_templates/patterns/reasoning/subtask-breakdown.md +0 -131
- package/dist/default_templates/patterns/reasoning/thinking-tags.md +0 -100
- package/dist/default_templates/patterns/role-definition/capability-declarations.md +0 -72
- package/dist/default_templates/patterns/role-definition/expert-identity.md +0 -45
- package/dist/default_templates/patterns/role-definition/scope-boundaries.md +0 -61
- package/dist/default_templates/patterns/safety/code-safety-rules.md +0 -17
- package/dist/default_templates/patterns/safety/credential-handling.md +0 -17
- package/dist/default_templates/patterns/safety/destructive-warnings.md +0 -17
- package/dist/default_templates/patterns/safety/refusal-messages.md +0 -17
- package/dist/default_templates/patterns/tone/adaptive-tone.md +0 -17
- package/dist/default_templates/patterns/tone/concise-communication.md +0 -17
- package/dist/default_templates/patterns/tone/forbidden-phrases.md +0 -17
- package/dist/default_templates/patterns/tool-guidelines/function-schemas.md +0 -143
- package/dist/default_templates/patterns/tool-guidelines/parameter-examples.md +0 -137
- package/dist/default_templates/patterns/tool-guidelines/usage-policies.md +0 -105
- package/dist/default_templates/php/framework-laravel.md +0 -112
- package/dist/default_templates/php/lang-php.md +0 -94
- package/dist/default_templates/python/lang-python.md +0 -508
- package/dist/default_templates/react/react-core.md +0 -677
- package/dist/default_templates/react/react-zustand.md +0 -7
- package/dist/default_templates/ruby/framework-rails.md +0 -309
- package/dist/default_templates/ruby/framework-sinatra.md +0 -227
- package/dist/default_templates/ruby/lang-ruby.md +0 -216
- package/dist/default_templates/rust/lang-rust.md +0 -89
- package/dist/default_templates/swift/framework-vapor.md +0 -352
- package/dist/default_templates/swift/lang-swift.md +0 -291
- package/dist/default_templates/vue/style-primevue.md +0 -6
- package/dist/default_templates/vue/style-quasar.md +0 -22
- package/dist/default_templates/vue/vue-core.md +0 -108
- package/dist/default_templates/vue/vue-pinia.md +0 -5
- package/dist/index-0GK4RlUx.js +0 -1748
- package/dist/index-0GK4RlUx.js.map +0 -1
- package/dist/index-AkVwRl-r.js +0 -92
- package/dist/index-AkVwRl-r.js.map +0 -1
- package/dist/index-B6BeG1yT.cjs +0 -68
- package/dist/index-B6BeG1yT.cjs.map +0 -1
- package/dist/index-B8pyjKdF.js +0 -94
- package/dist/index-B8pyjKdF.js.map +0 -1
- package/dist/index-BQ6v041y.js +0 -13
- package/dist/index-BQ6v041y.js.map +0 -1
- package/dist/index-Baxb1vI_.js +0 -210
- package/dist/index-Baxb1vI_.js.map +0 -1
- package/dist/index-Bg8DD8ku.js +0 -216
- package/dist/index-Bg8DD8ku.js.map +0 -1
- package/dist/index-BqTqxCpG.cjs +0 -89
- package/dist/index-BqTqxCpG.cjs.map +0 -1
- package/dist/index-Bv4Q1Pr7.cjs +0 -33
- package/dist/index-Bv4Q1Pr7.cjs.map +0 -1
- package/dist/index-CN8J45Nc.cjs +0 -24
- package/dist/index-CN8J45Nc.cjs.map +0 -1
- package/dist/index-CPbv2Od1.js +0 -62
- package/dist/index-CPbv2Od1.js.map +0 -1
- package/dist/index-Cf-MC6Al.js +0 -63
- package/dist/index-Cf-MC6Al.js.map +0 -1
- package/dist/index-DDPXXXDy.cjs +0 -19
- package/dist/index-DDPXXXDy.cjs.map +0 -1
- package/dist/index-DO30AzDe.cjs +0 -19
- package/dist/index-DO30AzDe.cjs.map +0 -1
- package/dist/index-DkvW5yBY.js +0 -2249
- package/dist/index-DkvW5yBY.js.map +0 -1
- package/dist/index-Dn1ehjIj.cjs +0 -80
- package/dist/index-Dn1ehjIj.cjs.map +0 -1
- package/dist/index-DqHvgoXJ.cjs +0 -19
- package/dist/index-DqHvgoXJ.cjs.map +0 -1
- package/dist/index-K39pdw94.cjs +0 -31
- package/dist/index-K39pdw94.cjs.map +0 -1
- package/dist/index-OT2XAJkc.js +0 -117
- package/dist/index-OT2XAJkc.js.map +0 -1
- package/dist/index-TPAX4XKg.cjs +0 -30
- package/dist/index-TPAX4XKg.cjs.map +0 -1
- package/dist/index-WmVSB57y.js +0 -107
- package/dist/index-WmVSB57y.js.map +0 -1
- package/dist/index-mYXvc3Fs.js +0 -68
- package/dist/index-mYXvc3Fs.js.map +0 -1
- package/dist/index-nioXOg4m.cjs +0 -76
- package/dist/index-nioXOg4m.cjs.map +0 -1
- package/dist/index-okhY3fWD.cjs +0 -2
- package/dist/index-okhY3fWD.cjs.map +0 -1
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"index-DqHvgoXJ.cjs","sources":["../src/builtin-plugins/csharp/index.ts"],"sourcesContent":["/**\n * C# / .NET Language Plugin\n *\n * Detects C# projects via .csproj files\n */\n\nimport type { ProjectMetadata, TemplateDefinition } from '../../types';\nimport { BasePlugin } from '../base/BasePlugin';\n\nexport class CSharpPlugin extends BasePlugin {\n name = 'csharp';\n displayName = 'C#';\n version = '3.0.0';\n priority = 60;\n\n async detect(projectPath: string): Promise<ProjectMetadata | null> {\n const csprojFiles = await this.findFiles(projectPath, '*.csproj');\n\n if (csprojFiles.length === 0) {\n return null;\n }\n\n const csprojFile = csprojFiles[0];\n const content = this.readFile(projectPath, csprojFile);\n const deps: Record<string, string> = {};\n\n if (content) {\n const depMatches = content.matchAll(\n /<PackageReference\\s+Include=\"([^\"]+)\"(?:\\s+Version=\"([^\"]+)\")?/g,\n );\n for (const match of depMatches) {\n deps[match[1]] = match[2] || '*';\n }\n }\n\n return {\n language: 'C#',\n name: csprojFile.replace('.csproj', ''),\n dependencies: deps,\n manifestFile: csprojFile,\n projectPath,\n };\n }\n\n getTemplates(): TemplateDefinition[] {\n return [\n {\n name: 'csharp-core',\n tags: ['csharp', 'dotnet'],\n content: `# C# / .NET Development Guidelines\n\nThis project uses C# and .NET.\n\n## Code Style\n- Follow C# naming conventions\n- Use proper async/await patterns\n- Leverage LINQ where appropriate\n\n## Dependencies\n- Manage with NuGet\n- Review package security\n- Keep packages updated\n\n## Testing\n- Write xUnit/NUnit tests\n- Use proper assertions\n- Aim for good coverage`,\n },\n ];\n }\n\n getDependencyTagMap() {\n return {\n 'Microsoft.AspNetCore': 'aspnetcore',\n xunit: 'xunit',\n NUnit: 'nunit',\n };\n }\n}\n"],"names":["CSharpPlugin","BasePlugin","projectPath","csprojFiles","csprojFile","content","deps","depMatches","match"],"mappings":"6HASO,MAAMA,UAAqBC,EAAAA,UAAW,CAAtC,aAAA,CAAA,MAAA,GAAA,SAAA,EACL,KAAA,KAAO,SACP,KAAA,YAAc,KACd,KAAA,QAAU,QACV,KAAA,SAAW,EAAA,CAEX,MAAM,OAAOC,EAAsD,CACjE,MAAMC,EAAc,MAAM,KAAK,UAAUD,EAAa,UAAU,EAEhE,GAAIC,EAAY,SAAW,EACzB,OAAO,KAGT,MAAMC,EAAaD,EAAY,CAAC,EAC1BE,EAAU,KAAK,SAASH,EAAaE,CAAU,EAC/CE,EAA+B,CAAA,EAErC,GAAID,EAAS,CACX,MAAME,EAAaF,EAAQ,SACzB,iEAAA,EAEF,UAAWG,KAASD,EAClBD,EAAKE,EAAM,CAAC,CAAC,EAAIA,EAAM,CAAC,GAAK,GAEjC,CAEA,MAAO,CACL,SAAU,KACV,KAAMJ,EAAW,QAAQ,UAAW,EAAE,EACtC,aAAcE,EACd,aAAcF,EACd,YAAAF,CAAA,CAEJ,CAEA,cAAqC,CACnC,MAAO,CACL,CACE,KAAM,cACN,KAAM,CAAC,SAAU,QAAQ,EACzB,QAAS;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,wBAAA,CAkBX,CAEJ,CAEA,qBAAsB,CACpB,MAAO,CACL,uBAAwB,aACxB,MAAO,QACP,MAAO,OAAA,CAEX,CACF"}
|
package/dist/index-K39pdw94.cjs
DELETED
|
@@ -1,31 +0,0 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const p=require("./BasePlugin-odQJAKA-.cjs");class l extends p.BasePlugin{constructor(){super(...arguments),this.name="python",this.displayName="Python",this.version="3.0.0",this.priority=85}async detect(e){return this.fileExists(e,"pyproject.toml")?this.detectFromPyproject(e):this.fileExists(e,"requirements.txt")?this.detectFromRequirements(e):this.fileExists(e,"setup.py")?{language:"Python",name:this.getProjectName(e),dependencies:{},manifestFile:"setup.py",projectPath:e}:null}getTemplates(){return[{name:"python-core",tags:["python"],content:this.getPythonTemplate()}]}getDependencyTagMap(){return{django:"django",flask:"flask",fastapi:"fastapi",pytest:"pytest",numpy:"numpy",pandas:"pandas"}}detectFromPyproject(e){const t=this.readFile(e,"pyproject.toml");if(!t)return{language:"Python",name:this.getProjectName(e),dependencies:{},manifestFile:"pyproject.toml",projectPath:e};const o=t.match(/name\s*=\s*["']([^"']+)["']/),n=t.match(/description\s*=\s*["']([^"']+)["']/),s={},i=t.match(/\[tool\.poetry\.dependencies\]([\s\S]*?)(?:\n\[|$)/);if(i){const a=i[1].split(`
|
|
2
|
-
`);for(const c of a){const r=c.match(/^([a-zA-Z0-9_-]+)\s*=\s*["']([^"']+)["']/);r&&r[1]!=="python"&&(s[r[1]]=r[2])}}return{language:"Python",name:o?.[1]||this.getProjectName(e),description:n?.[1],dependencies:s,manifestFile:"pyproject.toml",projectPath:e}}detectFromRequirements(e){const t=this.readFile(e,"requirements.txt"),o={};if(t){for(const n of t.split(`
|
|
3
|
-
`))if(n.trim()&&!n.startsWith("#")){const s=n.split(/[=<>]/),i=s[0].trim(),a=s[1]?.trim()||"*";i&&(o[i]=a)}}return{language:"Python",name:this.getProjectName(e),dependencies:o,manifestFile:"requirements.txt",projectPath:e}}getPythonTemplate(){return`# Python Development Guidelines
|
|
4
|
-
|
|
5
|
-
This project uses Python.
|
|
6
|
-
|
|
7
|
-
## Project Structure
|
|
8
|
-
- Follow PEP 8 style guide
|
|
9
|
-
- Organize code in packages/modules
|
|
10
|
-
- Use virtual environments
|
|
11
|
-
|
|
12
|
-
## Code Style
|
|
13
|
-
- Use type hints where appropriate
|
|
14
|
-
- Follow naming conventions
|
|
15
|
-
- Write docstrings for functions and classes
|
|
16
|
-
|
|
17
|
-
## Dependencies
|
|
18
|
-
- Manage with pip/Poetry/conda
|
|
19
|
-
- Keep requirements.txt or pyproject.toml updated
|
|
20
|
-
- Pin dependency versions
|
|
21
|
-
|
|
22
|
-
## Testing
|
|
23
|
-
- Write tests with pytest
|
|
24
|
-
- Use fixtures for setup/teardown
|
|
25
|
-
- Aim for good test coverage
|
|
26
|
-
|
|
27
|
-
## Best Practices
|
|
28
|
-
- Handle exceptions properly
|
|
29
|
-
- Use context managers for resources
|
|
30
|
-
- Follow Pythonic idioms`}}exports.PythonPlugin=l;
|
|
31
|
-
//# sourceMappingURL=index-K39pdw94.cjs.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"index-K39pdw94.cjs","sources":["../src/builtin-plugins/python/index.ts"],"sourcesContent":["/**\n * Python Language Plugin\n *\n * Detects Python projects via pyproject.toml, requirements.txt, or setup.py\n * Supports Poetry, pip, and setuptools project formats\n */\n\nimport type { ProjectMetadata, TemplateDefinition } from '../../types';\nimport { BasePlugin } from '../base/BasePlugin';\n\nexport class PythonPlugin extends BasePlugin {\n name = 'python';\n displayName = 'Python';\n version = '3.0.0';\n priority = 85;\n\n async detect(projectPath: string): Promise<ProjectMetadata | null> {\n // Check for pyproject.toml (Poetry, modern Python)\n if (this.fileExists(projectPath, 'pyproject.toml')) {\n return this.detectFromPyproject(projectPath);\n }\n\n // Check for requirements.txt (pip)\n if (this.fileExists(projectPath, 'requirements.txt')) {\n return this.detectFromRequirements(projectPath);\n }\n\n // Check for setup.py (setuptools)\n if (this.fileExists(projectPath, 'setup.py')) {\n return {\n language: 'Python',\n name: this.getProjectName(projectPath),\n dependencies: {},\n manifestFile: 'setup.py',\n projectPath,\n };\n }\n\n return null;\n }\n\n getTemplates(): TemplateDefinition[] {\n return [\n {\n name: 'python-core',\n tags: ['python'],\n content: this.getPythonTemplate(),\n },\n ];\n }\n\n getDependencyTagMap() {\n return {\n django: 'django',\n flask: 'flask',\n fastapi: 'fastapi',\n pytest: 'pytest',\n numpy: 'numpy',\n pandas: 'pandas',\n };\n }\n\n // Private helper methods\n\n private detectFromPyproject(projectPath: string): ProjectMetadata {\n const content = this.readFile(projectPath, 'pyproject.toml');\n if (!content) {\n return {\n language: 'Python',\n name: this.getProjectName(projectPath),\n dependencies: {},\n manifestFile: 'pyproject.toml',\n projectPath,\n };\n }\n\n const nameMatch = content.match(/name\\s*=\\s*[\"']([^\"']+)[\"']/);\n const descMatch = content.match(/description\\s*=\\s*[\"']([^\"']+)[\"']/);\n const deps: Record<string, string> = {};\n\n // Parse Poetry dependencies\n const depsSection = content.match(\n /\\[tool\\.poetry\\.dependencies\\]([\\s\\S]*?)(?:\\n\\[|$)/,\n );\n if (depsSection) {\n const lines = depsSection[1].split('\\n');\n for (const line of lines) {\n const depMatch = line.match(/^([a-zA-Z0-9_-]+)\\s*=\\s*[\"']([^\"']+)[\"']/);\n if (depMatch && depMatch[1] !== 'python') {\n deps[depMatch[1]] = depMatch[2];\n }\n }\n }\n\n return {\n language: 'Python',\n name: nameMatch?.[1] || this.getProjectName(projectPath),\n description: descMatch?.[1],\n dependencies: deps,\n manifestFile: 'pyproject.toml',\n projectPath,\n };\n }\n\n private detectFromRequirements(projectPath: string): ProjectMetadata {\n const content = this.readFile(projectPath, 'requirements.txt');\n const deps: Record<string, string> = {};\n\n if (content) {\n for (const line of content.split('\\n')) {\n if (line.trim() && !line.startsWith('#')) {\n const parts = line.split(/[=<>]/);\n const name = parts[0].trim();\n const version = parts[1]?.trim() || '*';\n if (name) deps[name] = version;\n }\n }\n }\n\n return {\n language: 'Python',\n name: this.getProjectName(projectPath),\n dependencies: deps,\n manifestFile: 'requirements.txt',\n projectPath,\n };\n }\n\n private getPythonTemplate(): string {\n return `# Python Development Guidelines\n\nThis project uses Python.\n\n## Project Structure\n- Follow PEP 8 style guide\n- Organize code in packages/modules\n- Use virtual environments\n\n## Code Style\n- Use type hints where appropriate\n- Follow naming conventions\n- Write docstrings for functions and classes\n\n## Dependencies\n- Manage with pip/Poetry/conda\n- Keep requirements.txt or pyproject.toml updated\n- Pin dependency versions\n\n## Testing\n- Write tests with pytest\n- Use fixtures for setup/teardown\n- Aim for good test coverage\n\n## Best Practices\n- Handle exceptions properly\n- Use context managers for resources\n- Follow Pythonic idioms`;\n }\n}\n"],"names":["PythonPlugin","BasePlugin","projectPath","content","nameMatch","descMatch","deps","depsSection","lines","line","depMatch","parts","name","version"],"mappings":"6HAUO,MAAMA,UAAqBC,EAAAA,UAAW,CAAtC,aAAA,CAAA,MAAA,GAAA,SAAA,EACL,KAAA,KAAO,SACP,KAAA,YAAc,SACd,KAAA,QAAU,QACV,KAAA,SAAW,EAAA,CAEX,MAAM,OAAOC,EAAsD,CAEjE,OAAI,KAAK,WAAWA,EAAa,gBAAgB,EACxC,KAAK,oBAAoBA,CAAW,EAIzC,KAAK,WAAWA,EAAa,kBAAkB,EAC1C,KAAK,uBAAuBA,CAAW,EAI5C,KAAK,WAAWA,EAAa,UAAU,EAClC,CACL,SAAU,SACV,KAAM,KAAK,eAAeA,CAAW,EACrC,aAAc,CAAA,EACd,aAAc,WACd,YAAAA,CAAA,EAIG,IACT,CAEA,cAAqC,CACnC,MAAO,CACL,CACE,KAAM,cACN,KAAM,CAAC,QAAQ,EACf,QAAS,KAAK,kBAAA,CAAkB,CAClC,CAEJ,CAEA,qBAAsB,CACpB,MAAO,CACL,OAAQ,SACR,MAAO,QACP,QAAS,UACT,OAAQ,SACR,MAAO,QACP,OAAQ,QAAA,CAEZ,CAIQ,oBAAoBA,EAAsC,CAChE,MAAMC,EAAU,KAAK,SAASD,EAAa,gBAAgB,EAC3D,GAAI,CAACC,EACH,MAAO,CACL,SAAU,SACV,KAAM,KAAK,eAAeD,CAAW,EACrC,aAAc,CAAA,EACd,aAAc,iBACd,YAAAA,CAAA,EAIJ,MAAME,EAAYD,EAAQ,MAAM,6BAA6B,EACvDE,EAAYF,EAAQ,MAAM,oCAAoC,EAC9DG,EAA+B,CAAA,EAG/BC,EAAcJ,EAAQ,MAC1B,oDAAA,EAEF,GAAII,EAAa,CACf,MAAMC,EAAQD,EAAY,CAAC,EAAE,MAAM;AAAA,CAAI,EACvC,UAAWE,KAAQD,EAAO,CACxB,MAAME,EAAWD,EAAK,MAAM,0CAA0C,EAClEC,GAAYA,EAAS,CAAC,IAAM,WAC9BJ,EAAKI,EAAS,CAAC,CAAC,EAAIA,EAAS,CAAC,EAElC,CACF,CAEA,MAAO,CACL,SAAU,SACV,KAAMN,IAAY,CAAC,GAAK,KAAK,eAAeF,CAAW,EACvD,YAAaG,IAAY,CAAC,EAC1B,aAAcC,EACd,aAAc,iBACd,YAAAJ,CAAA,CAEJ,CAEQ,uBAAuBA,EAAsC,CACnE,MAAMC,EAAU,KAAK,SAASD,EAAa,kBAAkB,EACvDI,EAA+B,CAAA,EAErC,GAAIH,GACF,UAAWM,KAAQN,EAAQ,MAAM;AAAA,CAAI,EACnC,GAAIM,EAAK,KAAA,GAAU,CAACA,EAAK,WAAW,GAAG,EAAG,CACxC,MAAME,EAAQF,EAAK,MAAM,OAAO,EAC1BG,EAAOD,EAAM,CAAC,EAAE,KAAA,EAChBE,EAAUF,EAAM,CAAC,GAAG,QAAU,IAChCC,IAAMN,EAAKM,CAAI,EAAIC,EACzB,EAIJ,MAAO,CACL,SAAU,SACV,KAAM,KAAK,eAAeX,CAAW,EACrC,aAAcI,EACd,aAAc,mBACd,YAAAJ,CAAA,CAEJ,CAEQ,mBAA4B,CAClC,MAAO;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,yBA4BT,CACF"}
|
package/dist/index-OT2XAJkc.js
DELETED
|
@@ -1,117 +0,0 @@
|
|
|
1
|
-
import { B as p } from "./BasePlugin-6wv0hYJ9.js";
|
|
2
|
-
class d extends p {
|
|
3
|
-
constructor() {
|
|
4
|
-
super(...arguments), this.name = "python", this.displayName = "Python", this.version = "3.0.0", this.priority = 85;
|
|
5
|
-
}
|
|
6
|
-
async detect(e) {
|
|
7
|
-
return this.fileExists(e, "pyproject.toml") ? this.detectFromPyproject(e) : this.fileExists(e, "requirements.txt") ? this.detectFromRequirements(e) : this.fileExists(e, "setup.py") ? {
|
|
8
|
-
language: "Python",
|
|
9
|
-
name: this.getProjectName(e),
|
|
10
|
-
dependencies: {},
|
|
11
|
-
manifestFile: "setup.py",
|
|
12
|
-
projectPath: e
|
|
13
|
-
} : null;
|
|
14
|
-
}
|
|
15
|
-
getTemplates() {
|
|
16
|
-
return [
|
|
17
|
-
{
|
|
18
|
-
name: "python-core",
|
|
19
|
-
tags: ["python"],
|
|
20
|
-
content: this.getPythonTemplate()
|
|
21
|
-
}
|
|
22
|
-
];
|
|
23
|
-
}
|
|
24
|
-
getDependencyTagMap() {
|
|
25
|
-
return {
|
|
26
|
-
django: "django",
|
|
27
|
-
flask: "flask",
|
|
28
|
-
fastapi: "fastapi",
|
|
29
|
-
pytest: "pytest",
|
|
30
|
-
numpy: "numpy",
|
|
31
|
-
pandas: "pandas"
|
|
32
|
-
};
|
|
33
|
-
}
|
|
34
|
-
// Private helper methods
|
|
35
|
-
detectFromPyproject(e) {
|
|
36
|
-
const t = this.readFile(e, "pyproject.toml");
|
|
37
|
-
if (!t)
|
|
38
|
-
return {
|
|
39
|
-
language: "Python",
|
|
40
|
-
name: this.getProjectName(e),
|
|
41
|
-
dependencies: {},
|
|
42
|
-
manifestFile: "pyproject.toml",
|
|
43
|
-
projectPath: e
|
|
44
|
-
};
|
|
45
|
-
const o = t.match(/name\s*=\s*["']([^"']+)["']/), n = t.match(/description\s*=\s*["']([^"']+)["']/), s = {}, i = t.match(
|
|
46
|
-
/\[tool\.poetry\.dependencies\]([\s\S]*?)(?:\n\[|$)/
|
|
47
|
-
);
|
|
48
|
-
if (i) {
|
|
49
|
-
const a = i[1].split(`
|
|
50
|
-
`);
|
|
51
|
-
for (const c of a) {
|
|
52
|
-
const r = c.match(/^([a-zA-Z0-9_-]+)\s*=\s*["']([^"']+)["']/);
|
|
53
|
-
r && r[1] !== "python" && (s[r[1]] = r[2]);
|
|
54
|
-
}
|
|
55
|
-
}
|
|
56
|
-
return {
|
|
57
|
-
language: "Python",
|
|
58
|
-
name: o?.[1] || this.getProjectName(e),
|
|
59
|
-
description: n?.[1],
|
|
60
|
-
dependencies: s,
|
|
61
|
-
manifestFile: "pyproject.toml",
|
|
62
|
-
projectPath: e
|
|
63
|
-
};
|
|
64
|
-
}
|
|
65
|
-
detectFromRequirements(e) {
|
|
66
|
-
const t = this.readFile(e, "requirements.txt"), o = {};
|
|
67
|
-
if (t) {
|
|
68
|
-
for (const n of t.split(`
|
|
69
|
-
`))
|
|
70
|
-
if (n.trim() && !n.startsWith("#")) {
|
|
71
|
-
const s = n.split(/[=<>]/), i = s[0].trim(), a = s[1]?.trim() || "*";
|
|
72
|
-
i && (o[i] = a);
|
|
73
|
-
}
|
|
74
|
-
}
|
|
75
|
-
return {
|
|
76
|
-
language: "Python",
|
|
77
|
-
name: this.getProjectName(e),
|
|
78
|
-
dependencies: o,
|
|
79
|
-
manifestFile: "requirements.txt",
|
|
80
|
-
projectPath: e
|
|
81
|
-
};
|
|
82
|
-
}
|
|
83
|
-
getPythonTemplate() {
|
|
84
|
-
return `# Python Development Guidelines
|
|
85
|
-
|
|
86
|
-
This project uses Python.
|
|
87
|
-
|
|
88
|
-
## Project Structure
|
|
89
|
-
- Follow PEP 8 style guide
|
|
90
|
-
- Organize code in packages/modules
|
|
91
|
-
- Use virtual environments
|
|
92
|
-
|
|
93
|
-
## Code Style
|
|
94
|
-
- Use type hints where appropriate
|
|
95
|
-
- Follow naming conventions
|
|
96
|
-
- Write docstrings for functions and classes
|
|
97
|
-
|
|
98
|
-
## Dependencies
|
|
99
|
-
- Manage with pip/Poetry/conda
|
|
100
|
-
- Keep requirements.txt or pyproject.toml updated
|
|
101
|
-
- Pin dependency versions
|
|
102
|
-
|
|
103
|
-
## Testing
|
|
104
|
-
- Write tests with pytest
|
|
105
|
-
- Use fixtures for setup/teardown
|
|
106
|
-
- Aim for good test coverage
|
|
107
|
-
|
|
108
|
-
## Best Practices
|
|
109
|
-
- Handle exceptions properly
|
|
110
|
-
- Use context managers for resources
|
|
111
|
-
- Follow Pythonic idioms`;
|
|
112
|
-
}
|
|
113
|
-
}
|
|
114
|
-
export {
|
|
115
|
-
d as PythonPlugin
|
|
116
|
-
};
|
|
117
|
-
//# sourceMappingURL=index-OT2XAJkc.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"index-OT2XAJkc.js","sources":["../src/builtin-plugins/python/index.ts"],"sourcesContent":["/**\n * Python Language Plugin\n *\n * Detects Python projects via pyproject.toml, requirements.txt, or setup.py\n * Supports Poetry, pip, and setuptools project formats\n */\n\nimport type { ProjectMetadata, TemplateDefinition } from '../../types';\nimport { BasePlugin } from '../base/BasePlugin';\n\nexport class PythonPlugin extends BasePlugin {\n name = 'python';\n displayName = 'Python';\n version = '3.0.0';\n priority = 85;\n\n async detect(projectPath: string): Promise<ProjectMetadata | null> {\n // Check for pyproject.toml (Poetry, modern Python)\n if (this.fileExists(projectPath, 'pyproject.toml')) {\n return this.detectFromPyproject(projectPath);\n }\n\n // Check for requirements.txt (pip)\n if (this.fileExists(projectPath, 'requirements.txt')) {\n return this.detectFromRequirements(projectPath);\n }\n\n // Check for setup.py (setuptools)\n if (this.fileExists(projectPath, 'setup.py')) {\n return {\n language: 'Python',\n name: this.getProjectName(projectPath),\n dependencies: {},\n manifestFile: 'setup.py',\n projectPath,\n };\n }\n\n return null;\n }\n\n getTemplates(): TemplateDefinition[] {\n return [\n {\n name: 'python-core',\n tags: ['python'],\n content: this.getPythonTemplate(),\n },\n ];\n }\n\n getDependencyTagMap() {\n return {\n django: 'django',\n flask: 'flask',\n fastapi: 'fastapi',\n pytest: 'pytest',\n numpy: 'numpy',\n pandas: 'pandas',\n };\n }\n\n // Private helper methods\n\n private detectFromPyproject(projectPath: string): ProjectMetadata {\n const content = this.readFile(projectPath, 'pyproject.toml');\n if (!content) {\n return {\n language: 'Python',\n name: this.getProjectName(projectPath),\n dependencies: {},\n manifestFile: 'pyproject.toml',\n projectPath,\n };\n }\n\n const nameMatch = content.match(/name\\s*=\\s*[\"']([^\"']+)[\"']/);\n const descMatch = content.match(/description\\s*=\\s*[\"']([^\"']+)[\"']/);\n const deps: Record<string, string> = {};\n\n // Parse Poetry dependencies\n const depsSection = content.match(\n /\\[tool\\.poetry\\.dependencies\\]([\\s\\S]*?)(?:\\n\\[|$)/,\n );\n if (depsSection) {\n const lines = depsSection[1].split('\\n');\n for (const line of lines) {\n const depMatch = line.match(/^([a-zA-Z0-9_-]+)\\s*=\\s*[\"']([^\"']+)[\"']/);\n if (depMatch && depMatch[1] !== 'python') {\n deps[depMatch[1]] = depMatch[2];\n }\n }\n }\n\n return {\n language: 'Python',\n name: nameMatch?.[1] || this.getProjectName(projectPath),\n description: descMatch?.[1],\n dependencies: deps,\n manifestFile: 'pyproject.toml',\n projectPath,\n };\n }\n\n private detectFromRequirements(projectPath: string): ProjectMetadata {\n const content = this.readFile(projectPath, 'requirements.txt');\n const deps: Record<string, string> = {};\n\n if (content) {\n for (const line of content.split('\\n')) {\n if (line.trim() && !line.startsWith('#')) {\n const parts = line.split(/[=<>]/);\n const name = parts[0].trim();\n const version = parts[1]?.trim() || '*';\n if (name) deps[name] = version;\n }\n }\n }\n\n return {\n language: 'Python',\n name: this.getProjectName(projectPath),\n dependencies: deps,\n manifestFile: 'requirements.txt',\n projectPath,\n };\n }\n\n private getPythonTemplate(): string {\n return `# Python Development Guidelines\n\nThis project uses Python.\n\n## Project Structure\n- Follow PEP 8 style guide\n- Organize code in packages/modules\n- Use virtual environments\n\n## Code Style\n- Use type hints where appropriate\n- Follow naming conventions\n- Write docstrings for functions and classes\n\n## Dependencies\n- Manage with pip/Poetry/conda\n- Keep requirements.txt or pyproject.toml updated\n- Pin dependency versions\n\n## Testing\n- Write tests with pytest\n- Use fixtures for setup/teardown\n- Aim for good test coverage\n\n## Best Practices\n- Handle exceptions properly\n- Use context managers for resources\n- Follow Pythonic idioms`;\n }\n}\n"],"names":["PythonPlugin","BasePlugin","projectPath","content","nameMatch","descMatch","deps","depsSection","lines","line","depMatch","parts","name","version"],"mappings":";AAUO,MAAMA,UAAqBC,EAAW;AAAA,EAAtC,cAAA;AAAA,UAAA,GAAA,SAAA,GACL,KAAA,OAAO,UACP,KAAA,cAAc,UACd,KAAA,UAAU,SACV,KAAA,WAAW;AAAA,EAAA;AAAA,EAEX,MAAM,OAAOC,GAAsD;AAEjE,WAAI,KAAK,WAAWA,GAAa,gBAAgB,IACxC,KAAK,oBAAoBA,CAAW,IAIzC,KAAK,WAAWA,GAAa,kBAAkB,IAC1C,KAAK,uBAAuBA,CAAW,IAI5C,KAAK,WAAWA,GAAa,UAAU,IAClC;AAAA,MACL,UAAU;AAAA,MACV,MAAM,KAAK,eAAeA,CAAW;AAAA,MACrC,cAAc,CAAA;AAAA,MACd,cAAc;AAAA,MACd,aAAAA;AAAA,IAAA,IAIG;AAAA,EACT;AAAA,EAEA,eAAqC;AACnC,WAAO;AAAA,MACL;AAAA,QACE,MAAM;AAAA,QACN,MAAM,CAAC,QAAQ;AAAA,QACf,SAAS,KAAK,kBAAA;AAAA,MAAkB;AAAA,IAClC;AAAA,EAEJ;AAAA,EAEA,sBAAsB;AACpB,WAAO;AAAA,MACL,QAAQ;AAAA,MACR,OAAO;AAAA,MACP,SAAS;AAAA,MACT,QAAQ;AAAA,MACR,OAAO;AAAA,MACP,QAAQ;AAAA,IAAA;AAAA,EAEZ;AAAA;AAAA,EAIQ,oBAAoBA,GAAsC;AAChE,UAAMC,IAAU,KAAK,SAASD,GAAa,gBAAgB;AAC3D,QAAI,CAACC;AACH,aAAO;AAAA,QACL,UAAU;AAAA,QACV,MAAM,KAAK,eAAeD,CAAW;AAAA,QACrC,cAAc,CAAA;AAAA,QACd,cAAc;AAAA,QACd,aAAAA;AAAA,MAAA;AAIJ,UAAME,IAAYD,EAAQ,MAAM,6BAA6B,GACvDE,IAAYF,EAAQ,MAAM,oCAAoC,GAC9DG,IAA+B,CAAA,GAG/BC,IAAcJ,EAAQ;AAAA,MAC1B;AAAA,IAAA;AAEF,QAAII,GAAa;AACf,YAAMC,IAAQD,EAAY,CAAC,EAAE,MAAM;AAAA,CAAI;AACvC,iBAAWE,KAAQD,GAAO;AACxB,cAAME,IAAWD,EAAK,MAAM,0CAA0C;AACtE,QAAIC,KAAYA,EAAS,CAAC,MAAM,aAC9BJ,EAAKI,EAAS,CAAC,CAAC,IAAIA,EAAS,CAAC;AAAA,MAElC;AAAA,IACF;AAEA,WAAO;AAAA,MACL,UAAU;AAAA,MACV,MAAMN,IAAY,CAAC,KAAK,KAAK,eAAeF,CAAW;AAAA,MACvD,aAAaG,IAAY,CAAC;AAAA,MAC1B,cAAcC;AAAA,MACd,cAAc;AAAA,MACd,aAAAJ;AAAA,IAAA;AAAA,EAEJ;AAAA,EAEQ,uBAAuBA,GAAsC;AACnE,UAAMC,IAAU,KAAK,SAASD,GAAa,kBAAkB,GACvDI,IAA+B,CAAA;AAErC,QAAIH;AACF,iBAAWM,KAAQN,EAAQ,MAAM;AAAA,CAAI;AACnC,YAAIM,EAAK,KAAA,KAAU,CAACA,EAAK,WAAW,GAAG,GAAG;AACxC,gBAAME,IAAQF,EAAK,MAAM,OAAO,GAC1BG,IAAOD,EAAM,CAAC,EAAE,KAAA,GAChBE,IAAUF,EAAM,CAAC,GAAG,UAAU;AACpC,UAAIC,MAAMN,EAAKM,CAAI,IAAIC;AAAA,QACzB;AAAA;AAIJ,WAAO;AAAA,MACL,UAAU;AAAA,MACV,MAAM,KAAK,eAAeX,CAAW;AAAA,MACrC,cAAcI;AAAA,MACd,cAAc;AAAA,MACd,aAAAJ;AAAA,IAAA;AAAA,EAEJ;AAAA,EAEQ,oBAA4B;AAClC,WAAO;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,EA4BT;AACF;"}
|
package/dist/index-TPAX4XKg.cjs
DELETED
|
@@ -1,30 +0,0 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const g=require("./BasePlugin-odQJAKA-.cjs");class l extends g.BasePlugin{constructor(){super(...arguments),this.name="go",this.displayName="Go",this.version="3.0.0",this.priority=90}async detect(t){if(!this.fileExists(t,"go.mod"))return null;const o=this.readFile(t,"go.mod");if(!o)return{language:"Go",name:this.getProjectName(t),dependencies:{},manifestFile:"go.mod",projectPath:t};const r=o.match(/module\s+([^\s\n]+)/),n={},a=o.split(`
|
|
2
|
-
`);let s=!1;for(const i of a){if(i.trim().startsWith("require (")){s=!0;continue}if(s){if(i.trim()===")")break;const e=i.match(/^\s*([^\s]+)\s+v([^\s]+)/);e&&(n[e[1]]=e[2])}else if(i.trim().startsWith("require ")){const e=i.match(/require\s+([^\s]+)\s+v([^\s]+)/);e&&(n[e[1]]=e[2])}}return{language:"Go",name:r?.[1]||this.getProjectName(t),dependencies:n,manifestFile:"go.mod",projectPath:t}}getTemplates(){return[{name:"go-core",tags:["go"],content:this.getGoTemplate()}]}getDependencyTagMap(){return{"github.com/gin-gonic/gin":"gin","github.com/gofiber/fiber":"fiber","github.com/labstack/echo":"echo","gorm.io/gorm":"gorm"}}getGoTemplate(){return`# Go Development Guidelines
|
|
3
|
-
|
|
4
|
-
This project uses Go.
|
|
5
|
-
|
|
6
|
-
## Project Structure
|
|
7
|
-
- Follow standard Go project layout
|
|
8
|
-
- Organize code in packages
|
|
9
|
-
- Use proper module management
|
|
10
|
-
|
|
11
|
-
## Code Style
|
|
12
|
-
- Follow Go conventions and idioms
|
|
13
|
-
- Use \`gofmt\` for formatting
|
|
14
|
-
- Run \`golint\` and \`go vet\`
|
|
15
|
-
|
|
16
|
-
## Error Handling
|
|
17
|
-
- Handle errors explicitly
|
|
18
|
-
- Don't ignore errors
|
|
19
|
-
- Provide meaningful error messages
|
|
20
|
-
|
|
21
|
-
## Testing
|
|
22
|
-
- Write table-driven tests
|
|
23
|
-
- Use \`testing\` package
|
|
24
|
-
- Aim for good test coverage
|
|
25
|
-
|
|
26
|
-
## Dependencies
|
|
27
|
-
- Use Go modules (\`go.mod\`)
|
|
28
|
-
- Keep dependencies minimal
|
|
29
|
-
- Review dependency licenses`}}exports.GoPlugin=l;
|
|
30
|
-
//# sourceMappingURL=index-TPAX4XKg.cjs.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"index-TPAX4XKg.cjs","sources":["../src/builtin-plugins/go/index.ts"],"sourcesContent":["/**\n * Go Language Plugin\n *\n * Detects Go projects via go.mod file\n * Parses module dependencies from go.mod\n */\n\nimport type { ProjectMetadata, TemplateDefinition } from '../../types';\nimport { BasePlugin } from '../base/BasePlugin';\n\nexport class GoPlugin extends BasePlugin {\n name = 'go';\n displayName = 'Go';\n version = '3.0.0';\n priority = 90;\n\n async detect(projectPath: string): Promise<ProjectMetadata | null> {\n if (!this.fileExists(projectPath, 'go.mod')) {\n return null;\n }\n\n const content = this.readFile(projectPath, 'go.mod');\n if (!content) {\n return {\n language: 'Go',\n name: this.getProjectName(projectPath),\n dependencies: {},\n manifestFile: 'go.mod',\n projectPath,\n };\n }\n\n const moduleMatch = content.match(/module\\s+([^\\s\\n]+)/);\n const deps: Record<string, string> = {};\n\n // Parse dependencies\n const lines = content.split('\\n');\n let inRequire = false;\n for (const line of lines) {\n if (line.trim().startsWith('require (')) {\n inRequire = true;\n continue;\n }\n if (inRequire) {\n if (line.trim() === ')') break;\n const depMatch = line.match(/^\\s*([^\\s]+)\\s+v([^\\s]+)/);\n if (depMatch) {\n deps[depMatch[1]] = depMatch[2];\n }\n } else if (line.trim().startsWith('require ')) {\n const depMatch = line.match(/require\\s+([^\\s]+)\\s+v([^\\s]+)/);\n if (depMatch) {\n deps[depMatch[1]] = depMatch[2];\n }\n }\n }\n\n return {\n language: 'Go',\n name: moduleMatch?.[1] || this.getProjectName(projectPath),\n dependencies: deps,\n manifestFile: 'go.mod',\n projectPath,\n };\n }\n\n getTemplates(): TemplateDefinition[] {\n return [\n {\n name: 'go-core',\n tags: ['go'],\n content: this.getGoTemplate(),\n },\n ];\n }\n\n getDependencyTagMap() {\n return {\n 'github.com/gin-gonic/gin': 'gin',\n 'github.com/gofiber/fiber': 'fiber',\n 'github.com/labstack/echo': 'echo',\n 'gorm.io/gorm': 'gorm',\n };\n }\n\n private getGoTemplate(): string {\n return `# Go Development Guidelines\n\nThis project uses Go.\n\n## Project Structure\n- Follow standard Go project layout\n- Organize code in packages\n- Use proper module management\n\n## Code Style\n- Follow Go conventions and idioms\n- Use \\`gofmt\\` for formatting\n- Run \\`golint\\` and \\`go vet\\`\n\n## Error Handling\n- Handle errors explicitly\n- Don't ignore errors\n- Provide meaningful error messages\n\n## Testing\n- Write table-driven tests\n- Use \\`testing\\` package\n- Aim for good test coverage\n\n## Dependencies\n- Use Go modules (\\`go.mod\\`)\n- Keep dependencies minimal\n- Review dependency licenses`;\n }\n}\n"],"names":["GoPlugin","BasePlugin","projectPath","content","moduleMatch","deps","lines","inRequire","line","depMatch"],"mappings":"6HAUO,MAAMA,UAAiBC,EAAAA,UAAW,CAAlC,aAAA,CAAA,MAAA,GAAA,SAAA,EACL,KAAA,KAAO,KACP,KAAA,YAAc,KACd,KAAA,QAAU,QACV,KAAA,SAAW,EAAA,CAEX,MAAM,OAAOC,EAAsD,CACjE,GAAI,CAAC,KAAK,WAAWA,EAAa,QAAQ,EACxC,OAAO,KAGT,MAAMC,EAAU,KAAK,SAASD,EAAa,QAAQ,EACnD,GAAI,CAACC,EACH,MAAO,CACL,SAAU,KACV,KAAM,KAAK,eAAeD,CAAW,EACrC,aAAc,CAAA,EACd,aAAc,SACd,YAAAA,CAAA,EAIJ,MAAME,EAAcD,EAAQ,MAAM,qBAAqB,EACjDE,EAA+B,CAAA,EAG/BC,EAAQH,EAAQ,MAAM;AAAA,CAAI,EAChC,IAAII,EAAY,GAChB,UAAWC,KAAQF,EAAO,CACxB,GAAIE,EAAK,KAAA,EAAO,WAAW,WAAW,EAAG,CACvCD,EAAY,GACZ,QACF,CACA,GAAIA,EAAW,CACb,GAAIC,EAAK,KAAA,IAAW,IAAK,MACzB,MAAMC,EAAWD,EAAK,MAAM,0BAA0B,EAClDC,IACFJ,EAAKI,EAAS,CAAC,CAAC,EAAIA,EAAS,CAAC,EAElC,SAAWD,EAAK,KAAA,EAAO,WAAW,UAAU,EAAG,CAC7C,MAAMC,EAAWD,EAAK,MAAM,gCAAgC,EACxDC,IACFJ,EAAKI,EAAS,CAAC,CAAC,EAAIA,EAAS,CAAC,EAElC,CACF,CAEA,MAAO,CACL,SAAU,KACV,KAAML,IAAc,CAAC,GAAK,KAAK,eAAeF,CAAW,EACzD,aAAcG,EACd,aAAc,SACd,YAAAH,CAAA,CAEJ,CAEA,cAAqC,CACnC,MAAO,CACL,CACE,KAAM,UACN,KAAM,CAAC,IAAI,EACX,QAAS,KAAK,cAAA,CAAc,CAC9B,CAEJ,CAEA,qBAAsB,CACpB,MAAO,CACL,2BAA4B,MAC5B,2BAA4B,QAC5B,2BAA4B,OAC5B,eAAgB,MAAA,CAEpB,CAEQ,eAAwB,CAC9B,MAAO;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,6BA4BT,CACF"}
|
package/dist/index-WmVSB57y.js
DELETED
|
@@ -1,107 +0,0 @@
|
|
|
1
|
-
import { B as f } from "./BasePlugin-6wv0hYJ9.js";
|
|
2
|
-
class u extends f {
|
|
3
|
-
constructor() {
|
|
4
|
-
super(...arguments), this.name = "swift", this.displayName = "Swift", this.version = "3.0.0", this.priority = 75;
|
|
5
|
-
}
|
|
6
|
-
async detect(e) {
|
|
7
|
-
if (this.fileExists(e, "Package.swift"))
|
|
8
|
-
return this.detectSPM(e);
|
|
9
|
-
const t = await this.hasFiles(e, "**/*.xcodeproj"), s = await this.hasFiles(
|
|
10
|
-
e,
|
|
11
|
-
"**/*.xcworkspace"
|
|
12
|
-
);
|
|
13
|
-
return t || s ? this.detectXcode(e) : await this.hasFiles(e, "**/*.swift") ? {
|
|
14
|
-
language: "Swift",
|
|
15
|
-
name: this.getProjectName(e),
|
|
16
|
-
dependencies: {},
|
|
17
|
-
projectPath: e
|
|
18
|
-
} : null;
|
|
19
|
-
}
|
|
20
|
-
getTemplates() {
|
|
21
|
-
return [
|
|
22
|
-
{
|
|
23
|
-
name: "swift-core",
|
|
24
|
-
tags: ["swift"],
|
|
25
|
-
content: `# Swift Development Guidelines
|
|
26
|
-
|
|
27
|
-
This project uses Swift.
|
|
28
|
-
|
|
29
|
-
## Project Structure
|
|
30
|
-
- Follow Swift Package Manager conventions
|
|
31
|
-
- Use clear module organization
|
|
32
|
-
- Separate concerns appropriately
|
|
33
|
-
|
|
34
|
-
## Code Style
|
|
35
|
-
- Follow Swift API Design Guidelines
|
|
36
|
-
- Use Swift naming conventions (lowerCamelCase for vars/funcs, UpperCamelCase for types)
|
|
37
|
-
- Leverage SwiftLint for consistency
|
|
38
|
-
- Prefer value types (structs) over reference types when appropriate
|
|
39
|
-
|
|
40
|
-
## Best Practices
|
|
41
|
-
- Use optionals safely with guard/if let
|
|
42
|
-
- Leverage protocol-oriented programming
|
|
43
|
-
- Use strong type system features
|
|
44
|
-
- Handle errors with do/catch or Result types
|
|
45
|
-
- Write clear documentation comments
|
|
46
|
-
|
|
47
|
-
## Async/Concurrency
|
|
48
|
-
- Use async/await for asynchronous operations
|
|
49
|
-
- Use actors for shared mutable state
|
|
50
|
-
- Understand structured concurrency patterns
|
|
51
|
-
|
|
52
|
-
## Testing
|
|
53
|
-
- Write XCTest unit tests
|
|
54
|
-
- Use Quick/Nimble for BDD-style tests (if applicable)
|
|
55
|
-
- Mock dependencies appropriately
|
|
56
|
-
- Test async code with expectations`
|
|
57
|
-
}
|
|
58
|
-
];
|
|
59
|
-
}
|
|
60
|
-
getDependencyTagMap() {
|
|
61
|
-
return {
|
|
62
|
-
vapor: "vapor",
|
|
63
|
-
Vapor: "vapor",
|
|
64
|
-
swift: "swift"
|
|
65
|
-
};
|
|
66
|
-
}
|
|
67
|
-
detectSPM(e) {
|
|
68
|
-
const t = this.readFile(e, "Package.swift");
|
|
69
|
-
if (!t)
|
|
70
|
-
return {
|
|
71
|
-
language: "Swift",
|
|
72
|
-
name: this.getProjectName(e),
|
|
73
|
-
dependencies: {},
|
|
74
|
-
manifestFile: "Package.swift",
|
|
75
|
-
projectPath: e
|
|
76
|
-
};
|
|
77
|
-
const s = {}, i = {
|
|
78
|
-
language: "Swift",
|
|
79
|
-
name: this.getProjectName(e),
|
|
80
|
-
dependencies: s,
|
|
81
|
-
manifestFile: "Package.swift",
|
|
82
|
-
projectPath: e
|
|
83
|
-
}, a = t.match(/name:\s*"([^"]+)"/);
|
|
84
|
-
a && (i.name = a[1]);
|
|
85
|
-
const n = t.match(/swift-tools-version:\s*([\d.]+)/);
|
|
86
|
-
n && (i.description = `Swift ${n[1]}`), (t.includes("vapor") || t.includes("Vapor")) && (s.vapor = "*");
|
|
87
|
-
const o = t.matchAll(/\.package\([^)]+url:\s*"([^"]+)"/g);
|
|
88
|
-
for (const c of o) {
|
|
89
|
-
const r = c[1], l = r.split("/").pop()?.replace(".git", "") || r;
|
|
90
|
-
s[l] = "*";
|
|
91
|
-
}
|
|
92
|
-
return i;
|
|
93
|
-
}
|
|
94
|
-
detectXcode(e) {
|
|
95
|
-
return {
|
|
96
|
-
language: "Swift",
|
|
97
|
-
name: this.getProjectName(e),
|
|
98
|
-
dependencies: {},
|
|
99
|
-
description: "Xcode project",
|
|
100
|
-
projectPath: e
|
|
101
|
-
};
|
|
102
|
-
}
|
|
103
|
-
}
|
|
104
|
-
export {
|
|
105
|
-
u as SwiftPlugin
|
|
106
|
-
};
|
|
107
|
-
//# sourceMappingURL=index-WmVSB57y.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"index-WmVSB57y.js","sources":["../src/builtin-plugins/swift/index.ts"],"sourcesContent":["/**\n * Swift Language Plugin\n *\n * Detects Swift projects via Package.swift, .xcodeproj, or .xcworkspace\n */\n\nimport type { ProjectMetadata, TemplateDefinition } from '../../types';\nimport { BasePlugin } from '../base/BasePlugin';\n\nexport class SwiftPlugin extends BasePlugin {\n name = 'swift';\n displayName = 'Swift';\n version = '3.0.0';\n priority = 75;\n\n async detect(projectPath: string): Promise<ProjectMetadata | null> {\n // Check for Swift Package Manager\n if (this.fileExists(projectPath, 'Package.swift')) {\n return this.detectSPM(projectPath);\n }\n\n // Check for Xcode project\n const hasXcodeProject = await this.hasFiles(projectPath, '**/*.xcodeproj');\n const hasXcodeWorkspace = await this.hasFiles(\n projectPath,\n '**/*.xcworkspace',\n );\n\n if (hasXcodeProject || hasXcodeWorkspace) {\n return this.detectXcode(projectPath);\n }\n\n // Check for Swift files\n if (await this.hasFiles(projectPath, '**/*.swift')) {\n return {\n language: 'Swift',\n name: this.getProjectName(projectPath),\n dependencies: {},\n projectPath,\n };\n }\n\n return null;\n }\n\n getTemplates(): TemplateDefinition[] {\n return [\n {\n name: 'swift-core',\n tags: ['swift'],\n content: `# Swift Development Guidelines\n\nThis project uses Swift.\n\n## Project Structure\n- Follow Swift Package Manager conventions\n- Use clear module organization\n- Separate concerns appropriately\n\n## Code Style\n- Follow Swift API Design Guidelines\n- Use Swift naming conventions (lowerCamelCase for vars/funcs, UpperCamelCase for types)\n- Leverage SwiftLint for consistency\n- Prefer value types (structs) over reference types when appropriate\n\n## Best Practices\n- Use optionals safely with guard/if let\n- Leverage protocol-oriented programming\n- Use strong type system features\n- Handle errors with do/catch or Result types\n- Write clear documentation comments\n\n## Async/Concurrency\n- Use async/await for asynchronous operations\n- Use actors for shared mutable state\n- Understand structured concurrency patterns\n\n## Testing\n- Write XCTest unit tests\n- Use Quick/Nimble for BDD-style tests (if applicable)\n- Mock dependencies appropriately\n- Test async code with expectations`,\n },\n ];\n }\n\n getDependencyTagMap() {\n return {\n vapor: 'vapor',\n Vapor: 'vapor',\n swift: 'swift',\n };\n }\n\n private detectSPM(projectPath: string): ProjectMetadata {\n const content = this.readFile(projectPath, 'Package.swift');\n if (!content) {\n return {\n language: 'Swift',\n name: this.getProjectName(projectPath),\n dependencies: {},\n manifestFile: 'Package.swift',\n projectPath,\n };\n }\n\n const deps: Record<string, string> = {};\n const metadata: ProjectMetadata = {\n language: 'Swift',\n name: this.getProjectName(projectPath),\n dependencies: deps,\n manifestFile: 'Package.swift',\n projectPath,\n };\n\n // Extract package name\n const packageNameMatch = content.match(/name:\\s*\"([^\"]+)\"/);\n if (packageNameMatch) {\n metadata.name = packageNameMatch[1];\n }\n\n // Extract Swift tools version\n const swiftVersionMatch = content.match(/swift-tools-version:\\s*([\\d.]+)/);\n if (swiftVersionMatch) {\n metadata.description = `Swift ${swiftVersionMatch[1]}`;\n }\n\n // Detect Vapor framework\n if (content.includes('vapor') || content.includes('Vapor')) {\n deps.vapor = '*';\n }\n\n // Extract dependencies (simplified)\n const depMatches = content.matchAll(/\\.package\\([^)]+url:\\s*\"([^\"]+)\"/g);\n for (const match of depMatches) {\n const url = match[1];\n const depName = url.split('/').pop()?.replace('.git', '') || url;\n deps[depName] = '*';\n }\n\n return metadata;\n }\n\n private detectXcode(projectPath: string): ProjectMetadata {\n return {\n language: 'Swift',\n name: this.getProjectName(projectPath),\n dependencies: {},\n description: 'Xcode project',\n projectPath,\n };\n }\n}\n"],"names":["SwiftPlugin","BasePlugin","projectPath","hasXcodeProject","hasXcodeWorkspace","content","deps","metadata","packageNameMatch","swiftVersionMatch","depMatches","match","url","depName"],"mappings":";AASO,MAAMA,UAAoBC,EAAW;AAAA,EAArC,cAAA;AAAA,UAAA,GAAA,SAAA,GACL,KAAA,OAAO,SACP,KAAA,cAAc,SACd,KAAA,UAAU,SACV,KAAA,WAAW;AAAA,EAAA;AAAA,EAEX,MAAM,OAAOC,GAAsD;AAEjE,QAAI,KAAK,WAAWA,GAAa,eAAe;AAC9C,aAAO,KAAK,UAAUA,CAAW;AAInC,UAAMC,IAAkB,MAAM,KAAK,SAASD,GAAa,gBAAgB,GACnEE,IAAoB,MAAM,KAAK;AAAA,MACnCF;AAAA,MACA;AAAA,IAAA;AAGF,WAAIC,KAAmBC,IACd,KAAK,YAAYF,CAAW,IAIjC,MAAM,KAAK,SAASA,GAAa,YAAY,IACxC;AAAA,MACL,UAAU;AAAA,MACV,MAAM,KAAK,eAAeA,CAAW;AAAA,MACrC,cAAc,CAAA;AAAA,MACd,aAAAA;AAAA,IAAA,IAIG;AAAA,EACT;AAAA,EAEA,eAAqC;AACnC,WAAO;AAAA,MACL;AAAA,QACE,MAAM;AAAA,QACN,MAAM,CAAC,OAAO;AAAA,QACd,SAAS;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,MAAA;AAAA,IAgCX;AAAA,EAEJ;AAAA,EAEA,sBAAsB;AACpB,WAAO;AAAA,MACL,OAAO;AAAA,MACP,OAAO;AAAA,MACP,OAAO;AAAA,IAAA;AAAA,EAEX;AAAA,EAEQ,UAAUA,GAAsC;AACtD,UAAMG,IAAU,KAAK,SAASH,GAAa,eAAe;AAC1D,QAAI,CAACG;AACH,aAAO;AAAA,QACL,UAAU;AAAA,QACV,MAAM,KAAK,eAAeH,CAAW;AAAA,QACrC,cAAc,CAAA;AAAA,QACd,cAAc;AAAA,QACd,aAAAA;AAAA,MAAA;AAIJ,UAAMI,IAA+B,CAAA,GAC/BC,IAA4B;AAAA,MAChC,UAAU;AAAA,MACV,MAAM,KAAK,eAAeL,CAAW;AAAA,MACrC,cAAcI;AAAA,MACd,cAAc;AAAA,MACd,aAAAJ;AAAA,IAAA,GAIIM,IAAmBH,EAAQ,MAAM,mBAAmB;AAC1D,IAAIG,MACFD,EAAS,OAAOC,EAAiB,CAAC;AAIpC,UAAMC,IAAoBJ,EAAQ,MAAM,iCAAiC;AACzE,IAAII,MACFF,EAAS,cAAc,SAASE,EAAkB,CAAC,CAAC,MAIlDJ,EAAQ,SAAS,OAAO,KAAKA,EAAQ,SAAS,OAAO,OACvDC,EAAK,QAAQ;AAIf,UAAMI,IAAaL,EAAQ,SAAS,mCAAmC;AACvE,eAAWM,KAASD,GAAY;AAC9B,YAAME,IAAMD,EAAM,CAAC,GACbE,IAAUD,EAAI,MAAM,GAAG,EAAE,OAAO,QAAQ,QAAQ,EAAE,KAAKA;AAC7D,MAAAN,EAAKO,CAAO,IAAI;AAAA,IAClB;AAEA,WAAON;AAAA,EACT;AAAA,EAEQ,YAAYL,GAAsC;AACxD,WAAO;AAAA,MACL,UAAU;AAAA,MACV,MAAM,KAAK,eAAeA,CAAW;AAAA,MACrC,cAAc,CAAA;AAAA,MACd,aAAa;AAAA,MACb,aAAAA;AAAA,IAAA;AAAA,EAEJ;AACF;"}
|
package/dist/index-mYXvc3Fs.js
DELETED
|
@@ -1,68 +0,0 @@
|
|
|
1
|
-
import { B as i } from "./BasePlugin-6wv0hYJ9.js";
|
|
2
|
-
class t extends i {
|
|
3
|
-
constructor() {
|
|
4
|
-
super(...arguments), this.name = "php", this.displayName = "PHP", this.version = "3.0.0", this.priority = 65;
|
|
5
|
-
}
|
|
6
|
-
async detect(e) {
|
|
7
|
-
if (!this.fileExists(e, "composer.json"))
|
|
8
|
-
return null;
|
|
9
|
-
const s = this.readJSON(e, "composer.json");
|
|
10
|
-
if (!s)
|
|
11
|
-
return {
|
|
12
|
-
language: "PHP",
|
|
13
|
-
name: this.getProjectName(e),
|
|
14
|
-
dependencies: {},
|
|
15
|
-
manifestFile: "composer.json",
|
|
16
|
-
projectPath: e
|
|
17
|
-
};
|
|
18
|
-
const n = {
|
|
19
|
-
...s.require,
|
|
20
|
-
...s["require-dev"]
|
|
21
|
-
};
|
|
22
|
-
return {
|
|
23
|
-
language: "PHP",
|
|
24
|
-
name: s.name || this.getProjectName(e),
|
|
25
|
-
description: s.description,
|
|
26
|
-
dependencies: n,
|
|
27
|
-
manifestFile: "composer.json",
|
|
28
|
-
projectPath: e
|
|
29
|
-
};
|
|
30
|
-
}
|
|
31
|
-
getTemplates() {
|
|
32
|
-
return [
|
|
33
|
-
{
|
|
34
|
-
name: "php-core",
|
|
35
|
-
tags: ["php"],
|
|
36
|
-
content: `# PHP Development Guidelines
|
|
37
|
-
|
|
38
|
-
This project uses PHP.
|
|
39
|
-
|
|
40
|
-
## Code Style
|
|
41
|
-
- Follow PSR-12 coding standard
|
|
42
|
-
- Use PHP-CS-Fixer
|
|
43
|
-
- Type hint where possible
|
|
44
|
-
|
|
45
|
-
## Dependencies
|
|
46
|
-
- Manage with Composer
|
|
47
|
-
- Keep composer.lock committed
|
|
48
|
-
- Review package security
|
|
49
|
-
|
|
50
|
-
## Testing
|
|
51
|
-
- Write PHPUnit tests
|
|
52
|
-
- Use proper assertions
|
|
53
|
-
- Aim for good coverage`
|
|
54
|
-
}
|
|
55
|
-
];
|
|
56
|
-
}
|
|
57
|
-
getDependencyTagMap() {
|
|
58
|
-
return {
|
|
59
|
-
"laravel/framework": "laravel",
|
|
60
|
-
"symfony/symfony": "symfony",
|
|
61
|
-
"phpunit/phpunit": "phpunit"
|
|
62
|
-
};
|
|
63
|
-
}
|
|
64
|
-
}
|
|
65
|
-
export {
|
|
66
|
-
t as PHPPlugin
|
|
67
|
-
};
|
|
68
|
-
//# sourceMappingURL=index-mYXvc3Fs.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"index-mYXvc3Fs.js","sources":["../src/builtin-plugins/php/index.ts"],"sourcesContent":["/**\n * PHP Language Plugin\n *\n * Detects PHP projects via composer.json\n */\n\nimport type { ProjectMetadata, TemplateDefinition } from '../../types';\nimport { BasePlugin } from '../base/BasePlugin';\n\nexport class PHPPlugin extends BasePlugin {\n name = 'php';\n displayName = 'PHP';\n version = '3.0.0';\n priority = 65;\n\n async detect(projectPath: string): Promise<ProjectMetadata | null> {\n if (!this.fileExists(projectPath, 'composer.json')) {\n return null;\n }\n\n const composer = this.readJSON<{\n name?: string;\n description?: string;\n require?: Record<string, string>;\n 'require-dev'?: Record<string, string>;\n }>(projectPath, 'composer.json');\n\n if (!composer) {\n return {\n language: 'PHP',\n name: this.getProjectName(projectPath),\n dependencies: {},\n manifestFile: 'composer.json',\n projectPath,\n };\n }\n\n const deps = {\n ...composer.require,\n ...composer['require-dev'],\n };\n\n return {\n language: 'PHP',\n name: composer.name || this.getProjectName(projectPath),\n description: composer.description,\n dependencies: deps,\n manifestFile: 'composer.json',\n projectPath,\n };\n }\n\n getTemplates(): TemplateDefinition[] {\n return [\n {\n name: 'php-core',\n tags: ['php'],\n content: `# PHP Development Guidelines\n\nThis project uses PHP.\n\n## Code Style\n- Follow PSR-12 coding standard\n- Use PHP-CS-Fixer\n- Type hint where possible\n\n## Dependencies\n- Manage with Composer\n- Keep composer.lock committed\n- Review package security\n\n## Testing\n- Write PHPUnit tests\n- Use proper assertions\n- Aim for good coverage`,\n },\n ];\n }\n\n getDependencyTagMap() {\n return {\n 'laravel/framework': 'laravel',\n 'symfony/symfony': 'symfony',\n 'phpunit/phpunit': 'phpunit',\n };\n }\n}\n"],"names":["PHPPlugin","BasePlugin","projectPath","composer","deps"],"mappings":";AASO,MAAMA,UAAkBC,EAAW;AAAA,EAAnC,cAAA;AAAA,UAAA,GAAA,SAAA,GACL,KAAA,OAAO,OACP,KAAA,cAAc,OACd,KAAA,UAAU,SACV,KAAA,WAAW;AAAA,EAAA;AAAA,EAEX,MAAM,OAAOC,GAAsD;AACjE,QAAI,CAAC,KAAK,WAAWA,GAAa,eAAe;AAC/C,aAAO;AAGT,UAAMC,IAAW,KAAK,SAKnBD,GAAa,eAAe;AAE/B,QAAI,CAACC;AACH,aAAO;AAAA,QACL,UAAU;AAAA,QACV,MAAM,KAAK,eAAeD,CAAW;AAAA,QACrC,cAAc,CAAA;AAAA,QACd,cAAc;AAAA,QACd,aAAAA;AAAA,MAAA;AAIJ,UAAME,IAAO;AAAA,MACX,GAAGD,EAAS;AAAA,MACZ,GAAGA,EAAS,aAAa;AAAA,IAAA;AAG3B,WAAO;AAAA,MACL,UAAU;AAAA,MACV,MAAMA,EAAS,QAAQ,KAAK,eAAeD,CAAW;AAAA,MACtD,aAAaC,EAAS;AAAA,MACtB,cAAcC;AAAA,MACd,cAAc;AAAA,MACd,aAAAF;AAAA,IAAA;AAAA,EAEJ;AAAA,EAEA,eAAqC;AACnC,WAAO;AAAA,MACL;AAAA,QACE,MAAM;AAAA,QACN,MAAM,CAAC,KAAK;AAAA,QACZ,SAAS;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,MAAA;AAAA,IAkBX;AAAA,EAEJ;AAAA,EAEA,sBAAsB;AACpB,WAAO;AAAA,MACL,qBAAqB;AAAA,MACrB,mBAAmB;AAAA,MACnB,mBAAmB;AAAA,IAAA;AAAA,EAEvB;AACF;"}
|
package/dist/index-nioXOg4m.cjs
DELETED
|
@@ -1,76 +0,0 @@
|
|
|
1
|
-
"use strict";var K=Object.create;var L=Object.defineProperty;var Z=Object.getOwnPropertyDescriptor;var ee=Object.getOwnPropertyNames;var te=Object.getPrototypeOf,se=Object.prototype.hasOwnProperty;var ne=(n,e,t,s)=>{if(e&&typeof e=="object"||typeof e=="function")for(let i of ee(e))!se.call(n,i)&&i!==t&&L(n,i,{get:()=>e[i],enumerable:!(s=Z(e,i))||s.enumerable});return n};var ie=(n,e,t)=>(t=n!=null?K(te(n)):{},ne(e||!n||!n.__esModule?L(t,"default",{value:n,enumerable:!0}):t,n));const C=require("node:path"),re=require("node:url"),j=require("node:fs"),b=require("picocolors"),oe=require("glob");var T=typeof document<"u"?document.currentScript:null;function R(n){const e=Object.create(null,{[Symbol.toStringTag]:{value:"Module"}});if(n){for(const t in n)if(t!=="default"){const s=Object.getOwnPropertyDescriptor(n,t);Object.defineProperty(e,t,s.get?s:{enumerable:!0,get:()=>n[t]})}}return e.default=n,Object.freeze(e)}const f=R(C),p=R(j);function ae(n){if(n==="src/**/*.ts")return/^src\/.*\.ts$/;if(n==="src/**/*.vue")return/^src\/.*\.vue$/;const e=n.replace(/\*\*/g,".*").replace(/\*/g,"[^/]*");return new RegExp(`^${e.replace(/[.+^${}()|[\]\\]/g,"\\$&")}$`)}function ce(n,e){const t=ae(e);return n.some(s=>t.test(s))}function le(n,e,t,s){const i=new Set;for(const[r,o]of Object.entries(n.dependencies))e[r]&&i.add(e[r]);for(const r of n.configFiles)t[r]&&i.add(t[r]);for(const r in s){const o=s[r];ce(n.projectFiles,r)&&i.add(o)}return i}const O={target:"github-copilot",templateDirectory:"ai_templates",outputDirectory:".github/instructions",aiRefinement:{quality:"standard",contextLevel:"balanced",outputFormat:"markdown",tokenBudget:4e3,includeExamples:!0,includeBestPractices:!0},dependencyTagMap:{vue:"framework-vue",react:"framework-react","@angular/core":"framework-angular","@nestjs/core":"framework-nestjs",tailwindcss:"style-tailwind",primevue:"style-primevue","@mui/material":"style-mui",quasar:"style-quasar",vitest:"test-vitest",jest:"test-jest",cypress:"test-cypress",playwright:"test-playwright",rxjs:"state-rxjs",pinia:"state-pinia",redux:"state-redux",zustand:"state-zustand"},configFileTagMap:{"tailwind.config.js":"style-tailwind","tailwind.config.ts":"style-tailwind","vite.config.ts":"build-vite","vite.config.js":"build-vite","tsconfig.json":"lang-typescript"},fileGlobTagMap:{"src/**/*.vue":"framework-vue","src/**/*.tsx":"framework-react","src/**/*.go":"lang-go","src/**/*.py":"lang-python"},tagTemplateMap:{"framework-vue":[{template:"vue/vue-core.md",suffix:"vue.instructions.md"}],"state-pinia":[{template:"vue/vue-pinia.md",suffix:"vue-pinia.instructions.md"}],"style-primevue":[{template:"vue/style-primevue.md",suffix:"vue-primevue.instructions.md"}],"style-quasar":[{template:"vue/style-quasar.md",suffix:"vue-quasar.instructions.md"}],"framework-react":[{template:"react/react-core.md",suffix:"react.instructions.md"}],"state-zustand":[{template:"react/react-zustand.md",suffix:"react-zustand.instructions.md"}],"framework-nestjs":[{template:"nestjs/nestjs-core.md",suffix:"nestjs.instructions.md"}],"framework-angular":[{template:"angular/angular-core.md",suffix:"angular.instructions.md"}],"style-tailwind":[{template:"generic/style-tailwind.md",suffix:"tailwind.instructions.md"}],"style-mui":[{template:"generic/style-mui.md",suffix:"mui.instructions.md"}],"test-vitest":[{template:"generic/test-vitest.md",suffix:"vitest.instructions.md"}],"test-jest":[{template:"generic/test-jest.md",suffix:"jest.instructions.md"}],"test-cypress":[{template:"generic/test-cypress.md",suffix:"cypress.instructions.md"}],"test-playwright":[{template:"generic/test-playwright.md",suffix:"playwright.instructions.md"}],"lang-typescript":[{template:"generic/lang-typescript.md",suffix:"typescript.instructions.md"}],"lang-python":[{template:"python/lang-python.md",suffix:"python.instructions.md"}],"lang-go":[{template:"go/lang-go.md",suffix:"go.instructions.md"}],"state-rxjs":[{template:"generic/state-rxjs.md",suffix:"rxjs.instructions.md"}],"state-redux":[{template:"generic/state-redux.md",suffix:"redux.instructions.md"}]}},I={quality:"standard",contextLevel:"balanced",outputFormat:"markdown",tokenBudget:4e3,includeExamples:!0,includeBestPractices:!0};function ue(n,e){const t={...I,...e};let s=n;return s=fe(s,t.outputFormat),s=de(s,t.quality),s=ge(s,t.contextLevel),t.includeExamples||(s=pe(s)),t.includeBestPractices||(s=me(s)),s=he(s,t.tokenBudget),s}function de(n,e){switch(e){case"basic":return n.split(/\n(?=##? )/).filter(s=>{s.toLowerCase();const i=s.split(`
|
|
2
|
-
`)[0].toLowerCase();return i.includes("# ")||i.includes("overview")||i.includes("basic")||i.includes("essential")}).join(`
|
|
3
|
-
`);case"comprehensive":return n;default:return n.split(/\n(?=##? )/).filter(s=>{const i=s.split(`
|
|
4
|
-
`)[0].toLowerCase();return!i.includes("advanced")&&!i.includes("deep dive")}).join(`
|
|
5
|
-
`)}}function ge(n,e){switch(e){case"minimal":return n.split(/\n(?=##? )/).filter(s=>{const i=s.split(`
|
|
6
|
-
`)[0].toLowerCase();return!i.includes("background")&&!i.includes("why ")&&!i.includes("explanation")&&!i.includes("deep dive")}).join(`
|
|
7
|
-
`);case"extensive":return n;default:return n.split(`
|
|
8
|
-
`).filter(t=>t.startsWith("#")||t.startsWith("-")||t.startsWith("*")||t.match(/^\d+\./)||t.startsWith("```")||t.startsWith(" ")||t.trim().length===0||t.trim().length<200).join(`
|
|
9
|
-
`)}}function fe(n,e){switch(e){case"structured":return n.replace(/^### /gm,"#### ").replace(/^## /gm,"### ").replace(/^# /gm,"## ");case"conversational":return n.replace(/^- (.+)$/gm,(t,s)=>`${s}.`).replace(/\n{3,}/g,`
|
|
10
|
-
|
|
11
|
-
`);case"code-focused":{const t=n.split(`
|
|
12
|
-
`);let s=!1;return t.filter(i=>i.startsWith("```")?(s=!s,!0):s||i.startsWith("#")||i.trim().length===0?!0:i.match(/^[^.]+\./)).join(`
|
|
13
|
-
`)}default:return n}}function pe(n){let e="",t=!1,s=!1;for(const i of n.split(`
|
|
14
|
-
`)){if(i.startsWith("```")){t=!t;continue}if(!t){if(i.match(/^##+ .*example/i)){s=!0;continue}i.startsWith("##")&&(s=!1)}!t&&!s&&(e+=`${i}
|
|
15
|
-
`)}return e}function me(n){return n.split(`
|
|
16
|
-
`).filter(e=>{const t=e.toLowerCase();return!(t.match(/^##+ .*best practice/i)||t.match(/^##+ .*recommendation/i)||t.match(/^##+ .*tip/i))}).join(`
|
|
17
|
-
`)}function he(n,e){const t=e*4;if(n.length<=t)return n;const s=n.substring(0,t),i=s.lastIndexOf(`
|
|
18
|
-
## `);return i>t*.7?`${s.substring(0,i)}
|
|
19
|
-
|
|
20
|
-
<!-- Content truncated to fit token budget -->`:`${s}
|
|
21
|
-
|
|
22
|
-
<!-- Content truncated to fit token budget -->`}function ye(n){return Math.ceil(n.length/4)}const M="magic-helix.config.json",we=["ai-aligner.config.json"];function ve(n){const t=(n?[f.resolve(process.cwd(),n)]:[f.resolve(process.cwd(),M),...we.map(s=>f.resolve(process.cwd(),s))]).find((s,i)=>{const r=p.existsSync(s);return!n&&r&&i>0&&console.warn(b.yellow(` Detected legacy config file ${f.basename(s)}. Please rename it to ${M}.`)),r});if(!t)return console.log(b.gray(" No user config file found. Using built-in conventions only.")),{};try{return console.log(b.blue(" User config file found. Merging with built-in conventions.")),JSON.parse(p.readFileSync(t,"utf-8"))}catch(s){return console.error(b.red(`❌ Error parsing config file: ${s.message}`)),console.warn(b.yellow(" Please fix the JSON or remove the file. Using built-in conventions only.")),{}}}function Pe(n){const e=O,t=be(n.outputDirectory??e.outputDirectory);return{target:n.target||e.target,templateDirectory:n.templateDirectory??e.templateDirectory,outputDirectory:t,dependencyTagMap:{...e.dependencyTagMap,...n.dependencyTagMap||{}},configFileTagMap:{...e.configFileTagMap,...n.configFileTagMap||{}},fileGlobTagMap:{...e.fileGlobTagMap,...n.fileGlobTagMap||{}},tagTemplateMap:{...e.tagTemplateMap,...n.tagTemplateMap||{}},aiRefinement:{...I,...n.aiRefinement||{}}}}function be(n){const e=n.trim();if(e.endsWith(".github/instruction")||/\binstruction\/?$/.test(e)){const t=e.replace(/instruction\/?$/,"instructions");return console.warn(b.yellow(` Normalized outputDirectory from "${e}" to "${t}". Using ".github/instructions" as the default convention.`)),t}return e}class _{format(e,t,s){return e}getFileExtension(){return".md"}getFrontmatter(e,t){return`---
|
|
23
|
-
applyTo: "${e}"
|
|
24
|
-
---
|
|
25
|
-
|
|
26
|
-
`}}class Ce{format(e,t,s){return e.replace(/- \*\*([^*]+)\*\*/g,"- **$1** (important)")}getFileExtension(){return".md"}getFrontmatter(e,t){return`---
|
|
27
|
-
applyTo: "${e}"
|
|
28
|
-
assistant: claude
|
|
29
|
-
---
|
|
30
|
-
|
|
31
|
-
`}}class ke{format(e,t,s){return e.replace(/- \*\*ALWAYS\*\*/g,"- 🔴").replace(/- \*\*NEVER\*\*/g,"- ❌")}getFileExtension(){return".md"}getFrontmatter(e,t){return`---
|
|
32
|
-
applyTo: "${e}"
|
|
33
|
-
context: chat
|
|
34
|
-
---
|
|
35
|
-
|
|
36
|
-
`}}class Fe{format(e,t,s){return e}getFileExtension(){return".md"}getFrontmatter(e,t){return`---
|
|
37
|
-
applyTo: "${e}"
|
|
38
|
-
---
|
|
39
|
-
|
|
40
|
-
`}}function Se(n){switch(n){case"github-copilot":return new _;case"claude":return new Ce;case"copilot-chat":return new ke;case"generic":return new Fe;default:return new _}}const v={},Te=Object.freeze(Object.defineProperty({__proto__:null,default:v},Symbol.toStringTag,{value:"Module"}));function A(){const n=v.join(__dirname,"default_templates","patterns"),e=new Map,t=["role-definition","organization","tool-guidelines","reasoning","domain-expertise","safety","tone","environment"];for(const s of t){const i=v.join(n,s);if(!v.existsSync(i))continue;const r=v.readdirSync(i).filter(o=>o.endsWith(".md"));for(const o of r){const a=o.replace(".md",""),c=v.readFileSync(v.join(i,o),"utf-8");e.set(a,{name:a,category:s,content:c,priority:Ee(s)})}}return e}function Ee(n){return{"role-definition":1,organization:2,"tool-guidelines":3,reasoning:4,"domain-expertise":5,environment:6,tone:7,safety:8}[n]}function N(n,e){const t=[],s=n.get("expert-identity"),i=n.get("scope-boundaries");s&&t.push(s),i&&t.push(i);const r=n.get("heading-hierarchy");r&&t.push(r);const o=n.get("function-schemas"),a=n.get("usage-policies");if(o&&t.push(o),a&&t.push(a),e.framework==="react"||e.framework==="vue"){const u=n.get("react-patterns");u&&t.push(u)}if(e.libraries){if(e.libraries.includes("tailwind")){const u=n.get("tailwind-patterns");u&&t.push(u)}if(e.libraries.includes("shadcn-ui")){const u=n.get("shadcn-ui");u&&t.push(u)}}if(e.aiModel==="claude"){const u=n.get("thinking-tags"),d=n.get("concise-communication");u&&t.push(u),d&&t.push(d)}if(e.tone==="concise"){const u=n.get("concise-communication"),d=n.get("forbidden-phrases");u&&t.push(u),d&&t.push(d)}if(e.environment==="vscode"){const u=n.get("ide-features");u&&t.push(u)}const c=n.get("refusal-messages"),l=n.get("destructive-warnings");if(c&&t.push(c),l&&t.push(l),e.includePatterns)for(const u of e.includePatterns){const d=n.get(u);d&&!t.includes(d)&&t.push(d)}return e.excludePatterns?t.filter(u=>!e.excludePatterns?.includes(u.name)):t}function W(n){const e=n.sort((g,m)=>g.priority-m.priority),t=[],s=new Map;for(const g of e){s.has(g.category)||s.set(g.category,[]);const m=s.get(g.category);m&&m.push(g)}t.push(`# AI Agent Instructions
|
|
41
|
-
`);const i=s.get("role-definition");if(i){t.push(`## Role & Identity
|
|
42
|
-
`);for(const g of i)t.push(w(g.content))}const r=s.get("organization");if(r){t.push(`## Instruction Structure
|
|
43
|
-
`);for(const g of r)t.push(w(g.content))}const o=s.get("tool-guidelines");if(o){t.push(`## Tool Usage Guidelines
|
|
44
|
-
`);for(const g of o)t.push(w(g.content))}const a=s.get("reasoning");if(a){t.push(`## Reasoning & Execution Patterns
|
|
45
|
-
`);for(const g of a)t.push(w(g.content))}const c=s.get("domain-expertise");if(c){t.push(`## Domain-Specific Guidelines
|
|
46
|
-
`);for(const g of c)t.push(w(g.content))}const l=s.get("environment");if(l){t.push(`## Environment Context
|
|
47
|
-
`);for(const g of l)t.push(w(g.content))}const u=s.get("tone");if(u){t.push(`## Communication Style
|
|
48
|
-
`);for(const g of u)t.push(w(g.content))}const d=s.get("safety");if(d){t.push(`## Safety & Refusal Protocols
|
|
49
|
-
`);for(const g of d)t.push(w(g.content))}return t.join(`
|
|
50
|
-
|
|
51
|
-
`)}function w(n){let e=n.replace(/^# .+ Pattern\n+/,"");const t=e.match(/## Examples\n([\s\S]+?)(?=\n## |\n---|Z)/);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())}function z(n){const e=A(),t=N(e,n);return W(t)}const G=[{name:"Expert Identity",weight:1,required:!0,check:n=>/you are (an?|the) .+? (expert|specialist|assistant)/i.test(n)},{name:"Capability Declarations",weight:.8,required:!0,check:n=>/you (can|excel at|have expertise in)/i.test(n)},{name:"Scope Boundaries",weight:.7,required:!1,check:n=>/you (will not|won't|cannot|must not)/i.test(n)},{name:"Clear Headings",weight:.9,required:!0,check:n=>(n.match(/^##? /gm)||[]).length>=3},{name:"Structured Sections",weight:.8,required:!1,check:n=>/<rules>|<thinking>|```xml/i.test(n)||(n.match(/^###? /gm)||[]).length>=5},{name:"Tool Documentation",weight:1,required:!0,check:n=>/tool|function|command|api/i.test(n)&&/parameter|argument|input/i.test(n)},{name:"Tool Usage Policies",weight:.9,required:!0,check:n=>/when to use|when not to use|prefer|avoid/i.test(n)},{name:"Concrete Examples",weight:.8,required:!0,check:n=>(n.match(/```[\s\S]+?```/g)||[]).length>=2},{name:"Step-by-Step Process",weight:.7,required:!1,check:n=>/^\d+\. /gm.test(n)||/first|then|next|finally/i.test(n)},{name:"Thinking/Planning Phase",weight:.6,required:!1,check:n=>/<thinking>|before .+?, (think|plan|analyze)/i.test(n)},{name:"Confirmation Gates",weight:.8,required:!1,check:n=>/confirmation|preview|show .+? before|ask .+? before/i.test(n)},{name:"Refusal Guidelines",weight:1,required:!0,check:n=>/refuse|decline|cannot (assist|help) with|inappropriate/i.test(n)},{name:"Destructive Action Warnings",weight:.9,required:!1,check:n=>/warning|caution|delete|remove|overwrite/i.test(n)},{name:"Communication Style",weight:.5,required:!1,check:n=>/concise|brief|direct|friendly|professional|tone/i.test(n)},{name:"Forbidden Phrases",weight:.4,required:!1,check:n=>/do not (say|use|start with)|avoid (saying|phrases like)/i.test(n)}];function $(n){const e=G.map(d=>({element:d,passed:d.check(n)})),t=e.filter(d=>["Clear Headings","Structured Sections"].includes(d.element.name)),s=E(t),i=e.filter(d=>["Concrete Examples","Communication Style","Forbidden Phrases"].includes(d.element.name)),r=E(i),o=e.filter(d=>d.element.required),a=E(o),c=Math.round(s*.3+r*.2+a*.5),l=e.filter(d=>d.element.required&&!d.passed).map(d=>d.element.name),u=je(e,n);return{overallScore:c,structureScore:s,clarityScore:r,completenessScore:a,recommendations:u,missingElements:l}}function E(n){if(n.length===0)return 100;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);return Math.round(t/e*100)}function je(n,e){const t=[],s=n.filter(a=>a.element.required&&!a.passed);s.length>0&&t.push(`Add ${s.length} critical element(s): ${s.map(a=>a.element.name).join(", ")}`),n.find(a=>a.element.name==="Expert Identity")?.passed||t.push('Add expert identity: Start with "You are an expert [domain] specialist..."'),n.find(a=>a.element.name==="Tool Documentation")?.passed||t.push("Add tool documentation: Include function schemas with parameters and examples"),n.find(a=>a.element.name==="Refusal Guidelines")?.passed||t.push("Add refusal guidelines: Specify what requests should be declined and how");const i=(e.match(/```[\s\S]+?```/g)||[]).length;i<3&&t.push(`Add more code examples: Currently ${i}, aim for at least 5 concrete examples`),/✅|❌|good:|bad:/i.test(e)||t.push("Add ✅/❌ comparisons: Show good vs bad examples for clarity");const o=e.split(/\s+/).length;return o<500?t.push(`Instructions may be too brief (${o} words). Aim for 1000-3000 words for comprehensive guidance.`):o>5e3&&t.push(`Instructions may be too long (${o} words). Consider breaking into sections or modules.`),n.find(a=>a.element.name==="Confirmation Gates")?.passed||t.push("Consider adding confirmation gates for destructive operations (delete, overwrite)"),t.length===0&&t.push("Instructions meet quality standards. Consider A/B testing variants for optimization."),t}function xe(n,e=70){return $(n).overallScore>=e}function q(n){return n>=90?"A":n>=80?"B":n>=70?"C":n>=60?"D":"F"}function Ie(n){const e=[];if(e.push(`=== Instruction Quality Report ===
|
|
52
|
-
`),e.push(`Overall Score: ${n.overallScore}/100 (${q(n.overallScore)})
|
|
53
|
-
`),e.push(` Structure: ${n.structureScore}/100`),e.push(` Clarity: ${n.clarityScore}/100`),e.push(` Completeness: ${n.completenessScore}/100
|
|
54
|
-
`),n.missingElements.length>0){e.push("❌ Missing Critical Elements:");for(const t of n.missingElements)e.push(` - ${t}`);e.push("")}if(n.recommendations.length>0){e.push("💡 Recommendations:");for(const t of n.recommendations)e.push(` - ${t}`);e.push("")}return e.join(`
|
|
55
|
-
`)}let B=class{constructor(){this.plugins=new Map}register(e){this.plugins.has(e.name)&&console.warn(`Plugin "${e.name}" is already registered. Overwriting.`),this.plugins.set(e.name,e)}unregister(e){return this.plugins.delete(e)}get(e){return this.plugins.get(e)}getAll(){return Array.from(this.plugins.values())}clear(){this.plugins.clear()}get size(){return this.plugins.size}};const h=new B;class $e{constructor(e,t=new Map){this.analysisData=e,this.fileContentCache=t}get files(){return this.analysisData.projectFiles}get dependencies(){return this.analysisData.dependencies}get configFiles(){return this.analysisData.configFiles}getTextFile(e){return this.fileContentCache.has(e)&&this.fileContentCache.get(e)||null}hasFile(e){return this.analysisData.projectFiles.includes(e)||this.analysisData.configFiles.includes(e)}matchesPattern(e){const t=this.globToRegex(e);return this.analysisData.projectFiles.some(s=>t.test(s))}globToRegex(e){const t=e.replace(/\\/g,"\\\\").replace(/\*\*/g,"§DOUBLESTAR§").replace(/\*/g,"[^/]*").replace(/§DOUBLESTAR§/g,".*").replace(/\./g,"\\.");return new RegExp(`^${t}$`)}}async function De(n,e){const t=new Set,s=[],i=new Map,r=new Map;if(e)for(const c of n.configFiles){const l=e(c);l&&r.set(c,l)}const o=new $e(n,r);if(e){const c=o.getTextFile.bind(o);o.getTextFile=l=>{const u=c(l);return u!==null?u:e(l)}}const a=h.getAll();for(const c of a)try{const l=await Promise.resolve(c.detect(o));if(l.detected){if(l.tags)for(const d of l.tags)t.add(d);l.metadata&&i.set(c.name,l.metadata);const u=await Promise.resolve(c.generateInstructions(o,l.metadata));s.push(...u)}}catch(l){console.error(`Error running plugin ${c.name}:`,l)}return{tags:t,instructions:s,metadata:i}}function Le(){Promise.resolve().then(()=>require("./index-okhY3fWD.cjs")).then(n=>{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)})}class Me{constructor(){this.name="codeowners",this.description="Detects CODEOWNERS file and provides code ownership instructions",this.version="1.0.0"}detect(e){if(!(e.hasFile(".github/CODEOWNERS")||e.hasFile("CODEOWNERS")||e.hasFile("docs/CODEOWNERS")))return{detected:!1};const s={hasCodeOwners:!0};let i="";e.hasFile(".github/CODEOWNERS")?i=".github/CODEOWNERS":e.hasFile("CODEOWNERS")?i="CODEOWNERS":i="docs/CODEOWNERS",s.location=i;const r=e.getTextFile(i);if(r){const a=r.split(`
|
|
56
|
-
`).filter(l=>l.trim()&&!l.trim().startsWith("#"));s.ruleCount=a.length;const c=new Set;for(const l of a){const u=l.trim().split(/\s+/);if(u.length>1)for(const d of u.slice(1))d.startsWith("@")&&c.add(d)}s.ownerCount=c.size,s.owners=Array.from(c).slice(0,10)}return{detected:!0,tags:["architecture-codeowners"],metadata:s}}generateInstructions(e,t){return[{template:"architecture/codeowners.md",suffix:"codeowners.md",targetFiles:[".github/CODEOWNERS","CODEOWNERS","docs/CODEOWNERS"]}]}}class _e{constructor(){this.name="docker",this.description="Detects Docker usage and provides Docker-specific instructions",this.version="1.0.0"}detect(e){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");if(!(t||s))return{detected:!1};const o={hasDockerfile:t,hasDockerCompose:s,hasDockerignore:i};if(t){const a=e.getTextFile("Dockerfile");if(a){const c=(a.match(/FROM\s+\S+\s+AS\s+\S+/gi)||[]).length;c>0&&(o.multiStage=!0,o.stageCount=c)}}return{detected:!0,tags:["devops-docker"],metadata:o}}generateInstructions(e,t){const s=[];return t?.hasDockerfile&&s.push({template:"devops/docker-dockerfile.md",suffix:"docker-dockerfile.md",targetFiles:["**/Dockerfile"]}),t?.hasDockerCompose&&s.push({template:"devops/docker-compose.md",suffix:"docker-compose.md",targetFiles:["**/docker-compose.yml","**/docker-compose.yaml","**/compose.yml","**/compose.yaml"]}),s}}class Re{constructor(){this.name="github-actions",this.description="Detects GitHub Actions workflows and provides CI/CD-specific instructions",this.version="1.0.0"}detect(e){if(!(e.matchesPattern(".github/workflows/*.yml")||e.matchesPattern(".github/workflows/*.yaml")))return{detected:!1};const s={hasWorkflows:!0},i=e.files.filter(r=>r.startsWith(".github/workflows/")&&(r.endsWith(".yml")||r.endsWith(".yaml")));if(i.length>0){s.workflowCount=i.length,s.workflowFiles=i;const r=e.getTextFile(i[0]);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"))}return{detected:!0,tags:["devops-github-actions","ci-cd"],metadata:s}}generateInstructions(e,t){return[{template:"devops/github-actions.md",suffix:"github-actions.md",targetFiles:[".github/workflows/*.yml",".github/workflows/*.yaml"]}]}}class Oe{constructor(){this.name="gitlab-ci",this.description="Detects GitLab CI/CD configuration and provides CI/CD-specific instructions",this.version="1.0.0"}detect(e){if(!e.hasFile(".gitlab-ci.yml"))return{detected:!1};const s={hasGitLabCI:!0},i=e.getTextFile(".gitlab-ci.yml");if(i){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:");const o=i.match(/^stages:\s*\n((?: {2}- .+\n?)+)/m);if(o){const a=o[1].match(/- (.+)/g)?.map(c=>c.replace(/- /,"").trim());a&&(s.stages=a)}}return{detected:!0,tags:["devops-gitlab-ci","ci-cd"],metadata:s}}generateInstructions(e,t){return[{template:"devops/gitlab-ci.md",suffix:"gitlab-ci.md",targetFiles:[".gitlab-ci.yml"]}]}}class Ae{constructor(){this.name="golang",this.description="Detects Go (Golang) projects and provides Go-specific instructions",this.version="1.0.0"}detect(e){const t=e.hasFile("go.mod"),s=e.matchesPattern("**/*.go");if(!(t||s))return{detected:!1};const r=e.getTextFile("go.mod"),o={hasGoMod:t,hasGoFiles:s};if(r){const a=r.match(/^module\s+(.+)$/m);a&&(o.moduleName=a[1].trim());const c=r.match(/^go\s+([\d.]+)$/m);c&&(o.goVersion=c[1])}return{detected:!0,tags:["lang-go"],metadata:o}}generateInstructions(e,t){return[{template:"go/lang-go.md",suffix:"lang-go.md",targetFiles:["**/*.go"]}]}}class Ne{constructor(){this.name="monorepo",this.description="Detects monorepo structures and provides monorepo-specific instructions",this.version="1.0.0"}detect(e){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"');if(e.hasFile("package.json")&&e.getTextFile("package.json")?.includes('"workspaces"'),!(t||s||i||r||o))return{detected:!1};const c={hasTurbo:t,hasNx:s,hasPnpmWorkspace:i,hasLerna:r,hasYarnWorkspaces:o};if(t){c.tool="turborepo";const d=e.getTextFile("turbo.json");d&&(c.hasPipeline=d.includes('"pipeline"'))}else s?c.tool="nx":i?c.tool="pnpm":r?c.tool="lerna":c.tool="npm/yarn workspaces";const l=["packages/*/package.json","apps/*/package.json"],u=e.files.filter(d=>l.some(g=>new RegExp(g.replace(/\*/g,"[^/]+")).test(d)));return u.length>0&&(c.packageCount=u.length),{detected:!0,tags:["architecture-monorepo"],metadata:c}}generateInstructions(e,t){const s=[{template:"architecture/monorepo.md",suffix:"monorepo.md",targetFiles:["package.json","turbo.json","nx.json","pnpm-workspace.yaml","lerna.json"]}];return t?.tool==="turborepo"?s.push({template:"architecture/turborepo.md",suffix:"turborepo.md",targetFiles:["turbo.json"]}):t?.tool==="nx"&&s.push({template:"architecture/nx.md",suffix:"nx.md",targetFiles:["nx.json","workspace.json"]}),s}}class We{constructor(){this.name="php",this.description="Detects PHP projects and provides PHP-specific instructions",this.version="1.0.0"}detect(e){const t=e.hasFile("composer.json"),s=e.hasFile("composer.lock"),i=e.matchesPattern("**/*.php");if(!(t||i))return{detected:!1};const o={hasComposerJson:t,hasComposerLock:s,hasPhpFiles:i},a=e.getTextFile("composer.json");if(a){a.includes('"laravel/framework"')?(o.framework="laravel",o.hasArtisan=e.hasFile("artisan")):a.includes('"symfony/')&&(o.framework="symfony");const c=a.match(/"name"\s*:\s*"([^"]+)"/);c&&(o.projectName=c[1])}return{detected:!0,tags:["lang-php"],metadata:o}}generateInstructions(e,t){const s=[{template:"php/lang-php.md",suffix:"lang-php.md",targetFiles:["**/*.php"]}];return t?.framework==="laravel"&&s.push({template:"php/framework-laravel.md",suffix:"framework-laravel.md",targetFiles:["**/*.php"]}),s}}class ze{constructor(){this.name="python",this.description="Detects Python projects and provides Python-specific instructions",this.version="1.0.0"}detect(e){const t=e.hasFile("pyproject.toml"),s=e.hasFile("requirements.txt"),i=e.hasFile("setup.py"),r=e.hasFile("Pipfile"),o=e.matchesPattern("**/*.py");if(!(t||s||i||r||o))return{detected:!1};const c={hasPyprojectToml:t,hasRequirementsTxt:s,hasSetupPy:i,hasPipfile:r,hasPyFiles:o};if(t){const d=e.getTextFile("pyproject.toml");d&&(d.includes("[tool.poetry]")?c.packageManager="poetry":d.includes("[build-system]")&&(c.packageManager="pip"))}else r?c.packageManager="pipenv":s&&(c.packageManager="pip");const l=[],u=e.getTextFile("requirements.txt");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),{detected:!0,tags:["lang-python"],metadata:c}}generateInstructions(e,t){return[{template:"python/lang-python.md",suffix:"lang-python.md",targetFiles:["**/*.py"]}]}}class Ge{constructor(){this.name="rust",this.description="Detects Rust projects and provides Rust-specific instructions",this.version="1.0.0"}detect(e){const t=e.hasFile("Cargo.toml"),s=e.hasFile("Cargo.lock"),i=e.matchesPattern("**/*.rs");if(!(t||i))return{detected:!1};const o=e.getTextFile("Cargo.toml"),a={hasCargoToml:t,hasCargoLock:s,hasRustFiles:i};if(o){const c=o.match(/^\[package\][\s\S]*?^name\s*=\s*"(.+?)"/m);c&&(a.packageName=c[1]);const l=o.match(/^edition\s*=\s*"(\d+)"/m);l&&(a.edition=l[1]),o.includes("[workspace]")&&(a.isWorkspace=!0)}return{detected:!0,tags:["lang-rust"],metadata:a}}generateInstructions(e,t){return[{template:"rust/lang-rust.md",suffix:"lang-rust.md",targetFiles:["**/*.rs"]}]}}class x{constructor(e={}){this.loadedPlugins=new Map,this.loadErrors=[],this.verbose=e.verbose??!1}async loadBuiltinPlugins(e){const t=[];try{const{NodeJSPlugin:s}=await Promise.resolve().then(()=>require("./index-B6BeG1yT.cjs")),{GoPlugin:i}=await Promise.resolve().then(()=>require("./index-TPAX4XKg.cjs")),{PythonPlugin:r}=await Promise.resolve().then(()=>require("./index-K39pdw94.cjs")),{RustPlugin:o}=await Promise.resolve().then(()=>require("./index-BqTqxCpG.cjs")),{JavaPlugin:a}=await Promise.resolve().then(()=>require("./index-CN8J45Nc.cjs")),{RubyPlugin:c}=await Promise.resolve().then(()=>require("./index-DO30AzDe.cjs")),{PHPPlugin:l}=await Promise.resolve().then(()=>require("./index-DDPXXXDy.cjs")),{CSharpPlugin:u}=await Promise.resolve().then(()=>require("./index-DqHvgoXJ.cjs")),{SwiftPlugin:d}=await Promise.resolve().then(()=>require("./index-Bv4Q1Pr7.cjs")),{CppPlugin:g}=await Promise.resolve().then(()=>require("./index-Dn1ehjIj.cjs")),m=[s,i,r,o,a,c,l,u,d,g];for(const S of m){const P=new S;if(e&&!e.includes(P.name))continue;const X=Date.now(),D={plugin:P,source:{type:"builtin",identifier:P.name,packageName:"magic-helix-plugins"},loadTime:Date.now()-X};this.loadedPlugins.set(P.name,D),t.push(D),this.log(`Loaded built-in plugin: ${P.displayName} (${P.name})`)}}catch(s){this.handleLoadError({type:"builtin",identifier:"magic-helix-plugins"},s)}return t}async loadNpmPlugin(e){try{const t=Date.now(),s=await this.tryImport(e);if(!s)throw new Error(`Package "${e}" not found`);const i=s.default||s.Plugin||s;if(typeof i!="function")throw new Error(`Package "${e}" does not export a valid plugin class`);const r=new i,o=Date.now()-t;this.validatePlugin(r);const a={plugin:r,source:{type:"npm",identifier:e,packageName:e},loadTime:o};return this.loadedPlugins.set(r.name,a),this.log(`✓ Loaded npm plugin: ${r.displayName} from ${e} (${o}ms)`),a}catch(t){return this.handleLoadError({type:"npm",identifier:e,packageName:e},t),null}}async loadLocalPlugin(e){try{const t=f.resolve(e);if(!p.existsSync(t))throw new Error(`Plugin file not found: ${t}`);const s=Date.now(),i=await import(t),r=Date.now()-s,o=i.default||i.Plugin||i;if(typeof o!="function")throw new Error(`File "${e}" does not export a valid plugin class`);const a=new o;this.validatePlugin(a);const c={plugin:a,source:{type:"local",identifier:e,path:t},loadTime:r};return this.loadedPlugins.set(a.name,c),this.log(`✓ Loaded local plugin: ${a.displayName} from ${e} (${r}ms)`),c}catch(t){return this.handleLoadError({type:"local",identifier:e,path:e},t),null}}async loadWorkspacePlugins(e,t){const s=[],i=t||[".magic-helix/plugins/**/*.js",".magic-helix/plugins/**/*.mjs"];try{const{glob:r}=await import("glob");for(const o of i){const a=await r(o,{cwd:e,absolute:!0});for(const c of a){const l=await this.loadLocalPlugin(c);l&&(l.source.type="workspace",s.push(l))}}}catch(r){this.logWarning(`Error loading workspace plugins: ${r.message}`)}return s}getPlugin(e){return this.loadedPlugins.get(e)?.plugin}getAllPlugins(){return Array.from(this.loadedPlugins.values()).map(e=>e.plugin).sort((e,t)=>t.priority-e.priority)}getPluginsByNames(e){return e.map(t=>this.getPlugin(t)).filter(t=>t!==void 0)}async detectProject(e){const t=this.getAllPlugins();for(const s of t)try{this.log(`Trying plugin: ${s.displayName}`);const i=await s.detect(e);if(i)return this.log(`✓ Detected ${i.language} project with ${s.displayName}`),{metadata:i,plugin:s}}catch(i){this.logWarning(`Plugin ${s.name} detection failed: ${i.message}`)}return null}async scanForProjects(e,t=5){const s=new Set,i=new Set,r=["package.json","Cargo.toml","go.mod","go.sum","setup.py","pyproject.toml","requirements.txt","pom.xml","build.gradle","build.gradle.kts","Package.swift","Gemfile","composer.json","CMakeLists.txt","Makefile","platformio.ini"],o=new Set(["node_modules","target","dist","build",".git",".svn",".hg","vendor","__pycache__",".venv","venv","env",".cargo",".gradle"]),a=async(c,l)=>{if(l>t)return;const u=f.normalize(c);if(!i.has(u)){i.add(u);try{const d=await p.promises.readdir(c,{withFileTypes:!0});let g=!1;for(const m of d)if(!m.isDirectory()&&r.includes(m.name)){s.add(c),g=!0;break}for(const m of d)if(m.isDirectory()&&!o.has(m.name)){const S=f.join(c,m.name);await a(S,l+1)}}catch{return}}};return await a(e,0),Array.from(s).sort()}async detectAllProjects(e){const t=[],s=new Set,i=this.getAllPlugins();for(const r of i)try{const o=await r.detect(e);if(o&&(s.add(o.projectPath),t.push({metadata:o,plugin:r}),o.workspaceMembers&&o.workspaceMembers.length>0))for(const a of o.workspaceMembers){const c=f.resolve(e,a);if(!s.has(c)){const l=await this.detectProject(c);l&&(s.add(l.metadata.projectPath),t.push(l))}}}catch(o){this.logWarning(`Plugin ${r.name} failed: ${o.message}`)}try{const r=await this.scanForProjects(e);for(const o of r)if(!s.has(o)){const a=await this.detectProject(o);a&&(s.add(a.metadata.projectPath),t.push(a))}}catch(r){this.logWarning(`Recursive scan failed: ${r.message}`)}return t}getLoadErrors(){return[...this.loadErrors]}clear(){this.loadedPlugins.clear(),this.loadErrors=[]}getStats(){const e=Array.from(this.loadedPlugins.values()),t={};for(const s of e)t[s.source.type]=(t[s.source.type]||0)+1;return{totalLoaded:e.length,totalErrors:this.loadErrors.length,averageLoadTime:e.length>0?e.reduce((s,i)=>s+i.loadTime,0)/e.length:0,byType:t}}validatePlugin(e){if(!e||typeof e!="object")throw new Error("Plugin must be an object");const t=e;if(!t.name||typeof t.name!="string")throw new Error('Plugin must have a "name" property');if(!t.displayName||typeof t.displayName!="string")throw new Error('Plugin must have a "displayName" property');if(!t.version||typeof t.version!="string")throw new Error('Plugin must have a "version" property');if(typeof t.priority!="number")throw new Error('Plugin must have a "priority" property');if(typeof t.detect!="function")throw new Error('Plugin must implement "detect" method');if(typeof t.getTemplates!="function")throw new Error('Plugin must implement "getTemplates" method')}async tryImport(e){try{return await import(e)}catch{return null}}handleLoadError(e,t){this.loadErrors.push({source:e,error:t,timestamp:new Date}),this.logWarning(`Failed to load plugin "${e.identifier}": ${t.message}`)}log(e){this.verbose&&console.log(`[PluginLoader] ${e}`)}logWarning(e){this.verbose&&console.warn(`[PluginLoader] ⚠️ ${e}`)}}const y=class y{constructor(){this.initialized=!1,this.loader=new x({verbose:!1}),this.config={}}static getInstance(){return y.instance||(y.instance=new y),y.instance}async initialize(e={}){if(!this.initialized&&(this.config=e,this.loader=new x({verbose:e.verbose}),await this.loadConfiguredPlugins(e.plugins),this.initialized=!0,e.verbose)){const t=this.loader.getStats();console.log(`[PluginRegistry] Initialized with ${t.totalLoaded} plugins`),console.log(`[PluginRegistry] Load time: ${t.averageLoadTime.toFixed(2)}ms avg`)}}reset(){this.loader.clear(),this.initialized=!1,this.config={}}async ensureInitialized(){this.initialized||await this.initialize()}async getPlugin(e){return await this.ensureInitialized(),this.loader.getPlugin(e)}async getAllPlugins(){return await this.ensureInitialized(),this.loader.getAllPlugins()}async detectProject(e){return await this.ensureInitialized(),this.loader.detectProject(e)}async detectAllProjects(e){return await this.ensureInitialized(),this.loader.detectAllProjects(e)}async getPluginForLanguage(e){await this.ensureInitialized();const t=this.loader.getAllPlugins();let s=t.find(i=>i.name===e.toLowerCase());return s||(s=t.find(i=>i.displayName.toLowerCase()===e.toLowerCase()),s)||(s=t.find(i=>i.displayName.toLowerCase().includes(e.toLowerCase())||e.toLowerCase().includes(i.name))),s}async loadPlugin(e){return await this.ensureInitialized(),(e.type==="npm"?await this.loader.loadNpmPlugin(e.path):await this.loader.loadLocalPlugin(e.path))?.plugin??null}async getStats(){await this.ensureInitialized();const e=this.loader.getStats();return{totalPlugins:e.totalLoaded,loadErrors:e.totalErrors,averageLoadTime:e.averageLoadTime,pluginsByType:e.byType}}async getLoadErrors(){return await this.ensureInitialized(),this.loader.getLoadErrors().map(e=>({source:e.source.identifier,error:e.error.message,timestamp:e.timestamp}))}getStatistics(){return this.loader.getStats()}async loadConfiguredPlugins(e={}){const{builtin:t=[],npm:s=[],local:i=[],workspace:r=[],disabled:o=[]}=e;if(t.length>0){const a=t.filter(c=>!o.includes(c));await this.loader.loadBuiltinPlugins(a)}else await this.loader.loadBuiltinPlugins();o.includes("@el-j/magic-helix-plugins")||await this.loader.loadNpmPlugin("@el-j/magic-helix-plugins").catch(()=>{});for(const a of s)o.includes(a)||await this.loader.loadNpmPlugin(a);for(const a of i)if(!o.includes(a)){const c=this.resolvePath(a);await this.loader.loadLocalPlugin(c)}this.config.workspacePath&&r.length>0&&await this.loader.loadWorkspacePlugins(this.config.workspacePath,r),e.priority&&this.applyPriorityOverrides(e.priority)}resolvePath(e){if(e.startsWith("~/")){const s=process.env.HOME||process.env.USERPROFILE||"";return f.join(s,e.slice(2))}if(f.isAbsolute(e))return e;const t=this.config.workspacePath||process.cwd();return f.resolve(t,e)}applyPriorityOverrides(e){for(const[t,s]of Object.entries(e)){const i=this.loader.getPlugin(t);i&&(i.priority=s)}}static async loadConfigFromFile(e){try{if(!p.existsSync(e))return null;const t=p.readFileSync(e,"utf-8");return JSON.parse(t)}catch(t){return console.warn(`Failed to load config from ${e}: ${t.message}`),null}}static async loadConfig(e){const t=[],s=process.env.HOME||process.env.USERPROFILE;if(s){const i=f.join(s,".magic-helix","config.json"),r=await y.loadConfigFromFile(i);r&&t.push(r)}if(e){const i=f.join(e,".magic-helix.json"),r=await y.loadConfigFromFile(i);r&&(r.workspacePath=e,t.push(r))}return t.length===0?{workspacePath:e}:t.reduce((i,r)=>{const o={...i.plugins||{},...r.plugins||{}},a={...i.templates||{},...r.templates||{}};return Object.assign({},i,r,{plugins:o,templates:a})},{workspacePath:e})}};y.instance=null;let k=y;function qe(){return k.getInstance()}async function Be(n){const e=k.getInstance();return await e.initialize(n),e}class Ue{constructor(e={}){this.templateCache=new Map,this.config=e.config||{},this.verbose=e.verbose??!1,this.cacheEnabled=e.cacheEnabled??!0}async loadTemplate(e,t=[]){const s=`${e}:${t.map(i=>i.name).join(",")}`;if(this.cacheEnabled&&this.templateCache.has(s)){const i=this.templateCache.get(s);if(i)return{content:i,source:"plugin",path:"(cached)"}}if(this.config.overrides?.[e]){const i=this.config.overrides[e],r=await this.loadFromPath(i,"override");if(r)return this.cacheTemplate(s,r.content),r}if(this.config.searchPaths)for(const i of this.config.searchPaths){const r=await this.searchInDirectory(i,e,i.includes(".magic-helix")?"workspace":"global");if(r)return this.cacheTemplate(s,r.content),r}for(const i of t){const r=await this.loadFromPlugin(i,e);if(r)return this.cacheTemplate(s,r.content),r}return this.log(`Template "${e}" not found`),null}async loadPluginTemplates(e){try{const t=await Promise.resolve(e.getTemplates());return this.log(`Loaded ${t.length} templates from ${e.displayName}`),t}catch(t){return this.logWarning(`Failed to load templates from ${e.name}: ${t.message}`),[]}}async loadTemplates(e,t=[]){const s=new Map;for(const i of e){const r=await this.loadTemplate(i,t);r&&s.set(i,r)}return s}async findTemplatesByTags(e,t=[]){const s=[];for(const i of t){const r=await this.loadPluginTemplates(i);s.push(...r)}return s.filter(i=>i.tags.some(r=>e.includes(r)))}async resolveTemplateContent(e){return typeof e.content=="string"?e.content:await Promise.resolve(e.content())}clearCache(){this.templateCache.clear(),this.log("Template cache cleared")}getCacheStats(){return{size:this.templateCache.size,keys:Array.from(this.templateCache.keys())}}async loadFromPath(e,t){try{const s=this.resolvePath(e);if(!p.existsSync(s))return this.log(`Template not found at: ${s}`),null;const i=p.readFileSync(s,"utf-8");return this.log(`✓ Loaded template from ${t}: ${s}`),{content:i,source:t,path:s}}catch(s){return this.logWarning(`Failed to load template from ${e}: ${s.message}`),null}}async searchInDirectory(e,t,s){const i=this.resolvePath(e);if(!p.existsSync(i))return null;const r=this.config.extensions||[".md",".txt",""];for(const o of r){const a=t.endsWith(o)?t:`${t}${o}`,c=f.join(i,a);if(p.existsSync(c))return this.loadFromPath(c,s)}return null}async loadFromPlugin(e,t){try{const i=(await this.loadPluginTemplates(e)).find(o=>o.name===t);if(!i)return null;const r=await this.resolveTemplateContent(i);return this.log(`✓ Loaded template "${t}" from plugin: ${e.displayName}`),{content:r,source:"plugin",path:`plugin:${e.name}/${t}`,plugin:e.name}}catch(s){return this.logWarning(`Failed to load template "${t}" from plugin ${e.name}: ${s.message}`),null}}resolvePath(e){if(e.startsWith("~/")){const t=process.env.HOME||process.env.USERPROFILE||"";return f.join(t,e.slice(2))}return f.isAbsolute(e)?e:f.resolve(process.cwd(),e)}cacheTemplate(e,t){this.cacheEnabled&&this.templateCache.set(e,t)}log(e){this.verbose&&console.log(`[TemplateLoader] ${e}`)}logWarning(e){this.verbose&&console.warn(`[TemplateLoader] ⚠️ ${e}`)}}const F=".magic-helix",U="meta-instructions.json";function H(n){const e=f.join(n,F,U);if(!p.existsSync(e))return null;try{const t=p.readFileSync(e,"utf-8");return JSON.parse(t)}catch(t){return console.warn(`Failed to load meta-instruction config: ${t.message}`),null}}function V(n){const e=f.join(n,F,"overrides"),t=new Map;if(!p.existsSync(e))return t;const s=oe.glob.sync("**/*.md",{cwd:e,absolute:!0});for(const i of s){const r=f.basename(i,".md"),o=p.readFileSync(i,"utf-8");t.set(r,o)}return t}function J(n,e,t){const s=new Map(n);if(e.ignoreTags)for(const r of e.ignoreTags)s.delete(r);const i=V(t);for(const[r,o]of i)s.set(r,o);if(e.overrides)for(const r of e.overrides){const o=s.get(r.tag);switch(r.mode){case"replace":s.set(r.tag,r.content);break;case"prepend":o?s.set(r.tag,`${r.content}
|
|
57
|
-
|
|
58
|
-
${o}`):s.set(r.tag,r.content);break;case"append":o?s.set(r.tag,`${o}
|
|
59
|
-
|
|
60
|
-
${r.content}`):s.set(r.tag,r.content);break}}return s}function Y(n,e){const t=new Map(n);let s=e.template;for(const i of e.tags){const r=n.get(i);r&&(s=s.replace(`{{${i}}}`,r))}return t.set(e.outputTag,s),t}function He(n,e){const t=H(e);if(!t)return n;let s=J(n,t,e);if(t.combiners)for(const i of t.combiners)s=Y(s,i);return s}function Ve(n){const e=f.join(n,F);return p.existsSync(e)}function Je(n){const e=f.join(n,F),t=f.join(e,"overrides");p.mkdirSync(e,{recursive:!0}),p.mkdirSync(t,{recursive:!0});const s={overrides:[{tag:"example-tag",content:`# Custom Instruction
|
|
61
|
-
|
|
62
|
-
Your content here...`,mode:"replace"}],combiners:[{tags:["tag1","tag2"],outputTag:"combined-tag",template:`# Combined Instructions
|
|
63
|
-
|
|
64
|
-
{{tag1}}
|
|
65
|
-
|
|
66
|
-
---
|
|
67
|
-
|
|
68
|
-
{{tag2}}`}],ignoreTags:["unwanted-tag"]},i=f.join(e,U);p.writeFileSync(i,JSON.stringify(s,null,2)),p.writeFileSync(f.join(t,"example.md"),`# Example Override
|
|
69
|
-
|
|
70
|
-
This file overrides the default instructions for this tag.
|
|
71
|
-
Create files like:
|
|
72
|
-
- react-core.md → overrides "react-core" tag
|
|
73
|
-
- style-tailwind.md → overrides "style-tailwind" tag
|
|
74
|
-
`),console.log(`✅ Initialized .magic-helix/ directory structure at: ${e}`)}class Q{constructor(e={}){this.enabled=!!e.enabled;const t=e.dir||C.resolve(process.cwd(),".magic-helix/telemetry");this.filePath=C.join(t,"events.jsonl"),this.sessionId=e.sessionId,this.variant=e.variant,this.projectRoot=e.projectRoot,this.enabled&&j.mkdirSync(C.dirname(this.filePath),{recursive:!0})}isEnabled(){return this.enabled}track(e){if(!this.enabled)return;const t={...e,timestamp:new Date().toISOString(),sessionId:this.sessionId,projectRoot:this.projectRoot};"variant"in e&&e.variant?t.variant=e.variant:t.variant=this.variant;const s=`${JSON.stringify(t)}
|
|
75
|
-
`;j.appendFileSync(this.filePath,s,"utf-8")}}function Ye(n={}){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();return new Q({enabled:e,dir:t,sessionId:s,variant:i,projectRoot:r})}function Qe(n){return n.map(e=>{const t=z(e.context),s=$(t);return{variant:e.name,instructions:t,score:s.overallScore,structureScore:s.structureScore,clarityScore:s.clarityScore,completenessScore:s.completenessScore,missingCount:s.missingElements.length}})}function Xe(n){return n.length===0?{variant:"",instructions:"",score:0,structureScore:0,clarityScore:0,completenessScore:0,missingCount:0}:n.reduce((e,t)=>t.score>e.score?t:e,n[0])}function Ke(n,e){if(e?.isEnabled())for(const t of n){const s={type:"instruction_validation",file:`ab-test-variant-${t.variant}`,score:t.score,structureScore:t.structureScore,clarityScore:t.clarityScore,completenessScore:t.completenessScore,missingCount:t.missingCount,variant:t.variant};e.track(s)}}const Ze=re.fileURLToPath(typeof document>"u"?require("url").pathToFileURL(__filename).href:T&&T.tagName.toUpperCase()==="SCRIPT"&&T.src||new URL("index-nioXOg4m.cjs",document.baseURI).href),et=C.dirname(Ze),tt=C.resolve(et,"default_templates");exports.BUILT_IN_CONFIG=O;exports.BUILT_IN_TEMPLATE_DIR=tt;exports.CodeOwnersPlugin=Me;exports.DEFAULT_AI_REFINEMENT=I;exports.DockerPlugin=_e;exports.GitHubActionsPlugin=Re;exports.GitLabCIPlugin=Oe;exports.GolangPlugin=Ae;exports.INSTRUCTION_ELEMENTS=G;exports.MonorepoPlugin=Ne;exports.PHPPlugin=We;exports.PluginLoader=x;exports.PluginRegistry=B;exports.PluginRegistry$1=k;exports.PythonPlugin=ze;exports.RustPlugin=Ge;exports.TelemetryClient=Q;exports.TemplateLoader=Ue;exports.__viteBrowserExternal=Te;exports.analyzeBestVariant=Xe;exports.analyzeProjectTags=le;exports.analyzeWithPlugins=De;exports.applyCombiner=Y;exports.applyMetaInstructions=He;exports.applyOverrides=J;exports.combinePatterns=W;exports.createTelemetry=Ye;exports.estimateTokens=ye;exports.formatValidationReport=Ie;exports.generateABVariants=Qe;exports.generateInstructions=z;exports.getFormatter=Se;exports.getQualityGrade=q;exports.getRegistry=qe;exports.hasMetaInstructions=Ve;exports.initMetaInstructions=Je;exports.initializeRegistry=Be;exports.loadMetaConfig=H;exports.loadOverrideInstructions=V;exports.loadPatternTemplates=A;exports.loadUserConfig=ve;exports.mergeConfigs=Pe;exports.passesQualityThreshold=xe;exports.pluginRegistry=h;exports.refineInstructions=ue;exports.registerBuiltInPlugins=Le;exports.selectPatterns=N;exports.trackABTest=Ke;exports.validateInstructions=$;
|
|
76
|
-
//# sourceMappingURL=index-nioXOg4m.cjs.map
|