@akanjs/cli 0.0.91 → 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 +101 -86
  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
  );
@@ -3843,7 +3850,7 @@ var ApplicationRunner = class {
3843
3850
  AppName: capitalize(appName),
3844
3851
  companyName: workspace.repoName,
3845
3852
  CompanyName: capitalize(workspace.repoName),
3846
- serveDomain: "localhost"
3853
+ startDomain: "localhost"
3847
3854
  }
3848
3855
  });
3849
3856
  workspace.setTsPaths("app", appName);
@@ -3858,7 +3865,7 @@ var ApplicationRunner = class {
3858
3865
  ...app.workspace.getBaseDevEnv(),
3859
3866
  type: "app",
3860
3867
  name: app.name,
3861
- command: "serve"
3868
+ command: "start"
3862
3869
  });
3863
3870
  const scanResult = await app.scan({ akanConfig });
3864
3871
  await app.syncAssets(scanResult.akanConfig.libs);
@@ -3883,7 +3890,7 @@ var ApplicationRunner = class {
3883
3890
  return { env: this.#getEnv(app, { AKAN_COMMAND_TYPE: type }) };
3884
3891
  }
3885
3892
  async buildBackend(app) {
3886
- await this.#prepareCommand(app, "serve", "backend");
3893
+ await this.#prepareCommand(app, "start", "backend");
3887
3894
  const akanConfig = await app.getConfig("build");
3888
3895
  const buildResult = await esbuild.build({
3889
3896
  write: false,
@@ -3908,8 +3915,8 @@ var ApplicationRunner = class {
3908
3915
  app.dist.writeJson("backend/package.json", appPackageJson);
3909
3916
  app.dist.writeFile(import_path4.default.join(app.dist.cwdPath, "backend", "Dockerfile"), akanConfig.backend.dockerfile);
3910
3917
  }
3911
- async serveBackend(app, { open: open2 = false } = {}) {
3912
- const { env } = await this.#prepareCommand(app, "serve", "backend");
3918
+ async startBackend(app, { open: open2 = false } = {}) {
3919
+ const { env } = await this.#prepareCommand(app, "start", "backend");
3913
3920
  const ctx = await esbuild.context({
3914
3921
  write: true,
3915
3922
  entryPoints: [`${app.cwdPath}/main.ts`],
@@ -3960,8 +3967,8 @@ var ApplicationRunner = class {
3960
3967
  ]);
3961
3968
  app.dist.writeFile("frontend/Dockerfile", akanConfig.frontend.dockerfile);
3962
3969
  }
3963
- async serveFrontend(app, { open: open2 = false, turbo = true } = {}) {
3964
- 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");
3965
3972
  if (open2)
3966
3973
  setTimeout(() => (0, import_open.default)("http://localhost:4200"), 3e3);
3967
3974
  await app.spawn("npx", ["next", "dev", "-p", "4200", ...turbo ? ["--turbo"] : []], { env });
@@ -4012,9 +4019,9 @@ var ApplicationRunner = class {
4012
4019
  define: {
4013
4020
  "process.env": {
4014
4021
  // ...env,
4015
- AKAN_COMMAND_TYPE: "serve",
4022
+ AKAN_COMMAND_TYPE: "start",
4016
4023
  NEXT_PUBLIC_REPO_NAME: app.workspace.repoName,
4017
- NEXT_PUBLIC_SERVE_DOMAIN: processEnv.NEXT_PUBLIC_SERVE_DOMAIN ?? "localhost",
4024
+ NEXT_PUBLIC_START_DOMAIN: processEnv.NEXT_PUBLIC_START_DOMAIN ?? "localhost",
4018
4025
  NEXT_PUBLIC_ENV: processEnv.NEXT_PUBLIC_ENV ?? "debug",
4019
4026
  NEXT_PUBLIC_OPERATION_MODE: processEnv.NEXT_PUBLIC_OPERATION_MODE ?? "local",
4020
4027
  NEXT_PUBLIC_LOG_LEVEL: processEnv.NEXT_PUBLIC_LOG_LEVEL ?? "log",
@@ -4036,7 +4043,7 @@ var ApplicationRunner = class {
4036
4043
  const config = await this.#getViteConfig(app);
4037
4044
  await vite.build(config);
4038
4045
  }
4039
- async serveCsr(app, { open: open2 = false } = {}) {
4046
+ async startCsr(app, { open: open2 = false } = {}) {
4040
4047
  const config = await this.#getViteConfig(app);
4041
4048
  const server = await vite.createServer(config);
4042
4049
  await server.listen(4201);
@@ -4057,7 +4064,7 @@ var ApplicationRunner = class {
4057
4064
  await this.#prepareIos(app);
4058
4065
  await app.spawn("npx", ["cap", "run", "ios"]);
4059
4066
  }
4060
- async serveIos(app, { open: open2 = false, operation = "local" } = {}) {
4067
+ async startIos(app, { open: open2 = false, operation = "local" } = {}) {
4061
4068
  await this.#prepareIos(app);
4062
4069
  if (open2)
4063
4070
  await app.spawn("npx", ["cap", "open", "ios"]);
@@ -4092,7 +4099,7 @@ var ApplicationRunner = class {
4092
4099
  await this.#prepareAndroid(app);
4093
4100
  await app.spawn("npx", ["cap", "build", "android"]);
4094
4101
  }
4095
- async serveAndroid(app, { open: open2 = false, operation = "local" } = {}) {
4102
+ async startAndroid(app, { open: open2 = false, operation = "local" } = {}) {
4096
4103
  await this.#prepareAndroid(app);
4097
4104
  if (open2)
4098
4105
  await app.spawn("npx", ["cap", "open", "android"]);
@@ -4141,7 +4148,12 @@ var ApplicationRunner = class {
4141
4148
  ]);
4142
4149
  }
4143
4150
  async dbup(workspace) {
4144
- 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
+ });
4145
4157
  await workspace.spawn(`docker`, ["compose", "up", "-d"], { cwd: `${workspace.workspaceRoot}/local` });
4146
4158
  }
4147
4159
  async dbdown(workspace) {
@@ -4264,8 +4276,8 @@ var ApplicationRunner = class {
4264
4276
  ANALYZE=false
4265
4277
  EOF
4266
4278
 
4267
- nx serve-backend ${app.name}
4268
- # or nx serve-frontend ${app.name}, etc
4279
+ nx start-backend ${app.name}
4280
+ # or nx start-frontend ${app.name}, etc
4269
4281
  \`\`\`
4270
4282
 
4271
4283
  ## Build
@@ -4343,11 +4355,11 @@ var ApplicationRunner = class {
4343
4355
  var ApplicationScript = class {
4344
4356
  #runner = new ApplicationRunner();
4345
4357
  libraryScript = new LibraryScript();
4346
- async createApplication(appName, workspace, { serve = false } = {}) {
4358
+ async createApplication(appName, workspace, { start = false } = {}) {
4347
4359
  const app = await this.#runner.createApplication(appName, workspace);
4348
4360
  await this.syncApplication(app);
4349
- if (serve)
4350
- await this.serve(app, { open: true });
4361
+ if (start)
4362
+ await this.start(app, { open: true });
4351
4363
  }
4352
4364
  async removeApplication(app) {
4353
4365
  await this.#runner.removeApplication(app);
@@ -4369,53 +4381,55 @@ var ApplicationScript = class {
4369
4381
  await this.syncApplication(app);
4370
4382
  await Promise.all([this.buildBackend(app, { sync: false }), this.buildFrontend(app, { sync: false })]);
4371
4383
  }
4372
- async serve(app, { open: open2 = false } = {}) {
4384
+ async start(app, { open: open2 = false } = {}) {
4373
4385
  await this.syncApplication(app);
4374
- 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 })]);
4375
4389
  }
4376
4390
  async buildBackend(app, { sync = true } = {}) {
4377
4391
  if (sync)
4378
4392
  await this.syncApplication(app);
4379
4393
  await this.#runner.buildBackend(app);
4380
4394
  }
4381
- async serveBackend(app, { open: open2 = false, sync = true } = {}) {
4395
+ async startBackend(app, { open: open2 = false, sync = true } = {}) {
4382
4396
  if (sync)
4383
4397
  await this.syncApplication(app);
4384
- await this.#runner.serveBackend(app, { open: open2 });
4398
+ await this.#runner.startBackend(app, { open: open2 });
4385
4399
  }
4386
4400
  async buildFrontend(app, { sync = true } = {}) {
4387
4401
  if (sync)
4388
4402
  await this.syncApplication(app);
4389
4403
  await this.#runner.buildFrontend(app);
4390
4404
  }
4391
- async serveFrontend(app, { open: open2 = false, turbo = false, sync = true } = {}) {
4405
+ async startFrontend(app, { open: open2 = false, turbo = false, sync = true } = {}) {
4392
4406
  if (sync)
4393
4407
  await this.syncApplication(app);
4394
- await this.#runner.serveFrontend(app, { open: open2, turbo });
4408
+ await this.#runner.startFrontend(app, { open: open2, turbo });
4395
4409
  }
4396
4410
  async buildCsr(app, { sync = true } = {}) {
4397
4411
  if (sync)
4398
4412
  await this.syncApplication(app);
4399
4413
  await this.#runner.buildCsr(app);
4400
4414
  }
4401
- async serveCsr(app, { open: open2 = false, sync = true } = {}) {
4415
+ async startCsr(app, { open: open2 = false, sync = true } = {}) {
4402
4416
  if (sync)
4403
4417
  await this.syncApplication(app);
4404
- await this.#runner.serveCsr(app, { open: open2 });
4418
+ await this.#runner.startCsr(app, { open: open2 });
4405
4419
  }
4406
4420
  async buildIos(app, { sync = true } = {}) {
4407
4421
  if (sync)
4408
4422
  await this.syncApplication(app);
4409
4423
  await this.#runner.buildIos(app);
4410
4424
  }
4411
- async serveIos(app, {
4425
+ async startIos(app, {
4412
4426
  open: open2 = false,
4413
4427
  operation = "local",
4414
4428
  sync = true
4415
4429
  } = {}) {
4416
4430
  if (sync)
4417
4431
  await this.syncApplication(app);
4418
- await this.#runner.serveIos(app, { open: open2, operation });
4432
+ await this.#runner.startIos(app, { open: open2, operation });
4419
4433
  }
4420
4434
  async releaseIos(app, { sync = true } = {}) {
4421
4435
  await this.buildCsr(app, { sync });
@@ -4426,14 +4440,14 @@ var ApplicationScript = class {
4426
4440
  await this.syncApplication(app);
4427
4441
  await this.#runner.buildAndroid(app);
4428
4442
  }
4429
- async serveAndroid(app, {
4443
+ async startAndroid(app, {
4430
4444
  open: open2 = false,
4431
4445
  operation = "local",
4432
4446
  sync = true
4433
4447
  } = {}) {
4434
4448
  if (sync)
4435
4449
  await this.syncApplication(app);
4436
- await this.#runner.serveAndroid(app, { open: open2, operation });
4450
+ await this.#runner.startAndroid(app, { open: open2, operation });
4437
4451
  }
4438
4452
  async releaseAndroid(app, { sync = true } = {}) {
4439
4453
  await this.buildCsr(app, { sync });
@@ -4479,8 +4493,8 @@ var ApplicationScript = class {
4479
4493
  // pkgs/@akanjs/cli/src/application/application.command.ts
4480
4494
  var ApplicationCommand = class {
4481
4495
  applicationScript = new ApplicationScript();
4482
- async createApplication(name, serve, workspace) {
4483
- await this.applicationScript.createApplication(name, workspace, { serve });
4496
+ async createApplication(name, start, workspace) {
4497
+ await this.applicationScript.createApplication(name, workspace, { start });
4484
4498
  }
4485
4499
  async removeApplication(app) {
4486
4500
  await this.applicationScript.removeApplication(app);
@@ -4506,23 +4520,23 @@ var ApplicationCommand = class {
4506
4520
  async buildAndroid(app) {
4507
4521
  await this.applicationScript.buildAndroid(app);
4508
4522
  }
4509
- async serve(app, open2) {
4510
- await this.applicationScript.serve(app, { open: open2 });
4523
+ async start(app, open2) {
4524
+ await this.applicationScript.start(app, { open: open2 });
4511
4525
  }
4512
- async serveBackend(app, open2) {
4513
- await this.applicationScript.serveBackend(app, { open: open2 });
4526
+ async startBackend(app, open2) {
4527
+ await this.applicationScript.startBackend(app, { open: open2 });
4514
4528
  }
4515
- async serveFrontend(app, open2, turbo) {
4516
- await this.applicationScript.serveFrontend(app, { open: open2, turbo });
4529
+ async startFrontend(app, open2, turbo) {
4530
+ await this.applicationScript.startFrontend(app, { open: open2, turbo });
4517
4531
  }
4518
- async serveCsr(app, open2) {
4519
- await this.applicationScript.serveCsr(app, { open: open2 });
4532
+ async startCsr(app, open2) {
4533
+ await this.applicationScript.startCsr(app, { open: open2 });
4520
4534
  }
4521
- async serveIos(app, open2, release) {
4522
- 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" });
4523
4537
  }
4524
- async serveAndroid(app, open2, release) {
4525
- 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" });
4526
4540
  }
4527
4541
  async releaseIos(app) {
4528
4542
  await this.applicationScript.releaseIos(app);
@@ -4558,7 +4572,7 @@ var ApplicationCommand = class {
4558
4572
  __decorateClass([
4559
4573
  Target.Public(),
4560
4574
  __decorateParam(0, Option("name", { desc: "name of application" })),
4561
- __decorateParam(1, Option("serve", { type: "boolean", desc: "serve application", default: false })),
4575
+ __decorateParam(1, Option("start", { type: "boolean", desc: "start application", default: false })),
4562
4576
  __decorateParam(2, Workspace())
4563
4577
  ], ApplicationCommand.prototype, "createApplication", 1);
4564
4578
  __decorateClass([
@@ -4596,36 +4610,36 @@ __decorateClass([
4596
4610
  __decorateClass([
4597
4611
  Target.Public({ short: true }),
4598
4612
  __decorateParam(0, App()),
4599
- __decorateParam(1, Option("open", { type: "boolean", desc: "open web browser", default: false }))
4600
- ], ApplicationCommand.prototype, "serve", 1);
4613
+ __decorateParam(1, Option("open", { type: "boolean", desc: "open web browser?", default: false }))
4614
+ ], ApplicationCommand.prototype, "start", 1);
4601
4615
  __decorateClass([
4602
4616
  Target.Public({ short: true }),
4603
4617
  __decorateParam(0, App()),
4604
4618
  __decorateParam(1, Option("open", { type: "boolean", desc: "open graphql playground", default: false }))
4605
- ], ApplicationCommand.prototype, "serveBackend", 1);
4619
+ ], ApplicationCommand.prototype, "startBackend", 1);
4606
4620
  __decorateClass([
4607
4621
  Target.Public({ short: true }),
4608
4622
  __decorateParam(0, App()),
4609
4623
  __decorateParam(1, Option("open", { type: "boolean", desc: "open web browser", default: false })),
4610
4624
  __decorateParam(2, Option("turbo", { type: "boolean", desc: "turbo", default: false }))
4611
- ], ApplicationCommand.prototype, "serveFrontend", 1);
4625
+ ], ApplicationCommand.prototype, "startFrontend", 1);
4612
4626
  __decorateClass([
4613
4627
  Target.Public({ short: true }),
4614
4628
  __decorateParam(0, App()),
4615
4629
  __decorateParam(1, Option("open", { type: "boolean", desc: "open web browser", default: false }))
4616
- ], ApplicationCommand.prototype, "serveCsr", 1);
4630
+ ], ApplicationCommand.prototype, "startCsr", 1);
4617
4631
  __decorateClass([
4618
4632
  Target.Public({ short: true }),
4619
4633
  __decorateParam(0, App()),
4620
4634
  __decorateParam(1, Option("open", { type: "boolean", desc: "open ios simulator", default: false })),
4621
4635
  __decorateParam(2, Option("release", { type: "boolean", desc: "release mode", default: false }))
4622
- ], ApplicationCommand.prototype, "serveIos", 1);
4636
+ ], ApplicationCommand.prototype, "startIos", 1);
4623
4637
  __decorateClass([
4624
4638
  Target.Public({ short: true }),
4625
4639
  __decorateParam(0, App()),
4626
4640
  __decorateParam(1, Option("open", { type: "boolean", desc: "open android simulator", default: false })),
4627
4641
  __decorateParam(2, Option("release", { type: "boolean", desc: "release mode", default: false }))
4628
- ], ApplicationCommand.prototype, "serveAndroid", 1);
4642
+ ], ApplicationCommand.prototype, "startAndroid", 1);
4629
4643
  __decorateClass([
4630
4644
  Target.Public(),
4631
4645
  __decorateParam(0, App())
@@ -4750,13 +4764,14 @@ var PackageRunner = class {
4750
4764
  } else if (pkg.name === "@akanjs/cli") {
4751
4765
  buildResult = await esbuild2.build({
4752
4766
  write: false,
4753
- entryPoints: [`${pkg.cwdPath}/index.ts`],
4767
+ entryPoints: [`${pkg.cwdPath}/index.ts`, `${pkg.cwdPath}/README.md`],
4754
4768
  bundle: true,
4755
4769
  format: "cjs",
4756
4770
  packages: "external",
4757
4771
  outdir: pkg.dist.cwdPath,
4758
4772
  logLevel: "error",
4759
- 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" }
4760
4775
  });
4761
4776
  await esbuild2.build({
4762
4777
  write: true,
@@ -4853,7 +4868,7 @@ var PackageScript = class {
4853
4868
 
4854
4869
  // pkgs/@akanjs/cli/src/cloud/cloud.runner.ts
4855
4870
  var import_prompts7 = require("@inquirer/prompts");
4856
- var import_chalk2 = __toESM(require("chalk"));
4871
+ var import_chalk4 = __toESM(require("chalk"));
4857
4872
  var import_latest_version = __toESM(require("latest-version"));
4858
4873
  var import_open2 = __toESM(require("open"));
4859
4874
  var QRcode = __toESM(require("qrcode"));
@@ -4863,17 +4878,17 @@ var CloudRunner = class {
4863
4878
  const config = getHostConfig();
4864
4879
  const self = config.auth ? await getSelf(config.auth.token) : null;
4865
4880
  if (self) {
4866
- Logger.rawLog(import_chalk2.default.green(`
4881
+ Logger.rawLog(import_chalk4.default.green(`
4867
4882
  \u2713 Already logged in akan cloud as ${self.nickname}
4868
4883
  `));
4869
4884
  return true;
4870
4885
  }
4871
4886
  const remoteId = (0, import_uuid.v4)();
4872
4887
  const signinUrl = `${akanCloudClientUrl}/signin?remoteId=${remoteId}`;
4873
- Logger.rawLog(import_chalk2.default.bold(`
4874
- ${import_chalk2.default.green("\u27A4")} Authentication Required`));
4875
- Logger.rawLog(import_chalk2.default.dim("Please visit or click the following URL:"));
4876
- 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");
4877
4892
  try {
4878
4893
  const qrcode = await new Promise((resolve, reject) => {
4879
4894
  QRcode.toString(signinUrl, { type: "terminal", small: true }, (err, data) => {
@@ -4884,11 +4899,11 @@ ${import_chalk2.default.green("\u27A4")} Authentication Required`));
4884
4899
  });
4885
4900
  Logger.rawLog(qrcode);
4886
4901
  await (0, import_open2.default)(signinUrl);
4887
- Logger.rawLog(import_chalk2.default.dim("Opening browser..."));
4902
+ Logger.rawLog(import_chalk4.default.dim("Opening browser..."));
4888
4903
  } catch {
4889
- 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."));
4890
4905
  }
4891
- Logger.rawLog(import_chalk2.default.dim("Waiting for authentication..."));
4906
+ Logger.rawLog(import_chalk4.default.dim("Waiting for authentication..."));
4892
4907
  const MAX_RETRY = 300;
4893
4908
  for (let i = 0; i < MAX_RETRY; i++) {
4894
4909
  const res = await fetch(`${akanCloudBackendUrl}/user/getRemoteAuthToken/${remoteId}`);
@@ -4896,37 +4911,37 @@ ${import_chalk2.default.green("\u27A4")} Authentication Required`));
4896
4911
  const self2 = jwt ? await getSelf(jwt) : null;
4897
4912
  if (jwt && self2) {
4898
4913
  setHostConfig(akanCloudHost, { auth: { token: jwt, self: self2 } });
4899
- Logger.rawLog(import_chalk2.default.green(`\r\u2713 Authentication successful!`));
4900
- 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(`
4901
4916
  \u2728 Welcome aboard, ${self2.nickname}!`));
4902
- 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"));
4903
4918
  return true;
4904
4919
  }
4905
4920
  await sleep(2e3);
4906
4921
  }
4907
- 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."));
4908
4923
  }
4909
4924
  logout() {
4910
4925
  const config = getHostConfig();
4911
4926
  if (config.auth) {
4912
4927
  setHostConfig(akanCloudHost, {});
4913
- Logger.rawLog(import_chalk2.default.magenta.bold(`
4928
+ Logger.rawLog(import_chalk4.default.magenta.bold(`
4914
4929
  \u{1F44B} Goodbye, ${config.auth.self.nickname}!`));
4915
- 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"));
4916
- Logger.rawLog(import_chalk2.default.cyan("You have been successfully logged out."));
4917
- 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"));
4918
4933
  } else {
4919
- Logger.rawLog(import_chalk2.default.yellow.bold("\n\u26A0\uFE0F No active session found"));
4920
- 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"));
4921
4936
  }
4922
4937
  }
4923
4938
  async setLlm() {
4924
4939
  await AiSession.init({ useExisting: true });
4925
- Logger.rawLog(import_chalk2.default.green("LLM model set successfully"));
4940
+ Logger.rawLog(import_chalk4.default.green("LLM model set successfully"));
4926
4941
  }
4927
4942
  resetLlm() {
4928
4943
  AiSession.setLlmConfig(null);
4929
- Logger.rawLog(import_chalk2.default.green("LLM model reset successfully"));
4944
+ Logger.rawLog(import_chalk4.default.green("LLM model reset successfully"));
4930
4945
  }
4931
4946
  async getAkanPkgs(workspace) {
4932
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.91",
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>;