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