feat(devframe)!: upgrade nostics to v0.2.0, drop deprecated APIs#20
Merged
Conversation
- Bump `nostics` catalog from `^0.1.0` to `^0.2.0`.
- Migrate all 23 diagnostics call sites from `.throw()` / `.report()` methods
to the new callable `DiagnosticHandle` form (`throw diagnostics.DFxxxx(...)`
/ `diagnostics.DFxxxx(..., { method })`).
- Refresh `DevToolsDiagnosticsHost` JSDoc and the `docs/guide/diagnostics.md`
guide to describe the callable handle.
- Fix publint `FILE_DOES_NOT_EXIST` finding: `pkg.types` now points at
`./dist/index.d.mts` (the file tsdown actually emits).
- Bump devframe to `v0.4.0` — breaking change for plugin authors who consume
`ctx.diagnostics.logger.CODE.report()` / `.throw()`.
✅ Deploy Preview for devfra ready!
To edit notification comments on pull requests, go to your Netlify project configuration. |
There was a problem hiding this comment.
Pull request overview
This PR upgrades nostics to v0.2.0 and migrates devframe’s diagnostics usage from deprecated .throw() / .report() methods to the new callable DiagnosticHandle API, while aligning documentation and package metadata with the new behavior.
Changes:
- Bump
nosticsto^0.2.0and update lockfile-resolved versions. - Migrate diagnostics emissions across node/RPC codepaths to
diagnostics.CODE(params, opts)withthrow diagnostics.CODE(...)for thrown cases. - Update docs/JSDoc and fix
devframepackagetypesentry to match emittedtsdowndeclaration output.
Reviewed changes
Copilot reviewed 18 out of 19 changed files in this pull request and generated 1 comment.
Show a summary per file
| File | Description |
|---|---|
| pnpm-workspace.yaml | Updates the workspace catalog to nostics ^0.2.0. |
| pnpm-lock.yaml | Locks nostics@0.2.0 and related dependency graph updates. |
| packages/devframe/src/types/diagnostics.ts | Updates public type/JSDoc text to describe callable diagnostic handles. |
| packages/devframe/src/rpc/validation.ts | Migrates thrown diagnostics to throw diagnostics.DF00xx(...). |
| packages/devframe/src/rpc/serialization.ts | Migrates DF0020 creation to callable handle form. |
| packages/devframe/src/rpc/handler.ts | Migrates missing-handler diagnostic throw to callable form. |
| packages/devframe/src/rpc/dump/collect.ts | Migrates dump/client diagnostics to callable handle form. |
| packages/devframe/src/rpc/collector.ts | Migrates RPC collector diagnostics to callable handle form. |
| packages/devframe/src/node/storage.ts | Migrates warn reporting to callable handle + reporter options. |
| packages/devframe/src/node/rpc-streaming.ts | Migrates stream error reporting and channel-dup throw to callable form. |
| packages/devframe/src/node/rpc-shared-state.ts | Migrates shared-state missing diagnostic to callable form. |
| packages/devframe/src/node/host-views.ts | Migrates distDir missing diagnostic throw to callable form. |
| packages/devframe/src/node/host-functions.ts | Migrates function-not-registered and ALS-not-set throws to callable form. |
| packages/devframe/src/node/host-agent.ts | Migrates agent/tool/resource validation throws to callable form. |
| packages/devframe/src/helpers/vite.ts | Migrates DF0033 warning reporting to callable form. |
| packages/devframe/src/adapters/mcp/build-server.ts | Migrates DF0017 throws (transport/start failure) to callable form. |
| packages/devframe/package.json | Bumps devframe version and updates types path to ./dist/index.d.mts. |
| docs/guide/diagnostics.md | Updates guide examples and narrative to callable handle semantics. |
| AGENTS.md | Updates contributor guidance examples to callable handle usage (but has an internal inconsistency noted in comments). |
Files not reviewed (1)
- pnpm-lock.yaml: Language not supported
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Comment on lines
66
to
+75
| import { diagnostics } from './diagnostics' | ||
|
|
||
| // For thrown errors — always prefix with `throw` for TypeScript control flow: | ||
| throw diagnostics.DF0033.throw({ name }) | ||
| throw diagnostics.DF0033({ id, reason }) | ||
|
|
||
| // For reported warnings/errors (not thrown). The default console method is `warn`; | ||
| // override with the 2nd-arg reporter options when needed: | ||
| diagnostics.DF0033.report({ name }) // console.warn | ||
| diagnostics.DF0033.report({ name }, { method: 'error' }) // console.error | ||
| diagnostics.DF0033.report({ name, cause: error }, { method: 'warn' }) // attach cause | ||
| diagnostics.DF0033({ id, reason }) // console.warn | ||
| diagnostics.DF0033({ id, reason }, { method: 'error' }) // console.error | ||
| diagnostics.DF0033({ id, reason, cause: error }, { method: 'warn' }) // attach cause |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
nosticsfrom^0.1.0to^0.2.0and migrates all 23 diagnostics call sites across 13 source files from the deprecated.throw()/.report()methods to the new callableDiagnosticHandleform (throw diagnostics.DFxxxx(...)).DevToolsDiagnosticsHostJSDoc anddocs/guide/diagnostics.mdguide so the documented API matches v0.2.0.publintFILE_DOES_NOT_EXISTfinding forpkg.types: now points at./dist/index.d.mts(the filetsdownactually emits), matching whatnosticsitself ships.devframetov0.4.0— breaking for plugin authors who consumectx.diagnostics.logger.CODE.report()/.throw().Test plan
pnpm typecheckcleanpnpm lintcleanpnpm test— 319/319 passing, including thetsnapiapi-snapshot guardpnpm dlx publint packages/devframe— "All good!"