sordo 0.4.0 → 1.0.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (152) hide show
  1. package/CHANGELOG.md +6 -116
  2. package/README.md +8 -175
  3. package/bin/sordo.ts +1 -4
  4. package/package.json +17 -41
  5. package/src/agents-md.ts +1 -0
  6. package/src/ai.ts +1 -0
  7. package/src/build.ts +1 -0
  8. package/src/client.ts +1 -0
  9. package/src/config.ts +1 -0
  10. package/src/dev.ts +1 -0
  11. package/src/index.ts +1 -55
  12. package/src/middleware.ts +1 -0
  13. package/src/plugin.ts +1 -0
  14. package/src/render.ts +1 -0
  15. package/src/router.ts +1 -0
  16. package/src/server.ts +1 -0
  17. package/CLAUDE.md +0 -124
  18. package/src/adapters/bun.ts +0 -59
  19. package/src/adapters/edge.ts +0 -75
  20. package/src/adapters/types.ts +0 -43
  21. package/src/agents-md/collect.ts +0 -113
  22. package/src/agents-md/generate.ts +0 -44
  23. package/src/agents-md/index.ts +0 -9
  24. package/src/agents-md/render.ts +0 -150
  25. package/src/agents-md/subprocess-entry.ts +0 -92
  26. package/src/agents-md/subprocess-runner.ts +0 -111
  27. package/src/agents-md/write.ts +0 -38
  28. package/src/agents-md/zod-to-json-schema.ts +0 -18
  29. package/src/ai/context.ts +0 -72
  30. package/src/ai/define.ts +0 -15
  31. package/src/ai/errors.ts +0 -51
  32. package/src/ai/index.ts +0 -36
  33. package/src/ai/middleware.ts +0 -21
  34. package/src/ai/registry.ts +0 -96
  35. package/src/ai/run.ts +0 -185
  36. package/src/ai/scan.ts +0 -42
  37. package/src/ai/stream.ts +0 -71
  38. package/src/ai/triggers.ts +0 -124
  39. package/src/ai/types.ts +0 -67
  40. package/src/ai/validate.ts +0 -82
  41. package/src/build/assets.ts +0 -48
  42. package/src/build/client-entry.ts +0 -43
  43. package/src/build/css.ts +0 -102
  44. package/src/build/embedded.ts +0 -66
  45. package/src/build/hash.ts +0 -21
  46. package/src/build/index.ts +0 -480
  47. package/src/build/macros/agents-hash.macro.ts +0 -9
  48. package/src/build/macros/agents.macro.ts +0 -21
  49. package/src/build/macros/env.macro.ts +0 -25
  50. package/src/build/macros/inline-assets.macro.ts +0 -28
  51. package/src/build/macros/manifest.macro.ts +0 -8
  52. package/src/build/macros/routes.macro.ts +0 -10
  53. package/src/build/page-entry.ts +0 -136
  54. package/src/build/scan-islands.ts +0 -39
  55. package/src/build/server-entry.ts +0 -256
  56. package/src/cli/ansi.ts +0 -41
  57. package/src/cli/build.ts +0 -195
  58. package/src/cli/commands/add/apply.ts +0 -31
  59. package/src/cli/commands/add/component-diff.ts +0 -116
  60. package/src/cli/commands/add/diff.ts +0 -153
  61. package/src/cli/commands/add/internal.ts +0 -41
  62. package/src/cli/commands/add/load-catalog.ts +0 -22
  63. package/src/cli/commands/add/peer-deps.ts +0 -115
  64. package/src/cli/commands/add/registry-fetch.ts +0 -122
  65. package/src/cli/commands/add/shadcn.ts +0 -285
  66. package/src/cli/commands/add/source.ts +0 -273
  67. package/src/cli/commands/add/stamper.ts +0 -73
  68. package/src/cli/commands/add/tokens.ts +0 -81
  69. package/src/cli/commands/add/ui-paths.ts +0 -113
  70. package/src/cli/commands/add.ts +0 -427
  71. package/src/cli/commands/deploy.ts +0 -143
  72. package/src/cli/commands/migrate.ts +0 -149
  73. package/src/cli/commands/secret.ts +0 -316
  74. package/src/cli/commands/ui/build.ts +0 -111
  75. package/src/cli/commands/ui/init.ts +0 -135
  76. package/src/cli/commands/ui/migrate/git-guard.ts +0 -19
  77. package/src/cli/commands/ui/migrate/radix.ts +0 -67
  78. package/src/cli/commands/ui/migrate/rtl.ts +0 -148
  79. package/src/cli/commands/ui/shadcn.ts +0 -82
  80. package/src/cli/commands/ui/view.ts +0 -63
  81. package/src/cli/commands/ui.ts +0 -86
  82. package/src/cli/commands/update.ts +0 -134
  83. package/src/cli/commands/upgrade.ts +0 -53
  84. package/src/cli/commands/view.ts +0 -34
  85. package/src/cli/dev.ts +0 -393
  86. package/src/cli/doctor/config-checks.ts +0 -63
  87. package/src/cli/doctor/deps.ts +0 -295
  88. package/src/cli/doctor/hydrate.ts +0 -65
  89. package/src/cli/doctor/monorepo.ts +0 -158
  90. package/src/cli/doctor/probes.ts +0 -16
  91. package/src/cli/doctor/report.ts +0 -72
  92. package/src/cli/doctor/toolchain.ts +0 -95
  93. package/src/cli/doctor/types.ts +0 -36
  94. package/src/cli/doctor.ts +0 -127
  95. package/src/cli/index.ts +0 -168
  96. package/src/cli/log.ts +0 -135
  97. package/src/cli/run/affected.ts +0 -79
  98. package/src/cli/run/cache-key.ts +0 -177
  99. package/src/cli/run/cache-store.ts +0 -0
  100. package/src/cli/run/files.ts +0 -96
  101. package/src/cli/run/git.ts +0 -13
  102. package/src/cli/run/runner.ts +0 -189
  103. package/src/cli/run/workspace.ts +0 -216
  104. package/src/cli/run.ts +0 -184
  105. package/src/cli/start.ts +0 -99
  106. package/src/cli/update-check.ts +0 -157
  107. package/src/client/index.ts +0 -65
  108. package/src/client/link.tsx +0 -61
  109. package/src/client/page.ts +0 -250
  110. package/src/config/define.ts +0 -5
  111. package/src/config/env.ts +0 -36
  112. package/src/config/load.ts +0 -152
  113. package/src/config/schema.ts +0 -135
  114. package/src/config/secrets.ts +0 -108
  115. package/src/dev/client.ts +0 -112
  116. package/src/dev/hot.ts +0 -24
  117. package/src/dev/index.ts +0 -4
  118. package/src/dev/tree.ts +0 -95
  119. package/src/dev/watcher.ts +0 -95
  120. package/src/internal/hmr-client.ts +0 -52
  121. package/src/internal/open-in-editor.ts +0 -23
  122. package/src/internal/runtime.ts +0 -30
  123. package/src/middleware/cookie-jar.ts +0 -135
  124. package/src/middleware/cookies.ts +0 -60
  125. package/src/middleware/index.ts +0 -127
  126. package/src/middleware/request-id.ts +0 -22
  127. package/src/middleware/response-helpers.ts +0 -25
  128. package/src/plugin/index.ts +0 -109
  129. package/src/render/bootstrap.ts +0 -44
  130. package/src/render/dev-error.tsx +0 -73
  131. package/src/render/index.tsx +0 -261
  132. package/src/render/island.tsx +0 -33
  133. package/src/render/meta.tsx +0 -48
  134. package/src/render/shell.tsx +0 -41
  135. package/src/router/conflict.ts +0 -20
  136. package/src/router/filesystem.ts +0 -37
  137. package/src/router/index.ts +0 -247
  138. package/src/router/match.ts +0 -91
  139. package/src/router/pattern.ts +0 -88
  140. package/src/server/index.ts +0 -250
  141. package/src/server/inline-assets.ts +0 -39
  142. package/src/types.ts +0 -53
  143. package/src/ui/schema.ts +0 -68
  144. package/src/ui/types.ts +0 -10
  145. package/templates/_internal/cn.ts +0 -6
  146. package/templates/_internal/slot.ts +0 -50
  147. package/templates/_internal/variants.ts +0 -1
  148. package/templates/themes/neutral/tokens.css +0 -46
  149. package/templates/themes/slate/tokens.css +0 -46
  150. package/templates/themes/stone/tokens.css +0 -46
  151. package/templates/themes/zinc/tokens.css +0 -46
  152. package/templates/tokens.css +0 -46
package/CHANGELOG.md CHANGED
@@ -1,123 +1,13 @@
1
1
  # sordo
2
2
 
3
- ## 0.4.0
3
+ ## 1.0.0
4
4
 
5
- ### Minor Changes
5
+ ### Major Changes
6
6
 
7
- - 5ebcc79: Edge: expose Worker bindings and `waitUntil` on `SordoContext` (`ctx.bindings`, typed via the augmentable `SordoBindings`), merge Worker string vars into `ctx.env`, and add `adapter.edge.assets: "external"` to emit client assets to `worker-assets/` instead of inlining them. `sordo build` warns when `worker.js` nears Cloudflare's size limit.
8
-
9
- Document the manual Cloudflare Workers deploy recipe (`wrangler deploy` against `worker.js`) in the README, and note in the `sordo deploy` hint that `@sordo/deploy-cloudflare` is not yet published.
10
-
11
- ### Patch Changes
12
-
13
- - b266211: New `@sordo/deploy-cloudflare` deploy plugin: `sordo deploy --target edge` runs `wrangler deploy` against the edge build, generating a minimal Wrangler config when the project has none. The README now documents the plugin and the manual Wrangler path (`.sordo/worker.js`, `bun run build`, external assets served under `/_sordo/assets/`), and the `sordo deploy` hint no longer calls the plugin unpublished.
14
-
15
- ## 0.3.0
16
-
17
- ### Minor Changes
18
-
19
- - 0f36821: Add an optional `css` build entry. Set `css: "app/styles/app.css"` (or `{ entry, tailwind }`) in `sordo.config.ts` and `sordo build` / the dev client compile it with `Bun.build` into a content-hashed sheet under `/_sordo/client/`, record it as `manifest.css`, and link it from every rendered page. The bun and edge servers serve the sheet from the bundle. Entries that `@import "tailwindcss"` load `bun-plugin-tailwind` (an optional peer dependency: `bun add -D bun-plugin-tailwind`). Apps without the option build exactly as before.
20
-
21
- ### Patch Changes
22
-
23
- - 62a3969: Production servers now serve the app's client code. A non-compiled `bun` build and the `edge` worker serve every `/_sordo/client/*` output (island and page chunks, the CSS sheet and its assets) from bytes inlined at build time, so islands and hydrated pages hydrate in production. Before, only `--compile` builds served them, and every other build returned 404. Adds `sordo start`, which runs the last build's server (the compiled binary when there is one) and accepts `--port` / `--out`; scaffolded apps' `bun run start` already calls it. The built bun server now honours `PORT`.
24
-
25
- ## 0.2.0
26
-
27
- ### Minor Changes
28
-
29
- - c5c1020: Remove the `patties-ui` package and its built-in 60-component catalog. `sordo add` now takes upstream shadcn/ui (`@shadcn/<name>`), local paths, URLs, and `ui.registries`; `sordo add <name>` for a non-catalog name points at `@shadcn/<name>`. The registry schema, `_internal` helpers, tokens, and theme presets now ship inside `sordo`, so `bun add -D patties-ui` is no longer needed. Scaffolded apps no longer depend on `patties-ui`.
30
- - a50617f: `sordo add @shadcn/<name>` stamps upstream shadcn/ui verbatim: registry items are mapped onto the existing add pipeline (import alias rewrite, transitive registry deps, pinned peer deps, `cssVars` token merge, schema validation, HTTPS-only, never installs). `sordo ui init --shadcn` wires the `@/*` alias and `app/lib/utils.ts`. The registry `ComponentFileSchema` gains an optional `root` (`components` | `app`) for files stamped into `app/{components,hooks,lib}`; the stamper refuses any other app-dir destination.
31
- - a50617f: Add opt-in whole-tree page hydration (`export const hydrate = true`, or `render: { hydrate: "pages" }`): the page's whole React tree hydrates as one root from a `__sordo_bootstrap` payload, so function props and shared context work. Pages can export `loader(req, ctx)` (plus optional `serialize`/`deserialize`); server-only exports are stripped from client bundles. Adds client-side navigation between hydrated pages (`Link`, `navigate`, `prefetch` from `sordo/client`), per-route client-bytes reporting in `sordo build`, and a `sordo doctor` check for pages mixing `<Island>` with `hydrate`. Client bundles now define `NODE_ENV`, so production builds ship React's production build. Routes without `hydrate` are unchanged.
32
-
33
- ### Patch Changes
34
-
35
- - 36541a8: `sordo dev` no longer misses a newly added or deleted route when the file watcher drops its event; the app tree is also rescanned every second, so the server restarts within about a second instead of serving a stale route table.
36
- - 089cb1a: Fix the `edge` target crashing every request with `Bun is not defined` / `process is not defined` on workerd. Cookies fall back to a small built-in jar when `Bun.CookieMap` is absent, and env / cwd / semver lookups no longer assume `Bun` or `process` exist.
37
-
38
- ## 0.1.0
39
-
40
- ### Minor Changes
41
-
42
- - 748b2d7: Add `sordo run <task>`: a Bun-native task runner with a content-addressed
43
- output cache and affected detection for workspace monorepos.
44
-
45
- `sordo run` wraps each `(package, task)` unit with a cache built entirely on
46
- Bun builtins (`Bun.CryptoHasher`, `Bun.Glob`, `Bun.Archive`, `bun:sqlite`,
47
- `Bun.$`, `Bun.spawn`) — no Turborepo/Nx. It walks the workspace in topological
48
- order, computes a conservative nine-component sha256 cache key per task, and on a
49
- hit restores the task's declared outputs and replays its log instead of
50
- re-running. A leaf change rebuilds exactly it and its transitive dependents;
51
- everything else restores from cache.
52
-
53
- Declare per-task `inputs` / `outputs` / `env` / `cache` in a `tasks` block in
54
- `sordo.config.ts`. Flags: `--filter`, `--affected --since <ref>`, `--no-cache`,
55
- `--force`, and `--dry-run` (which explains every hit/miss and why a key changed).
56
- `sordo dev` / `build` are unchanged. Remote caching (`--remote`) is reserved
57
- for a later release.
58
-
59
- - b893f36: Add `sordo doctor`: a read-only project hygiene report. Runs and contextualizes `bun audit` / `bun outdated`, adds sordo-specific checks (config validity, single-React invariant in monorepos), and prints one aligned report with a concrete remedy per finding. Composed from Bun builtins (`Bun.which`, `Bun.$`, `Bun.stringWidth`/`stripANSI`/`wrapAnsi`). Exit codes: 0 pass / 1 fail / 2 cannot-run.
60
-
61
- ### Patch Changes
62
-
63
- - ffa0b2b: Add an "update available" banner and a `sordo upgrade` command.
64
-
65
- The CLI now prints a cached, channel-aware banner on startup when a newer
66
- `sordo` is published, and `sordo upgrade` bumps the project's dependency to
67
- the newest release on its channel (`bun add sordo@<latest|next|…>`). The
68
- banner reads from a local cache and refreshes in the background, so it never
69
- blocks the CLI; opt out with `--no-update-check` or `NO_UPDATE_NOTIFIER`.
70
-
71
- - ffa0b2b: Make dev-server bin + React resolution workspace-aware so Bun-workspace monorepos (hoisted root `node_modules`) load a single copy of React and don't crash SSR with "Invalid hook call". Flat-app resolution is unchanged.
72
- - a99d1bf: Make `patties-ui` truly optional at the CLI: the `add` / `ui` / `view` /
73
- `update` catalog commands (the only modules that import `patties-ui`) are now
74
- lazy-loaded in the command dispatcher, so `sordo dev` / `build` / `deploy` /
75
- `secret` no longer fail with "Cannot find module 'patties-ui/schema'" in
76
- projects that don't depend on the UI catalog (e.g. backend or `--no-ui`
77
- projects scaffolded by create-sordo).
78
-
79
- ## 0.0.12-next.0
80
-
81
- ### Patch Changes
82
-
83
- - ffa0b2b: Add an "update available" banner and a `sordo upgrade` command.
84
-
85
- The CLI now prints a cached, channel-aware banner on startup when a newer
86
- `sordo` is published, and `sordo upgrade` bumps the project's dependency to
87
- the newest release on its channel (`bun add sordo@<latest|next|…>`). The
88
- banner reads from a local cache and refreshes in the background, so it never
89
- blocks the CLI; opt out with `--no-update-check` or `NO_UPDATE_NOTIFIER`.
90
-
91
- - ffa0b2b: Make dev-server bin + React resolution workspace-aware so Bun-workspace monorepos (hoisted root `node_modules`) load a single copy of React and don't crash SSR with "Invalid hook call". Flat-app resolution is unchanged.
92
- - a99d1bf: Make `patties-ui` truly optional at the CLI: the `add` / `ui` / `view` /
93
- `update` catalog commands (the only modules that import `patties-ui`) are now
94
- lazy-loaded in the command dispatcher, so `sordo dev` / `build` / `deploy` /
95
- `secret` no longer fail with "Cannot find module 'patties-ui/schema'" in
96
- projects that don't depend on the UI catalog (e.g. backend or `--no-ui`
97
- projects scaffolded by create-sordo).
98
-
99
- ## 0.0.8
100
-
101
- ### Patch Changes
102
-
103
- - 67ab8ce: Internal: move framework source from the repo root into
104
- `packages/sordo/` so the framework participates in changesets-managed
105
- releases. The repo root is now a private workspace shell; both
106
- `sordo` and `create-sordo` live under `packages/*` and are
107
- discovered uniformly by changesets and `bun --filter`.
108
-
109
- No public API changes. The published tarball still ships `src/`,
110
- `bin/`, `AGENTS.md`, `README.md`, and `CHANGELOG.md` at the same
111
- relative paths inside the package.
112
-
113
- ## 0.0.3
114
-
115
- ### Patch Changes
116
-
117
- - Ship phase 4: plugin system (`sordo/plugin` subpath). Adds `definePlugin`, `PluginServer.route`/`use`, `Bun.semver`-based compat checks, and hooks for build, dev, agents-md, and jobs.
118
-
119
- ## 0.0.1
7
+ - 7f48eb7: The framework now publishes as `@sordo/core` and the scaffolder as `@sordo/create`; `sordo` and `create-sordo` remain as thin re-export shims for a deprecation window. Imports change from `sordo/*` to `@sordo/core/*` (run `sordo migrate scope` to rewrite imports and `package.json`), and `sordo upgrade` now tracks `@sordo/core`. The `sordo` CLI binary keeps its name.
120
8
 
121
9
  ### Patch Changes
122
10
 
123
- - Initial release.
11
+ - Updated dependencies [b9a7257]
12
+ - Updated dependencies [7f48eb7]
13
+ - @sordo/core@1.0.0
package/README.md CHANGED
@@ -1,181 +1,14 @@
1
- <p align="center">
2
- <img src="./sordo-banner.png" alt="Bun + Sordo" />
3
- </p>
1
+ # sordo (deprecated)
4
2
 
5
- # Bun + Sordo
3
+ This package is a thin alias of [`@sordo/core`](https://www.npmjs.com/package/@sordo/core). It re-exports every
4
+ subpath (`sordo/config`, `sordo/plugin`, …) and the `sordo` CLI so existing apps keep working during the
5
+ deprecation window. It will be marked deprecated on npm and then removed.
6
6
 
7
- Sordo is a Bun-native full-stack meta-framework with React for UI and `Bun.serve` for HTTP. It is intentionally built around Bun primitives — `Bun.serve`, `Bun.Glob`, `Bun.build`, `bun --hot` — rather than as a Node-era framework with a Bun adapter. The goal is a smaller, more legible architecture that treats Bun as the foundation instead of a faster place to run old assumptions.
8
-
9
- ## Quick start
10
-
11
- ```sh
12
- bunx create-sordo@latest my-app
13
- cd my-app
14
- bunx sordo dev
15
- ```
16
-
17
- By default the scaffold includes a `CLAUDE.md` for Claude Code (rules +
18
- auto-generated manifest fenced into a marked section). Pick a different
19
- agent platform with `--template`:
20
-
21
- ```sh
22
- bunx create-sordo@latest my-app --template codex # .codex/ + AGENTS.md
23
- bunx create-sordo@latest my-app --template none # no agent file
24
- ```
25
-
26
- ## Manual setup
27
-
28
- ```sh
29
- bun add sordo react react-dom
30
- ```
31
-
32
- ```ts
33
- import { setupDevClient } from "sordo/dev"
34
- import { createRenderer } from "sordo/render"
35
- import { createRouter } from "sordo/router"
36
- import { startServer } from "sordo/server"
37
-
38
- const appDir = import.meta.dir + "/app"
39
- const devClient = await setupDevClient({ appDir })
40
- const renderer = createRenderer({ manifest: devClient.manifest, dev: true })
41
- const { routes, fallback } = await createRouter({ appDir, renderer })
42
-
43
- startServer({
44
- routes: { ...devClient.routes, ...routes },
45
- fallback,
46
- dev: true,
47
- })
48
- ```
49
-
50
- Drop files into `app/routes/` for pages and API handlers, and into
51
- `app/islands/` for components you want hydrated on the client. Wrap each
52
- island use site in `<Island name="MyIsland">…</Island>` (from
53
- `sordo/render`) so the SSR markers are emitted and the client runtime
54
- hydrates them.
55
-
56
- ## Agent manifest
57
-
58
- `sordo dev` / `sordo build` regenerate a route + island + agent +
59
- tool + job + middleware + env inventory. It's spliced between
60
- `<!-- sordo:manifest-start -->` … `<!-- sordo:manifest-end -->` so
61
- rules and notes above the section are preserved across regenerations.
62
- Default target is `CLAUDE.md`; override with `config.agentsMd.path`
63
- (string or `string[]`) in `sordo.config.ts`.
64
-
65
- ## CLI
66
-
67
- ```sh
68
- sordo dev # bun --hot dev server (use --cold for bun --watch)
69
- sordo build # production bundle
70
- sordo build --target edge
71
- sordo deploy # build then dispatch to an installed deploy plugin
72
- sordo secret # manage dev-time secrets in the OS keychain
73
- ```
74
-
75
- On `--target edge`, client chunks and CSS are inlined into `dist/worker.js` by
76
- default. Set `adapter: { edge: { assets: "external" } }` to write them (and
77
- `public/`) to `dist/worker-assets/` instead — URL paths mirror the directory,
78
- with a `_headers` file and `manifest.json` — and upload that directory as
79
- Workers static assets. `sordo build` warns when `worker.js` nears the 3 MB gz
80
- free-plan limit.
81
-
82
- ### Deploying to Cloudflare Workers
83
-
84
- Install the deploy plugin and let `sordo deploy` build and ship the Worker:
7
+ ## Migrate
85
8
 
86
9
  ```sh
87
- bun add -d @sordo/deploy-cloudflare
10
+ bun remove sordo && bun add @sordo/core
88
11
  ```
89
12
 
90
- ```ts
91
- // sordo.config.ts
92
- import { defineConfig } from "sordo/config";
93
- import { cloudflare } from "@sordo/deploy-cloudflare";
94
-
95
- export default defineConfig({
96
- target: "edge",
97
- plugins: [cloudflare({ name: "my-site" })],
98
- });
99
- ```
100
-
101
- ```sh
102
- bunx wrangler login
103
- bun run build # scaffolded apps generate CSS first, then build
104
- sordo deploy --target edge
105
- ```
106
-
107
- With no `wrangler.jsonc`/`wrangler.toml` in the project the plugin generates
108
- `.sordo/wrangler.generated.jsonc`; add your own to control bindings, routes or
109
- vars. See the plugin README for options (`wranglerEnv`, `dryRun`, `args`).
110
-
111
- #### Manual path (no plugin)
112
-
113
- Sordo emits no `wrangler.jsonc` — you own it. `sordo build --target edge` writes
114
- `.sordo/worker.js` (default `outDir` is `./.sordo`, not `dist/`). Scaffolded
115
- apps generate Tailwind CSS in their `build` script, so use `bun run build`
116
- rather than calling `sordo build` directly.
117
-
118
- ```sh
119
- bun run build
120
- bunx wrangler deploy # reads wrangler.jsonc
121
- ```
122
-
123
- ```jsonc
124
- // wrangler.jsonc
125
- {
126
- "name": "my-site",
127
- "main": ".sordo/worker.js",
128
- "compatibility_date": "2026-01-01",
129
- "services": [{ "binding": "CMS", "service": "my-cms-worker" }]
130
- // only with adapter.edge.assets: "external":
131
- // "assets": { "directory": ".sordo/worker-assets" }
132
- }
133
- ```
134
-
135
- Secrets: `bunx wrangler secret put NAME`. Handlers read them as `ctx.env.NAME`
136
- and read bindings (service, KV, R2, D1) from `ctx.bindings`; `ctx.waitUntil(p)`
137
- extends the request. Type bindings by augmenting the interface:
138
-
139
- ```ts
140
- declare module "sordo" {
141
- interface SordoBindings {
142
- CMS: { fetch: typeof fetch };
143
- }
144
- }
145
- ```
146
-
147
- By default `worker.js` is self-contained (client chunks and CSS are inlined), so
148
- `main` is the only file Wrangler needs. With `adapter.edge.assets: "external"`
149
- also set `assets.directory`; files from `app/public/` are then served at
150
- `/_sordo/assets/<name>` (not at `/<name>`). Only `config.env.public` values are
151
- inlined at build; secrets never are.
152
-
153
- UI components (upstream shadcn/ui, local paths, or registries):
154
-
155
- ```sh
156
- sordo ui init # scaffold tokens + _internal helpers (once)
157
- sordo add @shadcn/button # stamp components into app/components/ui/
158
- sordo view button # print a component's source before stamping
159
- sordo update button # re-stamp from the catalog after showing the diff
160
- sordo migrate # codemods: radix imports / RTL logical properties
161
- sordo ui build # emit a fetchable registry.json (for registry authors)
162
- ```
163
-
164
- See `sordo --help` for all flags.
165
-
166
- ## What's in the box
167
-
168
- - Filesystem routing compiled to Bun route patterns
169
- - React server rendering via `renderToReadableStream`
170
- - Client islands with on-demand hydration
171
- - HMR over a small WebSocket layer
172
- - Build pipeline that inlines route + island manifests for portable Bun / edge output
173
- - Single-file `--compile` binaries (`adapter.bun.compile`) with app/public + client chunks embedded via `Bun.embeddedFiles` — no `dist/` sidecar to ship
174
- - Per-request correlation IDs on `ctx.requestId`, echoed as `X-Request-Id`; dev responses also carry `Server-Timing: total;dur=<ms>`
175
- - Middleware composition, typed context, config + secrets loading
176
- - Optional AI primitives (agents, tools, jobs) and agent-manifest generation (default `CLAUDE.md`, configurable)
177
- - Plugin system
178
-
179
- ## Background
180
-
181
- Read the longer write-up: [_Bun, Patties, and Fries: A Complete Meal for the Bun-Native Web Stack_](https://medium.com/bihaviour/bun-patties-and-fries-a-complete-meal-for-the-bun-native-web-stack-01bcf977f564).
13
+ Then rewrite imports from `sordo/*` to `@sordo/core/*` (`sordo migrate scope` does this for you). The `sordo`
14
+ CLI binary keeps its name.
package/bin/sordo.ts CHANGED
@@ -1,5 +1,2 @@
1
1
  #!/usr/bin/env bun
2
- import { main } from "../src/cli/index.ts";
3
-
4
- const code = await main(process.argv.slice(2));
5
- if (code !== null) process.exit(code);
2
+ import "@sordo/core/bin";
package/package.json CHANGED
@@ -1,27 +1,27 @@
1
1
  {
2
2
  "name": "sordo",
3
- "version": "0.4.0",
4
- "description": "Bun-native full-stack meta-framework with React rendering",
3
+ "version": "1.0.0",
4
+ "description": "Deprecated alias of @sordo/core. Re-exports the framework and its `sordo` CLI.",
5
5
  "repository": {
6
6
  "type": "git",
7
7
  "url": "git+https://github.com/bihaviour/sordo.git",
8
- "directory": "packages/sordo"
8
+ "directory": "packages/sordo-compat"
9
9
  },
10
10
  "type": "module",
11
11
  "license": "MIT",
12
12
  "exports": {
13
13
  ".": "./src/index.ts",
14
- "./middleware": "./src/middleware/index.ts",
15
- "./server": "./src/server/index.ts",
16
- "./router": "./src/router/index.ts",
17
- "./render": "./src/render/index.tsx",
18
- "./client": "./src/client/index.ts",
19
- "./build": "./src/build/index.ts",
20
- "./dev": "./src/dev/index.ts",
21
- "./config": "./src/config/define.ts",
22
- "./ai": "./src/ai/index.ts",
23
- "./agents-md": "./src/agents-md/index.ts",
24
- "./plugin": "./src/plugin/index.ts"
14
+ "./middleware": "./src/middleware.ts",
15
+ "./server": "./src/server.ts",
16
+ "./router": "./src/router.ts",
17
+ "./render": "./src/render.ts",
18
+ "./client": "./src/client.ts",
19
+ "./build": "./src/build.ts",
20
+ "./dev": "./src/dev.ts",
21
+ "./config": "./src/config.ts",
22
+ "./ai": "./src/ai.ts",
23
+ "./agents-md": "./src/agents-md.ts",
24
+ "./plugin": "./src/plugin.ts"
25
25
  },
26
26
  "bin": {
27
27
  "sordo": "bin/sordo.ts"
@@ -29,42 +29,18 @@
29
29
  "files": [
30
30
  "bin",
31
31
  "src",
32
- "templates",
33
- "CLAUDE.md",
34
32
  "README.md",
35
33
  "CHANGELOG.md"
36
34
  ],
37
35
  "scripts": {
38
36
  "test": "bun test",
39
37
  "typecheck": "tsc --noEmit",
40
- "lint": "biome check .",
41
- "generate:agents-md": "bun run scripts/generate-agents-md.ts"
42
- },
43
- "peerDependencies": {
44
- "react": "^19.0.0",
45
- "react-dom": "^19.0.0",
46
- "@anthropic-ai/sdk": "^0.30.0",
47
- "bun-plugin-tailwind": ">=0.1.0"
48
- },
49
- "peerDependenciesMeta": {
50
- "@anthropic-ai/sdk": {
51
- "optional": true
52
- },
53
- "bun-plugin-tailwind": {
54
- "optional": true
55
- }
38
+ "lint": "biome check ."
56
39
  },
57
40
  "dependencies": {
58
- "zod": "^4.4.3"
41
+ "@sordo/core": "^1.0.0"
59
42
  },
60
- "devDependencies": {
61
- "@happy-dom/global-registrator": "^15.0.0",
62
- "@types/react": "^19.0.0",
63
- "@types/react-dom": "^19.0.0",
64
- "class-variance-authority": "^0.7.0",
65
- "cn": "^0.5.0",
66
- "lucide-react": "^1.59.0",
67
- "radix-ui": "^1.8.1",
43
+ "peerDependencies": {
68
44
  "react": "^19.0.0",
69
45
  "react-dom": "^19.0.0"
70
46
  },
@@ -0,0 +1 @@
1
+ export * from "@sordo/core/agents-md";
package/src/ai.ts ADDED
@@ -0,0 +1 @@
1
+ export * from "@sordo/core/ai";
package/src/build.ts ADDED
@@ -0,0 +1 @@
1
+ export * from "@sordo/core/build";
package/src/client.ts ADDED
@@ -0,0 +1 @@
1
+ export * from "@sordo/core/client";
package/src/config.ts ADDED
@@ -0,0 +1 @@
1
+ export * from "@sordo/core/config";
package/src/dev.ts ADDED
@@ -0,0 +1 @@
1
+ export * from "@sordo/core/dev";
package/src/index.ts CHANGED
@@ -1,55 +1 @@
1
- export { generateAgentsMd } from "./agents-md/generate.ts";
2
- export type { CreateAiContextOptions } from "./ai/context.ts";
3
- export type {
4
- AgentConfig,
5
- AgentRunResult,
6
- AiContext,
7
- AnthropicLike,
8
- JobConfig,
9
- RegisteredAgent,
10
- RegisteredJob,
11
- RegisteredTool,
12
- ToolConfig,
13
- } from "./ai/types.ts";
14
- export type {
15
- BuildOptions,
16
- BuildResult,
17
- BuiltAsset,
18
- ClientManifest as BuildClientManifest,
19
- } from "./build/index.ts";
20
- export { build } from "./build/index.ts";
21
- export { defineConfig } from "./config/define.ts";
22
- export { getEnv, MissingEnv, validateRequiredEnv } from "./config/env.ts";
23
- export { loadConfig } from "./config/load.ts";
24
- export type { SordoConfig, SordoConfigInput } from "./config/schema.ts";
25
- export { SordoConfigSchema } from "./config/schema.ts";
26
- export { loadSecrets } from "./config/secrets.ts";
27
- export type {
28
- Handler,
29
- Middleware,
30
- SordoBindings,
31
- SordoContext,
32
- } from "./middleware/index.ts";
33
- export { compose, defineMiddleware, makeContext } from "./middleware/index.ts";
34
- export type {
35
- AgentsMdDocument,
36
- JobSummary,
37
- Plugin,
38
- PluginContext,
39
- PluginHooks,
40
- PluginLogger,
41
- PluginServer,
42
- } from "./plugin/index.ts";
43
- export { assertPluginCompat, definePlugin } from "./plugin/index.ts";
44
- export type {
45
- ClientManifest,
46
- Renderer,
47
- RenderOptions,
48
- } from "./render/index.tsx";
49
- export { createRenderer } from "./render/index.tsx";
50
- export { scanRoutes } from "./router/filesystem.ts";
51
- export type { CompiledRouter, RouterOptions } from "./router/index.ts";
52
- export { createRouter } from "./router/index.ts";
53
- export type { ServerHandle, ServerOptions } from "./server/index.ts";
54
- export { createServer, startServer } from "./server/index.ts";
55
- export type { BunRoutes, HTTPMethod, RouteEntry, Segment } from "./types.ts";
1
+ export * from "@sordo/core";
@@ -0,0 +1 @@
1
+ export * from "@sordo/core/middleware";
package/src/plugin.ts ADDED
@@ -0,0 +1 @@
1
+ export * from "@sordo/core/plugin";
package/src/render.ts ADDED
@@ -0,0 +1 @@
1
+ export * from "@sordo/core/render";
package/src/router.ts ADDED
@@ -0,0 +1 @@
1
+ export * from "@sordo/core/router";
package/src/server.ts ADDED
@@ -0,0 +1 @@
1
+ export * from "@sordo/core/server";
package/CLAUDE.md DELETED
@@ -1,124 +0,0 @@
1
- # `sordo` package conventions
2
-
3
- This is the framework itself — the runtime, CLI, build pipeline, dev server,
4
- renderer, router, middleware, and adapters. Most things you'd add to a
5
- Bun-native full-stack framework live somewhere under `src/`.
6
-
7
- Project-wide rules live in `../../CLAUDE.md`. Read those first. The notes
8
- below are specific to working inside this package.
9
-
10
- ## Source layout
11
-
12
- - `src/router/` — filesystem route scan + compile to Bun route patterns
13
- - `src/render/` — React SSR (`renderToReadableStream`) + dev error overlay + island marker emission
14
- - `src/client/` — browser hydration runtime: scans `[data-island]` markers; `page.ts` boots whole-tree hydrated pages (`export const hydrate = true`) and drives client-side navigation (`Link` / `navigate`) from the `__sordo_bootstrap` payload (framework specs 28/29)
15
- - `src/build/` — route + island scan, client/server entry generation, `Bun.build` pipeline. Hydrated pages get a generated per-route entry (`page-entry.ts`) bundled in the same split build as islands; `loader`/`serialize` are stripped from client bundles via `Bun.Transpiler` export elimination. `adapter.bun.compile` (production) runs `bun build --compile` against the generated server-entry SOURCE and embeds app/public + client chunks via `with { type: "file" }` / `Bun.embeddedFiles`; `--compile` with `--target edge` is a config-time error. An optional `css` config entry is built by `css.ts` into a hashed sheet under `client/`, recorded as `manifest.css` (the renderer links it), and inlined into the bun/edge server bundle via `inline-assets.macro.ts`; Tailwind entries load `bun-plugin-tailwind` (optional peer) by dynamic import
16
- - `src/middleware/` — composition, `SordoContext`. `request-id.ts` mints `ctx.requestId` (echoed as `X-Request-Id`, inbound junk ignored); the router finalizer folds in the cookie flush and dev-only `Server-Timing`
17
- - `src/dev/` — `bun --hot` / `bun --watch` integration, HMR WebSocket, `setupDevClient` (bundles islands in dev and serves `/_sordo/client/*`)
18
- - `src/server/` — `startServer` / `createServer` around `Bun.serve`
19
- - `src/config/` — `defineConfig`, env + secrets loading, Zod schemas. `config.agentsMd.path` (string or string[]) picks where the manifest lands; default is `CLAUDE.md`
20
- - `src/ai/` — optional agents / tools / jobs primitives (Anthropic SDK is an optional peer dep)
21
- - `src/agents-md/` — manifest generator + `writeManifestToFile` (splices into a fenced section so rules around it survive regeneration)
22
- - `src/plugin/` — plugin system
23
- - `src/adapters/` — `bun` and `edge` runtime adapters
24
-
25
- ## Public entry points
26
-
27
- Declared in `package.json#exports`:
28
-
29
- `sordo`, `sordo/router`, `sordo/render`, `sordo/client`,
30
- `sordo/build`, `sordo/dev`, `sordo/config`, `sordo/middleware`,
31
- `sordo/server`, `sordo/ai`, `sordo/agents-md`, `sordo/plugin`.
32
-
33
- CLI at `bin/sordo.ts` → `src/cli/index.ts` (`dev` / `build` / `start` / `run` / `deploy` / `secret` / `doctor` / `add` / `ui` / `view` / `update` / `upgrade` / `migrate`). `run` is the opt-in monorepo task orchestrator: `sordo run <task>` wraps each workspace `(package, task)` unit with a content-addressed output cache + affected detection (`src/cli/run.ts` + `src/cli/run/`, framework spec 27). Its cache is 100% Bun builtins (`Bun.CryptoHasher` sha256 key, `Bun.Glob`, `Bun.Archive` tarballs, `bun:sqlite` WAL index, `Bun.$` git, `Bun.spawn`); per-task `inputs`/`outputs`/`env`/`cache` come from a `tasks` block in `sordo.config.ts`. `sordo add <component>` stamps UI source (upstream shadcn/ui via `@shadcn/<name>`) into `app/components/ui/` (it also resolves local paths, https URLs, and `@ns/<name>` namespaced registries); `ui init` scaffolds tokens + helpers, `ui build` emits a fetchable registry, `view`/`update` preview-then-stamp, and `migrate` codemods radix imports / RTL logical props. See `src/cli/commands/` and `.claude/rules/ui-catalog.md`. `upgrade` bumps the project's `sordo` dependency to the newest release on its channel (stable→`latest`, prerelease→its pre tag); the CLI also prints a cached, channel-aware "update available" banner on startup (`src/cli/update-check.ts`, opt out with `--no-update-check` / `NO_UPDATE_NOTIFIER`). `doctor` aggregates read-only project-hygiene checks (toolchain probes, `bun audit` / `bun outdated`, lockfile sync, config + biome validity, and monorepo single-React / catalog invariants) into one aligned report with a remedy per finding and a CI exit code (`src/cli/doctor.ts` + `src/cli/doctor/`, cli spec 20); Phase 1 is report-only — no `--fix`. Width-aware output utilities live in `src/cli/ansi.ts` (`Bun.stringWidth` / `stripANSI` / `wrapAnsi`).
34
-
35
- ## Dev mode wiring
36
-
37
- `sordo dev` re-execs under `bun --hot --preserve-symlinks` and resolves the
38
- re-exec entry through the user-project copy of the bin
39
- (`<cwd>/node_modules/sordo/bin/sordo.ts` when present). This keeps module
40
- resolution rooted in the app even when `sordo` is linked from a workspace —
41
- without it, two copies of React load and SSR hooks blow up.
42
-
43
- Templates wire dev mode via `setupDevClient({ appDir })` from `sordo/dev`:
44
- it bundles islands in development, mutates a `ClientManifest` the renderer
45
- holds by reference, and returns a `BunRoutes` map for `/_sordo/client/*`.
46
- Pages emit hydration markers only when wrapped in `<Island name=…>` — direct
47
- island imports SSR fine but never hydrate.
48
-
49
- ## Tests
50
-
51
- `bun test`. Snapshot-style assertions on the agent manifest live under
52
- `tests/agents-md/`; the framework's checked-in `CLAUDE.md` manifest section
53
- is regenerated by `scripts/generate-agents-md.ts` and CI fails on drift.
54
-
55
- The manifest section below is auto-generated from
56
- `tests/fixtures/ai-app/app`. Everything between the markers is regenerated
57
- on every `sordo dev/build` (and by the script above); content outside the
58
- markers is preserved.
59
-
60
- <!-- sordo:manifest-start -->
61
- > Generated by `sordo dev/build`. Edits inside the manifest markers are overwritten; content outside is preserved.
62
-
63
- ## Route map
64
-
65
- | File | URL | Methods |
66
- |---|---|---|
67
- | tests/fixtures/ai-app/app/routes/index.tsx | / | GET |
68
-
69
- ## Islands
70
-
71
- _No islands._
72
-
73
- ## Agents
74
-
75
- | Name | Model | Tools | Triggers |
76
- |---|---|---|---|
77
- | booking | claude-sonnet-4-6 | search | POST /api/booking/chat |
78
- | concierge | claude-sonnet-4-6 | | |
79
-
80
- ## Tools
81
-
82
- ### `search`
83
-
84
- Search hotel inventory.
85
-
86
- Input schema:
87
-
88
- ```json
89
- {
90
- "additionalProperties": false,
91
- "properties": {
92
- "city": {
93
- "type": "string"
94
- },
95
- "from": {
96
- "type": "string"
97
- },
98
- "to": {
99
- "type": "string"
100
- }
101
- },
102
- "required": [
103
- "city",
104
- "from",
105
- "to"
106
- ],
107
- "type": "object"
108
- }
109
- ```
110
-
111
- ## Jobs
112
-
113
- | Name | Schedule | TZ |
114
- |---|---|---|
115
- | refresh-inventory | */15 * * * * | Asia/Makassar |
116
-
117
- ## Middleware
118
-
119
- Tracks request counts and attaches a marker for downstream handlers.
120
-
121
- ## Environment variables
122
-
123
- _No declared env vars._
124
- <!-- sordo:manifest-end -->