@akanjs/cli 3.0.0-alpha.9 → 3.0.0-alpha.90
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/.build-stamp +1 -1
- package/README.ko.md +1 -1
- package/README.md +1 -1
- package/{abstractCompactor-e5yq60qz.js → abstractCompactor-cefxzggj.js} +3 -5
- package/{agent.command-f0gqkfgz.js → agent.command-r93wmq7m.js} +11 -13
- package/{application.command-x903m2qq.js → application.command-5nqfqgdn.js} +62 -38
- package/{applicationBuildRunner-ha3y8ew8.js → applicationBuildRunner-b21m07fs.js} +23 -20
- package/{applicationReleasePackager-gg8ccbeh.js → applicationReleasePackager-3wh58n2m.js} +8 -9
- package/buildBatch.proc.js +12 -14
- package/capacitorApp-gzcx6txb.js +12 -0
- package/{cloud.command-zs6kyf83.js → cloud.command-g0pk0k60.js} +15 -18
- package/commandManifest.json +1 -1
- package/{context.command-fmepgjzg.js → context.command-qd8kqrnh.js} +19 -23
- package/dependencyScanner-shs82ynp.js +8 -0
- package/devTui-2xf0meaq.js +552 -0
- package/devTuiView-7jy8f30g.js +9 -0
- package/getDirname-dr3jz1xg.js +7 -0
- package/{guideline.command-n6sw0a0c.js → guideline.command-f38x8jhw.js} +16 -18
- package/guidelines/agentRule/agentRule.generate.json +31 -0
- package/guidelines/agentRule/agentRule.instruction.md +533 -0
- package/guidelines/conventions/conventions.instruction.md +406 -197
- package/guidelines/cssRule/cssRule.instruction.md +7 -0
- package/guidelines/framework/framework.generate.json +3 -2
- package/guidelines/framework/framework.instruction.md +1 -9
- package/guidelines/mcpRule/mcpRule.generate.json +25 -0
- package/guidelines/mcpRule/mcpRule.instruction.md +217 -0
- package/guidelines/modelStore/modelStore.instruction.md +12 -0
- package/guidelines/modelTemplate/modelTemplate.instruction.md +5 -0
- package/guidelines/queryRule/queryRule.generate.json +31 -0
- package/guidelines/queryRule/queryRule.instruction.md +143 -0
- package/guidelines/runtimeRule/runtimeRule.generate.json +25 -0
- package/guidelines/runtimeRule/runtimeRule.instruction.md +213 -0
- package/guidelines/ssrRule/ssrRule.instruction.md +49 -5
- package/guidelines/transportRule/transportRule.generate.json +31 -0
- package/guidelines/transportRule/transportRule.instruction.md +60 -0
- package/guidelines/workspaceOnboarding/workspaceOnboarding.instruction.md +51 -760
- package/guidelines/workspaceRecipes/workspaceRecipes.generate.json +33 -0
- package/guidelines/workspaceRecipes/workspaceRecipes.instruction.md +402 -0
- package/incrementalBuilder.proc.js +26 -25
- package/{index-774gcx29.js → index-0emb9eat.js} +41 -34
- package/index-3d9y066c.js +76 -0
- package/{index-3vta1tqa.js → index-3vvbv974.js} +32 -32
- package/{index-76rn3g2c.js → index-47pj3aee.js} +4 -4
- package/{index-y4vkyhvv.js → index-5xdqxbn9.js} +14 -14
- package/{index-1577bej2.js → index-6wwzs1bc.js} +2 -2
- package/{index-wnp7hwq7.js → index-92zztqy1.js} +7 -7
- package/{index-jhpa13zj.js → index-9bwhxrqf.js} +57 -57
- package/{index-bjpxzr6s.js → index-9wtbw98m.js} +6 -3
- package/{index-fgc8r6dj.js → index-a5vmm6x4.js} +3 -1
- package/{index-xys926f2.js → index-by5gpp8x.js} +4 -4
- package/{index-kdh76j26.js → index-cezy7yb3.js} +100 -32
- package/{index-62955kn5.js → index-d61rcfa2.js} +758 -127
- package/{index-82jrh4hj.js → index-deekbtkj.js} +13 -13
- package/{index-rxkpk7n4.js → index-e82dyeqy.js} +4 -4
- package/{index-qzdjd4ct.js → index-h759vjfa.js} +18 -18
- package/{index-j37qq1f2.js → index-h7yw2z9n.js} +7 -7
- package/{index-qb61h0k7.js → index-jydtyzva.js} +1098 -1360
- package/{index-46tjzh6s.js → index-kcxmv48c.js} +29 -29
- package/{index-4m0bphac.js → index-kfnr6c19.js} +31 -30
- package/{index-xmmzf150.js → index-mpmyqm1y.js} +1 -1
- package/{index-xjd3rqzj.js → index-n68jx79w.js} +6 -15
- package/{index-0cj2zxbm.js → index-n85fer99.js} +12 -11
- package/{index-779ske1y.js → index-pgsswppj.js} +27 -27
- package/index-pvb4vdwr.js +159 -0
- package/{index-67546d0j.js → index-q0y2jq9j.js} +14 -2
- package/{index-z8ptfkzv.js → index-q8sn827n.js} +969 -240
- package/{index-5sn5w2mt.js → index-r50qen0z.js} +94 -61
- package/{index-eyyf2149.js → index-rntcdss1.js} +36 -37
- package/{index-gcv8ncfh.js → index-sjak5v5b.js} +16 -12
- package/{index-j9cxndc0.js → index-w8kmx1b6.js} +20 -11
- package/{index-jf2ya7r2.js → index-y74k5anj.js} +8 -8
- package/{index-d43t8af2.js → index-zkvpaggp.js} +58 -25
- package/index.js +22 -25
- package/{library.command-cv9gdbmg.js → library.command-em103wtn.js} +11 -10
- package/{localRegistry.command-d8fg36zc.js → localRegistry.command-gz8apn4y.js} +20 -23
- package/{module.command-qyr1s9cn.js → module.command-451pztkc.js} +13 -16
- package/{package.command-wsjx0k47.js → package.command-rfhyf38t.js} +8 -10
- package/package.json +5 -7
- package/{page.command-rdzg65rm.js → page.command-kt19da5g.js} +7 -9
- package/{primitive.command-89g38b53.js → primitive.command-pgy69ere.js} +13 -16
- package/{quality.command-0cs2z92d.js → quality.command-gpe2vqb5.js} +226 -105
- package/recipeScanner-fpagtgc1.js +11 -0
- package/{repair.command-6fphxfwj.js → repair.command-2sbrz187.js} +12 -14
- package/{routeSourceValidator-e4jmbfcx.js → routeSourceValidator-ze6x894c.js} +0 -2
- package/{scalar.command-xfer69s6.js → scalar.command-jcf4e5sv.js} +11 -14
- package/subspace.command-kqzqtk0p.js +755 -0
- package/templates/app/env/env.client.debug.ts.template +1 -5
- package/templates/app/env/env.client.develop.ts.template +1 -5
- package/templates/app/env/env.client.local.ts.template +1 -5
- package/templates/app/env/env.client.main.ts.template +1 -5
- package/templates/app/env/env.client.testing.ts.template +1 -5
- package/templates/app/env/env.client.type.ts +2 -6
- package/templates/app/env/env.server.debug.ts.template +1 -5
- package/templates/app/env/env.server.develop.ts.template +1 -5
- package/templates/app/env/env.server.local.ts.template +1 -5
- package/templates/app/env/env.server.main.ts.template +1 -5
- package/templates/app/main.ts +3 -1
- package/templates/appSample/lib/task/task.signal.ts +11 -6
- package/templates/appSample/srvkit/AuthGuard.ts +9 -5
- package/templates/appSample/srvkit/SessionInternalArg.ts +4 -3
- package/templates/crudPages/[__model__Id]/edit/page.tsx +5 -5
- package/templates/crudPages/[__model__Id]/page.tsx +10 -13
- package/templates/crudPages/new/page.tsx +5 -5
- package/templates/crudPages/page.tsx +9 -9
- package/templates/crudSinglePage/page.tsx +11 -7
- package/templates/env/_env.server.type.ts +7 -5
- package/templates/lib/db.ts +1 -1
- package/templates/lib/dict.ts +1 -1
- package/templates/lib/sig.ts +1 -1
- package/templates/lib/srv.ts +6 -2
- package/templates/module/__model__.dictionary.ts +4 -1
- package/templates/module/__model__.signal.ts +2 -3
- package/templates/module/__model__.store.ts +1 -2
- package/templates/workspaceRoot/.gitignore.template +0 -1
- package/templates/workspaceRoot/.husky/pre-commit.template +16 -0
- package/templates/workspaceRoot/.vscode/settings.json.template +1 -1
- package/templates/workspaceRoot/AGENTS.md.template +4 -0
- package/templates/workspaceRoot/CLAUDE.md.template +19 -0
- package/templates/workspaceRoot/biome.json.template +2 -1
- package/templates/workspaceRoot/docs/AI-DEVELOPMENT.md.template +10 -14
- package/templates/workspaceRoot/docs/GENERATED.md.template +12 -10
- package/templates/workspaceRoot/package.json.template +2 -4
- package/typeChecker-3xgrzc2v.js +7 -0
- package/typecheck.proc.js +4 -5
- package/{workflow.command-2ygfqt4f.js → workflow.command-m4z25a2p.js} +22 -25
- package/{workspace.command-88m0zs64.js → workspace.command-dqgj9zbk.js} +96 -81
- package/capacitorApp-9xswcgx7.js +0 -61
- package/dependencyScanner-f6grrep3.js +0 -9
- package/getDirname-m9s0cmhq.js +0 -8
- package/index-mxvakhsm.js +0 -66
- package/index-r24hmh0q.js +0 -4
- package/recipeScanner-tghkzrrt.js +0 -12
- package/typeChecker-kravn7ns.js +0 -8
- /package/{index-0wae5ebk.js → index-meh558jy.js} +0 -0
- /package/{index-ss469dec.js → index-nz8prx9g.js} +0 -0
|
@@ -0,0 +1,76 @@
|
|
|
1
|
+
// @bun
|
|
2
|
+
// pkgs/@akanjs/devkit/libSource.ts
|
|
3
|
+
class LibSource {
|
|
4
|
+
static manifestKey = "akan";
|
|
5
|
+
static unhashedDirs = ["env"];
|
|
6
|
+
#lib;
|
|
7
|
+
constructor(lib) {
|
|
8
|
+
this.#lib = lib;
|
|
9
|
+
}
|
|
10
|
+
get #prefix() {
|
|
11
|
+
return `libs/${this.#lib.name}/`;
|
|
12
|
+
}
|
|
13
|
+
#isHashed(file) {
|
|
14
|
+
const relative = file.slice(this.#prefix.length);
|
|
15
|
+
return !LibSource.unhashedDirs.includes(relative.split("/")[0] ?? "");
|
|
16
|
+
}
|
|
17
|
+
async#hashableContent(file) {
|
|
18
|
+
const content = await this.#lib.workspace.readFile(file);
|
|
19
|
+
if (file !== `${this.#prefix}package.json`)
|
|
20
|
+
return content;
|
|
21
|
+
const manifest = JSON.parse(content);
|
|
22
|
+
delete manifest[LibSource.manifestKey];
|
|
23
|
+
return JSON.stringify(manifest);
|
|
24
|
+
}
|
|
25
|
+
async computeHash() {
|
|
26
|
+
const files = (await this.#lib.workspace.listGitFiles([`libs/${this.#lib.name}`], { untracked: true })).filter((file) => this.#isHashed(file));
|
|
27
|
+
const hasher = new Bun.CryptoHasher("sha256");
|
|
28
|
+
for (const file of files) {
|
|
29
|
+
hasher.update(file);
|
|
30
|
+
hasher.update("\x00");
|
|
31
|
+
hasher.update(await this.#hashableContent(file));
|
|
32
|
+
hasher.update("\x00");
|
|
33
|
+
}
|
|
34
|
+
return hasher.digest("hex").slice(0, 32);
|
|
35
|
+
}
|
|
36
|
+
async read() {
|
|
37
|
+
const manifest = await this.#lib.getPackageJson();
|
|
38
|
+
const akan = manifest[LibSource.manifestKey];
|
|
39
|
+
return akan?.source ?? null;
|
|
40
|
+
}
|
|
41
|
+
async write({ origin, sha }) {
|
|
42
|
+
const [manifest, hash] = await Promise.all([this.#lib.getPackageJson(), this.computeHash()]);
|
|
43
|
+
const akan = manifest[LibSource.manifestKey] ?? {};
|
|
44
|
+
const stamp = { origin, sha, hash, syncedAt: new Date().toISOString() };
|
|
45
|
+
await this.#lib.setPackageJson({ ...manifest, [LibSource.manifestKey]: { ...akan, source: stamp } });
|
|
46
|
+
return stamp;
|
|
47
|
+
}
|
|
48
|
+
async syncStamp({ origin, sha }) {
|
|
49
|
+
const [current, hash] = await Promise.all([this.read(), this.computeHash()]);
|
|
50
|
+
if (current?.origin === origin && current.sha === sha && current.hash === hash)
|
|
51
|
+
return { stamp: current, changed: false };
|
|
52
|
+
return { stamp: await this.write({ origin, sha }), changed: true };
|
|
53
|
+
}
|
|
54
|
+
async status() {
|
|
55
|
+
const [stamp, hash] = await Promise.all([this.read(), this.computeHash()]);
|
|
56
|
+
const drift = !stamp ? "unstamped" : stamp.hash === hash ? "clean" : "drifted";
|
|
57
|
+
return { lib: this.#lib.name, drift, stamp, hash };
|
|
58
|
+
}
|
|
59
|
+
}
|
|
60
|
+
function formatLibStatuses(statuses) {
|
|
61
|
+
const marks = { clean: "clean ", drifted: "DRIFTED ", unstamped: "unstamped" };
|
|
62
|
+
const sections = [
|
|
63
|
+
"Akan Library Source Status",
|
|
64
|
+
"",
|
|
65
|
+
...statuses.map((status) => {
|
|
66
|
+
const origin = status.stamp ? `${status.stamp.origin}@${status.stamp.sha}` : "no akan.source in package.json";
|
|
67
|
+
return ` ${marks[status.drift]} libs/${status.lib} ${origin}`;
|
|
68
|
+
}),
|
|
69
|
+
"",
|
|
70
|
+
`drifted: ${statuses.filter((status) => status.drift === "drifted").length} / ${statuses.length}`
|
|
71
|
+
];
|
|
72
|
+
return sections.join(`
|
|
73
|
+
`);
|
|
74
|
+
}
|
|
75
|
+
|
|
76
|
+
export { LibSource, formatLibStatuses };
|
|
@@ -1,48 +1,48 @@
|
|
|
1
1
|
// @bun
|
|
2
2
|
import {
|
|
3
|
-
|
|
4
|
-
} from "./index-
|
|
3
|
+
script
|
|
4
|
+
} from "./index-cezy7yb3.js";
|
|
5
|
+
import {
|
|
6
|
+
AppExecutor,
|
|
7
|
+
LibExecutor,
|
|
8
|
+
ModuleExecutor
|
|
9
|
+
} from "./index-q8sn827n.js";
|
|
5
10
|
import {
|
|
6
|
-
addFieldUiPolicyForType,
|
|
7
|
-
coerceFieldDefault,
|
|
8
11
|
compactDiagnostics,
|
|
9
12
|
createPrimitiveWriteReport,
|
|
13
|
+
sourceFile,
|
|
14
|
+
moduleComponentName,
|
|
15
|
+
moduleSourcePaths,
|
|
16
|
+
generatedFilesForSync,
|
|
17
|
+
validationCommandsForTarget,
|
|
18
|
+
nextActionsForTarget,
|
|
19
|
+
lowerlize,
|
|
20
|
+
normalizeFieldType,
|
|
10
21
|
ensureBaseTypeImport,
|
|
11
|
-
|
|
12
|
-
ensureEnumImport,
|
|
22
|
+
coerceFieldDefault,
|
|
13
23
|
fieldExpression,
|
|
14
|
-
|
|
15
|
-
|
|
24
|
+
viaBuilderParameterName,
|
|
25
|
+
insertIntoObject,
|
|
26
|
+
insertLightProjectionField,
|
|
27
|
+
insertTemplateField,
|
|
28
|
+
ensureEnumImport,
|
|
29
|
+
insertEnumClass,
|
|
30
|
+
insertDictionaryModelField,
|
|
16
31
|
hasConstantInputField,
|
|
17
32
|
hasDictionaryModelField,
|
|
18
|
-
|
|
33
|
+
ensureConstantTypeImport,
|
|
34
|
+
insertDictionaryEnum,
|
|
35
|
+
parseValues,
|
|
19
36
|
hasSourceParseErrors,
|
|
37
|
+
hasClassMethod,
|
|
20
38
|
insertClassMethod,
|
|
21
|
-
|
|
22
|
-
insertDictionaryModelField,
|
|
23
|
-
insertEnumClass,
|
|
24
|
-
insertIntoObject,
|
|
25
|
-
insertLightProjectionField,
|
|
39
|
+
hasSignalFactoryEntry,
|
|
26
40
|
insertSignalFactoryEntry,
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
moduleComponentName,
|
|
30
|
-
moduleSourcePaths,
|
|
31
|
-
nextActionsForTarget,
|
|
32
|
-
normalizeFieldType,
|
|
33
|
-
parseValues,
|
|
34
|
-
sourceFile,
|
|
35
|
-
validationCommandsForTarget,
|
|
36
|
-
viaBuilderParameterName
|
|
37
|
-
} from "./index-rxkpk7n4.js";
|
|
41
|
+
addFieldUiPolicyForType
|
|
42
|
+
} from "./index-e82dyeqy.js";
|
|
38
43
|
import {
|
|
39
|
-
|
|
40
|
-
} from "./index-
|
|
41
|
-
import {
|
|
42
|
-
AppExecutor,
|
|
43
|
-
LibExecutor,
|
|
44
|
-
ModuleExecutor
|
|
45
|
-
} from "./index-z8ptfkzv.js";
|
|
44
|
+
ModuleScript
|
|
45
|
+
} from "./index-9bwhxrqf.js";
|
|
46
46
|
|
|
47
47
|
// pkgs/@akanjs/cli/primitive/primitive.script.ts
|
|
48
48
|
import { capitalize } from "akanjs/common";
|
|
@@ -37,10 +37,10 @@ var resolveMobileTargets = async (app, selection) => {
|
|
|
37
37
|
if (!selection && targets.length === 1)
|
|
38
38
|
return targets;
|
|
39
39
|
if (!selection) {
|
|
40
|
-
const
|
|
41
|
-
if (
|
|
42
|
-
return resolveMobileTargets(app,
|
|
43
|
-
throw new Error(`Multiple mobile targets found for ${app.name}. Pass --target <${
|
|
40
|
+
const choices = await getMobileTargetChoices(app);
|
|
41
|
+
if (choices.length === 1)
|
|
42
|
+
return resolveMobileTargets(app, choices[0]);
|
|
43
|
+
throw new Error(`Multiple mobile targets found for ${app.name}. Pass --target <${choices.join("|")}|all>.`);
|
|
44
44
|
}
|
|
45
45
|
if (selection === "all") {
|
|
46
46
|
if (Object.keys(config.mobile.targets).length > 1)
|
|
@@ -1,22 +1,22 @@
|
|
|
1
1
|
// @bun
|
|
2
2
|
import {
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
AiSession
|
|
7
|
-
} from "./index-0cj2zxbm.js";
|
|
3
|
+
runner,
|
|
4
|
+
script
|
|
5
|
+
} from "./index-cezy7yb3.js";
|
|
8
6
|
import {
|
|
9
|
-
createPassedPrimitiveReport,
|
|
10
7
|
generatedFilesForSync,
|
|
8
|
+
createPassedPrimitiveReport,
|
|
11
9
|
scalarChangedFiles
|
|
12
|
-
} from "./index-
|
|
10
|
+
} from "./index-e82dyeqy.js";
|
|
11
|
+
import {
|
|
12
|
+
AiSession
|
|
13
|
+
} from "./index-n85fer99.js";
|
|
13
14
|
import {
|
|
14
15
|
Prompter
|
|
15
|
-
} from "./index-
|
|
16
|
+
} from "./index-h7yw2z9n.js";
|
|
16
17
|
import {
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
} from "./index-kdh76j26.js";
|
|
18
|
+
pluralizeName
|
|
19
|
+
} from "./index-nz8prx9g.js";
|
|
20
20
|
|
|
21
21
|
// pkgs/@akanjs/cli/scalar/scalar.prompt.ts
|
|
22
22
|
import { input } from "@inquirer/prompts";
|
|
@@ -192,9 +192,9 @@ class ScalarRunner extends runner("scalar") {
|
|
|
192
192
|
const { request, validate } = await prompt.requestUpdateDictonaryWithInstruction();
|
|
193
193
|
await session.writeTypescripts(request, sys, { validate });
|
|
194
194
|
for (const scalarName of followingScalarNames) {
|
|
195
|
-
const
|
|
196
|
-
const { request
|
|
197
|
-
await session.writeTypescripts(
|
|
195
|
+
const prompt = new ScalarPrompt(sys, scalarName);
|
|
196
|
+
const { request, validate } = await prompt.requestUpdateDictonaryWithFollowing();
|
|
197
|
+
await session.writeTypescripts(request, sys, { validate });
|
|
198
198
|
}
|
|
199
199
|
}
|
|
200
200
|
}
|
|
@@ -2,6 +2,6 @@
|
|
|
2
2
|
// pkgs/@akanjs/devkit/getDirname.ts
|
|
3
3
|
import path from "path";
|
|
4
4
|
import { fileURLToPath } from "url";
|
|
5
|
-
var
|
|
5
|
+
var getDirname2 = (url) => path.dirname(fileURLToPath(url));
|
|
6
6
|
|
|
7
|
-
export {
|
|
7
|
+
export { getDirname2 };
|
|
@@ -5,7 +5,7 @@ import * as path from "path";
|
|
|
5
5
|
import chalk from "chalk";
|
|
6
6
|
import * as ts from "typescript";
|
|
7
7
|
|
|
8
|
-
class
|
|
8
|
+
class TypeChecker2 {
|
|
9
9
|
configPath;
|
|
10
10
|
configFile;
|
|
11
11
|
config;
|
|
@@ -143,12 +143,12 @@ ${summary.join(", ")} found${output.join(`
|
|
|
143
143
|
try {
|
|
144
144
|
const { diagnostics } = this.check(filePath);
|
|
145
145
|
return diagnostics.length === 0;
|
|
146
|
-
} catch (
|
|
146
|
+
} catch (_error) {
|
|
147
147
|
return false;
|
|
148
148
|
}
|
|
149
149
|
}
|
|
150
150
|
static checkProject(configPath) {
|
|
151
|
-
const parsedConfig =
|
|
151
|
+
const parsedConfig = TypeChecker2.parseConfig(configPath);
|
|
152
152
|
const host = ts.createIncrementalCompilerHost(parsedConfig.options);
|
|
153
153
|
const builderProgram = ts.createIncrementalProgram({
|
|
154
154
|
rootNames: parsedConfig.fileNames,
|
|
@@ -166,19 +166,19 @@ ${summary.join(", ")} found${output.join(`
|
|
|
166
166
|
diagnostics,
|
|
167
167
|
errors,
|
|
168
168
|
warnings,
|
|
169
|
-
message:
|
|
169
|
+
message: TypeChecker2.formatDiagnosticMessages(diagnostics)
|
|
170
170
|
};
|
|
171
171
|
}
|
|
172
172
|
static parseConfig(configPath) {
|
|
173
173
|
const configFile = ts.readConfigFile(configPath, (fileName) => ts.sys.readFile(fileName));
|
|
174
174
|
const configDiagnostics = configFile.error ? [configFile.error] : [];
|
|
175
175
|
if (!configFile.config) {
|
|
176
|
-
const message =
|
|
176
|
+
const message = TypeChecker2.formatDiagnosticMessages(configDiagnostics);
|
|
177
177
|
throw new Error(message || `Error reading tsconfig.json: ${configPath}`);
|
|
178
178
|
}
|
|
179
179
|
const parsedConfig = ts.parseJsonConfigFileContent(configFile.config, ts.sys, path.dirname(configPath), undefined, configPath);
|
|
180
180
|
if (parsedConfig.errors.length > 0)
|
|
181
|
-
throw new Error(
|
|
181
|
+
throw new Error(TypeChecker2.formatDiagnosticMessages(parsedConfig.errors));
|
|
182
182
|
return parsedConfig;
|
|
183
183
|
}
|
|
184
184
|
static formatDiagnosticMessages(diagnostics) {
|
|
@@ -190,4 +190,4 @@ ${summary.join(", ")} found${output.join(`
|
|
|
190
190
|
}
|
|
191
191
|
}
|
|
192
192
|
|
|
193
|
-
export {
|
|
193
|
+
export { TypeChecker2 };
|
|
@@ -1,34 +1,34 @@
|
|
|
1
1
|
// @bun
|
|
2
2
|
import {
|
|
3
|
-
|
|
4
|
-
} from "./index-
|
|
5
|
-
import {
|
|
6
|
-
PageScript
|
|
7
|
-
} from "./index-xmmzf150.js";
|
|
3
|
+
FileSys
|
|
4
|
+
} from "./index-q0y2jq9j.js";
|
|
8
5
|
import {
|
|
9
6
|
AiSession
|
|
10
|
-
} from "./index-
|
|
7
|
+
} from "./index-n85fer99.js";
|
|
11
8
|
import {
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
createPassedPrimitiveReport,
|
|
15
|
-
generatedFilesForSync,
|
|
16
|
-
moduleSourcePaths,
|
|
17
|
-
sourceFile
|
|
18
|
-
} from "./index-rxkpk7n4.js";
|
|
19
|
-
import {
|
|
20
|
-
Prompter
|
|
21
|
-
} from "./index-j37qq1f2.js";
|
|
9
|
+
ModuleExecutor
|
|
10
|
+
} from "./index-q8sn827n.js";
|
|
22
11
|
import {
|
|
23
12
|
runner,
|
|
24
13
|
script
|
|
25
|
-
} from "./index-
|
|
14
|
+
} from "./index-cezy7yb3.js";
|
|
26
15
|
import {
|
|
27
|
-
|
|
28
|
-
|
|
16
|
+
sourceFile,
|
|
17
|
+
moduleSourcePaths,
|
|
18
|
+
generatedFilesForSync,
|
|
19
|
+
createPassedPrimitiveReport,
|
|
20
|
+
bilingualLabelForField,
|
|
21
|
+
bilingualDescriptionForField
|
|
22
|
+
} from "./index-e82dyeqy.js";
|
|
29
23
|
import {
|
|
30
|
-
|
|
31
|
-
} from "./index-
|
|
24
|
+
PageScript
|
|
25
|
+
} from "./index-mpmyqm1y.js";
|
|
26
|
+
import {
|
|
27
|
+
Prompter
|
|
28
|
+
} from "./index-h7yw2z9n.js";
|
|
29
|
+
import {
|
|
30
|
+
pluralizeName
|
|
31
|
+
} from "./index-nz8prx9g.js";
|
|
32
32
|
|
|
33
33
|
// pkgs/@akanjs/devkit/getRelatedCnsts.ts
|
|
34
34
|
import { readFileSync, realpathSync } from "fs";
|
|
@@ -662,39 +662,39 @@ class ModuleRunner extends runner("module") {
|
|
|
662
662
|
}
|
|
663
663
|
|
|
664
664
|
// pkgs/@akanjs/cli/module/module.script.ts
|
|
665
|
-
var moduleChangedFiles = (
|
|
665
|
+
var moduleChangedFiles = (sys, moduleName, files) => Object.values(files).map((file) => sourceFile(sys, `lib/${moduleName}/${file.filename}`, "create", "Module source file was created."));
|
|
666
666
|
|
|
667
667
|
class ModuleScript extends script("module", [ModuleRunner, PageScript]) {
|
|
668
|
-
async createModuleTemplate(
|
|
669
|
-
const mod = ModuleExecutor.from(
|
|
668
|
+
async createModuleTemplate(sys, name, { page = false } = {}) {
|
|
669
|
+
const mod = ModuleExecutor.from(sys, name);
|
|
670
670
|
const files = await this.moduleRunner.createModuleTemplate(mod);
|
|
671
|
-
if (page &&
|
|
672
|
-
await this.pageScript.createCrudPage(mod, { app:
|
|
673
|
-
await
|
|
671
|
+
if (page && sys.type === "app")
|
|
672
|
+
await this.pageScript.createCrudPage(mod, { app: sys, basePath: null, single: false });
|
|
673
|
+
await sys.scan();
|
|
674
674
|
return createPassedPrimitiveReport({
|
|
675
675
|
command: "create-module",
|
|
676
|
-
changedFiles: moduleChangedFiles(
|
|
677
|
-
generatedFiles: generatedFilesForSync(
|
|
678
|
-
target:
|
|
676
|
+
changedFiles: moduleChangedFiles(sys, name, files),
|
|
677
|
+
generatedFiles: generatedFilesForSync(sys, "Generated files were refreshed after module creation."),
|
|
678
|
+
target: sys.name
|
|
679
679
|
});
|
|
680
680
|
}
|
|
681
|
-
async createModule(
|
|
681
|
+
async createModule(sys, name, {
|
|
682
682
|
page = false,
|
|
683
683
|
description,
|
|
684
684
|
schemaDescription
|
|
685
685
|
} = {}) {
|
|
686
|
-
const isContinued = await
|
|
687
|
-
const session = new AiSession("createModule", { workspace:
|
|
688
|
-
const moduleConstantExampleFiles = await
|
|
689
|
-
const executor = ModuleExecutor.from(
|
|
686
|
+
const isContinued = await sys.exists(`lib/${name}/${name}.constant.ts`);
|
|
687
|
+
const session = new AiSession("createModule", { workspace: sys.workspace, cacheKey: name, isContinued });
|
|
688
|
+
const moduleConstantExampleFiles = await sys.workspace.getConstantFiles();
|
|
689
|
+
const executor = ModuleExecutor.from(sys, name);
|
|
690
690
|
const files = await this.moduleRunner.createModuleTemplate(executor);
|
|
691
691
|
const { constant, dictionary } = files;
|
|
692
|
-
if (page &&
|
|
693
|
-
await this.pageScript.createCrudPage(executor, { app:
|
|
692
|
+
if (page && sys.type === "app")
|
|
693
|
+
await this.pageScript.createCrudPage(executor, { app: sys, basePath: null, single: false });
|
|
694
694
|
const modelDesc = description ?? await input({ message: "description of module" });
|
|
695
695
|
const modelSchemaDesign = schemaDescription ?? await input({ message: "schema description of module" });
|
|
696
|
-
const config = await
|
|
697
|
-
const moduleRequest = new ModuleRequest({ sysType:
|
|
696
|
+
const config = await sys.getConfig();
|
|
697
|
+
const moduleRequest = new ModuleRequest({ sysType: sys.type, sysName: sys.name, modelName: name, config });
|
|
698
698
|
const constantRequestPrompt = await moduleRequest.requestModelConstant({
|
|
699
699
|
modelDesc,
|
|
700
700
|
modelSchemaDesign,
|
|
@@ -702,38 +702,38 @@ class ModuleScript extends script("module", [ModuleRunner, PageScript]) {
|
|
|
702
702
|
exampleFiles: randomPicks(moduleConstantExampleFiles, Math.min(10, moduleConstantExampleFiles.length))
|
|
703
703
|
});
|
|
704
704
|
const constantGuide = await ModuleRequest.getGuideJson("modelConstant");
|
|
705
|
-
const constantWrites = await session.writeTypescripts(constantRequestPrompt,
|
|
705
|
+
const constantWrites = await session.writeTypescripts(constantRequestPrompt, sys, {
|
|
706
706
|
validate: constantGuide.update.rules
|
|
707
707
|
});
|
|
708
708
|
for (const scalarName of this.#getCreatedScalarNames(constantWrites.map(({ filePath }) => filePath))) {
|
|
709
|
-
await
|
|
709
|
+
await sys.applyTemplate({
|
|
710
710
|
basePath: "./lib/__scalar",
|
|
711
711
|
template: "__scalar",
|
|
712
|
-
dict: { model: scalarName, models: pluralizeName(scalarName), sysName:
|
|
712
|
+
dict: { model: scalarName, models: pluralizeName(scalarName), sysName: sys.name },
|
|
713
713
|
overwrite: false
|
|
714
714
|
});
|
|
715
715
|
}
|
|
716
|
-
const constantContent = await
|
|
716
|
+
const constantContent = await sys.readFile(`lib/${name}/${name}.constant.ts`);
|
|
717
717
|
const dictionaryGuide = await ModuleRequest.getGuideJson("modelDictionary");
|
|
718
718
|
await session.writeTypescripts(requestDictionary({
|
|
719
|
-
sysName:
|
|
719
|
+
sysName: sys.name,
|
|
720
720
|
modelName: name,
|
|
721
721
|
constant: constantContent,
|
|
722
722
|
modelDesc,
|
|
723
723
|
modelSchemaDesign,
|
|
724
724
|
boilerplate: dictionary.content,
|
|
725
725
|
exampleFiles: randomPicks(moduleConstantExampleFiles, Math.min(10, moduleConstantExampleFiles.length))
|
|
726
|
-
}),
|
|
727
|
-
await
|
|
728
|
-
|
|
726
|
+
}), sys, { validate: dictionaryGuide.update.rules });
|
|
727
|
+
await sys.scan();
|
|
728
|
+
sys.log(`Module ${name} created in ${sys.type}s/${sys.name}/lib/${name}`);
|
|
729
729
|
return createPassedPrimitiveReport({
|
|
730
730
|
command: "create-module",
|
|
731
731
|
changedFiles: [
|
|
732
|
-
...moduleChangedFiles(
|
|
733
|
-
...constantWrites.map((write) => sourceFile(
|
|
732
|
+
...moduleChangedFiles(sys, name, files),
|
|
733
|
+
...constantWrites.map((write) => sourceFile(sys, write.filePath, "modify", "AI-assisted module constant source was updated."))
|
|
734
734
|
],
|
|
735
|
-
generatedFiles: generatedFilesForSync(
|
|
736
|
-
target:
|
|
735
|
+
generatedFiles: generatedFilesForSync(sys, "Generated files were refreshed after module creation."),
|
|
736
|
+
target: sys.name
|
|
737
737
|
});
|
|
738
738
|
}
|
|
739
739
|
#getCreatedScalarNames(filePaths) {
|
|
@@ -744,15 +744,15 @@ class ModuleScript extends script("module", [ModuleRunner, PageScript]) {
|
|
|
744
744
|
async removeModule(mod) {
|
|
745
745
|
await this.moduleRunner.removeModule(mod);
|
|
746
746
|
}
|
|
747
|
-
async createService(
|
|
748
|
-
const service = ModuleExecutor.from(
|
|
747
|
+
async createService(sys, name) {
|
|
748
|
+
const service = ModuleExecutor.from(sys, `_${name}`);
|
|
749
749
|
const files = await this.moduleRunner.createService(service);
|
|
750
|
-
await
|
|
750
|
+
await sys.scan();
|
|
751
751
|
return createPassedPrimitiveReport({
|
|
752
752
|
command: "create-service",
|
|
753
|
-
changedFiles: moduleChangedFiles(
|
|
754
|
-
generatedFiles: generatedFilesForSync(
|
|
755
|
-
target:
|
|
753
|
+
changedFiles: moduleChangedFiles(sys, `_${name}`, files),
|
|
754
|
+
generatedFiles: generatedFilesForSync(sys, "Generated files were refreshed after service creation."),
|
|
755
|
+
target: sys.name
|
|
756
756
|
});
|
|
757
757
|
}
|
|
758
758
|
async createTest(workspace, name) {}
|
|
@@ -422,7 +422,7 @@ class HmrWatcher {
|
|
|
422
422
|
this.#unreportedChanges += unreported;
|
|
423
423
|
if (!this.#reportedCompensating) {
|
|
424
424
|
this.#reportedCompensating = true;
|
|
425
|
-
this.#logger.
|
|
425
|
+
this.#logger.verbose(`[hmr] recovered ${unreported} change(s) that fs.watch did not report; Bun coalesces concurrent saves and drops all but one, so changes are resolved by mtime`);
|
|
426
426
|
}
|
|
427
427
|
this.#logger.verbose(`[hmr] mtime scan found ${unreported} change(s) fs.watch never reported (${this.#unreportedChanges} total)`);
|
|
428
428
|
}
|
|
@@ -472,6 +472,8 @@ class WatchRootResolver {
|
|
|
472
472
|
}
|
|
473
473
|
async resolve() {
|
|
474
474
|
const tsconfig = await this.#app.getTsConfig();
|
|
475
|
+
const appDir = path4.resolve(this.#app.cwdPath);
|
|
476
|
+
const appsContainer = path4.dirname(appDir);
|
|
475
477
|
const set = new Set;
|
|
476
478
|
set.add(path4.resolve(`${this.#app.cwdPath}/page`));
|
|
477
479
|
for (const targets of Object.values(tsconfig.compilerOptions.paths ?? {})) {
|
|
@@ -482,8 +484,9 @@ class WatchRootResolver {
|
|
|
482
484
|
continue;
|
|
483
485
|
const cleaned = target.replace(/\/?\*+.*$/, "").replace(/\/[^/]+\.[^/]+$/, "");
|
|
484
486
|
const resolved = path4.resolve(this.#app.workspace.workspaceRoot, cleaned);
|
|
485
|
-
|
|
486
|
-
|
|
487
|
+
const root = resolved === appsContainer ? appDir : resolved;
|
|
488
|
+
if (fs2.existsSync(root))
|
|
489
|
+
set.add(root);
|
|
487
490
|
}
|
|
488
491
|
}
|
|
489
492
|
return [...set];
|
|
@@ -19,12 +19,14 @@ var prepareDevWatchBatch = ({
|
|
|
19
19
|
generatedFiles: indexSync.changedFiles
|
|
20
20
|
});
|
|
21
21
|
if (indexSync.errors.length > 0 && !devPlan.actions.includes("report-error")) {
|
|
22
|
-
|
|
22
|
+
const withReport = [...devPlan.actions, "report-error"];
|
|
23
|
+
devPlan.actions = withReport.sort();
|
|
23
24
|
}
|
|
24
25
|
return {
|
|
25
26
|
files,
|
|
26
27
|
kinds,
|
|
27
28
|
expandedBatch,
|
|
29
|
+
devPlan,
|
|
28
30
|
event: { type: "invalidate", kinds, files, generation, devPlan },
|
|
29
31
|
hasSyncErrors: indexSync.errors.length > 0
|
|
30
32
|
};
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
// pkgs/@akanjs/devkit/recipeScanner.ts
|
|
3
3
|
import { readdir } from "fs/promises";
|
|
4
4
|
import ts from "typescript";
|
|
5
|
-
var
|
|
5
|
+
var collectRecipeSources2 = async (uiDirPath, importFrom, basename = "Recipe") => {
|
|
6
6
|
const read = async (filePath) => {
|
|
7
7
|
const content = await Bun.file(filePath).text().catch(() => "");
|
|
8
8
|
return content ? { path: filePath, content, importFrom } : null;
|
|
@@ -12,7 +12,7 @@ var collectRecipeSources = async (uiDirPath, importFrom, basename = "Recipe") =>
|
|
|
12
12
|
const fromDir = await Promise.all(dirEntries.filter((entry) => entry.endsWith(".ts") && entry !== "index.ts" && !/\.(test|spec)\.ts$/.test(entry)).sort().map((entry) => read(`${uiDirPath}/${basename}/${entry}`)));
|
|
13
13
|
return [flat, ...fromDir].filter((source) => !!source);
|
|
14
14
|
};
|
|
15
|
-
var
|
|
15
|
+
var scanRecipes2 = (sources) => {
|
|
16
16
|
const recipes = [];
|
|
17
17
|
for (const source of sources) {
|
|
18
18
|
const sourceFile = ts.createSourceFile(source.path, source.content, ts.ScriptTarget.Latest, true, ts.ScriptKind.TSX);
|
|
@@ -87,7 +87,7 @@ var isNamed = (name) => ts.isIdentifier(name) || ts.isStringLiteral(name);
|
|
|
87
87
|
var propName = (name) => name.text;
|
|
88
88
|
var DUPLICATE_TOKEN_RATIO = 0.7;
|
|
89
89
|
var MIN_FINGERPRINT_TOKENS = 3;
|
|
90
|
-
var
|
|
90
|
+
var findInlineRecipeDuplicates2 = (recipes, files) => {
|
|
91
91
|
const fingerprints = recipes.map((recipe) => ({ recipe: recipe.name, tokens: (recipe.base ?? "").split(/\s+/).filter(Boolean) })).filter((fingerprint) => fingerprint.tokens.length >= MIN_FINGERPRINT_TOKENS).map((fingerprint) => ({ ...fingerprint, needed: Math.ceil(fingerprint.tokens.length * DUPLICATE_TOKEN_RATIO) }));
|
|
92
92
|
if (fingerprints.length === 0)
|
|
93
93
|
return [];
|
|
@@ -133,4 +133,4 @@ var getLeadingDoc = (fullText, node) => {
|
|
|
133
133
|
return line || undefined;
|
|
134
134
|
};
|
|
135
135
|
|
|
136
|
-
export {
|
|
136
|
+
export { collectRecipeSources2, scanRecipes2, findInlineRecipeDuplicates2 };
|