ide-assi 0.691.0 → 0.693.0
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/bundle.cjs.js +185 -116
- package/dist/bundle.esm.js +185 -116
- package/dist/components/ideAi.js +185 -113
- package/dist/components/ideUtils.js +0 -3
- package/package.json +1 -1
- package/src/components/ideAi.js +185 -113
- package/src/components/ideUtils.js +0 -3
package/dist/components/ideAi.js
CHANGED
|
@@ -246,26 +246,6 @@ export class IdeAi
|
|
|
246
246
|
return o;
|
|
247
247
|
};
|
|
248
248
|
|
|
249
|
-
|
|
250
|
-
#generateRealFile_BAK = async (srcPath, apply) => {
|
|
251
|
-
|
|
252
|
-
//const files = ["mybatis.xml", "service.java", "controller.java", "react.jsx"];
|
|
253
|
-
let files = [];
|
|
254
|
-
if (apply.mybatis) files.push("mybatis.xml");
|
|
255
|
-
if (apply.service) files.push("service.java");
|
|
256
|
-
if (apply.controller) files.push("controller.java");
|
|
257
|
-
if (apply.javascript) files.push("react.jsx");
|
|
258
|
-
|
|
259
|
-
const params = await Promise.all(
|
|
260
|
-
files.map(async (file) => ({
|
|
261
|
-
path: ninegrid.decode(file, "mybatis.xml", srcPath.mybatisPullPath, "service.java", srcPath.servicePullPath, "controller.java", srcPath.controllerPullPath, "react.jsx", srcPath.javascriptPullPath),
|
|
262
|
-
contents: await fetch(`/api/templates/${file}`).then(res => res.text()),
|
|
263
|
-
}))
|
|
264
|
-
);
|
|
265
|
-
|
|
266
|
-
api.post(`/api/source/generateRealFile`, { list: params });
|
|
267
|
-
};
|
|
268
|
-
|
|
269
249
|
#generateRealFile = async (srcPath, apply) => {
|
|
270
250
|
const fileMap = {
|
|
271
251
|
mybatis: { name: "mybatis.xml", path: srcPath.mybatisPullPath },
|
|
@@ -307,41 +287,6 @@ export class IdeAi
|
|
|
307
287
|
return src;
|
|
308
288
|
};
|
|
309
289
|
|
|
310
|
-
#getSourcePath_BAK = (menuUrl) => {
|
|
311
|
-
const path = menuUrl.replace(/^\/+/, '');
|
|
312
|
-
|
|
313
|
-
const raw = path.split("/").join(".").toLowerCase();
|
|
314
|
-
const cleaned = raw.replace(/[^a-z0-9.]/g, "");
|
|
315
|
-
const namespace = `${this.#parent.config.basePackage}.${cleaned}`;
|
|
316
|
-
|
|
317
|
-
const packageName = namespace.split(".").slice(0, -1).join(".");
|
|
318
|
-
|
|
319
|
-
//const packageName = `${path.split("/").slice(0, -1).join(".").toLowerCase()}`;
|
|
320
|
-
//const packageName = path.split("/").join(".").toLowerCase();
|
|
321
|
-
const fileName = path.split("/").at(-1).toLowerCase().split('-').map(word => word.charAt(0).toUpperCase() + word.slice(1)).join('');
|
|
322
|
-
|
|
323
|
-
return {
|
|
324
|
-
package: packageName,
|
|
325
|
-
namespace: namespace,
|
|
326
|
-
baseClass: fileName,
|
|
327
|
-
resultType: this.#parent.config.basePackage.split(".").slice(0, -1).join(".") + ".core.utils.CamelCaseMap",
|
|
328
|
-
mybatis: `${cleaned.split(".").slice(0, -1).join("/")}/${fileName}Mapper.xml`,
|
|
329
|
-
javascript: `/src/views/${cleaned.split(".").slice(0, -1).join("/")}/${path.split("/").at(-1)}.jsx`,
|
|
330
|
-
mybatisPullPath: `${this.#parent.settings.beProjectName}/src/main/resources/mapper/${cleaned.split(".").slice(0, -1).join("/")}/${fileName}Mapper.xml`,
|
|
331
|
-
controllerPullPath: `${this.#parent.settings.beProjectName}/src/main/java/${packageName.replaceAll(".", "/")}/controller/${fileName}Controller.java`,
|
|
332
|
-
servicePullPath: `${this.#parent.settings.beProjectName}/src/main/java/${packageName.replaceAll(".", "/")}/service/${fileName}Service.java`,
|
|
333
|
-
javascriptPullPath: `${this.#parent.settings.feProjectName}/src/views/${cleaned.split(".").slice(0, -1).join("/")}/${path.split("/").at(-1)}.jsx`,
|
|
334
|
-
};
|
|
335
|
-
/***
|
|
336
|
-
return {
|
|
337
|
-
package: packageName,
|
|
338
|
-
namespace: namespace,
|
|
339
|
-
controller: `/src/main/java/${packageName.replaceAll(".", "/")}/controller/${fileName}Controller.java`,
|
|
340
|
-
service: `/src/main/java/${packageName.replaceAll(".", "/")}/service/${fileName}Service.java`,
|
|
341
|
-
mybatis: `/src/main/resource/mapper/${path.split("/").slice(0, -1).join("/").toLowerCase()}/${fileName}Mapper.xml`,
|
|
342
|
-
javascript: `/${jsroot}/${path.split("/").slice(0, -1).join("/").toLowerCase()}/${path.split("/").at(-1)}.jsx`,
|
|
343
|
-
};*/
|
|
344
|
-
};
|
|
345
290
|
|
|
346
291
|
#findFirstEmptyDetailWrapper = () => {
|
|
347
292
|
const allWrappers = document.querySelectorAll('div[class^="detail-wrapper-"]');
|
|
@@ -427,58 +372,6 @@ export class IdeAi
|
|
|
427
372
|
};
|
|
428
373
|
|
|
429
374
|
|
|
430
|
-
|
|
431
|
-
#createSource = async (userPrompt, apply) => {
|
|
432
|
-
const where = await this.#where(userPrompt, this.#getMenuInfo(), await this.#getTableList());
|
|
433
|
-
this.#parent.addMessage("대상 메뉴와 테이블을 찾았습니다.")
|
|
434
|
-
|
|
435
|
-
console.log(where);
|
|
436
|
-
|
|
437
|
-
const srcPath = this.#getSourcePath(where.menu.url);
|
|
438
|
-
console.log(srcPath);
|
|
439
|
-
|
|
440
|
-
const columnInfo = await this.#getColumnInfo(where.table);
|
|
441
|
-
|
|
442
|
-
const mybatisXmlSource = await this.#generateTmplFile("/prompts/meta/C.BuildMyBatisMapper.txt", "mybatis.xml", {
|
|
443
|
-
userPrompt: userPrompt,
|
|
444
|
-
resultType: srcPath.resultType,
|
|
445
|
-
namespace: srcPath.namespace,
|
|
446
|
-
tableDefinitions: JSON.stringify(columnInfo)
|
|
447
|
-
});
|
|
448
|
-
this.#parent.addMessage("MyBatis 소스파일을 생성했습니다.");
|
|
449
|
-
|
|
450
|
-
const serviceSrc = await this.#generateTmplFile("/prompts/meta/C.BuildService.txt", "service.java", {
|
|
451
|
-
userPrompt: userPrompt,
|
|
452
|
-
baseClass: srcPath.baseClass,
|
|
453
|
-
myBatisPath: srcPath.mybatis,
|
|
454
|
-
namespace: srcPath.namespace,
|
|
455
|
-
package: srcPath.package + ".service",
|
|
456
|
-
mybatisXmlSource: mybatisXmlSource,
|
|
457
|
-
});
|
|
458
|
-
this.#parent.addMessage("Java(Service) 소스파일을 생성했습니다.");
|
|
459
|
-
|
|
460
|
-
const controllerSrc = await this.#generateTmplFile("/prompts/meta/C.BuildController.txt", "controller.java", {
|
|
461
|
-
userPrompt: userPrompt,
|
|
462
|
-
baseClass: srcPath.baseClass,
|
|
463
|
-
menuUrl: where.menu.url,
|
|
464
|
-
package: srcPath.package + ".controller",
|
|
465
|
-
serviceSource: serviceSrc,
|
|
466
|
-
});
|
|
467
|
-
this.#parent.addMessage("Java(Controller) 소스파일을 생성했습니다.");
|
|
468
|
-
|
|
469
|
-
const jsSrc = await this.#generateTmplFile("/prompts/meta/C.BuildReactJsx.txt", "react.jsx", {
|
|
470
|
-
userPrompt: userPrompt,
|
|
471
|
-
menuUrl: where.menu.url,
|
|
472
|
-
menuName: where.menu.name,
|
|
473
|
-
baseClass: srcPath.baseClass,
|
|
474
|
-
controllerSource: controllerSrc,
|
|
475
|
-
tableDefinitions: JSON.stringify(columnInfo),
|
|
476
|
-
});
|
|
477
|
-
this.#parent.addMessage("Jsx(React) 소스파일을 생성했습니다.");
|
|
478
|
-
|
|
479
|
-
await this.#generateRealFile(srcPath, apply);
|
|
480
|
-
};
|
|
481
|
-
|
|
482
375
|
#modifySource = async (userPrompt, apply, progressMessageInstance) => {
|
|
483
376
|
|
|
484
377
|
const el = ninegrid.querySelector("nx-side-menu-item.active");
|
|
@@ -649,6 +542,187 @@ console.log(el, href, title);
|
|
|
649
542
|
return returnSrc;
|
|
650
543
|
};
|
|
651
544
|
|
|
545
|
+
#generateSource = async (userPrompt, apply, progressMessageInstance) => {
|
|
546
|
+
|
|
547
|
+
/**
|
|
548
|
+
const el = ninegrid.querySelector("nx-side-menu-item.active");
|
|
549
|
+
if (!el) throw new Error("관련 메뉴를 찾을 수 없습니다.");
|
|
550
|
+
|
|
551
|
+
const href = el.getAttribute("href");
|
|
552
|
+
const title = el.getAttribute("title");
|
|
553
|
+
|
|
554
|
+
console.log(el, href, title);
|
|
555
|
+
|
|
556
|
+
const srcPath = this.#getSourcePath(href);
|
|
557
|
+
console.log(srcPath);
|
|
558
|
+
*/
|
|
559
|
+
|
|
560
|
+
|
|
561
|
+
const where = await this.#where(userPrompt, this.#getMenuInfo(), await this.#getTableList());
|
|
562
|
+
//this.#parent.addMessage("대상 메뉴와 테이블을 찾았습니다.")
|
|
563
|
+
|
|
564
|
+
console.log(where);
|
|
565
|
+
|
|
566
|
+
const srcPath = this.#getSourcePath(where.menu.url);
|
|
567
|
+
console.log(srcPath);
|
|
568
|
+
|
|
569
|
+
|
|
570
|
+
/**
|
|
571
|
+
* {
|
|
572
|
+
* "package": "ide.assi.be.tmpla",
|
|
573
|
+
* "namespace": "ide.assi.be.tmpla.docmanager",
|
|
574
|
+
* "baseClass": "DocManager",
|
|
575
|
+
* "resultType": "ide.assi.core.utils.CamelCaseMap",
|
|
576
|
+
* "mybatis": "tmpla/DocManagerMapper.xml",
|
|
577
|
+
* "mybatisPullPath": "ide-assi-be/src/main/resources/mapper/tmpla/DocManagerMapper.xml",
|
|
578
|
+
* "controllerPullPath": "ide-assi-be/src/main/java/ide/assi/be/tmpla/controller/DocManagerController.java",
|
|
579
|
+
* "servicePullPath": "ide-assi-be/src/main/java/ide/assi/be/tmpla/service/DocManagerService.java",
|
|
580
|
+
* "javascriptPullPath": "ide-assi-fe-vite-react-js/src/views/tmpla/doc-manager.jsx"
|
|
581
|
+
* }
|
|
582
|
+
*/
|
|
583
|
+
const src = await api.post("/api/source/read", srcPath);
|
|
584
|
+
//console.log(src);
|
|
585
|
+
|
|
586
|
+
/**
|
|
587
|
+
const response = await fetch(srcPath.javascript);
|
|
588
|
+
src.javascript = await response.text();*/
|
|
589
|
+
|
|
590
|
+
//console.log(src);
|
|
591
|
+
//const template = await fetch(path).then(res => res.text());
|
|
592
|
+
/*
|
|
593
|
+
arr.push({
|
|
594
|
+
//menuId: elem.getAttribute("menu-id"),
|
|
595
|
+
url: elem.getAttribute("href"),
|
|
596
|
+
title: elem.getAttribute("title"),
|
|
597
|
+
})*/
|
|
598
|
+
|
|
599
|
+
|
|
600
|
+
|
|
601
|
+
|
|
602
|
+
|
|
603
|
+
//const where = await this.#where(`${title}에서 ${userPrompt}`, [{url: href, title: title}], await this.#getTableList());
|
|
604
|
+
//this.#parent.addMessage("대상 메뉴와 테이블을 찾았습니다.");
|
|
605
|
+
progressMessageInstance.updateProgress('prepare2', 'completed');
|
|
606
|
+
|
|
607
|
+
//console.log(where);
|
|
608
|
+
|
|
609
|
+
//const srcPath = this.#getSourcePath(where.menu.url);
|
|
610
|
+
|
|
611
|
+
|
|
612
|
+
|
|
613
|
+
const columnInfo = await this.#getColumnInfo(where.table);
|
|
614
|
+
|
|
615
|
+
let mybatisXmlSource;
|
|
616
|
+
if (apply.mybatis) {
|
|
617
|
+
mybatisXmlSource = await this.#generateTmplFile("/prompts/meta/U.BuildMyBatisMapper.txt", "mybatis.xml", {
|
|
618
|
+
userPrompt: userPrompt,
|
|
619
|
+
originSrc: src.mybatis,
|
|
620
|
+
resultType: srcPath.resultType,
|
|
621
|
+
namespace: srcPath.namespace,
|
|
622
|
+
tableDefinitions: JSON.stringify(columnInfo),
|
|
623
|
+
});
|
|
624
|
+
//this.#parent.addMessage("MyBatis 소스파일을 생성했습니다.");
|
|
625
|
+
progressMessageInstance.updateProgress('mybatis', 'completed');
|
|
626
|
+
}
|
|
627
|
+
else {
|
|
628
|
+
mybatisXmlSource = src.mybatis;
|
|
629
|
+
}
|
|
630
|
+
|
|
631
|
+
let serviceSrc;
|
|
632
|
+
if (apply.service) {
|
|
633
|
+
serviceSrc = await this.#generateTmplFile("/prompts/meta/U.BuildService.txt", "service.java", {
|
|
634
|
+
userPrompt: userPrompt,
|
|
635
|
+
originSrc: src.service,
|
|
636
|
+
baseClass: srcPath.baseClass,
|
|
637
|
+
myBatisPath: srcPath.mybatis,
|
|
638
|
+
namespace: srcPath.namespace,
|
|
639
|
+
package: srcPath.package + ".service",
|
|
640
|
+
mybatisXmlSource: mybatisXmlSource,
|
|
641
|
+
});
|
|
642
|
+
//this.#parent.addMessage("Java(Service) 소스파일을 생성했습니다.");
|
|
643
|
+
progressMessageInstance.updateProgress('service', 'completed');
|
|
644
|
+
}
|
|
645
|
+
else {
|
|
646
|
+
serviceSrc = src.service;
|
|
647
|
+
}
|
|
648
|
+
|
|
649
|
+
let controllerSrc;
|
|
650
|
+
if (apply.controller) {
|
|
651
|
+
controllerSrc = await this.#generateTmplFile("/prompts/meta/U.BuildController.txt", "controller.java", {
|
|
652
|
+
userPrompt: userPrompt,
|
|
653
|
+
originSrc: src.controller,
|
|
654
|
+
baseClass: srcPath.baseClass,
|
|
655
|
+
menuUrl: where.menu.url,
|
|
656
|
+
package: srcPath.package + ".controller",
|
|
657
|
+
serviceSource: serviceSrc,
|
|
658
|
+
});
|
|
659
|
+
//this.#parent.addMessage("Java(Controller) 소스파일을 생성했습니다.");
|
|
660
|
+
progressMessageInstance.updateProgress('controller', 'completed');
|
|
661
|
+
}
|
|
662
|
+
else {
|
|
663
|
+
controllerSrc = src.controller;
|
|
664
|
+
}
|
|
665
|
+
|
|
666
|
+
let jsSrc;
|
|
667
|
+
if (apply.javascript) {
|
|
668
|
+
jsSrc = await this.#generateTmplFile(this.prompt.react.filter(item => item.includes(".main.") || item.includes(".all.")), "react.jsx", {
|
|
669
|
+
userPrompt: userPrompt,
|
|
670
|
+
mybatis: srcPath.mybatis,
|
|
671
|
+
originSrc: src.javascript,
|
|
672
|
+
menuUrl: where.menu.url,
|
|
673
|
+
menuName: where.menu.name,
|
|
674
|
+
baseClass: srcPath.baseClass,
|
|
675
|
+
mybatisXmlSource: mybatisXmlSource,
|
|
676
|
+
controllerSource: controllerSrc,
|
|
677
|
+
tableDefinitions: JSON.stringify(columnInfo),
|
|
678
|
+
});
|
|
679
|
+
//this.#parent.addMessage("Jsx(React) 소스파일을 생성했습니다.");
|
|
680
|
+
progressMessageInstance.updateProgress('javascript', 'completed');
|
|
681
|
+
}
|
|
682
|
+
else {
|
|
683
|
+
jsSrc = src.javascript;
|
|
684
|
+
}
|
|
685
|
+
|
|
686
|
+
//await this.#generateRealFile(srcPath, apply);
|
|
687
|
+
|
|
688
|
+
const returnSrc = [];
|
|
689
|
+
|
|
690
|
+
const mapping = {
|
|
691
|
+
mybatis: {
|
|
692
|
+
path: srcPath.mybatisPullPath,
|
|
693
|
+
src: mybatisXmlSource,
|
|
694
|
+
},
|
|
695
|
+
service: {
|
|
696
|
+
path: srcPath.servicePullPath,
|
|
697
|
+
src: serviceSrc,
|
|
698
|
+
},
|
|
699
|
+
controller: {
|
|
700
|
+
path: srcPath.controllerPullPath,
|
|
701
|
+
src: controllerSrc,
|
|
702
|
+
},
|
|
703
|
+
javascript: {
|
|
704
|
+
path: srcPath.javascriptPullPath,
|
|
705
|
+
src: jsSrc,
|
|
706
|
+
}
|
|
707
|
+
};
|
|
708
|
+
|
|
709
|
+
for (const key in apply) {
|
|
710
|
+
if (apply[key]) {
|
|
711
|
+
returnSrc.push({
|
|
712
|
+
[key]: {
|
|
713
|
+
asis: src[key],
|
|
714
|
+
tobe: mapping[key].src,
|
|
715
|
+
tobePath: mapping[key].path,
|
|
716
|
+
}
|
|
717
|
+
});
|
|
718
|
+
}
|
|
719
|
+
}
|
|
720
|
+
|
|
721
|
+
console.log(returnSrc);
|
|
722
|
+
|
|
723
|
+
return returnSrc;
|
|
724
|
+
};
|
|
725
|
+
|
|
652
726
|
#generateListSource = async (userPrompt, apply, progressMessageInstance) => {
|
|
653
727
|
|
|
654
728
|
/**
|
|
@@ -772,10 +846,7 @@ console.log(el, href, title);
|
|
|
772
846
|
|
|
773
847
|
let jsSrc;
|
|
774
848
|
if (apply.javascript) {
|
|
775
|
-
|
|
776
|
-
console.log(this.prompt.react.filter(item => item.contains(".main.") || item.endsWith(".all.")));
|
|
777
|
-
//jsSrc = await this.#generateTmplFile("/prompts/meta/U.BuildReactJsx.txt", "react.jsx", {
|
|
778
|
-
jsSrc = await this.#generateTmplFile(this.prompt.react.filter(item => item.contains(".main.") || item.endsWith(".all.")), "react.jsx", {
|
|
849
|
+
jsSrc = await this.#generateTmplFile(this.prompt.react.filter(item => item.includes(".main.") || item.includes(".all.")), "react.jsx", {
|
|
779
850
|
userPrompt: userPrompt,
|
|
780
851
|
mybatis: srcPath.mybatis,
|
|
781
852
|
originSrc: src.javascript,
|
|
@@ -1238,7 +1309,7 @@ console.log(el, href, title);
|
|
|
1238
1309
|
}
|
|
1239
1310
|
//await this.#createSource(userPrompt, apply);
|
|
1240
1311
|
//return await this.#modifySource(userPrompt, apply, progressMessageInstance);
|
|
1241
|
-
return await this.#
|
|
1312
|
+
return await this.#generateSource(userPrompt, apply, progressMessageInstance);
|
|
1242
1313
|
}
|
|
1243
1314
|
else if (what === "C2") {
|
|
1244
1315
|
if (!apply.mybatis || !apply.service || !apply.controller || !apply.javascript) {
|
|
@@ -1252,7 +1323,8 @@ console.log(el, href, title);
|
|
|
1252
1323
|
const el = document.querySelector(".list-wrapper.active");
|
|
1253
1324
|
|
|
1254
1325
|
if (el) {
|
|
1255
|
-
return await this.#modifySource(userPrompt, apply, progressMessageInstance);
|
|
1326
|
+
//return await this.#modifySource(userPrompt, apply, progressMessageInstance);
|
|
1327
|
+
return await this.#generateSource(userPrompt, apply, progressMessageInstance);
|
|
1256
1328
|
}
|
|
1257
1329
|
else {
|
|
1258
1330
|
return await this.#modifyDetailSource(userPrompt, apply, progressMessageInstance);
|