@beignet/cli 0.0.26 → 0.0.27

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 (75) hide show
  1. package/CHANGELOG.md +14 -0
  2. package/README.md +29 -10
  3. package/dist/choices.d.ts +8 -0
  4. package/dist/choices.d.ts.map +1 -1
  5. package/dist/choices.js +14 -0
  6. package/dist/choices.js.map +1 -1
  7. package/dist/db.js +2 -2
  8. package/dist/db.js.map +1 -1
  9. package/dist/index.d.ts.map +1 -1
  10. package/dist/index.js +109 -13
  11. package/dist/index.js.map +1 -1
  12. package/dist/inspect.js +51 -3
  13. package/dist/inspect.js.map +1 -1
  14. package/dist/make/inbox.d.ts +63 -0
  15. package/dist/make/inbox.d.ts.map +1 -0
  16. package/dist/make/inbox.js +1747 -0
  17. package/dist/make/inbox.js.map +1 -0
  18. package/dist/make/payments.d.ts +61 -0
  19. package/dist/make/payments.d.ts.map +1 -0
  20. package/dist/make/payments.js +1900 -0
  21. package/dist/make/payments.js.map +1 -0
  22. package/dist/make/shared.d.ts +575 -0
  23. package/dist/make/shared.d.ts.map +1 -0
  24. package/dist/make/shared.js +2166 -0
  25. package/dist/make/shared.js.map +1 -0
  26. package/dist/make/tenancy.d.ts +101 -0
  27. package/dist/make/tenancy.d.ts.map +1 -0
  28. package/dist/make/tenancy.js +4409 -0
  29. package/dist/make/tenancy.js.map +1 -0
  30. package/dist/make.d.ts +8 -44
  31. package/dist/make.d.ts.map +1 -1
  32. package/dist/make.js +71 -3659
  33. package/dist/make.js.map +1 -1
  34. package/dist/mcp.d.ts.map +1 -1
  35. package/dist/mcp.js +44 -3
  36. package/dist/mcp.js.map +1 -1
  37. package/dist/provider-add.d.ts +19 -0
  38. package/dist/provider-add.d.ts.map +1 -0
  39. package/dist/provider-add.js +691 -0
  40. package/dist/provider-add.js.map +1 -0
  41. package/dist/registry-edits.d.ts +9 -0
  42. package/dist/registry-edits.d.ts.map +1 -1
  43. package/dist/registry-edits.js +32 -0
  44. package/dist/registry-edits.js.map +1 -1
  45. package/dist/task.d.ts +2 -0
  46. package/dist/task.d.ts.map +1 -1
  47. package/dist/task.js +2 -0
  48. package/dist/task.js.map +1 -1
  49. package/dist/templates/agents.js +2 -2
  50. package/dist/templates/server.d.ts.map +1 -1
  51. package/dist/templates/server.js +44 -37
  52. package/dist/templates/server.js.map +1 -1
  53. package/dist/templates/shared.d.ts +5 -0
  54. package/dist/templates/shared.d.ts.map +1 -1
  55. package/dist/templates/shared.js +5 -0
  56. package/dist/templates/shared.js.map +1 -1
  57. package/package.json +2 -2
  58. package/skills/app-structure/SKILL.md +1 -1
  59. package/src/choices.ts +28 -0
  60. package/src/db.ts +2 -2
  61. package/src/index.ts +170 -13
  62. package/src/inspect.ts +68 -2
  63. package/src/make/inbox.ts +2015 -0
  64. package/src/make/payments.ts +2182 -0
  65. package/src/make/shared.ts +3550 -0
  66. package/src/make/tenancy.ts +4809 -0
  67. package/src/make.ts +380 -5289
  68. package/src/mcp.ts +65 -2
  69. package/src/provider-add.ts +926 -0
  70. package/src/registry-edits.ts +47 -0
  71. package/src/task.ts +8 -10
  72. package/src/templates/agents.ts +2 -2
  73. package/src/templates/server.ts +44 -37
  74. package/src/templates/shared.ts +5 -0
  75. package/src/test-helpers/generated-app.ts +168 -0
package/src/mcp.ts CHANGED
@@ -2,6 +2,7 @@ import path from "node:path";
2
2
  import { McpServer } from "@modelcontextprotocol/sdk/server/mcp.js";
3
3
  import { StdioServerTransport } from "@modelcontextprotocol/sdk/server/stdio.js";
4
4
  import { z } from "zod";
5
+ import { type ProviderPresetName, providerPresetChoices } from "./choices.js";
5
6
  import { applyDoctorFixes, inspectApp } from "./inspect.js";
6
7
  import { lintApp } from "./lint.js";
7
8
  import {
@@ -13,6 +14,7 @@ import {
13
14
  makeFeature,
14
15
  makeFeatureAddonChoices,
15
16
  makeFeatureRecipeChoices,
17
+ makeInbox,
16
18
  makeJob,
17
19
  makeListener,
18
20
  makeNotification,
@@ -24,10 +26,15 @@ import {
24
26
  makeSchedule,
25
27
  makeSeed,
26
28
  makeTask,
29
+ makeTenancy,
27
30
  makeTest,
28
31
  makeUpload,
29
32
  makeUseCase,
30
33
  } from "./make.js";
34
+ import {
35
+ type AddProviderPresetResult,
36
+ addProviderPreset,
37
+ } from "./provider-add.js";
31
38
 
32
39
  /**
33
40
  * Options for building or running the Beignet MCP server.
@@ -43,6 +50,7 @@ const makeArtifactChoices = [
43
50
  "event",
44
51
  "factory",
45
52
  "feature",
53
+ "inbox",
46
54
  "job",
47
55
  "listener",
48
56
  "notification",
@@ -54,6 +62,7 @@ const makeArtifactChoices = [
54
62
  "schedule",
55
63
  "seed",
56
64
  "task",
65
+ "tenancy",
57
66
  "test",
58
67
  "upload",
59
68
  "use-case",
@@ -69,7 +78,7 @@ const makeInputSchema = {
69
78
  .string()
70
79
  .optional()
71
80
  .describe(
72
- "Artifact name. Required except for outbox and payments. Feature-owned artifacts use feature-scoped paths such as posts/backfill.",
81
+ "Artifact name. Required except for inbox, outbox, payments, and tenancy. Feature-owned artifacts use feature-scoped paths such as posts/backfill.",
73
82
  ),
74
83
  with: z
75
84
  .array(z.enum(makeFeatureAddonChoices))
@@ -133,6 +142,18 @@ const makeInputSchema = {
133
142
  .describe("Preview generated changes without writing files."),
134
143
  };
135
144
 
145
+ const providerAddInputSchema = {
146
+ preset: z
147
+ .enum(providerPresetChoices)
148
+ .describe("Provider setup preset to add."),
149
+ dryRun: z
150
+ .boolean()
151
+ .optional()
152
+ .describe("Preview provider setup changes without writing files."),
153
+ };
154
+
155
+ const providerPresetDescription = providerPresetChoices.join(", ");
156
+
136
157
  type MakeToolInput = {
137
158
  artifact: MakeArtifact;
138
159
  name?: string;
@@ -150,6 +171,11 @@ type MakeToolInput = {
150
171
  dryRun?: boolean;
151
172
  };
152
173
 
174
+ type ProviderAddToolInput = {
175
+ preset: ProviderPresetName;
176
+ dryRun?: boolean;
177
+ };
178
+
153
179
  type McpToolResult = {
154
180
  content: Array<{ type: "text"; text: string }>;
155
181
  isError?: boolean;
@@ -194,6 +220,20 @@ async function runMakeTool(
194
220
  dryRun: input.dryRun,
195
221
  });
196
222
  }
223
+ if (input.artifact === "tenancy") {
224
+ return makeTenancy({
225
+ cwd,
226
+ force: input.force,
227
+ dryRun: input.dryRun,
228
+ });
229
+ }
230
+ if (input.artifact === "inbox") {
231
+ return makeInbox({
232
+ cwd,
233
+ force: input.force,
234
+ dryRun: input.dryRun,
235
+ });
236
+ }
197
237
  if (input.artifact === "outbox") {
198
238
  return makeOutbox({
199
239
  cwd,
@@ -266,6 +306,17 @@ async function runMakeTool(
266
306
  }
267
307
  }
268
308
 
309
+ async function runProviderAddTool(
310
+ cwd: string,
311
+ input: ProviderAddToolInput,
312
+ ): Promise<AddProviderPresetResult> {
313
+ return addProviderPreset({
314
+ name: input.preset,
315
+ cwd,
316
+ dryRun: input.dryRun,
317
+ });
318
+ }
319
+
269
320
  /**
270
321
  * Build the Beignet MCP server with routes, doctor, lint, and make tools.
271
322
  * Every tool resolves against the app directory captured at launch.
@@ -367,7 +418,7 @@ export function buildBeignetMcpServer(options: McpServerOptions): McpServer {
367
418
  "make",
368
419
  {
369
420
  description:
370
- "Generate Beignet app files for one artifact: adapter, contract, event, factory, feature, job, listener, notification, outbox, payments, policy, port, resource, schedule, seed, task, test, upload, or use-case. Generators auto-register artifacts, so doctor stays clean. Options by artifact: feature accepts with (addons); resource accepts auth, tenant, events, softDelete; listener requires event; schedule accepts cron, timezone, route. All artifacts accept force and dryRun. Returns created, updated, and skipped files as JSON.",
421
+ "Generate Beignet app files for one artifact: adapter, contract, event, factory, feature, inbox, job, listener, notification, outbox, payments, policy, port, resource, schedule, seed, task, tenancy, test, upload, or use-case. Generators auto-register artifacts, so doctor stays clean. Options by artifact: feature accepts with (addons); resource accepts auth, tenant, events, softDelete; listener requires event; schedule accepts cron, timezone, route. All artifacts accept force and dryRun. Returns created, updated, and skipped files as JSON.",
371
422
  inputSchema: makeInputSchema,
372
423
  },
373
424
  async (input) =>
@@ -376,6 +427,18 @@ export function buildBeignetMcpServer(options: McpServerOptions): McpServer {
376
427
  }),
377
428
  );
378
429
 
430
+ server.registerTool(
431
+ "provider_add",
432
+ {
433
+ description: `Add a Beignet provider setup preset to this app. Updates dependencies, provider registration, app port wiring, .env.example, and docs/integrations.md. Presets: ${providerPresetDescription}. Supports dryRun.`,
434
+ inputSchema: providerAddInputSchema,
435
+ },
436
+ async (input) =>
437
+ safeToolResult(async () => {
438
+ return jsonResult(await runProviderAddTool(cwd, input));
439
+ }),
440
+ );
441
+
379
442
  return server;
380
443
  }
381
444