@akanjs/devkit 1.0.20 → 2.1.0-rc.1
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/README.ko.md +65 -0
- package/README.md +62 -6
- package/aiEditor.ts +304 -0
- package/akanApp/akanApp.host.ts +393 -0
- package/akanApp/index.ts +1 -0
- package/akanConfig/akanConfig.test.ts +236 -0
- package/akanConfig/akanConfig.ts +384 -0
- package/akanConfig/index.ts +2 -0
- package/akanConfig/types.ts +23 -0
- package/applicationBuildReporter.ts +69 -0
- package/applicationBuildRunner.ts +302 -0
- package/applicationReleasePackager.ts +206 -0
- package/artifact/implicitRootLayout.ts +155 -0
- package/artifact/index.ts +1 -0
- package/artifact/routeSeedIndex.test.ts +98 -0
- package/artifact/routeSeedIndex.ts +130 -0
- package/auth.ts +41 -0
- package/builder.ts +164 -0
- package/capacitor.base.config.ts +88 -0
- package/capacitorApp.ts +440 -0
- package/commandDecorators/argMeta.ts +102 -0
- package/commandDecorators/command.ts +351 -0
- package/commandDecorators/commandBuilder.ts +224 -0
- package/commandDecorators/commandDecorators.test.ts +212 -0
- package/commandDecorators/commandMeta.ts +7 -0
- package/commandDecorators/dependencyBuilder.ts +100 -0
- package/{esm/src/commandDecorators/helpFormatter.js → commandDecorators/helpFormatter.ts} +100 -47
- package/{esm/src/commandDecorators/index.js → commandDecorators/index.ts} +4 -2
- package/commandDecorators/targetMeta.ts +31 -0
- package/commandDecorators/types.ts +10 -0
- package/constants.ts +25 -0
- package/createTunnel.ts +36 -0
- package/dependencyScanner.ts +357 -0
- package/devkitUtils.test.ts +259 -0
- package/executors.test.ts +315 -0
- package/executors.ts +1390 -0
- package/{esm/src/extractDeps.js → extractDeps.ts} +26 -20
- package/{esm/src/fileEditor.js → fileEditor.ts} +51 -32
- package/fileSys.ts +39 -0
- package/frontendBuild/allRoutesBuilder.ts +103 -0
- package/frontendBuild/buildRouteClient.test.ts +190 -0
- package/frontendBuild/clientBuildTypes.ts +114 -0
- package/frontendBuild/clientEntriesBundler.ts +303 -0
- package/frontendBuild/clientEntryDiscovery.ts +199 -0
- package/frontendBuild/csrArtifactBuilder.ts +237 -0
- package/frontendBuild/cssCompiler.ts +286 -0
- package/frontendBuild/cssImportResolver.ts +116 -0
- package/frontendBuild/fontOptimizer.ts +427 -0
- package/frontendBuild/frontendBuild.test.ts +204 -0
- package/frontendBuild/hmrChangeClassifier.ts +28 -0
- package/frontendBuild/hmrWatcher.ts +102 -0
- package/frontendBuild/index.ts +18 -0
- package/frontendBuild/pagesBundleBuilder.ts +137 -0
- package/frontendBuild/pagesEntrySourceGenerator.ts +37 -0
- package/frontendBuild/precompressArtifacts.ts +59 -0
- package/frontendBuild/routeClientBuilder.ts +290 -0
- package/frontendBuild/routesManifestArtifactSerializer.ts +62 -0
- package/frontendBuild/ssrBaseArtifactBuilder.ts +139 -0
- package/frontendBuild/vendorSpecifiers.ts +16 -0
- package/frontendBuild/watchRootResolver.ts +28 -0
- package/getCredentials.ts +19 -0
- package/getDirname.ts +3 -0
- package/getModelFileData.ts +59 -0
- package/getRelatedCnsts.ts +313 -0
- package/guideline.ts +19 -0
- package/incrementalBuilder/incrementalBuilder.host.test.ts +51 -0
- package/incrementalBuilder/incrementalBuilder.host.ts +152 -0
- package/incrementalBuilder/incrementalBuilder.proc.ts +331 -0
- package/incrementalBuilder/index.ts +1 -0
- package/{esm/src/index.js → index.ts} +28 -15
- package/lint/no-deep-internal-import.grit +25 -0
- package/lint/no-import-client-functions.grit +32 -0
- package/lint/no-import-external-library.grit +21 -0
- package/lint/no-js-private-class-method.grit +42 -0
- package/lint/no-use-client-in-server.grit +7 -0
- package/lint/non-scalar-props-restricted.grit +13 -0
- package/linter.ts +271 -0
- package/mobile/index.ts +1 -0
- package/mobile/mobileTarget.test.ts +53 -0
- package/mobile/mobileTarget.ts +88 -0
- package/package.json +48 -31
- package/prompter.ts +72 -0
- package/scanInfo.ts +606 -0
- package/selectModel.ts +11 -0
- package/{esm/src/spinner.js → spinner.ts} +22 -28
- package/{esm/src/capacitorApp.js → src/capacitorApp.ts} +82 -81
- package/sshTunnel.ts +152 -0
- package/{esm/src/streamAi.js → streamAi.ts} +18 -12
- package/transforms/barrelAnalyzer.ts +278 -0
- package/transforms/barrelImportsPlugin.ts +504 -0
- package/transforms/externalizeFrameworkPlugin.ts +185 -0
- package/transforms/index.ts +5 -0
- package/transforms/rscUseClientTransform.ts +59 -0
- package/transforms/transforms.test.ts +208 -0
- package/transforms/useClientBundlePlugin.ts +47 -0
- package/tsconfig.json +37 -0
- package/typeChecker.ts +264 -0
- package/types.ts +44 -0
- package/ui/MultiScrollList.tsx +242 -0
- package/ui/ScrollList.tsx +107 -0
- package/ui/index.ts +2 -0
- package/{esm/src/uploadRelease.js → uploadRelease.ts} +50 -34
- package/{esm/src/useStdoutDimensions.js → useStdoutDimensions.ts} +5 -5
- package/cjs/index.js +0 -21
- package/cjs/src/aiEditor.js +0 -311
- package/cjs/src/auth.js +0 -72
- package/cjs/src/builder.js +0 -114
- package/cjs/src/capacitorApp.js +0 -313
- package/cjs/src/commandDecorators/argMeta.js +0 -88
- package/cjs/src/commandDecorators/command.js +0 -324
- package/cjs/src/commandDecorators/commandMeta.js +0 -30
- package/cjs/src/commandDecorators/helpFormatter.js +0 -211
- package/cjs/src/commandDecorators/index.js +0 -31
- package/cjs/src/commandDecorators/targetMeta.js +0 -57
- package/cjs/src/commandDecorators/types.js +0 -15
- package/cjs/src/constants.js +0 -46
- package/cjs/src/createTunnel.js +0 -49
- package/cjs/src/dependencyScanner.js +0 -220
- package/cjs/src/executors.js +0 -964
- package/cjs/src/extractDeps.js +0 -103
- package/cjs/src/fileEditor.js +0 -120
- package/cjs/src/getCredentials.js +0 -44
- package/cjs/src/getDirname.js +0 -38
- package/cjs/src/getModelFileData.js +0 -66
- package/cjs/src/getRelatedCnsts.js +0 -260
- package/cjs/src/guideline.js +0 -15
- package/cjs/src/index.js +0 -65
- package/cjs/src/linter.js +0 -238
- package/cjs/src/prompter.js +0 -85
- package/cjs/src/scanInfo.js +0 -491
- package/cjs/src/selectModel.js +0 -46
- package/cjs/src/spinner.js +0 -93
- package/cjs/src/streamAi.js +0 -62
- package/cjs/src/typeChecker.js +0 -207
- package/cjs/src/types.js +0 -15
- package/cjs/src/uploadRelease.js +0 -112
- package/cjs/src/useStdoutDimensions.js +0 -43
- package/esm/index.js +0 -1
- package/esm/src/aiEditor.js +0 -282
- package/esm/src/auth.js +0 -42
- package/esm/src/builder.js +0 -81
- package/esm/src/commandDecorators/argMeta.js +0 -54
- package/esm/src/commandDecorators/command.js +0 -290
- package/esm/src/commandDecorators/commandMeta.js +0 -7
- package/esm/src/commandDecorators/targetMeta.js +0 -33
- package/esm/src/commandDecorators/types.js +0 -0
- package/esm/src/constants.js +0 -17
- package/esm/src/createTunnel.js +0 -26
- package/esm/src/dependencyScanner.js +0 -187
- package/esm/src/executors.js +0 -928
- package/esm/src/getCredentials.js +0 -11
- package/esm/src/getDirname.js +0 -5
- package/esm/src/getModelFileData.js +0 -33
- package/esm/src/getRelatedCnsts.js +0 -221
- package/esm/src/guideline.js +0 -0
- package/esm/src/linter.js +0 -205
- package/esm/src/prompter.js +0 -51
- package/esm/src/scanInfo.js +0 -455
- package/esm/src/selectModel.js +0 -13
- package/esm/src/typeChecker.js +0 -174
- package/esm/src/types.js +0 -0
- package/index.d.ts +0 -1
- package/src/aiEditor.d.ts +0 -50
- package/src/auth.d.ts +0 -9
- package/src/builder.d.ts +0 -18
- package/src/capacitorApp.d.ts +0 -39
- package/src/commandDecorators/argMeta.d.ts +0 -67
- package/src/commandDecorators/command.d.ts +0 -2
- package/src/commandDecorators/commandMeta.d.ts +0 -2
- package/src/commandDecorators/helpFormatter.d.ts +0 -3
- package/src/commandDecorators/index.d.ts +0 -6
- package/src/commandDecorators/targetMeta.d.ts +0 -19
- package/src/commandDecorators/types.d.ts +0 -1
- package/src/constants.d.ts +0 -26
- package/src/createTunnel.d.ts +0 -8
- package/src/dependencyScanner.d.ts +0 -23
- package/src/executors.d.ts +0 -296
- package/src/extractDeps.d.ts +0 -7
- package/src/fileEditor.d.ts +0 -16
- package/src/getCredentials.d.ts +0 -12
- package/src/getDirname.d.ts +0 -1
- package/src/getModelFileData.d.ts +0 -16
- package/src/getRelatedCnsts.d.ts +0 -53
- package/src/guideline.d.ts +0 -19
- package/src/index.d.ts +0 -23
- package/src/linter.d.ts +0 -109
- package/src/prompter.d.ts +0 -14
- package/src/scanInfo.d.ts +0 -82
- package/src/selectModel.d.ts +0 -1
- package/src/spinner.d.ts +0 -20
- package/src/streamAi.d.ts +0 -6
- package/src/typeChecker.d.ts +0 -52
- package/src/types.d.ts +0 -31
- package/src/uploadRelease.d.ts +0 -10
- package/src/useStdoutDimensions.d.ts +0 -1
package/esm/src/scanInfo.js
DELETED
|
@@ -1,455 +0,0 @@
|
|
|
1
|
-
import path from "path";
|
|
2
|
-
import { TypeScriptDependencyScanner } from "./dependencyScanner";
|
|
3
|
-
import { AppExecutor, LibExecutor, PkgExecutor } from "./executors";
|
|
4
|
-
const scalarFileTypes = ["constant", "dictionary", "document", "template", "unit", "util", "view", "zone"];
|
|
5
|
-
const serviceFileTypes = [
|
|
6
|
-
"dictionary",
|
|
7
|
-
"service",
|
|
8
|
-
"signal",
|
|
9
|
-
"store",
|
|
10
|
-
"template",
|
|
11
|
-
"unit",
|
|
12
|
-
"util",
|
|
13
|
-
"view",
|
|
14
|
-
"zone"
|
|
15
|
-
];
|
|
16
|
-
const databaseFileTypes = [
|
|
17
|
-
"constant",
|
|
18
|
-
"dictionary",
|
|
19
|
-
"document",
|
|
20
|
-
"service",
|
|
21
|
-
"signal",
|
|
22
|
-
"store",
|
|
23
|
-
"template",
|
|
24
|
-
"unit",
|
|
25
|
-
"util",
|
|
26
|
-
"view",
|
|
27
|
-
"zone"
|
|
28
|
-
];
|
|
29
|
-
class ScanInfo {
|
|
30
|
-
scanResult;
|
|
31
|
-
name;
|
|
32
|
-
scalar = /* @__PURE__ */ new Map();
|
|
33
|
-
service = /* @__PURE__ */ new Map();
|
|
34
|
-
database = /* @__PURE__ */ new Map();
|
|
35
|
-
file = Object.fromEntries(
|
|
36
|
-
databaseFileTypes.map((type) => [
|
|
37
|
-
type,
|
|
38
|
-
{ all: /* @__PURE__ */ new Set(), databases: /* @__PURE__ */ new Set(), services: /* @__PURE__ */ new Set(), scalars: /* @__PURE__ */ new Set() }
|
|
39
|
-
])
|
|
40
|
-
);
|
|
41
|
-
static async getScanResult(exec) {
|
|
42
|
-
const akanConfig = await exec.getConfig();
|
|
43
|
-
const tsconfig = exec.getTsConfig();
|
|
44
|
-
const rootPackageJson = exec.workspace.getPackageJson();
|
|
45
|
-
const gitignorePatterns = exec.workspace.getGitignorePatterns();
|
|
46
|
-
const scanner = new TypeScriptDependencyScanner(exec.cwdPath, {
|
|
47
|
-
workspaceRoot: exec.workspace.cwdPath,
|
|
48
|
-
tsconfig,
|
|
49
|
-
rootPackageJson,
|
|
50
|
-
gitignorePatterns
|
|
51
|
-
});
|
|
52
|
-
const { pkgDeps, libDeps, npmDeps } = await scanner.getMonorepoDependencies(exec.name);
|
|
53
|
-
const files = {
|
|
54
|
-
constant: { databases: [], scalars: [] },
|
|
55
|
-
dictionary: { databases: [], services: [], scalars: [] },
|
|
56
|
-
document: { databases: [], scalars: [] },
|
|
57
|
-
service: { databases: [], services: [] },
|
|
58
|
-
signal: { databases: [], services: [] },
|
|
59
|
-
store: { databases: [], services: [] },
|
|
60
|
-
template: { databases: [], services: [], scalars: [] },
|
|
61
|
-
unit: { databases: [], services: [], scalars: [] },
|
|
62
|
-
util: { databases: [], services: [], scalars: [] },
|
|
63
|
-
view: { databases: [], services: [], scalars: [] },
|
|
64
|
-
zone: { databases: [], services: [], scalars: [] }
|
|
65
|
-
};
|
|
66
|
-
const [{ dirs: dirnames }, scalarDirs] = await Promise.all([
|
|
67
|
-
exec.getFilesAndDirs("lib"),
|
|
68
|
-
exec.readdir("lib/__scalar")
|
|
69
|
-
]);
|
|
70
|
-
const databaseDirs = [];
|
|
71
|
-
const serviceDirs = [];
|
|
72
|
-
dirnames.forEach((name) => {
|
|
73
|
-
if (name.startsWith("_")) {
|
|
74
|
-
if (name.startsWith("__"))
|
|
75
|
-
return;
|
|
76
|
-
else
|
|
77
|
-
serviceDirs.push(name);
|
|
78
|
-
} else
|
|
79
|
-
databaseDirs.push(name);
|
|
80
|
-
});
|
|
81
|
-
await Promise.all([
|
|
82
|
-
...databaseDirs.map(async (name) => {
|
|
83
|
-
const filenames = await exec.readdir(path.join("lib", name));
|
|
84
|
-
filenames.forEach((filename) => {
|
|
85
|
-
if (filename.endsWith(".constant.ts"))
|
|
86
|
-
files.constant.databases.push(name);
|
|
87
|
-
else if (filename.endsWith(".dictionary.ts"))
|
|
88
|
-
files.dictionary.databases.push(name);
|
|
89
|
-
else if (filename.endsWith(".document.ts"))
|
|
90
|
-
files.document.databases.push(name);
|
|
91
|
-
else if (filename.endsWith(".service.ts"))
|
|
92
|
-
files.service.databases.push(name);
|
|
93
|
-
else if (filename.endsWith(".signal.ts"))
|
|
94
|
-
files.signal.databases.push(name);
|
|
95
|
-
else if (filename.endsWith(".store.ts"))
|
|
96
|
-
files.store.databases.push(name);
|
|
97
|
-
else if (filename.endsWith(".Template.tsx"))
|
|
98
|
-
files.template.databases.push(name);
|
|
99
|
-
else if (filename.endsWith(".Unit.tsx"))
|
|
100
|
-
files.unit.databases.push(name);
|
|
101
|
-
else if (filename.endsWith(".Util.tsx"))
|
|
102
|
-
files.util.databases.push(name);
|
|
103
|
-
else if (filename.endsWith(".View.tsx"))
|
|
104
|
-
files.view.databases.push(name);
|
|
105
|
-
else if (filename.endsWith(".Zone.tsx"))
|
|
106
|
-
files.zone.databases.push(name);
|
|
107
|
-
});
|
|
108
|
-
}),
|
|
109
|
-
...serviceDirs.map(async (dirname) => {
|
|
110
|
-
const name = dirname.slice(1);
|
|
111
|
-
const filenames = await exec.readdir(path.join("lib", dirname));
|
|
112
|
-
filenames.forEach((filename) => {
|
|
113
|
-
if (filename.endsWith(".dictionary.ts"))
|
|
114
|
-
files.dictionary.services.push(name);
|
|
115
|
-
else if (filename.endsWith(".service.ts"))
|
|
116
|
-
files.service.services.push(name);
|
|
117
|
-
else if (filename.endsWith(".signal.ts"))
|
|
118
|
-
files.signal.services.push(name);
|
|
119
|
-
else if (filename.endsWith(".store.ts"))
|
|
120
|
-
files.store.services.push(name);
|
|
121
|
-
else if (filename.endsWith(".Template.tsx"))
|
|
122
|
-
files.template.services.push(name);
|
|
123
|
-
else if (filename.endsWith(".Unit.tsx"))
|
|
124
|
-
files.unit.services.push(name);
|
|
125
|
-
else if (filename.endsWith(".Util.tsx"))
|
|
126
|
-
files.util.services.push(name);
|
|
127
|
-
else if (filename.endsWith(".View.tsx"))
|
|
128
|
-
files.view.services.push(name);
|
|
129
|
-
else if (filename.endsWith(".Zone.tsx"))
|
|
130
|
-
files.zone.services.push(name);
|
|
131
|
-
});
|
|
132
|
-
}),
|
|
133
|
-
...scalarDirs.map(async (name) => {
|
|
134
|
-
const filenames = await exec.readdir(path.join("lib/__scalar", name));
|
|
135
|
-
filenames.forEach((filename) => {
|
|
136
|
-
if (filename.endsWith(".constant.ts"))
|
|
137
|
-
files.constant.scalars.push(name);
|
|
138
|
-
else if (filename.endsWith(".dictionary.ts"))
|
|
139
|
-
files.dictionary.scalars.push(name);
|
|
140
|
-
else if (filename.endsWith(".document.ts"))
|
|
141
|
-
files.document.scalars.push(name);
|
|
142
|
-
else if (filename.endsWith(".Template.tsx"))
|
|
143
|
-
files.template.scalars.push(name);
|
|
144
|
-
else if (filename.endsWith(".Unit.tsx"))
|
|
145
|
-
files.unit.scalars.push(name);
|
|
146
|
-
else if (filename.endsWith(".Util.tsx"))
|
|
147
|
-
files.util.scalars.push(name);
|
|
148
|
-
else if (filename.endsWith(".View.tsx"))
|
|
149
|
-
files.view.scalars.push(name);
|
|
150
|
-
else if (filename.endsWith(".Zone.tsx"))
|
|
151
|
-
files.zone.scalars.push(name);
|
|
152
|
-
});
|
|
153
|
-
})
|
|
154
|
-
]);
|
|
155
|
-
const scanResult = {
|
|
156
|
-
name: exec.name,
|
|
157
|
-
type: exec.type,
|
|
158
|
-
repoName: exec.workspace.repoName,
|
|
159
|
-
serveDomain: exec.workspace.getBaseDevEnv().serveDomain,
|
|
160
|
-
akanConfig,
|
|
161
|
-
files,
|
|
162
|
-
libDeps,
|
|
163
|
-
pkgDeps,
|
|
164
|
-
dependencies: npmDeps.filter((dep) => !dep.startsWith("@akanjs"))
|
|
165
|
-
};
|
|
166
|
-
return scanResult;
|
|
167
|
-
}
|
|
168
|
-
constructor(scanResult) {
|
|
169
|
-
this.name = scanResult.name;
|
|
170
|
-
this.scanResult = scanResult;
|
|
171
|
-
Object.entries(scanResult.files).forEach(([_key, value]) => {
|
|
172
|
-
const key = _key;
|
|
173
|
-
const { databases, services, scalars } = value;
|
|
174
|
-
databases.forEach((modelName) => {
|
|
175
|
-
const model = this.database.get(modelName) ?? /* @__PURE__ */ new Set();
|
|
176
|
-
model.add(key);
|
|
177
|
-
this.database.set(modelName, model);
|
|
178
|
-
this.file[key].all.add(modelName);
|
|
179
|
-
this.file[key].databases.add(modelName);
|
|
180
|
-
});
|
|
181
|
-
services?.forEach((serviceName) => {
|
|
182
|
-
const service = this.service.get(serviceName) ?? /* @__PURE__ */ new Set();
|
|
183
|
-
service.add(key);
|
|
184
|
-
this.service.set(serviceName, service);
|
|
185
|
-
this.file[key].all.add(serviceName);
|
|
186
|
-
this.file[key].services.add(serviceName);
|
|
187
|
-
});
|
|
188
|
-
scalars?.forEach((scalarName) => {
|
|
189
|
-
const scalar = this.scalar.get(scalarName) ?? /* @__PURE__ */ new Set();
|
|
190
|
-
scalar.add(key);
|
|
191
|
-
this.scalar.set(scalarName, scalar);
|
|
192
|
-
this.file[key].all.add(scalarName);
|
|
193
|
-
this.file[key].scalars.add(scalarName);
|
|
194
|
-
});
|
|
195
|
-
});
|
|
196
|
-
}
|
|
197
|
-
getScanResult() {
|
|
198
|
-
return this.scanResult;
|
|
199
|
-
}
|
|
200
|
-
getDatabaseModules() {
|
|
201
|
-
return [...this.database.keys()];
|
|
202
|
-
}
|
|
203
|
-
getServiceModules() {
|
|
204
|
-
return [...this.service.keys()];
|
|
205
|
-
}
|
|
206
|
-
getScalarModules() {
|
|
207
|
-
return [...this.scalar.keys()];
|
|
208
|
-
}
|
|
209
|
-
}
|
|
210
|
-
class AppInfo extends ScanInfo {
|
|
211
|
-
type = "app";
|
|
212
|
-
exec;
|
|
213
|
-
akanConfig;
|
|
214
|
-
libDeps;
|
|
215
|
-
static appInfos = /* @__PURE__ */ new Map();
|
|
216
|
-
static async fromExecutor(exec, options = {}) {
|
|
217
|
-
const existingAppInfo = this.appInfos.get(exec.name);
|
|
218
|
-
if (existingAppInfo && !options.refresh)
|
|
219
|
-
return existingAppInfo;
|
|
220
|
-
const scanResult = await super.getScanResult(exec);
|
|
221
|
-
await Promise.all(
|
|
222
|
-
scanResult.libDeps.map(async (libName) => {
|
|
223
|
-
LibInfo.loadedLibs.add(libName);
|
|
224
|
-
const libExecutor = LibExecutor.from(exec, libName);
|
|
225
|
-
LibInfo.libInfos.set(libName, await LibInfo.fromExecutor(libExecutor));
|
|
226
|
-
})
|
|
227
|
-
);
|
|
228
|
-
const libDeps = await this.#getAllLibDeps(exec, scanResult.libDeps);
|
|
229
|
-
const appInfo = new AppInfo(exec, scanResult, libDeps);
|
|
230
|
-
this.appInfos.set(exec.name, appInfo);
|
|
231
|
-
return appInfo;
|
|
232
|
-
}
|
|
233
|
-
constructor(exec, scanResult, libDeps) {
|
|
234
|
-
super(scanResult);
|
|
235
|
-
this.exec = exec;
|
|
236
|
-
this.akanConfig = scanResult.akanConfig;
|
|
237
|
-
this.libDeps = libDeps;
|
|
238
|
-
}
|
|
239
|
-
getScanResult() {
|
|
240
|
-
return this.scanResult;
|
|
241
|
-
}
|
|
242
|
-
static async #getAllLibDeps(exec, libDeps, libSet = /* @__PURE__ */ new Set()) {
|
|
243
|
-
await Promise.all(
|
|
244
|
-
libDeps.map(async (libName) => {
|
|
245
|
-
if (libSet.has(libName))
|
|
246
|
-
return;
|
|
247
|
-
libSet.add(libName);
|
|
248
|
-
const libExecutor = LibExecutor.from(exec, libName);
|
|
249
|
-
const libInfo = await LibInfo.fromExecutor(libExecutor);
|
|
250
|
-
const libScanResult = libInfo.getScanResult();
|
|
251
|
-
if (libScanResult.libDeps.length > 0)
|
|
252
|
-
await this.#getAllLibDeps(exec, libScanResult.libDeps, libSet);
|
|
253
|
-
})
|
|
254
|
-
);
|
|
255
|
-
return [...libSet];
|
|
256
|
-
}
|
|
257
|
-
#sortedLibs = null;
|
|
258
|
-
#getSortedLibs() {
|
|
259
|
-
if (this.#sortedLibs)
|
|
260
|
-
return this.#sortedLibs;
|
|
261
|
-
const libIndices = LibInfo.getSortedLibIndices();
|
|
262
|
-
this.#sortedLibs = this.libDeps.sort((libNameA, libNameB) => {
|
|
263
|
-
const indexA = libIndices.get(libNameA);
|
|
264
|
-
const indexB = libIndices.get(libNameB);
|
|
265
|
-
if (indexA === void 0 || indexB === void 0)
|
|
266
|
-
throw new Error(`LibInfo not found: ${libNameA} or ${libNameB}`);
|
|
267
|
-
return indexA - indexB;
|
|
268
|
-
});
|
|
269
|
-
return this.#sortedLibs;
|
|
270
|
-
}
|
|
271
|
-
getLibs() {
|
|
272
|
-
return this.#getSortedLibs();
|
|
273
|
-
}
|
|
274
|
-
getLibInfos() {
|
|
275
|
-
return new Map(
|
|
276
|
-
this.#getSortedLibs().map((libName) => {
|
|
277
|
-
const libInfo = LibInfo.libInfos.get(libName);
|
|
278
|
-
if (!libInfo)
|
|
279
|
-
throw new Error(`LibInfo not found: ${libName}`);
|
|
280
|
-
return [libName, libInfo];
|
|
281
|
-
})
|
|
282
|
-
);
|
|
283
|
-
}
|
|
284
|
-
}
|
|
285
|
-
class LibInfo extends ScanInfo {
|
|
286
|
-
type = "lib";
|
|
287
|
-
exec;
|
|
288
|
-
akanConfig;
|
|
289
|
-
static loadedLibs = /* @__PURE__ */ new Set();
|
|
290
|
-
static libInfos = /* @__PURE__ */ new Map();
|
|
291
|
-
static #sortedLibIndices = null;
|
|
292
|
-
static getSortedLibIndices() {
|
|
293
|
-
if (this.#sortedLibIndices)
|
|
294
|
-
return this.#sortedLibIndices;
|
|
295
|
-
this.#sortedLibIndices = new Map(
|
|
296
|
-
[...this.libInfos.entries()].sort(([_, libInfoA], [__, libInfoB]) => libInfoA.getScanResult().libDeps.includes(libInfoB.name) ? 1 : -1).map(([libName], index) => [libName, index])
|
|
297
|
-
);
|
|
298
|
-
return this.#sortedLibIndices;
|
|
299
|
-
}
|
|
300
|
-
static async fromExecutor(exec, { refresh } = {}) {
|
|
301
|
-
const existingLibInfo = this.libInfos.get(exec.name);
|
|
302
|
-
if (existingLibInfo && !refresh)
|
|
303
|
-
return existingLibInfo;
|
|
304
|
-
const scanResult = await super.getScanResult(exec);
|
|
305
|
-
await Promise.all(
|
|
306
|
-
scanResult.libDeps.filter((libName) => !this.loadedLibs.has(libName)).map(async (libName) => {
|
|
307
|
-
this.loadedLibs.add(libName);
|
|
308
|
-
const libExecutor = LibExecutor.from(exec, libName);
|
|
309
|
-
this.libInfos.set(libName, await LibInfo.fromExecutor(libExecutor));
|
|
310
|
-
})
|
|
311
|
-
);
|
|
312
|
-
const libInfo = new LibInfo(exec, scanResult);
|
|
313
|
-
this.libInfos.set(exec.name, libInfo);
|
|
314
|
-
this.#sortedLibIndices = null;
|
|
315
|
-
return libInfo;
|
|
316
|
-
}
|
|
317
|
-
constructor(exec, scanResult) {
|
|
318
|
-
super(scanResult);
|
|
319
|
-
this.exec = exec;
|
|
320
|
-
this.akanConfig = scanResult.akanConfig;
|
|
321
|
-
}
|
|
322
|
-
getScanResult() {
|
|
323
|
-
return this.scanResult;
|
|
324
|
-
}
|
|
325
|
-
#sortedLibs = null;
|
|
326
|
-
#getSortedLibs() {
|
|
327
|
-
if (this.#sortedLibs)
|
|
328
|
-
return this.#sortedLibs;
|
|
329
|
-
const libs = LibInfo.getSortedLibIndices();
|
|
330
|
-
this.#sortedLibs = this.scanResult.libDeps.sort((libNameA, libNameB) => {
|
|
331
|
-
const indexA = libs.get(libNameA);
|
|
332
|
-
const indexB = libs.get(libNameB);
|
|
333
|
-
if (indexA === void 0 || indexB === void 0)
|
|
334
|
-
throw new Error(`LibInfo not found: ${libNameA} or ${libNameB}`);
|
|
335
|
-
return indexA - indexB;
|
|
336
|
-
});
|
|
337
|
-
return this.#sortedLibs;
|
|
338
|
-
}
|
|
339
|
-
getLibs() {
|
|
340
|
-
return this.#getSortedLibs();
|
|
341
|
-
}
|
|
342
|
-
getLibInfo(libName) {
|
|
343
|
-
if (!this.getScanResult().libDeps.includes(libName))
|
|
344
|
-
return void 0;
|
|
345
|
-
const libSet = new Set(this.#getSortedLibs());
|
|
346
|
-
if (!libSet.has(libName))
|
|
347
|
-
throw new Error(`LibInfo is invalid: ${libName}`);
|
|
348
|
-
return LibInfo.libInfos.get(libName);
|
|
349
|
-
}
|
|
350
|
-
getLibInfos() {
|
|
351
|
-
return new Map(
|
|
352
|
-
this.#getSortedLibs().map((libName) => {
|
|
353
|
-
const libInfo = LibInfo.libInfos.get(libName);
|
|
354
|
-
if (!libInfo)
|
|
355
|
-
throw new Error(`LibInfo not found: ${libName}`);
|
|
356
|
-
return [libName, libInfo];
|
|
357
|
-
})
|
|
358
|
-
);
|
|
359
|
-
}
|
|
360
|
-
}
|
|
361
|
-
class PkgInfo {
|
|
362
|
-
exec;
|
|
363
|
-
name;
|
|
364
|
-
scanResult;
|
|
365
|
-
static async getScanResult(exec) {
|
|
366
|
-
const tsconfig = exec.getTsConfig();
|
|
367
|
-
const rootPackageJson = exec.workspace.getPackageJson();
|
|
368
|
-
const gitignorePatterns = exec.workspace.getGitignorePatterns();
|
|
369
|
-
const scanner = new TypeScriptDependencyScanner(exec.cwdPath, {
|
|
370
|
-
workspaceRoot: exec.workspace.cwdPath,
|
|
371
|
-
tsconfig,
|
|
372
|
-
rootPackageJson,
|
|
373
|
-
gitignorePatterns
|
|
374
|
-
});
|
|
375
|
-
const npmSet = new Set(Object.keys({ ...rootPackageJson.dependencies, ...rootPackageJson.devDependencies }));
|
|
376
|
-
const pkgPathSet = new Set(
|
|
377
|
-
Object.keys(tsconfig.compilerOptions.paths ?? {}).filter((path2) => tsconfig.compilerOptions.paths?.[path2]?.some((resolve) => resolve.startsWith("pkgs/"))).map((path2) => path2.replace("/*", ""))
|
|
378
|
-
);
|
|
379
|
-
const [npmDepSet, pkgPathDepSet] = await scanner.getImportSets([npmSet, pkgPathSet]);
|
|
380
|
-
const pkgDeps = [...pkgPathDepSet].map((path2) => {
|
|
381
|
-
const pathSplitLength = path2.split("/").length;
|
|
382
|
-
return (tsconfig.compilerOptions.paths?.[path2]?.[0] ?? "*").split("/").slice(1, 1 + pathSplitLength).join("/");
|
|
383
|
-
}).filter((pkg) => pkg !== this.name);
|
|
384
|
-
const pkgScanResult = {
|
|
385
|
-
name: this.name,
|
|
386
|
-
pkgDeps,
|
|
387
|
-
dependencies: [...npmDepSet]
|
|
388
|
-
};
|
|
389
|
-
return pkgScanResult;
|
|
390
|
-
}
|
|
391
|
-
static #pkgInfos = /* @__PURE__ */ new Map();
|
|
392
|
-
static async fromExecutor(exec, options = {}) {
|
|
393
|
-
const existingPkgInfo = this.#pkgInfos.get(exec.name);
|
|
394
|
-
if (existingPkgInfo && !options.refresh)
|
|
395
|
-
return existingPkgInfo;
|
|
396
|
-
const scanResult = await this.getScanResult(exec);
|
|
397
|
-
const pkgInfo = new PkgInfo(exec, scanResult);
|
|
398
|
-
this.#pkgInfos.set(exec.name, pkgInfo);
|
|
399
|
-
return pkgInfo;
|
|
400
|
-
}
|
|
401
|
-
constructor(exec, scanResult) {
|
|
402
|
-
this.exec = exec;
|
|
403
|
-
this.name = exec.name;
|
|
404
|
-
this.scanResult = scanResult;
|
|
405
|
-
}
|
|
406
|
-
getScanResult() {
|
|
407
|
-
return this.scanResult;
|
|
408
|
-
}
|
|
409
|
-
}
|
|
410
|
-
class WorkspaceInfo {
|
|
411
|
-
constructor(appInfos = /* @__PURE__ */ new Map(), libInfos = /* @__PURE__ */ new Map(), pkgInfos = /* @__PURE__ */ new Map()) {
|
|
412
|
-
this.appInfos = appInfos;
|
|
413
|
-
this.libInfos = libInfos;
|
|
414
|
-
this.pkgInfos = pkgInfos;
|
|
415
|
-
}
|
|
416
|
-
static #workspaceInfos = /* @__PURE__ */ new Map();
|
|
417
|
-
static async fromExecutor(exec, options = {}) {
|
|
418
|
-
const existingWorkspaceInfo = this.#workspaceInfos.get(exec.name);
|
|
419
|
-
if (existingWorkspaceInfo && !options.refresh)
|
|
420
|
-
return existingWorkspaceInfo;
|
|
421
|
-
const [appNames, libNames, pkgNames] = await Promise.all([exec.getApps(), exec.getLibs(), exec.getPkgs()]);
|
|
422
|
-
const [appInfos, libInfos, pkgInfos] = await Promise.all([
|
|
423
|
-
Promise.all(
|
|
424
|
-
appNames.map(async (appName) => {
|
|
425
|
-
const app = AppExecutor.from(exec, appName);
|
|
426
|
-
return await app.scan();
|
|
427
|
-
})
|
|
428
|
-
),
|
|
429
|
-
Promise.all(
|
|
430
|
-
libNames.map(async (libName) => {
|
|
431
|
-
const lib = LibExecutor.from(exec, libName);
|
|
432
|
-
return await lib.scan();
|
|
433
|
-
})
|
|
434
|
-
),
|
|
435
|
-
Promise.all(
|
|
436
|
-
pkgNames.map(async (pkgName) => {
|
|
437
|
-
return await PkgExecutor.from(exec, pkgName).scan();
|
|
438
|
-
})
|
|
439
|
-
)
|
|
440
|
-
]);
|
|
441
|
-
const workspaceInfo = new WorkspaceInfo(
|
|
442
|
-
new Map(appInfos.map((app) => [app.exec.name, app])),
|
|
443
|
-
new Map(libInfos.map((lib) => [lib.exec.name, lib])),
|
|
444
|
-
new Map(pkgInfos.map((pkg) => [pkg.exec.name, pkg]))
|
|
445
|
-
);
|
|
446
|
-
this.#workspaceInfos.set(exec.name, workspaceInfo);
|
|
447
|
-
return workspaceInfo;
|
|
448
|
-
}
|
|
449
|
-
}
|
|
450
|
-
export {
|
|
451
|
-
AppInfo,
|
|
452
|
-
LibInfo,
|
|
453
|
-
PkgInfo,
|
|
454
|
-
WorkspaceInfo
|
|
455
|
-
};
|
package/esm/src/selectModel.js
DELETED
|
@@ -1,13 +0,0 @@
|
|
|
1
|
-
import { select } from "@inquirer/prompts";
|
|
2
|
-
import fs from "fs";
|
|
3
|
-
const selectModel = async (modulePath) => {
|
|
4
|
-
const modelNames = fs.readdirSync(`${modulePath}/lib`).filter((dir) => !dir.includes(".") && !dir.startsWith("_"));
|
|
5
|
-
const modelName = await select({
|
|
6
|
-
message: "Select the model to create the unit for",
|
|
7
|
-
choices: modelNames.map((name) => ({ name, value: name }))
|
|
8
|
-
});
|
|
9
|
-
return modelName;
|
|
10
|
-
};
|
|
11
|
-
export {
|
|
12
|
-
selectModel
|
|
13
|
-
};
|
package/esm/src/typeChecker.js
DELETED
|
@@ -1,174 +0,0 @@
|
|
|
1
|
-
import chalk from "chalk";
|
|
2
|
-
import * as fs from "fs";
|
|
3
|
-
import * as path from "path";
|
|
4
|
-
import * as ts from "typescript";
|
|
5
|
-
class TypeChecker {
|
|
6
|
-
configPath;
|
|
7
|
-
configFile;
|
|
8
|
-
config;
|
|
9
|
-
constructor(executor) {
|
|
10
|
-
const configPath = this.#findConfigFile(executor.cwdPath);
|
|
11
|
-
if (!configPath)
|
|
12
|
-
throw new Error("No tsconfig.json found in the project");
|
|
13
|
-
this.configPath = configPath;
|
|
14
|
-
this.configFile = ts.readConfigFile(this.configPath, (fileName) => ts.sys.readFile(fileName));
|
|
15
|
-
const parsedConfig = ts.parseJsonConfigFileContent(
|
|
16
|
-
this.configFile.config,
|
|
17
|
-
ts.sys,
|
|
18
|
-
path.dirname(this.configPath),
|
|
19
|
-
void 0,
|
|
20
|
-
this.configPath
|
|
21
|
-
);
|
|
22
|
-
if (parsedConfig.errors.length > 0) {
|
|
23
|
-
const errorMessages = parsedConfig.errors.map((error) => ts.flattenDiagnosticMessageText(error.messageText, "\n")).join("\n");
|
|
24
|
-
throw new Error(`Error parsing tsconfig.json:
|
|
25
|
-
${errorMessages}`);
|
|
26
|
-
}
|
|
27
|
-
this.config = parsedConfig;
|
|
28
|
-
}
|
|
29
|
-
/**
|
|
30
|
-
* Find tsconfig.json by walking up the directory tree
|
|
31
|
-
*/
|
|
32
|
-
#findConfigFile(searchPath) {
|
|
33
|
-
return ts.findConfigFile(searchPath, (fileName) => ts.sys.fileExists(fileName), "tsconfig.json");
|
|
34
|
-
}
|
|
35
|
-
/**
|
|
36
|
-
* Type-check a single TypeScript file
|
|
37
|
-
* @param filePath - Path to the TypeScript file to check
|
|
38
|
-
* @returns Array of diagnostic messages
|
|
39
|
-
*/
|
|
40
|
-
check(filePath) {
|
|
41
|
-
const program = ts.createProgram([filePath], this.config.options);
|
|
42
|
-
const diagnostics = [
|
|
43
|
-
...program.getSemanticDiagnostics(),
|
|
44
|
-
...program.getSyntacticDiagnostics(),
|
|
45
|
-
// Only check declaration diagnostics when declaration emit is enabled
|
|
46
|
-
...this.config.options.declaration ? program.getDeclarationDiagnostics() : []
|
|
47
|
-
];
|
|
48
|
-
const errors = diagnostics.filter((diagnostic) => diagnostic.category === ts.DiagnosticCategory.Error);
|
|
49
|
-
const warnings = diagnostics.filter((diagnostic) => diagnostic.category === ts.DiagnosticCategory.Warning);
|
|
50
|
-
const fileDiagnostics = diagnostics.filter((diagnostic) => diagnostic.file?.fileName === filePath);
|
|
51
|
-
const fileErrors = fileDiagnostics.filter((diagnostic) => diagnostic.category === ts.DiagnosticCategory.Error);
|
|
52
|
-
const fileWarnings = fileDiagnostics.filter((diagnostic) => diagnostic.category === ts.DiagnosticCategory.Warning);
|
|
53
|
-
return { diagnostics, errors, warnings, fileDiagnostics, fileErrors, fileWarnings };
|
|
54
|
-
}
|
|
55
|
-
/**
|
|
56
|
-
* Format diagnostics for console output
|
|
57
|
-
* @param diagnostics - Array of TypeScript diagnostics
|
|
58
|
-
* @returns Formatted string
|
|
59
|
-
*/
|
|
60
|
-
formatDiagnostics(diagnostics) {
|
|
61
|
-
if (diagnostics.length === 0)
|
|
62
|
-
return chalk.bold("\u2705 No type errors found");
|
|
63
|
-
const output = [];
|
|
64
|
-
let errorCount = 0;
|
|
65
|
-
let warningCount = 0;
|
|
66
|
-
let suggestionCount = 0;
|
|
67
|
-
const diagnosticsByFile = /* @__PURE__ */ new Map();
|
|
68
|
-
diagnostics.forEach((diagnostic) => {
|
|
69
|
-
if (diagnostic.category === ts.DiagnosticCategory.Error)
|
|
70
|
-
errorCount++;
|
|
71
|
-
else if (diagnostic.category === ts.DiagnosticCategory.Warning)
|
|
72
|
-
warningCount++;
|
|
73
|
-
else if (diagnostic.category === ts.DiagnosticCategory.Suggestion)
|
|
74
|
-
suggestionCount++;
|
|
75
|
-
if (diagnostic.file) {
|
|
76
|
-
const fileName = diagnostic.file.fileName;
|
|
77
|
-
if (!diagnosticsByFile.has(fileName))
|
|
78
|
-
diagnosticsByFile.set(fileName, []);
|
|
79
|
-
const fileDiagnostics = diagnosticsByFile.get(fileName);
|
|
80
|
-
if (fileDiagnostics)
|
|
81
|
-
fileDiagnostics.push(diagnostic);
|
|
82
|
-
} else {
|
|
83
|
-
if (!diagnosticsByFile.has(""))
|
|
84
|
-
diagnosticsByFile.set("", []);
|
|
85
|
-
const fileDiagnostics = diagnosticsByFile.get("");
|
|
86
|
-
if (fileDiagnostics)
|
|
87
|
-
fileDiagnostics.push(diagnostic);
|
|
88
|
-
}
|
|
89
|
-
});
|
|
90
|
-
diagnosticsByFile.forEach((fileDiagnostics, fileName) => {
|
|
91
|
-
if (fileName)
|
|
92
|
-
output.push(`
|
|
93
|
-
${chalk.cyan(fileName)}`);
|
|
94
|
-
fileDiagnostics.forEach((diagnostic) => {
|
|
95
|
-
const categoryText = diagnostic.category === ts.DiagnosticCategory.Error ? "error" : diagnostic.category === ts.DiagnosticCategory.Warning ? "warning" : "suggestion";
|
|
96
|
-
const categoryColor = diagnostic.category === ts.DiagnosticCategory.Error ? chalk.red : diagnostic.category === ts.DiagnosticCategory.Warning ? chalk.yellow : chalk.blue;
|
|
97
|
-
const icon = diagnostic.category === ts.DiagnosticCategory.Error ? "\u274C" : diagnostic.category === ts.DiagnosticCategory.Warning ? "\u26A0\uFE0F" : "\u{1F4A1}";
|
|
98
|
-
const message = ts.flattenDiagnosticMessageText(diagnostic.messageText, "\n");
|
|
99
|
-
const tsCode = chalk.dim(`(TS${diagnostic.code})`);
|
|
100
|
-
if (diagnostic.file && diagnostic.start !== void 0) {
|
|
101
|
-
const { line, character } = diagnostic.file.getLineAndCharacterOfPosition(diagnostic.start);
|
|
102
|
-
output.push(`
|
|
103
|
-
${icon} ${categoryColor(categoryText)}: ${message} ${tsCode}`);
|
|
104
|
-
output.push(` ${chalk.gray("at")} ${fileName}:${chalk.bold(`${line + 1}:${character + 1}`)}`);
|
|
105
|
-
const sourceLines = diagnostic.file.text.split("\n");
|
|
106
|
-
if (line < sourceLines.length) {
|
|
107
|
-
const sourceLine = sourceLines[line];
|
|
108
|
-
const lineNumber = (line + 1).toString().padStart(5, " ");
|
|
109
|
-
output.push(`
|
|
110
|
-
${chalk.dim(lineNumber + " |")} ${sourceLine}`);
|
|
111
|
-
const underlinePrefix = " ".repeat(character);
|
|
112
|
-
const length = diagnostic.length ?? 1;
|
|
113
|
-
const underline = "~".repeat(Math.max(1, length));
|
|
114
|
-
output.push(
|
|
115
|
-
`${chalk.dim(" ".repeat(lineNumber.length) + " |")} ${underlinePrefix}${categoryColor(underline)}`
|
|
116
|
-
);
|
|
117
|
-
}
|
|
118
|
-
} else
|
|
119
|
-
output.push(`
|
|
120
|
-
${icon} ${categoryColor(categoryText)}: ${message} ${tsCode}`);
|
|
121
|
-
});
|
|
122
|
-
});
|
|
123
|
-
const summary = [];
|
|
124
|
-
if (errorCount > 0)
|
|
125
|
-
summary.push(chalk.red(`${errorCount} error(s)`));
|
|
126
|
-
if (warningCount > 0)
|
|
127
|
-
summary.push(chalk.yellow(`${warningCount} warning(s)`));
|
|
128
|
-
if (suggestionCount > 0)
|
|
129
|
-
summary.push(chalk.blue(`${suggestionCount} suggestion(s)`));
|
|
130
|
-
return `
|
|
131
|
-
${summary.join(", ")} found` + output.join("\n");
|
|
132
|
-
}
|
|
133
|
-
/**
|
|
134
|
-
* Get detailed diagnostic information with code snippet
|
|
135
|
-
* @param filePath - Path to the TypeScript file to check
|
|
136
|
-
* @returns Object containing diagnostics and detailed information
|
|
137
|
-
*/
|
|
138
|
-
getDetailedDiagnostics(filePath) {
|
|
139
|
-
const { diagnostics } = this.check(filePath);
|
|
140
|
-
const sourceFile = ts.createSourceFile(filePath, fs.readFileSync(filePath, "utf8"), ts.ScriptTarget.Latest, true);
|
|
141
|
-
const details = diagnostics.map((diagnostic) => {
|
|
142
|
-
if (diagnostic.file && diagnostic.start !== void 0) {
|
|
143
|
-
const { line, character } = diagnostic.file.getLineAndCharacterOfPosition(diagnostic.start);
|
|
144
|
-
const message = ts.flattenDiagnosticMessageText(diagnostic.messageText, "\n");
|
|
145
|
-
const lines = sourceFile.text.split("\n");
|
|
146
|
-
const codeSnippet = line < lines.length ? lines[line] : void 0;
|
|
147
|
-
return { line: line + 1, column: character + 1, message, code: diagnostic.code, codeSnippet };
|
|
148
|
-
}
|
|
149
|
-
return {
|
|
150
|
-
line: 0,
|
|
151
|
-
column: 0,
|
|
152
|
-
message: ts.flattenDiagnosticMessageText(diagnostic.messageText, "\n"),
|
|
153
|
-
code: diagnostic.code
|
|
154
|
-
};
|
|
155
|
-
});
|
|
156
|
-
return { diagnostics, details };
|
|
157
|
-
}
|
|
158
|
-
/**
|
|
159
|
-
* Check if a file has type errors
|
|
160
|
-
* @param filePath - Path to the TypeScript file to check
|
|
161
|
-
* @returns true if there are no type errors, false otherwise
|
|
162
|
-
*/
|
|
163
|
-
hasNoTypeErrors(filePath) {
|
|
164
|
-
try {
|
|
165
|
-
const { diagnostics } = this.check(filePath);
|
|
166
|
-
return diagnostics.length === 0;
|
|
167
|
-
} catch (error) {
|
|
168
|
-
return false;
|
|
169
|
-
}
|
|
170
|
-
}
|
|
171
|
-
}
|
|
172
|
-
export {
|
|
173
|
-
TypeChecker
|
|
174
|
-
};
|
package/esm/src/types.js
DELETED
|
File without changes
|
package/index.d.ts
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export * from "./src";
|
package/src/aiEditor.d.ts
DELETED
|
@@ -1,50 +0,0 @@
|
|
|
1
|
-
import { BaseMessage } from "@langchain/core/messages";
|
|
2
|
-
import type { Executor, WorkspaceExecutor } from "./executors";
|
|
3
|
-
import type { FileContent } from "./types";
|
|
4
|
-
export declare const supportedLlmModels: readonly ["deepseek-chat", "deepseek-reasoner"];
|
|
5
|
-
export type SupportedLlmModel = (typeof supportedLlmModels)[number];
|
|
6
|
-
interface EditOptions {
|
|
7
|
-
onReasoning?: (reasoning: string) => void;
|
|
8
|
-
onChunk?: (chunk: string) => void;
|
|
9
|
-
maxTry?: number;
|
|
10
|
-
validate?: string[];
|
|
11
|
-
approve?: boolean;
|
|
12
|
-
}
|
|
13
|
-
export declare class AiSession {
|
|
14
|
-
#private;
|
|
15
|
-
static init({ temperature, useExisting }?: {
|
|
16
|
-
temperature?: number;
|
|
17
|
-
useExisting?: boolean;
|
|
18
|
-
}): Promise<typeof AiSession>;
|
|
19
|
-
static getLlmConfig(): {
|
|
20
|
-
model: SupportedLlmModel;
|
|
21
|
-
apiKey: string;
|
|
22
|
-
} | null;
|
|
23
|
-
static setLlmConfig(llmConfig: {
|
|
24
|
-
model: SupportedLlmModel;
|
|
25
|
-
apiKey: string;
|
|
26
|
-
} | null): typeof AiSession;
|
|
27
|
-
static clearCache(workspaceRoot: string): void;
|
|
28
|
-
messageHistory: BaseMessage[];
|
|
29
|
-
readonly sessionKey: string;
|
|
30
|
-
isCacheLoaded: boolean;
|
|
31
|
-
workspace: WorkspaceExecutor;
|
|
32
|
-
constructor(type: string, { workspace, cacheKey, isContinued }: {
|
|
33
|
-
workspace: WorkspaceExecutor;
|
|
34
|
-
cacheKey?: string;
|
|
35
|
-
isContinued?: boolean;
|
|
36
|
-
});
|
|
37
|
-
ask(question: string, { onReasoning, onChunk, }?: EditOptions): Promise<{
|
|
38
|
-
content: string;
|
|
39
|
-
messageHistory: BaseMessage[];
|
|
40
|
-
}>;
|
|
41
|
-
edit(question: string, { onChunk, onReasoning, maxTry, validate, approve }?: EditOptions): Promise<string>;
|
|
42
|
-
editTypescript(question: string, options?: EditOptions): Promise<string>;
|
|
43
|
-
addToolMessgaes(messages: {
|
|
44
|
-
type: string;
|
|
45
|
-
content: string;
|
|
46
|
-
}[]): this;
|
|
47
|
-
writeTypescripts(question: string, executor: Executor, options?: EditOptions): Promise<FileContent[]>;
|
|
48
|
-
editMarkdown(request: string, options?: EditOptions): Promise<string>;
|
|
49
|
-
}
|
|
50
|
-
export {};
|