@akanjs/cli 2.3.3-rc.1 → 2.3.4-rc.0

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.
@@ -688,7 +688,7 @@ import { resolveAkanI18nConfig } from "akanjs/common";
688
688
  import { archs } from "akanjs";
689
689
 
690
690
  // pkgs/@akanjs/devkit/akanConfig/akanConfig.ts
691
- var DEFAULT_BARREL_IMPORTS = ["akanjs/webkit", "akanjs/common", "akanjs/ui"];
691
+ var DEFAULT_BARREL_IMPORTS = ["akanjs/webkit", "akanjs/common", "akanjs/ui", "akanjs/server"];
692
692
  var DEFAULT_OPTIMIZE_IMPORTS = [
693
693
  "lucide-react",
694
694
  "date-fns",
@@ -716,18 +716,8 @@ var DEFAULT_OPTIMIZE_IMPORTS = [
716
716
  "mui-core",
717
717
  "react-icons/*"
718
718
  ];
719
- var WORKSPACE_BARREL_FACETS = [
720
- "ui",
721
- "webkit",
722
- "common",
723
- "client",
724
- "server"
725
- ];
726
- var SSR_RUNTIME_PACKAGES = [
727
- "react",
728
- "react-dom",
729
- "react-server-dom-webpack"
730
- ];
719
+ var WORKSPACE_BARREL_FACETS = ["ui", "webkit", "common", "client", "server"];
720
+ var SSR_RUNTIME_PACKAGES = ["react", "react-dom", "react-server-dom-webpack"];
731
721
  var NATIVE_RUNTIME_PACKAGES = ["sharp"];
732
722
  var DEFAULT_BACKEND_RUNTIME_PACKAGES = ["croner"];
733
723
  var DATABASE_MODE_RUNTIME_PACKAGES = {
@@ -787,12 +777,7 @@ class AkanAppConfig {
787
777
  ...libs.flatMap((lib) => WORKSPACE_BARREL_FACETS.map((facet) => `@libs/${lib}/${facet}`)),
788
778
  ...config?.barrelImports ?? []
789
779
  ];
790
- this.optimizeImports = [
791
- ...new Set([
792
- ...DEFAULT_OPTIMIZE_IMPORTS,
793
- ...config?.optimizeImports ?? []
794
- ])
795
- ];
780
+ this.optimizeImports = [...new Set([...DEFAULT_OPTIMIZE_IMPORTS, ...config?.optimizeImports ?? []])];
796
781
  this.images = mergeImageConfig(config?.images);
797
782
  this.i18n = resolveAkanI18nConfig(config?.i18n);
798
783
  process.env.AKAN_PUBLIC_DEFAULT_LOCALE = this.i18n.defaultLocale;
@@ -1054,9 +1039,7 @@ class AkanLibConfig {
1054
1039
  this.externalLibs = config?.externalLibs ?? [];
1055
1040
  }
1056
1041
  static async from(lib) {
1057
- const [configImp] = await Promise.all([
1058
- import(`${lib.cwdPath}/akan.config.ts`).then((mod) => mod.default)
1059
- ]);
1042
+ const [configImp] = await Promise.all([import(`${lib.cwdPath}/akan.config.ts`).then((mod) => mod.default)]);
1060
1043
  const config = typeof configImp === "function" ? configImp(lib) : configImp;
1061
1044
  return new AkanLibConfig(lib, config);
1062
1045
  }
package/index.js CHANGED
@@ -222,16 +222,16 @@ class CloudApi {
222
222
  Authorization: `Bearer ${this.#accessToken.jwt}`
223
223
  });
224
224
  }
225
- async uploadEnv(devProjectId, file) {
225
+ async uploadEnv(devProjectId2, file) {
226
226
  const formData = new FormData;
227
- formData.append("devProjectId", devProjectId);
227
+ formData.append("devProjectId", devProjectId2);
228
228
  formData.append("file", file);
229
- const data = await this.#api.post(`/uploadEnv/${devProjectId}`, formData);
229
+ const data = await this.#api.post(`/uploadEnv/${devProjectId2}`, formData);
230
230
  return data;
231
231
  }
232
- async downloadEnv(devProjectId) {
232
+ async downloadEnv(devProjectId2) {
233
233
  const localPath = `${this.#workspace.workspaceRoot}/local/env.tar`;
234
- await this.#api.getFile(`/downloadEnv/${devProjectId}`, localPath);
234
+ await this.#api.getFile(`/downloadEnv/${devProjectId2}`, localPath);
235
235
  return localPath;
236
236
  }
237
237
  async getRemoteAuthToken(remoteId) {
@@ -686,7 +686,7 @@ import { resolveAkanI18nConfig } from "akanjs/common";
686
686
  import { archs } from "akanjs";
687
687
 
688
688
  // pkgs/@akanjs/devkit/akanConfig/akanConfig.ts
689
- var DEFAULT_BARREL_IMPORTS = ["akanjs/webkit", "akanjs/common", "akanjs/ui"];
689
+ var DEFAULT_BARREL_IMPORTS = ["akanjs/webkit", "akanjs/common", "akanjs/ui", "akanjs/server"];
690
690
  var DEFAULT_OPTIMIZE_IMPORTS = [
691
691
  "lucide-react",
692
692
  "date-fns",
@@ -714,18 +714,8 @@ var DEFAULT_OPTIMIZE_IMPORTS = [
714
714
  "mui-core",
715
715
  "react-icons/*"
716
716
  ];
717
- var WORKSPACE_BARREL_FACETS = [
718
- "ui",
719
- "webkit",
720
- "common",
721
- "client",
722
- "server"
723
- ];
724
- var SSR_RUNTIME_PACKAGES = [
725
- "react",
726
- "react-dom",
727
- "react-server-dom-webpack"
728
- ];
717
+ var WORKSPACE_BARREL_FACETS = ["ui", "webkit", "common", "client", "server"];
718
+ var SSR_RUNTIME_PACKAGES = ["react", "react-dom", "react-server-dom-webpack"];
729
719
  var NATIVE_RUNTIME_PACKAGES = ["sharp"];
730
720
  var DEFAULT_BACKEND_RUNTIME_PACKAGES = ["croner"];
731
721
  var DATABASE_MODE_RUNTIME_PACKAGES = {
@@ -785,12 +775,7 @@ class AkanAppConfig {
785
775
  ...libs.flatMap((lib) => WORKSPACE_BARREL_FACETS.map((facet) => `@libs/${lib}/${facet}`)),
786
776
  ...config?.barrelImports ?? []
787
777
  ];
788
- this.optimizeImports = [
789
- ...new Set([
790
- ...DEFAULT_OPTIMIZE_IMPORTS,
791
- ...config?.optimizeImports ?? []
792
- ])
793
- ];
778
+ this.optimizeImports = [...new Set([...DEFAULT_OPTIMIZE_IMPORTS, ...config?.optimizeImports ?? []])];
794
779
  this.images = mergeImageConfig(config?.images);
795
780
  this.i18n = resolveAkanI18nConfig(config?.i18n);
796
781
  process.env.AKAN_PUBLIC_DEFAULT_LOCALE = this.i18n.defaultLocale;
@@ -1052,9 +1037,7 @@ class AkanLibConfig {
1052
1037
  this.externalLibs = config?.externalLibs ?? [];
1053
1038
  }
1054
1039
  static async from(lib) {
1055
- const [configImp] = await Promise.all([
1056
- import(`${lib.cwdPath}/akan.config.ts`).then((mod) => mod.default)
1057
- ]);
1040
+ const [configImp] = await Promise.all([import(`${lib.cwdPath}/akan.config.ts`).then((mod) => mod.default)]);
1058
1041
  const config = typeof configImp === "function" ? configImp(lib) : configImp;
1059
1042
  return new AkanLibConfig(lib, config);
1060
1043
  }
@@ -12132,10 +12115,10 @@ ${chalk7.green("\u27A4")} Authentication Required`));
12132
12115
 
12133
12116
  // pkgs/@akanjs/cli/cloud/cloud.script.ts
12134
12117
  class CloudScript extends script("cloud", [CloudRunner, ApplicationScript, PackageScript]) {
12135
- async login(host, workspace) {
12118
+ async login(workspace, host = GlobalConfig.akanCloudHost) {
12136
12119
  await this.cloudRunner.login(host, workspace);
12137
12120
  }
12138
- async logout(host, workspace) {
12121
+ async logout(workspace, host = GlobalConfig.akanCloudHost) {
12139
12122
  await this.cloudRunner.logout(host);
12140
12123
  }
12141
12124
  async setLlm(workspace) {
@@ -12148,9 +12131,9 @@ class CloudScript extends script("cloud", [CloudRunner, ApplicationScript, Packa
12148
12131
  const session = new AiSession("general", { workspace, isContinued: true });
12149
12132
  await session.ask(question);
12150
12133
  }
12151
- async downloadEnv(workspace) {
12152
- const workspaceId = workspace.getWorkspaceId({ allowEmpty: true });
12134
+ async downloadEnv(workspace, workspaceId = workspace.getWorkspaceId({ allowEmpty: true })) {
12153
12135
  if (workspaceId) {
12136
+ await this.login(workspace);
12154
12137
  const cloudApi2 = await CloudApi.fromHost(workspace);
12155
12138
  await this.cloudRunner.downloadEnv(cloudApi2, workspace, workspaceId);
12156
12139
  return;
@@ -12161,6 +12144,7 @@ class CloudScript extends script("cloud", [CloudRunner, ApplicationScript, Packa
12161
12144
  const workspaceId = workspace.getWorkspaceId({ allowEmpty: true });
12162
12145
  const { path: path40 } = await this.cloudRunner.gatherEnvFiles(workspace);
12163
12146
  if (workspaceId) {
12147
+ await this.login(workspace);
12164
12148
  const cloudApi2 = await CloudApi.fromHost(workspace);
12165
12149
  await this.cloudRunner.uploadEnv(cloudApi2, workspaceId, path40);
12166
12150
  return;
@@ -12194,10 +12178,10 @@ var resolveRegistryUrl = (registry) => registry === "local" ? localRegistryUrl()
12194
12178
 
12195
12179
  class CloudCommand extends command("cloud", [CloudScript], ({ public: target }) => ({
12196
12180
  login: target({ desc: "Login to Akan Cloud services" }).option("host", String, { desc: "host of the cloud", default: GlobalConfig.akanCloudHost }).with(Workspace).exec(async function(host, workspace) {
12197
- await this.cloudScript.login(host, workspace);
12181
+ await this.cloudScript.login(workspace, host);
12198
12182
  }),
12199
12183
  logout: target({ desc: "Logout from Akan Cloud services" }).option("host", String, { desc: "host of the cloud", default: GlobalConfig.akanCloudHost }).with(Workspace).exec(async function(host, workspace) {
12200
- await this.cloudScript.logout(host, workspace);
12184
+ await this.cloudScript.logout(workspace, host);
12201
12185
  }),
12202
12186
  setLlm: target({ desc: "Configure LLM (Large Language Model) API key" }).with(Workspace).exec(async function(workspace) {
12203
12187
  await this.cloudScript.setLlm(workspace);
@@ -14022,6 +14006,25 @@ class WorkspaceRunner extends runner("workspace") {
14022
14006
  exec2.cwdPath
14023
14007
  ]);
14024
14008
  }
14009
+ async writeTopLevelEnv(workspace, devProjectId2) {
14010
+ await workspace.writeFile(".env", `AKAN_WORKSPACE_ID=${devProjectId2}
14011
+
14012
+ # organization configuration, no need to change
14013
+ AKAN_PUBLIC_REPO_NAME=${workspace.repoName}
14014
+
14015
+ # serve domain, it changes the domain of the server.
14016
+ AKAN_PUBLIC_SERVE_DOMAIN=try.akanjs.com
14017
+
14018
+ # development branch, debug, develop, main, etc. mainly it changes databases.
14019
+ AKAN_PUBLIC_ENV=local
14020
+
14021
+ # local, cloud, edge it changes the connection point of the clients.
14022
+ AKAN_PUBLIC_OPERATION_MODE=local
14023
+
14024
+ # log level, debug, info, warn, error
14025
+ AKAN_PUBLIC_LOG_LEVEL=debug
14026
+ `);
14027
+ }
14025
14028
  }
14026
14029
 
14027
14030
  // pkgs/@akanjs/cli/workspace/workspace.script.ts
@@ -14029,7 +14032,8 @@ class WorkspaceScript extends script("workspace", [
14029
14032
  WorkspaceRunner,
14030
14033
  ApplicationScript,
14031
14034
  LibraryScript,
14032
- PackageScript
14035
+ PackageScript,
14036
+ CloudScript
14033
14037
  ]) {
14034
14038
  async createWorkspace(repoName, appName, {
14035
14039
  dirname: dirname2 = ".",
@@ -14105,6 +14109,17 @@ class WorkspaceScript extends script("workspace", [
14105
14109
  for (const appName of appNames)
14106
14110
  await this.applicationScript.sync(AppExecutor.from(workspace, appName));
14107
14111
  }
14112
+ async init(devProjectId2, workspace) {
14113
+ const spinner2 = workspace.spinning("Initializing workspace...");
14114
+ try {
14115
+ await this.workspaceRunner.writeTopLevelEnv(workspace, devProjectId2);
14116
+ await this.cloudScript.downloadEnv(workspace, devProjectId2);
14117
+ spinner2.succeed("Workspace initialized");
14118
+ } catch (error) {
14119
+ spinner2.fail("Workspace initialization failed");
14120
+ throw error;
14121
+ }
14122
+ }
14108
14123
  }
14109
14124
 
14110
14125
  // pkgs/@akanjs/cli/workspace/workspace.command.ts
@@ -14145,6 +14160,9 @@ class WorkspaceCommand extends command("workspace", [WorkspaceScript], ({ public
14145
14160
  }),
14146
14161
  syncAll: target({ desc: "Sync dependencies and configuration for all apps and libraries" }).with(Workspace).exec(async function(workspace) {
14147
14162
  await this.workspaceScript.syncAll(workspace);
14163
+ }),
14164
+ init: target({ desc: "Initialize the workspace" }).arg("devProjectId", String, { desc: "the ID of the workspace" }).with(Workspace).exec(async function(workspace) {
14165
+ await this.workspaceScript.init(devProjectId, workspace);
14148
14166
  })
14149
14167
  })) {
14150
14168
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@akanjs/cli",
3
- "version": "2.3.3-rc.1",
3
+ "version": "2.3.4-rc.0",
4
4
  "sourceType": "module",
5
5
  "type": "module",
6
6
  "publishConfig": {
@@ -35,7 +35,7 @@
35
35
  "@langchain/openai": "^1.4.6",
36
36
  "@tailwindcss/node": "^4.3.0",
37
37
  "@trapezedev/project": "^7.1.4",
38
- "akanjs": "2.3.3-rc.1",
38
+ "akanjs": "2.3.4-rc.0",
39
39
  "chalk": "^5.6.2",
40
40
  "commander": "^14.0.3",
41
41
  "daisyui": "^5.5.20",
@@ -80,7 +80,8 @@
80
80
  "fix": "safe"
81
81
  },
82
82
  "useParseIntRadix": "off",
83
- "useExhaustiveDependencies": "off"
83
+ "useExhaustiveDependencies": "off",
84
+ "useHookAtTopLevel": "off"
84
85
  },
85
86
  "nursery": {
86
87
  "useSortedClasses": {