@sdxc/kit 2026.10.25 → 2026.10.26
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 +28 -15
- package/changelog.jsonl +40 -5
- package/dist/architecture/graph.d.ts +16 -3
- package/dist/architecture/graph.js +37 -19
- package/dist/architecture/layers.d.ts +10 -3
- package/dist/architecture/layers.js +38 -9
- package/dist/commands/destroy.d.ts +1 -1
- package/dist/commands/make.d.ts +5 -5
- package/dist/commands/make.js +11 -8
- package/dist/commands/scaffold.d.ts +1 -1
- package/dist/contract.d.ts +3 -3
- package/dist/doctor/checks.d.ts +2 -2
- package/dist/doctor/checks.js +14 -2
- package/dist/doctor/constant-names.d.ts +17 -0
- package/dist/doctor/constant-names.js +106 -0
- package/dist/doctor/dependencies.d.ts +3 -3
- package/dist/doctor/dependencies.js +3 -3
- package/dist/doctor/fan-out.d.ts +3 -2
- package/dist/doctor/fan-out.js +4 -3
- package/dist/doctor/fetch-param.d.ts +15 -0
- package/dist/doctor/fetch-param.js +37 -0
- package/dist/doctor/files.d.ts +2 -0
- package/dist/doctor/files.js +4 -0
- package/dist/doctor/local-const.d.ts +15 -0
- package/dist/doctor/local-const.js +54 -0
- package/dist/doctor/logger.d.ts +15 -0
- package/dist/doctor/logger.js +41 -0
- package/dist/doctor/orphans.d.ts +3 -3
- package/dist/doctor/orphans.js +33 -7
- package/dist/doctor/process-env.d.ts +15 -0
- package/dist/doctor/process-env.js +39 -0
- package/dist/doctor/project.js +17 -13
- package/dist/doctor/result-throws.d.ts +5 -4
- package/dist/doctor/result-throws.js +6 -5
- package/dist/doctor/source-rule.d.ts +35 -0
- package/dist/doctor/source-rule.js +52 -0
- package/dist/doctor/stack-imports.d.ts +15 -0
- package/dist/doctor/stack-imports.js +60 -0
- package/dist/doctor/syntax.d.ts +31 -0
- package/dist/doctor/syntax.js +56 -0
- package/dist/make/binding.d.ts +13 -8
- package/dist/make/binding.js +96 -64
- package/dist/make/from-model.js +2 -7
- package/dist/make/index.js +2 -7
- package/dist/package-manager.d.ts +6 -0
- package/dist/package-manager.js +25 -2
- package/dist/scaffold/index.js +2 -7
- package/dist/ui/commands.js +2 -5
- package/dist/ui/registry.d.ts +2 -2
- package/dist/upgrade/changelog.d.ts +2 -0
- package/dist/upgrade/changelog.js +2 -0
- package/dist/upgrade/project.d.ts +2 -2
- package/dist/upgrade/prompt.d.ts +3 -2
- package/dist/upgrade/prompt.js +43 -2
- package/package.json +3 -3
- package/stubs/scaffold.test-mcp.stub +5 -1
- package/templates/app/AGENTS.md +3 -1
- package/templates/app/app/commands/db/fresh.ts +20 -13
- package/templates/app/app/commands/db/migrate.ts +42 -32
- package/templates/app/app/http/controllers/api/openapi.test.ts +29 -0
- package/templates/app/app/http/controllers/api/openapi.tsx +8 -2
- package/templates/app/app/http/controllers/mcp.test.ts +16 -0
- package/templates/app/app/http/middleware/access.ts +6 -3
- package/templates/app/app/http/middleware/page.ts +3 -4
- package/templates/app/app/initializers/database.test.ts +6 -1
- package/templates/app/app/initializers/openapi.ts +5 -4
- package/templates/app/app/initializers/router.tsx +3 -4
- package/templates/app/app/test/cloudflare-workers.test.ts +27 -0
- package/templates/app/app/test/cloudflare-workers.ts +17 -4
- package/templates/app/app/test/database.ts +33 -0
- package/templates/app/app/test/mcp.ts +96 -0
- package/templates/app/resources/layouts/document.tsx +2 -3
package/README.md
CHANGED
|
@@ -45,7 +45,7 @@ Every `@sdxc/*` package versions as the UTC date it was published, and a daily r
|
|
|
45
45
|
- `sdxc upgrade [release]` moves every `@sdxc/*` package the project lists to the target release, latest when left out, and `remix` to the version that release requires, then installs and prints a prompt for an AI agent from that release's changelog.
|
|
46
46
|
- `sdxc doctor` reports packages pinned behind the project's release and a `remix` pin other than the release's peer; `sdxc upgrade <release>` fixes both.
|
|
47
47
|
|
|
48
|
-
`sdxc doctor` also checks secrets, migrations, the app layout
|
|
48
|
+
`sdxc doctor` also checks secrets, migrations, the app layout, JSDoc comment shape and source conventions (local `let`, constant names, the stack's imports, `env`, `fetch` and logging), and runs a project's own checks written with `defineCheck` from `@sdxc/kit/doctor`. The [doctor guide](https://sdxc.dev/docs/sdxc/check-a-project) lists every check.
|
|
49
49
|
|
|
50
50
|
## API
|
|
51
51
|
|
|
@@ -67,6 +67,9 @@ Every `@sdxc/*` package versions as the UTC date it was published, and a daily r
|
|
|
67
67
|
| `sdxc stats` | Counts lines of code per kind of code, and the code to test ratio |
|
|
68
68
|
| `sdxc run` | Runs the project's command line (`run.entry`, default `bootstrap/cli.ts`) |
|
|
69
69
|
| `sdxc doctor` | Lints the project: release drift, secrets, migrations, layout, JSDoc and its own checks |
|
|
70
|
+
| `sdxc fix` | Applies the repairs `sdxc doctor` names that the kit can make safely |
|
|
71
|
+
| `sdxc setup` | Installs a multi-file feature (auth, billing, flags), or lists them with no name |
|
|
72
|
+
| `sdxc diagram` | Draws the project's layer architecture as Mermaid, or as SVG through `@sdxc/diagram` |
|
|
70
73
|
| `sdxc ui` | Copies `@sdxc/ui` components into the project and points imports at the copies |
|
|
71
74
|
| `sdxc upgrade` | Moves the `@sdxc/*` packages and `remix` to a release and prints the prompt |
|
|
72
75
|
| `sdxc deploy` | Builds, then runs the app's own `db migrate --remote` and `deploy`, once confirmed |
|
|
@@ -502,20 +505,30 @@ Move the @sdxc packages to another release and print the prompt for the code
|
|
|
502
505
|
|
|
503
506
|
The CLI reads `.config/sdxc.jsonc` (or `sdxc.jsonc` at the project root). Every key is optional.
|
|
504
507
|
|
|
505
|
-
| Key
|
|
506
|
-
|
|
|
507
|
-
| `ui.directory`
|
|
508
|
-
| `ui.alias`
|
|
509
|
-
| `ui.tests`
|
|
510
|
-
| `make.routes`
|
|
511
|
-
| `make.migrations`
|
|
512
|
-
| `make.tests`
|
|
513
|
-
| `make.specs`
|
|
514
|
-
| `make.stubs`
|
|
515
|
-
| `doctor.checks`
|
|
516
|
-
| `doctor.migrations.accept`
|
|
517
|
-
| `
|
|
518
|
-
| `
|
|
508
|
+
| Key | Default | Meaning |
|
|
509
|
+
| ----------------------------- | -------------------------------------- | ---------------------------------------------------------------------------- |
|
|
510
|
+
| `ui.directory` | `resources/components/ui` | Where `sdxc ui add` writes components |
|
|
511
|
+
| `ui.alias` | inferred from tsconfig `paths` | Import prefix for the copies |
|
|
512
|
+
| `ui.tests` | `false` | Copy a component's tests beside it |
|
|
513
|
+
| `make.routes` | `web` | Route contract `sdxc make controller` adds to, a module in `routes/` |
|
|
514
|
+
| `make.migrations` | `{ "default": "database/migrations" }` | Migration chains by name |
|
|
515
|
+
| `make.tests` | `true` | Write a test beside every generated file except migrations and factories |
|
|
516
|
+
| `make.specs` | `true` | Write a pairing `.spec` for controllers, commands, MCP tools and scaffolds |
|
|
517
|
+
| `make.stubs` | `.config/sdxc/stubs` | Stubs that replace the built-in ones |
|
|
518
|
+
| `doctor.checks` | `.config/sdxc/checks` | The project's own `sdxc doctor` checks, one module each |
|
|
519
|
+
| `doctor.migrations.accept` | `[]` | Migration errors `sdxc doctor` steps past, each `{ "file", "column" }` |
|
|
520
|
+
| `doctor.complexity.max` | `4` | Highest cyclomatic complexity a function may have |
|
|
521
|
+
| `doctor.moduleSize.maxLines` | `200` | Most code lines a module may hold |
|
|
522
|
+
| `doctor.crap.max` | `12` | Highest CRAP score a function may have |
|
|
523
|
+
| `doctor.crap.coverage` | `coverage/coverage-final.json` | Istanbul coverage the `crap` check reads |
|
|
524
|
+
| `doctor.testRatio.min` | `0.3` | Lowest test lines per code line |
|
|
525
|
+
| `doctor.fanOut.max` | `15` | Most project modules one module may import statically |
|
|
526
|
+
| `doctor.duplication.minLines` | `8` | Fewest code lines that count as a duplicated block |
|
|
527
|
+
| `doctor.mutation.report` | `reports/mutation/mutation.json` | Mutation-testing report the `mutation` check reads |
|
|
528
|
+
| `doctor.mutation.maxSurvived` | `0` | Most surviving mutants the `mutation` check allows |
|
|
529
|
+
| `run.entry` | `bootstrap/cli.ts` | Module `sdxc run` starts, relative to the project root |
|
|
530
|
+
| `format` | none | Command run once on every file a command wrote or edited, the paths appended |
|
|
531
|
+
| `lock` | `.config/sdxc.lock.jsonl` | Where the CLI keeps its state |
|
|
519
532
|
|
|
520
533
|
`format` is an argument list, such as `["bunx", "vp", "fmt"]`.
|
|
521
534
|
|
package/changelog.jsonl
CHANGED
|
@@ -969,13 +969,13 @@
|
|
|
969
969
|
{"release":"2026.10.16","package":"@sdxc/cli","type":"feat","breaking":false,"title":"Add tri-state booleans, group inputs, flag headings and prompt initial values","body":"Several additions to `@sdxc/cli`, and four changes to what it prints.\n\nTri-state boolean flags. Declare `default: undefined` and the flag reads\n`boolean | undefined`: unset unless `--x` or `--no-x` is passed, so a\nconfiguration or a later question decides. The help shows `--[no-]x`.\n\n flags: { git: flag.boolean(\"git\", { default: undefined }) } // boolean | undefined\n\nA handler prompt's starting answer. `ctx.prompt.*` takes `initial`, which a\nterminal starts from, apart from `default`, which applies without a terminal:\n\n await ctx.prompt.confirm({ message: \"Initialize git?\", default: false, initial: true });\n\nGroup arguments and flags. `commands()` takes `arguments`, `flags` and\n`tasks` for a handler mapped onto the group itself. Prompts bound to them ask\non a terminal, and without one a missing input is a usage error. A word the\ngroup's first argument rejects is reported as an unknown command.\n\n make: commands({\n \targuments: { kind: argument(s.enum_(KINDS), { prompt: prompt.select({ message: \"What?\", options: KINDS }) }) },\n \tjob: command({ flags: { dryRun: flag.boolean(\"dry-run\") } }),\n })\n\nShared helpers. `ChainContext<typeof CHAIN>` is the context of any command\nbehind a middleware chain, so a helper several commands call takes one type:\n\n const CHAIN = [project()] as const;\n function root(ctx: ChainContext<typeof CHAIN>) { return ctx.project.root; }\n\nHelp headings. Each flag takes `heading`, the help section it is listed\nunder in place of \"Options\":\n\n flag.string(\"retries\", { heading: \"Scheduling\" })\n\nOther additions:\n- `command({ tasks: true })` marks a command whose handler runs `ctx.task`.\n- `prompt.confirm` takes `active` and `inactive`, the words its toggle and\n summary line use for yes and no.\n- `ctx.prompt.select`, `multiselect` and `search` infer their value type\n from `options`, so `multiselect({ options: names, default: [] })` answers\n `string[]` with no type argument.\n\nChanged behavior:\n- The help lists `--no-progress` only for commands declared with\n `tasks: true`. Every command still accepts it. Add `tasks: true` to keep it\n listed.\n- A flag written before a member's name now moves to that member:\n `prog make --dry-run job` passes `--dry-run` to `job`. Before, it was an\n unknown flag of the group.\n- An empty value (`--seed=`, or `--allow-env=` on a comma list) is now the\n same usage error as a missing one, \"--seed needs a value\". Before, `--seed=`\n went to the schema, and a comma list said \"--allow-env= needs at least one\n value\".\n- A value that fails its schema is reported under the name typed (`--jobs`),\n not the flag's main name (`--concurrency`). A flag another command declares\n now consumes its value, so `--cron \"0 8 * * *\"` on the wrong command is one\n error, without \"Unexpected argument\".\n\nConsumers only act on the `--no-progress` change, and on tests that match the\nold messages."}
|
|
970
970
|
{"release":"2026.10.16","package":"@sdxc/cli","type":"feat","breaking":false,"title":"Let middleware read the run's result, require values, extend children's env, and read stdin","body":"`@sdxc/cli` adds five things to middleware and handlers.\n\n`next()` resolves to what the rest of the chain answered, so a middleware can\nlog the outcome. `exitCodeOf(error)` is exported, and answers the exit code a\nfailure maps to:\n\n let result = await next();\n if (isFailure(result)) log.set({ exit_code: exitCodeOf(result.error) });\n\n`ctx.require(key)` reads a value an earlier middleware must have published. A\nmissing value fails the run with exit 1, naming the command. A middleware\nsees the bare context, so this is how it reads another's value without an\n`undefined` check:\n\n models(registry, (ctx) => ({ db: ctx.require(Database) }))\n\n`ctx.setExecEnv(variables)` adds variables every child `ctx.exec` starts with.\nThey go over the run's `env` and under a call's own `options.env`, and an\n`undefined` value removes a variable:\n\n ctx.setExecEnv({ TRACEPARENT: toTraceParent(trace) });\n\n`ctx.stdin` exposes `isTTY` and `text()`, which reads everything piped in.\n`invoke()` from `@sdxc/cli/test` takes `stdin: \"…\"` to script it, which makes\n`interactive` default to `false`. Without `stdin` text, a non-interactive\n`invoke()` run now sees an empty pipe that ends at once:\n\n let sql = ctx.stdin.isTTY ? undefined : await ctx.stdin.text();\n\n`NextFunction` now resolves to a `CommandResult` instead of `void`. Middleware\nthat awaits `next()` needs no change."}
|
|
971
971
|
{"release":"2026.10.16","package":"@sdxc/cli","type":"feat","breaking":false,"title":"Type every property a middleware publishes from a union of effects","body":"A `CommandMiddleware` can now declare several effects as a union, one per\nproperty it installs. A handler behind it reads each property, typed:\n\n function i18n(): CommandMiddleware<\n \t| { key: typeof Translators; value: Translator; property: \"translate\" }\n \t| { key: typeof CurrentLocale; value: string; property: \"locale\" }\n > { … }\n\nBefore, a union effect typed none of its properties, so a middleware\npublishing more than one had to augment `CommandContext` for the rest.\nMiddleware declaring one effect is unchanged."}
|
|
972
|
-
{"release":"2026.10.16","package":"@sdxc/cli","type":"feat","breaking":false,"title":"Hand a command's arguments to another program with passthrough","body":"`passthrough: true` was replaced within the same release by\n`argument.rest()`, whose note describes the shipped API. Nothing to do."}
|
|
972
|
+
{"release":"2026.10.16","package":"@sdxc/cli","type":"feat","breaking":false,"title":"Hand a command's arguments to another program with passthrough","body":"`passthrough: true` was replaced within the same release by\n`argument.rest()`, whose note describes the shipped API. Nothing to do.","correctedIn":"2026.10.16"}
|
|
973
973
|
{"release":"2026.10.16","package":"@sdxc/cli","type":"feat","breaking":false,"title":"Take another program's arguments with argument.rest(), and expose ctx.argv","body":"`argument.rest()` declares an argument that receives every token after the\ncommand's name exactly as typed, flags and `--help` included, for a command\nthat runs another program with them:\n\n let run = command({ arguments: { args: argument.rest() } });\n // prog run users find --limit 5\n // ctx.arguments.args: [\"users\", \"find\", \"--limit\", \"5\"]\n\nIt is the command's only argument and the command declares no flags;\n`createCLI` throws otherwise. `--help` written before the command's name still\nshows the program's own help. It replaces the `passthrough: true` command\noption added earlier in this release, which is removed.\n\n`ctx.argv` holds the arguments the run was given, exactly as `cli.run`\nreceived them, for logging a run or starting it again:"}
|
|
974
974
|
{"release":"2026.10.16","package":"@sdxc/cli","type":"docs","breaking":false,"title":"Shorten the @sdxc/cli API reference","body":"The README's API section now gives each export one line, grouped into declaring commands, running them, the handler's context and results as tables, and testing; option-by-option detail stays in each export's JSDoc. No code changed; nothing to do."}
|
|
975
975
|
{"release":"2026.10.16","package":"@sdxc/codemod","type":"feat","breaking":false,"title":"Add the @sdxc/codemod package","body":"New package for source-to-source edits of JavaScript and TypeScript\n(.js, .mjs, .cjs, .jsx, .ts, .mts, .cts, .tsx). Every edit replaces source\nranges and returns the new text, so a file keeps its formatting, comments\nand quote style. Its only runtime dependency is @sdxc/result.\n\n import {\n addProperty,\n findModuleReferences,\n insertAfterLast,\n moveImports,\n rewriteSpecifiers,\n } from \"@sdxc/codemod\";\n\n let references = findModuleReferences(\"page.tsx\", source, { calls: [\"vi.mock\"] });\n // success([{ kind: \"import\", specifier: \"acme/ui\", names: [...], range, specifierRange, ... }])\n\n let rewritten = rewriteSpecifiers(\"page.tsx\", source, (reference) =>\n reference.specifier === \"@acme/ui\" ? \"acme/ui\" : null,\n );\n\n let moved = moveImports(\"page.tsx\", source, {\n from: \"acme/ui\",\n names: [\"Button\"],\n to: \"~/components/ui/button.js\",\n }); // moved.data.unhandled lists default and namespace imports it cannot split\n\n let declared = addProperty(\"index.ts\", source, {\n call: \"jobs\",\n path: [\"trials\"],\n key: \"expire\",\n value: \"job({ input: s.object({}) })\",\n });\n\n let mapped = insertAfterLast(\"dispatcher.ts\", source, {\n call: \"dispatcher.map\",\n statement: 'dispatcher.map(jobs.trials.expire, () => import(\"./expire.js\"));',\n fallbackAfter: \"createJobDispatcher\",\n });\n\nThe scanner reads strings, template literals, regular expressions,\ncomments and JSX text as tokens of their own, so `<p>Don't import \"./x.js\"</p>`\nnames no module. Input that ends inside one of them, or whose brackets do\nnot pair, fails with a `CodemodError` (code, filename, offset) before any\nedit is computed, and every edit re-scans its own output. Each function\nanswers `Result<Edit, CodemodError>`, where `Edit` is\n`{ source, changed, unhandled }`."}
|
|
976
976
|
{"release":"2026.10.16","package":"@sdxc/codemod","type":"feat","breaking":false,"title":"Report TypeScript import types on request","body":"findModuleReferences takes an `importTypes` option that also reports TypeScript import types, `typeof import(\"…\")` and `import(\"…\").Name`, as `dynamic` references with `typeOnly: true`. A declaration file names its dependencies this way, so a check over emitted `.d.ts` files needs them:\n\n let references = findModuleReferences(\"index.d.ts\", source, { importTypes: true });\n // [{ kind: \"dynamic\", specifier: \"./types.js\", typeOnly: true, ... }]\n\nWithout the option the result is unchanged, so existing callers need no action."}
|
|
977
977
|
{"release":"2026.10.16","package":"@sdxc/codemod","type":"feat","breaking":false,"title":"Read JSX in .js, .mjs and .cjs files","body":"Every `@sdxc/codemod` function now reads JSX in `.js`, `.mjs` and `.cjs` files, the\nway it already did in `.jsx` and `.tsx`. Projects that keep React-style components in\n`.js` files can be scanned and edited without renaming them:\n\n import { moveImports } from \"@sdxc/codemod\";\n\n let moved = moveImports(\"page.js\", 'import { Button } from \"acme/ui\";\\nexport let page = <Button />;\\n', {\n from: \"acme/ui\",\n names: [\"Button\"],\n to: \"./button.js\",\n });\n\nBefore, a `.js` file containing JSX failed to scan or was read with its markup as code.\nA `<` where an expression begins is now an element in every JavaScript file, and a `<`\nafter an operand (`a < b`) stays a comparison, so plain JavaScript files read exactly as\nbefore. No action is needed."}
|
|
978
|
-
{"release":"2026.10.16","package":"@sdxc/codemod","type":"feat","breaking":true,"title":"Move default and namespace imports, and merge moved declarations","body":"`moveImports` now moves every kind of binding, matched by the name the module\nexports: a named binding by its name, a default import by `\"default\"`, and\n`import * as X`, `export * as X` and `export * from` by `\"*\"`, which repoints the\nwhole declaration.\n\n import { moveImports } from \"@sdxc/codemod\";\n\n moveImports(\"page.ts\", source, {\n from: \"acme/ui\",\n names: [\"default\", \"Button\"],\n to: \"~/components/ui/index.js\",\n });\n // import Ui, { Button, Dialog } from \"acme/ui\";\n // becomes\n // import { Dialog } from \"acme/ui\";\n // import Ui, { Button } from \"~/components/ui/index.js\";\n\nThe moved bindings of one kind (imports or re-exports, type-only or not) now land in\none declaration of `to`: an existing one, the first declaration repointed in place,\nor one new declaration. Before, two declarations that both moved left two\ndeclarations of `to`:\n\n import { Button } from \"acme/ui\";\n import { Dialog } from \"acme/ui\";\n // before: two imports of \"~/ui.js\"; now:\n import { Button, Dialog } from \"~/ui.js\";\n\nA default joins the named imports; a namespace, a type-only default and a second\ndefault keep declarations of their own, and `import type` stays separate from\n`import`.\n\nBreaking: `Edit.unhandled` from `moveImports` now holds only the namespace imports\nand `export *` declarations of `from` that stay while other names move, since those\nreach the moved names through the whole module. A default import of `from` used to\nbe reported there and is now left in place unless `names` includes `\"default\"`.\nCallers that reported default imports from `unhandled` should add `\"default\"` to\n`names` to move them."}
|
|
978
|
+
{"release":"2026.10.16","package":"@sdxc/codemod","type":"feat","breaking":true,"title":"Move default and namespace imports, and merge moved declarations","body":"`moveImports` now moves every kind of binding, matched by the name the module\nexports: a named binding by its name, a default import by `\"default\"`, and\n`import * as X`, `export * as X` and `export * from` by `\"*\"`, which repoints the\nwhole declaration.\n\n import { moveImports } from \"@sdxc/codemod\";\n\n moveImports(\"page.ts\", source, {\n from: \"acme/ui\",\n names: [\"default\", \"Button\"],\n to: \"~/components/ui/index.js\",\n });\n // import Ui, { Button, Dialog } from \"acme/ui\";\n // becomes\n // import { Dialog } from \"acme/ui\";\n // import Ui, { Button } from \"~/components/ui/index.js\";\n\nThe moved bindings of one kind (imports or re-exports, type-only or not) now land in\none declaration of `to`: an existing one, the first declaration repointed in place,\nor one new declaration. Before, two declarations that both moved left two\ndeclarations of `to`:\n\n import { Button } from \"acme/ui\";\n import { Dialog } from \"acme/ui\";\n // before: two imports of \"~/ui.js\"; now:\n import { Button, Dialog } from \"~/ui.js\";\n\nA default joins the named imports; a namespace, a type-only default and a second\ndefault keep declarations of their own, and `import type` stays separate from\n`import`.\n\nBreaking: `Edit.unhandled` from `moveImports` now holds only the namespace imports\nand `export *` declarations of `from` that stay while other names move, since those\nreach the moved names through the whole module. A default import of `from` used to\nbe reported there and is now left in place unless `names` includes `\"default\"`.\nCallers that reported default imports from `unhandled` should add `\"default\"` to\n`names` to move them.","correctedIn":"2026.10.16"}
|
|
979
979
|
{"release":"2026.10.16","package":"@sdxc/data-model","type":"chore","breaking":false,"title":"Make remix a peer dependency of every package that imports it","body":"Every @sdxc package whose code imports `remix/*` now lists `remix` under\n`peerDependencies` (pinned to the same exact version as before) instead of\n`dependencies`, so your app's own `remix` is the only copy installed.\n\nBefore, a version mismatch between your app's `remix` and a package's pin\ninstalled a second nested copy, and Remix context keys and `instanceof` checks\nsilently stopped matching between the app and the package. Now the mismatch\nfails at install with a peer conflict.\n\nAction for consumers: list `remix` in your own `package.json` at the version\nthe @sdxc packages pin (currently `3.0.0`); npm 7+, Bun and pnpm install a\nmissing required peer automatically."}
|
|
980
980
|
{"release":"2026.10.16","package":"@sdxc/data-model","type":"feat","breaking":false,"title":"Publish ctx.models on an @sdxc/cli command line with @sdxc/data-model/cli","body":"`@sdxc/data-model/cli` exports `models(registry, context, options?)` for an `@sdxc/cli` command line, with the same contract as the `./router` and `./jobs` entries: it publishes the registry bound to each command run as `ctx.models` (or `options.property`) under the same `Models` key, and `context` runs once, on the first model access, so it reads whatever earlier middleware published and a command that touches no model never binds.\n\n import { createCLI, failure, success } from \"@sdxc/cli\";\n import { models } from \"@sdxc/data-model/cli\";\n import { database } from \"@sdxc/database-middleware/cli\";\n\n let cli = createCLI({\n \tname: \"app\",\n \tcommands: contract,\n \tmiddleware: [database(db), models(registry, (ctx) => ({ db: ctx.db }))],\n });\n\n cli.map(contract.users.find, async (ctx) => {\n \tlet user = await ctx.models.users.findByEmail(ctx.arguments.email);\n \treturn user === null ? failure(new Error(\"No such user\")) : success();\n });\n\n`@sdxc/cli` is an optional peer dependency, so an app without a command line installs nothing new. The other entries are unchanged."}
|
|
981
981
|
{"release":"2026.10.16","package":"@sdxc/data-table-d1","type":"chore","breaking":false,"title":"Make remix a peer dependency of every package that imports it","body":"Every @sdxc package whose code imports `remix/*` now lists `remix` under\n`peerDependencies` (pinned to the same exact version as before) instead of\n`dependencies`, so your app's own `remix` is the only copy installed.\n\nBefore, a version mismatch between your app's `remix` and a package's pin\ninstalled a second nested copy, and Remix context keys and `instanceof` checks\nsilently stopped matching between the app and the package. Now the mismatch\nfails at install with a peer conflict.\n\nAction for consumers: list `remix` in your own `package.json` at the version\nthe @sdxc packages pin (currently `3.0.0`); npm 7+, Bun and pnpm install a\nmissing required peer automatically."}
|
|
@@ -1111,7 +1111,7 @@
|
|
|
1111
1111
|
{"release":"2026.10.17","package":"@sdxc/user-agent","type":"feat","breaking":false,"title":"Keep the parsed string on the result as `raw`","body":"`parse()` and the `userAgent()` middleware now return the string they read as `raw`, beside\n`browser`, `engine`, `os` and `device`, so code that forwards the header verbatim (a spam or\nanalytics provider) reads it from `ctx.userAgent` instead of the request headers.\n\n import { userAgent } from \"@sdxc/user-agent/middleware\";\n\n let router = createRouter({ middleware: [userAgent()] });\n // in a handler\n ctx.userAgent.raw; // \"Mozilla/5.0 (iPhone; CPU iPhone OS 17_4 like Mac OS X) …\"\n\nA request without the header, and a context the middleware never ran on, read `raw` as `\"\"`.\nCode that builds a `UserAgent` object literal by hand must now add a `raw` string."}
|
|
1112
1112
|
{"release":"2026.10.17","package":"@sdxc/zip","type":"perf","breaking":false,"title":"Compute CRC-32 with an indexed loop","body":"`crc32` read its input through the typed array's iterator, which spent more time in iteration than in the checksum. It now indexes the bytes directly, so checksumming large entries in `Zip` (and every chunk `@sdxc/png` writes) is faster. Results are unchanged and no action is needed."}
|
|
1113
1113
|
{"release":"2026.10.20","package":"@sdxc/cli","type":"feat","breaking":false,"title":"Describe a command line as data and check one without running it","body":"Every CLI built with `createCLI` now answers `--help --json` with its contract as data,\nand the CLI object gains two methods for tools that check command lines against it:\n\n hello greet --help --json # { \"title\": \"hello greet\", \"arguments\": […], \"flags\": […], … }\n\n let description = cli.describe([\"greet\"]);\n let checked = await cli.check([\"greet\", \"Ada\", \"--shuot\"]);\n if (isFailure(checked)) console.error(checked.error.message);\n\n- `cli.describe(path?)` returns the command `path` names (the whole program without one)\n with every visible member below it: arguments, flags with their short names, value\n names, defaults and whether they repeat or take a list, and examples. The flags every\n command answers, `--help`, `--version` and `--no-progress`, are listed with\n `builtin: true`. It returns `undefined` for a path that names no command.\n- `cli.check(argv)` parses and checks a command line the way a run does before it asks\n anything: unknown commands, unknown flags and values a schema rejects come back together\n as one `UsageError`. A value a prompt would ask for counts as given, and no handler loads.\n- `--help --json` prints the same description; a `--json` after `--` stays an argument.\n\nThe new `CommandDescription`, `ArgumentDescription`, `FlagDescription` and\n`CheckedCommand` types are exported. Existing programs need no change."}
|
|
1114
|
-
{"release":"2026.10.20","package":"@sdxc/cli","type":"fix","breaking":false,"title":"Name three commands and count the rest when a flag belongs elsewhere","body":"When a flag is passed to a command that does not declare it, the usage error\nnames the commands that do. Before, it listed every one of them, so a flag that\na whole group shares produced a line naming over a dozen commands:\n\n --force is not a flag of sdxc make migration; sdxc make, sdxc make controller, … and sdxc make test take it\n\nNow it names the first three and counts the others:\n\n --force is not a flag of sdxc make migration; sdxc make, sdxc make controller, sdxc make middleware and 12 more take it\n\nUp to three commands are still listed in full. Nothing to change in your code;\na test asserting the full list of a flag shared by more than three commands\nneeds its expected message updated."}
|
|
1114
|
+
{"release":"2026.10.20","package":"@sdxc/cli","type":"fix","breaking":false,"title":"Name three commands and count the rest when a flag belongs elsewhere","body":"When a flag is passed to a command that does not declare it, the usage error\nnames the commands that do. Before, it listed every one of them, so a flag that\na whole group shares produced a line naming over a dozen commands:\n\n --force is not a flag of sdxc make migration; sdxc make, sdxc make controller, … and sdxc make test take it\n\nNow it names the first three and counts the others:\n\n --force is not a flag of sdxc make migration; sdxc make, sdxc make controller, sdxc make middleware and 12 more take it\n\nUp to three commands are still listed in full. Nothing to change in your code;\na test asserting the full list of a flag shared by more than three commands\nneeds its expected message updated.","correctedIn":"2026.10.20"}
|
|
1115
1115
|
{"release":"2026.10.20","package":"@sdxc/codemod","type":"feat","breaking":false,"title":"Append list entries with addElement and read source with tokenize","body":"`addElement(filename, source, { call, path?, value })` appends source text to a list in the\nfirst call to `call` that has it: the call's own arguments, or, with `path`, the array literal\nreached by key through the object literal the call receives. The entry follows the list's\nlayout, one per line with its siblings' indentation and trailing-comma style, or inline after\nthe last entry. A missing call, key or array fails with `not-found`.\n\n import { addElement } from \"@sdxc/codemod\";\n\n let edit = addElement(\"router.ts\", source, {\n call: \"createRouter\",\n path: [\"middleware\"],\n value: \"requestId()\",\n });\n\n`tokenize(filename, source)` and the `Token`/`TokenType` types are now exported, so a tool can\nread JavaScript, TypeScript and JSX the way the edits do, with strings, template literals,\nregular expressions, comments and JSX told apart. It returns a `Result<Token[], CodemodError>`.\nExisting functions are unchanged; consumers need not act."}
|
|
1116
1116
|
{"release":"2026.10.20","package":"@sdxc/codemod","type":"feat","breaking":false,"title":"Remove a declaration and the statements that load a module","body":"Three edits undo what `addProperty` and `insertAfterLast` add:\n\n import { findStatements, removeProperty, removeStatements } from \"@sdxc/codemod\";\n\n removeProperty(\"index.ts\", source, { call: \"jobs\", path: [\"trials\"], key: \"expire\" });\n removeStatements(\"router.ts\", source, { specifier: \"~/app/http/controllers/home\" });\n\n- `removeProperty` takes the same `call`, `argument` and `path` as `addProperty` and removes\n `key` with its comma and, when it sits on its own line, the line. A group the removal\n leaves empty, such as `trials: {}`, is removed from its parent in turn, through `route()`\n calls too. A missing call, path or key fails with `not-found`.\n- `findStatements` answers the innermost statements holding a string literal equal to\n `specifier`, across lines, with their text and range, so a caller can read what a mapping\n maps before removing it.\n- `removeStatements` removes each of them with the rest of its lines.\n\nNo change for existing callers."}
|
|
1117
1117
|
{"release":"2026.10.20","package":"@sdxc/codemod","type":"fix","breaking":false,"title":"Leave {} when removeProperty takes out an object's only property","body":"Before, removing the only property of an object written one property per line left its braces on two lines, as `createModels({\\n})`. Now the object becomes `{}`, as it was before addProperty added the property, so adding and removing a property gives back the original source. No action is needed."}
|
|
@@ -1146,7 +1146,7 @@
|
|
|
1146
1146
|
{"release":"2026.10.20","package":"@sdxc/kit","type":"feat","breaking":false,"title":"Leave out pieces a project already has with sdxc scaffold --skip","body":"`sdxc scaffold <name> [field ...] --skip <piece,...>` writes the resource without the pieces\nit names: `model`, `migration`, `factory`, `validator`, `policy` or `pages`. The common case\nis pages for a model `sdxc make model` already wrote:\n\n sdxc make model post title body\n sdxc scaffold post title body --skip model,migration,factory\n\n- `model` leaves out the model, its test and its registry entry; `policy` the abilities, the\n grants and the policy test; `pages` the five controllers, their tests, the form and the\n locale copy.\n- A skipped piece the rest reads must exist already, or the run stops before writing:\n `--skip model needs app/models/post.ts, which the pages, tools and commands read; drop model\n from --skip`. The same holds for the validator the pages submit through, the factory the\n tests seed rows with, and the abilities the pages and tools check.\n\n`make controller --actions` reads its action list from the same module as `--skip`; nothing\nelse changes for existing scaffolds."}
|
|
1147
1147
|
{"release":"2026.10.20","package":"@sdxc/kit","type":"feat","breaking":false,"title":"Scaffold a JSON resource with its OpenAPI operations through sdxc scaffold --api","body":"`sdxc scaffold <name> [field ...] --api` writes the resource as JSON endpoints in the `api`\ncontract instead of pages:\n\n sdxc scaffold post title body published --api\n\n| Endpoint | Controller | Answers |\n| --------------------------- | -------------------------------------------- | -------------------------- |\n| `GET /api/posts` | `app/http/controllers/api/posts/index.tsx` | `{ data: [...] }` |\n| `GET /api/posts/:id` | `.../show.tsx` | `{ data }` or `notFound` |\n| `POST /api/posts` | `.../create.tsx` | 201 `{ data }` |\n| `PATCH /api/posts/:id` | `.../update.tsx` | `{ data }` |\n| `DELETE /api/posts/:id` | `.../destroy.tsx` | 204 |\n\n- `routes/api.ts` gains the routes and, after them, `POST_SCHEMA` and one operation per\n endpoint (`POSTS_INDEX`, `POST_SHOW`, `POST_CREATE`, `POST_UPDATE`, `POST_DESTROY`), typing\n each body from the fields; `app/initializers/openapi.ts` adds them to the document, so\n `/api/openapi.json` describes every endpoint. A file laid out otherwise gets the code\n printed to place by hand.\n- Each write parses its body through its operation, answers a refused body or model\n validation with the `validationError` problem, and a missing or hidden row with\n `notFound`. Each checks the resource's ability, as the pages do.\n- The model, migration, factory and policy are written as without `--api`; the validator,\n form, page controllers and locale copy are not. `--skip pages` leaves out the endpoints.\n- The template's API binds every caller as a guest, who may only read, so the write\n endpoints answer 403 until the app authenticates API callers; their tests say so and\n leave the authenticated case as a `test.todo`.\n\nScaffolds without `--api` are unchanged."}
|
|
1148
1148
|
{"release":"2026.10.20","package":"@sdxc/kit","type":"refactor","breaking":false,"title":"Declare the app template's seed in database/seed.ts with defineSeed","body":"The template's seed is now one file, `database/seed.ts`, default-exporting\n`defineSeed(registry, { … })` from `@sdxc/data-model/seed`, in place of the\n`database/seeders/` folder and the template's own `app/services/seeders.ts`. `sdxc run db seed`\nruns its steps in order and prints `Seeded <name>` for each.\n\nAn app made from the previous template moves each seeder into a step and deletes the rest:\n\n // before: database/seeders/posts.ts, listed in database/seeders/index.ts\n const seedPosts: Seeder = async ({ factories }) => {\n \tawait factories.createMany(PostFactory, 10);\n };\n\n // after: database/seed.ts\n export default defineSeed(registry, {\n \tposts: ({ factories }) => factories.createMany(PostFactory, 10),\n });\n\nThen point `app/commands/db/seed.ts` at it (`await seeder.run({ db: ctx.db })`) and remove\n`database/seeders/` and `app/services/seeders.ts`."}
|
|
1149
|
-
{"release":"2026.10.20","package":"@sdxc/kit","type":"fix","breaking":false,"title":"Ship database/seed.ts with the app template","body":"A new app from `sdxc create` gets `database/seed.ts`, an empty `defineSeed(registry, {})` that\n`sdxc run db seed` reads. It ships in the same release as the move to `database/seed.ts`, so\nno app needs to act."}
|
|
1149
|
+
{"release":"2026.10.20","package":"@sdxc/kit","type":"fix","breaking":false,"title":"Ship database/seed.ts with the app template","body":"A new app from `sdxc create` gets `database/seed.ts`, an empty `defineSeed(registry, {})` that\n`sdxc run db seed` reads. It ships in the same release as the move to `database/seed.ts`, so\nno app needs to act.","correctedIn":"2026.10.20"}
|
|
1150
1150
|
{"release":"2026.10.20","package":"@sdxc/kit","type":"feat","breaking":false,"title":"Leave out paths and sort the listing with sdxc routes --except-path and --sort","body":"`sdxc routes` takes two more flags:\n\n sdxc routes --except-path /api,/mcp\n sdxc routes --sort pattern\n\n- `--except-path <path>` leaves out the routes whose pattern is the path or sits under it by\n whole segments, so `/api` drops `/api/posts` and keeps `/apiary`. Repeat it or list several;\n it composes with every other filter and `--json`.\n- `--sort <field>` orders the routes by `name`, `pattern`, `method` or `controller` instead of\n declaration order; a route no router maps sorts last by controller.\n\nWithout them the listing is unchanged."}
|
|
1151
1151
|
{"release":"2026.10.20","package":"@sdxc/kit","type":"feat","breaking":false,"title":"End make and scaffold output with what they left out and what needs you","body":"`sdxc make` and `sdxc scaffold` now print their notes last, after the formatter's own output,\nso a long run ends with what still needs your attention:\n\n sdxc make model post title --skip migration,factory\n Wrote app/models/post.ts\n Wrote app/models/post.test.ts\n Edited app/models/index.ts\n ✓ Formatting 3 files\n Wrote no migration or factory, as --skip asked\n\n- `make model --skip` and `scaffold --skip` name every piece they left out.\n- `make model --force` on an existing model says it wrote no migration and names the\n `sdxc make migration add-<columns>-to-<table>` to run for new columns.\n- Edits to make by hand, the `--force` note on kept declarations, and the `--actions` note on\n `index` move to the end too.\n\nThe files written are unchanged; only the order of the output differs."}
|
|
1152
1152
|
{"release":"2026.10.20","package":"@sdxc/kit","type":"feat","breaking":false,"title":"List note comments with sdxc notes and count code with sdxc stats","body":"Two read-only commands for an overview of a project:\n\n sdxc notes\n app/http/controllers/posts/show.tsx:\n [21] TODO: render the page\n\n sdxc stats\n Kind Files Lines Code\n Controllers 8 173 108\n …\n Code: 1094 Tests: 490 Code to test ratio: 1:0.4\n\n- `sdxc notes` lists every `TODO`, `FIXME`, `HACK` and `OPTIMIZE` comment under `app/`,\n `bootstrap/`, `config/`, `database/`, `resources/` and `routes/`, by file and line, after\n `//`, `/*`, `*`, `{/*`, `--` or `<!--`. `--tag` picks other tags (`--tag TODO,REVIEW`), and\n `--json` prints the notes as an array.\n- `sdxc stats` counts files, lines, and code lines without blanks and comments, for each kind\n of code the app layout names (controllers, middleware, validators, jobs, models, services,\n policies, initializers, MCP, commands, emails, migrations, factories, resources, routes…),\n with tests counted apart wherever they sit, and prints the code to test ratio. `--json`\n prints the counts.\n\nNo action is needed for existing projects."}
|
|
@@ -1409,7 +1409,7 @@
|
|
|
1409
1409
|
{"release":"2026.10.25","package":"@sdxc/privacy-pass","type":"feat","breaking":false,"title":"Add @sdxc/privacy-pass for Privacy Pass origins","body":"New package: the origin (redeemer) side of Privacy Pass (RFC 9576, 9577\nand 9578). It writes the `WWW-Authenticate: PrivateToken` challenge,\nredeems the token a client answers with in `Authorization: PrivateToken`,\nverifies Blind RSA tokens (type 0x0002) with Web Crypto, reads the\nissuer's keys from its `/.well-known/private-token-issuer-directory`,\nand refuses a token spent twice. Every call answers a `Result`.\n\n import { MemoryRedemptionStore, PrivacyPass } from \"@sdxc/privacy-pass\";\n\n let privacyPass = new PrivacyPass({\n issuer: \"demo-pat.issuer.cloudflare.com\",\n store: new MemoryRedemptionStore(),\n });\n\n let redeemed = await privacyPass.redeem(request.headers.get(\"Authorization\"));\n if (isFailure(redeemed)) {\n let challenge = await privacyPass.challenge();\n // answer 401 with WWW-Authenticate: challenge.data\n }\n\n`redemptionContext: \"fresh\"` (the default) binds each token to one\nchallenge; `\"empty\"` accepts cached tokens and keeps spent nonces. Back\n`RedemptionStore` with shared storage in production. The structures\n(`encodeTokenChallenge`, `parseToken`, `parseAuthorization`) and the\nverifier (`importTokenKey`, `verifyToken`) are exported for custom flows."}
|
|
1410
1410
|
{"release":"2026.10.25","package":"@sdxc/rate-limit","type":"feat","breaking":true,"title":"Write the RateLimit fields of draft-ietf-httpapi-ratelimit-headers-11","body":"`@sdxc/rate-limit` now writes `RateLimit` and `RateLimit-Policy` as the current\nrevision of the IETF draft (-11) defines them: Structured Field Lists of Items\nnamed after the policy, instead of the -07 Dictionary and bare Item.\n\nHeader values, before and after, for a 10-request, 10-second policy:\n\n Before: RateLimit: limit=10, remaining=0, reset=7\n RateLimit-Policy: 10;w=10\n After: RateLimit: \"default\";r=0;t=7\n RateLimit-Policy: \"default\";q=10;w=10\n\n`Retry-After` is unchanged. The limit moved from `RateLimit` to the policy's\n`q`. A denial now always reports `r=0`, also on a backend that cannot count\nwhat remains (the Cloudflare binding); an allowed request on such a backend\ngets no `RateLimit` field, since `r` is required. A window under one second\ndrops `w` and keeps the policy. Writing the fields onto a response keeps Items\nother policies already put there, replaces one of the same name, and keeps\nthe longer `Retry-After`, so nested limiters each report their own policy.\n\nMigration:\n\n1. `rateLimitHeaders`, `applyRateLimitHeaders` and `tooManyRequests` take a\n policy where they took a window. An adapter is one, so pass it whole:\n\n // before\n tooManyRequests(decision, adapter.window, body, init);\n applyRateLimitHeaders(response, decision, adapter.window);\n rateLimitHeaders(decision, \"10 seconds\");\n // after\n tooManyRequests(decision, adapter, body, init);\n applyRateLimitHeaders(response, decision, adapter);\n rateLimitHeaders(decision, { window: \"10 seconds\" });\n\n2. Update anything that reads or asserts the old values. A client that read\n `limit`, `remaining` and `reset` reads `q` from `RateLimit-Policy`, and `r`\n and `t` from `RateLimit`:\n\n // before\n expect(response.headers.get(\"RateLimit-Policy\")).toBe(\"10;w=10\");\n // after\n expect(response.headers.get(\"RateLimit-Policy\")).toBe('\"default\";q=10;w=10');\n\nNew, to name a policy and describe it further:\n\n rateLimit({ adapter, key, policy: \"burst\" });\n // RateLimit: \"burst\";r=9;t=7\n\n tooManyRequests(decision, { ...adapter, name: \"export\", quotaUnit: \"content-bytes\" });\n // RateLimit-Policy: \"export\";q=10;qu=\"content-bytes\";w=10\n\n`partitionKey` (a `Uint8Array`) writes `pk` on both fields. `quotaExceeded`\nanswers the draft's `quota-exceeded` problem type as `application/problem+json`,\nnaming the policy in `violated-policies`:\n\n if (!decision.allowed) return quotaExceeded(decision, adapter, \"Try again in 7 seconds.\");\n // {\"type\":\"https://iana.org/assignments/http-problem-types#quota-exceeded\", …,\n // \"violated-policies\":[\"default\"]}\n\n`DEFAULT_POLICY_NAME`, `QUOTA_EXCEEDED_TYPE` and the `RateLimitPolicy` and\n`QuotaUnit` types are exported too."}
|
|
1411
1411
|
{"release":"2026.10.25","package":"@sdxc/rdap","type":"feat","breaking":false,"title":"Report the fields a registry redacted under RFC 9537","body":"A domain lookup now reads the response's RFC 9537 `redacted` member into\n`domain.redacted`, and the new `isRedacted()` tells a field the registry\nwithheld from one the registration never had:\n\n import { isRedacted, RDAP } from \"@sdxc/rdap\";\n\n let looked = await rdap.domain(\"example.com\");\n if (isSuccess(looked) && isRedacted(looked.data, \"registrant.email\")) {\n // show \"hidden by the registry\" instead of \"not published\"\n }\n\nEach `RDAP.Redaction` keeps the entry's `name`, `method` (`removal`,\n`emptyValue`, `partialValue` or `replacementValue`, defaulting to\n`removal`), `prePath`/`postPath`/`replacementPath`, `pathLang` and\n`reason`, plus the `field` it resolves onto: `handle`, or a lowercased role\nand contact field such as `registrant.name`, `technical.phone` or\n`abuse.email`. The field is read from the JSONPath first (jCard and\nJSContact shapes) and from the registered name (`Tech Email`, `Registry\nDomain ID`) when the path says nothing; a contact removed whole\n(`administrative.contact`) redacts each of its fields.\n\n`RDAP.Domain` gains the `redacted` array, empty when a registry publishes\nnone. Code that builds an `RDAP.Domain` by hand must add it."}
|
|
1412
|
-
{"release":"2026.10.25","package":"@sdxc/rdap","type":"feat","breaking":false,"title":"Read entity contacts from JSContact cards and jCards alike","body":"A domain lookup now answers `domain.contacts`: every entity of the\nresponse, nested ones after their parent, as one `RDAP.Contact` whether the\nserver sent a jCard `vcardArray` or a JSContact `jscontact_card`\n(draft-ietf-regext-rdap-jscontact):\n\n let looked = await rdap.domain(\"example.com\");\n let registrant = looked.data.contacts.find((c) => c.roles.includes(\"registrant\"));\n registrant?.name; // \"Joe User\", or null when absent or redacted\n registrant?.card; // the card as a JSContact Card, via @sdxc/jscontact\n\nEach contact carries `roles`, `handle`, `kind`, `name`, `organization`,\n`emails`, `phones`, `faxes`, `address`, `contactUri` and `url`; an emptied\n(redacted) value reads as `null`, and `isRedacted` tells it apart from a\nmissing one. `RDAP.Registrar` is read the same way, so a registrar that\nonly publishes a JSContact card now gets its name and abuse email, and a\ncard with an empty name falls back to its organization.\n\n`RDAP.Domain` gains the `contacts` array; code that builds an\n`RDAP.Domain` by hand must add it."}
|
|
1412
|
+
{"release":"2026.10.25","package":"@sdxc/rdap","type":"feat","breaking":false,"title":"Read entity contacts from JSContact cards and jCards alike","body":"A domain lookup now answers `domain.contacts`: every entity of the\nresponse, nested ones after their parent, as one `RDAP.Contact` whether the\nserver sent a jCard `vcardArray` or a JSContact `jscontact_card`\n(draft-ietf-regext-rdap-jscontact):\n\n let looked = await rdap.domain(\"example.com\");\n let registrant = looked.data.contacts.find((c) => c.roles.includes(\"registrant\"));\n registrant?.name; // \"Joe User\", or null when absent or redacted\n registrant?.card; // the card as a JSContact Card, via @sdxc/jscontact\n\nEach contact carries `roles`, `handle`, `kind`, `name`, `organization`,\n`emails`, `phones`, `faxes`, `address`, `contactUri` and `url`; an emptied\n(redacted) value reads as `null`, and `isRedacted` tells it apart from a\nmissing one. `RDAP.Registrar` is read the same way, so a registrar that\nonly publishes a JSContact card now gets its name and abuse email, and a\ncard with an empty name falls back to its organization.\n\n`RDAP.Domain` gains the `contacts` array; code that builds an\n`RDAP.Domain` by hand must add it.","correctedIn":"2026.10.25"}
|
|
1413
1413
|
{"release":"2026.10.25","package":"@sdxc/robots","type":"feat","breaking":false,"title":"Read, write and evaluate IETF AI Preferences Content-Usage signals","body":"`@sdxc/robots` now supports the IETF AI Preferences drafts (draft-ietf-aipref-vocab and\ndraft-ietf-aipref-attach) beside the existing `Content-Signal` line.\n\nA robots.txt `Content-Usage` rule, with or without a leading path pattern, is parsed into\n`group.contentUsage` and written back by `stringify`. `contentUsage()` answers the preferences\na file states for one agent and URL: the longest matching pattern decides (no pattern counts as\n`/`), rules tied at that length combine with the most restrictive preference winning, and a\ndisallowed URL answers `null`, since it carries no preferences.\n\n import { contentUsage, parse, stringify } from \"@sdxc/robots\";\n\n let document = parse(\"User-agent: *\\nContent-Usage: train-ai=n\\nContent-Usage: /open/ train-ai=y\\n\");\n contentUsage(document, \"ExampleBot/1.0\", \"/open/post\"); // { \"train-ai\": true }\n\n stringify({\n groups: [{ userAgents: [\"*\"], rules: [], contentUsage: [{ preferences: { search: true } }] }],\n sitemaps: [],\n records: [],\n }); // \"User-agent: *\\nContent-Usage: search=y\\n\"\n\nThe new `@sdxc/robots/content-usage` entry reads and writes the `Content-Usage` HTTP field as an\nRFC 9651 Dictionary of `y`/`n` Tokens:\n\n import { combinePreferences, getContentUsage, setContentUsage } from \"@sdxc/robots/content-usage\";\n\n setContentUsage(response.headers, { search: true, \"train-ai\": false }); // search=y, train-ai=n\n let stated = combinePreferences(contentUsage(document, agent, url) ?? {}, getContentUsage(response));\n\nPreferences are `Robots.UsagePreferences`: `true` allows a category, `false` disallows it, and a\nmissing label is unknown. Labels are case-sensitive, so an invalid field leaves every category\nunknown. The package now depends on `@sdxc/structured-fields` and `@sdxc/result`, with `remix` as\na peer. No existing API changes."}
|
|
1414
1414
|
{"release":"2026.10.25","package":"@sdxc/rss","type":"feat","breaking":false,"title":"Read and write RFC 5005 complete and archive markers","body":"`RSS.Channel` gains `fhComplete` and `fhArchive`, the Feed Paging and Archiving (RFC 5005)\nmarkers `fh:complete` and `fh:archive`. Parsing sets them from the elements, judged by the\n`http://purl.org/syndication/history/1.0` namespace whatever prefix binds it, so they no\nlonger land in `extensions`. Serializing writes them back, declaring `xmlns:fh` when the\ndocument binds none:\n\n let rss = new RSS({ title, link, description, fhComplete: true });\n rss.toString(); // … xmlns:fh=\"http://purl.org/syndication/history/1.0\" … <fh:complete/>\n\nThe paging and archive relations travel as `atomLink` entries (`rel: \"prev-archive\"` and\nso on), as before. A consumer that read the markers out of `channel.extensions` reads\n`channel.fhComplete` or `channel.fhArchive` instead."}
|
|
1415
1415
|
{"release":"2026.10.25","package":"@sdxc/scim","type":"feat","breaking":true,"title":"Page lists by cursor and sign SCIM event tokens","body":"Lists can now page by cursor (RFC 9865), and the new `@sdxc/scim/events`\nentry point builds and signs SCIM events (RFC 9967).\n\nCursor pagination: pass `cursor: true` to `parseListQuery` or\n`parseSearchRequest` to read the `cursor` parameter. `query.cursor` is\n`null` for an index request, `\"\"` for the first cursor page (a bare\n`?cursor`), or the cursor the client sent back. Answer a cursor page with\n`nextCursor` instead of `startIndex`; leaving it out marks the last page:\n\n let query = parseListQuery(url, { maxCount: 200, cursor: true });\n if (isFailure(query)) return errorResponse(query.error);\n if (query.data.cursor !== null) {\n let page = await store.after(query.data.cursor, query.data.count);\n return listResponse(\n { resources: page.users, totalResults, nextCursor: page.next },\n toWire,\n );\n }\n\n`defaultPagination: \"cursor\"` pages requests that name neither `cursor` nor\n`startIndex` by cursor. A cursor outside RFC 3986's unreserved characters\nfails `400 invalidCursor`, and a request that sends both `cursor` and\n`startIndex` fails `400 invalidValue`. `Scim.ErrorType` now includes\n`invalidCursor`, `expiredCursor` and `invalidCount`. `serviceProviderConfig`\ntakes a `pagination` option to advertise RFC 9865's capability:\n\n serviceProviderConfig({ ...options, pagination: { cursor: true, index: true, defaultPaginationMethod: \"index\", maxPageSize: 200 } });\n\nSCIM events: `createScimEvent` builds a Security Event Token with a fresh\n`jti`, the subject in `sub_id`, and the events from the `scimEvents` builders.\nIt is typed `secevent+jwt` and signed through `@sdxc/jwt`:\n\n import { createScimEvent, scimEvents } from \"@sdxc/scim/events\";\n\n let signed = await createScimEvent({\n issuer: \"https://scim.example.com\",\n audience: \"https://receiver.example.com/events\",\n subject: { uri: `/Users/${id}`, externalId },\n events: [scimEvents.create({ data: userResource(user) })],\n }).sign(JWK.Algorithm.ES256, keys);\n\n`ScimEventToken.verify` refuses any other token type. `prefersAsync` and\n`acceptedResponse` handle `Prefer: respond-async` and the empty `202` with\n`Set-Txn`, and `serviceProviderConfig` takes a `securityEvents` option.\nDelivering the tokens (RFC 8935 push or RFC 8936 poll) stays with the app.\n\nBreaking: `Scim.ListQuery` has a new required `cursor` field, and `Scim.Page`\nis now `Scim.IndexPage | Scim.CursorPage`. Code that builds a query by hand\nmust add the field:\n\n // before\n let query: Scim.ListQuery = { filter: null, startIndex: 1, count: 100, ... };\n // after\n let query: Scim.ListQuery = { filter: null, startIndex: 1, cursor: null, count: 100, ... };\n\nCode that reads `page.startIndex` from a `Scim.Page` must type the page as\n`Scim.IndexPage`. Pages passed to `listResponse` need no change."}
|
|
@@ -1428,3 +1428,38 @@
|
|
|
1428
1428
|
{"release":"2026.10.25","package":"@sdxc/well-known","type":"feat","breaking":false,"title":"Model the DPoP and JWT introspection algorithm lists","body":"`AuthorizationServerMetadata` (and so the OpenID Connect discovery document) gains two\nRFC 8414 registry members, read and written like the other algorithm lists:\n\n- `dpopSigningAlgValuesSupported` (`dpop_signing_alg_values_supported`, RFC 9449 §5.1):\n the algorithms a DPoP proof may be signed with.\n- `introspectionSigningAlgValuesSupported` (`introspection_signing_alg_values_supported`,\n RFC 9701 §7): the algorithms a JWT introspection response is signed with.\n\n define({\n issuer,\n responseTypesSupported: [\"code\"],\n dpopSigningAlgValuesSupported: [\"ES256\", \"Ed25519\"],\n introspectionSigningAlgValuesSupported: [\"ES256\"],\n });\n\nBoth default to an empty list and are left out of the document when empty. A document\nread before this change that carried either member under `extensions` now carries it\nin the typed field instead."}
|
|
1429
1429
|
{"release":"2026.10.25","package":"@sdxc/workers-cache","type":"feat","breaking":false,"title":"Declare CDN-Cache-Control and Cloudflare-CDN-Cache-Control lifetimes","body":"`ctx.cache()` now takes `cdn` and `cloudflare` in its object form, written as\nthe RFC 9213 `CDN-Cache-Control` and `Cloudflare-CDN-Cache-Control` fields. The\nedge obeys them over `Cache-Control`, so it can keep a page far longer than\nbrowsers do and still drop it on a purge:\n\n import { policy, targetedPolicy } from \"@sdxc/http/cache\";\n\n ctx.cache({\n policy: policy({ visibility: \"public\", maxAge: 0, mustRevalidate: true }).toString(),\n cdn: targetedPolicy({ maxAge: \"1 day\" }),\n tags: [TAGS.post(post.id)],\n });\n\n`cdn` is forwarded to any CDN in front of the edge; `cloudflare` is read only by\nthe edge, which takes it over `cdn`. A later declaration replaces the earlier\npolicy and its targeted fields together.\n\nThe safety checks now cover what a CDN actually obeys. On a request with a\nsession (or, without session middleware, any cookie), a valid targeted field\nthat lacks `private` and `no-store` is refused even when `Cache-Control` is\nprivate, with the new `CacheRefusalReason` `\"session-with-shared-targeted-policy\"`;\nthis includes targeted fields the handler set on the response itself. Invalid\nor empty targeted fields are judged as absent, since caches ignore them. Every\ndowngrade, including the `Set-Cookie` one, now also removes both targeted\nfields, so the edge falls back to `private, no-store`. The applied-policy log\nline records the field the edge follows as `cache.edge_field`.\n\n`CDN_CACHE_CONTROL_HEADER`, `CLOUDFLARE_CDN_CACHE_CONTROL_HEADER` and\n`EDGE_TARGETED_HEADERS` (the edge's target list, most specific first) are\nexported. Declarations without targeted fields behave as before."}
|
|
1430
1430
|
{"release":"2026.10.25","package":"@sdxc/zone-file","type":"feat","breaking":true,"title":"Read SVCB, HTTPS, TLSA, DS, DNSKEY, CDS and CDNSKEY data into typed fields","body":"`parseRecordData`, `parse` and `formatRecordData` now read and print seven more record types,\nfrom presentation format and from RFC 3597 generic data alike:\n\n- `SVCB` and `HTTPS` (RFC 9460): `{ priority, target, params }`, where `params` holds each\n SvcParam as a camelCase field (`mandatory`, `alpn`, `noDefaultAlpn`, `port`, `ipv4Hint`,\n `ech`, `ipv6Hint`, `dohPath`, `ohttp`) and any other key under `other` by key number.\n- `TLSA` (RFC 6698): `{ usage, selector, matchingType, certificateAssociation }`.\n- `DS` and `CDS` (RFC 4034, RFC 7344): `{ keyTag, algorithm, digestType, digest }`; algorithm\n mnemonics such as `RSASHA256` read as their number.\n- `DNSKEY` and `CDNSKEY`: `{ flags, zoneKey, secureEntryPoint, protocol, algorithm, publicKey,\n keyTag }`, where `keyTag` is the RFC 4034 Appendix B tag a DS record names the key by.\n\nHex prints lowercase, base64 without whitespace, and SvcParams in key order, so a zone file's\nspelling and a resolver's generic form of one record print to the same string. A new\n`typeCode` maps a mnemonic or `TYPEnnn` to its number.\n\n```ts\nimport { formatRecordData, parseRecordData, typeCode } from \"@sdxc/zone-file\";\n\nparseRecordData(\"HTTPS\", '1 . alpn=\"h3,h2\" ipv4hint=192.0.2.1');\n// success({ type: \"HTTPS\", priority: 1, target: \".\", params: { alpn: [\"h3\", \"h2\"], ipv4Hint: [\"192.0.2.1\"] } })\n\nlet ds = parseRecordData(\"DS\", \"60485 5 1 2BB183AF5F22588179A53B0A98631FAD1A292118\");\n// ds.data.digest === \"2bb183af5f22588179a53b0a98631fad1a292118\"\n\ntypeCode(\"TLSA\"); // 52\n```\n\nBreaking: records of these types used to come back untyped as `{ type, data }` with the RDATA\nas written (and, from `parse`, an `origin`). Code that read `data` from one of them must read\nthe typed fields instead, or print them back with `formatRecordData`:\n\n```ts\n// Before\nif (record.type === \"HTTPS\") show(record.data);\n\n// After\nif (record.type === \"HTTPS\") show(formatRecordData(record));\n```\n\nData that does not fit one of these types now fails with `RecordDataError` in\n`parseRecordData` and becomes an `invalid-data` rejection in `parse`, where it used to be\naccepted verbatim."}
|
|
1431
|
+
{"release":"2026.10.26","package":"@sdxc/activitypub","type":"refactor","breaking":false,"title":"Read an inbox's Retry-After with @sdxc/http","body":"A failed delivery now reads the inbox's `Retry-After` through `parseRetryAfter` from `@sdxc/http/retry-after`, still capped at the longest backoff step. The obsolete RFC 850 and asctime date spellings are now read in UTC, and a negative or fractional delay is now ignored, so `DeliveryError.retryAfter` is `null` and the job's own backoff applies where it used to read `0`. Consumers need not act."}
|
|
1432
|
+
{"release":"2026.10.26","package":"@sdxc/atom","type":"feat","breaking":true,"title":"Return Results from building and serializing a feed","body":"Building and writing an Atom feed no longer throws. The constructor is private: build an instance with `Atom.fromJSON({ feed, entries })`, or validate and serialize plain data in one call with `Atom.stringify`. `addEntry` and the new `setFeed` answer a `Result` instead of throwing `AtomParseError`, and serialization failures arrive as an `AtomStringifyError` failure.\n\nThis also fixes `Atom.parse`, `Atom.fromXML` and `Atom.fetch` throwing on a feed or entry with an empty `<title/>`, which RFC 4287 permits; they now return the feed with `title: \"\"`. Building a feed likewise accepts an empty title, and refuses only a missing one.\n\nMigration:\n\n1. Replace the constructor and `toString()` with `Atom.stringify`.\n\nBefore:\n\n let atom = new Atom(feed);\n for (let entry of entries) atom.addEntry(entry);\n let xml = atom.toString();\n\nAfter:\n\n let xml = Atom.stringify({ feed, entries });\n if (isFailure(xml)) return xml.error;\n xml.data;\n\n2. When you need an instance, build it with `Atom.fromJSON`.\n\nBefore:\n\n let atom = new Atom(feed);\n\nAfter:\n\n let atom = Atom.fromJSON({ feed, entries: [] });\n if (isFailure(atom)) return atom.error;\n\n3. Check the `Result` `addEntry` returns.\n\nBefore:\n\n atom.addEntry(entry);\n\nAfter:\n\n let added = atom.addEntry(entry);\n if (isFailure(added)) return added.error;\n\n4. Replace assignments to `atom.feed` with `setFeed`; the `feed` getter is unchanged.\n\nBefore:\n\n atom.feed = { ...atom.feed, updated };\n\nAfter:\n\n let replaced = atom.setFeed({ ...atom.feed, updated });\n\n5. Serialize an instance with `Atom.stringify(atom)` instead of `atom.toString()` or `String(atom)`; `toString()` is gone, so a template literal now prints `[object Object]`."}
|
|
1433
|
+
{"release":"2026.10.26","package":"@sdxc/billing","type":"feat","breaking":false,"title":"Type webhook handlers with the router's context and let them return a Result","body":"`BillingWebhook` now takes the request context type as a type parameter, so a handler receives your router's context, with every service its middleware publishes (`ctx.db`, `ctx.models`, ...), instead of the bare `RequestContext`. A handler may also return a `Result`: a `Failure` is reported exactly like a thrown error (a retryable one answers `503`, any other is logged and acknowledged with `200`, and the delivery stays unprocessed). A thrown error is still caught and reported the same way.\n\n```ts\nimport type { AppContext } from \"./router.js\";\n\nexport const WEBHOOK = new BillingWebhook<AppContext>(polar, {\n\tasync \"order.paid\"(event, ctx) {\n\t\tlet granted = await ctx.models.orders.grant(event.order);\n\t\tif (isFailure(granted)) return granted;\n\t},\n});\n\nexport default createAction(routes.webhook, (ctx) => WEBHOOK.handler(ctx));\n```\n\nThe type parameter defaults to `RequestContext`, so existing endpoints compile unchanged; drop any `ctx as RequestContext` cast by passing your router's context type instead."}
|
|
1434
|
+
{"release":"2026.10.26","package":"@sdxc/feed","type":"refactor","breaking":false,"title":"Read RSS documents through the Result-returning RSS.fromXML","body":"`Feed.parse` and the readers built on it take RSS documents from the Result-returning `RSS.fromXML` in `@sdxc/rss` instead of catching what it threw. A document the RSS parser refuses still answers a `FeedParseError` with the same message. No consumer action is needed."}
|
|
1435
|
+
{"release":"2026.10.26","package":"@sdxc/highlight","type":"refactor","breaking":false,"title":"Name grammar constants in UPPER_SNAKE_CASE","body":"Internal cleanup with no consumer effect: each grammar's non-exported rule constants use UPPER_SNAKE_CASE, and test comments describe their fixtures on their own terms."}
|
|
1436
|
+
{"release":"2026.10.26","package":"@sdxc/http","type":"fix","breaking":false,"title":"Keep the Content-Type a caller passes to file()","body":"Before, `file()` from `@sdxc/http/response` always wrote `Content-Type: application/octet-stream`, overwriting a `Content-Type` passed in `init.headers`. Now the caller's type wins, and `application/octet-stream` stays the default when `init` names none:\n\n```ts\nimport { file } from \"@sdxc/http/response\";\n\nreturn file(zipBytes, \"archive.zip\", { headers: { \"Content-Type\": \"application/zip\" } });\n// Content-Type: application/zip\n// Content-Disposition: attachment; filename=\"archive.zip\"\n```\n\nConsumers need not act. Code that built the Response by hand to set its own type around this can switch to `file()`."}
|
|
1437
|
+
{"release":"2026.10.26","package":"@sdxc/http","type":"feat","breaking":false,"title":"Read Retry-After as a wait in milliseconds","body":"The new `@sdxc/http/retry-after` entry point exports `parseRetryAfter(value, now?)`, which reads an RFC 9110 `Retry-After` header in either form: delay-seconds, or an HTTP-date (IMF-fixdate and the obsolete RFC 850 and asctime spellings) measured from `now`, which defaults to the current time. A date already past reads as `0`; a missing header, or a value in neither form (negative or fractional numbers included), reads as `null` so the caller falls back to its own backoff.\n\n```ts\nimport { parseRetryAfter } from \"@sdxc/http/retry-after\";\n\nlet wait = parseRetryAfter(response.headers.get(\"Retry-After\")) ?? 2 ** attempt * 1000;\nparseRetryAfter(\"Wed, 21 Oct 2015 07:28:30 GMT\", new Date(\"2015-10-21T07:28:00Z\")); // 30000\n```"}
|
|
1438
|
+
{"release":"2026.10.26","package":"@sdxc/http","type":"refactor","breaking":false,"title":"Name content-type lookup tables in UPPER_SNAKE_CASE","body":"Internal cleanup with no consumer effect: the lookup tables behind content negotiation use UPPER_SNAKE_CASE."}
|
|
1439
|
+
{"release":"2026.10.26","package":"@sdxc/jmap","type":"feat","breaking":false,"title":"Type Email/set creations with EmailCreate","body":"Email/set now takes EmailCreate values in create, whose body parts are EmailBodyPartCreate: every property optional, so a part names only what RFC 8621 asks of it. Before, create was a shallow Partial<Email>, and a body part needed every EmailBodyPart property or a cast.\n\nbatch.call(\"Email/set\", {\n\taccountId,\n\tcreate: {\n\t\tdraft: {\n\t\t\tmailboxIds: { [drafts]: true },\n\t\t\tbodyValues: { body: { value: \"Hi\" } },\n\t\t\ttextBody: [{ partId: \"body\", type: \"text/plain\" }],\n\t\t},\n\t},\n});\n\nSetArguments takes the creation shape as an optional second type parameter, SetArguments<T, Create = Partial<T>>, so every other /set is unchanged. Code that cast a body part to EmailBodyPart keeps compiling, and the cast can be removed."}
|
|
1440
|
+
{"release":"2026.10.26","package":"@sdxc/jscontact","type":"docs","breaking":false,"title":"State the full vCard media type in the README","body":"The README said VCARD_MEDIA_TYPE is text/vcard; the constant is, and always was, \"text/vcard;charset=utf-8\". Only the documentation changed, and no action is needed."}
|
|
1441
|
+
{"release":"2026.10.26","package":"@sdxc/json-feed","type":"feat","breaking":true,"title":"Return Results from building and serializing a feed","body":"Building and writing a JSON Feed no longer throws. The constructor is private: build an instance from camelCase data with the new `JSONFeed.from({ feed, items })`, or validate and serialize it in one call with `JSONFeed.stringify`. `addItem` and the new `setFeed` answer a `Result` instead of throwing `JSONFeedParseError`, and leave the feed unchanged when they refuse. A value JSON cannot represent, such as a `BigInt` in an extension, arrives as a `JSONFeedStringifyError` failure. `JSONFeed.fromJSON`, `parse` and `fetch` are unchanged, and `JSONFeed.Data` names the `{ feed, items }` shape.\n\nMigration:\n\n1. Replace the constructor, `addItem` loop and `toString()` with `JSONFeed.stringify`.\n\nBefore:\n\n let feed = new JSONFeed(metadata);\n for (let item of items) feed.addItem(item);\n let json = feed.toString();\n\nAfter:\n\n let json = JSONFeed.stringify({ feed: metadata, items });\n if (isFailure(json)) return json.error;\n json.data;\n\n2. When you need an instance, build it with `JSONFeed.from`.\n\nBefore:\n\n let feed = new JSONFeed(metadata);\n\nAfter:\n\n let feed = JSONFeed.from({ feed: metadata, items: [] });\n if (isFailure(feed)) return feed.error;\n\n3. Check the `Result` `addItem` returns.\n\nBefore:\n\n feed.addItem(item);\n\nAfter:\n\n let added = feed.addItem(item);\n if (isFailure(added)) return added.error;\n\n4. Replace assignments to `feed.feed` with `setFeed`; the `feed` getter is unchanged.\n\nBefore:\n\n feed.feed = { ...feed.feed, expired: true };\n\nAfter:\n\n let replaced = feed.setFeed({ ...feed.feed, expired: true });\n\n5. Serialize an instance with `JSONFeed.stringify(feed)` instead of `feed.toString()` or `String(feed)`; `toString()` is gone, so a template literal now prints `[object Object]`. `JSON.stringify(feed)` still writes the document through `toJSON()`, but throws on a value JSON cannot represent."}
|
|
1442
|
+
{"release":"2026.10.26","package":"@sdxc/kit","type":"fix","breaking":false,"title":"Judge lazy mappings, contracts and test helpers as the app layout requires","body":"sdxc doctor's dependencies, fan-out, orphans and result-throws checks flagged the wiring every app needs, so a fresh sdxc create app failed its own doctor with dozens of warnings.\n\nBefore: a lazy() mapping in the router, the command line or the job dispatcher counted as an outward import, a cycle edge and fan-out; a controller importing its route contract or the layout it renders broke the dependency rule; an initializer importing the jobs, commands or emails declarations or the router's own middleware did too; a test helper in app/test/ that only tests import, a module vite.config.ts names, and the empty MCP declarations were orphans; and bootstrap/browser.ts's loadModule, which the Remix runtime expects to throw, was flagged by result-throws.\n\nAfter: a dynamic import() is a deferred edge, so it keeps its target from being an orphan but closes no cycle, breaches no layer and adds no fan-out. Route contracts are the innermost layer and views sit between the handlers that render them and the initializers they read. app/jobs/index.ts, app/commands/index.ts, app/emails/index.ts and app/mcp/{tools,resources}/index.ts are declarations any layer reads, and an initializer may import app/http/middleware/. Imports from *.test.ts files and paths a root *.config.ts names count as uses. bootstrap/ is left out of result-throws.\n\nsdxc diagram --json gains a deferred field on each edge. No action is needed; re-run sdxc doctor to see the warnings that remain."}
|
|
1443
|
+
{"release":"2026.10.26","package":"@sdxc/kit","type":"fix","breaking":false,"title":"Build the app template's OpenAPI document once","body":"Before: an app from sdxc create built a new openapiHandler for every request to /api/openapi.json, so the document was assembled and serialized on each request and the server it named was whatever origin the request reached.\n\nAfter: the controller creates the handler once at module scope, so the document is built on the first request and every later one is served from that build with the same ETag. createApiDocument() takes no argument and names SITE_URL from config/constants.ts as the server.\n\nAn existing app can apply the same change: move the handler out of the action and build the document from a fixed origin."}
|
|
1444
|
+
{"release":"2026.10.26","package":"@sdxc/kit","type":"feat","breaking":false,"title":"Ship the database and MCP test helpers in the app template","body":"An app from sdxc create now has app/test/database.ts (migrate() and factories()) and app/test/mcp.ts (callTool()) from the start, instead of receiving them with the first sdxc scaffold. A test can use them right away:\n\n import { factories, migrate } from \"~/app/test/database\";\n beforeAll(migrate);\n\nThe template's tests use both: the database test applies the migration chain to an empty binding, and a new /mcp test calls a tool the server does not offer. callTool reads the response in a helper of its own, so the helper stays within sdxc doctor's complexity limit. sdxc scaffold still writes either file into a project that lacks it."}
|
|
1445
|
+
{"release":"2026.10.26","package":"@sdxc/kit","type":"fix","breaking":false,"title":"Pass sdxc doctor in a fresh app from the app template","body":"Before: a new app failed its own sdxc doctor with jsdoc warnings (four module descriptions ran to four lines) and complexity warnings (db fresh, db migrate and the access middleware's signedIn)."}
|
|
1446
|
+
{"release":"2026.10.26","package":"@sdxc/kit","type":"fix","breaking":false,"title":"Name the declared package manager's install after sdxc ui add","body":"Before: sdxc ui add ignored package.json's packageManager field, so in a project declaring bun@… without a lock file it printed \"run npm install\" after adding a package, while sdxc make printed \"run bun install\" for the same project."}
|
|
1447
|
+
{"release":"2026.10.26","package":"@sdxc/kit","type":"fix","breaking":false,"title":"Write valid, distinct declarations from make binding, secret and do","body":"Before:\n- make do wrote fetch(request) with an unused argument and no override, which fails a project with noImplicitOverride, and named feed-do's class FeedDoDO (undo's binding came out as UN).\n- make binding durableObject wrote worker: /* self */, exportName: \"TODO\", which does not parse.\n- make binding r2 USER_UPLOADS named the bucket user_uploads, which R2 refuses; d1 and queue reused the Worker's own name, and rateLimit reused namespace 1001, so a new binding shared the template's database, queue or counter.\n- --force moved the replaced declaration to the top of env and left a blank line behind each time.\n- These three kinds skipped the project's format command and printed lowercase wrote/edited.\n\nAfter:\n- The Durable Object stub declares override fetch(): Response, and a trailing do in the name, in any case, is dropped before DO is added once: feed-do writes FeedDO bound as FEED.\n- durableObject writes bindings.durableObject({ worker: manifest.name, exportName: \"<Key>DO\" }).\n- r2 names the bucket in kebab case (user-uploads); d1 and queue name theirs `${manifest.name}-<key>`; rateLimit takes the next namespace number the config leaves free.\n- --force replaces the declaration where it stands, keeping its comment.\n- All three run the project's format command over what they wrote and print Wrote, Replaced and Edited like every other kind.\n\nBindings declared by an earlier release keep working; rename a shared database, queue or rate-limit namespace before deploying if one was generated with the old placeholders."}
|
|
1448
|
+
{"release":"2026.10.26","package":"@sdxc/kit","type":"feat","breaking":false,"title":"Give the app template's test stand-in a DurableObject base class","body":"An app from sdxc create resolves cloudflare:workers to app/test/cloudflare-workers.ts under Vitest. It now exports a DurableObject class holding the ctx and env it is constructed with, so a module from sdxc make do loads in a test instead of failing with \"Class extends value undefined\", and a test constructs it with a mock state:\n\n let views = new PageViewsDO(createDurableObjectState(), env);\n\nAn existing app can add the same class to its own app/test/cloudflare-workers.ts."}
|
|
1449
|
+
{"release":"2026.10.26","package":"@sdxc/kit","type":"docs","breaking":false,"title":"List fix, setup and diagram, and every doctor and run key, in the README","body":"The @sdxc/kit README's command table now names sdxc fix, sdxc setup and sdxc diagram, and its configuration table lists the doctor.complexity, doctor.moduleSize, doctor.crap, doctor.testRatio, doctor.fanOut, doctor.duplication and doctor.mutation keys and run.entry with their defaults. No consumer action is needed."}
|
|
1450
|
+
{"release":"2026.10.26","package":"@sdxc/kit","type":"style","breaking":false,"title":"Format the app template's db fresh command","body":"Formatting only; generated apps get the same code laid out as the formatter writes it. No action is needed."}
|
|
1451
|
+
{"release":"2026.10.26","package":"@sdxc/kit","type":"fix","breaking":false,"title":"Show corrected release notes to projects past the original release","body":"Before, when a later release corrected a published note, `sdxc upgrade` showed the correction only to projects whose upgrade still crossed the original note's release. A project already past it got neither the original nor the replacement in its prompt, even when the replacement changed a breaking change's migration steps.\n\nNow the prompt has a `## Corrected notes` section. It lists each note of a package the project imports that comes from a release the project already had, when the correction shipped in a release the upgrade moves across. Each entry names both releases and gives the replacement text:\n\n ### @sdxc/auth: Rename the issuer\n\n Released in 2026.9.5, corrected in 2026.10.14.\n\n`changelog.jsonl` now records `correctedIn` on a corrected line, and keeps an older note whose correction shipped within its twelve-month window. Older kits ignore the new key. You don't need to do anything: run `sdxc upgrade` as usual."}
|
|
1452
|
+
{"release":"2026.10.26","package":"@sdxc/kit","type":"fix","breaking":false,"title":"List a project check's files past node_modules","body":"`ctx.files(folder)` in a check written with `defineCheck` from `@sdxc/kit/doctor` now walks the folder without descending into `node_modules` or dot-folders. Before, it read the whole tree first and filtered afterwards, so a folder whose `node_modules` held a symlink loop (as workspace installs do) failed to list and the check received an empty array, passing without reading a file. Checks that scan a folder holding installed packages now see its files; no action is needed."}
|
|
1453
|
+
{"release":"2026.10.26","package":"@sdxc/kit","type":"feat","breaking":false,"title":"Check source conventions in sdxc doctor","body":"`sdxc doctor` runs six new checks over the app's source, each a warning that names the file and line:\n\n- `local-const`: a `const` inside a function or block, tests included. Declare locals with `let`; `const` is for module-level constants.\n- `constant-names`: a non-exported module-level `const` holding a literal, an array, an object of data or a `new Set`/`Map`/`RegExp`, named outside `UPPER_SNAKE_CASE`.\n- `stack-imports`: an import of `zod`, `react`, `react-router`, Tailwind or `remix/html-template`; use `remix/data-schema`, `remix/component` and `css()` mixins.\n- `process-env`: app code reading `process.env`; import `env` from `cloudflare:workers`.\n- `fetch-param`: a `typeof fetch` parameter or option; call the global `fetch` and mock it with MSW.\n- `logger`: `createLogger()` outside `app/initializers/`; log through `ctx.log` or `currentLog()`.\n\nRun one on its own while fixing its findings:\n\n sdxc doctor --only local-const\n\nProjects that already follow the conventions the app template's AGENTS.md lists see six more `pass` lines. Warnings leave the exit code at 0; to skip a check, pass `--skip <name>`."}
|
|
1454
|
+
{"release":"2026.10.26","package":"@sdxc/lazy-route","type":"fix","breaking":false,"title":"Accept guards that publish a context value","body":"`lazy()`'s second argument now accepts any middleware, including one that publishes a typed context value such as `captcha()` from `@sdxc/captcha/middleware`. Before, such a guard was a type error at the `lazy()` call, even though it ran correctly:\n\n router.map(\n \troutes.signUp.action,\n \tlazy(() => import(\"~/app/http/controllers/sign-up/action\"), [captcha(guard)]),\n );\n\nThe value the guard publishes reaches the loaded handler, which reads it typed when the publishing package declares it on `RequestContext`, as `@sdxc/captcha` does for `ctx.captcha`. Code that compiled before compiles unchanged; no action is needed."}
|
|
1455
|
+
{"release":"2026.10.26","package":"@sdxc/markdown","type":"fix","breaking":false,"title":"Accept components typed with a named props interface in toRemix","body":"Before, a component registered in toRemix's `components` map type-checked only when its props were an inline type literal; a component typed as `Handle<CalloutProps>` with `interface CalloutProps { type: string; children: RemixNode }` was rejected unless the interface added `[key: string]: unknown`. Now any component whose props declare `children` as a `RemixNode` (required or optional), or that takes no props, is accepted, whether its props are an interface or a type literal. No action is needed; the `[key: string]: unknown` workaround can be removed from props interfaces."}
|
|
1456
|
+
{"release":"2026.10.26","package":"@sdxc/markdown","type":"docs","breaking":false,"title":"Explain that compose runs a parent's handlers before its children","body":"The Markdown.compose reference now says that a parent's handlers all run before the walk reaches its children, so text one visitor produces inside a node (a value variables() fills) reaches the other visitors only in a later walk. Its JSDoc example no longer composes variables() with headings(). No consumer effect; run variables() in its own walk before visitors that read the text it fills, as the variables pattern already shows."}
|
|
1457
|
+
{"release":"2026.10.26","package":"@sdxc/math","type":"docs","breaking":false,"title":"Say to register MathTag, not MathFormula, in toRemix's components map","body":"The @sdxc/math README now states that MathFormula takes no children and so fails to type-check in @sdxc/markdown's toRemix components map, and that MathTag is the component to register there: toRemix(document, { components: { math: MathTag } }). A type test pins both. No consumer effect."}
|
|
1458
|
+
{"release":"2026.10.26","package":"@sdxc/messaging","type":"refactor","breaking":false,"title":"Read a platform's Retry-After with @sdxc/http","body":"A failed send now reads the `Retry-After` header through `parseRetryAfter` from `@sdxc/http/retry-after`, which `@sdxc/messaging` now depends on, before falling back to a body's `retry_after`. The obsolete RFC 850 and asctime date spellings are now read in UTC, and a negative or fractional header value is now ignored in favor of the body's `retry_after` (or `null`), as RFC 9110 allows only whole seconds. Consumers need not act."}
|
|
1459
|
+
{"release":"2026.10.26","package":"@sdxc/newsletter","type":"feat","breaking":false,"title":"Type webhook handlers with the router's context and let them return a Result","body":"`NewsletterWebhook` now takes the request context type as a type parameter, so a handler receives your router's context, with every service its middleware publishes (`ctx.db`, `ctx.models`, ...), instead of the bare `RequestContext`. A handler may also return a `Result`: a `Failure` answers the delivery with `503` and leaves the event unremembered, exactly as a thrown error does, so the platform redelivers it. A thrown error is still caught and reported the same way.\n\n```ts\nimport type { AppContext } from \"./router.js\";\n\nexport const WEBHOOK = new NewsletterWebhook<AppContext>(buttondown, {\n\tasync \"subscriber.confirmed\"(event, ctx) {\n\t\tlet welcomed = await ctx.models.readers.welcome(event.subscriberId);\n\t\tif (isFailure(welcomed)) return welcomed;\n\t},\n});\n\nexport default createAction(routes.webhook, (ctx) => WEBHOOK.handler(ctx));\n```\n\nThe type parameter defaults to `RequestContext`, so existing endpoints compile unchanged; drop any `ctx as RequestContext` cast by passing your router's context type instead."}
|
|
1460
|
+
{"release":"2026.10.26","package":"@sdxc/privacy-pass","type":"feat","breaking":false,"title":"Add a test issuer at @sdxc/privacy-pass/testing","body":"The new @sdxc/privacy-pass/testing entry stands in for a Privacy Pass issuer in an origin's tests: createTestIssuer() makes a key, issuerDirectoryResponse(issuer) is the directory response for an MSW handler, and answerChallenge(issuer, header) returns the Authorization value a client holding a token sends. Before, a test could only cover the paths where the issuer is down.\n\nimport { answerChallenge, createTestIssuer, issuerDirectoryResponse } from \"@sdxc/privacy-pass/testing\";\n\nlet issuer = await createTestIssuer();\nserver.use(http.get(directory.url, () => issuerDirectoryResponse(issuer)));\nlet authorization = await answerChallenge(issuer, unwrap(await privacyPass.challenge()));\nlet redeemed = await privacyPass.redeem(authorization);\n\nsignToken(issuer, token) is exported too, for signing a token with chosen fields."}
|
|
1461
|
+
{"release":"2026.10.26","package":"@sdxc/rdap","type":"refactor","breaking":false,"title":"Read a registry's Retry-After with @sdxc/http","body":"A rate-limited lookup now reads the server's `Retry-After` through `parseRetryAfter` from `@sdxc/http/retry-after`, which `@sdxc/rdap` now depends on. `RDAPError.retryAfter` keeps its meaning (milliseconds, or `null` when the server named none); the obsolete RFC 850 and asctime date spellings are now read in UTC. Consumers need not act."}
|
|
1462
|
+
{"release":"2026.10.26","package":"@sdxc/rss","type":"feat","breaking":true,"title":"Return Results from building, parsing and serializing a feed","body":"Nothing in `@sdxc/rss` throws any more. The constructor is private: build an instance with `RSS.fromJSON({ channel, items })`, or validate and serialize plain data in one call with `RSS.stringify`. `addItem` and the new `setChannel` answer a `Result` instead of throwing, and leave the feed unchanged when they refuse. `RSS.parse`, `RSS.fromXML` and `RSS.fetch` answer a `Result` too. Failures arrive as three new error classes: `RSSParseError` (a document or data missing what RSS 2.0 requires), `RSSFetchError` (a failed request, a non-`ok` status, or a response that is not XML) and `RSSStringifyError` (a name or value XML cannot hold).\n\nMigration:\n\n1. Replace the constructor, `addItem` loop and `toString()` with `RSS.stringify`.\n\nBefore:\n\n let rss = new RSS(channel);\n for (let item of items) rss.addItem(item);\n let xml = rss.toString();\n\nAfter:\n\n let xml = RSS.stringify({ channel, items });\n if (isFailure(xml)) return xml.error;\n xml.data;\n\n2. When you need an instance, build it with `RSS.fromJSON`.\n\nBefore:\n\n let rss = new RSS(channel);\n\nAfter:\n\n let rss = RSS.fromJSON({ channel, items: [] });\n if (isFailure(rss)) return rss.error;\n\n3. Check the `Result` `addItem` returns.\n\nBefore:\n\n rss.addItem(item);\n\nAfter:\n\n let added = rss.addItem(item);\n if (isFailure(added)) return added.error;\n\n4. Replace assignments to `rss.channel` with `setChannel`; the `channel` getter is unchanged.\n\nBefore:\n\n rss.channel = { ...rss.channel, lastBuildDate };\n\nAfter:\n\n let replaced = rss.setChannel({ ...rss.channel, lastBuildDate });\n\n5. Read the feed out of the `Result` that `RSS.parse` and `RSS.fromXML` return, instead of catching an exception.\n\nBefore:\n\n let feed = RSS.parse(xml);\n feed.channel.title;\n\nAfter:\n\n let feed = RSS.parse(xml);\n if (isFailure(feed)) return feed.error;\n feed.data.channel.title;\n\n6. Do the same with `RSS.fetch`, whose promise now resolves to a `Result` rather than rejecting.\n\nBefore:\n\n let feed = await RSS.fetch(url);\n\nAfter:\n\n let feed = await RSS.fetch(url);\n if (isFailure(feed)) return feed.error;\n\n7. Serialize an instance with `RSS.stringify(rss)` instead of `rss.toString()` or `String(rss)`; `toString()` is gone, so a template literal now prints `[object Object]`."}
|
|
1463
|
+
{"release":"2026.10.26","package":"@sdxc/security-headers","type":"docs","breaking":false,"title":"Show passing the nonce to @sdxc/assets-middleware and when to read it","body":"The @sdxc/security-headers README now shows the usual wiring, where @sdxc/assets-middleware reads the nonce for the document's import map: assets(assetResolver, { stylesheets, script, nonce: (ctx) => ctx.securityHeaders.nonce }). It and the SecurityHeadersContext.nonce JSDoc state that the nonce must be read while the response is built, in the handler or a component that renders synchronously, because the headers are written when the middleware chain resolves and a later read leaves them without the nonce. No consumer effect."}
|
|
1464
|
+
{"release":"2026.10.26","package":"@sdxc/spec","type":"refactor","breaking":false,"title":"Drop ADR citations from comments","body":"Internal cleanup with no consumer effect: comments state their reasons instead of citing ADRs, and an internal metadata key is named META_KEY."}
|
|
1465
|
+
{"release":"2026.10.26","package":"@sdxc/ui","type":"refactor","breaking":false,"title":"Name the view-transition state map in UPPER_SNAKE_CASE","body":"Internal cleanup with no consumer effect: the per-frame transition state map is named FRAME_TRANSITIONS."}
|
|
@@ -14,6 +14,11 @@ export interface ImportEdge {
|
|
|
14
14
|
to: string;
|
|
15
15
|
/** The specifier as written in the source. */
|
|
16
16
|
specifier: string;
|
|
17
|
+
/**
|
|
18
|
+
* Whether the import is a dynamic `import()`, which loads the target on first use: a
|
|
19
|
+
* `lazy()` mapping in a router, dispatcher or command line, or a load that breaks a cycle.
|
|
20
|
+
*/
|
|
21
|
+
deferred: boolean;
|
|
17
22
|
}
|
|
18
23
|
/** An edge between two layers, with how many module edges it aggregates. */
|
|
19
24
|
export interface LayerEdge {
|
|
@@ -29,11 +34,16 @@ export interface ProjectGraph {
|
|
|
29
34
|
modules: string[];
|
|
30
35
|
/** Relative and `~/` imports that resolve inside the project. */
|
|
31
36
|
edges: ImportEdge[];
|
|
37
|
+
/** Imports from the project's test files into its modules, which keep a test helper in use. */
|
|
38
|
+
testEdges: ImportEdge[];
|
|
32
39
|
/** Module edges rolled up by layer, for the architecture diagram. */
|
|
33
40
|
layers: LayerEdge[];
|
|
34
|
-
/**
|
|
41
|
+
/**
|
|
42
|
+
* Strongly connected components with more than one module, or a self-cycle, over static
|
|
43
|
+
* imports: a deferred import resolves after every module has loaded.
|
|
44
|
+
*/
|
|
35
45
|
cycles: string[][];
|
|
36
|
-
/**
|
|
46
|
+
/** Static module edges that point from an inner layer to an outer one. */
|
|
37
47
|
violations: ImportEdge[];
|
|
38
48
|
}
|
|
39
49
|
/**
|
|
@@ -41,7 +51,10 @@ export interface ProjectGraph {
|
|
|
41
51
|
* layout folders. Specifiers that leave the project (packages, absolute URLs) are ignored.
|
|
42
52
|
*/
|
|
43
53
|
export declare function projectGraph(root: string): Promise<ProjectGraph>;
|
|
44
|
-
/**
|
|
54
|
+
/**
|
|
55
|
+
* Rolls module edges into layer-to-layer counts. A deferred edge counts toward its pair and
|
|
56
|
+
* leaves it allowed, since a `lazy()` mapping is how an initializer reaches what it maps.
|
|
57
|
+
*/
|
|
45
58
|
export declare function aggregateLayers(edges: readonly ImportEdge[]): LayerEdge[];
|
|
46
59
|
/**
|
|
47
60
|
* Resolves `specifier` written in `file` to a project-relative path without extension, or
|
|
@@ -18,42 +18,58 @@ import { allowsDependency, layerOf } from "./layers.js";
|
|
|
18
18
|
*/
|
|
19
19
|
export async function projectGraph(root) {
|
|
20
20
|
let modules = [];
|
|
21
|
-
let
|
|
21
|
+
let tests = [];
|
|
22
22
|
let known = new Set();
|
|
23
23
|
for (let folder of PROJECT_FOLDERS) {
|
|
24
|
-
for (let file of
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
24
|
+
for (let file of await listFiles(root, folder)) {
|
|
25
|
+
if (isAppSource(file)) {
|
|
26
|
+
modules.push(file);
|
|
27
|
+
known.add(file);
|
|
28
|
+
known.add(withoutExtension(file));
|
|
29
|
+
}
|
|
30
|
+
else if (TEST_FILE.test(file)) {
|
|
31
|
+
tests.push(file);
|
|
32
|
+
}
|
|
28
33
|
}
|
|
29
34
|
}
|
|
30
|
-
|
|
35
|
+
let edges = await importEdges(root, modules, known);
|
|
36
|
+
let testEdges = await importEdges(root, tests, known);
|
|
37
|
+
let loaded = edges.filter((edge) => !edge.deferred);
|
|
38
|
+
return {
|
|
39
|
+
modules,
|
|
40
|
+
edges,
|
|
41
|
+
testEdges,
|
|
42
|
+
layers: aggregateLayers(edges),
|
|
43
|
+
cycles: findCycles(modules, loaded),
|
|
44
|
+
violations: loaded.filter((edge) => !allowsDependency(edge.from, edge.to)),
|
|
45
|
+
};
|
|
46
|
+
}
|
|
47
|
+
/** Every import in `files` that resolves to a `known` module. */
|
|
48
|
+
async function importEdges(root, files, known) {
|
|
49
|
+
let edges = [];
|
|
50
|
+
for (let file of files) {
|
|
31
51
|
let source = await wrap(() => readFile(join(root, file), "utf8"));
|
|
32
52
|
if (isFailure(source))
|
|
33
53
|
continue;
|
|
34
54
|
let references = findModuleReferences(file, source.data);
|
|
35
55
|
if (isFailure(references))
|
|
36
56
|
continue;
|
|
37
|
-
for (let { specifier } of references.data) {
|
|
57
|
+
for (let { specifier, kind } of references.data) {
|
|
38
58
|
let target = resolveSpecifier(specifier, file);
|
|
39
59
|
if (target === null)
|
|
40
60
|
continue;
|
|
41
61
|
let resolved = resolveKnown(target, known);
|
|
42
62
|
if (resolved === null)
|
|
43
63
|
continue;
|
|
44
|
-
edges.push({ from: file, to: resolved, specifier });
|
|
64
|
+
edges.push({ from: file, to: resolved, specifier, deferred: kind === "dynamic" });
|
|
45
65
|
}
|
|
46
66
|
}
|
|
47
|
-
|
|
48
|
-
return {
|
|
49
|
-
modules,
|
|
50
|
-
edges,
|
|
51
|
-
layers: aggregateLayers(edges),
|
|
52
|
-
cycles: findCycles(modules, edges),
|
|
53
|
-
violations,
|
|
54
|
-
};
|
|
67
|
+
return edges;
|
|
55
68
|
}
|
|
56
|
-
/**
|
|
69
|
+
/**
|
|
70
|
+
* Rolls module edges into layer-to-layer counts. A deferred edge counts toward its pair and
|
|
71
|
+
* leaves it allowed, since a `lazy()` mapping is how an initializer reaches what it maps.
|
|
72
|
+
*/
|
|
57
73
|
export function aggregateLayers(edges) {
|
|
58
74
|
let counts = new Map();
|
|
59
75
|
for (let edge of edges) {
|
|
@@ -65,7 +81,7 @@ export function aggregateLayers(edges) {
|
|
|
65
81
|
let existing = counts.get(key);
|
|
66
82
|
if (existing) {
|
|
67
83
|
existing.count += 1;
|
|
68
|
-
if (!allowsDependency(edge.from, edge.to))
|
|
84
|
+
if (!edge.deferred && !allowsDependency(edge.from, edge.to))
|
|
69
85
|
existing.allowed = false;
|
|
70
86
|
continue;
|
|
71
87
|
}
|
|
@@ -73,7 +89,7 @@ export function aggregateLayers(edges) {
|
|
|
73
89
|
from,
|
|
74
90
|
to,
|
|
75
91
|
count: 1,
|
|
76
|
-
allowed: allowsDependency(edge.from, edge.to),
|
|
92
|
+
allowed: edge.deferred || allowsDependency(edge.from, edge.to),
|
|
77
93
|
});
|
|
78
94
|
}
|
|
79
95
|
return [...counts.values()].sort((a, b) => a.from === b.from ? a.to.localeCompare(b.to) : a.from.localeCompare(b.from));
|
|
@@ -89,6 +105,8 @@ export function resolveSpecifier(specifier, file) {
|
|
|
89
105
|
return null;
|
|
90
106
|
return posix.normalize(posix.join(dirname(file).split("\\").join("/"), specifier));
|
|
91
107
|
}
|
|
108
|
+
/** A test file, whose imports keep a module in use without being part of the app's graph. */
|
|
109
|
+
const TEST_FILE = /\.test\.[cm]?[jt]sx?$/;
|
|
92
110
|
/** Matches a resolved specifier against known modules, trying common extensions. */
|
|
93
111
|
function resolveKnown(target, known) {
|
|
94
112
|
let candidates = [
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* The app-layout layers Clean Architecture's dependency rule maps onto: outer kinds may import
|
|
3
3
|
* inner ones, never the reverse, so a model never reaches a controller and a view never pulls a
|
|
4
|
-
* job.
|
|
4
|
+
* job. Route contracts and handler declarations are data every layer may read.
|
|
5
5
|
*
|
|
6
6
|
* @author [Sergio Xalambrí](https://sergiodxa.com)
|
|
7
7
|
* @copyright Sergio Xalambrí 2026
|
|
@@ -11,7 +11,11 @@
|
|
|
11
11
|
* outside the rule so anyone may import them.
|
|
12
12
|
*/
|
|
13
13
|
export type Layer = "models" | "policies" | "services" | "initializers" | "http" | "jobs" | "mcp" | "emails" | "commands" | "resources" | "routes" | "bootstrap" | "test";
|
|
14
|
-
/**
|
|
14
|
+
/**
|
|
15
|
+
* Higher rank is more inward; an import may only reach a layer at this rank or higher. Route
|
|
16
|
+
* contracts are innermost, since controllers, views and the router all read them, and views sit
|
|
17
|
+
* between the handlers that render them and the instances they read.
|
|
18
|
+
*/
|
|
15
19
|
export declare const LAYER_RANK: Readonly<Record<Layer, number>>;
|
|
16
20
|
/** Display order for architecture diagrams, outer first. */
|
|
17
21
|
export declare const LAYER_ORDER: readonly Layer[];
|
|
@@ -24,6 +28,9 @@ export declare const LAYER_ORDER: readonly Layer[];
|
|
|
24
28
|
export declare function layerOf(path: string): Layer | null;
|
|
25
29
|
/**
|
|
26
30
|
* Whether an import from `from` to `to` obeys the dependency rule. Unranked endpoints are left
|
|
27
|
-
* alone so config and packages stay free to import
|
|
31
|
+
* alone so config and packages stay free to import, any layer reads a declaration module, and
|
|
32
|
+
* an initializer reads the middleware its router's global chain lists.
|
|
28
33
|
*/
|
|
29
34
|
export declare function allowsDependency(from: string, to: string): boolean;
|
|
35
|
+
/** Whether `path` is a module that declares a runtime's jobs, commands, emails or MCP handlers. */
|
|
36
|
+
export declare function isDeclaration(path: string): boolean;
|