@akanjs/cli 2.4.1 → 2.4.2-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 (66) hide show
  1. package/.build-stamp +1 -1
  2. package/{agent.command-sa12ccz3.js → agent.command-ash7wabs.js} +7 -7
  3. package/{application.command-jv63vv7z.js → application.command-zm47j93m.js} +5 -5
  4. package/{applicationBuildRunner-vzjdgv1g.js → applicationBuildRunner-554a2vnk.js} +6 -1
  5. package/{applicationReleasePackager-brvth6rs.js → applicationReleasePackager-pjbxc793.js} +1 -1
  6. package/buildBatch.proc.js +3 -3
  7. package/{capacitorApp-wnxzrppx.js → capacitorApp-wc75rvfm.js} +3 -3
  8. package/{cloud.command-8z2nc6b2.js → cloud.command-vwpzten0.js} +10 -10
  9. package/{context.command-0m854xme.js → context.command-j0kq87xa.js} +15 -15
  10. package/{dependencyScanner-m4x5maek.js → dependencyScanner-f6grrep3.js} +2 -2
  11. package/{guideline.command-dsdpae45.js → guideline.command-1m4jwhv0.js} +5 -5
  12. package/incrementalBuilder.proc.js +22 -14
  13. package/{index-eja0sbm6.js → index-0wgpfp7t.js} +6 -6
  14. package/{index-1b9f27pm.js → index-2nb022xv.js} +3 -3
  15. package/{index-n2mp0f48.js → index-31183bxt.js} +6 -6
  16. package/{index-p9f1rpbp.js → index-31e8cwjq.js} +5 -5
  17. package/{index-x53a5nya.js → index-46tjzh6s.js} +1 -1
  18. package/{index-61keag0s.js → index-67546d0j.js} +4 -1
  19. package/{index-q4sc46ec.js → index-79v9jwqe.js} +3 -3
  20. package/{index-m0vg9n8z.js → index-7k9sj7j5.js} +3 -2
  21. package/{index-e3b8ms64.js → index-8dsjmcbp.js} +11 -11
  22. package/{index-2v10yr8g.js → index-ckywhpvp.js} +1 -1
  23. package/{index-d2e2y85b.js → index-cp26p7qd.js} +4 -4
  24. package/{index-eqxmxan6.js → index-ehjhzg5y.js} +1 -1
  25. package/{index-phj3ewxv.js → index-en4zpzdm.js} +2 -2
  26. package/{index-qacv44mm.js → index-f1x6fe2e.js} +1 -1
  27. package/{index-m04as81s.js → index-mpj63mbw.js} +4 -4
  28. package/{index-3a4vntr0.js → index-n08vr4hh.js} +2 -2
  29. package/{index-5vvwc0cz.js → index-nsj2ftxj.js} +1 -1
  30. package/{index-0t7pwff2.js → index-s6nk9815.js} +182 -64
  31. package/{index-hk58kr1m.js → index-smt4re0s.js} +1 -1
  32. package/{index-zw4aqvwh.js → index-t5rn8q9f.js} +4 -4
  33. package/{index-h6pevatb.js → index-tnngmzgf.js} +7 -7
  34. package/{index-eay4t1te.js → index-xdf6rxyt.js} +3 -3
  35. package/{index-81epkybm.js → index-xjkjcbhd.js} +3 -3
  36. package/index.js +19 -19
  37. package/{library.command-fhx5ce8n.js → library.command-39eq3brk.js} +4 -4
  38. package/{localRegistry.command-18f61945.js → localRegistry.command-34zvgkys.js} +9 -9
  39. package/{module.command-29wvnb56.js → module.command-vwahdkzr.js} +8 -8
  40. package/{package.command-46r1dncm.js → package.command-wkwd5x5p.js} +5 -5
  41. package/package.json +2 -2
  42. package/{page.command-vxvqdzc0.js → page.command-9w85hrg0.js} +4 -4
  43. package/{primitive.command-yk622wmt.js → primitive.command-2hnr8h7f.js} +9 -9
  44. package/{quality.command-p0mb5xwt.js → quality.command-4kerz7mh.js} +3 -3
  45. package/{repair.command-nptckp6w.js → repair.command-zmwshmvr.js} +6 -6
  46. package/{routeSourceValidator-wbhmbwpj.js → routeSourceValidator-cncd92fv.js} +39 -0
  47. package/{scalar.command-bss14hez.js → scalar.command-9kanb73t.js} +7 -7
  48. package/templates/workspaceRoot/.cursor/rules/akan-page-routing.mdc.template +27 -1
  49. package/templates/workspaceRoot/.cursor/rules/akan-sync-conventions.mdc.template +14 -0
  50. package/templates/workspaceRoot/.cursor/rules/client-server-boundaries.mdc.template +1 -1
  51. package/templates/workspaceRoot/.cursor/rules/coding-comments.mdc.template +13 -7
  52. package/templates/workspaceRoot/.cursor/rules/coding-style.mdc.template +23 -3
  53. package/templates/workspaceRoot/.cursor/rules/lint-enforced-rules.mdc.template +18 -0
  54. package/templates/workspaceRoot/.cursor/rules/module-file-playbook.mdc.template +61 -0
  55. package/templates/workspaceRoot/.cursor/rules/naming-conventions.mdc.template +15 -0
  56. package/templates/workspaceRoot/.cursor/rules/react-component-style.mdc.template +21 -0
  57. package/templates/workspaceRoot/.cursor/rules/scalar-modeling.mdc.template +47 -3
  58. package/templates/workspaceRoot/.cursor/rules/service-signal-conventions.mdc.template +69 -0
  59. package/templates/workspaceRoot/.cursor/rules/srvkit-adapters-and-guards.mdc.template +50 -0
  60. package/templates/workspaceRoot/.cursor/rules/typescript-imports.mdc.template +3 -0
  61. package/templates/workspaceRoot/.gitignore.template +1 -0
  62. package/templates/workspaceRoot/AGENTS.md.template +140 -14
  63. package/templates/workspaceRoot/docs/AI-DEVELOPMENT.md.template +19 -0
  64. package/templates/workspaceRoot/docs/GENERATED.md.template +1 -1
  65. package/{workflow.command-7fhqb33d.js → workflow.command-4areq0ex.js} +12 -12
  66. package/{workspace.command-xkcec7ky.js → workspace.command-02x93b10.js} +22 -22
@@ -1,7 +1,7 @@
1
1
  // @bun
2
2
  import {
3
3
  ModuleScript
4
- } from "./index-h6pevatb.js";
4
+ } from "./index-tnngmzgf.js";
5
5
  import {
6
6
  addFieldUiPolicyForType,
7
7
  coerceFieldDefault,
@@ -34,15 +34,15 @@ import {
34
34
  sourceFile,
35
35
  validationCommandsForTarget,
36
36
  viaBuilderParameterName
37
- } from "./index-2v10yr8g.js";
37
+ } from "./index-ckywhpvp.js";
38
38
  import {
39
39
  script
40
- } from "./index-phj3ewxv.js";
40
+ } from "./index-en4zpzdm.js";
41
41
  import {
42
42
  AppExecutor,
43
43
  LibExecutor,
44
44
  ModuleExecutor
45
- } from "./index-0t7pwff2.js";
45
+ } from "./index-s6nk9815.js";
46
46
 
47
47
  // pkgs/@akanjs/cli/primitive/primitive.script.ts
48
48
  import { capitalize } from "akanjs/common";
@@ -2,10 +2,10 @@
2
2
  import {
3
3
  runner,
4
4
  script
5
- } from "./index-phj3ewxv.js";
5
+ } from "./index-en4zpzdm.js";
6
6
  import {
7
7
  LibExecutor
8
- } from "./index-0t7pwff2.js";
8
+ } from "./index-s6nk9815.js";
9
9
 
10
10
  // pkgs/@akanjs/cli/semver.ts
11
11
  function parseVersion(version) {
@@ -1,7 +1,7 @@
1
1
  // @bun
2
2
  import {
3
3
  FileSys
4
- } from "./index-61keag0s.js";
4
+ } from "./index-67546d0j.js";
5
5
  import {
6
6
  Spinner
7
7
  } from "./index-6pz1j0zj.js";
@@ -1,7 +1,7 @@
1
1
  // @bun
2
2
  import {
3
3
  FileSys
4
- } from "./index-61keag0s.js";
4
+ } from "./index-67546d0j.js";
5
5
  import {
6
6
  Spinner
7
7
  } from "./index-6pz1j0zj.js";
@@ -16,7 +16,16 @@ import {
16
16
  spawn as spawn2
17
17
  } from "child_process";
18
18
  import { readFileSync as readFileSync2 } from "fs";
19
- import { copyFile, mkdir, readdir as readDirEntries, stat } from "fs/promises";
19
+ import {
20
+ copyFile,
21
+ cp as cpEntry,
22
+ mkdir,
23
+ readdir as readDirEntries,
24
+ realpath,
25
+ rm as rm2,
26
+ stat,
27
+ symlink
28
+ } from "fs/promises";
20
29
  import path5 from "path";
21
30
  import { pathToFileURL } from "url";
22
31
  import {
@@ -178,6 +187,7 @@ class AkanAppConfig {
178
187
  mobile;
179
188
  hasMobileConfig;
180
189
  secrets;
190
+ syncPageLibs;
181
191
  baseDevEnv;
182
192
  libs;
183
193
  plugins;
@@ -207,6 +217,7 @@ class AkanAppConfig {
207
217
  process.env.AKAN_PUBLIC_LOCALES = this.i18n.locales.join(",");
208
218
  this.publicEnv = config?.publicEnv ?? [];
209
219
  this.secrets = config?.secrets ?? [];
220
+ this.syncPageLibs = config?.syncPageLibs ?? false;
210
221
  this.hasMobileConfig = Boolean(config.mobile);
211
222
  this.mobile = this.#resolveMobileConfig(config.mobile);
212
223
  this.docker = this.#makeDockerContent(config?.docker ?? {});
@@ -865,7 +876,7 @@ var moduleUiFileTypes = {
865
876
  };
866
877
  var testFilePattern = /\.(test|spec)\.(ts|tsx)$/;
867
878
  var rootSignalTestFilePattern = /^[A-Za-z][A-Za-z0-9_-]*\.signal\.(test|spec)\.(ts|tsx)$/;
868
- var createDependencyScanner = async (exec) => (await import("./dependencyScanner-m4x5maek.js")).TypeScriptDependencyScanner.from(exec);
879
+ var createDependencyScanner = async (exec) => (await import("./dependencyScanner-f6grrep3.js")).TypeScriptDependencyScanner.from(exec);
869
880
  var isAllowedTestFile = (filename) => testFilePattern.test(filename);
870
881
  var isAllowedLibRootFile = (filename) => libRootAllowedFiles.has(filename) || rootSignalTestFilePattern.test(filename);
871
882
  var getScanPath = (exec, relativePath) => path4.posix.join(`${exec.type}s`, exec.name, relativePath.split(path4.sep).join("/"));
@@ -1163,6 +1174,9 @@ class AppInfo extends ScanInfo {
1163
1174
  getScanResult() {
1164
1175
  return this.scanResult;
1165
1176
  }
1177
+ setRoutes(routes) {
1178
+ this.scanResult.routes = routes;
1179
+ }
1166
1180
  static async#getAllLibDeps(exec, libDeps, libSet = new Set) {
1167
1181
  await Promise.all(libDeps.map(async (libName) => {
1168
1182
  if (libSet.has(libName))
@@ -1683,9 +1697,9 @@ class Executor {
1683
1697
  return this;
1684
1698
  }
1685
1699
  async removeDir(dirPath) {
1686
- const readPath = this.getPath(dirPath);
1687
- if (await FileSys.dirExists(readPath))
1688
- await $`rm -rf ${readPath}`;
1700
+ const readPath = path5.join(this.getPath(dirPath), ".");
1701
+ if (await FileSys.entryExists(readPath))
1702
+ await rm2(readPath, { recursive: true, force: true });
1689
1703
  this.logger.verbose(`Remove directory ${readPath}`);
1690
1704
  return this;
1691
1705
  }
@@ -1728,7 +1742,7 @@ class Executor {
1728
1742
  const readPath = this.getPath(filePath);
1729
1743
  return await FileSys.readJson(readPath);
1730
1744
  }
1731
- async cp(srcPath, destPath) {
1745
+ async cp(srcPath, destPath, { dereference = false } = {}) {
1732
1746
  const src = this.getPath(srcPath);
1733
1747
  const dest = this.getPath(destPath);
1734
1748
  if (!await FileSys.exists(src))
@@ -1736,7 +1750,10 @@ class Executor {
1736
1750
  const isDirectory = (await stat(src)).isDirectory();
1737
1751
  if (!await FileSys.exists(dest) && isDirectory)
1738
1752
  await mkdir(dest, { recursive: true });
1739
- await $`cp -r ${src}${isDirectory ? "/." : ""} ${dest}`;
1753
+ if (dereference)
1754
+ await cpEntry(src, dest, { recursive: isDirectory, dereference: true, force: true });
1755
+ else
1756
+ await $`cp -r ${src}${isDirectory ? "/." : ""} ${dest}`;
1740
1757
  }
1741
1758
  log(msg) {
1742
1759
  this.logger.info(msg);
@@ -2099,7 +2116,7 @@ class WorkspaceExecutor extends Executor {
2099
2116
  if (AVOID_DIRS.includes(dir))
2100
2117
  return;
2101
2118
  const dirPath = path5.join(dirname, dir);
2102
- if ((await stat(dirPath)).isDirectory()) {
2119
+ if (await FileSys.dirExists(dirPath)) {
2103
2120
  const hasTargetFile = await FileSys.fileExists(path5.join(dirPath, targetFilename));
2104
2121
  if (hasTargetFile)
2105
2122
  results.push(`${prefix}${dir}`);
@@ -2346,7 +2363,7 @@ class SysExecutor extends Executor {
2346
2363
  class AppExecutor extends SysExecutor {
2347
2364
  static #routeSourceValidator = null;
2348
2365
  static async#getRouteSourceValidator() {
2349
- AppExecutor.#routeSourceValidator ??= (await import("./routeSourceValidator-wbhmbwpj.js")).RouteSourceValidator;
2366
+ AppExecutor.#routeSourceValidator ??= (await import("./routeSourceValidator-cncd92fv.js")).RouteSourceValidator;
2350
2367
  return AppExecutor.#routeSourceValidator;
2351
2368
  }
2352
2369
  dist;
@@ -2403,12 +2420,14 @@ class AppExecutor extends SysExecutor {
2403
2420
  };
2404
2421
  Object.assign(process.env, routeEnv);
2405
2422
  if (type === "build") {
2423
+ this.#excludeDevOnlyPages = true;
2424
+ this.#pageKeys = null;
2406
2425
  if (await this.exists(this.dist.cwdPath))
2407
2426
  await this.dist.exec(`rm -rf ${this.dist.cwdPath}`);
2408
2427
  await Promise.all([this.dist.mkdir("private"), this.dist.mkdir("public")]);
2409
2428
  await Promise.all([
2410
- this.cp("private", `${this.dist.cwdPath}/private`),
2411
- this.cp("public", `${this.dist.cwdPath}/public`)
2429
+ this.cp("private", `${this.dist.cwdPath}/private`, { dereference: true }),
2430
+ this.cp("public", `${this.dist.cwdPath}/public`, { dereference: true })
2412
2431
  ]);
2413
2432
  } else
2414
2433
  await this.removeDir(".akan");
@@ -2455,77 +2474,174 @@ class AppExecutor extends SysExecutor {
2455
2474
  return this.#akanConfig;
2456
2475
  }
2457
2476
  #pageKeys = null;
2477
+ #excludeDevOnlyPages = false;
2458
2478
  async getPageKeys({ refresh } = {}) {
2459
2479
  if (this.#pageKeys && !refresh)
2460
2480
  return this.#pageKeys;
2461
2481
  const akanConfig2 = await this.getConfig();
2462
2482
  const glob = new Bun.Glob("**/*");
2463
2483
  const pageKeys = [];
2464
- const pageDir = `${this.cwdPath}/page`;
2465
- if (!await FileSys.dirExists(pageDir)) {
2466
- this.#pageKeys = [];
2467
- return this.#pageKeys;
2468
- }
2469
- for await (const rel of glob.scan({
2470
- cwd: pageDir,
2471
- absolute: false,
2472
- onlyFiles: true
2473
- })) {
2474
- const segments = rel.split(path5.sep);
2475
- if (segments.some((s) => s === "node_modules"))
2484
+ const owners = new Map;
2485
+ const devOnlyKeys = new Set;
2486
+ const devOnlyDirs = [];
2487
+ for (const root of await this.getPageRoots()) {
2488
+ if (!await FileSys.dirExists(root.dir))
2476
2489
  continue;
2477
- const posix = segments.join("/");
2478
- const absPath = path5.join(pageDir, posix);
2479
- validatePageSourceFile(posix, { filePath: absPath });
2480
- if (!isRouteSourceFile(posix))
2481
- continue;
2482
- const key = `./${posix}`;
2483
- validateSubRoutePageKey(key, akanConfig2.basePaths, {
2484
- appName: this.name,
2485
- filePath: absPath
2486
- });
2487
- const parsed = parseRouteModuleKey(key);
2488
- if (parsed.isInternalRootLayout) {
2489
- throw new Error(`[route-convention] __root_layout is reserved for Akan.js generated root layout: ${absPath}`);
2490
+ for await (const rel of glob.scan({
2491
+ cwd: root.dir,
2492
+ absolute: false,
2493
+ onlyFiles: true
2494
+ })) {
2495
+ const segments = rel.split(path5.sep);
2496
+ if (segments.some((s) => s === "node_modules"))
2497
+ continue;
2498
+ const posix = `${root.keyPrefix}${segments.join("/")}`;
2499
+ const absPath = path5.join(root.dir, ...segments);
2500
+ validatePageSourceFile(posix, { filePath: absPath });
2501
+ if (!isRouteSourceFile(posix))
2502
+ continue;
2503
+ const key = `./${posix}`;
2504
+ validateSubRoutePageKey(key, akanConfig2.basePaths, {
2505
+ appName: this.name,
2506
+ filePath: absPath
2507
+ });
2508
+ const parsed = parseRouteModuleKey(key);
2509
+ if (parsed.isInternalRootLayout) {
2510
+ throw new Error(`[route-convention] __root_layout is reserved for Akan.js generated root layout: ${absPath}`);
2511
+ }
2512
+ const fromLib = !!root.keyPrefix;
2513
+ const routeId = `${parsed.kind}:${parsed.pattern}`;
2514
+ const owner = owners.get(routeId);
2515
+ if (owner && (owner.fromLib || fromLib)) {
2516
+ throw new Error(`[route-convention] duplicate ${parsed.kind} route "${parsed.pattern}" in app "${this.name}":
2517
+ - ${owner.absPath}
2518
+ - ${absPath}`);
2519
+ }
2520
+ if (!owner)
2521
+ owners.set(routeId, { absPath, fromLib });
2522
+ const isRootLayout = parsed.kind === "layout" && parsed.moduleSegments.at(-1) === "_layout";
2523
+ const routeSource = await Bun.file(absPath).text();
2524
+ const validator = await AppExecutor.#getRouteSourceValidator();
2525
+ if (parsed.kind === "overrides")
2526
+ validator.validateOverridesSourceExports(routeSource, absPath);
2527
+ else {
2528
+ const info = validator.validateRouteSourceExports(routeSource, absPath, parsed.kind, {
2529
+ rootLayout: isRootLayout
2530
+ });
2531
+ if (info.devOnly) {
2532
+ devOnlyKeys.add(key);
2533
+ if (parsed.kind === "layout")
2534
+ devOnlyDirs.push(key.replace(/[^/]+$/, ""));
2535
+ }
2536
+ }
2537
+ pageKeys.push(key);
2490
2538
  }
2491
- const isRootLayout = parsed.kind === "layout" && parsed.moduleSegments.at(-1) === "_layout";
2492
- const routeSource = await Bun.file(absPath).text();
2493
- const validator = await AppExecutor.#getRouteSourceValidator();
2494
- if (parsed.kind === "overrides")
2495
- validator.validateOverridesSourceExports(routeSource, absPath);
2496
- else
2497
- validator.validateRouteSourceExports(routeSource, absPath, parsed.kind, { rootLayout: isRootLayout });
2498
- pageKeys.push(key);
2499
2539
  }
2500
2540
  pageKeys.sort();
2501
- this.#pageKeys = pageKeys;
2541
+ this.#pageKeys = this.#excludeDevOnlyPages ? this.#dropDevOnlyPages(pageKeys, devOnlyKeys, devOnlyDirs) : pageKeys;
2502
2542
  return this.#pageKeys;
2503
2543
  }
2544
+ #dropDevOnlyPages(pageKeys, devOnlyKeys, devOnlyDirs) {
2545
+ if (!devOnlyKeys.size)
2546
+ return pageKeys;
2547
+ const isDevOnly = (key) => devOnlyKeys.has(key) || devOnlyDirs.some((dir) => key.startsWith(dir));
2548
+ const dropped = pageKeys.filter(isDevOnly);
2549
+ this.log(`[route] excluded ${dropped.length} dev-only route file(s) from the build: ${dropped.join(", ")}`);
2550
+ return pageKeys.filter((key) => !isDevOnly(key));
2551
+ }
2552
+ async getPageRoots() {
2553
+ const akanConfig2 = await this.getConfig();
2554
+ const pageDir = `${this.cwdPath}/page`;
2555
+ const roots = [{ dir: pageDir, realDir: pageDir, keyPrefix: "" }];
2556
+ for (const parent of AppExecutor.#pageLibParents(akanConfig2.basePaths)) {
2557
+ const libsDir = `${pageDir}/${parent}${AppExecutor.#pageLibsDir}`;
2558
+ const entries = await readDirEntries(libsDir).catch(() => []);
2559
+ for (const entry of entries.sort()) {
2560
+ const dir = `${libsDir}/${entry}`;
2561
+ if (!await FileSys.dirExists(dir))
2562
+ continue;
2563
+ roots.push({ dir, realDir: await realpath(dir), keyPrefix: `${parent}${AppExecutor.#pageLibsDir}/${entry}/` });
2564
+ }
2565
+ }
2566
+ return roots;
2567
+ }
2504
2568
  setPageKeys(pageKeys) {
2505
2569
  this.#pageKeys = pageKeys;
2506
2570
  }
2571
+ static #pageLibsDir = "(libs)";
2572
+ static #pageLibParents(basePaths) {
2573
+ const parents = [...basePaths].map((basePath) => `${basePath}/`);
2574
+ return parents.length ? parents : [""];
2575
+ }
2576
+ async syncPages(libDeps) {
2577
+ const akanConfig2 = await this.getConfig();
2578
+ const parents = AppExecutor.#pageLibParents(akanConfig2.basePaths);
2579
+ const libs = await this.#resolvePageLibs(akanConfig2.syncPageLibs, libDeps);
2580
+ const linked = (await Promise.all(parents.map(async (parent) => {
2581
+ const libsDir = `${this.cwdPath}/page/${parent}${AppExecutor.#pageLibsDir}`;
2582
+ const entries = await readDirEntries(libsDir).catch(() => []);
2583
+ return entries.map((entry) => `${parent}${AppExecutor.#pageLibsDir}/${entry}/`);
2584
+ }))).flat();
2585
+ const wanted = parents.flatMap((parent) => libs.map((lib) => `${parent}${AppExecutor.#pageLibsDir}/(${lib})/`));
2586
+ if (linked.sort().join(",") === wanted.sort().join(","))
2587
+ return false;
2588
+ await Promise.all(parents.map((parent) => this.removeDir(`${this.cwdPath}/page/${parent}${AppExecutor.#pageLibsDir}`)));
2589
+ for (const parent of parents) {
2590
+ if (!libs.length)
2591
+ break;
2592
+ const libsDir = `${this.cwdPath}/page/${parent}${AppExecutor.#pageLibsDir}`;
2593
+ await this.mkdir(libsDir);
2594
+ await Promise.all(libs.map((lib) => AppExecutor.#linkLibAsset(`${this.workspace.workspaceRoot}/libs/${lib}/page`, `${libsDir}/(${lib})`)));
2595
+ }
2596
+ this.#pageKeys = null;
2597
+ return true;
2598
+ }
2599
+ async#resolvePageLibs(syncPageLibs, libDeps) {
2600
+ if (!syncPageLibs)
2601
+ return [];
2602
+ const hasPageDir = async (lib) => await FileSys.dirExists(`${this.workspace.workspaceRoot}/libs/${lib}/page`);
2603
+ if (syncPageLibs === true) {
2604
+ const libs = [];
2605
+ for (const lib of libDeps)
2606
+ if (await hasPageDir(lib))
2607
+ libs.push(lib);
2608
+ return libs;
2609
+ }
2610
+ for (const lib of syncPageLibs) {
2611
+ if (!libDeps.includes(lib))
2612
+ throw new Error(`[syncPageLibs] app "${this.name}" lists lib "${lib}" but does not depend on it (deps: ${libDeps.join(", ") || "none"})`);
2613
+ if (!await hasPageDir(lib))
2614
+ throw new Error(`[syncPageLibs] app "${this.name}" lists lib "${lib}" but libs/${lib}/page does not exist`);
2615
+ }
2616
+ return [...syncPageLibs];
2617
+ }
2507
2618
  async syncAssets(libDeps) {
2508
- const projectPublicPath = `${this.cwdPath}/public`;
2509
- const projectAssetsPath = `${this.cwdPath}/private`;
2510
- const projectPublicLibPath = `${projectPublicPath}/libs`;
2511
- const projectAssetsLibPath = `${projectAssetsPath}/libs`;
2512
- await Promise.all([this.removeDir(projectPublicLibPath), this.removeDir(projectAssetsLibPath)]);
2513
- const targetPublicDeps = [];
2619
+ await Promise.all(["public", "private"].map((facet) => this.#syncLibAssets(facet, libDeps)));
2620
+ }
2621
+ async#syncLibAssets(facet, libDeps) {
2622
+ const libLinkPath = `${this.cwdPath}/${facet}/libs`;
2623
+ await this.removeDir(libLinkPath);
2624
+ const targetDeps = [];
2514
2625
  for (const dep of libDeps) {
2515
- if (await this.exists(`${this.workspace.workspaceRoot}/libs/${dep}/public`))
2516
- targetPublicDeps.push(dep);
2626
+ if (await this.exists(`${this.workspace.workspaceRoot}/libs/${dep}/${facet}`))
2627
+ targetDeps.push(dep);
2517
2628
  }
2518
- const targetAssetsDeps = [];
2519
- for (const dep of libDeps) {
2520
- if (await this.exists(`${this.workspace.workspaceRoot}/libs/${dep}/private`))
2521
- targetAssetsDeps.push(dep);
2629
+ if (!targetDeps.length)
2630
+ return;
2631
+ await this.mkdir(libLinkPath);
2632
+ await Promise.all(targetDeps.map((dep) => AppExecutor.#linkLibAsset(`${this.workspace.workspaceRoot}/libs/${dep}/${facet}`, `${libLinkPath}/${dep}`)));
2633
+ }
2634
+ static async#linkLibAsset(targetPath, linkPath) {
2635
+ const isWindows = process.platform === "win32";
2636
+ try {
2637
+ const target = isWindows ? targetPath : path5.relative(path5.dirname(linkPath), targetPath);
2638
+ await symlink(target, linkPath, isWindows ? "junction" : "dir");
2639
+ } catch (error) {
2640
+ if (!isWindows)
2641
+ throw error;
2642
+ await mkdir(linkPath, { recursive: true });
2643
+ await cpEntry(targetPath, linkPath, { recursive: true, dereference: true, force: true });
2522
2644
  }
2523
- await Promise.all(targetPublicDeps.map((dep) => this.mkdir(`${projectPublicLibPath}/${dep}`)));
2524
- await Promise.all(targetAssetsDeps.map((dep) => this.mkdir(`${projectAssetsLibPath}/${dep}`)));
2525
- await Promise.all([
2526
- ...targetPublicDeps.map((dep) => this.cp(`${this.workspace.workspaceRoot}/libs/${dep}/public`, `${projectPublicLibPath}/${dep}`)),
2527
- ...targetAssetsDeps.map((dep) => this.cp(`${this.workspace.workspaceRoot}/libs/${dep}/private`, `${projectAssetsLibPath}/${dep}`))
2528
- ]);
2529
2645
  }
2530
2646
  async scanSync({ refresh = false, write = true } = {}) {
2531
2647
  const scanInfo = await this.scan({
@@ -2535,6 +2651,8 @@ class AppExecutor extends SysExecutor {
2535
2651
  });
2536
2652
  if (write)
2537
2653
  await this.syncAssets(scanInfo.getScanResult().libDeps);
2654
+ if (write && await this.syncPages(scanInfo.getScanResult().libDeps))
2655
+ scanInfo.setRoutes(await this.getPageKeys({ refresh: true }));
2538
2656
  if (write)
2539
2657
  await this.#runPluginSyncAssets();
2540
2658
  return scanInfo;
@@ -5,7 +5,7 @@ import {
5
5
  } from "./index-76rn3g2c.js";
6
6
  import {
7
7
  CommandExecutionError
8
- } from "./index-0t7pwff2.js";
8
+ } from "./index-s6nk9815.js";
9
9
 
10
10
  // pkgs/@akanjs/devkit/capacitorApp.ts
11
11
  import { cp, mkdir, readFile, rm, writeFile } from "fs/promises";
@@ -4,17 +4,17 @@ import {
4
4
  CloudApi,
5
5
  GlobalConfig,
6
6
  getDefaultHostConfig
7
- } from "./index-5vvwc0cz.js";
7
+ } from "./index-nsj2ftxj.js";
8
8
  import {
9
9
  openBrowser
10
- } from "./index-n2mp0f48.js";
10
+ } from "./index-31183bxt.js";
11
11
  import {
12
12
  runner
13
- } from "./index-phj3ewxv.js";
13
+ } from "./index-en4zpzdm.js";
14
14
  import {
15
15
  AppExecutor,
16
16
  WorkspaceExecutor
17
- } from "./index-0t7pwff2.js";
17
+ } from "./index-s6nk9815.js";
18
18
 
19
19
  // pkgs/@akanjs/cli/cloud/cloud.runner.ts
20
20
  import path from "path";
@@ -1,7 +1,7 @@
1
1
  // @bun
2
2
  import {
3
3
  PageScript
4
- } from "./index-qacv44mm.js";
4
+ } from "./index-f1x6fe2e.js";
5
5
  import {
6
6
  pluralizeName
7
7
  } from "./index-ss469dec.js";
@@ -12,23 +12,23 @@ import {
12
12
  generatedFilesForSync,
13
13
  moduleSourcePaths,
14
14
  sourceFile
15
- } from "./index-2v10yr8g.js";
15
+ } from "./index-ckywhpvp.js";
16
16
  import {
17
17
  Prompter
18
- } from "./index-eqxmxan6.js";
18
+ } from "./index-ehjhzg5y.js";
19
19
  import {
20
20
  AiSession
21
- } from "./index-5vvwc0cz.js";
21
+ } from "./index-nsj2ftxj.js";
22
22
  import {
23
23
  runner,
24
24
  script
25
- } from "./index-phj3ewxv.js";
25
+ } from "./index-en4zpzdm.js";
26
26
  import {
27
27
  ModuleExecutor
28
- } from "./index-0t7pwff2.js";
28
+ } from "./index-s6nk9815.js";
29
29
  import {
30
30
  FileSys
31
- } from "./index-61keag0s.js";
31
+ } from "./index-67546d0j.js";
32
32
 
33
33
  // pkgs/@akanjs/devkit/getRelatedCnsts.ts
34
34
  import { readFileSync, realpathSync } from "fs";
@@ -2,14 +2,14 @@
2
2
  import {
3
3
  workflowRunArtifactPath,
4
4
  workflowSyncDir
5
- } from "./index-2v10yr8g.js";
5
+ } from "./index-ckywhpvp.js";
6
6
  import {
7
7
  AppExecutor,
8
8
  LibExecutor
9
- } from "./index-0t7pwff2.js";
9
+ } from "./index-s6nk9815.js";
10
10
  import {
11
11
  FileSys
12
- } from "./index-61keag0s.js";
12
+ } from "./index-67546d0j.js";
13
13
 
14
14
  // pkgs/@akanjs/devkit/akanContext.ts
15
15
  import { readdir } from "fs/promises";
@@ -1,17 +1,17 @@
1
1
  // @bun
2
2
  import {
3
3
  AkanContextAnalyzer
4
- } from "./index-eay4t1te.js";
4
+ } from "./index-xdf6rxyt.js";
5
5
  import {
6
6
  createRepairReport,
7
7
  generatedFilePathsForTarget,
8
8
  renderRepairReport,
9
9
  writeGeneratedSyncState,
10
10
  writeWorkflowRunArtifact
11
- } from "./index-2v10yr8g.js";
11
+ } from "./index-ckywhpvp.js";
12
12
  import {
13
13
  runner
14
- } from "./index-phj3ewxv.js";
14
+ } from "./index-en4zpzdm.js";
15
15
 
16
16
  // pkgs/@akanjs/cli/repair/repair.runner.ts
17
17
  var commandForShell = (command) => command.startsWith("akan ") ? `bun run ${command}` : command;
package/index.js CHANGED
@@ -4,9 +4,9 @@ import {
4
4
  getTargetCommandNames,
5
5
  getTargetMetas,
6
6
  runCommands
7
- } from "./index-phj3ewxv.js";
8
- import"./index-0t7pwff2.js";
9
- import"./index-61keag0s.js";
7
+ } from "./index-en4zpzdm.js";
8
+ import"./index-s6nk9815.js";
9
+ import"./index-67546d0j.js";
10
10
  import"./index-6pz1j0zj.js";
11
11
  import {
12
12
  __require
@@ -17,22 +17,22 @@ import path from "path";
17
17
 
18
18
  // pkgs/@akanjs/cli/commandModules.ts
19
19
  var commandModules = {
20
- workspace: async () => (await import("./workspace.command-xkcec7ky.js")).WorkspaceCommand,
21
- agent: async () => (await import("./agent.command-sa12ccz3.js")).AgentCommand,
22
- application: async () => (await import("./application.command-jv63vv7z.js")).ApplicationCommand,
23
- library: async () => (await import("./library.command-fhx5ce8n.js")).LibraryCommand,
24
- localRegistry: async () => (await import("./localRegistry.command-18f61945.js")).LocalRegistryCommand,
25
- package: async () => (await import("./package.command-46r1dncm.js")).PackageCommand,
26
- module: async () => (await import("./module.command-29wvnb56.js")).ModuleCommand,
27
- page: async () => (await import("./page.command-vxvqdzc0.js")).PageCommand,
28
- context: async () => (await import("./context.command-0m854xme.js")).ContextCommand,
29
- cloud: async () => (await import("./cloud.command-8z2nc6b2.js")).CloudCommand,
30
- guideline: async () => (await import("./guideline.command-dsdpae45.js")).GuidelineCommand,
31
- scalar: async () => (await import("./scalar.command-bss14hez.js")).ScalarCommand,
32
- primitive: async () => (await import("./primitive.command-yk622wmt.js")).PrimitiveCommand,
33
- quality: async () => (await import("./quality.command-p0mb5xwt.js")).QualityCommand,
34
- repair: async () => (await import("./repair.command-nptckp6w.js")).RepairCommand,
35
- workflow: async () => (await import("./workflow.command-7fhqb33d.js")).WorkflowCommand
20
+ workspace: async () => (await import("./workspace.command-02x93b10.js")).WorkspaceCommand,
21
+ agent: async () => (await import("./agent.command-ash7wabs.js")).AgentCommand,
22
+ application: async () => (await import("./application.command-zm47j93m.js")).ApplicationCommand,
23
+ library: async () => (await import("./library.command-39eq3brk.js")).LibraryCommand,
24
+ localRegistry: async () => (await import("./localRegistry.command-34zvgkys.js")).LocalRegistryCommand,
25
+ package: async () => (await import("./package.command-wkwd5x5p.js")).PackageCommand,
26
+ module: async () => (await import("./module.command-vwahdkzr.js")).ModuleCommand,
27
+ page: async () => (await import("./page.command-9w85hrg0.js")).PageCommand,
28
+ context: async () => (await import("./context.command-j0kq87xa.js")).ContextCommand,
29
+ cloud: async () => (await import("./cloud.command-vwpzten0.js")).CloudCommand,
30
+ guideline: async () => (await import("./guideline.command-1m4jwhv0.js")).GuidelineCommand,
31
+ scalar: async () => (await import("./scalar.command-9kanb73t.js")).ScalarCommand,
32
+ primitive: async () => (await import("./primitive.command-2hnr8h7f.js")).PrimitiveCommand,
33
+ quality: async () => (await import("./quality.command-4kerz7mh.js")).QualityCommand,
34
+ repair: async () => (await import("./repair.command-zmwshmvr.js")).RepairCommand,
35
+ workflow: async () => (await import("./workflow.command-4areq0ex.js")).WorkflowCommand
36
36
  };
37
37
  var commandModuleIds = Object.keys(commandModules);
38
38
 
@@ -1,14 +1,14 @@
1
1
  // @bun
2
2
  import {
3
3
  LibraryScript
4
- } from "./index-3a4vntr0.js";
4
+ } from "./index-n08vr4hh.js";
5
5
  import {
6
6
  Lib,
7
7
  Workspace,
8
8
  command
9
- } from "./index-phj3ewxv.js";
10
- import"./index-0t7pwff2.js";
11
- import"./index-61keag0s.js";
9
+ } from "./index-en4zpzdm.js";
10
+ import"./index-s6nk9815.js";
11
+ import"./index-67546d0j.js";
12
12
  import"./index-6pz1j0zj.js";
13
13
  import"./index-r24hmh0q.js";
14
14
 
@@ -2,28 +2,28 @@
2
2
  import {
3
3
  CloudRunner,
4
4
  getNpmRegistryUrl
5
- } from "./index-zw4aqvwh.js";
6
- import"./index-5vvwc0cz.js";
5
+ } from "./index-t5rn8q9f.js";
6
+ import"./index-nsj2ftxj.js";
7
7
  import {
8
8
  ApplicationScript
9
- } from "./index-n2mp0f48.js";
9
+ } from "./index-31183bxt.js";
10
10
  import"./index-76rn3g2c.js";
11
- import"./index-3a4vntr0.js";
11
+ import"./index-n08vr4hh.js";
12
12
  import {
13
13
  PackageScript
14
- } from "./index-p9f1rpbp.js";
14
+ } from "./index-31e8cwjq.js";
15
15
  import {
16
16
  Workspace,
17
17
  command,
18
18
  runner,
19
19
  script
20
- } from "./index-phj3ewxv.js";
20
+ } from "./index-en4zpzdm.js";
21
21
  import"./index-fgc8r6dj.js";
22
22
  import {
23
23
  PkgExecutor
24
- } from "./index-0t7pwff2.js";
25
- import"./index-x53a5nya.js";
26
- import"./index-61keag0s.js";
24
+ } from "./index-s6nk9815.js";
25
+ import"./index-46tjzh6s.js";
26
+ import"./index-67546d0j.js";
27
27
  import"./index-bjpxzr6s.js";
28
28
  import"./index-6pz1j0zj.js";
29
29
  import"./index-r24hmh0q.js";