@beignet/cli 0.0.45 → 0.0.47
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 +20 -0
- package/README.md +19 -9
- package/dist/choices.d.ts +1 -1
- package/dist/choices.d.ts.map +1 -1
- package/dist/choices.js +3 -0
- package/dist/choices.js.map +1 -1
- package/dist/db.d.ts +4 -0
- package/dist/db.d.ts.map +1 -1
- package/dist/db.js +4 -2
- package/dist/db.js.map +1 -1
- package/dist/inspect.d.ts.map +1 -1
- package/dist/inspect.js +520 -41
- package/dist/inspect.js.map +1 -1
- package/dist/make/tenancy.d.ts.map +1 -1
- package/dist/make/tenancy.js +2 -1
- package/dist/make/tenancy.js.map +1 -1
- package/dist/mcp.js +2 -2
- package/dist/mcp.js.map +1 -1
- package/dist/templates/agents.d.ts.map +1 -1
- package/dist/templates/agents.js +14 -2
- package/dist/templates/agents.js.map +1 -1
- package/dist/templates/server.d.ts.map +1 -1
- package/dist/templates/server.js +4 -1
- package/dist/templates/server.js.map +1 -1
- package/dist/templates/shared.js +1 -1
- package/package.json +2 -2
- package/skills/app-structure/SKILL.md +7 -1
- package/src/choices.ts +3 -0
- package/src/db.ts +4 -2
- package/src/inspect.ts +730 -41
- package/src/make/tenancy.ts +2 -1
- package/src/mcp.ts +2 -2
- package/src/templates/agents.ts +14 -2
- package/src/templates/server.ts +4 -1
- package/src/templates/shared.ts +1 -1
package/src/make/tenancy.ts
CHANGED
|
@@ -3857,7 +3857,7 @@ export type AppServiceContextInput =
|
|
|
3857
3857
|
*/
|
|
3858
3858
|
export const appContext = defineServerContext<AppContext, AppRuntimePorts>()({
|
|
3859
3859
|
\tgate: (ports) => ports.gate,
|
|
3860
|
-
\trequest: async ({ req, ports, requestId, trace }) => {
|
|
3860
|
+
\trequest: async ({ req, requestInfo, ports, requestId, trace }) => {
|
|
3861
3861
|
\t\tconst auth = await ports.auth.getSession(req);
|
|
3862
3862
|
\t\tconst { tenant, membership } = await resolveRequestWorkspace({
|
|
3863
3863
|
\t\t\tauth,
|
|
@@ -3876,6 +3876,7 @@ export const appContext = defineServerContext<AppContext, AppRuntimePorts>()({
|
|
|
3876
3876
|
\t\t\t\t\t})
|
|
3877
3877
|
\t\t\t\t: createAnonymousActor(),
|
|
3878
3878
|
\t\t\tauth,
|
|
3879
|
+
\t\t\trequestInfo,
|
|
3879
3880
|
\t\t\t...trace,
|
|
3880
3881
|
\t\t\tports,
|
|
3881
3882
|
\t\t\t...(tenant ? { tenant } : {}),
|
package/src/mcp.ts
CHANGED
|
@@ -995,7 +995,7 @@ export function buildBeignetMcpServer(options: McpServerOptions): McpServer {
|
|
|
995
995
|
"doctor_fix_plan",
|
|
996
996
|
{
|
|
997
997
|
description:
|
|
998
|
-
"Plan every currently available low-risk doctor repair without changing files. Returns stable operation IDs, exact unified patches, file hashes, and a plan ID for guarded doctor_fix application.",
|
|
998
|
+
"Plan every currently available low-risk doctor repair without changing files, including eligible registration drift and managed default provider-table exports. Returns stable operation IDs, exact unified patches, file hashes, and a plan ID for guarded doctor_fix application.",
|
|
999
999
|
inputSchema: {
|
|
1000
1000
|
strict: z
|
|
1001
1001
|
.boolean()
|
|
@@ -1021,7 +1021,7 @@ export function buildBeignetMcpServer(options: McpServerOptions): McpServer {
|
|
|
1021
1021
|
"doctor_fix",
|
|
1022
1022
|
{
|
|
1023
1023
|
description:
|
|
1024
|
-
"Apply low-risk doctor repairs, then re-check the app. With no planId, preserves the legacy apply-all behavior. Pass the planId returned by doctor_fix_plan for stale-file protection, optionally with fixIds to select repair operations.",
|
|
1024
|
+
"Apply eligible low-risk doctor repairs, then re-check the app; custom or ambiguous code remains diagnostic-only. With no planId, preserves the legacy apply-all behavior. Pass the planId returned by doctor_fix_plan for stale-file protection, optionally with fixIds to select repair operations.",
|
|
1025
1025
|
inputSchema: {
|
|
1026
1026
|
strict: z
|
|
1027
1027
|
.boolean()
|
package/src/templates/agents.ts
CHANGED
|
@@ -56,6 +56,10 @@ is a silent failure — the file exists but never runs:
|
|
|
56
56
|
in \`server/outbox.ts\`.
|
|
57
57
|
- Listeners must be added to the \`listeners\` array in \`server/listeners.ts\`
|
|
58
58
|
and wired through a \`registerListeners(...)\` call in server provider wiring.
|
|
59
|
+
- Apps using Inngest must also spread feature job registries into
|
|
60
|
+
\`inngestJobs\` in \`server/inngest.ts\`.
|
|
61
|
+
- Apps using runtime integrity must list workflow registries in
|
|
62
|
+
\`defineRuntimeManifest({...})\`.
|
|
59
63
|
|
|
60
64
|
The starter ships no workflow registries — generators create them on first
|
|
61
65
|
use, so their absence is fine. \`${cli} make event\`, \`${cli} make job\`,
|
|
@@ -69,7 +73,14 @@ manual registry instruction in the error.
|
|
|
69
73
|
with \`${cli} doctor --fix --dry-run\`, then apply the returned plan with
|
|
70
74
|
\`${cli} doctor --fix --plan <plan-id>\` and optional
|
|
71
75
|
\`--only <operation-ids>\`. Plain \`${cli} doctor --fix\` remains the
|
|
72
|
-
apply-all shortcut.
|
|
76
|
+
apply-all shortcut. Doctor can append fully unregistered artifacts to
|
|
77
|
+
existing central, Inngest, and runtime-manifest arrays when their imports and
|
|
78
|
+
array anchors are unambiguous. It also syncs missing default Beignet
|
|
79
|
+
provider-table exports when \`infra/db/schema/beignet.ts\` is missing or still
|
|
80
|
+
matches \`${cli} db schema sync\` output and the schema index has no custom
|
|
81
|
+
named re-export for that file. Run \`${cli} db generate\` and
|
|
82
|
+
\`${cli} db migrate\` after accepting that source repair. Custom or ambiguous
|
|
83
|
+
code stays diagnostic-only.
|
|
73
84
|
|
|
74
85
|
## Prefer generators
|
|
75
86
|
|
|
@@ -96,6 +107,7 @@ apps have reimplemented by accident:
|
|
|
96
107
|
| Ports outside a request — auth callbacks, module-level helpers | \`const { ports } = await getServer()\` (dynamic \`import("@/server")\` breaks module cycles). Do not construct parallel provider clients or fall back to \`console.*\` when \`ports.logger\` exists. |
|
|
97
108
|
| Routes that cannot be contracts — webhooks, third-party callbacks, streaming | \`createWebhookRoute\`, \`createPaymentWebhookRoute\`, \`createScheduleRoute\`, \`createOutboxDrainRoute\` from \`@beignet/next\`; \`server.rawRoute(...)\` for anything else. All run the hooks pipeline — never hand-enforce rate limits in a route body. |
|
|
98
109
|
| Rate limiting or idempotency on a route | Declare \`metadata.rateLimit\` / \`metadata.idempotency\` on the contract (or the \`pipeline\` option on raw routes); hooks enforce it. |
|
|
110
|
+
| External URL, origin, host, protocol, or client IP behind a proxy | Configure one \`trustedProxy\` policy on the server and read its resolved \`requestInfo\` in the context factory or server hooks. Forwarding headers are untrusted by default; do not persist client IPs automatically. |
|
|
99
111
|
| Tenant-owned repository access | Resolve the request tenant from membership-backed app state or provider claims the app explicitly treats as authoritative and current; never trust caller-supplied tenant IDs or unverified session fields. Pass \`TenantScope\` through app-facing repository methods and unwrap it with \`tenantScopeId(scope)\` in adapters. Raw provider-correlation lookups such as webhook customer IDs are not tenant authorization. |
|
|
100
112
|
| Route-level tests that exercise real hooks | \`createTestApp\` / \`createTestRequester\` from \`@beignet/web/testing\`. Bind the rate-limit and idempotency ports in the test app when asserting 429s or replay. |
|
|
101
113
|
| Environment configuration | \`lib/env.ts\` (\`createEnv\`), never ad-hoc \`process.env\` reads in app code. |
|
|
@@ -113,7 +125,7 @@ ${cli} check
|
|
|
113
125
|
It runs \`${cli} lint\` (Beignet's dependency-direction lint),
|
|
114
126
|
\`${cli} doctor --strict\`, and the app's \`lint\` (Biome), \`typecheck\`, and
|
|
115
127
|
\`test\` scripts in one pass, reporting every failure. Add \`--fix\` to apply
|
|
116
|
-
doctor's low-risk
|
|
128
|
+
doctor's eligible low-risk fixes first. Use \`${format}\` to apply
|
|
117
129
|
formatting. The individual commands (\`${lint}\`, \`${cli} lint\`,
|
|
118
130
|
\`${cli} doctor --strict\`, \`${test}\`, \`${typecheck}\`) still work when you
|
|
119
131
|
need one check alone.
|
package/src/templates/server.ts
CHANGED
|
@@ -416,6 +416,7 @@ async function stopServerAndDatabase(server: {
|
|
|
416
416
|
const files = {
|
|
417
417
|
appContext: `import type { ActivityActor, ActivityTenant } from "@beignet/core/ports";
|
|
418
418
|
import type { InferProviderPorts } from "@beignet/core/providers";
|
|
419
|
+
import type { TrustedRequestInfo } from "@beignet/core/server";
|
|
419
420
|
import type { TraceContext } from "@beignet/core/tracing";
|
|
420
421
|
import type { AppGate, AppPorts } from "@/ports";
|
|
421
422
|
import type { AuthSession } from "@/ports/auth";
|
|
@@ -432,6 +433,7 @@ export type AppContext = {
|
|
|
432
433
|
auth: AuthSession | null;
|
|
433
434
|
gate: AppGate;
|
|
434
435
|
ports: AppRuntimePorts;
|
|
436
|
+
requestInfo?: TrustedRequestInfo;
|
|
435
437
|
tenant?: ActivityTenant;
|
|
436
438
|
} & Partial<TraceContext>;
|
|
437
439
|
`,
|
|
@@ -552,7 +554,7 @@ export type AppServiceContextInput =
|
|
|
552
554
|
*/
|
|
553
555
|
export const appContext = defineServerContext<AppContext, AppRuntimePorts>()({
|
|
554
556
|
gate: (ports) => ports.gate,
|
|
555
|
-
request: async ({ req, ports, requestId, trace }) => {
|
|
557
|
+
request: async ({ req, requestInfo, ports, requestId, trace }) => {
|
|
556
558
|
const auth = await ports.auth.getSession(req);
|
|
557
559
|
const tenant = resolveRequestTenant({ auth });
|
|
558
560
|
|
|
@@ -562,6 +564,7 @@ export const appContext = defineServerContext<AppContext, AppRuntimePorts>()({
|
|
|
562
564
|
? createUserActor(auth.user.id, { displayName: auth.user.name })
|
|
563
565
|
: createAnonymousActor(),
|
|
564
566
|
auth,
|
|
567
|
+
requestInfo,
|
|
565
568
|
...trace,
|
|
566
569
|
ports,
|
|
567
570
|
...(tenant ? { tenant } : {}),
|
package/src/templates/shared.ts
CHANGED