chiltepin 0.47.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (45) hide show
  1. package/LICENSE +21 -0
  2. package/README.md +249 -0
  3. package/dist/bin.js +3582 -0
  4. package/dist/bin.js.map +1 -0
  5. package/package.json +93 -0
  6. package/templates/chiltepin.config.json +5 -0
  7. package/templates/demo.md +2161 -0
  8. package/templates/docs/getting-started.md +155 -0
  9. package/templates/docs/tutorial.md +559 -0
  10. package/templates/skill/SKILL.md +172 -0
  11. package/templates/skill/reference/blocks/INDEX.md +141 -0
  12. package/templates/skill/reference/blocks/agentic.md +63 -0
  13. package/templates/skill/reference/blocks/algorithms.md +49 -0
  14. package/templates/skill/reference/blocks/api.md +40 -0
  15. package/templates/skill/reference/blocks/architecture.md +94 -0
  16. package/templates/skill/reference/blocks/business.md +70 -0
  17. package/templates/skill/reference/blocks/charts-overviews.md +74 -0
  18. package/templates/skill/reference/blocks/data-model.md +34 -0
  19. package/templates/skill/reference/blocks/design-system.md +50 -0
  20. package/templates/skill/reference/blocks/flows.md +74 -0
  21. package/templates/skill/reference/blocks/narrative.md +65 -0
  22. package/templates/skill/reference/blocks/planning.md +74 -0
  23. package/templates/skill/reference/blocks/quality.md +43 -0
  24. package/templates/skill/reference/blocks/tables-data.md +55 -0
  25. package/templates/skill/reference/check.md +62 -0
  26. package/templates/skill/reference/decks.md +198 -0
  27. package/templates/skill/reference/exemplars/adr.md +87 -0
  28. package/templates/skill/reference/exemplars/agent-system.md +113 -0
  29. package/templates/skill/reference/exemplars/api-reference.md +110 -0
  30. package/templates/skill/reference/exemplars/backend-arch.md +117 -0
  31. package/templates/skill/reference/exemplars/data-pipeline.md +107 -0
  32. package/templates/skill/reference/exemplars/frontend-arch.md +93 -0
  33. package/templates/skill/reference/exemplars/incident-postmortem.md +93 -0
  34. package/templates/skill/reference/exemplars/migration-plan.md +95 -0
  35. package/templates/skill/reference/exemplars/onboarding.md +78 -0
  36. package/templates/skill/reference/exemplars/product-spec.md +81 -0
  37. package/templates/skill/reference/intake.md +140 -0
  38. package/templates/skill/reference/mermaid.md +216 -0
  39. package/templates/skill/reference/organizing.md +118 -0
  40. package/templates/skill/reference/patterns-design.md +59 -0
  41. package/templates/skill/reference/patterns.md +167 -0
  42. package/templates/skill/reference/recipes.md +153 -0
  43. package/templates/skill/reference/style-ste.md +119 -0
  44. package/templates/skill/reference/system-design.md +161 -0
  45. package/templates/skill/reference/writing.md +132 -0
package/LICENSE ADDED
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2026 Chiltepin contributors
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
package/README.md ADDED
@@ -0,0 +1,249 @@
1
+ <!-- Generated from the repo README by scripts/sync-readme.mjs — edit the root README.md. -->
2
+ <p align="center">
3
+ <img src="https://raw.githubusercontent.com/jdiejim/chiltepin/main/assets/brand/mark-256.png" alt="Chiltepin" width="100" />
4
+ </p>
5
+
6
+ <h1 align="center">Chiltepin</h1>
7
+
8
+ <p align="center"><strong>Docs your AI agent can write, and your CI can check.</strong><br/>Turn Markdown and typed YAML into architecture diagrams, API docs, runbooks, and slides. 107 block types, with deterministic HTML + SVG output.</p>
9
+
10
+ <p align="center">
11
+ <a href="https://www.npmjs.com/package/chiltepin"><img src="https://img.shields.io/npm/v/chiltepin?label=chiltepin&color=e4744c" alt="npm" /></a>
12
+ <a href="https://github.com/jdiejim/chiltepin/actions/workflows/ci.yml"><img src="https://github.com/jdiejim/chiltepin/actions/workflows/ci.yml/badge.svg" alt="CI status" /></a>
13
+ <a href="https://github.com/jdiejim/chiltepin/blob/main/LICENSE"><img src="https://img.shields.io/badge/license-MIT-blue" alt="license" /></a>
14
+ <a href="https://nodejs.org"><img src="https://img.shields.io/node/v/chiltepin" alt="node" /></a>
15
+ <a href="https://github.com/jdiejim/chiltepin/tree/main/skills/chiltepin"><img src="https://img.shields.io/badge/skills-npx%20skills%20add%20jdiejim%2Fchiltepin-111" alt="skill" /></a>
16
+ </p>
17
+
18
+ <p align="center">
19
+ <a href="https://chiltepin.dev">Website</a> ·
20
+ <a href="#quick-start">Quick start</a> ·
21
+ <a href="#examples">Examples</a> ·
22
+ <a href="https://github.com/jdiejim/chiltepin/blob/main/skills/chiltepin/SKILL.md">Agent skill</a> ·
23
+ <a href="https://github.com/jdiejim/chiltepin/blob/main/CONTRIBUTING.md">Contribute</a>
24
+ </p>
25
+
26
+ <p align="center">
27
+ <img src="https://raw.githubusercontent.com/jdiejim/chiltepin/main/assets/examples/architecture.png" alt="C4 context diagram: a shopper places orders, and the orders system calls payment and shipping services" width="880" />
28
+ </p>
29
+
30
+ **Your agent writes the content. Chiltepin handles the layout.** Keep the source in Git, review a Markdown diff, and run `chiltepin check` in CI.
31
+
32
+ ```bash
33
+ npx -y chiltepin demo # see rendered examples without creating a project
34
+ ```
35
+
36
+ Use an agent to write docs with `npx skills add jdiejim/chiltepin -g`, or follow the [manual quick start](#quick-start).
37
+
38
+ ## Examples
39
+
40
+ These are screenshots from the current renderer. Open each image at full size, or follow its source link to inspect the YAML.
41
+
42
+ | Architecture and system context | Request flow with success and failure branches |
43
+ | --- | --- |
44
+ | [![C4 context: shopper, orders, payments, and shipping](https://raw.githubusercontent.com/jdiejim/chiltepin/main/assets/examples/architecture.png)](https://github.com/jdiejim/chiltepin/blob/main/assets/examples/architecture.png) | [![Sequence diagram: place an order, charge a card, then approve or decline](https://raw.githubusercontent.com/jdiejim/chiltepin/main/assets/examples/sequence.png)](https://github.com/jdiejim/chiltepin/blob/main/assets/examples/sequence.png) |
45
+ | [Source: system overview](https://github.com/jdiejim/chiltepin/blob/main/docs/examples/system-overview.md) | [Source: the example below](#what-a-doc-looks-like) |
46
+
47
+ | Database relationships | Canary rollout with explicit gates |
48
+ | --- | --- |
49
+ | [![Entity relationship diagram connecting orders and order items](https://raw.githubusercontent.com/jdiejim/chiltepin/main/assets/examples/data-model.png)](https://github.com/jdiejim/chiltepin/blob/main/assets/examples/data-model.png) | [![Checkout rollout from 1 percent to full traffic, with health gates and rollback](https://raw.githubusercontent.com/jdiejim/chiltepin/main/assets/examples/rollout.png)](https://github.com/jdiejim/chiltepin/blob/main/assets/examples/rollout.png) |
50
+ | [Source: API reference](https://github.com/jdiejim/chiltepin/blob/main/docs/examples/api.md) | [Source: canary rollout](https://github.com/jdiejim/chiltepin/blob/main/docs/examples/canary-rollout.md) |
51
+
52
+ More complete documents: [ADR](https://github.com/jdiejim/chiltepin/blob/main/docs/examples/adr.md), [event contract](https://github.com/jdiejim/chiltepin/blob/main/docs/examples/event-contract.md), [runbook](https://github.com/jdiejim/chiltepin/blob/main/docs/examples/runbook.md), and [slide deck](https://github.com/jdiejim/chiltepin/blob/main/docs/examples/presentation.md).
53
+
54
+ <details>
55
+ <summary><strong>Watch the authoring workflow</strong></summary>
56
+
57
+ <p align="center">
58
+ <img src="https://raw.githubusercontent.com/jdiejim/chiltepin/main/assets/flow.gif" alt="Workflow overview: install the skill, ask for a doc, write typed YAML, validate, and render" width="880" />
59
+ </p>
60
+
61
+ </details>
62
+
63
+ ## Why Chiltepin
64
+
65
+ - **Docs you can review.** Prose, diagrams, tables, and decisions live in the same Markdown file.
66
+ - **Layout you can reproduce.** Typed content goes through deterministic renderers; the agent does not need to draw the output.
67
+ - **Validation you can automate.** `chiltepin check` fails on invalid fields and broken references. Style and density warnings help authors improve the result.
68
+ - **Several outputs from one source.** Export HTML, slides, PDF, or a static docs site. Edit the same files in Studio or your editor.
69
+
70
+ ## What a doc looks like
71
+
72
+ ````markdown
73
+ ## Request flow
74
+
75
+ ```sequence
76
+ title: Place order
77
+ actors:
78
+ - { id: Client, name: Client }
79
+ - { id: API, name: Orders API }
80
+ - { id: PSP, name: Payment provider }
81
+ messages:
82
+ - Client -> API: POST /orders
83
+ - API -> PSP: charge card
84
+ - alt: approved
85
+ - PSP --> API: 200 captured
86
+ - API --> Client: 201 Created
87
+ - else: declined
88
+ - PSP --> API: 402 declined
89
+ - API --> Client: 402 PAYMENT_FAILED
90
+ - end
91
+ ```
92
+ ````
93
+
94
+ Prose is plain Markdown. Anything structured is a fenced block: the info-string is the block type, the body is YAML (JSON works too) against a strict schema. Terse one-line forms cover the common items (`a -> b: label`, `Term — definition`, `[pass] item — evidence`). The `.md` files are the only source of truth; the CLI, Studio, and your agent are all editors of the same files.
95
+
96
+ ## Quick start
97
+
98
+ Requires **Node.js 20 or later**. `npx` downloads the CLI on first use.
99
+
100
+ **With an agent:**
101
+
102
+ ```bash
103
+ npx skills add jdiejim/chiltepin -g
104
+ ```
105
+
106
+ Then ask:
107
+
108
+ > Use Chiltepin to document this project's request flow. Read the code, explain the services and data stores, include the failure path, and validate the document.
109
+
110
+ The [skill](https://github.com/jdiejim/chiltepin/blob/main/skills/chiltepin/SKILL.md) guides block selection, schema lookup, and validation. Review the generated content against your code.
111
+
112
+ **By hand, in your project directory:**
113
+
114
+ ```bash
115
+ npx -y chiltepin init
116
+ npx -y chiltepin check
117
+ npx -y chiltepin html docs/getting-started.md -p
118
+ npx -y chiltepin studio
119
+ ```
120
+
121
+ `init` writes a config and two starter docs; it skips existing files. Look up any block with `npx -y chiltepin block sequence`.
122
+
123
+ For a version pinned in your project, run `pnpm add -D chiltepin`, then use `pnpm exec chiltepin check` and `pnpm exec chiltepin studio`.
124
+
125
+ **Other AI tools:** `chiltepin skill` prints the authoring guide for tools with a system-prompt field.
126
+
127
+ ## Check docs in CI
128
+
129
+ After installing the project's dependencies, run:
130
+
131
+ ```bash
132
+ pnpm exec chiltepin check
133
+ ```
134
+
135
+ Errors fail the command. Warnings are non-blocking by default; `--strict-prose` makes prose warnings fail too. Validation checks structure and references; reviewers still verify the technical facts.
136
+
137
+ ## What you can document
138
+
139
+ | For… | Blocks |
140
+ |---|---|
141
+ | Architecture & system design | `c4` `block` `cluster` `archmap` `dfd` `erd` `usecase` `pkg` |
142
+ | Flows, state, time | `sequence` `flow` `state` `swimlane` `saga` `spans` `timing` `gitgraph` `cycle` |
143
+ | Events & messaging | `block` (`preset: event`) `eventcontract` `saga` — 12 patterns in the skill |
144
+ | API reference | `endpoint` `eventcontract` `packet` `code` |
145
+ | Quality, audits, performance | `audit` `checklist` `perfbudget` `percentiles` `threatmodel` `slo` `benchmark` `risk` |
146
+ | Charts | `chart` (bar · line · area · scatter · donut · pie · gauge · radar · waterfall · funnel · pareto · histogram · bell · boxplot · bullet) `heatmap` `sankey` `treemap` `slopegraph` `quadrant` |
147
+ | Decks & decisions | `scqa` `takeaways` `bignumber` `options` `harvey` `scorecard` `scenarios` `chevrons` `roadmap` `swot` `okr` `wardley` |
148
+ | Planning | `userstory` `storymap` `kanban` `timeline` `gantt` `rollout` `changelog` `statustable` `agenda` |
149
+ | Design systems | `wireframe` `palette` `typescale` `dodont` `inventory` `frontend` `felogic` |
150
+ | Algorithms | `array` `linkedlist` `bintree` `hashmap` `graph` |
151
+ | AI & ML | `agentloop` `trace` `prompt` `context` `neuralnet` `modelcard` |
152
+ | Prose structure | `callout` `list` `glossary` `faq` `steps` `spec` `layers` `gallery` `mindmap` `tree` `fishbone` |
153
+
154
+ 107 block types across 13 families. Every field, enum, and terse form: `chiltepin block <type>`. Twelve old names (`infra` `event` `ddd` `network` `belogic` `dag` `waterfall` `funnel` `diff` `terminal` `mece` `tracker`) remain permanent aliases.
155
+
156
+ ## Outputs
157
+
158
+ | Command | Result |
159
+ |---|---|
160
+ | `chiltepin html docs/x.md` | A standalone page with inline CSS + SVG; size depends on content |
161
+ | `chiltepin slides docs/x.md` | A self-contained deck, one slide per heading |
162
+ | `chiltepin pdf docs/x.md` | Print-ready PDF (Chromium fetched once on first use) |
163
+ | `chiltepin build` | A static docs site: index, sidebar, cross-doc links |
164
+ | `chiltepin studio` | Local editor: Home page of your docs, edit in place, Present, Export |
165
+
166
+ One look, dark by default. `"colorScheme": "light"` or `"system"` in `chiltepin.config.json` switches it; print and PDF are always light.
167
+
168
+ ## How the check keeps docs honest
169
+
170
+ ```bash
171
+ chiltepin check # docs/**/*.md
172
+ chiltepin check --json # { code, file, line, column, message, hint, suggestions }
173
+ ```
174
+
175
+ Strict schemas (an unknown field is an error, with "did you mean"), repo-global unique ids, `doc#id` references resolved across files, density caps that say how to split a crowded diagram, prose lints for long sentences and filler, and lens lints: an unlabelled `c4` arrow, a third block of the same type. The parser also repairs the one YAML trap agents hit most — an unquoted comma inside an inline map — so `label: Hold as BACKORDERED, email ETA` means what the author meant.
176
+
177
+ ## Cross-references
178
+
179
+ ```yaml
180
+ links:
181
+ - { ref: orders-api#seq-place-order, label: Request flow }
182
+ ```
183
+
184
+ Any block with a top-level `id:` can be referenced as `doc#id` (or `#id` in the same doc). Duplicates and dangling refs fail the check with both locations.
185
+
186
+ ## Packages
187
+
188
+ | Package | Purpose |
189
+ |---|---|
190
+ | [`chiltepin`](https://github.com/jdiejim/chiltepin/tree/main/packages/cli) | The `chiltepin` CLI: `check · block · demo · html · slides · pdf · build · studio · init · new · audit · sync · skill` |
191
+ | [`chiltepin-core`](https://github.com/jdiejim/chiltepin/tree/main/packages/core) | Parser, block registry, Zod schemas, terse grammars, diagnostics. Pure, no I/O |
192
+ | [`chiltepin-render`](https://github.com/jdiejim/chiltepin/tree/main/packages/render) | Deterministic renderers; HTML + SVG, one editorial skin |
193
+ | [`chiltepin-studio`](https://github.com/jdiejim/chiltepin/tree/main/packages/studio) | The local visual editor served by `chiltepin studio` |
194
+ | [`skills/chiltepin`](https://github.com/jdiejim/chiltepin/tree/main/skills/chiltepin) | The agent skill: block selection, validation, and references loaded on demand |
195
+
196
+ <details>
197
+ <summary><strong>Full CLI reference</strong></summary>
198
+
199
+ | Command | What it does |
200
+ |---|---|
201
+ | `chiltepin init` | Scaffold `chiltepin.config.json` + two starter docs (`--force` overwrites) |
202
+ | `chiltepin new [name]` | Scaffold a whole doc (`adr`, `runbook`, …) or one block |
203
+ | `chiltepin check [globs]` | Validate — schemas, refs, ids, density, prose, lens lints (`--json`) |
204
+ | `chiltepin block [type]` | The reference: every type on one line, or one type's contract (`--json`) |
205
+ | `chiltepin demo [family] [-s]` | Render the built-in showcase — every block, or one family (`-s` slides) |
206
+ | `chiltepin html / slides / pdf <in>` | Render one doc (`-p` opens, `-o` writes) |
207
+ | `chiltepin <file.md>` | Render and open one doc |
208
+ | `chiltepin build` | Static site from all docs (`--out`) |
209
+ | `chiltepin studio` | The local editor (`--port`, `--no-open`) |
210
+ | `chiltepin audit [path]` | Audit a codebase and recommend which docs to write, with evidence |
211
+ | `chiltepin sync openapi\|csv\|sql\|dbml\|prisma <file>` | Generate blocks or docs from an OpenAPI spec, a CSV, or a schema |
212
+ | `chiltepin skill` | Print the skill as one document |
213
+
214
+ Exit codes: `0` clean · `1` errors · `2` usage error. `CHILTEPIN_PLAIN=1` forces plain output.
215
+
216
+ </details>
217
+
218
+ ## Evaluation
219
+
220
+ The [generation evaluation](https://github.com/jdiejim/chiltepin/tree/main/evals/generate) records 40 plain-language requests: a selection score of 39.5/40, 33 first drafts without errors, and 40 documents validated and rendered at handoff. These are maintainer-reported development runs, including rescoring after fixes. Raw run artifacts are local, so this is not an independently reproducible benchmark result yet. See the [case set](https://github.com/jdiejim/chiltepin/blob/main/evals/generate/cases.yaml) and [method](https://github.com/jdiejim/chiltepin/blob/main/evals/generate/README.md).
221
+
222
+ ## Design rules
223
+
224
+ - **Geometry is code, never prompt.** If a fix tempts you to teach the model coordinates, the fix belongs in the renderer.
225
+ - **Registries are exhaustive.** A block type exists only when it has a schema, a renderer, a skill entry, a catalog example, and a test.
226
+ - **One look.** Tokens only, no literal colours; one accent per diagram, spent on the one thing the reader must see.
227
+ - **Files are the truth.** Studio, the CLI, and agents write the same `.md`; nothing else holds state.
228
+
229
+ See [`ARCHITECTURE.md`](https://github.com/jdiejim/chiltepin/blob/main/ARCHITECTURE.md) and the renderer's [`DESIGN.md`](https://github.com/jdiejim/chiltepin/blob/main/packages/render/DESIGN.md).
230
+
231
+ ## Development
232
+
233
+ ```bash
234
+ pnpm install
235
+ pnpm typecheck && pnpm test && pnpm lint && pnpm build
236
+ node packages/cli/dist/bin.js check # the repo's own docs
237
+ ```
238
+
239
+ Evals live in [`evals/`](https://github.com/jdiejim/chiltepin/tree/main/evals): block selection and end-to-end generation. Add a scenario when you add a block. Regenerate the gallery with `pnpm screenshots` after building; it requires the CLI's optional Playwright and its Chromium browser.
240
+
241
+ ## Contribute and get help
242
+
243
+ Read [CONTRIBUTING.md](https://github.com/jdiejim/chiltepin/blob/main/CONTRIBUTING.md) to add a block, improve a renderer, or contribute an example. [Report a bug](https://github.com/jdiejim/chiltepin/issues/new?template=bug.yml) with the smallest Markdown file that reproduces it, or [request a block](https://github.com/jdiejim/chiltepin/issues/new?template=block.yml).
244
+
245
+ If Chiltepin saves you a diagram, a star helps other people find it.
246
+
247
+ ## License
248
+
249
+ [MIT](https://github.com/jdiejim/chiltepin/blob/main/LICENSE)