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/bundle.cjs.js
CHANGED
|
@@ -202484,9 +202484,6 @@ class IdeUtils
|
|
|
202484
202484
|
constructor() {
|
|
202485
202485
|
}
|
|
202486
202486
|
|
|
202487
|
-
|
|
202488
|
-
|
|
202489
|
-
|
|
202490
202487
|
static generatePrompt = async (paths, params) => {
|
|
202491
202488
|
|
|
202492
202489
|
if (!Array.isArray(paths)) paths = [paths];
|
|
@@ -202779,26 +202776,6 @@ class IdeAi
|
|
|
202779
202776
|
return o;
|
|
202780
202777
|
};
|
|
202781
202778
|
|
|
202782
|
-
|
|
202783
|
-
#generateRealFile_BAK = async (srcPath, apply) => {
|
|
202784
|
-
|
|
202785
|
-
//const files = ["mybatis.xml", "service.java", "controller.java", "react.jsx"];
|
|
202786
|
-
let files = [];
|
|
202787
|
-
if (apply.mybatis) files.push("mybatis.xml");
|
|
202788
|
-
if (apply.service) files.push("service.java");
|
|
202789
|
-
if (apply.controller) files.push("controller.java");
|
|
202790
|
-
if (apply.javascript) files.push("react.jsx");
|
|
202791
|
-
|
|
202792
|
-
const params = await Promise.all(
|
|
202793
|
-
files.map(async (file) => ({
|
|
202794
|
-
path: ninegrid.decode(file, "mybatis.xml", srcPath.mybatisPullPath, "service.java", srcPath.servicePullPath, "controller.java", srcPath.controllerPullPath, "react.jsx", srcPath.javascriptPullPath),
|
|
202795
|
-
contents: await fetch(`/api/templates/${file}`).then(res => res.text()),
|
|
202796
|
-
}))
|
|
202797
|
-
);
|
|
202798
|
-
|
|
202799
|
-
api.post(`/api/source/generateRealFile`, { list: params });
|
|
202800
|
-
};
|
|
202801
|
-
|
|
202802
202779
|
#generateRealFile = async (srcPath, apply) => {
|
|
202803
202780
|
const fileMap = {
|
|
202804
202781
|
mybatis: { name: "mybatis.xml", path: srcPath.mybatisPullPath },
|
|
@@ -202840,41 +202817,6 @@ class IdeAi
|
|
|
202840
202817
|
return src;
|
|
202841
202818
|
};
|
|
202842
202819
|
|
|
202843
|
-
#getSourcePath_BAK = (menuUrl) => {
|
|
202844
|
-
const path = menuUrl.replace(/^\/+/, '');
|
|
202845
|
-
|
|
202846
|
-
const raw = path.split("/").join(".").toLowerCase();
|
|
202847
|
-
const cleaned = raw.replace(/[^a-z0-9.]/g, "");
|
|
202848
|
-
const namespace = `${this.#parent.config.basePackage}.${cleaned}`;
|
|
202849
|
-
|
|
202850
|
-
const packageName = namespace.split(".").slice(0, -1).join(".");
|
|
202851
|
-
|
|
202852
|
-
//const packageName = `${path.split("/").slice(0, -1).join(".").toLowerCase()}`;
|
|
202853
|
-
//const packageName = path.split("/").join(".").toLowerCase();
|
|
202854
|
-
const fileName = path.split("/").at(-1).toLowerCase().split('-').map(word => word.charAt(0).toUpperCase() + word.slice(1)).join('');
|
|
202855
|
-
|
|
202856
|
-
return {
|
|
202857
|
-
package: packageName,
|
|
202858
|
-
namespace: namespace,
|
|
202859
|
-
baseClass: fileName,
|
|
202860
|
-
resultType: this.#parent.config.basePackage.split(".").slice(0, -1).join(".") + ".core.utils.CamelCaseMap",
|
|
202861
|
-
mybatis: `${cleaned.split(".").slice(0, -1).join("/")}/${fileName}Mapper.xml`,
|
|
202862
|
-
javascript: `/src/views/${cleaned.split(".").slice(0, -1).join("/")}/${path.split("/").at(-1)}.jsx`,
|
|
202863
|
-
mybatisPullPath: `${this.#parent.settings.beProjectName}/src/main/resources/mapper/${cleaned.split(".").slice(0, -1).join("/")}/${fileName}Mapper.xml`,
|
|
202864
|
-
controllerPullPath: `${this.#parent.settings.beProjectName}/src/main/java/${packageName.replaceAll(".", "/")}/controller/${fileName}Controller.java`,
|
|
202865
|
-
servicePullPath: `${this.#parent.settings.beProjectName}/src/main/java/${packageName.replaceAll(".", "/")}/service/${fileName}Service.java`,
|
|
202866
|
-
javascriptPullPath: `${this.#parent.settings.feProjectName}/src/views/${cleaned.split(".").slice(0, -1).join("/")}/${path.split("/").at(-1)}.jsx`,
|
|
202867
|
-
};
|
|
202868
|
-
/***
|
|
202869
|
-
return {
|
|
202870
|
-
package: packageName,
|
|
202871
|
-
namespace: namespace,
|
|
202872
|
-
controller: `/src/main/java/${packageName.replaceAll(".", "/")}/controller/${fileName}Controller.java`,
|
|
202873
|
-
service: `/src/main/java/${packageName.replaceAll(".", "/")}/service/${fileName}Service.java`,
|
|
202874
|
-
mybatis: `/src/main/resource/mapper/${path.split("/").slice(0, -1).join("/").toLowerCase()}/${fileName}Mapper.xml`,
|
|
202875
|
-
javascript: `/${jsroot}/${path.split("/").slice(0, -1).join("/").toLowerCase()}/${path.split("/").at(-1)}.jsx`,
|
|
202876
|
-
};*/
|
|
202877
|
-
};
|
|
202878
202820
|
|
|
202879
202821
|
#findFirstEmptyDetailWrapper = () => {
|
|
202880
202822
|
const allWrappers = document.querySelectorAll('div[class^="detail-wrapper-"]');
|
|
@@ -202960,58 +202902,6 @@ class IdeAi
|
|
|
202960
202902
|
};
|
|
202961
202903
|
|
|
202962
202904
|
|
|
202963
|
-
|
|
202964
|
-
#createSource = async (userPrompt, apply) => {
|
|
202965
|
-
const where = await this.#where(userPrompt, this.#getMenuInfo(), await this.#getTableList());
|
|
202966
|
-
this.#parent.addMessage("대상 메뉴와 테이블을 찾았습니다.");
|
|
202967
|
-
|
|
202968
|
-
console.log(where);
|
|
202969
|
-
|
|
202970
|
-
const srcPath = this.#getSourcePath(where.menu.url);
|
|
202971
|
-
console.log(srcPath);
|
|
202972
|
-
|
|
202973
|
-
const columnInfo = await this.#getColumnInfo(where.table);
|
|
202974
|
-
|
|
202975
|
-
const mybatisXmlSource = await this.#generateTmplFile("/prompts/meta/C.BuildMyBatisMapper.txt", "mybatis.xml", {
|
|
202976
|
-
userPrompt: userPrompt,
|
|
202977
|
-
resultType: srcPath.resultType,
|
|
202978
|
-
namespace: srcPath.namespace,
|
|
202979
|
-
tableDefinitions: JSON.stringify(columnInfo)
|
|
202980
|
-
});
|
|
202981
|
-
this.#parent.addMessage("MyBatis 소스파일을 생성했습니다.");
|
|
202982
|
-
|
|
202983
|
-
const serviceSrc = await this.#generateTmplFile("/prompts/meta/C.BuildService.txt", "service.java", {
|
|
202984
|
-
userPrompt: userPrompt,
|
|
202985
|
-
baseClass: srcPath.baseClass,
|
|
202986
|
-
myBatisPath: srcPath.mybatis,
|
|
202987
|
-
namespace: srcPath.namespace,
|
|
202988
|
-
package: srcPath.package + ".service",
|
|
202989
|
-
mybatisXmlSource: mybatisXmlSource,
|
|
202990
|
-
});
|
|
202991
|
-
this.#parent.addMessage("Java(Service) 소스파일을 생성했습니다.");
|
|
202992
|
-
|
|
202993
|
-
const controllerSrc = await this.#generateTmplFile("/prompts/meta/C.BuildController.txt", "controller.java", {
|
|
202994
|
-
userPrompt: userPrompt,
|
|
202995
|
-
baseClass: srcPath.baseClass,
|
|
202996
|
-
menuUrl: where.menu.url,
|
|
202997
|
-
package: srcPath.package + ".controller",
|
|
202998
|
-
serviceSource: serviceSrc,
|
|
202999
|
-
});
|
|
203000
|
-
this.#parent.addMessage("Java(Controller) 소스파일을 생성했습니다.");
|
|
203001
|
-
|
|
203002
|
-
await this.#generateTmplFile("/prompts/meta/C.BuildReactJsx.txt", "react.jsx", {
|
|
203003
|
-
userPrompt: userPrompt,
|
|
203004
|
-
menuUrl: where.menu.url,
|
|
203005
|
-
menuName: where.menu.name,
|
|
203006
|
-
baseClass: srcPath.baseClass,
|
|
203007
|
-
controllerSource: controllerSrc,
|
|
203008
|
-
tableDefinitions: JSON.stringify(columnInfo),
|
|
203009
|
-
});
|
|
203010
|
-
this.#parent.addMessage("Jsx(React) 소스파일을 생성했습니다.");
|
|
203011
|
-
|
|
203012
|
-
await this.#generateRealFile(srcPath, apply);
|
|
203013
|
-
};
|
|
203014
|
-
|
|
203015
202905
|
#modifySource = async (userPrompt, apply, progressMessageInstance) => {
|
|
203016
202906
|
|
|
203017
202907
|
const el = ninegrid.querySelector("nx-side-menu-item.active");
|
|
@@ -203182,6 +203072,187 @@ console.log(el, href, title);
|
|
|
203182
203072
|
return returnSrc;
|
|
203183
203073
|
};
|
|
203184
203074
|
|
|
203075
|
+
#generateSource = async (userPrompt, apply, progressMessageInstance) => {
|
|
203076
|
+
|
|
203077
|
+
/**
|
|
203078
|
+
const el = ninegrid.querySelector("nx-side-menu-item.active");
|
|
203079
|
+
if (!el) throw new Error("관련 메뉴를 찾을 수 없습니다.");
|
|
203080
|
+
|
|
203081
|
+
const href = el.getAttribute("href");
|
|
203082
|
+
const title = el.getAttribute("title");
|
|
203083
|
+
|
|
203084
|
+
console.log(el, href, title);
|
|
203085
|
+
|
|
203086
|
+
const srcPath = this.#getSourcePath(href);
|
|
203087
|
+
console.log(srcPath);
|
|
203088
|
+
*/
|
|
203089
|
+
|
|
203090
|
+
|
|
203091
|
+
const where = await this.#where(userPrompt, this.#getMenuInfo(), await this.#getTableList());
|
|
203092
|
+
//this.#parent.addMessage("대상 메뉴와 테이블을 찾았습니다.")
|
|
203093
|
+
|
|
203094
|
+
console.log(where);
|
|
203095
|
+
|
|
203096
|
+
const srcPath = this.#getSourcePath(where.menu.url);
|
|
203097
|
+
console.log(srcPath);
|
|
203098
|
+
|
|
203099
|
+
|
|
203100
|
+
/**
|
|
203101
|
+
* {
|
|
203102
|
+
* "package": "ide.assi.be.tmpla",
|
|
203103
|
+
* "namespace": "ide.assi.be.tmpla.docmanager",
|
|
203104
|
+
* "baseClass": "DocManager",
|
|
203105
|
+
* "resultType": "ide.assi.core.utils.CamelCaseMap",
|
|
203106
|
+
* "mybatis": "tmpla/DocManagerMapper.xml",
|
|
203107
|
+
* "mybatisPullPath": "ide-assi-be/src/main/resources/mapper/tmpla/DocManagerMapper.xml",
|
|
203108
|
+
* "controllerPullPath": "ide-assi-be/src/main/java/ide/assi/be/tmpla/controller/DocManagerController.java",
|
|
203109
|
+
* "servicePullPath": "ide-assi-be/src/main/java/ide/assi/be/tmpla/service/DocManagerService.java",
|
|
203110
|
+
* "javascriptPullPath": "ide-assi-fe-vite-react-js/src/views/tmpla/doc-manager.jsx"
|
|
203111
|
+
* }
|
|
203112
|
+
*/
|
|
203113
|
+
const src = await api.post("/api/source/read", srcPath);
|
|
203114
|
+
//console.log(src);
|
|
203115
|
+
|
|
203116
|
+
/**
|
|
203117
|
+
const response = await fetch(srcPath.javascript);
|
|
203118
|
+
src.javascript = await response.text();*/
|
|
203119
|
+
|
|
203120
|
+
//console.log(src);
|
|
203121
|
+
//const template = await fetch(path).then(res => res.text());
|
|
203122
|
+
/*
|
|
203123
|
+
arr.push({
|
|
203124
|
+
//menuId: elem.getAttribute("menu-id"),
|
|
203125
|
+
url: elem.getAttribute("href"),
|
|
203126
|
+
title: elem.getAttribute("title"),
|
|
203127
|
+
})*/
|
|
203128
|
+
|
|
203129
|
+
|
|
203130
|
+
|
|
203131
|
+
|
|
203132
|
+
|
|
203133
|
+
//const where = await this.#where(`${title}에서 ${userPrompt}`, [{url: href, title: title}], await this.#getTableList());
|
|
203134
|
+
//this.#parent.addMessage("대상 메뉴와 테이블을 찾았습니다.");
|
|
203135
|
+
progressMessageInstance.updateProgress('prepare2', 'completed');
|
|
203136
|
+
|
|
203137
|
+
//console.log(where);
|
|
203138
|
+
|
|
203139
|
+
//const srcPath = this.#getSourcePath(where.menu.url);
|
|
203140
|
+
|
|
203141
|
+
|
|
203142
|
+
|
|
203143
|
+
const columnInfo = await this.#getColumnInfo(where.table);
|
|
203144
|
+
|
|
203145
|
+
let mybatisXmlSource;
|
|
203146
|
+
if (apply.mybatis) {
|
|
203147
|
+
mybatisXmlSource = await this.#generateTmplFile("/prompts/meta/U.BuildMyBatisMapper.txt", "mybatis.xml", {
|
|
203148
|
+
userPrompt: userPrompt,
|
|
203149
|
+
originSrc: src.mybatis,
|
|
203150
|
+
resultType: srcPath.resultType,
|
|
203151
|
+
namespace: srcPath.namespace,
|
|
203152
|
+
tableDefinitions: JSON.stringify(columnInfo),
|
|
203153
|
+
});
|
|
203154
|
+
//this.#parent.addMessage("MyBatis 소스파일을 생성했습니다.");
|
|
203155
|
+
progressMessageInstance.updateProgress('mybatis', 'completed');
|
|
203156
|
+
}
|
|
203157
|
+
else {
|
|
203158
|
+
mybatisXmlSource = src.mybatis;
|
|
203159
|
+
}
|
|
203160
|
+
|
|
203161
|
+
let serviceSrc;
|
|
203162
|
+
if (apply.service) {
|
|
203163
|
+
serviceSrc = await this.#generateTmplFile("/prompts/meta/U.BuildService.txt", "service.java", {
|
|
203164
|
+
userPrompt: userPrompt,
|
|
203165
|
+
originSrc: src.service,
|
|
203166
|
+
baseClass: srcPath.baseClass,
|
|
203167
|
+
myBatisPath: srcPath.mybatis,
|
|
203168
|
+
namespace: srcPath.namespace,
|
|
203169
|
+
package: srcPath.package + ".service",
|
|
203170
|
+
mybatisXmlSource: mybatisXmlSource,
|
|
203171
|
+
});
|
|
203172
|
+
//this.#parent.addMessage("Java(Service) 소스파일을 생성했습니다.");
|
|
203173
|
+
progressMessageInstance.updateProgress('service', 'completed');
|
|
203174
|
+
}
|
|
203175
|
+
else {
|
|
203176
|
+
serviceSrc = src.service;
|
|
203177
|
+
}
|
|
203178
|
+
|
|
203179
|
+
let controllerSrc;
|
|
203180
|
+
if (apply.controller) {
|
|
203181
|
+
controllerSrc = await this.#generateTmplFile("/prompts/meta/U.BuildController.txt", "controller.java", {
|
|
203182
|
+
userPrompt: userPrompt,
|
|
203183
|
+
originSrc: src.controller,
|
|
203184
|
+
baseClass: srcPath.baseClass,
|
|
203185
|
+
menuUrl: where.menu.url,
|
|
203186
|
+
package: srcPath.package + ".controller",
|
|
203187
|
+
serviceSource: serviceSrc,
|
|
203188
|
+
});
|
|
203189
|
+
//this.#parent.addMessage("Java(Controller) 소스파일을 생성했습니다.");
|
|
203190
|
+
progressMessageInstance.updateProgress('controller', 'completed');
|
|
203191
|
+
}
|
|
203192
|
+
else {
|
|
203193
|
+
controllerSrc = src.controller;
|
|
203194
|
+
}
|
|
203195
|
+
|
|
203196
|
+
let jsSrc;
|
|
203197
|
+
if (apply.javascript) {
|
|
203198
|
+
jsSrc = await this.#generateTmplFile(this.prompt.react.filter(item => item.includes(".main.") || item.includes(".all.")), "react.jsx", {
|
|
203199
|
+
userPrompt: userPrompt,
|
|
203200
|
+
mybatis: srcPath.mybatis,
|
|
203201
|
+
originSrc: src.javascript,
|
|
203202
|
+
menuUrl: where.menu.url,
|
|
203203
|
+
menuName: where.menu.name,
|
|
203204
|
+
baseClass: srcPath.baseClass,
|
|
203205
|
+
mybatisXmlSource: mybatisXmlSource,
|
|
203206
|
+
controllerSource: controllerSrc,
|
|
203207
|
+
tableDefinitions: JSON.stringify(columnInfo),
|
|
203208
|
+
});
|
|
203209
|
+
//this.#parent.addMessage("Jsx(React) 소스파일을 생성했습니다.");
|
|
203210
|
+
progressMessageInstance.updateProgress('javascript', 'completed');
|
|
203211
|
+
}
|
|
203212
|
+
else {
|
|
203213
|
+
jsSrc = src.javascript;
|
|
203214
|
+
}
|
|
203215
|
+
|
|
203216
|
+
//await this.#generateRealFile(srcPath, apply);
|
|
203217
|
+
|
|
203218
|
+
const returnSrc = [];
|
|
203219
|
+
|
|
203220
|
+
const mapping = {
|
|
203221
|
+
mybatis: {
|
|
203222
|
+
path: srcPath.mybatisPullPath,
|
|
203223
|
+
src: mybatisXmlSource,
|
|
203224
|
+
},
|
|
203225
|
+
service: {
|
|
203226
|
+
path: srcPath.servicePullPath,
|
|
203227
|
+
src: serviceSrc,
|
|
203228
|
+
},
|
|
203229
|
+
controller: {
|
|
203230
|
+
path: srcPath.controllerPullPath,
|
|
203231
|
+
src: controllerSrc,
|
|
203232
|
+
},
|
|
203233
|
+
javascript: {
|
|
203234
|
+
path: srcPath.javascriptPullPath,
|
|
203235
|
+
src: jsSrc,
|
|
203236
|
+
}
|
|
203237
|
+
};
|
|
203238
|
+
|
|
203239
|
+
for (const key in apply) {
|
|
203240
|
+
if (apply[key]) {
|
|
203241
|
+
returnSrc.push({
|
|
203242
|
+
[key]: {
|
|
203243
|
+
asis: src[key],
|
|
203244
|
+
tobe: mapping[key].src,
|
|
203245
|
+
tobePath: mapping[key].path,
|
|
203246
|
+
}
|
|
203247
|
+
});
|
|
203248
|
+
}
|
|
203249
|
+
}
|
|
203250
|
+
|
|
203251
|
+
console.log(returnSrc);
|
|
203252
|
+
|
|
203253
|
+
return returnSrc;
|
|
203254
|
+
};
|
|
203255
|
+
|
|
203185
203256
|
#generateListSource = async (userPrompt, apply, progressMessageInstance) => {
|
|
203186
203257
|
|
|
203187
203258
|
/**
|
|
@@ -203305,10 +203376,7 @@ console.log(el, href, title);
|
|
|
203305
203376
|
|
|
203306
203377
|
let jsSrc;
|
|
203307
203378
|
if (apply.javascript) {
|
|
203308
|
-
|
|
203309
|
-
console.log(this.prompt.react.filter(item => item.contains(".main.") || item.endsWith(".all.")));
|
|
203310
|
-
//jsSrc = await this.#generateTmplFile("/prompts/meta/U.BuildReactJsx.txt", "react.jsx", {
|
|
203311
|
-
jsSrc = await this.#generateTmplFile(this.prompt.react.filter(item => item.contains(".main.") || item.endsWith(".all.")), "react.jsx", {
|
|
203379
|
+
jsSrc = await this.#generateTmplFile(this.prompt.react.filter(item => item.includes(".main.") || item.includes(".all.")), "react.jsx", {
|
|
203312
203380
|
userPrompt: userPrompt,
|
|
203313
203381
|
mybatis: srcPath.mybatis,
|
|
203314
203382
|
originSrc: src.javascript,
|
|
@@ -203769,7 +203837,7 @@ console.log(el, href, title);
|
|
|
203769
203837
|
if (!apply.mybatis || !apply.service || !apply.controller || !apply.javascript) ;
|
|
203770
203838
|
//await this.#createSource(userPrompt, apply);
|
|
203771
203839
|
//return await this.#modifySource(userPrompt, apply, progressMessageInstance);
|
|
203772
|
-
return await this.#
|
|
203840
|
+
return await this.#generateSource(userPrompt, apply, progressMessageInstance);
|
|
203773
203841
|
}
|
|
203774
203842
|
else if (what === "C2") {
|
|
203775
203843
|
if (!apply.mybatis || !apply.service || !apply.controller || !apply.javascript) ;
|
|
@@ -203781,7 +203849,8 @@ console.log(el, href, title);
|
|
|
203781
203849
|
const el = document.querySelector(".list-wrapper.active");
|
|
203782
203850
|
|
|
203783
203851
|
if (el) {
|
|
203784
|
-
return await this.#modifySource(userPrompt, apply, progressMessageInstance);
|
|
203852
|
+
//return await this.#modifySource(userPrompt, apply, progressMessageInstance);
|
|
203853
|
+
return await this.#generateSource(userPrompt, apply, progressMessageInstance);
|
|
203785
203854
|
}
|
|
203786
203855
|
else {
|
|
203787
203856
|
return await this.#modifyDetailSource(userPrompt, apply, progressMessageInstance);
|