ide-assi 0.591.0 → 0.593.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.
@@ -202088,8 +202088,6 @@ class IdeAi
202088
202088
  throw new Error(o);
202089
202089
  }
202090
202090
 
202091
- console.log(o);
202092
-
202093
202091
  return o.result;
202094
202092
  };
202095
202093
 
@@ -202437,6 +202435,175 @@ console.log(el, href, title);
202437
202435
  return returnSrc;
202438
202436
  };
202439
202437
 
202438
+ #generateDetailSource = async (userPrompt, apply, progressMessageInstance) => {
202439
+
202440
+ const el = ninegrid.querySelector("nx-side-menu-item.active");
202441
+ if (!el) throw new Error("관련 메뉴를 찾을 수 없습니다.");
202442
+
202443
+ const href = el.getAttribute("href");
202444
+ const title = el.getAttribute("title");
202445
+
202446
+ console.log(el, href, title);
202447
+
202448
+ const srcPath = this.#getSourcePath(href);
202449
+ console.log(srcPath);
202450
+
202451
+
202452
+ /**
202453
+ * {
202454
+ * "package": "ide.assi.be.tmpla",
202455
+ * "namespace": "ide.assi.be.tmpla.docmanager",
202456
+ * "baseClass": "DocManager",
202457
+ * "resultType": "ide.assi.core.utils.CamelCaseMap",
202458
+ * "mybatis": "tmpla/DocManagerMapper.xml",
202459
+ * "mybatisPullPath": "ide-assi-be/src/main/resources/mapper/tmpla/DocManagerMapper.xml",
202460
+ * "controllerPullPath": "ide-assi-be/src/main/java/ide/assi/be/tmpla/controller/DocManagerController.java",
202461
+ * "servicePullPath": "ide-assi-be/src/main/java/ide/assi/be/tmpla/service/DocManagerService.java",
202462
+ * "javascriptPullPath": "ide-assi-fe-vite-react-js/src/views/tmpla/doc-manager.jsx"
202463
+ * }
202464
+ */
202465
+ const src = await api.post("/api/source/read", srcPath);
202466
+ //console.log(src);
202467
+
202468
+ /**
202469
+ const response = await fetch(srcPath.javascript);
202470
+ src.javascript = await response.text();*/
202471
+
202472
+ //console.log(src);
202473
+ //const template = await fetch(path).then(res => res.text());
202474
+ /*
202475
+ arr.push({
202476
+ //menuId: elem.getAttribute("menu-id"),
202477
+ url: elem.getAttribute("href"),
202478
+ title: elem.getAttribute("title"),
202479
+ })*/
202480
+
202481
+
202482
+
202483
+
202484
+
202485
+ const where = await this.#where(`${title}에서 ${userPrompt}`, [{url: href, title: title}], await this.#getTableList());
202486
+ //this.#parent.addMessage("대상 메뉴와 테이블을 찾았습니다.");
202487
+ progressMessageInstance.updateProgress('prepare2', 'completed');
202488
+
202489
+ console.log(where);
202490
+
202491
+ //const srcPath = this.#getSourcePath(where.menu.url);
202492
+ console.log(srcPath);
202493
+
202494
+ const columnInfo = await this.#getColumnInfo(where.table);
202495
+
202496
+ let mybatisXmlSource;
202497
+ if (apply.mybatis) {
202498
+ mybatisXmlSource = await this.#generateTmplFile("/prompts/meta/U.BuildMyBatisMapper.txt", "mybatis.xml", {
202499
+ userPrompt: userPrompt,
202500
+ originSrc: src.mybatis,
202501
+ resultType: srcPath.resultType,
202502
+ namespace: srcPath.namespace,
202503
+ tableDefinitions: JSON.stringify(columnInfo),
202504
+ });
202505
+ //this.#parent.addMessage("MyBatis 소스파일을 생성했습니다.");
202506
+ progressMessageInstance.updateProgress('mybatis', 'completed');
202507
+ }
202508
+ else {
202509
+ mybatisXmlSource = src.mybatis;
202510
+ }
202511
+
202512
+ let serviceSrc;
202513
+ if (apply.service) {
202514
+ serviceSrc = await this.#generateTmplFile("/prompts/meta/U.BuildService.txt", "service.java", {
202515
+ userPrompt: userPrompt,
202516
+ originSrc: src.service,
202517
+ baseClass: srcPath.baseClass,
202518
+ myBatisPath: srcPath.mybatis,
202519
+ namespace: srcPath.namespace,
202520
+ package: srcPath.package + ".service",
202521
+ mybatisXmlSource: mybatisXmlSource,
202522
+ });
202523
+ //this.#parent.addMessage("Java(Service) 소스파일을 생성했습니다.");
202524
+ progressMessageInstance.updateProgress('service', 'completed');
202525
+ }
202526
+ else {
202527
+ serviceSrc = src.service;
202528
+ }
202529
+
202530
+ let controllerSrc;
202531
+ if (apply.controller) {
202532
+ controllerSrc = await this.#generateTmplFile("/prompts/meta/U.BuildController.txt", "controller.java", {
202533
+ userPrompt: userPrompt,
202534
+ originSrc: src.controller,
202535
+ baseClass: srcPath.baseClass,
202536
+ menuUrl: where.menu.url,
202537
+ package: srcPath.package + ".controller",
202538
+ serviceSource: serviceSrc,
202539
+ });
202540
+ //this.#parent.addMessage("Java(Controller) 소스파일을 생성했습니다.");
202541
+ progressMessageInstance.updateProgress('controller', 'completed');
202542
+ }
202543
+ else {
202544
+ controllerSrc = src.controller;
202545
+ }
202546
+
202547
+ let jsSrc;
202548
+ if (apply.javascript) {
202549
+ jsSrc = await this.#generateTmplFile("/prompts/meta/detail/4.BuildReactJsx_Detail.txt", "react2.jsx", {
202550
+ userPrompt: userPrompt,
202551
+ mybatis: srcPath.mybatis,
202552
+ originSrc: "", //src.javascript,
202553
+ menuUrl: where.menu.url,
202554
+ menuName: where.menu.name,
202555
+ baseClass: srcPath.baseClass,
202556
+ mybatisXmlSource: mybatisXmlSource,
202557
+ controllerSource: controllerSrc,
202558
+ tableDefinitions: JSON.stringify(columnInfo),
202559
+ });
202560
+ //this.#parent.addMessage("Jsx(React) 소스파일을 생성했습니다.");
202561
+ progressMessageInstance.updateProgress('javascript', 'completed');
202562
+ }
202563
+ else {
202564
+ jsSrc = src.javascript;
202565
+ }
202566
+
202567
+ //await this.#generateRealFile(srcPath, apply);
202568
+
202569
+ const returnSrc = [];
202570
+
202571
+ const mapping = {
202572
+ mybatis: {
202573
+ path: srcPath.mybatisPullPath,
202574
+ src: mybatisXmlSource,
202575
+ },
202576
+ service: {
202577
+ path: srcPath.servicePullPath,
202578
+ src: serviceSrc,
202579
+ },
202580
+ controller: {
202581
+ path: srcPath.controllerPullPath,
202582
+ src: controllerSrc,
202583
+ },
202584
+ javascript: {
202585
+ path: srcPath.javascriptPullPath,
202586
+ src: jsSrc,
202587
+ }
202588
+ };
202589
+
202590
+ for (const key in apply) {
202591
+ if (apply[key]) {
202592
+ returnSrc.push({
202593
+ [key]: {
202594
+ asis: src[key],
202595
+ tobe: mapping[key].src,
202596
+ tobePath: mapping[key].path,
202597
+ }
202598
+ });
202599
+ }
202600
+ }
202601
+
202602
+ console.log(returnSrc);
202603
+
202604
+ return returnSrc;
202605
+ };
202606
+
202440
202607
  generateSourceClient = async (userPrompt, apply) => {
202441
202608
 
202442
202609
  this.#createModel();
@@ -202487,10 +202654,21 @@ console.log(el, href, title);
202487
202654
  }, 9000);
202488
202655
  */
202489
202656
 
202490
- await this.#what(userPrompt);
202657
+ const what = await this.#what(userPrompt);
202491
202658
  //this.#parent.addMessage("명령을 이해했습니다.");
202492
202659
  progressMessageInstance.updateProgress('prepare1', 'completed');
202493
202660
 
202661
+ //active가 상세면
202662
+ if (!apply.javascript) ;
202663
+ if (what === "1") {
202664
+ if (!apply.mybatis || !apply.service || !apply.controller || !apply.javascript) ;
202665
+ //await this.#createSource(userPrompt, apply);
202666
+ return await this.#generateDetailSource(userPrompt, apply, progressMessageInstance);
202667
+ }
202668
+ else if (what === "2") {
202669
+ return await this.#generateDetailSource(userPrompt, apply, progressMessageInstance);
202670
+ }
202671
+
202494
202672
  return;
202495
202673
  }
202496
202674
 
@@ -202084,8 +202084,6 @@ class IdeAi
202084
202084
  throw new Error(o);
202085
202085
  }
202086
202086
 
202087
- console.log(o);
202088
-
202089
202087
  return o.result;
202090
202088
  };
202091
202089
 
@@ -202433,6 +202431,175 @@ console.log(el, href, title);
202433
202431
  return returnSrc;
202434
202432
  };
202435
202433
 
202434
+ #generateDetailSource = async (userPrompt, apply, progressMessageInstance) => {
202435
+
202436
+ const el = ninegrid.querySelector("nx-side-menu-item.active");
202437
+ if (!el) throw new Error("관련 메뉴를 찾을 수 없습니다.");
202438
+
202439
+ const href = el.getAttribute("href");
202440
+ const title = el.getAttribute("title");
202441
+
202442
+ console.log(el, href, title);
202443
+
202444
+ const srcPath = this.#getSourcePath(href);
202445
+ console.log(srcPath);
202446
+
202447
+
202448
+ /**
202449
+ * {
202450
+ * "package": "ide.assi.be.tmpla",
202451
+ * "namespace": "ide.assi.be.tmpla.docmanager",
202452
+ * "baseClass": "DocManager",
202453
+ * "resultType": "ide.assi.core.utils.CamelCaseMap",
202454
+ * "mybatis": "tmpla/DocManagerMapper.xml",
202455
+ * "mybatisPullPath": "ide-assi-be/src/main/resources/mapper/tmpla/DocManagerMapper.xml",
202456
+ * "controllerPullPath": "ide-assi-be/src/main/java/ide/assi/be/tmpla/controller/DocManagerController.java",
202457
+ * "servicePullPath": "ide-assi-be/src/main/java/ide/assi/be/tmpla/service/DocManagerService.java",
202458
+ * "javascriptPullPath": "ide-assi-fe-vite-react-js/src/views/tmpla/doc-manager.jsx"
202459
+ * }
202460
+ */
202461
+ const src = await api.post("/api/source/read", srcPath);
202462
+ //console.log(src);
202463
+
202464
+ /**
202465
+ const response = await fetch(srcPath.javascript);
202466
+ src.javascript = await response.text();*/
202467
+
202468
+ //console.log(src);
202469
+ //const template = await fetch(path).then(res => res.text());
202470
+ /*
202471
+ arr.push({
202472
+ //menuId: elem.getAttribute("menu-id"),
202473
+ url: elem.getAttribute("href"),
202474
+ title: elem.getAttribute("title"),
202475
+ })*/
202476
+
202477
+
202478
+
202479
+
202480
+
202481
+ const where = await this.#where(`${title}에서 ${userPrompt}`, [{url: href, title: title}], await this.#getTableList());
202482
+ //this.#parent.addMessage("대상 메뉴와 테이블을 찾았습니다.");
202483
+ progressMessageInstance.updateProgress('prepare2', 'completed');
202484
+
202485
+ console.log(where);
202486
+
202487
+ //const srcPath = this.#getSourcePath(where.menu.url);
202488
+ console.log(srcPath);
202489
+
202490
+ const columnInfo = await this.#getColumnInfo(where.table);
202491
+
202492
+ let mybatisXmlSource;
202493
+ if (apply.mybatis) {
202494
+ mybatisXmlSource = await this.#generateTmplFile("/prompts/meta/U.BuildMyBatisMapper.txt", "mybatis.xml", {
202495
+ userPrompt: userPrompt,
202496
+ originSrc: src.mybatis,
202497
+ resultType: srcPath.resultType,
202498
+ namespace: srcPath.namespace,
202499
+ tableDefinitions: JSON.stringify(columnInfo),
202500
+ });
202501
+ //this.#parent.addMessage("MyBatis 소스파일을 생성했습니다.");
202502
+ progressMessageInstance.updateProgress('mybatis', 'completed');
202503
+ }
202504
+ else {
202505
+ mybatisXmlSource = src.mybatis;
202506
+ }
202507
+
202508
+ let serviceSrc;
202509
+ if (apply.service) {
202510
+ serviceSrc = await this.#generateTmplFile("/prompts/meta/U.BuildService.txt", "service.java", {
202511
+ userPrompt: userPrompt,
202512
+ originSrc: src.service,
202513
+ baseClass: srcPath.baseClass,
202514
+ myBatisPath: srcPath.mybatis,
202515
+ namespace: srcPath.namespace,
202516
+ package: srcPath.package + ".service",
202517
+ mybatisXmlSource: mybatisXmlSource,
202518
+ });
202519
+ //this.#parent.addMessage("Java(Service) 소스파일을 생성했습니다.");
202520
+ progressMessageInstance.updateProgress('service', 'completed');
202521
+ }
202522
+ else {
202523
+ serviceSrc = src.service;
202524
+ }
202525
+
202526
+ let controllerSrc;
202527
+ if (apply.controller) {
202528
+ controllerSrc = await this.#generateTmplFile("/prompts/meta/U.BuildController.txt", "controller.java", {
202529
+ userPrompt: userPrompt,
202530
+ originSrc: src.controller,
202531
+ baseClass: srcPath.baseClass,
202532
+ menuUrl: where.menu.url,
202533
+ package: srcPath.package + ".controller",
202534
+ serviceSource: serviceSrc,
202535
+ });
202536
+ //this.#parent.addMessage("Java(Controller) 소스파일을 생성했습니다.");
202537
+ progressMessageInstance.updateProgress('controller', 'completed');
202538
+ }
202539
+ else {
202540
+ controllerSrc = src.controller;
202541
+ }
202542
+
202543
+ let jsSrc;
202544
+ if (apply.javascript) {
202545
+ jsSrc = await this.#generateTmplFile("/prompts/meta/detail/4.BuildReactJsx_Detail.txt", "react2.jsx", {
202546
+ userPrompt: userPrompt,
202547
+ mybatis: srcPath.mybatis,
202548
+ originSrc: "", //src.javascript,
202549
+ menuUrl: where.menu.url,
202550
+ menuName: where.menu.name,
202551
+ baseClass: srcPath.baseClass,
202552
+ mybatisXmlSource: mybatisXmlSource,
202553
+ controllerSource: controllerSrc,
202554
+ tableDefinitions: JSON.stringify(columnInfo),
202555
+ });
202556
+ //this.#parent.addMessage("Jsx(React) 소스파일을 생성했습니다.");
202557
+ progressMessageInstance.updateProgress('javascript', 'completed');
202558
+ }
202559
+ else {
202560
+ jsSrc = src.javascript;
202561
+ }
202562
+
202563
+ //await this.#generateRealFile(srcPath, apply);
202564
+
202565
+ const returnSrc = [];
202566
+
202567
+ const mapping = {
202568
+ mybatis: {
202569
+ path: srcPath.mybatisPullPath,
202570
+ src: mybatisXmlSource,
202571
+ },
202572
+ service: {
202573
+ path: srcPath.servicePullPath,
202574
+ src: serviceSrc,
202575
+ },
202576
+ controller: {
202577
+ path: srcPath.controllerPullPath,
202578
+ src: controllerSrc,
202579
+ },
202580
+ javascript: {
202581
+ path: srcPath.javascriptPullPath,
202582
+ src: jsSrc,
202583
+ }
202584
+ };
202585
+
202586
+ for (const key in apply) {
202587
+ if (apply[key]) {
202588
+ returnSrc.push({
202589
+ [key]: {
202590
+ asis: src[key],
202591
+ tobe: mapping[key].src,
202592
+ tobePath: mapping[key].path,
202593
+ }
202594
+ });
202595
+ }
202596
+ }
202597
+
202598
+ console.log(returnSrc);
202599
+
202600
+ return returnSrc;
202601
+ };
202602
+
202436
202603
  generateSourceClient = async (userPrompt, apply) => {
202437
202604
 
202438
202605
  this.#createModel();
@@ -202483,10 +202650,21 @@ console.log(el, href, title);
202483
202650
  }, 9000);
202484
202651
  */
202485
202652
 
202486
- await this.#what(userPrompt);
202653
+ const what = await this.#what(userPrompt);
202487
202654
  //this.#parent.addMessage("명령을 이해했습니다.");
202488
202655
  progressMessageInstance.updateProgress('prepare1', 'completed');
202489
202656
 
202657
+ //active가 상세면
202658
+ if (!apply.javascript) ;
202659
+ if (what === "1") {
202660
+ if (!apply.mybatis || !apply.service || !apply.controller || !apply.javascript) ;
202661
+ //await this.#createSource(userPrompt, apply);
202662
+ return await this.#generateDetailSource(userPrompt, apply, progressMessageInstance);
202663
+ }
202664
+ else if (what === "2") {
202665
+ return await this.#generateDetailSource(userPrompt, apply, progressMessageInstance);
202666
+ }
202667
+
202490
202668
  return;
202491
202669
  }
202492
202670
 
@@ -218,8 +218,6 @@ export class IdeAi
218
218
  throw new Error(o);
219
219
  }
220
220
 
221
- console.log(o);
222
-
223
221
  return o.result;
224
222
  };
225
223
 
@@ -567,6 +565,175 @@ console.log(el, href, title);
567
565
  return returnSrc;
568
566
  };
569
567
 
568
+ #generateDetailSource = async (userPrompt, apply, progressMessageInstance) => {
569
+
570
+ const el = ninegrid.querySelector("nx-side-menu-item.active");
571
+ if (!el) throw new Error("관련 메뉴를 찾을 수 없습니다.");
572
+
573
+ const href = el.getAttribute("href");
574
+ const title = el.getAttribute("title");
575
+
576
+ console.log(el, href, title);
577
+
578
+ const srcPath = this.#getSourcePath(href);
579
+ console.log(srcPath);
580
+
581
+
582
+ /**
583
+ * {
584
+ * "package": "ide.assi.be.tmpla",
585
+ * "namespace": "ide.assi.be.tmpla.docmanager",
586
+ * "baseClass": "DocManager",
587
+ * "resultType": "ide.assi.core.utils.CamelCaseMap",
588
+ * "mybatis": "tmpla/DocManagerMapper.xml",
589
+ * "mybatisPullPath": "ide-assi-be/src/main/resources/mapper/tmpla/DocManagerMapper.xml",
590
+ * "controllerPullPath": "ide-assi-be/src/main/java/ide/assi/be/tmpla/controller/DocManagerController.java",
591
+ * "servicePullPath": "ide-assi-be/src/main/java/ide/assi/be/tmpla/service/DocManagerService.java",
592
+ * "javascriptPullPath": "ide-assi-fe-vite-react-js/src/views/tmpla/doc-manager.jsx"
593
+ * }
594
+ */
595
+ const src = await api.post("/api/source/read", srcPath);
596
+ //console.log(src);
597
+
598
+ /**
599
+ const response = await fetch(srcPath.javascript);
600
+ src.javascript = await response.text();*/
601
+
602
+ //console.log(src);
603
+ //const template = await fetch(path).then(res => res.text());
604
+ /*
605
+ arr.push({
606
+ //menuId: elem.getAttribute("menu-id"),
607
+ url: elem.getAttribute("href"),
608
+ title: elem.getAttribute("title"),
609
+ })*/
610
+
611
+
612
+
613
+
614
+
615
+ const where = await this.#where(`${title}에서 ${userPrompt}`, [{url: href, title: title}], await this.#getTableList());
616
+ //this.#parent.addMessage("대상 메뉴와 테이블을 찾았습니다.");
617
+ progressMessageInstance.updateProgress('prepare2', 'completed');
618
+
619
+ console.log(where);
620
+
621
+ //const srcPath = this.#getSourcePath(where.menu.url);
622
+ console.log(srcPath);
623
+
624
+ const columnInfo = await this.#getColumnInfo(where.table);
625
+
626
+ let mybatisXmlSource;
627
+ if (apply.mybatis) {
628
+ mybatisXmlSource = await this.#generateTmplFile("/prompts/meta/U.BuildMyBatisMapper.txt", "mybatis.xml", {
629
+ userPrompt: userPrompt,
630
+ originSrc: src.mybatis,
631
+ resultType: srcPath.resultType,
632
+ namespace: srcPath.namespace,
633
+ tableDefinitions: JSON.stringify(columnInfo),
634
+ });
635
+ //this.#parent.addMessage("MyBatis 소스파일을 생성했습니다.");
636
+ progressMessageInstance.updateProgress('mybatis', 'completed');
637
+ }
638
+ else {
639
+ mybatisXmlSource = src.mybatis;
640
+ }
641
+
642
+ let serviceSrc;
643
+ if (apply.service) {
644
+ serviceSrc = await this.#generateTmplFile("/prompts/meta/U.BuildService.txt", "service.java", {
645
+ userPrompt: userPrompt,
646
+ originSrc: src.service,
647
+ baseClass: srcPath.baseClass,
648
+ myBatisPath: srcPath.mybatis,
649
+ namespace: srcPath.namespace,
650
+ package: srcPath.package + ".service",
651
+ mybatisXmlSource: mybatisXmlSource,
652
+ });
653
+ //this.#parent.addMessage("Java(Service) 소스파일을 생성했습니다.");
654
+ progressMessageInstance.updateProgress('service', 'completed');
655
+ }
656
+ else {
657
+ serviceSrc = src.service;
658
+ }
659
+
660
+ let controllerSrc;
661
+ if (apply.controller) {
662
+ controllerSrc = await this.#generateTmplFile("/prompts/meta/U.BuildController.txt", "controller.java", {
663
+ userPrompt: userPrompt,
664
+ originSrc: src.controller,
665
+ baseClass: srcPath.baseClass,
666
+ menuUrl: where.menu.url,
667
+ package: srcPath.package + ".controller",
668
+ serviceSource: serviceSrc,
669
+ });
670
+ //this.#parent.addMessage("Java(Controller) 소스파일을 생성했습니다.");
671
+ progressMessageInstance.updateProgress('controller', 'completed');
672
+ }
673
+ else {
674
+ controllerSrc = src.controller;
675
+ }
676
+
677
+ let jsSrc;
678
+ if (apply.javascript) {
679
+ jsSrc = await this.#generateTmplFile("/prompts/meta/detail/4.BuildReactJsx_Detail.txt", "react2.jsx", {
680
+ userPrompt: userPrompt,
681
+ mybatis: srcPath.mybatis,
682
+ originSrc: "", //src.javascript,
683
+ menuUrl: where.menu.url,
684
+ menuName: where.menu.name,
685
+ baseClass: srcPath.baseClass,
686
+ mybatisXmlSource: mybatisXmlSource,
687
+ controllerSource: controllerSrc,
688
+ tableDefinitions: JSON.stringify(columnInfo),
689
+ });
690
+ //this.#parent.addMessage("Jsx(React) 소스파일을 생성했습니다.");
691
+ progressMessageInstance.updateProgress('javascript', 'completed');
692
+ }
693
+ else {
694
+ jsSrc = src.javascript;
695
+ }
696
+
697
+ //await this.#generateRealFile(srcPath, apply);
698
+
699
+ const returnSrc = [];
700
+
701
+ const mapping = {
702
+ mybatis: {
703
+ path: srcPath.mybatisPullPath,
704
+ src: mybatisXmlSource,
705
+ },
706
+ service: {
707
+ path: srcPath.servicePullPath,
708
+ src: serviceSrc,
709
+ },
710
+ controller: {
711
+ path: srcPath.controllerPullPath,
712
+ src: controllerSrc,
713
+ },
714
+ javascript: {
715
+ path: srcPath.javascriptPullPath,
716
+ src: jsSrc,
717
+ }
718
+ };
719
+
720
+ for (const key in apply) {
721
+ if (apply[key]) {
722
+ returnSrc.push({
723
+ [key]: {
724
+ asis: src[key],
725
+ tobe: mapping[key].src,
726
+ tobePath: mapping[key].path,
727
+ }
728
+ });
729
+ }
730
+ }
731
+
732
+ console.log(returnSrc);
733
+
734
+ return returnSrc;
735
+ };
736
+
570
737
  generateSourceClient = async (userPrompt, apply) => {
571
738
 
572
739
  this.#createModel();
@@ -621,6 +788,21 @@ console.log(el, href, title);
621
788
  //this.#parent.addMessage("명령을 이해했습니다.");
622
789
  progressMessageInstance.updateProgress('prepare1', 'completed');
623
790
 
791
+ //active가 상세면
792
+ if (!apply.javascript) {
793
+ //return "소스 생성하실려면 변경대상 소스를 모두 선택하세요.";
794
+ }
795
+ if (what === "1") {
796
+ if (!apply.mybatis || !apply.service || !apply.controller || !apply.javascript) {
797
+ //return "소스 생성하실려면 변경대상 소스를 모두 선택하세요.";
798
+ }
799
+ //await this.#createSource(userPrompt, apply);
800
+ return await this.#generateDetailSource(userPrompt, apply, progressMessageInstance);
801
+ }
802
+ else if (what === "2") {
803
+ return await this.#generateDetailSource(userPrompt, apply, progressMessageInstance);
804
+ }
805
+
624
806
  return;
625
807
 
626
808
  if (what === "1") {
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "ide-assi",
3
3
  "type": "module",
4
- "version": "0.591.0",
4
+ "version": "0.593.0",
5
5
  "main": "dist/index.js",
6
6
  "types": "dist/index.d.ts",
7
7
  "exports": {
@@ -218,8 +218,6 @@ export class IdeAi
218
218
  throw new Error(o);
219
219
  }
220
220
 
221
- console.log(o);
222
-
223
221
  return o.result;
224
222
  };
225
223
 
@@ -567,6 +565,175 @@ console.log(el, href, title);
567
565
  return returnSrc;
568
566
  };
569
567
 
568
+ #generateDetailSource = async (userPrompt, apply, progressMessageInstance) => {
569
+
570
+ const el = ninegrid.querySelector("nx-side-menu-item.active");
571
+ if (!el) throw new Error("관련 메뉴를 찾을 수 없습니다.");
572
+
573
+ const href = el.getAttribute("href");
574
+ const title = el.getAttribute("title");
575
+
576
+ console.log(el, href, title);
577
+
578
+ const srcPath = this.#getSourcePath(href);
579
+ console.log(srcPath);
580
+
581
+
582
+ /**
583
+ * {
584
+ * "package": "ide.assi.be.tmpla",
585
+ * "namespace": "ide.assi.be.tmpla.docmanager",
586
+ * "baseClass": "DocManager",
587
+ * "resultType": "ide.assi.core.utils.CamelCaseMap",
588
+ * "mybatis": "tmpla/DocManagerMapper.xml",
589
+ * "mybatisPullPath": "ide-assi-be/src/main/resources/mapper/tmpla/DocManagerMapper.xml",
590
+ * "controllerPullPath": "ide-assi-be/src/main/java/ide/assi/be/tmpla/controller/DocManagerController.java",
591
+ * "servicePullPath": "ide-assi-be/src/main/java/ide/assi/be/tmpla/service/DocManagerService.java",
592
+ * "javascriptPullPath": "ide-assi-fe-vite-react-js/src/views/tmpla/doc-manager.jsx"
593
+ * }
594
+ */
595
+ const src = await api.post("/api/source/read", srcPath);
596
+ //console.log(src);
597
+
598
+ /**
599
+ const response = await fetch(srcPath.javascript);
600
+ src.javascript = await response.text();*/
601
+
602
+ //console.log(src);
603
+ //const template = await fetch(path).then(res => res.text());
604
+ /*
605
+ arr.push({
606
+ //menuId: elem.getAttribute("menu-id"),
607
+ url: elem.getAttribute("href"),
608
+ title: elem.getAttribute("title"),
609
+ })*/
610
+
611
+
612
+
613
+
614
+
615
+ const where = await this.#where(`${title}에서 ${userPrompt}`, [{url: href, title: title}], await this.#getTableList());
616
+ //this.#parent.addMessage("대상 메뉴와 테이블을 찾았습니다.");
617
+ progressMessageInstance.updateProgress('prepare2', 'completed');
618
+
619
+ console.log(where);
620
+
621
+ //const srcPath = this.#getSourcePath(where.menu.url);
622
+ console.log(srcPath);
623
+
624
+ const columnInfo = await this.#getColumnInfo(where.table);
625
+
626
+ let mybatisXmlSource;
627
+ if (apply.mybatis) {
628
+ mybatisXmlSource = await this.#generateTmplFile("/prompts/meta/U.BuildMyBatisMapper.txt", "mybatis.xml", {
629
+ userPrompt: userPrompt,
630
+ originSrc: src.mybatis,
631
+ resultType: srcPath.resultType,
632
+ namespace: srcPath.namespace,
633
+ tableDefinitions: JSON.stringify(columnInfo),
634
+ });
635
+ //this.#parent.addMessage("MyBatis 소스파일을 생성했습니다.");
636
+ progressMessageInstance.updateProgress('mybatis', 'completed');
637
+ }
638
+ else {
639
+ mybatisXmlSource = src.mybatis;
640
+ }
641
+
642
+ let serviceSrc;
643
+ if (apply.service) {
644
+ serviceSrc = await this.#generateTmplFile("/prompts/meta/U.BuildService.txt", "service.java", {
645
+ userPrompt: userPrompt,
646
+ originSrc: src.service,
647
+ baseClass: srcPath.baseClass,
648
+ myBatisPath: srcPath.mybatis,
649
+ namespace: srcPath.namespace,
650
+ package: srcPath.package + ".service",
651
+ mybatisXmlSource: mybatisXmlSource,
652
+ });
653
+ //this.#parent.addMessage("Java(Service) 소스파일을 생성했습니다.");
654
+ progressMessageInstance.updateProgress('service', 'completed');
655
+ }
656
+ else {
657
+ serviceSrc = src.service;
658
+ }
659
+
660
+ let controllerSrc;
661
+ if (apply.controller) {
662
+ controllerSrc = await this.#generateTmplFile("/prompts/meta/U.BuildController.txt", "controller.java", {
663
+ userPrompt: userPrompt,
664
+ originSrc: src.controller,
665
+ baseClass: srcPath.baseClass,
666
+ menuUrl: where.menu.url,
667
+ package: srcPath.package + ".controller",
668
+ serviceSource: serviceSrc,
669
+ });
670
+ //this.#parent.addMessage("Java(Controller) 소스파일을 생성했습니다.");
671
+ progressMessageInstance.updateProgress('controller', 'completed');
672
+ }
673
+ else {
674
+ controllerSrc = src.controller;
675
+ }
676
+
677
+ let jsSrc;
678
+ if (apply.javascript) {
679
+ jsSrc = await this.#generateTmplFile("/prompts/meta/detail/4.BuildReactJsx_Detail.txt", "react2.jsx", {
680
+ userPrompt: userPrompt,
681
+ mybatis: srcPath.mybatis,
682
+ originSrc: "", //src.javascript,
683
+ menuUrl: where.menu.url,
684
+ menuName: where.menu.name,
685
+ baseClass: srcPath.baseClass,
686
+ mybatisXmlSource: mybatisXmlSource,
687
+ controllerSource: controllerSrc,
688
+ tableDefinitions: JSON.stringify(columnInfo),
689
+ });
690
+ //this.#parent.addMessage("Jsx(React) 소스파일을 생성했습니다.");
691
+ progressMessageInstance.updateProgress('javascript', 'completed');
692
+ }
693
+ else {
694
+ jsSrc = src.javascript;
695
+ }
696
+
697
+ //await this.#generateRealFile(srcPath, apply);
698
+
699
+ const returnSrc = [];
700
+
701
+ const mapping = {
702
+ mybatis: {
703
+ path: srcPath.mybatisPullPath,
704
+ src: mybatisXmlSource,
705
+ },
706
+ service: {
707
+ path: srcPath.servicePullPath,
708
+ src: serviceSrc,
709
+ },
710
+ controller: {
711
+ path: srcPath.controllerPullPath,
712
+ src: controllerSrc,
713
+ },
714
+ javascript: {
715
+ path: srcPath.javascriptPullPath,
716
+ src: jsSrc,
717
+ }
718
+ };
719
+
720
+ for (const key in apply) {
721
+ if (apply[key]) {
722
+ returnSrc.push({
723
+ [key]: {
724
+ asis: src[key],
725
+ tobe: mapping[key].src,
726
+ tobePath: mapping[key].path,
727
+ }
728
+ });
729
+ }
730
+ }
731
+
732
+ console.log(returnSrc);
733
+
734
+ return returnSrc;
735
+ };
736
+
570
737
  generateSourceClient = async (userPrompt, apply) => {
571
738
 
572
739
  this.#createModel();
@@ -621,6 +788,21 @@ console.log(el, href, title);
621
788
  //this.#parent.addMessage("명령을 이해했습니다.");
622
789
  progressMessageInstance.updateProgress('prepare1', 'completed');
623
790
 
791
+ //active가 상세면
792
+ if (!apply.javascript) {
793
+ //return "소스 생성하실려면 변경대상 소스를 모두 선택하세요.";
794
+ }
795
+ if (what === "1") {
796
+ if (!apply.mybatis || !apply.service || !apply.controller || !apply.javascript) {
797
+ //return "소스 생성하실려면 변경대상 소스를 모두 선택하세요.";
798
+ }
799
+ //await this.#createSource(userPrompt, apply);
800
+ return await this.#generateDetailSource(userPrompt, apply, progressMessageInstance);
801
+ }
802
+ else if (what === "2") {
803
+ return await this.#generateDetailSource(userPrompt, apply, progressMessageInstance);
804
+ }
805
+
624
806
  return;
625
807
 
626
808
  if (what === "1") {