@gadicc/loom 1.27.0 → 1.29.0
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/README.md +7 -3
- package/esm/src/cli/mod.d.ts.map +1 -1
- package/esm/src/cli/mod.js +76 -13
- package/esm/src/next/auth/client.d.ts +28 -0
- package/esm/src/next/auth/client.d.ts.map +1 -0
- package/esm/src/next/auth/client.js +28 -0
- package/esm/src/next/auth/server.d.ts +16 -0
- package/esm/src/next/auth/server.d.ts.map +1 -1
- package/esm/src/next/auth/server.js +15 -3
- package/package.json +6 -2
- package/script/src/cli/mod.d.ts.map +1 -1
- package/script/src/cli/mod.js +76 -13
- package/script/src/next/auth/client.d.ts +28 -0
- package/script/src/next/auth/client.d.ts.map +1 -0
- package/script/src/next/auth/client.js +32 -0
- package/script/src/next/auth/server.d.ts +16 -0
- package/script/src/next/auth/server.d.ts.map +1 -1
- package/script/src/next/auth/server.js +15 -3
- package/skills/loom-auth/SKILL.md +65 -0
- package/skills/modernize-app/SKILL.md +90 -0
- package/skills/modernize-app/agents/openai.yaml +4 -0
- package/skills/modernize-app/references/architecture-and-characterization.md +205 -0
- package/skills/modernize-app/references/identity-and-data.md +251 -0
- package/skills/modernize-app/references/offline-and-media.md +403 -0
- package/skills/modernize-app/references/rollout-and-shared-work.md +400 -0
package/README.md
CHANGED
|
@@ -362,6 +362,10 @@ The package now publishes Codex skill folders under `skills/`.
|
|
|
362
362
|
dependency-upgrade workflow covering compatibility groups, rollback safety,
|
|
363
363
|
failure isolation, major migrations, reviewable commits, and exact-tree final
|
|
364
364
|
verification.
|
|
365
|
+
- `skills/modernize-app` guides staged modernization of an existing application,
|
|
366
|
+
including identity/data preservation, optional offline/media transitions and
|
|
367
|
+
verified rollout. Dependency-only work stays with `upgrade-deps`; new apps use
|
|
368
|
+
scaffolding rather than this migration workflow.
|
|
365
369
|
- `skills/loom-db` provides DB-feature guidance for Neon/Drizzle wiring, managed
|
|
366
370
|
local schema blueprints, Valibot generation, and the shared PGlite harness.
|
|
367
371
|
- `skills/loom-auth` covers Better Auth secrets, rotation, environment trust
|
|
@@ -375,9 +379,9 @@ Projects do not need to copy these files manually. `loom init`, `loom add db`,
|
|
|
375
379
|
`loom add jobs`, and `loom check` manage a small project-local `AGENTS.md` Loom
|
|
376
380
|
block plus `.agents/skills/*` symlinks that point to the installed
|
|
377
381
|
`node_modules/@gadicc/loom/skills/*` folders. The global `loom`,
|
|
378
|
-
`loom-torvalds-review`,
|
|
379
|
-
initialized project; feature skills are linked when their matching
|
|
380
|
-
active.
|
|
382
|
+
`loom-torvalds-review`, `upgrade-deps`, and `modernize-app` skills are linked
|
|
383
|
+
for every initialized project; feature skills are linked when their matching
|
|
384
|
+
feature is active.
|
|
381
385
|
|
|
382
386
|
Third-party skills are not packaged with Loom. Loom carries a metadata-only
|
|
383
387
|
catalog containing source URLs, immutable commits, content hashes, and license
|
package/esm/src/cli/mod.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"mod.d.ts","sourceRoot":"","sources":["../../../src/src/cli/mod.ts"],"names":[],"mappings":"AAgCA,OAAO,EAEL,KAAK,uBAAuB,EAC7B,MAAM,yBAAyB,CAAC;AAuBjC,OAAO,EAUL,KAAK,cAAc,EAMpB,MAAM,qBAAqB,CAAC;AAE7B,eAAO,MAAM,kBAAkB,WAAW,CAAC;AAC3C,eAAO,MAAM,eAAe,iBAAiB,CAAC;AAC9C,eAAO,MAAM,oBAAoB,2DACyB,CAAC;AAC3D,eAAO,MAAM,yBAAyB,uCAAuC,CAAC;AAC9E,eAAO,MAAM,uBAAuB,qCAAqC,CAAC;AAC1E,eAAO,MAAM,8BAA8B,8CACE,CAAC;AAC9C,eAAO,MAAM,4BAA4B,4CACE,CAAC;AAC5C,eAAO,MAAM,+BAA+B,6BAA6B,CAAC;AAC1E,eAAO,MAAM,6BAA6B,2BAA2B,CAAC;AACtE,eAAO,MAAM,kCAAkC,yBAAyB,CAAC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+
label: "legacy app modernization skill",
|
|
100
|
+
relativePackagePath: "skills/modernize-app",
|
|
101
|
+
skillName: "modernize-app",
|
|
102
|
+
},
|
|
98
103
|
{
|
|
99
104
|
featureKey: "db",
|
|
100
105
|
label: "loom db skill",
|
|
@@ -1156,6 +1161,10 @@ async function mergeAuthConfig(cwd, framework, featureConfig) {
|
|
|
1156
1161
|
...defaults.modules,
|
|
1157
1162
|
...featureConfig?.modules,
|
|
1158
1163
|
},
|
|
1164
|
+
// Recorded by the app; Loom never infers or rewrites this choice.
|
|
1165
|
+
...(featureConfig?.requestSessionReaders
|
|
1166
|
+
? { requestSessionReaders: featureConfig.requestSessionReaders }
|
|
1167
|
+
: {}),
|
|
1159
1168
|
};
|
|
1160
1169
|
}
|
|
1161
1170
|
function dependencyExecutable(tooling, executable) {
|
|
@@ -3935,15 +3944,35 @@ function matchesAuthRouteWrapper(text, expectedSources, expectedExportName) {
|
|
|
3935
3944
|
if (!matchesImportSource(normalized, expectedSources)) {
|
|
3936
3945
|
return false;
|
|
3937
3946
|
}
|
|
3938
|
-
|
|
3939
|
-
|
|
3947
|
+
// Exactly one handler set, so every exported method is traceable to it.
|
|
3948
|
+
const calls = [
|
|
3949
|
+
...normalized.matchAll(/toNextJsHandler\(\s*([A-Za-z_$][\w$]*)\s*\)/g),
|
|
3950
|
+
];
|
|
3951
|
+
if (calls.length !== 1) {
|
|
3940
3952
|
return false;
|
|
3941
3953
|
}
|
|
3942
|
-
const
|
|
3943
|
-
if (
|
|
3954
|
+
const instanceName = calls[0][1];
|
|
3955
|
+
if (expectedExportName && instanceName !== expectedExportName) {
|
|
3944
3956
|
return false;
|
|
3945
3957
|
}
|
|
3946
|
-
|
|
3958
|
+
const match = normalized.match(/export\s+const\s+\{\s*([^}]+)\s*\}\s*=\s*toNextJsHandler\(/);
|
|
3959
|
+
if (match) {
|
|
3960
|
+
const actualSpecifiers = new Set(match[1].split(",").map((specifier) => specifier.trim()).filter(Boolean));
|
|
3961
|
+
return actualSpecifiers.has("GET") && actualSpecifiers.has("POST");
|
|
3962
|
+
}
|
|
3963
|
+
// An app may wrap the handlers, for example to fail closed until a
|
|
3964
|
+
// migration completes. Each exported method must still come from the
|
|
3965
|
+
// handlers that call returned.
|
|
3966
|
+
const handlers = normalized.match(/(?:const|let|var)\s+([A-Za-z_$][\w$]*)\s*=\s*toNextJsHandler\(/);
|
|
3967
|
+
if (!handlers) {
|
|
3968
|
+
return false;
|
|
3969
|
+
}
|
|
3970
|
+
const handlersName = handlers[1];
|
|
3971
|
+
return ["GET", "POST"].every((method) => {
|
|
3972
|
+
const exported = normalized.match(new RegExp(`export\\s+const\\s+${method}\\s*=([^;]*);`));
|
|
3973
|
+
return Boolean(exported &&
|
|
3974
|
+
new RegExp(`\\b${escapeRegExp(handlersName)}\\.${method}\\b`).test(exported[1]));
|
|
3975
|
+
});
|
|
3947
3976
|
}
|
|
3948
3977
|
function authClientTemplate(config, authExportName) {
|
|
3949
3978
|
return `"use client";
|
|
@@ -9257,6 +9286,7 @@ async function checkAuthFeature(cwd, framework, manifest) {
|
|
|
9257
9286
|
const config = await mergeAuthConfig(cwd, framework, feature.config);
|
|
9258
9287
|
const requiredFiles = [
|
|
9259
9288
|
config.modules.authModule,
|
|
9289
|
+
config.modules.authRuntimeModule,
|
|
9260
9290
|
config.modules.authClientModule,
|
|
9261
9291
|
config.entrypoints.routeHandler,
|
|
9262
9292
|
config.modules.authServerModule,
|
|
@@ -9272,6 +9302,37 @@ async function checkAuthFeature(cwd, framework, manifest) {
|
|
|
9272
9302
|
const authExportName = authModuleText
|
|
9273
9303
|
? detectBetterAuthExportName(authModuleText)
|
|
9274
9304
|
: null;
|
|
9305
|
+
// An app may build its instance in a separate runtime module, so the shared
|
|
9306
|
+
// helpers can be split across the two. Only a runtime module that imports
|
|
9307
|
+
// the auth module counts: otherwise its text proves nothing about the
|
|
9308
|
+
// instance this feature checks.
|
|
9309
|
+
const authRuntimeModule = config.modules.authRuntimeModule;
|
|
9310
|
+
const authRuntimeText = authRuntimeModule
|
|
9311
|
+
? await readTextIfExists(join(cwd, authRuntimeModule))
|
|
9312
|
+
: null;
|
|
9313
|
+
let creditedRuntimeText = null;
|
|
9314
|
+
if (authRuntimeModule && authRuntimeText) {
|
|
9315
|
+
if (matchesImportSource(authRuntimeText, getImportSpecifierCandidates(authRuntimeModule, config.modules.authModule))) {
|
|
9316
|
+
creditedRuntimeText = authRuntimeText;
|
|
9317
|
+
}
|
|
9318
|
+
else {
|
|
9319
|
+
issues.push(`Auth runtime module does not import the configured auth module: ${authRuntimeModule}`);
|
|
9320
|
+
suggestions.add("Point modules.authRuntimeModule at the module that builds the configured auth instance, or remove it from loom.json.");
|
|
9321
|
+
}
|
|
9322
|
+
}
|
|
9323
|
+
const authWiringSources = [
|
|
9324
|
+
{ path: config.modules.authModule, text: authModuleText },
|
|
9325
|
+
...(creditedRuntimeText
|
|
9326
|
+
? [{ path: authRuntimeModule, text: creditedRuntimeText }]
|
|
9327
|
+
: []),
|
|
9328
|
+
].filter((source) => source.text);
|
|
9329
|
+
// Modules reach the instance through whichever of the two exports it.
|
|
9330
|
+
const authImportCandidates = (fromPath) => [
|
|
9331
|
+
...getImportSpecifierCandidates(fromPath, config.modules.authModule),
|
|
9332
|
+
...(creditedRuntimeText && authRuntimeModule
|
|
9333
|
+
? getImportSpecifierCandidates(fromPath, authRuntimeModule)
|
|
9334
|
+
: []),
|
|
9335
|
+
];
|
|
9275
9336
|
if (authModuleText) {
|
|
9276
9337
|
const authModuleChecks = [
|
|
9277
9338
|
[
|
|
@@ -9284,8 +9345,8 @@ async function checkAuthFeature(cwd, framework, manifest) {
|
|
|
9284
9345
|
],
|
|
9285
9346
|
];
|
|
9286
9347
|
for (const [pattern, message] of authModuleChecks) {
|
|
9287
|
-
if (!pattern.test(
|
|
9288
|
-
issues.push(`${message}: ${
|
|
9348
|
+
if (!authWiringSources.some((source) => pattern.test(source.text))) {
|
|
9349
|
+
issues.push(`${message}: ${authWiringSources.map((source) => source.path).join(", ")}`);
|
|
9289
9350
|
suggestions.add("Update the auth module to use the shared Loom Better Auth helpers, or rerun `loom add auth` and reapply any app-local customizations.");
|
|
9290
9351
|
}
|
|
9291
9352
|
}
|
|
@@ -9294,15 +9355,16 @@ async function checkAuthFeature(cwd, framework, manifest) {
|
|
|
9294
9355
|
warnings.push(`Auth module uses a dynamic Better Auth baseURL without trusted proxy headers; trusted reverse proxies such as \`vercel dev\` can leak an internal callback host: ${config.modules.authModule}`);
|
|
9295
9356
|
suggestions.add("Use createBetterAuthLocalDevelopmentConfig for loopback development behind a trusted proxy, or explicitly enable Better Auth trustedProxyHeaders only where that proxy boundary is trusted.");
|
|
9296
9357
|
}
|
|
9297
|
-
if (
|
|
9358
|
+
if (config.requestSessionReaders !== "app-owned" &&
|
|
9359
|
+
!config.modules.authServerModule &&
|
|
9298
9360
|
!authModuleText.includes("createRequestAuthSessionReaders")) {
|
|
9299
9361
|
issues.push(`Auth module is missing Loom request-scoped session readers: ${config.modules.authModule}`);
|
|
9300
|
-
suggestions.add(
|
|
9362
|
+
suggestions.add('Either wire createRequestAuthSessionReaders into the auth module, add an auth server helper module and record it in loom.json, or record requestSessionReaders: "app-owned" when the app must read sessions its own way.');
|
|
9301
9363
|
}
|
|
9302
9364
|
}
|
|
9303
9365
|
const authClientText = await readTextIfExists(join(cwd, config.modules.authClientModule));
|
|
9304
9366
|
if (authClientText) {
|
|
9305
|
-
const authClientImportCandidates =
|
|
9367
|
+
const authClientImportCandidates = authImportCandidates(config.modules.authClientModule);
|
|
9306
9368
|
const authClientChecks = [
|
|
9307
9369
|
[
|
|
9308
9370
|
authClientText.includes("createAuthClient"),
|
|
@@ -9326,7 +9388,7 @@ async function checkAuthFeature(cwd, framework, manifest) {
|
|
|
9326
9388
|
}
|
|
9327
9389
|
const routeHandlerText = await readTextIfExists(join(cwd, config.entrypoints.routeHandler));
|
|
9328
9390
|
if (routeHandlerText) {
|
|
9329
|
-
const routeImportCandidates =
|
|
9391
|
+
const routeImportCandidates = authImportCandidates(config.entrypoints.routeHandler);
|
|
9330
9392
|
if (!matchesAuthRouteWrapper(routeHandlerText, routeImportCandidates, authExportName)) {
|
|
9331
9393
|
issues.push(`Auth route-handler wrapper does not match loom manifest config: ${config.entrypoints.routeHandler}`);
|
|
9332
9394
|
suggestions.add("Run `loom add auth` to restore the thin auth route wrapper, or update loom.json if the app intentionally uses different auth paths.");
|
|
@@ -9335,10 +9397,11 @@ async function checkAuthFeature(cwd, framework, manifest) {
|
|
|
9335
9397
|
if (config.modules.authServerModule) {
|
|
9336
9398
|
const authServerText = await readTextIfExists(join(cwd, config.modules.authServerModule));
|
|
9337
9399
|
if (authServerText) {
|
|
9338
|
-
const authServerImportCandidates =
|
|
9400
|
+
const authServerImportCandidates = authImportCandidates(config.modules.authServerModule);
|
|
9339
9401
|
const authServerChecks = [
|
|
9340
9402
|
[
|
|
9341
|
-
|
|
9403
|
+
config.requestSessionReaders === "app-owned" ||
|
|
9404
|
+
authServerText.includes("createRequestAuthSessionReaders"),
|
|
9342
9405
|
"Auth server module is not wired to Loom request-scoped session readers",
|
|
9343
9406
|
],
|
|
9344
9407
|
[
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
import "../../../_dnt.polyfills.js";
|
|
2
|
+
/**
|
|
3
|
+
* Browser-side Better Auth helpers. This module imports nothing, so it adds no
|
|
4
|
+
* dependency and is safe to reach from a consumer's own client module. Read
|
|
5
|
+
* globals through `globalThis`: a bare `window` becomes a build shim that is
|
|
6
|
+
* always defined, and pulls Node polyfills into the browser bundle.
|
|
7
|
+
*/
|
|
8
|
+
type PendingSessionState = {
|
|
9
|
+
isPending: boolean;
|
|
10
|
+
};
|
|
11
|
+
/**
|
|
12
|
+
* Wraps Better Auth's `useSession` so a session reports pending only until the
|
|
13
|
+
* page's first answer.
|
|
14
|
+
*
|
|
15
|
+
* Better Auth marks a session with no data as pending again for every refetch,
|
|
16
|
+
* which it runs on focus, on reconnect and on a cross-tab session change. For a
|
|
17
|
+
* signed-out visitor that turns each of those into a pending state, so views
|
|
18
|
+
* waiting for the first answer unmount and re-check identity, and anything
|
|
19
|
+
* keyed on the session runs again. After the first answer this keeps the last
|
|
20
|
+
* settled state, which for a pending refetch is always "no session", until the
|
|
21
|
+
* new answer arrives.
|
|
22
|
+
*
|
|
23
|
+
* Server renders never settle, so hydration still starts from the pending
|
|
24
|
+
* state the server rendered.
|
|
25
|
+
*/
|
|
26
|
+
export declare function createSettledSessionHook<TState extends PendingSessionState>(useSession: () => TState): () => TState;
|
|
27
|
+
export {};
|
|
28
|
+
//# sourceMappingURL=client.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"client.d.ts","sourceRoot":"","sources":["../../../../src/src/next/auth/client.ts"],"names":[],"mappings":"AAAA,OAAO,4BAA4B,CAAC;AAGpC;;;;;GAKG;AAEH,KAAK,mBAAmB,GAAG;IACzB,SAAS,EAAE,OAAO,CAAC;CACpB,CAAC;AAEF;;;;;;;;;;;;;;GAcG;AACH,wBAAgB,wBAAwB,CAAC,MAAM,SAAS,mBAAmB,EACzE,UAAU,EAAE,MAAM,MAAM,GACvB,MAAM,MAAM,CAWd"}
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
/**
|
|
3
|
+
* Wraps Better Auth's `useSession` so a session reports pending only until the
|
|
4
|
+
* page's first answer.
|
|
5
|
+
*
|
|
6
|
+
* Better Auth marks a session with no data as pending again for every refetch,
|
|
7
|
+
* which it runs on focus, on reconnect and on a cross-tab session change. For a
|
|
8
|
+
* signed-out visitor that turns each of those into a pending state, so views
|
|
9
|
+
* waiting for the first answer unmount and re-check identity, and anything
|
|
10
|
+
* keyed on the session runs again. After the first answer this keeps the last
|
|
11
|
+
* settled state, which for a pending refetch is always "no session", until the
|
|
12
|
+
* new answer arrives.
|
|
13
|
+
*
|
|
14
|
+
* Server renders never settle, so hydration still starts from the pending
|
|
15
|
+
* state the server rendered.
|
|
16
|
+
*/
|
|
17
|
+
export function createSettledSessionHook(useSession) {
|
|
18
|
+
let settled = false;
|
|
19
|
+
return function useSettledSession() {
|
|
20
|
+
const session = useSession();
|
|
21
|
+
if (!session.isPending) {
|
|
22
|
+
if (typeof globalThis.document !== "undefined")
|
|
23
|
+
settled = true;
|
|
24
|
+
return session;
|
|
25
|
+
}
|
|
26
|
+
return settled ? { ...session, isPending: false } : session;
|
|
27
|
+
};
|
|
28
|
+
}
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
type SessionQuery = {
|
|
2
2
|
disableCookieCache?: boolean;
|
|
3
|
+
disableRefresh?: boolean;
|
|
3
4
|
};
|
|
4
5
|
type GetSessionArgs<THeaders> = {
|
|
5
6
|
headers: THeaders;
|
|
@@ -20,9 +21,24 @@ export type CreateRequestAuthSessionReadersOptions<THeaders, TAuth extends Bette
|
|
|
20
21
|
getHeaders: () => THeaders | Promise<THeaders>;
|
|
21
22
|
profileEnvVar?: string;
|
|
22
23
|
};
|
|
24
|
+
export type SessionReadOptions = {
|
|
25
|
+
disableCookieCache?: boolean;
|
|
26
|
+
/** Reads the session without extending it, for a check that only decides. */
|
|
27
|
+
disableRefresh?: boolean;
|
|
28
|
+
};
|
|
23
29
|
export declare function createRequestAuthSessionReaders<THeaders, TAuth extends BetterAuthLike<THeaders, unknown>>(options: CreateRequestAuthSessionReadersOptions<THeaders, TAuth>): {
|
|
24
30
|
getFreshSession: any;
|
|
25
31
|
getSession: any;
|
|
32
|
+
/**
|
|
33
|
+
* Reads the session again on every call, unlike the cached readers above.
|
|
34
|
+
* An authorization boundary that re-checks after awaited work needs this:
|
|
35
|
+
* a cached read can still answer from before a revocation. Pass
|
|
36
|
+
* `disableRefresh` for a check that only decides, so deciding does not
|
|
37
|
+
* extend the session.
|
|
38
|
+
*/
|
|
39
|
+
readSession: (readOptions?: SessionReadOptions) => Promise<InferAuthSession<TAuth, THeaders>>;
|
|
40
|
+
/** `readSession` with the cookie cache bypassed, and never cached. */
|
|
41
|
+
readFreshSession: (readOptions?: SessionReadOptions) => Promise<InferAuthSession<TAuth, THeaders>>;
|
|
26
42
|
};
|
|
27
43
|
export {};
|
|
28
44
|
//# sourceMappingURL=server.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"server.d.ts","sourceRoot":"","sources":["../../../../src/src/next/auth/server.ts"],"names":[],"mappings":"AAEA,KAAK,YAAY,GAAG;IAClB,kBAAkB,CAAC,EAAE,OAAO,CAAC;
|
|
1
|
+
{"version":3,"file":"server.d.ts","sourceRoot":"","sources":["../../../../src/src/next/auth/server.ts"],"names":[],"mappings":"AAEA,KAAK,YAAY,GAAG;IAClB,kBAAkB,CAAC,EAAE,OAAO,CAAC;IAC7B,cAAc,CAAC,EAAE,OAAO,CAAC;CAC1B,CAAC;AAEF,KAAK,cAAc,CAAC,QAAQ,IAAI;IAC9B,OAAO,EAAE,QAAQ,CAAC;IAClB,KAAK,CAAC,EAAE,YAAY,GAAG,SAAS,CAAC;CAClC,CAAC;AAEF,KAAK,cAAc,CAAC,QAAQ,EAAE,QAAQ,IAAI;IACxC,MAAM,EAAE;QACN,OAAO,EAAE,QAAQ,CAAC;KACnB,CAAC;IACF,GAAG,EAAE;QACH,UAAU,CAAC,IAAI,EAAE,cAAc,CAAC,QAAQ,CAAC,GAAG,OAAO,CAAC,QAAQ,GAAG,IAAI,CAAC,CAAC;KACtE,CAAC;CACH,CAAC;AAEF,MAAM,MAAM,gBAAgB,CAC1B,KAAK,SAAS,cAAc,CAAC,QAAQ,EAAE,OAAO,CAAC,EAC/C,QAAQ,IACN,KAAK,CAAC,QAAQ,CAAC,CAAC,SAAS,CAAC,GAAG,IAAI,CAAC;AAEtC,MAAM,MAAM,sCAAsC,CAChD,QAAQ,EACR,KAAK,SAAS,cAAc,CAAC,QAAQ,EAAE,OAAO,CAAC,IAC7C;IACF,IAAI,EAAE,KAAK,CAAC;IACZ,GAAG,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,GAAG,SAAS,CAAC,CAAC;IACzC,UAAU,EAAE,MAAM,QAAQ,GAAG,OAAO,CAAC,QAAQ,CAAC,CAAC;IAC/C,aAAa,CAAC,EAAE,MAAM,CAAC;CACxB,CAAC;AAEF,MAAM,MAAM,kBAAkB,GAAG;IAC/B,kBAAkB,CAAC,EAAE,OAAO,CAAC;IAC7B,6EAA6E;IAC7E,cAAc,CAAC,EAAE,OAAO,CAAC;CAC1B,CAAC;AAEF,wBAAgB,+BAA+B,CAC7C,QAAQ,EACR,KAAK,SAAS,cAAc,CAAC,QAAQ,EAAE,OAAO,CAAC,EAE/C,OAAO,EAAE,sCAAsC,CAAC,QAAQ,EAAE,KAAK,CAAC;;;IAqC9D;;;;;;OAMG;gCAtCU,kBAAkB,KAC9B,OAAO,CAAC,gBAAgB,CAAC,KAAK,EAAE,QAAQ,CAAC,CAAC;IAuC3C,sEAAsE;qCACtC,kBAAkB;EAGrD"}
|
|
@@ -4,11 +4,13 @@ export function createRequestAuthSessionReaders(options) {
|
|
|
4
4
|
async function readSession(readOptions = {}) {
|
|
5
5
|
const startedAt = Date.now();
|
|
6
6
|
const requestHeaders = await options.getHeaders();
|
|
7
|
+
const query = {
|
|
8
|
+
...(readOptions.disableCookieCache ? { disableCookieCache: true } : {}),
|
|
9
|
+
...(readOptions.disableRefresh ? { disableRefresh: true } : {}),
|
|
10
|
+
};
|
|
7
11
|
const session = await options.auth.api.getSession({
|
|
8
12
|
headers: requestHeaders,
|
|
9
|
-
query:
|
|
10
|
-
? { disableCookieCache: true }
|
|
11
|
-
: undefined,
|
|
13
|
+
query: Object.keys(query).length ? query : undefined,
|
|
12
14
|
});
|
|
13
15
|
if (options.env?.[profileEnvVar] === "1") {
|
|
14
16
|
console.info(`[perf:authSession] disableCookieCache=${readOptions.disableCookieCache ? 1 : 0} total=${Date.now() - startedAt}ms`);
|
|
@@ -20,5 +22,15 @@ export function createRequestAuthSessionReaders(options) {
|
|
|
20
22
|
return {
|
|
21
23
|
getFreshSession,
|
|
22
24
|
getSession,
|
|
25
|
+
/**
|
|
26
|
+
* Reads the session again on every call, unlike the cached readers above.
|
|
27
|
+
* An authorization boundary that re-checks after awaited work needs this:
|
|
28
|
+
* a cached read can still answer from before a revocation. Pass
|
|
29
|
+
* `disableRefresh` for a check that only decides, so deciding does not
|
|
30
|
+
* extend the session.
|
|
31
|
+
*/
|
|
32
|
+
readSession,
|
|
33
|
+
/** `readSession` with the cookie cache bypassed, and never cached. */
|
|
34
|
+
readFreshSession: (readOptions = {}) => readSession({ ...readOptions, disableCookieCache: true }),
|
|
23
35
|
};
|
|
24
36
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@gadicc/loom",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.29.0",
|
|
4
4
|
"description": "Deno-first shared helpers for extracting common Next.js app code.",
|
|
5
5
|
"homepage": "https://github.com/gadicc/loom#readme",
|
|
6
6
|
"repository": {
|
|
@@ -55,6 +55,10 @@
|
|
|
55
55
|
"import": "./esm/src/next/apiKeys/mod.js",
|
|
56
56
|
"require": "./script/src/next/apiKeys/mod.js"
|
|
57
57
|
},
|
|
58
|
+
"./src/next/auth/client.js": {
|
|
59
|
+
"import": "./esm/src/next/auth/client.js",
|
|
60
|
+
"require": "./script/src/next/auth/client.js"
|
|
61
|
+
},
|
|
58
62
|
"./src/next/files/mod.js": {
|
|
59
63
|
"import": "./esm/src/next/files/mod.js",
|
|
60
64
|
"require": "./script/src/next/files/mod.js"
|
|
@@ -231,7 +235,7 @@
|
|
|
231
235
|
},
|
|
232
236
|
"scripts": {},
|
|
233
237
|
"loom": {
|
|
234
|
-
"gitCommit": "
|
|
238
|
+
"gitCommit": "3b37c6ad50a4faaf5ee2e48fa5669dcbdee9b36a"
|
|
235
239
|
},
|
|
236
240
|
"bin": {
|
|
237
241
|
"loom": "script/bin/loom.js"
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"mod.d.ts","sourceRoot":"","sources":["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,uBAAuB,EAC9B,OAAO,GAAE;IAAE,KAAK,CAAC,EAAE,OAAO,CAAC;IAAC,KAAK,CAAC,EAAE,MAAM,CAAA;CAAO,YAoClD;AA4gCD,wBAAsB,aAAa,CACjC,GAAG,EAAE,MAAM,EACX,OAAO,EAAE,MAAM,GAAG,SAAS,EAC3B,IAAI,EAAE,MAAM,EAAE,EACd,EAAE,EAAE,SAAS,EACb,OAAO,GAAE;IACP,aAAa,CAAC,EAAE,aAAa,CAAC;CAC1B,mBAiBP;AAopBD,wBAAsB,MAAM,CAC1B,IAAI,MAAwB,EAC5B,EAAE,GAAE,SAGH,mBA6KF"}
|
package/script/src/cli/mod.js
CHANGED
|
@@ -166,6 +166,11 @@ const managedSkills = [
|
|
|
166
166
|
relativePackagePath: "skills/upgrade-deps",
|
|
167
167
|
skillName: "upgrade-deps",
|
|
168
168
|
},
|
|
169
|
+
{
|
|
170
|
+
label: "legacy app modernization skill",
|
|
171
|
+
relativePackagePath: "skills/modernize-app",
|
|
172
|
+
skillName: "modernize-app",
|
|
173
|
+
},
|
|
169
174
|
{
|
|
170
175
|
featureKey: "db",
|
|
171
176
|
label: "loom db skill",
|
|
@@ -1227,6 +1232,10 @@ async function mergeAuthConfig(cwd, framework, featureConfig) {
|
|
|
1227
1232
|
...defaults.modules,
|
|
1228
1233
|
...featureConfig?.modules,
|
|
1229
1234
|
},
|
|
1235
|
+
// Recorded by the app; Loom never infers or rewrites this choice.
|
|
1236
|
+
...(featureConfig?.requestSessionReaders
|
|
1237
|
+
? { requestSessionReaders: featureConfig.requestSessionReaders }
|
|
1238
|
+
: {}),
|
|
1230
1239
|
};
|
|
1231
1240
|
}
|
|
1232
1241
|
function dependencyExecutable(tooling, executable) {
|
|
@@ -4006,15 +4015,35 @@ function matchesAuthRouteWrapper(text, expectedSources, expectedExportName) {
|
|
|
4006
4015
|
if (!matchesImportSource(normalized, expectedSources)) {
|
|
4007
4016
|
return false;
|
|
4008
4017
|
}
|
|
4009
|
-
|
|
4010
|
-
|
|
4018
|
+
// Exactly one handler set, so every exported method is traceable to it.
|
|
4019
|
+
const calls = [
|
|
4020
|
+
...normalized.matchAll(/toNextJsHandler\(\s*([A-Za-z_$][\w$]*)\s*\)/g),
|
|
4021
|
+
];
|
|
4022
|
+
if (calls.length !== 1) {
|
|
4011
4023
|
return false;
|
|
4012
4024
|
}
|
|
4013
|
-
const
|
|
4014
|
-
if (
|
|
4025
|
+
const instanceName = calls[0][1];
|
|
4026
|
+
if (expectedExportName && instanceName !== expectedExportName) {
|
|
4015
4027
|
return false;
|
|
4016
4028
|
}
|
|
4017
|
-
|
|
4029
|
+
const match = normalized.match(/export\s+const\s+\{\s*([^}]+)\s*\}\s*=\s*toNextJsHandler\(/);
|
|
4030
|
+
if (match) {
|
|
4031
|
+
const actualSpecifiers = new Set(match[1].split(",").map((specifier) => specifier.trim()).filter(Boolean));
|
|
4032
|
+
return actualSpecifiers.has("GET") && actualSpecifiers.has("POST");
|
|
4033
|
+
}
|
|
4034
|
+
// An app may wrap the handlers, for example to fail closed until a
|
|
4035
|
+
// migration completes. Each exported method must still come from the
|
|
4036
|
+
// handlers that call returned.
|
|
4037
|
+
const handlers = normalized.match(/(?:const|let|var)\s+([A-Za-z_$][\w$]*)\s*=\s*toNextJsHandler\(/);
|
|
4038
|
+
if (!handlers) {
|
|
4039
|
+
return false;
|
|
4040
|
+
}
|
|
4041
|
+
const handlersName = handlers[1];
|
|
4042
|
+
return ["GET", "POST"].every((method) => {
|
|
4043
|
+
const exported = normalized.match(new RegExp(`export\\s+const\\s+${method}\\s*=([^;]*);`));
|
|
4044
|
+
return Boolean(exported &&
|
|
4045
|
+
new RegExp(`\\b${escapeRegExp(handlersName)}\\.${method}\\b`).test(exported[1]));
|
|
4046
|
+
});
|
|
4018
4047
|
}
|
|
4019
4048
|
function authClientTemplate(config, authExportName) {
|
|
4020
4049
|
return `"use client";
|
|
@@ -9328,6 +9357,7 @@ async function checkAuthFeature(cwd, framework, manifest) {
|
|
|
9328
9357
|
const config = await mergeAuthConfig(cwd, framework, feature.config);
|
|
9329
9358
|
const requiredFiles = [
|
|
9330
9359
|
config.modules.authModule,
|
|
9360
|
+
config.modules.authRuntimeModule,
|
|
9331
9361
|
config.modules.authClientModule,
|
|
9332
9362
|
config.entrypoints.routeHandler,
|
|
9333
9363
|
config.modules.authServerModule,
|
|
@@ -9343,6 +9373,37 @@ async function checkAuthFeature(cwd, framework, manifest) {
|
|
|
9343
9373
|
const authExportName = authModuleText
|
|
9344
9374
|
? detectBetterAuthExportName(authModuleText)
|
|
9345
9375
|
: null;
|
|
9376
|
+
// An app may build its instance in a separate runtime module, so the shared
|
|
9377
|
+
// helpers can be split across the two. Only a runtime module that imports
|
|
9378
|
+
// the auth module counts: otherwise its text proves nothing about the
|
|
9379
|
+
// instance this feature checks.
|
|
9380
|
+
const authRuntimeModule = config.modules.authRuntimeModule;
|
|
9381
|
+
const authRuntimeText = authRuntimeModule
|
|
9382
|
+
? await readTextIfExists((0, node_path_1.join)(cwd, authRuntimeModule))
|
|
9383
|
+
: null;
|
|
9384
|
+
let creditedRuntimeText = null;
|
|
9385
|
+
if (authRuntimeModule && authRuntimeText) {
|
|
9386
|
+
if (matchesImportSource(authRuntimeText, getImportSpecifierCandidates(authRuntimeModule, config.modules.authModule))) {
|
|
9387
|
+
creditedRuntimeText = authRuntimeText;
|
|
9388
|
+
}
|
|
9389
|
+
else {
|
|
9390
|
+
issues.push(`Auth runtime module does not import the configured auth module: ${authRuntimeModule}`);
|
|
9391
|
+
suggestions.add("Point modules.authRuntimeModule at the module that builds the configured auth instance, or remove it from loom.json.");
|
|
9392
|
+
}
|
|
9393
|
+
}
|
|
9394
|
+
const authWiringSources = [
|
|
9395
|
+
{ path: config.modules.authModule, text: authModuleText },
|
|
9396
|
+
...(creditedRuntimeText
|
|
9397
|
+
? [{ path: authRuntimeModule, text: creditedRuntimeText }]
|
|
9398
|
+
: []),
|
|
9399
|
+
].filter((source) => source.text);
|
|
9400
|
+
// Modules reach the instance through whichever of the two exports it.
|
|
9401
|
+
const authImportCandidates = (fromPath) => [
|
|
9402
|
+
...getImportSpecifierCandidates(fromPath, config.modules.authModule),
|
|
9403
|
+
...(creditedRuntimeText && authRuntimeModule
|
|
9404
|
+
? getImportSpecifierCandidates(fromPath, authRuntimeModule)
|
|
9405
|
+
: []),
|
|
9406
|
+
];
|
|
9346
9407
|
if (authModuleText) {
|
|
9347
9408
|
const authModuleChecks = [
|
|
9348
9409
|
[
|
|
@@ -9355,8 +9416,8 @@ async function checkAuthFeature(cwd, framework, manifest) {
|
|
|
9355
9416
|
],
|
|
9356
9417
|
];
|
|
9357
9418
|
for (const [pattern, message] of authModuleChecks) {
|
|
9358
|
-
if (!pattern.test(
|
|
9359
|
-
issues.push(`${message}: ${
|
|
9419
|
+
if (!authWiringSources.some((source) => pattern.test(source.text))) {
|
|
9420
|
+
issues.push(`${message}: ${authWiringSources.map((source) => source.path).join(", ")}`);
|
|
9360
9421
|
suggestions.add("Update the auth module to use the shared Loom Better Auth helpers, or rerun `loom add auth` and reapply any app-local customizations.");
|
|
9361
9422
|
}
|
|
9362
9423
|
}
|
|
@@ -9365,15 +9426,16 @@ async function checkAuthFeature(cwd, framework, manifest) {
|
|
|
9365
9426
|
warnings.push(`Auth module uses a dynamic Better Auth baseURL without trusted proxy headers; trusted reverse proxies such as \`vercel dev\` can leak an internal callback host: ${config.modules.authModule}`);
|
|
9366
9427
|
suggestions.add("Use createBetterAuthLocalDevelopmentConfig for loopback development behind a trusted proxy, or explicitly enable Better Auth trustedProxyHeaders only where that proxy boundary is trusted.");
|
|
9367
9428
|
}
|
|
9368
|
-
if (
|
|
9429
|
+
if (config.requestSessionReaders !== "app-owned" &&
|
|
9430
|
+
!config.modules.authServerModule &&
|
|
9369
9431
|
!authModuleText.includes("createRequestAuthSessionReaders")) {
|
|
9370
9432
|
issues.push(`Auth module is missing Loom request-scoped session readers: ${config.modules.authModule}`);
|
|
9371
|
-
suggestions.add(
|
|
9433
|
+
suggestions.add('Either wire createRequestAuthSessionReaders into the auth module, add an auth server helper module and record it in loom.json, or record requestSessionReaders: "app-owned" when the app must read sessions its own way.');
|
|
9372
9434
|
}
|
|
9373
9435
|
}
|
|
9374
9436
|
const authClientText = await readTextIfExists((0, node_path_1.join)(cwd, config.modules.authClientModule));
|
|
9375
9437
|
if (authClientText) {
|
|
9376
|
-
const authClientImportCandidates =
|
|
9438
|
+
const authClientImportCandidates = authImportCandidates(config.modules.authClientModule);
|
|
9377
9439
|
const authClientChecks = [
|
|
9378
9440
|
[
|
|
9379
9441
|
authClientText.includes("createAuthClient"),
|
|
@@ -9397,7 +9459,7 @@ async function checkAuthFeature(cwd, framework, manifest) {
|
|
|
9397
9459
|
}
|
|
9398
9460
|
const routeHandlerText = await readTextIfExists((0, node_path_1.join)(cwd, config.entrypoints.routeHandler));
|
|
9399
9461
|
if (routeHandlerText) {
|
|
9400
|
-
const routeImportCandidates =
|
|
9462
|
+
const routeImportCandidates = authImportCandidates(config.entrypoints.routeHandler);
|
|
9401
9463
|
if (!matchesAuthRouteWrapper(routeHandlerText, routeImportCandidates, authExportName)) {
|
|
9402
9464
|
issues.push(`Auth route-handler wrapper does not match loom manifest config: ${config.entrypoints.routeHandler}`);
|
|
9403
9465
|
suggestions.add("Run `loom add auth` to restore the thin auth route wrapper, or update loom.json if the app intentionally uses different auth paths.");
|
|
@@ -9406,10 +9468,11 @@ async function checkAuthFeature(cwd, framework, manifest) {
|
|
|
9406
9468
|
if (config.modules.authServerModule) {
|
|
9407
9469
|
const authServerText = await readTextIfExists((0, node_path_1.join)(cwd, config.modules.authServerModule));
|
|
9408
9470
|
if (authServerText) {
|
|
9409
|
-
const authServerImportCandidates =
|
|
9471
|
+
const authServerImportCandidates = authImportCandidates(config.modules.authServerModule);
|
|
9410
9472
|
const authServerChecks = [
|
|
9411
9473
|
[
|
|
9412
|
-
|
|
9474
|
+
config.requestSessionReaders === "app-owned" ||
|
|
9475
|
+
authServerText.includes("createRequestAuthSessionReaders"),
|
|
9413
9476
|
"Auth server module is not wired to Loom request-scoped session readers",
|
|
9414
9477
|
],
|
|
9415
9478
|
[
|