create-fullstack-scaffold 0.4.3 → 0.4.5

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 (147) hide show
  1. package/dist/cli/index.js +5 -0
  2. package/dist/cli/index.js.map +1 -1
  3. package/package.json +1 -1
  4. package/template/dist/cli/index.js +237 -94
  5. package/template/dist/cli/index.js.map +1 -1
  6. package/template/dist/client/admin.html +15 -10
  7. package/template/dist/client/assets/App-BpFUIC-5.js +114 -0
  8. package/template/dist/client/assets/{CartPage-DESSHkaG.js → CartPage-DgDZP-R5.js} +2 -2
  9. package/template/dist/client/assets/{CategoriesPage-DqLZ_Mom.js → CategoriesPage-fuYNiSmE.js} +2 -2
  10. package/template/dist/client/assets/ContentDetailPage-BvvFU1Mr.js +1 -0
  11. package/template/dist/client/assets/ContentListPage-ShPxo6WG.js +1 -0
  12. package/template/dist/client/assets/DashboardPage-C1rZzZo4.js +11 -0
  13. package/template/dist/client/assets/{DeveloperDashboardPage-Cum7zFwO.js → DeveloperDashboardPage-_WtmbVoA.js} +2 -2
  14. package/template/dist/client/assets/{EmptyState-BK7ttK8D.js → EmptyState-DEyOQjbY.js} +1 -1
  15. package/template/dist/client/assets/LoadingSpinner-BcHjaM1m.js +6 -0
  16. package/template/dist/client/assets/LoginPage-CjeQqDdO.js +1 -0
  17. package/template/dist/client/assets/LogoutOutlined-ColFAHdd.js +1 -0
  18. package/template/dist/client/assets/NotificationPage-DRkEv02s.js +1 -0
  19. package/template/dist/client/assets/OrdersPage-7I3vPWLP.js +11 -0
  20. package/template/dist/client/assets/{PluginDetailPage-Br24YS4P.js → PluginDetailPage-CWyxdVCg.js} +3 -13
  21. package/template/dist/client/assets/PluginsPage-DRgWLeJT.js +6 -0
  22. package/template/dist/client/assets/ProfilePage-2FFkaii8.js +16 -0
  23. package/template/dist/client/assets/PublishPage-DW7yvROx.js +1 -0
  24. package/template/dist/client/assets/{RegisterPage-rPFG4Sry.js → RegisterPage-Dvaf9b0e.js} +2 -2
  25. package/template/dist/client/assets/SaveOutlined-CLQ2tsSY.js +2 -0
  26. package/template/dist/client/assets/{SearchPage-DQl1U5Uy.js → SearchPage-DvnEyswS.js} +2 -2
  27. package/template/dist/client/assets/{SettingsPage-DaYE80wj.js → SettingsPage-IrU-L9Zr.js} +2 -2
  28. package/template/dist/client/assets/{StatusBadge-BJ3W2Zc7.js → StatusBadge-CG7wVqpu.js} +1 -1
  29. package/template/dist/client/assets/{TodoPage-zC5wWNBa.js → TodoPage-B7D-bl65.js} +3 -3
  30. package/template/dist/client/assets/TopicsPage-CYCNr-mn.js +6 -0
  31. package/template/dist/client/assets/{WebSocketPage-B4NLdz1w.js → WebSocketPage-CGEg6QJE.js} +2 -2
  32. package/template/dist/client/assets/{activity-B94BUAsD.js → activity-CgTz9Mrd.js} +1 -1
  33. package/template/dist/client/assets/admin-D2iHWNOg.js +1 -0
  34. package/template/dist/client/assets/api-request-DIJocPxr.js +356 -0
  35. package/template/dist/client/assets/{arrow-left-H5JH0iU1.js → arrow-left-DtLQ3tTk.js} +1 -1
  36. package/template/dist/client/assets/{chevron-down-DwRh_wjD.js → chevron-down-CpIAV_yr.js} +1 -1
  37. package/template/dist/client/assets/{chevron-right-CpIWaqAL.js → chevron-right-CnU7oPQs.js} +1 -1
  38. package/template/dist/client/assets/{circle-check-big-CSElLscG.js → circle-check-big-CrZdwS75.js} +1 -1
  39. package/template/dist/client/assets/{circle-x-CYxr4RAw.js → circle-x-CvN9r3fW.js} +1 -1
  40. package/template/dist/client/assets/{clock-BseUJ7ex.js → clock-CTeSZBiH.js} +1 -1
  41. package/template/dist/client/assets/{download-BsGC_Xhq.js → download-OSVfVuNV.js} +1 -1
  42. package/template/dist/client/assets/{external-link-UTDzdjq8.js → external-link-fBsuHMby.js} +1 -1
  43. package/template/dist/client/assets/{eye-nR10ui7i.js → eye-CwlZZEsj.js} +1 -1
  44. package/template/dist/client/assets/index-09IqiOaE.css +1 -0
  45. package/template/dist/client/assets/index-B3CRby6r.js +51 -0
  46. package/template/dist/client/assets/index-CC_zy73y.js +17 -0
  47. package/template/dist/client/assets/main-Cn4IDo2I.js +92 -0
  48. package/template/dist/client/assets/merchant-DDDN9bMu.js +40 -0
  49. package/template/dist/client/assets/{message-square-CwWGL-Bh.js → message-square-BRaZfgbJ.js} +1 -1
  50. package/template/dist/client/assets/pluginStore-DDsWJPe6.js +1 -0
  51. package/template/dist/client/assets/{plus-pZld_nUL.js → plus-DDZfPiDJ.js} +1 -1
  52. package/template/dist/client/assets/sse-client-DGQ072hl.js +64 -0
  53. package/template/dist/client/assets/star-C7tO6w4H.js +11 -0
  54. package/template/dist/client/assets/{tag-DsiUPF90.js → tag-DBfpQDuJ.js} +1 -1
  55. package/template/dist/client/assets/tenant-CizbLaLJ.js +1 -0
  56. package/template/dist/client/assets/{trash-2-DRblNbnA.js → trash-2-BP7fkd5b.js} +1 -1
  57. package/template/dist/client/assets/{triangle-alert-D1CLh-Vd.js → triangle-alert-CrOQEdJ2.js} +1 -1
  58. package/template/dist/client/assets/{wifi-BwXjnCqI.js → wifi-CwYSE0J4.js} +1 -1
  59. package/template/dist/client/assets/{x-BH2rJdFq.js → x-t615pnNR.js} +1 -1
  60. package/template/dist/client/content/index.html +5 -4
  61. package/template/dist/client/index.html +4 -3
  62. package/template/dist/client/merchant.html +18 -0
  63. package/template/dist/client/notifications/index.html +6 -5
  64. package/template/dist/client/tenant.html +18 -0
  65. package/template/dist/client/todos/index.html +6 -5
  66. package/template/dist/client/websocket/index.html +6 -5
  67. package/template/dist/cloudflare/chunk-HX7DVRDX.js +1 -0
  68. package/template/dist/cloudflare/{chunk-QBHAPWIA.js → chunk-IXJL2LE4.js} +1 -1
  69. package/template/dist/cloudflare/chunk-Q34AN3RF.js +14 -0
  70. package/template/dist/cloudflare/{chunk-BHPTQ4K2.js → chunk-ZAMVL4EG.js} +2 -2
  71. package/template/dist/cloudflare/cloudflare.js +35 -29
  72. package/template/dist/cloudflare/db-4AQOSFAX.js +1 -0
  73. package/template/dist/cloudflare/{migrator-2ZYYKNI5.js → migrator-TEPBVUFO.js} +1 -1
  74. package/template/dist/cloudflare/permission-service-impl-RE7NPW3Q.js +1 -0
  75. package/template/dist/cloudflare/schema-DVEMT3X2.js +1 -0
  76. package/template/dist/cloudflare/test-setup-Z2RYE5B4.js +265 -0
  77. package/template/dist/server/chunk-27SIJSPF.js +1 -0
  78. package/template/dist/server/chunk-37QNGBQU.js +1 -0
  79. package/template/dist/server/chunk-FIY4CGJJ.js +1 -0
  80. package/template/dist/server/chunk-HZUDBIT4.js +1 -0
  81. package/template/dist/server/chunk-I6OBDFDU.js +1 -0
  82. package/template/dist/server/chunk-JHNYLNG7.js +1 -0
  83. package/template/dist/server/chunk-MDOVVKKD.js +1 -0
  84. package/template/dist/server/chunk-NSOCT7E5.js +1 -0
  85. package/template/dist/server/chunk-OU5IGVVO.js +1 -0
  86. package/template/dist/server/chunk-OYCBNRMK.js +1 -0
  87. package/template/dist/server/chunk-P2RJNNGD.js +1 -0
  88. package/template/dist/server/chunk-UMAQLNPE.js +1 -0
  89. package/template/dist/server/chunk-XZZTSRSN.js +1 -0
  90. package/template/dist/server/content-service-5QVHDR5X.js +1 -0
  91. package/template/dist/server/db-FLI5L5DD.js +1 -0
  92. package/template/dist/server/dispute-service-E2FCYUEM.js +1 -0
  93. package/template/dist/server/init-72JXJV3I.js +46 -0
  94. package/template/dist/server/init-FWYXSKPX.js +46 -0
  95. package/template/dist/server/node.js +34 -28
  96. package/template/dist/server/order-service-TKGG5S5K.js +1 -0
  97. package/template/dist/server/permission-service-impl-M3AKEYNY.js +1 -0
  98. package/template/dist/server/schema-V4UG7HMU.js +1 -0
  99. package/template/dist/server/tenant-service-JG6UUWXQ.js +1 -0
  100. package/template/dist/server/tenant-service-XJWZSEDX.js +1 -0
  101. package/template/dist/{cloudflare/test-setup-NMZJZLRV.js → server/test-setup-VFOPBGYM.js} +83 -2
  102. package/template/dist/server/ticket-service-3RSW7V2Z.js +1 -0
  103. package/template/dist/server/todo-service-S6BGIO7D.js +1 -0
  104. package/template/src/merchant/pages/DisputesPage.tsx +11 -11
  105. package/template/src/merchant/pages/OrdersPage.tsx +4 -3
  106. package/template/src/merchant/pages/ProductsPage.tsx +2 -2
  107. package/template/src/merchant/stores/merchantStore.ts +11 -6
  108. package/template/src/server/db/init.ts +5 -642
  109. package/template/src/server/module-plugin/services/plugin-seed-service.ts +623 -0
  110. package/template/src/server/module-tenant/routes/tenant-routes.ts +2 -2
  111. package/template/src/server/module-tenant/services/tenant-service.ts +63 -17
  112. package/template/src/shared/modules/merchant/index.ts +9 -0
  113. package/template/src/shared/modules/merchant/schemas.ts +37 -0
  114. package/template/src/shared/modules/tenant/index.ts +2 -0
  115. package/template/src/shared/schemas/index.ts +27 -0
  116. package/template/src/tenant/layouts/Header.tsx +1 -1
  117. package/template/src/tenant/layouts/Sidebar.tsx +1 -1
  118. package/template/src/tenant/pages/SettingsPage.tsx +4 -8
  119. package/template/src/tenant/stores/tenantStore.ts +41 -302
  120. package/template/tsconfig.json +1 -0
  121. package/template/tsup.config.ts +11 -3
  122. package/template/dist/client/assets/ContentDetailPage-DdltMANL.js +0 -1
  123. package/template/dist/client/assets/ContentListPage-B63sUB6N.js +0 -1
  124. package/template/dist/client/assets/DashboardPage-tUMilc7Z.js +0 -11
  125. package/template/dist/client/assets/LoadingSpinner-DVYOLSRM.js +0 -6
  126. package/template/dist/client/assets/LoginPage-g9mSLIMC.js +0 -6
  127. package/template/dist/client/assets/NotificationPage-COTzp-HD.js +0 -1
  128. package/template/dist/client/assets/OrdersPage-BsPh4oEI.js +0 -11
  129. package/template/dist/client/assets/PluginsPage-BNtAe_yo.js +0 -6
  130. package/template/dist/client/assets/ProfilePage-dL_iSuZN.js +0 -16
  131. package/template/dist/client/assets/PublishPage-D96FnbLA.js +0 -1
  132. package/template/dist/client/assets/TopicsPage-DyLjZa4D.js +0 -6
  133. package/template/dist/client/assets/admin-Bh1vfz_L.js +0 -486
  134. package/template/dist/client/assets/index-1bA-ixFv.js +0 -114
  135. package/template/dist/client/assets/index-CWh3vXC_.css +0 -1
  136. package/template/dist/client/assets/main-DHnArIp_.js +0 -82
  137. package/template/dist/client/assets/pluginStore-XQfsm3iR.js +0 -1
  138. package/template/dist/client/content/content-1/index.html +0 -18
  139. package/template/dist/client/content/content-13/index.html +0 -18
  140. package/template/dist/client/content/content-14/index.html +0 -18
  141. package/template/dist/client/content/content-15/index.html +0 -18
  142. package/template/dist/client/content/content-19/index.html +0 -18
  143. package/template/dist/client/content/content-2/index.html +0 -18
  144. package/template/dist/client/content/content-20/index.html +0 -18
  145. package/template/dist/cloudflare/chunk-YY6FRMAQ.js +0 -14
  146. package/template/dist/cloudflare/db-7J42RQ3T.js +0 -1
  147. package/template/dist/cloudflare/permission-service-impl-TGXVSSSA.js +0 -1
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "create-fullstack-scaffold",
3
- "version": "0.4.3",
3
+ "version": "0.4.5",
4
4
  "type": "module",
5
5
  "bin": {
6
6
  "create-fullstack-scaffold": "dist/cli/index.js"
@@ -322,20 +322,13 @@ function getClient() {
322
322
  return createRPCClient(globalBaseUrl);
323
323
  }
324
324
 
325
- // src/cli/utils/xcli-bridge.ts
326
- function asXcliSchema(schema) {
327
- return schema;
328
- }
329
-
330
325
  // src/cli/modules/todo/index.ts
331
326
  function registerTodoCommands(site) {
332
327
  site.command("list", {
333
328
  description: "List all todos",
334
- parameters: asXcliSchema(
335
- z.object({
336
- limit: z.coerce.number().default(20).describe("Limit results")
337
- })
338
- ),
329
+ parameters: z.object({
330
+ limit: z.coerce.number().default(20).describe("Limit results")
331
+ }),
339
332
  handler: async () => {
340
333
  try {
341
334
  const client = getClient();
@@ -349,15 +342,14 @@ function registerTodoCommands(site) {
349
342
  });
350
343
  site.command("get", {
351
344
  description: "Get a todo by ID",
352
- parameters: asXcliSchema(
353
- z.object({
354
- id: z.string().describe("Todo ID")
355
- })
356
- ),
345
+ parameters: z.object({
346
+ id: z.string().describe("Todo ID")
347
+ }),
357
348
  handler: async (params) => {
349
+ const p = params;
358
350
  try {
359
351
  const client = getClient();
360
- const res = await client.api.todos[":id"].$get({ param: { id: params.id } });
352
+ const res = await client.api.todos[":id"].$get({ param: { id: p.id } });
361
353
  const data = await res.json();
362
354
  return ok(data);
363
355
  } catch (err) {
@@ -367,16 +359,15 @@ function registerTodoCommands(site) {
367
359
  });
368
360
  site.command("create", {
369
361
  description: "Create a new todo",
370
- parameters: asXcliSchema(
371
- z.object({
372
- title: z.string().min(1).describe("Todo title"),
373
- description: z.string().optional().describe("Todo description")
374
- })
375
- ),
362
+ parameters: z.object({
363
+ title: z.string().min(1).describe("Todo title"),
364
+ description: z.string().optional().describe("Todo description")
365
+ }),
376
366
  handler: async (params) => {
367
+ const p = params;
377
368
  try {
378
369
  const client = getClient();
379
- const res = await client.api.todos.$post({ json: params });
370
+ const res = await client.api.todos.$post({ json: p });
380
371
  const data = await res.json();
381
372
  return ok(data, ["Todo created"]);
382
373
  } catch (err) {
@@ -386,17 +377,16 @@ function registerTodoCommands(site) {
386
377
  });
387
378
  site.command("update", {
388
379
  description: "Update a todo",
389
- parameters: asXcliSchema(
390
- z.object({
391
- id: z.string().describe("Todo ID"),
392
- title: z.string().optional().describe("New title"),
393
- description: z.string().optional().describe("New description"),
394
- status: z.enum(["pending", "in_progress", "completed"]).optional().describe("New status")
395
- })
396
- ),
380
+ parameters: z.object({
381
+ id: z.string().describe("Todo ID"),
382
+ title: z.string().optional().describe("New title"),
383
+ description: z.string().optional().describe("New description"),
384
+ status: z.enum(["pending", "in_progress", "completed"]).optional().describe("New status")
385
+ }),
397
386
  handler: async (params) => {
387
+ const p = params;
398
388
  try {
399
- const { id, ...body } = params;
389
+ const { id, ...body } = p;
400
390
  const client = getClient();
401
391
  const res = await client.api.todos[":id"].$put({
402
392
  param: { id },
@@ -411,15 +401,14 @@ function registerTodoCommands(site) {
411
401
  });
412
402
  site.command("delete", {
413
403
  description: "Delete a todo",
414
- parameters: asXcliSchema(
415
- z.object({
416
- id: z.string().describe("Todo ID")
417
- })
418
- ),
404
+ parameters: z.object({
405
+ id: z.string().describe("Todo ID")
406
+ }),
419
407
  handler: async (params) => {
408
+ const p = params;
420
409
  try {
421
410
  const client = getClient();
422
- const res = await client.api.todos[":id"].$delete({ param: { id: params.id } });
411
+ const res = await client.api.todos[":id"].$delete({ param: { id: p.id } });
423
412
  const data = await res.json();
424
413
  return ok(data, ["Todo deleted"]);
425
414
  } catch (err) {
@@ -431,17 +420,16 @@ function registerTodoCommands(site) {
431
420
  function registerNotificationCommands(site) {
432
421
  site.command("list", {
433
422
  description: "List all notifications",
434
- parameters: asXcliSchema(
435
- z.object({
436
- "unread-only": z.boolean().default(false).describe("Show only unread"),
437
- limit: z.coerce.number().default(20).describe("Limit results")
438
- })
439
- ),
423
+ parameters: z.object({
424
+ "unread-only": z.boolean().default(false).describe("Show only unread"),
425
+ limit: z.coerce.number().default(20).describe("Limit results")
426
+ }),
440
427
  handler: async (params) => {
428
+ const p = params;
441
429
  try {
442
430
  const client = getClient();
443
431
  const res = await client.api.notifications.$get({
444
- query: { unreadOnly: String(params["unread-only"]), limit: String(params.limit) }
432
+ query: { unreadOnly: String(p["unread-only"]), limit: String(p.limit) }
445
433
  });
446
434
  const data = await res.json();
447
435
  return ok(data);
@@ -452,17 +440,16 @@ function registerNotificationCommands(site) {
452
440
  });
453
441
  site.command("create", {
454
442
  description: "Create a new notification",
455
- parameters: asXcliSchema(
456
- z.object({
457
- title: z.string().min(1).describe("Notification title"),
458
- message: z.string().min(1).describe("Notification message"),
459
- type: z.enum(["info", "warning", "success", "error"]).default("info").describe("Type")
460
- })
461
- ),
443
+ parameters: z.object({
444
+ title: z.string().min(1).describe("Notification title"),
445
+ message: z.string().min(1).describe("Notification message"),
446
+ type: z.enum(["info", "warning", "success", "error"]).default("info").describe("Type")
447
+ }),
462
448
  handler: async (params) => {
449
+ const p = params;
463
450
  try {
464
451
  const client = getClient();
465
- const res = await client.api.notifications.$post({ json: params });
452
+ const res = await client.api.notifications.$post({ json: p });
466
453
  const data = await res.json();
467
454
  return ok(data, ["Notification created"]);
468
455
  } catch (err) {
@@ -472,7 +459,7 @@ function registerNotificationCommands(site) {
472
459
  });
473
460
  site.command("unread-count", {
474
461
  description: "Get unread notification count",
475
- parameters: asXcliSchema(z.object({})),
462
+ parameters: z.object({}),
476
463
  handler: async () => {
477
464
  try {
478
465
  const client = getClient();
@@ -486,15 +473,14 @@ function registerNotificationCommands(site) {
486
473
  });
487
474
  site.command("mark-read", {
488
475
  description: "Mark a notification as read",
489
- parameters: asXcliSchema(
490
- z.object({
491
- id: z.string().describe("Notification ID")
492
- })
493
- ),
476
+ parameters: z.object({
477
+ id: z.string().describe("Notification ID")
478
+ }),
494
479
  handler: async (params) => {
480
+ const p = params;
495
481
  try {
496
482
  const client = getClient();
497
- const res = await client.api.notifications[":id"].read.$patch({ param: { id: params.id } });
483
+ const res = await client.api.notifications[":id"].read.$patch({ param: { id: p.id } });
498
484
  const data = await res.json();
499
485
  return ok(data, ["Marked as read"]);
500
486
  } catch (err) {
@@ -504,15 +490,14 @@ function registerNotificationCommands(site) {
504
490
  });
505
491
  site.command("delete", {
506
492
  description: "Delete a notification",
507
- parameters: asXcliSchema(
508
- z.object({
509
- id: z.string().describe("Notification ID")
510
- })
511
- ),
493
+ parameters: z.object({
494
+ id: z.string().describe("Notification ID")
495
+ }),
512
496
  handler: async (params) => {
497
+ const p = params;
513
498
  try {
514
499
  const client = getClient();
515
- const res = await client.api.notifications[":id"].$delete({ param: { id: params.id } });
500
+ const res = await client.api.notifications[":id"].$delete({ param: { id: p.id } });
516
501
  const data = await res.json();
517
502
  return ok(data, ["Notification deleted"]);
518
503
  } catch (err) {
@@ -542,32 +527,30 @@ function saveConfig(config) {
542
527
  function registerConfigCommands(site) {
543
528
  site.command("config-get", {
544
529
  description: "Show current configuration",
545
- parameters: asXcliSchema(
546
- z.object({
547
- key: z.string().optional().describe("Get specific config key")
548
- })
549
- ),
530
+ parameters: z.object({
531
+ key: z.string().optional().describe("Get specific config key")
532
+ }),
550
533
  handler: async (params) => {
534
+ const p = params;
551
535
  const cfg = loadConfig();
552
- if (params.key) {
553
- const value = cfg[params.key];
554
- return ok({ [params.key]: value ?? "not set" });
536
+ if (p.key) {
537
+ const value = cfg[p.key];
538
+ return ok({ [p.key]: value ?? "not set" });
555
539
  }
556
540
  return ok(cfg);
557
541
  }
558
542
  });
559
543
  site.command("config-set", {
560
544
  description: "Set configuration value",
561
- parameters: asXcliSchema(
562
- z.object({
563
- url: z.string().optional().describe("Set server URL")
564
- })
565
- ),
545
+ parameters: z.object({
546
+ url: z.string().optional().describe("Set server URL")
547
+ }),
566
548
  handler: async (params) => {
549
+ const p = params;
567
550
  const cfg = loadConfig();
568
- if (params.url) {
569
- cfg.baseUrl = params.url;
570
- setBaseUrl(params.url);
551
+ if (p.url) {
552
+ cfg.baseUrl = p.url;
553
+ setBaseUrl(p.url);
571
554
  }
572
555
  saveConfig(cfg);
573
556
  return ok(cfg, ["Configuration saved"]);
@@ -575,25 +558,24 @@ function registerConfigCommands(site) {
575
558
  });
576
559
  site.command("config-url", {
577
560
  description: "Show or set server URL",
578
- parameters: asXcliSchema(
579
- z.object({
580
- url: z.string().optional().describe("New server URL")
581
- })
582
- ),
561
+ parameters: z.object({
562
+ url: z.string().optional().describe("New server URL")
563
+ }),
583
564
  handler: async (params) => {
584
- if (params.url) {
565
+ const p = params;
566
+ if (p.url) {
585
567
  const cfg = loadConfig();
586
- cfg.baseUrl = params.url;
587
- setBaseUrl(params.url);
568
+ cfg.baseUrl = p.url;
569
+ setBaseUrl(p.url);
588
570
  saveConfig(cfg);
589
- return ok({ url: params.url }, [`Server URL set to: ${params.url}`]);
571
+ return ok({ url: p.url }, [`Server URL set to: ${p.url}`]);
590
572
  }
591
573
  return ok({ url: getBaseUrl() });
592
574
  }
593
575
  });
594
576
  site.command("config-status", {
595
577
  description: "Check server connection status",
596
- parameters: asXcliSchema(z.object({})),
578
+ parameters: z.object({}),
597
579
  handler: async () => {
598
580
  try {
599
581
  const client = getClient();
@@ -607,7 +589,7 @@ function registerConfigCommands(site) {
607
589
  });
608
590
  site.command("config-reset", {
609
591
  description: "Reset configuration to defaults",
610
- parameters: asXcliSchema(z.object({})),
592
+ parameters: z.object({}),
611
593
  handler: async () => {
612
594
  const defaultConfig = { baseUrl: "http://localhost:3010" };
613
595
  saveConfig(defaultConfig);
@@ -617,12 +599,171 @@ function registerConfigCommands(site) {
617
599
  });
618
600
  site.command("config-path", {
619
601
  description: "Show config file path",
620
- parameters: asXcliSchema(z.object({})),
602
+ parameters: z.object({}),
621
603
  handler: async () => {
622
604
  return ok({ path: CONFIG_FILE });
623
605
  }
624
606
  });
625
607
  }
608
+ function registerPluginCommands(site) {
609
+ site.command("list", {
610
+ description: "List all plugins",
611
+ parameters: z.object({
612
+ limit: z.coerce.number().default(20).describe("Limit results"),
613
+ page: z.coerce.number().default(1).describe("Page number")
614
+ }),
615
+ handler: async (params) => {
616
+ const p = params;
617
+ try {
618
+ const client = getClient();
619
+ const res = await client.api.plugins.$get({
620
+ query: { limit: String(p.limit), page: String(p.page) }
621
+ });
622
+ const data = await res.json();
623
+ return ok(data);
624
+ } catch (err) {
625
+ return fail(err instanceof Error ? err.message : "Failed to list plugins");
626
+ }
627
+ }
628
+ });
629
+ site.command("search", {
630
+ description: "Search plugins",
631
+ parameters: z.object({
632
+ query: z.string().min(1).describe("Search query")
633
+ }),
634
+ handler: async (params) => {
635
+ const p = params;
636
+ try {
637
+ const client = getClient();
638
+ const res = await client.api.plugins.search.$get({ query: { q: p.query } });
639
+ const data = await res.json();
640
+ return ok(data);
641
+ } catch (err) {
642
+ return fail(err instanceof Error ? err.message : "Failed to search plugins");
643
+ }
644
+ }
645
+ });
646
+ site.command("get", {
647
+ description: "Get plugin details",
648
+ parameters: z.object({
649
+ slug: z.string().describe("Plugin slug")
650
+ }),
651
+ handler: async (params) => {
652
+ const p = params;
653
+ try {
654
+ const client = getClient();
655
+ const res = await client.api.plugins[":slug"].$get({ param: { slug: p.slug } });
656
+ const data = await res.json();
657
+ return ok(data);
658
+ } catch (err) {
659
+ return fail(err instanceof Error ? err.message : "Failed to get plugin");
660
+ }
661
+ }
662
+ });
663
+ site.command("install", {
664
+ description: "Track plugin install",
665
+ parameters: z.object({
666
+ slug: z.string().describe("Plugin slug")
667
+ }),
668
+ handler: async (params) => {
669
+ const p = params;
670
+ try {
671
+ const client = getClient();
672
+ const res = await client.api.plugins[":slug"].install.$post({ param: { slug: p.slug } });
673
+ const data = await res.json();
674
+ return ok(data, ["Install tracked"]);
675
+ } catch (err) {
676
+ return fail(err instanceof Error ? err.message : "Failed to track install");
677
+ }
678
+ }
679
+ });
680
+ site.command("categories", {
681
+ description: "List plugin categories",
682
+ parameters: z.object({}),
683
+ handler: async () => {
684
+ try {
685
+ const client = getClient();
686
+ const res = await client.api.categories.$get();
687
+ const data = await res.json();
688
+ return ok(data);
689
+ } catch (err) {
690
+ return fail(err instanceof Error ? err.message : "Failed to list categories");
691
+ }
692
+ }
693
+ });
694
+ site.command("stats", {
695
+ description: "Show marketplace statistics",
696
+ parameters: z.object({}),
697
+ handler: async () => {
698
+ try {
699
+ const client = getClient();
700
+ const res = await client.api.stats.$get();
701
+ const data = await res.json();
702
+ return ok(data);
703
+ } catch (err) {
704
+ return fail(err instanceof Error ? err.message : "Failed to get stats");
705
+ }
706
+ }
707
+ });
708
+ }
709
+ function registerAuthCommands(site) {
710
+ site.command("register", {
711
+ description: "Register a new developer account",
712
+ parameters: z.object({
713
+ username: z.string().min(2).max(50).describe("Username"),
714
+ email: z.string().email().describe("Email"),
715
+ password: z.string().min(6).describe("Password")
716
+ }),
717
+ handler: async (params) => {
718
+ const p = params;
719
+ try {
720
+ const client = getClient();
721
+ const res = await client.api.auth.register.$post({ json: p });
722
+ const data = await res.json();
723
+ return ok(data, ["Registration successful"]);
724
+ } catch (err) {
725
+ return fail(err instanceof Error ? err.message : "Failed to register");
726
+ }
727
+ }
728
+ });
729
+ site.command("login", {
730
+ description: "Login to get API key",
731
+ parameters: z.object({
732
+ account: z.string().describe("Email or username"),
733
+ password: z.string().min(6).describe("Password")
734
+ }),
735
+ handler: async (params) => {
736
+ const p = params;
737
+ try {
738
+ const client = getClient();
739
+ const res = await client.api.auth.login.$post({ json: p });
740
+ const data = await res.json();
741
+ return ok(data, ["Login successful"]);
742
+ } catch (err) {
743
+ return fail(err instanceof Error ? err.message : "Failed to login");
744
+ }
745
+ }
746
+ });
747
+ site.command("verify", {
748
+ description: "Verify API key",
749
+ parameters: z.object({
750
+ token: z.string().describe("API key to verify")
751
+ }),
752
+ handler: async (params) => {
753
+ const p = params;
754
+ try {
755
+ const client = getClient();
756
+ const res = await client.api.auth.verify.$get({
757
+ headers: { Authorization: `Bearer ${p.token}` }
758
+ });
759
+ const data = await res.json();
760
+ return ok(data);
761
+ } catch (err) {
762
+ return fail(err instanceof Error ? err.message : "Failed to verify");
763
+ }
764
+ }
765
+ });
766
+ }
626
767
 
627
768
  // src/cli/modules/index.ts
628
769
  function registerBuiltinCommands(app2) {
@@ -634,6 +775,8 @@ function registerBuiltinCommands(app2) {
634
775
  registerTodoCommands(site);
635
776
  registerNotificationCommands(site);
636
777
  registerConfigCommands(site);
778
+ registerPluginCommands(site);
779
+ registerAuthCommands(site);
637
780
  }
638
781
 
639
782
  // src/cli/index.ts