@nine-lab/nine-mu 0.1.84 → 0.1.85

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@nine-lab/nine-mu",
3
- "version": "0.1.84",
3
+ "version": "0.1.85",
4
4
  "description": "AI-Driven Full-Stack Code Fabrication Engine",
5
5
  "type": "module",
6
6
  "main": "./dist/nine-mu.umd.js",
@@ -5,6 +5,8 @@ export class NineChat extends HTMLElement {
5
5
  #service = null;
6
6
  #routes = [];
7
7
  #diffPopup;
8
+ #packageName;
9
+ #routesPath;
8
10
 
9
11
  constructor() {
10
12
  super();
@@ -12,6 +14,9 @@ export class NineChat extends HTMLElement {
12
14
  }
13
15
 
14
16
  async connectedCallback() {
17
+
18
+ this.#packageName = this.getAttribute('package-name');
19
+
15
20
  // 서비스 초기화
16
21
  const connectorUrl = this.getAttribute('connector-url') || 'http://localhost:3002';
17
22
  this.#service = new NineMuService(connectorUrl);
@@ -22,19 +27,9 @@ export class NineChat extends HTMLElement {
22
27
 
23
28
 
24
29
  const res = await api.post("/nine-mu/config/get", {});
25
- const routeUrl = res?.userDir + "/" + this.getAttribute('package-name') + "/public/prompts/data/routes.json";
26
- trace.log(routeUrl);
27
-
28
- const res2 = await api.post("/nine-mu/source/readFile", { path: routeUrl });
29
- trace.log(res2);
30
-
31
- const jsonData = res2.contents ? JSON.parse(res2.contents) : {};
32
- //const asisSource = res2.contents?.json();
33
-
30
+ this.#routesPath = res?.userDir + "/" + this.#packageName + "/public/prompts/data/routes.json";
34
31
 
35
32
 
36
- trace.log(jsonData);
37
-
38
33
  // 경로 데이터 로드
39
34
  this.#routes = await this.#service.fetchRoutes(this.getAttribute('route-url'));
40
35
 
@@ -59,23 +54,8 @@ export class NineChat extends HTMLElement {
59
54
  });
60
55
  });
61
56
 
62
- this.shadowRoot.querySelector(".source-gen")?.addEventListener("click", async e => {
63
- const command = "";
64
- const targets = "";
65
-
66
- try {
67
- const result = await this.#service.generateAll(command, targets, this.#routes);
68
-
69
- // 4. 성공 처리
70
- $status.textContent = "✅ 완료";
71
- nine.alert("소스 생성 성공").rgb();
72
- this.dispatchEvent(new CustomEvent('nine-mu-completed', { detail: result, bubbles: true }));
73
- } catch (err) {
74
- // 5. 실패 처리
75
- $status.textContent = "❌ 실패";
76
- nine.alert(err.message).rgb().shake();
77
- }
78
- });
57
+ this.shadowRoot.querySelector(".make-menu")?.addEventListener("click", this.#makeMenuHandler);
58
+ this.shadowRoot.querySelector(".source-gen")?.addEventListener("click", this.#sourceGenHandler);
79
59
  }
80
60
 
81
61
  // --- [그룹 2: Action] 엔터키 입력 시 서비스 호출 ---
@@ -161,6 +141,37 @@ export class NineChat extends HTMLElement {
161
141
  this.#diffPopup = this.shadowRoot.querySelector('nine-diff-popup');
162
142
  }
163
143
 
144
+ #makeMenuHandler = async e => {
145
+
146
+
147
+
148
+ const res = await api.post("/nine-mu/source/readFile", { path: this.#routesPath });
149
+ trace.log(res);
150
+
151
+ const jsonRoutes = res?.contents ? JSON.parse(res?.contents) : {};
152
+ trace.log(jsonRoutes);
153
+
154
+
155
+ }
156
+
157
+ #sourceGenHandler = async e => {
158
+ const command = "";
159
+ const targets = "";
160
+
161
+ try {
162
+ const result = await this.#service.generateAll(command, targets, this.#routes);
163
+
164
+ // 4. 성공 처리
165
+ $status.textContent = "✅ 완료";
166
+ nine.alert("소스 생성 성공").rgb();
167
+ this.dispatchEvent(new CustomEvent('nine-mu-completed', { detail: result, bubbles: true }));
168
+ } catch (err) {
169
+ // 5. 실패 처리
170
+ $status.textContent = "❌ 실패";
171
+ nine.alert(err.message).rgb().shake();
172
+ }
173
+ }
174
+
164
175
  showDiff = (asis, tobe, lang) => {
165
176
  this.#diffPopup.popup().data(asis, tobe, lang);
166
177
  }