@raindogs/contextmd 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/README.md +152 -0
- package/bin/contextmd.js +5 -0
- package/dist/index.d.ts +2 -0
- package/dist/index.js +1201 -0
- package/dist/index.js.map +1 -0
- package/package.json +33 -0
package/README.md
ADDED
|
@@ -0,0 +1,152 @@
|
|
|
1
|
+
# contextmd
|
|
2
|
+
|
|
3
|
+
Generate and sync `CLAUDE.md` and `AGENTS.md` for any repo — one command, no API key needed.
|
|
4
|
+
|
|
5
|
+
```bash
|
|
6
|
+
npx contextmd
|
|
7
|
+
```
|
|
8
|
+
|
|
9
|
+
Your AI assistant finally knows your project.
|
|
10
|
+
|
|
11
|
+
---
|
|
12
|
+
|
|
13
|
+
## Why
|
|
14
|
+
|
|
15
|
+
AI coding assistants are only as good as the context they receive. Claude Code, Cursor, Codex, and Windsurf all depend on `CLAUDE.md` and `AGENTS.md` to understand your project's architecture, conventions, and constraints — but no tooling exists to generate these files automatically.
|
|
16
|
+
|
|
17
|
+
[Issue #6235](https://github.com/anthropics/claude-code/issues/6235) — "Support AGENTS.md" — is the single most-commented open issue on the claude-code repo (2,120+ comments, unresolved for 10+ months). Nobody has shipped the clean `npx contextmd` solution. Until now.
|
|
18
|
+
|
|
19
|
+
---
|
|
20
|
+
|
|
21
|
+
## What it does
|
|
22
|
+
|
|
23
|
+
- Scans your repo (package.json, tsconfig, directory structure, git log)
|
|
24
|
+
- Generates a **commit-quality** `CLAUDE.md` with all 6 required sections
|
|
25
|
+
- Generates a compatible `AGENTS.md` (works with Codex, Cursor, Windsurf)
|
|
26
|
+
- Infers conventions from your actual stack (Zustand → no Redux, Prisma → no raw SQL, etc.)
|
|
27
|
+
- No API key. No internet connection. Zero ongoing cost.
|
|
28
|
+
|
|
29
|
+
> **This repo's `CLAUDE.md` was generated with `npx contextmd` and has never been manually edited.**
|
|
30
|
+
|
|
31
|
+
---
|
|
32
|
+
|
|
33
|
+
## Usage
|
|
34
|
+
|
|
35
|
+
```bash
|
|
36
|
+
# Generate CLAUDE.md + AGENTS.md in current directory
|
|
37
|
+
npx contextmd
|
|
38
|
+
|
|
39
|
+
# Regenerate after making changes to the codebase
|
|
40
|
+
npx contextmd sync
|
|
41
|
+
|
|
42
|
+
# Audit quality of an existing CLAUDE.md (0-100 score)
|
|
43
|
+
npx contextmd score
|
|
44
|
+
|
|
45
|
+
# Also write .ruler/ files for ruler.js fan-out (27+ agent formats)
|
|
46
|
+
npx contextmd --ruler
|
|
47
|
+
```
|
|
48
|
+
|
|
49
|
+
---
|
|
50
|
+
|
|
51
|
+
## What gets generated
|
|
52
|
+
|
|
53
|
+
`contextmd` produces the 6 sections that the [GitHub Blog analysis of 2,500+ repos](https://github.blog/ai-and-ml/github-copilot/how-to-write-a-great-agents-md-lessons-from-over-2500-repositories/) identifies as required for an effective context file:
|
|
54
|
+
|
|
55
|
+
| Section | What it contains |
|
|
56
|
+
|---|---|
|
|
57
|
+
| **Commands** | Exact `dev`, `build`, `test`, `lint` invocations — including the single-test-file variant |
|
|
58
|
+
| **Architecture** | Directory map with purpose of each key folder |
|
|
59
|
+
| **Conventions** | Non-obvious team decisions inferred from your stack |
|
|
60
|
+
| **Testing** | Runner, how to run a subset, coverage command |
|
|
61
|
+
| **Git** | Commit format detected from recent history |
|
|
62
|
+
| **Do NOT** | Explicit rejections of plausible alternatives the team has decided against |
|
|
63
|
+
|
|
64
|
+
### Inference rules
|
|
65
|
+
|
|
66
|
+
`contextmd` automatically derives conventions from your dependencies:
|
|
67
|
+
|
|
68
|
+
| Dependency | Generated rule |
|
|
69
|
+
|---|---|
|
|
70
|
+
| `zustand` | Do not use Redux or Redux Toolkit |
|
|
71
|
+
| `@tanstack/react-query` | Do not store server state in useState |
|
|
72
|
+
| `prisma` | Do not write raw SQL — use Prisma ORM |
|
|
73
|
+
| `drizzle-orm` | Do not write raw SQL — use Drizzle ORM |
|
|
74
|
+
| `tailwindcss` | Do not use inline styles |
|
|
75
|
+
| `@commitlint/cli` | Conventional commits format |
|
|
76
|
+
| `next` + `app/` | Use Server Components by default |
|
|
77
|
+
| tsconfig `paths` | Use the `@/` path alias |
|
|
78
|
+
|
|
79
|
+
---
|
|
80
|
+
|
|
81
|
+
## Ruler integration
|
|
82
|
+
|
|
83
|
+
[ruler](https://github.com/intellectronica/ruler) distributes rules to 27+ agent formats (`.cursorrules`, `.windsurfrules`, `.github/copilot-instructions.md`, etc.) — but it can't generate them.
|
|
84
|
+
|
|
85
|
+
`contextmd` generates the source. `ruler` handles the fan-out:
|
|
86
|
+
|
|
87
|
+
```bash
|
|
88
|
+
npx contextmd --ruler # writes .ruler/rules.md and .ruler/project.md
|
|
89
|
+
ruler # distributes to all your agent configs
|
|
90
|
+
```
|
|
91
|
+
|
|
92
|
+
---
|
|
93
|
+
|
|
94
|
+
## Quality score
|
|
95
|
+
|
|
96
|
+
```bash
|
|
97
|
+
npx contextmd score
|
|
98
|
+
```
|
|
99
|
+
|
|
100
|
+
Audits your `CLAUDE.md` against 5 commit-readiness tests (each worth 20 pts):
|
|
101
|
+
|
|
102
|
+
1. Commands are executable (can be copy-pasted and run immediately)
|
|
103
|
+
2. Architecture map matches actual directory structure
|
|
104
|
+
3. Conventions section encodes at least one non-obvious team decision
|
|
105
|
+
4. Do NOT section has at least one explicit rejection
|
|
106
|
+
5. File is under 200 lines
|
|
107
|
+
|
|
108
|
+
A low-signal `CLAUDE.md` performs **worse than no file at all** — Claude is instructed to treat it as optional context. The score tells you if yours is pulling its weight.
|
|
109
|
+
|
|
110
|
+
---
|
|
111
|
+
|
|
112
|
+
## Compared to alternatives
|
|
113
|
+
|
|
114
|
+
| Tool | npx install | Static (no API) | CLAUDE.md + AGENTS.md | Auto-sync | Score |
|
|
115
|
+
|---|---|---|---|---|---|
|
|
116
|
+
| **contextmd** | ✓ | ✓ | ✓ | ✓ | ✓ |
|
|
117
|
+
| ClaudeForge | ✗ (Claude Code plugin) | ✗ | partial | partial | ✓ |
|
|
118
|
+
| agentseed | ✓ | partial | AGENTS.md only | ✗ | ✗ |
|
|
119
|
+
| `claude /init` | built-in | ✗ | CLAUDE.md only | ✗ | ✗ |
|
|
120
|
+
| claudemd-gen | ✓ | ✓ | CLAUDE.md only | ✗ | ✗ |
|
|
121
|
+
|
|
122
|
+
---
|
|
123
|
+
|
|
124
|
+
## Team sync (coming in v0.2)
|
|
125
|
+
|
|
126
|
+
The paid [contextmd.dev](https://contextmd.dev) sync layer adds:
|
|
127
|
+
|
|
128
|
+
- **Auto-sync on push** — GitHub Action that keeps context files current
|
|
129
|
+
- **Drift alerts** — Slack/email when files fall out of sync with the codebase
|
|
130
|
+
- **Multi-repo dashboard** — health status across all repos in an org
|
|
131
|
+
- **Team config** — shared `contextmd.config.json` for consistent format
|
|
132
|
+
|
|
133
|
+
Solo $9/mo · Team $19/mo · Studio $29/mo
|
|
134
|
+
|
|
135
|
+
---
|
|
136
|
+
|
|
137
|
+
## Contributing
|
|
138
|
+
|
|
139
|
+
Issues, PRs, and feedback welcome.
|
|
140
|
+
|
|
141
|
+
```bash
|
|
142
|
+
git clone https://github.com/walidch/contextmd
|
|
143
|
+
cd contextmd
|
|
144
|
+
npm install
|
|
145
|
+
npm run dev
|
|
146
|
+
```
|
|
147
|
+
|
|
148
|
+
---
|
|
149
|
+
|
|
150
|
+
## License
|
|
151
|
+
|
|
152
|
+
MIT
|
package/bin/contextmd.js
ADDED
package/dist/index.d.ts
ADDED