add-diagnostic
Add a new diagnostic code following the defineDiagnostics() conventions from nostics
npx skills add https://github.com/vercel-labs/nostics --skill add-diagnosticAdd a diagnostic code
-
Find the catalog: grep
defineDiagnostics. If there are many, pick by area. -
Pick the code:
PREFIX_XNNNN.PREFIXis the project name in uppercase (NUXT,I18N).Xis the area:Bbuild,Rruntime,Cconfig,Ddeprecation.NNNNis the next free number. Never rename or reuse a published code. -
Add the entry:
LIB_R0001: { why: (p: { hook: string }) => `${p.hook}() must run at the top of setup().`, // required fix: 'Move the call into setup() or a composable it calls.', // add when the fix is known docs: 'https://example.com/custom', // optional: overrides docsBase, `false` opts out },whysays what is wrong,fixsays what to do: do not repeat text between them. Params ofwhyandfixare merged and required at the call site.causeandsourcesgo at the call site, not in the definition. -
Call it:
diagnostics.LIB_R0001({ hook })reports,throw diagnostics.LIB_R0001({ hook, cause: err })reports and raises. To check a caught error:diagnostics.LIB_R0001.is(err).
More details: the nostics skill.