@akanjs/devkit 2.3.9-rc.1 → 2.3.9-rc.10

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.
@@ -269,11 +269,11 @@ describe("getModelFileData", () => {
269
269
  ].join("\n"),
270
270
  );
271
271
  await write(
272
- path.join(root, "apps/demo/lib/post/post.Unit.tsx"),
272
+ path.join(root, "apps/demo/lib/post/Post.Unit.tsx"),
273
273
  "export default function Unit() { return null; }\n",
274
274
  );
275
275
  await write(
276
- path.join(root, "apps/demo/lib/post/post.View.tsx"),
276
+ path.join(root, "apps/demo/lib/post/Post.View.tsx"),
277
277
  "export default function View() { return null; }\n",
278
278
  );
279
279
 
package/executors.ts CHANGED
@@ -503,7 +503,7 @@ export class Executor {
503
503
  async writeFile(
504
504
  filePath: string,
505
505
  content: string | object,
506
- { overwrite = true }: { overwrite?: boolean } = {},
506
+ { overwrite = true, silent = false }: { overwrite?: boolean; silent?: boolean } = {},
507
507
  ): Promise<FileContent> {
508
508
  const writePath = this.getPath(filePath);
509
509
  const dir = path.dirname(writePath);
@@ -521,7 +521,7 @@ export class Executor {
521
521
  }
522
522
  } else {
523
523
  await FileSys.writeText(writePath, contentStr);
524
- this.logger.rawLog(chalk.green(`File Create: ${filePath}`));
524
+ if (!silent) this.logger.rawLog(chalk.green(`File Create: ${filePath}`));
525
525
  }
526
526
  return { filePath: writePath, content: contentStr };
527
527
  }
@@ -626,14 +626,14 @@ export class Executor {
626
626
  overwrite?: boolean;
627
627
  },
628
628
  dict: { [key: string]: string } = {},
629
- options: { [key: string]: any } = {},
629
+ options: { [key: string]: unknown } = {},
630
630
  ): Promise<FileContent | null> {
631
631
  if (targetPath.endsWith(".ts") || targetPath.endsWith(".tsx")) {
632
632
  const getContent = (await import(templatePath)) as {
633
633
  default: (
634
634
  scanInfo: AppInfo | LibInfo | null,
635
635
  dict: { [key: string]: string },
636
- options?: { [key: string]: any },
636
+ options?: { [key: string]: unknown },
637
637
  ) => Promise<string | null | { filename: string; content: string }>;
638
638
  };
639
639
  const result = await getContent.default(scanInfo ?? null, dict, options);
@@ -686,7 +686,7 @@ export class Executor {
686
686
  template: string;
687
687
  scanInfo?: AppInfo | LibInfo | null;
688
688
  dict?: { [key: string]: string };
689
- options?: { [key: string]: any };
689
+ options?: { [key: string]: unknown };
690
690
  overwrite?: boolean;
691
691
  }): Promise<FileContent[]> {
692
692
  const templateRoot = await this.#resolveTemplateRoot();
@@ -752,7 +752,7 @@ export class Executor {
752
752
  basePath: string;
753
753
  template: string;
754
754
  dict?: { [key: string]: string };
755
- options?: { [key: string]: any };
755
+ options?: { [key: string]: unknown };
756
756
  overwrite?: boolean;
757
757
  }): Promise<FileContent[]> {
758
758
  const dict = {
@@ -827,10 +827,10 @@ export class Executor {
827
827
  filePath: string,
828
828
  { fix = false, dryRun = false }: { fix?: boolean; dryRun?: boolean } = {},
829
829
  ): Promise<{
830
- results: any[]; // ESLint.LintResult[];
830
+ results: unknown[]; // ESLint.LintResult[];
831
831
  message: string;
832
- errors: any[]; // ESLintLinter.LintMessage[];
833
- warnings: any[]; // ESLintLinter.LintMessage[];
832
+ errors: unknown[]; // ESLintLinter.LintMessage[];
833
+ warnings: unknown[]; // ESLintLinter.LintMessage[];
834
834
  }> {
835
835
  const path = this.getPath(filePath);
836
836
  const linter = this.getLinter();
@@ -1225,40 +1225,44 @@ export class SysExecutor extends Executor {
1225
1225
  async getViewComponents() {
1226
1226
  const viewComponents = (await this.readdir("lib"))
1227
1227
  .filter((name) => !name.startsWith("_") && !name.startsWith("__") && !name.endsWith(".ts"))
1228
- .filter((name) => Bun.file(`${this.cwdPath}/lib/${name}/${name}.View.tsx`).exists());
1228
+ .filter((name) => Bun.file(`${this.cwdPath}/lib/${name}/${capitalize(name)}.View.tsx`).exists());
1229
1229
  return viewComponents;
1230
1230
  }
1231
1231
 
1232
1232
  async getUnitComponents() {
1233
1233
  const unitComponents = (await this.readdir("lib"))
1234
1234
  .filter((name) => !name.startsWith("_") && !name.startsWith("__") && !name.endsWith(".ts"))
1235
- .filter((name) => Bun.file(`${this.cwdPath}/lib/${name}/${name}.Unit.tsx`).exists());
1235
+ .filter((name) => Bun.file(`${this.cwdPath}/lib/${name}/${capitalize(name)}.Unit.tsx`).exists());
1236
1236
  return unitComponents;
1237
1237
  }
1238
1238
  async getTemplateComponents() {
1239
1239
  const templateComponents = (await this.readdir("lib"))
1240
1240
  .filter((name) => !name.startsWith("_") && !name.startsWith("__") && !name.endsWith(".ts"))
1241
- .filter((name) => Bun.file(`${this.cwdPath}/lib/${name}/${name}.Template.tsx`).exists());
1241
+ .filter((name) => Bun.file(`${this.cwdPath}/lib/${name}/${capitalize(name)}.Template.tsx`).exists());
1242
1242
  return templateComponents;
1243
1243
  }
1244
1244
 
1245
1245
  async getViewsSourceCode() {
1246
1246
  const viewComponents = await this.getViewComponents();
1247
1247
  return Promise.all(
1248
- viewComponents.map((viewComponent) => this.getLocalFile(`lib/${viewComponent}/${viewComponent}.View.tsx`)),
1248
+ viewComponents.map((viewComponent) =>
1249
+ this.getLocalFile(`lib/${viewComponent}/${capitalize(viewComponent)}.View.tsx`),
1250
+ ),
1249
1251
  );
1250
1252
  }
1251
1253
  async getUnitsSourceCode() {
1252
1254
  const unitComponents = await this.getUnitComponents();
1253
1255
  return Promise.all(
1254
- unitComponents.map((unitComponent) => this.getLocalFile(`lib/${unitComponent}/${unitComponent}.Unit.tsx`)),
1256
+ unitComponents.map((unitComponent) =>
1257
+ this.getLocalFile(`lib/${unitComponent}/${capitalize(unitComponent)}.Unit.tsx`),
1258
+ ),
1255
1259
  );
1256
1260
  }
1257
1261
  async getTemplatesSourceCode() {
1258
1262
  const templateComponents = await this.getTemplateComponents();
1259
1263
  return Promise.all(
1260
1264
  templateComponents.map((templateComponent) =>
1261
- this.getLocalFile(`lib/${templateComponent}/${templateComponent}.Template.tsx`),
1265
+ this.getLocalFile(`lib/${templateComponent}/${capitalize(templateComponent)}.Template.tsx`),
1262
1266
  ),
1263
1267
  );
1264
1268
  }
@@ -1357,14 +1361,15 @@ export class AppExecutor extends SysExecutor {
1357
1361
  getCommandEnv(env: Record<string, string> = {}): Record<string, string> {
1358
1362
  const basePort = 8282;
1359
1363
  const portOffset = WorkspaceExecutor.getBaseDevEnv().portOffset;
1360
- const PORT = basePort ? (basePort + portOffset).toString() : undefined;
1364
+ const PORT = (basePort + portOffset).toString();
1361
1365
  const AKAN_PUBLIC_SERVER_PORT = portOffset ? (8282 + portOffset).toString() : undefined;
1362
1366
  return {
1363
1367
  ...process.env,
1364
1368
  AKAN_PUBLIC_APP_NAME: this.name,
1365
1369
  AKAN_WORKSPACE_ROOT: this.workspace.workspaceRoot,
1366
1370
  NODE_NO_WARNINGS: "1",
1367
- ...(PORT ? { PORT, AKAN_PUBLIC_CLIENT_PORT: PORT } : {}),
1371
+ PORT,
1372
+ AKAN_PUBLIC_CLIENT_PORT: PORT,
1368
1373
  ...(AKAN_PUBLIC_SERVER_PORT ? { AKAN_PUBLIC_SERVER_PORT } : {}),
1369
1374
  ...env,
1370
1375
  };
@@ -1,3 +1,5 @@
1
+ import { capitalize } from "akanjs/common";
2
+
1
3
  interface ModelFileData {
2
4
  moduleType: "lib" | "app";
3
5
  moduleName: string;
@@ -16,9 +18,10 @@ interface ModelFileData {
16
18
  export const getModelFileData = async (modulePath: string, modelName: string): Promise<ModelFileData> => {
17
19
  const moduleType = modulePath.startsWith("apps") ? "app" : "lib";
18
20
  const moduleName = modulePath.split("/")[1] ?? "";
21
+ const modelComponentName = capitalize(modelName);
19
22
  const constantFilePath = `${modulePath}/lib/${modelName}/${modelName}.constant.ts`;
20
- const unitFilePath = `${modulePath}/lib/${modelName}/${modelName}.Unit.tsx`;
21
- const viewFilePath = `${modulePath}/lib/${modelName}/${modelName}.View.tsx`;
23
+ const unitFilePath = `${modulePath}/lib/${modelName}/${modelComponentName}.Unit.tsx`;
24
+ const viewFilePath = `${modulePath}/lib/${modelName}/${modelComponentName}.View.tsx`;
22
25
  const [constantFileStr, unitFileStr, viewFileStr] = await Promise.all([
23
26
  Bun.file(constantFilePath).text(),
24
27
  Bun.file(unitFilePath).text(),
package/index.ts CHANGED
@@ -2,6 +2,7 @@ export * from "./aiEditor";
2
2
  export * from "./akanApp";
3
3
  export * from "./akanConfig";
4
4
  export * from "./akanContext";
5
+ export * from "./akanMcpContract";
5
6
  export * from "./applicationBuildReporter";
6
7
  export * from "./applicationBuildRunner";
7
8
  export * from "./applicationReleasePackager";
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@akanjs/devkit",
3
- "version": "2.3.9-rc.1",
3
+ "version": "2.3.9-rc.10",
4
4
  "sourceType": "module",
5
5
  "type": "module",
6
6
  "publishConfig": {
@@ -32,7 +32,7 @@
32
32
  "@langchain/openai": "^1.4.6",
33
33
  "@tailwindcss/node": "^4.3.0",
34
34
  "@trapezedev/project": "^7.1.4",
35
- "akanjs": "2.3.9-rc.1",
35
+ "akanjs": "2.3.9-rc.10",
36
36
  "chalk": "^5.6.2",
37
37
  "commander": "^14.0.3",
38
38
  "daisyui": "5.5.23",