@akanjs/cli 0.0.141 → 0.0.143

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.
package/esm/index.js CHANGED
@@ -967,6 +967,7 @@ var execEmoji = {
967
967
  lib: "\u{1F527}",
968
968
  pkg: "\u{1F4E6}",
969
969
  dist: "\u{1F4BF}",
970
+ module: "\u2699\uFE0F",
970
971
  default: "\u2708\uFE0F"
971
972
  // for sys executor
972
973
  };
@@ -1741,6 +1742,17 @@ var PkgExecutor = class _PkgExecutor extends Executor {
1741
1742
  return pkgScanResult;
1742
1743
  }
1743
1744
  };
1745
+ var ModuleExecutor = class _ModuleExecutor extends Executor {
1746
+ sys;
1747
+ emoji = execEmoji.module;
1748
+ constructor({ sys: sys2, name }) {
1749
+ super(name, `${sys2.workspace.workspaceRoot}/${sys2.type}s/${sys2.name}/lib/${name}`);
1750
+ this.sys = sys2;
1751
+ }
1752
+ static from(sysExecutor, name) {
1753
+ return new _ModuleExecutor({ sys: sysExecutor, name });
1754
+ }
1755
+ };
1744
1756
 
1745
1757
  // pkgs/@akanjs/devkit/src/constants.ts
1746
1758
  import { homedir } from "os";
@@ -2091,6 +2103,7 @@ var Lib = createArgMetaDecorator("Lib");
2091
2103
  var Sys = createArgMetaDecorator("Sys");
2092
2104
  var Exec = createArgMetaDecorator("Exec");
2093
2105
  var Pkg = createArgMetaDecorator("Pkg");
2106
+ var Module = createArgMetaDecorator("Module");
2094
2107
  var Workspace = createArgMetaDecorator("Workspace");
2095
2108
 
2096
2109
  // pkgs/@akanjs/devkit/src/commandDecorators/commandMeta.ts
@@ -2271,6 +2284,38 @@ var getInternalArgumentValue = async (argMeta, value, workspace) => {
2271
2284
  return PkgExecutor.from(workspace, value);
2272
2285
  const pkgName = await select2({ message: `Select the ${sysType} name`, choices: pkgs });
2273
2286
  return PkgExecutor.from(workspace, pkgName);
2287
+ } else if (sysType === "module") {
2288
+ if (value) {
2289
+ const [sysName, moduleName2] = value.split(":");
2290
+ if (appNames.includes(sysName)) {
2291
+ const app = AppExecutor.from(workspace, sysName);
2292
+ const modules2 = await app.getModules();
2293
+ if (modules2.includes(moduleName2))
2294
+ return ModuleExecutor.from(app, moduleName2);
2295
+ else
2296
+ throw new Error(`Invalid module name: ${moduleName2}`);
2297
+ } else if (libNames.includes(sysName)) {
2298
+ const lib = LibExecutor.from(workspace, sysName);
2299
+ const modules2 = await lib.getModules();
2300
+ if (modules2.includes(moduleName2))
2301
+ return ModuleExecutor.from(lib, moduleName2);
2302
+ } else
2303
+ throw new Error(`Invalid system name: ${sysName}`);
2304
+ }
2305
+ const { type, name } = await select2({
2306
+ message: `select the App or Lib name`,
2307
+ choices: [
2308
+ ...appNames.map((name2) => ({ name: name2, value: { type: "app", name: name2 } })),
2309
+ ...libNames.map((name2) => ({ name: name2, value: { type: "lib", name: name2 } }))
2310
+ ]
2311
+ });
2312
+ const executor = type === "app" ? AppExecutor.from(workspace, name) : LibExecutor.from(workspace, name);
2313
+ const modules = await executor.getModules();
2314
+ const moduleName = await select2({
2315
+ message: `Select the module name`,
2316
+ choices: modules.map((name2) => ({ name: `${executor.name}:${name2}`, value: name2 }))
2317
+ });
2318
+ return ModuleExecutor.from(executor, moduleName);
2274
2319
  } else
2275
2320
  throw new Error(`Invalid system type: ${argMeta.type}`);
2276
2321
  };
@@ -2302,11 +2347,18 @@ var runCommands = async (...commands) => {
2302
2347
  programCommand = handleArgument(programCommand, argMeta);
2303
2348
  else if (argMeta.type === "Workspace")
2304
2349
  continue;
2305
- const sysType = argMeta.type.toLowerCase();
2306
- programCommand = programCommand.argument(
2307
- `[${sysType}]`,
2308
- `${sysType} in this workspace ${sysType}s/<${sysType}Name>`
2309
- );
2350
+ else if (argMeta.type === "Module") {
2351
+ programCommand = programCommand.argument(
2352
+ `[sys-name:module-name]`,
2353
+ `${argMeta.type} in this workspace (apps|libs)/<sys-name>/lib/<module-name>`
2354
+ );
2355
+ } else {
2356
+ const sysType = argMeta.type.toLowerCase();
2357
+ programCommand = programCommand.argument(
2358
+ `[${sysType}]`,
2359
+ `${sysType} in this workspace ${sysType}s/<${sysType}Name>`
2360
+ );
2361
+ }
2310
2362
  }
2311
2363
  programCommand = programCommand.option(`-v, --verbose [boolean]`, `verbose output`);
2312
2364
  programCommand.action(async (...args) => {
@@ -2424,8 +2476,10 @@ var AiSession = class _AiSession {
2424
2476
  Logger.raw(chunk);
2425
2477
  }
2426
2478
  } = {}) {
2427
- if (!_AiSession.#chat)
2479
+ if (!_AiSession.#chat) {
2480
+ Logger.rawLog(chalk3.yellow("\u{1F916}akan-editor is not initialized. LLM configuration should be set first."));
2428
2481
  await _AiSession.init();
2482
+ }
2429
2483
  if (!_AiSession.#chat)
2430
2484
  throw new Error("Failed to initialize the AI session");
2431
2485
  const loader = new Spinner(`${_AiSession.#chat.model} is thinking...`, {
@@ -5511,7 +5565,6 @@ var CloudScript = class {
5511
5565
  this.#runner.resetLlm();
5512
5566
  }
5513
5567
  async ask(question, workspace) {
5514
- await AiSession.init();
5515
5568
  const session = new AiSession();
5516
5569
  await session.ask(question);
5517
5570
  }
@@ -5643,9 +5696,6 @@ LibraryCommand = __decorateClass([
5643
5696
  Commands()
5644
5697
  ], LibraryCommand);
5645
5698
 
5646
- // pkgs/@akanjs/cli/src/module/module.command.ts
5647
- import { select as select4 } from "@inquirer/prompts";
5648
-
5649
5699
  // pkgs/@akanjs/cli/src/module/module.script.ts
5650
5700
  import fs12 from "fs";
5651
5701
 
@@ -5960,8 +6010,8 @@ var requestUnit = ({
5960
6010
  var ModuleRunner = class {
5961
6011
  async createModule(workspace, sysType, sysName, moduleName, description) {
5962
6012
  }
5963
- removeModule(sys2, name) {
5964
- sys2.removeDir(`${sys2.cwdPath}/lib/${name}`);
6013
+ removeModule(module) {
6014
+ module.sys.removeDir(`lib/${module.name}`);
5965
6015
  }
5966
6016
  async createScalarTemplate(sys2, name) {
5967
6017
  const akanConfig = await sys2.getConfig();
@@ -6003,20 +6053,20 @@ var ModuleRunner = class {
6003
6053
  dictionary: { filename: `${name}.dictionary.ts`, content: sys2.readFile(`lib/${name}/${name}.dictionary.ts`) }
6004
6054
  };
6005
6055
  }
6006
- async createComponentTemplate(sys2, name, type) {
6007
- const akanConfig = await sys2.getConfig();
6008
- const scanResult = await sys2.scan({ akanConfig });
6009
- await sys2.applyTemplate({
6010
- basePath: `./lib/${name}`,
6011
- template: `module/__Model__.${capitalize(type)}.ts`,
6056
+ async createComponentTemplate(module, type) {
6057
+ const akanConfig = await module.sys.getConfig();
6058
+ const scanResult = await module.sys.scan({ akanConfig });
6059
+ await module.sys.applyTemplate({
6060
+ basePath: `./lib/${module.name}`,
6061
+ template: `module/${capitalize(module.name)}.${capitalize(type)}.ts`,
6012
6062
  scanResult,
6013
- dict: { model: name, Model: capitalize(name), appName: sys2.name }
6063
+ dict: { model: module.name, Model: capitalize(module.name), appName: module.sys.name }
6014
6064
  });
6015
- await sys2.scan({ akanConfig });
6065
+ await module.sys.scan({ akanConfig });
6016
6066
  return {
6017
6067
  component: {
6018
- filename: `${name}.${capitalize(type)}.tsx`,
6019
- content: sys2.readFile(`lib/${name}/${capitalize(name)}.${capitalize(type)}.tsx`)
6068
+ filename: `${module.name}.${capitalize(type)}.tsx`,
6069
+ content: module.sys.readFile(`lib/${module.name}/${capitalize(module.name)}.${capitalize(type)}.tsx`)
6020
6070
  }
6021
6071
  // constant: {
6022
6072
  // filename: `${name}.constant.ts`,
@@ -6028,65 +6078,68 @@ var ModuleRunner = class {
6028
6078
  // },
6029
6079
  };
6030
6080
  }
6031
- async createModuleTemplate(sys2, name) {
6032
- const akanConfig = await sys2.getConfig();
6033
- const scanResult = await sys2.scan({ akanConfig });
6034
- const names = pluralize(name);
6035
- await sys2.applyTemplate({
6036
- basePath: `./lib/${name}`,
6081
+ async createModuleTemplate(module) {
6082
+ const akanConfig = await module.sys.getConfig();
6083
+ const scanResult = await module.sys.scan({ akanConfig });
6084
+ const names = pluralize(module.name);
6085
+ await module.applyTemplate({
6086
+ basePath: `.`,
6037
6087
  template: "module",
6038
6088
  scanResult,
6039
6089
  dict: {
6040
- model: name,
6041
- Model: capitalize(name),
6090
+ model: module.name,
6091
+ Model: capitalize(module.name),
6042
6092
  models: names,
6043
6093
  Models: capitalize(names),
6044
- sysName: sys2.name,
6045
- SysName: capitalize(sys2.name)
6094
+ sysName: module.sys.name,
6095
+ SysName: capitalize(module.sys.name)
6046
6096
  }
6047
6097
  });
6048
- await sys2.scan({ akanConfig });
6098
+ await module.sys.scan({ akanConfig });
6049
6099
  return {
6050
- constant: { filename: `${name}.constant.ts`, content: sys2.readFile(`lib/${name}/${name}.constant.ts`) },
6100
+ constant: {
6101
+ filename: `${module.name}.constant.ts`,
6102
+ content: module.readFile(`${module.name}.constant.ts`)
6103
+ },
6051
6104
  dictionary: {
6052
- filename: `${name}.dictionary.ts`,
6053
- content: sys2.readFile(`lib/${name}/${name}.dictionary.ts`)
6105
+ filename: `${module.name}.dictionary.ts`,
6106
+ content: module.readFile(`${module.name}.dictionary.ts`)
6054
6107
  },
6055
6108
  service: {
6056
- filename: `${name}.service.ts`,
6057
- content: sys2.readFile(`lib/${name}/${name}.service.ts`)
6109
+ filename: `${module.name}.service.ts`,
6110
+ content: module.readFile(`${module.name}.service.ts`)
6058
6111
  },
6059
6112
  store: {
6060
- filename: `${name}.store.ts`,
6061
- content: sys2.readFile(`lib/${name}/${name}.store.ts`)
6113
+ filename: `${module.name}.store.ts`,
6114
+ content: module.readFile(`${module.name}.store.ts`)
6062
6115
  },
6063
6116
  signal: {
6064
- filename: `${name}.signal.ts`,
6065
- content: sys2.readFile(`lib/${name}/${name}.signal.spec.ts`)
6117
+ filename: `${module.name}.signal.ts`,
6118
+ content: module.readFile(`${module.name}.signal.spec.ts`)
6066
6119
  },
6067
6120
  test: {
6068
- filename: `${name}.test.ts`,
6069
- content: sys2.readFile(`lib/${name}/${name}.signal.test.ts`)
6121
+ filename: `${module.name}.test.ts`,
6122
+ content: module.readFile(`${module.name}.signal.test.ts`)
6070
6123
  },
6071
6124
  unit: {
6072
- filename: `${name}.Unit.tsx`,
6073
- content: sys2.readFile(`lib/${name}/${name}.Unit.tsx`)
6125
+ filename: `${module.name}.Unit.tsx`,
6126
+ content: module.readFile(`${module.name}.Unit.tsx`)
6074
6127
  },
6075
6128
  view: {
6076
- filename: `${name}.View.tsx`,
6077
- content: sys2.readFile(`lib/${name}/${name}.View.tsx`)
6129
+ filename: `${module.name}.View.tsx`,
6130
+ content: module.readFile(`${module.name}.View.tsx`)
6078
6131
  },
6079
6132
  template: {
6080
- filename: `${name}.Template.tsx`,
6081
- content: sys2.readFile(`lib/${name}/${name}.Template.tsx`)
6133
+ filename: `${module.name}.Template.tsx`,
6134
+ content: module.readFile(`${module.name}.Template.tsx`)
6082
6135
  },
6083
6136
  zone: {
6084
- filename: `${name}.Zone.tsx`,
6085
- content: sys2.readFile(`lib/${name}/${name}.Zone.tsx`)
6137
+ filename: `${module.name}.Zone.tsx`,
6138
+ content: module.readFile(`${module.name}.Zone.tsx`)
6086
6139
  },
6087
6140
  util: {
6088
- filename: `${name}.Util.tsx`,
6089
- content: sys2.readFile(`lib/${name}/${name}.Util.tsx`)
6141
+ filename: `${module.name}.Util.tsx`,
6142
+ content: module.readFile(`${module.name}.Util.tsx`)
6090
6143
  }
6091
6144
  };
6092
6145
  }
@@ -6095,17 +6148,17 @@ var ModuleRunner = class {
6095
6148
  // pkgs/@akanjs/cli/src/module/module.script.ts
6096
6149
  var ModuleScript = class {
6097
6150
  #runner = new ModuleRunner();
6098
- //! .command arg에 병합 필요.
6099
- async createModuleTemplate(sys2, name, description) {
6100
- await this.#runner.createModuleTemplate(sys2, name);
6151
+ async createModuleTemplate(sys2, name) {
6152
+ const executor = ModuleExecutor.from(sys2, name);
6153
+ await this.#runner.createModuleTemplate(executor);
6101
6154
  }
6102
6155
  async createModule(sys2, name, description, schemaDescription) {
6103
- await AiSession.init();
6104
6156
  const session = new AiSession();
6105
6157
  const [appNames, libNames] = await sys2.workspace.getSyss();
6106
6158
  const moduleConstantExampleFiles = await sys2.workspace.getConstantFiles();
6107
6159
  const moduleDictionaryExampleFiles = await sys2.workspace.getDictionaryFiles();
6108
- const { constant, dictionary } = await this.#runner.createModuleTemplate(sys2, name);
6160
+ const executor = ModuleExecutor.from(sys2, name);
6161
+ const { constant, dictionary } = await this.#runner.createModuleTemplate(executor);
6109
6162
  sys2.log(`Module ${name} created in ${sys2.type}s/${sys2.name}/lib/${name}`);
6110
6163
  const constantContent = await session.editTypescript(
6111
6164
  requestConstant({
@@ -6130,28 +6183,27 @@ var ModuleScript = class {
6130
6183
  })
6131
6184
  );
6132
6185
  sys2.writeFile(`lib/${name}/${name}.dictionary.ts`, dictionaryContent);
6133
- await this.createView(sys2, name);
6134
- await this.createUnit(sys2, name);
6135
- await this.createTemplate(sys2, name);
6186
+ await this.createView(executor);
6187
+ await this.createUnit(executor);
6188
+ await this.createTemplate(executor);
6136
6189
  sys2.log(`Module ${name} created in ${sys2.type}s/${sys2.name}/lib/${name}`);
6137
6190
  }
6138
6191
  async createModule_(sys2, name, description, schemaDescription) {
6139
- await AiSession.init();
6140
6192
  const session = new AiSession();
6141
6193
  const [appNames, libNames] = await sys2.workspace.getSyss();
6142
6194
  const moduleConstantExampleFiles = await sys2.workspace.getConstantFiles();
6143
6195
  const moduleDictionaryExampleFiles = await sys2.workspace.getDictionaryFiles();
6196
+ const executor = ModuleExecutor.from(sys2, name);
6144
6197
  sys2.log(`Module ${name} created in ${sys2.type}s/${sys2.name}/lib/${name}`);
6145
- await this.createView(sys2, name);
6146
- await this.createUnit(sys2, name);
6147
- await this.createTemplate(sys2, name);
6198
+ await this.createView(executor);
6199
+ await this.createUnit(executor);
6200
+ await this.createTemplate(executor);
6148
6201
  sys2.log(`Module ${name} created in ${sys2.type}s/${sys2.name}/lib/${name}`);
6149
6202
  }
6150
- removeModule(sys2, name) {
6151
- this.#runner.removeModule(sys2, name);
6203
+ removeModule(module) {
6204
+ this.#runner.removeModule(module);
6152
6205
  }
6153
6206
  async createScalar(sys2, name, description, schemaDescription) {
6154
- await AiSession.init();
6155
6207
  const scalarConstantExampleFiles = await sys2.workspace.getScalarConstantFiles();
6156
6208
  const { constant, dictionary } = await this.#runner.createScalarTemplate(sys2, name);
6157
6209
  const session = new AiSession();
@@ -6171,19 +6223,18 @@ var ModuleScript = class {
6171
6223
  }
6172
6224
  async createTest(workspace, name) {
6173
6225
  }
6174
- async createTemplate(sys2, name) {
6175
- await AiSession.init();
6176
- const { component: template } = await this.#runner.createComponentTemplate(sys2, name, "template");
6177
- const templateExampleFiles = (await sys2.getTemplatesSourceCode()).filter(
6178
- (f) => !f.filepath.includes(`${name}.Template.tsx`)
6226
+ async createTemplate(module) {
6227
+ const { component: template } = await this.#runner.createComponentTemplate(module, "template");
6228
+ const templateExampleFiles = (await module.sys.getTemplatesSourceCode()).filter(
6229
+ (f) => !f.filepath.includes(`${module.name}.Template.tsx`)
6179
6230
  );
6180
- const Name = capitalize(name);
6181
- const relatedCnsts = getRelatedCnsts(`${sys2.cwdPath}/lib/${name}/${name}.constant.ts`);
6182
- const constant = fs12.readFileSync(`${sys2.cwdPath}/lib/${name}/${name}.constant.ts`, "utf-8");
6231
+ const Name = capitalize(module.name);
6232
+ const relatedCnsts = getRelatedCnsts(`${module.sys.cwdPath}/lib/${module.name}/${module.name}.constant.ts`);
6233
+ const constant = fs12.readFileSync(`${module.sys.cwdPath}/lib/${module.name}/${module.name}.constant.ts`, "utf-8");
6183
6234
  const session = new AiSession();
6184
6235
  const promptRst = requestTemplate({
6185
- sysName: sys2.name,
6186
- modelName: name,
6236
+ sysName: module.sys.name,
6237
+ modelName: module.name,
6187
6238
  ModelName: Name,
6188
6239
  constant,
6189
6240
  boilerplate: template.content,
@@ -6191,19 +6242,20 @@ var ModuleScript = class {
6191
6242
  exampleFiles: randomPicks(templateExampleFiles, Math.min(20, templateExampleFiles.length))
6192
6243
  });
6193
6244
  const content = await session.editTypescript(promptRst);
6194
- sys2.writeFile(`lib/${name}/${Name}.Template.tsx`, content);
6195
- }
6196
- async createUnit(sys2, name) {
6197
- await AiSession.init();
6198
- const { component: unit } = await this.#runner.createComponentTemplate(sys2, name, "unit");
6199
- const Name = capitalize(name);
6200
- const unitExampleFiles = (await sys2.getUnitsSourceCode()).filter((f) => !f.filepath.includes(`${name}.Unit.tsx`));
6201
- const relatedCnsts = getRelatedCnsts(`${sys2.cwdPath}/lib/${name}/${name}.constant.ts`);
6202
- const constant = fs12.readFileSync(`${sys2.cwdPath}/lib/${name}/${name}.constant.ts`, "utf-8");
6245
+ module.writeFile(`${Name}.Template.tsx`, content);
6246
+ }
6247
+ async createUnit(module) {
6248
+ const { component: unit } = await this.#runner.createComponentTemplate(module, "unit");
6249
+ const Name = capitalize(module.name);
6250
+ const unitExampleFiles = (await module.sys.getUnitsSourceCode()).filter(
6251
+ (f) => !f.filepath.includes(`${module.name}.Unit.tsx`)
6252
+ );
6253
+ const relatedCnsts = getRelatedCnsts(`${module.sys.cwdPath}/lib/${module.name}/${module.name}.constant.ts`);
6254
+ const constant = fs12.readFileSync(`${module.sys.cwdPath}/lib/${module.name}/${module.name}.constant.ts`, "utf-8");
6203
6255
  const session = new AiSession();
6204
6256
  const promptRst = requestUnit({
6205
- sysName: sys2.name,
6206
- modelName: name,
6257
+ sysName: module.sys.name,
6258
+ modelName: module.name,
6207
6259
  ModelName: Name,
6208
6260
  constant,
6209
6261
  properties: relatedCnsts.map((r) => ({ key: r.key, source: r.source })),
@@ -6211,19 +6263,20 @@ var ModuleScript = class {
6211
6263
  boilerplate: unit.content
6212
6264
  });
6213
6265
  const content = await session.editTypescript(promptRst);
6214
- sys2.writeFile(`lib/${name}/${Name}.Unit.tsx`, content);
6215
- }
6216
- async createView(sys2, name) {
6217
- await AiSession.init();
6218
- const { component: view } = await this.#runner.createComponentTemplate(sys2, name, "view");
6219
- const viewExampleFiles = (await sys2.getViewsSourceCode()).filter((f) => !f.filepath.includes(`${name}.View.tsx`));
6220
- const Name = capitalize(name);
6221
- const relatedCnsts = getRelatedCnsts(`${sys2.cwdPath}/lib/${name}/${name}.constant.ts`);
6222
- const constant = fs12.readFileSync(`${sys2.cwdPath}/lib/${name}/${name}.constant.ts`, "utf-8");
6266
+ module.writeFile(`${Name}.Unit.tsx`, content);
6267
+ }
6268
+ async createView(module) {
6269
+ const { component: view } = await this.#runner.createComponentTemplate(module, "view");
6270
+ const viewExampleFiles = (await module.sys.getViewsSourceCode()).filter(
6271
+ (f) => !f.filepath.includes(`${module.name}.View.tsx`)
6272
+ );
6273
+ const Name = capitalize(module.name);
6274
+ const relatedCnsts = getRelatedCnsts(`${module.sys.cwdPath}/lib/${module.name}/${module.name}.constant.ts`);
6275
+ const constant = fs12.readFileSync(`${module.sys.cwdPath}/lib/${module.name}/${module.name}.constant.ts`, "utf-8");
6223
6276
  const session = new AiSession();
6224
6277
  const promptRst = requestView({
6225
- sysName: sys2.name,
6226
- modelName: name,
6278
+ sysName: module.sys.name,
6279
+ modelName: module.name,
6227
6280
  ModelName: Name,
6228
6281
  constant,
6229
6282
  boilerplate: view.content,
@@ -6231,25 +6284,14 @@ var ModuleScript = class {
6231
6284
  exampleFiles: randomPicks(viewExampleFiles, Math.min(20, viewExampleFiles.length))
6232
6285
  });
6233
6286
  const content = await session.editTypescript(promptRst);
6234
- sys2.writeFile(`lib/${name}/${Name}.View.tsx`, content);
6287
+ module.writeFile(`${Name}.View.tsx`, content);
6235
6288
  }
6236
6289
  };
6237
6290
 
6238
6291
  // pkgs/@akanjs/cli/src/module/module.command.ts
6239
6292
  var ModuleCommand = class {
6240
6293
  moduleScript = new ModuleScript();
6241
- async selectLib(sys2) {
6242
- const libs = await sys2.getModules();
6243
- const lib = await select4({
6244
- message: "Select the lib",
6245
- choices: libs.map((l) => `${sys2.name}/${l}`)
6246
- }).catch((e) => {
6247
- Logger.error("canceled");
6248
- return null;
6249
- });
6250
- return lib?.split("/").pop();
6251
- }
6252
- async createModule(sys2, moduleName, description, schemaDescription, ai, workspace) {
6294
+ async createModule(sys2, moduleName, description, schemaDescription, ai) {
6253
6295
  const name = lowerlize(moduleName.replace(/ /g, ""));
6254
6296
  if (ai) {
6255
6297
  await this.moduleScript.createModule(sys2, name, description, schemaDescription);
@@ -6257,32 +6299,20 @@ var ModuleCommand = class {
6257
6299
  await this.moduleScript.createModuleTemplate(sys2, name);
6258
6300
  }
6259
6301
  }
6260
- async removeModule(sys2, workspace) {
6261
- const name = await this.selectLib(sys2);
6262
- if (!name)
6263
- return;
6264
- this.moduleScript.removeModule(sys2, name);
6302
+ removeModule(module) {
6303
+ this.moduleScript.removeModule(module);
6265
6304
  }
6266
- async createScalar(sys2, scalarName, description, schemaDescription, workspace) {
6305
+ async createScalar(sys2, scalarName, description, schemaDescription) {
6267
6306
  await this.moduleScript.createScalar(sys2, lowerlize(scalarName.replace(/ /g, "")), description, schemaDescription);
6268
6307
  }
6269
- async createView(sys2, workspace) {
6270
- const name = await this.selectLib(sys2);
6271
- if (!name)
6272
- return;
6273
- await this.moduleScript.createView(sys2, name);
6308
+ async createView(module) {
6309
+ await this.moduleScript.createView(module);
6274
6310
  }
6275
- async createUnit(sys2, workspace) {
6276
- const name = await this.selectLib(sys2);
6277
- if (!name)
6278
- return;
6279
- await this.moduleScript.createUnit(sys2, name);
6311
+ async createUnit(module) {
6312
+ await this.moduleScript.createUnit(module);
6280
6313
  }
6281
- async createTemplate(sys2, workspace) {
6282
- const name = await this.selectLib(sys2);
6283
- if (!name)
6284
- return;
6285
- await this.moduleScript.createTemplate(sys2, name);
6314
+ async createTemplate(module) {
6315
+ await this.moduleScript.createTemplate(module);
6286
6316
  }
6287
6317
  };
6288
6318
  __decorateClass([
@@ -6291,36 +6321,30 @@ __decorateClass([
6291
6321
  __decorateParam(1, Argument("moduleName", { desc: "name of module" })),
6292
6322
  __decorateParam(2, Option("description", { desc: "description of module" })),
6293
6323
  __decorateParam(3, Option("schemaDescription", { desc: "schema description of module" })),
6294
- __decorateParam(4, Option("ai", { type: "boolean", default: false, desc: "use ai to create module" })),
6295
- __decorateParam(5, Workspace())
6324
+ __decorateParam(4, Option("ai", { type: "boolean", default: false, desc: "use ai to create module" }))
6296
6325
  ], ModuleCommand.prototype, "createModule", 1);
6297
6326
  __decorateClass([
6298
6327
  Target.Public(),
6299
- __decorateParam(0, Sys()),
6300
- __decorateParam(1, Workspace())
6328
+ __decorateParam(0, Module())
6301
6329
  ], ModuleCommand.prototype, "removeModule", 1);
6302
6330
  __decorateClass([
6303
6331
  Target.Public(),
6304
6332
  __decorateParam(0, Sys()),
6305
6333
  __decorateParam(1, Argument("scalarName", { desc: "name of scalar module" })),
6306
6334
  __decorateParam(2, Option("description", { desc: "description of scalar module" })),
6307
- __decorateParam(3, Option("schemaDescription", { desc: "schema description of scalar module" })),
6308
- __decorateParam(4, Workspace())
6335
+ __decorateParam(3, Option("schemaDescription", { desc: "schema description of scalar module" }))
6309
6336
  ], ModuleCommand.prototype, "createScalar", 1);
6310
6337
  __decorateClass([
6311
6338
  Target.Public(),
6312
- __decorateParam(0, Sys()),
6313
- __decorateParam(1, Workspace())
6339
+ __decorateParam(0, Module())
6314
6340
  ], ModuleCommand.prototype, "createView", 1);
6315
6341
  __decorateClass([
6316
6342
  Target.Public(),
6317
- __decorateParam(0, Sys()),
6318
- __decorateParam(1, Workspace())
6343
+ __decorateParam(0, Module())
6319
6344
  ], ModuleCommand.prototype, "createUnit", 1);
6320
6345
  __decorateClass([
6321
6346
  Target.Public(),
6322
- __decorateParam(0, Sys()),
6323
- __decorateParam(1, Workspace())
6347
+ __decorateParam(0, Module())
6324
6348
  ], ModuleCommand.prototype, "createTemplate", 1);
6325
6349
  ModuleCommand = __decorateClass([
6326
6350
  Commands()
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "sourceType": "module",
3
3
  "name": "@akanjs/cli",
4
- "version": "0.0.141",
4
+ "version": "0.0.143",
5
5
  "bin": {
6
6
  "akan": "cjs/index.js"
7
7
  },
@@ -1,12 +1,11 @@
1
- import { Sys, Workspace } from "@akanjs/devkit";
1
+ import { Module, Sys } from "@akanjs/devkit";
2
2
  import { ModuleScript } from "./module.script";
3
3
  export declare class ModuleCommand {
4
4
  moduleScript: ModuleScript;
5
- private selectLib;
6
- createModule(sys: Sys, moduleName: string, description: string, schemaDescription: string, ai: boolean, workspace: Workspace): Promise<void>;
7
- removeModule(sys: Sys, workspace: Workspace): Promise<void>;
8
- createScalar(sys: Sys, scalarName: string, description: string, schemaDescription: string, workspace: Workspace): Promise<void>;
9
- createView(sys: Sys, workspace: Workspace): Promise<void>;
10
- createUnit(sys: Sys, workspace: Workspace): Promise<void>;
11
- createTemplate(sys: Sys, workspace: Workspace): Promise<void>;
5
+ createModule(sys: Sys, moduleName: string, description: string, schemaDescription: string, ai: boolean): Promise<void>;
6
+ removeModule(module: Module): void;
7
+ createScalar(sys: Sys, scalarName: string, description: string, schemaDescription: string): Promise<void>;
8
+ createView(module: Module): Promise<void>;
9
+ createUnit(module: Module): Promise<void>;
10
+ createTemplate(module: Module): Promise<void>;
12
11
  }
@@ -1,7 +1,7 @@
1
- import { type Sys, Workspace } from "@akanjs/devkit";
1
+ import { type Module, type Sys, Workspace } from "@akanjs/devkit";
2
2
  export declare class ModuleRunner {
3
3
  createModule(workspace: Workspace, sysType: "app" | "lib", sysName: string, moduleName: string, description: string): Promise<void>;
4
- removeModule(sys: Sys, name: string): void;
4
+ removeModule(module: Module): void;
5
5
  createScalarTemplate(sys: Sys, name: string): Promise<{
6
6
  constant: {
7
7
  filename: string;
@@ -18,13 +18,13 @@ export declare class ModuleRunner {
18
18
  content: string;
19
19
  };
20
20
  }>;
21
- createComponentTemplate(sys: Sys, name: string, type: "unit" | "view" | "template" | "zone" | "util"): Promise<{
21
+ createComponentTemplate(module: Module, type: "unit" | "view" | "template" | "zone" | "util"): Promise<{
22
22
  component: {
23
23
  filename: string;
24
24
  content: string;
25
25
  };
26
26
  }>;
27
- createModuleTemplate(sys: Sys, name: string): Promise<{
27
+ createModuleTemplate(module: Module): Promise<{
28
28
  constant: {
29
29
  filename: string;
30
30
  content: string;
@@ -1,14 +1,14 @@
1
- import { type Sys, Workspace } from "@akanjs/devkit";
1
+ import { type Module, type Sys, Workspace } from "@akanjs/devkit";
2
2
  export declare class ModuleScript {
3
3
  #private;
4
- createModuleTemplate(sys: Sys, name: string, description?: string): Promise<void>;
4
+ createModuleTemplate(sys: Sys, name: string): Promise<void>;
5
5
  createModule(sys: Sys, name: string, description?: string, schemaDescription?: string): Promise<void>;
6
6
  createModule_(sys: Sys, name: string, description: string, schemaDescription: string): Promise<void>;
7
- removeModule(sys: Sys, name: string): void;
7
+ removeModule(module: Module): void;
8
8
  createScalar(sys: Sys, name: string, description: string, schemaDescription: string): Promise<void>;
9
9
  createService(workspace: Workspace, name: string): Promise<void>;
10
10
  createTest(workspace: Workspace, name: string): Promise<void>;
11
- createTemplate(sys: Sys, name: string): Promise<void>;
12
- createUnit(sys: Sys, name: string): Promise<void>;
13
- createView(sys: Sys, name: string): Promise<void>;
11
+ createTemplate(module: Module): Promise<void>;
12
+ createUnit(module: Module): Promise<void>;
13
+ createView(module: Module): Promise<void>;
14
14
  }