You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: AGENTS.md
+7-7Lines changed: 7 additions & 7 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -4,7 +4,7 @@
4
4
5
5
Two layers, one mental model:
6
6
7
-
-**`devframe`** — *the container for one devtool integration, portable across viewers.* External project; lives at [`github.com/devframes/devframe`](https://github.com/devframes/devframe), docs at [`devfra.me`](https://devfra.me). Consumed here as an npm dependency (`catalog:deps`). A checked-in submodule at `devframe/` mirrors the source at the pinned tag for browsing and upstream contributions.
7
+
-**`devframe`** — *the container for one devtool integration, portable across viewers.* External project; lives at [`github.com/devframes/devframe`](https://github.com/devframes/devframe), docs at [`devfra.me`](https://devfra.me). Consumed here as an npm dependency (`catalog:deps`).
8
8
-**`@vitejs/devtools-kit`** — *the hub that unites many devtools integrations.* Owns docking, the command palette, toasts, terminal sessions — anything that only makes sense when more than one tool shares a UI. Provides `createPluginFromDevframe(devframeApp)` so a portable devframe definition drops into Vite DevTools as a Vite plugin, with the dock entry auto-derived from the definition's metadata.
9
9
10
10
When deciding where something belongs: if a single-app standalone CLI would still need it, it belongs upstream in devframe; if it only matters once you have multiple integrations or a host UI, it lives in the kit.
@@ -28,8 +28,6 @@ Monorepo (`pnpm` workspaces + `turbo`). ESM TypeScript; bundled with `tsdown`. P
28
28
Other top-level directories:
29
29
-`docs/` — VitePress docs; guides in `docs/guide/`
30
30
-`skills/` — Agent skill files generated from docs via [Agent Skills](https://agentskills.io/home). Structured references (RPC patterns, dock types, shared state, project structure) for AI agent context.
31
-
-`devframe/` — Git submodule pinned to the `devframe` version in `catalogs.deps`. Run `pnpm sync` to align with the catalog; `pnpm sync <version>` or `pnpm sync --latest` to bump.
32
-
-`scripts/sync.ts` — Submodule pin manager (see `pnpm sync --help`).
33
31
34
32
```mermaid
35
33
flowchart TD
@@ -125,11 +123,13 @@ Codes are sequential 4-digit numbers per prefix (e.g. `DTK0033`, `RDDT0003`). Ch
125
123
import { diagnostics } from'./diagnostics'
126
124
127
125
// For thrown errors — always prefix with `throw` for TypeScript control flow:
128
-
throwdiagnostics.DTK0033.throw({ name })
126
+
throwdiagnostics.DTK0033({ name })
129
127
130
-
// For reported (non-thrown) diagnostics:
131
-
diagnostics.DTK0033.report({ name })
132
-
diagnostics.DTK0033.report({ name, cause: error }) // attach cause via params
128
+
// For reported (non-thrown) diagnostics. The default console method is `warn`;
129
+
// override with the 2nd-arg reporter options when needed:
130
+
diagnostics.DTK0033({ name }) // console.warn
131
+
diagnostics.DTK0033({ name }, { method: 'error' }) // console.error
132
+
diagnostics.DTK0033({ name, cause: error }) // attach cause via params
133
133
```
134
134
135
135
3.**Create a docs page** at `docs/errors/DTK0033.md`:
Copy file name to clipboardExpand all lines: MIGRATION.md
+17Lines changed: 17 additions & 0 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -50,3 +50,20 @@ These types are no longer re-exported from `@vitejs/devtools-kit`. Import them f
50
50
```
51
51
52
52
The `@vitejs/devtools-kit/utils/when` subpath remains and re-exports these types alongside `evaluateWhen` and `resolveContextValue`.
53
+
54
+
#### Diagnostic handles are callable
55
+
56
+
`nostics` 0.2 (pulled in via devframe 0.4) drops the `.report()` / `.throw()` methods on diagnostic handles. Each handle is now a callable that builds and emits a diagnostic; prefix with `throw` to raise.
57
+
58
+
```diff
59
+
- throw ctx.diagnostics.logger.MYP0001.throw({ name })
60
+
+ throw ctx.diagnostics.logger.MYP0001({ name })
61
+
62
+
- ctx.diagnostics.logger.MYP0002.report()
63
+
+ ctx.diagnostics.logger.MYP0002()
64
+
65
+
- ctx.diagnostics.logger.MYP0002.report({ name }, { method: 'error' })
66
+
+ ctx.diagnostics.logger.MYP0002({ name }, { method: 'error' })
67
+
```
68
+
69
+
The payload shape (including `cause`) and the optional reporter-options second argument are unchanged. Apply the same rewrite to typed handles returned from `ctx.diagnostics.defineDiagnostics()`.
Copy file name to clipboardExpand all lines: docs/kit/diagnostics.md
+15-11Lines changed: 15 additions & 11 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -13,7 +13,8 @@
13
13
interfaceDevToolsDiagnosticsHost {
14
14
/**
15
15
* Proxy-backed lookup of every registered code by name. Each entry is a
16
-
* `nostics` handle with `.report()` and `.throw()` methods.
16
+
* `nostics` `DiagnosticHandle` — a callable that builds a diagnostic and
17
+
* routes it through registered reporters; prefix with `throw` to raise.
17
18
*/
18
19
readonly logger:Record<string, any>
19
20
@@ -56,7 +57,7 @@ export function MyPlugin(): PluginWithDevTools {
56
57
ctx.diagnostics.register(diagnostics)
57
58
58
59
// Emit codes through the shared lookup:
59
-
ctx.diagnostics.logger.MYP0002.report()
60
+
ctx.diagnostics.logger.MYP0002()
60
61
},
61
62
},
62
63
}
@@ -80,23 +81,26 @@ Each definition supports `why` (string or function returning a string) and an op
80
81
81
82
## Emit a diagnostic
82
83
83
-
Each registered code is reachable as a property on `ctx.diagnostics.logger`. Every handle exposes `.throw(params)` and `.report(params)`.
84
+
Each registered code is reachable as a property on `ctx.diagnostics.logger`. Every handle is a callable — invoke it to report (returns the `Diagnostic`), or prefix with `throw` to raise.
-**[`ctx.messages`](./messages)** — user-facing activity surfaces in the DevTools UI: progress indicators, audit results, "URL copied" toasts. Just a message and a level.
140
144
141
145
Diagnostics target tool authors and CI; messages target the human in front of the DevTools panel.
0 commit comments