@akanjs/cli 0.0.90 → 0.0.92

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (73) hide show
  1. package/README.md +24 -0
  2. package/index.js +104 -91
  3. package/package.json +1 -1
  4. package/{pkgs/@akanjs/cli/src → src}/application/application.command.d.ts +7 -7
  5. package/{pkgs/@akanjs/cli/src → src}/application/application.runner.d.ts +5 -5
  6. package/{pkgs/@akanjs/cli/src → src}/application/application.script.d.ts +8 -8
  7. package/pkgs/@akanjs/common/Logger.d.ts +0 -28
  8. package/pkgs/@akanjs/common/applyMixins.d.ts +0 -3
  9. package/pkgs/@akanjs/common/capitalize.d.ts +0 -1
  10. package/pkgs/@akanjs/common/deepObjectify.d.ts +0 -4
  11. package/pkgs/@akanjs/common/index.d.ts +0 -18
  12. package/pkgs/@akanjs/common/isDayjs.d.ts +0 -2
  13. package/pkgs/@akanjs/common/isQueryEqual.d.ts +0 -1
  14. package/pkgs/@akanjs/common/isValidDate.d.ts +0 -2
  15. package/pkgs/@akanjs/common/lowerlize.d.ts +0 -1
  16. package/pkgs/@akanjs/common/mergeVersion.d.ts +0 -10
  17. package/pkgs/@akanjs/common/objectify.d.ts +0 -1
  18. package/pkgs/@akanjs/common/pathGet.d.ts +0 -1
  19. package/pkgs/@akanjs/common/pathSet.d.ts +0 -1
  20. package/pkgs/@akanjs/common/pluralize.d.ts +0 -2
  21. package/pkgs/@akanjs/common/randomPick.d.ts +0 -1
  22. package/pkgs/@akanjs/common/randomPicks.d.ts +0 -1
  23. package/pkgs/@akanjs/common/sleep.d.ts +0 -1
  24. package/pkgs/@akanjs/common/splitVersion.d.ts +0 -11
  25. package/pkgs/@akanjs/common/types.d.ts +0 -15
  26. package/pkgs/@akanjs/config/index.d.ts +0 -3
  27. package/pkgs/@akanjs/config/src/akanConfig.d.ts +0 -7
  28. package/pkgs/@akanjs/config/src/nextConfig.d.ts +0 -14
  29. package/pkgs/@akanjs/config/src/types.d.ts +0 -135
  30. package/pkgs/@akanjs/devkit/index.d.ts +0 -1
  31. package/pkgs/@akanjs/devkit/src/aiEditor.d.ts +0 -31
  32. package/pkgs/@akanjs/devkit/src/auth.d.ts +0 -9
  33. package/pkgs/@akanjs/devkit/src/capacitorApp.d.ts +0 -21
  34. package/pkgs/@akanjs/devkit/src/commandDecorators/argMeta.d.ts +0 -55
  35. package/pkgs/@akanjs/devkit/src/commandDecorators/command.d.ts +0 -2
  36. package/pkgs/@akanjs/devkit/src/commandDecorators/commandMeta.d.ts +0 -2
  37. package/pkgs/@akanjs/devkit/src/commandDecorators/index.d.ts +0 -5
  38. package/pkgs/@akanjs/devkit/src/commandDecorators/targetMeta.d.ts +0 -18
  39. package/pkgs/@akanjs/devkit/src/commandDecorators/types.d.ts +0 -1
  40. package/pkgs/@akanjs/devkit/src/constants.d.ts +0 -26
  41. package/pkgs/@akanjs/devkit/src/createTunnel.d.ts +0 -8
  42. package/pkgs/@akanjs/devkit/src/dependencyScanner.d.ts +0 -8
  43. package/pkgs/@akanjs/devkit/src/executors.d.ts +0 -166
  44. package/pkgs/@akanjs/devkit/src/extractDeps.d.ts +0 -6
  45. package/pkgs/@akanjs/devkit/src/getCredentials.d.ts +0 -12
  46. package/pkgs/@akanjs/devkit/src/getModelFileData.d.ts +0 -16
  47. package/pkgs/@akanjs/devkit/src/getRelatedCnsts.d.ts +0 -53
  48. package/pkgs/@akanjs/devkit/src/index.d.ts +0 -16
  49. package/pkgs/@akanjs/devkit/src/selectModel.d.ts +0 -1
  50. package/pkgs/@akanjs/devkit/src/streamAi.d.ts +0 -6
  51. package/pkgs/@akanjs/devkit/src/types.d.ts +0 -20
  52. package/pkgs/@akanjs/devkit/src/uploadRelease.d.ts +0 -9
  53. /package/{pkgs/@akanjs/cli/index.d.ts → index.d.ts} +0 -0
  54. /package/{pkgs/@akanjs/cli/src → src}/application/application.prompt.d.ts +0 -0
  55. /package/{pkgs/@akanjs/cli/src → src}/cloud/cloud.command.d.ts +0 -0
  56. /package/{pkgs/@akanjs/cli/src → src}/cloud/cloud.runner.d.ts +0 -0
  57. /package/{pkgs/@akanjs/cli/src → src}/cloud/cloud.script.d.ts +0 -0
  58. /package/{pkgs/@akanjs/cli/src → src}/library/library.command.d.ts +0 -0
  59. /package/{pkgs/@akanjs/cli/src → src}/library/library.runner.d.ts +0 -0
  60. /package/{pkgs/@akanjs/cli/src → src}/library/library.script.d.ts +0 -0
  61. /package/{pkgs/@akanjs/cli/src → src}/module/module.command.d.ts +0 -0
  62. /package/{pkgs/@akanjs/cli/src → src}/module/module.prompt.d.ts +0 -0
  63. /package/{pkgs/@akanjs/cli/src → src}/module/module.runner.d.ts +0 -0
  64. /package/{pkgs/@akanjs/cli/src → src}/module/module.script.d.ts +0 -0
  65. /package/{pkgs/@akanjs/cli/src → src}/package/package.command.d.ts +0 -0
  66. /package/{pkgs/@akanjs/cli/src → src}/package/package.runner.d.ts +0 -0
  67. /package/{pkgs/@akanjs/cli/src → src}/package/package.script.d.ts +0 -0
  68. /package/{pkgs/@akanjs/cli/src → src}/page/page.command.d.ts +0 -0
  69. /package/{pkgs/@akanjs/cli/src → src}/page/page.runner.d.ts +0 -0
  70. /package/{pkgs/@akanjs/cli/src → src}/page/page.script.d.ts +0 -0
  71. /package/{pkgs/@akanjs/cli/src → src}/workspace/workspace.command.d.ts +0 -0
  72. /package/{pkgs/@akanjs/cli/src → src}/workspace/workspace.runner.d.ts +0 -0
  73. /package/{pkgs/@akanjs/cli/src → src}/workspace/workspace.script.d.ts +0 -0
package/README.md ADDED
@@ -0,0 +1,24 @@
1
+ # Prerequisites
2
+
3
+ - Node.js >=23.x
4
+ - pnpm >=10.x
5
+ - docker
6
+ - (temporary) access permission to akan-team github organization
7
+
8
+ # How to create your project
9
+
10
+ ```bash
11
+ npm install -g @akanjs/cli --latest
12
+ # or if you want to update, run below
13
+ # pnpm update -g @akanjs/cli --latest
14
+
15
+ akan create-workspace
16
+ # workspace name?
17
+ # application name?
18
+ ```
19
+
20
+ # How to start your project
21
+
22
+ ```bash
23
+ cd <workspace-name> && akan start <app-name> --open=true
24
+ ```
package/index.js CHANGED
@@ -758,6 +758,7 @@ var import_dotenv = __toESM(require("dotenv"));
758
758
  var import_fs6 = __toESM(require("fs"));
759
759
  var import_promises = __toESM(require("fs/promises"));
760
760
  var import_path3 = __toESM(require("path"));
761
+ var import_chalk = __toESM(require("chalk"));
761
762
 
762
763
  // pkgs/@akanjs/devkit/src/dependencyScanner.ts
763
764
  var fs7 = __toESM(require("fs"));
@@ -922,7 +923,7 @@ var Executor = class {
922
923
  Logger.raw(data.toString());
923
924
  });
924
925
  proc.stderr?.on("data", (data) => {
925
- Logger.raw(data.toString());
926
+ Logger.raw(import_chalk.default.red(data.toString()));
926
927
  });
927
928
  return new Promise((resolve, reject) => {
928
929
  proc.on("exit", (code, signal) => {
@@ -936,7 +937,7 @@ var Executor = class {
936
937
  spawn(command, args = [], options = {}) {
937
938
  const proc = (0, import_child_process.spawn)(command, args, { cwd: this.cwdPath, stdio: "inherit", ...options });
938
939
  proc.stderr?.on("data", (data) => {
939
- Logger.raw(data.toString());
940
+ Logger.raw(import_chalk.default.red(data.toString()));
940
941
  });
941
942
  return new Promise((resolve, reject) => {
942
943
  proc.on("exit", (code, signal) => {
@@ -1799,7 +1800,7 @@ var extractDependencies = (filepaths, pacakgeJson, defaultDependencies = []) =>
1799
1800
  ...pacakgeJson.devDependencies ?? {}
1800
1801
  };
1801
1802
  const requireRegex = /require\s*\(\s*['"`]([^'"`]+)['"`]\s*\)/g;
1802
- for (const { text } of filepaths) {
1803
+ for (const { text } of filepaths.filter(({ path: path7 }) => path7.endsWith(".js"))) {
1803
1804
  let requireMatch;
1804
1805
  while ((requireMatch = requireRegex.exec(text)) !== null) {
1805
1806
  const moduleName = requireMatch[1];
@@ -1900,6 +1901,7 @@ var Target = {
1900
1901
  var import_prompts3 = require("@inquirer/prompts");
1901
1902
  var import_commander = require("commander");
1902
1903
  var import_fs9 = __toESM(require("fs"));
1904
+ var import_chalk2 = __toESM(require("chalk"));
1903
1905
  var camelToKebabCase = (str) => str.replace(/([A-Z])/g, "-$1").toLowerCase();
1904
1906
  var handleOption = (programCommand, argMeta) => {
1905
1907
  const {
@@ -1912,7 +1914,7 @@ var handleOption = (programCommand, argMeta) => {
1912
1914
  } = argMeta.argsOption;
1913
1915
  const kebabName = camelToKebabCase(argMeta.name);
1914
1916
  programCommand.option(
1915
- `-${flag}, --${kebabName} <${kebabName}>`,
1917
+ `-${flag}, --${kebabName}${type === "boolean" ? " [boolean]" : ` <${kebabName}>`}`,
1916
1918
  `${desc}${ask ? ` (${ask})` : ""}${example ? ` (example: ${example})` : ""}${choices ? ` (choices: ${choices.join(", ")})` : ""}`
1917
1919
  );
1918
1920
  return programCommand;
@@ -1923,7 +1925,7 @@ var convertOptionValue = (value, type) => {
1923
1925
  else if (type === "number")
1924
1926
  return Number(value);
1925
1927
  else
1926
- return value === "true";
1928
+ return value === true || value === "true";
1927
1929
  };
1928
1930
  var getOptionValue = async (argMeta, opt) => {
1929
1931
  const {
@@ -1938,15 +1940,15 @@ var getOptionValue = async (argMeta, opt) => {
1938
1940
  return null;
1939
1941
  if (choices) {
1940
1942
  const choice = await (0, import_prompts3.select)({
1941
- message: ask ?? `Select the ${name} value`,
1943
+ message: ask ?? desc ?? `Select the ${name} value`,
1942
1944
  choices: choices.map((choice2) => choice2.toString())
1943
1945
  });
1944
1946
  return choice;
1945
1947
  } else if (type === "boolean") {
1946
- const message = ask ?? `Do you want to set ${name}? ${desc ? ` (${desc})` : ""}: `;
1948
+ const message = ask ?? desc ?? `Do you want to set ${name}? ${desc ? ` (${desc})` : ""}: `;
1947
1949
  return await (0, import_prompts3.confirm)({ message });
1948
1950
  } else {
1949
- const message = ask ? `${ask}: ` : `Enter the ${name} value${example ? ` (example: ${example})` : ""}: `;
1951
+ const message = ask ? `${ask}: ` : desc ? `${desc}: ` : `Enter the ${name} value${example ? ` (example: ${example})` : ""}: `;
1950
1952
  if (argMeta.argsOption.nullable)
1951
1953
  return await (0, import_prompts3.input)({ message });
1952
1954
  else
@@ -2034,7 +2036,12 @@ var runCommands = async (...commands) => {
2034
2036
  commandArgs[argMeta.idx] = await getArgumentValue(argMeta, cmdArgs[argMeta.idx], workspace);
2035
2037
  }
2036
2038
  const cmd = new command();
2037
- await cmd[targetMeta.key](...commandArgs);
2039
+ try {
2040
+ await cmd[targetMeta.key](...commandArgs);
2041
+ } catch (e) {
2042
+ const errMsg = e instanceof Error ? e.message : typeof e === "string" ? e : JSON.stringify(e);
2043
+ Logger.error(`Command Error: ${import_chalk2.default.red(errMsg)}`);
2044
+ }
2038
2045
  });
2039
2046
  }
2040
2047
  }
@@ -2046,7 +2053,7 @@ var runCommands = async (...commands) => {
2046
2053
  var import_prompts4 = require("@inquirer/prompts");
2047
2054
  var import_messages = require("@langchain/core/messages");
2048
2055
  var import_openai2 = require("@langchain/openai");
2049
- var import_chalk = __toESM(require("chalk"));
2056
+ var import_chalk3 = __toESM(require("chalk"));
2050
2057
  var MAX_ASK_TRY = 300;
2051
2058
  var supportedLlmModels = ["deepseek-chat", "deepseek-reasoner"];
2052
2059
  var AiSession = class _AiSession {
@@ -2097,7 +2104,7 @@ var AiSession = class _AiSession {
2097
2104
  return true;
2098
2105
  } catch (error) {
2099
2106
  Logger.rawLog(
2100
- import_chalk.default.red(
2107
+ import_chalk3.default.red(
2101
2108
  `LLM API key is invalid. Please check your API key and try again. You can set it again by running "akan set-llm" or reset by running "akan reset-llm"`
2102
2109
  )
2103
2110
  );
@@ -2179,9 +2186,7 @@ var LibraryRunner = class {
2179
2186
  }
2180
2187
  async installLibrary(workspace, libName) {
2181
2188
  workspace.log(`Installing ${libName} library as git subtree...`);
2182
- await workspace.exec(
2183
- `git subtree add --quiet --prefix=libs/${libName} git@github.com:akan-team/${libName}.git main`
2184
- );
2189
+ await workspace.exec(`git subtree add --prefix=libs/${libName} git@github.com:akan-team/${libName}.git main`);
2185
2190
  await workspace.cp(`libs/${libName}/env/env.server.example.ts`, `libs/${libName}/env/env.server.testing.ts`);
2186
2191
  workspace.setTsPaths("lib", libName);
2187
2192
  await workspace.commit(`Add ${libName} library`);
@@ -2215,13 +2220,13 @@ var LibraryRunner = class {
2215
2220
  }
2216
2221
  async pushLibrary(lib, branch) {
2217
2222
  await lib.workspace.exec(
2218
- `git subtree push --quiet --prefix=libs/${lib.name} git@github.com:akan-team/${lib.name}.git ${branch}`
2223
+ `git subtree push --prefix=libs/${lib.name} git@github.com:akan-team/${lib.name}.git ${branch}`
2219
2224
  );
2220
2225
  lib.logger.log(`${lib.name} library pushed to ${branch} branch`);
2221
2226
  }
2222
2227
  async pullLibrary(lib, branch) {
2223
2228
  await lib.workspace.exec(
2224
- `git subtree pull --quiet --prefix=libs/${lib.name} git@github.com:akan-team/${lib.name}.git ${branch}`
2229
+ `git subtree pull --prefix=libs/${lib.name} git@github.com:akan-team/${lib.name}.git ${branch}`
2225
2230
  );
2226
2231
  lib.logger.log(`${lib.name} library pulled from ${branch} branch`);
2227
2232
  }
@@ -3845,7 +3850,7 @@ var ApplicationRunner = class {
3845
3850
  AppName: capitalize(appName),
3846
3851
  companyName: workspace.repoName,
3847
3852
  CompanyName: capitalize(workspace.repoName),
3848
- serveDomain: "localhost"
3853
+ startDomain: "localhost"
3849
3854
  }
3850
3855
  });
3851
3856
  workspace.setTsPaths("app", appName);
@@ -3860,7 +3865,7 @@ var ApplicationRunner = class {
3860
3865
  ...app.workspace.getBaseDevEnv(),
3861
3866
  type: "app",
3862
3867
  name: app.name,
3863
- command: "serve"
3868
+ command: "start"
3864
3869
  });
3865
3870
  const scanResult = await app.scan({ akanConfig });
3866
3871
  await app.syncAssets(scanResult.akanConfig.libs);
@@ -3885,7 +3890,7 @@ var ApplicationRunner = class {
3885
3890
  return { env: this.#getEnv(app, { AKAN_COMMAND_TYPE: type }) };
3886
3891
  }
3887
3892
  async buildBackend(app) {
3888
- await this.#prepareCommand(app, "serve", "backend");
3893
+ await this.#prepareCommand(app, "start", "backend");
3889
3894
  const akanConfig = await app.getConfig("build");
3890
3895
  const buildResult = await esbuild.build({
3891
3896
  write: false,
@@ -3910,8 +3915,8 @@ var ApplicationRunner = class {
3910
3915
  app.dist.writeJson("backend/package.json", appPackageJson);
3911
3916
  app.dist.writeFile(import_path4.default.join(app.dist.cwdPath, "backend", "Dockerfile"), akanConfig.backend.dockerfile);
3912
3917
  }
3913
- async serveBackend(app, { open: open2 = false } = {}) {
3914
- const { env } = await this.#prepareCommand(app, "serve", "backend");
3918
+ async startBackend(app, { open: open2 = false } = {}) {
3919
+ const { env } = await this.#prepareCommand(app, "start", "backend");
3915
3920
  const ctx = await esbuild.context({
3916
3921
  write: true,
3917
3922
  entryPoints: [`${app.cwdPath}/main.ts`],
@@ -3962,8 +3967,8 @@ var ApplicationRunner = class {
3962
3967
  ]);
3963
3968
  app.dist.writeFile("frontend/Dockerfile", akanConfig.frontend.dockerfile);
3964
3969
  }
3965
- async serveFrontend(app, { open: open2 = false, turbo = true } = {}) {
3966
- const { env } = await this.#prepareCommand(app, "serve", "frontend");
3970
+ async startFrontend(app, { open: open2 = false, turbo = true } = {}) {
3971
+ const { env } = await this.#prepareCommand(app, "start", "frontend");
3967
3972
  if (open2)
3968
3973
  setTimeout(() => (0, import_open.default)("http://localhost:4200"), 3e3);
3969
3974
  await app.spawn("npx", ["next", "dev", "-p", "4200", ...turbo ? ["--turbo"] : []], { env });
@@ -4014,9 +4019,9 @@ var ApplicationRunner = class {
4014
4019
  define: {
4015
4020
  "process.env": {
4016
4021
  // ...env,
4017
- AKAN_COMMAND_TYPE: "serve",
4022
+ AKAN_COMMAND_TYPE: "start",
4018
4023
  NEXT_PUBLIC_REPO_NAME: app.workspace.repoName,
4019
- NEXT_PUBLIC_SERVE_DOMAIN: processEnv.NEXT_PUBLIC_SERVE_DOMAIN ?? "localhost",
4024
+ NEXT_PUBLIC_START_DOMAIN: processEnv.NEXT_PUBLIC_START_DOMAIN ?? "localhost",
4020
4025
  NEXT_PUBLIC_ENV: processEnv.NEXT_PUBLIC_ENV ?? "debug",
4021
4026
  NEXT_PUBLIC_OPERATION_MODE: processEnv.NEXT_PUBLIC_OPERATION_MODE ?? "local",
4022
4027
  NEXT_PUBLIC_LOG_LEVEL: processEnv.NEXT_PUBLIC_LOG_LEVEL ?? "log",
@@ -4038,7 +4043,7 @@ var ApplicationRunner = class {
4038
4043
  const config = await this.#getViteConfig(app);
4039
4044
  await vite.build(config);
4040
4045
  }
4041
- async serveCsr(app, { open: open2 = false } = {}) {
4046
+ async startCsr(app, { open: open2 = false } = {}) {
4042
4047
  const config = await this.#getViteConfig(app);
4043
4048
  const server = await vite.createServer(config);
4044
4049
  await server.listen(4201);
@@ -4059,7 +4064,7 @@ var ApplicationRunner = class {
4059
4064
  await this.#prepareIos(app);
4060
4065
  await app.spawn("npx", ["cap", "run", "ios"]);
4061
4066
  }
4062
- async serveIos(app, { open: open2 = false, operation = "local" } = {}) {
4067
+ async startIos(app, { open: open2 = false, operation = "local" } = {}) {
4063
4068
  await this.#prepareIos(app);
4064
4069
  if (open2)
4065
4070
  await app.spawn("npx", ["cap", "open", "ios"]);
@@ -4094,7 +4099,7 @@ var ApplicationRunner = class {
4094
4099
  await this.#prepareAndroid(app);
4095
4100
  await app.spawn("npx", ["cap", "build", "android"]);
4096
4101
  }
4097
- async serveAndroid(app, { open: open2 = false, operation = "local" } = {}) {
4102
+ async startAndroid(app, { open: open2 = false, operation = "local" } = {}) {
4098
4103
  await this.#prepareAndroid(app);
4099
4104
  if (open2)
4100
4105
  await app.spawn("npx", ["cap", "open", "android"]);
@@ -4143,7 +4148,12 @@ var ApplicationRunner = class {
4143
4148
  ]);
4144
4149
  }
4145
4150
  async dbup(workspace) {
4146
- await workspace.applyTemplate({ basePath: "local", template: "localDev", dict: { repoName: workspace.repoName } });
4151
+ await workspace.applyTemplate({
4152
+ basePath: "local",
4153
+ template: "localDev",
4154
+ dict: { repoName: workspace.repoName },
4155
+ overwrite: false
4156
+ });
4147
4157
  await workspace.spawn(`docker`, ["compose", "up", "-d"], { cwd: `${workspace.workspaceRoot}/local` });
4148
4158
  }
4149
4159
  async dbdown(workspace) {
@@ -4266,8 +4276,8 @@ var ApplicationRunner = class {
4266
4276
  ANALYZE=false
4267
4277
  EOF
4268
4278
 
4269
- nx serve-backend ${app.name}
4270
- # or nx serve-frontend ${app.name}, etc
4279
+ nx start-backend ${app.name}
4280
+ # or nx start-frontend ${app.name}, etc
4271
4281
  \`\`\`
4272
4282
 
4273
4283
  ## Build
@@ -4345,11 +4355,11 @@ var ApplicationRunner = class {
4345
4355
  var ApplicationScript = class {
4346
4356
  #runner = new ApplicationRunner();
4347
4357
  libraryScript = new LibraryScript();
4348
- async createApplication(appName, workspace, { serve = false } = {}) {
4358
+ async createApplication(appName, workspace, { start = false } = {}) {
4349
4359
  const app = await this.#runner.createApplication(appName, workspace);
4350
4360
  await this.syncApplication(app);
4351
- if (serve)
4352
- await this.serve(app, { open: true });
4361
+ if (start)
4362
+ await this.start(app, { open: true });
4353
4363
  }
4354
4364
  async removeApplication(app) {
4355
4365
  await this.#runner.removeApplication(app);
@@ -4371,53 +4381,55 @@ var ApplicationScript = class {
4371
4381
  await this.syncApplication(app);
4372
4382
  await Promise.all([this.buildBackend(app, { sync: false }), this.buildFrontend(app, { sync: false })]);
4373
4383
  }
4374
- async serve(app, { open: open2 = false } = {}) {
4384
+ async start(app, { open: open2 = false } = {}) {
4375
4385
  await this.syncApplication(app);
4376
- await Promise.all([this.serveBackend(app, { open: open2, sync: false }), this.serveFrontend(app, { open: open2, sync: false })]);
4386
+ if (app.workspace.getBaseDevEnv().env === "local")
4387
+ await this.dbup(app.workspace);
4388
+ await Promise.all([this.startBackend(app, { open: open2, sync: false }), this.startFrontend(app, { open: open2, sync: false })]);
4377
4389
  }
4378
4390
  async buildBackend(app, { sync = true } = {}) {
4379
4391
  if (sync)
4380
4392
  await this.syncApplication(app);
4381
4393
  await this.#runner.buildBackend(app);
4382
4394
  }
4383
- async serveBackend(app, { open: open2 = false, sync = true } = {}) {
4395
+ async startBackend(app, { open: open2 = false, sync = true } = {}) {
4384
4396
  if (sync)
4385
4397
  await this.syncApplication(app);
4386
- await this.#runner.serveBackend(app, { open: open2 });
4398
+ await this.#runner.startBackend(app, { open: open2 });
4387
4399
  }
4388
4400
  async buildFrontend(app, { sync = true } = {}) {
4389
4401
  if (sync)
4390
4402
  await this.syncApplication(app);
4391
4403
  await this.#runner.buildFrontend(app);
4392
4404
  }
4393
- async serveFrontend(app, { open: open2 = false, turbo = false, sync = true } = {}) {
4405
+ async startFrontend(app, { open: open2 = false, turbo = false, sync = true } = {}) {
4394
4406
  if (sync)
4395
4407
  await this.syncApplication(app);
4396
- await this.#runner.serveFrontend(app, { open: open2, turbo });
4408
+ await this.#runner.startFrontend(app, { open: open2, turbo });
4397
4409
  }
4398
4410
  async buildCsr(app, { sync = true } = {}) {
4399
4411
  if (sync)
4400
4412
  await this.syncApplication(app);
4401
4413
  await this.#runner.buildCsr(app);
4402
4414
  }
4403
- async serveCsr(app, { open: open2 = false, sync = true } = {}) {
4415
+ async startCsr(app, { open: open2 = false, sync = true } = {}) {
4404
4416
  if (sync)
4405
4417
  await this.syncApplication(app);
4406
- await this.#runner.serveCsr(app, { open: open2 });
4418
+ await this.#runner.startCsr(app, { open: open2 });
4407
4419
  }
4408
4420
  async buildIos(app, { sync = true } = {}) {
4409
4421
  if (sync)
4410
4422
  await this.syncApplication(app);
4411
4423
  await this.#runner.buildIos(app);
4412
4424
  }
4413
- async serveIos(app, {
4425
+ async startIos(app, {
4414
4426
  open: open2 = false,
4415
4427
  operation = "local",
4416
4428
  sync = true
4417
4429
  } = {}) {
4418
4430
  if (sync)
4419
4431
  await this.syncApplication(app);
4420
- await this.#runner.serveIos(app, { open: open2, operation });
4432
+ await this.#runner.startIos(app, { open: open2, operation });
4421
4433
  }
4422
4434
  async releaseIos(app, { sync = true } = {}) {
4423
4435
  await this.buildCsr(app, { sync });
@@ -4428,14 +4440,14 @@ var ApplicationScript = class {
4428
4440
  await this.syncApplication(app);
4429
4441
  await this.#runner.buildAndroid(app);
4430
4442
  }
4431
- async serveAndroid(app, {
4443
+ async startAndroid(app, {
4432
4444
  open: open2 = false,
4433
4445
  operation = "local",
4434
4446
  sync = true
4435
4447
  } = {}) {
4436
4448
  if (sync)
4437
4449
  await this.syncApplication(app);
4438
- await this.#runner.serveAndroid(app, { open: open2, operation });
4450
+ await this.#runner.startAndroid(app, { open: open2, operation });
4439
4451
  }
4440
4452
  async releaseAndroid(app, { sync = true } = {}) {
4441
4453
  await this.buildCsr(app, { sync });
@@ -4481,8 +4493,8 @@ var ApplicationScript = class {
4481
4493
  // pkgs/@akanjs/cli/src/application/application.command.ts
4482
4494
  var ApplicationCommand = class {
4483
4495
  applicationScript = new ApplicationScript();
4484
- async createApplication(name, serve, workspace) {
4485
- await this.applicationScript.createApplication(name, workspace, { serve });
4496
+ async createApplication(name, start, workspace) {
4497
+ await this.applicationScript.createApplication(name, workspace, { start });
4486
4498
  }
4487
4499
  async removeApplication(app) {
4488
4500
  await this.applicationScript.removeApplication(app);
@@ -4508,23 +4520,23 @@ var ApplicationCommand = class {
4508
4520
  async buildAndroid(app) {
4509
4521
  await this.applicationScript.buildAndroid(app);
4510
4522
  }
4511
- async serve(app, open2) {
4512
- await this.applicationScript.serve(app, { open: open2 });
4523
+ async start(app, open2) {
4524
+ await this.applicationScript.start(app, { open: open2 });
4513
4525
  }
4514
- async serveBackend(app, open2) {
4515
- await this.applicationScript.serveBackend(app, { open: open2 });
4526
+ async startBackend(app, open2) {
4527
+ await this.applicationScript.startBackend(app, { open: open2 });
4516
4528
  }
4517
- async serveFrontend(app, open2, turbo) {
4518
- await this.applicationScript.serveFrontend(app, { open: open2, turbo });
4529
+ async startFrontend(app, open2, turbo) {
4530
+ await this.applicationScript.startFrontend(app, { open: open2, turbo });
4519
4531
  }
4520
- async serveCsr(app, open2) {
4521
- await this.applicationScript.serveCsr(app, { open: open2 });
4532
+ async startCsr(app, open2) {
4533
+ await this.applicationScript.startCsr(app, { open: open2 });
4522
4534
  }
4523
- async serveIos(app, open2, release) {
4524
- await this.applicationScript.serveIos(app, { open: open2, operation: release ? "release" : "local" });
4535
+ async startIos(app, open2, release) {
4536
+ await this.applicationScript.startIos(app, { open: open2, operation: release ? "release" : "local" });
4525
4537
  }
4526
- async serveAndroid(app, open2, release) {
4527
- await this.applicationScript.serveAndroid(app, { open: open2, operation: release ? "release" : "local" });
4538
+ async startAndroid(app, open2, release) {
4539
+ await this.applicationScript.startAndroid(app, { open: open2, operation: release ? "release" : "local" });
4528
4540
  }
4529
4541
  async releaseIos(app) {
4530
4542
  await this.applicationScript.releaseIos(app);
@@ -4560,7 +4572,7 @@ var ApplicationCommand = class {
4560
4572
  __decorateClass([
4561
4573
  Target.Public(),
4562
4574
  __decorateParam(0, Option("name", { desc: "name of application" })),
4563
- __decorateParam(1, Option("serve", { type: "boolean", desc: "serve application", default: false })),
4575
+ __decorateParam(1, Option("start", { type: "boolean", desc: "start application", default: false })),
4564
4576
  __decorateParam(2, Workspace())
4565
4577
  ], ApplicationCommand.prototype, "createApplication", 1);
4566
4578
  __decorateClass([
@@ -4598,36 +4610,36 @@ __decorateClass([
4598
4610
  __decorateClass([
4599
4611
  Target.Public({ short: true }),
4600
4612
  __decorateParam(0, App()),
4601
- __decorateParam(1, Option("open", { type: "boolean", desc: "open web browser", default: false }))
4602
- ], ApplicationCommand.prototype, "serve", 1);
4613
+ __decorateParam(1, Option("open", { type: "boolean", desc: "open web browser?", default: false }))
4614
+ ], ApplicationCommand.prototype, "start", 1);
4603
4615
  __decorateClass([
4604
4616
  Target.Public({ short: true }),
4605
4617
  __decorateParam(0, App()),
4606
4618
  __decorateParam(1, Option("open", { type: "boolean", desc: "open graphql playground", default: false }))
4607
- ], ApplicationCommand.prototype, "serveBackend", 1);
4619
+ ], ApplicationCommand.prototype, "startBackend", 1);
4608
4620
  __decorateClass([
4609
4621
  Target.Public({ short: true }),
4610
4622
  __decorateParam(0, App()),
4611
4623
  __decorateParam(1, Option("open", { type: "boolean", desc: "open web browser", default: false })),
4612
4624
  __decorateParam(2, Option("turbo", { type: "boolean", desc: "turbo", default: false }))
4613
- ], ApplicationCommand.prototype, "serveFrontend", 1);
4625
+ ], ApplicationCommand.prototype, "startFrontend", 1);
4614
4626
  __decorateClass([
4615
4627
  Target.Public({ short: true }),
4616
4628
  __decorateParam(0, App()),
4617
4629
  __decorateParam(1, Option("open", { type: "boolean", desc: "open web browser", default: false }))
4618
- ], ApplicationCommand.prototype, "serveCsr", 1);
4630
+ ], ApplicationCommand.prototype, "startCsr", 1);
4619
4631
  __decorateClass([
4620
4632
  Target.Public({ short: true }),
4621
4633
  __decorateParam(0, App()),
4622
4634
  __decorateParam(1, Option("open", { type: "boolean", desc: "open ios simulator", default: false })),
4623
4635
  __decorateParam(2, Option("release", { type: "boolean", desc: "release mode", default: false }))
4624
- ], ApplicationCommand.prototype, "serveIos", 1);
4636
+ ], ApplicationCommand.prototype, "startIos", 1);
4625
4637
  __decorateClass([
4626
4638
  Target.Public({ short: true }),
4627
4639
  __decorateParam(0, App()),
4628
4640
  __decorateParam(1, Option("open", { type: "boolean", desc: "open android simulator", default: false })),
4629
4641
  __decorateParam(2, Option("release", { type: "boolean", desc: "release mode", default: false }))
4630
- ], ApplicationCommand.prototype, "serveAndroid", 1);
4642
+ ], ApplicationCommand.prototype, "startAndroid", 1);
4631
4643
  __decorateClass([
4632
4644
  Target.Public(),
4633
4645
  __decorateParam(0, App())
@@ -4752,13 +4764,14 @@ var PackageRunner = class {
4752
4764
  } else if (pkg.name === "@akanjs/cli") {
4753
4765
  buildResult = await esbuild2.build({
4754
4766
  write: false,
4755
- entryPoints: [`${pkg.cwdPath}/index.ts`],
4767
+ entryPoints: [`${pkg.cwdPath}/index.ts`, `${pkg.cwdPath}/README.md`],
4756
4768
  bundle: true,
4757
4769
  format: "cjs",
4758
4770
  packages: "external",
4759
4771
  outdir: pkg.dist.cwdPath,
4760
4772
  logLevel: "error",
4761
- plugins: [(0, import_esbuild_plugin_d.dtsPlugin)({ tsconfig: `${pkg.cwdPath}/tsconfig.json` })]
4773
+ plugins: [(0, import_esbuild_plugin_d.dtsPlugin)({ tsconfig: `${pkg.cwdPath}/tsconfig.json` })],
4774
+ loader: { ".md": "copy" }
4762
4775
  });
4763
4776
  await esbuild2.build({
4764
4777
  write: true,
@@ -4855,7 +4868,7 @@ var PackageScript = class {
4855
4868
 
4856
4869
  // pkgs/@akanjs/cli/src/cloud/cloud.runner.ts
4857
4870
  var import_prompts7 = require("@inquirer/prompts");
4858
- var import_chalk2 = __toESM(require("chalk"));
4871
+ var import_chalk4 = __toESM(require("chalk"));
4859
4872
  var import_latest_version = __toESM(require("latest-version"));
4860
4873
  var import_open2 = __toESM(require("open"));
4861
4874
  var QRcode = __toESM(require("qrcode"));
@@ -4865,17 +4878,17 @@ var CloudRunner = class {
4865
4878
  const config = getHostConfig();
4866
4879
  const self = config.auth ? await getSelf(config.auth.token) : null;
4867
4880
  if (self) {
4868
- Logger.rawLog(import_chalk2.default.green(`
4881
+ Logger.rawLog(import_chalk4.default.green(`
4869
4882
  \u2713 Already logged in akan cloud as ${self.nickname}
4870
4883
  `));
4871
4884
  return true;
4872
4885
  }
4873
4886
  const remoteId = (0, import_uuid.v4)();
4874
4887
  const signinUrl = `${akanCloudClientUrl}/signin?remoteId=${remoteId}`;
4875
- Logger.rawLog(import_chalk2.default.bold(`
4876
- ${import_chalk2.default.green("\u27A4")} Authentication Required`));
4877
- Logger.rawLog(import_chalk2.default.dim("Please visit or click the following URL:"));
4878
- Logger.rawLog(import_chalk2.default.cyan.underline(signinUrl) + "\n");
4888
+ Logger.rawLog(import_chalk4.default.bold(`
4889
+ ${import_chalk4.default.green("\u27A4")} Authentication Required`));
4890
+ Logger.rawLog(import_chalk4.default.dim("Please visit or click the following URL:"));
4891
+ Logger.rawLog(import_chalk4.default.cyan.underline(signinUrl) + "\n");
4879
4892
  try {
4880
4893
  const qrcode = await new Promise((resolve, reject) => {
4881
4894
  QRcode.toString(signinUrl, { type: "terminal", small: true }, (err, data) => {
@@ -4886,11 +4899,11 @@ ${import_chalk2.default.green("\u27A4")} Authentication Required`));
4886
4899
  });
4887
4900
  Logger.rawLog(qrcode);
4888
4901
  await (0, import_open2.default)(signinUrl);
4889
- Logger.rawLog(import_chalk2.default.dim("Opening browser..."));
4902
+ Logger.rawLog(import_chalk4.default.dim("Opening browser..."));
4890
4903
  } catch {
4891
- Logger.rawLog(import_chalk2.default.yellow("Could not open browser. Please visit the URL manually."));
4904
+ Logger.rawLog(import_chalk4.default.yellow("Could not open browser. Please visit the URL manually."));
4892
4905
  }
4893
- Logger.rawLog(import_chalk2.default.dim("Waiting for authentication..."));
4906
+ Logger.rawLog(import_chalk4.default.dim("Waiting for authentication..."));
4894
4907
  const MAX_RETRY = 300;
4895
4908
  for (let i = 0; i < MAX_RETRY; i++) {
4896
4909
  const res = await fetch(`${akanCloudBackendUrl}/user/getRemoteAuthToken/${remoteId}`);
@@ -4898,37 +4911,37 @@ ${import_chalk2.default.green("\u27A4")} Authentication Required`));
4898
4911
  const self2 = jwt ? await getSelf(jwt) : null;
4899
4912
  if (jwt && self2) {
4900
4913
  setHostConfig(akanCloudHost, { auth: { token: jwt, self: self2 } });
4901
- Logger.rawLog(import_chalk2.default.green(`\r\u2713 Authentication successful!`));
4902
- Logger.rawLog(import_chalk2.default.green.bold(`
4914
+ Logger.rawLog(import_chalk4.default.green(`\r\u2713 Authentication successful!`));
4915
+ Logger.rawLog(import_chalk4.default.green.bold(`
4903
4916
  \u2728 Welcome aboard, ${self2.nickname}!`));
4904
- Logger.rawLog(import_chalk2.default.dim("You're now ready to use Akan CLI!\n"));
4917
+ Logger.rawLog(import_chalk4.default.dim("You're now ready to use Akan CLI!\n"));
4905
4918
  return true;
4906
4919
  }
4907
4920
  await sleep(2e3);
4908
4921
  }
4909
- throw new Error(import_chalk2.default.red("\u2716 Authentication timed out after 10 minutes. Please try again."));
4922
+ throw new Error(import_chalk4.default.red("\u2716 Authentication timed out after 10 minutes. Please try again."));
4910
4923
  }
4911
4924
  logout() {
4912
4925
  const config = getHostConfig();
4913
4926
  if (config.auth) {
4914
4927
  setHostConfig(akanCloudHost, {});
4915
- Logger.rawLog(import_chalk2.default.magenta.bold(`
4928
+ Logger.rawLog(import_chalk4.default.magenta.bold(`
4916
4929
  \u{1F44B} Goodbye, ${config.auth.self.nickname}!`));
4917
- Logger.rawLog(import_chalk2.default.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\n"));
4918
- Logger.rawLog(import_chalk2.default.cyan("You have been successfully logged out."));
4919
- Logger.rawLog(import_chalk2.default.dim("Thank you for using Akan CLI. Come back soon! \u{1F31F}\n"));
4930
+ Logger.rawLog(import_chalk4.default.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\n"));
4931
+ Logger.rawLog(import_chalk4.default.cyan("You have been successfully logged out."));
4932
+ Logger.rawLog(import_chalk4.default.dim("Thank you for using Akan CLI. Come back soon! \u{1F31F}\n"));
4920
4933
  } else {
4921
- Logger.rawLog(import_chalk2.default.yellow.bold("\n\u26A0\uFE0F No active session found"));
4922
- Logger.rawLog(import_chalk2.default.dim("You were not logged in to begin with\n"));
4934
+ Logger.rawLog(import_chalk4.default.yellow.bold("\n\u26A0\uFE0F No active session found"));
4935
+ Logger.rawLog(import_chalk4.default.dim("You were not logged in to begin with\n"));
4923
4936
  }
4924
4937
  }
4925
4938
  async setLlm() {
4926
4939
  await AiSession.init({ useExisting: true });
4927
- Logger.rawLog(import_chalk2.default.green("LLM model set successfully"));
4940
+ Logger.rawLog(import_chalk4.default.green("LLM model set successfully"));
4928
4941
  }
4929
4942
  resetLlm() {
4930
4943
  AiSession.setLlmConfig(null);
4931
- Logger.rawLog(import_chalk2.default.green("LLM model reset successfully"));
4944
+ Logger.rawLog(import_chalk4.default.green("LLM model reset successfully"));
4932
4945
  }
4933
4946
  async getAkanPkgs(workspace) {
4934
4947
  const pkgs = await workspace.getPkgs();
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "type": "commonjs",
3
3
  "name": "@akanjs/cli",
4
- "version": "0.0.90",
4
+ "version": "0.0.92",
5
5
  "bin": {
6
6
  "akan": "index.js"
7
7
  },
@@ -2,7 +2,7 @@ import { App, Sys, Workspace } from "@akanjs/devkit";
2
2
  import { ApplicationScript } from "./application.script";
3
3
  export declare class ApplicationCommand {
4
4
  applicationScript: ApplicationScript;
5
- createApplication(name: string, serve: boolean, workspace: Workspace): Promise<void>;
5
+ createApplication(name: string, start: boolean, workspace: Workspace): Promise<void>;
6
6
  removeApplication(app: App): Promise<void>;
7
7
  scanApplication(app: App): Promise<void>;
8
8
  build(app: App): Promise<void>;
@@ -11,12 +11,12 @@ export declare class ApplicationCommand {
11
11
  buildCsr(app: App): Promise<void>;
12
12
  buildIos(app: App): Promise<void>;
13
13
  buildAndroid(app: App): Promise<void>;
14
- serve(app: App, open: boolean): Promise<void>;
15
- serveBackend(app: App, open: boolean): Promise<void>;
16
- serveFrontend(app: App, open: boolean, turbo: boolean): Promise<void>;
17
- serveCsr(app: App, open: boolean): Promise<void>;
18
- serveIos(app: App, open: boolean, release: boolean): Promise<void>;
19
- serveAndroid(app: App, open: boolean, release: boolean): Promise<void>;
14
+ start(app: App, open: boolean): Promise<void>;
15
+ startBackend(app: App, open: boolean): Promise<void>;
16
+ startFrontend(app: App, open: boolean, turbo: boolean): Promise<void>;
17
+ startCsr(app: App, open: boolean): Promise<void>;
18
+ startIos(app: App, open: boolean, release: boolean): Promise<void>;
19
+ startAndroid(app: App, open: boolean, release: boolean): Promise<void>;
20
20
  releaseIos(app: App): Promise<void>;
21
21
  releaseAndroid(app: App): Promise<void>;
22
22
  releaseSource(app: App, rebuild: boolean, buildNum: number, environment: string, local: boolean): Promise<void>;
@@ -11,26 +11,26 @@ export declare class ApplicationRunner {
11
11
  removeApplication(app: App): Promise<void>;
12
12
  scanSync(app: App): Promise<import("@akanjs/config").AppScanResult | import("@akanjs/config").LibScanResult>;
13
13
  buildBackend(app: App): Promise<void>;
14
- serveBackend(app: App, { open }?: {
14
+ startBackend(app: App, { open }?: {
15
15
  open?: boolean;
16
16
  }): Promise<void>;
17
17
  buildFrontend(app: App): Promise<void>;
18
- serveFrontend(app: App, { open, turbo }?: {
18
+ startFrontend(app: App, { open, turbo }?: {
19
19
  open?: boolean;
20
20
  turbo?: boolean;
21
21
  }): Promise<void>;
22
22
  buildCsr(app: App): Promise<void>;
23
- serveCsr(app: App, { open }?: {
23
+ startCsr(app: App, { open }?: {
24
24
  open?: boolean;
25
25
  }): Promise<void>;
26
26
  buildIos(app: App): Promise<void>;
27
- serveIos(app: App, { open, operation }?: {
27
+ startIos(app: App, { open, operation }?: {
28
28
  open?: boolean;
29
29
  operation?: "local" | "release";
30
30
  }): Promise<void>;
31
31
  releaseIos(app: App): Promise<void>;
32
32
  buildAndroid(app: App): Promise<void>;
33
- serveAndroid(app: App, { open, operation }?: {
33
+ startAndroid(app: App, { open, operation }?: {
34
34
  open?: boolean;
35
35
  operation?: "local" | "release";
36
36
  }): Promise<void>;