@ahmadubaidillah/cli 1.1.9 → 1.1.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.
package/dist/bin.js CHANGED
@@ -14932,7 +14932,8 @@ var init_plugin_loader = __esm(() => {
14932
14932
  routeInfo: z.object({
14933
14933
  path: z.string(),
14934
14934
  importFile: z.string(),
14935
- exportName: z.string()
14935
+ exportName: z.string(),
14936
+ type: z.enum(["api", "ui"]).default("api")
14936
14937
  }).optional()
14937
14938
  });
14938
14939
  });
@@ -32409,18 +32410,21 @@ async function installPlugin(pluginName, projectDir, options) {
32409
32410
  if (!appContent.includes(config.routeInfo.importFile)) {
32410
32411
  appContent = importStmt + appContent;
32411
32412
  }
32412
- const routeStmt = `api.route('${config.routeInfo.path}', ${config.routeInfo.exportName});
32413
+ const isUI = config.routeInfo.type === "ui";
32414
+ const targetInstance = isUI ? "app" : "api";
32415
+ const marker = isUI ? "// [PLUGIN_UI_INJECTION_POINT]" : "// [PLUGIN_ROUTES_INJECTION_POINT]";
32416
+ const injectionRegex = new RegExp(`${marker.replace("[", "\\[").replace("]", "\\]")}.*$`, "m");
32417
+ const routeStmt = `${targetInstance}.route('${config.routeInfo.path}', ${config.routeInfo.exportName});
32413
32418
  `;
32414
32419
  if (!appContent.includes(routeStmt)) {
32415
- const marker = "// [PLUGIN_ROUTES_INJECTION_POINT]";
32416
- const injectionRegex = /\/\/ \[PLUGIN_ROUTES_INJECTION_POINT\].*$/m;
32417
32420
  if (injectionRegex.test(appContent)) {
32418
32421
  appContent = appContent.replace(injectionRegex, `${marker}
32419
32422
  ${routeStmt}`);
32420
32423
  } else {
32424
+ const fallbackInstance = appContent.includes("const api =") ? "api" : "app";
32421
32425
  appContent += `
32422
32426
  // Auto-injected route
32423
- api.route('${config.routeInfo.path}', ${config.routeInfo.exportName});
32427
+ ${fallbackInstance}.route('${config.routeInfo.path}', ${config.routeInfo.exportName});
32424
32428
  `;
32425
32429
  }
32426
32430
  }
@@ -10,6 +10,7 @@
10
10
  "routeInfo": {
11
11
  "path": "/admin",
12
12
  "importFile": "./modules/admin/routes/admin.routes",
13
- "exportName": "adminRoutes"
13
+ "exportName": "adminRoutes",
14
+ "type": "ui"
14
15
  }
15
16
  }
@@ -19,6 +19,8 @@ app.get('/', (c) => {
19
19
  return c.html(<LandingPage projectName="{{PROJECT_NAME}}" />);
20
20
  });
21
21
 
22
+ // [PLUGIN_UI_INJECTION_POINT]
23
+
22
24
  // Feature Routes (Registry)
23
25
  const api = new Hono();
24
26
  api.route('/users', userRoutes);
@@ -6,6 +6,17 @@ export class UserRepository {
6
6
 
7
7
  async findById(id: string): Promise<User | null> {
8
8
  console.log(`[UserRepository] Finding user by id: ${id}`);
9
+
10
+ // Seed/Mock fallback for the demo user
11
+ if (id === '1') {
12
+ return {
13
+ id: '1',
14
+ name: 'System Administrator',
15
+ email: 'admin@devforge.dev',
16
+ createdAt: new Date(),
17
+ };
18
+ }
19
+
9
20
  return null;
10
21
  }
11
22
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@ahmadubaidillah/cli",
3
- "version": "1.1.9",
3
+ "version": "1.1.10",
4
4
  "description": "The elite modular boilerplate engine for agentic applications.",
5
5
  "repository": {
6
6
  "type": "git",
@@ -16,7 +16,7 @@
16
16
  "devforge-cli": "dist/bin.js"
17
17
  },
18
18
  "dependencies": {
19
- "@ahmadubaidillah/core": "^1.1.9",
19
+ "@ahmadubaidillah/core": "^1.1.10",
20
20
  "@inquirer/prompts": "latest",
21
21
  "chalk": "latest",
22
22
  "commander": "latest",