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

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.
@@ -1,6 +1,6 @@
1
- "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const p=require("node:path"),m=require("../BasePlugin-odQJAKA-.cjs");function u(s){const e=Object.create(null,{[Symbol.toStringTag]:{value:"Module"}});if(s){for(const t in s)if(t!=="default"){const n=Object.getOwnPropertyDescriptor(s,t);Object.defineProperty(e,t,n.get?n:{enumerable:!0,get:()=>s[t]})}}return e.default=s,Object.freeze(e)}const d=u(p);class y extends m.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.loadTemplateFromFile(d.join(__dirname,"templates/lang-python.md")).then(e=>e||this.getPythonFallbackTemplate())}]}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 n=t.match(/name\s*=\s*["']([^"']+)["']/),i=t.match(/description\s*=\s*["']([^"']+)["']/),o={},r=t.match(/\[tool\.poetry\.dependencies\]([\s\S]*?)(?:\n\[|$)/);if(r){const c=r[1].split(`
2
- `);for(const l of c){const a=l.match(/^([a-zA-Z0-9_-]+)\s*=\s*["']([^"']+)["']/);a&&a[1]!=="python"&&(o[a[1]]=a[2])}}return{language:"Python",name:n?.[1]||this.getProjectName(e),description:i?.[1],dependencies:o,manifestFile:"pyproject.toml",projectPath:e}}detectFromRequirements(e){const t=this.readFile(e,"requirements.txt"),n={};if(t){for(const i of t.split(`
3
- `))if(i.trim()&&!i.startsWith("#")){const o=i.split(/[=<>]/),r=o[0].trim(),c=o[1]?.trim()||"*";r&&(n[r]=c)}}return{language:"Python",name:this.getProjectName(e),dependencies:n,manifestFile:"requirements.txt",projectPath:e}}getPythonFallbackTemplate(){return`# Python Development Guidelines
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const d=require("node:path"),u=require("../BasePlugin-Be6rLq9o.cjs");var l=typeof document<"u"?document.currentScript:null;function g(i){const e=Object.create(null,{[Symbol.toStringTag]:{value:"Module"}});if(i){for(const t in i)if(t!=="default"){const n=Object.getOwnPropertyDescriptor(i,t);Object.defineProperty(e,t,n.get?n:{enumerable:!0,get:()=>i[t]})}}return e.default=i,Object.freeze(e)}const y=g(d);class f extends u.BasePlugin{constructor(){super(...arguments),this.name="python",this.displayName="Python",this.version="3.0.0",this.priority=85}async detect(e){if(this.fileExists(e,"pyproject.toml"))return this.detectFromPyproject(e);if(this.fileExists(e,"requirements.txt"))return this.detectFromRequirements(e);if(this.fileExists(e,"setup.py")){const t={},n=await this.enrichTags(e,t);return{language:"Python",name:this.getProjectName(e),dependencies:t,manifestFile:"setup.py",projectPath:e,tags:Array.from(n)}}return null}getTemplates(){const e=this.getDirname(typeof document>"u"?require("url").pathToFileURL(__filename).href:l&&l.tagName.toUpperCase()==="SCRIPT"&&l.src||new URL("python/index.cjs",document.baseURI).href);return[{name:"python-core",tags:["python"],content:()=>this.loadTemplateFromFile(y.join(e,"templates/lang-python.md")).then(t=>t||this.getPythonFallbackTemplate())}]}getDependencyTagMap(){return{django:"django",flask:"flask",fastapi:"fastapi",pytest:"pytest",numpy:"numpy",pandas:"pandas"}}async detectFromPyproject(e){const t=this.readFile(e,"pyproject.toml");if(!t){const a=await this.enrichTags(e,{});return{language:"Python",name:this.getProjectName(e),dependencies:{},manifestFile:"pyproject.toml",projectPath:e,tags:Array.from(a)}}const n=t.match(/name\s*=\s*["']([^"']+)["']/),o=t.match(/description\s*=\s*["']([^"']+)["']/),s={},r=t.match(/\[tool\.poetry\.dependencies\]([\s\S]*?)(?:\n\[|$)/);if(r){const a=r[1].split(`
2
+ `);for(const m of a){const p=m.match(/^([a-zA-Z0-9_-]+)\s*=\s*["']([^"']+)["']/);p&&p[1]!=="python"&&(s[p[1]]=p[2])}}const c=await this.enrichTags(e,s);return{language:"Python",name:n?.[1]||this.getProjectName(e),description:o?.[1],dependencies:s,manifestFile:"pyproject.toml",projectPath:e,tags:Array.from(c)}}async detectFromRequirements(e){const t=this.readFile(e,"requirements.txt"),n={};if(t){for(const s of t.split(`
3
+ `))if(s.trim()&&!s.startsWith("#")){const r=s.split(/[=<>]/),c=r[0].trim(),a=r[1]?.trim()||"*";c&&(n[c]=a)}}const o=await this.enrichTags(e,n);return{language:"Python",name:this.getProjectName(e),dependencies:n,manifestFile:"requirements.txt",projectPath:e,tags:Array.from(o)}}async enrichTags(e,t){const n=new Set(["python"]),o=this.getDependencyTagMap();for(const s in t)o[s]&&n.add(o[s]);return n}getPythonFallbackTemplate(){return`# Python Development Guidelines
4
4
 
5
5
  This project uses Python.
6
6
 
@@ -27,4 +27,4 @@ This project uses Python.
27
27
  ## Best Practices
28
28
  - Handle exceptions properly
29
29
  - Use context managers for resources
30
- - Follow Pythonic idioms`}}exports.PythonPlugin=y;
30
+ - Follow Pythonic idioms`}}exports.PythonPlugin=f;
@@ -1,26 +1,36 @@
1
- import * as c from "node:path";
2
- import { B as m } from "../BasePlugin-6wv0hYJ9.js";
3
- class u extends m {
1
+ import * as m from "node:path";
2
+ import { B as l } from "../BasePlugin-BXz3Zpy5.js";
3
+ class y extends l {
4
4
  constructor() {
5
5
  super(...arguments), this.name = "python", this.displayName = "Python", this.version = "3.0.0", this.priority = 85;
6
6
  }
7
7
  async detect(e) {
8
- return this.fileExists(e, "pyproject.toml") ? this.detectFromPyproject(e) : this.fileExists(e, "requirements.txt") ? this.detectFromRequirements(e) : this.fileExists(e, "setup.py") ? {
9
- language: "Python",
10
- name: this.getProjectName(e),
11
- dependencies: {},
12
- manifestFile: "setup.py",
13
- projectPath: e
14
- } : null;
8
+ if (this.fileExists(e, "pyproject.toml"))
9
+ return this.detectFromPyproject(e);
10
+ if (this.fileExists(e, "requirements.txt"))
11
+ return this.detectFromRequirements(e);
12
+ if (this.fileExists(e, "setup.py")) {
13
+ const t = {}, s = await this.enrichTags(e, t);
14
+ return {
15
+ language: "Python",
16
+ name: this.getProjectName(e),
17
+ dependencies: t,
18
+ manifestFile: "setup.py",
19
+ projectPath: e,
20
+ tags: Array.from(s)
21
+ };
22
+ }
23
+ return null;
15
24
  }
16
25
  getTemplates() {
26
+ const e = this.getDirname(import.meta.url);
17
27
  return [
18
28
  {
19
29
  name: "python-core",
20
30
  tags: ["python"],
21
31
  content: () => this.loadTemplateFromFile(
22
- c.join(__dirname, "templates/lang-python.md")
23
- ).then((e) => e || this.getPythonFallbackTemplate())
32
+ m.join(e, "templates/lang-python.md")
33
+ ).then((t) => t || this.getPythonFallbackTemplate())
24
34
  }
25
35
  ];
26
36
  }
@@ -35,54 +45,70 @@ class u extends m {
35
45
  };
36
46
  }
37
47
  // Private helper methods
38
- detectFromPyproject(e) {
48
+ async detectFromPyproject(e) {
39
49
  const t = this.readFile(e, "pyproject.toml");
40
- if (!t)
50
+ if (!t) {
51
+ const a = await this.enrichTags(e, {});
41
52
  return {
42
53
  language: "Python",
43
54
  name: this.getProjectName(e),
44
55
  dependencies: {},
45
56
  manifestFile: "pyproject.toml",
46
- projectPath: e
57
+ projectPath: e,
58
+ tags: Array.from(a)
47
59
  };
48
- const o = t.match(/name\s*=\s*["']([^"']+)["']/), n = t.match(/description\s*=\s*["']([^"']+)["']/), s = {}, i = t.match(
60
+ }
61
+ const s = t.match(/name\s*=\s*["']([^"']+)["']/), i = t.match(/description\s*=\s*["']([^"']+)["']/), n = {}, o = t.match(
49
62
  /\[tool\.poetry\.dependencies\]([\s\S]*?)(?:\n\[|$)/
50
63
  );
51
- if (i) {
52
- const a = i[1].split(`
64
+ if (o) {
65
+ const a = o[1].split(`
53
66
  `);
54
67
  for (const p of a) {
55
- const r = p.match(/^([a-zA-Z0-9_-]+)\s*=\s*["']([^"']+)["']/);
56
- r && r[1] !== "python" && (s[r[1]] = r[2]);
68
+ const c = p.match(/^([a-zA-Z0-9_-]+)\s*=\s*["']([^"']+)["']/);
69
+ c && c[1] !== "python" && (n[c[1]] = c[2]);
57
70
  }
58
71
  }
72
+ const r = await this.enrichTags(e, n);
59
73
  return {
60
74
  language: "Python",
61
- name: o?.[1] || this.getProjectName(e),
62
- description: n?.[1],
63
- dependencies: s,
75
+ name: s?.[1] || this.getProjectName(e),
76
+ description: i?.[1],
77
+ dependencies: n,
64
78
  manifestFile: "pyproject.toml",
65
- projectPath: e
79
+ projectPath: e,
80
+ tags: Array.from(r)
66
81
  };
67
82
  }
68
- detectFromRequirements(e) {
69
- const t = this.readFile(e, "requirements.txt"), o = {};
83
+ async detectFromRequirements(e) {
84
+ const t = this.readFile(e, "requirements.txt"), s = {};
70
85
  if (t) {
71
86
  for (const n of t.split(`
72
87
  `))
73
88
  if (n.trim() && !n.startsWith("#")) {
74
- const s = n.split(/[=<>]/), i = s[0].trim(), a = s[1]?.trim() || "*";
75
- i && (o[i] = a);
89
+ const o = n.split(/[=<>]/), r = o[0].trim(), a = o[1]?.trim() || "*";
90
+ r && (s[r] = a);
76
91
  }
77
92
  }
93
+ const i = await this.enrichTags(e, s);
78
94
  return {
79
95
  language: "Python",
80
96
  name: this.getProjectName(e),
81
- dependencies: o,
97
+ dependencies: s,
82
98
  manifestFile: "requirements.txt",
83
- projectPath: e
99
+ projectPath: e,
100
+ tags: Array.from(i)
84
101
  };
85
102
  }
103
+ /**
104
+ * Enrich tags from dependencies
105
+ */
106
+ async enrichTags(e, t) {
107
+ const s = /* @__PURE__ */ new Set(["python"]), i = this.getDependencyTagMap();
108
+ for (const n in t)
109
+ i[n] && s.add(i[n]);
110
+ return s;
111
+ }
86
112
  getPythonFallbackTemplate() {
87
113
  return `# Python Development Guidelines
88
114
 
@@ -115,5 +141,5 @@ This project uses Python.
115
141
  }
116
142
  }
117
143
  export {
118
- u as PythonPlugin
144
+ y as PythonPlugin
119
145
  };
@@ -1,4 +1,4 @@
1
- "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const a=require("node:path"),l=require("../BasePlugin-odQJAKA-.cjs");function o(i){const e=Object.create(null,{[Symbol.toStringTag]:{value:"Module"}});if(i){for(const t in i)if(t!=="default"){const n=Object.getOwnPropertyDescriptor(i,t);Object.defineProperty(e,t,n.get?n:{enumerable:!0,get:()=>i[t]})}}return e.default=i,Object.freeze(e)}const u=o(a);class c extends l.BasePlugin{constructor(){super(...arguments),this.name="ruby",this.displayName="Ruby",this.version="3.0.0",this.priority=70}async detect(e){if(!this.fileExists(e,"Gemfile"))return null;const t=this.readFile(e,"Gemfile"),n={};if(t){const r=t.matchAll(/gem\s+['"]([^'"]+)['"](?:,\s*['"]([^'"]+)['"])?/g);for(const s of r)n[s[1]]=s[2]||"*"}return{language:"Ruby",name:this.getProjectName(e),dependencies:n,manifestFile:"Gemfile",projectPath:e}}getTemplates(){return[{name:"ruby-core",tags:["ruby"],content:()=>this.loadTemplateFromFile(u.join(__dirname,"templates/lang-ruby.md")).then(e=>e||this.getRubyFallbackTemplate())}]}getRubyFallbackTemplate(){return`# Ruby Development Guidelines
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const u=require("node:path"),o=require("../BasePlugin-Be6rLq9o.cjs");var r=typeof document<"u"?document.currentScript:null;function c(n){const e=Object.create(null,{[Symbol.toStringTag]:{value:"Module"}});if(n){for(const t in n)if(t!=="default"){const i=Object.getOwnPropertyDescriptor(n,t);Object.defineProperty(e,t,i.get?i:{enumerable:!0,get:()=>n[t]})}}return e.default=n,Object.freeze(e)}const l=c(u);class m extends o.BasePlugin{constructor(){super(...arguments),this.name="ruby",this.displayName="Ruby",this.version="3.0.0",this.priority=70}async detect(e){if(!this.fileExists(e,"Gemfile"))return null;const t=this.readFile(e,"Gemfile"),i={};if(t){const a=t.matchAll(/gem\s+['"]([^'"]+)['"](?:,\s*['"]([^'"]+)['"])?/g);for(const s of a)i[s[1]]=s[2]||"*"}return{language:"Ruby",name:this.getProjectName(e),dependencies:i,manifestFile:"Gemfile",projectPath:e}}getTemplates(){const e=this.getDirname(typeof document>"u"?require("url").pathToFileURL(__filename).href:r&&r.tagName.toUpperCase()==="SCRIPT"&&r.src||new URL("ruby/index.cjs",document.baseURI).href);return[{name:"ruby-core",tags:["ruby"],content:()=>this.loadTemplateFromFile(l.join(e,"templates/lang-ruby.md")).then(t=>t||this.getRubyFallbackTemplate())}]}getRubyFallbackTemplate(){return`# Ruby Development Guidelines
2
2
 
3
3
  This project uses Ruby.
4
4
 
@@ -15,4 +15,4 @@ This project uses Ruby.
15
15
  ## Testing
16
16
  - Write tests with RSpec/Minitest
17
17
  - Use fixtures and factories
18
- - Aim for good coverage`}getDependencyTagMap(){return{rails:"rails",rspec:"rspec",sinatra:"sinatra"}}}exports.RubyPlugin=c;
18
+ - Aim for good coverage`}getDependencyTagMap(){return{rails:"rails",rspec:"rspec",sinatra:"sinatra"}}}exports.RubyPlugin=m;
@@ -1,6 +1,6 @@
1
- import * as a from "node:path";
2
- import { B as r } from "../BasePlugin-6wv0hYJ9.js";
3
- class m extends r {
1
+ import * as r from "node:path";
2
+ import { B as a } from "../BasePlugin-BXz3Zpy5.js";
3
+ class m extends a {
4
4
  constructor() {
5
5
  super(...arguments), this.name = "ruby", this.displayName = "Ruby", this.version = "3.0.0", this.priority = 70;
6
6
  }
@@ -22,13 +22,14 @@ class m extends r {
22
22
  };
23
23
  }
24
24
  getTemplates() {
25
+ const e = this.getDirname(import.meta.url);
25
26
  return [
26
27
  {
27
28
  name: "ruby-core",
28
29
  tags: ["ruby"],
29
30
  content: () => this.loadTemplateFromFile(
30
- a.join(__dirname, "templates/lang-ruby.md")
31
- ).then((e) => e || this.getRubyFallbackTemplate())
31
+ r.join(e, "templates/lang-ruby.md")
32
+ ).then((t) => t || this.getRubyFallbackTemplate())
32
33
  }
33
34
  ];
34
35
  }
@@ -1,5 +1,5 @@
1
- "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const p=require("node:path"),g=require("../BasePlugin-odQJAKA-.cjs");function d(s){const e=Object.create(null,{[Symbol.toStringTag]:{value:"Module"}});if(s){for(const t in s)if(t!=="default"){const n=Object.getOwnPropertyDescriptor(s,t);Object.defineProperty(e,t,n.get?n:{enumerable:!0,get:()=>s[t]})}}return e.default=s,Object.freeze(e)}const f=d(p);class h extends g.BasePlugin{constructor(){super(...arguments),this.name="rust",this.displayName="Rust",this.version="3.0.0",this.priority=80}async detect(e){if(!this.fileExists(e,"Cargo.toml"))return null;const t=this.readFile(e,"Cargo.toml");if(!t)return{language:"Rust",name:this.getProjectName(e),dependencies:{},manifestFile:"Cargo.toml",projectPath:e};const n=t.match(/\[package\][\s\S]*?name\s*=\s*"([^"]+)"/),m=t.match(/\[package\][\s\S]*?description\s*=\s*"([^"]+)"/),c={},l=t.match(/\[dependencies\]([\s\S]*?)(?:\n\[|$)/);if(l){const r=l[1].split(`
2
- `);for(const a of r){const i=a.match(/^([a-zA-Z0-9_-]+)\s*=\s*(?:"([^"]+)"|{[^}]*version\s*=\s*"([^"]+)")/);i&&(c[i[1]]=i[2]||i[3]||"*")}}const u=t.match(/\[workspace\][\s\S]*?members\s*=\s*\[([\s\S]*?)\]/),o=[];if(u){const r=u[1].split(",").map(a=>a.trim().replace(/["']/g,"")).filter(Boolean);o.push(...r)}return{language:"Rust",name:n?.[1]||this.getProjectName(e),description:m?.[1],dependencies:c,manifestFile:"Cargo.toml",projectPath:e,workspaceMembers:o.length>0?o:void 0}}getTemplates(){return[{name:"rust-core",tags:["rust"],content:()=>this.loadTemplateFromFile(f.join(__dirname,"templates/lang-rust.md")).then(e=>e||this.getRustFallbackTemplate())}]}getRustFallbackTemplate(){return`# Rust Development Guidelines
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const d=require("node:path"),g=require("../BasePlugin-Be6rLq9o.cjs");var c=typeof document<"u"?document.currentScript:null;function f(s){const e=Object.create(null,{[Symbol.toStringTag]:{value:"Module"}});if(s){for(const t in s)if(t!=="default"){const n=Object.getOwnPropertyDescriptor(s,t);Object.defineProperty(e,t,n.get?n:{enumerable:!0,get:()=>s[t]})}}return e.default=s,Object.freeze(e)}const h=f(d);class R extends g.BasePlugin{constructor(){super(...arguments),this.name="rust",this.displayName="Rust",this.version="3.0.0",this.priority=80}async detect(e){if(!this.fileExists(e,"Cargo.toml"))return null;const t=this.readFile(e,"Cargo.toml");if(!t)return{language:"Rust",name:this.getProjectName(e),dependencies:{},manifestFile:"Cargo.toml",projectPath:e};const n=t.match(/\[package\][\s\S]*?name\s*=\s*"([^"]+)"/),p=t.match(/\[package\][\s\S]*?description\s*=\s*"([^"]+)"/),u={},l=t.match(/\[dependencies\]([\s\S]*?)(?:\n\[|$)/);if(l){const o=l[1].split(`
2
+ `);for(const a of o){const r=a.match(/^([a-zA-Z0-9_-]+)\s*=\s*(?:"([^"]+)"|{[^}]*version\s*=\s*"([^"]+)")/);r&&(u[r[1]]=r[2]||r[3]||"*")}}const m=t.match(/\[workspace\][\s\S]*?members\s*=\s*\[([\s\S]*?)\]/),i=[];if(m){const o=m[1].split(",").map(a=>a.trim().replace(/["']/g,"")).filter(Boolean);i.push(...o)}return{language:"Rust",name:n?.[1]||this.getProjectName(e),description:p?.[1],dependencies:u,manifestFile:"Cargo.toml",projectPath:e,workspaceMembers:i.length>0?i:void 0}}getTemplates(){const e=this.getDirname(typeof document>"u"?require("url").pathToFileURL(__filename).href:c&&c.tagName.toUpperCase()==="SCRIPT"&&c.src||new URL("rust/index.cjs",document.baseURI).href);return[{name:"rust-core",tags:["rust"],content:()=>this.loadTemplateFromFile(h.join(e,"templates/lang-rust.md")).then(t=>t||this.getRustFallbackTemplate())}]}getRustFallbackTemplate(){return`# Rust Development Guidelines
3
3
 
4
4
  This project uses Rust.
5
5
 
@@ -26,4 +26,4 @@ This project uses Rust.
26
26
  ## Dependencies
27
27
  - Manage with Cargo.toml
28
28
  - Review crate security
29
- - Keep dependencies updated`}getDependencyTagMap(){return{tokio:"tokio","actix-web":"actix",rocket:"rocket",serde:"serde"}}}exports.RustPlugin=h;
29
+ - Keep dependencies updated`}getDependencyTagMap(){return{tokio:"tokio","actix-web":"actix",rocket:"rocket",serde:"serde"}}}exports.RustPlugin=R;
@@ -1,5 +1,5 @@
1
1
  import * as p from "node:path";
2
- import { B as u } from "../BasePlugin-6wv0hYJ9.js";
2
+ import { B as u } from "../BasePlugin-BXz3Zpy5.js";
3
3
  class h extends u {
4
4
  constructor() {
5
5
  super(...arguments), this.name = "rust", this.displayName = "Rust", this.version = "3.0.0", this.priority = 80;
@@ -16,7 +16,7 @@ class h extends u {
16
16
  manifestFile: "Cargo.toml",
17
17
  projectPath: e
18
18
  };
19
- const l = t.match(/\[package\][\s\S]*?name\s*=\s*"([^"]+)"/), m = t.match(/\[package\][\s\S]*?description\s*=\s*"([^"]+)"/), a = {}, r = t.match(/\[dependencies\]([\s\S]*?)(?:\n\[|$)/);
19
+ const m = t.match(/\[package\][\s\S]*?name\s*=\s*"([^"]+)"/), l = t.match(/\[package\][\s\S]*?description\s*=\s*"([^"]+)"/), a = {}, r = t.match(/\[dependencies\]([\s\S]*?)(?:\n\[|$)/);
20
20
  if (r) {
21
21
  const i = r[1].split(`
22
22
  `);
@@ -32,8 +32,8 @@ class h extends u {
32
32
  }
33
33
  return {
34
34
  language: "Rust",
35
- name: l?.[1] || this.getProjectName(e),
36
- description: m?.[1],
35
+ name: m?.[1] || this.getProjectName(e),
36
+ description: l?.[1],
37
37
  dependencies: a,
38
38
  manifestFile: "Cargo.toml",
39
39
  projectPath: e,
@@ -41,13 +41,14 @@ class h extends u {
41
41
  };
42
42
  }
43
43
  getTemplates() {
44
+ const e = this.getDirname(import.meta.url);
44
45
  return [
45
46
  {
46
47
  name: "rust-core",
47
48
  tags: ["rust"],
48
49
  content: () => this.loadTemplateFromFile(
49
- p.join(__dirname, "templates/lang-rust.md")
50
- ).then((e) => e || this.getRustFallbackTemplate())
50
+ p.join(e, "templates/lang-rust.md")
51
+ ).then((t) => t || this.getRustFallbackTemplate())
51
52
  }
52
53
  ];
53
54
  }
@@ -1,4 +1,4 @@
1
- "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const u=require("node:path"),p=require("../BasePlugin-odQJAKA-.cjs");function d(a){const e=Object.create(null,{[Symbol.toStringTag]:{value:"Module"}});if(a){for(const t in a)if(t!=="default"){const s=Object.getOwnPropertyDescriptor(a,t);Object.defineProperty(e,t,s.get?s:{enumerable:!0,get:()=>a[t]})}}return e.default=a,Object.freeze(e)}const g=d(u);class m extends p.BasePlugin{constructor(){super(...arguments),this.name="swift",this.displayName="Swift",this.version="3.0.0",this.priority=75}async detect(e){if(this.fileExists(e,"Package.swift"))return this.detectSPM(e);const t=await this.hasFiles(e,"**/*.xcodeproj"),s=await this.hasFiles(e,"**/*.xcworkspace");return t||s?this.detectXcode(e):await this.hasFiles(e,"**/*.swift")?{language:"Swift",name:this.getProjectName(e),dependencies:{},projectPath:e}:null}getTemplates(){return[{name:"swift-core",tags:["swift"],content:()=>this.loadTemplateFromFile(g.join(__dirname,"templates/lang-swift.md")).then(e=>e||this.getSwiftFallbackTemplate())}]}getSwiftFallbackTemplate(){return`# Swift Development Guidelines
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const d=require("node:path"),p=require("../BasePlugin-Be6rLq9o.cjs");var a=typeof document<"u"?document.currentScript:null;function m(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 g=m(d);class w extends p.BasePlugin{constructor(){super(...arguments),this.name="swift",this.displayName="Swift",this.version="3.0.0",this.priority=75}async detect(e){if(this.fileExists(e,"Package.swift"))return this.detectSPM(e);const t=await this.hasFiles(e,"**/*.xcodeproj"),s=await this.hasFiles(e,"**/*.xcworkspace");return t||s?this.detectXcode(e):await this.hasFiles(e,"**/*.swift")?{language:"Swift",name:this.getProjectName(e),dependencies:{},projectPath:e}:null}getTemplates(){const e=this.getDirname(typeof document>"u"?require("url").pathToFileURL(__filename).href:a&&a.tagName.toUpperCase()==="SCRIPT"&&a.src||new URL("swift/index.cjs",document.baseURI).href);return[{name:"swift-core",tags:["swift"],content:()=>this.loadTemplateFromFile(g.join(e,"templates/lang-swift.md")).then(t=>t||this.getSwiftFallbackTemplate())}]}getSwiftFallbackTemplate(){return`# Swift Development Guidelines
2
2
 
3
3
  This project uses Swift.
4
4
 
@@ -29,4 +29,4 @@ This project uses Swift.
29
29
  - Write XCTest unit tests
30
30
  - Use Quick/Nimble for BDD-style tests (if applicable)
31
31
  - Mock dependencies appropriately
32
- - Test async code with expectations`}getDependencyTagMap(){return{vapor:"vapor",Vapor:"vapor",swift:"swift"}}detectSPM(e){const t=this.readFile(e,"Package.swift");if(!t)return{language:"Swift",name:this.getProjectName(e),dependencies:{},manifestFile:"Package.swift",projectPath:e};const s={},i={language:"Swift",name:this.getProjectName(e),dependencies:s,manifestFile:"Package.swift",projectPath:e},n=t.match(/name:\s*"([^"]+)"/);n&&(i.name=n[1]);const r=t.match(/swift-tools-version:\s*([\d.]+)/);r&&(i.description=`Swift ${r[1]}`),(t.includes("vapor")||t.includes("Vapor"))&&(s.vapor="*");const c=t.matchAll(/\.package\([^)]+url:\s*"([^"]+)"/g);for(const l of c){const o=l[1],f=o.split("/").pop()?.replace(".git","")||o;s[f]="*"}return i}detectXcode(e){return{language:"Swift",name:this.getProjectName(e),dependencies:{},description:"Xcode project",projectPath:e}}}exports.SwiftPlugin=m;
32
+ - Test async code with expectations`}getDependencyTagMap(){return{vapor:"vapor",Vapor:"vapor",swift:"swift"}}detectSPM(e){const t=this.readFile(e,"Package.swift");if(!t)return{language:"Swift",name:this.getProjectName(e),dependencies:{},manifestFile:"Package.swift",projectPath:e};const s={},i={language:"Swift",name:this.getProjectName(e),dependencies:s,manifestFile:"Package.swift",projectPath:e},r=t.match(/name:\s*"([^"]+)"/);r&&(i.name=r[1]);const o=t.match(/swift-tools-version:\s*([\d.]+)/);o&&(i.description=`Swift ${o[1]}`),(t.includes("vapor")||t.includes("Vapor"))&&(s.vapor="*");const l=t.matchAll(/\.package\([^)]+url:\s*"([^"]+)"/g);for(const u of l){const c=u[1],f=c.split("/").pop()?.replace(".git","")||c;s[f]="*"}return i}detectXcode(e){return{language:"Swift",name:this.getProjectName(e),dependencies:{},description:"Xcode project",projectPath:e}}}exports.SwiftPlugin=w;
@@ -1,5 +1,5 @@
1
1
  import * as p from "node:path";
2
- import { B as f } from "../BasePlugin-6wv0hYJ9.js";
2
+ import { B as f } from "../BasePlugin-BXz3Zpy5.js";
3
3
  class u extends f {
4
4
  constructor() {
5
5
  super(...arguments), this.name = "swift", this.displayName = "Swift", this.version = "3.0.0", this.priority = 75;
@@ -19,13 +19,14 @@ class u extends f {
19
19
  } : null;
20
20
  }
21
21
  getTemplates() {
22
+ const e = this.getDirname(import.meta.url);
22
23
  return [
23
24
  {
24
25
  name: "swift-core",
25
26
  tags: ["swift"],
26
27
  content: () => this.loadTemplateFromFile(
27
- p.join(__dirname, "templates/lang-swift.md")
28
- ).then((e) => e || this.getSwiftFallbackTemplate())
28
+ p.join(e, "templates/lang-swift.md")
29
+ ).then((t) => t || this.getSwiftFallbackTemplate())
29
30
  }
30
31
  ];
31
32
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@el-j/magic-helix-plugins",
3
- "version": "4.0.0-beta.7",
3
+ "version": "4.0.0-beta.8",
4
4
  "description": "Official language detection plugins for MagicAgentHelix",
5
5
  "type": "module",
6
6
  "main": "./dist/index.js",
@@ -1 +0,0 @@
1
- "use strict";var u=Object.create;var l=Object.defineProperty;var f=Object.getOwnPropertyDescriptor;var y=Object.getOwnPropertyNames;var p=Object.getPrototypeOf,d=Object.prototype.hasOwnProperty;var g=(r,e,t,n)=>{if(e&&typeof e=="object"||typeof e=="function")for(let s of y(e))!d.call(r,s)&&s!==t&&l(r,s,{get:()=>e[s],enumerable:!(n=f(e,s))||n.enumerable});return r};var b=(r,e,t)=>(t=r!=null?u(p(r)):{},g(e||!r||!r.__esModule?l(t,"default",{value:r,enumerable:!0}):t,r));const m=require("node:fs"),j=require("node:path");function o(r){const e=Object.create(null,{[Symbol.toStringTag]:{value:"Module"}});if(r){for(const t in r)if(t!=="default"){const n=Object.getOwnPropertyDescriptor(r,t);Object.defineProperty(e,t,n.get?n:{enumerable:!0,get:()=>r[t]})}}return e.default=r,Object.freeze(e)}const c=o(m),i=o(j);class F{fileExists(e,t){return c.existsSync(i.join(e,t))}readFile(e,t){try{const n=i.join(e,t);if(c.existsSync(n))return c.readFileSync(n,"utf-8")}catch{}return null}readJSON(e,t){try{const n=this.readFile(e,t);if(n)return JSON.parse(n)}catch{}return null}getProjectName(e){return i.basename(e)}async loadTemplateFromFile(e){try{if(c.existsSync(e))return c.readFileSync(e,"utf-8")}catch{}return null}createTemplate(e,t,n,s={}){return{name:e,tags:t,content:n,...s}}parseDependencies(e,...t){const n={};for(const s of t){const a=e[s];a&&typeof a=="object"&&Object.assign(n,a)}return n}async findFiles(e,t){try{const{glob:n}=await import("glob");return await n(t,{cwd:e,absolute:!1})}catch{return[]}}async hasFiles(e,t){return(await this.findFiles(e,t)).length>0}}exports.BasePlugin=F;