Skip to content

Commit 3a7560f

Browse files
authored
feat!: remove deprecated 0.7-era compat shims for 0.9 (#180)
1 parent 7c18542 commit 3a7560f

39 files changed

Lines changed: 294 additions & 467 deletions

alias.ts

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,6 @@ export const alias = {
3636
'devframe/utils/structured-clone': r('devframe/src/utils/structured-clone.ts'),
3737
'devframe/utils/when': r('devframe/src/utils/when.ts'),
3838
'devframe/adapters/cac': r('devframe/src/adapters/cac.ts'),
39-
'devframe/adapters/cli': r('devframe/src/adapters/cli.ts'),
4039
'devframe/adapters/dev': r('devframe/src/adapters/dev.ts'),
4140
'devframe/adapters/build': r('devframe/src/adapters/build.ts'),
4241
'devframe/helpers/vite': r('devframe/src/helpers/vite.ts'),
@@ -80,7 +79,6 @@ export const alias = {
8079
'@devframes/plugin-git': p('git/src/index.ts'),
8180
'devframe/recipes/interactive-auth': r('devframe/src/recipes/interactive-auth.ts'),
8281
'devframe/recipes/common-rpc-functions': r('devframe/src/recipes/common-rpc-functions.ts'),
83-
'devframe/recipes/open-helpers': r('devframe/src/recipes/open-helpers.ts'),
8482
'devframe/client': r('devframe/src/client/index.ts'),
8583
'devframe': r('devframe/src'),
8684
'@devframes/plugin-data-inspector/client': p('data-inspector/src/client/index.ts'),

docs/.vitepress/config.ts

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -146,6 +146,8 @@ export function devframeNav(prefix = ''): DefaultTheme.NavItem[] {
146146
{ text: 'Contributing', link: `${repo}/blob/main/CONTRIBUTING.md` },
147147
{
148148
items: [
149+
{ text: 'Migrating to 0.9', link: `${prefix}/guide/migration-0.9` },
150+
{ text: 'Migrating to 0.8', link: `${prefix}/guide/migration-0.8` },
149151
{ text: 'Migrating to 0.7', link: `${prefix}/guide/migration-0.7` },
150152
{ text: 'Migrating to 0.6', link: `${prefix}/guide/migration-0.6` },
151153
],

docs/adapters/cac.md

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -28,8 +28,6 @@ const devframe = defineDevframe({
2828
await createCac(devframe).parse()
2929
```
3030

31-
The `devframe/adapters/cli` entry (`createCli`) remains as a deprecated alias for this module — new code should import `createCac` from `devframe/adapters/cac`.
32-
3331
Running the resulting binary:
3432

3533
```sh

docs/guide/migration-0.8.md

Lines changed: 78 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,78 @@
1+
---
2+
outline: deep
3+
---
4+
5+
# Migrating to 0.8
6+
7+
0.8 makes RPC schemas validator-neutral and validated at runtime, upgrades the MCP adapter to `@modelcontextprotocol/sdk` v2, and lands the agent-native MCP surface (`ctx.agent`, tool providers, and the `devframe connect` connector). This page covers the changes between 0.7.x and 0.8 — see the [v0.8.0 release notes](https://github.com/devframes/devframe/releases/tag/v0.8.0) for the full changelog.
8+
9+
## RPC schemas are Standard Schema and validated at runtime
10+
11+
`args` and `returns` on `defineRpcFunction` are now typed against [Standard Schema](https://standardschema.dev/) rather than valibot's `GenericSchema`. Any Standard-Schema-compliant validator works — valibot, zod, arktype — so existing valibot schemas keep compiling and inferring types unchanged.
12+
13+
Two things change in practice:
14+
15+
**Devframe no longer bundles a validator.** `valibot` was dropped from `devframe`'s runtime dependencies, so author your schemas with whichever validator you prefer and install it yourself:
16+
17+
```sh
18+
npm install valibot # or: zod / arktype
19+
```
20+
21+
If your app already pulls in zod (the JSON-render integration and the MCP server both use it), prefer zod for your RPC schemas and reuse the dependency. For first-party code that wants zero dependencies, devframe ships a minimal built-in builder at `devframe/utils/simple-schema`:
22+
23+
```ts
24+
// Bring your own validator …
25+
import { defineRpcFunction } from 'devframe'
26+
import * as v from 'valibot'
27+
28+
export const rename = defineRpcFunction({
29+
name: 'devframes:plugin:terminals:rename',
30+
type: 'action',
31+
args: [v.object({ id: v.string(), title: v.string() })],
32+
returns: v.void(),
33+
setup: ctx => ({ handler: ({ id, title }) => { /**/ } }),
34+
})
35+
```
36+
37+
```ts
38+
// … or use the built-in zero-dep builder
39+
import { defineRpcFunction } from 'devframe'
40+
import { s } from 'devframe/utils/simple-schema'
41+
42+
export const rename = defineRpcFunction({
43+
name: 'devframes:plugin:terminals:rename',
44+
type: 'action',
45+
args: [s.object({ id: s.string(), title: s.string() })],
46+
returns: s.void(),
47+
setup: ctx => ({ handler: ({ id, title }) => { /**/ } }),
48+
})
49+
```
50+
51+
**Declared schemas are now enforced.** Each argument is validated against its schema at the boundary before the handler runs, and the resolved return value is validated on the way out; a mismatch is rejected with a coded diagnostic instead of reaching (or leaving) the handler. Payloads are guarded, not rewritten — extra object fields the schema doesn't mention still reach the handler. Audit any schema that was previously more of a type hint than a contract, since inputs that used to slip through now throw.
52+
53+
See [RPC](./rpc) for the full reference.
54+
55+
## MCP adapter upgraded to `@modelcontextprotocol/sdk` v2
56+
57+
The MCP adapter now targets the v2 SDK, which ships as scoped `@modelcontextprotocol/server` and `@modelcontextprotocol/client` packages. Swap the peer dependency when you ship MCP support:
58+
59+
| 0.7.x | 0.8 |
60+
|-------|-----|
61+
| `@modelcontextprotocol/sdk@^1` | `@modelcontextprotocol/server@^2` |
62+
63+
```sh
64+
npm uninstall @modelcontextprotocol/sdk
65+
npm install @modelcontextprotocol/server
66+
```
67+
68+
`@modelcontextprotocol/server` remains an optional peer dependency, pulled in only through `devframe/adapters/mcp`. The `devframe connect` connector (below) additionally uses `@modelcontextprotocol/client` — install it too if you drive agents through the connector.
69+
70+
If you imported SDK types directly, the deep `@modelcontextprotocol/sdk/...` subpaths are now flat entries on the scoped packages (e.g. `@modelcontextprotocol/sdk/server/stdio.js``@modelcontextprotocol/server/stdio`). See [MCP](/adapters/mcp) for the adapter reference.
71+
72+
## Agent-native MCP surface
73+
74+
0.8 adds the agent host on `ctx.agent``registerTool`, `registerToolProvider`, and `registerResource` — plus an instance registry and the `devframe connect` MCP connector shipped in the `devframe` bin. These are additive; existing `agent`-flagged RPCs keep working and are projected to MCP as before.
75+
76+
One type sharpens: an RPC `handler` (and its `dump`) now returns `Thenable<returns>` — the `returns` schema describes the *resolved* value and the runtime always awaits the handler. Synchronous handlers are unaffected; an `async` handler whose declared `returns` was the unwrapped value now type-checks correctly rather than needing the promise spelled into the schema.
77+
78+
See [Agent-Native](./agent-native) for the tool/resource surface and [MCP → `devframe connect`](/adapters/mcp#discovery-devframe-connect) for the connector.

docs/guide/migration-0.9.md

Lines changed: 98 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,98 @@
1+
---
2+
outline: deep
3+
---
4+
5+
# Migrating to 0.9
6+
7+
0.9 removes the compatibility shims that were deprecated across the 0.7 series. Each removed export has a drop-in replacement that has shipped alongside it since 0.7, so migrating is a matter of updating import paths and a handful of call sites. This page covers the changes between 0.8.x and 0.9.
8+
9+
## `devframe/adapters/cli` is removed
10+
11+
The CLI adapter was renamed to `cac` in 0.7. The `devframe/adapters/cli` entry — `createCli`, `CreateCliOptions`, and `CliHandle` — is now gone. Import from `devframe/adapters/cac` instead:
12+
13+
| 0.8.x | 0.9 |
14+
|-------|-----|
15+
| `import { createCli } from 'devframe/adapters/cli'` | `import { createCac } from 'devframe/adapters/cac'` |
16+
| `CreateCliOptions` | `CreateCacOptions` |
17+
| `CliHandle` | `CacHandle` |
18+
19+
```ts
20+
// 0.8.x
21+
import { createCli } from 'devframe/adapters/cli'
22+
23+
await createCli(devframe).parse()
24+
```
25+
26+
```ts
27+
// 0.9
28+
import { createCac } from 'devframe/adapters/cac'
29+
30+
await createCac(devframe).parse()
31+
```
32+
33+
The typed-flag helpers `defineCliFlags` and `parseCliFlags` live on `devframe/adapters/cac` too. See [CLI (cac)](/adapters/cac) for the full adapter reference.
34+
35+
## `devframe/recipes/open-helpers` is removed
36+
37+
The recipe was renamed to `common-rpc-functions` in 0.7.16. Import `commonRpcFunctions` from `devframe/recipes/common-rpc-functions`:
38+
39+
```ts
40+
// 0.8.x
41+
import { openHelpers } from 'devframe/recipes/open-helpers'
42+
```
43+
44+
```ts
45+
// 0.9
46+
import { commonRpcFunctions } from 'devframe/recipes/common-rpc-functions'
47+
```
48+
49+
The `openInEditor` and `openInFinder` members are unchanged. See [Common RPC functions](/helpers/common-rpc-functions) for the full reference.
50+
51+
## RPC dump re-exports move to `devframe/rpc/dump`
52+
53+
The static-dump helpers and types are served from the dedicated `devframe/rpc/dump` entry; the aliases that re-exported them from the top-level `devframe/rpc` barrel are removed. Import them from `devframe/rpc/dump`:
54+
55+
```ts
56+
// 0.8.x
57+
import { createClientFromDump, dumpFunctions } from 'devframe/rpc'
58+
59+
// 0.9
60+
import { createClientFromDump, dumpFunctions } from 'devframe/rpc/dump'
61+
```
62+
63+
This applies to every dump export — `collectStaticRpcDump`, `createClientFromDump`, `dumpFunctions`, `getDefinitionsWithDumps`, `reviveDumpError`, `serializeDumpError`, and the `StaticRpcDump*` types.
64+
65+
## `@devframes/hub` json-render shims are removed
66+
67+
json-render moved out of the hub into the opt-in [`@devframes/json-render`](./json-render) integration in 0.7. The hub-local compatibility shims are now removed: the `defineJsonRenderSpec` helper, the `ctx.createJsonRenderer` factory, the `DevframeViewJsonRender` dock type, and the `JsonRenderSpec` / `JsonRenderElement` / `JsonRenderer` types.
68+
69+
| 0.8.x (`@devframes/hub`) | 0.9 (`@devframes/json-render`) |
70+
|---|---|
71+
| `defineJsonRenderSpec(spec)` | Pass the spec directly to `createJsonRenderView(ctx, { id, spec })` |
72+
| `ctx.createJsonRenderer(spec)` | `createJsonRenderView(ctx, { id, spec })` (from `@devframes/json-render/node`) |
73+
| `JsonRenderSpec` | `DevframeJsonRenderSpec` |
74+
| `JsonRenderElement` | element shape of `DevframeJsonRenderSpec` |
75+
| `JsonRenderer` | `JsonRenderView` |
76+
| `DevframeViewJsonRender` | `DevframeJsonRenderDockEntry` (from `@devframes/json-render/hub`) |
77+
78+
```ts
79+
// 0.8.x
80+
import { defineJsonRenderSpec } from '@devframes/hub'
81+
82+
const spec = defineJsonRenderSpec({ root: 'panel', elements: { /* ... */ } })
83+
const renderer = ctx.createJsonRenderer(spec)
84+
```
85+
86+
```ts
87+
// 0.9
88+
import { createJsonRenderView } from '@devframes/json-render/node'
89+
90+
const view = createJsonRenderView(ctx, {
91+
id: 'panel',
92+
spec: { root: 'panel', elements: { /* ... */ } },
93+
})
94+
```
95+
96+
`createJsonRenderView` returns a view carrying a serializable `ref` (a shared-state key or an inline spec). Project it onto a hub dock with `toJsonRenderDockEntry` from `@devframes/json-render/hub`, which contributes the `'json-render'` dock type to the hub's open dock union. A dock entry now carries that serializable `view` ref rather than a live renderer handle — a client reads `entry.view.stateKey` (or `entry.view.spec`) to render it.
97+
98+
See [JSON-Render](./json-render) for the full integration reference.

docs/helpers/common-rpc-functions.md

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -30,8 +30,6 @@ defineDevframe({
3030

3131
Both functions are `action`-type RPCs returning `void`, and their arguments are schema-validated — `openInEditor`'s `editor` argument is restricted to `KNOWN_EDITORS`, so a value outside that list fails validation rather than reaching the underlying `launch-editor` process spawn. Both handlers dynamically `import()` their underlying `devframe/utils/*` implementation, so the `launch-editor` and `open` dependencies only load when the recipe actually runs.
3232

33-
The `devframe/recipes/open-helpers` entry (`openHelpers`) remains as a deprecated alias for this module — new code should import `commonRpcFunctions` from `devframe/recipes/common-rpc-functions`.
34-
3533
## Pick and choose
3634

3735
Register only the helper you need rather than the whole array:

knip.jsonc

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -73,12 +73,12 @@
7373
"entry": [
7474
"src/{index,constants}.ts",
7575
"src/helpers/vite.ts",
76-
"src/adapters/{build,cac,cli,dev,embedded,initiate}.ts",
76+
"src/adapters/{build,cac,dev,embedded,initiate}.ts",
7777
"src/adapters/mcp/index.ts",
7878
"src/client/index.ts",
7979
"src/node/index.ts",
8080
"src/node/{auth,hub-internals}/index.ts",
81-
"src/recipes/{common-rpc-functions,interactive-auth,open-helpers}.ts",
81+
"src/recipes/{common-rpc-functions,interactive-auth}.ts",
8282
"src/rpc/{index,client,server}.ts",
8383
"src/rpc/dump/index.ts",
8484
"src/rpc/transports/{ws-bun,ws-client,ws-server}.ts",

packages/devframe/package.json

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,6 @@
2222
".": "./dist/index.mjs",
2323
"./adapters/build": "./dist/adapters/build.mjs",
2424
"./adapters/cac": "./dist/adapters/cac.mjs",
25-
"./adapters/cli": "./dist/adapters/cli.mjs",
2625
"./adapters/dev": "./dist/adapters/dev.mjs",
2726
"./adapters/embedded": "./dist/adapters/embedded.mjs",
2827
"./adapters/mcp": "./dist/adapters/mcp.mjs",
@@ -35,7 +34,6 @@
3534
"./node/hub-internals": "./dist/node/hub-internals.mjs",
3635
"./recipes/common-rpc-functions": "./dist/recipes/common-rpc-functions.mjs",
3736
"./recipes/interactive-auth": "./dist/recipes/interactive-auth.mjs",
38-
"./recipes/open-helpers": "./dist/recipes/open-helpers.mjs",
3937
"./rpc": "./dist/rpc/index.mjs",
4038
"./rpc/client": "./dist/rpc/client.mjs",
4139
"./rpc/dump": "./dist/rpc/dump.mjs",

packages/devframe/src/adapters/cac.ts

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -6,9 +6,6 @@
66
// without it throws at load time with the usual Node module-not-found
77
// error. The typed-flag helpers (`defineCliFlags` / `parseCliFlags`) are
88
// re-exported below so they live alongside the CLI adapter.
9-
//
10-
// The historical `devframe/adapters/cli` entry (`createCli`) re-exports
11-
// this module under deprecated aliases for backward compatibility.
129
import type { CAC } from 'cac'
1310
import type { H3 } from 'h3'
1411
import type { DevframeDefinition } from '../types/devframe'

packages/devframe/src/adapters/cli.ts

Lines changed: 0 additions & 20 deletions
This file was deleted.

0 commit comments

Comments
 (0)