@akanjs/cli 3.2.0-rc.9 → 3.3.0-rc.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (143) hide show
  1. package/.build-stamp +2 -2
  2. package/CodeAgent-fx6088tv.js +11 -0
  3. package/{CodeTui-qstk5vpj.js → CodeTui-zee8atsr.js} +822 -666
  4. package/README.ko.md +7 -0
  5. package/README.md +7 -0
  6. package/TunnelShare-9ry4vh0y.js +18 -0
  7. package/agent.command-x65f2ags.js +61 -0
  8. package/akanCode.js +12 -12
  9. package/appExecutor-79azsb2w.js +11 -0
  10. package/{application.command-m4rq4wc2.js → application.command-azbd1pb2.js} +83 -37
  11. package/{applicationBuildRunner-df7rx3ra.js → applicationBuildRunner-trfxv3pd.js} +49 -18
  12. package/buildBatch.proc.js +25 -11
  13. package/{cloud.command-a0gy0qq2.js → cloud.command-gapp4634.js} +33 -29
  14. package/cloud.script-3b401efv.js +35 -0
  15. package/{code.command-5rsdqw8s.js → code.command-5smx61yf.js} +13 -9
  16. package/context.command-ym5jbkny.js +64 -0
  17. package/context.runner-kctbfsde.js +34 -0
  18. package/{dependencyScanner-78sq8m4q.js → dependencyScanner-ge10gb52.js} +2 -2
  19. package/{devTui-h77zrjv5.js → devTui-rf374y2w.js} +1 -1
  20. package/{fileSys-zpvt5gtf.js → fileSys-q22646yc.js} +1 -1
  21. package/{guideline.command-mffxknbr.js → guideline.command-zwypaqsh.js} +9 -5
  22. package/guidelines/agentRule/agentRule.instruction.md +25 -9
  23. package/guidelines/akanApi/akanApi.instruction.md +6 -4
  24. package/guidelines/conventions/core.md +23 -5
  25. package/guidelines/conventions/rules/app.md +4 -1
  26. package/guidelines/conventions/rules/page.md +5 -4
  27. package/guidelines/conventions/rules/ts.md +3 -3
  28. package/guidelines/errorCodes/errorCodes.instruction.md +165 -0
  29. package/guidelines/fieldRule/fieldRule.instruction.md +2 -1
  30. package/guidelines/mcpRule/mcpRule.instruction.md +225 -5
  31. package/guidelines/pageRule/pageRule.instruction.md +10 -1
  32. package/guidelines/queryRule/queryRule.instruction.md +3 -1
  33. package/guidelines/runtimeRule/runtimeRule.instruction.md +14 -8
  34. package/guidelines/transportRule/transportRule.instruction.md +31 -1
  35. package/incrementalBuilder.proc.js +577 -411
  36. package/{index-w15mg3km.js → index-0dm25wvf.js} +1 -1
  37. package/{index-0gg15zwa.js → index-0s7w2085.js} +6 -6
  38. package/{index-hj6w4ka1.js → index-1p81ecbz.js} +1 -1
  39. package/{index-swwjakt0.js → index-275a4r3n.js} +11 -11
  40. package/{index-j6gc8n14.js → index-2jmvfa62.js} +11 -9
  41. package/{index-qd7xn2bk.js → index-2ny1e95c.js} +2 -2
  42. package/{index-exn38bzx.js → index-2yn3r67f.js} +116 -54
  43. package/{index-34792nh7.js → index-3txdtztz.js} +1 -1
  44. package/{index-28x1aszt.js → index-41a03gkj.js} +149 -53
  45. package/{index-2mf1aen9.js → index-4ss4gkv3.js} +2 -2
  46. package/{index-an76bdrv.js → index-612fdtbk.js} +1 -1
  47. package/{index-5radqwn2.js → index-67sd09ag.js} +12 -12
  48. package/{index-0hbtve0a.js → index-6dzjer7p.js} +32 -28
  49. package/{index-3ghdb7p5.js → index-71y6176j.js} +2777 -3676
  50. package/{index-xyn02k0w.js → index-78y75t0a.js} +662 -433
  51. package/index-7wf8snar.js +80 -0
  52. package/{index-skmtj8rm.js → index-8jtqfye2.js} +27 -10
  53. package/{index-2mrn1mrg.js → index-9f3reh2y.js} +1 -1
  54. package/{index-nmvhjn8c.js → index-9wh04mqy.js} +93 -82
  55. package/{index-xvk2a75m.js → index-a860mx0m.js} +3 -3
  56. package/{index-5zwr4n6k.js → index-baccvws5.js} +65 -8
  57. package/{index-yf9wc28h.js → index-bejy9zyc.js} +1 -1
  58. package/{index-bns3wcpc.js → index-by2tvsq6.js} +1 -1
  59. package/{index-r0a604h4.js → index-c669pbyb.js} +5 -4
  60. package/{index-x40bdsca.js → index-dadwp2aw.js} +33 -98
  61. package/{index-vm0dn0mt.js → index-dmcpetwe.js} +200 -138
  62. package/{index-43f4h4cm.js → index-ebn9kgea.js} +6 -6
  63. package/{index-hqv34wzq.js → index-gt8phqpt.js} +10 -10
  64. package/{index-yckz5t8b.js → index-h901f24n.js} +516 -434
  65. package/{index-j3v29pq7.js → index-j0wr4e32.js} +219 -175
  66. package/{index-gcx48get.js → index-j592zfqc.js} +2 -2
  67. package/{index-grxs6fts.js → index-j6jjmn2r.js} +57 -31
  68. package/{index-w8yasvpc.js → index-jek2re5k.js} +2136 -2175
  69. package/{index-ny2k80mv.js → index-jf4vk1s0.js} +9 -2
  70. package/{index-gxav1bjz.js → index-k6vwww45.js} +9 -9
  71. package/{index-99qvtff2.js → index-kfvjzk8r.js} +5 -5
  72. package/{index-j6eeh5d7.js → index-knpm8sdm.js} +5 -5
  73. package/{index-2r9ff9qm.js → index-nc3br31y.js} +2 -2
  74. package/{index-35j83zkd.js → index-p5zh7pmc.js} +2 -2
  75. package/{index-cmg5ngqa.js → index-p7beqww9.js} +2 -2
  76. package/{index-b4qq3rq0.js → index-rwgqba9p.js} +1 -1
  77. package/{index-rfzp4pqs.js → index-s885g0jj.js} +3 -3
  78. package/{index-9p260r4e.js → index-trffs83s.js} +538 -250
  79. package/{index-k92x3vne.js → index-v7ajmsh3.js} +1 -1
  80. package/index-w1zexzpx.js +127 -0
  81. package/{index-h7hehkw6.js → index-xczjdng6.js} +3 -1
  82. package/{index-39jz41jb.js → index-xs9a3ddt.js} +3 -3
  83. package/{index-rp4yf32g.js → index-xwwex8rf.js} +36 -29
  84. package/{index-ra9fvn7s.js → index-ybcb9wc8.js} +74 -38
  85. package/index-z92zm3wd.js +788 -0
  86. package/{index-j9790rhk.js → index-z96ks033.js} +1509 -1121
  87. package/index-zfnz878d.js +30 -0
  88. package/{index-2vgv7fs7.js → index-zmd9xxgd.js} +727 -693
  89. package/{index-ygdbn9jn.js → index-zyb0ebm4.js} +1 -1
  90. package/index.js +28 -24
  91. package/libExecutor-jc6f8hm6.js +10 -0
  92. package/{library.command-bmd7zc5m.js → library.command-nxvesvhb.js} +12 -5
  93. package/{localRegistry.command-y6en1599.js → localRegistry.command-xz62e4ng.js} +29 -24
  94. package/{module.command-7exfffqw.js → module.command-aaws9byg.js} +11 -7
  95. package/{package.command-adskw2rj.js → package.command-j7hv26p0.js} +14 -10
  96. package/package.json +8 -8
  97. package/{page.command-dw01272p.js → page.command-7yffs7n9.js} +8 -4
  98. package/{pipeline.command-0b1r3y5r.js → pipeline.command-7yk0zcng.js} +15 -9
  99. package/pkgExecutor-arxmvx4t.js +10 -0
  100. package/{primitive.command-byw6vc04.js → primitive.command-7a1pt715.js} +12 -8
  101. package/{projectTypecheck-kkrpq60a.js → projectTypecheck-f4qhbecd.js} +1 -1
  102. package/{prompter-qrwx1p17.js → prompter-qyggfhqd.js} +2 -2
  103. package/{quality.command-6rqnhzct.js → quality.command-c6mvrjh1.js} +25 -16
  104. package/{recipeScanner-4b69ybe0.js → recipeScanner-rrx69awy.js} +1 -1
  105. package/{repair.command-rw5zymak.js → repair.command-093adzt9.js} +12 -8
  106. package/{routeSourceValidator-4h947v7c.js → routeSourceValidator-8n6j1vn7.js} +4 -2
  107. package/{scalar.command-2dyp9nh9.js → scalar.command-2ex84spb.js} +10 -6
  108. package/skills/akan-debug/SKILL.md +8 -5
  109. package/skills/akan-err/SKILL.md +7 -0
  110. package/skills/akan-mcp/SKILL.md +19 -1
  111. package/skills/akan-scaffold/SKILL.md +1 -1
  112. package/skills/akan-validate/SKILL.md +3 -3
  113. package/{subspace.command-111ynwv1.js → subspace.command-4n4n4jpv.js} +32 -24
  114. package/templates/app/page/_layout.tsx +13 -0
  115. package/templates/app/page/styles.css.template +40 -0
  116. package/templates/appSample/page/_index.tsx +9 -9
  117. package/templates/appSample/page/_layout.tsx +1 -0
  118. package/templates/appSample/page/styles.css.template +40 -5
  119. package/templates/appSample/ui/Recipe/jellyButton.ts +1 -1
  120. package/templates/biomeForm.ts +1 -1
  121. package/templates/env/_env.server.type.ts +1 -1
  122. package/templates/facetIndex/index.ts +2 -37
  123. package/templates/lib/sig.ts +0 -4
  124. package/templates/lib/useClient.ts +1 -1
  125. package/templates/workspaceRoot/.devcontainer/devcontainer.json.template +1 -1
  126. package/templates/workspaceRoot/AGENTS.md.template +2 -1
  127. package/templates/workspaceRoot/README.ts +4 -2
  128. package/{tunnel.command-2gcpfbdj.js → tunnel.command-f7ep1qfa.js} +17 -13
  129. package/{typeChecker-s640r6c0.js → typeChecker-7jt6abrs.js} +1 -1
  130. package/typecheck.proc.js +3 -2
  131. package/{verify.command-djgs86ma.js → verify.command-zrkxnvct.js} +21 -17
  132. package/{workflow.command-n0k2mxr5.js → workflow.command-ks16jegk.js} +21 -14
  133. package/{workspace.command-fh1qwxfx.js → workspace.command-ahhfpaag.js} +60 -54
  134. package/CodeAgent-x2p3a3e0.js +0 -11
  135. package/TunnelShare-c4xsfzg5.js +0 -15
  136. package/agent.command-9et2e27p.js +0 -52
  137. package/cloud.script-xze4zh7n.js +0 -31
  138. package/context.command-rk1dwrg4.js +0 -57
  139. package/context.runner-83ky5m1b.js +0 -30
  140. /package/templates/{appSample → app}/public/fonts/Pretendard-Bold.woff2 +0 -0
  141. /package/templates/{appSample → app}/public/fonts/Pretendard-Medium.woff2 +0 -0
  142. /package/templates/{appSample → app}/public/fonts/Pretendard-Regular.woff2 +0 -0
  143. /package/templates/{appSample → app}/public/fonts/Pretendard-SemiBold.woff2 +0 -0
@@ -2,7 +2,7 @@
2
2
  import {
3
3
  GlobalConfig,
4
4
  CloudApi
5
- } from "./index-rfzp4pqs.js";
5
+ } from "./index-s885g0jj.js";
6
6
 
7
7
  // pkgs/@akanjs/cli/tunnel/TunnelShare.ts
8
8
  import { TunnelAgent } from "akanjs/server/tunnel";
@@ -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-9p260r4e.js";
5
+ } from "./index-trffs83s.js";
6
6
  import {
7
7
  GitRevision
8
- } from "./index-ygdbn9jn.js";
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-rfzp4pqs.js";
9
+ } from "./index-s885g0jj.js";
10
10
  import {
11
11
  resolveMobileTargets
12
12
  } from "./index-m9jj544v.js";
13
13
  import {
14
- WorkspaceExecutor,
15
- AppExecutor
16
- } from "./index-3ghdb7p5.js";
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-43f4h4cm.js";
21
+ } from "./index-ebn9kgea.js";
20
22
  import {
21
23
  runner,
22
24
  assertPromptable
23
- } from "./index-exn38bzx.js";
25
+ } from "./index-2yn3r67f.js";
24
26
  import {
25
27
  getNpmRegistryUrl,
26
28
  getPublishedVersions,
27
- getLatestPackageVersion
28
- } from "./index-ny2k80mv.js";
29
+ getLatestPackageVersion,
30
+ getPublishedPeerDependencies
31
+ } from "./index-jf4vk1s0.js";
29
32
  import {
30
33
  SubspaceConfig
31
- } from "./index-h7hehkw6.js";
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 AppExecutor.from(workspace, appName).getConfig();
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 registryArgs = this.#getRegistryArgs(registry);
1244
- const env = this.#getRegistryEnv(registry);
1245
- const globalCliArgs = ["add", "-g", `@akanjs/cli@${tag}`, ...registryArgs];
1246
- if (!await workspace.exists("package.json"))
1247
- await workspace.spawn("bun", globalCliArgs, { env });
1248
- else
1249
- await Promise.all([
1250
- workspace.spawn("bun", globalCliArgs, { env }),
1251
- this.#updateAkanPkgs(workspace, tag, registry)
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, tag = "latest", registryUrl) {
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
- for (const name of ["akanjs", "@akanjs/devkit", "@akanjs/cli", "@akanjs/language"]) {
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] = latestPublishedVersion;
1268
+ rootPackageJson.dependencies[name] = version;
1262
1269
  if (rootPackageJson.devDependencies?.[name])
1263
- rootPackageJson.devDependencies[name] = latestPublishedVersion;
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 AppExecutor.from(workspace, appName).getConfig();
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 AppExecutor.from(workspace, appName).getConfig();
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-vm0dn0mt.js";
4
+ } from "./index-dmcpetwe.js";
5
5
  import {
6
6
  parseBiomeReport,
7
7
  Linter,
8
- ProjectTypecheck2,
9
- AppExecutor,
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-xyn02k0w.js";
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(scope, { lintOnly = false, build = true } = {}) {
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 systems)
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", scope.targets, (target) => this.#lint(target, { comments: !lintOnly, rewritten: renames.get(target) ?? new Map })),
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 = scope.targets.filter((target) => target.type === "app");
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#each(name, items, step) {
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
- let fixed = 0;
612
- let failed = false;
613
- for (const item of items) {
614
- const outcome = await step(item).catch((error) => ({
615
- diagnostics: [VerifyDiagnostics.fromMessage(name, ApplicationBuildReporter.formatError(error, this.#root))]
616
- }));
617
- fixed += outcome.fixed ?? 0;
618
- failed ||= outcome.diagnostics.some((diagnostic) => diagnostic.severity === "error");
619
- this.#diagnostics.push(...outcome.diagnostics);
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 AppExecutor.from(this.#workspace, target.name).scanSync();
665
+ await AppExecutor2.from(this.#workspace, target.name).scanSync();
633
666
  else
634
- await LibExecutor.from(this.#workspace, target.name).scan();
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(AppExecutor.from(this.#workspace, target.name), {
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(LibExecutor.from(this.#workspace, target.name), {
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).check(tsconfigPath, "records");
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(AppExecutor.from(this.#workspace, target.name), { fast: true });
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 scanned = await new AkanQualityScanner().scan(this.#root);
727
- const warnings = scanned.warnings.filter((warning) => warning.scope === "ssr");
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 AppExecutor.from(this.#workspace, target.name);
765
+ return AppExecutor2.from(this.#workspace, target.name);
733
766
  if (target.type === "lib")
734
- return LibExecutor.from(this.#workspace, target.name);
735
- return PkgExecutor.from(this.#workspace, target.name);
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 = `${(result.ms / 1000).toFixed(1)}s`;
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;