@akanjs/cli 3.1.2-rc.4 → 3.2.0-rc.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (120) hide show
  1. package/.build-stamp +1 -1
  2. package/{CodeAgent-z34p8m91.js → CodeAgent-vmd9k4ak.js} +3 -3
  3. package/{CodeTui-nvd9fk3g.js → CodeTui-zka44v52.js} +1 -1
  4. package/README.ko.md +9 -0
  5. package/README.md +9 -0
  6. package/TunnelShare-k3ja4w9x.js +14 -0
  7. package/{agent.command-962mp3kg.js → agent.command-2f657613.js} +19 -17
  8. package/akanCode.js +6 -6
  9. package/{application.command-1nr0bqq1.js → application.command-q6skd3am.js} +36 -22
  10. package/{applicationBuildRunner-xy7hnfzq.js → applicationBuildRunner-sctcmkyx.js} +55 -16
  11. package/buildBatch.proc.js +7 -7
  12. package/{cloud.command-cj7b3m6y.js → cloud.command-7642pks6.js} +36 -19
  13. package/cloud.script-1sfseznn.js +30 -0
  14. package/{code.command-asq7xrr6.js → code.command-7s4ndq2k.js} +6 -6
  15. package/commandManifest.json +1 -1
  16. package/{context.command-fw4g2pw1.js → context.command-569z0rqf.js} +20 -19
  17. package/context.runner-ms8v1rxy.js +29 -0
  18. package/{devTui-evr3b35y.js → devTui-w38ch13a.js} +1 -1
  19. package/{guideline.command-43gfjsjv.js → guideline.command-gnv3e8p8.js} +2 -2
  20. package/guidelines/akanApi/akanApi.instruction.md +317 -0
  21. package/guidelines/conventions/rules/app.md +5 -5
  22. package/guidelines/conventions/rules/config.md +1 -1
  23. package/guidelines/conventions/rules/gates.md +10 -5
  24. package/incrementalBuilder.proc.js +69 -39
  25. package/{index-0tkj05cz.js → index-0fb3cpbt.js} +3 -3
  26. package/{index-6t7fkx73.js → index-1q1cjn8s.js} +21 -11
  27. package/{index-tenw3mah.js → index-23860fej.js} +16 -6
  28. package/{index-6zgt7zmx.js → index-48d5qsj3.js} +4 -4
  29. package/{index-z47rw9ez.js → index-5w9my9qe.js} +8 -8
  30. package/{index-qwe079ww.js → index-6wpaq392.js} +61 -15
  31. package/{index-kc871vpc.js → index-7xdpww43.js} +69 -12
  32. package/index-7y5yghjg.js +2969 -0
  33. package/{index-38patcx6.js → index-8g7tdsk4.js} +249 -696
  34. package/{index-90q0w90q.js → index-8kczhnmv.js} +1 -1
  35. package/{index-kdswbvys.js → index-8pb9yvp8.js} +63 -21
  36. package/{index-hmj94es2.js → index-8ts9774g.js} +4 -4
  37. package/{index-r0q2ka2b.js → index-93ewzmp6.js} +43 -14
  38. package/{index-y0y0pnx8.js → index-9tbgb4d8.js} +1 -1
  39. package/{index-jzpeny42.js → index-a8a9ede9.js} +7 -7
  40. package/index-abgh0jve.js +126 -0
  41. package/{index-t0hk1kxq.js → index-aj3ehkcx.js} +1 -1
  42. package/{index-demt944k.js → index-d4n1wmrz.js} +37 -4
  43. package/{index-sra1a5f8.js → index-drz9e84d.js} +22 -8
  44. package/{index-gfh90r3t.js → index-e3vmjtph.js} +2 -2
  45. package/{index-k64mhwbw.js → index-eajbmk10.js} +2 -1
  46. package/{index-g0yds382.js → index-ed6ea0qp.js} +1 -1
  47. package/{index-ap6ac70m.js → index-fjr4d6yd.js} +444 -368
  48. package/index-hqrkqxx2.js +176 -0
  49. package/{index-ampz4vgv.js → index-kpdv34rq.js} +4 -4
  50. package/{index-kc6ffq0s.js → index-ktb3wcqz.js} +73 -34
  51. package/{index-dcm66hss.js → index-mmym5xmb.js} +4 -2
  52. package/{index-8d9r465x.js → index-mqntfzv5.js} +2 -2
  53. package/{index-4am4dvmf.js → index-ny2k80mv.js} +15 -3
  54. package/index-p6hjwt2d.js +1668 -0
  55. package/{index-53h0053j.js → index-rc5fvqj2.js} +12 -14
  56. package/{index-jzz6ye8x.js → index-s2grpzef.js} +40 -8
  57. package/{index-38by07nw.js → index-sr5da35e.js} +32 -9
  58. package/{index-qev8p5wp.js → index-sy481q2x.js} +1 -1
  59. package/{index-ck64kxrn.js → index-thckcabc.js} +2 -2
  60. package/{index-2yan1ajk.js → index-v4p1zye8.js} +18 -9
  61. package/{index-wymcdsas.js → index-vkzfk7qt.js} +25 -23
  62. package/{index-r8t5sq7z.js → index-vr68mxj5.js} +68 -21
  63. package/{index-vkpqe29t.js → index-w639tvkd.js} +24 -125
  64. package/index-ygdbn9jn.js +122 -0
  65. package/{index-w60zxxye.js → index-zpv14wpy.js} +3 -3
  66. package/index.js +24 -23
  67. package/{library.command-zh29tjdd.js → library.command-1gp5qe3r.js} +3 -3
  68. package/{localRegistry.command-k9pn9ahj.js → localRegistry.command-x7jptkd3.js} +26 -17
  69. package/{module.command-dgpqs9fz.js → module.command-4xz9he6h.js} +6 -6
  70. package/{package.command-1je4hsca.js → package.command-s7qpnn1g.js} +12 -3
  71. package/package.json +2 -2
  72. package/{page.command-cgsasanh.js → page.command-fan34c49.js} +3 -3
  73. package/{pipeline.command-tb46sa8v.js → pipeline.command-ph4fnn9w.js} +2 -2
  74. package/{primitive.command-bzsy23x5.js → primitive.command-3fqh8emf.js} +7 -7
  75. package/{projectTypecheck-h8rgaczy.js → projectTypecheck-vkb40hjc.js} +1 -1
  76. package/{quality.command-120m9h6v.js → quality.command-ecj6exsh.js} +15 -10
  77. package/{repair.command-6m4wd0qv.js → repair.command-fe9jw719.js} +6 -6
  78. package/{scalar.command-3dn5hsc6.js → scalar.command-cnvfhk0n.js} +5 -5
  79. package/skills/akan-debug/SKILL.md +2 -1
  80. package/skills/akan-page/SKILL.md +16 -7
  81. package/skills/akan-service/SKILL.md +48 -19
  82. package/{subspace.command-s8nyfqbn.js → subspace.command-qw5ddd6y.js} +8 -8
  83. package/templates/app/lib/___appName__/__appName__.abstract.md.template +6 -0
  84. package/templates/app/page/_index.tsx +4 -284
  85. package/templates/app/page/_layout.tsx +1 -26
  86. package/templates/app/page/styles.css.template +58 -318
  87. package/templates/appSample/page/_index.tsx +281 -0
  88. package/templates/appSample/page/_layout.tsx +55 -0
  89. package/templates/appSample/page/styles.css.template +327 -0
  90. package/templates/libRoot/lib/___libName__/__libName__.abstract.md.template +6 -0
  91. package/templates/workspaceRoot/package.json.template +1 -12
  92. package/{tunnel.command-8mwrqkr3.js → tunnel.command-ggj38mqf.js} +7 -7
  93. package/{verify.command-2pspfy7k.js → verify.command-w9ttxkdz.js} +16 -14
  94. package/{workflow.command-7sy5vnsj.js → workflow.command-ss8devj0.js} +12 -12
  95. package/{workspace.command-x518tdv4.js → workspace.command-6z2rh8ze.js} +51 -39
  96. package/TunnelShare-jwbb50kz.js +0 -14
  97. package/cloud.script-8kr7qgfa.js +0 -27
  98. package/context.runner-p6m5cxk3.js +0 -28
  99. package/index-d894868w.js +0 -842
  100. package/index-re2kfscb.js +0 -1363
  101. /package/templates/{app → appSample}/page/_overrides.tsx +0 -0
  102. /package/templates/{app → appSample}/public/fonts/Pretendard-Black.woff2 +0 -0
  103. /package/templates/{app → appSample}/public/fonts/Pretendard-Bold.woff2 +0 -0
  104. /package/templates/{app → appSample}/public/fonts/Pretendard-ExtraBold.woff2 +0 -0
  105. /package/templates/{app → appSample}/public/fonts/Pretendard-ExtraLight.woff2 +0 -0
  106. /package/templates/{app → appSample}/public/fonts/Pretendard-Light.woff2 +0 -0
  107. /package/templates/{app → appSample}/public/fonts/Pretendard-Medium.woff2 +0 -0
  108. /package/templates/{app → appSample}/public/fonts/Pretendard-Regular.woff2 +0 -0
  109. /package/templates/{app → appSample}/public/fonts/Pretendard-SemiBold.woff2 +0 -0
  110. /package/templates/{app → appSample}/public/fonts/Pretendard-Thin.woff2 +0 -0
  111. /package/templates/{app → appSample}/public/jelly/cloud.webp +0 -0
  112. /package/templates/{app → appSample}/public/jelly/comet.webp +0 -0
  113. /package/templates/{app → appSample}/public/jelly/moon.webp +0 -0
  114. /package/templates/{app → appSample}/public/jelly/planet.webp +0 -0
  115. /package/templates/{app → appSample}/public/jelly/rocket.webp +0 -0
  116. /package/templates/{app → appSample}/public/jelly/star.webp +0 -0
  117. /package/templates/{app → appSample}/public/jelly/sugar.webp +0 -0
  118. /package/templates/{app → appSample}/public/logo.png +0 -0
  119. /package/templates/{app → appSample}/ui/Recipe/index.ts +0 -0
  120. /package/templates/{app → appSample}/ui/Recipe/jellyButton.ts +0 -0
@@ -3,12 +3,12 @@ import {
3
3
  HmrWatcher,
4
4
  WatchRootResolver,
5
5
  ApplicationBuildReporter
6
- } from "./index-d894868w.js";
6
+ } from "./index-p6hjwt2d.js";
7
7
  import {
8
8
  CodegenLock,
9
9
  WorkspaceExecutor,
10
10
  AppExecutor
11
- } from "./index-38by07nw.js";
11
+ } from "./index-sr5da35e.js";
12
12
  import"./index-bns3wcpc.js";
13
13
  import {
14
14
  GraphClientEntryDiscovery,
@@ -19,15 +19,20 @@ import {
19
19
  DevChangePlanner,
20
20
  DevGeneratedIndexSync,
21
21
  SsrDevBundler
22
- } from "./index-kc871vpc.js";
22
+ } from "./index-7xdpww43.js";
23
23
  import {
24
24
  ServerGraphFile
25
- } from "./index-6t7fkx73.js";
25
+ } from "./index-1q1cjn8s.js";
26
+ import"./index-7y5yghjg.js";
27
+ import {
28
+ FrameworkGraph
29
+ } from "./index-abgh0jve.js";
30
+ import {
31
+ GitRevision
32
+ } from "./index-ygdbn9jn.js";
26
33
  import {
27
- GitRevision,
28
34
  WorkspaceGraph
29
- } from "./index-vkpqe29t.js";
30
- import"./index-re2kfscb.js";
35
+ } from "./index-w639tvkd.js";
31
36
  import {
32
37
  prepareDevWatchBatch
33
38
  } from "./index-a5vmm6x4.js";
@@ -144,6 +149,59 @@ class BuilderChannel {
144
149
  }
145
150
  }
146
151
 
152
+ // pkgs/@akanjs/devkit/incrementalBuilder/builderGraphPayloads.ts
153
+ class BuilderGraphPayloads {
154
+ #app;
155
+ #generation;
156
+ #graph = null;
157
+ #changes = null;
158
+ constructor(app, generation) {
159
+ this.#app = app;
160
+ this.#generation = generation;
161
+ }
162
+ touched(files) {
163
+ FrameworkGraph.touched(this.#app.workspace.workspaceRoot, files);
164
+ }
165
+ async of(msg) {
166
+ if (msg.framework)
167
+ return await this.#framework();
168
+ return msg.changes ? await this.#changesSince(msg.changes.since) : await this.#workspaceGraph();
169
+ }
170
+ async#workspaceGraph() {
171
+ const generation = this.#generation();
172
+ if (this.#graph?.generation !== generation) {
173
+ const { workspace } = this.#app;
174
+ const graph = WorkspaceGraph.visibleTo(await WorkspaceGraph.build(workspace), this.#app.name);
175
+ this.#graph = { generation, payload: { workspaceRoot: workspace.workspaceRoot, graph } };
176
+ }
177
+ return this.#graph.payload;
178
+ }
179
+ async#framework() {
180
+ const { workspaceRoot } = this.#app.workspace;
181
+ return { workspaceRoot, framework: await FrameworkGraph.cached(workspaceRoot) };
182
+ }
183
+ async#changesSince(since) {
184
+ const { workspace, name } = this.#app;
185
+ const { workspaceRoot } = workspace;
186
+ const forkPoint = await new GitRevision(workspaceRoot).forkPointOf(since);
187
+ if (forkPoint.error !== undefined)
188
+ return { workspaceRoot, changes: { error: forkPoint.error } };
189
+ const key = `${this.#generation()}:${forkPoint.sha}`;
190
+ if (this.#changes?.key !== key) {
191
+ const payload = WorkspaceGraph.changesAt(workspace, forkPoint.sha).then((changes) => ({
192
+ workspaceRoot,
193
+ changes: WorkspaceGraph.changesVisibleTo(changes, name)
194
+ }));
195
+ payload.catch(() => {
196
+ if (this.#changes?.payload === payload)
197
+ this.#changes = null;
198
+ });
199
+ this.#changes = { key, payload };
200
+ }
201
+ return await this.#changes.payload;
202
+ }
203
+ }
204
+
147
205
  // pkgs/@akanjs/devkit/incrementalBuilder/builderWorkQueue.ts
148
206
  class BuilderWorkQueue {
149
207
  #runBatch;
@@ -243,8 +301,7 @@ class IncrementalBuilder {
243
301
  #watcher = null;
244
302
  #generation = 0;
245
303
  #shellKey = null;
246
- #graph = null;
247
- #changes = null;
304
+ #graphPayloads;
248
305
  #discoveredThrough = 0;
249
306
  #csrActive = IncrementalBuilder.#csrArmedByEnv();
250
307
  #csrBundler;
@@ -282,6 +339,7 @@ class IncrementalBuilder {
282
339
  this.#discovery = options.discovery;
283
340
  this.#generation = options.initialGeneration ?? 0;
284
341
  this.#discoveredThrough = this.#generation;
342
+ this.#graphPayloads = new BuilderGraphPayloads(options.app, () => this.#generation);
285
343
  this.#batchRunner = new BuildBatchRunner({
286
344
  workspaceRoot: options.app.workspace.workspaceRoot,
287
345
  cwd: options.app.cwdPath
@@ -515,6 +573,7 @@ class IncrementalBuilder {
515
573
  this.#logger.verbose(`watching ${roots.length} roots`);
516
574
  }
517
575
  async#handleWatchBatch(batch) {
576
+ this.#graphPayloads.touched(batch.files);
518
577
  const rawKinds = new Set(batch.kinds);
519
578
  if (rawKinds.size === 0)
520
579
  return;
@@ -927,7 +986,7 @@ class IncrementalBuilder {
927
986
  }
928
987
  async handleBuildGraph(msg) {
929
988
  try {
930
- const data = msg.changes ? await this.#changesPayload(msg.changes.since) : await this.#graphPayload();
989
+ const data = await this.#graphPayloads.of(msg);
931
990
  await BuilderChannel.send({ type: "build-graph-res", id: msg.id, ok: true, data });
932
991
  } catch (err) {
933
992
  const error = ApplicationBuildReporter.formatError(err, this.#app.workspace.workspaceRoot);
@@ -935,35 +994,6 @@ class IncrementalBuilder {
935
994
  await BuilderChannel.send({ type: "build-graph-res", id: msg.id, ok: false, error });
936
995
  }
937
996
  }
938
- async#graphPayload() {
939
- const generation = this.#generation;
940
- if (this.#graph?.generation !== generation) {
941
- const { workspace } = this.#app;
942
- const graph = WorkspaceGraph.visibleTo(await WorkspaceGraph.build(workspace), this.#app.name);
943
- this.#graph = { generation, payload: { workspaceRoot: workspace.workspaceRoot, graph } };
944
- }
945
- return this.#graph.payload;
946
- }
947
- async#changesPayload(since) {
948
- const { workspace, name } = this.#app;
949
- const { workspaceRoot } = workspace;
950
- const forkPoint = await new GitRevision(workspaceRoot).forkPointOf(since);
951
- if (forkPoint.error !== undefined)
952
- return { workspaceRoot, changes: { error: forkPoint.error } };
953
- const key = `${this.#generation}:${forkPoint.sha}`;
954
- if (this.#changes?.key !== key) {
955
- const payload = WorkspaceGraph.changesAt(workspace, forkPoint.sha).then((changes) => ({
956
- workspaceRoot,
957
- changes: WorkspaceGraph.changesVisibleTo(changes, name)
958
- }));
959
- payload.catch(() => {
960
- if (this.#changes?.payload === payload)
961
- this.#changes = null;
962
- });
963
- this.#changes = { key, payload };
964
- }
965
- return await this.#changes.payload;
966
- }
967
997
  async handleBuildCsr(msg) {
968
998
  if (msg.shell) {
969
999
  await this.#buildShell(msg);
@@ -7,13 +7,13 @@ import {
7
7
  isWorkflowSysName,
8
8
  isWorkflowModuleName,
9
9
  renderRepairReport
10
- } from "./index-kdswbvys.js";
10
+ } from "./index-8pb9yvp8.js";
11
11
  import {
12
12
  AkanContextAnalyzer
13
- } from "./index-ck64kxrn.js";
13
+ } from "./index-thckcabc.js";
14
14
  import {
15
15
  runner
16
- } from "./index-r0q2ka2b.js";
16
+ } from "./index-93ewzmp6.js";
17
17
 
18
18
  // pkgs/@akanjs/cli/repair/repair.runner.ts
19
19
  var akanArgPattern = /^(?:--?[a-z][a-zA-Z0-9-]*|[A-Za-z0-9@_][A-Za-z0-9@._/:,=-]*)$/;
@@ -1,8 +1,9 @@
1
1
  // @bun
2
2
  import {
3
3
  AsyncDefaultExportDetector,
4
+ StoreBootstrap,
4
5
  resolveSsrPageEntriesForApp
5
- } from "./index-38by07nw.js";
6
+ } from "./index-sr5da35e.js";
6
7
  import {
7
8
  FileSys2
8
9
  } from "./index-bns3wcpc.js";
@@ -110,10 +111,15 @@ class BarrelAnalyzer {
110
111
  if (!isRelative(spec))
111
112
  continue;
112
113
  if (star) {
113
- if (nsAs)
114
- authoritative.delete(nsAs);
115
- else
114
+ if (!nsAs)
116
115
  starSpecs.push(spec);
116
+ else if (authoritative.has(nsAs)) {
117
+ attributed.add(nsAs);
118
+ const targetAbs = await this.#resolveRel(absFile, spec);
119
+ const targetSubpath = targetAbs ? this.#subpathFor(pkg, targetAbs) : null;
120
+ if (targetSubpath && !map.has(nsAs))
121
+ map.set(nsAs, { subpath: targetSubpath, originalName: nsAs, namespace: true });
122
+ }
117
123
  continue;
118
124
  }
119
125
  if (namedList !== undefined) {
@@ -263,7 +269,7 @@ var createTsconfigPackageResolver = async (app) => {
263
269
  continue;
264
270
  const replPath = repl.endsWith("/*") ? repl.slice(0, -1) : repl;
265
271
  const candidate = path2.resolve(app.workspace.workspaceRoot, replPath + suffix);
266
- for (const ext of CANDIDATE_EXTS2) {
272
+ for (const ext of CANDIDATE_EXTS2.includes(path2.extname(candidate)) ? ["", ...CANDIDATE_EXTS2] : CANDIDATE_EXTS2) {
267
273
  const file = `${candidate}${ext}`;
268
274
  if (await Bun.file(file).exists()) {
269
275
  const lastSlash = pkgName.lastIndexOf("/");
@@ -479,6 +485,7 @@ var rewriteSingleStatement = (stmt, map) => {
479
485
  return null;
480
486
  const remaining = [];
481
487
  const rewrites = new Map;
488
+ const namespaceLines = [];
482
489
  for (const item of clause.named) {
483
490
  if (item.isType) {
484
491
  remaining.push(item);
@@ -489,15 +496,17 @@ var rewriteSingleStatement = (stmt, map) => {
489
496
  remaining.push(item);
490
497
  continue;
491
498
  }
499
+ if (target.namespace) {
500
+ namespaceLines.push(`import * as ${item.local} from "${target.subpath}";`);
501
+ continue;
502
+ }
492
503
  const list = rewrites.get(target.subpath) ?? [];
493
504
  list.push({ imported: target.originalName, local: item.local, isType: false });
494
505
  rewrites.set(target.subpath, list);
495
506
  }
496
- if (rewrites.size === 0)
507
+ if (rewrites.size === 0 && namespaceLines.length === 0)
497
508
  return null;
498
- const lines = [];
499
- if (shouldPreserveBarrelSideEffects(stmt.specifier))
500
- lines.push(`import "${stmt.specifier}";`);
509
+ const lines = [...StoreBootstrap.ofClientBarrel(stmt.specifier, map) ?? []];
501
510
  if (clause.defaultImport || remaining.length > 0) {
502
511
  const parts = [];
503
512
  if (clause.defaultImport)
@@ -509,10 +518,10 @@ var rewriteSingleStatement = (stmt, map) => {
509
518
  for (const [subpath, items] of rewrites) {
510
519
  lines.push(`import { ${items.map(serializeNamedItem).join(", ")} } from "${subpath}";`);
511
520
  }
521
+ lines.push(...namespaceLines);
512
522
  return lines.join(`
513
523
  `);
514
524
  };
515
- var shouldPreserveBarrelSideEffects = (specifier) => /^@(apps|libs)\/[^/]+\/client$/.test(specifier);
516
525
  var serializeNamedItem = (item) => {
517
526
  const prefix = item.isType ? "type " : "";
518
527
  if (item.imported === item.local)
@@ -521,6 +530,7 @@ var serializeNamedItem = (item) => {
521
530
  };
522
531
 
523
532
  // pkgs/@akanjs/devkit/frontendBuild/bundleDefine.ts
533
+ var bundleConditions = (command) => command === "build" ? ["production"] : [];
524
534
  var bundleDefine = (app, command, renderEnv) => {
525
535
  const nodeEnv = command === "build" ? "production" : "development";
526
536
  return {
@@ -1172,4 +1182,4 @@ class PagesBundleBuilder {
1172
1182
  }
1173
1183
  }
1174
1184
 
1175
- export { loaderFor, BarrelAnalyzer, createBarrelImportsPlugin, createTsconfigPackageResolver, rewriteBarrelImports, bundleDefine, CsrEntryFiles, toClientReferencePath, scanUseClientExports, CsrDevPaths, PagesEntrySourceGenerator, ServerGraphFile, PagesBundleBuilder };
1185
+ export { loaderFor, BarrelAnalyzer, createBarrelImportsPlugin, createTsconfigPackageResolver, rewriteBarrelImports, bundleConditions, bundleDefine, CsrEntryFiles, toClientReferencePath, scanUseClientExports, CsrDevPaths, PagesEntrySourceGenerator, ServerGraphFile, PagesBundleBuilder };
@@ -8,10 +8,10 @@ class PreviewChrome2 {
8
8
  static pathEnvKey = "BUN_CHROME_PATH";
9
9
  static backendEnvKey = "AKAN_CODE_WEBVIEW_BACKEND";
10
10
  static executables = [
11
- "chromium",
12
- "chromium-browser",
13
11
  "google-chrome-stable",
14
12
  "google-chrome",
13
+ "chromium-browser",
14
+ "chromium",
15
15
  "brave-browser",
16
16
  "microsoft-edge",
17
17
  "chrome"
@@ -79,6 +79,8 @@ class PreviewChrome2 {
79
79
 
80
80
  // pkgs/@akanjs/devkit/preview/PreviewView.ts
81
81
  class PreviewView2 {
82
+ static startTimeoutMs = 120000;
83
+ static #stalled = new Set;
82
84
  static get available() {
83
85
  return PreviewView2.isAvailable();
84
86
  }
@@ -95,14 +97,22 @@ class PreviewView2 {
95
97
  width = 1280,
96
98
  height = 800,
97
99
  engine = PreviewChrome2.backend,
100
+ startTimeoutMs = PreviewView2.startTimeoutMs,
98
101
  timeoutMs = 30000,
99
102
  settleMs = 0
100
103
  } = {}) {
101
104
  const logs = [];
102
- const deadline = Date.now() + timeoutMs;
103
- const within = (work, what) => PreviewView2.#within(work, deadline, `${what} ${url}`);
104
105
  const view = PreviewView2.#open({ width, height, engine, onConsole: (line) => logs.push(line) });
105
106
  try {
107
+ const startMs = PreviewView2.#stalled.has(engine) ? Math.min(startTimeoutMs, timeoutMs) : startTimeoutMs;
108
+ const stalled = new Error(`Timed out starting the ${engine} browser after ${startMs / 1000} s.`);
109
+ await PreviewView2.#within(view.navigate("about:blank"), Date.now() + startMs, stalled).then(() => PreviewView2.#stalled.delete(engine), (error) => {
110
+ if (error === stalled)
111
+ PreviewView2.#stalled.add(engine);
112
+ throw error;
113
+ });
114
+ const deadline = Date.now() + timeoutMs;
115
+ const within = (work, what) => PreviewView2.#within(work, deadline, new Error(`Timed out ${what} ${url}; the dev server may be rebuilding or stuck.`));
106
116
  let page = await PreviewView2.#load(view, url, settleMs, within);
107
117
  if (page.empty) {
108
118
  logs.length = 0;
@@ -146,10 +156,10 @@ class PreviewView2 {
146
156
  const response = await fetch(href, { redirect: "manual", signal: AbortSignal.timeout(left) }).catch(() => null);
147
157
  return response?.status ?? null;
148
158
  }
149
- static async#within(work, deadline, what) {
159
+ static async#within(work, deadline, expiry) {
150
160
  let timer;
151
161
  const expired = new Promise((_, reject) => {
152
- timer = setTimeout(() => reject(new Error(`Timed out ${what}; the dev server may be rebuilding or stuck.`)), Math.max(0, deadline - Date.now()));
162
+ timer = setTimeout(() => reject(expiry), Math.max(0, deadline - Date.now()));
153
163
  });
154
164
  try {
155
165
  return await Promise.race([work, expired]);
@@ -1,12 +1,12 @@
1
1
  // @bun
2
2
  import {
3
3
  script
4
- } from "./index-r0q2ka2b.js";
4
+ } from "./index-93ewzmp6.js";
5
5
  import {
6
6
  AppExecutor,
7
7
  LibExecutor,
8
8
  ModuleExecutor
9
- } from "./index-38by07nw.js";
9
+ } from "./index-sr5da35e.js";
10
10
  import {
11
11
  InteractionScaffold,
12
12
  workflowStatus,
@@ -45,10 +45,10 @@ import {
45
45
  addFieldUiPolicyForType,
46
46
  KeyRename,
47
47
  MutationScaffold
48
- } from "./index-kdswbvys.js";
48
+ } from "./index-8pb9yvp8.js";
49
49
  import {
50
50
  ModuleScript
51
- } from "./index-hmj94es2.js";
51
+ } from "./index-8ts9774g.js";
52
52
 
53
53
  // pkgs/@akanjs/cli/primitive/primitive.script.ts
54
54
  import { capitalize, lowerlize } from "akanjs/common";
@@ -4,7 +4,7 @@ import {
4
4
  script,
5
5
  ExitCodeError,
6
6
  markCliErrorPrinted
7
- } from "./index-r0q2ka2b.js";
7
+ } from "./index-93ewzmp6.js";
8
8
  import {
9
9
  AGENT_BLOCK_START,
10
10
  AGENT_BLOCK_END,
@@ -15,7 +15,7 @@ import {
15
15
  CLAUDE_COMMENT_RULE,
16
16
  AppExecutor,
17
17
  LibExecutor
18
- } from "./index-38by07nw.js";
18
+ } from "./index-sr5da35e.js";
19
19
  import {
20
20
  akanCodePaths2
21
21
  } from "./index-35j83zkd.js";
@@ -29,19 +29,19 @@ import {
29
29
  } from "./index-hj6w4ka1.js";
30
30
  import {
31
31
  AkanContextAnalyzer
32
- } from "./index-ck64kxrn.js";
32
+ } from "./index-thckcabc.js";
33
33
  import {
34
34
  ApplicationRunner,
35
35
  VerifyScope
36
- } from "./index-kc6ffq0s.js";
36
+ } from "./index-ktb3wcqz.js";
37
37
  import {
38
38
  WorkspaceRunner
39
- } from "./index-ap6ac70m.js";
39
+ } from "./index-fjr4d6yd.js";
40
40
  import {
41
41
  VerifyComments,
42
42
  VerifyPipeline,
43
43
  VerifyReport
44
- } from "./index-jzz6ye8x.js";
44
+ } from "./index-s2grpzef.js";
45
45
 
46
46
  // pkgs/@akanjs/cli/agent/agent.script.ts
47
47
  import { Logger as Logger3 } from "akanjs/common";
@@ -65,7 +65,7 @@ class AgentAssets {
65
65
  "akan-scaffold": ["workspaceRecipes"],
66
66
  "akan-module": ["moduleOverview", "modelConstant", "modelDictionary", "fieldRule"],
67
67
  "akan-scalar": ["scalarModule", "scalarConstant", "scalarDictionary"],
68
- "akan-service": ["modelService", "modelSignal", "modelDocument"],
68
+ "akan-service": ["modelService", "modelSignal", "modelDocument", "akanApi"],
69
69
  "akan-store": ["modelStore"],
70
70
  "akan-ui": [
71
71
  "ssrRule",
@@ -82,7 +82,7 @@ class AgentAssets {
82
82
  "akan-err": [],
83
83
  "akan-deps": [],
84
84
  "akan-debug": [],
85
- "akan-page": ["pageRule"],
85
+ "akan-page": ["pageRule", "akanApi"],
86
86
  "akan-query": ["queryRule"],
87
87
  "akan-transport": ["transportRule"],
88
88
  "akan-runtime": ["runtimeRule"],
@@ -6,25 +6,26 @@ import {
6
6
  CloudApi,
7
7
  CloudUpdates,
8
8
  PipelineSecrets
9
- } from "./index-sra1a5f8.js";
9
+ } from "./index-drz9e84d.js";
10
10
  import {
11
11
  resolveMobileTargets
12
12
  } from "./index-m9jj544v.js";
13
13
  import {
14
14
  WorkspaceExecutor,
15
15
  AppExecutor
16
- } from "./index-38by07nw.js";
16
+ } from "./index-sr5da35e.js";
17
17
  import {
18
18
  NativeApp
19
- } from "./index-w60zxxye.js";
19
+ } from "./index-zpv14wpy.js";
20
20
  import {
21
21
  runner,
22
22
  assertPromptable
23
- } from "./index-r0q2ka2b.js";
23
+ } from "./index-93ewzmp6.js";
24
24
  import {
25
25
  getNpmRegistryUrl,
26
+ getPublishedVersions,
26
27
  getLatestPackageVersion
27
- } from "./index-4am4dvmf.js";
28
+ } from "./index-ny2k80mv.js";
28
29
  import {
29
30
  SubspaceConfig
30
31
  } from "./index-h7hehkw6.js";
@@ -993,7 +994,7 @@ class CloudRunner extends runner("cloud") {
993
994
  }
994
995
  async login(host, workspace) {
995
996
  const cloudApi = await CloudApi.fromHost(workspace, host);
996
- const signedIn = await cloudApi.getRemoteSelf().catch(() => null);
997
+ const signedIn = cloudApi.needsSignIn ? null : await cloudApi.getRemoteSelf().catch(() => null);
997
998
  if (signedIn) {
998
999
  Logger3.rawLog(chalk3.green(`
999
1000
  \u2713 Already logged in akan cloud as ${signedIn.nickname}
@@ -1109,18 +1110,28 @@ ${run.format(results)}
1109
1110
  const isPrivate = await Promise.all(pkgs.map(async (pkg) => (await workspace.readJson(`pkgs/${pkg}/package.json`)).private));
1110
1111
  return pkgs.filter((_, idx) => isPrivate[idx] !== true);
1111
1112
  }
1112
- async deployAkan(workspace, akanPkgs, { registryUrl, confirmPublish = true, tag: distTag } = {}) {
1113
+ async deployAkan(workspace, akanPkgs, { registryUrl, confirmPublish = true, npmLogin = true, tag: distTag, prerelease, packTo } = {}) {
1114
+ if (prerelease != null && (prerelease === "latest" || !/^[a-z][a-z0-9-]*$/.test(prerelease)))
1115
+ throw new Error(`--prerelease takes a lowercase identifier other than latest, such as rc, not "${prerelease}"`);
1113
1116
  const registry = registryUrl ? getNpmRegistryUrl(registryUrl) : undefined;
1114
1117
  const akanPackageJson = await workspace.readJson("pkgs/akanjs/package.json");
1115
1118
  const [majorVersion, minorVersion, patchVersion, devPatchVersion] = akanPackageJson.version.split(".");
1116
- const isOfficialRelease = !devPatchVersion;
1117
- const targetVersionPrefix = isOfficialRelease ? `${majorVersion}.${minorVersion}` : `${majorVersion}.${minorVersion}.${patchVersion}`;
1118
- const tag = distTag ?? (isOfficialRelease ? "latest" : patchVersion.split("-").at(1) ?? "dev");
1119
- const latestPublishedVersion = await getLatestPackageVersion("akanjs", tag, registry).catch(() => null);
1120
- const latestPatch = latestPublishedVersion?.startsWith(targetVersionPrefix) ? parseInt(latestPublishedVersion.split(".").at(-1) ?? "-1") : -1;
1119
+ const releaseVersion = `${majorVersion}.${minorVersion}.${patchVersion.split("-")[0]}`;
1120
+ const isOfficialRelease = !devPatchVersion && !prerelease;
1121
+ const prereleasePrefix = prerelease ? `${releaseVersion}-${prerelease}` : `${majorVersion}.${minorVersion}.${patchVersion}`;
1122
+ const targetVersionPrefix = isOfficialRelease ? `${majorVersion}.${minorVersion}` : prereleasePrefix;
1123
+ const tag = distTag ?? (isOfficialRelease ? "latest" : prerelease ?? patchVersion.split("-").at(1) ?? "dev");
1124
+ const published = await Promise.all(akanPkgs.map((library) => getPublishedVersions(library, registry)));
1125
+ if (prerelease) {
1126
+ const released = published.flatMap((entry) => entry?.tags.latest ?? []).sort(Bun.semver.order).at(-1);
1127
+ if (released && Bun.semver.order(releaseVersion, released) <= 0)
1128
+ throw new Error(`akanjs ${released} is already released, so ${targetVersionPrefix}.N would sort below it; run \`changeset version\` first so the packages carry the next release`);
1129
+ }
1130
+ const latestPatch = Math.max(-1, ...published.flatMap((entry) => entry ? [...entry.versions, ...Object.values(entry.tags)] : []).filter((version) => version.startsWith(`${targetVersionPrefix}.`)).map((version) => version.slice(targetVersionPrefix.length + 1)).filter((patch) => /^\d+$/.test(patch)).map(Number));
1121
1131
  const nextVersion = `${targetVersionPrefix}.${latestPatch + 1}`;
1122
- Logger3.info(`Latest published version of akanjs: ${latestPublishedVersion ?? "none"}`);
1132
+ Logger3.info(`Highest published ${targetVersionPrefix}.N: ${latestPatch < 0 ? "none" : latestPatch}`);
1123
1133
  Logger3.info(`Next version of akanjs: ${nextVersion}`);
1134
+ const internalDependencies = new Map;
1124
1135
  for (const library of akanPkgs) {
1125
1136
  const packageJson = await workspace.readJson(`pkgs/${library}/package.json`);
1126
1137
  const newPackageJson = this.#normalizeAkanPackageJson(packageJson, library, nextVersion);
@@ -1128,6 +1139,12 @@ ${run.format(results)}
1128
1139
  const distPackageJson = await workspace.readJson(`dist/pkgs/${library}/package.json`);
1129
1140
  const newDistPackageJson = this.#normalizeAkanPackageJson(distPackageJson, library, nextVersion);
1130
1141
  await workspace.writeJson(`dist/pkgs/${library}/package.json`, newDistPackageJson);
1142
+ internalDependencies.set(library, Object.keys({ ...newDistPackageJson.dependencies, ...newDistPackageJson.peerDependencies }).filter((dep) => dep !== library && akanPkgs.includes(dep)));
1143
+ }
1144
+ const publishOrder = this.#dependenciesFirst(akanPkgs, internalDependencies);
1145
+ if (packTo) {
1146
+ await this.#packForPublish(workspace, publishOrder, { packTo, tag, version: nextVersion });
1147
+ return;
1131
1148
  }
1132
1149
  if (confirmPublish)
1133
1150
  assertPromptable(`Publishing ${akanPkgs.join(", ")}@${nextVersion} asks for a confirmation`, {
@@ -1137,12 +1154,12 @@ ${run.format(results)}
1137
1154
  Logger3.error("Deployment cancelled");
1138
1155
  return;
1139
1156
  }
1140
- if (!registry) {
1157
+ if (!registry && npmLogin) {
1141
1158
  Logger3.info("Logging in to npm...");
1142
1159
  await workspace.spawn("npm", ["login"], { stdio: "inherit" });
1143
1160
  Logger3.info("Logged in to npm");
1144
1161
  }
1145
- for (const library of akanPkgs) {
1162
+ for (const library of publishOrder) {
1146
1163
  Logger3.info(`Publishing ${library}@${nextVersion} to ${registry ?? "npm"}...`);
1147
1164
  await workspace.spawn("npm", ["publish", "--tag", tag, ...this.#getRegistryArgs(registry), ...this.#getLocalRegistryAuthArgs(registry)], {
1148
1165
  cwd: path8.join(workspace.workspaceRoot, "dist/pkgs", library),
@@ -1153,6 +1170,35 @@ ${run.format(results)}
1153
1170
  }
1154
1171
  Logger3.info(`All libraries are published to ${registry ?? "npm"}`);
1155
1172
  }
1173
+ #dependenciesFirst(libraries, dependencies) {
1174
+ const ordered = [];
1175
+ const visiting = new Set;
1176
+ const visit = (library) => {
1177
+ if (ordered.includes(library) || visiting.has(library))
1178
+ return;
1179
+ visiting.add(library);
1180
+ for (const dependency of dependencies.get(library) ?? [])
1181
+ visit(dependency);
1182
+ ordered.push(library);
1183
+ };
1184
+ for (const library of libraries)
1185
+ visit(library);
1186
+ return ordered;
1187
+ }
1188
+ async#packForPublish(workspace, libraries, { packTo, tag, version }) {
1189
+ const packDir = path8.resolve(workspace.workspaceRoot, packTo);
1190
+ await workspace.mkdir(packDir);
1191
+ const tarballs = [];
1192
+ for (const library of libraries) {
1193
+ const output = await workspace.spawn("npm", ["pack", "--json", "--pack-destination", packDir], {
1194
+ cwd: path8.join(workspace.workspaceRoot, "dist/pkgs", library)
1195
+ });
1196
+ const [{ filename }] = JSON.parse(output);
1197
+ tarballs.push(filename);
1198
+ }
1199
+ await workspace.writeJson(path8.join(packDir, "publish.json"), { version, tag, tarballs });
1200
+ Logger3.info(`Packed ${libraries.join(", ")}@${version} for \`npm publish --tag ${tag}\` into ${packDir}`);
1201
+ }
1156
1202
  async update(workspace, tag = "latest", { registryUrl } = {}) {
1157
1203
  const registry = registryUrl ? getNpmRegistryUrl(registryUrl) : undefined;
1158
1204
  const registryArgs = this.#getRegistryArgs(registry);