@akanjs/cli 3.0.0-beta.19 → 3.0.0-beta.20

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 (95) hide show
  1. package/.build-stamp +1 -1
  2. package/{CodeAgent-6cm97kay.js → CodeAgent-awv258wb.js} +2 -2
  3. package/{CodeTui-za4jsm41.js → CodeTui-1nqh35ez.js} +20 -22
  4. package/TunnelShare-scf4e4pd.js +9 -0
  5. package/{agent.command-e0wpbbyg.js → agent.command-1s9ag7sb.js} +8 -9
  6. package/akanCode.js +4 -4
  7. package/{application.command-8wyxqc8q.js → application.command-49hwy6va.js} +25 -56
  8. package/{applicationBuildRunner-n9gzaxd0.js → applicationBuildRunner-ybyp97pv.js} +33 -59
  9. package/{applicationReleasePackager-vpggfqgq.js → applicationReleasePackager-esnrphw8.js} +40 -60
  10. package/buildBatch.proc.js +19 -24
  11. package/{capacitorApp-q3z0qht0.js → capacitorApp-1synz4en.js} +3 -4
  12. package/{cloud.command-4zwa5dsx.js → cloud.command-d7rqtzt9.js} +16 -26
  13. package/cloud.script-bkbpcr96.js +19 -0
  14. package/{code.command-468c9d7s.js → code.command-nn48xzej.js} +22 -37
  15. package/context.command-s3mcmvpa.js +48 -0
  16. package/context.runner-k99nb5pk.js +21 -0
  17. package/{dependencyScanner-0z2h2tks.js → dependencyScanner-ye2e6pdz.js} +2 -2
  18. package/{devTui-ffjsarqa.js → devTui-q7k7bakd.js} +5 -9
  19. package/fileSys-5ngz93ga.js +9 -0
  20. package/{guideline.command-vhw13pqr.js → guideline.command-sct4qnt5.js} +4 -5
  21. package/guidelines/conventions/conventions.instruction.md +5 -1
  22. package/guidelines/mcpRule/mcpRule.instruction.md +7 -5
  23. package/incrementalBuilder.proc.js +30 -48
  24. package/{index-s5rhm04y.js → index-0bq14vr1.js} +1 -1
  25. package/{index-10dkrrww.js → index-13ffe9wp.js} +4 -4
  26. package/{index-srmay5jw.js → index-22d57v4c.js} +84 -67
  27. package/{index-53176s7j.js → index-31yr441d.js} +10 -17
  28. package/index-3hx1z96c.js +87 -0
  29. package/{index-4m929vvn.js → index-3sq321ak.js} +10 -18
  30. package/{index-bhtmj233.js → index-3t7g9e4r.js} +41 -78
  31. package/{index-q0y2jq9j.js → index-5b6tavv3.js} +6 -3
  32. package/{index-47pj3aee.js → index-5e0n4hqx.js} +11 -12
  33. package/{index-7ep8qtvp.js → index-5pc1qrbv.js} +5 -8
  34. package/{index-esk82rvk.js → index-8mna0947.js} +34 -71
  35. package/{index-sq2dzkzm.js → index-8sf7wmdr.js} +6 -6
  36. package/{index-crmeqnmf.js → index-9d9bgcx4.js} +283 -722
  37. package/{index-bwf965h6.js → index-ahemdr5n.js} +6 -6
  38. package/{index-ab0c38ea.js → index-as7xmyz8.js} +20 -20
  39. package/{index-bc88j1ry.js → index-axzjaqve.js} +94 -142
  40. package/{index-3d9y066c.js → index-bjwxs904.js} +9 -8
  41. package/{index-667w0yah.js → index-c6eggbee.js} +2 -5
  42. package/{index-a1w6934z.js → index-ddxvdd1p.js} +169 -305
  43. package/{index-92zztqy1.js → index-dy0jx9ay.js} +2 -17
  44. package/{index-22xtgmhn.js → index-dzf3r49a.js} +1 -1
  45. package/{index-89hy31kf.js → index-fgq75haa.js} +172 -287
  46. package/{index-by5gpp8x.js → index-hj6w4ka1.js} +2 -1
  47. package/{index-hwkygn9s.js → index-khpfpcsd.js} +302 -33
  48. package/{index-vqx8bdxz.js → index-mxav6j3c.js} +78 -231
  49. package/{index-2446k7b4.js → index-myhc3c1j.js} +512 -588
  50. package/{index-3jrp517k.js → index-nv5976x3.js} +45 -128
  51. package/{index-zqgj2rt2.js → index-przybvy5.js} +69 -147
  52. package/{index-n3cv0tm4.js → index-smme4r47.js} +1 -1
  53. package/{index-qdgzsnhg.js → index-w2zdcw3k.js} +110 -231
  54. package/{index-14zrtgfa.js → index-wa5jbxj1.js} +6 -39
  55. package/{index-bftkz6cp.js → index-ww4z397j.js} +198 -555
  56. package/{index-kwaq3n9n.js → index-xqjwd384.js} +4 -7
  57. package/{index-txr7dj2g.js → index-xqpzbab5.js} +106 -240
  58. package/{index-e4v6vhxq.js → index-xsjh6nzh.js} +178 -165
  59. package/{index-18zybgkc.js → index-ygn77a5w.js} +47 -99
  60. package/{index-9d6nvkz2.js → index-ztp3e73t.js} +79 -35
  61. package/index.js +23 -24
  62. package/{library.command-cqr175dy.js → library.command-1gx04jgn.js} +4 -5
  63. package/{localRegistry.command-49z55qqz.js → localRegistry.command-zndxj1q6.js} +21 -42
  64. package/{module.command-9p8mm3b0.js → module.command-3waddk95.js} +6 -7
  65. package/{package.command-wxyz909t.js → package.command-zrc7br1y.js} +5 -6
  66. package/package.json +2 -2
  67. package/{page.command-gsrsfqqs.js → page.command-vpjgardh.js} +4 -5
  68. package/{primitive.command-ns1mptje.js → primitive.command-sz84tk4t.js} +9 -20
  69. package/{prompter-1f8d9pcc.js → prompter-ptaa3nk0.js} +2 -2
  70. package/{quality.command-e76k2q9k.js → quality.command-g869hafs.js} +129 -363
  71. package/{recipeScanner-fpagtgc1.js → recipeScanner-4b69ybe0.js} +1 -1
  72. package/{repair.command-pkrsm3cw.js → repair.command-chsnjvvv.js} +11 -35
  73. package/{scalar.command-0cpt3fc8.js → scalar.command-2v21newx.js} +5 -6
  74. package/skills/akan-code/SKILL.md +12 -4
  75. package/{subspace.command-fktpwp0g.js → subspace.command-ckcbwfp1.js} +39 -58
  76. package/templates/appSample/srvkit/{AuthGuard.ts → guards.ts} +3 -3
  77. package/templates/appSample/srvkit/{SessionInternalArg.ts → internalArgs.ts} +3 -3
  78. package/templates/client.ts +7 -30
  79. package/templates/lib/__lib/lib.dictionary.ts +0 -2
  80. package/templates/lib/__lib/lib.document.ts +0 -2
  81. package/templates/lib/sig.ts +8 -30
  82. package/templates/server.ts +0 -2
  83. package/{tunnel.command-d5jy9gk8.js → tunnel.command-kd2yr4fx.js} +5 -6
  84. package/{typeChecker-3xgrzc2v.js → typeChecker-px49mezc.js} +1 -1
  85. package/typecheck.proc.js +1 -1
  86. package/workflow.command-44252cqv.js +79 -0
  87. package/{workspace.command-gv84eh1p.js → workspace.command-fqcztt5p.js} +72 -107
  88. package/TunnelShare-2j6s511d.js +0 -9
  89. package/cloud.script-fwx3vb34.js +0 -20
  90. package/context.command-dsnw0jby.js +0 -80
  91. package/context.runner-rs4rj15d.js +0 -22
  92. package/devTuiView-1q1mdgrv.js +0 -9
  93. package/getDirname-dr3jz1xg.js +0 -7
  94. package/index-6wwzs1bc.js +0 -7
  95. package/workflow.command-6tkcysmx.js +0 -105
@@ -2,12 +2,12 @@
2
2
  import {
3
3
  runner,
4
4
  script
5
- } from "./index-qdgzsnhg.js";
5
+ } from "./index-w2zdcw3k.js";
6
6
  import {
7
7
  generatedFilesForSync,
8
8
  createPassedPrimitiveReport,
9
9
  scalarChangedFiles
10
- } from "./index-2446k7b4.js";
10
+ } from "./index-myhc3c1j.js";
11
11
  import {
12
12
  pluralizeName
13
13
  } from "./index-nz8prx9g.js";
@@ -21,23 +21,15 @@ class ScalarRunner extends runner("scalar") {
21
21
  dict: { model: scalarName, models: pluralizeName(scalarName), sysName: sys.name },
22
22
  overwrite: false
23
23
  });
24
+ const read = async (suffix) => {
25
+ const filename = `${scalarName}.${suffix}`;
26
+ return { filename, content: await sys.readFile(`lib/__scalar/${scalarName}/${filename}`) };
27
+ };
24
28
  return {
25
- abstract: {
26
- filename: `${scalarName}.abstract.md`,
27
- content: await sys.readFile(`lib/__scalar/${scalarName}/${scalarName}.abstract.md`)
28
- },
29
- constant: {
30
- filename: `${scalarName}.constant.ts`,
31
- content: await sys.readFile(`lib/__scalar/${scalarName}/${scalarName}.constant.ts`)
32
- },
33
- dictionary: {
34
- filename: `${scalarName}.dictionary.ts`,
35
- content: await sys.readFile(`lib/__scalar/${scalarName}/${scalarName}.dictionary.ts`)
36
- },
37
- document: {
38
- filename: `${scalarName}.document.ts`,
39
- content: await sys.readFile(`lib/__scalar/${scalarName}/${scalarName}.document.ts`)
40
- }
29
+ abstract: await read("abstract.md"),
30
+ constant: await read("constant.ts"),
31
+ dictionary: await read("dictionary.ts"),
32
+ document: await read("document.ts")
41
33
  };
42
34
  }
43
35
  }
@@ -1,7 +1,7 @@
1
1
  // @bun
2
2
  import {
3
- FileSys
4
- } from "./index-q0y2jq9j.js";
3
+ FileSys2
4
+ } from "./index-5b6tavv3.js";
5
5
 
6
6
  // pkgs/@akanjs/devkit/dependencyScanner.ts
7
7
  import { builtinModules } from "module";
@@ -57,24 +57,21 @@ class TypeScriptDependencyScanner2 {
57
57
  async getPackageBuildDependencies(projectName) {
58
58
  const runtimeDeps = new Set;
59
59
  const devDeps = new Set;
60
- const sourceFiles = await this.#findTypeScriptFiles(this.#directory, {
61
- excludeBuildFiles: true,
62
- excludeTestFiles: true
63
- });
64
- const cssFiles = await this.#findCssFiles(this.#directory);
60
+ const sourceFiles = await this.#findFiles("**/*.{ts,tsx}", { excludeBuildFiles: true, excludeTestFiles: true });
61
+ const cssFiles = await this.#findFiles("**/*.css");
65
62
  for (const filePath of sourceFiles) {
66
- const fileContent = await FileSys.readText(filePath);
63
+ const fileContent = await FileSys2.readText(filePath);
67
64
  const { imports, typeImports } = this.#extractImports(fileContent, filePath);
68
65
  this.#addNormalizedImports(runtimeDeps, imports, projectName);
69
66
  this.#addNormalizedImports(devDeps, typeImports, projectName);
70
67
  }
71
68
  for (const filePath of cssFiles) {
72
- const fileContent = await FileSys.readText(filePath);
69
+ const fileContent = await FileSys2.readText(filePath);
73
70
  this.#addNormalizedImports(runtimeDeps, this.#extractCssPluginImports(fileContent), projectName);
74
71
  }
75
72
  const buildFilePath = path.join(this.#directory, "build.ts");
76
- if (await FileSys.fileExists(buildFilePath)) {
77
- const fileContent = await FileSys.readText(buildFilePath);
73
+ if (await FileSys2.fileExists(buildFilePath)) {
74
+ const fileContent = await FileSys2.readText(buildFilePath);
78
75
  const { imports, typeImports } = this.#extractImports(fileContent, buildFilePath);
79
76
  this.#addNormalizedImports(devDeps, [...imports, ...typeImports], projectName);
80
77
  }
@@ -98,7 +95,7 @@ class TypeScriptDependencyScanner2 {
98
95
  if (!await Bun.file(packageJsonPath).exists())
99
96
  return false;
100
97
  try {
101
- const packageJson = await FileSys.readJson(packageJsonPath);
98
+ const packageJson = await FileSys2.readJson(packageJsonPath);
102
99
  return packageJson.name === dep && !!packageJson.version;
103
100
  } catch {
104
101
  return false;
@@ -109,27 +106,21 @@ class TypeScriptDependencyScanner2 {
109
106
  return this.#getImportSetsFromDependencies(depSets, fileDependencies);
110
107
  }
111
108
  #getImportSetsFromDependencies(depSets, fileDependencies) {
112
- const importedDepSets = new Array(depSets.length);
113
- for (let i = 0;i < depSets.length; i++)
114
- importedDepSets[i] = new Set;
115
- fileDependencies.forEach((imps) => {
116
- imps.forEach((imp) => {
109
+ const importedDepSets = depSets.map(() => new Set);
110
+ for (const imps of fileDependencies.values())
111
+ for (const imp of imps) {
117
112
  if (imp.startsWith("."))
118
- return;
119
- const moduleName = imp;
120
- const moduleNameParts = moduleName.split("/");
121
- const subModuleLength = moduleNameParts.length;
122
- for (let i = 0;i < subModuleLength; i++) {
123
- const importName = moduleNameParts.slice(0, i + 1).join("/");
124
- for (let j = 0;j < depSets.length; j++) {
125
- if (depSets[j]?.has(importName)) {
126
- importedDepSets[j]?.add(importName);
127
- return;
128
- }
129
- }
113
+ continue;
114
+ const parts = imp.split("/");
115
+ for (let length = 1;length <= parts.length; length++) {
116
+ const importName = parts.slice(0, length).join("/");
117
+ const setIndex = depSets.findIndex((depSet) => depSet.has(importName));
118
+ if (setIndex === -1)
119
+ continue;
120
+ importedDepSets[setIndex]?.add(importName);
121
+ break;
130
122
  }
131
- });
132
- });
123
+ }
133
124
  return importedDepSets;
134
125
  }
135
126
  async getDependencies() {
@@ -137,43 +128,25 @@ class TypeScriptDependencyScanner2 {
137
128
  this.#fileRuntimeDependencies.clear();
138
129
  this.#fileTypeDependencies.clear();
139
130
  this.#visitedFiles.clear();
140
- const files = await this.#findTypeScriptFiles(this.#directory);
141
- for (const file of files)
131
+ for (const file of await this.#findFiles("**/*.{ts,tsx}"))
142
132
  await this.#analyzeFile(file, this.#directory);
143
133
  return this.#fileDependencies;
144
134
  }
145
- async#findTypeScriptFiles(directory, {
135
+ async#findFiles(pattern, {
146
136
  excludeBuildFiles = false,
147
137
  excludeTestFiles = false
148
138
  } = {}) {
149
139
  const files = [];
150
- const glob = new Bun.Glob("**/*.{ts,tsx}");
151
- for await (const filePath of glob.scan({ cwd: directory, onlyFiles: true })) {
140
+ for await (const filePath of new Bun.Glob(pattern).scan({ cwd: this.#directory, onlyFiles: true })) {
152
141
  if (isSkippedPath(filePath))
153
142
  continue;
154
143
  if (excludeBuildFiles && filePath === "build.ts")
155
144
  continue;
156
145
  if (excludeTestFiles && testFileRegex.test(filePath))
157
146
  continue;
158
- const fullPath = path.join(directory, filePath);
159
- const relativePath = path.relative(this.#workspaceRoot, fullPath);
160
- if (this.#ig.ignores(relativePath))
161
- continue;
162
- files.push(fullPath);
163
- }
164
- return files;
165
- }
166
- async#findCssFiles(directory) {
167
- const files = [];
168
- const glob = new Bun.Glob("**/*.css");
169
- for await (const filePath of glob.scan({ cwd: directory, onlyFiles: true })) {
170
- if (isSkippedPath(filePath))
171
- continue;
172
- const fullPath = path.join(directory, filePath);
173
- const relativePath = path.relative(this.#workspaceRoot, fullPath);
174
- if (this.#ig.ignores(relativePath))
175
- continue;
176
- files.push(fullPath);
147
+ const fullPath = path.join(this.#directory, filePath);
148
+ if (!this.#ig.ignores(path.relative(this.#workspaceRoot, fullPath)))
149
+ files.push(fullPath);
177
150
  }
178
151
  return files;
179
152
  }
@@ -182,7 +155,7 @@ class TypeScriptDependencyScanner2 {
182
155
  return;
183
156
  this.#visitedFiles.add(filePath);
184
157
  try {
185
- const fileContent = await FileSys.readText(filePath);
158
+ const fileContent = await FileSys2.readText(filePath);
186
159
  const { imports, typeImports } = this.#extractImports(fileContent, filePath);
187
160
  const resolvedImports = await this.#resolveImports(imports, filePath, baseDir);
188
161
  const resolvedTypeImports = await this.#resolveImports(typeImports, filePath, baseDir);
@@ -194,19 +167,17 @@ class TypeScriptDependencyScanner2 {
194
167
  }
195
168
  async#resolveImports(imports, filePath, baseDir) {
196
169
  return await Promise.all(imports.map(async (importPath) => {
197
- if (importPath.startsWith(".")) {
198
- const resolvedPath = `./${path.join(path.relative(baseDir, filePath), importPath)}`;
199
- return await this.#ensureExtension(resolvedPath);
200
- }
201
- return importPath;
170
+ if (!importPath.startsWith("."))
171
+ return importPath;
172
+ return await this.#ensureExtension(`./${path.join(path.relative(baseDir, filePath), importPath)}`);
202
173
  }));
203
174
  }
204
175
  async#ensureExtension(filePath) {
205
- if (await FileSys.fileExists(`${filePath}.ts`))
176
+ if (await FileSys2.fileExists(`${filePath}.ts`))
206
177
  return `${filePath}.ts`;
207
- else if (await FileSys.fileExists(`${filePath}.tsx`))
178
+ else if (await FileSys2.fileExists(`${filePath}.tsx`))
208
179
  return `${filePath}.tsx`;
209
- else if (await FileSys.fileExists(filePath))
180
+ else if (await FileSys2.fileExists(filePath))
210
181
  return filePath;
211
182
  return `${filePath}.ts`;
212
183
  }
@@ -265,22 +236,14 @@ class TypeScriptDependencyScanner2 {
265
236
  `;
266
237
  const projectImports = imports.filter((i) => !i.startsWith("react") && !i.startsWith("@"));
267
238
  const externalImports = imports.filter((i) => i.startsWith("react") || i.startsWith("@"));
268
- if (projectImports.length > 0) {
239
+ if (projectImports.length > 0)
269
240
  graph += ` Project dependencies:
270
- `;
271
- projectImports.forEach((imp) => {
272
- graph += ` \u2192 ${imp}
273
- `;
274
- });
275
- }
276
- if (externalImports.length > 0) {
241
+ ${projectImports.map((imp) => ` \u2192 ${imp}
242
+ `).join("")}`;
243
+ if (externalImports.length > 0)
277
244
  graph += ` External dependencies:
278
- `;
279
- externalImports.forEach((imp) => {
280
- graph += ` \u2192 ${imp}
281
- `;
282
- });
283
- }
245
+ ${externalImports.map((imp) => ` \u2192 ${imp}
246
+ `).join("")}`;
284
247
  graph += `
285
248
  `;
286
249
  }
@@ -1,9 +1,12 @@
1
1
  // @bun
2
2
  // pkgs/@akanjs/devkit/fileSys.ts
3
3
  import { lstat, rename, rm, stat } from "fs/promises";
4
+ import nodePath from "path";
5
+ import { fileURLToPath } from "url";
4
6
  import { Logger } from "akanjs/common";
7
+ var getDirname2 = (url) => nodePath.dirname(fileURLToPath(url));
5
8
 
6
- class FileSys {
9
+ class FileSys2 {
7
10
  static logger = new Logger("FileSys");
8
11
  static async fileExists(path) {
9
12
  return await Bun.file(path).exists();
@@ -24,7 +27,7 @@ class FileSys {
24
27
  try {
25
28
  return await Bun.file(path).json();
26
29
  } catch (error) {
27
- FileSys.logger.error(`Failed to read JSON file: ${path}`);
30
+ FileSys2.logger.error(`Failed to read JSON file: ${path}`);
28
31
  throw error;
29
32
  }
30
33
  }
@@ -52,4 +55,4 @@ class FileSys {
52
55
  }
53
56
  }
54
57
 
55
- export { FileSys };
58
+ export { getDirname2, FileSys2 };
@@ -1,5 +1,6 @@
1
1
  // @bun
2
2
  // pkgs/@akanjs/devkit/mobile/mobileTarget.ts
3
+ var trimSlashes = (value) => value.replace(/^\/+|\/+$/g, "");
3
4
  var getMobileTargets = async (app) => {
4
5
  const config = await app.getConfig();
5
6
  return Object.entries(config.mobile.targets).map(([name, target]) => ({ name, config: target }));
@@ -9,12 +10,11 @@ var getMobileTargetChoices = async (app) => {
9
10
  const targetNames = Object.keys(config.mobile.targets);
10
11
  if (targetNames.length > 0)
11
12
  return targetNames;
12
- const basePaths = [...config.basePaths];
13
- return basePaths;
13
+ return [...config.basePaths];
14
14
  };
15
15
  var resolveMobileTargetByBasePath = (targets, basePath) => {
16
- const normalizedBasePath = basePath.replace(/^\/+|\/+$/g, "");
17
- const byBasePath = targets.find((target) => target.config.basePath?.replace(/^\/+|\/+$/g, "") === normalizedBasePath);
16
+ const normalizedBasePath = trimSlashes(basePath);
17
+ const byBasePath = targets.find(({ config }) => config.basePath !== undefined && trimSlashes(config.basePath) === normalizedBasePath);
18
18
  if (byBasePath)
19
19
  return byBasePath;
20
20
  const [template] = targets;
@@ -22,11 +22,7 @@ var resolveMobileTargetByBasePath = (targets, basePath) => {
22
22
  return;
23
23
  return {
24
24
  name: normalizedBasePath,
25
- config: {
26
- ...template.config,
27
- name: normalizedBasePath,
28
- basePath: normalizedBasePath
29
- }
25
+ config: { ...template.config, name: normalizedBasePath, basePath: normalizedBasePath }
30
26
  };
31
27
  };
32
28
  var resolveMobileTargets = async (app, selection) => {
@@ -58,13 +54,13 @@ var resolveMobileTargets = async (app, selection) => {
58
54
  if (target)
59
55
  return [target];
60
56
  const basePathTarget = resolveMobileTargetByBasePath(targets, selection);
61
- if (basePathTarget && config.basePaths.has(selection.replace(/^\/+|\/+$/g, "")))
57
+ if (basePathTarget && config.basePaths.has(trimSlashes(selection)))
62
58
  return [basePathTarget];
63
59
  const choices = await getMobileTargetChoices(app);
64
60
  throw new Error(`Mobile target '${selection}' was not found. Available: ${choices.join(", ")}`);
65
61
  };
66
62
  var resolveMobilePath = (target, pathname) => {
67
- const basePath = target.basePath?.replace(/^\/+|\/+$/g, "");
63
+ const basePath = trimSlashes(target.basePath ?? "");
68
64
  const normalizedPath = `/${pathname.replace(/^\/+/, "")}`;
69
65
  if (!basePath)
70
66
  return normalizedPath;
@@ -72,5 +68,8 @@ var resolveMobilePath = (target, pathname) => {
72
68
  return normalizedPath;
73
69
  return `/${basePath}${normalizedPath === "/" ? "" : normalizedPath}`;
74
70
  };
75
- var targetHtmlFilename = (target) => target.basePath?.replace(/^\/+|\/+$/g, "") ? `${target.basePath.replace(/^\/+|\/+$/g, "")}.html` : "index.html";
71
+ var targetHtmlFilename = (target) => {
72
+ const basePath = trimSlashes(target.basePath ?? "");
73
+ return basePath ? `${basePath}.html` : "index.html";
74
+ };
76
75
  export { getMobileTargets, getMobileTargetChoices, resolveMobileTargets, resolveMobilePath, targetHtmlFilename };
@@ -2,23 +2,21 @@
2
2
  import {
3
3
  runner,
4
4
  script
5
- } from "./index-qdgzsnhg.js";
5
+ } from "./index-w2zdcw3k.js";
6
6
  import {
7
7
  LibExecutor
8
- } from "./index-crmeqnmf.js";
8
+ } from "./index-9d9bgcx4.js";
9
9
  import {
10
10
  LibSource,
11
11
  formatLibStatuses
12
- } from "./index-3d9y066c.js";
12
+ } from "./index-bjwxs904.js";
13
13
 
14
14
  // pkgs/@akanjs/cli/library/library.script.ts
15
15
  import { Logger } from "akanjs/common";
16
16
 
17
17
  // pkgs/@akanjs/devkit/semver.ts
18
18
  var stripRangeOperator = (version) => version.replace(/^[\s^~>=<v]+/, "").trim();
19
- var parseVersion = (version) => {
20
- return version.replace(/^[^\d]*/, "").split(/[.-]/).map((part) => Number.parseInt(part, 10)).map((part) => Number.isFinite(part) ? part : 0);
21
- };
19
+ var parseVersion = (version) => version.replace(/^[^\d]*/, "").split(/[.-]/).map((part) => Number.parseInt(part, 10)).map((part) => Number.isFinite(part) ? part : 0);
22
20
  var compareNumeric = (a, b) => {
23
21
  const left = parseVersion(a);
24
22
  const right = parseVersion(b);
@@ -44,8 +42,7 @@ class LibraryRunner extends runner("library") {
44
42
  async createLibrary(libName, workspace) {
45
43
  await workspace.mkdir(`libs/${libName}`);
46
44
  await workspace.applyTemplate({ basePath: `libs/${libName}`, template: "libRoot", dict: { libName } });
47
- const lib = LibExecutor.from(workspace, libName);
48
- return lib;
45
+ return LibExecutor.from(workspace, libName);
49
46
  }
50
47
  async removeLibrary(lib) {
51
48
  await lib.workspace.removeDir(`libs/${lib.name}`);
@@ -2,10 +2,10 @@
2
2
  import {
3
3
  runner,
4
4
  script
5
- } from "./index-qdgzsnhg.js";
5
+ } from "./index-w2zdcw3k.js";
6
6
  import {
7
7
  ModuleExecutor
8
- } from "./index-crmeqnmf.js";
8
+ } from "./index-9d9bgcx4.js";
9
9
  import {
10
10
  sourceFile,
11
11
  moduleSourcePaths,
@@ -13,10 +13,10 @@ import {
13
13
  createPassedPrimitiveReport,
14
14
  bilingualLabelForField,
15
15
  bilingualDescriptionForField
16
- } from "./index-2446k7b4.js";
16
+ } from "./index-myhc3c1j.js";
17
17
  import {
18
18
  PageScript
19
- } from "./index-22xtgmhn.js";
19
+ } from "./index-dzf3r49a.js";
20
20
  import {
21
21
  pluralizeName
22
22
  } from "./index-nz8prx9g.js";
@@ -44,7 +44,19 @@ ${purpose}
44
44
  - Removal is soft: a removed ${noun} keeps its row with \`removedAt\` set.
45
45
  `;
46
46
  };
47
- var localModuleFilename = (moduleName, pathKey) => moduleSourcePaths(moduleName)[pathKey].replace(`lib/${moduleName}/`, "");
47
+ var moduleFileKeys = [
48
+ "abstract",
49
+ "constant",
50
+ "dictionary",
51
+ "service",
52
+ "store",
53
+ "signal",
54
+ "unit",
55
+ "view",
56
+ "template",
57
+ "zone",
58
+ "util"
59
+ ];
48
60
 
49
61
  class ModuleRunner extends runner("module") {
50
62
  async createService(module) {
@@ -54,20 +66,20 @@ class ModuleRunner extends runner("module") {
54
66
  template: "service",
55
67
  dict: { model: serviceName, sysName: module.sys.name }
56
68
  });
57
- const [abstractContent, dictionaryContent, serviceContent, signalContent, storeContent] = await Promise.all([
58
- module.readFile(`${serviceName}.abstract.md`),
59
- module.readFile(`${serviceName}.dictionary.ts`),
60
- module.readFile(`${serviceName}.service.ts`),
61
- module.readFile(`${serviceName}.signal.ts`),
62
- module.readFile(`${serviceName}.store.ts`)
63
- ]);
64
- return {
65
- abstract: { filename: `${serviceName}.abstract.md`, content: abstractContent },
66
- dictionary: { filename: `${serviceName}.dictionary.ts`, content: dictionaryContent },
67
- service: { filename: `${serviceName}.service.ts`, content: serviceContent },
68
- signal: { filename: `${serviceName}.signal.ts`, content: signalContent },
69
- store: { filename: `${serviceName}.store.ts`, content: storeContent }
70
- };
69
+ return await this.#readFiles(module, {
70
+ abstract: `${serviceName}.abstract.md`,
71
+ dictionary: `${serviceName}.dictionary.ts`,
72
+ service: `${serviceName}.service.ts`,
73
+ signal: `${serviceName}.signal.ts`,
74
+ store: `${serviceName}.store.ts`
75
+ });
76
+ }
77
+ async#readFiles(module, filenames) {
78
+ const files = await Promise.all(Object.entries(filenames).map(async ([key, filename]) => [
79
+ key,
80
+ { filename, content: await module.readFile(filename) }
81
+ ]));
82
+ return Object.fromEntries(files);
71
83
  }
72
84
  async removeModule(module) {
73
85
  await module.sys.removeDir(`lib/${module.name}`);
@@ -97,19 +109,8 @@ class ModuleRunner extends runner("module") {
97
109
  const names = pluralizeName(module.name);
98
110
  const modelLabel = bilingualLabelForField(module.name);
99
111
  const modelDescription = bilingualDescriptionForField(module.name);
100
- const filenames = {
101
- abstract: localModuleFilename(module.name, "abstract"),
102
- constant: localModuleFilename(module.name, "constant"),
103
- dictionary: localModuleFilename(module.name, "dictionary"),
104
- service: localModuleFilename(module.name, "service"),
105
- store: localModuleFilename(module.name, "store"),
106
- signal: localModuleFilename(module.name, "signal"),
107
- unit: localModuleFilename(module.name, "unit"),
108
- view: localModuleFilename(module.name, "view"),
109
- template: localModuleFilename(module.name, "template"),
110
- zone: localModuleFilename(module.name, "zone"),
111
- util: localModuleFilename(module.name, "util")
112
- };
112
+ const paths = moduleSourcePaths(module.name);
113
+ const filenames = Object.fromEntries(moduleFileKeys.map((key) => [key, paths[key].replace(`lib/${module.name}/`, "")]));
113
114
  const sharedGuards = await this.#hasSharedGuards(module);
114
115
  await module.applyTemplate({
115
116
  basePath: `.`,
@@ -127,44 +128,7 @@ class ModuleRunner extends runner("module") {
127
128
  }
128
129
  });
129
130
  await module.writeFile(filenames.abstract, moduleAbstractContent(module.name, sharedGuards));
130
- const [
131
- abstractContent,
132
- constantContent,
133
- dictionaryContent,
134
- serviceContent,
135
- storeContent,
136
- signalContent,
137
- unitContent,
138
- viewContent,
139
- templateContent,
140
- zoneContent,
141
- utilContent
142
- ] = await Promise.all([
143
- module.readFile(filenames.abstract),
144
- module.readFile(filenames.constant),
145
- module.readFile(filenames.dictionary),
146
- module.readFile(filenames.service),
147
- module.readFile(filenames.store),
148
- module.readFile(filenames.signal),
149
- module.readFile(filenames.unit),
150
- module.readFile(filenames.view),
151
- module.readFile(filenames.template),
152
- module.readFile(filenames.zone),
153
- module.readFile(filenames.util)
154
- ]);
155
- return {
156
- abstract: { filename: filenames.abstract, content: abstractContent },
157
- constant: { filename: filenames.constant, content: constantContent },
158
- dictionary: { filename: filenames.dictionary, content: dictionaryContent },
159
- service: { filename: filenames.service, content: serviceContent },
160
- store: { filename: filenames.store, content: storeContent },
161
- signal: { filename: filenames.signal, content: signalContent },
162
- unit: { filename: filenames.unit, content: unitContent },
163
- view: { filename: filenames.view, content: viewContent },
164
- template: { filename: filenames.template, content: templateContent },
165
- zone: { filename: filenames.zone, content: zoneContent },
166
- util: { filename: filenames.util, content: utilContent }
167
- };
131
+ return await this.#readFiles(module, filenames);
168
132
  }
169
133
  }
170
134
 
@@ -199,7 +163,6 @@ class ModuleScript extends script("module", [ModuleRunner, PageScript]) {
199
163
  target: sys.name
200
164
  });
201
165
  }
202
- async createTest(workspace, name) {}
203
166
  async createTemplate(mod) {
204
167
  return await this.#createComponent(mod, "template");
205
168
  }
@@ -2,22 +2,22 @@
2
2
  import {
3
3
  GlobalConfig,
4
4
  CloudApi
5
- } from "./index-srmay5jw.js";
5
+ } from "./index-22d57v4c.js";
6
6
  import {
7
7
  script
8
- } from "./index-qdgzsnhg.js";
8
+ } from "./index-w2zdcw3k.js";
9
9
  import {
10
10
  PkgExecutor
11
- } from "./index-crmeqnmf.js";
11
+ } from "./index-9d9bgcx4.js";
12
12
  import {
13
13
  ApplicationScript
14
- } from "./index-bftkz6cp.js";
14
+ } from "./index-ww4z397j.js";
15
15
  import {
16
16
  PackageScript
17
- } from "./index-ab0c38ea.js";
17
+ } from "./index-as7xmyz8.js";
18
18
  import {
19
19
  CloudRunner
20
- } from "./index-bc88j1ry.js";
20
+ } from "./index-axzjaqve.js";
21
21
 
22
22
  // pkgs/@akanjs/cli/cloud/cloud.script.ts
23
23
  import { Logger } from "akanjs/common";