百科.dev
全部条目在线工具AI 编程趋势榜开源项目技术资讯提交条目
登录
< 返回工具列表
N

nostics

> AI 编程
开源

值得阅读的错误

190 stars0 点赞1 次浏览
访问官网GitHub

工具介绍

值得阅读的错误

nostics

Errors worth reading.

nostics helps you replace ad hoc error strings with stable diagnostic codes, actionable fixes, source locations, and docs links.

txt
[NUXT_B2011] Plugin `./runtime/analytics.server.ts` is server-only but was registered with mode `client`.
├▶ fix: Rename the file or register it with mode `server`.
├▶ sources: modules/analytics.ts:18:5
╰▶ see: https://nuxt.com/e/b2011

Install

bash
pnpm add nostics

Quick start

…

Use the generated handles where the problem happens:

typescript
const plugin = resolvePlugin()
const source = locatePluginCall(plugin)
const config = loadNuxtConfig()

diagnostics.NUXT_B2011({
  src: plugin.src,
  mode: plugin.mode,
  sources: [source],
})

throw diagnostics.NUXT_B5001({
  configPath: config.filepath,
  value: config.compatibilityDate,
  example: '2024-04-03',
})

Calling a handle reports the diagnostic and returns a Diagnostic. Throwing the return value raises it. The params are inferred from your why and fix functions.

Claude Code plugin

Install the plugin to give Claude skills for your diagnostic catalog:

bash
claude plugin add https://github.com/vercel-labs/nostics

Claude will automatically pick up the nostics API reference and an add-diagnostic skill that finds the right catalog, chooses the next free code, and wires the call site.

Agent skills

Prefer just the skills, without the plugin? Install them with npx skills into any supported agent (Claude Code, Codex, Cursor, opencode, and more):

bash
npx skills add vercel-labs/nostics

Why use it

  • Stable codes that users can search and docs can link to.
  • Typed params at the call site.
  • Diagnostic instances that extend Error.
  • Built-in console, file, fetch, and Vite dev reporters.
  • Plain, ANSI, and JSON formatters.
  • A build plugin that strips report-only diagnostics from production bundles.

The structured shape also makes diagnostics easier for tools and coding agents to read, without making that the main workflow.

Vite plugins

Build-time plugins live in the separate @nostics/unplugin package:

bash
pnpm add -D @nostics/unplugin

For library builds, use the strip plugin:

typescript
import { nosticsStrip } from '@nostics/unplugin/strip-transform'

export default defineConfig({
  plugins: [nosticsStrip.vite()],
})

For browser diagnostics during Vite dev, use createDevReporter() in the browser and nosticsCollector in the consuming app:

typescript
import { nosticsCollector } from '@nostics/unplugin/dev-server-collector'

export default defineConfig({
  plugins: [nosticsCollector.vite()],
})

Docs

See the docs site for the guide, production build notes, dev collector setup, and API reference.

License

MIT

Issues· 0 开放

查看全部 Issues在 GitHub 打开

暂无开放 Issues,或尚未同步最近议题。

> 标签

TypeScriptagentsdeverrors

暂无评论,来聊聊你的看法吧

> 工具信息

发布日期2026年8月1日
最后更新2026年9月18日
分类AI 编程
定价开源

> 相关工具

G
GitHub Copilot
GitHub 官方 AI 编程助手,覆盖补全、Chat 与 Agent 模式。
C
Cursor
AI 原生代码编辑器,对话改代码、多文件 Agent 与规则体系是其核心。
S
skills
Skills for Real Engineers. Straight from my .agents directory.