@akanjs/cli 3.1.0-rc.1 → 3.1.0-rc.11

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 (98) hide show
  1. package/.build-stamp +1 -1
  2. package/{CodeAgent-kyprmy06.js → CodeAgent-rkjyxgec.js} +2 -2
  3. package/{CodeTui-21mtze3j.js → CodeTui-h7pyj6xa.js} +1 -1
  4. package/TunnelShare-661cxz5e.js +14 -0
  5. package/{agent.command-f3gsc1gd.js → agent.command-3qxf4xcj.js} +5 -5
  6. package/akanCode.js +2 -2
  7. package/{application.command-5s780vnz.js → application.command-m1kcd7jf.js} +54 -42
  8. package/{applicationBuildRunner-1yaqsrdq.js → applicationBuildRunner-dj0xkrep.js} +26 -33
  9. package/buildBatch.proc.js +24 -15
  10. package/{cloud.command-yj6xb2a7.js → cloud.command-9cp1t0f5.js} +60 -67
  11. package/cloud.script-dgstqt1m.js +24 -0
  12. package/{code.command-3wkn4ja5.js → code.command-0ad6gw2a.js} +6 -6
  13. package/{context.command-9jjn3gcw.js → context.command-0qx447mb.js} +17 -13
  14. package/context.runner-1vsjztjg.js +25 -0
  15. package/{dependencyScanner-06z2dmrr.js → dependencyScanner-3afj2vt1.js} +1 -1
  16. package/{guideline.command-dtczrqpf.js → guideline.command-cv5bmrx2.js} +2 -2
  17. package/guidelines/agentRule/agentRule.instruction.md +3 -3
  18. package/guidelines/conventions/conventions.instruction.md +457 -1071
  19. package/guidelines/cssRule/cssRule.instruction.md +28 -7
  20. package/guidelines/fieldRule/fieldRule.instruction.md +62 -0
  21. package/guidelines/framework/framework.instruction.md +4 -7
  22. package/guidelines/mcpRule/mcpRule.instruction.md +43 -20
  23. package/guidelines/modelConstant/modelConstant.instruction.md +2 -1
  24. package/guidelines/modelStore/modelStore.instruction.md +9 -0
  25. package/guidelines/pageRule/pageRule.instruction.md +80 -0
  26. package/guidelines/queryRule/queryRule.instruction.md +44 -11
  27. package/guidelines/runtimeRule/runtimeRule.instruction.md +113 -17
  28. package/guidelines/ssrRule/ssrRule.instruction.md +13 -0
  29. package/guidelines/transportRule/transportRule.instruction.md +135 -13
  30. package/guidelines/workspaceOnboarding/workspaceOnboarding.instruction.md +4 -4
  31. package/guidelines/workspaceRecipes/workspaceRecipes.instruction.md +68 -7
  32. package/incrementalBuilder.proc.js +10 -7
  33. package/index-192ha4xh.js +1173 -0
  34. package/{index-c76k723e.js → index-1p98exm2.js} +2 -2
  35. package/{index-rwq3ekqc.js → index-1xj2t7cb.js} +7 -7
  36. package/{index-rtct7d43.js → index-20bxxyvn.js} +80 -80
  37. package/{index-qt22xstj.js → index-35hc95h5.js} +5 -3
  38. package/{index-8r4d7cmt.js → index-4mhy6qme.js} +4 -4
  39. package/{index-ww9bhp67.js → index-4pf8g7ff.js} +1 -1
  40. package/{index-2mx692qq.js → index-5edzv8fn.js} +5 -5
  41. package/{index-k9rrten6.js → index-5nd1wtkv.js} +92 -94
  42. package/index-62md4dwy.js +260 -0
  43. package/index-665zp9rs.js +271 -0
  44. package/{index-2etcv0sc.js → index-86jt2a0e.js} +1 -1
  45. package/{index-krq7btbt.js → index-8fp3b47h.js} +419 -418
  46. package/{index-c2yrsxdh.js → index-9z426msb.js} +109 -328
  47. package/{index-ctanya41.js → index-awbdfcf2.js} +4 -4
  48. package/{index-3hx1z96c.js → index-bqbf654f.js} +1 -1
  49. package/{index-rc5rwyps.js → index-bspm21y1.js} +71 -60
  50. package/index-cpb3nvma.js +667 -0
  51. package/{index-jx4bzvwg.js → index-d47ypebv.js} +97 -55
  52. package/{index-ae5pwhgs.js → index-d72hfmdm.js} +15 -13
  53. package/{index-e0cvze1s.js → index-fmzcs8v6.js} +4 -4
  54. package/{index-8ggztp8k.js → index-fyq1z6kt.js} +68 -201
  55. package/{index-1w2qaee2.js → index-g1mbppa9.js} +331 -259
  56. package/{index-gnyf1fqy.js → index-j237xtew.js} +6 -6
  57. package/{index-fm46xrf1.js → index-j4mkhz93.js} +3 -3
  58. package/{index-6jjtnhkw.js → index-jw1zm273.js} +74 -34
  59. package/{index-q958tqqg.js → index-m9jj544v.js} +1 -1
  60. package/index-mdjc93e1.js +33 -0
  61. package/{index-c1x0be5j.js → index-pydbnfez.js} +2 -2
  62. package/{index-56d2g8ms.js → index-qwa5k1j8.js} +1 -1
  63. package/{index-v29746vb.js → index-tamvyvj3.js} +3 -3
  64. package/{index-05g3jayg.js → index-trpasv9q.js} +260 -259
  65. package/{index-2ahj896a.js → index-tvehn2sp.js} +1 -1
  66. package/{index-55mynnqs.js → index-va06nr10.js} +1434 -1173
  67. package/index-vk0pa0mn.js +240 -0
  68. package/{index-aprt7pkz.js → index-w44cy4vs.js} +2271 -3369
  69. package/index.js +22 -22
  70. package/{library.command-gaga5bmq.js → library.command-erp2f56n.js} +3 -3
  71. package/{localRegistry.command-vsreyy42.js → localRegistry.command-y176p558.js} +15 -11
  72. package/{module.command-7vpf6db4.js → module.command-gs2r615e.js} +5 -5
  73. package/{package.command-twmvvf69.js → package.command-j10r76ax.js} +4 -4
  74. package/package.json +21 -21
  75. package/{page.command-5asq7fdf.js → page.command-4h4a8pnh.js} +3 -3
  76. package/{pipeline.command-d0v38572.js → pipeline.command-a2nrk26m.js} +221 -220
  77. package/{primitive.command-dyrs2fm8.js → primitive.command-w6t0asqz.js} +6 -6
  78. package/{projectTypecheck-cvtkrzp2.js → projectTypecheck-f534enqj.js} +1 -1
  79. package/{quality.command-6emsqpbg.js → quality.command-77x7vbbx.js} +4 -4
  80. package/{repair.command-8t6aegv5.js → repair.command-y6sstev7.js} +5 -5
  81. package/{scalar.command-bnggy1x7.js → scalar.command-20b8cy0k.js} +4 -4
  82. package/{subspace.command-md2teygq.js → subspace.command-5c7yasd7.js} +424 -364
  83. package/templates/appSample/lib/task/Task.Util.tsx +7 -7
  84. package/templates/appSample/lib/task/Task.Zone.tsx +1 -1
  85. package/templates/appSample/ui/QuantityControl.tsx +2 -2
  86. package/templates/crudSinglePage/page.tsx +1 -1
  87. package/templates/lib/cnst.ts +0 -1
  88. package/templates/workspaceRoot/.gitignore.template +23 -52
  89. package/templates/workspaceRoot/biome.json.template +1 -1
  90. package/{tunnel.command-jx3tdm2d.js → tunnel.command-2kw8vt9g.js} +8 -4
  91. package/{workflow.command-jx0wag5r.js → workflow.command-2djwmpqf.js} +10 -10
  92. package/{workspace.command-yxd7rr7g.js → workspace.command-6qfgq4b4.js} +38 -34
  93. package/TunnelShare-q4jq08qg.js +0 -9
  94. package/cloud.script-h6pvcpa2.js +0 -20
  95. package/context.runner-atcrzz5b.js +0 -21
  96. package/index-6w0rbr9d.js +0 -68
  97. package/index-n68jx79w.js +0 -120
  98. package/index-pgj2rt78.js +0 -404
@@ -2,16 +2,16 @@
2
2
  import {
3
3
  runner,
4
4
  script
5
- } from "./index-6jjtnhkw.js";
5
+ } from "./index-jw1zm273.js";
6
6
  import {
7
7
  FileSys2
8
8
  } from "./index-52w0fvh8.js";
9
9
  import {
10
10
  PkgExecutor
11
- } from "./index-55mynnqs.js";
11
+ } from "./index-va06nr10.js";
12
12
  import {
13
13
  TypeScriptDependencyScanner2
14
- } from "./index-2ahj896a.js";
14
+ } from "./index-tvehn2sp.js";
15
15
 
16
16
  // pkgs/@akanjs/cli/package/package.runner.ts
17
17
  import path2 from "path";
@@ -159,10 +159,10 @@ class PackageRunner extends runner("package") {
159
159
  const packageRuntimeDependencies = {
160
160
  "@akanjs/devkit": [
161
161
  "tailwind-scrollbar",
162
- "@earendil-works/chord",
163
162
  "@earendil-works/pi-agent-core",
164
163
  "@earendil-works/pi-ai",
165
- "@earendil-works/pi-telemetry",
164
+ "@earendil-works/pi-codemode",
165
+ "@earendil-works/pi-mcp",
166
166
  "@earendil-works/pi-tui"
167
167
  ]
168
168
  };
@@ -273,7 +273,7 @@ class PackageRunner extends runner("package") {
273
273
  if (!failures.length)
274
274
  return;
275
275
  throw new Error(`[package] ${pkg.name} dist imports ${failures.length} subpath(s) no consumer can resolve:
276
- ` + `${failures.sort().join(`
276
+ ` + `${failures.sort((a, b) => a < b ? -1 : a > b ? 1 : 0).join(`
277
277
  `)}
278
278
  ` + `Add the missing "exports" entries: a bare file facet needs "./*": "./*.ts", a directory facet ` + `needs its own "./name": "./name/index.ts", and "./*.ts": "./*.ts" keeps an already-suffixed ` + `specifier from gaining a second extension.`);
279
279
  }
@@ -5,13 +5,13 @@ import {
5
5
  writeGeneratedSyncState,
6
6
  createRepairReport,
7
7
  renderRepairReport
8
- } from "./index-05g3jayg.js";
8
+ } from "./index-trpasv9q.js";
9
9
  import {
10
10
  AkanContextAnalyzer
11
- } from "./index-2mx692qq.js";
11
+ } from "./index-5edzv8fn.js";
12
12
  import {
13
13
  runner
14
- } from "./index-6jjtnhkw.js";
14
+ } from "./index-jw1zm273.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], {
@@ -10,7 +10,7 @@ import {
10
10
  LibExecutor,
11
11
  PkgExecutor,
12
12
  ModuleExecutor
13
- } from "./index-55mynnqs.js";
13
+ } from "./index-va06nr10.js";
14
14
 
15
15
  // pkgs/@akanjs/devkit/commandDecorators/camelToKebabCase.ts
16
16
  var camelToKebabCase = (str) => str.replace(/([A-Z])/g, "-$1").toLowerCase();
@@ -40,7 +40,7 @@ var getArgMetas = (command, key) => {
40
40
  const internalArgMetas = allArgMetas.filter((argMeta) => argMeta.type !== "Option");
41
41
  return [allArgMetas, argMetas, internalArgMetas];
42
42
  };
43
- var createInternalArgToken = (type) => ({ type });
43
+ var createInternalArgToken = (type, option) => option ? { type, option } : { type };
44
44
  var normalizePrimitiveArgType = (type) => {
45
45
  if (type === String)
46
46
  return "string";
@@ -54,10 +54,34 @@ var App = createInternalArgToken("App");
54
54
  var Apps = createInternalArgToken("Apps");
55
55
  var Lib = createInternalArgToken("Lib");
56
56
  var Sys = createInternalArgToken("Sys");
57
+ var SysOrOnlyApp = createInternalArgToken("Sys", { onlyApp: true });
57
58
  var Exec = createInternalArgToken("Exec");
58
59
  var Pkg = createInternalArgToken("Pkg");
59
60
  var Module = createInternalArgToken("Module");
60
61
  var Workspace = createInternalArgToken("Workspace");
62
+ // pkgs/@akanjs/devkit/commandDecorators/command.ts
63
+ import path2 from "path";
64
+ import { Logger } from "akanjs/common";
65
+ import chalk2 from "chalk";
66
+ import { program } from "commander";
67
+
68
+ // pkgs/@akanjs/devkit/appSelectionMemory.ts
69
+ import path from "path";
70
+ class AppSelectionMemory {
71
+ static pathIn(workspaceRoot) {
72
+ return path.join(workspaceRoot, "local", ".akan", "lastStart.json");
73
+ }
74
+ static async read(workspaceRoot) {
75
+ const stored = await Bun.file(AppSelectionMemory.pathIn(workspaceRoot)).json().catch(() => null);
76
+ const apps = stored?.apps;
77
+ return Array.isArray(apps) ? apps.filter((name) => typeof name === "string") : [];
78
+ }
79
+ static async write(workspaceRoot, apps) {
80
+ await FileSys2.writeJson(AppSelectionMemory.pathIn(workspaceRoot), { apps }).catch(() => {
81
+ return;
82
+ });
83
+ }
84
+ }
61
85
 
62
86
  // pkgs/@akanjs/devkit/commandDecorators/dependencyBuilder.ts
63
87
  var capitalize = (value) => value.slice(0, 1).toUpperCase() + value.slice(1);
@@ -136,27 +160,16 @@ var script = (refName, deps = []) => {
136
160
  return ScriptBase;
137
161
  };
138
162
 
139
- // pkgs/@akanjs/devkit/commandDecorators/command.ts
140
- import path2 from "path";
141
- import { Logger } from "akanjs/common";
142
- import chalk2 from "chalk";
143
- import { program } from "commander";
144
-
145
- // pkgs/@akanjs/devkit/appSelectionMemory.ts
146
- import path from "path";
147
- class AppSelectionMemory {
148
- static pathIn(workspaceRoot) {
149
- return path.join(workspaceRoot, "local", ".akan", "lastStart.json");
163
+ // pkgs/@akanjs/devkit/commandDecorators/exitCodeError.ts
164
+ class ExitCodeError extends Error {
165
+ exitCode;
166
+ name = "ExitCodeError";
167
+ constructor(message, exitCode) {
168
+ super(message);
169
+ this.exitCode = exitCode;
150
170
  }
151
- static async read(workspaceRoot) {
152
- const stored = await Bun.file(AppSelectionMemory.pathIn(workspaceRoot)).json().catch(() => null);
153
- const apps = stored?.apps;
154
- return Array.isArray(apps) ? apps.filter((name) => typeof name === "string") : [];
155
- }
156
- static async write(workspaceRoot, apps) {
157
- await FileSys2.writeJson(AppSelectionMemory.pathIn(workspaceRoot), { apps }).catch(() => {
158
- return;
159
- });
171
+ static codeOf(error) {
172
+ return error instanceof ExitCodeError ? error.exitCode : null;
160
173
  }
161
174
  }
162
175
 
@@ -352,6 +365,7 @@ var select = (config, context) => prompts().then((m) => m.select(config, context
352
365
  var confirm = (config, context) => prompts().then((m) => m.confirm(config, context));
353
366
  var input = (config, context) => prompts().then((m) => m.input(config, context));
354
367
  var checkbox = (config, context) => prompts().then((m) => m.checkbox(config, context));
368
+ var argLabelOf = (argMeta) => argMeta.type === "Option" ? `option '--${camelToKebabCase(argMeta.name)}'` : `argument '${argMeta.name}'`;
355
369
  var assertEnumChoice = (argMeta, value) => {
356
370
  const enumChoices = argMeta.argsOption.enum;
357
371
  if (!enumChoices || typeof enumChoices === "function")
@@ -359,8 +373,12 @@ var assertEnumChoice = (argMeta, value) => {
359
373
  const choices = normalizeEnumChoices(enumChoices);
360
374
  if (choices.some((choice) => String(choice.value) === String(value)))
361
375
  return;
362
- const label = argMeta.type === "Option" ? `option '--${camelToKebabCase(argMeta.name)}'` : `argument '${argMeta.name}'`;
363
- throw new Error(`${label} argument '${String(value)}' is invalid. Allowed choices are ${choices.map((choice) => choice.name).join(", ")}.`);
376
+ throw new Error(`${argLabelOf(argMeta)} argument '${String(value)}' is invalid. Allowed choices are ${choices.map((choice) => choice.name).join(", ")}.`);
377
+ };
378
+ var assertPromptable = (problem, { choices = [], remedy = "pass it on the command line" } = {}) => {
379
+ if (process.stdin.isTTY)
380
+ return;
381
+ throw new Error(`${problem}: stdin is not a terminal to prompt on, so ${remedy}${choices.length ? ` (choices: ${choices.join(", ")})` : ""}.`);
364
382
  };
365
383
  var inputMessageOf = ({ name, argsOption: { desc, example, ask } }) => ask ? `${ask}: ` : desc ? `${desc}: ` : `Enter the ${name} value${example ? ` (example: ${example})` : ""}: `;
366
384
  var getOptionValue = async (argMeta, opt, context) => {
@@ -379,8 +397,11 @@ var getOptionValue = async (argMeta, opt, context) => {
379
397
  const choices = normalizeEnumChoices((typeof enumChoices === "function" ? await enumChoices(context) : enumChoices) ?? []);
380
398
  if (choices.length === 1)
381
399
  return choices[0]?.value;
400
+ assertPromptable(`Missing ${argLabelOf(argMeta)}`, { choices: choices.map((choice) => choice.value) });
382
401
  return await select({ message: ask ?? desc ?? `Select the ${name} value`, choices });
383
- } else if (type === "boolean") {
402
+ }
403
+ assertPromptable(`Missing ${argLabelOf(argMeta)}`);
404
+ if (type === "boolean") {
384
405
  const message = ask ?? desc ?? `Do you want to set ${name}? ${desc ? ` (${desc})` : ""}: `;
385
406
  return await confirm({ message });
386
407
  } else
@@ -395,6 +416,10 @@ var getArgumentValue = async (argMeta, value) => {
395
416
  return defaultValue;
396
417
  else if (nullable)
397
418
  return null;
419
+ const { enum: enumChoices } = argMeta.argsOption;
420
+ assertPromptable(`Missing ${argLabelOf(argMeta)}`, {
421
+ choices: enumChoices && typeof enumChoices !== "function" ? normalizeEnumChoices(enumChoices).map(({ value }) => value) : []
422
+ });
398
423
  return convertArgValue(await input({ message: inputMessageOf(argMeta) }), type ?? "string");
399
424
  };
400
425
  var assignCommandContext = (context, argMeta, value) => {
@@ -415,17 +440,17 @@ var assignCommandContext = (context, argMeta, value) => {
415
440
  };
416
441
  var assertCurrentDirectoryIsWorkspaceRoot = async () => {
417
442
  const cwd = process.cwd();
418
- const [hasPackageJson, hasTsConfig, hasEnv] = await Promise.all([
443
+ const [hasPackageJson, hasTsConfig, ...hasMemberDirs] = await Promise.all([
419
444
  FileSys2.fileExists(`${cwd}/package.json`),
420
445
  FileSys2.fileExists(`${cwd}/tsconfig.json`),
421
- FileSys2.fileExists(`${cwd}/.env`)
446
+ ...["apps", "libs", "pkgs"].map((dir) => FileSys2.dirExists(`${cwd}/${dir}`))
422
447
  ]);
423
- if (hasPackageJson && hasTsConfig && hasEnv)
448
+ if (hasPackageJson && hasTsConfig && hasMemberDirs.some(Boolean))
424
449
  return;
425
450
  throw new Error([
426
451
  "Akan CLI commands must be run from the workspace root.",
427
452
  `Current directory: ${cwd}`,
428
- "Move to the directory that contains package.json, tsconfig.json, and .env, then run the command again."
453
+ "Move to the directory that contains package.json, tsconfig.json, and an apps/, libs/ or pkgs/ folder, then run the command again."
429
454
  ].join(`
430
455
  `));
431
456
  };
@@ -445,6 +470,7 @@ var getAppsArgumentValue = async (value, workspace) => {
445
470
  }
446
471
  if (appNames.length === 1 && appNames[0])
447
472
  return [AppExecutor.from(workspace, appNames[0])];
473
+ assertPromptable("Missing apps", { choices: [...appNames, "all"] });
448
474
  const remembered = new Set(await AppSelectionMemory.read(workspace.workspaceRoot));
449
475
  const picked = await checkbox({
450
476
  message: "Select the apps to run (space to toggle, enter to confirm)",
@@ -459,6 +485,7 @@ var getInternalArgumentValue = async (argMeta, value, workspace) => {
459
485
  return workspace;
460
486
  const sysType = argMeta.type.toLowerCase();
461
487
  const [appNames, libNames, pkgNames] = await workspace.getExecs();
488
+ const problemOf = (kind) => value ? `Unknown ${kind} '${value}'` : `Missing ${kind}`;
462
489
  if (sysType === "sys" || sysType === "exec") {
463
490
  const pkgChoices = sysType === "exec" ? pkgNames : [];
464
491
  const execOf = (name) => {
@@ -473,6 +500,11 @@ var getInternalArgumentValue = async (argMeta, value, workspace) => {
473
500
  const found = value ? execOf(value) : null;
474
501
  if (found)
475
502
  return found;
503
+ if (!value && argMeta.option?.onlyApp && appNames.length === 1 && appNames[0])
504
+ return AppExecutor.from(workspace, appNames[0]);
505
+ assertPromptable(problemOf(sysType === "exec" ? "app, lib or pkg" : "app or lib"), {
506
+ choices: [...appNames, ...libNames, ...pkgChoices]
507
+ });
476
508
  const name = await select({
477
509
  message: sysType === "exec" ? `Select the App or Lib or Pkg name` : `Select the App or Lib name`,
478
510
  choices: [...appNames, ...libNames, ...pkgChoices]
@@ -486,17 +518,20 @@ var getInternalArgumentValue = async (argMeta, value, workspace) => {
486
518
  return AppExecutor.from(workspace, value);
487
519
  if (!value && appNames.length === 1 && appNames[0])
488
520
  return AppExecutor.from(workspace, appNames[0]);
521
+ assertPromptable(problemOf("app"), { choices: appNames });
489
522
  const appName = await select({ message: `Select the ${sysType} name`, choices: appNames });
490
523
  return AppExecutor.from(workspace, appName);
491
524
  } else if (sysType === "lib") {
492
525
  if (value && libNames.includes(value))
493
526
  return LibExecutor.from(workspace, value);
527
+ assertPromptable(problemOf("lib"), { choices: libNames });
494
528
  const libName = await select({ message: `Select the ${sysType} name`, choices: libNames });
495
529
  return LibExecutor.from(workspace, libName);
496
530
  } else if (sysType === "pkg") {
497
531
  const pkgs = await workspace.getPkgs();
498
532
  if (value && pkgs.includes(value))
499
533
  return PkgExecutor.from(workspace, value);
534
+ assertPromptable(problemOf("pkg"), { choices: pkgs });
500
535
  const pkgName = await select({ message: `Select the ${sysType} name`, choices: pkgs });
501
536
  return PkgExecutor.from(workspace, pkgName);
502
537
  } else if (sysType === "module") {
@@ -519,6 +554,7 @@ var getInternalArgumentValue = async (argMeta, value, workspace) => {
519
554
  } else
520
555
  throw new Error(`Invalid system name: ${sysName}`);
521
556
  }
557
+ assertPromptable(problemOf("module"));
522
558
  const { type, name } = await select({
523
559
  message: `select the App or Lib name`,
524
560
  choices: [
@@ -540,7 +576,7 @@ var runCommands = async (...commands) => {
540
576
  let failureExitCode = 1;
541
577
  process.on("unhandledRejection", (error) => {
542
578
  printCliError(error);
543
- process.exit(failureExitCode);
579
+ process.exit(ExitCodeError.codeOf(error) ?? failureExitCode);
544
580
  });
545
581
  const __dirname2 = getDirname2(import.meta.url);
546
582
  const packageJsonCandidates = [`${path2.dirname(Bun.main)}/package.json`, `${__dirname2}/../package.json`];
@@ -647,10 +683,9 @@ It may cause unexpected behavior. Run \`akan update\` to update latest akanjs.`)
647
683
  }
648
684
  await program.parseAsync(process.argv).catch((error) => {
649
685
  printCliError(error);
650
- process.exit(failureExitCode);
686
+ process.exit(ExitCodeError.codeOf(error) ?? failureExitCode);
651
687
  });
652
688
  };
653
-
654
689
  // pkgs/@akanjs/devkit/commandDecorators/commandBuilder.ts
655
690
  var argMetaOf = (type, name, primitive, argsOption, idx) => ({ name, argsOption: { ...argsOption, type: normalizePrimitiveArgType(primitive) }, key: "", idx, type });
656
691
 
@@ -671,7 +706,12 @@ class TargetBuilder {
671
706
  return this.#add(argMetaOf("Option", name, type, argsOption, this.#args.length));
672
707
  }
673
708
  with(...tokens) {
674
- return this.#add(...tokens.map((token, offset) => ({ key: "", idx: this.#args.length + offset, type: token.type })));
709
+ return this.#add(...tokens.map((token, offset) => ({
710
+ key: "",
711
+ idx: this.#args.length + offset,
712
+ type: token.type,
713
+ ...token.option ? { option: token.option } : {}
714
+ })));
675
715
  }
676
716
  exec(handler) {
677
717
  return {
@@ -718,4 +758,4 @@ function command(refName, depsOrBuilder, builder) {
718
758
  }
719
759
  return CommandBase;
720
760
  }
721
- export { getTargetMetas, getTargetCommandNames, App, Apps, Lib, Sys, Exec, Pkg, Module, Workspace, CommandContainer, runner, script, runCommands, command };
761
+ export { getTargetMetas, getTargetCommandNames, App, Apps, Lib, Sys, SysOrOnlyApp, Exec, Pkg, Module, Workspace, CommandContainer, runner, script, ExitCodeError, assertPromptable, runCommands, command };
@@ -1,6 +1,6 @@
1
1
  // @bun
2
2
  // pkgs/@akanjs/devkit/mobile/mobileTarget.ts
3
- var trimSlashes = (value) => value.replace(/^\/+|\/+$/g, "");
3
+ import { trimSlashes } from "akanjs/common";
4
4
  var getMobileTargets = async (app) => {
5
5
  const config = await app.getConfig();
6
6
  return Object.entries(config.native.targets).map(([name, target]) => ({ name, config: target }));
@@ -0,0 +1,33 @@
1
+ // @bun
2
+ import {
3
+ getMobileTargetChoices
4
+ } from "./index-m9jj544v.js";
5
+
6
+ // pkgs/@akanjs/cli/application/commandOptions.ts
7
+ var targetChoices = async ({ app }) => await getMobileTargetChoices(app);
8
+ var writeOption = { desc: "write code generation", default: true };
9
+ var nativeTargetOption = {
10
+ desc: "native target name (a key of native.targets) or all",
11
+ ask: "Select native target",
12
+ enum: targetChoices
13
+ };
14
+ var oneNativeTargetOption = {
15
+ desc: "native target name (a key of native.targets)",
16
+ ask: "Select native target",
17
+ enum: targetChoices
18
+ };
19
+ var nativeEnvs = ["debug", "develop", "main", "local"];
20
+ var releaseEnvOption = { enum: nativeEnvs, desc: "backend environment", default: "main" };
21
+ var allowLocalOption = (what) => ({ flag: "l", desc: `allow ${what} with --env local`, default: false });
22
+ var publicEnvOption = (what) => ({
23
+ flag: "u",
24
+ desc: `the AKAN_PUBLIC_* ${what} inlines, exactly: a JSON map of them, or a store build's bundle.json that recorded them`,
25
+ nullable: true
26
+ });
27
+ var hostOption = {
28
+ desc: "host of the cloud to target (default: cloud.host of the root akan.config.ts, else Akan Cloud)",
29
+ nullable: true
30
+ };
31
+ var subspaceOption = (whose) => ({ desc: `the subspace whose project ${whose}`, nullable: true });
32
+
33
+ export { writeOption, nativeTargetOption, oneNativeTargetOption, nativeEnvs, releaseEnvOption, allowLocalOption, publicEnvOption, hostOption, subspaceOption };
@@ -2,12 +2,12 @@
2
2
  import {
3
3
  runner,
4
4
  script
5
- } from "./index-6jjtnhkw.js";
5
+ } from "./index-jw1zm273.js";
6
6
  import {
7
7
  LibSource,
8
8
  formatLibStatuses,
9
9
  LibExecutor
10
- } from "./index-55mynnqs.js";
10
+ } from "./index-va06nr10.js";
11
11
 
12
12
  // pkgs/@akanjs/cli/library/library.script.ts
13
13
  import { Logger } from "akanjs/common";
@@ -2,7 +2,7 @@
2
2
  import {
3
3
  GlobalConfig,
4
4
  CloudApi
5
- } from "./index-pgj2rt78.js";
5
+ } from "./index-cpb3nvma.js";
6
6
 
7
7
  // pkgs/@akanjs/cli/tunnel/TunnelShare.ts
8
8
  import { TunnelAgent } from "akanjs/server/tunnel";
@@ -2,7 +2,7 @@
2
2
  import {
3
3
  runner,
4
4
  script
5
- } from "./index-6jjtnhkw.js";
5
+ } from "./index-jw1zm273.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-55mynnqs.js";
16
+ } from "./index-va06nr10.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-2mx692qq.js";
23
+ } from "./index-5edzv8fn.js";
24
24
  import {
25
25
  Prompter2
26
26
  } from "./index-zzvvc845.js";