with one click
add-new-diagram
// Use when adding a new diagram type to Pintora. Covers parser, artist, config, registration, snapshot tests, and user docs.
// Use when adding a new diagram type to Pintora. Covers parser, artist, config, registration, snapshot tests, and user docs.
| name | add-new-diagram |
| description | Use when adding a new diagram type to Pintora. Covers parser, artist, config, registration, snapshot tests, and user docs. |
| triggers | add diagram, new diagram type, register diagram, parser artist config |
pnpm install succeeds locally and the workspace builds.packages/pintora-diagrams/AGENTS.md.ai/docs/patterns/diagram-three-piece.mdmkdir -p packages/pintora-diagrams/src/<type>
Create packages/pintora-diagrams/src/<type>/parser.ne. Use packages/pintora-diagrams/src/sequence/parser.ne as a reference.
pnpm --filter @pintora/diagrams gen-parser
This produces parser.ts alongside parser.ne. Commit both.
Create packages/pintora-diagrams/src/<type>/artist.ts. Use packages/pintora-diagrams/src/mindmap/artist.ts as a minimal reference or packages/pintora-diagrams/src/sequence/artist.ts as a full-featured one.
Rules:
getConfig().themeConfig. Never hard-code hex values.Create packages/pintora-diagrams/src/<type>/config.ts exporting DEFAULT_CONFIG, configKey, and the config type. If new theme tokens are introduced, also update packages/pintora-core/src/themes/default.ts and any other theme variants.
Create packages/pintora-diagrams/src/<type>/index.ts:
import { pintora } from '@pintora/core'
import parser from './parser'
import artist from './artist'
import { DEFAULT_CONFIG, configKey } from './config'
pintora.registerDiagram('<type>', {
parser,
artist,
configKey,
})
Re-export from packages/pintora-diagrams/src/index.ts (and from packages/pintora-standalone/src/index.ts if standalone needs to ship it).
Create packages/pintora-diagrams/src/__tests__/<type>.spec.ts modelled on the existing per-diagram spec files in that directory.
Run the suite:
pnpm --filter @pintora/diagrams test -- <type>
Review the generated snapshot manually before committing it.
Create website/docs/diagrams/<type>.mdx following the structure of website/docs/diagrams/sequence-diagram.mdx. Add a note at the top linking back to this skill for contributors.
pnpm demo:dev
Open the demo, pick the new diagram type, and confirm it renders.
pnpm --filter @pintora/diagrams test passes and snapshots are committed after manual review.pnpm compile succeeds for all packages.pnpm ai:lint reports no new warnings.parser.ne โ symptoms are stale parser errors.undefined outside the default theme.