@akanjs/cli 3.1.1-rc.4 → 3.1.1-rc.6

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 (73) hide show
  1. package/.build-stamp +1 -1
  2. package/{CodeAgent-8hfzq1zs.js → CodeAgent-y6ppa10x.js} +2 -2
  3. package/{CodeTui-kj6ng91g.js → CodeTui-dy37zz3j.js} +1 -1
  4. package/TunnelShare-mnn0jxnp.js +14 -0
  5. package/{agent.command-2gay26y4.js → agent.command-ydftceda.js} +5 -5
  6. package/akanCode.js +2 -2
  7. package/{application.command-a3aepayy.js → application.command-fdghyjfj.js} +9 -9
  8. package/{applicationBuildRunner-xye2sqrm.js → applicationBuildRunner-t2r84sz6.js} +72 -26
  9. package/buildBatch.proc.js +5 -5
  10. package/{cloud.command-t2zdcw87.js → cloud.command-eyxwxnrn.js} +13 -13
  11. package/cloud.script-c9f92bev.js +24 -0
  12. package/{code.command-184jfjtk.js → code.command-4kqbrjt9.js} +6 -6
  13. package/{context.command-kx0kzz3t.js → context.command-h56yvjay.js} +16 -16
  14. package/context.runner-cf11819z.js +25 -0
  15. package/{guideline.command-72psmnpx.js → guideline.command-snh85ctf.js} +2 -2
  16. package/guidelines/agentRule/agentRule.instruction.md +5 -2
  17. package/guidelines/conventions/conventions.instruction.md +10 -7
  18. package/guidelines/pageRule/pageRule.instruction.md +8 -0
  19. package/guidelines/queryRule/queryRule.instruction.md +10 -1
  20. package/guidelines/runtimeRule/runtimeRule.instruction.md +12 -0
  21. package/guidelines/workspaceOnboarding/workspaceOnboarding.instruction.md +2 -1
  22. package/incrementalBuilder.proc.js +3 -3
  23. package/{index-0fpeb7x7.js → index-0fz95kxe.js} +1 -1
  24. package/{index-jn8gfj2b.js → index-12ny6e0x.js} +9 -9
  25. package/{index-sxqjxb4j.js → index-2xcc2ax5.js} +2 -2
  26. package/{index-md6026rp.js → index-31es1yev.js} +24 -2
  27. package/{index-azrhhgtb.js → index-3wypz6xj.js} +59 -8
  28. package/{index-kb51mayy.js → index-40brg4px.js} +3 -3
  29. package/{index-mtf0cx8t.js → index-42j4a8zq.js} +2 -2
  30. package/{index-x6c29k5m.js → index-44hh6bx2.js} +7 -7
  31. package/{index-qp73c26e.js → index-4vgbysa0.js} +3 -3
  32. package/{index-5anqj3bm.js → index-74tjjsnc.js} +4 -4
  33. package/{index-q0e6604h.js → index-905qdgqp.js} +1 -1
  34. package/{index-0dnv1039.js → index-b70zct19.js} +7 -7
  35. package/{index-bxjacq5c.js → index-bksa6cqh.js} +3 -3
  36. package/{index-s28awecf.js → index-ds2tmxgx.js} +3 -3
  37. package/{index-hrc7q2e6.js → index-e9b3zh22.js} +2 -2
  38. package/{index-eyhqttvh.js → index-espk51ah.js} +2 -2
  39. package/{index-3wfw8jb8.js → index-hmt54t45.js} +4 -4
  40. package/{index-zz5731qs.js → index-j9vyj3dj.js} +3 -3
  41. package/{index-xhnw8n74.js → index-jg2xev75.js} +2 -1
  42. package/{index-rqcmr940.js → index-jhbkzc8c.js} +4 -4
  43. package/{index-hqaa4y3y.js → index-kr9vpvdn.js} +8 -8
  44. package/{index-v1gz5vja.js → index-krz4bcg5.js} +1 -1
  45. package/{index-yaz7yks8.js → index-pcwzkdqb.js} +1 -1
  46. package/{index-ssseyt0n.js → index-secyhsjs.js} +4 -4
  47. package/{index-4q1amb3p.js → index-skk9zc1x.js} +2 -2
  48. package/{index-trjhp735.js → index-wcej7g4z.js} +5 -5
  49. package/{index-4g6te8sa.js → index-xb8809yb.js} +2 -2
  50. package/{index-9z37veck.js → index-xjf5j657.js} +1 -1
  51. package/{index-ggfjqpp4.js → index-zz4vrw85.js} +1 -1
  52. package/index.js +22 -22
  53. package/{library.command-tnxw0yb4.js → library.command-gycrwhf1.js} +3 -3
  54. package/{localRegistry.command-dy0byd6z.js → localRegistry.command-bajag7gm.js} +12 -12
  55. package/{module.command-8pjk6vmm.js → module.command-v6hgs1bc.js} +5 -5
  56. package/{package.command-b831nx2n.js → package.command-shzpcfph.js} +3 -3
  57. package/package.json +2 -2
  58. package/{page.command-earjccmn.js → page.command-ptxn5kqk.js} +3 -3
  59. package/{pipeline.command-yt8bq91c.js → pipeline.command-zz31pgax.js} +2 -2
  60. package/{primitive.command-8dw8ra1x.js → primitive.command-a1vse91z.js} +6 -6
  61. package/{projectTypecheck-btbw3nyf.js → projectTypecheck-2ztky9cf.js} +1 -1
  62. package/{quality.command-j2c4a2zg.js → quality.command-ah8qcakd.js} +2 -2
  63. package/{repair.command-7jv7bgc4.js → repair.command-cvazbz99.js} +5 -5
  64. package/{scalar.command-vwjk94zr.js → scalar.command-0acvyp26.js} +4 -4
  65. package/{subspace.command-xjw4tc0p.js → subspace.command-dzpfbc99.js} +8 -8
  66. package/templates/app/tsconfig.json.template +2 -7
  67. package/templates/workspaceRoot/bunfig.toml.template +0 -4
  68. package/{tunnel.command-zm29dgkr.js → tunnel.command-cfw6f0vz.js} +7 -7
  69. package/{workflow.command-nyjc1mxx.js → workflow.command-abb1d5xy.js} +10 -10
  70. package/{workspace.command-rq7mgq6f.js → workspace.command-5rc8f0wt.js} +30 -31
  71. package/TunnelShare-ycmz33ve.js +0 -14
  72. package/cloud.script-mm636g83.js +0 -24
  73. package/context.runner-d7dhvbc7.js +0 -25
@@ -78,6 +78,14 @@ body shape — this is the full contract behind them. Before changing route beha
78
78
  - **A route guard is not authorization for data.** It keeps a person off a screen and redirects early; every query
79
79
  the screen makes is still judged by that endpoint's own `guards`. Write both: the signal guard is the gate, the
80
80
  route guard is the courtesy that answers before the screen draws.
81
+ - **Keeping a person on a page is `router.addNavigationGuard(guard)`, not `.guard()`.** `guard({ kind, from, to })`
82
+ is asked before every in-app move — `push`, `replace`, `back`, a `Link`, the browser's back and forward (`pop`), a
83
+ native back or swipe, the agent's `navigate` and `goBack` — with routes free of locale and basePath and `to: null`
84
+ for a `back`. `false`, a throw or a rejection keeps the page, `router.navigation()` rejects with
85
+ `NavigationRefused`, and a refused browser back is undone before the page redraws. Guards answer one at a time; a
86
+ move started while one decides is refused. Register it from an effect and return the remover
87
+ (`useEffect(() => router.addNavigationGuard(…), [isDirty])`). Redirects, `notFound()`, `setLang` and moves off the
88
+ origin are not asked; a closing tab is `beforeunload`'s.
81
89
 
82
90
  ## MCP Apps — `.app()`
83
91
 
@@ -115,9 +115,18 @@ this is the full contract behind them.
115
115
  document path**: they fire no hooks, so a model whose removal cascades or carries a `_postRemove` still goes
116
116
  through `remove<Model>(id)`.
117
117
  - The write-through pair is `pickAndWrite(id, data)` / `pickOneAndWrite(query, data)` — pick the document, write
118
- into it and save it, so the save hooks do run; reach for those when the write has to be seen by them.
118
+ into it and save it, so the save hooks do run; reach for those when the write has to be seen by them. A third
119
+ argument `{ touch: false }`, like `doc.save({ touch: false })`, keeps `updatedAt` while the hooks and live sync
120
+ still run — a nudge that re-sends a row its rooms must re-read, with no edit to stamp.
119
121
  - `upsertById(data, { preserveTimestamps })` writes a record whole under its own id, new or in place, with no
120
122
  hook: the write a sync or a backfill repeats safely, keeping the record's `createdAt`/`updatedAt` when asked.
123
+ - **Writes that must land together go in `this.transaction(async () => …)`**, which every service has: it commits
124
+ when the body resolves, returns its value, and rolls back when it throws, rethrowing that error unchanged. A
125
+ server has one database, so it covers every model, hooks and query-level writes included; a nested call joins the
126
+ outer one, with no savepoint. Cache, `memory` and outside calls are not in it — hand them to
127
+ `this.afterCommit(fn)`, run once the commit lands, never after a rollback, at once outside one; one that throws is
128
+ logged, never thrown, and the rest still run. On SQLite it holds the only write turn: keep it short.
129
+ `@Transaction()` is deprecated.
121
130
 
122
131
  ## Text Search In A Filter — `q.search()`
123
132
 
@@ -239,6 +239,10 @@ const config: AppConfig = { docker: "FROM oven/bun:1.4.4-slim\n…" }; // verbat
239
239
  `RUN if [ "$TARGETARCH" = "<arch>" ]` guard, so a multi-arch build runs it on one leg only. `preRuns` land
240
240
  before `bun install --production` (where a native dependency's build tools have to be), `postRuns` after it
241
241
  and before the app files are copied.
242
+ - **The image installs the versions the workspace locked.** `akan build` writes a `bun.lock` beside the image's
243
+ `package.json`, cut down from the workspace's to what the server needs, and the image installs it
244
+ `--frozen-lockfile`. A workspace without a root `bun.lock` gets a warning and an unlocked install; a Dockerfile
245
+ written whole copies `bun.lock` itself.
242
246
  - **A lib declares the steps its own runtime needs**, and every app that mounts it inherits them:
243
247
  `libs/<lib>/akan.config.ts` takes `docker: { preRuns, postRuns }` and nothing else — the base image and the
244
248
  command belong to the app. Lib steps are emitted before the app's own, and an identical step declared twice
@@ -513,6 +517,14 @@ The carried server asks the shell that showed the dialog over its IPC channel, s
513
517
  and nothing else, and no page ever holds a path. Behind a dev build `akan start` checks the grant's signature
514
518
  against a key in `~/.akan/native` instead, in `operationMode` local only; every other server refuses a grant.
515
519
 
520
+ **A secret the user gives the server is kept by the OS, never in a file.** `NativeSecret.set(key, value)`,
521
+ `get(key)` (null when none is kept) and `remove(key)` from `akanjs/server` reach the OS credential store through the
522
+ shell that carries the server — the macOS Keychain, the Windows Credential Manager, the Secret Service on Linux — in a
523
+ store of the server's own, apart from the page's `secretStorage`, so no page script reads it. Anywhere but a carried
524
+ server `NativeSecret.available` is false and every call rejects: keep secrets in the env there. On macOS without a
525
+ Team ID signature, any program of the same user can read the store's key through `security`, as with
526
+ `secretStorage`.
527
+
516
528
  **Devices belong to the shell, not the server.** Displays and their changes (`screen`), windows placed on them
517
529
  (`window`), the system volume and mute (`volume`), global shortcuts (`global-shortcut`), keep-awake (`keep-awake`)
518
530
  and launch at login (`autostart`) are native runtime plugins, each added to `native.plugins`. Every builtin plugin's
@@ -250,7 +250,8 @@ query-level writes are in `queryRule`; these are the shapes that build green and
250
250
  a `list<Filter>(...)` / `listBy...(...)` array. Returning an array type-checks but fails at runtime with
251
251
  `Unknown document field path: 0`. (See Recipe 3.)
252
252
  - **Custom endpoint names must not collide with generated CRUD.** `create/update/remove/view/edit/merge<Model>`
253
- already exist. A collision can build green and fail only at runtime — pick a distinct verb.
253
+ already exist wherever the slice mounts the verb. A collision builds green and the server refuses to boot
254
+ (`[DI:fetch]`) — pick a distinct verb.
254
255
  - **Numbers are `Int` or `Float`, never `Number`.** `field(Number)` / `.body("x", Number)` fail to typecheck.
255
256
  - **Array fields use `field([T])`** — `tags: field([String])`, `images: field([File])`.
256
257
  - **Reading a secret field needs an explicit select, and the two call sites spell it differently.**
@@ -8,7 +8,7 @@ import {
8
8
  CodegenLock,
9
9
  WorkspaceExecutor,
10
10
  AppExecutor
11
- } from "./index-trjhp735.js";
11
+ } from "./index-wcej7g4z.js";
12
12
  import"./index-52w0fvh8.js";
13
13
  import {
14
14
  GraphClientEntryDiscovery,
@@ -19,10 +19,10 @@ import {
19
19
  DevChangePlanner,
20
20
  DevGeneratedIndexSync,
21
21
  SsrDevBundler
22
- } from "./index-eyhqttvh.js";
22
+ } from "./index-espk51ah.js";
23
23
  import {
24
24
  ServerGraphFile
25
- } from "./index-0fpeb7x7.js";
25
+ } from "./index-0fz95kxe.js";
26
26
  import {
27
27
  prepareDevWatchBatch
28
28
  } from "./index-a5vmm6x4.js";
@@ -2,7 +2,7 @@
2
2
  import {
3
3
  AsyncDefaultExportDetector,
4
4
  resolveSsrPageEntriesForApp
5
- } from "./index-trjhp735.js";
5
+ } from "./index-wcej7g4z.js";
6
6
  import {
7
7
  FileSys2
8
8
  } from "./index-52w0fvh8.js";
@@ -41,7 +41,7 @@ import {
41
41
  script,
42
42
  markCliErrorPrinted,
43
43
  assertPromptable
44
- } from "./index-azrhhgtb.js";
44
+ } from "./index-3wypz6xj.js";
45
45
  import {
46
46
  AppInfo,
47
47
  CommandExecutionError,
@@ -50,11 +50,11 @@ import {
50
50
  AppExecutor,
51
51
  LibExecutor,
52
52
  PkgExecutor
53
- } from "./index-trjhp735.js";
53
+ } from "./index-wcej7g4z.js";
54
54
  import {
55
55
  DesktopServerStage,
56
56
  UpdateUploader
57
- } from "./index-xhnw8n74.js";
57
+ } from "./index-jg2xev75.js";
58
58
  import {
59
59
  resolveMobileTargets,
60
60
  resolveAppId
@@ -63,17 +63,17 @@ import {
63
63
  NativePublicEnv,
64
64
  UpdatePackFolder,
65
65
  NativeApp
66
- } from "./index-s28awecf.js";
66
+ } from "./index-ds2tmxgx.js";
67
67
  import {
68
68
  LibraryScript
69
- } from "./index-sxqjxb4j.js";
69
+ } from "./index-2xcc2ax5.js";
70
70
  import {
71
71
  stripAnsi
72
72
  } from "./index-7md2g9vw.js";
73
73
  import {
74
74
  SlicePlanner,
75
75
  formatSlicePlan
76
- } from "./index-yaz7yks8.js";
76
+ } from "./index-pcwzkdqb.js";
77
77
  import {
78
78
  openBrowser
79
79
  } from "./index-9dp031by.js";
@@ -1900,7 +1900,7 @@ ${uniqueCandidates.map((candidate) => ` - ${candidate}`).join(`
1900
1900
 
1901
1901
  // pkgs/@akanjs/cli/application/application.runner.ts
1902
1902
  import { Logger as Logger3, toError } from "akanjs/common";
1903
- var loadBuildRunner = async () => (await import("./applicationBuildRunner-xye2sqrm.js")).ApplicationBuildRunner;
1903
+ var loadBuildRunner = async () => (await import("./applicationBuildRunner-t2r84sz6.js")).ApplicationBuildRunner;
1904
1904
  var loadPrompts = async () => await import("@inquirer/prompts");
1905
1905
 
1906
1906
  class ApplicationRunner extends runner("application") {
@@ -2101,7 +2101,7 @@ if (loaded) process.exitCode = await loaded.migrations.command(loaded.server, ar
2101
2101
  await new (await loadBuildRunner())(app).typecheck(options);
2102
2102
  }
2103
2103
  async typecheckLibrary(lib, options = {}) {
2104
- const { ProjectTypecheck } = await import("./projectTypecheck-btbw3nyf.js");
2104
+ const { ProjectTypecheck } = await import("./projectTypecheck-2ztky9cf.js");
2105
2105
  const root = lib.workspace.workspaceRoot;
2106
2106
  await new ProjectTypecheck(lib.cwdPath, root, { ...process.env, AKAN_WORKSPACE_ROOT: root }).run([
2107
2107
  "../../server.ts",
@@ -3706,7 +3706,7 @@ class ApplicationScript extends script("application", [ApplicationRunner, Librar
3706
3706
  await Promise.all(shares.map(async (share) => await share.close()));
3707
3707
  }, "Abandoning the tunnel release; the shares expire on their own.");
3708
3708
  await Promise.all(apps.map(async (app) => {
3709
- const { TunnelShare } = await import("./TunnelShare-ycmz33ve.js");
3709
+ const { TunnelShare } = await import("./TunnelShare-mnn0jxnp.js");
3710
3710
  const share = await TunnelShare.open(app, { workspace: app.workspace });
3711
3711
  shares.push(share);
3712
3712
  urls.set(app.name, share.url);
@@ -2,13 +2,13 @@
2
2
  import {
3
3
  runner,
4
4
  script
5
- } from "./index-azrhhgtb.js";
5
+ } from "./index-3wypz6xj.js";
6
6
  import {
7
7
  LibSource,
8
8
  formatLibStatuses,
9
9
  CommandExecutionError,
10
10
  LibExecutor
11
- } from "./index-trjhp735.js";
11
+ } from "./index-wcej7g4z.js";
12
12
 
13
13
  // pkgs/@akanjs/cli/library/library.script.ts
14
14
  import { Logger } from "akanjs/common";
@@ -10,7 +10,7 @@ import {
10
10
  isScannedRootEntry,
11
11
  AppExecutor,
12
12
  LibExecutor
13
- } from "./index-trjhp735.js";
13
+ } from "./index-wcej7g4z.js";
14
14
  import {
15
15
  FileSys2
16
16
  } from "./index-52w0fvh8.js";
@@ -23,7 +23,7 @@ import {
23
23
  workflowPathsForPlan,
24
24
  workflowRunArtifactPath,
25
25
  workflowSyncDir
26
- } from "./index-9z37veck.js";
26
+ } from "./index-xjf5j657.js";
27
27
 
28
28
  // pkgs/@akanjs/devkit/akanContext.ts
29
29
  import { readdir } from "fs/promises";
@@ -372,6 +372,25 @@ class AkanContextAnalyzer {
372
372
  hint
373
373
  };
374
374
  }
375
+ static async#configLeftovers(workspace, sysPaths) {
376
+ const leftovers = [];
377
+ for (const sysPath of sysPaths) {
378
+ const tsconfigPath = `${sysPath}/tsconfig.json`;
379
+ const tsconfig = await safeReadText(path.join(workspace.workspaceRoot, tsconfigPath));
380
+ if (tsconfig && (/"name"\s*:\s*"next"/.test(tsconfig) || tsconfig.includes(".next/types")))
381
+ leftovers.push({
382
+ path: tsconfigPath,
383
+ message: `${tsconfigPath} still names the Next.js TS plugin or .next/types, which Akan never uses \u2014 delete the "next" plugin entry and the ".next/types/**/*.ts" include.`
384
+ });
385
+ }
386
+ const bunfig = await safeReadText(path.join(workspace.workspaceRoot, "bunfig.toml"));
387
+ if (bunfig?.includes("bun-plugin-tailwind"))
388
+ leftovers.push({
389
+ path: "bunfig.toml",
390
+ message: "bunfig.toml still loads bun-plugin-tailwind, which is not installed and which Akan never uses (it compiles Tailwind itself) \u2014 delete the [serve.static] section, which Akan never reads."
391
+ });
392
+ return leftovers;
393
+ }
375
394
  static async doctor(workspace, {
376
395
  strict = false,
377
396
  runIdOrPlan = null,
@@ -415,6 +434,9 @@ class AkanContextAnalyzer {
415
434
  const agentDrift = await AkanContextAnalyzer.#agentGuideDrift(workspace);
416
435
  if (agentDrift)
417
436
  report({ severity: "warning", code: agentDrift.code, path: "AGENTS.md", message: agentDrift.message }, repairAction("generated", "akan agent install agents-md", agentDrift.hint, true));
437
+ const sysPaths = [...context.apps, ...context.libs].map((sys) => sys.path);
438
+ for (const leftover of await AkanContextAnalyzer.#configLeftovers(workspace, sysPaths))
439
+ diagnostics.push({ severity: "warning", code: "config-leftover", ...leftover });
418
440
  for (const sys of [...context.apps, ...context.libs]) {
419
441
  for (const module of sys.modules) {
420
442
  const moduleShapeCommand = `akan repair module-shape --app ${sys.name} --module ${module.name}`;
@@ -10,7 +10,7 @@ import {
10
10
  LibExecutor,
11
11
  PkgExecutor,
12
12
  ModuleExecutor
13
- } from "./index-trjhp735.js";
13
+ } from "./index-wcej7g4z.js";
14
14
 
15
15
  // pkgs/@akanjs/devkit/commandDecorators/camelToKebabCase.ts
16
16
  var camelToKebabCase = (str) => str.replace(/([A-Z])/g, "-$1").toLowerCase();
@@ -60,7 +60,7 @@ var Pkg = createInternalArgToken("Pkg");
60
60
  var Module = createInternalArgToken("Module");
61
61
  var Workspace = createInternalArgToken("Workspace");
62
62
  // pkgs/@akanjs/devkit/commandDecorators/command.ts
63
- import path2 from "path";
63
+ import path3 from "path";
64
64
  import { Logger } from "akanjs/common";
65
65
  import chalk2 from "chalk";
66
66
  import { program } from "commander";
@@ -299,6 +299,59 @@ var formatCommandHelp = (command, key) => {
299
299
  `);
300
300
  };
301
301
 
302
+ // pkgs/@akanjs/devkit/commandDecorators/workspaceVersionCheck.ts
303
+ import { existsSync, readFileSync, realpathSync } from "fs";
304
+ import path2 from "path";
305
+
306
+ class WorkspaceVersionCheck {
307
+ static #exemptCommands = new Set(["update", "create-workspace"]);
308
+ static #infoFlags = new Set(["--help", "-h", "--version", "-V"]);
309
+ static #updateTags = new Set(["dev", "canary", "beta", "rc", "alpha"]);
310
+ static warning(cliVersion, argv, workspaceRoot) {
311
+ const args = argv.slice(2);
312
+ if (!cliVersion || WorkspaceVersionCheck.#exemptCommands.has(args[0] ?? ""))
313
+ return null;
314
+ if (args.some((arg) => WorkspaceVersionCheck.#infoFlags.has(arg)))
315
+ return null;
316
+ const installed = WorkspaceVersionCheck.installedAkanVersion(workspaceRoot);
317
+ if (!installed || installed === cliVersion)
318
+ return null;
319
+ const pinnedCli = WorkspaceVersionCheck.#versionAt(path2.join(workspaceRoot, "node_modules/@akanjs/cli"));
320
+ const runner = pinnedCli === installed ? ["bunx"] : ["bunx", "-p", `@akanjs/cli@${installed}`];
321
+ const rerun = [...runner, "akan", ...args].map(WorkspaceVersionCheck.#quote).join(" ");
322
+ const [, prerelease = ""] = cliVersion.split("-");
323
+ const tag = prerelease.split(".")[0];
324
+ const update = `akan update${WorkspaceVersionCheck.#updateTags.has(tag) ? ` --tag ${tag}` : ""}`;
325
+ const lines = [
326
+ `This akan is @akanjs/cli ${cliVersion}, but this workspace has akanjs ${installed}: what it generates may not match the installed framework.`,
327
+ `Run the matching CLI: ${rerun}`
328
+ ];
329
+ if (Bun.semver.order(cliVersion, installed) > 0)
330
+ lines.push(`Or move the workspace and this CLI to the newest release of the line together: ${update}`);
331
+ else if (pinnedCli !== installed)
332
+ lines.push(`Pin it so \`bunx akan\` runs it: bun add -d @akanjs/cli@${installed}`);
333
+ return lines.join(`
334
+ `);
335
+ }
336
+ static installedAkanVersion(workspaceRoot) {
337
+ const packageDir = path2.join(workspaceRoot, "node_modules", "akanjs");
338
+ if (!existsSync(packageDir))
339
+ return null;
340
+ if (!realpathSync(packageDir).split(path2.sep).includes("node_modules"))
341
+ return null;
342
+ return WorkspaceVersionCheck.#versionAt(packageDir);
343
+ }
344
+ static #versionAt(packageDir) {
345
+ const packageJsonPath = path2.join(packageDir, "package.json");
346
+ if (!existsSync(packageJsonPath))
347
+ return null;
348
+ return JSON.parse(readFileSync(packageJsonPath, "utf8")).version ?? null;
349
+ }
350
+ static #quote(arg) {
351
+ return /^[\w@%+=:,./-]+$/.test(arg) ? arg : `'${arg.replaceAll("'", `'\\''`)}'`;
352
+ }
353
+ }
354
+
302
355
  // pkgs/@akanjs/devkit/commandDecorators/command.ts
303
356
  var loggedCliErrorObjects = new WeakSet;
304
357
  var loggedCliErrorMessages = new Set;
@@ -607,7 +660,7 @@ var runCommands = async (...commands) => {
607
660
  process.exit(ExitCodeError.codeOf(error) ?? failureExitCode);
608
661
  });
609
662
  const __dirname2 = getDirname2(import.meta.url);
610
- const packageJsonCandidates = [`${path2.dirname(Bun.main)}/package.json`, `${__dirname2}/../package.json`];
663
+ const packageJsonCandidates = [`${path3.dirname(Bun.main)}/package.json`, `${__dirname2}/../package.json`];
611
664
  let cliPackageJson = null;
612
665
  for (const packageJsonPath of packageJsonCandidates) {
613
666
  if (!await FileSys2.fileExists(packageJsonPath))
@@ -627,12 +680,10 @@ var runCommands = async (...commands) => {
627
680
  program.version(process.env.AKAN_VERSION).description("Akan CLI").configureHelp({
628
681
  helpWidth: 100
629
682
  });
630
- const installedAkanPackageJson = await FileSys2.fileExists("./node_modules/akanjs/package.json") ? await FileSys2.readJson("./node_modules/akanjs/package.json") : null;
631
- if (installedAkanPackageJson && installedAkanPackageJson.version !== process.env.AKAN_VERSION) {
683
+ const versionWarning = WorkspaceVersionCheck.warning(cliPackageJson?.version, process.argv, process.cwd());
684
+ if (versionWarning)
632
685
  Logger.rawLog(chalk2.yellow(`
633
- Akan CLI version is mismatch with installed package. ${process.env.AKAN_VERSION} (global) vs ${installedAkanPackageJson.version} (akanjs)
634
- It may cause unexpected behavior. Run \`akan update\` to update latest akanjs.`), undefined, "error");
635
- }
686
+ ${versionWarning}`), undefined, "error");
636
687
  for (const command of commands) {
637
688
  const targetMetas = getTargetMetas(command);
638
689
  for (const targetMeta of targetMetas) {
@@ -1,7 +1,7 @@
1
1
  // @bun
2
2
  import {
3
3
  resolveSsrPageEntriesForApp
4
- } from "./index-trjhp735.js";
4
+ } from "./index-wcej7g4z.js";
5
5
  import {
6
6
  computeRouteSeedIndex,
7
7
  saveRouteSeedIndex,
@@ -9,7 +9,7 @@ import {
9
9
  ClientEntriesBundler,
10
10
  VENDOR_SPECIFIERS,
11
11
  RouteClientBuilder
12
- } from "./index-eyhqttvh.js";
12
+ } from "./index-espk51ah.js";
13
13
  import {
14
14
  SOURCE_EXTS
15
15
  } from "./index-5nd1wtkv.js";
@@ -19,7 +19,7 @@ import {
19
19
  createTsconfigPackageResolver,
20
20
  rewriteBarrelImports,
21
21
  PagesBundleBuilder
22
- } from "./index-0fpeb7x7.js";
22
+ } from "./index-0fz95kxe.js";
23
23
  import {
24
24
  CssBlockParser
25
25
  } from "./index-62md4dwy.js";
@@ -2,13 +2,13 @@
2
2
  import {
3
3
  runner,
4
4
  script
5
- } from "./index-azrhhgtb.js";
5
+ } from "./index-3wypz6xj.js";
6
6
  import {
7
7
  FileSys2
8
8
  } from "./index-52w0fvh8.js";
9
9
  import {
10
10
  PkgExecutor
11
- } from "./index-trjhp735.js";
11
+ } from "./index-wcej7g4z.js";
12
12
  import {
13
13
  TypeScriptDependencyScanner2
14
14
  } from "./index-tvehn2sp.js";
@@ -4,26 +4,26 @@ import {
4
4
  CloudApi,
5
5
  CloudUpdates,
6
6
  PipelineSecrets
7
- } from "./index-hrc7q2e6.js";
7
+ } from "./index-e9b3zh22.js";
8
8
  import {
9
9
  PkgExecutor
10
- } from "./index-trjhp735.js";
10
+ } from "./index-wcej7g4z.js";
11
11
  import {
12
12
  NativePublicEnv,
13
13
  UpdatePackFolder
14
- } from "./index-s28awecf.js";
14
+ } from "./index-ds2tmxgx.js";
15
15
  import {
16
16
  script
17
- } from "./index-azrhhgtb.js";
17
+ } from "./index-3wypz6xj.js";
18
18
  import {
19
19
  ApplicationScript
20
- } from "./index-jn8gfj2b.js";
20
+ } from "./index-12ny6e0x.js";
21
21
  import {
22
22
  PackageScript
23
- } from "./index-mtf0cx8t.js";
23
+ } from "./index-42j4a8zq.js";
24
24
  import {
25
25
  CloudRunner
26
- } from "./index-rqcmr940.js";
26
+ } from "./index-jhbkzc8c.js";
27
27
 
28
28
  // pkgs/@akanjs/cli/cloud/cloud.script.ts
29
29
  import { Logger } from "akanjs/common";
@@ -2,7 +2,7 @@
2
2
  import {
3
3
  runner,
4
4
  script
5
- } from "./index-azrhhgtb.js";
5
+ } from "./index-3wypz6xj.js";
6
6
  import {
7
7
  AGENT_BLOCK_START,
8
8
  AGENT_BLOCK_END,
@@ -13,14 +13,14 @@ import {
13
13
  CLAUDE_COMMENT_RULE,
14
14
  AppExecutor,
15
15
  LibExecutor
16
- } from "./index-trjhp735.js";
16
+ } from "./index-wcej7g4z.js";
17
17
  import {
18
18
  collectRecipeSources2,
19
19
  scanRecipes2
20
20
  } from "./index-hj6w4ka1.js";
21
21
  import {
22
22
  AkanContextAnalyzer
23
- } from "./index-md6026rp.js";
23
+ } from "./index-31es1yev.js";
24
24
  import {
25
25
  Prompter2
26
26
  } from "./index-zzvvc845.js";
@@ -1,12 +1,12 @@
1
1
  // @bun
2
2
  import {
3
3
  script
4
- } from "./index-azrhhgtb.js";
4
+ } from "./index-3wypz6xj.js";
5
5
  import {
6
6
  AppExecutor,
7
7
  LibExecutor,
8
8
  ModuleExecutor
9
- } from "./index-trjhp735.js";
9
+ } from "./index-wcej7g4z.js";
10
10
  import {
11
11
  workflowStatus,
12
12
  compactDiagnostics,
@@ -41,10 +41,10 @@ import {
41
41
  hasSignalFactoryEntry,
42
42
  insertSignalFactoryEntry,
43
43
  addFieldUiPolicyForType
44
- } from "./index-9z37veck.js";
44
+ } from "./index-xjf5j657.js";
45
45
  import {
46
46
  ModuleScript
47
- } from "./index-3wfw8jb8.js";
47
+ } from "./index-hmt54t45.js";
48
48
 
49
49
  // pkgs/@akanjs/cli/primitive/primitive.script.ts
50
50
  import { capitalize, lowerlize } from "akanjs/common";
@@ -2,7 +2,7 @@
2
2
  import {
3
3
  runner,
4
4
  script
5
- } from "./index-azrhhgtb.js";
5
+ } from "./index-3wypz6xj.js";
6
6
 
7
7
  // pkgs/@akanjs/cli/page/page.runner.ts
8
8
  class PageRunner extends runner("page") {
@@ -22,26 +22,26 @@ import {
22
22
  renderWorkflowApply,
23
23
  renderWorkflowValidation,
24
24
  renderWorkflowRunArtifact
25
- } from "./index-9z37veck.js";
25
+ } from "./index-xjf5j657.js";
26
26
  import {
27
27
  AkanContextAnalyzer
28
- } from "./index-md6026rp.js";
28
+ } from "./index-31es1yev.js";
29
29
  import {
30
30
  CommandContainer,
31
31
  runner
32
- } from "./index-azrhhgtb.js";
32
+ } from "./index-3wypz6xj.js";
33
33
  import {
34
34
  ModuleScript
35
- } from "./index-3wfw8jb8.js";
35
+ } from "./index-hmt54t45.js";
36
36
  import {
37
37
  PrimitiveScript
38
- } from "./index-5anqj3bm.js";
38
+ } from "./index-74tjjsnc.js";
39
39
  import {
40
40
  spawnShell
41
- } from "./index-zz5731qs.js";
41
+ } from "./index-j9vyj3dj.js";
42
42
  import {
43
43
  ScalarScript
44
- } from "./index-4q1amb3p.js";
44
+ } from "./index-skk9zc1x.js";
45
45
 
46
46
  // pkgs/@akanjs/cli/workflow/workflow.runner.ts
47
47
  import { mkdir, readFile, writeFile } from "fs/promises";
@@ -5,7 +5,7 @@ import {
5
5
  McpServerConfig,
6
6
  McpSignIn,
7
7
  AkanCodeCompaction2
8
- } from "./index-v1gz5vja.js";
8
+ } from "./index-krz4bcg5.js";
9
9
  import {
10
10
  stripAnsi
11
11
  } from "./index-7md2g9vw.js";
@@ -809,7 +809,7 @@ class AkanToolPack2 {
809
809
  return { name: "akan-tools", factory: async (pi) => await this.#register(pi) };
810
810
  }
811
811
  async names() {
812
- const { ContextRunner } = await import("./context.runner-d7dhvbc7.js");
812
+ const { ContextRunner } = await import("./context.runner-cf11819z.js");
813
813
  return [
814
814
  ...new ContextRunner().listMcpTools(this.#options.mode).map((tool) => tool.name),
815
815
  AkanToolPack2.verifyToolName
@@ -817,7 +817,7 @@ class AkanToolPack2 {
817
817
  }
818
818
  static verifyToolName = "akan_verify";
819
819
  async#register(pi) {
820
- const { ContextRunner } = await import("./context.runner-d7dhvbc7.js");
820
+ const { ContextRunner } = await import("./context.runner-cf11819z.js");
821
821
  const runner = new ContextRunner;
822
822
  const guidelineNames = await AkanToolPack2.#guidelineNames();
823
823
  for (const tool of runner.listMcpTools(this.#options.mode, { guidelineNames })) {
@@ -4,17 +4,17 @@ import {
4
4
  ServerEnvProfile,
5
5
  Executor,
6
6
  WorkspaceExecutor
7
- } from "./index-trjhp735.js";
7
+ } from "./index-wcej7g4z.js";
8
8
  import {
9
9
  resolveAppId,
10
10
  targetHtmlFilename
11
11
  } from "./index-m9jj544v.js";
12
12
  import {
13
13
  CsrArtifactBuilder
14
- } from "./index-4g6te8sa.js";
14
+ } from "./index-xb8809yb.js";
15
15
  import {
16
16
  ExitCodeError
17
- } from "./index-azrhhgtb.js";
17
+ } from "./index-3wypz6xj.js";
18
18
 
19
19
  // pkgs/@akanjs/devkit/mobile/desktopBin.ts
20
20
  import { chmod, mkdir, rename, rm, writeFile } from "fs/promises";
@@ -9,10 +9,10 @@ import {
9
9
  NativePublicEnv,
10
10
  UpdatePackFolder,
11
11
  NativeApp
12
- } from "./index-s28awecf.js";
12
+ } from "./index-ds2tmxgx.js";
13
13
  import {
14
14
  ExitCodeError
15
- } from "./index-azrhhgtb.js";
15
+ } from "./index-3wypz6xj.js";
16
16
  import {
17
17
  ConfigLock
18
18
  } from "./index-bqbf654f.js";
@@ -19,11 +19,11 @@ import {
19
19
  CsrDevPaths,
20
20
  PagesEntrySourceGenerator,
21
21
  PagesBundleBuilder
22
- } from "./index-0fpeb7x7.js";
22
+ } from "./index-0fz95kxe.js";
23
23
  import {
24
24
  AsyncDefaultExportDetector,
25
25
  resolveSsrPageEntriesForApp
26
- } from "./index-trjhp735.js";
26
+ } from "./index-wcej7g4z.js";
27
27
 
28
28
  // pkgs/@akanjs/devkit/frontendBuild/autoImportSync.ts
29
29
  import { readdir, readFile, stat } from "fs/promises";
@@ -2,10 +2,10 @@
2
2
  import {
3
3
  runner,
4
4
  script
5
- } from "./index-azrhhgtb.js";
5
+ } from "./index-3wypz6xj.js";
6
6
  import {
7
7
  ModuleExecutor
8
- } from "./index-trjhp735.js";
8
+ } from "./index-wcej7g4z.js";
9
9
  import {
10
10
  sourceFile,
11
11
  moduleSourcePaths,
@@ -13,10 +13,10 @@ import {
13
13
  createPassedPrimitiveReport,
14
14
  bilingualLabelForField,
15
15
  bilingualDescriptionForField
16
- } from "./index-9z37veck.js";
16
+ } from "./index-xjf5j657.js";
17
17
  import {
18
18
  PageScript
19
- } from "./index-q0e6604h.js";
19
+ } from "./index-905qdgqp.js";
20
20
  import {
21
21
  pluralizeName
22
22
  } from "./index-nz8prx9g.js";
@@ -5,13 +5,13 @@ import {
5
5
  writeGeneratedSyncState,
6
6
  createRepairReport,
7
7
  renderRepairReport
8
- } from "./index-9z37veck.js";
8
+ } from "./index-xjf5j657.js";
9
9
  import {
10
10
  AkanContextAnalyzer
11
- } from "./index-md6026rp.js";
11
+ } from "./index-31es1yev.js";
12
12
  import {
13
13
  runner
14
- } from "./index-azrhhgtb.js";
14
+ } from "./index-3wypz6xj.js";
15
15
 
16
16
  // pkgs/@akanjs/cli/repair/repair.runner.ts
17
17
  var spawnShell = async (workspace, command) => await workspace.spawn("bash", ["-lc", command.startsWith("akan ") ? `bun run ${command}` : command], {