@akanjs/cli 2.4.0-rc.9 → 2.4.1-rc.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/agent.command-h4afc69n.js +26 -0
- package/application.command-4ctkfdan.js +165 -0
- package/applicationBuildRunner-esa1kj7v.js +284 -0
- package/applicationReleasePackager-brvth6rs.js +245 -0
- package/capacitorApp-y0h6cgft.js +58 -0
- package/cloud.command-rpztn4fh.js +94 -0
- package/commandManifest.json +1 -0
- package/context.command-nqbtak4f.js +82 -0
- package/dependencyScanner-m4x5maek.js +9 -0
- package/guideline.command-ya0dh44f.js +356 -0
- package/incrementalBuilder.proc.js +89 -17394
- package/index-1xdrsbry.js +1447 -0
- package/index-45aj5ry0.js +990 -0
- package/index-5vvwc0cz.js +559 -0
- package/index-61keag0s.js +40 -0
- package/index-6pz1j0zj.js +62 -0
- package/index-73pr2cmy.js +534 -0
- package/index-76rn3g2c.js +76 -0
- package/index-85msc0wg.js +161 -0
- package/index-8pkbzj26.js +840 -0
- package/index-8rc0bm04.js +514 -0
- package/index-9sp6fsc5.js +1884 -0
- package/index-a6sbyy0b.js +2769 -0
- package/index-b0brjbp3.js +83 -0
- package/index-fgc8r6dj.js +33 -0
- package/index-h6ca6qg0.js +2777 -0
- package/index-hdqztm58.js +758 -0
- package/index-hwzpw9c1.js +202 -0
- package/index-pmm9e2jf.js +120 -0
- package/index-qaq13qk3.js +80 -0
- package/index-qhtr07v8.js +1072 -0
- package/index-r24hmh0q.js +4 -0
- package/index-ss469dec.js +11 -0
- package/index-swf4bmbg.js +25 -0
- package/index-w7fyqjrw.js +462 -0
- package/index-wnp7hwq7.js +193 -0
- package/index-wq8jwx8z.js +224 -0
- package/index-x53a5nya.js +301 -0
- package/index-xmc2w32q.js +4359 -0
- package/index-y3hdhy4p.js +229 -0
- package/index.js +54 -23340
- package/library.command-r15zdqvp.js +33 -0
- package/localRegistry.command-5tcahs3f.js +178 -0
- package/module.command-qrj3kmyz.js +54 -0
- package/package.command-r8sq5kzp.js +43 -0
- package/package.json +2 -2
- package/page.command-c6xdx0xm.js +24 -0
- package/primitive.command-pv9ssmtf.js +62 -0
- package/quality.command-es67wvdp.js +809 -0
- package/repair.command-677675vw.js +67 -0
- package/routeSourceValidator-wbhmbwpj.js +132 -0
- package/scalar.command-kabkd6wd.js +35 -0
- package/templates/app/page/_layout.tsx +19 -1
- package/templates/app/public/fonts/Pretendard-Black.woff2 +0 -0
- package/templates/app/public/fonts/Pretendard-Bold.woff2 +0 -0
- package/templates/app/public/fonts/Pretendard-ExtraBold.woff2 +0 -0
- package/templates/app/public/fonts/Pretendard-ExtraLight.woff2 +0 -0
- package/templates/app/public/fonts/Pretendard-Light.woff2 +0 -0
- package/templates/app/public/fonts/Pretendard-Medium.woff2 +0 -0
- package/templates/app/public/fonts/Pretendard-Regular.woff2 +0 -0
- package/templates/app/public/fonts/Pretendard-SemiBold.woff2 +0 -0
- package/templates/app/public/fonts/Pretendard-Thin.woff2 +0 -0
- package/templates/facetIndex/index.ts +1 -1
- package/typeChecker-kravn7ns.js +8 -0
- package/typecheck.proc.js +4 -194
- package/workflow.command-64r6cw0w.js +108 -0
- package/workspace.command-vrws0rgx.js +435 -0
- package/README.ko.md +0 -72
- package/README.md +0 -85
|
@@ -0,0 +1,229 @@
|
|
|
1
|
+
// @bun
|
|
2
|
+
import {
|
|
3
|
+
pluralizeName
|
|
4
|
+
} from "./index-ss469dec.js";
|
|
5
|
+
import {
|
|
6
|
+
Prompter
|
|
7
|
+
} from "./index-qaq13qk3.js";
|
|
8
|
+
import {
|
|
9
|
+
createPassedPrimitiveReport,
|
|
10
|
+
generatedFilesForSync,
|
|
11
|
+
scalarChangedFiles
|
|
12
|
+
} from "./index-h6ca6qg0.js";
|
|
13
|
+
import {
|
|
14
|
+
AiSession
|
|
15
|
+
} from "./index-5vvwc0cz.js";
|
|
16
|
+
import {
|
|
17
|
+
runner,
|
|
18
|
+
script
|
|
19
|
+
} from "./index-hdqztm58.js";
|
|
20
|
+
|
|
21
|
+
// pkgs/@akanjs/cli/scalar/scalar.prompt.ts
|
|
22
|
+
import { input } from "@inquirer/prompts";
|
|
23
|
+
class ScalarPrompt extends Prompter {
|
|
24
|
+
sys;
|
|
25
|
+
name;
|
|
26
|
+
constructor(sys, name) {
|
|
27
|
+
super();
|
|
28
|
+
this.sys = sys;
|
|
29
|
+
this.name = name;
|
|
30
|
+
}
|
|
31
|
+
async requestUpdateConstant() {
|
|
32
|
+
const request = await input({ message: `What do you want to change?` });
|
|
33
|
+
return { request, validate: undefined };
|
|
34
|
+
}
|
|
35
|
+
async requestCreateConstant() {
|
|
36
|
+
const constantFiles = await this.sys.getConstantFilesWithLibs();
|
|
37
|
+
const description = await input({ message: "description of scalar" });
|
|
38
|
+
const schemaDescription = await input({ message: "schema description of scalar" });
|
|
39
|
+
await this.sys.applyTemplate({
|
|
40
|
+
basePath: "./lib/__scalar",
|
|
41
|
+
template: "__scalar",
|
|
42
|
+
dict: { model: this.name, models: pluralizeName(this.name), sysName: this.sys.name }
|
|
43
|
+
});
|
|
44
|
+
const boilerplate = await this.sys.readFile(`lib/__scalar/${this.name}/${this.name}.constant.ts`);
|
|
45
|
+
return await this.#requestConstant({
|
|
46
|
+
modelDesc: description,
|
|
47
|
+
modelSchemaDesign: schemaDescription,
|
|
48
|
+
boilerplate,
|
|
49
|
+
constantFiles
|
|
50
|
+
});
|
|
51
|
+
}
|
|
52
|
+
async#requestConstant({
|
|
53
|
+
modelDesc,
|
|
54
|
+
modelSchemaDesign,
|
|
55
|
+
boilerplate,
|
|
56
|
+
constantFiles
|
|
57
|
+
}) {
|
|
58
|
+
const scanInfo = await this.sys.scan();
|
|
59
|
+
const guideJson = await Prompter.getGuideJson("scalarConstant");
|
|
60
|
+
const request = await this.makeTsFileUpdatePrompt({
|
|
61
|
+
context: `
|
|
62
|
+
1. Overview of __scalar/<model>/<model>.constant.ts file
|
|
63
|
+
${await this.getDocumentation("scalarConstant")}
|
|
64
|
+
|
|
65
|
+
2. How to write Enums in __scalar/<model>/<model>.constant.ts file
|
|
66
|
+
${await this.getDocumentation("enumConstant")}
|
|
67
|
+
|
|
68
|
+
3. How to write Fields in __scalar/<model>/<model>.constant.ts file
|
|
69
|
+
${await this.getDocumentation("fieldRule")}
|
|
70
|
+
|
|
71
|
+
4. List of constant.ts files in other libraries connected to current ${this.sys.name} ${this.sys.type === "app" ? "Application" : "Library"} ${scanInfo.getLibs().map((lib) => lib).join(", ")}
|
|
72
|
+
Please understand the content and file patterns below, and feel free to reuse any constants or enums if available.
|
|
73
|
+
${constantFiles.map((constant) => `
|
|
74
|
+
\`\`\`typescript
|
|
75
|
+
// File: ${constant.filePath}
|
|
76
|
+
${constant.content}
|
|
77
|
+
\`\`\`
|
|
78
|
+
`).join(`
|
|
79
|
+
`)}
|
|
80
|
+
`,
|
|
81
|
+
request: `
|
|
82
|
+
Based on the above content, please organize it according to the boilerplate below for easy parsing
|
|
83
|
+
|
|
84
|
+
Application name: ${this.sys.name} (${this.sys.type === "app" ? "Application" : "Library"})
|
|
85
|
+
Model name: ${this.name}
|
|
86
|
+
Model description: ${modelDesc}
|
|
87
|
+
Model schema design: ${modelSchemaDesign}
|
|
88
|
+
Model filename(You can create another connected scalar model file if needed): ${this.name}.constant.ts
|
|
89
|
+
\`\`\`typescript
|
|
90
|
+
// File: lib/__scalar/${this.name}/${this.name}.constant.ts
|
|
91
|
+
${boilerplate}
|
|
92
|
+
\`\`\`
|
|
93
|
+
|
|
94
|
+
If additional connected scalar models need to be written besides ${this.name}.constant.ts file, please write them in the following format
|
|
95
|
+
\`\`\`typescript
|
|
96
|
+
// File: lib/__scalar/otherModel/otherModel.constant.ts
|
|
97
|
+
...file content
|
|
98
|
+
\`\`\`
|
|
99
|
+
|
|
100
|
+
Please provide only the file results without any other content.`
|
|
101
|
+
});
|
|
102
|
+
return { request, validate: guideJson.update.rules };
|
|
103
|
+
}
|
|
104
|
+
async requestUpdateDictonaryWithInstruction() {
|
|
105
|
+
const constant = await this.sys.readFile(`lib/__scalar/${this.name}/${this.name}.constant.ts`);
|
|
106
|
+
const boilerplate = await this.sys.readFile(`lib/__scalar/${this.name}/${this.name}.dictionary.ts`);
|
|
107
|
+
const guideJson = await Prompter.getGuideJson("scalarDictionary");
|
|
108
|
+
const request = `\uB2E4\uC74C ${this.name}.dictionary.ts \uD30C\uC77C\uB3C4 \uC644\uC131\uB41C ${this.name}.constant.ts \uD30C\uC77C\uC744 \uAE30\uBC18\uC73C\uB85C \uC791\uC131\uD574\uC918.
|
|
109
|
+
1. Dictionary \uC791\uC131\uBC95
|
|
110
|
+
${await this.getDocumentation("scalarDictionary")}
|
|
111
|
+
|
|
112
|
+
Model constant file
|
|
113
|
+
\`\`\`typescript
|
|
114
|
+
// File: lib/__scalar/${this.name}/${this.name}.constant.ts
|
|
115
|
+
${constant}
|
|
116
|
+
\`\`\`
|
|
117
|
+
|
|
118
|
+
Model filename: ${this.name}.dictionary.ts
|
|
119
|
+
\`\`\`typescript
|
|
120
|
+
// File: lib/__scalar/${this.name}/${this.name}.dictionary.ts
|
|
121
|
+
${boilerplate}
|
|
122
|
+
\`\`\`
|
|
123
|
+
`;
|
|
124
|
+
return { request, validate: guideJson.update.rules };
|
|
125
|
+
}
|
|
126
|
+
async requestUpdateDictonaryWithFollowing() {
|
|
127
|
+
const [constant, boilerplate] = await Promise.all([
|
|
128
|
+
this.sys.readFile(`lib/__scalar/${this.name}/${this.name}.constant.ts`),
|
|
129
|
+
this.sys.readFile(`lib/__scalar/${this.name}/${this.name}.dictionary.ts`)
|
|
130
|
+
]);
|
|
131
|
+
const request = `\uB2E4\uC74C ${this.name}.dictionary.ts \uD30C\uC77C\uB3C4 \uC644\uC131\uB41C ${this.name}.constant.ts \uD30C\uC77C\uC744 \uAE30\uBC18\uC73C\uB85C \uC791\uC131\uD574\uC918.
|
|
132
|
+
Model constant file
|
|
133
|
+
\`\`\`typescript
|
|
134
|
+
// File: lib/__scalar/${this.name}/${this.name}.constant.ts
|
|
135
|
+
${constant}
|
|
136
|
+
\`\`\`
|
|
137
|
+
|
|
138
|
+
Model filename: ${this.name}.dictionary.ts
|
|
139
|
+
\`\`\`typescript
|
|
140
|
+
// File: lib/__scalar/${this.name}/${this.name}.dictionary.ts
|
|
141
|
+
${boilerplate}
|
|
142
|
+
\`\`\`
|
|
143
|
+
`;
|
|
144
|
+
return { request, validate: [] };
|
|
145
|
+
}
|
|
146
|
+
}
|
|
147
|
+
|
|
148
|
+
// pkgs/@akanjs/cli/scalar/scalar.runner.ts
|
|
149
|
+
class ScalarRunner extends runner("scalar") {
|
|
150
|
+
async applyScalarTemplate(sys, scalarName) {
|
|
151
|
+
await sys.applyTemplate({
|
|
152
|
+
basePath: "./lib/__scalar",
|
|
153
|
+
template: "__scalar",
|
|
154
|
+
dict: { model: scalarName, models: pluralizeName(scalarName), sysName: sys.name },
|
|
155
|
+
overwrite: false
|
|
156
|
+
});
|
|
157
|
+
return {
|
|
158
|
+
abstract: {
|
|
159
|
+
filename: `${scalarName}.abstract.md`,
|
|
160
|
+
content: await sys.readFile(`lib/__scalar/${scalarName}/${scalarName}.abstract.md`)
|
|
161
|
+
},
|
|
162
|
+
constant: {
|
|
163
|
+
filename: `${scalarName}.constant.ts`,
|
|
164
|
+
content: await sys.readFile(`lib/__scalar/${scalarName}/${scalarName}.constant.ts`)
|
|
165
|
+
},
|
|
166
|
+
dictionary: {
|
|
167
|
+
filename: `${scalarName}.dictionary.ts`,
|
|
168
|
+
content: await sys.readFile(`lib/__scalar/${scalarName}/${scalarName}.dictionary.ts`)
|
|
169
|
+
},
|
|
170
|
+
document: {
|
|
171
|
+
filename: `${scalarName}.document.ts`,
|
|
172
|
+
content: await sys.readFile(`lib/__scalar/${scalarName}/${scalarName}.document.ts`)
|
|
173
|
+
}
|
|
174
|
+
};
|
|
175
|
+
}
|
|
176
|
+
async createScalarConstant(sys, scalarName) {
|
|
177
|
+
const isContinued = await sys.exists(`lib/__scalar/${scalarName}/${scalarName}.constant.ts`);
|
|
178
|
+
const prompt = new ScalarPrompt(sys, scalarName);
|
|
179
|
+
const session = new AiSession("createScalar", { workspace: sys.workspace, cacheKey: scalarName, isContinued });
|
|
180
|
+
const { request, validate } = session.isCacheLoaded ? await prompt.requestUpdateConstant() : await prompt.requestCreateConstant();
|
|
181
|
+
const writes = await session.writeTypescripts(request, sys, { validate });
|
|
182
|
+
const scalarNames = writes.map(({ filePath }) => filePath.split("/").at(-2)).filter((name) => !!name);
|
|
183
|
+
if (!scalarNames.includes(scalarName))
|
|
184
|
+
scalarNames.unshift(scalarName);
|
|
185
|
+
for (const name of scalarNames)
|
|
186
|
+
await this.applyScalarTemplate(sys, name);
|
|
187
|
+
return { session, scalarNames, writes, prompt };
|
|
188
|
+
}
|
|
189
|
+
async updateScalarDictionaries(sys, scalarNames, { session }) {
|
|
190
|
+
const [firstScalarName, ...followingScalarNames] = scalarNames;
|
|
191
|
+
const prompt = new ScalarPrompt(sys, firstScalarName);
|
|
192
|
+
const { request, validate } = await prompt.requestUpdateDictonaryWithInstruction();
|
|
193
|
+
await session.writeTypescripts(request, sys, { validate });
|
|
194
|
+
for (const scalarName of followingScalarNames) {
|
|
195
|
+
const prompt2 = new ScalarPrompt(sys, scalarName);
|
|
196
|
+
const { request: request2, validate: validate2 } = await prompt2.requestUpdateDictonaryWithFollowing();
|
|
197
|
+
await session.writeTypescripts(request2, sys, { validate: validate2 });
|
|
198
|
+
}
|
|
199
|
+
}
|
|
200
|
+
}
|
|
201
|
+
|
|
202
|
+
// pkgs/@akanjs/cli/scalar/scalar.script.ts
|
|
203
|
+
class ScalarScript extends script("scalar", [ScalarRunner]) {
|
|
204
|
+
async createScalar(sys, scalarName) {
|
|
205
|
+
const files = await this.scalarRunner.applyScalarTemplate(sys, scalarName);
|
|
206
|
+
return createPassedPrimitiveReport({
|
|
207
|
+
command: "create-scalar",
|
|
208
|
+
changedFiles: scalarChangedFiles(sys, scalarName, files),
|
|
209
|
+
generatedFiles: generatedFilesForSync(sys),
|
|
210
|
+
target: sys.name
|
|
211
|
+
});
|
|
212
|
+
}
|
|
213
|
+
async createScalarWithAi(sys, scalarName) {
|
|
214
|
+
const { session, scalarNames } = await this.scalarRunner.createScalarConstant(sys, scalarName);
|
|
215
|
+
await this.scalarRunner.updateScalarDictionaries(sys, scalarNames, { session });
|
|
216
|
+
const fileMaps = await Promise.all(scalarNames.map(async (name) => ({ name, files: await this.scalarRunner.applyScalarTemplate(sys, name) })));
|
|
217
|
+
return createPassedPrimitiveReport({
|
|
218
|
+
command: "create-scalar",
|
|
219
|
+
changedFiles: fileMaps.flatMap(({ name, files }) => scalarChangedFiles(sys, name, files)),
|
|
220
|
+
generatedFiles: generatedFilesForSync(sys),
|
|
221
|
+
target: sys.name
|
|
222
|
+
});
|
|
223
|
+
}
|
|
224
|
+
async removeScalar(sys, scalarName) {
|
|
225
|
+
await sys.removeDir(`lib/__scalar/${scalarName}`);
|
|
226
|
+
}
|
|
227
|
+
}
|
|
228
|
+
|
|
229
|
+
export { ScalarScript };
|