beacon-docs 0.1.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.
package/LICENSE ADDED
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2026 julio
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,406 @@
1
+ # Beacon
2
+
3
+ > **Trail markers for AI-collaborative codebases.**
4
+ > Opinionated documentation convention + CLI that scaffolds the structure, generates per-vendor AI rule files (Claude, Cursor, Codex, Gemini), and lints the result.
5
+
6
+ <p align="left">
7
+ <a href="https://www.npmjs.com/package/beacon-docs"><img src="https://img.shields.io/npm/v/beacon-docs.svg?style=flat-square" alt="npm version"></a>
8
+ <a href="https://www.npmjs.com/package/beacon-docs"><img src="https://img.shields.io/npm/dm/beacon-docs.svg?style=flat-square" alt="npm downloads"></a>
9
+ <a href="https://github.com/Juliocbm/beacon-docs/blob/main/LICENSE"><img src="https://img.shields.io/npm/l/beacon-docs.svg?style=flat-square" alt="MIT License"></a>
10
+ <img src="https://img.shields.io/node/v/beacon-docs.svg?style=flat-square" alt="Node version">
11
+ <img src="https://img.shields.io/badge/tests-147%20passing-brightgreen?style=flat-square" alt="147 tests passing">
12
+ </p>
13
+
14
+ ---
15
+
16
+ ## The problem
17
+
18
+ You're building with AI agents β€” Claude Code, Cursor, Codex, Gemini CLI. After a few weeks of vibing, your repo has:
19
+
20
+ - 47 markdown files in random folders
21
+ - `PLAN_v2_FINAL.md`, `plan-v2.md`, `_2025_plan.md` β€” three versions of the same plan
22
+ - ADRs duplicated across `/docs`, `/notes`, and `/decisions`
23
+ - No `CLAUDE.md` or `.cursorrules` telling agents where new docs should go
24
+ - A graveyard of "is this still relevant?" content nobody dares delete
25
+
26
+ The result: **neither humans nor AI agents can answer where X lives, whether it's current, or why it exists.**
27
+
28
+ ## The solution
29
+
30
+ Beacon ships **one opinionated convention** and a CLI that enforces it:
31
+
32
+ - πŸ—‚οΈ **Structure**: 6 core folders every project needs + 6 opt-in add-ons (`compliance/`, `business/`, `modules/`, etc.)
33
+ - 🏷️ **Naming**: filename suffix encodes type (`.plan.md`, `.adr.md`, `.pattern.md`), folder encodes status (`_archive/`)
34
+ - πŸ€– **AI rule files**: generates `CLAUDE.md`, `AGENTS.md`, `GEMINI.md`, `.cursorrules`, and `.cursor/rules/beacon.mdc` from a single source β€” every AI agent gets the rules in its preferred format
35
+ - 🚨 **Linter**: 11 rules validate structure, naming, and AI-file sync (CI-friendly with `--strict` and `--json`)
36
+ - ⚑ **Interactive wizard**: project-type-aware defaults via `@clack/prompts`
37
+
38
+ Result: AI agents stop creating docs in random places. Humans stop hunting for "the latest version." Reviews stop devolving into "should this be here?"
39
+
40
+ ---
41
+
42
+ ## Demo
43
+
44
+ ```bash
45
+ $ npx beacon-docs init
46
+
47
+ β—† Project type?
48
+ β”‚ ● Library / SDK / Package
49
+ β”‚ β—‹ Web Application
50
+ β”‚ β—‹ Backend Service / API
51
+ β”‚ β—‹ CLI Tool
52
+ β”‚ β—‹ ...
53
+
54
+ β—† Which categories to enable?
55
+ β”‚ β—Ό reference β—Ό architecture β—Ό adr β—Ό plans β—Ό backlog β—Ό evaluations
56
+ β”‚ β—» compliance β—» business β—» modules β—» integrations β—» operations β—» roadmaps
57
+
58
+ β—† Which AI agents do you use?
59
+ β”‚ β—Ό Claude Code β—Ό Cursor β—» Codex / Copilot β—» Gemini CLI
60
+
61
+ βœ” Beacon docs scaffolded at /your/project/docs/
62
+ ```
63
+
64
+ You now have a complete docs tree, AI rule files at the project root, and a `docs:lint` script added to your `package.json`. Your next AI session will read `CLAUDE.md` and know exactly where to put new docs.
65
+
66
+ ---
67
+
68
+ ## What you get
69
+
70
+ ```
71
+ your-project/
72
+ β”œβ”€β”€ CLAUDE.md ← generated, read by Claude Code
73
+ β”œβ”€β”€ .cursorrules ← generated, legacy Cursor
74
+ β”œβ”€β”€ .cursor/rules/beacon.mdc ← generated, modern Cursor
75
+ β”œβ”€β”€ package.json ← gets a `docs:lint` script
76
+ └── docs/
77
+ β”œβ”€β”€ README.md ← master index, "where do I find X?"
78
+ β”œβ”€β”€ _meta/
79
+ β”‚ β”œβ”€β”€ convention.md ← SINGLE SOURCE OF TRUTH (you edit this)
80
+ β”‚ └── beacon.config.json ← project type + enabled categories
81
+ β”œβ”€β”€ reference/ ← replicable patterns (.pattern.md)
82
+ β”‚ └── README.md
83
+ β”œβ”€β”€ architecture/ ← system structure (.architecture.md)
84
+ β”‚ └── README.md
85
+ β”œβ”€β”€ adr/ ← decisions (ADR-NNN-*.md, auto-numbered)
86
+ β”‚ └── README.md
87
+ β”œβ”€β”€ plans/ ← active work (.plan.md)
88
+ β”‚ β”œβ”€β”€ README.md
89
+ β”‚ └── _archive/ ← closed plans (status = folder, not filename)
90
+ β”œβ”€β”€ backlog/ ← future items (.todo.md)
91
+ β”‚ └── README.md
92
+ └── evaluations/ ← audits / snapshots (YYYY-MM-DD-*.eval.md)
93
+ └── README.md
94
+ ```
95
+
96
+ And the generated `CLAUDE.md` (only the categories *your* project enabled show up):
97
+
98
+ ```markdown
99
+ <!-- generated by beacon β€” do not edit. Edit docs/_meta/convention.md and run `beacon sync`. -->
100
+
101
+ # Documentation Convention
102
+
103
+ > Project type: **library**. Full convention: [`docs/_meta/convention.md`](docs/_meta/convention.md).
104
+
105
+ ## Universal rules
106
+
107
+ 1. **One doc = one category.** Never duplicate across folders.
108
+ 2. **Status via folder, never filename.** Closed plan β†’ `_archive/`, never `*_DONE.md` or `*_v2.md`.
109
+ 3. **kebab-case for all filenames.**
110
+ 4. **README required in every category folder.**
111
+ 5. **ADRs are append-only.** Supersede with a new ADR; never edit an accepted one.
112
+ 6. **Evaluations are immutable snapshots.** To revise, create a new dated file.
113
+ ...
114
+
115
+ ## Where does X go?
116
+
117
+ | Question | Folder |
118
+ |---|---|
119
+ | "How is X done technically?" | `reference/` |
120
+ | "Why was X decided?" | `adr/` |
121
+ | "What is being built right now?" | `plans/` |
122
+ | "What was the state at date X?" | `evaluations/` |
123
+ ```
124
+
125
+ ---
126
+
127
+ ## Install
128
+
129
+ ```bash
130
+ npm install -D beacon-docs
131
+ ```
132
+
133
+ Or use without installing:
134
+
135
+ ```bash
136
+ npx beacon-docs init
137
+ ```
138
+
139
+ **Requires Node β‰₯ 20.**
140
+
141
+ ## Quick start
142
+
143
+ ### Interactive (recommended for first run)
144
+
145
+ ```bash
146
+ npx beacon-docs init
147
+ ```
148
+
149
+ The wizard detects your project (reads `package.json`, suggests add-ons based on installed deps like `stripe`/`@prisma/client`), then walks you through choices.
150
+
151
+ ### Non-interactive (for CI / scripted setup)
152
+
153
+ ```bash
154
+ npx beacon-docs init \
155
+ --yes \
156
+ --type=library \
157
+ --with=operations \
158
+ --without=backlog \
159
+ --agents=claude,cursor
160
+ ```
161
+
162
+ | Flag | Purpose |
163
+ |---|---|
164
+ | `--yes` | Skip the interactive wizard |
165
+ | `--type=<type>` | One of: `web-app`, `backend-service`, `library`, `cli-tool`, `mobile-app`, `monorepo`, `custom` |
166
+ | `--with=a,b` | Add categories beyond your project type's defaults |
167
+ | `--without=a,b` | Remove categories from defaults |
168
+ | `--agents=a,b` | AI agents to support: `claude`, `cursor`, `codex`, `gemini` |
169
+ | `--language=en` | Docs language (only `en` ships in v1) |
170
+
171
+ ---
172
+
173
+ ## Project types & default categories
174
+
175
+ Project type **suggests defaults**. The wizard pre-checks them, but every choice is deselectable, and unmarked categories can be opted into. Granular customization is available on every type β€” `custom` just starts with nothing pre-selected.
176
+
177
+ | Folder | Library | Web App | Backend | CLI Tool | Mobile | Monorepo | Custom |
178
+ |---|:---:|:---:|:---:|:---:|:---:|:---:|:---:|
179
+ | `reference/` | βœ… | βœ… | βœ… | βœ… | βœ… | βœ… | ⬜ |
180
+ | `architecture/` | βœ… | βœ… | βœ… | βœ… | βœ… | βœ… | ⬜ |
181
+ | `adr/` | βœ… | βœ… | βœ… | βœ… | βœ… | βœ… | ⬜ |
182
+ | `plans/` | βœ… | βœ… | βœ… | βœ… | βœ… | βœ… | ⬜ |
183
+ | `backlog/` | βœ… | βœ… | βœ… | βœ… | βœ… | βœ… | ⬜ |
184
+ | `evaluations/` | βœ… | βœ… | βœ… | βœ… | βœ… | βœ… | ⬜ |
185
+ | `compliance/` | ⬜ | ⬜\* | ⬜\* | ⬜ | ⬜\* | ⬜ | ⬜ |
186
+ | `business/` | ⬜ | βœ… | ⬜ | ⬜ | βœ… | ⬜ | ⬜ |
187
+ | `modules/` | ⬜ | ⬜ | ⬜ | ⬜ | ⬜ | βœ… | ⬜ |
188
+ | `integrations/` | ⬜ | βœ… | βœ… | ⬜ | βœ… | βœ… | ⬜ |
189
+ | `operations/` | ⬜ | βœ… | βœ… | βœ… | βœ… | βœ… | ⬜ |
190
+ | `roadmaps/` | ⬜ | βœ… | βœ… | ⬜ | βœ… | βœ… | ⬜ |
191
+
192
+ βœ… pre-selected β€” ⬜ available but not pre-selected β€” \* prompted explicitly ("Do you handle regulated data?")
193
+
194
+ ---
195
+
196
+ ## Commands
197
+
198
+ | Command | Purpose |
199
+ |---|---|
200
+ | `beacon init` | Interactive scaffold (or `--yes --type=...` for CI) |
201
+ | `beacon new <type> <slug>` | Create a doc with correct location, naming, frontmatter |
202
+ | `beacon archive <type> <slug>` | Move a completed plan/roadmap to `_archive/` |
203
+ | `beacon sync` | Regenerate AI rule files from `docs/_meta/convention.md` |
204
+ | `beacon enable <addon>` | Enable an add-on category (creates folder + README, re-syncs AI files) |
205
+ | `beacon disable <addon>` | Disable an add-on category (`--force` if folder has content) |
206
+ | `beacon lint` | Validate the docs tree (`--strict` to escalate warnings, `--json` for CI) |
207
+
208
+ ### `beacon new` examples
209
+
210
+ ```bash
211
+ beacon new plan billing-integration # β†’ docs/plans/billing-integration.plan.md
212
+ beacon new adr add-rate-limiting # β†’ docs/adr/ADR-001-add-rate-limiting.md (auto-numbered)
213
+ beacon new pattern multi-tenancy # β†’ docs/reference/multi-tenancy.pattern.md
214
+ beacon new eval frontend-audit # β†’ docs/evaluations/2026-05-22-frontend-audit.eval.md
215
+ beacon new module invoicing # β†’ docs/modules/invoicing.module.md (requires `modules` enabled)
216
+ beacon new todo realtime-hardening # β†’ docs/backlog/realtime-hardening.todo.md
217
+ beacon new guide deploy --category=operations # β†’ docs/operations/deploy.guide.md
218
+ ```
219
+
220
+ Each command opens a doc with the right frontmatter skeleton β€” title, status, date, etc.
221
+
222
+ ---
223
+
224
+ ## CI integration
225
+
226
+ Drop this into `.github/workflows/docs-lint.yml`:
227
+
228
+ ```yaml
229
+ name: Beacon docs lint
230
+ on:
231
+ pull_request:
232
+ paths:
233
+ - "docs/**"
234
+ - "CLAUDE.md"
235
+ - "AGENTS.md"
236
+ - "GEMINI.md"
237
+ - ".cursorrules"
238
+ - ".cursor/**"
239
+ push:
240
+ branches: [main]
241
+ jobs:
242
+ beacon-lint:
243
+ runs-on: ubuntu-latest
244
+ steps:
245
+ - uses: actions/checkout@v4
246
+ - uses: actions/setup-node@v4
247
+ with: { node-version: 20 }
248
+ - run: npx beacon-docs lint --strict
249
+ ```
250
+
251
+ `--strict` escalates warnings to errors, so a stale plan or oversized folder will fail the PR.
252
+
253
+ ---
254
+
255
+ ## How it works
256
+
257
+ **Single source of truth β†’ generated artifacts.**
258
+
259
+ ```
260
+ docs/_meta/convention.md ← human-edited, project-specific
261
+ β”‚
262
+ β”œβ”€β–Ί CLAUDE.md (project root)
263
+ β”œβ”€β–Ί AGENTS.md (project root, for Codex / Copilot)
264
+ β”œβ”€β–Ί GEMINI.md (project root)
265
+ β”œβ”€β–Ί .cursorrules (project root, legacy Cursor)
266
+ └─► .cursor/rules/beacon.mdc (modern Cursor rule format)
267
+ ```
268
+
269
+ Generated files carry a `<!-- generated by beacon -->` header. Run `beacon sync` after editing `convention.md` β€” or let `beacon lint --strict` catch out-of-sync files in CI.
270
+
271
+ Each generated file has two layers:
272
+
273
+ - **Universal** (identical in every project) β€” the 9 invariant rules: one doc = one category, status via folder, kebab-case, ADRs append-only, evaluations immutable, etc.
274
+ - **Project-specific** (conditional on enabled categories) β€” e.g., "business/ is for strategy/pricing, no technical content" only appears if you enabled `business/`.
275
+
276
+ A `library` project's `CLAUDE.md` is ~30 lines. A full `web-app` with every add-on is ~70 lines. Density scales with complexity.
277
+
278
+ ---
279
+
280
+ ## How Beacon compares
281
+
282
+ | Tool | What it does | Beacon's difference |
283
+ |---|---|---|
284
+ | **DiΓ‘taxis** | Philosophy of 4 doc types (tutorials, how-to, reference, explanation) | Beacon is CLI + enforced convention; DiΓ‘taxis is a mental model |
285
+ | **adr-tools** | CLI for Architecture Decision Records only | Beacon covers ADRs *and* plans, patterns, evaluations, etc. |
286
+ | **.cursorrules / CLAUDE.md by hand** | You write the rules yourself | Beacon generates all 4 vendor formats from one source, keeps them in sync |
287
+ | **Docusaurus / Vitepress / Starlight** | Builds a docs *site* | Beacon manages the *source tree convention*; pair it with any docs site generator |
288
+ | **Conventional Commits** | Standardizes commit messages | Same philosophy, different layer: standardizes documentation structure |
289
+
290
+ Beacon's wedge: **AI-first**. Built for projects where AI agents are routinely creating, editing, and reading documentation.
291
+
292
+ ---
293
+
294
+ ## Configuration
295
+
296
+ Beacon stores per-project config at `docs/_meta/beacon.config.json`:
297
+
298
+ ```json
299
+ {
300
+ "version": "1.0",
301
+ "projectType": "library",
302
+ "categories": [
303
+ "reference", "architecture", "adr",
304
+ "plans", "backlog", "evaluations",
305
+ "operations"
306
+ ],
307
+ "agents": ["claude", "cursor"],
308
+ "language": "en"
309
+ }
310
+ ```
311
+
312
+ Edited via `beacon init`, `beacon enable`, `beacon disable`. You don't hand-edit it normally β€” but you *can* in a pinch (followed by `beacon sync`).
313
+
314
+ ---
315
+
316
+ ## Customizing the convention
317
+
318
+ Want to tweak the universal rules or the "where does X go?" table for your team? Edit `docs/_meta/convention.md` directly. Then:
319
+
320
+ ```bash
321
+ beacon sync # regenerate all AI rule files
322
+ beacon lint # confirm sync (and structure)
323
+ ```
324
+
325
+ The linter's `ai-files-sync` rule will fail in CI if anyone forgets to run `beacon sync` after editing the convention.
326
+
327
+ ---
328
+
329
+ ## Dogfooding
330
+
331
+ `beacon-docs` itself uses Beacon to organize its own documentation β€” see [`docs/`](./docs) for live examples:
332
+
333
+ - [`docs/architecture/system-overview.architecture.md`](docs/architecture/system-overview.architecture.md) β€” how Beacon is structured internally
334
+ - [`docs/adr/`](docs/adr) β€” 6 ADRs explaining the major design decisions
335
+ - [`docs/reference/`](docs/reference) β€” contributor guides (add a category, add a lint rule, add an AI vendor)
336
+ - [`docs/operations/release-process.guide.md`](docs/operations/release-process.guide.md) β€” release runbook
337
+ - [`docs/backlog/`](docs/backlog) β€” 7 deferred-to-post-1.0 features
338
+
339
+ If you want to see what your project's docs *could* look like, browse this repo.
340
+
341
+ ---
342
+
343
+ ## Project status
344
+
345
+ **v0.1.0** β€” initial public release. Feature-complete for the V1 scope: scaffold + 4 vendor generators + 7 commands + 11 lint rules.
346
+
347
+ ### Deferred to post-1.0
348
+
349
+ See [`docs/backlog/`](docs/backlog) for the full list. Highlights:
350
+
351
+ - `beacon doctor` β€” health checks (stale plans, evals without review)
352
+ - Plugin system for custom categories
353
+ - Auto-migration from existing doc structures (DiΓ‘taxis, ad-hoc)
354
+ - i18n of AI rule templates
355
+ - VSCode extension surfacing lint warnings inline
356
+ - `beacon serve` β€” local docs preview server
357
+ - Brew / scoop distribution
358
+
359
+ PRs welcome for any of these β€” see Contributing below.
360
+
361
+ ---
362
+
363
+ ## Contributing
364
+
365
+ The repo dogfoods its own convention, so contributing means:
366
+
367
+ 1. Open an issue describing the problem or feature.
368
+ 2. For non-trivial changes, propose an ADR in `docs/adr/` first.
369
+ 3. Code changes go in `src/`; add or update tests in `tests/`.
370
+ 4. Run `npm test` (147 tests must keep passing), `npm run typecheck`, `npm run build`.
371
+ 5. Add a changeset (`npx changeset add`) describing your change.
372
+ 6. PR to `main`.
373
+
374
+ Common contribution types β€” see the contributor patterns in [`docs/reference/`](docs/reference):
375
+
376
+ - **Adding a category** β†’ [`docs/reference/adding-a-category.pattern.md`](docs/reference/adding-a-category.pattern.md)
377
+ - **Adding a lint rule** β†’ [`docs/reference/adding-a-lint-rule.pattern.md`](docs/reference/adding-a-lint-rule.pattern.md)
378
+ - **Adding an AI vendor** β†’ [`docs/reference/adding-an-ai-vendor.pattern.md`](docs/reference/adding-an-ai-vendor.pattern.md)
379
+
380
+ ---
381
+
382
+ ## FAQ
383
+
384
+ **Q: Does Beacon write documentation for me?**
385
+ A: No. Beacon enforces *where* docs go and *how* they're named, and tells AI agents the rules. Your AI agent (or you) still writes the actual content.
386
+
387
+ **Q: Can I use Beacon with a docs site like Docusaurus / Vitepress?**
388
+ A: Yes. Beacon manages the source tree convention; layer any site generator on top of `docs/`.
389
+
390
+ **Q: Does it work without AI agents?**
391
+ A: Yes β€” humans benefit from the same convention. The AI rule files are just opt-in via `--agents`.
392
+
393
+ **Q: Why force kebab-case filenames?**
394
+ A: AI agents are wildly inconsistent with casing (camelCase, snake_case, Title Case). Enforcing kebab-case at lint time means agents stop creating duplicates that differ only in casing.
395
+
396
+ **Q: Can I disable a rule I don't like?**
397
+ A: Not in v1. The 11 lint rules are fixed by design (consistency beats configurability for an opinionated tool). Configurable rules are on the [backlog](docs/backlog).
398
+
399
+ **Q: What if my project doesn't fit any of the 7 types?**
400
+ A: Use `--type=custom` β€” starts with no categories enabled, you opt into exactly what you need.
401
+
402
+ ---
403
+
404
+ ## License
405
+
406
+ [MIT](./LICENSE) Β© 2026 julio