⏳ This skill is pending AI review.
Scores will appear once the review pipeline completes.
vibex
Diagrams and checkable docs from a codebase. Draws ERDs, C4 context/container/component views, API endpoint catalogues, lifecycle/state machines, and service-to-service call maps as a validated JSON spec plus a standalone HTML viewer, with Mermaid export. Imports OpenAPI, GraphQL SDL and Prisma; otherwise reads the code (NestJS, TypeORM, Express) and writes the spec. Use for: database diagram, ERD, data model, table relationships, C4 or architecture diagram, system context, API map, endpoint list, "show me the endpoints", status flow, state machine, allowed transitions, "what happens after X is approved", how services call each other, microservice map, Mermaid diagram. Also writes documentation as a fact graph: each statement carries its source and a computed confidence, and a drift check fails CI when the code moves. Use to document a system, write architecture or onboarding docs, or explain how a system works.
Choose how to use this skill
You do not need every option. Choose the path your AI client supports. The stable page stays the same; versioned files are immutable.
1. Native installer
This listing has no registered native installer command. Use the complete package or source fallback below, depending on what your client supports.
Do not guess an installer command or replace an existing version without reviewing the diff.
2. Complete package recommended
Download the ZIP when available. It includes SKILL.md plus the references, security notes and version metadata.
No complete ProSkills package is published for this listing yet.3. Prompt-only
Copy the prompt above when the agent can read the stable page or when you want to adopt the workflow without installing a skill.
Need only the instruction file?
Download SKILL.md only if your client requires a single file. The complete ZIP is safer for a full installation because it preserves the references and release context.
No path installs or executes anything by itself. Your agent still needs access to the project files. Before updating, compare the installed version and review the diff.
// RATINGS
Not yet listed on ClawHub or SkillsMP
// README
vibeX
Your architecture diagram is a lie.
vibeX reads the thing that can't lie — your Prisma schema, your OpenAPI document, your GraphQL SDL, or the source itself — and renders the diagram that's actually true. Then it documents the system in claims that fail CI when the code moves underneath them.
One standalone HTML file. No server. Nothing leaves your network.
The diagram you have right now
a whiteboard photo in a Slack threada Confluence page last touched in 2023a Miro board nobody can finda Mermaid block that stopped renderingthe one guy who knows
→ one command, run against the schema that actually ships.
npx skills add Raja0sama/vibex -g -a claude-code -a codex -y # Claude Code + Codex, then just ask
npx @vibex/vibex demo out # or look first: installs nothing
Why "vibeX"
vibe — how code gets written now. Fast, AI-assisted, more of it than anyone can hold in their head. X — the crossings. Which table joins which. Which service calls which. What happens after approval.
You vibed it into existence. vibeX shows you what you actually built.
The mark is the same idea: two edges crossing. Everything interesting in a system is a line between two things, not the things themselves.
Six diagrams. One source of truth.
| Type | What it draws | Import from | |
|---|---|---|---|
| 🔵 | erd | tables, columns, PK/FK badges, crow's-foot cardinality that knows nullable from not, bounded contexts as groups | Prisma, GraphQL SDL (--erd) |
| 🟣 | c4 | persons, systems, containers, components, databases, queues, each with its own fill, inside tinted nested boundaries | hand-authored |
| 🟢 | endpoints | REST routes, GraphQL operations, published events — grouped by resource, with method badges, auth, params, status codes | OpenAPI 2/3, GraphQL SDL |
| 🟡 | lifecycle | every state a thing can reach and every legal move between them, with actor, event, guard and side effect on each arrow | hand-authored |
| 🟠 | sequence | one request or job end to end: who calls whom, in order, with replies, async events, activation bars and alt/opt/loop/par branches | hand-authored |
| 🔷 | links | the System view: every call between services, pinned to the client that makes it and the handler that serves it, across repositories | hand-authored from clients and handlers |
Each is a validated JSON spec plus a rendered viewer. The spec is the artifact you keep;
the HTML is disposable. Documentation and changes are two more views over the same
specs, all in one dashboard file. Every diagram also exports as Mermaid
(vibex mermaid <spec>, or the button in the viewer) for Markdown that renders it.
Which service calls which. A *.links.json records each call once, anchored on both
ends. vibex links checks it against the code:
vibex links system.links.json docs --repo bff=../bff --repo orders=../orders --check
It fails when a client or handler moved, an endpoint it names is gone, or a C4 arrow has
no call behind it. It also lists endpoints nothing calls. In a monorepo, pass --repo ..
Three commands. No config file.
# 1. import — your schema becomes a draft spec
vibex import prisma prisma/schema.prisma docs/db.erd.json
vibex import openapi openapi.yaml docs/api.endpoints.json
vibex import graphql schema.graphql docs/api.endpoints.json
# 2. validate — dangling refs and unreachable states are errors that name the field
vibex validate docs/db.erd.json
# 3. render — one file, CSS and JS inlined, spec embedded
vibex render docs/db.erd.json --open
# or --linked: the HTML is only a placeholder; data goes in db.erd.data.js
# and the viewer in vibex-viewer.js/.css beside it (still opens from disk)
# every spec in the folder, one page, cross-linked
vibex dashboard docs/index.html docs --title "Payments platform" --repo .
# several repos side by side? run it from the folder above them:
# a landing page plus one dashboard per repo, and the files to serve it
vibex workspace ~/work --title "Payments platform" --host
cd ~/work/vibex-site && VIBEX_USER=you VIBEX_PASSWORD=change-me docker compose up --build
No source schema? It reads the code — NestJS controllers, GraphQL resolvers, TypeORM entities, Express routers, SQL migrations — and writes the spec itself.
Install it as a skill and stop learning flags
vibeX is a Claude Code / Codex skill first and a CLI second. Installed as a skill, the
whole command surface collapses into a sentence — the agent reads SKILL.md, finds your
schema, picks the diagram type, writes the spec and renders it:
> show me the data model
wrote db.erd.json · db.erd.html
> now the endpoints
wrote api.endpoints.json · api.endpoints.html
> what happens after a request is approved?
wrote request.lifecycle.json · request.lifecycle.html
> document the auth service and fail CI when it drifts
wrote auth.docs.json · 41 claims, 38 verified
Install it. Pick your agent:
| Agent | Command |
|---|---|
| Claude Code + Codex | npx skills add Raja0sama/vibex -g -a claude-code -a codex -y |
| Claude Code plugin | /plugin marketplace add Raja0sama/vibex, then /plugin install vibex@vibex |
| Codex, by hand | git clone https://github.com/Raja0sama/vibex ~/.agents/skills/vibex |
Then:
- Restart the agent (or open a new session).
- Ask: "show me the data model".
-g installs for your user, so every project sees it. Codex reads ~/.agents/skills;
Claude Code gets a symlink in ~/.claude/skills. The plugin route updates through
/plugin instead.
Check it landed:
node ~/.agents/skills/vibex/bin/vibex.mjs types
Per project, so the skill is checked in beside the code it documents. Drop -g
and run it inside the repo:
cd my-project && npx skills add Raja0sama/vibex -a claude-code -a codex -y
Another agent (Cursor, Gemini CLI, OpenCode, Copilot and more): swap the -a
values, or run npx skills add Raja0sama/vibex and pick from the list.
Pinned to a published version. SKILL.md ships inside the npm package, so a
global install plus one symlink does it:
npm i -g @vibex/vibex
ln -s "$(npm root -g)/@vibex/vibex" ~/.claude/skills/vibex # or ~/.agents/skills/vibex for Codex
Under nvm,
npm root -gis scoped to the Node version you are on. Install a new Node and both thevibexbinary and this symlink stop resolving, silently.skills addhas no such problem.
From source, if you are changing vibeX itself. The symlink tracks your working copy, so edits apply the moment you save:
git clone https://github.com/Raja0sama/vibex && cd vibex
ln -s "$(pwd)" ~/.claude/skills/vibex
skills add and the plugin clone the repository, not the npm package, so they have
no node_modules. Run npm install inside the skill folder only if you need YAML
OpenAPI. The npm paths already have it.
Prose that can't quietly go stale
An AI wrote the sentence once. Arithmetic checks it forever.
A diagram can't drift from the schema, because it's generated f
// HOW IT'S BUILT
// FILES
107 files shipped with this skill. Inline text is the catalog copy. The upstream link is the source repository.
SKILL.md32 KBe7da463d8d8atruncatedupstream ↗
Showing the inlined prefix. The rest is in the upstream file.
--- name: vibex description: 'Diagrams and checkable docs from a codebase. Draws ERDs, C4 context/container/component views, API endpoint catalogues, lifecycle/state machines, sequence diagrams, and service-to-service call maps as a validated JSON spec plus a standalone HTML viewer, with Mermaid export. Imports OpenAPI, GraphQL SDL and Prisma; otherwise reads the code (NestJS, TypeORM, Express) and writes the spec. Use for: database diagram, ERD, data model, table relationships, C4 or architecture diagram, system context, API map, endpoint list, "show me the endpoints", status flow, state machine, allowed transitions, "what happens after X is approved", sequence diagram, request flow, how services call each other, microservice map, Mermaid diagram. Also writes documentation as a fact graph: each statement carries its source and a computed confidence, and a drift check fails CI when the code moves. Use to document a system, write architecture or onboarding docs, or explain how a system works.' license: MIT metadata: version: "0.8.1" cli: node bin/vibex.mjs repository: https://github.com/Raja0sama/vibex --- # vibeX *You vibed it into existence. vibeX shows you what you actually built.* Output is always two files: `<name>.<type>.json` (the spec, the source of truth) and `<name>.<type>.html` (self-contained viewer: pan/zoom, search, click-for-details, dark/light, SVG/PNG export). Not fancy. Correct and readable. Skill root: the directory containing this file. Every command below is `node <skill-root>/bin/vibex.mjs …`. ## Steps 1. **Pick the type** from the ask. One diagram per type per question; do not mix. | Ask | Type | Spec file | |---|---|---| | tables, models, schema, relations, FKs, data model | `erd` | `schemas/erd.schema.json` | | context, containers, components, who talks to what, system boundary | `c4` | `schemas/c4.schema.json` | | endpoints, routes, API surface, GraphQL operations, events/topics | `endpoints` | `schemas/endpoints.schema.json` | | statuses, state machine, lifecycle, what happens after X, allowed transitions | `lifecycle` | `schemas/lifecycle.schema.json` | | sequence diagram, request flow, what happens when the user clicks X, who calls whom and in what order | `sequence` | `schemas/sequence.schema.json` | 2. **Find a machine-readable source first.** Search the repo before reading code: - `endpoints`: `openapi.*`, `swagger.*`, `*.graphql`, `schema.gql`, or a generated schema endpoint dump. Run `import openapi` or `import graphql`. - `erd`: `schema.prisma` → `import prisma`. A GraphQL SDL can also seed an ERD with `import graphql <file> out.json --erd`. - `c4`: never importable. Author it (step 3). ```bash node bin/vibex.mjs import openapi path/to/openapi.yaml out/api.endpoints.json node bin/vibex.mjs import graphql path/to/schema.graphql out/api.endpoints.json node bin/vibex.mjs import prisma prisma/schema.prisma out/db.erd.json ``` After an import, open the JSON and edit it like a human would: rename groups, drop noise endpoints (health, metrics), add `entities` links on endpoints, add `sources`. The import is a starting point, not the deliverable. 3. **No source file? Dig in the code.** Read the schema file for your type once, then read one example in `examples/`. Author the JSON fresh. Where to look: - **NestJS REST**: `@Controller('prefix')` + `@Get/@Post/@Put/@Patch/@Delete('path')` → one endpoint each, path = prefix + path with `:id` rewritten as `{id}`. `@UseGuards(...)`/`@Roles(...)` → `auth`. `@Body()` DTO class → `request`. Return type / `@ApiOkResponse` → `response`. One group per controller. Put `sources: [{path, line}]` on every endpoint pointing at the handler method. Prepend `app.setGlobalPrefix()` and `@Version()`/`VersioningType.URI` segments to every path. `@Param()` → `params[].in: "path"`, `@Query()` → `"query"`, `@Headers()` → `"header"`; a DTO class in `@Query()` becomes one param per property. - **NestJS GraphQL**: `@Query()`, `@Mutation()`, `@Subscription()` in `*.resolver.ts` → method QUERY/MUTATION/SUBSCRIPTION, path = `name(arg: Type)`. `@ObjectType`/`@InputType` classes → `types`. - **Express/Fastify**: `router.get('/x', …)`, `app.post(...)`, `fastify.route({method, url})`. - **TypeORM**: `@Entity('table')` classes; `@PrimaryGeneratedColumn`/`@PrimaryColumn` → `pk`; `@Column({nullable, unique, type})`; `@ManyToOne` + `@JoinColumn` → FK on this side, relationship `from` this entity `to` target with `from_cardinality: many`; `@OneToOne` → `one`/`zero-or-one`; `@ManyToMany` + `@JoinTable` → a join entity or a many↔many relationship. - **Prisma**: prefer the importer. The importer already fills `sources` (path + model line); add `description` and `groups` by hand. It names entities by the lowercased model name (`OrderItem` → `orderitem`; `@@map` only changes the label). - **SQL migrations**: `CREATE TABLE`, `REFERENCES`, `PRIMARY KEY`, `UNIQUE`. - **C4**: `docker-compose.yml`, `k8s/`, `serverless.yml`, `infra/` for containers and datastores; `package.json`/`*.module.ts` for tech; HTTP clients, queue clients, SDK imports (`stripe`, `@aws-sdk/client-sqs`, `nodemailer`) for external systems and relationships. People come from auth roles. Keep IDs stable and boring: `user`, `order_item`, `bff`, `list-orders`. Reuse the same ID for the same thing across diagrams so ERD entity IDs can go into `endpoints[].entities`. With a Prisma-imported ERD, use exactly the importer's ids (`orderitem`, not `order_item`); run `dashboard` and check the "which endpoints touch which tables" table is non-empty. 4. **Validate, then render.** ```bash node bin/vibex.mjs validate out/db.erd.json node bin/vibex.mjs render out/db.erd.json out/db.erd.html ``` Exit 1 means errors: fix the named field and rerun. Warnings never block; fix the ones about layout (`row`/`col` hints) when they appear, ignore missing-summary warnings unless the user wants prose. Add `--open` to the render to open the browser. 5. **Several diagrams for one system? Build the dashboard too.** Keep all specs in one folder (e.g. `docs/arch/`), then: ```bash node bin/vibex.mjs dashboard docs/arch/index.html docs/arch --title "My system" ``` The overview page lists every diagram, shows which endpoints touch which tables (from `endpoints[].entities`), and resolves C4 `link` values that name another spec file in the folder (`link: "bff.c4.html"` → the `bff.c4.json` panel; both specs must be in the same `dashboard` invocation, matching is by file name). Re-run it after every spec change; it is cheap. **Several repos side by side?** Run from the folder above them. Keep each repo's specs inside that repo (e.g. `repo-a/docs/arch/`) so its CI can check drift; a shared folder of cross-repo specs works too, with anchor paths prefixed by the repo folder (`repo-a/src/x.ts`). Then: ```bash node bin/vibex.mjs workspace ~/work --title "My platform" # → ~/work/vibex-site/ node bin/vibex.mjs workspace ~/work --host # + Dockerfile, nginx, login ``` One dashboard per top-level folder that holds specs, plus a landing page listing them. Re-run after any spec change; folders whose specs are gone are removed from the site. 6. **Report**: the two paths, counts (entities/elements/endpoints and relationships), what was imported vs inferred, and anything you left out on purpose. If code reading left ambiguity (cardinality, auth), say so in one line and put it in a `cards` note with `tone: "warning"`. ## Documentation (`docs`) A `docs` spec is not a diagram. Its unit is a **claim**: one checkable sentence with a source. The build turns claims plus the diagram specs into `docs.json` — the fact graph humans read in the dashboard and agents read directly. ```bash node bin/vibex.mjs docs docs/arch/system.docs.json docs/arch --repo . --reanchor # pin anchors node bin/vibex.mjs docs docs/arch/system.docs.jsonexamples/shop-repo/README.md470 Bb5d7b9ae0449upstream ↗
# shop-repo — the code the example documentation describes `shop.docs.json` and `auth.docs.json` anchor claims to files in here, so the bundled demo shows a document whose anchors actually verify rather than a wall of "unverifiable". It ships with the package for that reason: `vibex demo` has to work from a fresh install, and a product about trustworthy documentation cannot open on red. Nothing here runs. It is the shape of a NestJS service, not a working one.README.md19 KB06fac40f1eaaupstream ↗
<div align="center"> <img src="assets/favicon.svg" width="72" height="72" alt=""> # vibeX ### Your architecture diagram is a lie. vibeX reads the thing that can't lie — your Prisma schema, your OpenAPI document, your GraphQL SDL, or the source itself — and renders the diagram that's actually true. Then it documents the system in claims that fail CI when the code moves underneath them. **One standalone HTML file. No server. Nothing leaves your network.** [](https://github.com/Raja0sama/vibex/actions/workflows/ci.yml)    </div> --- ## The diagram you have right now - ~~a whiteboard photo in a Slack thread~~ - ~~a Confluence page last touched in 2023~~ - ~~a Miro board nobody can find~~ - ~~a Mermaid block that stopped rendering~~ - ~~the one guy who knows~~ → **one command, run against the schema that actually ships.** ```bash npx skills add Raja0sama/vibex -g -a claude-code -a codex -y # Claude Code + Codex, then just ask npx @vibex/vibex demo out # or look first: installs nothing ``` <div align="center"> [](https://www.youtube.com/watch?v=SovgqAX7oSY) **[Watch the demo](https://www.youtube.com/watch?v=SovgqAX7oSY)** </div> ## Why "vibeX" **vibe** — how code gets written now. Fast, AI-assisted, more of it than anyone can hold in their head. **X** — the crossings. Which table joins which. Which service calls which. What happens after approval. > **You vibed it into existence. vibeX shows you what you actually built.** The mark is the same idea: two edges crossing. Everything interesting in a system is a line between two things, not the things themselves. ## Six diagrams. One source of truth. | | Type | What it draws | Import from | |---|---|---|---| | 🔵 | `erd` | tables, columns, PK/FK badges, crow's-foot cardinality that knows nullable from not, bounded contexts as groups | Prisma, GraphQL SDL (`--erd`) | | 🟣 | `c4` | persons, systems, containers, components, databases, queues, each with its own fill, inside tinted nested boundaries | hand-authored | | 🟢 | `endpoints` | REST routes, GraphQL operations, published events — grouped by resource, with method badges, auth, params, status codes | OpenAPI 2/3, GraphQL SDL | | 🟡 | `lifecycle` | every state a thing can reach and every legal move between them, with actor, event, guard and side effect on each arrow | hand-authored | | 🟠 | `sequence` | one request or job end to end: who calls whom, in order, with replies, async events, activation bars and `alt`/`opt`/`loop`/`par` branches | hand-authored | | 🔷 | `links` | the **System view**: every call between services, pinned to the client that makes it and the handler that serves it, across repositories | hand-authored from clients and handlers | Each is a validated JSON spec plus a rendered viewer. **The spec is the artifact you keep; the HTML is disposable.** Documentation and changes are two more views over the same specs, all in one dashboard file. Every diagram also exports as Mermaid (`vibex mermaid <spec>`, or the button in the viewer) for Markdown that renders it. **Which service calls which.** A `*.links.json` records each call once, anchored on both ends. `vibex links` checks it against the code: ```bash vibex links system.links.json docs --repo bff=../bff --repo orders=../orders --check ``` It fails when a client or handler moved, an endpoint it names is gone, or a C4 arrow has no call behind it. It also lists endpoints nothing calls. In a monorepo, pass `--repo .`. ## Three commands. No config file. ```bash # 1. import — your schema becomes a draft spec vibex import prisma prisma/schema.prisma docs/db.erd.json vibex import openapi openapi.yaml docs/api.endpoints.json vibex import graphql schema.graphql docs/api.endpoints.json # 2. validate — dangling refs and unreachable states are errors that name the field vibex validate docs/db.erd.json # 3. render — one file, CSS and JS inlined, spec embedded vibex render docs/db.erd.json --open # or --linked: the HTML is only a placeholder; data goes in db.erd.data.js # and the viewer in vibex-viewer.js/.css beside it (still opens from disk) # every spec in the folder, one page, cross-linked vibex dashboard docs/index.html docs --title "Payments platform" --repo . # several repos side by side? run it from the folder above them: # a landing page plus one dashboard per repo, and the files to serve it vibex workspace ~/work --title "Payments platform" --host cd ~/work/vibex-site && VIBEX_USER=you VIBEX_PASSWORD=change-me docker compose up --build ``` No source schema? It reads the code — NestJS controllers, GraphQL resolvers, TypeORM entities, Express routers, SQL migrations — and writes the spec itself. ## Install it as a skill and stop learning flags vibeX is a Claude Code / Codex skill first and a CLI second. Installed as a skill, the whole command surface collapses into a sentence — the agent reads `SKILL.md`, finds your schema, picks the diagram type, writes the spec and renders it: ``` > show me the data model wrote db.erd.json · db.erd.html > now the endpoints wrote api.endpoints.json · api.endpoints.html > what happens after a request is approved? wrote request.lifecycle.json · request.lifecycle.html > document the auth service and fail CI when it drifts wrote auth.docs.json · 41 claims, 38 verified ``` **Install it.** Pick your agent: | Agent | Command | |---|---| | Claude Code + Codex | `npx skills add Raja0sama/vibex -g -a claude-code -a codex -y` | | Claude Code plugin | `/plugin marketplace add Raja0sama/vibex`, then `/plugin install vibex@vibex` | | Codex, by hand | `git clone https://github.com/Raja0sama/vibex ~/.agents/skills/vibex` | Then: 1. Restart the agent (or open a new session). 2. Ask: *"show me the data model"*. `-g` installs for your user, so every project sees it. Codex reads `~/.agents/skills`; Claude Code gets a symlink in `~/.claude/skills`. The plugin route updates through `/plugin` instead. Check it landed: ```bash node ~/.agents/skills/vibex/bin/vibex.mjs types ``` <details> <summary><b>Other ways in</b>: per project, other agents, pinned to a release, or from source</summary> <br> **Per project**, so the skill is checked in beside the code it documents. Drop `-g` and run it inside the repo: ```bash cd my-project && npx skills add Raja0sama/vibex -a claude-code -a codex -y ``` **Another agent** (Cursor, Gemini CLI, OpenCode, Copilot and more): swap the `-a` values, or run `npx skills add Raja0sama/vibex` and pick from the list. **Pinned to a published version.** `SKILL.md` ships inside the npm package, so a global install plus one symlink does it: ```bash npm i -g @vibex/vibex ln -s "$(npm root -g)/@vibex/vibex" ~/.claude/skills/vibex # or ~/.agents/skills/vibex for Codex ``` > Under nvm, `npm root -g` is scoped to the Node version you are on. Install a new > Node and both the `vibex` binary and this symlink stop resolving, silently. > `skills add` has no such problem. **From source**, if you are changing vibeX itself. The symlink tracks your working copy, so edits apply the moment you save: ```bash git clone https://github.com/Raja0sama/vibex && cd vibex ln -s "$(pwd)" ~/.claude/skills/vibex ``` `skills add` and the plugin clone the repository, not the npm package, so they have no `node_modules`. Run `npm install` inside the skill folder only if you need YAML OpenAPI. The npm paths already have it. </details> --- ## Prose that can't quietly go stale > **An AI wrote the sentence once. Arithmetic checks it forever.** A diagram can't drift from the schema, because it's generated from it. Prose can, and always does. So `vibex docs` documents a system the same way it draws one — the unit isn't a page, it's a **claim**: one sentence with a source attached. ```bash vibex docs system.docs.json specs/ --repo . --check # exit 1 on any claim that no longer holds ``` **There is no model in the verification path** — only `fs`, `path`, `crypto` and `git`. That is the whole point, and it is why a full drift check costs ~70ms and nothing per run. ### What it does not do It catches drift, not initial error. If the first draft misreads the code, the hash still matches, CI stays green, and a wrong claim can stay verified indefinitely. Reviewing the spec once, at authoring time, is the only thing that establishes truth. The honest version: **you get a reviewable first draft in one pass, and after you have read it once, arithmetic keeps it honest.** <details> <summary><b>How a claim works</b> — three sources, five computed confidence states</summary> <br> | Source | What holds it up | |---|---| | `derived` | Computed from a diagram spec by one of ten fixed generators. Cannot disagree with the diagram beside it, because it *is* the diagram. | | `anchored` | Prose pinned to a file and a symbol by a content hash. In languages where whitespace is not syntax (TypeScript, JSON, Go, …) the hash ignores it — reformat the file and nothing moves; change the line and the claim flags itself. Everywhere else (Python, YAML, Makefiles, any unknown extension) indentation counts, and only trailing whitespace and line endings are ignored. | | `asserted` | A person's decision, with their name and the date. For what no file can prove — and it expires, so "we decided this in March" can't pass for fact forever. | **Confidence is computed, never written.** A claim cannot declare how trustworthy it is. The build assigns one of five states from the evidence and the clock, and the validator rejects any claim that tries to rate itself: `verified` · `stated` · `needs re-reading` · `out of date` · `unverifiable` ```bash vibex docs system.docs.json specs/ --repo . --reanchor # re-pin hashes after a deliberate edit vibex docs system.docs.json specs/ --repo . --md doc.md # portable Markdown, zero raw HTML ``` **Incremental, keyed on git.** `docs.lock.json` records the commit each claim last verified at, so a rebuild re-reads only what git says moved — and every uncertainty resolves toward reading *more*, never less. CI passes `--no-lock`: a lock file arrives from a contributor's machine *asserting* that claims were verified, and CI re-reads every anchor rather than taking that on trust. **It tells you what it doesn't cover.** Every document renders three lists: what was read, what is deliberately out of scope and why, and what the build noticed but could not account for. A document that implies completeness gets believed exactly where it is wrong. **One artefact, two readers.** People read the dashboard panel; agents read `docs.json` — every fact once, addressable, with resolved edges, so "what breaks if I change this" is a single lookup rather than a search. Narrative sections carry Markdown that cites claims inline with `[[claim-id]]`, rendering each citation as a coloured pip showing that claim's confidence, so a reader sees which words are load-bearing. **One document per question.** `auth.docs.json`, `payments.docs.json` — each becomes its own dashboard entry. Not one document trying to be the whole system. Pass `--repo` to `dashboard` or every anchored claim renders as unverifiable. </details> <details> <summary><b>Wrong? Fix it from where you found it</b> — the intake loop</summary> <br> Every claim and node carries a report link. It opens an issue with a fenced `vibex` block naming exactly what the reader was looking at, so the request arrives with its coordinates attached instead of "the auth docs seem wrong". ``` reader → pre-addressed issue → triage → agent writes a PR → a person merges ``` - **It answers either way.** Actionable or not, the issue gets a reply and a label (`ready` or `needs-info`). An intake queue that answers nothing is worse than none. - **It cannot assert its way out.** The agent follows the same `SKILL.md` you do. What it could not establish from the code goes in `coverage.out_of_scope`, not into a claim under somebody's name. - **It opens, it never merges.** The change arrives as a pull request that has already run `validate` and `docs --check`. A human still reviews it. - **No API key? Triage still runs**, still answers on the issue, still labels it. It just doesn't write anything. </details> <details> <summary><b>Release notes that know what they touched</b> — <code>vibex changelog</code></summary> <br> Builds the release list from commit history — and with `--specs`, what each commit did to the documented system. It becomes a Changes panel in the dashboard, beside the diagrams those commits moved. ```bash vibex changelog HEAD --specs docs/ -o changelog.json --md CHANGES.md vibex dashboard docs/index.html docs --changelog changelog.json ``` If the history doesn't use conventional-commit prefixes, sections are inferred from the files each commit touched — and the output says so, in the document: *"treat the grouping as a rough sort, not as the author's intent."* </details> --- ## Nothing leaves the machine An architecture diagram is a reconnaissance map of your system — table names, service topology, auth boundaries, every internal route. It's the exact thing you can't paste into someone else's SaaS. So vibeX doesn't have a server. **There is nothing to review, because there is nowhere for it to go.** <details> <summary><b>What the generated file does not do</b> — verified in the source</summary> <br> - No `fetch`, `XMLHttpRequest` or WebSocket, anywhere in the viewer runtime - No CDN, no web fonts, no analytics, no telemetry — the system font stack and nothing else - PNG export renders through an in-memory blob; it never touches the network - Pull the cable out of the wall and it still pans, zooms, searches and exports `vibex host <dir>` writes the nginx + Docker files to serve a folder of pages on your own box, behind a login that is on by default. Or put it on S3 behind SSO, a private Pages site, a Confluence attachment, committed next to the code, or `file://`. **No account to view it. No seats. No expiry.** Hand it to a contractor, an auditor, or the new hire on their first morning. It's a file. </details> <details> <summary><b>Viewer shortcuts</b> — search, deep links, source links, export</summary> <br> A PNG of a 40-table schema is a wall. This one you can interrogate: <kbd>/</kbd> search · <kbd>t</kbd> theme · <kbd>0</kbd> fit · <kbd>+</kbd>/<kbd>-</kbd> zoom · <kbd>r</kbd> reset layout · <kbd>s</kbd> save layout · <kbd>Esc</kbd> clear Drag any box to move it and its lines re-route around the other boxes. To keep it, click **Save layout**. The page writes nothing itself; pick one: 1. **Copy prompt:** paste it to your coding agent. It carries the JSON and the steps. 2. **Copy JSON:** save it to a file and run `vibex layout <spec.json> <file>`. 3. **Raise an issue:** prefilled, when `meta.repository.url` is set. Intake applies it in a pull request. The positions land in the spec's `layout.positions`; every render after that draws the boxes there. Click any node for its columns, fields, params and relationships. `#node=<id>` deep-links to one specific table in one specific diagram — so you can send someone *the thing*, not "it's in the doc somewhere." SVG and PNG export produce standalone files in the current theme. **Mermaid** exports the diagram as `.mmd`, for Markdown that renders Mermaid (GitHub, GitLab, Notion). `vibex render` writes the `.mmd` beside every HTML it makes; `vibex mermaid <spec>` prints it. Set `meta.repository` and `sources: [{path, line}]` and every node links back to the exact line on GitHub or GitLab. </details> <details> <summary><b>Layout</b> — what lives where, and how to add a diagram type</summary> <br> ``` bin/vibex.mjs CLI: validate, render, import, dashboard, docs, changelog, demo, types schemas/ JSON Schema per type (the authoring contract) examples/ one example spec per type renderers/<type>/ JSON -> SVG body renderers/docs/ claim graph, anchors, markdown export renderers/shared/ validate, layout (grid, orthogonal routing, edge lanes), svg styles, template, dashboard importers/ openapi, graphql (own SDL parser), prisma assets/template.html single-diagram shell; slots are <!-- VIBEX:* --> comments assets/dashboard.html multi-diagram shell: sidebar, overview, cross-links assets/viewer.js|css shared viewer runtime, inlined into both shells assets/icon.svg the mark (monochrome, currentColor) test/ node:test suite + fixtures SKILL.md agent instructions (Claude Code / Cursor skill) ``` A new diagram type is a schema, a validator function, a renderer that emits `data-node-id` / `data-edge-from|to`, and a line in `renderers/shared/render.mjs`. </details> ## Install ```bash npx skills add Raja0sama/vibex -g -a claude-code -a codex -y # Claude Code + Codex ``` ``` /plugin marketplace add Raja0sama/vibex # or, inside Claude Code /plugin install vibex@vibex ``` The CLI comes with it and is what the skill drives. If you want it on your `PATH` as well, or pinned to a published release rather than a clone of `main`: ```bash npm i -g @vibex/vibex # adds the `vibex` command npx @vibex/vibex demo out # or run it once without installing anything ``` > The unscoped `vibex` on npm is an unrelated package by another author. Always > install `@vibex/vibex`. Node 18+. Zero required dependencies. The optional `yaml` package is only needed if your OpenAPI document is YAML rather than JSON. <details> <summary><b>On the roadmap</b> — built for one service, going to a system of them</summary> <br> - **Request workflows** — follow one request across service boundaries: the call in, the services it touches, the events it publishes, the tables it writes. C4 shows what *could* talk to what; this shows what actually happens when somebody presses buy. - **Monorepo support** — one repository, many packages, one dashboard. Specs beside the package they describe, anchors that resolve inside it, and a root view that stitches them together without anyone maintaining a list by hand. - ~~**One logical system**~~ — shipped in 0.7 as the System view (`links`, above). Next for it: which service owns which table. - **A GitHub Action** that runs in *your* CI, regenerates on every pull request, and comments what moved — *"2 tables, 3 endpoints."* Still no server. - **A hosted tier**, for teams who would rather buy the outcome than own the pipeline. The self-hosted path stays free and stays supported. These are being designed, not finished. If one of them is the reason you'd adopt this, [say so](https://github.com/Raja0sama/vibex/issues) — that is the fastest way to influence it. </details> ## License MIT, see [LICENSE](LICENSE). ### Prior art Diagrams-as-code is a well-populated field, and vibeX stands on a lot of it: [Mermaid](https://github.com/mermaid-js/mermaid) and [PlantUML](https://github.com/plantuml/plantuml) for turning text into a picture, [Structurizr](https://structurizr.com) for treating C4 as a model rather than a drawing, [DBML](https://github.com/holistics/dbml) for schema-to-ERD, [Graphviz](https://graphviz.org) for deterministic layout, and [tt-a1i/archify](https://github.com/tt-a1i/archify) (MIT) <div align="center"> **Never stale. Never leaves.** </div>assets/dashboard.html18 KB7eeac8fe19d3upstream ↗
<!doctype html> <html lang="en" data-theme="light" data-theme-pref="<!-- VIBEX:THEME -->"> <head> <meta charset="utf-8"> <meta name="viewport" content="width=device-width, initial-scale=1"> <!-- VIBEX:STAMP --> <title><!-- VIBEX:TITLE --></title> <!-- VIBEX:CSS --> <style> body{display:grid;grid-template-columns:252px minmax(0,1fr);height:100vh} nav{border-right:1px solid var(--border-soft);background:var(--surface);display:flex;flex-direction:column;overflow:auto} nav .brand{display:flex;align-items:center;gap:10px;padding:16px 16px 14px;border-bottom:1px solid var(--border-soft)} nav .brand .mark{width:28px;height:28px;flex:none;border-radius:8px;background:linear-gradient(135deg,var(--accent),color-mix(in srgb,var(--accent) 55%,var(--patch)));display:grid;place-items:center;box-shadow:var(--shadow-sm)} nav .brand .mark svg{width:16px;height:16px;fill:none;stroke:#fff;stroke-width:1.7;stroke-linecap:round;stroke-linejoin:round} nav .brand .txt{min-width:0} nav .brand h1{font-size:14px;font-weight:680;line-height:1.3;overflow:hidden;text-overflow:ellipsis;white-space:nowrap} nav .brand .sub{color:var(--text-3);font-size:11.5px;margin-top:1px;overflow:hidden;text-overflow:ellipsis;white-space:nowrap} nav .group{padding:12px 10px 2px} nav .group h2{font-size:10px;text-transform:uppercase;letter-spacing:.08em;color:var(--text-3);font-weight:650;padding:0 8px 7px} nav a{position:relative;display:flex;align-items:center;gap:9px;padding:7px 10px;border-radius:8px;color:var(--text-2);text-decoration:none;font-size:13px;cursor:pointer;min-width:0;transition:background-color .12s,color .12s} nav a .t{overflow:hidden;text-overflow:ellipsis;white-space:nowrap;min-width:0} nav a .dot{width:7px;height:7px;border-radius:50%;flex:none;background:var(--text-3)} nav a[data-type=erd] .dot{background:var(--pk)} nav a[data-type=links] .dot{background:var(--accent)} nav a[data-type=c4] .dot{background:var(--system)} nav a[data-type=endpoints] .dot{background:var(--get)} nav a[data-type=lifecycle] .dot{background:var(--patch)} nav a[data-type=sequence] .dot{background:var(--event)} nav a:hover{background:var(--surface-2);color:var(--text)} nav a:focus-visible{outline:2px solid var(--accent);outline-offset:-2px} nav a.active{background:var(--accent-soft);color:var(--accent);font-weight:600} nav a.active::before{content:"";position:absolute;left:-10px;top:50%;transform:translateY(-50%);width:3px;height:16px;border-radius:0 3px 3px 0;background:var(--accent)} nav a .n{margin-left:auto;font-family:var(--font-mono);font-size:10.5px;color:var(--text-3);background:var(--surface-2);border-radius:99px;padding:1px 6px;flex:none} nav a.active .n{background:color-mix(in srgb,var(--accent) 16%,transparent);color:var(--accent)} nav .foot{margin-top:auto;padding:13px 15px;font-size:10.5px;color:var(--text-3);border-top:1px solid var(--border-soft);line-height:1.9} nav .foot kbd{font-family:var(--font-mono);font-size:10px;background:var(--surface-2);border:1px solid var(--border-soft);border-radius:4px;padding:1px 4px;color:var(--text-2)} nav .foot button{width:100%;margin-top:9px;justify-content:center} /* A dashboard is mostly canvas, so the index can step aside. Collapsed it keeps the type dots and the active marker, which is enough to navigate by. */ body{transition:grid-template-columns .17s ease} body.nav-min{grid-template-columns:62px minmax(0,1fr)} .nav-min nav .brand{justify-content:center;padding:16px 0 14px} .nav-min nav .brand .txt{display:none} .nav-min nav .group{padding:10px 8px 2px} .nav-min nav .group h2{display:none} .nav-min nav a{justify-content:center;padding:9px 0} .nav-min nav a .t,.nav-min nav a .n{display:none} .nav-min nav a .dot{width:9px;height:9px} .nav-min nav a.active::before{left:-8px} .nav-min nav .foot{padding:10px 8px} .nav-min nav .foot .keys,.nav-min nav .foot button[data-role=theme-global]{display:none} .nav-min nav .foot button[data-role=nav-toggle] .lbl{display:none} .nav-min nav .foot button[data-role=nav-toggle]{padding:8px 0} nav .foot button[data-role=nav-toggle]{display:flex;align-items:center;justify-content:center;gap:7px} nav .foot button[data-role=nav-toggle] .i{width:13px;height:13px;fill:none;stroke:currentColor;stroke-width:1.6;stroke-linecap:round;stroke-linejoin:round;transition:transform .17s ease} nav .foot button[data-role=nav-toggle][aria-expanded=true] .i{transform:rotate(180deg)} main{min-height:0;display:flex;flex-direction:column;background:var(--bg)} .panel{display:none;min-height:0;height:100%} .panel.active{display:flex;flex-direction:column} .panel .viewer{flex:1;min-height:0} /* overview */ .overview{padding:26px 30px 40px;overflow:auto} .overview>*{max-width:1120px} .ov-head{max-width:900px;margin:0 0 26px} .overview h1{font-size:22px;font-weight:700;letter-spacing:-.018em} .overview .lead{color:var(--text-3);margin:6px 0 0;font-size:13.5px;line-height:1.5} .stat-strip{display:flex;flex-wrap:wrap;gap:0;margin-top:18px;background:var(--surface);border:1px solid var(--border-soft);border-radius:var(--r-lg);box-shadow:var(--shadow-sm);overflow:hidden} .stat{flex:1 1 110px;padding:13px 18px;border-right:1px solid var(--border-soft)} .stat:last-child{border-right:none} .stat b{display:block;font-size:21px;font-weight:680;letter-spacing:-.02em;font-variant-numeric:tabular-nums;line-height:1.2} .stat span{display:block;font-size:11px;color:var(--text-3);margin-top:2px;text-transform:uppercase;letter-spacing:.05em} .overview h2{font-size:10.5px;text-transform:uppercase;letter-spacing:.08em;color:var(--text-3);font-weight:650;margin:28px 0 12px;display:flex;align-items:center;gap:10px} .overview h2::after{content:"";flex:1;height:1px;background:var(--border-soft)} .tiles{display:grid;grid-template-columns:repeat(auto-fill,minmax(272px,1fr));gap:13px} .tile{border:1px solid var(--border-soft);border-radius:var(--r-lg);background:var(--surface);padding:15px 17px;cursor:pointer;display:flex;flex-direction:column;gap:5px;color:inherit;text-decoration:none;box-shadow:var(--shadow-sm);transition:transform .14s,box-shadow .14s,border-color .14s} .tile:hover,.tile:focus-visible{border-color:var(--border);box-shadow:var(--shadow-lg);transform:translateY(-2px);outline:none} .tile:focus-visible{border-color:var(--accent)} .tile .row{display:flex;align-items:center;gap:9px} .tile h3{font-size:14.5px;font-weight:650;min-width:0;overflow:hidden;text-overflow:ellipsis;white-space:nowrap} .tile .row .type-badge{margin-left:auto} .tile .sub{color:var(--text-3);font-size:12.5px;line-height:1.45;min-height:18px} .tile .counts{display:flex;flex-wrap:wrap;gap:4px 14px;margin-top:7px;padding-top:10px;border-top:1px solid var(--border-soft);font-size:11.5px;color:var(--text-3)} .tile .counts b{color:var(--text);font-weight:650;font-variant-numeric:tabular-nums} .xlinks{border:1px solid var(--border-soft);border-radius:var(--r-lg);background:var(--surface);box-shadow:var(--shadow-sm);overflow:hidden} .xlinks table{width:100%;border-collapse:collapse;font-size:12.5px} .xlinks td{padding:9px 16px;border-bottom:1px solid var(--border-soft);vertical-align:middle} .xlinks tr:last-child td{border-bottom:none} .xlinks tr:hover td{background:var(--surface-2)} .xlinks td:first-child{white-space:nowrap;width:1%;border-right:1px solid var(--border-soft)} .xlinks .chip{margin:1px 2px} .xlinks .arrow{color:var(--text-3)} .empty-note{color:var(--text-3);font-size:13px;background:var(--surface);border:1px dashed var(--border);border-radius:var(--r-lg);padding:16px 18px;margin:0} .empty-note code{font-family:var(--font-mono);font-size:11.5px;background:var(--surface-2);border-radius:4px;padding:1px 5px} @media (max-width:900px){ body{grid-template-columns:minmax(0,1fr);height:auto} body.nav-min{grid-template-columns:minmax(0,1fr)} nav .foot button[data-role=nav-toggle]{display:none} nav{border-right:none;border-bottom:1px solid var(--border-soft);min-width:0;overflow:visible} nav .brand{padding:12px 14px 10px;border-bottom:none} nav .group{display:flex;align-items:center;gap:6px;overflow-x:auto;padding:4px 12px 8px;scrollbar-width:thin} nav .group h2{padding:0 4px 0 0;white-space:nowrap} nav a{flex:none;padding:5px 11px;border:1px solid var(--border-soft);border-radius:999px;font-size:12.5px} nav a.active::before{display:none} nav a .n{display:none} nav .foot{margin-top:0;padding:2px 14px 10px;border-top:none;display:flex;justify-content:flex-end} nav .foot .keys{display:none} nav .foot button{width:auto;margin:0} .panel .viewer{flex:none} .overview{padding:18px 16px 30px} .stat-strip{display:grid;grid-template-columns:1fr 1fr} .stat{padding:11px 14px;border-bottom:1px solid var(--border-soft)} .stat:nth-child(2n){border-right:none} .stat:nth-last-child(-n+2){border-bottom:none} .stat b{font-size:18px} .xlinks td{padding:8px 12px} } </style> </head> <body> <nav> <div class="brand"> <span class="mark" aria-hidden="true"><svg viewBox="0 0 16 16"><path d="M3 4H7v8h6M3 12h6V4h4"/><circle cx="3" cy="4" r="1.35" fill="#fff" stroke="none"/><circle cx="13" cy="4" r="1.35" fill="#fff" stroke="none"/><circle cx="3" cy="12" r="1.35" fill="#fff" stroke="none"/><circle cx="13" cy="12" r="1.35" fill="#fff" stroke="none"/></svg></span> <span class="txt"><h1><!-- VIBEX:TITLE --></h1><div class="sub"><!-- VIBEX:SUBTITLE --></div></span> </div> <div class="group"><a href="#" data-panel="overview" class="active" aria-current="page"><span class="dot"></span><span class="t">Overview</span></a></div> <!-- VIBEX:NAV --> <div class="foot"><span class="keys"><kbd>/</kbd> search · <kbd>esc</kbd> clear · <kbd>t</kbd> theme · <kbd>0</kbd> fit · <kbd>[</kbd><kbd>]</kbd> panels</span><button type="button" data-role="theme-global">Toggle theme</button><button type="button" data-role="nav-toggle" aria-expanded="true"><svg class="i" viewBox="0 0 16 16" aria-hidden="true"><path d="M6.2 3.4 10.8 8l-4.6 4.6"/></svg><span class="lbl">Collapse index</span></button></div> </nav> <main> <section class="panel overview active" data-panel="overview"><!-- VIBEX:OVERVIEW --></section> <!-- VIBEX:PANELS --> </main> <script id="vibex-specs" type="application/json"><!-- VIBEX:SPECS --></script> <!-- VIBEX:VIEWER_JS --> <script> (function () { var specs = JSON.parse(document.getElementById('vibex-specs').textContent); var viewers = {}; var panels = Array.prototype.slice.call(document.querySelectorAll('.panel')); var links = Array.prototype.slice.call(document.querySelectorAll('nav a[data-panel], [data-goto-panel]')); // Where does an id live? First diagram that has it, preferring ERD for entities. function whereIs(id, preferType) { var hits = []; specs.forEach(function (s, i) { ['entities', 'elements', 'endpoints', 'types', 'groups', 'boundaries'].forEach(function (c) { if ((s[c] || []).some(function (x) { return x.id === id; })) hits.push({ diagram: String(i), type: s.diagram_type, collection: c }); }); }); if (preferType) { var p = hits.find(function (h) { return h.type === preferType; }); if (p) return p; } return hits[0] || null; } function crossLinks(id, collection, selfIndex) { var out = []; specs.forEach(function (s, i) { if (String(i) === String(selfIndex)) return; if (collection === 'entities') { (s.endpoints || []).forEach(function (ep) { if ((ep.entities || []).indexOf(id) !== -1) out.push({ diagram: String(i), nodeId: ep.id, label: ep.method + ' ' + ep.path }); }); } ['entities', 'elements'].forEach(function (c) { if ((s[c] || []).some(function (x) { return x.id === id; })) out.push({ diagram: String(i), nodeId: id, label: (s.meta.title || 'diagram') + ' › ' + id }); }); }); return out; } function resolveLink(href) { var base = String(href).split('/').pop().replace(/\.html$/, ''); var i = specs.findIndex(function (s) { return s.__file === base || s.__file === base + '.json'; }); return i === -1 ? null : String(i); } function panelFor(id) { return /^\d+$/.test(String(id)) ? document.querySelector('.panel[data-panel="' + id + '"]') : null; } function panelExists(id) { return !!document.querySelector('.panel[data-panel="' + String(id).replace(/"/g, '') + '"]'); } function ensureViewer(i) { if (viewers[i]) return viewers[i]; var panel = panelFor(i); if (!panel) return null; var root = panel.querySelector('[data-role=viewer]'); viewers[i] = new VibexViewer(root, specs[i], { resolveExternal: function (id) { return whereIs(id); }, onMissingNode: function (id) { var w = whereIs(id, 'erd'); if (w) show(w.diagram, id); }, crossLinks: function (id, collection) { return crossLinks(id, collection, i); }, resolveLink: resolveLink, gotoDiagram: function (d, nodeId) { show(d, nodeId); }, onSelect: function (id) { history.replaceState(null, '', '#d=' + i + '&node=' + encodeURIComponent(id)); }, }); return viewers[i]; } function show(id, nodeId) { if (!panelExists(id)) id = 'overview'; panels.forEach(function (p) { p.classList.toggle('active', p.getAttribute('data-panel') === String(id)); }); document.querySelectorAll('nav a[data-panel]').forEach(function (a) { var active = a.getAttribute('data-panel') === String(id); a.classList.toggle('active', active); if (active) a.setAttribute('aria-current', 'page'); else a.removeAttribute('aria-current'); }); if (panelFor(id)) { var v = ensureViewer(id); if (nodeId) v.selectNode(nodeId); else history.replaceState(null, '', '#d=' + id); } else history.replaceState(null, '', id === 'overview' ? '#' : '#' + id); } document.addEventListener('click', function (e) { var t = e.target.closest('[data-panel], [data-goto-panel]'); if (!t || t.closest('.panel') && !t.hasAttribute('data-goto-panel')) return; e.preventDefault(); show(t.getAttribute('data-goto-panel') || t.getAttribute('data-panel'), t.getAttribute('data-goto-node')); }); document.querySelector('[data-role=theme-global]').addEventListener('click', function () { VibexTheme.toggle(); }); function decode(v) { try { return decodeURIComponent(v); } catch (e) { return null; } } // One router for the initial hash, for browser back/forward, and for a link // someone pastes into an already-open page. function fromHash() { var hash = location.hash; var d = /[#&]d=(\d+)/.exec(hash); var node = /[#&]node=([^&]+)/.exec(hash); if (d) return { id: d[1], node: node ? decode(node[1]) : null }; var docs = /^#(docs)(?:-(\d+))?(?:$|[&/])/.exec(hash); if (docs) return { id: 'docs-' + (docs[2] || '0'), node: null }; if (/^#changelog\b/.test(hash)) return { id: 'changelog', node: null }; if (/^#?$/.test(hash)) return { id: 'overview', node: null }; return null; } function route() { var t = fromHash(); if (t) show(t.id, t.node); } window.addEventListener('hashchange', route); route(); // Docs panel: filter claims by text and by whether they need attention. // Plain DOM work — the docs panel has no SVG and needs no viewer. Array.prototype.slice.call(document.querySelectorAll('.panel.docs')).forEach(function docsPanel(panel) { var search = panel.querySelector('[data-role=docs-search]'); var buttons = Array.prototype.slice.call(panel.querySelectorAll('[data-docs-filter]')); var claims = Array.prototype.slice.call(panel.querySelectorAll('.claim')); var sections = Array.prototype.slice.call(panel.querySelectorAll('.docs-section')); var noMatch = panel.querySelector('.no-match'); var ATTENTION = { stale: 1, broken: 1, expired: 1 }; var mode = 'all'; function apply() { var q = (search && search.value || '').trim().toLowerCase(); var shown = 0; claims.forEach(function (el) { var ok = (!q || el.getAttribute('data-find').indexOf(q) !== -1) && (mode === 'all' || ATTENTION[el.getAttribute('data-conf')]); el.hidden = !ok; if (ok) shown += 1; }); // A heading with nothing under it is noise; the coverage block stays. sections.forEach(function (sec) { if (sec.querySelector('.coverage') && mode === 'all' && !q) { sec.hidden = false; return; } var any = sec.querySelector('.claim:not([hidden])'); sec.hidden = !any; }); if (noMatch) noMatch.hidden = shown > 0; } if (search) search.addEventListener('input', apply); buttons.forEach(function (b) { b.addEventListener('click', function () { mode = b.getAttribute('data-docs-filter'); buttons.forEach(function (x) { x.classList.toggle('on', x === b); }); apply(); }); }); // In-page jumps from "Needs attention" must survive an active filter. panel.addEventListener('click', function (e) { var a = e.target.closest('a[href^="#claim-"]'); if (!a) return; e.preventDefault(); var target = panel.querySelector(a.getAttribute('href').replace(/"/g, '')); if (!target) return; if (target.hidden) { mode = 'all'; if (search) search.value = ''; buttons.forEach(function (x) { x.classList.toggle('on', x.getAttribute('data-docs-filter') === 'all'); }); apply(); } target.scrollIntoView({ block: 'center' }); target.classList.add('flash'); setTimeout(function () { target.classList.remove('flash'); }, 1200); }); }); // The index can step aside. Collapsed, each entry keeps its colour dot, so the // title moves to a tooltip rather than disappearing. (function () { var btn = document.querySelector('[data-role=nav-toggle]'); if (!btn) return; Array.prototype.forEach.call(document.querySelectorAll('nav a[data-panel]'), function (a) { var t = a.querySelector('.t'); if (t && !a.title) a.title = t.textContent; }); function apply(collapsed, persist) { document.body.classList.toggle('nav-min', collapsed); var label = collapsed ? 'Expand index' : 'Collapse index'; btn.setAttribute('aria-expanded', collapsed ? 'false' : 'true'); btn.setAttribute('aria-label', label); btn.title = label + ' ['; var lbl = btn.querySelector('.lbl'); if (lbl) lbl.textContent = label; if (persist) { try { localStorage.setItem('vibex-nav', collapsed ? '1' : '0'); } catch (e) {} } } btn.addEventListener('click', function () { apply(!document.body.classList.contains('nav-min'), true); }); document.addEventListener('keydown', function (e) { if (e.target.tagName === 'INPUT' || e.target.tagName === 'TEXTAREA') return; if (e.metaKey || e.ctrlKey || e.altKey) return; if (e.key === '[') { e.preventDefault(); apply(!document.body.classList.contains('nav-min'), true); } }); var stored = null; try { stored = localStorage.getItem('vibex-nav'); } catch (e) {} apply(stored === '1', false); })(); })(); </script> </body> </html>assets/favicon.svg631 B1a382a6e7fe3upstream ↗
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 32 32" width="32" height="32" role="img" aria-label="vibeX"> <title>vibeX</title> <rect width="32" height="32" rx="7" fill="#2b6cb0"/> <g transform="translate(4 4)"> <g fill="none" stroke="#ffffff" stroke-width="1.8" stroke-linecap="round" stroke-linejoin="round"> <path d="M4.5 5.5H10.5V18.5H19.5"/> <path d="M4.5 18.5H13.5V5.5H19.5"/> </g> <g fill="#ffffff"> <circle cx="4.5" cy="5.5" r="2"/> <circle cx="19.5" cy="5.5" r="2"/> <circle cx="4.5" cy="18.5" r="2"/> <circle cx="19.5" cy="18.5" r="2"/> </g> </g> </svg>assets/icon.svg526 B282f5246ce42upstream ↗
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" width="24" height="24" role="img" aria-label="vibeX"> <title>vibeX</title> <g fill="none" stroke="currentColor" stroke-width="1.8" stroke-linecap="round" stroke-linejoin="round"> <path d="M4.5 5.5H10.5V18.5H19.5"/> <path d="M4.5 18.5H13.5V5.5H19.5"/> </g> <g fill="currentColor"> <circle cx="4.5" cy="5.5" r="2"/> <circle cx="19.5" cy="5.5" r="2"/> <circle cx="4.5" cy="18.5" r="2"/> <circle cx="19.5" cy="18.5" r="2"/> </g> </svg>assets/template.html1.9 KBd105e36c6c32upstream ↗
<!doctype html> <html lang="en" data-theme="light" data-diagram-type="<!-- VIBEX:TYPE -->" data-theme-pref="<!-- VIBEX:THEME -->"> <head> <meta charset="utf-8"> <meta name="viewport" content="width=device-width, initial-scale=1"> <!-- VIBEX:STAMP --> <title><!-- VIBEX:TITLE --></title> <!-- VIBEX:CSS --> <style> body{display:flex;flex-direction:column;min-height:100vh} .viewer{flex:1} @media (max-width:900px){body{min-height:auto;height:auto}html{height:auto}.viewer{flex:none}} </style> </head> <body> <section class="viewer" data-role="viewer"> <header class="toolbar"> <div class="titles"> <h1><!-- VIBEX:TITLE --></h1> <span class="type-badge <!-- VIBEX:TYPE -->"><!-- VIBEX:TYPE --></span> <p class="sub"><!-- VIBEX:SUBTITLE --></p> </div> <!-- VIBEX:ACTIONS --> </header> <div class="viewer-body"> <div class="canvas" data-role="canvas"> <!-- VIBEX:SVG --> <div class="hint">drag a box to move it · drag empty space to pan · wheel to zoom · click a node</div> </div> <aside> <section><h2>Details</h2><div class="details" data-role="details" aria-live="polite"><p class="empty">Click a node or relationship.</p></div></section> <section><h2>Legend</h2><!-- VIBEX:LEGEND --></section> <section><h2>Stats</h2><div class="stats" data-role="stats"></div></section> </aside> </div> <div class="cards"><!-- VIBEX:CARDS --></div> </section> <script id="vibex-spec" type="application/json"><!-- VIBEX:SPEC --></script> <!-- VIBEX:VIEWER_JS --> <script> (function () { var spec = JSON.parse(document.getElementById('vibex-spec').textContent); var viewer = new VibexViewer(document.querySelector('[data-role=viewer]'), spec); var m = /[#&]node=([^&]+)/.exec(location.hash); if (m) { try { viewer.selectNode(decodeURIComponent(m[1])); } catch (e) { /* malformed hash */ } } })(); </script> </body> </html>assets/viewer.css33 KB4f9f58c4eb2bupstream ↗
Contents are not inlined in the catalog. Open the upstream file.
assets/viewer.js48 KB1919ea53aa14upstream ↗
Contents are not inlined in the catalog. Open the upstream file.
.claude-plugin/marketplace.json460 Bbdc78683ddaeupstream ↗
{ "name": "vibex", "owner": { "name": "Raja Osama", "url": "https://github.com/Raja0sama" }, "description": "vibeX: architecture diagrams and checkable docs from your codebase", "plugins": [ { "name": "vibex", "source": "./", "description": "ERD, C4, API endpoint, lifecycle, sequence and service-links diagrams from your code, plus documentation that fails CI when the code moves.", "category": "documentation" } ] }.claude-plugin/plugin.json620 B88850a9c06e6upstream ↗
{ "name": "vibex", "displayName": "vibeX", "version": "0.8.1", "description": "ERD, C4, API endpoint, lifecycle, sequence and service-links diagrams from your code, as a JSON spec plus a standalone HTML viewer, and documentation whose claims fail CI when the code moves.", "author": { "name": "Raja Osama", "url": "https://github.com/Raja0sama" }, "homepage": "https://github.com/Raja0sama/vibex#readme", "repository": "https://github.com/Raja0sama/vibex", "license": "MIT", "keywords": [ "diagram", "erd", "c4", "openapi", "mermaid", "architecture", "docs" ] }.editorconfig188 Bf15441abf844upstream ↗
root = true [*] charset = utf-8 end_of_line = lf insert_final_newline = true trim_trailing_whitespace = true indent_style = space indent_size = 2 [*.md] trim_trailing_whitespace = false.github/dependabot.yml189 B59598a02ef61upstream ↗
version: 2 updates: # Workflow actions are pinned to commit SHAs; this keeps the pins current. - package-ecosystem: github-actions directory: / schedule: interval: weekly.github/ISSUE_TEMPLATE/1-doc-request.yml1.1 KB971bfc3df60fupstream ↗
name: Request a document description: Ask for something to be documented that is not documented yet. title: "Document: " labels: [docs, intake] body: - type: markdown attributes: value: | You do not need to know how the docs work. Say what you wanted to find out and could not — that is the most useful thing you can give us. - type: textarea id: question attributes: label: What question should this answer? description: One sentence, in your own words. "How does a refund actually reach the customer?" is perfect. placeholder: How does ... validations: { required: true } - type: textarea id: context attributes: label: What made you ask? description: What were you doing when you needed this? It tells us how deep to go. - type: input id: area attributes: label: Which part of the system, if you know placeholder: the BFF, the orders table, checkout... - type: textarea id: vibex attributes: label: Context description: Filled in automatically if you came from a diagram. Leave it as it is. render: vibex.github/ISSUE_TEMPLATE/2-doc-problem.yml913 Be98c82d1fac4upstream ↗
name: Report a problem with the docs description: Something written down is wrong, out of date, or misleading. title: "Docs wrong: " labels: [docs, intake] body: - type: textarea id: wrong attributes: label: What does it say, and what is actually true? description: Quote the sentence if you can. If you only know it is wrong and not what is right, say that — it is still worth filing. validations: { required: true } - type: dropdown id: certainty attributes: label: How sure are you? options: - I know this is wrong - I think this is wrong - Something here confused me and I cannot tell validations: { required: true } - type: textarea id: vibex attributes: label: Context description: Filled in automatically if you came from a claim. Leave it as it is — it points at the exact sentence. render: vibex.github/ISSUE_TEMPLATE/3-spec-gap.yml822 B82dd60554f0cupstream ↗
name: Something is missing from a diagram description: A table, service, endpoint or state that exists in the code but not in the diagram. title: "Missing: " labels: [spec, intake] body: - type: textarea id: missing attributes: label: What is missing or wrong? placeholder: The disputes table is not in the ERD, and orders references it. validations: { required: true } - type: input id: where attributes: label: Where does it live in the code? description: A path helps enormously — it is what turns this into a change rather than a search. placeholder: src/disputes/dispute.entity.ts - type: textarea id: vibex attributes: label: Context description: Filled in automatically if you came from a diagram. Leave it as it is. render: vibex.github/ISSUE_TEMPLATE/4-proposal.yml1.1 KB59b2c46fc69cupstream ↗
name: Propose something that does not exist description: Describe a change to the system so it can be drawn and argued about before anyone builds it. title: "Proposal: " labels: [proposal, intake] body: - type: markdown attributes: value: | This produces a **proposal**: a diagram and document marked, everywhere they appear, as describing something that does not exist. They are never checked against code, because there is none. - type: textarea id: what attributes: label: What are you proposing? placeholder: A second region, so an outage in one does not stop the other. validations: { required: true } - type: textarea id: why attributes: label: What problem does it solve? validations: { required: true } - type: textarea id: unknowns attributes: label: What have you not worked out? description: This becomes the proposal's "what this does not cover" section, which is the part that makes it honest. - type: textarea id: vibex attributes: label: Context render: vibex.github/ISSUE_TEMPLATE/config.yml218 B15972aa1c85dupstream ↗
blank_issues_enabled: true contact_links: - name: Ask a question url: https://github.com/Raja0sama/vibex/discussions about: Not sure which of these fits? Ask here and someone will point you at the right one..github/pull_request_template.md454 Bc75f8d8a15dfupstream ↗
## What this changes <!-- One or two sentences. The commit history explains how; this explains why. --> ## Checks - [ ] `npm test` passes - [ ] `node bin/vibex.mjs demo out` prints no warnings - [ ] `node bin/vibex.mjs validate <spec>` passes for any spec touched - [ ] The drift check passes, and any claim I re-anchored I actually re-read ## If this changes what a generated file contains - [ ] `CHANGELOG.md` has an entry under `## [Unreleased]`.github/scripts/triage-issue.mjs2.7 KBedddae9b228dupstream ↗
#!/usr/bin/env node // Reads an intake issue, decides whether it can be acted on, and writes the // answer to GITHUB_OUTPUT. It never edits a spec and never opens a pull // request — it only decides, so that the decision is testable on its own. import fs from 'node:fs'; import path from 'node:path'; import { parseIntake, triage, PLAYBOOK, ACTIONS } from '../../renderers/shared/triage.mjs'; import { buildGraph, specId } from '../../renderers/docs/graph.mjs'; import { validateSpec, DIAGRAM_TYPES } from '../../renderers/shared/validate.mjs'; const dir = process.argv[2] || 'examples'; const body = process.env.ISSUE_BODY || ''; const labels = (process.env.ISSUE_LABELS || '').split(',').map((l) => l.trim()).filter(Boolean); // Mirrors the author job's gate in intake.yml: only people with write access reach the agent. const trusted = ['OWNER', 'MEMBER', 'COLLABORATOR'].includes(process.env.ISSUE_AUTHOR_ASSOCIATION || ''); // Build the current picture so every reference in the issue is checked against // what exists now, not what existed when the page was rendered. const specs = new Map(); const docsSpecs = []; for (const file of fs.existsSync(dir) ? fs.readdirSync(dir).filter((f) => f.endsWith('.json')) : []) { let spec; try { spec = JSON.parse(fs.readFileSync(path.join(dir, file), 'utf8')); } catch { continue; } if (!spec?.diagram_type || !validateSpec(spec).ok) continue; const id = specId(spec, file.replace(/\.json$/, '')); if (spec.diagram_type === 'docs') docsSpecs.push(spec); else specs.set(id, spec); } const graph = docsSpecs.length ? { claims: docsSpecs.flatMap((d) => buildGraph(d, { specs }).claims) } : null; const parsed = parseIntake(body); const result = triage(parsed, { graph, specIds: new Set(specs.keys()), specs, labels, body }); const reply = result.action === ACTIONS.ask ? result.reply : result.action === ACTIONS.act && trusted ? `Picking this up.\n\n**What I will do:** ${PLAYBOOK[parsed.intent]}\n\nI will open a pull request. A person reviews it before anything merges — nothing here changes the docs on its own.` : result.action === ACTIONS.act ? `This has everything needed to act on, and it is labelled \`ready\`. Issues from outside the project are not handed to the agent automatically, so a maintainer will pick it up.\n\n**What will be done:** ${PLAYBOOK[parsed.intent]}` : ''; const out = { action: result.action, intent: parsed.intent || '', reason: result.reason, target: JSON.stringify(result.target || {}), reply, playbook: PLAYBOOK[parsed.intent] || '', }; const sink = process.env.GITHUB_OUTPUT; for (const [k, v] of Object.entries(out)) { const line = `${k}<<__VIBEX__\n${v}\n__VIBEX__\n`; if (sink) fs.appendFileSync(sink, line); else process.stdout.write(line); }.github/workflows/ci.yml5.1 KBaeb0cac57218upstream ↗
name: ci on: push: branches: [main] pull_request: jobs: test: runs-on: ubuntu-latest strategy: fail-fast: false matrix: node: [18, 20, 22] steps: - uses: actions/checkout@11d5960a326750d5838078e36cf38b85af677262 # v4 - uses: actions/setup-node@49933ea5288caeca8642d1e84afbd3f7d6820020 # v4 with: node-version: ${{ matrix.node }} - run: node --version - run: npm test - run: node bin/vibex.mjs types - run: node bin/vibex.mjs demo out render-warnings: runs-on: ubuntu-latest steps: - uses: actions/checkout@11d5960a326750d5838078e36cf38b85af677262 # v4 - uses: actions/setup-node@49933ea5288caeca8642d1e84afbd3f7d6820020 # v4 with: node-version: 22 - name: examples must render without warnings run: | node bin/vibex.mjs demo out 2> stderr.txt if grep -qi 'warning' stderr.txt; then cat stderr.txt; exit 1; fi docs-drift: runs-on: ubuntu-latest steps: # Full history: a shallow clone cannot diff against the commit a lock # file names, and a check that silently degrades is worse than none. - uses: actions/checkout@11d5960a326750d5838078e36cf38b85af677262 # v4 with: { fetch-depth: 0 } - uses: actions/setup-node@49933ea5288caeca8642d1e84afbd3f7d6820020 # v4 with: node-version: 22 # --no-lock on purpose. The lock file is an optimisation for local # iteration; it arrives here from a contributor's machine and asserts # that claims were verified. CI re-reads every anchor from scratch # rather than taking that on trust. It costs milliseconds. - name: every claim must still hold against the code run: | status=0 for spec in examples/*.docs.json; do echo "::group::$spec" node bin/vibex.mjs docs "$spec" examples \ --repo examples/shop-repo --check --no-lock -o /dev/null || status=1 echo "::endgroup::" done if [ $status -ne 0 ]; then echo "::error::Documentation has drifted from the code." echo "A claim is stale, broken, or out of date. Do not re-anchor blindly:" echo " 1. read the code the claim points at" echo " 2. still true -> vibex docs <spec> <dir> --repo . --reanchor" echo " 3. no longer -> rewrite the claim, or supersede it" exit 1 fi - name: the markdown copy must stay free of raw HTML run: | node bin/vibex.mjs docs examples/auth.docs.json examples \ --repo examples/shop-repo --no-lock --md doc.md -o /dev/null if grep -qE '</?[a-zA-Z][^>]*>' doc.md; then echo "::error::Raw HTML in the Markdown export would not render in Confluence or a wiki." grep -nE '</?[a-zA-Z][^>]*>' doc.md exit 1 fi pack: runs-on: ubuntu-latest steps: - uses: actions/checkout@11d5960a326750d5838078e36cf38b85af677262 # v4 - uses: actions/setup-node@49933ea5288caeca8642d1e84afbd3f7d6820020 # v4 with: node-version: 22 - name: tarball must ship every runtime asset run: | npm pack --dry-run --json > pack.json for f in bin/vibex.mjs assets/template.html assets/dashboard.html assets/viewer.js assets/viewer.css \ schemas/erd.schema.json schemas/docs.schema.json schemas/docs-graph.schema.json \ renderers/docs/graph.mjs renderers/docs/facts.mjs renderers/docs/anchors.mjs \ examples/orders.erd.json examples/shop.docs.json SKILL.md LICENSE; do grep -q "\"path\": *\"$f\"" pack.json || { echo "missing from tarball: $f"; exit 1; } done # A file list only catches what someone remembered to list. Install the # tarball and run it: the demo is the first thing a new user sees, and it # must not open on a wall of unverifiable claims in a tool whose pitch is # documentation you can trust. - name: the packed tarball must work from a clean install run: | mkdir -p /tmp/pkg /tmp/install npm pack --pack-destination /tmp/pkg tar xzf /tmp/pkg/*.tgz -C /tmp/install cd /tmp/install/package node bin/vibex.mjs demo out node -e ' const html = require("fs").readFileSync("out/dashboard.html", "utf8"); const count = (re) => (html.match(re) || []).length; const broken = count(/conf broken/g); const verified = count(/conf verified/g); const panels = count(/<section class="panel docs"/g); console.log(`verified ${verified}, unverifiable ${broken}, docs panels ${panels}`); if (!panels) { console.error("::error::the packed demo rendered no documentation panel"); process.exit(1); } if (!verified) { console.error("::error::the packed demo verified nothing"); process.exit(1); } if (broken) { console.error(`::error::${broken} unverifiable claims in the packed demo — an anchored file is missing from the tarball`); process.exit(1); } '.github/workflows/intake.yml4.8 KB455c12ba2985upstream ↗
name: intake # Someone filed a request from a diagram or a doc. Decide whether it can be # acted on, and say so on the issue either way — an intake queue that answers # nothing is worse than no intake queue. on: issues: types: [opened, edited, labeled] permissions: contents: read issues: write jobs: triage: if: contains(join(github.event.issue.labels.*.name, ','), 'intake') runs-on: ubuntu-latest outputs: action: ${{ steps.decide.outputs.action }} intent: ${{ steps.decide.outputs.intent }} playbook: ${{ steps.decide.outputs.playbook }} steps: - uses: actions/checkout@11d5960a326750d5838078e36cf38b85af677262 # v4 - uses: actions/setup-node@49933ea5288caeca8642d1e84afbd3f7d6820020 # v4 with: node-version: 22 - id: decide env: ISSUE_BODY: ${{ github.event.issue.body }} ISSUE_LABELS: ${{ join(github.event.issue.labels.*.name, ',') }} ISSUE_AUTHOR_ASSOCIATION: ${{ github.event.issue.author_association }} run: node .github/scripts/triage-issue.mjs examples - name: say what happens next if: steps.decide.outputs.reply != '' uses: actions/github-script@f28e40c7f34bde8b3046d885e986cb6290c5673b # v7 env: REPLY: ${{ steps.decide.outputs.reply }} with: script: | await github.rest.issues.createComment({ owner: context.repo.owner, repo: context.repo.repo, issue_number: context.issue.number, body: process.env.REPLY, }); - name: label what it needs uses: actions/github-script@f28e40c7f34bde8b3046d885e986cb6290c5673b # v7 with: script: | const action = '${{ steps.decide.outputs.action }}'; const label = action === 'ask' ? 'needs-info' : action === 'act' ? 'ready' : null; if (!label) return; await github.rest.issues.addLabels({ owner: context.repo.owner, repo: context.repo.repo, issue_number: context.issue.number, labels: [label], }); # The authoring step. It runs only once triage says the request is actionable, # and only if an API key is configured — without one the queue still triages # and answers, it just does not write anything. # Issue text is public input: anyone can open one, and the templates label it # intake. Only issues from people with write access reach the agent; the rest # are still triaged and answered, and a maintainer picks them up by hand. author: needs: triage if: >- needs.triage.outputs.action == 'act' && contains(fromJSON('["OWNER", "MEMBER", "COLLABORATOR"]'), github.event.issue.author_association) runs-on: ubuntu-latest permissions: contents: write pull-requests: write issues: write steps: - uses: actions/checkout@11d5960a326750d5838078e36cf38b85af677262 # v4 - name: check for a key id: key run: echo "present=${{ secrets.ANTHROPIC_API_KEY != '' }}" >> "$GITHUB_OUTPUT" - name: explain that nothing will be written if: steps.key.outputs.present != 'true' uses: actions/github-script@f28e40c7f34bde8b3046d885e986cb6290c5673b # v7 with: script: | await github.rest.issues.createComment({ owner: context.repo.owner, repo: context.repo.repo, issue_number: context.issue.number, body: 'This request is actionable, but no `ANTHROPIC_API_KEY` is configured, so nothing will be written automatically. It is labelled `ready` for a person to pick up.', }); # Configure ANTHROPIC_API_KEY to turn this on. The agent reads SKILL.md, # which already forbids inventing an asserted claim and requires the # drift check to pass — and it opens a pull request, never a merge. - name: write it if: steps.key.outputs.present == 'true' uses: anthropics/claude-code-action@86d88e619d8e6caf07b5c3944dd14f441c533718 # v1 with: anthropic_api_key: ${{ secrets.ANTHROPIC_API_KEY }} prompt: | Follow SKILL.md in this repository. ${{ needs.triage.outputs.playbook }} The request is GitHub issue #${{ github.event.issue.number }}. Read it, including the fenced `vibex` block, which names exactly which claim, spec or node the reader was looking at. Before you finish, run: node bin/vibex.mjs validate <every spec you touched> node bin/vibex.mjs docs <the docs spec> <dir> --repo . --check --no-lock Open a pull request that closes the issue. Do not merge it. If you could not establish something from the code, say so in coverage.out_of_scope rather than asserting it in anyone's name..github/workflows/publish.yml2.6 KB0e22255ce43fupstream ↗
name: publish # Publishing from a laptop needs an interactive 2FA prompt. Publishing from here # needs a granular access token with "bypass 2FA" enabled, stored as the NPM_TOKEN # secret — which also means the release is reproducible from a tag rather than # from whatever happened to be in someone's working tree. # # Release: git tag v0.1.0 && git push --tags on: push: tags: ['v*'] workflow_dispatch: inputs: dry_run: description: 'Pack and verify, but do not publish' type: boolean default: true permissions: contents: read # Provenance: npm records which repo, workflow and commit built each tarball. id-token: write jobs: publish: runs-on: ubuntu-latest steps: - uses: actions/checkout@11d5960a326750d5838078e36cf38b85af677262 # v4 with: { fetch-depth: 0 } - uses: actions/setup-node@49933ea5288caeca8642d1e84afbd3f7d6820020 # v4 with: node-version: 22 registry-url: https://registry.npmjs.org # A tag that disagrees with package.json ships a version nobody can trace # back to a commit. Fail before anything leaves the machine. - name: the tag must match package.json if: startsWith(github.ref, 'refs/tags/v') run: | tag="${GITHUB_REF_NAME#v}" pkg=$(node -p "require('./package.json').version") echo "tag=$tag package.json=$pkg" if [ "$tag" != "$pkg" ]; then echo "::error::Tag v$tag does not match package.json $pkg. Bump one of them." exit 1 fi - run: npm test # The demo is the first thing anyone runs after installing. If it cannot # run from the packed tarball, the release is broken no matter what the # unit tests say. - name: the packed tarball must actually work run: | npm pack tgz=$(ls ./*.tgz) mkdir -p /tmp/smoke && cd /tmp/smoke npm init -y > /dev/null npm install "$GITHUB_WORKSPACE/$tgz" > /dev/null npx vibex types npx vibex demo ./out test -f ./out/dashboard.html test -f ./out/orders.erd.html echo "tarball smoke test passed" - name: publish if: startsWith(github.ref, 'refs/tags/v') || inputs.dry_run == false run: npm publish --access public --provenance env: NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }} - name: dry run only if: "!startsWith(github.ref, 'refs/tags/v') && inputs.dry_run != false" run: echo "Verified but not published. Re-run with dry_run=false, or push a v* tag.".gitignore319 B32856fd426d4upstream ↗
node_modules/ out/ *.html !assets/*.html *.tgz .DS_Store .claude/ content/ # Generated docs artefacts (docs.lock.json IS committed — it is the record) docs.json changelog.json # The landing page and the Relay showcase are their own repository # (Raja0sama/vibex-website), checked out here for convenience. website/bin/vibex.mjs44 KBb45ab38f17f8upstream ↗
Contents are not inlined in the catalog. Open the upstream file.
CHANGELOG.md28 KBe10c4ff0f379upstream ↗
# Changelog All notable changes to this project are recorded here. The format follows Keep a Changelog; versions follow SemVer. ## [Unreleased] Nothing yet. ## [0.8.1] - 2026-10-16 ### Fixed - **Nested sequence fragments are drawn inside each other.** An `alt` inside a `loop` no longer shares the loop's edges. ## [0.8.0] - 2026-10-16 ### Added - **Sequence diagrams.** A new `sequence` type draws one flow end to end: participants, numbered messages (sync, async, reply), activation bars, notes, and `alt`/`opt`/`loop`/`par`/`break` fragments. Exports to Mermaid `sequenceDiagram`, shows in the dashboard as Flows, and the `sequence.messages` docs generator writes one sentence per step. Example: `examples/checkout.sequence.json`. - **`vibex workspace`: one site for several repos.** Run it from the folder above them. It finds each repo's specs and builds a landing page plus one dashboard per repo. Specs can live inside each repo or in a shared folder. - **`vibex host`: serve the docs behind a login.** Writes a Dockerfile, `docker-compose.yml` and nginx config next to any folder of pages. The login is on by default; the container will not start without `VIBEX_USER` and `VIBEX_PASSWORD` unless `VIBEX_PUBLIC=1`. `/healthz` stays open for platform health checks. ### Changed - **Busy lifecycle diagrams are easier to read.** States in a column are ordered to cut crossings, and transitions that go back a step loop over or under the boxes instead of piling onto one side. ## [0.7.2] - 2026-10-06 ### Security - **npm provenance.** Each release records which repository, workflow and commit built it, shown on the npm page. - **Intake agent only acts for maintainers.** Issue text is public input; issues from outside the project are triaged and answered, but a maintainer picks them up. - **`--open` on Windows** uses `explorer.exe` instead of `cmd /c start`, which could run a command hidden in a file name. - **Workflow actions pinned to commits**, kept current by Dependabot. ## [0.7.1] - 2026-10-05 ### Added - **Install in Claude Code and Codex with one command.** `npx skills add Raja0sama/vibex -g -a claude-code -a codex -y`. Claude Code can also install it as a plugin: `/plugin marketplace add Raja0sama/vibex`, then `/plugin install vibex@vibex`. ### Fixed - **`links` counts as a diagram type.** `vibex types` lists it, `demo` renders `shop.links.html`, and `docs` and `links` can load a links spec beside the others. ### Changed - **Skill description** fits the 1024-character Agent Skills limit and now triggers on service maps and Mermaid. ## [0.7.0] - 2026-10-05 ### Added - **`links` spec + `vibex links`.** Record how services call each other: one entry per call, anchored on the client and the handler. `--repo name=dir` checks across several repos; `--check` fails CI when either end moves. Lists endpoints nothing calls (`services[].ignore` hides health routes; `endpoint` takes a list for templated calls). Checks C4 diagrams against the calls (`services[].c4`): arrows with no call, calls with no arrow, neighbours left out. Example: `examples/shop.links.json`. - **System view.** A links spec renders as a diagram (and leads the dashboard): services as boxes, one arrow per service pair labelled with its call count. Click an arrow for every route behind it. - **Save layout.** Moved boxes can now be kept. The viewer offers **Copy prompt** (for your coding agent), **Copy JSON**, or **Raise an issue** (prefilled, when `meta.repository.url` is set). `vibex layout <spec> <file>` writes it into `layout.positions`, and every render after that draws the boxes there. Intake triages `layout` issues and checks each box still exists. - **Mermaid export, for every diagram.** A Mermaid button on every page and dashboard panel, a `.mmd` beside every `vibex render`, and `vibex mermaid <spec>`. ERD becomes `erDiagram`, lifecycle `stateDiagram-v2`, C4 and the System view a flowchart with nested boundaries, endpoints a flowchart of groups and types. ### Fixed - **Lines no longer cut through boxes.** In C4, ERD, lifecycle and System views, and while dragging, a line that would cross another box routes around it. ## [0.6.0] - 2026-09-26 ### Added - **Drag boxes to move them.** Lines re-route and labels follow. A C4 boundary carries what's inside; an endpoint row drags its card. Fit and export include moved boxes. `r` or **Reset layout** puts them back. - **Layout lives until reload.** Each dashboard panel keeps its moves, zoom, selection and search while you switch panels. Nothing is stored. - **`--linked`** on `render`, `dashboard`, `demo`. The HTML is a placeholder; data goes in `<name>.data.js`, the viewer in `vibex-viewer.js/.css`. Still opens from disk. Default single-file output is unchanged. - **Browser tests:** `npm run test:e2e` (needs `playwright-core` and Chrome). ## [0.5.0] - 2026-09-24 Anchored claims on Python, YAML, Makefiles and any file type not known to be whitespace-insensitive are hashed with indentation kept. Existing claims on those files read `stale` once after upgrading, so a docs drift check in CI will fail until each one is re-read and re-anchored. ### Fixed - **An anchored claim on Python or YAML verified after its code changed meaning.** The anchor hash collapsed all whitespace, so moving a `return` out of an `if`, or re-nesting a YAML key under a sibling, left the hash identical and the claim `verified`. The whitespace-insensitive hash now applies only to an explicit list of languages where whitespace is not syntax. Everything else, including any extension not on that list, keeps leading indentation and ignores only trailing whitespace, line endings and trailing blank lines. An existing claim on such a file goes `stale` once: re-read it, then `--reanchor`. A lock written by an earlier version is re-checked rather than trusted. ### Added - **`source.hash_mode: "exact" | "loose"`** overrides the per-extension default. `vibex validate` warns (`loose-hash`) when it is set to `loose` on a file where indentation is syntax. ## [0.4.0] - 2026-09-21 C4 boxes are sized for the text they actually hold. Existing specs render at different heights and edge labels that used to be cut now wrap, so this changes what a generated file contains. ### Fixed - **A C4 description longer than three lines was silently halved.** The cap is now measured by wrapping the wordiest description in the spec, bounded at five lines, and the whole rank grows to hold it. Greedy wrapping leaves ragged line ends, so dividing a description's length by the characters that fit comes up a line short — the wrap itself is the only honest count. One verbose element makes every box in the rank taller. That is the trade worth making: a long description costs height rather than quietly losing half of itself. - **A dashboard could size a diagram's boxes from the previous diagram's text.** Sizing and drawing are two passes over the same spec, and the line cap they both read was module state. It travels as an argument now, so many renders in one process cannot interfere — the failure mode being boxes measured for three lines holding five. - **Edge labels were truncated at 40 characters.** The label box was always sized from its own text, so nothing forced that cap; it just threw the rest away. Labels wrap to two lines instead. ### Added - **A render says when text did not fit, and names what was cut.** The warning gives the element ids or the `from→to` of the relationships affected, and points at the tooltip and details panel where the full text is still readable. Silence is the failure mode this project exists to avoid. Whitespace is normalised on both sides before the comparison, so a description containing a newline no longer reports as shortened when every word of it survived. ## [0.3.1] - 2026-09-20 Install instructions only. No change to the CLI, the renderers, or anything a generated file contains. ### Changed - **The skill is the way in, everywhere.** README and landing page now lead with `cd ~ && npx skills add Raja0sama/vibex`, with the CLI presented as what the skill drives rather than as the thing you install first. `skills add` resolves relative to the directory you run it in, which is the failure people actually hit: run it in a project and the skill exists only there. That is now stated wherever the command appears. The npm global install stays as the pinned-release route, with a warning that under nvm `npm root -g` is scoped to the current Node version, so the symlink dies silently on an upgrade. - The README claimed the repository was private and that `skills add` "does not work yet". It has been public since before 0.2.0 and the command works. ## [0.3.0] - 2026-09-20 Generated files can now say what built them, and every panel around the canvas gets out of its way. Both change what a generated file contains, so this is a minor. ### Added - **`vibex outdated <dir>` — which generated files this version would now render differently.** Every generated file records what produced it: `generator` for a person, and a build fingerprint for a machine. The fingerprint covers every renderer and every inlined asset, not just the version, so a fix that only touched `viewer.css` is as detectable as a release. It exits 1 when anything is stale, so CI can gate on it the way it gates on documentation drift. A stale artifact and a broken feature look identical to whoever opens the file; this is how you tell them apart. What it does not answer is whether the *spec* moved — a generated file carries its own spec, but renderers normalise before embedding, so a truthful answer there means re-rendering rather than diffing JSON. - **Every panel around the canvas now collapses, and remembers it.** The dashboard index, the right-hand details panel and the notes strip each take a click or a key — `[`, `]` and `\` — and the choice is kept per panel across reloads. Collapsing is not hiding. The index keeps its colour dots and its active marker, and the details panel keeps `Details`, `Legend` and `Stats` readable down its edge; clicking one reopens the panel at that section. A reader who wants the diagram wide gets it without losing their way back. ## [0.2.1] - 2026-09-20 Documentation, README and landing page. No change to the CLI, the renderers, the schemas, or anything a generated file contains. ### Changed - The README leads with the skill rather than the CLI, and folds its reference material into collapsible sections. - The demo is shown rather than promised: a linked thumbnail in the README, and an embedded player on the landing page. - Attribution is now a `Prior art` section crediting the wider diagrams-as-code field — Mermaid, PlantUML, Structurizr, DBML, Graphviz and archify — instead of naming a single project. - The landing page gained depth, and its nav no longer swallows the heading you jumped to. - Article drafts are no longer tracked; `content/` is ignored. ## [0.2.0] - 2026-09-19 Four diagram types, documentation as a checkable fact graph, and a release list built from git history. ### Changed - Redesigned the generated viewer shell: icon toolbar with segmented zoom/export controls, dot-grid canvas, floating hint pill, sectioned side panel, scrollable detail tables that drop empty columns, tinted note cards, styled scrollbars, and a print stylesheet. - Dashboard: brand mark, per-type colour dots in the sidebar, a totals strip on the overview, tiles that lift on hover, and a two-column stat grid on phones. - Diagram boxes get a soft drop shadow; the theme button now shows the theme you are switching to. - **C4 diagrams redesigned.** Databases and queues now have their own fills (teal, indigo) instead of sharing the container blue, so the legend swatches finally match the canvas; the swatches also echo each shape. Boxes hug their content and share one height per diagram, with the text block centred rather than top-aligned. Person elements read as a head over shoulders. Databases are proper cylinders with both caps. Boundaries get a tinted frame, a label tag that straddles the top edge, and a more solid frame the deeper they nest. `Drill down ↗` is an underlined footer instead of a corner note. Edge labels are slightly smaller and grow a dotted leader when obstacle avoidance pushes them off their own line. - **C4 edge routing gets lanes.** Every edge crossing a gap used to turn at the same midpoint, so their turning segments — and the labels riding on them — stacked into one column. Edges sharing a gap are now spread across the gap by greedy interval colouring, which separates only the turns that actually overlap, so simple diagrams route exactly as before. Turns are clamped inside the gap so no lane runs over a box. `routeOrthogonal` takes an `offset.channel` and reports the `corridor` it used; `channelOffsets` assigns the lanes. ERD, endpoints and lifecycle still route down the middle. ### Fixed - Lifecycle transitions crossing the same gap all turned at its midpoint, stacking their labels into one column. Lifecycle now uses the same lane assignment as C4 and ERD — every diagram type has it. - When no free spot existed for a label, `placeLabel` took the first candidate that cleared the other labels, which could be one sitting across a node's title. It now measures the overlap and takes the least bad position, and searches further off the line before giving up. Across the eleven diagrams this repository ships, labels sitting on a node went from four to none — and a test now parses the rendered SVG and fails if that ever regresses. - The Prisma importer wrote `1 enums` into the subtitle, which is the first line a reader sees of an imported diagram. - The dashboard sorted C4 diagrams alphabetically, so a set of levels read component, context, container. Within C4 it now sorts by zoom — landscape, context, container, component — because that is the order a reader drills in. - The demo's Changes panel was built from **vibeX's own commit history** and shown beside the Relay specs, so a fictional parcel network's release notes read "fix the clean-install gate". The changelog describes the repository being documented, not the tool doing the documenting; the showcase now carries a fixture describing a fictional Relay release, like the rest of it. - The documentation-diff placeholder told the reader to pass `--specs`, which fires equally when `--specs` *was* passed and the range simply had no start commit to compare against. It now names the actual reason, and the CLI warns at the point the range is chosen. - ERD relationships crossing the same gap all turned at its midpoint, stacking their cardinality labels into one column — the same defect fixed for C4, now using the same lane assignment. - The clean-install CI gate ran `npm pack --pack-destination /tmp/pkg` without creating that directory. It passed locally, where the directory already existed, and failed on the first real runner. - The example documentation anchored into `test/fixtures/`, which `npm pack` does not ship. A freshly installed package running `vibex demo` therefore opened on **22 unverifiable claims** — the worst possible first impression for a tool whose pitch is documentation you can trust. The fixture moved to `examples/shop-repo/` (it is an example, and it is the code the example documentation describes), and CI now installs the packed tarball and runs the demo, failing on any unverifiable claim rather than trusting a hand-maintained file list. - Dashboard hash routing only ran on first load, so `#docs-1`, a pasted deep link, and browser back/forward did nothing on an already-open page. There is now one router, wired to `hashchange`. - `renderSpec` threw a `TypeError` on any spec whose `diagram_type` has no diagram renderer. It now reports `not-a-diagram` and names what to run instead. - Dashboard: every panel but the last rendered its boxes invisibly. The drop-shadow filter was referenced from the shared SVG stylesheet, and because CSS cascades across the whole document all four panels resolved to the last panel's namespaced filter id — a reference the other panels do not contain, which suppresses the element entirely. The filter now rides on the elements themselves, so each panel resolves its own copy. ### Added - **The showcase now shows the breadth.** Nine diagrams instead of four: all three C4 levels with working drill-down, a second data model imported from a real `schema.prisma`, a GraphQL API imported from a real `.graphql` SDL, and a second lifecycle drawn top-to-bottom against the first one's left-to-right — the same renderer, a visibly different shape. Both importers run against files committed beside the output, so the demo proves they work rather than asserting it. - **A Changes panel in the dashboard.** A `changelog.json` beside the specs becomes a panel, or pass `--changelog`. Each entry links to its commit in the repository the commits came from — not the one a spec happens to describe — and the specs it touched are chips that open those diagrams. Reworded claims are shown as the change they were, old wording struck through beside the new, which is the thing a file diff buries. - **`vibex changelog`** builds a release list from commit history. With `--specs` it also reports what those commits did to the documentation — claims written, reworded, superseded and removed — which is the part a reader of a changelog cannot otherwise see. Derived facts are counted rather than named, because ninety machine-generated sentences appearing is not news. Conventional-commit prefixes are honoured where a project uses them; where it does not, sections are inferred from the files each commit touched and **the output says so**, because a reader who thinks the headings were chosen deliberately will draw conclusions from them. A commit that touches a renderer and a workflow is not internal: internal means every path was. - **Proposals.** `meta.proposed` marks a spec as describing something that does not exist. It renders with a banner, a distinct badge, and a stamp drawn into the SVG so an exported image still says so; its claims read `proposed` rather than `verified`, and `--check` ignores it because there is nothing to drift from. The validator refuses an anchored claim inside one — there is no code to anchor to — and warns when a proposal carries no trail back to whoever made it. A document that merely *derives* facts from a proposed spec marks those facts proposed too. - **Intake.** Four issue forms, a triage workflow, and a dispatcher that resolves an issue's `vibex` block against the current build. A claim id that no longer exists, a diagram nobody named, or a proposal with no stated problem gets a specific question posted back rather than a confident wrong pull request. The authoring step is gated on `ANTHROPIC_API_KEY`: without one the queue still triages and answers, it just writes nothing. Nothing merges — every path ends at a pull request with the drift check running on it. - **Report it from where you noticed it.** Every claim, and every node's details panel, now carries a link that opens a prefilled issue on the project's own repository. The body holds a fenced `vibex` block with the claim id, the spec and node it is about, its confidence, and the exact commit the reader was looking at — so whoever picks the issue up, person or agent, does not have to reconstruct where the reader was standing. The docs toolbar adds the three intents that are not about one claim: request a document, report a gap, propose a change. GitHub and GitLab are understood; any other host gets no link rather than one that opens a 404, and a project with no `meta.repository` gets none at all. - **A public showcase.** `showcase/` is a fictional parcel delivery network — 16 containers, 13 tables, 17 operations, a twelve-state parcel lifecycle with retry loops and a recoverable failure, and two documents totalling 129 claims with nine stated gaps. GitHub Pages now builds the demo from it rather than from the bundled examples: a different domain, at the depth the tool is actually for, while `examples/` stays small and didactic for the skill to read as a pattern. It ships with the repository, not the npm package, and the deploy fails if it ever publishes a claim it could not verify. - `examples/order.lifecycle.json` replaces the previous lifecycle example and ties into `orders.erd.json`, so the bundled set is now one coherent system rather than a shop plus an unrelated flow. - **`docs`: a fact graph for the system, for people and for agents.** A new spec type whose unit is a *claim* — one checkable sentence with a source — rather than a page of prose. Three kinds of source: `derived` (computed from a diagram spec by one of ten fixed generators, so the sentence cannot disagree with the diagram), `anchored` (prose pinned to a file and symbol by a content hash), and `asserted` (a person, with a date). A claim cannot declare its own confidence; the build computes one of `verified`, `stale`, `broken`, `asserted`, `expired` from the evidence and the clock, and the validator rejects any claim that tries. `vibex docs` emits `docs.json`: every fact once, a `subjects` index that gathers each node's claims and resolved edges, and a `coverage` block that names what the build could not account for. `--check` fails CI on anything stale, broken or expired; `--reanchor` re-pins hashes after a deliberate edit. Anchor hashes are whitespace-insensitive, so reformatting a file does not flag every claim about it while changing a line does. - **A review flow in SKILL.md.** CI proves a claim's evidence has not moved; it cannot prove the claim was ever true. The skill now hands the reviewer a prioritised list — gaps first, then every asserted claim, then a sample of anchors, then uncited narrative — and tells the agent to name what it attributed to a person and what it inferred rather than read. Deliberately not a validator rule: whether a whole-file anchor is too loose depends on the file, and a warning that fires on legitimate cases is how people learn to ignore warnings. - **CI gate for documentation drift.** A `docs-drift` job checks every `*.docs.json` and fails the build when a claim goes stale, broken or out of date, with a message that says to re-read the code rather than re-anchor blindly. It checks out full history and runs with `--no-lock`: the lock file arrives from a contributor's machine asserting claims were verified, and CI re-reads every anchor rather than trusting it. A second step fails the build if the Markdown export ever contains raw HTML, which would not render in Confluence or a wiki. - **One document per topic.** Every `*.docs.json` in the set now gets its own entry under Documentation in the dashboard, so `auth.docs.json` and `payments.docs.json` stay separate documents instead of one trying to be the whole system. A new `examples/auth.docs.json` shows the shape: prose, seven claims, four things it says it does not cover. Undocumented nodes are reported as gaps only for specs the document actually derives facts from — a focused document is no longer nagged about the forty subjects it was never about. - **`--md` output is now free of raw HTML**, so a document survives a paste into Confluence, a wiki or a README unchanged. Citations resolve to the cited claim's confidence mark inline rather than to in-page anchors, which do not survive the trip. - **Narrative prose, so a docs page reads as a document.** A section can carry a `narrative` of Markdown that cites claims with `[[claim-id]]`. Each citation renders as a coloured pip carrying that claim's confidence, so a reader sees which words are load-bearing without leaving the sentence; the cited claims collapse into an evidence block beneath. The Markdown renderer is a deliberately small subset written for this purpose — agent-authored text is escaped first and formatting applied to the escaped text, so no input can emit a tag the renderer did not write, and `javascript:` links are dropped. A dangling citation fails the build; a long narrative citing nothing is warned about. `vibex docs --md` writes the whole document as a Markdown file, with every claim and its confidence marker. - **Incremental anchor checking, keyed on git.** `vibex docs` writes `docs.lock.json` recording HEAD and the commit each anchor last verified at, then re-reads only the files git reports as changed since — committed diffs and uncommitted working-tree changes both. Every uncertainty resolves toward checking more: an unreadable HEAD, an undiffable commit, a re-anchored hash, or a claim that did not verify last time all force a re-read. The commit a claim verified at survives builds that reused the result, so the graph can say when a claim was last true rather than only when the build ran. - **Documentation panel in the dashboard.** A `*.docs.json` in the set becomes a Documentation entry in the sidebar, ahead of the diagrams. Each claim renders with its confidence and its source in the same line of sight as its text — derived claims name the spec and generator that produced them, anchored claims link to the file (and line) in the repository, asserted claims read as "stated by <name> on <date>". A trust bar and a "needs attention" list sit in the side panel, a subject chip on each claim jumps to that node in its diagram, and the coverage block renders as a section of the document rather than a footnote. Filter by text or by "needs attention". `vibex dashboard --repo <dir>` checks anchors while building. - `lifecycle` diagram type: states (initial, normal, waiting, terminal, failure) and transitions (actor, event, guard, action, auto/timeout/failure kinds), reachability and dead-end validation, dashboard section. ## [0.1.0] - 2026-09-18 First release. ### Added - Three diagram types rendered from a validated JSON spec to a single self-contained HTML file: `erd`, `c4`, `endpoints`. - Importers: OpenAPI 2/3 (JSON, or YAML when the optional `yaml` package is installed), GraphQL SDL (own parser, `--erd` seeds an ERD), Prisma schema. - CLI `vibex`: `validate`, `render`, `import`, `dashboard`, `demo`, `types`; `--json` output for validate and render; exit codes 0/1/2. - Dashboard: one HTML with a sidebar of every diagram, overview tiles, entity <-> endpoint cross-links, deep links (`#d=&node=`). - Viewer: pan/zoom, search, details panel, dark/light theme, SVG and PNG export, keyboard shortcuts. - SKILL.md so the folder installs as a Claude Code / Cursor skill. - JSON Schemas for each type under `schemas/`, one example per type under `examples/`, `node:test` suite. ## Release checklist Publishing happens in CI, on a tag. Nothing is published from a laptop — npm requires an interactive 2FA prompt there, and a release should not depend on somebody being awake for it. 1. `npm test` and `node bin/vibex.mjs demo out` pass with no `warning` lines on stderr. 2. Bump the version in `package.json`. `SKILL.md` (`metadata.version`) must match — a test enforces this, so a mismatch fails the build rather than shipping. 3. Move everything out of `## [Unreleased]` into a dated `## [x.y.z] - YYYY-MM-DD` section, and leave a fresh empty Unreleased behind. A test checks the version being shipped has a section. 4. `git commit -am "release x.y.z" && git tag -a vx.y.z -m "vx.y.z" && git push --follow-tags`. The tag must be annotated: `--follow-tags` pushes annotated tags only, so a lightweight `git tag vx.y.z` is silently left behind and the release never runs. 5. The `publish` workflow takes it from there: it refuses a tag that disagrees with `package.json`, runs the suite, installs the packed tarball into an empty directory and runs `vibex demo` against it, then publishes. 6. Confirm: `npx @vibex/[email protected] demo /tmp/vibex-smoke`. 7. Skill path: `npx skills add Raja0sama/vibex` in a scratch project, then `node ~/.claude/skills/vibex/bin/vibex.mjs types`. Versioning is SemVer, pre-1.0: a new diagram or spec type, or anything that changes what a generated file contains, is a minor. Bug fixes are a patch. `schema_version` inside a spec is separate and only moves on a breaking change to the authoring contract.CODE_OF_CONDUCT.md5.1 KB5543e4de5ce3upstream ↗
# Contributor Covenant Code of Conduct ## Our Pledge We as members, contributors, and leaders pledge to make participation in our community a harassment-free experience for everyone, regardless of age, body size, visible or invisible disability, ethnicity, sex characteristics, gender identity and expression, level of experience, education, socio-economic status, nationality, personal appearance, race, caste, color, religion, or sexual identity and orientation. We pledge to act and interact in ways that contribute to an open, welcoming, diverse, inclusive, and healthy community. ## Our Standards Examples of behavior that contributes to a positive environment for our community include: * Demonstrating empathy and kindness toward other people * Being respectful of differing opinions, viewpoints, and experiences * Giving and gracefully accepting constructive feedback * Accepting responsibility and apologizing to those affected by our mistakes, and learning from the experience * Focusing on what is best not just for us as individuals, but for the overall community Examples of unacceptable behavior include: * The use of sexualized language or imagery, and sexual attention or advances of any kind * Trolling, insulting or derogatory comments, and personal or political attacks * Public or private harassment * Publishing others' private information, such as a physical or email address, without their explicit permission * Other conduct which could reasonably be considered inappropriate in a professional setting ## Enforcement Responsibilities Community leaders are responsible for clarifying and enforcing our standards of acceptable behavior and will take appropriate and fair corrective action in response to any behavior that they deem inappropriate, threatening, offensive, or harmful. Community leaders have the right and responsibility to remove, edit, or reject comments, commits, code, wiki edits, issues, and other contributions that are not aligned to this Code of Conduct, and will communicate reasons for moderation decisions when appropriate. ## Scope This Code of Conduct applies within all community spaces, and also applies when an individual is officially representing the community in public spaces. Examples of representing our community include using an official email address, posting via an official social media account, or acting as an appointed representative at an online or offline event. ## Enforcement Instances of abusive, harassing, or otherwise unacceptable behavior may be reported to the community leaders responsible for enforcement at [email protected]. All complaints will be reviewed and investigated promptly and fairly. All community leaders are obligated to respect the privacy and security of the reporter of any incident. ## Enforcement Guidelines Community leaders will follow these Community Impact Guidelines in determining the consequences for any action they deem in violation of this Code of Conduct: ### 1. Correction **Community Impact**: Use of inappropriate language or other behavior deemed unprofessional or unwelcome in the community. **Consequence**: A private, written warning from community leaders, providing clarity around the nature of the violation and an explanation of why the behavior was inappropriate. A public apology may be requested. ### 2. Warning **Community Impact**: A violation through a single incident or series of actions. **Consequence**: A warning with consequences for continued behavior. No interaction with the people involved, including unsolicited interaction with those enforcing the Code of Conduct, for a specified period of time. This includes avoiding interactions in community spaces as well as external channels like social media. Violating these terms may lead to a temporary or permanent ban. ### 3. Temporary Ban **Community Impact**: A serious violation of community standards, including sustained inappropriate behavior. **Consequence**: A temporary ban from any sort of interaction or public communication with the community for a specified period of time. No public or private interaction with the people involved, including unsolicited interaction with those enforcing the Code of Conduct, is allowed during this period. Violating these terms may lead to a permanent ban. ### 4. Permanent Ban **Community Impact**: Demonstrating a pattern of violation of community standards, including sustained inappropriate behavior, harassment of an individual, or aggression toward or disparagement of classes of individuals. **Consequence**: A permanent ban from any sort of public interaction within the community. ## Attribution This Code of Conduct is adapted from the [Contributor Covenant][homepage], version 2.1, available at https://www.contributor-covenant.org/version/2/1/code_of_conduct.html. Community Impact Guidelines were inspired by [Mozilla's code of conduct enforcement ladder][Mozilla CoC]. For answers to common questions about this code of conduct, see the FAQ at https://www.contributor-covenant.org/faq. Translations are available at https://www.contributor-covenant.org/translations. [homepage]: https://www.contributor-covenant.org [Mozilla CoC]: https://github.com/mozilla/diversityCONTRIBUTING.md1.9 KBcdc05ea06b66upstream ↗
# Contributing ## The one rule A claim in a document either points at code that proves it, or it is marked as asserted and carries whose word it is on. Nothing else ships. A tool whose pitch is documentation you can trust cannot itself contain a sentence nobody checked. If you cannot establish something from the code, put it in `coverage.out_of_scope` rather than asserting it in somebody's name. ## Before you open a pull request ```bash npm test # the suite, no network, no fixtures to install node bin/vibex.mjs demo out # must print no warnings node bin/vibex.mjs validate <spec…> # any spec you touched ``` Then the drift check, which is what CI actually gates on: ```bash node bin/vibex.mjs docs examples/auth.docs.json examples \ --repo examples/shop-repo --check --no-lock -o /dev/null ``` If a claim has gone stale, do not re-anchor it blindly. Read the code it points at. Still true, re-anchor with `--reanchor`. No longer true, rewrite the claim or supersede it and say why. Re-anchoring a claim you have not read converts a true sentence into a false one with a fresh hash on it. ## House style - **Zero runtime dependencies.** `yaml` is optional and only for YAML OpenAPI. A pull request that adds a dependency needs to argue for it in the description. - **Escape everything on the way into HTML or SVG.** `esc()` from `renderers/shared/utils.mjs`, every time, no exceptions for "this one is ours". - **Comments say why, not what.** The code already says what. - **Node 18+, ES modules, no build step.** What you read is what runs. - Tests live in `test/vibex.test.mjs` and use `node --test`. A bug fix comes with the test that would have caught it. ## Releasing Maintainers only, and the procedure is in [CHANGELOG.md](CHANGELOG.md#release-checklist). Publishing happens in CI on a tag; nothing is published from a laptop.examples/auth.docs.json7.3 KB2e390e64bf38upstream ↗
{ "schema_version": 1, "diagram_type": "docs", "meta": { "id": "auth.docs", "title": "How authentication works", "subtitle": "Where identity is established, what is trusted downstream, and the two things that bypass it" }, "covers": [ "shop.c4", "shop.endpoints" ], "review_window_days": 90, "sections": [ { "id": "edge", "title": "Where identity is established", "narrative": "Authentication happens in exactly one place. The BFF issues an opaque session token and keeps the user id against it server-side [[session.issued-by-bff]]; the token itself carries no claims, so there is nothing in it to forge or decode.\n\nA session lasts twelve hours from the moment it is issued [[session.ttl]], and can be ended immediately by deleting it server-side [[session.revocable]] — which is the whole reason the token is opaque rather than a JWT.\n\nThere are no refresh tokens [[auth.no-refresh]]. A user whose session expires signs in again [[auth.reauth-on-expiry]].", "claims": [ "session.issued-by-bff", "session.ttl", "session.revocable", "auth.no-refresh", "auth.reauth-on-expiry" ] }, { "id": "downstream", "title": "What the services behind it assume", "narrative": "The BFF forwards the verified user id inward on the `x-user-id` header [[session.forwarded-identity]]. Every domain API authorises on that header alone and performs no verification of its own [[api.trusts-header]].\n\n> This is the load-bearing assumption of the whole design: **the header is trusted because the network is**. A domain API reachable by any route other than the BFF has no authentication at all. If that ever stops being true — a new ingress, a debugging port, a service mesh change — this document is wrong and the system is open.", "claims": [ "session.forwarded-identity", "api.trusts-header" ] }, { "id": "exceptions", "title": "The two things that bypass it", "narrative": "Two paths do not carry a session.\n\nStripe calls the webhook endpoint directly and authenticates by signature instead [[webhook.signature]]. That endpoint is the one place a request from outside reaches a domain concern without passing a session check, and the signature is the only thing standing in its place.\n\nThe second is internal traffic between domain APIs, which is covered below rather than here: nothing currently documents how, or whether, those calls are authenticated.", "claims": [ "webhook.signature" ] }, { "id": "coverage", "title": "What this document does not cover", "narrative": "Read this before trusting an absence. Something missing here is either out of scope below, listed as noticed-and-unaccounted-for, or nobody has looked.", "generate": [ "coverage" ] } ], "claims": [ { "id": "session.issued-by-bff", "text": "The BFF issues an opaque session token and stores the user id against it server-side.", "subject": "shop.c4#bff", "tags": [ "auth", "session" ], "source": { "kind": "anchored", "path": "bff/src/auth/session.service.ts", "symbol": "SessionService", "line": 10, "end_line": 14, "hash": "973d9cd1899f" } }, { "id": "session.ttl", "text": "A session is valid for twelve hours from the moment it is issued.", "subject": "shop.c4#bff", "tags": [ "auth", "session" ], "source": { "kind": "anchored", "path": "bff/src/auth/session.service.ts", "symbol": "TTL_MS", "line": 4, "end_line": 4, "hash": "c318ebc926bf" } }, { "id": "session.revocable", "text": "A session can be ended immediately by deleting its token server-side.", "subject": "shop.c4#bff", "tags": [ "auth", "session" ], "source": { "kind": "anchored", "path": "bff/src/auth/session.service.ts", "symbol": "revoke", "line": 26, "end_line": 28, "hash": "64faceb52a89" } }, { "id": "auth.no-refresh", "text": "The system issues no refresh tokens.", "subject": "shop.c4#bff", "tags": [ "auth" ], "source": { "kind": "asserted", "by": "[email protected]", "at": "2026-09-19", "rationale": "A twelve-hour session covers a working day, and revocation matters more here than uninterrupted sessions." } }, { "id": "auth.reauth-on-expiry", "text": "A user whose session expires signs in again.", "subject": "shop.c4#bff", "tags": [ "auth" ], "source": { "kind": "asserted", "by": "[email protected]", "at": "2026-09-19" } }, { "id": "session.forwarded-identity", "text": "The BFF forwards the verified user id to the domain APIs in the x-user-id header.", "subject": "shop.c4#bff", "tags": [ "auth" ], "source": { "kind": "anchored", "path": "bff/src/auth/identity.interceptor.ts", "symbol": "IdentityInterceptor", "hash": "e12859b083fa" } }, { "id": "api.trusts-header", "text": "The Order API authorises requests on the forwarded x-user-id header alone and verifies nothing itself.", "subject": "shop.c4#order_api", "tags": [ "auth" ], "source": { "kind": "anchored", "path": "order-api/src/auth/identity.guard.ts", "symbol": "IdentityGuard", "hash": "750754a1ffff" } }, { "id": "webhook.signature", "text": "The Stripe webhook endpoint authenticates its caller by verifying a Stripe signature instead of a session.", "subject": "shop.endpoints#stripe-webhook", "tags": [ "auth" ], "source": { "kind": "anchored", "path": "order-api/src/payments/stripe-webhook.controller.ts", "symbol": "StripeWebhookController", "hash": "0f9d5e1b22aa" } } ], "glossary": [ { "term": "Opaque token", "definition": "A session identifier that carries no information of its own: the server holds everything it means, so revoking it is a delete rather than a wait.", "see": "shop.c4#bff" } ], "coverage": { "out_of_scope": [ { "area": "How a user proves who they are in the first place", "reason": "Sign-in, password handling and any identity provider are not documented here. This document starts at the point a session exists." }, { "area": "Authorisation", "reason": "This covers who the caller is, not what they are allowed to do. Role and permission checks are not documented anywhere yet." }, { "area": "Service-to-service calls inside the private network", "reason": "Not documented yet. Whether the domain APIs authenticate each other is unknown, and the trust-the-header design means it matters." }, { "area": "Admin console access", "reason": "Ops staff reach the Admin console, which uses the same BFF sessions, but no claim here covers how ops accounts differ from customer accounts." } ] } }examples/checkout.sequence.json3.1 KBa6747a5c0a7aupstream ↗
{ "schema_version": 1, "diagram_type": "sequence", "meta": { "id": "checkout.sequence", "title": "Checkout", "subtitle": "From the Pay button to the confirmation email", "trigger": "The customer presses Pay", "repository": { "url": "https://github.com/example/shop-api", "revision": "main" } }, "participants": [ { "id": "customer", "label": "Customer", "kind": "person" }, { "id": "bff", "label": "BFF", "technology": "NestJS", "description": "Session and request shaping for the storefront" }, { "id": "order_api", "label": "Order API", "technology": "NestJS" }, { "id": "db", "label": "Shop DB", "kind": "database", "technology": "PostgreSQL" }, { "id": "stripe", "label": "Stripe", "kind": "external" }, { "id": "events", "label": "Domain events", "kind": "queue", "technology": "SQS" }, { "id": "worker", "label": "Notification worker" } ], "steps": [ { "from": "customer", "to": "bff", "label": "POST /checkout", "detail": "basket id, card token" }, { "from": "bff", "to": "bff", "label": "resolve session", "detail": "x-user-id from cookie" }, { "from": "bff", "to": "order_api", "label": "POST /orders", "detail": "x-user-id header", "sources": [{ "path": "bff/src/orders/orders.client.ts", "line": 12 }] }, { "from": "order_api", "to": "db", "label": "INSERT order (placed)" }, { "from": "db", "to": "order_api", "label": "order id", "kind": "reply" }, { "from": "order_api", "to": "stripe", "label": "create PaymentIntent", "detail": "idempotency key = order id" }, { "from": "stripe", "to": "order_api", "label": "requires_capture", "kind": "reply" }, { "fragment": "alt", "label": "card accepted", "steps": [ { "from": "order_api", "to": "db", "label": "UPDATE status = paid" }, { "from": "db", "to": "order_api", "label": "ok", "kind": "reply" }, { "from": "order_api", "to": "events", "label": "OrderPaid", "kind": "async" }, { "from": "order_api", "to": "bff", "label": "201 Created", "kind": "reply" } ], "else": [ { "label": "card declined", "steps": [ { "from": "order_api", "to": "db", "label": "UPDATE status = payment_failed" }, { "from": "db", "to": "order_api", "label": "ok", "kind": "reply" }, { "from": "order_api", "to": "bff", "label": "402 Payment Required", "kind": "reply", "failure": true } ] } ] }, { "from": "bff", "to": "customer", "label": "confirmation page", "kind": "reply" }, { "note": "The worker runs on its own schedule; the customer is not waiting for it.", "over": ["events", "worker"] }, { "fragment": "opt", "label": "OrderPaid was published", "steps": [ { "from": "events", "to": "worker", "label": "OrderPaid", "kind": "async" }, { "from": "worker", "to": "worker", "label": "send receipt email", "detail": "SendGrid" } ] } ], "cards": [ { "title": "Where these came from", "tone": "info", "items": ["Calls match shop.links.json", "Statuses are the order_status values in order.lifecycle.json"] } ] }examples/order.lifecycle.json2.9 KB3cc6666ad7adupstream ↗
{ "schema_version": 1, "diagram_type": "lifecycle", "meta": { "id": "order.lifecycle", "title": "Order lifecycle", "subtitle": "Every state an order reaches, and the only moves between them", "subject": "Order.status", "repository": { "url": "https://github.com/example/shop-api", "revision": "main" } }, "states": [ { "id": "draft", "label": "Draft", "kind": "initial", "actor": "buyer", "description": "In the basket, not yet submitted", "sources": [{ "path": "src/orders/order.state.ts", "line": 14 }] }, { "id": "placed", "label": "Placed", "actor": "payment provider", "description": "Submitted, waiting for the card to clear" }, { "id": "payment_failed", "label": "Payment failed", "kind": "failure", "actor": "buyer", "description": "Declined. The buyer can try another card." }, { "id": "paid", "label": "Paid", "actor": "ops", "description": "Captured and stock reserved, waiting for dispatch" }, { "id": "shipped", "label": "Shipped", "actor": "carrier", "description": "Handed to the carrier with a tracking number" }, { "id": "delivered", "label": "Delivered", "kind": "terminal", "description": "Confirmed by the carrier" }, { "id": "cancelled", "label": "Cancelled", "kind": "terminal", "description": "Withdrawn, refunded if anything had been taken" } ], "transitions": [ { "id": "submit", "from": "draft", "to": "placed", "event": "submit", "actor": "buyer", "guard": "the basket is not empty", "action": "authorise the card" }, { "id": "abandon", "from": "draft", "to": "cancelled", "event": "30 days idle", "actor": "system", "kind": "timeout", "action": "release the basket" }, { "id": "capture", "from": "placed", "to": "paid", "event": "payment captured", "actor": "payment provider", "action": "reserve stock" }, { "id": "decline", "from": "placed", "to": "payment_failed", "event": "payment declined", "actor": "payment provider", "kind": "failure", "action": "email the buyer" }, { "id": "retry", "from": "payment_failed", "to": "placed", "event": "try another card", "actor": "buyer", "guard": "fewer than three attempts" }, { "id": "give-up", "from": "payment_failed", "to": "cancelled", "event": "three attempts used", "actor": "system", "kind": "auto", "action": "release the stock hold" }, { "id": "dispatch", "from": "paid", "to": "shipped", "event": "dispatch", "actor": "ops", "action": "email the tracking number" }, { "id": "cancel", "from": "paid", "to": "cancelled", "event": "cancel", "actor": "buyer", "guard": "not yet dispatched", "action": "refund in full" }, { "id": "confirm", "from": "shipped", "to": "delivered", "event": "carrier confirms", "actor": "carrier", "action": "close the order" } ], "cards": [ { "title": "Where these came from", "tone": "info", "items": ["State ids are the order_status enum values in orders.erd.json", "Transitions are the guard clauses in OrderStateMachine"] } ] }examples/orders.erd.json27 KB2278155e0a36upstream ↗
Contents are not inlined in the catalog. Open the upstream file.
examples/shop-repo/bff/src/auth/identity.interceptor.ts684 Bca751cf0c811upstream ↗
import { CallHandler, ExecutionContext, Injectable, NestInterceptor } from '@nestjs/common'; import { SessionService } from './session.service'; // Every outbound call to a domain API carries the verified user id. The domain // APIs never see the session token itself. @Injectable() export class IdentityInterceptor implements NestInterceptor { constructor(private readonly sessions: SessionService) {} intercept(context: ExecutionContext, next: CallHandler) { const request = context.switchToHttp().getRequest(); const userId = this.sessions.verify(request.cookies?.session); request.outboundHeaders = { 'x-user-id': userId ?? '' }; return next.handle(); } }examples/shop-repo/bff/src/auth/session.service.ts733 B1e0bf3b37a0fupstream ↗
import { Injectable } from '@nestjs/common'; import { randomBytes } from 'node:crypto'; const TTL_MS = 1000 * 60 * 60 * 12; @Injectable() export class SessionService { private readonly store = new Map<string, { userId: string; expires: number }>(); issue(userId: string): string { const token = randomBytes(32).toString('base64url'); this.store.set(token, { userId, expires: Date.now() + TTL_MS }); return token; } verify(token: string): string | null { const row = this.store.get(token); if (!row) return null; if (row.expires < Date.now()) { this.store.delete(token); return null; } return row.userId; } revoke(token: string): void { this.store.delete(token); } }examples/shop-repo/bff/src/orders/orders.client.ts832 Bcb0034c6cbf6upstream ↗
import { Injectable } from '@nestjs/common'; import { HttpService } from '@nestjs/axios'; import { ConfigService } from '@nestjs/config'; @Injectable() export class OrdersClient { private readonly baseUrl: string; constructor(private readonly http: HttpService, config: ConfigService) { this.baseUrl = config.getOrThrow('ORDER_API_URL'); } listOrders(userToken: string) { return this.http.get(`${this.baseUrl}/orders`, { headers: { authorization: userToken } }); } createOrder(userToken: string, body: { shippingAddressId: string }) { return this.http.post(`${this.baseUrl}/orders`, body, { headers: { authorization: userToken } }); } cancelOrder(userToken: string, id: string) { return this.http.post(`${this.baseUrl}/orders/${id}/cancel`, {}, { headers: { authorization: userToken } }); } }examples/shop-repo/order-api/src/auth/identity.guard.ts526 B1214c4827a4aupstream ↗
import { CanActivate, ExecutionContext, Injectable } from '@nestjs/common'; // The BFF has already authenticated the caller. This service issues no tokens // and verifies no signatures; it trusts the forwarded header. @Injectable() export class IdentityGuard implements CanActivate { canActivate(context: ExecutionContext): boolean { const request = context.switchToHttp().getRequest(); const userId = request.headers['x-user-id']; if (!userId) return false; request.userId = userId; return true; } }examples/shop-repo/order-api/src/orders/orders.controller.ts708 B87f6fa7cee6bupstream ↗
import { Body, Controller, Get, Param, Post, Req, UseGuards } from '@nestjs/common'; import { IdentityGuard } from '../auth/identity.guard'; import { OrdersRepository } from './orders.repository'; @Controller('orders') @UseGuards(IdentityGuard) export class OrdersController { constructor(private readonly orders: OrdersRepository) {} @Get() listOrders(@Req() req) { return this.orders.findForUser(req.user.id); } @Post() createOrder(@Req() req, @Body() body: { shippingAddressId: string }) { return this.orders.create(req.user.id, body.shippingAddressId); } @Post(':id/cancel') cancelOrder(@Param('id') id: string) { return this.orders.updateStatus(id, 'cancelled'); } }examples/shop-repo/order-api/src/orders/orders.repository.ts768 B03a30782cde6upstream ↗
import { Injectable } from '@nestjs/common'; import { PrismaClient } from '@prisma/client'; // The only place in the platform that writes to the orders table. The // Catalogue API reads it through a view and has no write access. @Injectable() export class OrdersRepository { constructor(private readonly prisma: PrismaClient) {} create(userId: string, shippingAddressId: string) { return this.prisma.order.create({ data: { userId, shippingAddressId, status: 'draft', totalCents: 0 }, }); } updateStatus(id: string, status: string) { return this.prisma.order.update({ where: { id }, data: { status } }); } findForUser(userId: string) { return this.prisma.order.findMany({ where: { userId }, orderBy: { placedAt: 'desc' } }); } }examples/shop-repo/order-api/src/payments/stripe-webhook.controller.ts900 B5fda4227fc55upstream ↗
import { Controller, Headers, Post, RawBodyRequest, Req, UnauthorizedException } from '@nestjs/common'; import Stripe from 'stripe'; // Reached directly by Stripe, not through the BFF, so there is no session to // verify. The signature header is the only thing authenticating this request. @Controller('webhooks/stripe') export class StripeWebhookController { private readonly stripe = new Stripe(process.env.STRIPE_KEY); @Post() handle(@Req() request: RawBodyRequest<Request>, @Headers('stripe-signature') signature: string) { let event: Stripe.Event; try { event = this.stripe.webhooks.constructEvent(request.rawBody, signature, process.env.STRIPE_WEBHOOK_SECRET); } catch { throw new UnauthorizedException('bad signature'); } return this.dispatch(event); } private dispatch(event: Stripe.Event) { return { received: true, type: event.type }; } }examples/shop-repo/order-api/src/payments/stripe.client.ts345 B509fdb68c573upstream ↗
import { Injectable } from '@nestjs/common'; import Stripe from 'stripe'; @Injectable() export class StripeClient { constructor(private readonly stripe: Stripe) {} charge(orderId: string, amountCents: number, currency: string) { return this.stripe.paymentIntents.create({ amount: amountCents, currency, metadata: { orderId } }); } }examples/shop.c4.json3.6 KB24ec18cdccd4upstream ↗
{ "schema_version": 1, "diagram_type": "c4", "meta": { "title": "Shop platform — Containers", "subtitle": "C4 level 2: containers inside the Shop system", "level": "container", "scope": "Shop" }, "elements": [ { "id": "customer", "kind": "person", "label": "Customer", "description": "Browses products and places orders" }, { "id": "ops", "kind": "person", "label": "Ops staff", "description": "Manages catalogue and refunds" }, { "id": "spa", "kind": "container", "label": "Storefront", "technology": "React SPA", "description": "Product browsing, cart, checkout UI", "link": "storefront.c4.html" }, { "id": "admin", "kind": "container", "label": "Admin console", "technology": "Next.js", "description": "Back-office for catalogue and orders" }, { "id": "bff", "kind": "container", "label": "BFF", "technology": "NestJS / GraphQL", "description": "Aggregates domain APIs for the frontends, owns auth sessions", "link": "bff.c4.html" }, { "id": "order_api", "kind": "container", "label": "Order API", "technology": "NestJS / REST", "description": "Order lifecycle, pricing, payments orchestration" }, { "id": "catalog_api", "kind": "container", "label": "Catalogue API", "technology": "NestJS / REST", "description": "Products, stock, search index" }, { "id": "db", "kind": "database", "label": "Shop DB", "technology": "PostgreSQL 15", "description": "Orders, users, products" }, { "id": "events", "kind": "queue", "label": "Domain events", "technology": "AWS SQS", "description": "order.placed, order.paid, stock.changed" }, { "id": "worker", "kind": "container", "label": "Notification worker", "technology": "Node.js", "description": "Sends emails and webhooks from domain events" }, { "id": "stripe", "kind": "system", "label": "Stripe", "external": true, "description": "Card payments" }, { "id": "mail", "kind": "system", "label": "SendGrid", "external": true, "description": "Transactional email" } ], "boundaries": [ { "id": "shop", "kind": "system", "label": "Shop", "contains": ["spa", "admin", "bff", "backend"] }, { "id": "backend", "kind": "deployment", "label": "Private network", "contains": ["order_api", "catalog_api", "db", "events", "worker"] } ], "relationships": [ { "from": "customer", "to": "spa", "label": "Shops using", "technology": "HTTPS" }, { "from": "ops", "to": "admin", "label": "Manages via", "technology": "HTTPS" }, { "from": "spa", "to": "bff", "label": "Queries / mutations", "technology": "GraphQL over HTTPS" }, { "from": "admin", "to": "bff", "label": "Queries / mutations", "technology": "GraphQL over HTTPS" }, { "from": "bff", "to": "order_api", "label": "Places and reads orders", "technology": "REST/JSON" }, { "from": "bff", "to": "catalog_api", "label": "Reads products", "technology": "REST/JSON" }, { "from": "order_api", "to": "db", "label": "Reads / writes", "technology": "SQL" }, { "from": "catalog_api", "to": "db", "label": "Reads / writes", "technology": "SQL" }, { "from": "order_api", "to": "events", "label": "Publishes", "technology": "SQS", "style": "dashed" }, { "from": "events", "to": "worker", "label": "Consumes", "technology": "SQS", "style": "dashed" }, { "from": "order_api", "to": "stripe", "label": "Charges cards", "technology": "HTTPS" }, { "from": "stripe", "to": "order_api", "label": "Sends payment webhooks", "technology": "HTTPS", "style": "dashed" }, { "from": "worker", "to": "mail", "label": "Sends email", "technology": "HTTPS" } ], "cards": [ { "title": "Ownership", "tone": "info", "items": ["Frontends: web team", "BFF and APIs: platform team", "Stripe and SendGrid are external"] } ] }examples/shop.docs.json8.9 KB5f0a890cef3cupstream ↗
Contents are not inlined in the catalog. Open the upstream file.
examples/shop.endpoints.json4.4 KB3a325837c66eupstream ↗
{ "schema_version": 1, "diagram_type": "endpoints", "meta": { "title": "Order API", "subtitle": "REST surface of the Order service", "api_kind": "rest", "base_url": "https://api.shop.example/v1", "version": "1.4.0", "repository": { "url": "https://github.com/example/shop-api", "revision": "main" } }, "groups": [ { "id": "orders", "label": "Orders", "description": "Checkout and order lifecycle", "sources": [{ "path": "src/orders/orders.controller.ts" }] }, { "id": "payments", "label": "Payments" }, { "id": "admin", "label": "Admin", "description": "Requires the ops role" } ], "endpoints": [ { "id": "list-orders", "group": "orders", "method": "GET", "path": "/orders", "summary": "List the caller's orders, newest first", "auth": "bearer", "response": "Order[]", "status": [200, 401], "params": [{ "name": "status", "in": "query", "type": "OrderStatus" }, { "name": "cursor", "in": "query", "type": "string" }], "entities": ["order"], "sources": [{ "path": "src/orders/orders.controller.ts", "line": 24 }] }, { "id": "create-order", "group": "orders", "method": "POST", "path": "/orders", "summary": "Create a draft order from the cart", "auth": "bearer", "request": "CreateOrderInput", "response": "Order", "status": [201, 400, 401], "entities": ["order", "order_item"], "sources": [{ "path": "src/orders/orders.controller.ts", "line": 41 }] }, { "id": "get-order", "group": "orders", "method": "GET", "path": "/orders/{id}", "summary": "Fetch one order with items", "auth": "bearer", "response": "Order", "status": [200, 404], "entities": ["order"] }, { "id": "cancel-order", "group": "orders", "method": "POST", "path": "/orders/{id}/cancel", "summary": "Cancel before payment capture", "auth": "bearer", "response": "Order", "status": [200, 409], "entities": ["order"] }, { "id": "delete-order-legacy", "group": "orders", "method": "DELETE", "path": "/orders/{id}", "summary": "Removed in v2, use cancel", "auth": "bearer", "status": [204], "deprecated": true }, { "id": "create-payment", "group": "payments", "method": "POST", "path": "/orders/{id}/payments", "summary": "Start a Stripe payment intent", "auth": "bearer", "request": "CreatePaymentInput", "response": "Payment", "status": [201, 402, 409], "entities": ["payment"] }, { "id": "stripe-webhook", "group": "payments", "method": "POST", "path": "/webhooks/stripe", "summary": "Stripe event callback (signature verified)", "auth": "stripe-signature", "status": [200, 400], "entities": ["payment", "order"] }, { "id": "admin-list-orders", "group": "admin", "method": "GET", "path": "/admin/orders", "summary": "All orders with filters", "auth": "bearer + role:ops", "response": "Order[]", "status": [200, 403] }, { "id": "admin-refund", "group": "admin", "method": "POST", "path": "/admin/orders/{id}/refund", "summary": "Refund a captured payment", "auth": "bearer + role:ops", "request": "RefundInput", "response": "Payment", "status": [200, 403, 409] }, { "id": "order-paid-event", "group": "orders", "method": "EVENT", "path": "order.paid", "summary": "Published to SQS after capture", "response": "OrderPaidEvent" } ], "types": [ { "id": "Order", "name": "Order", "fields": [{ "name": "id", "type": "uuid", "required": true }, { "name": "status", "type": "OrderStatus", "required": true }, { "name": "items", "type": "OrderItem[]", "required": true }, { "name": "totalCents", "type": "int", "required": true }, { "name": "placedAt", "type": "datetime" }] }, { "id": "OrderItem", "name": "OrderItem", "fields": [{ "name": "productId", "type": "uuid", "required": true }, { "name": "quantity", "type": "int", "required": true }, { "name": "unitPriceCents", "type": "int", "required": true }] }, { "id": "CreateOrderInput", "name": "CreateOrderInput", "kind": "input", "fields": [{ "name": "items", "type": "OrderItemInput[]", "required": true }, { "name": "shippingAddressId", "type": "uuid" }] }, { "id": "Payment", "name": "Payment", "fields": [{ "name": "id", "type": "uuid", "required": true }, { "name": "provider", "type": "string", "required": true }, { "name": "capturedAt", "type": "datetime" }] }, { "id": "OrderStatus", "name": "OrderStatus", "kind": "enum", "values": ["draft", "placed", "paid", "shipped", "cancelled"] } ], "cards": [ { "title": "Auth", "tone": "info", "items": ["Bearer JWT from the BFF session", "Admin routes additionally check role:ops", "Stripe webhook uses signature header, no JWT"] } ] }examples/shop.links.json2.9 KBa20af2138b79upstream ↗
{ "schema_version": 1, "diagram_type": "links", "meta": { "id": "shop.links", "title": "How the shop services talk", "subtitle": "Every call between services, anchored on both ends" }, "services": [ { "id": "bff", "label": "BFF", "repo": "bff", "c4": ["shop.c4#bff"] }, { "id": "order_api", "label": "Order API", "repo": "order-api", "spec": "shop.endpoints", "c4": ["shop.c4#order_api"] }, { "id": "stripe", "label": "Stripe", "external": true, "c4": ["shop.c4#stripe"] } ], "links": [ { "id": "bff-list-orders", "from": "bff", "to": "order_api", "kind": "http", "route": "GET /orders", "env": "ORDER_API_URL", "endpoint": "shop.endpoints#list-orders", "client": { "path": "src/orders/orders.client.ts", "symbol": "listOrders", "line": 13, "end_line": 15, "hash": "96b21191949e" }, "handler": { "path": "src/orders/orders.controller.ts", "symbol": "listOrders", "line": 10, "end_line": 13, "hash": "7d2f6abf5244" } }, { "id": "bff-create-order", "from": "bff", "to": "order_api", "kind": "http", "route": "POST /orders", "env": "ORDER_API_URL", "endpoint": "shop.endpoints#create-order", "client": { "path": "src/orders/orders.client.ts", "symbol": "createOrder", "line": 17, "end_line": 19, "hash": "98beb91daa66" }, "handler": { "path": "src/orders/orders.controller.ts", "symbol": "createOrder", "line": 15, "end_line": 18, "hash": "8ecac0abb1d7" } }, { "id": "bff-cancel-order", "from": "bff", "to": "order_api", "kind": "http", "route": "POST /orders/{id}/cancel", "env": "ORDER_API_URL", "endpoint": "shop.endpoints#cancel-order", "client": { "path": "src/orders/orders.client.ts", "symbol": "cancelOrder", "line": 21, "end_line": 23, "hash": "ef7d3b3cacee" }, "handler": { "path": "src/orders/orders.controller.ts", "symbol": "cancelOrder", "line": 20, "end_line": 23, "hash": "e496be90391a" } }, { "id": "order-api-charge", "from": "order_api", "to": "stripe", "kind": "http", "route": "POST /v1/payment_intents", "client": { "path": "src/payments/stripe.client.ts", "symbol": "charge", "line": 8, "end_line": 10, "hash": "ef7c3fe1ed80" } }, { "id": "stripe-webhook", "from": "stripe", "to": "order_api", "kind": "webhook", "route": "POST /webhooks/stripe", "endpoint": "shop.endpoints#stripe-webhook", "handler": { "path": "src/payments/stripe-webhook.controller.ts", "symbol": "handle", "line": 10, "end_line": 23, "hash": "390232fa244c" } } ], "shared_ids": [ { "id": "order-id", "label": "orderId", "owner": "order_api", "used_by": ["bff"], "refs": ["orders.erd#order"] } ], "layout": { "positions": { "bff": [49, -183], "order_api": [136, 122], "stripe": [700, -156] } } }importers/graphql.mjs13 KBa30a52a182f1upstream ↗
Contents are not inlined in the catalog. Open the upstream file.
importers/openapi.mjs8.0 KBae97e9df0bc0upstream ↗
Contents are not inlined in the catalog. Open the upstream file.
importers/prisma.mjs6.6 KB7e4b19d84da5upstream ↗
Contents are not inlined in the catalog. Open the upstream file.
importers/shared.mjs743 Baf3917064fc3upstream ↗
export function slug(value, fallback = 'item') { const s = String(value ?? '') .replace(/[{}]/g, '') .replace(/[^a-zA-Z0-9_.-]+/g, '-') .replace(/^-+|-+$/g, '') .replace(/-{2,}/g, '-'); const out = /^[a-zA-Z]/.test(s) ? s : `${fallback}-${s}`; return out.replace(/-+$/, '') || fallback; } export function uniqueId(base, taken) { let id = base; let n = 2; while (taken.has(id)) { id = `${base}-${n}`; n += 1; } taken.add(id); return id; } export function firstSentence(text, max = 120) { const s = String(text ?? '').replace(/\s+/g, ' ').trim(); if (!s) return undefined; const m = /^(.*?[.!?])(\s|$)/.exec(s); const out = m ? m[1] : s; return out.length > max ? `${out.slice(0, max - 1)}…` : out; }LICENSE1.0 KB9dee456b4f84upstream ↗
Contents are not inlined in the catalog. Open the upstream file.
package.json1.5 KBed43dcd75dc9upstream ↗
Contents are not inlined in the catalog. Open the upstream file.
renderers/c4/render-c4.mjs19 KB1f11185d4cf9upstream ↗
Contents are not inlined in the catalog. Open the upstream file.
renderers/changelog/from-git.mjs6.9 KB87b6587f47b5upstream ↗
Contents are not inlined in the catalog. Open the upstream file.
renderers/changelog/render-changelog.mjs7.0 KB150d7dfee74cupstream ↗
Contents are not inlined in the catalog. Open the upstream file.
renderers/changelog/to-markdown.mjs4.7 KBac67f93b7011upstream ↗
Contents are not inlined in the catalog. Open the upstream file.
renderers/docs/anchors.mjs2.5 KB19c72303d5f4upstream ↗
Contents are not inlined in the catalog. Open the upstream file.
renderers/docs/facts.mjs12 KB31c938d65413upstream ↗
Contents are not inlined in the catalog. Open the upstream file.
renderers/docs/git.mjs2.1 KBe398110cb1ddupstream ↗
Contents are not inlined in the catalog. Open the upstream file.
renderers/docs/graph.mjs12 KB86b74ca2172dupstream ↗
Contents are not inlined in the catalog. Open the upstream file.
renderers/docs/hash-mode.mjs1.4 KBa2992d813499upstream ↗
Contents are not inlined in the catalog. Open the upstream file.
renderers/docs/incremental.mjs3.6 KB3fa82cefd2c4upstream ↗
Contents are not inlined in the catalog. Open the upstream file.
renderers/docs/markdown.mjs5.0 KB39daaee558a8upstream ↗
Contents are not inlined in the catalog. Open the upstream file.
renderers/docs/render-docs.mjs13 KBc8f8480f4563upstream ↗
Contents are not inlined in the catalog. Open the upstream file.
renderers/docs/to-markdown.mjs6.0 KBc91218a83b7eupstream ↗
Contents are not inlined in the catalog. Open the upstream file.
renderers/endpoints/render-endpoints.mjs11 KBf9882d8816c8upstream ↗
Contents are not inlined in the catalog. Open the upstream file.
renderers/erd/render-erd.mjs11 KBe4a3ba0037e9upstream ↗
Contents are not inlined in the catalog. Open the upstream file.
renderers/lifecycle/render-lifecycle.mjs16 KBa70f4ceeefb4upstream ↗
Contents are not inlined in the catalog. Open the upstream file.
renderers/links/check.mjs5.7 KB54ef1a692b25upstream ↗
Contents are not inlined in the catalog. Open the upstream file.
renderers/links/render-links.mjs2.8 KBbbf0ffc8c923upstream ↗
Contents are not inlined in the catalog. Open the upstream file.
renderers/mermaid/to-mermaid.mjs10 KB3e1e56c92d27upstream ↗
Contents are not inlined in the catalog. Open the upstream file.
renderers/sequence/render-sequence.mjs14 KBb57a22fa51b5upstream ↗
Contents are not inlined in the catalog. Open the upstream file.
renderers/sequence/steps.mjs1.1 KB2f2387e6f07aupstream ↗
Contents are not inlined in the catalog. Open the upstream file.
renderers/shared/dashboard.mjs13 KBcb589f1619fcupstream ↗
Contents are not inlined in the catalog. Open the upstream file.
renderers/shared/host.mjs3.4 KBde1dd9d33cbeupstream ↗
Contents are not inlined in the catalog. Open the upstream file.
renderers/shared/intake.mjs2.9 KBa89045ca2f7eupstream ↗
Contents are not inlined in the catalog. Open the upstream file.
renderers/shared/layout.mjs24 KBac27f1e378ccupstream ↗
Contents are not inlined in the catalog. Open the upstream file.
renderers/shared/positions.mjs5.5 KB0d6216f516d3upstream ↗
Contents are not inlined in the catalog. Open the upstream file.
renderers/shared/render.mjs2.4 KB8b6a1f337c3bupstream ↗
Contents are not inlined in the catalog. Open the upstream file.
renderers/shared/stamp.mjs3.2 KB1bc70211c7d4upstream ↗
Contents are not inlined in the catalog. Open the upstream file.
renderers/shared/svgdoc.mjs13 KB89fc6f553b97upstream ↗
Contents are not inlined in the catalog. Open the upstream file.
renderers/shared/template.mjs6.9 KBf021525f7f72upstream ↗
Contents are not inlined in the catalog. Open the upstream file.
renderers/shared/triage.mjs6.7 KB5217b8336091upstream ↗
Contents are not inlined in the catalog. Open the upstream file.
renderers/shared/utils.mjs4.1 KBcf1efc8f92c0upstream ↗
Contents are not inlined in the catalog. Open the upstream file.
renderers/shared/validate.mjs46 KBb7e9939ad09cupstream ↗
Contents are not inlined in the catalog. Open the upstream file.
renderers/shared/workspace.mjs5.6 KBd6dbe15ab48fupstream ↗
Contents are not inlined in the catalog. Open the upstream file.
schemas/c4.schema.json3.9 KB66b24ca31732upstream ↗
Contents are not inlined in the catalog. Open the upstream file.
schemas/common.schema.json4.0 KB723ca565d6feupstream ↗
Contents are not inlined in the catalog. Open the upstream file.
schemas/docs-graph.schema.json12 KBcc37d8107ff9upstream ↗
Contents are not inlined in the catalog. Open the upstream file.
schemas/docs-lock.schema.json1.9 KB0d9afecb6a76upstream ↗
Contents are not inlined in the catalog. Open the upstream file.
schemas/docs.schema.json11 KB8549edc96889upstream ↗
Contents are not inlined in the catalog. Open the upstream file.
schemas/endpoints.schema.json4.8 KBac517fbd968eupstream ↗
Contents are not inlined in the catalog. Open the upstream file.
schemas/erd.schema.json4.3 KBae8dd6d01f07upstream ↗
Contents are not inlined in the catalog. Open the upstream file.
schemas/lifecycle.schema.json3.5 KB8585d6035508upstream ↗
Contents are not inlined in the catalog. Open the upstream file.
schemas/links.schema.json4.7 KB89a77082331aupstream ↗
Contents are not inlined in the catalog. Open the upstream file.
schemas/sequence.schema.json3.9 KB014a47c0247eupstream ↗
Contents are not inlined in the catalog. Open the upstream file.
SECURITY.md2.0 KBfca6fb53dcceupstream ↗
Contents are not inlined in the catalog. Open the upstream file.
test/e2e/linked.e2e.mjs14 KB2cfd9d7cb080upstream ↗
Contents are not inlined in the catalog. Open the upstream file.
test/e2e/mermaid.e2e.mjs4.2 KB9483ab8109bdupstream ↗
Contents are not inlined in the catalog. Open the upstream file.
test/e2e/move.e2e.mjs13 KBc3b2dca9ee18upstream ↗
Contents are not inlined in the catalog. Open the upstream file.
test/e2e/save.e2e.mjs4.6 KB008154b8b2f5upstream ↗
Contents are not inlined in the catalog. Open the upstream file.
test/install.test.mjs1.3 KBc206fd27b779upstream ↗
Contents are not inlined in the catalog. Open the upstream file.
test/intake-gate.test.mjs1.6 KB4714a4e2d684upstream ↗
Contents are not inlined in the catalog. Open the upstream file.
test/layout.test.mjs10 KB9e4cdf8702b0upstream ↗
Contents are not inlined in the catalog. Open the upstream file.
test/links.test.mjs10 KB6e697a7fde6fupstream ↗
Contents are not inlined in the catalog. Open the upstream file.
test/mermaid.test.mjs4.6 KBc4e8137859b2upstream ↗
Contents are not inlined in the catalog. Open the upstream file.
test/outdated.test.mjs5.5 KBbf4f8be2f37fupstream ↗
Contents are not inlined in the catalog. Open the upstream file.
test/vibex.test.mjs88 KB10ea19390855upstream ↗
Contents are not inlined in the catalog. Open the upstream file.
test/workspace.test.mjs5.5 KBd9833b3a5747upstream ↗
Contents are not inlined in the catalog. Open the upstream file.
Plain-text copy, no login: /skill-bundles/raja0sama-vibex.md
