@beignet/cli 0.0.26 → 0.0.28

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 (97) hide show
  1. package/CHANGELOG.md +26 -0
  2. package/README.md +59 -15
  3. package/dist/check.d.ts +61 -0
  4. package/dist/check.d.ts.map +1 -0
  5. package/dist/check.js +164 -0
  6. package/dist/check.js.map +1 -0
  7. package/dist/choices.d.ts +8 -0
  8. package/dist/choices.d.ts.map +1 -1
  9. package/dist/choices.js +14 -0
  10. package/dist/choices.js.map +1 -1
  11. package/dist/db.d.ts +8 -0
  12. package/dist/db.d.ts.map +1 -1
  13. package/dist/db.js +4 -4
  14. package/dist/db.js.map +1 -1
  15. package/dist/index.d.ts.map +1 -1
  16. package/dist/index.js +156 -21
  17. package/dist/index.js.map +1 -1
  18. package/dist/inspect.d.ts.map +1 -1
  19. package/dist/inspect.js +121 -3
  20. package/dist/inspect.js.map +1 -1
  21. package/dist/make/inbox.d.ts +63 -0
  22. package/dist/make/inbox.d.ts.map +1 -0
  23. package/dist/make/inbox.js +1747 -0
  24. package/dist/make/inbox.js.map +1 -0
  25. package/dist/make/payments.d.ts +61 -0
  26. package/dist/make/payments.d.ts.map +1 -0
  27. package/dist/make/payments.js +1900 -0
  28. package/dist/make/payments.js.map +1 -0
  29. package/dist/make/shared.d.ts +592 -0
  30. package/dist/make/shared.d.ts.map +1 -0
  31. package/dist/make/shared.js +2233 -0
  32. package/dist/make/shared.js.map +1 -0
  33. package/dist/make/tenancy.d.ts +101 -0
  34. package/dist/make/tenancy.d.ts.map +1 -0
  35. package/dist/make/tenancy.js +4409 -0
  36. package/dist/make/tenancy.js.map +1 -0
  37. package/dist/make.d.ts +8 -44
  38. package/dist/make.d.ts.map +1 -1
  39. package/dist/make.js +57 -3689
  40. package/dist/make.js.map +1 -1
  41. package/dist/mcp.d.ts.map +1 -1
  42. package/dist/mcp.js +45 -4
  43. package/dist/mcp.js.map +1 -1
  44. package/dist/provider-add.d.ts +19 -0
  45. package/dist/provider-add.d.ts.map +1 -0
  46. package/dist/provider-add.js +691 -0
  47. package/dist/provider-add.js.map +1 -0
  48. package/dist/provider-audit.d.ts.map +1 -1
  49. package/dist/provider-audit.js +77 -1
  50. package/dist/provider-audit.js.map +1 -1
  51. package/dist/registry-edits.d.ts +9 -0
  52. package/dist/registry-edits.d.ts.map +1 -1
  53. package/dist/registry-edits.js +32 -0
  54. package/dist/registry-edits.js.map +1 -1
  55. package/dist/task.d.ts +2 -0
  56. package/dist/task.d.ts.map +1 -1
  57. package/dist/task.js +2 -0
  58. package/dist/task.js.map +1 -1
  59. package/dist/templates/agents.d.ts.map +1 -1
  60. package/dist/templates/agents.js +29 -11
  61. package/dist/templates/agents.js.map +1 -1
  62. package/dist/templates/base.d.ts.map +1 -1
  63. package/dist/templates/base.js +42 -12
  64. package/dist/templates/base.js.map +1 -1
  65. package/dist/templates/db/sqlite.d.ts.map +1 -1
  66. package/dist/templates/db/sqlite.js +7 -1
  67. package/dist/templates/db/sqlite.js.map +1 -1
  68. package/dist/templates/server.d.ts.map +1 -1
  69. package/dist/templates/server.js +44 -37
  70. package/dist/templates/server.js.map +1 -1
  71. package/dist/templates/shared.d.ts +5 -0
  72. package/dist/templates/shared.d.ts.map +1 -1
  73. package/dist/templates/shared.js +5 -0
  74. package/dist/templates/shared.js.map +1 -1
  75. package/package.json +2 -2
  76. package/skills/app-structure/SKILL.md +1 -1
  77. package/src/check.ts +246 -0
  78. package/src/choices.ts +28 -0
  79. package/src/db.ts +4 -4
  80. package/src/index.ts +232 -21
  81. package/src/inspect.ts +168 -2
  82. package/src/make/inbox.ts +2015 -0
  83. package/src/make/payments.ts +2182 -0
  84. package/src/make/shared.ts +3638 -0
  85. package/src/make/tenancy.ts +4809 -0
  86. package/src/make.ts +388 -5355
  87. package/src/mcp.ts +66 -3
  88. package/src/provider-add.ts +926 -0
  89. package/src/provider-audit.ts +95 -3
  90. package/src/registry-edits.ts +47 -0
  91. package/src/task.ts +8 -10
  92. package/src/templates/agents.ts +29 -11
  93. package/src/templates/base.ts +43 -12
  94. package/src/templates/db/sqlite.ts +7 -1
  95. package/src/templates/server.ts +44 -37
  96. package/src/templates/shared.ts +5 -0
  97. package/src/test-helpers/generated-app.ts +168 -0
package/CHANGELOG.md CHANGED
@@ -1,5 +1,31 @@
1
1
  # @beignet/cli
2
2
 
3
+ ## 0.0.28
4
+
5
+ ### Patch Changes
6
+
7
+ - 57504c5: Add `beignet check`, one command for the full validation loop: `beignet lint`, `beignet doctor --strict` (with optional `--fix`), and the app's `lint`, `typecheck`, and `test` package scripts. Every step runs even when an earlier one fails; missing scripts are skipped. `beignet doctor --fix` now also wires fully unregistered feature listener registries into the providers file with the same listeners provider `beignet make listener` generates.
8
+ - f21e8af: Make existing framework machinery easier to find and safer to miss. Generated AGENTS.md/CLAUDE.md gain a need-to-API capability index (query invalidation, service contexts, ports outside requests, raw routes, metadata-driven hooks, test harnesses). `createTestApp` warns when registered contracts declare `metadata.rateLimit` or `metadata.idempotency` the test app cannot enforce. The sqlite starter enables `PRAGMA foreign_keys` and scopes `busy_timeout` to local files (remote libsql rejects it). `beignet provider` aliases to `providers`, and provider registration detection resolves `const` initializers so environment-switched providers extracted to named constants no longer report as unregistered.
9
+ - c7f7f1d: Document optional Next.js 16 cookie-only Better Auth proxy redirects for app-specific protected UI routes.
10
+ - Updated dependencies [57504c5]
11
+ - Updated dependencies [57504c5]
12
+ - Updated dependencies [3f4728d]
13
+ - @beignet/core@0.0.28
14
+
15
+ ## 0.0.27
16
+
17
+ ### Patch Changes
18
+
19
+ - 88200a0: `beignet task run <name> --tenant <id|slug>` passes the tenant to the app's `createTaskContext` and `stopTaskContext` separately from task input, so tenant selection no longer has to live in task input schemas. `@beignet/core/tasks` exports the `TaskRunContextArgs` contract for those registry exports, and the task run result includes the tenant when one was passed.
20
+ - f2461a9: Add lazy Next route server loaders and update generated route files and package docs to avoid booting providers during production build imports.
21
+ - 4f54fc1: Add `beignet providers add` presets for first-party provider setup, including flags, mail, search, error reporting, rate limiting, Redis, and S3-compatible storage, plus matching MCP support.
22
+ - 8021c30: Add `beignet make tenancy` and `beignet make inbox` generators and upgrade `beignet make payments` with free/pro plans, entitlement gating, seeds, and a plan settings UI. `make tenancy` scaffolds a workspace feature with membership-aware tenant resolution, invites, a demo seed, and workspace settings UI; `make inbox` scaffolds a per-user in-app notification inbox with a `defineInboxNotificationChannel` channel factory. Generated seed entrypoints now live at `server/seed.ts` (instead of `infra/db/seed.ts`) so `beignet lint` stays clean, and all generators compose into one seed entrypoint.
23
+ - Updated dependencies [88200a0]
24
+ - Updated dependencies [88200a0]
25
+ - Updated dependencies [afbe1b3]
26
+ - Updated dependencies [f2461a9]
27
+ - @beignet/core@0.0.27
28
+
3
29
  ## 0.0.26
4
30
 
5
31
  ### Patch Changes
package/README.md CHANGED
@@ -11,11 +11,11 @@ The package ships a single `beignet` bin. Generated apps install
11
11
  day-to-day form inside an app is:
12
12
 
13
13
  ```bash
14
- bun beignet doctor --strict
14
+ bun beignet check
15
15
  ```
16
16
 
17
- With npm use `npm run beignet -- doctor --strict`, with pnpm
18
- `pnpm beignet doctor --strict`, and with yarn `yarn beignet doctor --strict`.
17
+ With npm use `npm run beignet -- check`, with pnpm `pnpm beignet check`, and
18
+ with yarn `yarn beignet check`.
19
19
  For one-off runs outside an app, invoke the scoped package directly:
20
20
 
21
21
  ```bash
@@ -184,8 +184,10 @@ beignet make factory <feature>/<name> [options]
184
184
  beignet make feature <name> [options]
185
185
  beignet make job <feature>/<name> [options]
186
186
  beignet make notification <feature>/<name> [options]
187
+ beignet make inbox [options]
187
188
  beignet make outbox [options]
188
189
  beignet make payments [options]
190
+ beignet make tenancy [options]
189
191
  beignet make listener <feature>/<name> --event <feature>/<event> [options]
190
192
  beignet make schedule <feature>/<name> [options]
191
193
  beignet make upload <feature>/<name> [options]
@@ -201,8 +203,10 @@ beignet db migrate [--dry-run] [--json]
201
203
  beignet db seed [--dry-run] [--json]
202
204
  beignet db reset [--dry-run] [--json]
203
205
  beignet routes [--json] [--cwd <dir>]
206
+ beignet check [--json] [--fix] [--cwd <dir>]
204
207
  beignet lint [--json] [--cwd <dir>] [--format human|json|github]
205
208
  beignet doctor [--json] [--strict] [--fix] [--cwd <dir>] [--format human|json|github]
209
+ beignet providers add <preset> [--dry-run] [--json] [--cwd <dir>]
206
210
  beignet providers audit [--json] [--cwd <dir>]
207
211
  beignet mcp
208
212
  beignet completion install [--shell bash|zsh] [--json]
@@ -219,9 +223,10 @@ Options:
219
223
  --force Write into a non-empty directory.
220
224
  --dry-run Preview create/make writes without changing files.
221
225
  --json Print machine-readable output.
222
- --cwd path/to/app Run routes, lint, doctor, or provider audit against another app directory.
226
+ --cwd path/to/app Run routes, check, lint, doctor, provider add, or provider audit against another app directory.
223
227
  --format github Output format for lint and doctor: human, json, or github.
224
228
  --input '{"dryRun":true}' JSON input for `beignet task run`.
229
+ --tenant acme Tenant id or slug passed to the app's createTaskContext by `beignet task run`, separate from task input.
225
230
  --payload '{"date":"..."}' JSON payload for `beignet schedule run`.
226
231
  --module server/tasks.ts Override the task, outbox, or schedule registry path.
227
232
  --batch-size 100 Maximum outbox messages to claim in one drain pass.
@@ -232,7 +237,9 @@ Options:
232
237
  --source manual Provider or app source label for schedule runs.
233
238
  --with policy,events Add optional artifacts to `make feature`; also supports factories, seeds, tasks, listeners, jobs, notifications, schedules, ui, uploads.
234
239
  --recipe full-slice Add the canonical full-slice feature recipe: policy, client UI, workflow artifacts, outbox-ready events/jobs, and listener registration.
235
- make payments Add `features/billing`, a `createPaymentWebhookRoute(...)` route, billing persistence, entitlement checks, and local memory payments provider wiring.
240
+ make tenancy Add `features/workspaces` with membership-aware tenant resolution, workspace/member/invite routes, a demo seed, and workspace settings UI on shell apps.
241
+ make payments Add `features/billing` with free/pro plans, a `createPaymentWebhookRoute(...)` route, billing persistence, entitlement gating, a demo seed, and a plan settings UI on shell apps.
242
+ make inbox Add `features/inbox` with a per-user notification inbox, an in-app notification channel, cursor-paginated routes, and an inbox page on shell apps.
236
243
  --auth Add authorization metadata, policy wiring, policy tests, and use-case gate checks to `make resource`.
237
244
  --tenant Add tenant-scoped schemas, repository filters, and use-case tenant checks to `make resource`.
238
245
  --events Add created, updated, and deleted domain events to `make resource`.
@@ -241,6 +248,7 @@ Options:
241
248
  --cron "0 9 * * *" Cron expression for `make schedule`.
242
249
  --timezone America/Chicago Timezone for `make schedule`.
243
250
  --route Add a Next.js cron route for `make schedule`.
251
+ providers add redis-cache Add dependencies, provider wiring, env examples, and setup notes for a supported provider preset.
244
252
  --strict Include CI-oriented doctor warnings and fail on warnings.
245
253
  --fix Apply low-risk doctor fixes before reporting.
246
254
  --shell zsh Shell for `completion install`/`uninstall`. Defaults to $SHELL.
@@ -643,10 +651,13 @@ Each command creates or updates the folder's `index.ts` with an exported
643
651
  registry such as `postTasks`, `postJobs`, `postNotifications`,
644
652
  `postListeners`, `postSchedules`, or `postUploads`. Task generators also
645
653
  create or update `server/tasks.ts`, which is the registry and lifecycle
646
- boundary used by `beignet task run <name> --input '{"dryRun":true}'`.
654
+ boundary used by
655
+ `beignet task run <name> --tenant acme --input '{"dryRun":true}'`.
647
656
  New task registries include `createTaskContext(...)` and
648
657
  `stopTaskContext(...)` placeholders so provider startup and teardown stay
649
- out of task definitions.
658
+ out of task definitions. Both receive `TaskRunContextArgs` from
659
+ `@beignet/core/tasks` — the task, task name, parsed input, and the optional
660
+ `--tenant` value — so tenant scoping stays out of task input schemas.
650
661
 
651
662
  `make outbox` creates `server/outbox.ts` and a bounded
652
663
  `app/api/cron/outbox/drain` route. `make event` and `make job` create that
@@ -749,7 +760,7 @@ beignet db reset
749
760
 
750
761
  The CLI delegates to app-owned package scripts named `db:generate`,
751
762
  `db:migrate`, `db:seed`, and `db:reset`. In standard Drizzle apps, those scripts
752
- run Drizzle Kit and the generated `infra/db/seed.ts` / `infra/db/reset.ts`
763
+ run Drizzle Kit and the generated `server/seed.ts` / `infra/db/reset.ts`
753
764
  entrypoints. This keeps schema generation and migration behavior Drizzle-native
754
765
  while making the lifecycle discoverable through Beignet.
755
766
 
@@ -775,7 +786,7 @@ beignet make seed posts/demo-posts
775
786
 
776
787
  Factories are written under `features/posts/tests/factories/` and persist
777
788
  through app-owned repository ports. Seeds are written under
778
- `features/posts/seeds/`; `make seed` creates the app-owned `infra/db/seed.ts`
789
+ `features/posts/seeds/`; `make seed` creates the app-owned `server/seed.ts`
779
790
  entrypoint and `db:seed` script when they are missing.
780
791
 
781
792
  Generated feature and use-case tests use Beignet's test context helpers so
@@ -810,6 +821,27 @@ Use JSON output when you want to feed the route catalog into another tool:
810
821
  beignet routes --json
811
822
  ```
812
823
 
824
+ ## Run the validation loop
825
+
826
+ Run `check` when you want the whole validation loop as one command:
827
+
828
+ ```bash
829
+ beignet check
830
+ ```
831
+
832
+ It runs `beignet lint`, `beignet doctor --strict`, and the app's own `lint`,
833
+ `typecheck`, and `test` package scripts through the detected package manager,
834
+ in that order. Every step runs even when an earlier one fails, so a single
835
+ run reports everything that needs fixing; the command exits non-zero when any
836
+ step fails. Missing package scripts are reported as skipped, never as
837
+ failures.
838
+
839
+ Use `beignet check --fix` to apply doctor's low-risk registration fixes
840
+ before checking, and `beignet check --json` for a versioned payload
841
+ (`schemaVersion: 1`) with the step list, statuses, captured failure output,
842
+ and applied fixes. The individual commands below still work when you need one
843
+ check alone or its `--format github` output.
844
+
813
845
  ## Lint app architecture
814
846
 
815
847
  Run `lint` when you want the CLI to enforce Beignet dependency direction:
@@ -928,10 +960,18 @@ metadata in installed package manifests. The CLI does not import provider
928
960
  implementation modules to discover those facts, and it reports malformed
929
961
  metadata before using provider-derived doctor rules.
930
962
 
963
+ Use `beignet providers add <preset>` to wire a stable provider recipe after
964
+ app creation. It updates `package.json`, `server/providers.ts`, app port
965
+ types, deferred port wiring, `.env.example`, and `docs/integrations.md`.
966
+ Supported presets are `flags-openfeature`, `mail-resend`, `mail-smtp`,
967
+ `search-meilisearch`, `sentry`, `upstash-rate-limit`, `redis-cache`,
968
+ `redis-locks`, and `s3-storage`; pass `--dry-run --json` to preview the exact
969
+ file changes.
970
+
931
971
  Use `beignet providers audit` when you want a report-only inventory of the
932
- provider packages installed in an app. The human audit prints provider metadata
933
- validity, registration status, required env, required tables, and declared app
934
- ports. `beignet providers audit --json` returns a versioned
972
+ provider packages installed in an app. The human audit prints provider
973
+ metadata validity, registration status, required env, required tables, and
974
+ declared app ports. `beignet providers audit --json` returns a versioned
935
975
  `schemaVersion: 1` payload with active variants and watchers for scripts and
936
976
  coding agents. The command does not fail CI for missing setup; stable,
937
977
  actionable findings belong in `doctor`.
@@ -949,12 +989,15 @@ passes `doctor --strict`. Use
949
989
  Use `beignet doctor --fix` for low-risk maintenance fixes. Today it can add
950
990
  a missing `test` script, register existing feature route groups in the central
951
991
  route list, register unregistered feature schedule, task, and outbox
952
- event/job registries in their existing central registry files, and repair
992
+ event/job registries in their existing central registry files, wire fully
993
+ unregistered feature listener registries into the generated providers file
994
+ with the same listeners provider `beignet make listener` generates, and repair
953
995
  direct `createOpenAPIHandler([...])` arrays when the missing contracts are
954
996
  already imported in the OpenAPI route. Registry fixes are append-only: when a
955
997
  central file is missing, an anchor is customized beyond recognition, or some
956
998
  artifacts are already registered individually, the fix bails out and the
957
- diagnostic stays. Listener registration is report-only because apps own their
999
+ diagnostic stays. The listener fix additionally bails when the app has no
1000
+ `eventBus` port or the providers array is customized, because apps own their
958
1001
  event-bus wiring.
959
1002
 
960
1003
  ## MCP server for coding agents
@@ -966,7 +1009,7 @@ call the CLI as tools:
966
1009
  beignet mcp
967
1010
  ```
968
1011
 
969
- The server exposes five tools:
1012
+ The server exposes six tools:
970
1013
 
971
1014
  - `routes` - list app routes and contracts (read-only)
972
1015
  - `doctor` - drift diagnostics as JSON, `{ strict?: boolean }` defaults to
@@ -977,6 +1020,7 @@ The server exposes five tools:
977
1020
  - `lint` - architecture dependency-direction diagnostics (read-only)
978
1021
  - `make` - run a generator with `{ artifact, name, ...options }`, the same
979
1022
  artifact kinds as `beignet make`
1023
+ - `provider_add` - add a provider setup preset with `{ preset, dryRun? }`
980
1024
 
981
1025
  Tool outputs match the JSON the matching `--json` flags print. Generated apps
982
1026
  ship a `.mcp.json` that runs `./node_modules/.bin/beignet mcp`, so Claude
@@ -0,0 +1,61 @@
1
+ import { type InspectFix } from "./inspect.js";
2
+ /**
3
+ * One step of `beignet check`.
4
+ *
5
+ * `output` carries the failing step's formatted diagnostics or captured
6
+ * script output so the summary is actionable without a re-run.
7
+ */
8
+ export type CheckStep = {
9
+ name: string;
10
+ command: string;
11
+ status: "passed" | "failed" | "skipped";
12
+ detail?: string;
13
+ output?: string;
14
+ durationMs: number;
15
+ };
16
+ export type CheckAppResult = {
17
+ schemaVersion: 1;
18
+ targetDir: string;
19
+ runner: string;
20
+ ok: boolean;
21
+ fixes: InspectFix[];
22
+ steps: CheckStep[];
23
+ };
24
+ export type CheckAppOptions = {
25
+ cwd?: string;
26
+ fix?: boolean;
27
+ color?: boolean;
28
+ /** Called after each step completes, for incremental progress output. */
29
+ onStep?: (step: CheckStep) => void;
30
+ };
31
+ /**
32
+ * Run the whole app validation loop as one command: `beignet lint`,
33
+ * `beignet doctor --strict` (optionally with fixes), and the app's own
34
+ * `lint`, `typecheck`, and `test` package scripts through the detected
35
+ * package manager.
36
+ *
37
+ * Every step runs even when an earlier one fails, so a single run reports
38
+ * everything that needs fixing. Missing package scripts are reported as
39
+ * skipped, never as failures.
40
+ */
41
+ export declare function checkApp(options?: CheckAppOptions): Promise<CheckAppResult>;
42
+ /**
43
+ * Format a completed step as a single status line, with the failing step's
44
+ * output indented underneath.
45
+ */
46
+ export declare function formatCheckStep(step: CheckStep, options?: {
47
+ color?: boolean;
48
+ }): string;
49
+ /**
50
+ * Format the closing summary line, e.g. `3 passed, 1 failed, 1 skipped`.
51
+ */
52
+ export declare function formatCheckSummary(result: CheckAppResult, options?: {
53
+ color?: boolean;
54
+ }): string;
55
+ /**
56
+ * Format a full result at once (JSON-free callers and tests).
57
+ */
58
+ export declare function formatCheck(result: CheckAppResult, options?: {
59
+ color?: boolean;
60
+ }): string;
61
+ //# sourceMappingURL=check.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"check.d.ts","sourceRoot":"","sources":["../src/check.ts"],"names":[],"mappings":"AAIA,OAAO,EAGL,KAAK,UAAU,EAEhB,MAAM,cAAc,CAAC;AAGtB;;;;;GAKG;AACH,MAAM,MAAM,SAAS,GAAG;IACtB,IAAI,EAAE,MAAM,CAAC;IACb,OAAO,EAAE,MAAM,CAAC;IAChB,MAAM,EAAE,QAAQ,GAAG,QAAQ,GAAG,SAAS,CAAC;IACxC,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,UAAU,EAAE,MAAM,CAAC;CACpB,CAAC;AAEF,MAAM,MAAM,cAAc,GAAG;IAC3B,aAAa,EAAE,CAAC,CAAC;IACjB,SAAS,EAAE,MAAM,CAAC;IAClB,MAAM,EAAE,MAAM,CAAC;IACf,EAAE,EAAE,OAAO,CAAC;IACZ,KAAK,EAAE,UAAU,EAAE,CAAC;IACpB,KAAK,EAAE,SAAS,EAAE,CAAC;CACpB,CAAC;AAEF,MAAM,MAAM,eAAe,GAAG;IAC5B,GAAG,CAAC,EAAE,MAAM,CAAC;IACb,GAAG,CAAC,EAAE,OAAO,CAAC;IACd,KAAK,CAAC,EAAE,OAAO,CAAC;IAChB,yEAAyE;IACzE,MAAM,CAAC,EAAE,CAAC,IAAI,EAAE,SAAS,KAAK,IAAI,CAAC;CACpC,CAAC;AAIF;;;;;;;;;GASG;AACH,wBAAsB,QAAQ,CAC5B,OAAO,GAAE,eAAoB,GAC5B,OAAO,CAAC,cAAc,CAAC,CA0BzB;AAED;;;GAGG;AACH,wBAAgB,eAAe,CAC7B,IAAI,EAAE,SAAS,EACf,OAAO,GAAE;IAAE,KAAK,CAAC,EAAE,OAAO,CAAA;CAAO,GAChC,MAAM,CAkBR;AAED;;GAEG;AACH,wBAAgB,kBAAkB,CAChC,MAAM,EAAE,cAAc,EACtB,OAAO,GAAE;IAAE,KAAK,CAAC,EAAE,OAAO,CAAA;CAAO,GAChC,MAAM,CAWR;AAED;;GAEG;AACH,wBAAgB,WAAW,CACzB,MAAM,EAAE,cAAc,EACtB,OAAO,GAAE;IAAE,KAAK,CAAC,EAAE,OAAO,CAAA;CAAO,GAChC,MAAM,CAGR"}
package/dist/check.js ADDED
@@ -0,0 +1,164 @@
1
+ import { readFile } from "node:fs/promises";
2
+ import path from "node:path";
3
+ import { createPainter } from "./ansi.js";
4
+ import { detectPackageManager, spawnCommand } from "./db.js";
5
+ import { applyDoctorFixes, formatDoctor, inspectApp, } from "./inspect.js";
6
+ import { formatLint, lintApp } from "./lint.js";
7
+ const scriptStepNames = ["lint", "typecheck", "test"];
8
+ /**
9
+ * Run the whole app validation loop as one command: `beignet lint`,
10
+ * `beignet doctor --strict` (optionally with fixes), and the app's own
11
+ * `lint`, `typecheck`, and `test` package scripts through the detected
12
+ * package manager.
13
+ *
14
+ * Every step runs even when an earlier one fails, so a single run reports
15
+ * everything that needs fixing. Missing package scripts are reported as
16
+ * skipped, never as failures.
17
+ */
18
+ export async function checkApp(options = {}) {
19
+ const targetDir = path.resolve(options.cwd ?? process.cwd());
20
+ const runner = await detectPackageManager(targetDir);
21
+ const steps = [];
22
+ const record = (step) => {
23
+ steps.push(step);
24
+ options.onStep?.(step);
25
+ };
26
+ record(await lintStep(targetDir, options));
27
+ const { step: doctorStep, fixes } = await runDoctorStep(targetDir, options);
28
+ record(doctorStep);
29
+ const scripts = await readPackageScripts(targetDir);
30
+ for (const script of scriptStepNames) {
31
+ record(await scriptStep(targetDir, runner, script, scripts));
32
+ }
33
+ return {
34
+ schemaVersion: 1,
35
+ targetDir,
36
+ runner,
37
+ ok: steps.every((step) => step.status !== "failed"),
38
+ fixes,
39
+ steps,
40
+ };
41
+ }
42
+ /**
43
+ * Format a completed step as a single status line, with the failing step's
44
+ * output indented underneath.
45
+ */
46
+ export function formatCheckStep(step, options = {}) {
47
+ const paint = createPainter(options.color);
48
+ const mark = step.status === "passed"
49
+ ? paint("✓", "green")
50
+ : step.status === "failed"
51
+ ? paint("✗", "red")
52
+ : paint("-", "cyan");
53
+ const detail = step.detail ? ` (${step.detail})` : "";
54
+ const line = `${mark} ${step.name}${detail}`;
55
+ if (step.status !== "failed" || !step.output?.trim())
56
+ return line;
57
+ const indented = step.output
58
+ .trimEnd()
59
+ .split("\n")
60
+ .map((outputLine) => ` ${outputLine}`)
61
+ .join("\n");
62
+ return `${line}\n${indented}`;
63
+ }
64
+ /**
65
+ * Format the closing summary line, e.g. `3 passed, 1 failed, 1 skipped`.
66
+ */
67
+ export function formatCheckSummary(result, options = {}) {
68
+ const paint = createPainter(options.color);
69
+ const counts = {
70
+ passed: result.steps.filter((step) => step.status === "passed").length,
71
+ failed: result.steps.filter((step) => step.status === "failed").length,
72
+ skipped: result.steps.filter((step) => step.status === "skipped").length,
73
+ };
74
+ const parts = [`${counts.passed} passed`];
75
+ if (counts.failed > 0)
76
+ parts.push(paint(`${counts.failed} failed`, "red"));
77
+ if (counts.skipped > 0)
78
+ parts.push(`${counts.skipped} skipped`);
79
+ return parts.join(", ");
80
+ }
81
+ /**
82
+ * Format a full result at once (JSON-free callers and tests).
83
+ */
84
+ export function formatCheck(result, options = {}) {
85
+ const lines = result.steps.map((step) => formatCheckStep(step, options));
86
+ return `${lines.join("\n")}\n\n${formatCheckSummary(result, options)}`;
87
+ }
88
+ async function lintStep(targetDir, options) {
89
+ const startedAt = Date.now();
90
+ const result = await lintApp({ cwd: targetDir });
91
+ const failed = result.diagnostics.length > 0;
92
+ return {
93
+ name: "beignet lint",
94
+ command: "beignet lint",
95
+ status: failed ? "failed" : "passed",
96
+ ...(failed ? { output: formatLint(result, { color: options.color }) } : {}),
97
+ durationMs: Date.now() - startedAt,
98
+ };
99
+ }
100
+ async function runDoctorStep(targetDir, options) {
101
+ const startedAt = Date.now();
102
+ const fixes = options.fix
103
+ ? await applyDoctorFixes({ cwd: targetDir, strict: true })
104
+ : [];
105
+ const result = await inspectApp({ cwd: targetDir, strict: true });
106
+ result.fixes = fixes;
107
+ const failed = result.diagnostics.some((diagnostic) => diagnostic.severity === "error" || diagnostic.severity === "warning");
108
+ return {
109
+ step: {
110
+ name: "beignet doctor --strict",
111
+ command: "beignet doctor --strict",
112
+ status: failed ? "failed" : "passed",
113
+ ...(fixes.length > 0
114
+ ? {
115
+ detail: `${fixes.length} ${fixes.length === 1 ? "fix" : "fixes"} applied`,
116
+ }
117
+ : {}),
118
+ ...(failed
119
+ ? { output: formatDoctor(result, { color: options.color }) }
120
+ : {}),
121
+ durationMs: Date.now() - startedAt,
122
+ },
123
+ fixes,
124
+ };
125
+ }
126
+ async function scriptStep(targetDir, runner, script, scripts) {
127
+ const command = `${runner} run ${script}`;
128
+ if (!scripts[script]) {
129
+ return {
130
+ name: script,
131
+ command,
132
+ status: "skipped",
133
+ detail: `no "${script}" script in package.json`,
134
+ durationMs: 0,
135
+ };
136
+ }
137
+ const startedAt = Date.now();
138
+ const result = await spawnCommand(runner, ["run", script], targetDir, {
139
+ captureOutput: true,
140
+ });
141
+ const failed = result.exitCode !== 0;
142
+ return {
143
+ name: script,
144
+ command,
145
+ status: failed ? "failed" : "passed",
146
+ detail: command,
147
+ ...(failed
148
+ ? { output: [result.stdout, result.stderr].filter(Boolean).join("\n") }
149
+ : {}),
150
+ durationMs: Date.now() - startedAt,
151
+ };
152
+ }
153
+ async function readPackageScripts(targetDir) {
154
+ let source;
155
+ try {
156
+ source = await readFile(path.join(targetDir, "package.json"), "utf8");
157
+ }
158
+ catch {
159
+ throw new Error("Could not find package.json. Run beignet check from the app root.");
160
+ }
161
+ const parsed = JSON.parse(source);
162
+ return parsed.scripts ?? {};
163
+ }
164
+ //# sourceMappingURL=check.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"check.js","sourceRoot":"","sources":["../src/check.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAA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AE,MAAM,CAAC,EAAE,SAAS,EAAE;QACpE,aAAa,EAAE,IAAI;KACpB,CAAC,CAAC;IACH,MAAM,MAAM,GAAG,MAAM,CAAC,QAAQ,KAAK,CAAC,CAAC;IAErC,OAAO;QACL,IAAI,EAAE,MAAM;QACZ,OAAO;QACP,MAAM,EAAE,MAAM,CAAC,CAAC,CAAC,QAAQ,CAAC,CAAC,CAAC,QAAQ;QACpC,MAAM,EAAE,OAAO;QACf,GAAG,CAAC,MAAM;YACR,CAAC,CAAC,EAAE,MAAM,EAAE,CAAC,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,MAAM,CAAC,CAAC,MAAM,CAAC,OAAO,CAAC,CAAC,IAAI,CAAC,IAAI,CAAC,EAAE;YACvE,CAAC,CAAC,EAAE,CAAC;QACP,UAAU,EAAE,IAAI,CAAC,GAAG,EAAE,GAAG,SAAS;KACnC,CAAC;AACJ,CAAC;AAED,KAAK,UAAU,kBAAkB,CAC/B,SAAiB;IAEjB,IAAI,MAAc,CAAC;IACnB,IAAI,CAAC;QACH,MAAM,GAAG,MAAM,QAAQ,CAAC,IAAI,CAAC,IAAI,CAAC,SAAS,EAAE,cAAc,CAAC,EAAE,MAAM,CAAC,CAAC;IACxE,CAAC;IAAC,MAAM,CAAC;QACP,MAAM,IAAI,KAAK,CACb,mEAAmE,CACpE,CAAC;IACJ,CAAC;IAED,MAAM,MAAM,GAAG,IAAI,CAAC,KAAK,CAAC,MAAM,CAE/B,CAAC;IACF,OAAO,MAAM,CAAC,OAAO,IAAI,EAAE,CAAC;AAC9B,CAAC"}
package/dist/choices.d.ts CHANGED
@@ -23,6 +23,10 @@ export type IntegrationName = "inngest" | "resend" | "upstash-rate-limit";
23
23
  * Databases supported by the starter's Drizzle persistence layer.
24
24
  */
25
25
  export type DatabaseName = "sqlite" | "postgres" | "mysql";
26
+ /**
27
+ * Provider setup presets supported by `beignet providers add`.
28
+ */
29
+ export type ProviderPresetName = "flags-openfeature" | "mail-resend" | "mail-smtp" | "search-meilisearch" | "sentry" | "upstash-rate-limit" | "redis-cache" | "redis-locks" | "s3-storage";
26
30
  /**
27
31
  * Supported scaffold template choices.
28
32
  */
@@ -39,6 +43,10 @@ export declare const integrationChoices: readonly ["inngest", "resend", "upstash
39
43
  * Supported scaffold database choices.
40
44
  */
41
45
  export declare const databaseChoices: readonly ["sqlite", "postgres", "mysql"];
46
+ /**
47
+ * Supported provider setup preset choices.
48
+ */
49
+ export declare const providerPresetChoices: readonly ["flags-openfeature", "mail-resend", "mail-smtp", "search-meilisearch", "sentry", "upstash-rate-limit", "redis-cache", "redis-locks", "s3-storage"];
42
50
  /**
43
51
  * Local database name derived from the app name.
44
52
  *
@@ -1 +1 @@
1
- {"version":3,"file":"choices.d.ts","sourceRoot":"","sources":["../src/choices.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH;;GAEG;AACH,MAAM,MAAM,cAAc,GAAG,KAAK,GAAG,KAAK,GAAG,MAAM,GAAG,MAAM,CAAC;AAC7D;;GAEG;AACH,MAAM,MAAM,YAAY,GAAG,MAAM,CAAC;AAClC;;;;;GAKG;AACH,MAAM,MAAM,eAAe,GAAG,SAAS,GAAG,QAAQ,GAAG,oBAAoB,CAAC;AAC1E;;GAEG;AACH,MAAM,MAAM,YAAY,GAAG,QAAQ,GAAG,UAAU,GAAG,OAAO,CAAC;AAE3D;;GAEG;AACH,eAAO,MAAM,eAAe,mBAEgB,CAAC;AAE7C;;GAEG;AACH,eAAO,MAAM,qBAAqB,yCAKY,CAAC;AAE/C;;GAEG;AACH,eAAO,MAAM,kBAAkB,sDAIgB,CAAC;AAEhD;;GAEG;AACH,eAAO,MAAM,eAAe,0CAIgB,CAAC;AAE7C;;;;;;;GAOG;AACH,wBAAgB,iBAAiB,CAAC,OAAO,EAAE,MAAM,GAAG,MAAM,CAEzD;AAED;;;;GAIG;AACH,wBAAgB,oBAAoB,CAClC,QAAQ,EAAE,YAAY,EACtB,OAAO,EAAE,MAAM,GACd,MAAM,GAAG,SA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DAIgB,CAAC;AAEhD;;GAEG;AACH,eAAO,MAAM,eAAe,0CAIgB,CAAC;AAE7C;;GAEG;AACH,eAAO,MAAM,qBAAqB,8JAUgB,CAAC;AAEnD;;;;;;;GAOG;AACH,wBAAgB,iBAAiB,CAAC,OAAO,EAAE,MAAM,GAAG,MAAM,CAEzD;AAED;;;;GAIG;AACH,wBAAgB,oBAAoB,CAClC,QAAQ,EAAE,YAAY,EACtB,OAAO,EAAE,MAAM,GACd,MAAM,GAAG,SAAS,CAWpB;AAED;;;GAGG;AACH,wBAAgB,gBAAgB,CAC9B,QAAQ,EAAE,YAAY,EACtB,OAAO,EAAE,MAAM,GACd,MAAM,CAWR;AAED;;GAEG;AACH,MAAM,MAAM,eAAe,GAAG,MAAM,GAAG,KAAK,CAAC;AAE7C;;GAEG;AACH,eAAO,MAAM,sBAAsB,0BAGY,CAAC;AAEhD;;GAEG;AACH,eAAO,MAAM,uBAAuB,+NAqB1B,CAAC;AAEX;;GAEG;AACH,MAAM,MAAM,gBAAgB,GAAG,CAAC,OAAO,uBAAuB,CAAC,CAAC,MAAM,CAAC,CAAC;AAExE;;GAEG;AACH,eAAO,MAAM,wBAAwB,yBAA0B,CAAC;AAEhE;;GAEG;AACH,MAAM,MAAM,iBAAiB,GAAG,CAAC,OAAO,wBAAwB,CAAC,CAAC,MAAM,CAAC,CAAC"}
package/dist/choices.js CHANGED
@@ -35,6 +35,20 @@ export const databaseChoices = [
35
35
  "postgres",
36
36
  "mysql",
37
37
  ];
38
+ /**
39
+ * Supported provider setup preset choices.
40
+ */
41
+ export const providerPresetChoices = [
42
+ "flags-openfeature",
43
+ "mail-resend",
44
+ "mail-smtp",
45
+ "search-meilisearch",
46
+ "sentry",
47
+ "upstash-rate-limit",
48
+ "redis-cache",
49
+ "redis-locks",
50
+ "s3-storage",
51
+ ];
38
52
  /**
39
53
  * Local database name derived from the app name.
40
54
  *
@@ -1 +1 @@
1
- {"version":3,"file":"choices.js","sourceRoot":"","sources":["../src/choices.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,sBAAsB,GAAG;IACpC,MAAM;IACN,KAAK;CACwC,CAAC;AAEhD;;GAEG;AACH,MAAM,CAAC,MAAM,uBAAuB,GAAG;IACrC,QAAQ;IACR,SAAS;IACT,WAAW;IACX,OAAO;IACP,QAAQ;IACR,KAAK;IACL,MAAM;IACN,UAAU;IACV,WAAW;IACX,cAAc;IACd,eAAe;IACf,UAAU;IACV,WAAW;IACX,MAAM;IACN,OAAO;IACP,MAAM;IACN,OAAO;IACP,IAAI;IACJ,QAAQ;IACR,SAAS;CACD,CAAC;AAOX;;GAEG;AACH,MAAM,CAAC,MAAM,wBAAwB,GAAG,CAAC,YAAY,CAAU,CAAC"}
1
+ {"version":3,"file":"choices.js","sourceRoot":"","sources":["../src/choices.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAmCH;;GAEG;AACH,MAAM,CAAC,MAAM,eAAe,GAAG;IAC7B,MAAM;CACoC,CAAC;AAE7C;;GAEG;AACH,MAAM,CAAC,MAAM,qBAAqB,GAAG;IACnC,KAAK;IACL,KAAK;IACL,MAAM;IACN,MAAM;CACsC,CAAC;AAE/C;;GAEG;AACH,MAAM,CAAC,MAAM,kBAAkB,GAAG;IAChC,SAAS;IACT,QAAQ;IACR,oBAAoB;CACyB,CAAC;AAEhD;;GAEG;AACH,MAAM,CAAC,MAAM,eAAe,GAAG;IAC7B,QAAQ;IACR,UAAU;IACV,OAAO;CACmC,CAAC;AAE7C;;GAEG;AACH,MAAM,CAAC,MAAM,qBAAqB,GAAG;IACnC,mBAAmB;IACnB,aAAa;IACb,WAAW;IACX,oBAAoB;IACpB,QAAQ;IACR,oBAAoB;IACpB,aAAa;IACb,aAAa;IACb,YAAY;CACoC,CAAC;AAEnD;;;;;;;GAOG;AACH,MAAM,UAAU,iBAAiB,CAAC,OAAe;IAC/C,OAAO,OAAO,CAAC,UAAU,CAAC,aAAa,EAAE,GAAG,CAAC,CAAC;AAChD,CAAC;AAED;;;;GAIG;AACH,MAAM,UAAU,oBAAoB,CAClC,QAAsB,EACtB,OAAe;IAEf,MAAM,YAAY,GAAG,iBAAiB,CAAC,OAAO,CAAC,CAAC;IAEhD,QAAQ,QAAQ,EAAE,CAAC;QACjB,KAAK,UAAU;YACb,OAAO,2FAA2F,YAAY,kCAAkC,CAAC;QACnJ,KAAK,OAAO;YACV,OAAO,uEAAuE,YAAY,yBAAyB,CAAC;QACtH;YACE,OAAO,SAAS,CAAC;IACrB,CAAC;AACH,CAAC;AAED;;;GAGG;AACH,MAAM,UAAU,gBAAgB,CAC9B,QAAsB,EACtB,OAAe;IAEf,MAAM,YAAY,GAAG,iBAAiB,CAAC,OAAO,CAAC,CAAC;IAEhD,QAAQ,QAAQ,EAAE,CAAC;QACjB,KAAK,UAAU;YACb,OAAO,6CAA6C,YAAY,EAAE,CAAC;QACrE,KAAK,OAAO;YACV,OAAO,uCAAuC,YAAY,EAAE,CAAC;QAC/D;YACE,OAAO,eAAe,CAAC;IAC3B,CAAC;AACH,CAAC;AAOD;;GAEG;AACH,MAAM,CAAC,MAAM,sBAAsB,GAAG;IACpC,MAAM;IACN,KAAK;CACwC,CAAC;AAEhD;;GAEG;AACH,MAAM,CAAC,MAAM,uBAAuB,GAAG;IACrC,QAAQ;IACR,SAAS;IACT,WAAW;IACX,OAAO;IACP,QAAQ;IACR,KAAK;IACL,MAAM;IACN,UAAU;IACV,WAAW;IACX,cAAc;IACd,eAAe;IACf,UAAU;IACV,WAAW;IACX,MAAM;IACN,OAAO;IACP,MAAM;IACN,OAAO;IACP,IAAI;IACJ,QAAQ;IACR,SAAS;CACD,CAAC;AAOX;;GAEG;AACH,MAAM,CAAC,MAAM,wBAAwB,GAAG,CAAC,YAAY,CAAU,CAAC"}
package/dist/db.d.ts CHANGED
@@ -64,4 +64,12 @@ export declare function runDatabaseCommand(options: RunDatabaseCommandOptions):
64
64
  * `beignet db migrate`.
65
65
  */
66
66
  export declare function generateDatabaseSchema(options?: GenerateDatabaseSchemaOptions): Promise<GenerateDatabaseSchemaResult>;
67
+ export declare function detectPackageManager(cwd: string): Promise<string>;
68
+ export declare function spawnCommand(command: string, args: readonly string[], cwd: string, options: {
69
+ captureOutput: boolean;
70
+ }): Promise<{
71
+ exitCode: number;
72
+ stdout?: string;
73
+ stderr?: string;
74
+ }>;
67
75
  //# sourceMappingURL=db.d.ts.map
package/dist/db.d.ts.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"file":"db.d.ts","sourceRoot":"","sources":["../src/db.ts"],"names":[],"mappings":"AAIA;;GAEG;AACH,MAAM,MAAM,eAAe,GAAG,UAAU,GAAG,SAAS,GAAG,MAAM,GAAG,OAAO,CAAC;AAExE;;GAEG;AACH,MAAM,MAAM,yBAAyB,GAAG;IACtC,OAAO,EAAE,eAAe,CAAC;IACzB,GAAG,CAAC,EAAE,MAAM,CAAC;IACb,aAAa,CAAC,EAAE,OAAO,CAAC;IACxB,MAAM,CAAC,EAAE,OAAO,CAAC;CAClB,CAAC;AAEF;;GAEG;AACH,MAAM,MAAM,wBAAwB,GAAG;IACrC,aAAa,EAAE,CAAC,CAAC;IACjB,OAAO,EAAE,eAAe,CAAC;IACzB,GAAG,EAAE,MAAM,CAAC;IACZ,MAAM,EAAE,MAAM,CAAC;IACf,MAAM,EAAE,MAAM,CAAC;IACf,IAAI,EAAE,MAAM,EAAE,CAAC;IACf,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,MAAM,EAAE,OAAO,CAAC;IAChB,QAAQ,EAAE,MAAM,CAAC;CAClB,CAAC;AAEF,MAAM,MAAM,qBAAqB,GAAG,QAAQ,GAAG,UAAU,GAAG,OAAO,CAAC;AACpE,MAAM,MAAM,mBAAmB,GAAG,OAAO,GAAG,aAAa,GAAG,QAAQ,CAAC;AAErE,MAAM,MAAM,6BAA6B,GAAG;IAC1C,GAAG,CAAC,EAAE,MAAM,CAAC;IACb,OAAO,CAAC,EAAE,qBAAqB,CAAC;IAChC,MAAM,CAAC,EAAE,SAAS,mBAAmB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AAsB,oBAAoB,CAAC,GAAG,EAAE,MAAM,GAAG,OAAO,CAAC,MAAM,CAAC,CAOvE;AAWD,wBAAgB,YAAY,CAC1B,OAAO,EAAE,MAAM,EACf,IAAI,EAAE,SAAS,MAAM,EAAE,EACvB,GAAG,EAAE,MAAM,EACX,OAAO,EAAE;IAAE,aAAa,EAAE,OAAO,CAAA;CAAE,GAClC,OAAO,CAAC;IAAE,QAAQ,EAAE,MAAM,CAAC;IAAC,MAAM,CAAC,EAAE,MAAM,CAAC;IAAC,MAAM,CAAC,EAAE,MAAM,CAAA;CAAE,CAAC,CA6BjE"}
package/dist/db.js CHANGED
@@ -105,7 +105,7 @@ async function assertDatabaseCommandPreflight(cwd, command, scriptCommand) {
105
105
  throw new Error(`Missing Drizzle config. beignet db ${command} runs "${scriptCommand}", but no drizzle.config.ts, drizzle.config.mts, drizzle.config.js, or drizzle.config.mjs exists in the app root.`);
106
106
  }
107
107
  const standardEntrypoints = {
108
- seed: "infra/db/seed.ts",
108
+ seed: "server/seed.ts",
109
109
  reset: "infra/db/reset.ts",
110
110
  };
111
111
  const standardEntrypoint = standardEntrypoints[command];
@@ -282,7 +282,7 @@ function missingDatabaseScriptMessage(command, script) {
282
282
  if (command === "generate" || command === "migrate") {
283
283
  return `Missing package.json script "${script}". Standard Drizzle apps use "${script}": "drizzle-kit ${command}" with drizzle.config.ts at the app root.`;
284
284
  }
285
- const entrypoint = command === "seed" ? "infra/db/seed.ts" : "infra/db/reset.ts";
285
+ const entrypoint = command === "seed" ? "server/seed.ts" : "infra/db/reset.ts";
286
286
  return `Missing package.json script "${script}". Standard Drizzle apps use "${script}": "bun ${entrypoint}" so beignet db ${command} can run the app-owned ${command} entrypoint.`;
287
287
  }
288
288
  async function readPackageJson(cwd) {
@@ -296,7 +296,7 @@ async function readPackageJson(cwd) {
296
296
  throw error;
297
297
  }
298
298
  }
299
- async function detectPackageManager(cwd) {
299
+ export async function detectPackageManager(cwd) {
300
300
  if (await exists(path.join(cwd, "bun.lock")))
301
301
  return "bun";
302
302
  if (await exists(path.join(cwd, "bun.lockb")))
@@ -318,7 +318,7 @@ async function exists(filePath) {
318
318
  return false;
319
319
  }
320
320
  }
321
- function spawnCommand(command, args, cwd, options) {
321
+ export function spawnCommand(command, args, cwd, options) {
322
322
  return new Promise((resolve, reject) => {
323
323
  const child = spawn(command, args, {
324
324
  cwd,