@akanjs/cli 3.2.0-rc.9 → 3.2.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/.build-stamp +2 -2
- package/CodeAgent-fx6088tv.js +11 -0
- package/{CodeTui-qstk5vpj.js → CodeTui-zee8atsr.js} +822 -666
- package/README.ko.md +7 -0
- package/README.md +7 -0
- package/TunnelShare-9ry4vh0y.js +18 -0
- package/agent.command-x65f2ags.js +61 -0
- package/akanCode.js +12 -12
- package/appExecutor-79azsb2w.js +11 -0
- package/{application.command-m4rq4wc2.js → application.command-azbd1pb2.js} +83 -37
- package/{applicationBuildRunner-df7rx3ra.js → applicationBuildRunner-trfxv3pd.js} +49 -18
- package/buildBatch.proc.js +25 -11
- package/{cloud.command-a0gy0qq2.js → cloud.command-gapp4634.js} +33 -29
- package/cloud.script-3b401efv.js +35 -0
- package/{code.command-5rsdqw8s.js → code.command-5smx61yf.js} +13 -9
- package/context.command-ym5jbkny.js +64 -0
- package/context.runner-kctbfsde.js +34 -0
- package/{dependencyScanner-78sq8m4q.js → dependencyScanner-ge10gb52.js} +2 -2
- package/{devTui-h77zrjv5.js → devTui-rf374y2w.js} +1 -1
- package/{fileSys-zpvt5gtf.js → fileSys-q22646yc.js} +1 -1
- package/{guideline.command-mffxknbr.js → guideline.command-zwypaqsh.js} +9 -5
- package/guidelines/agentRule/agentRule.instruction.md +25 -9
- package/guidelines/akanApi/akanApi.instruction.md +6 -4
- package/guidelines/conventions/core.md +23 -5
- package/guidelines/conventions/rules/app.md +4 -1
- package/guidelines/conventions/rules/page.md +5 -4
- package/guidelines/conventions/rules/ts.md +3 -3
- package/guidelines/errorCodes/errorCodes.instruction.md +165 -0
- package/guidelines/fieldRule/fieldRule.instruction.md +2 -1
- package/guidelines/mcpRule/mcpRule.instruction.md +225 -5
- package/guidelines/pageRule/pageRule.instruction.md +10 -1
- package/guidelines/queryRule/queryRule.instruction.md +3 -1
- package/guidelines/runtimeRule/runtimeRule.instruction.md +14 -8
- package/guidelines/transportRule/transportRule.instruction.md +31 -1
- package/incrementalBuilder.proc.js +577 -411
- package/{index-w15mg3km.js → index-0dm25wvf.js} +1 -1
- package/{index-0gg15zwa.js → index-0s7w2085.js} +6 -6
- package/{index-hj6w4ka1.js → index-1p81ecbz.js} +1 -1
- package/{index-swwjakt0.js → index-275a4r3n.js} +11 -11
- package/{index-j6gc8n14.js → index-2jmvfa62.js} +11 -9
- package/{index-qd7xn2bk.js → index-2ny1e95c.js} +2 -2
- package/{index-exn38bzx.js → index-2yn3r67f.js} +116 -54
- package/{index-34792nh7.js → index-3txdtztz.js} +1 -1
- package/{index-28x1aszt.js → index-41a03gkj.js} +149 -53
- package/{index-2mf1aen9.js → index-4ss4gkv3.js} +2 -2
- package/{index-an76bdrv.js → index-612fdtbk.js} +1 -1
- package/{index-5radqwn2.js → index-67sd09ag.js} +12 -12
- package/{index-0hbtve0a.js → index-6dzjer7p.js} +32 -28
- package/{index-3ghdb7p5.js → index-71y6176j.js} +2777 -3676
- package/{index-xyn02k0w.js → index-78y75t0a.js} +662 -433
- package/index-7wf8snar.js +80 -0
- package/{index-skmtj8rm.js → index-8jtqfye2.js} +27 -10
- package/{index-2mrn1mrg.js → index-9f3reh2y.js} +1 -1
- package/{index-nmvhjn8c.js → index-9wh04mqy.js} +93 -82
- package/{index-xvk2a75m.js → index-a860mx0m.js} +3 -3
- package/{index-5zwr4n6k.js → index-baccvws5.js} +65 -8
- package/{index-yf9wc28h.js → index-bejy9zyc.js} +1 -1
- package/{index-bns3wcpc.js → index-by2tvsq6.js} +1 -1
- package/{index-r0a604h4.js → index-c669pbyb.js} +5 -4
- package/{index-x40bdsca.js → index-dadwp2aw.js} +33 -98
- package/{index-vm0dn0mt.js → index-dmcpetwe.js} +200 -138
- package/{index-43f4h4cm.js → index-ebn9kgea.js} +6 -6
- package/{index-hqv34wzq.js → index-gt8phqpt.js} +10 -10
- package/{index-yckz5t8b.js → index-h901f24n.js} +516 -434
- package/{index-j3v29pq7.js → index-j0wr4e32.js} +219 -175
- package/{index-gcx48get.js → index-j592zfqc.js} +2 -2
- package/{index-grxs6fts.js → index-j6jjmn2r.js} +57 -31
- package/{index-w8yasvpc.js → index-jek2re5k.js} +2136 -2175
- package/{index-ny2k80mv.js → index-jf4vk1s0.js} +9 -2
- package/{index-gxav1bjz.js → index-k6vwww45.js} +9 -9
- package/{index-99qvtff2.js → index-kfvjzk8r.js} +5 -5
- package/{index-j6eeh5d7.js → index-knpm8sdm.js} +5 -5
- package/{index-2r9ff9qm.js → index-nc3br31y.js} +2 -2
- package/{index-35j83zkd.js → index-p5zh7pmc.js} +2 -2
- package/{index-cmg5ngqa.js → index-p7beqww9.js} +2 -2
- package/{index-b4qq3rq0.js → index-rwgqba9p.js} +1 -1
- package/{index-rfzp4pqs.js → index-s885g0jj.js} +3 -3
- package/{index-9p260r4e.js → index-trffs83s.js} +538 -250
- package/{index-k92x3vne.js → index-v7ajmsh3.js} +1 -1
- package/index-w1zexzpx.js +127 -0
- package/{index-h7hehkw6.js → index-xczjdng6.js} +3 -1
- package/{index-39jz41jb.js → index-xs9a3ddt.js} +3 -3
- package/{index-rp4yf32g.js → index-xwwex8rf.js} +36 -29
- package/{index-ra9fvn7s.js → index-ybcb9wc8.js} +74 -38
- package/index-z92zm3wd.js +788 -0
- package/{index-j9790rhk.js → index-z96ks033.js} +1509 -1121
- package/index-zfnz878d.js +30 -0
- package/{index-2vgv7fs7.js → index-zmd9xxgd.js} +727 -693
- package/{index-ygdbn9jn.js → index-zyb0ebm4.js} +1 -1
- package/index.js +28 -24
- package/libExecutor-jc6f8hm6.js +10 -0
- package/{library.command-bmd7zc5m.js → library.command-nxvesvhb.js} +12 -5
- package/{localRegistry.command-y6en1599.js → localRegistry.command-xz62e4ng.js} +29 -24
- package/{module.command-7exfffqw.js → module.command-aaws9byg.js} +11 -7
- package/{package.command-adskw2rj.js → package.command-j7hv26p0.js} +14 -10
- package/package.json +8 -8
- package/{page.command-dw01272p.js → page.command-7yffs7n9.js} +8 -4
- package/{pipeline.command-0b1r3y5r.js → pipeline.command-7yk0zcng.js} +15 -9
- package/pkgExecutor-arxmvx4t.js +10 -0
- package/{primitive.command-byw6vc04.js → primitive.command-7a1pt715.js} +12 -8
- package/{projectTypecheck-kkrpq60a.js → projectTypecheck-f4qhbecd.js} +1 -1
- package/{prompter-qrwx1p17.js → prompter-qyggfhqd.js} +2 -2
- package/{quality.command-6rqnhzct.js → quality.command-c6mvrjh1.js} +25 -16
- package/{recipeScanner-4b69ybe0.js → recipeScanner-rrx69awy.js} +1 -1
- package/{repair.command-rw5zymak.js → repair.command-093adzt9.js} +12 -8
- package/{routeSourceValidator-4h947v7c.js → routeSourceValidator-8n6j1vn7.js} +4 -2
- package/{scalar.command-2dyp9nh9.js → scalar.command-2ex84spb.js} +10 -6
- package/skills/akan-debug/SKILL.md +8 -5
- package/skills/akan-err/SKILL.md +7 -0
- package/skills/akan-mcp/SKILL.md +19 -1
- package/skills/akan-scaffold/SKILL.md +1 -1
- package/skills/akan-validate/SKILL.md +3 -3
- package/{subspace.command-111ynwv1.js → subspace.command-4n4n4jpv.js} +32 -24
- package/templates/app/page/_layout.tsx +13 -0
- package/templates/app/page/styles.css.template +40 -0
- package/templates/appSample/page/_index.tsx +9 -9
- package/templates/appSample/page/_layout.tsx +1 -0
- package/templates/appSample/page/styles.css.template +40 -5
- package/templates/appSample/ui/Recipe/jellyButton.ts +1 -1
- package/templates/biomeForm.ts +1 -1
- package/templates/env/_env.server.type.ts +1 -1
- package/templates/facetIndex/index.ts +2 -37
- package/templates/lib/sig.ts +0 -4
- package/templates/lib/useClient.ts +1 -1
- package/templates/workspaceRoot/.devcontainer/devcontainer.json.template +1 -1
- package/templates/workspaceRoot/AGENTS.md.template +2 -1
- package/templates/workspaceRoot/README.ts +4 -2
- package/{tunnel.command-2gcpfbdj.js → tunnel.command-f7ep1qfa.js} +17 -13
- package/{typeChecker-s640r6c0.js → typeChecker-7jt6abrs.js} +1 -1
- package/typecheck.proc.js +3 -2
- package/{verify.command-djgs86ma.js → verify.command-zrkxnvct.js} +21 -17
- package/{workflow.command-n0k2mxr5.js → workflow.command-ks16jegk.js} +21 -14
- package/{workspace.command-fh1qwxfx.js → workspace.command-ahhfpaag.js} +60 -54
- package/CodeAgent-x2p3a3e0.js +0 -11
- package/TunnelShare-c4xsfzg5.js +0 -15
- package/agent.command-9et2e27p.js +0 -52
- package/cloud.script-xze4zh7n.js +0 -31
- package/context.command-rk1dwrg4.js +0 -57
- package/context.runner-83ky5m1b.js +0 -30
- /package/templates/{appSample → app}/public/fonts/Pretendard-Bold.woff2 +0 -0
- /package/templates/{appSample → app}/public/fonts/Pretendard-Medium.woff2 +0 -0
- /package/templates/{appSample → app}/public/fonts/Pretendard-Regular.woff2 +0 -0
- /package/templates/{appSample → app}/public/fonts/Pretendard-SemiBold.woff2 +0 -0
|
@@ -0,0 +1,127 @@
|
|
|
1
|
+
// @bun
|
|
2
|
+
import {
|
|
3
|
+
execEmoji,
|
|
4
|
+
Executor,
|
|
5
|
+
PkgInfo,
|
|
6
|
+
WorkspaceExecutor
|
|
7
|
+
} from "./index-71y6176j.js";
|
|
8
|
+
|
|
9
|
+
// pkgs/@akanjs/devkit/executors/pkgExecutor.ts
|
|
10
|
+
import path from "path";
|
|
11
|
+
class PkgExecutor2 extends Executor {
|
|
12
|
+
workspace;
|
|
13
|
+
name;
|
|
14
|
+
dist;
|
|
15
|
+
emoji = execEmoji.pkg;
|
|
16
|
+
constructor({ workspace = WorkspaceExecutor.fromRoot(), name }) {
|
|
17
|
+
super(name, `${workspace.workspaceRoot}/pkgs/${name}`);
|
|
18
|
+
this.workspace = workspace;
|
|
19
|
+
this.name = name;
|
|
20
|
+
this.dist = new Executor(`dist/${name}`, `${this.workspace.workspaceRoot}/dist/pkgs/${name}`);
|
|
21
|
+
}
|
|
22
|
+
static from(executor, name) {
|
|
23
|
+
return new PkgExecutor2({ workspace: executor instanceof WorkspaceExecutor ? executor : executor.workspace, name });
|
|
24
|
+
}
|
|
25
|
+
#scanInfo = null;
|
|
26
|
+
async scan({ refresh } = {}) {
|
|
27
|
+
if (this.#scanInfo && !refresh)
|
|
28
|
+
return this.#scanInfo;
|
|
29
|
+
const scanInfo = await PkgInfo.fromExecutor(this, { refresh });
|
|
30
|
+
this.#scanInfo = scanInfo;
|
|
31
|
+
return scanInfo;
|
|
32
|
+
}
|
|
33
|
+
async#getDependencyVersion(rootPackageJson, dep) {
|
|
34
|
+
const rootDeps = {
|
|
35
|
+
...rootPackageJson.dependencies,
|
|
36
|
+
...rootPackageJson.devDependencies
|
|
37
|
+
};
|
|
38
|
+
const rootVersion = rootDeps[dep];
|
|
39
|
+
if (rootVersion)
|
|
40
|
+
return rootVersion;
|
|
41
|
+
const overrideVersion = rootPackageJson.overrides?.[dep];
|
|
42
|
+
if (typeof overrideVersion === "string")
|
|
43
|
+
return overrideVersion;
|
|
44
|
+
try {
|
|
45
|
+
const packageJsonPath = `pkgs/${dep}/package.json`;
|
|
46
|
+
if (!await Bun.file(path.join(this.workspace.workspaceRoot, packageJsonPath)).exists())
|
|
47
|
+
return;
|
|
48
|
+
const packageJson = await this.workspace.readJson(packageJsonPath);
|
|
49
|
+
if (packageJson.name === dep)
|
|
50
|
+
return packageJson.version;
|
|
51
|
+
} catch {
|
|
52
|
+
return;
|
|
53
|
+
}
|
|
54
|
+
}
|
|
55
|
+
async#toDependencyMap(rootPackageJson, dependencies = [], devDependencies = []) {
|
|
56
|
+
const dependencyNames = [...new Set(dependencies)].sort();
|
|
57
|
+
const devDependencyNames = [...new Set(devDependencies)].filter((dep) => !dependencyNames.includes(dep)).sort((a, b) => a < b ? -1 : a > b ? 1 : 0);
|
|
58
|
+
const dependencyVersions = new Map;
|
|
59
|
+
const missingDeps = [];
|
|
60
|
+
for (const dep of [...dependencyNames, ...devDependencyNames]) {
|
|
61
|
+
const version = await this.#getDependencyVersion(rootPackageJson, dep);
|
|
62
|
+
if (version)
|
|
63
|
+
dependencyVersions.set(dep, version);
|
|
64
|
+
else
|
|
65
|
+
missingDeps.push(dep);
|
|
66
|
+
}
|
|
67
|
+
if (missingDeps.length > 0)
|
|
68
|
+
throw new Error(`Missing dependency versions in root package.json: ${missingDeps.join(", ")}`);
|
|
69
|
+
const toDependencyMap = (names) => Object.fromEntries(names.map((dep) => [dep, dependencyVersions.get(dep)]));
|
|
70
|
+
return { dependencies: toDependencyMap(dependencyNames), devDependencies: toDependencyMap(devDependencyNames) };
|
|
71
|
+
}
|
|
72
|
+
async updatePackageJsonDependencies(dependencies = [], devDependencies = []) {
|
|
73
|
+
const [rootPackageJson, pkgJson] = await Promise.all([this.workspace.getPackageJson(), this.getPackageJson()]);
|
|
74
|
+
const dependencyMaps = await this.#toDependencyMap(rootPackageJson, dependencies, devDependencies);
|
|
75
|
+
const newPkgJson = {
|
|
76
|
+
...pkgJson,
|
|
77
|
+
...dependencyMaps
|
|
78
|
+
};
|
|
79
|
+
await this.writeJson("package.json", newPkgJson);
|
|
80
|
+
return newPkgJson;
|
|
81
|
+
}
|
|
82
|
+
async generateDistPackageJson(dependencies = [], devDependencies = []) {
|
|
83
|
+
const [rootPackageJson, pkgJson] = await Promise.all([this.workspace.getPackageJson(), this.getPackageJson()]);
|
|
84
|
+
const dependencyMaps = await this.#toDependencyMap(rootPackageJson, dependencies, devDependencies);
|
|
85
|
+
const distPkgJson = {
|
|
86
|
+
...pkgJson,
|
|
87
|
+
type: "module",
|
|
88
|
+
exports: {
|
|
89
|
+
...pkgJson.exports,
|
|
90
|
+
".": {
|
|
91
|
+
import: "./index.ts",
|
|
92
|
+
types: "./index.ts",
|
|
93
|
+
default: "./index.ts"
|
|
94
|
+
}
|
|
95
|
+
},
|
|
96
|
+
engines: { bun: ">=1.4.4" },
|
|
97
|
+
...dependencyMaps
|
|
98
|
+
};
|
|
99
|
+
await Promise.all([this.dist.writeJson("package.json", distPkgJson), this.writeJson("package.json", distPkgJson)]);
|
|
100
|
+
return distPkgJson;
|
|
101
|
+
}
|
|
102
|
+
async build() {
|
|
103
|
+
await Bun.build({
|
|
104
|
+
root: this.cwdPath,
|
|
105
|
+
entrypoints: [`${this.cwdPath}/index.ts`],
|
|
106
|
+
splitting: false,
|
|
107
|
+
target: "bun"
|
|
108
|
+
});
|
|
109
|
+
await this.cp(`${this.cwdPath}/dist`, this.dist.cwdPath);
|
|
110
|
+
}
|
|
111
|
+
async generateTsconfigJson() {
|
|
112
|
+
const [rootTsconfig, pkgTsconfig] = await Promise.all([this.workspace.getTsConfig(), this.getTsConfig()]);
|
|
113
|
+
const tsconfig = {
|
|
114
|
+
...rootTsconfig,
|
|
115
|
+
...pkgTsconfig,
|
|
116
|
+
compilerOptions: {
|
|
117
|
+
...rootTsconfig.compilerOptions,
|
|
118
|
+
...pkgTsconfig.compilerOptions,
|
|
119
|
+
paths: {}
|
|
120
|
+
}
|
|
121
|
+
};
|
|
122
|
+
await this.dist.writeJson("tsconfig.json", tsconfig);
|
|
123
|
+
return tsconfig;
|
|
124
|
+
}
|
|
125
|
+
}
|
|
126
|
+
|
|
127
|
+
export { PkgExecutor2 };
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
// @bun
|
|
2
|
-
// pkgs/@akanjs/devkit/subspaceConfig.ts
|
|
2
|
+
// pkgs/@akanjs/devkit/subspace/subspaceConfig.ts
|
|
3
3
|
class SubspaceConfig {
|
|
4
4
|
static source = "subspace in the workspace root akan.config.ts";
|
|
5
5
|
static defaultPushableBranches = ["main", "develop", "debug"];
|
|
@@ -24,6 +24,8 @@ class SubspaceConfig {
|
|
|
24
24
|
for (const subspace of this.subspaces) {
|
|
25
25
|
if (!subspace.name || !subspace.repo)
|
|
26
26
|
throw new Error(`${SubspaceConfig.source}: every subspace needs a name and a repo`);
|
|
27
|
+
if (subspace.repo.startsWith("-"))
|
|
28
|
+
throw new Error(`${SubspaceConfig.source}: subspace "${subspace.name}" repo "${subspace.repo}" reads as a git option`);
|
|
27
29
|
if (!SubspaceConfig.namePattern.test(subspace.name))
|
|
28
30
|
throw new Error(`${SubspaceConfig.source}: subspace name "${subspace.name}" takes letters, digits, ".", "_" and "-", starting with a letter or digit`);
|
|
29
31
|
if (seenNames.has(subspace.name))
|
|
@@ -2,12 +2,12 @@
|
|
|
2
2
|
import {
|
|
3
3
|
AkanGraphDiff,
|
|
4
4
|
AkanIndex
|
|
5
|
-
} from "./index-
|
|
5
|
+
} from "./index-trffs83s.js";
|
|
6
6
|
import {
|
|
7
7
|
GitRevision
|
|
8
|
-
} from "./index-
|
|
8
|
+
} from "./index-zyb0ebm4.js";
|
|
9
9
|
|
|
10
|
-
// pkgs/@akanjs/devkit/workspaceGraph.ts
|
|
10
|
+
// pkgs/@akanjs/devkit/workspace/workspaceGraph.ts
|
|
11
11
|
import { readFile } from "fs/promises";
|
|
12
12
|
import path from "path";
|
|
13
13
|
import ts from "typescript";
|
|
@@ -6,29 +6,32 @@ import {
|
|
|
6
6
|
CloudApi,
|
|
7
7
|
CloudUpdates,
|
|
8
8
|
PipelineSecrets
|
|
9
|
-
} from "./index-
|
|
9
|
+
} from "./index-s885g0jj.js";
|
|
10
10
|
import {
|
|
11
11
|
resolveMobileTargets
|
|
12
12
|
} from "./index-m9jj544v.js";
|
|
13
13
|
import {
|
|
14
|
-
WorkspaceExecutor
|
|
15
|
-
|
|
16
|
-
|
|
14
|
+
WorkspaceExecutor
|
|
15
|
+
} from "./index-71y6176j.js";
|
|
16
|
+
import {
|
|
17
|
+
AppExecutor2
|
|
18
|
+
} from "./index-z92zm3wd.js";
|
|
17
19
|
import {
|
|
18
20
|
NativeApp
|
|
19
|
-
} from "./index-
|
|
21
|
+
} from "./index-ebn9kgea.js";
|
|
20
22
|
import {
|
|
21
23
|
runner,
|
|
22
24
|
assertPromptable
|
|
23
|
-
} from "./index-
|
|
25
|
+
} from "./index-2yn3r67f.js";
|
|
24
26
|
import {
|
|
25
27
|
getNpmRegistryUrl,
|
|
26
28
|
getPublishedVersions,
|
|
27
|
-
getLatestPackageVersion
|
|
28
|
-
|
|
29
|
+
getLatestPackageVersion,
|
|
30
|
+
getPublishedPeerDependencies
|
|
31
|
+
} from "./index-jf4vk1s0.js";
|
|
29
32
|
import {
|
|
30
33
|
SubspaceConfig
|
|
31
|
-
} from "./index-
|
|
34
|
+
} from "./index-xczjdng6.js";
|
|
32
35
|
import {
|
|
33
36
|
openBrowser
|
|
34
37
|
} from "./index-9dp031by.js";
|
|
@@ -304,7 +307,7 @@ class LinuxDockerTarget extends PlatformTestTarget {
|
|
|
304
307
|
if (started.exitCode !== 0)
|
|
305
308
|
throw new Error(`docker run failed: ${started.stderr.trim()}`);
|
|
306
309
|
this.#container = container;
|
|
307
|
-
const extract = await this.exec(`tar -xf /io/${path3.basename(context.snapshot.tarPath)} -C /w && cp /io-env /w/.env && git -C /w init -q`, path3.join(context.logDir, this.platform, "extract.log"), PlatformTestTarget.installIdleMs);
|
|
310
|
+
const extract = await this.exec(`tar -xf /io/${path3.basename(context.snapshot.tarPath)} -C /w && cp /io-env /w/.env && git -C /w init -q && git -C /w add -A`, path3.join(context.logDir, this.platform, "extract.log"), PlatformTestTarget.installIdleMs);
|
|
308
311
|
if (extract.exitCode !== 0)
|
|
309
312
|
throw new Error("extracting the snapshot into the container failed");
|
|
310
313
|
}
|
|
@@ -473,7 +476,7 @@ class WindowsSshTarget extends PlatformTestTarget {
|
|
|
473
476
|
if (copied.exitCode !== 0)
|
|
474
477
|
throw new Error(`scp ${remoteName} failed: ${copied.stderr.trim()}`);
|
|
475
478
|
}
|
|
476
|
-
const extract = await this.exec("tar -xf ..\\src.tar && copy /Y ..\\env .env >nul && git init -q", path5.join(context.logDir, this.platform, "extract.log"), PlatformTestTarget.installIdleMs);
|
|
479
|
+
const extract = await this.exec("tar -xf ..\\src.tar && copy /Y ..\\env .env >nul && git init -q && git add -A", path5.join(context.logDir, this.platform, "extract.log"), PlatformTestTarget.installIdleMs);
|
|
477
480
|
if (extract.exitCode !== 0)
|
|
478
481
|
throw new Error("extracting the snapshot on the Windows host failed");
|
|
479
482
|
}
|
|
@@ -715,7 +718,7 @@ class EnvArchive {
|
|
|
715
718
|
static async#secretGlobs(workspace) {
|
|
716
719
|
const [appNames] = await workspace.getExecs();
|
|
717
720
|
const entries = await Promise.all(appNames.map(async (appName) => {
|
|
718
|
-
const { secrets = [] } = await
|
|
721
|
+
const { secrets = [] } = await AppExecutor2.from(workspace, appName).getConfig();
|
|
719
722
|
return [appName, secrets.map((pattern) => new Bun.Glob(pattern))];
|
|
720
723
|
}));
|
|
721
724
|
return new Map(entries);
|
|
@@ -1240,27 +1243,31 @@ ${run.format(results)}
|
|
|
1240
1243
|
}
|
|
1241
1244
|
async update(workspace, tag = "latest", { registryUrl } = {}) {
|
|
1242
1245
|
const registry = registryUrl ? getNpmRegistryUrl(registryUrl) : undefined;
|
|
1243
|
-
const
|
|
1244
|
-
const
|
|
1245
|
-
const
|
|
1246
|
-
|
|
1247
|
-
|
|
1248
|
-
|
|
1249
|
-
|
|
1250
|
-
|
|
1251
|
-
|
|
1252
|
-
]);
|
|
1246
|
+
const hasPackageJson = await workspace.exists("package.json");
|
|
1247
|
+
const version = hasPackageJson ? await getLatestPackageVersion("akanjs", tag, registry) : tag;
|
|
1248
|
+
const peers = hasPackageJson ? await getPublishedPeerDependencies("akanjs", version, registry) : null;
|
|
1249
|
+
await Promise.all([
|
|
1250
|
+
workspace.spawn("bun", ["add", "-g", `@akanjs/cli@${version}`, ...this.#getRegistryArgs(registry)], {
|
|
1251
|
+
env: this.#getRegistryEnv(registry)
|
|
1252
|
+
}),
|
|
1253
|
+
peers && this.#updateAkanPkgs(workspace, version, peers, registry)
|
|
1254
|
+
]);
|
|
1253
1255
|
}
|
|
1254
|
-
async#updateAkanPkgs(workspace,
|
|
1255
|
-
const latestPublishedVersion = await getLatestPackageVersion("akanjs", tag, registryUrl);
|
|
1256
|
+
async#updateAkanPkgs(workspace, akanVersion, peers, registryUrl) {
|
|
1256
1257
|
const rootPackageJson = await workspace.getPackageJson();
|
|
1257
1258
|
if (!rootPackageJson.dependencies)
|
|
1258
1259
|
throw new Error("No dependencies found in package.json");
|
|
1259
|
-
|
|
1260
|
+
const pins = Object.fromEntries(["akanjs", "@akanjs/devkit", "@akanjs/cli", "@akanjs/language"].map((name) => [name, akanVersion]));
|
|
1261
|
+
for (const peer of ["react", "react-dom", "react-server-dom-webpack"]) {
|
|
1262
|
+
const version = peers[peer];
|
|
1263
|
+
if (version)
|
|
1264
|
+
pins[peer] = version;
|
|
1265
|
+
}
|
|
1266
|
+
for (const [name, version] of Object.entries(pins)) {
|
|
1260
1267
|
if (rootPackageJson.dependencies[name])
|
|
1261
|
-
rootPackageJson.dependencies[name] =
|
|
1268
|
+
rootPackageJson.dependencies[name] = version;
|
|
1262
1269
|
if (rootPackageJson.devDependencies?.[name])
|
|
1263
|
-
rootPackageJson.devDependencies[name] =
|
|
1270
|
+
rootPackageJson.devDependencies[name] = version;
|
|
1264
1271
|
}
|
|
1265
1272
|
await workspace.setPackageJson(rootPackageJson);
|
|
1266
1273
|
await workspace.spawn("bun", ["install", ...this.#getRegistryArgs(registryUrl)], {
|
|
@@ -1355,7 +1362,7 @@ ${run.format(results)}
|
|
|
1355
1362
|
}
|
|
1356
1363
|
async#gatherCustomSecretFiles(workspace, appNames) {
|
|
1357
1364
|
const secretPaths = await Promise.all(appNames.map(async (appName) => {
|
|
1358
|
-
const config = await
|
|
1365
|
+
const config = await AppExecutor2.from(workspace, appName).getConfig();
|
|
1359
1366
|
const secretGlobs = config.secrets ?? [];
|
|
1360
1367
|
if (secretGlobs.length === 0)
|
|
1361
1368
|
return [];
|
|
@@ -1439,7 +1446,7 @@ ${run.format(results)}
|
|
|
1439
1446
|
}
|
|
1440
1447
|
async#syncSecretGitignore(workspace, appNames) {
|
|
1441
1448
|
const patterns = (await Promise.all(appNames.map(async (appName) => {
|
|
1442
|
-
const config = await
|
|
1449
|
+
const config = await AppExecutor2.from(workspace, appName).getConfig();
|
|
1443
1450
|
return (config.secrets ?? []).map((pattern) => `apps/${appName}/${pattern.replace(/^\/+/, "")}`);
|
|
1444
1451
|
}))).flat();
|
|
1445
1452
|
const uniquePatterns = [...new Set(patterns)].sort();
|
|
@@ -1,22 +1,31 @@
|
|
|
1
1
|
// @bun
|
|
2
2
|
import {
|
|
3
3
|
ApplicationBuildReporter
|
|
4
|
-
} from "./index-
|
|
4
|
+
} from "./index-dmcpetwe.js";
|
|
5
5
|
import {
|
|
6
6
|
parseBiomeReport,
|
|
7
7
|
Linter,
|
|
8
|
-
ProjectTypecheck2
|
|
9
|
-
|
|
10
|
-
LibExecutor,
|
|
11
|
-
PkgExecutor
|
|
12
|
-
} from "./index-3ghdb7p5.js";
|
|
8
|
+
ProjectTypecheck2
|
|
9
|
+
} from "./index-71y6176j.js";
|
|
13
10
|
import {
|
|
14
11
|
TypecheckFailure
|
|
15
12
|
} from "./index-j4yvgfhr.js";
|
|
13
|
+
import {
|
|
14
|
+
AppExecutor2
|
|
15
|
+
} from "./index-z92zm3wd.js";
|
|
16
|
+
import {
|
|
17
|
+
LibExecutor2
|
|
18
|
+
} from "./index-zfnz878d.js";
|
|
19
|
+
import {
|
|
20
|
+
PkgExecutor2
|
|
21
|
+
} from "./index-w1zexzpx.js";
|
|
16
22
|
import {
|
|
17
23
|
WorkspaceRunner,
|
|
18
24
|
AkanQualityScanner
|
|
19
|
-
} from "./index-
|
|
25
|
+
} from "./index-78y75t0a.js";
|
|
26
|
+
import {
|
|
27
|
+
VerifyScope
|
|
28
|
+
} from "./index-z96ks033.js";
|
|
20
29
|
|
|
21
30
|
// pkgs/@akanjs/cli/verify/verifyComments.ts
|
|
22
31
|
import { existsSync } from "fs";
|
|
@@ -27,6 +36,7 @@ class VerifyComments {
|
|
|
27
36
|
static fix = "keep only a fact the code cannot say (vendor quirk, constraint, security, domain meaning, rejected alternative); delete the rest";
|
|
28
37
|
static #codeFile = /\.[cm]?[jt]sx?$/;
|
|
29
38
|
static #directive = /^(\/\/\/?|\/\*+)\s*(biome-ignore|@ts-|eslint-|prettier-ignore|#region|#endregion|<reference|[#@]__PURE__|@__NO_SIDE_EFFECTS__)/;
|
|
39
|
+
static #trackedTodo = /^(\/\/|\/\*+)\s*TODO:?\s*https?:\/\/\S[^\n]*$/;
|
|
30
40
|
static #typescriptLoad;
|
|
31
41
|
static #templateCommentsLoad;
|
|
32
42
|
static #loadTypescript() {
|
|
@@ -51,6 +61,8 @@ class VerifyComments {
|
|
|
51
61
|
for (const comment of VerifyComments.commentsOf(typescript, file, text)) {
|
|
52
62
|
if (VerifyComments.#directive.test(comment.text))
|
|
53
63
|
continue;
|
|
64
|
+
if (VerifyComments.#trackedTodo.test(comment.text))
|
|
65
|
+
continue;
|
|
54
66
|
if (VerifyComments.#scaffolded(comment, templateComments))
|
|
55
67
|
continue;
|
|
56
68
|
if (lines && !VerifyComments.#touches(comment, lines))
|
|
@@ -187,6 +199,7 @@ class VerifyComments {
|
|
|
187
199
|
|
|
188
200
|
// pkgs/@akanjs/cli/verify/verifyPipeline.ts
|
|
189
201
|
import { existsSync as existsSync4 } from "fs";
|
|
202
|
+
import os from "os";
|
|
190
203
|
import path5 from "path";
|
|
191
204
|
|
|
192
205
|
// pkgs/@akanjs/cli/verify/verifyDiagnostics.ts
|
|
@@ -560,6 +573,10 @@ class VerifyStyleClasses {
|
|
|
560
573
|
|
|
561
574
|
// pkgs/@akanjs/cli/verify/verifyPipeline.ts
|
|
562
575
|
class VerifyPipeline {
|
|
576
|
+
static concurrencyOf(cpus, memoryBytes) {
|
|
577
|
+
return Math.max(1, Math.min(4, Math.max(2, cpus - 1), Math.floor(memoryBytes / 2 ** 32)));
|
|
578
|
+
}
|
|
579
|
+
static #concurrency = VerifyPipeline.concurrencyOf(os.availableParallelism(), os.totalmem());
|
|
563
580
|
#workspace;
|
|
564
581
|
#workspaceRunner;
|
|
565
582
|
#applicationRunner;
|
|
@@ -573,20 +590,22 @@ class VerifyPipeline {
|
|
|
573
590
|
get #root() {
|
|
574
591
|
return this.#workspace.workspaceRoot;
|
|
575
592
|
}
|
|
576
|
-
async run(
|
|
593
|
+
async run(changed, { lintOnly = false, build = true } = {}) {
|
|
577
594
|
const startedAt = performance.now();
|
|
595
|
+
const scope = lintOnly ? changed : await this.#withDependents(changed);
|
|
578
596
|
const systems = scope.targets.filter((target) => target.type !== "pkg");
|
|
597
|
+
const edited = scope.targets.filter((target) => !target.dependent);
|
|
579
598
|
if (!lintOnly)
|
|
580
599
|
await this.#each("sync", systems, (target) => this.#sync(target));
|
|
581
600
|
const synced = !this.#failed("sync");
|
|
582
601
|
const renames = new Map;
|
|
583
|
-
for (const target of
|
|
602
|
+
for (const target of edited.filter((target) => target.type !== "pkg"))
|
|
584
603
|
renames.set(target, await VerifyPrivateMethods.fix(this.#root, target.dir, target.files).catch(() => new Map));
|
|
585
604
|
await Promise.all([
|
|
586
|
-
this.#each("lint",
|
|
587
|
-
lintOnly || !synced ? null : this.#each("typecheck", scope.targets, (target) => this.#typecheck(target))
|
|
605
|
+
this.#each("lint", edited, (target) => this.#lint(target, { comments: !lintOnly, rewritten: renames.get(target) ?? new Map }), VerifyPipeline.#concurrency),
|
|
606
|
+
lintOnly || !synced ? null : this.#each("typecheck", scope.targets, (target) => this.#typecheck(target), VerifyPipeline.#concurrency)
|
|
588
607
|
]);
|
|
589
|
-
const apps =
|
|
608
|
+
const apps = edited.filter((target) => target.type === "app");
|
|
590
609
|
const clean = !this.#diagnostics.some((diagnostic) => diagnostic.severity === "error");
|
|
591
610
|
if (!lintOnly && build && apps.length) {
|
|
592
611
|
if (clean)
|
|
@@ -604,20 +623,34 @@ class VerifyPipeline {
|
|
|
604
623
|
diagnostics: this.#diagnostics
|
|
605
624
|
};
|
|
606
625
|
}
|
|
607
|
-
async#
|
|
626
|
+
async#withDependents(scope) {
|
|
627
|
+
if (!scope.changedLibs.length)
|
|
628
|
+
return scope;
|
|
629
|
+
const [apps, libs, pkgs] = await this.#workspace.getExecs();
|
|
630
|
+
const names = { apps, libs, pkgs };
|
|
631
|
+
return scope.withDependents(names, await VerifyScope.libDepsIn(this.#root, names));
|
|
632
|
+
}
|
|
633
|
+
async#each(name, items, step, concurrency = 1) {
|
|
608
634
|
if (!items.length)
|
|
609
635
|
return;
|
|
610
636
|
const startedAt = performance.now();
|
|
611
|
-
|
|
612
|
-
let
|
|
613
|
-
|
|
614
|
-
|
|
615
|
-
|
|
616
|
-
|
|
617
|
-
|
|
618
|
-
|
|
619
|
-
|
|
620
|
-
}
|
|
637
|
+
const outcomes = [];
|
|
638
|
+
let next = 0;
|
|
639
|
+
const worker = async () => {
|
|
640
|
+
while (next < items.length) {
|
|
641
|
+
const idx = next++;
|
|
642
|
+
outcomes[idx] = await step(items[idx]).catch((error) => ({
|
|
643
|
+
diagnostics: [VerifyDiagnostics.fromMessage(name, ApplicationBuildReporter.formatError(error, this.#root))]
|
|
644
|
+
}));
|
|
645
|
+
}
|
|
646
|
+
};
|
|
647
|
+
await Promise.all(Array.from({ length: Math.min(concurrency, items.length) }, worker));
|
|
648
|
+
const fixed = outcomes.reduce((sum, outcome) => sum + (outcome.fixed ?? 0), 0);
|
|
649
|
+
const diagnostics = [
|
|
650
|
+
...new Map(outcomes.flatMap((outcome) => outcome.diagnostics).map((entry) => [JSON.stringify(entry), entry])).values()
|
|
651
|
+
];
|
|
652
|
+
this.#diagnostics.push(...diagnostics);
|
|
653
|
+
const failed = diagnostics.some((diagnostic) => diagnostic.severity === "error");
|
|
621
654
|
const ms = Math.round(performance.now() - startedAt);
|
|
622
655
|
this.#steps.set(name, { name, status: failed ? "fail" : "pass", ms, fixed });
|
|
623
656
|
}
|
|
@@ -629,9 +662,9 @@ class VerifyPipeline {
|
|
|
629
662
|
}
|
|
630
663
|
async#sync(target) {
|
|
631
664
|
if (target.type === "app")
|
|
632
|
-
await
|
|
665
|
+
await AppExecutor2.from(this.#workspace, target.name).scanSync();
|
|
633
666
|
else
|
|
634
|
-
await
|
|
667
|
+
await LibExecutor2.from(this.#workspace, target.name).scan();
|
|
635
668
|
return { diagnostics: [] };
|
|
636
669
|
}
|
|
637
670
|
async#lint(target, { comments, rewritten }) {
|
|
@@ -696,12 +729,12 @@ class VerifyPipeline {
|
|
|
696
729
|
async#typecheck(target) {
|
|
697
730
|
try {
|
|
698
731
|
if (target.type === "app")
|
|
699
|
-
await this.#applicationRunner.typecheck(
|
|
732
|
+
await this.#applicationRunner.typecheck(AppExecutor2.from(this.#workspace, target.name), {
|
|
700
733
|
tests: true,
|
|
701
734
|
report: "records"
|
|
702
735
|
});
|
|
703
736
|
else if (target.type === "lib")
|
|
704
|
-
await this.#applicationRunner.typecheckLibrary(
|
|
737
|
+
await this.#applicationRunner.typecheckLibrary(LibExecutor2.from(this.#workspace, target.name), {
|
|
705
738
|
tests: true,
|
|
706
739
|
report: "records"
|
|
707
740
|
});
|
|
@@ -709,7 +742,7 @@ class VerifyPipeline {
|
|
|
709
742
|
const tsconfigPath = path5.join(this.#root, target.dir, "tsconfig.json");
|
|
710
743
|
if (!existsSync4(tsconfigPath))
|
|
711
744
|
return { diagnostics: [] };
|
|
712
|
-
await new ProjectTypecheck2(path5.join(this.#root, target.dir), this.#root, process.env).
|
|
745
|
+
await new ProjectTypecheck2(path5.join(this.#root, target.dir), this.#root, process.env).checkIncremental(tsconfigPath, path5.join(this.#root, ".akan", "typecheck", target.dir), "records");
|
|
713
746
|
}
|
|
714
747
|
return { diagnostics: [] };
|
|
715
748
|
} catch (error) {
|
|
@@ -719,20 +752,20 @@ class VerifyPipeline {
|
|
|
719
752
|
}
|
|
720
753
|
}
|
|
721
754
|
async#build(target) {
|
|
722
|
-
const { routeJsWarnings = [] } = await this.#applicationRunner.build(
|
|
755
|
+
const { routeJsWarnings = [] } = await this.#applicationRunner.build(AppExecutor2.from(this.#workspace, target.name), { verify: true });
|
|
723
756
|
return { diagnostics: routeJsWarnings.map((warning) => VerifyDiagnostics.fromRouteJsBudget(warning)) };
|
|
724
757
|
}
|
|
725
758
|
async#ssr(scope) {
|
|
726
|
-
const
|
|
727
|
-
const warnings =
|
|
759
|
+
const dirs = scope.targets.filter((target) => target.type !== "pkg" && target.files.some((file) => file.endsWith(".tsx"))).map((target) => target.dir);
|
|
760
|
+
const warnings = await new AkanQualityScanner().scanSsr(this.#root, dirs);
|
|
728
761
|
return { diagnostics: VerifyDiagnostics.fromQuality(warnings, scope.changedFiles) };
|
|
729
762
|
}
|
|
730
763
|
#execOf(target) {
|
|
731
764
|
if (target.type === "app")
|
|
732
|
-
return
|
|
765
|
+
return AppExecutor2.from(this.#workspace, target.name);
|
|
733
766
|
if (target.type === "lib")
|
|
734
|
-
return
|
|
735
|
-
return
|
|
767
|
+
return LibExecutor2.from(this.#workspace, target.name);
|
|
768
|
+
return PkgExecutor2.from(this.#workspace, target.name);
|
|
736
769
|
}
|
|
737
770
|
}
|
|
738
771
|
|
|
@@ -753,18 +786,21 @@ class VerifyReport {
|
|
|
753
786
|
static #header(result) {
|
|
754
787
|
const ran = result.steps.filter((step) => step.name !== "sync" || step.status === "fail");
|
|
755
788
|
const fixed = result.steps.reduce((sum, step) => sum + step.fixed, 0);
|
|
756
|
-
const seconds =
|
|
789
|
+
const seconds = VerifyReport.#seconds(result.ms);
|
|
757
790
|
const fixedNote = fixed ? `fixed ${fixed} file${fixed === 1 ? "" : "s"}` : null;
|
|
758
|
-
const steps = result.ok ? ran.filter((step) => step.status === "pass").map((step) => step.name).join(" ") : ran.map((step) => VerifyReport.#stepLabel(step, result.diagnostics)).join(" \xB7 ");
|
|
791
|
+
const steps = result.ok ? ran.filter((step) => step.status === "pass").map((step) => `${step.name} ${VerifyReport.#seconds(step.ms)}`).join(" ") : ran.map((step) => VerifyReport.#stepLabel(step, result.diagnostics)).join(" \xB7 ");
|
|
759
792
|
return [`verify ${result.ok ? "ok" : "fail"}`, result.targets.join(", "), steps, fixedNote, seconds].filter(Boolean).join(" \xB7 ");
|
|
760
793
|
}
|
|
761
794
|
static #stepLabel(step, diagnostics) {
|
|
762
795
|
if (step.status === "skip")
|
|
763
796
|
return `${step.name} skipped`;
|
|
764
797
|
if (step.status === "pass")
|
|
765
|
-
return `${step.name} ok`;
|
|
798
|
+
return `${step.name} ok ${VerifyReport.#seconds(step.ms)}`;
|
|
766
799
|
const errors = diagnostics.filter((entry) => entry.step === step.name && entry.severity === "error").length;
|
|
767
|
-
return `${step.name} ${errors} error${errors === 1 ? "" : "s"}`;
|
|
800
|
+
return `${step.name} ${errors} error${errors === 1 ? "" : "s"} ${VerifyReport.#seconds(step.ms)}`;
|
|
801
|
+
}
|
|
802
|
+
static #seconds(ms) {
|
|
803
|
+
return `${(ms / 1000).toFixed(1)}s`;
|
|
768
804
|
}
|
|
769
805
|
static #diagnosticLines(diagnostics, max) {
|
|
770
806
|
const groups = new Map;
|