@akanjs/cli 3.1.1 → 3.1.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 (113) hide show
  1. package/.build-stamp +1 -1
  2. package/CodeAgent-dyc45f5w.js +11 -0
  3. package/{CodeAgentRpcHost-9g27hmer.js → CodeAgentRpcHost-6dzfkvsc.js} +1 -1
  4. package/CodeAgentRpcListener-tcwrdvst.js +182 -0
  5. package/{CodeTui-h6yz2kvq.js → CodeTui-q55b2zrn.js} +25 -8
  6. package/TunnelShare-hdq9h1hr.js +14 -0
  7. package/{agent.command-3r4jsck8.js → agent.command-20zaqe60.js} +18 -15
  8. package/akanCode.js +8 -7
  9. package/{application.command-g7xv6ad0.js → application.command-nd0fshsk.js} +11 -11
  10. package/{applicationBuildRunner-qvjnhr9j.js → applicationBuildRunner-s13x3zqb.js} +10 -9
  11. package/buildBatch.proc.js +6 -6
  12. package/{cloud.command-6ebygmhw.js → cloud.command-8kbddsz9.js} +25 -18
  13. package/cloud.script-hgvvajm3.js +27 -0
  14. package/code.command-625bg8s8.js +345 -0
  15. package/{context.command-svdh6b2w.js → context.command-p6haqjay.js} +19 -18
  16. package/context.runner-rsnqnk9j.js +27 -0
  17. package/{dependencyScanner-3afj2vt1.js → dependencyScanner-78sq8m4q.js} +2 -2
  18. package/{fileSys-wzzrntkw.js → fileSys-zpvt5gtf.js} +1 -1
  19. package/{guideline.command-qwp3tnjx.js → guideline.command-195g0h9a.js} +4 -4
  20. package/guidelines/agentRule/agentRule.instruction.md +22 -8
  21. package/guidelines/conventions/rules/auth.md +5 -4
  22. package/guidelines/conventions/rules/config.md +5 -1
  23. package/guidelines/conventions/rules/gates.md +2 -1
  24. package/guidelines/conventions/rules/module.md +1 -1
  25. package/guidelines/conventions/rules/server.md +8 -3
  26. package/guidelines/conventions/rules/ssr.md +2 -2
  27. package/guidelines/conventions/rules/tsx.md +2 -1
  28. package/guidelines/pageRule/pageRule.instruction.md +4 -4
  29. package/guidelines/runtimeRule/runtimeRule.instruction.md +35 -25
  30. package/guidelines/ssrRule/ssrRule.instruction.md +11 -10
  31. package/guidelines/transportRule/transportRule.instruction.md +5 -4
  32. package/guidelines/workspaceRecipes/workspaceRecipes.instruction.md +1 -1
  33. package/incrementalBuilder.proc.js +4 -4
  34. package/{index-w4k2ragk.js → index-00a7j05x.js} +7 -7
  35. package/{index-w7q6h97v.js → index-0j1t1h2b.js} +3 -1
  36. package/{index-payhwt51.js → index-1h2jc0x3.js} +141 -67
  37. package/{index-vxmy1p4f.js → index-1qsd8ft1.js} +63 -123
  38. package/{index-s6da8ta9.js → index-2mwjshz5.js} +158 -51
  39. package/index-2nxk8wgs.js +266 -0
  40. package/{index-k5jbcxyh.js → index-2phm56a1.js} +49 -8
  41. package/{index-jje9qzyq.js → index-35j83zkd.js} +37 -3
  42. package/{index-m5n3ka0p.js → index-4am4dvmf.js} +13 -2
  43. package/index-75y7bcz4.js +28 -0
  44. package/{index-b8c289dx.js → index-7apsdr5g.js} +55 -12
  45. package/{index-8559hsz4.js → index-84h43kg6.js} +6 -5
  46. package/{index-eja64h28.js → index-9zy8479y.js} +5 -3
  47. package/{index-96wzdhfh.js → index-a1vb3x7t.js} +209 -36
  48. package/{index-52w0fvh8.js → index-bns3wcpc.js} +15 -0
  49. package/{index-am36s3jh.js → index-cjmjvg4r.js} +157 -117
  50. package/{index-1p0qbq3m.js → index-defp4gmb.js} +1 -1
  51. package/{index-4pdts00b.js → index-ewbmfarf.js} +10 -8
  52. package/{index-9rvcs76p.js → index-fhw7yq2d.js} +10 -10
  53. package/{index-8scw1pjk.js → index-g500c5j9.js} +178 -82
  54. package/{index-qxzrp5xt.js → index-g841cap9.js} +4 -4
  55. package/{index-qkkdhjm6.js → index-gr9thy79.js} +5 -5
  56. package/{index-4pf8g7ff.js → index-h7hehkw6.js} +3 -0
  57. package/{index-4mj92tsh.js → index-hm0tn7qv.js} +73 -68
  58. package/{index-r2wedvqn.js → index-j6eeh5d7.js} +1 -1
  59. package/{index-tgt2fnd6.js → index-j7hwy56s.js} +3 -3
  60. package/{index-rnphv731.js → index-jc2zbwra.js} +2 -2
  61. package/{index-z4b84y6k.js → index-khk05tsf.js} +1 -1
  62. package/{index-tvehn2sp.js → index-qd7xn2bk.js} +1 -1
  63. package/{index-266dewjs.js → index-qw6814m4.js} +53 -15
  64. package/{index-zcf6k8a5.js → index-raz588b3.js} +47 -12
  65. package/{index-at7bz0xq.js → index-s4nvxpzm.js} +2 -0
  66. package/{index-3yz30c07.js → index-sp0qsr7a.js} +114 -12
  67. package/{index-1shvxzt0.js → index-sveq36gh.js} +39 -42
  68. package/{index-r2w2eh93.js → index-t1t9wq9a.js} +4 -4
  69. package/index-t78230d7.js +191 -0
  70. package/{index-r0k3ham2.js → index-tgqameyb.js} +4 -4
  71. package/{index-dd44g6vz.js → index-tp56652m.js} +5 -5
  72. package/index-w15mg3km.js +389 -0
  73. package/{index-xq543a5y.js → index-y4kcmbt2.js} +2 -2
  74. package/index-yf9wc28h.js +52 -0
  75. package/{index-xqgwjz7a.js → index-zbrwnmf1.js} +9 -7
  76. package/{index-xxfy1jp2.js → index-zttm13c3.js} +4 -4
  77. package/index.js +24 -24
  78. package/{library.command-2853y6mk.js → library.command-63hgt9te.js} +4 -4
  79. package/{localRegistry.command-76ds31p4.js → localRegistry.command-g3f8k25t.js} +43 -23
  80. package/{module.command-yfnb0abs.js → module.command-r4sa2khp.js} +7 -6
  81. package/{package.command-d9s86hp9.js → package.command-96eheyvd.js} +5 -5
  82. package/package.json +2 -2
  83. package/{page.command-6a8a8rd1.js → page.command-gs6d841d.js} +4 -4
  84. package/{pipeline.command-rt3rwd2z.js → pipeline.command-wdfvdbfj.js} +3 -3
  85. package/{primitive.command-emcebgrq.js → primitive.command-dfsv4mpe.js} +8 -7
  86. package/{projectTypecheck-51m7eh1f.js → projectTypecheck-kqj1t6hb.js} +1 -1
  87. package/{prompter-hgcta8pb.js → prompter-qrwx1p17.js} +2 -2
  88. package/{quality.command-xtrk0n3x.js → quality.command-webzxee2.js} +6 -4
  89. package/{repair.command-51szxnxx.js → repair.command-3r3j1xre.js} +7 -6
  90. package/{scalar.command-8qv27t82.js → scalar.command-e8y47j6d.js} +6 -5
  91. package/skills/akan-agent/SKILL.md +8 -1
  92. package/skills/akan-code/SKILL.md +37 -11
  93. package/skills/akan-debug/SKILL.md +2 -1
  94. package/skills/akan-err/SKILL.md +2 -1
  95. package/skills/akan-query/SKILL.md +3 -2
  96. package/skills/akan-runtime/SKILL.md +3 -0
  97. package/{subspace.command-pn56pnh8.js → subspace.command-a1sf9n5a.js} +12 -10
  98. package/templates/appSample/lib/task/task.signal.ts +14 -9
  99. package/templates/appSample/srvkit/guards.ts +11 -0
  100. package/templates/service/__model__.dictionary.ts +3 -5
  101. package/templates/workspaceRoot/.gitignore.template +1 -0
  102. package/{tunnel.command-q2h0j2en.js → tunnel.command-dcb0wg93.js} +25 -13
  103. package/{verify.command-z1dsbmrt.js → verify.command-yyepccbh.js} +13 -11
  104. package/{workflow.command-r3y67jeq.js → workflow.command-z5pg9ay0.js} +12 -11
  105. package/{workspace.command-t2f0xsrw.js → workspace.command-d7x5jttw.js} +74 -47
  106. package/CodeAgent-35wnb7w5.js +0 -9
  107. package/CodeAgentRpcListener-7p7z5dd7.js +0 -97
  108. package/TunnelShare-xyjpa7gx.js +0 -14
  109. package/cloud.script-0s1jybd5.js +0 -26
  110. package/code.command-mpkm2emr.js +0 -167
  111. package/context.runner-ch0z3a8g.js +0 -26
  112. package/index-c6eggbee.js +0 -123
  113. package/index-ksfgqq1x.js +0 -49
@@ -6,34 +6,34 @@ import {
6
6
  CloudApi,
7
7
  CloudUpdates,
8
8
  PipelineSecrets
9
- } from "./index-qkkdhjm6.js";
9
+ } from "./index-gr9thy79.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-8scw1pjk.js";
16
+ } from "./index-g500c5j9.js";
17
17
  import {
18
18
  NativeApp
19
- } from "./index-3yz30c07.js";
19
+ } from "./index-sp0qsr7a.js";
20
20
  import {
21
21
  runner,
22
22
  assertPromptable
23
- } from "./index-eja64h28.js";
24
- import {
25
- SubspaceConfig
26
- } from "./index-4pf8g7ff.js";
23
+ } from "./index-9zy8479y.js";
27
24
  import {
28
25
  getNpmRegistryUrl,
29
26
  getLatestPackageVersion
30
- } from "./index-m5n3ka0p.js";
27
+ } from "./index-4am4dvmf.js";
28
+ import {
29
+ SubspaceConfig
30
+ } from "./index-h7hehkw6.js";
31
31
  import {
32
32
  openBrowser
33
33
  } from "./index-9dp031by.js";
34
34
 
35
35
  // pkgs/@akanjs/cli/cloud/cloud.runner.ts
36
- import path7 from "path";
36
+ import path8 from "path";
37
37
 
38
38
  // pkgs/@akanjs/devkit/platformTest/PlatformTestRun.ts
39
39
  import path6 from "path";
@@ -671,11 +671,74 @@ class PlatformTestRun {
671
671
 
672
672
  // pkgs/@akanjs/cli/cloud/cloud.runner.ts
673
673
  import { confirm, input, select } from "@inquirer/prompts";
674
- import { Logger as Logger2 } from "akanjs/common";
674
+ import { Logger as Logger3 } from "akanjs/common";
675
675
  import chalk3 from "chalk";
676
676
 
677
+ // pkgs/@akanjs/cli/cloud/envArchive.ts
678
+ import { copyFile, mkdir as mkdir3, mkdtemp, readdir, rm } from "fs/promises";
679
+ import path7 from "path";
680
+ import { Logger } from "akanjs/common";
681
+
682
+ class EnvArchive {
683
+ static envFilePattern = /^env\.(client|server)\.(?!(type|example)\.ts$).+\.ts$/;
684
+ static async extract(workspace, archivePath) {
685
+ const root = workspace.workspaceRoot;
686
+ await mkdir3(path7.join(root, "local"), { recursive: true });
687
+ const staging = await mkdtemp(path7.join(root, "local", "env-extract-"));
688
+ try {
689
+ const relativeArchive = path7.relative(staging, path7.resolve(root, archivePath)).split(path7.sep).join("/");
690
+ await workspace.spawn("tar", ["-xf", relativeArchive], { cwd: staging });
691
+ const secretGlobs = await EnvArchive.#secretGlobs(workspace);
692
+ const { files, others } = await EnvArchive.#walk(staging);
693
+ const kept = files.filter((file) => EnvArchive.#isEnvFile(file, secretGlobs));
694
+ const skipped = [...files.filter((file) => !kept.includes(file)), ...others];
695
+ for (const file of kept) {
696
+ const target = path7.join(root, file);
697
+ await mkdir3(path7.dirname(target), { recursive: true });
698
+ await copyFile(path7.join(staging, file), target);
699
+ }
700
+ if (skipped.length)
701
+ Logger.warn(`Left out of the env archive what is no env or declared secret file: ${skipped.join(", ")}`);
702
+ return { kept, skipped };
703
+ } finally {
704
+ await rm(staging, { recursive: true, force: true });
705
+ }
706
+ }
707
+ static #isEnvFile(file, secretGlobs) {
708
+ const [scope = "", name = "", ...rest] = file.split("/");
709
+ const [folder, fileName = ""] = rest;
710
+ if ((scope === "apps" || scope === "libs") && rest.length === 2 && folder === "env")
711
+ return EnvArchive.envFilePattern.test(fileName);
712
+ return scope === "apps" && !!secretGlobs.get(name)?.some((glob) => glob.match(rest.join("/")));
713
+ }
714
+ static async#secretGlobs(workspace) {
715
+ const [appNames] = await workspace.getExecs();
716
+ const entries = await Promise.all(appNames.map(async (appName) => {
717
+ const { secrets = [] } = await AppExecutor.from(workspace, appName).getConfig();
718
+ return [appName, secrets.map((pattern) => new Bun.Glob(pattern))];
719
+ }));
720
+ return new Map(entries);
721
+ }
722
+ static async#walk(dir, prefix = "") {
723
+ const files = [];
724
+ const others = [];
725
+ for (const entry of await readdir(dir, { withFileTypes: true })) {
726
+ const relative = prefix ? `${prefix}/${entry.name}` : entry.name;
727
+ if (entry.isDirectory()) {
728
+ const nested = await EnvArchive.#walk(path7.join(dir, entry.name), relative);
729
+ files.push(...nested.files);
730
+ others.push(...nested.others);
731
+ } else if (entry.isFile())
732
+ files.push(relative);
733
+ else
734
+ others.push(relative);
735
+ }
736
+ return { files, others };
737
+ }
738
+ }
739
+
677
740
  // pkgs/@akanjs/cli/cloud/remoteLogin.ts
678
- import { Backoff, Logger, RemoteAuthCode, sleep } from "akanjs/common";
741
+ import { Backoff, Logger as Logger2, RemoteAuthCode, sleep } from "akanjs/common";
679
742
  import chalk2 from "chalk";
680
743
  import * as QRcode from "qrcode";
681
744
  class RemoteLogin {
@@ -718,33 +781,37 @@ class RemoteLogin {
718
781
  }
719
782
  async#prompt(remoteId, loginId) {
720
783
  const signinUrl = `${this.#api.host}/remoteAuth?remoteId=${encodeURIComponent(loginId)}`;
721
- Logger.rawLog(chalk2.bold(`
784
+ Logger2.rawLog(chalk2.bold(`
722
785
  ${chalk2.green("\u27A4")} Authentication Required`));
723
- Logger.rawLog(chalk2.dim("Please visit or click the following URL:"));
724
- Logger.rawLog(`${chalk2.cyan.underline(signinUrl)}
786
+ Logger2.rawLog(chalk2.dim("Please visit or click the following URL:"));
787
+ Logger2.rawLog(`${chalk2.cyan.underline(signinUrl)}
725
788
  `);
726
789
  try {
727
- Logger.rawLog(await QRcode.toString(signinUrl, { type: "terminal", small: true }));
790
+ Logger2.rawLog(await QRcode.toString(signinUrl, { type: "terminal", small: true }));
728
791
  await this.#open(signinUrl);
729
- Logger.rawLog(chalk2.dim("Opening browser..."));
792
+ Logger2.rawLog(chalk2.dim("Opening browser..."));
730
793
  } catch {
731
- Logger.rawLog(chalk2.yellow("Could not open browser. Please visit the URL manually."));
794
+ Logger2.rawLog(chalk2.yellow("Could not open browser. Please visit the URL manually."));
732
795
  }
733
- Logger.rawLog(`
796
+ Logger2.rawLog(`
734
797
  ${chalk2.bold("Your code:")} ${chalk2.bold.inverse(` ${await RemoteAuthCode.of(remoteId)} `)}`);
735
- Logger.rawLog(chalk2.dim(`Enter this code on the sign-in page. Never enter a code that did not come from your own terminal.
798
+ Logger2.rawLog(chalk2.dim(`Enter this code on the sign-in page. Never enter a code that did not come from your own terminal.
736
799
  `));
737
800
  }
738
801
  async#awaitApproval(remoteId, loginId) {
739
- Logger.rawLog(chalk2.dim("Waiting for authentication..."));
802
+ Logger2.rawLog(chalk2.dim("Waiting for authentication..."));
740
803
  const deadline = this.#now() + this.#limitMs;
741
804
  const ids = [remoteId, loginId];
742
805
  let failures = 0;
743
806
  while (this.#now() < deadline) {
744
807
  const answers = await Promise.allSettled(ids.map((id) => this.#api.getRemoteAuthToken(id)));
745
- for (const answer of answers)
746
- if (answer.status === "fulfilled" && answer.value)
747
- return answer.value;
808
+ const [deviceAnswer, legacyAnswer] = answers;
809
+ if (deviceAnswer?.status === "fulfilled" && deviceAnswer.value)
810
+ return deviceAnswer.value;
811
+ if (legacyAnswer?.status === "fulfilled" && legacyAnswer.value) {
812
+ Logger2.rawLog(chalk2.yellow(`${this.#api.host} handed the session out for the sign-in URL's id; it should answer by the device code alone.`));
813
+ return legacyAnswer.value;
814
+ }
748
815
  const [device, legacy] = answers.map((answer) => answer.status === "rejected" ? answer.reason : null);
749
816
  if (RemoteLogin.#isFinal(device))
750
817
  throw this.#refusal(device);
@@ -757,7 +824,7 @@ ${chalk2.bold("Your code:")} ${chalk2.bold.inverse(` ${await RemoteAuthCode.of(r
757
824
  failures = 0;
758
825
  else {
759
826
  if (failures++ === 0)
760
- Logger.rawLog(chalk2.yellow(`Could not check the sign-in (${RemoteLogin.#reasonOf(errors[0])}); retrying...`));
827
+ Logger2.rawLog(chalk2.yellow(`Could not check the sign-in (${RemoteLogin.#reasonOf(errors[0])}); retrying...`));
761
828
  waitMs = Math.max(retryAfterMs, Backoff.delay(failures + 1, { min: this.#pollMs, max: this.#maxBackoffMs }));
762
829
  }
763
830
  await this.#wait(Math.min(waitMs, Math.max(0, deadline - this.#now())));
@@ -782,7 +849,7 @@ ${chalk2.bold("Your code:")} ${chalk2.bold.inverse(` ${await RemoteAuthCode.of(r
782
849
  await GlobalConfig.setHostConfig(getDefaultHostConfig(host));
783
850
  throw new Error(chalk2.red(`\u2716 ${host} did not take the session it handed out. Run akan login again.`));
784
851
  }
785
- Logger.rawLog(chalk2.yellow(`Could not read the signed-in account (${reason}).`));
852
+ Logger2.rawLog(chalk2.yellow(`Could not read the signed-in account (${reason}).`));
786
853
  return null;
787
854
  }
788
855
  static #isFinal(error) {
@@ -808,7 +875,13 @@ var addRemoteEnvServerValue = "__addRemoteEnvServer";
808
875
  var removeRemoteEnvServerValue = "__removeRemoteEnvServer";
809
876
 
810
877
  class CloudRunner extends runner("cloud") {
811
- #akanFrameworkPackages = new Set(["akanjs", "@akanjs/devkit", "@akanjs/cli", "create-akan-workspace"]);
878
+ #akanFrameworkPackages = new Set([
879
+ "akanjs",
880
+ "@akanjs/devkit",
881
+ "@akanjs/cli",
882
+ "@akanjs/language",
883
+ "create-akan-workspace"
884
+ ]);
812
885
  #getRegistryArgs(registryUrl) {
813
886
  return registryUrl ? ["--registry", getNpmRegistryUrl(registryUrl)] : [];
814
887
  }
@@ -852,7 +925,7 @@ class CloudRunner extends runner("cloud") {
852
925
  const servers = await GlobalConfig.getRemoteEnvServers();
853
926
  const serverEntries = Object.entries(servers).sort(([nameA], [nameB]) => nameA.localeCompare(nameB));
854
927
  if (serverEntries.length === 0) {
855
- Logger2.info("No remote env servers configured. Add the first remote server for SCP mode.");
928
+ Logger3.info("No remote env servers configured. Add the first remote server for SCP mode.");
856
929
  return await this.#addRemoteEnvServer();
857
930
  }
858
931
  const selectedName = await select({
@@ -882,7 +955,7 @@ class CloudRunner extends runner("cloud") {
882
955
  if (!await confirm({ message: `Remove remote env server "${selectedName}"?`, default: false }))
883
956
  return;
884
957
  await GlobalConfig.removeRemoteEnvServer(selectedName);
885
- Logger2.info(`Removed remote env server "${selectedName}"`);
958
+ Logger3.info(`Removed remote env server "${selectedName}"`);
886
959
  }
887
960
  #serverChoice([name, config]) {
888
961
  return { name: `${name} (${this.#getSshTarget(config)}${config.port ? `:${config.port}` : ""})`, value: name };
@@ -902,6 +975,8 @@ class CloudRunner extends runner("cloud") {
902
975
  }
903
976
  #getRemoteEnvArchiveDir() {
904
977
  const { repoName } = WorkspaceExecutor.getBaseDevEnv();
978
+ if (!/^[A-Za-z0-9][\w.-]*$/.test(repoName))
979
+ throw new Error(`The repository name "${repoName}" cannot name the remote env folder ~/secrets/<name>: it takes letters, digits, ".", "_" and "-". Set AKAN_PUBLIC_REPO_NAME in the workspace .env to such a name.`);
905
980
  return `~/secrets/${repoName}`;
906
981
  }
907
982
  #getScpTarget(config, remotePath) {
@@ -920,21 +995,21 @@ class CloudRunner extends runner("cloud") {
920
995
  const cloudApi = await CloudApi.fromHost(workspace, host);
921
996
  const signedIn = await cloudApi.getRemoteSelf().catch(() => null);
922
997
  if (signedIn) {
923
- Logger2.rawLog(chalk3.green(`
998
+ Logger3.rawLog(chalk3.green(`
924
999
  \u2713 Already logged in akan cloud as ${signedIn.nickname}
925
1000
  `));
926
1001
  return true;
927
1002
  }
928
1003
  const self = await new RemoteLogin(cloudApi).signIn();
929
- Logger2.rawLog(chalk3.green(`\r\u2713 Authentication successful!`));
1004
+ Logger3.rawLog(chalk3.green(`\r\u2713 Authentication successful!`));
930
1005
  if (!self) {
931
- Logger2.rawLog(chalk3.yellow(`The session is saved; run akan login again to check which account it signed in.
1006
+ Logger3.rawLog(chalk3.yellow(`The session is saved; run akan login again to check which account it signed in.
932
1007
  `));
933
1008
  return true;
934
1009
  }
935
- Logger2.rawLog(chalk3.green.bold(`
1010
+ Logger3.rawLog(chalk3.green.bold(`
936
1011
  \u2728 Welcome aboard, ${self.nickname ?? "anonymous"}!`));
937
- Logger2.rawLog(chalk3.dim(`You're now ready to use Akan CLI!
1012
+ Logger3.rawLog(chalk3.dim(`You're now ready to use Akan CLI!
938
1013
  `));
939
1014
  return true;
940
1015
  }
@@ -942,17 +1017,17 @@ class CloudRunner extends runner("cloud") {
942
1017
  const config = await GlobalConfig.getHostConfig(host);
943
1018
  if (config.auth?.self || config.auth?.accessToken) {
944
1019
  await GlobalConfig.setHostConfig(getDefaultHostConfig(config.host));
945
- Logger2.rawLog(chalk3.magenta.bold(`
1020
+ Logger3.rawLog(chalk3.magenta.bold(`
946
1021
  \uD83D\uDC4B Goodbye, ${config.auth.self?.nickname ?? "anonymous"}!`));
947
- Logger2.rawLog(chalk3.dim(`\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500
1022
+ Logger3.rawLog(chalk3.dim(`\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500
948
1023
  `));
949
- Logger2.rawLog(chalk3.cyan("You have been successfully logged out."));
950
- Logger2.rawLog(chalk3.dim(`Thank you for using Akan CLI. Come back soon! \uD83C\uDF1F
1024
+ Logger3.rawLog(chalk3.cyan("You have been successfully logged out."));
1025
+ Logger3.rawLog(chalk3.dim(`Thank you for using Akan CLI. Come back soon! \uD83C\uDF1F
951
1026
  `));
952
1027
  } else {
953
- Logger2.rawLog(chalk3.yellow.bold(`
1028
+ Logger3.rawLog(chalk3.yellow.bold(`
954
1029
  \u26A0\uFE0F No active session found`));
955
- Logger2.rawLog(chalk3.dim(`You were not logged in to begin with
1030
+ Logger3.rawLog(chalk3.dim(`You were not logged in to begin with
956
1031
  `));
957
1032
  }
958
1033
  }
@@ -962,24 +1037,24 @@ class CloudRunner extends runner("cloud") {
962
1037
  targets.windows = await this.#askWindowsTestTarget();
963
1038
  await GlobalConfig.setTestTargets({ windows: targets.windows });
964
1039
  }
965
- Logger2.info(`Testing ${pkgs.join(", ")} on ${platforms.join(", ")} in the background...`);
1040
+ Logger3.info(`Testing ${pkgs.join(", ")} on ${platforms.join(", ")} in the background...`);
966
1041
  return await PlatformTestRun.start({
967
1042
  workspaceRoot: workspace.workspaceRoot,
968
1043
  platforms,
969
1044
  pkgs,
970
1045
  targets,
971
- onProgress: (message) => Logger2.info(message)
1046
+ onProgress: (message) => Logger3.info(message)
972
1047
  });
973
1048
  }
974
1049
  async settlePlatformTests(run, { interactive, recordStreaks, checkDrift }) {
975
1050
  const results = await run.results();
976
- Logger2.rawLog(`
1051
+ Logger3.rawLog(`
977
1052
  ${run.format(results)}
978
1053
  `);
979
1054
  if (recordStreaks) {
980
1055
  const streak = await PlatformTestRun.recordStreaks(results);
981
1056
  if (streak?.promoted)
982
- Logger2.info(`${streak.platform} passed ${streak.greenStreak} deploys in a row and now gates every deploy`);
1057
+ Logger3.info(`${streak.platform} passed ${streak.greenStreak} deploys in a row and now gates every deploy`);
983
1058
  }
984
1059
  const { blocking, warning } = PlatformTestRun.verdict(results);
985
1060
  const unreachable = blocking.filter((result) => result.infraError && !result.packages.length);
@@ -1014,7 +1089,7 @@ ${run.format(results)}
1014
1089
  assertPromptable("No Windows test target is configured", {
1015
1090
  remedy: "run it once in a terminal, which saves the target to ~/.akan/config.json"
1016
1091
  });
1017
- Logger2.info("No Windows test target is configured yet; it is saved to ~/.akan/config.json once entered.");
1092
+ Logger3.info("No Windows test target is configured yet; it is saved to ~/.akan/config.json once entered.");
1018
1093
  const required = (value) => !!value.trim();
1019
1094
  const host = await this.#ask("Windows host (ip or name): ", required);
1020
1095
  const user = await this.#ask("SSH user: ", required);
@@ -1044,8 +1119,8 @@ ${run.format(results)}
1044
1119
  const latestPublishedVersion = await getLatestPackageVersion("akanjs", tag, registry).catch(() => null);
1045
1120
  const latestPatch = latestPublishedVersion?.startsWith(targetVersionPrefix) ? parseInt(latestPublishedVersion.split(".").at(-1) ?? "-1") : -1;
1046
1121
  const nextVersion = `${targetVersionPrefix}.${latestPatch + 1}`;
1047
- Logger2.info(`Latest published version of akanjs: ${latestPublishedVersion ?? "none"}`);
1048
- Logger2.info(`Next version of akanjs: ${nextVersion}`);
1122
+ Logger3.info(`Latest published version of akanjs: ${latestPublishedVersion ?? "none"}`);
1123
+ Logger3.info(`Next version of akanjs: ${nextVersion}`);
1049
1124
  for (const library of akanPkgs) {
1050
1125
  const packageJson = await workspace.readJson(`pkgs/${library}/package.json`);
1051
1126
  const newPackageJson = this.#normalizeAkanPackageJson(packageJson, library, nextVersion);
@@ -1059,24 +1134,24 @@ ${run.format(results)}
1059
1134
  remedy: "run it in a terminal"
1060
1135
  });
1061
1136
  if (confirmPublish && !await confirm({ message: "Are you sure you want to deploy the libraries?" })) {
1062
- Logger2.error("Deployment cancelled");
1137
+ Logger3.error("Deployment cancelled");
1063
1138
  return;
1064
1139
  }
1065
1140
  if (!registry) {
1066
- Logger2.info("Logging in to npm...");
1141
+ Logger3.info("Logging in to npm...");
1067
1142
  await workspace.spawn("npm", ["login"], { stdio: "inherit" });
1068
- Logger2.info("Logged in to npm");
1143
+ Logger3.info("Logged in to npm");
1069
1144
  }
1070
1145
  for (const library of akanPkgs) {
1071
- Logger2.info(`Publishing ${library}@${nextVersion} to ${registry ?? "npm"}...`);
1146
+ Logger3.info(`Publishing ${library}@${nextVersion} to ${registry ?? "npm"}...`);
1072
1147
  await workspace.spawn("npm", ["publish", "--tag", tag, ...this.#getRegistryArgs(registry), ...this.#getLocalRegistryAuthArgs(registry)], {
1073
- cwd: path7.join(workspace.workspaceRoot, "dist/pkgs", library),
1148
+ cwd: path8.join(workspace.workspaceRoot, "dist/pkgs", library),
1074
1149
  env: this.#getRegistryEnv(registry),
1075
1150
  stdio: "inherit"
1076
1151
  });
1077
- Logger2.info(`${library}@${nextVersion} is published to ${registry ?? "npm"}`);
1152
+ Logger3.info(`${library}@${nextVersion} is published to ${registry ?? "npm"}`);
1078
1153
  }
1079
- Logger2.info(`All libraries are published to ${registry ?? "npm"}`);
1154
+ Logger3.info(`All libraries are published to ${registry ?? "npm"}`);
1080
1155
  }
1081
1156
  async update(workspace, tag = "latest", { registryUrl } = {}) {
1082
1157
  const registry = registryUrl ? getNpmRegistryUrl(registryUrl) : undefined;
@@ -1096,7 +1171,7 @@ ${run.format(results)}
1096
1171
  const rootPackageJson = await workspace.getPackageJson();
1097
1172
  if (!rootPackageJson.dependencies)
1098
1173
  throw new Error("No dependencies found in package.json");
1099
- for (const name of ["akanjs", "@akanjs/devkit", "@akanjs/cli"]) {
1174
+ for (const name of ["akanjs", "@akanjs/devkit", "@akanjs/cli", "@akanjs/language"]) {
1100
1175
  if (rootPackageJson.dependencies[name])
1101
1176
  rootPackageJson.dependencies[name] = latestPublishedVersion;
1102
1177
  if (rootPackageJson.devDependencies?.[name])
@@ -1125,46 +1200,45 @@ ${run.format(results)}
1125
1200
  const localPath = await cloudApi.downloadEnv(workspaceId).catch((error) => {
1126
1201
  throw CloudApi.refusal(error, "downloading its env archive takes the project owner's own `akan login`");
1127
1202
  });
1128
- const relativePath = path7.relative(workspace.workspaceRoot, localPath).split(path7.sep).join("/");
1129
- await workspace.spawn("tar", ["-xf", relativePath], { cwd: workspace.workspaceRoot });
1203
+ await EnvArchive.extract(workspace, localPath);
1130
1204
  await workspace.remove(localPath);
1131
1205
  }
1132
1206
  async uploadEnv(cloudApi, workspaceId, filePath) {
1133
- const file = new File([Bun.file(filePath)], path7.basename(filePath));
1207
+ const file = new File([Bun.file(filePath)], path8.basename(filePath));
1134
1208
  await cloudApi.uploadEnv(workspaceId, file).catch((error) => {
1135
1209
  throw CloudApi.refusal(error, "an env archive is uploaded by a project member signed in with `akan login`");
1136
1210
  });
1137
1211
  }
1138
1212
  async downloadEnvByScp(workspace) {
1139
1213
  const envArchivePath = "local/env.tar";
1140
- const remoteServer = await this.#getRemoteEnvServerWithUsername();
1141
1214
  const remoteArchivePath = this.#getRemoteEnvArchivePath();
1215
+ const remoteServer = await this.#getRemoteEnvServerWithUsername();
1142
1216
  const remoteTarget = this.#getScpTarget(remoteServer.config, remoteArchivePath);
1143
1217
  await workspace.mkdir("local");
1144
1218
  await workspace.remove(envArchivePath);
1145
1219
  try {
1146
- Logger2.info(`Downloading env archive from remote server "${remoteServer.name}"...`);
1220
+ Logger3.info(`Downloading env archive from remote server "${remoteServer.name}"...`);
1147
1221
  await workspace.spawn("scp", this.#getScpArgs(remoteServer.config, remoteTarget, envArchivePath), {
1148
1222
  cwd: workspace.workspaceRoot,
1149
1223
  stdio: "inherit"
1150
1224
  });
1151
- await workspace.spawn("tar", ["-xf", envArchivePath], { cwd: workspace.workspaceRoot });
1225
+ await EnvArchive.extract(workspace, envArchivePath);
1152
1226
  await workspace.remove(envArchivePath);
1153
1227
  } catch (error) {
1154
1228
  throw new Error(`Failed to download env archive from remote server "${remoteServer.name}"`, { cause: error });
1155
1229
  }
1156
1230
  }
1157
1231
  async uploadEnvByScp(workspace, filePath) {
1158
- const remoteServer = await this.#getRemoteEnvServerWithUsername();
1159
1232
  const remoteArchiveDir = this.#getRemoteEnvArchiveDir();
1160
1233
  const remoteArchivePath = this.#getRemoteEnvArchivePath();
1234
+ const remoteServer = await this.#getRemoteEnvServerWithUsername();
1161
1235
  const remoteTarget = this.#getScpTarget(remoteServer.config, remoteArchivePath);
1162
1236
  try {
1163
1237
  await workspace.spawn("ssh", this.#getSshArgs(remoteServer.config, `mkdir -p ${remoteArchiveDir}`), {
1164
1238
  cwd: workspace.workspaceRoot,
1165
1239
  stdio: "inherit"
1166
1240
  });
1167
- Logger2.info(`Uploading env archive to remote server "${remoteServer.name}"...`);
1241
+ Logger3.info(`Uploading env archive to remote server "${remoteServer.name}"...`);
1168
1242
  await workspace.spawn("scp", this.#getScpArgs(remoteServer.config, filePath, remoteTarget), {
1169
1243
  cwd: workspace.workspaceRoot,
1170
1244
  stdio: "inherit"
@@ -1174,7 +1248,7 @@ ${run.format(results)}
1174
1248
  }
1175
1249
  }
1176
1250
  async gatherEnvFiles(workspace, { scope, archivePath = "local/env.tar" } = {}) {
1177
- const envFilePattern = /^env\.(client|server)\.(?!(type|example)\.ts$).+\.ts$/;
1251
+ const { envFilePattern } = EnvArchive;
1178
1252
  const [workspaceAppNames, workspaceLibNames] = await workspace.getExecs();
1179
1253
  const appNames = scope?.apps ?? workspaceAppNames;
1180
1254
  const libNames = scope?.libs ?? workspaceLibNames;
@@ -1191,7 +1265,7 @@ ${run.format(results)}
1191
1265
  if (envFilePaths.length === 0)
1192
1266
  throw new Error(scope ? `No environment files found to archive for ${appNames.join(", ") || "(no apps)"}` : "No environment files found to archive");
1193
1267
  await workspace.spawn("tar", ["-cf", archivePath, ...envFilePaths], { cwd: workspace.workspaceRoot });
1194
- Logger2.info(`Archived ${envFilePaths.length} environment files to ${archivePath}`);
1268
+ Logger3.info(`Archived ${envFilePaths.length} environment files to ${archivePath}`);
1195
1269
  return { files: envFilePaths, path: archivePath };
1196
1270
  }
1197
1271
  async#gatherCustomSecretFiles(workspace, appNames) {
@@ -1200,8 +1274,8 @@ ${run.format(results)}
1200
1274
  const secretGlobs = config.secrets ?? [];
1201
1275
  if (secretGlobs.length === 0)
1202
1276
  return [];
1203
- const appDir = path7.join(workspace.workspaceRoot, "apps", appName);
1204
- return secretGlobs.flatMap((pattern) => Array.from(new Bun.Glob(pattern).scanSync({ cwd: appDir, onlyFiles: true })).map((match) => `apps/${appName}/${match.split(path7.sep).join("/")}`));
1277
+ const appDir = path8.join(workspace.workspaceRoot, "apps", appName);
1278
+ return secretGlobs.flatMap((pattern) => Array.from(new Bun.Glob(pattern).scanSync({ cwd: appDir, onlyFiles: true })).map((match) => `apps/${appName}/${match.split(path8.sep).join("/")}`));
1205
1279
  }));
1206
1280
  return secretPaths.flat();
1207
1281
  }
@@ -1289,7 +1363,7 @@ ${run.format(results)}
1289
1363
  if (nextContent === existing)
1290
1364
  return;
1291
1365
  await workspace.writeFile(".gitignore", nextContent);
1292
- Logger2.info(uniquePatterns.length ? `Synced ${uniquePatterns.length} secret pattern(s) from akan.config.ts to .gitignore` : "Removed managed secret patterns from .gitignore");
1366
+ Logger3.info(uniquePatterns.length ? `Synced ${uniquePatterns.length} secret pattern(s) from akan.config.ts to .gitignore` : "Removed managed secret patterns from .gitignore");
1293
1367
  }
1294
1368
  #applySecretGitignoreBlock(content, patterns) {
1295
1369
  const beginMarker = "# akan:secrets (managed by akan.config.ts \u2014 do not edit)";