@beignet/cli 0.0.48 → 0.0.50

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 (111) hide show
  1. package/CHANGELOG.md +54 -0
  2. package/README.md +117 -22
  3. package/dist/analysis/contract-factories.d.ts +17 -0
  4. package/dist/analysis/contract-factories.d.ts.map +1 -0
  5. package/dist/analysis/contract-factories.js +176 -0
  6. package/dist/analysis/contract-factories.js.map +1 -0
  7. package/dist/analysis/layers.d.ts +5 -0
  8. package/dist/analysis/layers.d.ts.map +1 -0
  9. package/dist/analysis/layers.js +172 -0
  10. package/dist/analysis/layers.js.map +1 -0
  11. package/dist/analysis/port-wiring.d.ts +23 -0
  12. package/dist/analysis/port-wiring.d.ts.map +1 -0
  13. package/dist/analysis/port-wiring.js +379 -0
  14. package/dist/analysis/port-wiring.js.map +1 -0
  15. package/dist/analysis/source-index.d.ts +5 -0
  16. package/dist/analysis/source-index.d.ts.map +1 -1
  17. package/dist/analysis/source-index.js +171 -42
  18. package/dist/analysis/source-index.js.map +1 -1
  19. package/dist/analysis/workspace.d.ts +11 -4
  20. package/dist/analysis/workspace.d.ts.map +1 -1
  21. package/dist/analysis/workspace.js +78 -8
  22. package/dist/analysis/workspace.js.map +1 -1
  23. package/dist/app-map-changes.d.ts +103 -0
  24. package/dist/app-map-changes.d.ts.map +1 -0
  25. package/dist/app-map-changes.js +949 -0
  26. package/dist/app-map-changes.js.map +1 -0
  27. package/dist/app-map.d.ts.map +1 -1
  28. package/dist/app-map.js +311 -92
  29. package/dist/app-map.js.map +1 -1
  30. package/dist/check.js +37 -3
  31. package/dist/check.js.map +1 -1
  32. package/dist/explain.js +4 -4
  33. package/dist/explain.js.map +1 -1
  34. package/dist/git-changes.d.ts +30 -0
  35. package/dist/git-changes.d.ts.map +1 -0
  36. package/dist/git-changes.js +367 -0
  37. package/dist/git-changes.js.map +1 -0
  38. package/dist/index.d.ts.map +1 -1
  39. package/dist/index.js +26 -1
  40. package/dist/index.js.map +1 -1
  41. package/dist/inspect.d.ts.map +1 -1
  42. package/dist/inspect.js +706 -186
  43. package/dist/inspect.js.map +1 -1
  44. package/dist/lib.d.ts +3 -0
  45. package/dist/lib.d.ts.map +1 -1
  46. package/dist/lib.js +1 -0
  47. package/dist/lib.js.map +1 -1
  48. package/dist/lint.d.ts.map +1 -1
  49. package/dist/lint.js +309 -487
  50. package/dist/lint.js.map +1 -1
  51. package/dist/make/inbox.d.ts.map +1 -1
  52. package/dist/make/inbox.js +11 -4
  53. package/dist/make/inbox.js.map +1 -1
  54. package/dist/make/payments.js +2 -2
  55. package/dist/make/shared.d.ts.map +1 -1
  56. package/dist/make/shared.js +31 -27
  57. package/dist/make/shared.js.map +1 -1
  58. package/dist/make.d.ts.map +1 -1
  59. package/dist/make.js +144 -8
  60. package/dist/make.js.map +1 -1
  61. package/dist/mcp.d.ts +1 -1
  62. package/dist/mcp.d.ts.map +1 -1
  63. package/dist/mcp.js +43 -21
  64. package/dist/mcp.js.map +1 -1
  65. package/dist/provider-add.d.ts.map +1 -1
  66. package/dist/provider-add.js +142 -7
  67. package/dist/provider-add.js.map +1 -1
  68. package/dist/registry-edits.d.ts +7 -0
  69. package/dist/registry-edits.d.ts.map +1 -1
  70. package/dist/registry-edits.js +237 -53
  71. package/dist/registry-edits.js.map +1 -1
  72. package/dist/templates/agents.d.ts.map +1 -1
  73. package/dist/templates/agents.js +37 -1
  74. package/dist/templates/agents.js.map +1 -1
  75. package/dist/templates/base.d.ts.map +1 -1
  76. package/dist/templates/base.js +13 -2
  77. package/dist/templates/base.js.map +1 -1
  78. package/dist/templates/server.d.ts.map +1 -1
  79. package/dist/templates/server.js +2 -0
  80. package/dist/templates/server.js.map +1 -1
  81. package/dist/templates/shared.d.ts +1 -0
  82. package/dist/templates/shared.d.ts.map +1 -1
  83. package/dist/templates/shared.js +3 -2
  84. package/dist/templates/shared.js.map +1 -1
  85. package/package.json +7 -6
  86. package/skills/app-structure/SKILL.md +71 -7
  87. package/src/analysis/contract-factories.ts +256 -0
  88. package/src/analysis/layers.ts +266 -0
  89. package/src/analysis/port-wiring.ts +506 -0
  90. package/src/analysis/source-index.ts +225 -57
  91. package/src/analysis/workspace.ts +134 -9
  92. package/src/app-map-changes.ts +1462 -0
  93. package/src/app-map.ts +418 -109
  94. package/src/check.ts +51 -3
  95. package/src/explain.ts +4 -4
  96. package/src/git-changes.ts +511 -0
  97. package/src/index.ts +39 -1
  98. package/src/inspect.ts +1005 -238
  99. package/src/lib.ts +21 -0
  100. package/src/lint.ts +393 -643
  101. package/src/make/inbox.ts +11 -4
  102. package/src/make/payments.ts +2 -2
  103. package/src/make/shared.ts +31 -27
  104. package/src/make.ts +225 -8
  105. package/src/mcp.ts +51 -24
  106. package/src/provider-add.ts +186 -7
  107. package/src/registry-edits.ts +313 -63
  108. package/src/templates/agents.ts +37 -1
  109. package/src/templates/base.ts +13 -2
  110. package/src/templates/server.ts +2 -0
  111. package/src/templates/shared.ts +3 -2
package/CHANGELOG.md CHANGED
@@ -1,5 +1,59 @@
1
1
  # @beignet/cli
2
2
 
3
+ ## 0.0.50
4
+
5
+ ### Patch Changes
6
+
7
+ - 6fe026a: Expose event-subscription readiness and asynchronous cleanup, await listener
8
+ registries during provider startup with bounded rollback, diagnose unsafe app
9
+ wiring, and make Redis subscription lifecycle failures observable with bounded
10
+ provider shutdown and recoverable channel state.
11
+ - 4be4573: Keep mail content out of provider instrumentation, document the Redis
12
+ deployment policy required for monotonic fencing, and align generated agent
13
+ guidance with optional seed, worker, and migration paths.
14
+ - 2ec5545: Map local Git changes to bounded, source-backed Beignet concepts through the
15
+ CLI, library API, and MCP server.
16
+ - Updated dependencies [6fe026a]
17
+ - Updated dependencies [4be4573]
18
+ - Updated dependencies [ee402a9]
19
+ - Updated dependencies [d1db53e]
20
+ - Updated dependencies [7b0961b]
21
+ - @beignet/core@0.0.50
22
+
23
+ ## 0.0.49
24
+
25
+ ### Patch Changes
26
+
27
+ - e597d53: Require Node.js 22.12 or newer across every Beignet package, generated app,
28
+ and documented workflow.
29
+ - 3049831: Prevent outbox job registries from silently running without a dispatcher by
30
+ wiring generated jobs, reporting incomplete app-port configuration, and
31
+ validating delivery transports before claiming messages. Jobs provider presets
32
+ replace only the marked generated inline fallback.
33
+ - ea4bcf7: Inspect TypeScript module references structurally in architecture lint,
34
+ including require/import variants, transitive feature helpers, configured path
35
+ layouts, and exhaustive feature layer classification.
36
+ - 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.
37
+ - 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.
38
+ - e597d53: Migrate the Beignet MCP server to the stable TypeScript SDK v2 packages while
39
+ preserving stdio transport and protocol compatibility.
40
+ - 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.
41
+ - b2188d8: Align provider production behavior by validating cache TTLs consistently,
42
+ requiring encrypted SMTP transport by default, and streaming unknown-size S3
43
+ uploads through bounded managed multipart uploads with explicit cleanup across
44
+ all failure stages.
45
+
46
+ The S3 provider now requires `@aws-sdk/lib-storage`; the Beignet provider
47
+ preset installs the compatible version automatically.
48
+
49
+ - Updated dependencies [e597d53]
50
+ - Updated dependencies [3049831]
51
+ - Updated dependencies [60edd56]
52
+ - Updated dependencies [a06c5b9]
53
+ - Updated dependencies [8c0b355]
54
+ - Updated dependencies [b2188d8]
55
+ - @beignet/core@0.0.49
56
+
3
57
  ## 0.0.48
4
58
 
5
59
  ### 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:
@@ -362,7 +365,13 @@ server/routes.ts
362
365
  generated route tests pass the same value to `createTestApp(...)`.
363
366
 
364
367
  Route inspection supports contract-group definitions and direct
365
- `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.
366
375
 
367
376
  The standard app layout includes the files feature generators expect:
368
377
 
@@ -688,7 +697,9 @@ starter, tests, and feature-specific not-found and conflict catalog errors. Use
688
697
  resource.
689
698
 
690
699
  Generated list routes use cursor pagination with `limit`, `cursor`, `name`,
691
- `sortBy`, and `sortDirection` query parameters. The generated use case
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
692
703
  normalizes cursor pages, validates opaque base64url cursors against the selected
693
704
  sort, and passes one repository query object into memory and Drizzle adapters.
694
705
  Adapters filter `name` with case-insensitive contains matching, sort only by
@@ -787,10 +798,27 @@ and `make job` create that outbox path on first use and register the feature's
787
798
  `beignet doctor` reports events and jobs the registry cannot deliver. Keep the
788
799
  route as the durable recovery sweep even when the deferred trigger is present.
789
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
+
790
815
  Generators wire the provider-backed ports their output depends on. `make
791
816
  event` (and `make resource --events`) wires `eventBus: EventBusPort` with
792
817
  `createMemoryEventBusProvider()` from
793
818
  `@beignet/provider-event-bus-memory`, including the package dependency.
819
+ Listener generation also installs provider lifecycle wiring that registers the
820
+ central listener registry in `start()`, waits for its initial readiness with
821
+ the default 10-second registry deadline, and awaits cleanup in `stop()`.
794
822
  `make notification` wires `mailer: MailerPort` with
795
823
  `createMemoryMailerProvider()` and `notifications: NotificationPort` with
796
824
  `createInlineNotificationsProvider()`, both dev-default providers from
@@ -840,6 +868,8 @@ The runner loads `server/outbox.ts` or `paths.outbox`. That module should export
840
868
  `stopOutboxDrainContext(...)`. The context owns app ports and provider
841
869
  lifecycle, so the CLI drain uses the same outbox, event bus, jobs,
842
870
  instrumentation, actor, and tenant decisions as the scheduled drain route.
871
+ The drain validates all transports required by the registry before claiming a
872
+ batch, so missing `eventBus` or `jobs` wiring does not consume attempts.
843
873
 
844
874
  Inspect and recover failed deliveries through the same app-owned operational
845
875
  context:
@@ -1020,6 +1050,8 @@ Build a deterministic, source-backed graph of the app:
1020
1050
  beignet map
1021
1051
  beignet map --feature issues
1022
1052
  beignet map --json --kind route,use-case,event,listener
1053
+ beignet map --changed
1054
+ beignet map --changed --base origin/main --json
1023
1055
  ```
1024
1056
 
1025
1057
  The human view summarizes contracts, use cases, workflows, ports, UI, and tests
@@ -1032,17 +1064,48 @@ every edge carries source evidence and confidence.
1032
1064
 
1033
1065
  The JSON app map retains failed local module references as explicit
1034
1066
  `local_import_unresolved` entries instead of silently omitting their edges. It
1035
- also reports `contract_declaration_unresolved` when it finds an exported direct
1036
- `defineContract(...)` declaration whose method or path cannot be derived
1037
- statically. Registration diagnostics identify their declaration through a
1038
- structured `subject.file` and `subject.exportName`; registration status in the
1039
- map uses that identity rather than matching human-readable messages.
1067
+ also reports `contract_declaration_unresolved` when an exported direct or
1068
+ contract-group declaration has a method, path, or group prefix that cannot be
1069
+ derived statically. Registration diagnostics identify their declaration
1070
+ through a structured `subject.file` and `subject.exportName`; registration
1071
+ status in the map uses that identity rather than matching human-readable
1072
+ messages.
1040
1073
 
1041
1074
  `--feature` keeps that feature plus its direct relationships, while `--kind`
1042
1075
  accepts one or a comma-separated list of node kinds. These projections make
1043
1076
  the same full graph practical for coding-agent context windows. The command is
1044
1077
  report-only and does not fail because doctor or lint findings are present.
1045
1078
 
1079
+ `--changed` maps the current Git change set to potentially affected concepts.
1080
+ Without `--base`, it preserves staged index changes, unstaged worktree changes,
1081
+ and untracked files instead of collapsing them into one net diff against
1082
+ `HEAD`. With `--base <ref>`, it also includes committed branch changes from the
1083
+ merge base of that already-local ref through `HEAD`; Beignet never fetches the
1084
+ ref. The bounded report distinguishes direct source changes, reverse local
1085
+ imports, one-hop semantic consumers, related members of directly changed
1086
+ containers, and feature ownership context. Governing configuration and changed
1087
+ direct local workspace dependencies are marked app-wide. Recognized guide
1088
+ files such as `README.md`, `AGENTS.md`, and `CLAUDE.md`, plus Markdown or text
1089
+ files under a root `docs/` or `documentation/` directory, remain non-impacting.
1090
+ Other `.mdx` and `.txt` paths remain application changes. Deleted declarations,
1091
+ unresolved imports, changed files with no mapped concept, and other
1092
+ static-analysis blind spots remain visible as gaps.
1093
+ Changed-file paths and gap paths are repository-relative; app-map node sources
1094
+ and source evidence remain relative to the selected app root.
1095
+
1096
+ Changed mapping explains potential impact; it does not run checks or claim
1097
+ that a change is correct. Use `beignet check` after inspecting the report.
1098
+ `--changed` cannot be combined with `--feature` or `--kind`, and `--base`
1099
+ requires `--changed`.
1100
+
1101
+ The same report is available to library callers:
1102
+
1103
+ ```ts
1104
+ import { mapAppChanges } from "@beignet/cli";
1105
+
1106
+ const impact = await mapAppChanges({ cwd: "apps/api", base: "origin/main" });
1107
+ ```
1108
+
1046
1109
  ## Explain mapped app concepts
1047
1110
 
1048
1111
  Resolve one app-map target into deterministic, source-backed context:
@@ -1090,7 +1153,12 @@ in that order. Every step runs even when an earlier one fails, so a single
1090
1153
  run reports everything that needs fixing; the command exits non-zero when any
1091
1154
  step fails. Missing package scripts are reported as skipped, never as
1092
1155
  failures. Failed package-script output retains at most the last 64 KiB of each
1093
- stream.
1156
+ stream. The target package must declare `@beignet/core`, `@beignet/next`, or
1157
+ `@beignet/web` as a runtime dependency. The root must also contain
1158
+ `app-context.ts` or `beignet.config.*`; a canonical app with both `features/`
1159
+ and `server/index.ts` is accepted when `app-context.ts` is missing so doctor
1160
+ can report the drift. Other package roots stop before lint, doctor, or app
1161
+ scripts run.
1094
1162
 
1095
1163
  Use `beignet check --fix` to apply doctor's eligible low-risk fixes
1096
1164
  before checking, and `beignet check --json` for a versioned payload
@@ -1148,14 +1216,30 @@ Run `lint` when you want the CLI to enforce Beignet dependency direction:
1148
1216
  beignet lint
1149
1217
  ```
1150
1218
 
1151
- The command scans static imports and fails when app layers reach into runtime
1152
- or framework layers. It catches domain, use case, workflow, policy, port,
1153
- contract, route, infra, and component files importing things like `infra/`, UI
1154
- components, route handlers, server modules, client modules, provider packages,
1155
- Next.js, React, or database vendors in the wrong direction. It also catches
1156
- feature-specific domain files importing another feature's domain unless the
1157
- target is `features/shared/domain`. Workflow folders include feature-owned
1158
- jobs, listeners, notifications, schedules, and uploads.
1219
+ The command recognizes TypeScript imports and re-exports, `require()`, import
1220
+ assignments, and literal dynamic imports. It fails when app layers reach into
1221
+ runtime or framework layers, including domain, use case, workflow, policy,
1222
+ port, contract, route, schema, seed, agent capability, feature helper, infra,
1223
+ and component files importing `infra/`, UI components, route handlers, server
1224
+ modules, client modules, provider packages, Next.js, React, or database vendors
1225
+ in the wrong direction. Computed `require()` and `import()` expressions inside
1226
+ constrained layers fail because lint cannot verify their destination; use a
1227
+ string-literal specifier or move runtime loading behind an allowed boundary.
1228
+ Client-safe graphs reject Node built-ins whether they use `node:fs` or a bare
1229
+ specifier such as `fs/promises`.
1230
+
1231
+ Local value-import checks follow feature-root and other local helpers.
1232
+ For example, `use-case -> history.ts -> infra` reports the complete chain
1233
+ instead of treating `history.ts` as an unknown layer. Every module inside the
1234
+ configured feature root is classified; allowed feature-root helpers remain
1235
+ helpers, while near-miss canonical names such as `usecases/` report the
1236
+ expected `use-cases/` path. Feature-specific domain files still cannot import
1237
+ another feature's domain unless the target is `features/shared/domain`.
1238
+ Workflow folders include feature-owned jobs, listeners, notifications,
1239
+ schedules, tasks, and uploads. Agent capabilities may adapt use cases but core
1240
+ application layers cannot depend back on those adapters. Seeds may compose
1241
+ factories and app ports, but not concrete infra, providers, UI, or runtime
1242
+ composition.
1159
1243
 
1160
1244
  Local imports are resolved with the app's complete `tsconfig.json`
1161
1245
  configuration before dependency direction is classified. That includes
@@ -1163,10 +1247,10 @@ configuration before dependency direction is classified. That includes
1163
1247
  with multiple targets. The CLI uses TypeScript's config parser and resolver, so
1164
1248
  JSON comments and extended tsconfigs follow the same rules as the compiler.
1165
1249
 
1166
- Import diagnostics include 1-based `line` and `column` positions. Human
1167
- output prints clickable `file.ts:12:3` locations; runtime-boundary
1168
- diagnostics report the chain root file and the full import chain in the
1169
- message instead.
1250
+ Import diagnostics include 1-based `line` and `column` positions and preserve
1251
+ separate occurrences of the same module specifier. Human output prints
1252
+ clickable `file.ts:12:3` locations; transitive and runtime-boundary diagnostics
1253
+ report the chain root file and the full import chain in the message instead.
1170
1254
 
1171
1255
  Use JSON output in CI or custom scripts, or GitHub annotations in workflows:
1172
1256
 
@@ -1186,13 +1270,18 @@ beignet doctor
1186
1270
  Today it detects:
1187
1271
 
1188
1272
  - Contracts without a matching Next.js route handler
1273
+ - Contract query schemas without an explicit second `.query(...)` transport
1189
1274
  - Feature route groups that are not registered in the central route list
1190
1275
  - Feature schedules and tasks that are not registered in `server/schedules.ts`
1191
1276
  or `server/tasks.ts`
1192
1277
  - Feature events with listeners, and feature jobs, that are missing from
1193
1278
  `defineOutboxRegistry({...})` when the app uses outbox delivery
1279
+ - Outbox registries with jobs but no declared and bound or deferred `jobs`
1280
+ application port
1194
1281
  - Feature listeners missing from `server/listeners.ts` or otherwise not
1195
1282
  referenced by `registerListeners(...)`
1283
+ - Listener wiring that does not register in `start()`, await initial readiness,
1284
+ and await asynchronous cleanup in `stop()`
1196
1285
  - Opted-in runtime manifests that omit generated workflow registries
1197
1286
  - Next.js route handlers that do not map to known contracts
1198
1287
  - OpenAPI drift in direct arrays, exported contract lists, and
@@ -1208,6 +1297,9 @@ Today it detects:
1208
1297
  `features/shared/errors.ts`
1209
1298
  - Feature runtime `appError(...)` calls that are not declared on the feature's
1210
1299
  contracts
1300
+ - Feature layers whose normalized name or known alias points at a canonical
1301
+ location, such as `usecases/` instead of `use-cases/` or `events/` instead
1302
+ of `domain/events/`; doctor and lint report the same expected path
1211
1303
  - Authorization metadata whose ability is missing from feature policy coverage
1212
1304
  - Audit-required metadata without feature audit writes or test assertions
1213
1305
  - Mixed `@beignet/*` version ranges in package.json, and mixed installed
@@ -1247,7 +1339,7 @@ Today it detects:
1247
1339
  - Billing entitlement modules that are not wired into infra or server providers
1248
1340
  - Stripe payments configuration paired with local memory payments provider
1249
1341
  wiring
1250
- - Devtools routes that are explicitly enabled without authorization
1342
+ - Devtools routes without authorization or an explicit local-only development opt-in
1251
1343
  - Cron routes that do not use `CRON_SECRET`
1252
1344
  - Installed provider packages without expected environment configuration
1253
1345
  - Better Auth providers without an auth route or trusted-origin configuration
@@ -1365,7 +1457,10 @@ Resources:
1365
1457
  Tools:
1366
1458
 
1367
1459
  - `app_map` - project the source-backed app graph by optional `feature`,
1368
- `kinds`, and `includeDiagnostics` inputs (read-only)
1460
+ `kinds`, and `includeDiagnostics` inputs, or pass
1461
+ `{ changed: true, base?: "origin/main" }` for the same bounded report as
1462
+ `beignet map --changed --json` (read-only). Changed mode rejects projection
1463
+ and diagnostic inputs
1369
1464
  - `explain` - explain any source-backed mapped concept or diagnostic with
1370
1465
  `{ kind, target }`, returning relationships, conventions, findings,
1371
1466
  suggested files, and follow-up commands (read-only)
@@ -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,QAAQ;IACR,SAAS;IACT,MAAM;IACN,WAAW;IACX,QAAQ;IACR,WAAW;CACZ,CAAC,CAAC;AAEH,MAAM,mBAAmB,GAAG,IAAI,GAAG,CAAC;IAClC,QAAQ;IACR,KAAK;IACL,MAAM;IACN,SAAS;IACT,OAAO;IACP,MAAM;IACN,KAAK;CACN,CAAC,CAAC;AAEH,MAAM,UAAU,uBAAuB,CACrC,UAAyB;IAEzB,MAAM,QAAQ,GAA4B;QACxC,UAAU,EAAE;YACV,cAAc,EAAE,IAAI,GAAG,EAAE;YACzB,mBAAmB,EAAE,IAAI,GAAG,EAAE;SAC/B;QACD,cAAc,EAAE,IAAI,GAAG,EAAE;KAC1B,CAAC;IAEF,KAAK,MAAM,SAAS,IAAI,UAAU,CAAC,UAAU,EAAE,CAAC;QAC9C,IACE,CAAC,EAAE,CAAC,mBAAmB,CAAC,SAAS,CAAC;YAClC,CAAC,EAAE,CAAC,eAAe,CAAC,SAAS,CAAC,eAAe,CAAC;YAC9C,SAAS,CAAC,eAAe,CAAC,IAAI,KAAK,qBAAqB;YACxD,CAAC,SAAS,CAAC,YAAY;YACvB,SAAS,CAAC,YAAY,CAAC,UAAU,EACjC,CAAC;YACD,SAAS;QACX,CAAC;QAED,MAAM,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;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"}