@beignet/cli 0.0.47 → 0.0.49
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/CHANGELOG.md +46 -0
- package/README.md +126 -42
- package/dist/analysis/contract-factories.d.ts +17 -0
- package/dist/analysis/contract-factories.d.ts.map +1 -0
- package/dist/analysis/contract-factories.js +176 -0
- package/dist/analysis/contract-factories.js.map +1 -0
- package/dist/analysis/layers.d.ts +5 -0
- package/dist/analysis/layers.d.ts.map +1 -0
- package/dist/analysis/layers.js +172 -0
- package/dist/analysis/layers.js.map +1 -0
- package/dist/analysis/port-wiring.d.ts +23 -0
- package/dist/analysis/port-wiring.d.ts.map +1 -0
- package/dist/analysis/port-wiring.js +379 -0
- package/dist/analysis/port-wiring.js.map +1 -0
- package/dist/analysis/source-index.d.ts +5 -0
- package/dist/analysis/source-index.d.ts.map +1 -1
- package/dist/analysis/source-index.js +171 -42
- package/dist/analysis/source-index.js.map +1 -1
- package/dist/analysis/workspace.d.ts +10 -4
- package/dist/analysis/workspace.d.ts.map +1 -1
- package/dist/analysis/workspace.js +66 -6
- package/dist/analysis/workspace.js.map +1 -1
- package/dist/app-map.d.ts.map +1 -1
- package/dist/app-map.js +311 -92
- package/dist/app-map.js.map +1 -1
- package/dist/check.d.ts +8 -1
- package/dist/check.d.ts.map +1 -1
- package/dist/check.js +55 -9
- package/dist/check.js.map +1 -1
- package/dist/db.d.ts +38 -0
- package/dist/db.d.ts.map +1 -1
- package/dist/db.js +52 -0
- package/dist/db.js.map +1 -1
- package/dist/explain.js +4 -4
- package/dist/explain.js.map +1 -1
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +73 -6
- package/dist/index.js.map +1 -1
- package/dist/inspect.d.ts.map +1 -1
- package/dist/inspect.js +454 -170
- package/dist/inspect.js.map +1 -1
- package/dist/lib.d.ts +2 -2
- package/dist/lib.d.ts.map +1 -1
- package/dist/lib.js +1 -1
- package/dist/lib.js.map +1 -1
- package/dist/lint.d.ts.map +1 -1
- package/dist/lint.js +309 -487
- package/dist/lint.js.map +1 -1
- package/dist/make/inbox.d.ts.map +1 -1
- package/dist/make/inbox.js +12 -5
- package/dist/make/inbox.js.map +1 -1
- package/dist/make/payments.js +3 -3
- package/dist/make/payments.js.map +1 -1
- package/dist/make/tenancy.js +1 -1
- package/dist/make/tenancy.js.map +1 -1
- package/dist/make.d.ts.map +1 -1
- package/dist/make.js +144 -8
- package/dist/make.js.map +1 -1
- package/dist/mcp.d.ts +1 -1
- package/dist/mcp.d.ts.map +1 -1
- package/dist/mcp.js +56 -19
- package/dist/mcp.js.map +1 -1
- package/dist/preflight.d.ts +11 -3
- package/dist/preflight.d.ts.map +1 -1
- package/dist/preflight.js +139 -16
- package/dist/preflight.js.map +1 -1
- package/dist/provider-add.d.ts.map +1 -1
- package/dist/provider-add.js +149 -9
- package/dist/provider-add.js.map +1 -1
- package/dist/provider-audit.d.ts +13 -0
- package/dist/provider-audit.d.ts.map +1 -1
- package/dist/provider-audit.js +122 -8
- package/dist/provider-audit.js.map +1 -1
- package/dist/registry-edits.d.ts +7 -0
- package/dist/registry-edits.d.ts.map +1 -1
- package/dist/registry-edits.js +237 -53
- package/dist/registry-edits.js.map +1 -1
- package/dist/templates/agents.d.ts.map +1 -1
- package/dist/templates/agents.js +29 -7
- package/dist/templates/agents.js.map +1 -1
- package/dist/templates/base.d.ts +1 -0
- package/dist/templates/base.d.ts.map +1 -1
- package/dist/templates/base.js +20 -6
- package/dist/templates/base.js.map +1 -1
- package/dist/templates/db/index.d.ts +1 -0
- package/dist/templates/db/index.d.ts.map +1 -1
- package/dist/templates/db/index.js.map +1 -1
- package/dist/templates/db/migration-status.d.ts +9 -0
- package/dist/templates/db/migration-status.d.ts.map +1 -0
- package/dist/templates/db/migration-status.js +117 -0
- package/dist/templates/db/migration-status.js.map +1 -0
- package/dist/templates/db/mysql.d.ts.map +1 -1
- package/dist/templates/db/mysql.js +23 -0
- package/dist/templates/db/mysql.js.map +1 -1
- package/dist/templates/db/postgres.d.ts.map +1 -1
- package/dist/templates/db/postgres.js +21 -0
- package/dist/templates/db/postgres.js.map +1 -1
- package/dist/templates/db/sqlite.d.ts.map +1 -1
- package/dist/templates/db/sqlite.js +53 -0
- package/dist/templates/db/sqlite.js.map +1 -1
- package/dist/templates/index.d.ts.map +1 -1
- package/dist/templates/index.js +5 -0
- package/dist/templates/index.js.map +1 -1
- package/dist/templates/server.d.ts.map +1 -1
- package/dist/templates/server.js +2 -0
- package/dist/templates/server.js.map +1 -1
- package/dist/templates/shared.d.ts +1 -0
- package/dist/templates/shared.d.ts.map +1 -1
- package/dist/templates/shared.js +4 -2
- package/dist/templates/shared.js.map +1 -1
- package/package.json +7 -6
- package/skills/app-structure/SKILL.md +56 -11
- package/src/analysis/contract-factories.ts +256 -0
- package/src/analysis/layers.ts +266 -0
- package/src/analysis/port-wiring.ts +506 -0
- package/src/analysis/source-index.ts +225 -57
- package/src/analysis/workspace.ts +115 -6
- package/src/app-map.ts +418 -109
- package/src/check.ts +86 -10
- package/src/db.ts +97 -0
- package/src/explain.ts +4 -4
- package/src/index.ts +108 -7
- package/src/inspect.ts +659 -216
- package/src/lib.ts +9 -1
- package/src/lint.ts +393 -643
- package/src/make/inbox.ts +12 -5
- package/src/make/payments.ts +3 -3
- package/src/make/tenancy.ts +1 -1
- package/src/make.ts +225 -8
- package/src/mcp.ts +73 -21
- package/src/preflight.ts +195 -16
- package/src/provider-add.ts +193 -9
- package/src/provider-audit.ts +210 -18
- package/src/registry-edits.ts +313 -63
- package/src/templates/agents.ts +29 -7
- package/src/templates/base.ts +21 -4
- package/src/templates/db/index.ts +1 -0
- package/src/templates/db/migration-status.ts +126 -0
- package/src/templates/db/mysql.ts +23 -0
- package/src/templates/db/postgres.ts +21 -0
- package/src/templates/db/sqlite.ts +53 -0
- package/src/templates/index.ts +5 -0
- package/src/templates/server.ts +2 -0
- package/src/templates/shared.ts +4 -2
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,51 @@
|
|
|
1
1
|
# @beignet/cli
|
|
2
2
|
|
|
3
|
+
## 0.0.49
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- e597d53: Require Node.js 22.12 or newer across every Beignet package, generated app,
|
|
8
|
+
and documented workflow.
|
|
9
|
+
- 3049831: Prevent outbox job registries from silently running without a dispatcher by
|
|
10
|
+
wiring generated jobs, reporting incomplete app-port configuration, and
|
|
11
|
+
validating delivery transports before claiming messages. Jobs provider presets
|
|
12
|
+
replace only the marked generated inline fallback.
|
|
13
|
+
- ea4bcf7: Inspect TypeScript module references structurally in architecture lint,
|
|
14
|
+
including require/import variants, transitive feature helpers, configured path
|
|
15
|
+
layouts, and exhaustive feature layer classification.
|
|
16
|
+
- ac46aad: Inspect contracts through import-backed TypeScript syntax and local fluent-builder aliases, align lint and doctor placement diagnostics, and reject non-app roots before `beignet check` runs validation.
|
|
17
|
+
- a06c5b9: Require contracts with query schemas to declare an explicit transport shared by typed clients, servers, and OpenAPI generation. Add deterministic scalar, repeated-array, and flat deep-object transports, migrate CLI generators, and diagnose legacy one-argument query declarations.
|
|
18
|
+
- e597d53: Migrate the Beignet MCP server to the stable TypeScript SDK v2 packages while
|
|
19
|
+
preserving stdio transport and protocol compatibility.
|
|
20
|
+
- 8c0b355: Isolate and safely frame default rate-limit buckets, fail closed for unresolved user scopes, escape Swagger script data, and require an explicit access policy for devtools routes.
|
|
21
|
+
- b2188d8: Align provider production behavior by validating cache TTLs consistently,
|
|
22
|
+
requiring encrypted SMTP transport by default, and streaming unknown-size S3
|
|
23
|
+
uploads through bounded managed multipart uploads with explicit cleanup across
|
|
24
|
+
all failure stages.
|
|
25
|
+
|
|
26
|
+
The S3 provider now requires `@aws-sdk/lib-storage`; the Beignet provider
|
|
27
|
+
preset installs the compatible version automatically.
|
|
28
|
+
|
|
29
|
+
- Updated dependencies [e597d53]
|
|
30
|
+
- Updated dependencies [3049831]
|
|
31
|
+
- Updated dependencies [60edd56]
|
|
32
|
+
- Updated dependencies [a06c5b9]
|
|
33
|
+
- Updated dependencies [8c0b355]
|
|
34
|
+
- Updated dependencies [b2188d8]
|
|
35
|
+
- @beignet/core@0.0.49
|
|
36
|
+
|
|
37
|
+
## 0.0.48
|
|
38
|
+
|
|
39
|
+
### Patch Changes
|
|
40
|
+
|
|
41
|
+
- 728c942: Add read-only migration status reports, connected validation, stable generated migration hashes, preflight pending detection, generated Drizzle status scripts, and serialized deployment guidance.
|
|
42
|
+
- 2391a09: Harden provider failure semantics with isolated asynchronous instrumentation,
|
|
43
|
+
level-aware Pino metadata redaction and owned-transport shutdown, bounded
|
|
44
|
+
Upstash timeout policy and readiness, and validated Vercel Blob token/OIDC
|
|
45
|
+
credential alternatives.
|
|
46
|
+
- Updated dependencies [2391a09]
|
|
47
|
+
- @beignet/core@0.0.48
|
|
48
|
+
|
|
3
49
|
## 0.0.47
|
|
4
50
|
|
|
5
51
|
### Patch Changes
|
package/README.md
CHANGED
|
@@ -6,6 +6,9 @@
|
|
|
6
6
|
|
|
7
7
|
Command-line tools for creating and maintaining Beignet apps.
|
|
8
8
|
|
|
9
|
+
Beignet requires Node.js 22.12 or newer. Bun 1.3.14 or newer is supported for
|
|
10
|
+
CLI commands.
|
|
11
|
+
|
|
9
12
|
The package ships a single `beignet` bin. Generated apps install
|
|
10
13
|
`@beignet/cli` as a dev dependency and add a `beignet` package script, so the
|
|
11
14
|
day-to-day form inside an app is:
|
|
@@ -148,6 +151,7 @@ cd my-app
|
|
|
148
151
|
bun install
|
|
149
152
|
cp .env.example .env.local
|
|
150
153
|
bun beignet db migrate
|
|
154
|
+
bun beignet db status
|
|
151
155
|
bun run dev
|
|
152
156
|
```
|
|
153
157
|
|
|
@@ -179,6 +183,7 @@ bun beignet doctor
|
|
|
179
183
|
bun beignet make feature projects
|
|
180
184
|
bun beignet db generate
|
|
181
185
|
bun beignet db migrate
|
|
186
|
+
bun beignet db status
|
|
182
187
|
bun run test
|
|
183
188
|
bun run lint
|
|
184
189
|
bun run typecheck
|
|
@@ -221,13 +226,15 @@ beignet make test <feature.action> [options] [--cwd <dir>]
|
|
|
221
226
|
beignet make use-case <feature.action> [options] [--cwd <dir>]
|
|
222
227
|
beignet db generate [--dry-run] [--json] [--cwd <dir>]
|
|
223
228
|
beignet db migrate [--dry-run] [--json] [--cwd <dir>]
|
|
229
|
+
beignet db status [--json] [--cwd <dir>]
|
|
224
230
|
beignet db seed [--dry-run] [--json] [--cwd <dir>]
|
|
225
231
|
beignet db reset [--dry-run] [--json] [--cwd <dir>]
|
|
226
232
|
beignet db schema sync [--dialect sqlite|postgres|mysql] [--tables audit,idempotency,outbox] [--output <path>] [--dry-run] [--json] [--cwd <dir>]
|
|
227
233
|
beignet routes [--json] [--cwd <dir>]
|
|
228
234
|
beignet map [--json] [--feature <name>] [--kind <kinds>] [--cwd <dir>]
|
|
229
235
|
beignet explain <kind> <target> [--json] [--cwd <dir>]
|
|
230
|
-
beignet check [--json] [--fix] [--preflight] [--cwd <dir>]
|
|
236
|
+
beignet check [--json] [--fix] [--preflight] [--preflight-connect] [--connect-timeout-ms <ms>] [--cwd <dir>]
|
|
237
|
+
beignet preflight [--connect] [--connect-timeout-ms <ms>] [--json] [--cwd <dir>]
|
|
231
238
|
beignet lint [--json] [--cwd <dir>] [--format human|json|github]
|
|
232
239
|
beignet doctor [--json] [--strict] [--fix] [--dry-run] [--plan <id>] [--only <operation-ids>] [--cwd <dir>] [--format human|json|github]
|
|
233
240
|
beignet provider add <preset> [--dry-run] [--json] [--cwd <dir>]
|
|
@@ -248,6 +255,8 @@ Options:
|
|
|
248
255
|
--dry-run Preview create/make writes without changing files.
|
|
249
256
|
--json Print machine-readable output.
|
|
250
257
|
--cwd path/to/app Run an existing-app command against another app directory.
|
|
258
|
+
--preflight-connect Add connected migration and dependency checks.
|
|
259
|
+
--connect-timeout-ms 5000 Override the connected preflight per-check timeout.
|
|
251
260
|
--format github Output format for lint and doctor: human, json, or github.
|
|
252
261
|
--input '{"dryRun":true}' JSON input for `beignet task run`.
|
|
253
262
|
--tenant acme Tenant id or slug passed to the app's createTaskContext by `beignet task run`, separate from task input.
|
|
@@ -356,7 +365,13 @@ server/routes.ts
|
|
|
356
365
|
generated route tests pass the same value to `createTestApp(...)`.
|
|
357
366
|
|
|
358
367
|
Route inspection supports contract-group definitions and direct
|
|
359
|
-
`defineContract({ method, path })` exports.
|
|
368
|
+
`defineContract({ method, path })` exports. It reads exported declarations and
|
|
369
|
+
fluent contract calls from TypeScript syntax, so nested objects, comments, and
|
|
370
|
+
multiline expressions do not truncate a contract before its method or path.
|
|
371
|
+
Local fluent-builder aliases and named local exports are followed. Factories
|
|
372
|
+
must be value imports from `@beignet/core/contracts`; named aliases and
|
|
373
|
+
namespace imports work, while same-named methods on unrelated objects are
|
|
374
|
+
ignored.
|
|
360
375
|
|
|
361
376
|
The standard app layout includes the files feature generators expect:
|
|
362
377
|
|
|
@@ -682,7 +697,9 @@ starter, tests, and feature-specific not-found and conflict catalog errors. Use
|
|
|
682
697
|
resource.
|
|
683
698
|
|
|
684
699
|
Generated list routes use cursor pagination with `limit`, `cursor`, `name`,
|
|
685
|
-
`sortBy`, and `sortDirection` query parameters.
|
|
700
|
+
`sortBy`, and `sortDirection` query parameters. Their contract pairs the query
|
|
701
|
+
schema with an explicit transport so the client, server, and OpenAPI document
|
|
702
|
+
use the same URL representation. The generated use case
|
|
686
703
|
normalizes cursor pages, validates opaque base64url cursors against the selected
|
|
687
704
|
sort, and passes one repository query object into memory and Drizzle adapters.
|
|
688
705
|
Adapters filter `name` with case-insensitive contains matching, sort only by
|
|
@@ -781,6 +798,20 @@ and `make job` create that outbox path on first use and register the feature's
|
|
|
781
798
|
`beignet doctor` reports events and jobs the registry cannot deliver. Keep the
|
|
782
799
|
route as the durable recovery sweep even when the deferred trigger is present.
|
|
783
800
|
|
|
801
|
+
`make job` also ensures `jobs: JobDispatcherPort` is declared and bound. When
|
|
802
|
+
the app has no job dispatcher yet, it defers the port and installs an app-owned
|
|
803
|
+
inline dispatcher provider; existing direct wiring and providers such as
|
|
804
|
+
Inngest are preserved. Registry membership alone is not execution wiring.
|
|
805
|
+
Adding the `jobs-inngest` or `jobs-bullmq` preset later replaces only that
|
|
806
|
+
marked generated fallback; an unmarked app-owned inline provider is reported
|
|
807
|
+
as a conflict instead of being removed.
|
|
808
|
+
`beignet doctor` warns when an outbox registry contains jobs but the configured
|
|
809
|
+
ports and port-wiring files do not declare and bind or defer `jobs`. Keep that
|
|
810
|
+
key and the registry's `jobs` entries explicit; doctor reports indeterminate
|
|
811
|
+
registry or port-wiring shapes when they prevent it from verifying required
|
|
812
|
+
wiring, and the generator stops rather than replacing custom spread- or
|
|
813
|
+
helper-based wiring it cannot verify.
|
|
814
|
+
|
|
784
815
|
Generators wire the provider-backed ports their output depends on. `make
|
|
785
816
|
event` (and `make resource --events`) wires `eventBus: EventBusPort` with
|
|
786
817
|
`createMemoryEventBusProvider()` from
|
|
@@ -834,6 +865,8 @@ The runner loads `server/outbox.ts` or `paths.outbox`. That module should export
|
|
|
834
865
|
`stopOutboxDrainContext(...)`. The context owns app ports and provider
|
|
835
866
|
lifecycle, so the CLI drain uses the same outbox, event bus, jobs,
|
|
836
867
|
instrumentation, actor, and tenant decisions as the scheduled drain route.
|
|
868
|
+
The drain validates all transports required by the registry before claiming a
|
|
869
|
+
batch, so missing `eventBus` or `jobs` wiring does not consume attempts.
|
|
837
870
|
|
|
838
871
|
Inspect and recover failed deliveries through the same app-owned operational
|
|
839
872
|
context:
|
|
@@ -915,15 +948,17 @@ stable framework command surface:
|
|
|
915
948
|
```bash
|
|
916
949
|
beignet db generate
|
|
917
950
|
beignet db migrate
|
|
951
|
+
beignet db status
|
|
918
952
|
beignet db seed
|
|
919
953
|
beignet db reset
|
|
920
954
|
```
|
|
921
955
|
|
|
922
956
|
The CLI delegates to app-owned package scripts named `db:generate`,
|
|
923
|
-
`db:migrate`, `db:seed`, and `db:reset`. In standard Drizzle apps,
|
|
924
|
-
run Drizzle Kit and the generated
|
|
925
|
-
entrypoints.
|
|
926
|
-
|
|
957
|
+
`db:migrate`, `db:status`, `db:seed`, and `db:reset`. In standard Drizzle apps,
|
|
958
|
+
those scripts run Drizzle Kit and the generated status, seed, and reset
|
|
959
|
+
entrypoints. Status is read-only: exit 0 means current, exit 2 means pending,
|
|
960
|
+
and any other non-zero exit means inspection failed. This keeps database
|
|
961
|
+
behavior app-owned while making the lifecycle discoverable through Beignet.
|
|
927
962
|
|
|
928
963
|
When an app adopts Beignet's Drizzle-backed operational ports for audit,
|
|
929
964
|
idempotency, or outbox, run `beignet db schema sync` first. It idempotently
|
|
@@ -934,7 +969,7 @@ Drizzle Kit script creates the matching migration.
|
|
|
934
969
|
|
|
935
970
|
`beignet db` checks standard prerequisites before running those scripts. If the
|
|
936
971
|
script is missing, Drizzle Kit has no `drizzle.config.*`, or the standard
|
|
937
|
-
seed/reset entrypoint was removed, the error points to the exact file or
|
|
972
|
+
status/seed/reset entrypoint was removed, the error points to the exact file or
|
|
938
973
|
package script to restore.
|
|
939
974
|
|
|
940
975
|
`beignet db <command> --json` retains the final 64 KiB from each output stream
|
|
@@ -957,6 +992,8 @@ Call `db_schema_sync` with `{ dialect?, tables?, output?, dryRun? }` for the
|
|
|
957
992
|
same report as `beignet db schema sync --json`. For lifecycle commands,
|
|
958
993
|
`dryRun` validates prerequisites and reports the app-owned script without
|
|
959
994
|
executing it; it does not simulate the script's SQL or data changes.
|
|
995
|
+
Call the separate read-only `db_status` tool with `{ timeoutMs? }` for the same
|
|
996
|
+
report as `beignet db status --json`.
|
|
960
997
|
|
|
961
998
|
Generate feature-owned test factories and local/demo seeds with:
|
|
962
999
|
|
|
@@ -1022,11 +1059,12 @@ every edge carries source evidence and confidence.
|
|
|
1022
1059
|
|
|
1023
1060
|
The JSON app map retains failed local module references as explicit
|
|
1024
1061
|
`local_import_unresolved` entries instead of silently omitting their edges. It
|
|
1025
|
-
also reports `contract_declaration_unresolved` when
|
|
1026
|
-
|
|
1027
|
-
statically. Registration diagnostics identify their declaration
|
|
1028
|
-
structured `subject.file` and `subject.exportName`; registration
|
|
1029
|
-
map uses that identity rather than matching human-readable
|
|
1062
|
+
also reports `contract_declaration_unresolved` when an exported direct or
|
|
1063
|
+
contract-group declaration has a method, path, or group prefix that cannot be
|
|
1064
|
+
derived statically. Registration diagnostics identify their declaration
|
|
1065
|
+
through a structured `subject.file` and `subject.exportName`; registration
|
|
1066
|
+
status in the map uses that identity rather than matching human-readable
|
|
1067
|
+
messages.
|
|
1030
1068
|
|
|
1031
1069
|
`--feature` keeps that feature plus its direct relationships, while `--kind`
|
|
1032
1070
|
accepts one or a comma-separated list of node kinds. These projections make
|
|
@@ -1080,13 +1118,20 @@ in that order. Every step runs even when an earlier one fails, so a single
|
|
|
1080
1118
|
run reports everything that needs fixing; the command exits non-zero when any
|
|
1081
1119
|
step fails. Missing package scripts are reported as skipped, never as
|
|
1082
1120
|
failures. Failed package-script output retains at most the last 64 KiB of each
|
|
1083
|
-
stream.
|
|
1121
|
+
stream. The target package must declare `@beignet/core`, `@beignet/next`, or
|
|
1122
|
+
`@beignet/web` as a runtime dependency. The root must also contain
|
|
1123
|
+
`app-context.ts` or `beignet.config.*`; a canonical app with both `features/`
|
|
1124
|
+
and `server/index.ts` is accepted when `app-context.ts` is missing so doctor
|
|
1125
|
+
can report the drift. Other package roots stop before lint, doctor, or app
|
|
1126
|
+
scripts run.
|
|
1084
1127
|
|
|
1085
1128
|
Use `beignet check --fix` to apply doctor's eligible low-risk fixes
|
|
1086
1129
|
before checking, and `beignet check --json` for a versioned payload
|
|
1087
1130
|
(`schemaVersion: 1`) with the step list, statuses, captured failure output,
|
|
1088
|
-
and applied fixes. Add `--preflight` to run the runtime
|
|
1089
|
-
strict doctor.
|
|
1131
|
+
and applied fixes. Add `--preflight` to run the disconnected runtime
|
|
1132
|
+
environment gate after strict doctor. Use `--preflight-connect` when the same
|
|
1133
|
+
check should also inspect migration status and dependency health; it implies
|
|
1134
|
+
`--preflight`. The individual commands below still work when you need one
|
|
1090
1135
|
check alone or its `--format github` output.
|
|
1091
1136
|
|
|
1092
1137
|
## Gate the deploy environment
|
|
@@ -1095,17 +1140,27 @@ check alone or its `--format github` output.
|
|
|
1095
1140
|
beignet preflight
|
|
1096
1141
|
beignet preflight --connect
|
|
1097
1142
|
beignet check --preflight
|
|
1143
|
+
beignet check --preflight-connect
|
|
1098
1144
|
```
|
|
1099
1145
|
|
|
1100
1146
|
`preflight` is the runtime production gate, distinct from the static `doctor`
|
|
1101
1147
|
checks: it reads the environment the process actually runs with. It verifies
|
|
1102
|
-
every
|
|
1148
|
+
every individually required provider env var and accepts mutually exclusive
|
|
1149
|
+
credentials only when one complete `requiredEnvAlternatives` configuration is
|
|
1150
|
+
present. Variant packages are scoped to the factories registered in the app,
|
|
1151
|
+
so inactive variants do not demand credentials. Preflight also flags values
|
|
1103
1152
|
still matching `.env.example` (or common placeholder patterns) on secret-like
|
|
1104
1153
|
keys, validates the app env schema by importing `lib/env.ts`, folds in
|
|
1105
1154
|
`doctor`'s production hardening diagnostics with promoted severities, and
|
|
1106
|
-
warns when logging or error reporting is absent or inert. `--connect`
|
|
1107
|
-
the app
|
|
1108
|
-
|
|
1155
|
+
warns when logging or error reporting is absent or inert. `--connect` first
|
|
1156
|
+
runs the app-owned `db:status` script when available, failing before server
|
|
1157
|
+
boot on pending migrations or inspection failure, then runs every port's
|
|
1158
|
+
`checkHealth()`. Older apps without the script receive a compatibility note.
|
|
1159
|
+
The flag is opt-in because it needs network access and real credentials.
|
|
1160
|
+
Use `--connect-timeout-ms <ms>` to change the default 5000 ms limit for
|
|
1161
|
+
migration status and each dependency health check. Timeout findings include
|
|
1162
|
+
the configured duration, and bounded status output says when only the retained
|
|
1163
|
+
tail is shown. `--env-file` merges a dotenv-style
|
|
1109
1164
|
file under the environment for local rehearsal, `--env-module` and
|
|
1110
1165
|
`--server-module` override the default `lib/env.ts` and `server/index.ts`
|
|
1111
1166
|
paths, and `--json` emits machine-readable output with `schemaVersion: 1`.
|
|
@@ -1126,14 +1181,30 @@ Run `lint` when you want the CLI to enforce Beignet dependency direction:
|
|
|
1126
1181
|
beignet lint
|
|
1127
1182
|
```
|
|
1128
1183
|
|
|
1129
|
-
The command
|
|
1130
|
-
|
|
1131
|
-
|
|
1132
|
-
|
|
1133
|
-
|
|
1134
|
-
|
|
1135
|
-
|
|
1136
|
-
|
|
1184
|
+
The command recognizes TypeScript imports and re-exports, `require()`, import
|
|
1185
|
+
assignments, and literal dynamic imports. It fails when app layers reach into
|
|
1186
|
+
runtime or framework layers, including domain, use case, workflow, policy,
|
|
1187
|
+
port, contract, route, schema, seed, agent capability, feature helper, infra,
|
|
1188
|
+
and component files importing `infra/`, UI components, route handlers, server
|
|
1189
|
+
modules, client modules, provider packages, Next.js, React, or database vendors
|
|
1190
|
+
in the wrong direction. Computed `require()` and `import()` expressions inside
|
|
1191
|
+
constrained layers fail because lint cannot verify their destination; use a
|
|
1192
|
+
string-literal specifier or move runtime loading behind an allowed boundary.
|
|
1193
|
+
Client-safe graphs reject Node built-ins whether they use `node:fs` or a bare
|
|
1194
|
+
specifier such as `fs/promises`.
|
|
1195
|
+
|
|
1196
|
+
Local value-import checks follow feature-root and other local helpers.
|
|
1197
|
+
For example, `use-case -> history.ts -> infra` reports the complete chain
|
|
1198
|
+
instead of treating `history.ts` as an unknown layer. Every module inside the
|
|
1199
|
+
configured feature root is classified; allowed feature-root helpers remain
|
|
1200
|
+
helpers, while near-miss canonical names such as `usecases/` report the
|
|
1201
|
+
expected `use-cases/` path. Feature-specific domain files still cannot import
|
|
1202
|
+
another feature's domain unless the target is `features/shared/domain`.
|
|
1203
|
+
Workflow folders include feature-owned jobs, listeners, notifications,
|
|
1204
|
+
schedules, tasks, and uploads. Agent capabilities may adapt use cases but core
|
|
1205
|
+
application layers cannot depend back on those adapters. Seeds may compose
|
|
1206
|
+
factories and app ports, but not concrete infra, providers, UI, or runtime
|
|
1207
|
+
composition.
|
|
1137
1208
|
|
|
1138
1209
|
Local imports are resolved with the app's complete `tsconfig.json`
|
|
1139
1210
|
configuration before dependency direction is classified. That includes
|
|
@@ -1141,10 +1212,10 @@ configuration before dependency direction is classified. That includes
|
|
|
1141
1212
|
with multiple targets. The CLI uses TypeScript's config parser and resolver, so
|
|
1142
1213
|
JSON comments and extended tsconfigs follow the same rules as the compiler.
|
|
1143
1214
|
|
|
1144
|
-
Import diagnostics include 1-based `line` and `column` positions
|
|
1145
|
-
|
|
1146
|
-
|
|
1147
|
-
message instead.
|
|
1215
|
+
Import diagnostics include 1-based `line` and `column` positions and preserve
|
|
1216
|
+
separate occurrences of the same module specifier. Human output prints
|
|
1217
|
+
clickable `file.ts:12:3` locations; transitive and runtime-boundary diagnostics
|
|
1218
|
+
report the chain root file and the full import chain in the message instead.
|
|
1148
1219
|
|
|
1149
1220
|
Use JSON output in CI or custom scripts, or GitHub annotations in workflows:
|
|
1150
1221
|
|
|
@@ -1164,11 +1235,14 @@ beignet doctor
|
|
|
1164
1235
|
Today it detects:
|
|
1165
1236
|
|
|
1166
1237
|
- Contracts without a matching Next.js route handler
|
|
1238
|
+
- Contract query schemas without an explicit second `.query(...)` transport
|
|
1167
1239
|
- Feature route groups that are not registered in the central route list
|
|
1168
1240
|
- Feature schedules and tasks that are not registered in `server/schedules.ts`
|
|
1169
1241
|
or `server/tasks.ts`
|
|
1170
1242
|
- Feature events with listeners, and feature jobs, that are missing from
|
|
1171
1243
|
`defineOutboxRegistry({...})` when the app uses outbox delivery
|
|
1244
|
+
- Outbox registries with jobs but no declared and bound or deferred `jobs`
|
|
1245
|
+
application port
|
|
1172
1246
|
- Feature listeners missing from `server/listeners.ts` or otherwise not
|
|
1173
1247
|
referenced by `registerListeners(...)`
|
|
1174
1248
|
- Opted-in runtime manifests that omit generated workflow registries
|
|
@@ -1186,6 +1260,9 @@ Today it detects:
|
|
|
1186
1260
|
`features/shared/errors.ts`
|
|
1187
1261
|
- Feature runtime `appError(...)` calls that are not declared on the feature's
|
|
1188
1262
|
contracts
|
|
1263
|
+
- Feature layers whose normalized name or known alias points at a canonical
|
|
1264
|
+
location, such as `usecases/` instead of `use-cases/` or `events/` instead
|
|
1265
|
+
of `domain/events/`; doctor and lint report the same expected path
|
|
1189
1266
|
- Authorization metadata whose ability is missing from feature policy coverage
|
|
1190
1267
|
- Audit-required metadata without feature audit writes or test assertions
|
|
1191
1268
|
- Mixed `@beignet/*` version ranges in package.json, and mixed installed
|
|
@@ -1202,7 +1279,7 @@ Today it detects:
|
|
|
1202
1279
|
- Generated ports without test fakes
|
|
1203
1280
|
- Drizzle repository adapters that are not wired through `infra/db/repositories.ts`
|
|
1204
1281
|
- Repository ports whose infra folder has no repository adapter
|
|
1205
|
-
- Missing Drizzle config, schema index exports, database scripts, or standard seed/reset entrypoints
|
|
1282
|
+
- Missing Drizzle config, schema index exports, database scripts, or standard status/seed/reset entrypoints
|
|
1206
1283
|
- Drizzle-backed idempotency, outbox, or audit ports without matching table
|
|
1207
1284
|
setup in schema files, configured schema sources, migrations, provider setup
|
|
1208
1285
|
statements, or app database setup files
|
|
@@ -1225,7 +1302,7 @@ Today it detects:
|
|
|
1225
1302
|
- Billing entitlement modules that are not wired into infra or server providers
|
|
1226
1303
|
- Stripe payments configuration paired with local memory payments provider
|
|
1227
1304
|
wiring
|
|
1228
|
-
- Devtools routes
|
|
1305
|
+
- Devtools routes without authorization or an explicit local-only development opt-in
|
|
1229
1306
|
- Cron routes that do not use `CRON_SECRET`
|
|
1230
1307
|
- Installed provider packages without expected environment configuration
|
|
1231
1308
|
- Better Auth providers without an auth route or trusted-origin configuration
|
|
@@ -1261,8 +1338,10 @@ provider packages installed in an app. The human audit prints provider
|
|
|
1261
1338
|
metadata validity, registration status, required env, required tables, and
|
|
1262
1339
|
declared app ports. `beignet provider audit --json` returns a versioned
|
|
1263
1340
|
`schemaVersion: 1` payload with active variants, watchers, and source locations
|
|
1264
|
-
for matching provider-registry entries.
|
|
1265
|
-
|
|
1341
|
+
for matching provider-registry entries. Missing alternative credential paths
|
|
1342
|
+
remain grouped in human diagnostics, while JSON preserves each active
|
|
1343
|
+
variant's accepted configurations and status. The command does not fail CI for
|
|
1344
|
+
missing setup; stable, actionable findings belong in `doctor`.
|
|
1266
1345
|
|
|
1267
1346
|
Use `beignet doctor --strict` for CI-oriented checks that may be noisy locally,
|
|
1268
1347
|
such as missing generated feature tests, canonical app conformance drift, and
|
|
@@ -1295,8 +1374,9 @@ event-bus wiring. Database repair requires an existing schema index, default
|
|
|
1295
1374
|
Beignet table names, a missing `beignet.ts` or one that still matches
|
|
1296
1375
|
`beignet db schema sync` output, and a schema index where the generated
|
|
1297
1376
|
`export *` can be safely added or retained. It does not generate or apply a
|
|
1298
|
-
migration. Run `beignet db generate
|
|
1299
|
-
that source change. Compatible workflow
|
|
1377
|
+
migration. Run `beignet db generate`, `beignet db migrate`, and
|
|
1378
|
+
`beignet db status` after accepting that source change. Compatible workflow
|
|
1379
|
+
repairs that share files are combined
|
|
1300
1380
|
into the selectable `workflows.register-missing` operation so apply-all remains
|
|
1301
1381
|
atomic.
|
|
1302
1382
|
|
|
@@ -1346,12 +1426,16 @@ Tools:
|
|
|
1346
1426
|
suggested files, and follow-up commands (read-only)
|
|
1347
1427
|
- `check` - run the complete validation loop and return versioned step
|
|
1348
1428
|
results, bounded failure output, durations, and overall `ok`; accepts
|
|
1349
|
-
`{ preflight?: boolean, timeoutMs?: number }`,
|
|
1350
|
-
the MCP request, and does not apply Beignet
|
|
1351
|
-
|
|
1429
|
+
`{ preflight?: boolean, preflightConnect?: boolean, connectTimeoutMs?: number, timeoutMs?: number }`,
|
|
1430
|
+
cancels the active script with the MCP request, and does not apply Beignet
|
|
1431
|
+
fixes. `preflightConnect` implies preflight and adds migration and dependency
|
|
1432
|
+
checks. App scripts retain their normal side effects, so this is an
|
|
1433
|
+
execution tool rather than a read-only tool
|
|
1352
1434
|
- `db` - run `generate`, `migrate`, `seed`, or `reset` with
|
|
1353
1435
|
`{ command, dryRun?, timeoutMs? }`; returns the matching versioned CLI report
|
|
1354
1436
|
with bounded output, request cancellation, and a command timeout
|
|
1437
|
+
- `db_status` - inspect the app-owned migration history without mutating the
|
|
1438
|
+
database; returns `current`, `pending`, or `failed`
|
|
1355
1439
|
- `db_schema_sync` - sync app-owned Beignet provider-table schema re-exports
|
|
1356
1440
|
with `{ dialect?, tables?, output?, dryRun? }`; idempotent but writes source
|
|
1357
1441
|
unless `dryRun` is true
|
|
@@ -1377,7 +1461,7 @@ Tools:
|
|
|
1377
1461
|
artifact kinds as `beignet make`
|
|
1378
1462
|
- `provider_add` - add a provider setup preset with `{ preset, dryRun? }`
|
|
1379
1463
|
|
|
1380
|
-
The `db`, `db_schema_sync`, `task_run`, `schedule_run`, `outbox_inspect`,
|
|
1464
|
+
The `db`, `db_status`, `db_schema_sync`, `task_run`, `schedule_run`, `outbox_inspect`,
|
|
1381
1465
|
`outbox_run`, `doctor_fix_plan`, and `doctor_fix` tool outputs match the
|
|
1382
1466
|
corresponding CLI/library JSON payloads. Operational app code runs outside the
|
|
1383
1467
|
long-lived MCP server with bounded structured results, request cancellation,
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import ts from "typescript";
|
|
2
|
+
export type ContractFactoryName = "defineContract" | "defineContractGroup";
|
|
3
|
+
export type ContractFactoryBindings = {
|
|
4
|
+
localNames: Record<ContractFactoryName, Set<string>>;
|
|
5
|
+
namespaceNames: Set<string>;
|
|
6
|
+
};
|
|
7
|
+
export type ContractBindingNames = {
|
|
8
|
+
contracts: Set<string>;
|
|
9
|
+
groups: Set<string>;
|
|
10
|
+
};
|
|
11
|
+
export declare function contractFactoryBindings(sourceFile: ts.SourceFile): ContractFactoryBindings;
|
|
12
|
+
export declare function isImportedContractFactoryCall(call: ts.CallExpression, name: ContractFactoryName, bindings: ContractFactoryBindings): boolean;
|
|
13
|
+
/** Follow imported factories through local group and contract builder aliases. */
|
|
14
|
+
export declare function contractBindingNames(sourceFile: ts.SourceFile, bindings: ContractFactoryBindings): ContractBindingNames;
|
|
15
|
+
/** Determine whether an expression declares a direct or group-built contract. */
|
|
16
|
+
export declare function isImportedContractDeclaration(expression: ts.Expression, bindings: ContractFactoryBindings, names: ContractBindingNames): boolean;
|
|
17
|
+
//# sourceMappingURL=contract-factories.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"contract-factories.d.ts","sourceRoot":"","sources":["../../src/analysis/contract-factories.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,YAAY,CAAC;AAI5B,MAAM,MAAM,mBAAmB,GAAG,gBAAgB,GAAG,qBAAqB,CAAC;AAE3E,MAAM,MAAM,uBAAuB,GAAG;IACpC,UAAU,EAAE,MAAM,CAAC,mBAAmB,EAAE,GAAG,CAAC,MAAM,CAAC,CAAC,CAAC;IACrD,cAAc,EAAE,GAAG,CAAC,MAAM,CAAC,CAAC;CAC7B,CAAC;AAEF,MAAM,MAAM,oBAAoB,GAAG;IACjC,SAAS,EAAE,GAAG,CAAC,MAAM,CAAC,CAAC;IACvB,MAAM,EAAE,GAAG,CAAC,MAAM,CAAC,CAAC;CACrB,CAAC;AAkCF,wBAAgB,uBAAuB,CACrC,UAAU,EAAE,EAAE,CAAC,UAAU,GACxB,uBAAuB,CAoCzB;AAED,wBAAgB,6BAA6B,CAC3C,IAAI,EAAE,EAAE,CAAC,cAAc,EACvB,IAAI,EAAE,mBAAmB,EACzB,QAAQ,EAAE,uBAAuB,GAChC,OAAO,CAaT;AAED,kFAAkF;AAClF,wBAAgB,oBAAoB,CAClC,UAAU,EAAE,EAAE,CAAC,UAAU,EACzB,QAAQ,EAAE,uBAAuB,GAChC,oBAAoB,CAiDtB;AAED,iFAAiF;AACjF,wBAAgB,6BAA6B,CAC3C,UAAU,EAAE,EAAE,CAAC,UAAU,EACzB,QAAQ,EAAE,uBAAuB,EACjC,KAAK,EAAE,oBAAoB,GAC1B,OAAO,CAaT"}
|
|
@@ -0,0 +1,176 @@
|
|
|
1
|
+
import ts from "typescript";
|
|
2
|
+
const contractFactoryModule = "@beignet/core/contracts";
|
|
3
|
+
const contractGroupMethods = new Set([
|
|
4
|
+
"defineContractGroup",
|
|
5
|
+
"deprecated",
|
|
6
|
+
"errors",
|
|
7
|
+
"headers",
|
|
8
|
+
"meta",
|
|
9
|
+
"namespace",
|
|
10
|
+
"prefix",
|
|
11
|
+
"responses",
|
|
12
|
+
]);
|
|
13
|
+
const httpContractMethods = new Set([
|
|
14
|
+
"delete",
|
|
15
|
+
"get",
|
|
16
|
+
"head",
|
|
17
|
+
"options",
|
|
18
|
+
"patch",
|
|
19
|
+
"post",
|
|
20
|
+
"put",
|
|
21
|
+
]);
|
|
22
|
+
export function contractFactoryBindings(sourceFile) {
|
|
23
|
+
const bindings = {
|
|
24
|
+
localNames: {
|
|
25
|
+
defineContract: new Set(),
|
|
26
|
+
defineContractGroup: new Set(),
|
|
27
|
+
},
|
|
28
|
+
namespaceNames: new Set(),
|
|
29
|
+
};
|
|
30
|
+
for (const statement of sourceFile.statements) {
|
|
31
|
+
if (!ts.isImportDeclaration(statement) ||
|
|
32
|
+
!ts.isStringLiteral(statement.moduleSpecifier) ||
|
|
33
|
+
statement.moduleSpecifier.text !== contractFactoryModule ||
|
|
34
|
+
!statement.importClause ||
|
|
35
|
+
statement.importClause.isTypeOnly) {
|
|
36
|
+
continue;
|
|
37
|
+
}
|
|
38
|
+
const namedBindings = statement.importClause.namedBindings;
|
|
39
|
+
if (namedBindings && ts.isNamespaceImport(namedBindings)) {
|
|
40
|
+
bindings.namespaceNames.add(namedBindings.name.text);
|
|
41
|
+
continue;
|
|
42
|
+
}
|
|
43
|
+
if (!namedBindings || !ts.isNamedImports(namedBindings))
|
|
44
|
+
continue;
|
|
45
|
+
for (const element of namedBindings.elements) {
|
|
46
|
+
if (element.isTypeOnly)
|
|
47
|
+
continue;
|
|
48
|
+
const importedName = (element.propertyName ?? element.name).text;
|
|
49
|
+
if (!isContractFactoryName(importedName))
|
|
50
|
+
continue;
|
|
51
|
+
bindings.localNames[importedName].add(element.name.text);
|
|
52
|
+
}
|
|
53
|
+
}
|
|
54
|
+
return bindings;
|
|
55
|
+
}
|
|
56
|
+
export function isImportedContractFactoryCall(call, name, bindings) {
|
|
57
|
+
const callee = unwrapExpression(call.expression);
|
|
58
|
+
if (ts.isIdentifier(callee)) {
|
|
59
|
+
return bindings.localNames[name].has(callee.text);
|
|
60
|
+
}
|
|
61
|
+
if (!ts.isPropertyAccessExpression(callee) || callee.name.text !== name) {
|
|
62
|
+
return false;
|
|
63
|
+
}
|
|
64
|
+
const receiver = unwrapExpression(callee.expression);
|
|
65
|
+
return (ts.isIdentifier(receiver) && bindings.namespaceNames.has(receiver.text));
|
|
66
|
+
}
|
|
67
|
+
/** Follow imported factories through local group and contract builder aliases. */
|
|
68
|
+
export function contractBindingNames(sourceFile, bindings) {
|
|
69
|
+
const declarations = sourceFile.statements
|
|
70
|
+
.filter(ts.isVariableStatement)
|
|
71
|
+
.flatMap((statement) => [...statement.declarationList.declarations]);
|
|
72
|
+
const names = {
|
|
73
|
+
contracts: new Set(),
|
|
74
|
+
groups: new Set(),
|
|
75
|
+
};
|
|
76
|
+
let changed = true;
|
|
77
|
+
while (changed) {
|
|
78
|
+
changed = false;
|
|
79
|
+
for (const declaration of declarations) {
|
|
80
|
+
if (!ts.isIdentifier(declaration.name) ||
|
|
81
|
+
!declaration.initializer ||
|
|
82
|
+
names.contracts.has(declaration.name.text) ||
|
|
83
|
+
names.groups.has(declaration.name.text)) {
|
|
84
|
+
continue;
|
|
85
|
+
}
|
|
86
|
+
const chain = contractCallChain(declaration.initializer);
|
|
87
|
+
if (!chain)
|
|
88
|
+
continue;
|
|
89
|
+
if (contractFactoryCall(chain, "defineContract", bindings) ||
|
|
90
|
+
(chain.baseIdentifier && names.contracts.has(chain.baseIdentifier))) {
|
|
91
|
+
names.contracts.add(declaration.name.text);
|
|
92
|
+
changed = true;
|
|
93
|
+
continue;
|
|
94
|
+
}
|
|
95
|
+
if (!isContractGroupDerived(chain, bindings, names.groups))
|
|
96
|
+
continue;
|
|
97
|
+
if (chain.calls.some((call) => httpContractMethods.has(call.name))) {
|
|
98
|
+
names.contracts.add(declaration.name.text);
|
|
99
|
+
changed = true;
|
|
100
|
+
continue;
|
|
101
|
+
}
|
|
102
|
+
if (chain.calls.some((call) => !contractGroupMethods.has(call.name))) {
|
|
103
|
+
continue;
|
|
104
|
+
}
|
|
105
|
+
names.groups.add(declaration.name.text);
|
|
106
|
+
changed = true;
|
|
107
|
+
}
|
|
108
|
+
}
|
|
109
|
+
return names;
|
|
110
|
+
}
|
|
111
|
+
/** Determine whether an expression declares a direct or group-built contract. */
|
|
112
|
+
export function isImportedContractDeclaration(expression, bindings, names) {
|
|
113
|
+
const chain = contractCallChain(expression);
|
|
114
|
+
if (!chain)
|
|
115
|
+
return false;
|
|
116
|
+
if (contractFactoryCall(chain, "defineContract", bindings) ||
|
|
117
|
+
(chain.baseIdentifier && names.contracts.has(chain.baseIdentifier))) {
|
|
118
|
+
return true;
|
|
119
|
+
}
|
|
120
|
+
return (isContractGroupDerived(chain, bindings, names.groups) &&
|
|
121
|
+
chain.calls.some((call) => httpContractMethods.has(call.name)));
|
|
122
|
+
}
|
|
123
|
+
function isContractGroupDerived(chain, bindings, groupNames) {
|
|
124
|
+
return Boolean(contractFactoryCall(chain, "defineContractGroup", bindings) ||
|
|
125
|
+
(chain.baseIdentifier && groupNames.has(chain.baseIdentifier)));
|
|
126
|
+
}
|
|
127
|
+
function contractFactoryCall(chain, name, bindings) {
|
|
128
|
+
const calls = chain.rootCall ? [chain.rootCall, ...chain.calls] : chain.calls;
|
|
129
|
+
return calls.find((call) => isImportedContractFactoryCall(call.node, name, bindings));
|
|
130
|
+
}
|
|
131
|
+
function contractCallChain(rawExpression) {
|
|
132
|
+
const calls = [];
|
|
133
|
+
let expression = rawExpression;
|
|
134
|
+
while (true) {
|
|
135
|
+
expression = unwrapExpression(expression);
|
|
136
|
+
if (ts.isPropertyAccessExpression(expression)) {
|
|
137
|
+
expression = expression.expression;
|
|
138
|
+
continue;
|
|
139
|
+
}
|
|
140
|
+
if (ts.isCallExpression(expression)) {
|
|
141
|
+
const callee = unwrapExpression(expression.expression);
|
|
142
|
+
if (ts.isPropertyAccessExpression(callee)) {
|
|
143
|
+
calls.unshift({ name: callee.name.text, node: expression });
|
|
144
|
+
expression = callee.expression;
|
|
145
|
+
continue;
|
|
146
|
+
}
|
|
147
|
+
if (ts.isIdentifier(callee)) {
|
|
148
|
+
return {
|
|
149
|
+
baseIdentifier: callee.text,
|
|
150
|
+
rootCall: { name: callee.text, node: expression },
|
|
151
|
+
calls,
|
|
152
|
+
};
|
|
153
|
+
}
|
|
154
|
+
return undefined;
|
|
155
|
+
}
|
|
156
|
+
if (ts.isIdentifier(expression)) {
|
|
157
|
+
return { baseIdentifier: expression.text, calls };
|
|
158
|
+
}
|
|
159
|
+
return undefined;
|
|
160
|
+
}
|
|
161
|
+
}
|
|
162
|
+
function isContractFactoryName(value) {
|
|
163
|
+
return value === "defineContract" || value === "defineContractGroup";
|
|
164
|
+
}
|
|
165
|
+
function unwrapExpression(expression) {
|
|
166
|
+
let current = expression;
|
|
167
|
+
while (ts.isParenthesizedExpression(current) ||
|
|
168
|
+
ts.isAsExpression(current) ||
|
|
169
|
+
ts.isTypeAssertionExpression(current) ||
|
|
170
|
+
ts.isNonNullExpression(current) ||
|
|
171
|
+
ts.isSatisfiesExpression(current)) {
|
|
172
|
+
current = current.expression;
|
|
173
|
+
}
|
|
174
|
+
return current;
|
|
175
|
+
}
|
|
176
|
+
//# sourceMappingURL=contract-factories.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"contract-factories.js","sourceRoot":"","sources":["../../src/analysis/contract-factories.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,YAAY,CAAC;AAE5B,MAAM,qBAAqB,GAAG,yBAAyB,CAAC;AAyBxD,MAAM,oBAAoB,GAAG,IAAI,GAAG,CAAC;IACnC,qBAAqB;IACrB,YAAY;IACZ,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AC,EAAE,CAAC;gBAC5B,OAAO;oBACL,cAAc,EAAE,MAAM,CAAC,IAAI;oBAC3B,QAAQ,EAAE,EAAE,IAAI,EAAE,MAAM,CAAC,IAAI,EAAE,IAAI,EAAE,UAAU,EAAE;oBACjD,KAAK;iBACN,CAAC;YACJ,CAAC;YACD,OAAO,SAAS,CAAC;QACnB,CAAC;QACD,IAAI,EAAE,CAAC,YAAY,CAAC,UAAU,CAAC,EAAE,CAAC;YAChC,OAAO,EAAE,cAAc,EAAE,UAAU,CAAC,IAAI,EAAE,KAAK,EAAE,CAAC;QACpD,CAAC;QACD,OAAO,SAAS,CAAC;IACnB,CAAC;AACH,CAAC;AAED,SAAS,qBAAqB,CAAC,KAAa;IAC1C,OAAO,KAAK,KAAK,gBAAgB,IAAI,KAAK,KAAK,qBAAqB,CAAC;AACvE,CAAC;AAED,SAAS,gBAAgB,CAAC,UAAyB;IACjD,IAAI,OAAO,GAAG,UAAU,CAAC;IACzB,OACE,EAAE,CAAC,yBAAyB,CAAC,OAAO,CAAC;QACrC,EAAE,CAAC,cAAc,CAAC,OAAO,CAAC;QAC1B,EAAE,CAAC,yBAAyB,CAAC,OAAO,CAAC;QACrC,EAAE,CAAC,mBAAmB,CAAC,OAAO,CAAC;QAC/B,EAAE,CAAC,qBAAqB,CAAC,OAAO,CAAC,EACjC,CAAC;QACD,OAAO,GAAG,OAAO,CAAC,UAAU,CAAC;IAC/B,CAAC;IACD,OAAO,OAAO,CAAC;AACjB,CAAC"}
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
import { type ResolvedBeignetConfig } from "../config.js";
|
|
2
|
+
export type SourceLayer = "app" | "app-context" | "agent-capability" | "client" | "component" | "contract" | "domain" | "feature-helper" | "feature-port" | "infra" | "lib" | "policy" | "port" | "route" | "schema" | "seed" | "server" | "test" | "use-case" | "workflow" | "unknown";
|
|
3
|
+
export declare function classifySourcePath(filePath: string, config: ResolvedBeignetConfig): SourceLayer;
|
|
4
|
+
export declare function canonicalFeatureLayerPath(filePath: string, config: ResolvedBeignetConfig): string | undefined;
|
|
5
|
+
//# sourceMappingURL=layers.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"layers.d.ts","sourceRoot":"","sources":["../../src/analysis/layers.ts"],"names":[],"mappings":"AACA,OAAO,EAIL,KAAK,qBAAqB,EAC3B,MAAM,cAAc,CAAC;AAEtB,MAAM,MAAM,WAAW,GACnB,KAAK,GACL,aAAa,GACb,kBAAkB,GAClB,QAAQ,GACR,WAAW,GACX,UAAU,GACV,QAAQ,GACR,gBAAgB,GAChB,cAAc,GACd,OAAO,GACP,KAAK,GACL,QAAQ,GACR,MAAM,GACN,OAAO,GACP,QAAQ,GACR,MAAM,GACN,QAAQ,GACR,MAAM,GACN,UAAU,GACV,UAAU,GACV,SAAS,CAAC;AA6Cd,wBAAgB,kBAAkB,CAChC,QAAQ,EAAE,MAAM,EAChB,MAAM,EAAE,qBAAqB,GAC5B,WAAW,CAuEb;AAED,wBAAgB,yBAAyB,CACvC,QAAQ,EAAE,MAAM,EAChB,MAAM,EAAE,qBAAqB,GAC5B,MAAM,GAAG,SAAS,CAmCpB"}
|