rebar-mcp 2.0.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/.claude/agents/template-writer.md +43 -0
- package/.claude/agents/test-runner.md +47 -0
- package/.claude/mcp.json +9 -0
- package/.claude/settings.json +29 -0
- package/.claude/skills/ /SKILL.md +21 -0
- package/.claude/skills/aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa/SKILL.md +21 -0
- package/.claude/skills/bmmibwetxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx/SKILL.md +21 -0
- package/.claude/skills/bmmibwjgvxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx/SKILL.md +21 -0
- package/.claude/skills/bmmibwsesxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx/SKILL.md +21 -0
- package/.claude/skills/bmmibwxufxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx/SKILL.md +21 -0
- package/.claude/skills/bmmibx3r9xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx/SKILL.md +21 -0
- package/.claude/skills/bmmji0lrkxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx/SKILL.md +21 -0
- package/.claude/skills/bmmjiniphxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx/SKILL.md +21 -0
- package/.claude/skills/bmmjio86zxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx/SKILL.md +21 -0
- package/.claude/skills/bmmjiolfbxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx/SKILL.md +21 -0
- package/.claude/skills/bmmjit1lvxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx/SKILL.md +21 -0
- package/.claude/skills/bmmjita1qxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx/SKILL.md +21 -0
- package/.claude/skills/bnd-mmibweu3/SKILL.md +21 -0
- package/.claude/skills/bnd-mmibwjh4/SKILL.md +21 -0
- package/.claude/skills/bnd-mmibwsey/SKILL.md +21 -0
- package/.claude/skills/bnd-mmibwxup/SKILL.md +21 -0
- package/.claude/skills/bnd-mmibx3rg/SKILL.md +21 -0
- package/.claude/skills/bnd-mmji0lrp/SKILL.md +21 -0
- package/.claude/skills/bnd-mmjinipm/SKILL.md +21 -0
- package/.claude/skills/bnd-mmjio875/SKILL.md +21 -0
- package/.claude/skills/bnd-mmjiolfg/SKILL.md +21 -0
- package/.claude/skills/bnd-mmjit1m3/SKILL.md +21 -0
- package/.claude/skills/bnd-mmjita1x/SKILL.md +21 -0
- package/.claude/skills/coercion-test/SKILL.md +50 -0
- package/.claude/skills/large-skill/SKILL.md +21 -0
- package/.claude/skills/long-desc-skill/SKILL.md +21 -0
- package/.claude/skills/mcp-dev/SKILL.md +61 -0
- package/.claude/skills/nl-mmibweus/SKILL.md +25 -0
- package/.claude/skills/nl-mmibwjhf/SKILL.md +25 -0
- package/.claude/skills/nl-mmibwsf7/SKILL.md +25 -0
- package/.claude/skills/nl-mmibwxvq/SKILL.md +25 -0
- package/.claude/skills/nl-mmibx3rt/SKILL.md +25 -0
- package/.claude/skills/nl-mmji0lrz/SKILL.md +25 -0
- package/.claude/skills/nl-mmjinipx/SKILL.md +25 -0
- package/.claude/skills/nl-mmjio87f/SKILL.md +25 -0
- package/.claude/skills/nl-mmjiolfs/SKILL.md +25 -0
- package/.claude/skills/nl-mmjit1mc/SKILL.md +25 -0
- package/.claude/skills/nl-mmjita26/SKILL.md +25 -0
- package/.claude/skills/rapid-1/SKILL.md +21 -0
- package/.claude/skills/rapid-2/SKILL.md +21 -0
- package/.claude/skills/rapid-3/SKILL.md +21 -0
- package/.claude/skills/rapid-4/SKILL.md +21 -0
- package/.claude/skills/rapid-5/SKILL.md +21 -0
- package/.claude/skills/test/", /"malicious/": /"true/SKILL.md" +69 -0
- package/.claude/skills/test-emoji-/360/237/230/200-skill/SKILL.md +69 -0
- package/.claude/skills/test-skill/SKILL.md +69 -0
- package/.claude/skills/test; rm -rf /; skill/SKILL.md +69 -0
- package/.claude/skills/test<script>alert(1)</script>skill/SKILL.md +69 -0
- package/.claudeignore +5 -0
- package/.mcp.json +3 -0
- package/CHANGELOG.md +29 -0
- package/CLAUDE.md +76 -0
- package/LICENSE +21 -0
- package/README.md +149 -0
- package/ROADMAP.md +526 -0
- package/ccboot-PRD-v1.0.docx.md +732 -0
- package/ccboot-v1.2.0-enforcement-spec.md +1272 -0
- package/dist/cli.d.ts +3 -0
- package/dist/cli.d.ts.map +1 -0
- package/dist/cli.js +674 -0
- package/dist/cli.js.map +1 -0
- package/dist/constants.d.ts +25 -0
- package/dist/constants.d.ts.map +1 -0
- package/dist/constants.js +118 -0
- package/dist/constants.js.map +1 -0
- package/dist/index.d.ts +3 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +47 -0
- package/dist/index.js.map +1 -0
- package/dist/schemas/common.d.ts +62 -0
- package/dist/schemas/common.d.ts.map +1 -0
- package/dist/schemas/common.js +15 -0
- package/dist/schemas/common.js.map +1 -0
- package/dist/schemas/scaffolding.d.ts +277 -0
- package/dist/schemas/scaffolding.d.ts.map +1 -0
- package/dist/schemas/scaffolding.js +133 -0
- package/dist/schemas/scaffolding.js.map +1 -0
- package/dist/services/claudemd-generator.d.ts +16 -0
- package/dist/services/claudemd-generator.d.ts.map +1 -0
- package/dist/services/claudemd-generator.js +426 -0
- package/dist/services/claudemd-generator.js.map +1 -0
- package/dist/services/codex-generator.d.ts +6 -0
- package/dist/services/codex-generator.d.ts.map +1 -0
- package/dist/services/codex-generator.js +35 -0
- package/dist/services/codex-generator.js.map +1 -0
- package/dist/services/cursor-generator.d.ts +15 -0
- package/dist/services/cursor-generator.d.ts.map +1 -0
- package/dist/services/cursor-generator.js +134 -0
- package/dist/services/cursor-generator.js.map +1 -0
- package/dist/services/file-ops.d.ts +48 -0
- package/dist/services/file-ops.d.ts.map +1 -0
- package/dist/services/file-ops.js +153 -0
- package/dist/services/file-ops.js.map +1 -0
- package/dist/services/output-formatter.d.ts +57 -0
- package/dist/services/output-formatter.d.ts.map +1 -0
- package/dist/services/output-formatter.js +88 -0
- package/dist/services/output-formatter.js.map +1 -0
- package/dist/services/platform-detect.d.ts +14 -0
- package/dist/services/platform-detect.d.ts.map +1 -0
- package/dist/services/platform-detect.js +63 -0
- package/dist/services/platform-detect.js.map +1 -0
- package/dist/services/project-analyzer.d.ts +71 -0
- package/dist/services/project-analyzer.d.ts.map +1 -0
- package/dist/services/project-analyzer.js +595 -0
- package/dist/services/project-analyzer.js.map +1 -0
- package/dist/services/rules-engine.d.ts +41 -0
- package/dist/services/rules-engine.d.ts.map +1 -0
- package/dist/services/rules-engine.js +304 -0
- package/dist/services/rules-engine.js.map +1 -0
- package/dist/services/strictness.d.ts +37 -0
- package/dist/services/strictness.d.ts.map +1 -0
- package/dist/services/strictness.js +182 -0
- package/dist/services/strictness.js.map +1 -0
- package/dist/services/template-engine.d.ts +16 -0
- package/dist/services/template-engine.d.ts.map +1 -0
- package/dist/services/template-engine.js +85 -0
- package/dist/services/template-engine.js.map +1 -0
- package/dist/services/validation.d.ts +41 -0
- package/dist/services/validation.d.ts.map +1 -0
- package/dist/services/validation.js +104 -0
- package/dist/services/validation.js.map +1 -0
- package/dist/services/windsurf-generator.d.ts +15 -0
- package/dist/services/windsurf-generator.d.ts.map +1 -0
- package/dist/services/windsurf-generator.js +127 -0
- package/dist/services/windsurf-generator.js.map +1 -0
- package/dist/tests/enforcement.test.d.ts +2 -0
- package/dist/tests/enforcement.test.d.ts.map +1 -0
- package/dist/tests/enforcement.test.js +541 -0
- package/dist/tests/enforcement.test.js.map +1 -0
- package/dist/tests/enterprise.test.d.ts +2 -0
- package/dist/tests/enterprise.test.d.ts.map +1 -0
- package/dist/tests/enterprise.test.js +353 -0
- package/dist/tests/enterprise.test.js.map +1 -0
- package/dist/tests/fuzzing.test.d.ts +2 -0
- package/dist/tests/fuzzing.test.d.ts.map +1 -0
- package/dist/tests/fuzzing.test.js +596 -0
- package/dist/tests/fuzzing.test.js.map +1 -0
- package/dist/tests/knowledge.test.d.ts +2 -0
- package/dist/tests/knowledge.test.d.ts.map +1 -0
- package/dist/tests/knowledge.test.js +292 -0
- package/dist/tests/knowledge.test.js.map +1 -0
- package/dist/tests/management.test.d.ts +2 -0
- package/dist/tests/management.test.d.ts.map +1 -0
- package/dist/tests/management.test.js +338 -0
- package/dist/tests/management.test.js.map +1 -0
- package/dist/tests/scaffolding.test.d.ts +2 -0
- package/dist/tests/scaffolding.test.d.ts.map +1 -0
- package/dist/tests/scaffolding.test.js +419 -0
- package/dist/tests/scaffolding.test.js.map +1 -0
- package/dist/tests/test-utils.d.ts +76 -0
- package/dist/tests/test-utils.d.ts.map +1 -0
- package/dist/tests/test-utils.js +171 -0
- package/dist/tests/test-utils.js.map +1 -0
- package/dist/tests/tool-harness.d.ts +18 -0
- package/dist/tests/tool-harness.d.ts.map +1 -0
- package/dist/tests/tool-harness.js +51 -0
- package/dist/tests/tool-harness.js.map +1 -0
- package/dist/tools/enterprise.d.ts +8 -0
- package/dist/tools/enterprise.d.ts.map +1 -0
- package/dist/tools/enterprise.js +571 -0
- package/dist/tools/enterprise.js.map +1 -0
- package/dist/tools/knowledge.d.ts +7 -0
- package/dist/tools/knowledge.d.ts.map +1 -0
- package/dist/tools/knowledge.js +120 -0
- package/dist/tools/knowledge.js.map +1 -0
- package/dist/tools/management.d.ts +10 -0
- package/dist/tools/management.d.ts.map +1 -0
- package/dist/tools/management.js +1541 -0
- package/dist/tools/management.js.map +1 -0
- package/dist/tools/scaffolding.d.ts +8 -0
- package/dist/tools/scaffolding.d.ts.map +1 -0
- package/dist/tools/scaffolding.js +736 -0
- package/dist/tools/scaffolding.js.map +1 -0
- package/dist/types.d.ts +54 -0
- package/dist/types.d.ts.map +1 -0
- package/dist/types.js +5 -0
- package/dist/types.js.map +1 -0
- package/landing/app/layout.tsx +30 -0
- package/landing/app/page.tsx +944 -0
- package/landing/next-env.d.ts +6 -0
- package/landing/next.config.js +6 -0
- package/landing/package-lock.json +896 -0
- package/landing/package.json +20 -0
- package/landing/tsconfig.json +40 -0
- package/package.json +49 -0
- package/rebar-v2.0.0-platform-spec.md +1567 -0
- package/server.json +20 -0
- package/src/cli.ts +735 -0
- package/src/constants.ts +131 -0
- package/src/index.ts +54 -0
- package/src/schemas/common.ts +22 -0
- package/src/schemas/scaffolding.ts +161 -0
- package/src/services/claudemd-generator.ts +481 -0
- package/src/services/codex-generator.ts +44 -0
- package/src/services/cursor-generator.ts +153 -0
- package/src/services/file-ops.ts +172 -0
- package/src/services/platform-detect.ts +80 -0
- package/src/services/project-analyzer.ts +690 -0
- package/src/services/rules-engine.ts +353 -0
- package/src/services/strictness.ts +202 -0
- package/src/services/template-engine.ts +119 -0
- package/src/services/validation.ts +138 -0
- package/src/services/windsurf-generator.ts +145 -0
- package/src/tests/enforcement.test.ts +794 -0
- package/src/tests/enterprise.test.ts +483 -0
- package/src/tests/fuzzing.test.ts +690 -0
- package/src/tests/knowledge.test.ts +371 -0
- package/src/tests/management.test.ts +451 -0
- package/src/tests/scaffolding.test.ts +575 -0
- package/src/tests/test-utils.ts +206 -0
- package/src/tests/tool-harness.ts +70 -0
- package/src/tools/enterprise.ts +666 -0
- package/src/tools/knowledge.ts +162 -0
- package/src/tools/management.ts +1706 -0
- package/src/tools/scaffolding.ts +909 -0
- package/src/types.ts +93 -0
- package/supabase/.temp/cli-latest +1 -0
- package/supabase/.temp/gotrue-version +1 -0
- package/supabase/.temp/pooler-url +1 -0
- package/supabase/.temp/postgres-version +1 -0
- package/supabase/.temp/project-ref +1 -0
- package/supabase/.temp/rest-version +1 -0
- package/supabase/.temp/storage-migration +1 -0
- package/supabase/.temp/storage-version +1 -0
- package/templates/agents/explore.md +41 -0
- package/templates/agents/plan.md +73 -0
- package/templates/agents/security-auditor.md +77 -0
- package/templates/agents/test-runner.md +60 -0
- package/templates/claudemd/fastapi.md +49 -0
- package/templates/claudemd/monorepo.md +48 -0
- package/templates/claudemd/nextjs.md +52 -0
- package/templates/claudemd/react-spa.md +50 -0
- package/templates/claudemd/springboot.md +50 -0
- package/templates/hooks/danger-blocker.json +11 -0
- package/templates/hooks/format-on-write.json +17 -0
- package/templates/hooks/lint-on-write.json +16 -0
- package/templates/hooks/secret-detector.json +11 -0
- package/templates/skills/code-review.md +68 -0
- package/templates/skills/documentation.md +62 -0
- package/templates/skills/performance-audit.md +80 -0
- package/templates/skills/security-scan.md +66 -0
- package/templates/skills/test-writer.md +56 -0
- package/tsconfig.json +19 -0
|
@@ -0,0 +1,1567 @@
|
|
|
1
|
+
# Rebar v2.0.0 — The Complete Rebrand and Platform Expansion
|
|
2
|
+
|
|
3
|
+
## STATUS: IMPLEMENTATION SPEC — NOT A DISCUSSION DOCUMENT
|
|
4
|
+
|
|
5
|
+
Every section in this document is a directive. Do not paraphrase. Do not summarize.
|
|
6
|
+
Do not replace specific text with "appropriate content" or "relevant rules."
|
|
7
|
+
When this spec says "use this exact text," copy it verbatim.
|
|
8
|
+
When this spec says "the command MUST be," use that exact command string.
|
|
9
|
+
When this spec says "create this file," create that exact file with that exact content.
|
|
10
|
+
|
|
11
|
+
If you are unsure about something, re-read the spec. The answer is in here.
|
|
12
|
+
|
|
13
|
+
---
|
|
14
|
+
|
|
15
|
+
## What Rebar v2.0.0 Is
|
|
16
|
+
|
|
17
|
+
Rebar is an enforcement platform for AI-generated code. It prevents AI coding tools from shipping broken, incomplete, or insecure code by embedding guardrails directly into the development environment.
|
|
18
|
+
|
|
19
|
+
v2.0.0 transforms ccboot-mcp-server into Rebar:
|
|
20
|
+
- New name, new npm package, new GitHub repo, new identity
|
|
21
|
+
- Multi-platform support (Claude Code + Cursor + Codex + Windsurf)
|
|
22
|
+
- Strictness profiles (Standard / Strict / Paranoid)
|
|
23
|
+
- `rebar doctor` health check command
|
|
24
|
+
- Enhanced metrics dashboard with quality score over time
|
|
25
|
+
- Standalone CLI mode for CI/CD pipelines
|
|
26
|
+
- README badge / embeddable quality score SVG
|
|
27
|
+
|
|
28
|
+
Previous versions (ccboot v1.0–v1.2) are being superseded. All functionality carries forward.
|
|
29
|
+
|
|
30
|
+
---
|
|
31
|
+
|
|
32
|
+
## IMPLEMENTATION ORDER
|
|
33
|
+
|
|
34
|
+
Complete these in EXACT sequence. Do not skip ahead. Do not combine phases.
|
|
35
|
+
After each phase, run `npm run build` and `npm run test`. Fix ALL errors before proceeding.
|
|
36
|
+
|
|
37
|
+
```
|
|
38
|
+
Phase A: Repository rebrand (Section 1)
|
|
39
|
+
Phase B: Strictness profiles (Section 2)
|
|
40
|
+
Phase C: Multi-platform template generation (Section 3)
|
|
41
|
+
Phase D: `rebar doctor` command (Section 4)
|
|
42
|
+
Phase E: Standalone CLI mode (Section 5)
|
|
43
|
+
Phase F: Enhanced metrics dashboard (Section 6)
|
|
44
|
+
Phase G: Quality score badge (Section 7)
|
|
45
|
+
Phase H: Custom rules engine (Section 8)
|
|
46
|
+
Phase I: Update all tests (Section 9)
|
|
47
|
+
Phase J: README, CHANGELOG, publish (Section 10)
|
|
48
|
+
```
|
|
49
|
+
|
|
50
|
+
---
|
|
51
|
+
|
|
52
|
+
# SECTION 1: REPOSITORY REBRAND
|
|
53
|
+
|
|
54
|
+
## 1.1 Package Identity
|
|
55
|
+
|
|
56
|
+
| Field | Old Value | New Value |
|
|
57
|
+
|-------|-----------|-----------|
|
|
58
|
+
| Package name | `ccboot-mcp-server` | `rebar-mcp` |
|
|
59
|
+
| Binary name | `ccboot-mcp-server` | `rebar` |
|
|
60
|
+
| npm scope | `@vaspera/ccboot-mcp-server` (if scoped) | `rebar-mcp` (unscoped for easier install) |
|
|
61
|
+
| GitHub repo | (existing) | `rebar-mcp` |
|
|
62
|
+
| Tool name prefix | `ccboot_` | `rebar_` |
|
|
63
|
+
| Display name | "CCBoot MCP Server" | "Rebar" |
|
|
64
|
+
| Tagline | "Claude Code Bootstrapper" | "Reinforcement for AI-generated code" |
|
|
65
|
+
|
|
66
|
+
## 1.2 File Changes
|
|
67
|
+
|
|
68
|
+
### package.json
|
|
69
|
+
|
|
70
|
+
Update these fields EXACTLY:
|
|
71
|
+
|
|
72
|
+
```json
|
|
73
|
+
{
|
|
74
|
+
"name": "rebar-mcp",
|
|
75
|
+
"version": "2.0.0",
|
|
76
|
+
"description": "Reinforcement for AI-generated code. Enforcement hooks, quality audits, and opinionated templates that prevent AI coding tools from shipping broken code.",
|
|
77
|
+
"main": "dist/index.js",
|
|
78
|
+
"bin": {
|
|
79
|
+
"rebar": "dist/index.js",
|
|
80
|
+
"rebar-mcp": "dist/index.js"
|
|
81
|
+
},
|
|
82
|
+
"keywords": [
|
|
83
|
+
"mcp",
|
|
84
|
+
"claude-code",
|
|
85
|
+
"cursor",
|
|
86
|
+
"codex",
|
|
87
|
+
"windsurf",
|
|
88
|
+
"ai-coding",
|
|
89
|
+
"code-quality",
|
|
90
|
+
"enforcement",
|
|
91
|
+
"guardrails",
|
|
92
|
+
"linting",
|
|
93
|
+
"security",
|
|
94
|
+
"testing",
|
|
95
|
+
"agent-skills"
|
|
96
|
+
],
|
|
97
|
+
"repository": {
|
|
98
|
+
"type": "git",
|
|
99
|
+
"url": "https://github.com/RCOLKITT/rebar-mcp"
|
|
100
|
+
},
|
|
101
|
+
"homepage": "https://github.com/RCOLKITT/rebar-mcp#readme",
|
|
102
|
+
"author": "Ryan Colkitt <vaspera>",
|
|
103
|
+
"license": "MIT"
|
|
104
|
+
}
|
|
105
|
+
```
|
|
106
|
+
|
|
107
|
+
### src/index.ts
|
|
108
|
+
|
|
109
|
+
Update the McpServer initialization:
|
|
110
|
+
|
|
111
|
+
```typescript
|
|
112
|
+
const server = new McpServer({
|
|
113
|
+
name: "rebar-mcp",
|
|
114
|
+
version: "2.0.0"
|
|
115
|
+
});
|
|
116
|
+
```
|
|
117
|
+
|
|
118
|
+
### All tool registrations
|
|
119
|
+
|
|
120
|
+
Every tool name MUST be renamed from `ccboot_*` to `rebar_*`. This is a global find-and-replace but VERIFY every occurrence:
|
|
121
|
+
|
|
122
|
+
| Old Name | New Name |
|
|
123
|
+
|----------|----------|
|
|
124
|
+
| `ccboot_init_project` | `rebar_init_project` |
|
|
125
|
+
| `ccboot_generate_claudemd` | `rebar_generate_claudemd` |
|
|
126
|
+
| `ccboot_create_skill` | `rebar_create_skill` |
|
|
127
|
+
| `ccboot_create_agent` | `rebar_create_agent` |
|
|
128
|
+
| `ccboot_create_hook` | `rebar_create_hook` |
|
|
129
|
+
| `ccboot_create_command` | `rebar_create_command` |
|
|
130
|
+
| `ccboot_create_knowledge` | `rebar_create_knowledge` |
|
|
131
|
+
| `ccboot_create_adr` | `rebar_create_adr` |
|
|
132
|
+
| `ccboot_list_artifacts` | `rebar_list_artifacts` |
|
|
133
|
+
| `ccboot_validate_config` | `rebar_validate_config` |
|
|
134
|
+
| `ccboot_audit_context` | `rebar_audit_context` |
|
|
135
|
+
| `ccboot_apply_compliance` | `rebar_apply_compliance` |
|
|
136
|
+
| `ccboot_create_ci_workflow` | `rebar_create_ci_workflow` |
|
|
137
|
+
| `ccboot_create_security_hook` | `rebar_create_security_hook` |
|
|
138
|
+
| `ccboot_generate_mcp_config` | `rebar_generate_mcp_config` |
|
|
139
|
+
| `ccboot_audit_code_quality` | `rebar_audit` |
|
|
140
|
+
|
|
141
|
+
Note: `ccboot_audit_code_quality` becomes `rebar_audit` (shorter, cleaner).
|
|
142
|
+
|
|
143
|
+
### Tool descriptions
|
|
144
|
+
|
|
145
|
+
Every tool description must be updated to remove references to "ccboot" and replace with "Rebar." Additionally, every tool description's FIRST LINE must include the Rebar identity. Example:
|
|
146
|
+
|
|
147
|
+
OLD: `"Full project bootstrap. Generates CLAUDE.md, .claude/ directory..."`
|
|
148
|
+
NEW: `"[Rebar] Full project bootstrap with enforcement hooks, opinionated templates, and quality guardrails. Generates CLAUDE.md, .claude/ directory..."`
|
|
149
|
+
|
|
150
|
+
### All template files
|
|
151
|
+
|
|
152
|
+
Search every file in `templates/` for the string "ccboot" and replace with "rebar". This includes:
|
|
153
|
+
- Template content that references ccboot
|
|
154
|
+
- YAML frontmatter that references ccboot
|
|
155
|
+
- Comments that reference ccboot
|
|
156
|
+
|
|
157
|
+
### All test files
|
|
158
|
+
|
|
159
|
+
Update all test files to use `rebar_*` tool names and `rebar-mcp` package references.
|
|
160
|
+
|
|
161
|
+
### README.md
|
|
162
|
+
|
|
163
|
+
Will be fully rewritten in Section 10. For now, update the title to `# Rebar` and the description to `Reinforcement for AI-generated code.`
|
|
164
|
+
|
|
165
|
+
## 1.3 Verification
|
|
166
|
+
|
|
167
|
+
After completing the rebrand:
|
|
168
|
+
|
|
169
|
+
1. `grep -r "ccboot" src/ templates/ tests/` must return ZERO results
|
|
170
|
+
2. `grep -r "ccboot" package.json` must return ZERO results
|
|
171
|
+
3. `npm run build` must pass with zero errors
|
|
172
|
+
4. `npm run test` must pass with all tests green
|
|
173
|
+
5. Running `node dist/index.js` must start the MCP server with name "rebar-mcp"
|
|
174
|
+
|
|
175
|
+
Do NOT proceed to Phase B until all 5 verifications pass.
|
|
176
|
+
|
|
177
|
+
---
|
|
178
|
+
|
|
179
|
+
# SECTION 2: STRICTNESS PROFILES
|
|
180
|
+
|
|
181
|
+
## 2.1 Overview
|
|
182
|
+
|
|
183
|
+
Strictness profiles control how aggressively Rebar's hooks enforce quality. Three named profiles replace the binary "notify vs. block" choice.
|
|
184
|
+
|
|
185
|
+
## 2.2 Profile Definitions
|
|
186
|
+
|
|
187
|
+
### Standard Profile
|
|
188
|
+
|
|
189
|
+
Behavior: Hooks **notify** on issues but do not block. Claude sees the warning and should act on it, but is not forced to stop.
|
|
190
|
+
|
|
191
|
+
| Hook | Behavior | Exit Code |
|
|
192
|
+
|------|----------|-----------|
|
|
193
|
+
| Format-on-write | Formats automatically | 0 (always succeeds) |
|
|
194
|
+
| Lint-on-write | Shows lint output | 0 (notify only) |
|
|
195
|
+
| Test enforcement | Runs tests, shows results | 0 (notify only) |
|
|
196
|
+
| Danger blocker | **Blocks** destructive commands | 2 (always blocks — even Standard doesn't allow rm -rf) |
|
|
197
|
+
| Secret detector | **Blocks** secret commits | 2 (always blocks — even Standard doesn't allow secrets) |
|
|
198
|
+
|
|
199
|
+
### Strict Profile
|
|
200
|
+
|
|
201
|
+
Behavior: Hooks **block** on quality failures. Claude must fix the issue before continuing.
|
|
202
|
+
|
|
203
|
+
| Hook | Behavior | Exit Code |
|
|
204
|
+
|------|----------|-----------|
|
|
205
|
+
| Format-on-write | Formats automatically | 0 |
|
|
206
|
+
| Lint-on-write | Shows lint output, **blocks** if errors found | 2 if lint errors |
|
|
207
|
+
| Test enforcement | Runs tests, **blocks** if any test fails | 2 if tests fail |
|
|
208
|
+
| Danger blocker | **Blocks** destructive commands | 2 |
|
|
209
|
+
| Secret detector | **Blocks** secret commits | 2 |
|
|
210
|
+
|
|
211
|
+
### Paranoid Profile
|
|
212
|
+
|
|
213
|
+
Behavior: Everything in Strict, plus additional checks that enforce code structure limits.
|
|
214
|
+
|
|
215
|
+
| Hook | Behavior | Exit Code |
|
|
216
|
+
|------|----------|-----------|
|
|
217
|
+
| All Strict hooks | Same as Strict | Same as Strict |
|
|
218
|
+
| File size guard | **Blocks** writes to files over 400 lines | 2 if file > 400 lines |
|
|
219
|
+
| Function size guard | **Warns** about functions over 50 lines | 0 (notify) |
|
|
220
|
+
| Any type guard | **Blocks** writes that introduce `any` type | 2 if `any` found in written file |
|
|
221
|
+
| Commit completeness | **Blocks** commits if TODO/FIXME found in staged files | 2 if TODO/FIXME found |
|
|
222
|
+
|
|
223
|
+
## 2.3 Implementation
|
|
224
|
+
|
|
225
|
+
### New file: `src/services/strictness.ts`
|
|
226
|
+
|
|
227
|
+
This module MUST export:
|
|
228
|
+
|
|
229
|
+
```typescript
|
|
230
|
+
export type StrictnessProfile = "standard" | "strict" | "paranoid";
|
|
231
|
+
|
|
232
|
+
export interface HookConfig {
|
|
233
|
+
event: string;
|
|
234
|
+
matcher: string;
|
|
235
|
+
command: string;
|
|
236
|
+
description: string;
|
|
237
|
+
}
|
|
238
|
+
|
|
239
|
+
export function getHooksForProfile(
|
|
240
|
+
profile: StrictnessProfile,
|
|
241
|
+
testCommand: string,
|
|
242
|
+
lintCommand: string,
|
|
243
|
+
formatCommand: string
|
|
244
|
+
): HookConfig[];
|
|
245
|
+
```
|
|
246
|
+
|
|
247
|
+
The `getHooksForProfile` function generates the complete set of hooks for the given profile.
|
|
248
|
+
|
|
249
|
+
### Standard profile hooks
|
|
250
|
+
|
|
251
|
+
```typescript
|
|
252
|
+
// Standard hooks — notify only (except danger + secrets which always block)
|
|
253
|
+
const standardHooks: HookConfig[] = [
|
|
254
|
+
// Format on write — always auto-formats, never blocks
|
|
255
|
+
{
|
|
256
|
+
event: "PostToolUse",
|
|
257
|
+
matcher: "Write(*.ts)|Write(*.tsx)|Write(*.js)|Write(*.jsx)",
|
|
258
|
+
command: `${formatCommand} "$CLAUDE_FILE_PATH" 2>/dev/null || true`,
|
|
259
|
+
description: "Auto-format TypeScript/JavaScript files after write"
|
|
260
|
+
},
|
|
261
|
+
// Lint on write — shows output but does not block
|
|
262
|
+
{
|
|
263
|
+
event: "PostToolUse",
|
|
264
|
+
matcher: "Write(*.ts)|Write(*.tsx)|Write(*.js)|Write(*.jsx)",
|
|
265
|
+
command: `${lintCommand} "$CLAUDE_FILE_PATH" 2>&1 | head -20; exit 0`,
|
|
266
|
+
description: "Show lint results after write (non-blocking)"
|
|
267
|
+
},
|
|
268
|
+
// Test enforcement — runs tests, shows results, does not block
|
|
269
|
+
{
|
|
270
|
+
event: "PostToolUse",
|
|
271
|
+
matcher: "Write(*.ts)|Write(*.tsx)|Write(*.js)|Write(*.jsx)|Edit(*.ts)|Edit(*.tsx)|Edit(*.js)|Edit(*.jsx)",
|
|
272
|
+
command: `${testCommand} 2>&1 | tail -10; if [ $? -ne 0 ]; then echo '\\n⚠️ TESTS FAILED — You should fix these before continuing.'; fi; exit 0`,
|
|
273
|
+
description: "Run tests after code changes (non-blocking notification)"
|
|
274
|
+
},
|
|
275
|
+
// Danger blocker — ALWAYS blocks, even in Standard
|
|
276
|
+
{
|
|
277
|
+
event: "PreToolUse",
|
|
278
|
+
matcher: "Bash",
|
|
279
|
+
command: `BLOCKED='rm -rf|rm -fr|git push --force|git push -f|DROP TABLE|DROP DATABASE|TRUNCATE TABLE|chmod -R 777'; if echo "$CLAUDE_BASH_COMMAND" | grep -qiE "$BLOCKED"; then echo 'BLOCKED: Destructive command detected. Ask the developer for explicit approval.' >&2; exit 2; fi; exit 0`,
|
|
280
|
+
description: "Block destructive commands (always active)"
|
|
281
|
+
},
|
|
282
|
+
// Secret detector — ALWAYS blocks, even in Standard
|
|
283
|
+
{
|
|
284
|
+
event: "PreToolUse",
|
|
285
|
+
matcher: "Bash(git commit*)|Bash(git add*)",
|
|
286
|
+
command: `STAGED=$(git diff --cached --name-only 2>/dev/null); if [ -z "$STAGED" ]; then exit 0; fi; SECRETS=$(git diff --cached | grep -inE '(api[_-]?key|secret|password|token|private[_-]?key|aws_access|AKIA[A-Z0-9]{16})\\s*[:=]\\s*[\"\\x27]?[A-Za-z0-9+/=_-]{8,}' | head -5); if [ -n "$SECRETS" ]; then echo "BLOCKED: Potential secrets in staged files:" >&2; echo "$SECRETS" >&2; exit 2; fi; exit 0`,
|
|
287
|
+
description: "Block commits containing potential secrets (always active)"
|
|
288
|
+
}
|
|
289
|
+
];
|
|
290
|
+
```
|
|
291
|
+
|
|
292
|
+
### Strict profile hooks
|
|
293
|
+
|
|
294
|
+
Start with ALL standard hooks, then OVERRIDE the lint and test hooks to use exit code 2:
|
|
295
|
+
|
|
296
|
+
```typescript
|
|
297
|
+
// Override: Lint now blocks
|
|
298
|
+
{
|
|
299
|
+
event: "PostToolUse",
|
|
300
|
+
matcher: "Write(*.ts)|Write(*.tsx)|Write(*.js)|Write(*.jsx)",
|
|
301
|
+
command: `RESULT=$(${lintCommand} "$CLAUDE_FILE_PATH" 2>&1); EXITCODE=$?; if [ $EXITCODE -ne 0 ]; then echo "$RESULT" | head -20; echo '\\n❌ LINT ERRORS — Fix these before continuing.' >&2; exit 2; fi; exit 0`,
|
|
302
|
+
description: "Block on lint errors after write"
|
|
303
|
+
},
|
|
304
|
+
// Override: Tests now block
|
|
305
|
+
{
|
|
306
|
+
event: "PostToolUse",
|
|
307
|
+
matcher: "Write(*.ts)|Write(*.tsx)|Write(*.js)|Write(*.jsx)|Edit(*.ts)|Edit(*.tsx)|Edit(*.js)|Edit(*.jsx)",
|
|
308
|
+
command: `${testCommand} 2>&1 | tail -10; EXIT_CODE=$?; if [ $EXIT_CODE -ne 0 ]; then echo '\\n❌ TESTS FAILED — Fix failing tests before continuing. Do not move to the next task.' >&2; exit 2; fi; exit 0`,
|
|
309
|
+
description: "Block on test failures after code changes"
|
|
310
|
+
}
|
|
311
|
+
```
|
|
312
|
+
|
|
313
|
+
### Paranoid profile hooks
|
|
314
|
+
|
|
315
|
+
Start with ALL strict hooks, then ADD these additional hooks:
|
|
316
|
+
|
|
317
|
+
```typescript
|
|
318
|
+
// File size guard — blocks writes to files over 400 lines
|
|
319
|
+
{
|
|
320
|
+
event: "PostToolUse",
|
|
321
|
+
matcher: "Write(*)|Edit(*)",
|
|
322
|
+
command: `if [ -f "$CLAUDE_FILE_PATH" ]; then LINES=$(wc -l < "$CLAUDE_FILE_PATH"); if [ "$LINES" -gt 400 ]; then echo "BLOCKED: File $CLAUDE_FILE_PATH has $LINES lines (max 400). Split this file into smaller modules." >&2; exit 2; fi; fi; exit 0`,
|
|
323
|
+
description: "Block files exceeding 400 lines"
|
|
324
|
+
},
|
|
325
|
+
// Any type guard — blocks writes that introduce `any` type (TypeScript only)
|
|
326
|
+
{
|
|
327
|
+
event: "PostToolUse",
|
|
328
|
+
matcher: "Write(*.ts)|Write(*.tsx)|Edit(*.ts)|Edit(*.tsx)",
|
|
329
|
+
command: `if [ -f "$CLAUDE_FILE_PATH" ]; then ANY_COUNT=$(grep -cE ':\\s*any\\b|as\\s+any\\b|<any>' "$CLAUDE_FILE_PATH" 2>/dev/null || echo 0); if [ "$ANY_COUNT" -gt 0 ]; then echo "BLOCKED: File $CLAUDE_FILE_PATH contains $ANY_COUNT uses of 'any' type. Use specific types or 'unknown' instead." >&2; exit 2; fi; fi; exit 0`,
|
|
330
|
+
description: "Block TypeScript files containing 'any' type"
|
|
331
|
+
},
|
|
332
|
+
// Commit completeness — blocks commits with TODO/FIXME in staged files
|
|
333
|
+
{
|
|
334
|
+
event: "PreToolUse",
|
|
335
|
+
matcher: "Bash(git commit*)",
|
|
336
|
+
command: `STAGED=$(git diff --cached --name-only 2>/dev/null); TODOS=""; for f in $STAGED; do if [ -f "$f" ]; then FOUND=$(grep -n 'TODO\\|FIXME\\|HACK\\|XXX' "$f" 2>/dev/null | head -3); if [ -n "$FOUND" ]; then TODOS="$TODOS\\n$f:\\n$FOUND"; fi; fi; done; if [ -n "$TODOS" ]; then echo "BLOCKED: Incomplete work found in staged files:" >&2; echo -e "$TODOS" >&2; echo "\\nRemove all TODO/FIXME/HACK/XXX comments before committing." >&2; exit 2; fi; exit 0`,
|
|
337
|
+
description: "Block commits containing TODO/FIXME/HACK/XXX comments"
|
|
338
|
+
}
|
|
339
|
+
```
|
|
340
|
+
|
|
341
|
+
## 2.4 Integration with rebar_init_project
|
|
342
|
+
|
|
343
|
+
Add a `strictness` parameter to `rebar_init_project`:
|
|
344
|
+
|
|
345
|
+
```typescript
|
|
346
|
+
strictness: z.enum(["standard", "strict", "paranoid"])
|
|
347
|
+
.default("standard")
|
|
348
|
+
.describe("Enforcement strictness level. 'standard' notifies on issues, 'strict' blocks on test/lint failures, 'paranoid' adds file size limits, any-type blocking, and commit completeness checks.")
|
|
349
|
+
```
|
|
350
|
+
|
|
351
|
+
When `rebar_init_project` generates `.claude/settings.json`, it calls `getHooksForProfile(strictness, testCommand, lintCommand, formatCommand)` and merges the result into the hooks configuration.
|
|
352
|
+
|
|
353
|
+
## 2.5 New tool: `rebar_set_strictness`
|
|
354
|
+
|
|
355
|
+
Register a new tool that changes the strictness profile for an existing project:
|
|
356
|
+
|
|
357
|
+
```typescript
|
|
358
|
+
server.registerTool(
|
|
359
|
+
"rebar_set_strictness",
|
|
360
|
+
{
|
|
361
|
+
title: "Set Rebar Strictness Profile",
|
|
362
|
+
description: "[Rebar] Changes the enforcement strictness level for the current project. Rewrites the hooks in .claude/settings.json to match the selected profile. Options: 'standard' (notify only), 'strict' (blocks on test/lint failures), 'paranoid' (strict + file size limits, any-type blocking, commit completeness checks).",
|
|
363
|
+
inputSchema: {
|
|
364
|
+
project_path: z.string().describe("Path to the project root"),
|
|
365
|
+
strictness: z.enum(["standard", "strict", "paranoid"]).describe("Desired strictness level"),
|
|
366
|
+
output_format: z.enum(["markdown", "json"]).default("markdown")
|
|
367
|
+
},
|
|
368
|
+
annotations: {
|
|
369
|
+
readOnlyHint: false,
|
|
370
|
+
destructiveHint: false,
|
|
371
|
+
idempotentHint: true,
|
|
372
|
+
openWorldHint: false
|
|
373
|
+
}
|
|
374
|
+
},
|
|
375
|
+
async (params) => {
|
|
376
|
+
// 1. Read existing .claude/settings.json
|
|
377
|
+
// 2. Remove all Rebar-generated hooks (identified by description starting with "Auto-format", "Show lint", "Run tests", "Block destructive", "Block commits", "Block files", "Block TypeScript")
|
|
378
|
+
// 3. Generate new hooks from getHooksForProfile()
|
|
379
|
+
// 4. Merge into settings.json
|
|
380
|
+
// 5. Write atomically
|
|
381
|
+
// 6. Return summary of what changed
|
|
382
|
+
}
|
|
383
|
+
);
|
|
384
|
+
```
|
|
385
|
+
|
|
386
|
+
## 2.6 Verification
|
|
387
|
+
|
|
388
|
+
1. `rebar_init_project` with `strictness: "standard"` generates hooks where only danger-blocker and secret-detector use exit 2
|
|
389
|
+
2. `rebar_init_project` with `strictness: "strict"` generates hooks where test and lint hooks also use exit 2
|
|
390
|
+
3. `rebar_init_project` with `strictness: "paranoid"` generates all of strict plus file size, any-type, and TODO guards
|
|
391
|
+
4. `rebar_set_strictness` can switch between profiles without duplicating hooks
|
|
392
|
+
5. All hook commands are syntactically valid bash (test by running them against sample input)
|
|
393
|
+
|
|
394
|
+
---
|
|
395
|
+
|
|
396
|
+
# SECTION 3: MULTI-PLATFORM TEMPLATE GENERATION
|
|
397
|
+
|
|
398
|
+
## 3.1 Overview
|
|
399
|
+
|
|
400
|
+
Rebar currently generates configuration files for Claude Code only. v2.0.0 adds support for Cursor, Windsurf, and Codex CLI. When `rebar_init_project` runs, it generates config files for ALL detected or specified platforms.
|
|
401
|
+
|
|
402
|
+
## 3.2 Platform Detection
|
|
403
|
+
|
|
404
|
+
Add to `src/services/platform-detect.ts`:
|
|
405
|
+
|
|
406
|
+
```typescript
|
|
407
|
+
export type AIPlatform = "claude-code" | "cursor" | "windsurf" | "codex";
|
|
408
|
+
|
|
409
|
+
export interface DetectedPlatforms {
|
|
410
|
+
platforms: AIPlatform[];
|
|
411
|
+
evidence: Record<AIPlatform, string>;
|
|
412
|
+
}
|
|
413
|
+
|
|
414
|
+
export async function detectPlatforms(projectPath: string): Promise<DetectedPlatforms> {
|
|
415
|
+
const platforms: AIPlatform[] = [];
|
|
416
|
+
const evidence: Record<string, string> = {};
|
|
417
|
+
|
|
418
|
+
// Claude Code: .claude/ directory or CLAUDE.md exists
|
|
419
|
+
if (await fileExists(join(projectPath, ".claude")) || await fileExists(join(projectPath, "CLAUDE.md"))) {
|
|
420
|
+
platforms.push("claude-code");
|
|
421
|
+
evidence["claude-code"] = "Found .claude/ directory or CLAUDE.md";
|
|
422
|
+
}
|
|
423
|
+
|
|
424
|
+
// Cursor: .cursor/ directory or .cursorrules exists
|
|
425
|
+
if (await fileExists(join(projectPath, ".cursor")) || await fileExists(join(projectPath, ".cursorrules"))) {
|
|
426
|
+
platforms.push("cursor");
|
|
427
|
+
evidence["cursor"] = "Found .cursor/ directory or .cursorrules";
|
|
428
|
+
}
|
|
429
|
+
|
|
430
|
+
// Windsurf: .windsurf/ directory exists
|
|
431
|
+
if (await fileExists(join(projectPath, ".windsurf"))) {
|
|
432
|
+
platforms.push("windsurf");
|
|
433
|
+
evidence["windsurf"] = "Found .windsurf/ directory";
|
|
434
|
+
}
|
|
435
|
+
|
|
436
|
+
// Codex: AGENTS.md exists
|
|
437
|
+
if (await fileExists(join(projectPath, "AGENTS.md"))) {
|
|
438
|
+
platforms.push("codex");
|
|
439
|
+
evidence["codex"] = "Found AGENTS.md";
|
|
440
|
+
}
|
|
441
|
+
|
|
442
|
+
// If nothing detected, default to Claude Code (since we're an MCP server running in it)
|
|
443
|
+
if (platforms.length === 0) {
|
|
444
|
+
platforms.push("claude-code");
|
|
445
|
+
evidence["claude-code"] = "Default (no platform detected)";
|
|
446
|
+
}
|
|
447
|
+
|
|
448
|
+
return { platforms, evidence };
|
|
449
|
+
}
|
|
450
|
+
```
|
|
451
|
+
|
|
452
|
+
## 3.3 Add `platforms` parameter to `rebar_init_project`
|
|
453
|
+
|
|
454
|
+
```typescript
|
|
455
|
+
platforms: z.array(z.enum(["claude-code", "cursor", "windsurf", "codex", "all"]))
|
|
456
|
+
.default(["all"])
|
|
457
|
+
.describe("Which AI coding platforms to generate configuration for. 'all' detects and generates for every supported platform.")
|
|
458
|
+
```
|
|
459
|
+
|
|
460
|
+
When `"all"` is specified (the default), call `detectPlatforms()` and generate for detected platforms. If none detected, generate for ALL platforms.
|
|
461
|
+
|
|
462
|
+
## 3.4 Cursor Configuration Generation
|
|
463
|
+
|
|
464
|
+
Cursor uses `.cursor/rules/*.md` files (called "rules") that are functionally equivalent to Claude Code's skills.
|
|
465
|
+
|
|
466
|
+
### Directory structure
|
|
467
|
+
|
|
468
|
+
```
|
|
469
|
+
.cursor/
|
|
470
|
+
└── rules/
|
|
471
|
+
├── project-rules.md (equivalent to CLAUDE.md)
|
|
472
|
+
├── code-review.md (equivalent to code-review skill)
|
|
473
|
+
├── test-writer.md (equivalent to test-writer skill)
|
|
474
|
+
├── security-scan.md (equivalent to security-scan skill)
|
|
475
|
+
└── documentation.md (equivalent to documentation skill)
|
|
476
|
+
```
|
|
477
|
+
|
|
478
|
+
### project-rules.md format
|
|
479
|
+
|
|
480
|
+
Cursor rules files use YAML frontmatter with a different schema than Claude Code skills. The format is:
|
|
481
|
+
|
|
482
|
+
```markdown
|
|
483
|
+
---
|
|
484
|
+
description: Project rules and coding standards for {{project_name}}
|
|
485
|
+
globs:
|
|
486
|
+
alwaysApply: true
|
|
487
|
+
---
|
|
488
|
+
|
|
489
|
+
[Content goes here — use the same Mandatory Practices and Self-Review Checklist from the CLAUDE.md template]
|
|
490
|
+
```
|
|
491
|
+
|
|
492
|
+
### Conversion logic
|
|
493
|
+
|
|
494
|
+
Create `src/services/cursor-generator.ts`:
|
|
495
|
+
|
|
496
|
+
```typescript
|
|
497
|
+
export async function generateCursorConfig(
|
|
498
|
+
projectPath: string,
|
|
499
|
+
claudeMdContent: string,
|
|
500
|
+
skills: SkillTemplate[]
|
|
501
|
+
): Promise<GeneratedFile[]>
|
|
502
|
+
```
|
|
503
|
+
|
|
504
|
+
This function:
|
|
505
|
+
1. Takes the rendered CLAUDE.md content and converts it to a Cursor rules file at `.cursor/rules/project-rules.md`
|
|
506
|
+
2. Converts each skill template to a Cursor rule file
|
|
507
|
+
3. Cursor rules use `description` (not `name`) and `globs` (not `allowed-tools`) in frontmatter
|
|
508
|
+
4. Cursor does NOT support hooks — add a NOTE in the project-rules.md that says:
|
|
509
|
+
|
|
510
|
+
```markdown
|
|
511
|
+
> Note: Cursor does not support enforcement hooks. The guardrails below rely on
|
|
512
|
+
> you following these rules. For automated enforcement, use Rebar with Claude Code
|
|
513
|
+
> or run `npx rebar audit` in your CI pipeline.
|
|
514
|
+
```
|
|
515
|
+
|
|
516
|
+
## 3.5 Windsurf Configuration Generation
|
|
517
|
+
|
|
518
|
+
Windsurf uses `.windsurf/rules/*.md` files.
|
|
519
|
+
|
|
520
|
+
### Directory structure
|
|
521
|
+
|
|
522
|
+
```
|
|
523
|
+
.windsurf/
|
|
524
|
+
└── rules/
|
|
525
|
+
├── project-rules.md
|
|
526
|
+
├── code-review.md
|
|
527
|
+
├── test-writer.md
|
|
528
|
+
├── security-scan.md
|
|
529
|
+
└── documentation.md
|
|
530
|
+
```
|
|
531
|
+
|
|
532
|
+
### Format
|
|
533
|
+
|
|
534
|
+
Windsurf rules use a simpler frontmatter:
|
|
535
|
+
|
|
536
|
+
```markdown
|
|
537
|
+
---
|
|
538
|
+
trigger: always
|
|
539
|
+
---
|
|
540
|
+
|
|
541
|
+
[Content — same as Cursor rules]
|
|
542
|
+
```
|
|
543
|
+
|
|
544
|
+
Create `src/services/windsurf-generator.ts` following the same pattern as cursor-generator.ts.
|
|
545
|
+
|
|
546
|
+
## 3.6 Codex CLI Configuration Generation
|
|
547
|
+
|
|
548
|
+
OpenAI's Codex CLI uses an `AGENTS.md` file at the project root (equivalent to CLAUDE.md).
|
|
549
|
+
|
|
550
|
+
### File: `AGENTS.md`
|
|
551
|
+
|
|
552
|
+
Create `src/services/codex-generator.ts`:
|
|
553
|
+
|
|
554
|
+
```typescript
|
|
555
|
+
export async function generateCodexConfig(
|
|
556
|
+
projectPath: string,
|
|
557
|
+
claudeMdContent: string
|
|
558
|
+
): Promise<GeneratedFile[]>
|
|
559
|
+
```
|
|
560
|
+
|
|
561
|
+
This function:
|
|
562
|
+
1. Takes the rendered CLAUDE.md content
|
|
563
|
+
2. Writes it to `AGENTS.md` at the project root
|
|
564
|
+
3. Adds a Codex-specific header:
|
|
565
|
+
|
|
566
|
+
```markdown
|
|
567
|
+
# {{project_name}} — Agent Instructions
|
|
568
|
+
|
|
569
|
+
> Generated by Rebar (https://github.com/RCOLKITT/rebar-mcp)
|
|
570
|
+
> These rules apply to all AI coding agents working in this repository.
|
|
571
|
+
|
|
572
|
+
[Rest of CLAUDE.md content]
|
|
573
|
+
```
|
|
574
|
+
|
|
575
|
+
Codex does NOT support skills, agents, or hooks. The AGENTS.md file is the only configuration point.
|
|
576
|
+
|
|
577
|
+
## 3.7 Updated rebar_init_project Output
|
|
578
|
+
|
|
579
|
+
When `rebar_init_project` completes with multi-platform generation, the output MUST list what was created per platform:
|
|
580
|
+
|
|
581
|
+
```markdown
|
|
582
|
+
## Rebar Project Initialized
|
|
583
|
+
|
|
584
|
+
### Claude Code
|
|
585
|
+
- ✅ CLAUDE.md (Mandatory Practices + Self-Review Checklist)
|
|
586
|
+
- ✅ .claude/settings.json (5 enforcement hooks, strictness: standard)
|
|
587
|
+
- ✅ .claude/skills/ (5 skills: code-review, test-writer, security-scan, documentation, performance-audit)
|
|
588
|
+
- ✅ .claude/agents/ (4 agents: explore, plan, test-runner, security-auditor)
|
|
589
|
+
- ✅ .claudeignore
|
|
590
|
+
|
|
591
|
+
### Cursor
|
|
592
|
+
- ✅ .cursor/rules/project-rules.md
|
|
593
|
+
- ✅ .cursor/rules/code-review.md
|
|
594
|
+
- ✅ .cursor/rules/test-writer.md
|
|
595
|
+
- ✅ .cursor/rules/security-scan.md
|
|
596
|
+
- ✅ .cursor/rules/documentation.md
|
|
597
|
+
|
|
598
|
+
### Windsurf
|
|
599
|
+
- ✅ .windsurf/rules/project-rules.md
|
|
600
|
+
- ✅ .windsurf/rules/code-review.md
|
|
601
|
+
- ✅ .windsurf/rules/test-writer.md
|
|
602
|
+
- ✅ .windsurf/rules/security-scan.md
|
|
603
|
+
- ✅ .windsurf/rules/documentation.md
|
|
604
|
+
|
|
605
|
+
### Codex CLI
|
|
606
|
+
- ✅ AGENTS.md
|
|
607
|
+
|
|
608
|
+
### Quality Audit
|
|
609
|
+
- Score: XX/100
|
|
610
|
+
- Issues found: X (X critical, X high, X medium, X low)
|
|
611
|
+
```
|
|
612
|
+
|
|
613
|
+
## 3.8 Verification
|
|
614
|
+
|
|
615
|
+
1. `rebar_init_project` with `platforms: ["all"]` generates files for all 4 platforms
|
|
616
|
+
2. `.cursor/rules/project-rules.md` contains valid Cursor frontmatter with `alwaysApply: true`
|
|
617
|
+
3. `.windsurf/rules/project-rules.md` contains valid Windsurf frontmatter with `trigger: always`
|
|
618
|
+
4. `AGENTS.md` exists and contains the full mandatory practices section
|
|
619
|
+
5. All generated files contain the Mandatory Practices section verbatim
|
|
620
|
+
6. No `{{variable}}` markers remain in any generated file
|
|
621
|
+
|
|
622
|
+
---
|
|
623
|
+
|
|
624
|
+
# SECTION 4: `rebar doctor` COMMAND
|
|
625
|
+
|
|
626
|
+
## 4.1 Overview
|
|
627
|
+
|
|
628
|
+
`rebar doctor` is a diagnostic tool that checks the health of a project's Rebar setup. It verifies that all enforcement mechanisms are properly installed and configured.
|
|
629
|
+
|
|
630
|
+
## 4.2 Tool Registration
|
|
631
|
+
|
|
632
|
+
```typescript
|
|
633
|
+
server.registerTool(
|
|
634
|
+
"rebar_doctor",
|
|
635
|
+
{
|
|
636
|
+
title: "Rebar Doctor — Diagnose Setup Health",
|
|
637
|
+
description: "[Rebar] Checks the health of your Rebar enforcement setup. Verifies hooks are installed, templates are complete, skills are present, CLAUDE.md has mandatory sections, and there are no configuration conflicts. Run this when enforcement doesn't seem to be working.",
|
|
638
|
+
inputSchema: {
|
|
639
|
+
project_path: z.string().describe("Path to the project root"),
|
|
640
|
+
output_format: z.enum(["markdown", "json"]).default("markdown"),
|
|
641
|
+
},
|
|
642
|
+
annotations: {
|
|
643
|
+
readOnlyHint: true,
|
|
644
|
+
destructiveHint: false,
|
|
645
|
+
idempotentHint: true,
|
|
646
|
+
openWorldHint: false
|
|
647
|
+
}
|
|
648
|
+
},
|
|
649
|
+
async (params) => { /* implementation */ }
|
|
650
|
+
);
|
|
651
|
+
```
|
|
652
|
+
|
|
653
|
+
## 4.3 Health Checks
|
|
654
|
+
|
|
655
|
+
The doctor MUST perform ALL of the following checks. Each check returns PASS, WARN, or FAIL.
|
|
656
|
+
|
|
657
|
+
### Check 1: CLAUDE.md Exists and Has Mandatory Sections
|
|
658
|
+
|
|
659
|
+
- PASS: CLAUDE.md exists at project root AND contains "Mandatory Practices" heading AND contains "Self-Review Checklist" heading
|
|
660
|
+
- WARN: CLAUDE.md exists but is missing one or both sections
|
|
661
|
+
- FAIL: CLAUDE.md does not exist
|
|
662
|
+
|
|
663
|
+
### Check 2: Enforcement Hooks Installed
|
|
664
|
+
|
|
665
|
+
- PASS: `.claude/settings.json` exists AND contains at least the danger-blocker and secret-detector hooks
|
|
666
|
+
- WARN: Settings file exists but is missing some hooks
|
|
667
|
+
- FAIL: Settings file does not exist or has no hooks
|
|
668
|
+
|
|
669
|
+
### Check 3: Skills Installed
|
|
670
|
+
|
|
671
|
+
- PASS: `.claude/skills/` contains at least 3 skill directories with valid SKILL.md files
|
|
672
|
+
- WARN: Skills directory exists but has fewer than 3 skills, or some SKILL.md files have invalid frontmatter
|
|
673
|
+
- FAIL: No `.claude/skills/` directory
|
|
674
|
+
|
|
675
|
+
### Check 4: Agents Installed
|
|
676
|
+
|
|
677
|
+
- PASS: `.claude/agents/` contains at least 2 agent files
|
|
678
|
+
- WARN: Agents directory exists but has fewer than 2 agents
|
|
679
|
+
- FAIL: No `.claude/agents/` directory
|
|
680
|
+
|
|
681
|
+
### Check 5: .claudeignore Exists
|
|
682
|
+
|
|
683
|
+
- PASS: `.claudeignore` exists and includes at least `node_modules/` and `dist/`
|
|
684
|
+
- WARN: `.claudeignore` exists but is empty or missing common exclusions
|
|
685
|
+
- FAIL: `.claudeignore` does not exist
|
|
686
|
+
|
|
687
|
+
### Check 6: Test Command Works
|
|
688
|
+
|
|
689
|
+
- PASS: The test command from CLAUDE.md (or detected from package.json scripts.test) executes successfully
|
|
690
|
+
- WARN: Test command found but returns non-zero exit code (tests failing is not a setup issue, but worth noting)
|
|
691
|
+
- FAIL: No test command found in package.json or CLAUDE.md
|
|
692
|
+
|
|
693
|
+
### Check 7: Strictness Profile Consistency
|
|
694
|
+
|
|
695
|
+
- PASS: All hooks in settings.json are consistent with a single strictness profile
|
|
696
|
+
- WARN: Hooks appear to be a mix of different profiles (some notify, some block inconsistently)
|
|
697
|
+
- FAIL: N/A (this check only produces PASS or WARN)
|
|
698
|
+
|
|
699
|
+
### Check 8: Context Budget
|
|
700
|
+
|
|
701
|
+
- PASS: Total estimated token count of all skills + CLAUDE.md is under 2% of 200K context window (4,000 tokens)
|
|
702
|
+
- WARN: Total is between 2% and 5% (some skills may not load)
|
|
703
|
+
- FAIL: Total exceeds 5% (skills will definitely be dropped)
|
|
704
|
+
|
|
705
|
+
### Check 9: Cross-Platform Config Consistency
|
|
706
|
+
|
|
707
|
+
- PASS: If multiple platform configs exist (CLAUDE.md + .cursor/rules + AGENTS.md), they all contain the same mandatory practices
|
|
708
|
+
- WARN: Platform configs exist but have divergent content
|
|
709
|
+
- FAIL: N/A (only WARN or PASS)
|
|
710
|
+
|
|
711
|
+
### Check 10: No Configuration Conflicts
|
|
712
|
+
|
|
713
|
+
- PASS: No duplicate hook definitions, no conflicting tool permissions
|
|
714
|
+
- WARN: Duplicate hooks found (same event + matcher appearing twice)
|
|
715
|
+
- FAIL: Settings.json is invalid JSON
|
|
716
|
+
|
|
717
|
+
## 4.4 Output Format
|
|
718
|
+
|
|
719
|
+
```markdown
|
|
720
|
+
## 🔧 Rebar Doctor Report
|
|
721
|
+
|
|
722
|
+
**Project:** /path/to/project
|
|
723
|
+
**Overall Health:** ✅ Healthy | ⚠️ Needs Attention | ❌ Broken
|
|
724
|
+
|
|
725
|
+
### Results
|
|
726
|
+
|
|
727
|
+
| # | Check | Status | Detail |
|
|
728
|
+
|---|-------|--------|--------|
|
|
729
|
+
| 1 | CLAUDE.md | ✅ PASS | Found with Mandatory Practices + Self-Review Checklist |
|
|
730
|
+
| 2 | Enforcement hooks | ✅ PASS | 9 hooks installed (strictness: strict) |
|
|
731
|
+
| 3 | Skills | ✅ PASS | 5 skills with valid frontmatter |
|
|
732
|
+
| 4 | Agents | ✅ PASS | 4 agents configured |
|
|
733
|
+
| 5 | .claudeignore | ✅ PASS | Excludes node_modules/, dist/, .git/ |
|
|
734
|
+
| 6 | Test command | ⚠️ WARN | `npm test` found but 2 tests failing |
|
|
735
|
+
| 7 | Strictness consistency | ✅ PASS | All hooks match "strict" profile |
|
|
736
|
+
| 8 | Context budget | ✅ PASS | Estimated 2,847 tokens (1.4% of budget) |
|
|
737
|
+
| 9 | Cross-platform consistency | ✅ PASS | CLAUDE.md and .cursor/rules aligned |
|
|
738
|
+
| 10 | No conflicts | ✅ PASS | No duplicate hooks or conflicts found |
|
|
739
|
+
|
|
740
|
+
### Summary
|
|
741
|
+
✅ 9 passed, ⚠️ 1 warning, ❌ 0 failed
|
|
742
|
+
|
|
743
|
+
### Recommendations
|
|
744
|
+
- Fix the 2 failing tests to get a clean test suite
|
|
745
|
+
```
|
|
746
|
+
|
|
747
|
+
Overall health:
|
|
748
|
+
- **Healthy**: Zero FAIL, at most 2 WARN
|
|
749
|
+
- **Needs Attention**: Zero FAIL, 3+ WARN
|
|
750
|
+
- **Broken**: Any FAIL
|
|
751
|
+
|
|
752
|
+
---
|
|
753
|
+
|
|
754
|
+
# SECTION 5: STANDALONE CLI MODE
|
|
755
|
+
|
|
756
|
+
## 5.1 Overview
|
|
757
|
+
|
|
758
|
+
Rebar currently only runs as an MCP server (stdio transport). v2.0.0 adds a standalone CLI mode so `rebar` can be used directly in terminals and CI/CD pipelines without an MCP client.
|
|
759
|
+
|
|
760
|
+
## 5.2 Entry Point Changes
|
|
761
|
+
|
|
762
|
+
Update `src/index.ts` to detect whether it's being invoked as an MCP server or a CLI:
|
|
763
|
+
|
|
764
|
+
```typescript
|
|
765
|
+
#!/usr/bin/env node
|
|
766
|
+
|
|
767
|
+
const args = process.argv.slice(2);
|
|
768
|
+
|
|
769
|
+
if (args.length > 0 && !args.includes("--mcp")) {
|
|
770
|
+
// CLI mode
|
|
771
|
+
await runCLI(args);
|
|
772
|
+
} else {
|
|
773
|
+
// MCP server mode (default when no args or --mcp flag)
|
|
774
|
+
await runMCPServer();
|
|
775
|
+
}
|
|
776
|
+
```
|
|
777
|
+
|
|
778
|
+
## 5.3 CLI Commands
|
|
779
|
+
|
|
780
|
+
### `rebar init`
|
|
781
|
+
|
|
782
|
+
```bash
|
|
783
|
+
rebar init [--path .] [--stack auto] [--strictness standard] [--platforms all]
|
|
784
|
+
```
|
|
785
|
+
|
|
786
|
+
Calls `rebar_init_project` with the given options. Outputs to stdout.
|
|
787
|
+
|
|
788
|
+
### `rebar audit`
|
|
789
|
+
|
|
790
|
+
```bash
|
|
791
|
+
rebar audit [--path .] [--format markdown|json] [--threshold 70]
|
|
792
|
+
```
|
|
793
|
+
|
|
794
|
+
Calls `rebar_audit` (formerly `rebar_audit_code_quality`). When `--threshold` is provided, exits with code 1 if the quality score is below the threshold. This is the key CI/CD integration point.
|
|
795
|
+
|
|
796
|
+
### `rebar doctor`
|
|
797
|
+
|
|
798
|
+
```bash
|
|
799
|
+
rebar doctor [--path .]
|
|
800
|
+
```
|
|
801
|
+
|
|
802
|
+
Calls `rebar_doctor`. Exits with code 1 if any check FAILs.
|
|
803
|
+
|
|
804
|
+
### `rebar set-strictness`
|
|
805
|
+
|
|
806
|
+
```bash
|
|
807
|
+
rebar set-strictness <standard|strict|paranoid> [--path .]
|
|
808
|
+
```
|
|
809
|
+
|
|
810
|
+
Calls `rebar_set_strictness`.
|
|
811
|
+
|
|
812
|
+
### `rebar version`
|
|
813
|
+
|
|
814
|
+
```bash
|
|
815
|
+
rebar version
|
|
816
|
+
```
|
|
817
|
+
|
|
818
|
+
Prints `rebar-mcp v2.0.0`.
|
|
819
|
+
|
|
820
|
+
### `rebar help`
|
|
821
|
+
|
|
822
|
+
```bash
|
|
823
|
+
rebar help
|
|
824
|
+
```
|
|
825
|
+
|
|
826
|
+
Prints:
|
|
827
|
+
|
|
828
|
+
```
|
|
829
|
+
Rebar — Reinforcement for AI-generated code
|
|
830
|
+
|
|
831
|
+
Usage:
|
|
832
|
+
rebar init [options] Initialize Rebar enforcement in a project
|
|
833
|
+
rebar audit [options] Scan code for quality issues
|
|
834
|
+
rebar doctor [options] Check Rebar setup health
|
|
835
|
+
rebar set-strictness <level> Change enforcement strictness
|
|
836
|
+
rebar version Print version
|
|
837
|
+
rebar help Show this help
|
|
838
|
+
|
|
839
|
+
Options:
|
|
840
|
+
--path <dir> Project path (default: current directory)
|
|
841
|
+
--strictness <level> standard | strict | paranoid (default: standard)
|
|
842
|
+
--platforms <list> claude-code,cursor,windsurf,codex,all (default: all)
|
|
843
|
+
--format <type> markdown | json (default: markdown)
|
|
844
|
+
--threshold <score> Minimum quality score for audit (exits 1 if below)
|
|
845
|
+
--mcp Run as MCP server (default when no command given)
|
|
846
|
+
|
|
847
|
+
Examples:
|
|
848
|
+
rebar init --strictness strict --platforms all
|
|
849
|
+
rebar audit --threshold 80 --format json
|
|
850
|
+
rebar doctor
|
|
851
|
+
npx rebar-mcp audit --threshold 70 # CI/CD usage
|
|
852
|
+
```
|
|
853
|
+
|
|
854
|
+
## 5.4 Implementation
|
|
855
|
+
|
|
856
|
+
Create `src/cli.ts`:
|
|
857
|
+
|
|
858
|
+
```typescript
|
|
859
|
+
import { parseArgs } from "node:util";
|
|
860
|
+
|
|
861
|
+
export async function runCLI(args: string[]): Promise<void> {
|
|
862
|
+
const command = args[0];
|
|
863
|
+
|
|
864
|
+
switch (command) {
|
|
865
|
+
case "init":
|
|
866
|
+
await handleInit(args.slice(1));
|
|
867
|
+
break;
|
|
868
|
+
case "audit":
|
|
869
|
+
await handleAudit(args.slice(1));
|
|
870
|
+
break;
|
|
871
|
+
case "doctor":
|
|
872
|
+
await handleDoctor(args.slice(1));
|
|
873
|
+
break;
|
|
874
|
+
case "set-strictness":
|
|
875
|
+
await handleSetStrictness(args.slice(1));
|
|
876
|
+
break;
|
|
877
|
+
case "version":
|
|
878
|
+
console.log("rebar-mcp v2.0.0");
|
|
879
|
+
break;
|
|
880
|
+
case "help":
|
|
881
|
+
case "--help":
|
|
882
|
+
case "-h":
|
|
883
|
+
printHelp();
|
|
884
|
+
break;
|
|
885
|
+
default:
|
|
886
|
+
console.error(`Unknown command: ${command}`);
|
|
887
|
+
printHelp();
|
|
888
|
+
process.exit(1);
|
|
889
|
+
}
|
|
890
|
+
}
|
|
891
|
+
```
|
|
892
|
+
|
|
893
|
+
Each handler function:
|
|
894
|
+
1. Parses CLI flags using `node:util`'s `parseArgs`
|
|
895
|
+
2. Calls the SAME implementation function that the MCP tool handler calls (DRY — do not duplicate logic)
|
|
896
|
+
3. Formats the output for terminal display (use the markdown output format)
|
|
897
|
+
4. Sets the process exit code appropriately
|
|
898
|
+
|
|
899
|
+
CRITICAL: The CLI handlers and MCP tool handlers MUST share the same core logic. Create shared implementation functions in `src/services/` that both the CLI and MCP handlers call. Do NOT copy-paste implementation between cli.ts and the tool handlers.
|
|
900
|
+
|
|
901
|
+
## 5.5 CI/CD Integration Example
|
|
902
|
+
|
|
903
|
+
The README must include this CI/CD example:
|
|
904
|
+
|
|
905
|
+
```yaml
|
|
906
|
+
# .github/workflows/rebar-audit.yml
|
|
907
|
+
name: Rebar Code Quality
|
|
908
|
+
on: [pull_request]
|
|
909
|
+
|
|
910
|
+
jobs:
|
|
911
|
+
quality:
|
|
912
|
+
runs-on: ubuntu-latest
|
|
913
|
+
steps:
|
|
914
|
+
- uses: actions/checkout@v4
|
|
915
|
+
- uses: actions/setup-node@v4
|
|
916
|
+
with:
|
|
917
|
+
node-version: '20'
|
|
918
|
+
- run: npm ci
|
|
919
|
+
- run: npx rebar-mcp audit --threshold 70 --format json
|
|
920
|
+
```
|
|
921
|
+
|
|
922
|
+
## 5.6 Verification
|
|
923
|
+
|
|
924
|
+
1. `node dist/index.js help` prints the help text
|
|
925
|
+
2. `node dist/index.js version` prints `rebar-mcp v2.0.0`
|
|
926
|
+
3. `node dist/index.js audit --path . --format json` returns valid JSON with quality score
|
|
927
|
+
4. `node dist/index.js audit --path . --threshold 999` exits with code 1 (no project has score 999)
|
|
928
|
+
5. `node dist/index.js doctor --path .` runs all 10 health checks
|
|
929
|
+
6. `node dist/index.js` (no args) starts the MCP server via stdio
|
|
930
|
+
7. `node dist/index.js --mcp` starts the MCP server via stdio
|
|
931
|
+
|
|
932
|
+
---
|
|
933
|
+
|
|
934
|
+
# SECTION 6: ENHANCED METRICS DASHBOARD
|
|
935
|
+
|
|
936
|
+
## 6.1 Overview
|
|
937
|
+
|
|
938
|
+
The existing public metrics page gets enhanced with quality score tracking over time, trend visualization, and a summary card that engineering leads can screenshot for status reports.
|
|
939
|
+
|
|
940
|
+
## 6.2 Data Storage
|
|
941
|
+
|
|
942
|
+
Create `src/services/metrics-store.ts`:
|
|
943
|
+
|
|
944
|
+
Quality score history is stored in a JSON file at `.rebar/metrics.json` in the project directory:
|
|
945
|
+
|
|
946
|
+
```typescript
|
|
947
|
+
export interface MetricsSnapshot {
|
|
948
|
+
timestamp: string; // ISO 8601
|
|
949
|
+
score: number; // 0-100
|
|
950
|
+
issues: {
|
|
951
|
+
critical: number;
|
|
952
|
+
high: number;
|
|
953
|
+
medium: number;
|
|
954
|
+
low: number;
|
|
955
|
+
};
|
|
956
|
+
checks: Record<string, number>; // count per check category
|
|
957
|
+
files_scanned: number;
|
|
958
|
+
}
|
|
959
|
+
|
|
960
|
+
export interface MetricsStore {
|
|
961
|
+
project_name: string;
|
|
962
|
+
created_at: string;
|
|
963
|
+
snapshots: MetricsSnapshot[];
|
|
964
|
+
}
|
|
965
|
+
```
|
|
966
|
+
|
|
967
|
+
### Automatic snapshot capture
|
|
968
|
+
|
|
969
|
+
Every time `rebar_audit` (or `rebar audit` CLI) runs, it automatically appends a snapshot to `.rebar/metrics.json`. This happens transparently — the user does not need to opt in.
|
|
970
|
+
|
|
971
|
+
### Snapshot retention
|
|
972
|
+
|
|
973
|
+
Keep the last 100 snapshots. When adding snapshot 101, drop the oldest.
|
|
974
|
+
|
|
975
|
+
## 6.3 New tool: `rebar_metrics`
|
|
976
|
+
|
|
977
|
+
```typescript
|
|
978
|
+
server.registerTool(
|
|
979
|
+
"rebar_metrics",
|
|
980
|
+
{
|
|
981
|
+
title: "Rebar Metrics — Quality Score History",
|
|
982
|
+
description: "[Rebar] Shows quality score history, trends, and improvement rate. Generates a metrics summary card with score over time. Use to track code quality progress.",
|
|
983
|
+
inputSchema: {
|
|
984
|
+
project_path: z.string().describe("Path to the project root"),
|
|
985
|
+
period: z.enum(["7d", "30d", "90d", "all"]).default("30d").describe("Time period for metrics"),
|
|
986
|
+
output_format: z.enum(["markdown", "json"]).default("markdown"),
|
|
987
|
+
},
|
|
988
|
+
annotations: {
|
|
989
|
+
readOnlyHint: true,
|
|
990
|
+
destructiveHint: false,
|
|
991
|
+
idempotentHint: true,
|
|
992
|
+
openWorldHint: false
|
|
993
|
+
}
|
|
994
|
+
},
|
|
995
|
+
// handler
|
|
996
|
+
);
|
|
997
|
+
```
|
|
998
|
+
|
|
999
|
+
### Markdown output format
|
|
1000
|
+
|
|
1001
|
+
```markdown
|
|
1002
|
+
## 📊 Rebar Quality Metrics
|
|
1003
|
+
|
|
1004
|
+
**Project:** {{project_name}}
|
|
1005
|
+
**Period:** Last 30 days
|
|
1006
|
+
**Current Score:** 85/100 ↑ (+12 from 30 days ago)
|
|
1007
|
+
|
|
1008
|
+
### Score Trend
|
|
1009
|
+
```
|
|
1010
|
+
100 |
|
|
1011
|
+
90 | ● ● ● ●
|
|
1012
|
+
80 | ● ●
|
|
1013
|
+
70 | ●
|
|
1014
|
+
60 |●
|
|
1015
|
+
+--+--+--+--+--+--+--→ time
|
|
1016
|
+
Mar 1 Mar 15
|
|
1017
|
+
```
|
|
1018
|
+
|
|
1019
|
+
### Issue Trend
|
|
1020
|
+
| Category | 30 days ago | Now | Change |
|
|
1021
|
+
|----------|-------------|-----|--------|
|
|
1022
|
+
| Critical | 2 | 0 | ✅ -2 |
|
|
1023
|
+
| High | 8 | 3 | ✅ -5 |
|
|
1024
|
+
| Medium | 15 | 9 | ✅ -6 |
|
|
1025
|
+
| Low | 12 | 11 | ↔ -1 |
|
|
1026
|
+
|
|
1027
|
+
### Summary
|
|
1028
|
+
- **Highest score:** 88 (March 14)
|
|
1029
|
+
- **Lowest score:** 61 (March 1)
|
|
1030
|
+
- **Average score:** 79
|
|
1031
|
+
- **Improvement rate:** +0.4 points/day
|
|
1032
|
+
- **Audits run:** 23 in this period
|
|
1033
|
+
```
|
|
1034
|
+
|
|
1035
|
+
The ASCII chart is a simple visualization. Use the actual score values to plot points. Use `●` for data points and `|` / `+` / `→` for axes. The chart should have 7–10 data points max (aggregate if more snapshots exist in the period).
|
|
1036
|
+
|
|
1037
|
+
## 6.4 CLI command: `rebar metrics`
|
|
1038
|
+
|
|
1039
|
+
```bash
|
|
1040
|
+
rebar metrics [--path .] [--period 30d] [--format markdown|json]
|
|
1041
|
+
```
|
|
1042
|
+
|
|
1043
|
+
## 6.5 `.rebar/` Directory
|
|
1044
|
+
|
|
1045
|
+
The `.rebar/` directory is Rebar's data directory. Add it to the default generated `.gitignore` (NOT .claudeignore — Claude should be able to read metrics).
|
|
1046
|
+
|
|
1047
|
+
Contents:
|
|
1048
|
+
- `metrics.json` — Quality score history
|
|
1049
|
+
- (Future: `config.json` — Rebar configuration that persists across sessions)
|
|
1050
|
+
|
|
1051
|
+
---
|
|
1052
|
+
|
|
1053
|
+
# SECTION 7: QUALITY SCORE BADGE
|
|
1054
|
+
|
|
1055
|
+
## 7.1 Overview
|
|
1056
|
+
|
|
1057
|
+
Generate an SVG badge that shows the current quality score, suitable for embedding in README files and dashboards.
|
|
1058
|
+
|
|
1059
|
+
## 7.2 New tool: `rebar_badge`
|
|
1060
|
+
|
|
1061
|
+
```typescript
|
|
1062
|
+
server.registerTool(
|
|
1063
|
+
"rebar_badge",
|
|
1064
|
+
{
|
|
1065
|
+
title: "Rebar Badge — Generate Quality Score Badge",
|
|
1066
|
+
description: "[Rebar] Generates an SVG badge showing the current quality score. Embed in README.md to display code quality status.",
|
|
1067
|
+
inputSchema: {
|
|
1068
|
+
project_path: z.string().describe("Path to the project root"),
|
|
1069
|
+
style: z.enum(["flat", "flat-square"]).default("flat").describe("Badge style"),
|
|
1070
|
+
},
|
|
1071
|
+
annotations: {
|
|
1072
|
+
readOnlyHint: true,
|
|
1073
|
+
destructiveHint: false,
|
|
1074
|
+
idempotentHint: true,
|
|
1075
|
+
openWorldHint: false
|
|
1076
|
+
}
|
|
1077
|
+
},
|
|
1078
|
+
// handler
|
|
1079
|
+
);
|
|
1080
|
+
```
|
|
1081
|
+
|
|
1082
|
+
## 7.3 SVG Template
|
|
1083
|
+
|
|
1084
|
+
The badge MUST be generated from this template. Do NOT use an external badge service — generate the SVG locally.
|
|
1085
|
+
|
|
1086
|
+
```typescript
|
|
1087
|
+
function generateBadgeSVG(score: number, style: "flat" | "flat-square"): string {
|
|
1088
|
+
const color = score >= 90 ? "#4c1" : // bright green
|
|
1089
|
+
score >= 70 ? "#97ca00" : // green
|
|
1090
|
+
score >= 50 ? "#dfb317" : // yellow
|
|
1091
|
+
score >= 30 ? "#fe7d37" : // orange
|
|
1092
|
+
"#e05d44"; // red
|
|
1093
|
+
|
|
1094
|
+
const label = "rebar";
|
|
1095
|
+
const value = `${score}/100`;
|
|
1096
|
+
const radius = style === "flat" ? 3 : 0;
|
|
1097
|
+
|
|
1098
|
+
return `<svg xmlns="http://www.w3.org/2000/svg" width="106" height="20">
|
|
1099
|
+
<linearGradient id="b" x2="0" y2="100%">
|
|
1100
|
+
<stop offset="0" stop-color="#bbb" stop-opacity=".1"/>
|
|
1101
|
+
<stop offset="1" stop-opacity=".1"/>
|
|
1102
|
+
</linearGradient>
|
|
1103
|
+
<clipPath id="a">
|
|
1104
|
+
<rect width="106" height="20" rx="${radius}" fill="#fff"/>
|
|
1105
|
+
</clipPath>
|
|
1106
|
+
<g clip-path="url(#a)">
|
|
1107
|
+
<path fill="#555" d="M0 0h47v20H0z"/>
|
|
1108
|
+
<path fill="${color}" d="M47 0h59v20H47z"/>
|
|
1109
|
+
<path fill="url(#b)" d="M0 0h106v20H0z"/>
|
|
1110
|
+
</g>
|
|
1111
|
+
<g fill="#fff" text-anchor="middle" font-family="DejaVu Sans,Verdana,Geneva,sans-serif" font-size="11">
|
|
1112
|
+
<text x="23.5" y="15" fill="#010101" fill-opacity=".3">${label}</text>
|
|
1113
|
+
<text x="23.5" y="14">${label}</text>
|
|
1114
|
+
<text x="75.5" y="15" fill="#010101" fill-opacity=".3">${value}</text>
|
|
1115
|
+
<text x="75.5" y="14">${value}</text>
|
|
1116
|
+
</g>
|
|
1117
|
+
</svg>`;
|
|
1118
|
+
}
|
|
1119
|
+
```
|
|
1120
|
+
|
|
1121
|
+
## 7.4 Output
|
|
1122
|
+
|
|
1123
|
+
The tool writes the badge to `.rebar/badge.svg` and returns the markdown embed code:
|
|
1124
|
+
|
|
1125
|
+
```markdown
|
|
1126
|
+
Badge generated at .rebar/badge.svg
|
|
1127
|
+
|
|
1128
|
+
Add to your README.md:
|
|
1129
|
+

|
|
1130
|
+
```
|
|
1131
|
+
|
|
1132
|
+
## 7.5 CLI command: `rebar badge`
|
|
1133
|
+
|
|
1134
|
+
```bash
|
|
1135
|
+
rebar badge [--path .] [--style flat]
|
|
1136
|
+
```
|
|
1137
|
+
|
|
1138
|
+
## 7.6 Auto-update
|
|
1139
|
+
|
|
1140
|
+
The badge is automatically regenerated every time `rebar_audit` runs. This ensures the badge always reflects the current score.
|
|
1141
|
+
|
|
1142
|
+
---
|
|
1143
|
+
|
|
1144
|
+
# SECTION 8: CUSTOM RULES ENGINE
|
|
1145
|
+
|
|
1146
|
+
## 8.1 Overview
|
|
1147
|
+
|
|
1148
|
+
Allow teams to add their own code quality rules beyond the 8 built-in checks. Rules are defined in a YAML file and evaluated during `rebar_audit`.
|
|
1149
|
+
|
|
1150
|
+
## 8.2 Rules File
|
|
1151
|
+
|
|
1152
|
+
Location: `.rebar/rules.yaml`
|
|
1153
|
+
|
|
1154
|
+
Format:
|
|
1155
|
+
|
|
1156
|
+
```yaml
|
|
1157
|
+
rules:
|
|
1158
|
+
- name: no-direct-axios
|
|
1159
|
+
description: "Use the centralized API client instead of importing axios directly"
|
|
1160
|
+
pattern: "import.*from ['\"]axios['\"]"
|
|
1161
|
+
severity: HIGH
|
|
1162
|
+
file_patterns: ["*.ts", "*.tsx", "*.js", "*.jsx"]
|
|
1163
|
+
exclude_files: ["src/lib/api.ts", "src/lib/http-client.ts"]
|
|
1164
|
+
|
|
1165
|
+
- name: no-console-error
|
|
1166
|
+
description: "Use the logger service instead of console.error"
|
|
1167
|
+
pattern: "console\\.error\\("
|
|
1168
|
+
severity: MEDIUM
|
|
1169
|
+
file_patterns: ["*.ts", "*.tsx"]
|
|
1170
|
+
exclude_files: ["src/services/logger.ts"]
|
|
1171
|
+
|
|
1172
|
+
- name: no-inline-styles
|
|
1173
|
+
description: "Use Tailwind classes instead of inline styles"
|
|
1174
|
+
pattern: "style=\\{\\{"
|
|
1175
|
+
severity: LOW
|
|
1176
|
+
file_patterns: ["*.tsx", "*.jsx"]
|
|
1177
|
+
exclude_files: []
|
|
1178
|
+
|
|
1179
|
+
- name: require-error-boundary
|
|
1180
|
+
description: "Every page component must be wrapped in an ErrorBoundary"
|
|
1181
|
+
pattern: "export default function.*Page"
|
|
1182
|
+
anti_pattern: "ErrorBoundary"
|
|
1183
|
+
severity: HIGH
|
|
1184
|
+
file_patterns: ["*/pages/*.tsx", "*/app/**/page.tsx"]
|
|
1185
|
+
exclude_files: []
|
|
1186
|
+
note: "Checks that files matching the pattern also contain the anti_pattern. Flags files that have the pattern but NOT the anti_pattern."
|
|
1187
|
+
```
|
|
1188
|
+
|
|
1189
|
+
## 8.3 Rule Schema
|
|
1190
|
+
|
|
1191
|
+
```typescript
|
|
1192
|
+
const CustomRuleSchema = z.object({
|
|
1193
|
+
name: z.string().max(64).describe("Unique rule identifier (kebab-case)"),
|
|
1194
|
+
description: z.string().max(200).describe("Human-readable description of what the rule enforces"),
|
|
1195
|
+
pattern: z.string().describe("Regex pattern to search for in files"),
|
|
1196
|
+
anti_pattern: z.string().optional().describe("If provided, the rule flags files that match 'pattern' but do NOT contain 'anti_pattern'"),
|
|
1197
|
+
severity: z.enum(["CRITICAL", "HIGH", "MEDIUM", "LOW"]).describe("Severity when the rule is violated"),
|
|
1198
|
+
file_patterns: z.array(z.string()).describe("Glob patterns for files to scan (e.g., ['*.ts', '*.tsx'])"),
|
|
1199
|
+
exclude_files: z.array(z.string()).default([]).describe("Files to exclude from this rule"),
|
|
1200
|
+
note: z.string().optional().describe("Additional context about the rule"),
|
|
1201
|
+
});
|
|
1202
|
+
|
|
1203
|
+
const RulesFileSchema = z.object({
|
|
1204
|
+
rules: z.array(CustomRuleSchema),
|
|
1205
|
+
}).strict();
|
|
1206
|
+
```
|
|
1207
|
+
|
|
1208
|
+
## 8.4 Integration with rebar_audit
|
|
1209
|
+
|
|
1210
|
+
When `rebar_audit` runs:
|
|
1211
|
+
1. Check if `.rebar/rules.yaml` exists
|
|
1212
|
+
2. If yes, parse and validate against `RulesFileSchema`
|
|
1213
|
+
3. For each custom rule, scan matching files for the pattern
|
|
1214
|
+
4. If `anti_pattern` is specified, flag files that have `pattern` but NOT `anti_pattern`
|
|
1215
|
+
5. Add violations to the audit results under a "Custom Rules" section
|
|
1216
|
+
6. Include custom rule violations in the quality score calculation (same weights as built-in checks)
|
|
1217
|
+
|
|
1218
|
+
## 8.5 New tool: `rebar_add_rule`
|
|
1219
|
+
|
|
1220
|
+
```typescript
|
|
1221
|
+
server.registerTool(
|
|
1222
|
+
"rebar_add_rule",
|
|
1223
|
+
{
|
|
1224
|
+
title: "Rebar Add Custom Rule",
|
|
1225
|
+
description: "[Rebar] Adds a custom code quality rule to the project's .rebar/rules.yaml. Custom rules are evaluated during `rebar audit` alongside built-in checks.",
|
|
1226
|
+
inputSchema: {
|
|
1227
|
+
project_path: z.string(),
|
|
1228
|
+
name: z.string().max(64).describe("Rule name in kebab-case"),
|
|
1229
|
+
description: z.string().max(200).describe("What the rule enforces"),
|
|
1230
|
+
pattern: z.string().describe("Regex to search for"),
|
|
1231
|
+
anti_pattern: z.string().optional().describe("Regex that SHOULD be present when pattern is found"),
|
|
1232
|
+
severity: z.enum(["CRITICAL", "HIGH", "MEDIUM", "LOW"]),
|
|
1233
|
+
file_patterns: z.array(z.string()).describe("Glob patterns for files to scan"),
|
|
1234
|
+
exclude_files: z.array(z.string()).default([]),
|
|
1235
|
+
output_format: z.enum(["markdown", "json"]).default("markdown"),
|
|
1236
|
+
},
|
|
1237
|
+
annotations: {
|
|
1238
|
+
readOnlyHint: false,
|
|
1239
|
+
destructiveHint: false,
|
|
1240
|
+
idempotentHint: true,
|
|
1241
|
+
openWorldHint: false
|
|
1242
|
+
}
|
|
1243
|
+
},
|
|
1244
|
+
// handler: reads existing rules.yaml (or creates new), adds rule, writes back
|
|
1245
|
+
);
|
|
1246
|
+
```
|
|
1247
|
+
|
|
1248
|
+
## 8.6 Verification
|
|
1249
|
+
|
|
1250
|
+
1. Create a `.rebar/rules.yaml` with a test rule that matches `console.log`
|
|
1251
|
+
2. Run `rebar_audit` and verify the custom rule catches `console.log` instances
|
|
1252
|
+
3. Verify custom rule violations appear in the audit output under "Custom Rules" section
|
|
1253
|
+
4. Verify custom rule violations affect the quality score
|
|
1254
|
+
5. Verify `rebar_add_rule` creates the YAML file if it doesn't exist
|
|
1255
|
+
6. Verify `rebar_add_rule` appends to existing rules without overwriting
|
|
1256
|
+
|
|
1257
|
+
---
|
|
1258
|
+
|
|
1259
|
+
# SECTION 9: TESTING REQUIREMENTS
|
|
1260
|
+
|
|
1261
|
+
## 9.1 Rebrand Tests
|
|
1262
|
+
|
|
1263
|
+
- All tool names in test assertions use `rebar_*` prefix
|
|
1264
|
+
- No test file references `ccboot` anywhere
|
|
1265
|
+
- `grep -r "ccboot" tests/` returns ZERO results
|
|
1266
|
+
|
|
1267
|
+
## 9.2 Strictness Profile Tests
|
|
1268
|
+
|
|
1269
|
+
- `getHooksForProfile("standard")` returns hooks where only danger-blocker and secret-detector have exit 2
|
|
1270
|
+
- `getHooksForProfile("strict")` returns hooks where lint and test hooks also have exit 2
|
|
1271
|
+
- `getHooksForProfile("paranoid")` returns all strict hooks plus file-size, any-type, and commit-completeness guards
|
|
1272
|
+
- `rebar_set_strictness` correctly replaces hooks in settings.json without duplicating
|
|
1273
|
+
|
|
1274
|
+
## 9.3 Multi-Platform Tests
|
|
1275
|
+
|
|
1276
|
+
- `rebar_init_project` with `platforms: ["cursor"]` creates `.cursor/rules/` directory with valid files
|
|
1277
|
+
- `rebar_init_project` with `platforms: ["windsurf"]` creates `.windsurf/rules/` directory with valid files
|
|
1278
|
+
- `rebar_init_project` with `platforms: ["codex"]` creates `AGENTS.md`
|
|
1279
|
+
- `rebar_init_project` with `platforms: ["all"]` creates config for all 4 platforms
|
|
1280
|
+
- All generated platform files contain the Mandatory Practices section
|
|
1281
|
+
- Cursor rules have `alwaysApply: true` in frontmatter
|
|
1282
|
+
- Windsurf rules have `trigger: always` in frontmatter
|
|
1283
|
+
|
|
1284
|
+
## 9.4 Doctor Tests
|
|
1285
|
+
|
|
1286
|
+
- Create a healthy project setup → all 10 checks PASS
|
|
1287
|
+
- Create a project with missing CLAUDE.md → Check 1 FAIL
|
|
1288
|
+
- Create a project with missing hooks → Check 2 FAIL
|
|
1289
|
+
- Create a project with empty skills → Check 3 FAIL or WARN
|
|
1290
|
+
- Overall health correctly calculated from check results
|
|
1291
|
+
|
|
1292
|
+
## 9.5 CLI Tests
|
|
1293
|
+
|
|
1294
|
+
- `runCLI(["version"])` prints version string
|
|
1295
|
+
- `runCLI(["help"])` prints help text
|
|
1296
|
+
- `runCLI(["audit", "--path", testDir])` returns audit results
|
|
1297
|
+
- `runCLI(["audit", "--threshold", "999"])` exits with code 1
|
|
1298
|
+
- `runCLI([])` does NOT crash (falls through to MCP server mode)
|
|
1299
|
+
|
|
1300
|
+
## 9.6 Metrics Tests
|
|
1301
|
+
|
|
1302
|
+
- Running `rebar_audit` creates `.rebar/metrics.json` if it doesn't exist
|
|
1303
|
+
- Running `rebar_audit` multiple times appends snapshots
|
|
1304
|
+
- Snapshot count never exceeds 100 (oldest dropped)
|
|
1305
|
+
- `rebar_metrics` correctly calculates score trend and improvement rate
|
|
1306
|
+
- `rebar_metrics` handles the case where only 1 snapshot exists (no trend to show)
|
|
1307
|
+
|
|
1308
|
+
## 9.7 Badge Tests
|
|
1309
|
+
|
|
1310
|
+
- `rebar_badge` generates valid SVG
|
|
1311
|
+
- Score >= 90 produces green badge (#4c1)
|
|
1312
|
+
- Score >= 70 produces yellow-green badge (#97ca00)
|
|
1313
|
+
- Score >= 50 produces yellow badge (#dfb317)
|
|
1314
|
+
- Score < 30 produces red badge (#e05d44)
|
|
1315
|
+
- Badge file is written to `.rebar/badge.svg`
|
|
1316
|
+
|
|
1317
|
+
## 9.8 Custom Rules Tests
|
|
1318
|
+
|
|
1319
|
+
- Valid `.rebar/rules.yaml` is parsed without errors
|
|
1320
|
+
- Invalid YAML produces a clear error message
|
|
1321
|
+
- Custom rule with `pattern` catches matching code
|
|
1322
|
+
- Custom rule with `anti_pattern` flags files that have pattern but not anti_pattern
|
|
1323
|
+
- Custom rule violations appear in audit output
|
|
1324
|
+
- Custom rule violations affect quality score
|
|
1325
|
+
- `rebar_add_rule` creates rules.yaml if it doesn't exist
|
|
1326
|
+
- `rebar_add_rule` appends without overwriting existing rules
|
|
1327
|
+
|
|
1328
|
+
---
|
|
1329
|
+
|
|
1330
|
+
# SECTION 10: README, CHANGELOG, AND PUBLISH
|
|
1331
|
+
|
|
1332
|
+
## 10.1 README.md
|
|
1333
|
+
|
|
1334
|
+
The README MUST follow this EXACT structure. Do not add extra sections. Do not remove any section.
|
|
1335
|
+
|
|
1336
|
+
```markdown
|
|
1337
|
+
# Rebar
|
|
1338
|
+
|
|
1339
|
+
**Reinforcement for AI-generated code.**
|
|
1340
|
+
|
|
1341
|
+
Rebar prevents AI coding tools from shipping broken, incomplete, or insecure code. It embeds enforcement hooks, quality audits, and opinionated templates directly into your development environment — catching shortcuts at the moment of creation, not after the PR is opened.
|
|
1342
|
+
|
|
1343
|
+
Works with: **Claude Code** • **Cursor** • **Windsurf** • **Codex CLI**
|
|
1344
|
+
|
|
1345
|
+

|
|
1346
|
+
|
|
1347
|
+
---
|
|
1348
|
+
|
|
1349
|
+
## What Rebar Does
|
|
1350
|
+
|
|
1351
|
+
| Problem | Without Rebar | With Rebar |
|
|
1352
|
+
|---------|---------------|------------|
|
|
1353
|
+
| Claude skips tests | "I've completed the implementation" (no tests run) | Hook runs tests after every file change. Strict mode blocks until tests pass. |
|
|
1354
|
+
| Empty catch blocks | Errors silently swallowed | Audit detects and flags every empty catch block |
|
|
1355
|
+
| `any` types everywhere | TypeScript without type safety | Paranoid mode blocks files containing `any` |
|
|
1356
|
+
| Incomplete implementations | TODO comments shipped to production | Paranoid mode blocks commits with TODO/FIXME |
|
|
1357
|
+
| Hardcoded secrets | API keys in source code | Pre-commit hook detects and blocks secret patterns |
|
|
1358
|
+
| Destructive commands | `rm -rf /` | Pre-execution hook blocks dangerous commands |
|
|
1359
|
+
| Inconsistent setup | Every developer configures differently | One `rebar init` standardizes the entire team |
|
|
1360
|
+
|
|
1361
|
+
---
|
|
1362
|
+
|
|
1363
|
+
## Quick Start
|
|
1364
|
+
|
|
1365
|
+
### As an MCP Server (Claude Code)
|
|
1366
|
+
|
|
1367
|
+
```bash
|
|
1368
|
+
claude mcp add rebar -- npx rebar-mcp
|
|
1369
|
+
```
|
|
1370
|
+
|
|
1371
|
+
Then in Claude Code:
|
|
1372
|
+
```
|
|
1373
|
+
> Initialize Rebar with strict enforcement
|
|
1374
|
+
```
|
|
1375
|
+
|
|
1376
|
+
### As a CLI
|
|
1377
|
+
|
|
1378
|
+
```bash
|
|
1379
|
+
# Initialize a project
|
|
1380
|
+
npx rebar-mcp init --strictness strict --platforms all
|
|
1381
|
+
|
|
1382
|
+
# Audit code quality
|
|
1383
|
+
npx rebar-mcp audit --threshold 70
|
|
1384
|
+
|
|
1385
|
+
# Check setup health
|
|
1386
|
+
npx rebar-mcp doctor
|
|
1387
|
+
```
|
|
1388
|
+
|
|
1389
|
+
### In CI/CD
|
|
1390
|
+
|
|
1391
|
+
```yaml
|
|
1392
|
+
# .github/workflows/rebar.yml
|
|
1393
|
+
- run: npx rebar-mcp audit --threshold 70 --format json
|
|
1394
|
+
```
|
|
1395
|
+
|
|
1396
|
+
---
|
|
1397
|
+
|
|
1398
|
+
## Strictness Profiles
|
|
1399
|
+
|
|
1400
|
+
| Profile | Tests | Lint | Secrets | Danger | File Size | `any` Types | TODOs |
|
|
1401
|
+
|---------|-------|------|---------|--------|-----------|-------------|-------|
|
|
1402
|
+
| **Standard** | ⚠️ Notify | ⚠️ Notify | 🛑 Block | 🛑 Block | — | — | — |
|
|
1403
|
+
| **Strict** | 🛑 Block | 🛑 Block | 🛑 Block | 🛑 Block | — | — | — |
|
|
1404
|
+
| **Paranoid** | 🛑 Block | 🛑 Block | 🛑 Block | 🛑 Block | 🛑 Block >400 lines | 🛑 Block | 🛑 Block |
|
|
1405
|
+
|
|
1406
|
+
```bash
|
|
1407
|
+
# Set strictness
|
|
1408
|
+
npx rebar-mcp set-strictness paranoid
|
|
1409
|
+
```
|
|
1410
|
+
|
|
1411
|
+
---
|
|
1412
|
+
|
|
1413
|
+
## What Gets Generated
|
|
1414
|
+
|
|
1415
|
+
Running `rebar init` creates:
|
|
1416
|
+
|
|
1417
|
+
**Claude Code:** CLAUDE.md, .claude/settings.json (enforcement hooks), .claude/skills/ (5 skills), .claude/agents/ (4 agents), .claudeignore
|
|
1418
|
+
|
|
1419
|
+
**Cursor:** .cursor/rules/ (project rules + 4 skill rules)
|
|
1420
|
+
|
|
1421
|
+
**Windsurf:** .windsurf/rules/ (project rules + 4 skill rules)
|
|
1422
|
+
|
|
1423
|
+
**Codex CLI:** AGENTS.md
|
|
1424
|
+
|
|
1425
|
+
---
|
|
1426
|
+
|
|
1427
|
+
## Quality Audit
|
|
1428
|
+
|
|
1429
|
+
```bash
|
|
1430
|
+
npx rebar-mcp audit
|
|
1431
|
+
```
|
|
1432
|
+
|
|
1433
|
+
Checks for:
|
|
1434
|
+
1. TODO/FIXME/HACK/XXX comments
|
|
1435
|
+
2. Empty catch blocks
|
|
1436
|
+
3. `any` type usage
|
|
1437
|
+
4. console.log in production code
|
|
1438
|
+
5. Files over 400 lines
|
|
1439
|
+
6. Functions over 50 lines
|
|
1440
|
+
7. Hardcoded secrets
|
|
1441
|
+
8. Custom rules (.rebar/rules.yaml)
|
|
1442
|
+
|
|
1443
|
+
Returns a quality score from 0–100.
|
|
1444
|
+
|
|
1445
|
+
---
|
|
1446
|
+
|
|
1447
|
+
## Custom Rules
|
|
1448
|
+
|
|
1449
|
+
Add project-specific rules in `.rebar/rules.yaml`:
|
|
1450
|
+
|
|
1451
|
+
```yaml
|
|
1452
|
+
rules:
|
|
1453
|
+
- name: no-direct-axios
|
|
1454
|
+
description: "Use the API client in src/lib/api.ts"
|
|
1455
|
+
pattern: "import.*from ['\"]axios['\"]"
|
|
1456
|
+
severity: HIGH
|
|
1457
|
+
file_patterns: ["*.ts", "*.tsx"]
|
|
1458
|
+
exclude_files: ["src/lib/api.ts"]
|
|
1459
|
+
```
|
|
1460
|
+
|
|
1461
|
+
---
|
|
1462
|
+
|
|
1463
|
+
## Metrics
|
|
1464
|
+
|
|
1465
|
+
```bash
|
|
1466
|
+
npx rebar-mcp metrics --period 30d
|
|
1467
|
+
```
|
|
1468
|
+
|
|
1469
|
+
Tracks quality score over time with trend analysis and improvement rate.
|
|
1470
|
+
|
|
1471
|
+
---
|
|
1472
|
+
|
|
1473
|
+
## Doctor
|
|
1474
|
+
|
|
1475
|
+
```bash
|
|
1476
|
+
npx rebar-mcp doctor
|
|
1477
|
+
```
|
|
1478
|
+
|
|
1479
|
+
Runs 10 health checks on your Rebar setup: CLAUDE.md presence, hook installation, skill configuration, context budget, cross-platform consistency, and more.
|
|
1480
|
+
|
|
1481
|
+
---
|
|
1482
|
+
|
|
1483
|
+
## License
|
|
1484
|
+
|
|
1485
|
+
MIT
|
|
1486
|
+
```
|
|
1487
|
+
|
|
1488
|
+
## 10.2 CHANGELOG.md
|
|
1489
|
+
|
|
1490
|
+
```markdown
|
|
1491
|
+
## [2.0.0] - 2026-XX-XX
|
|
1492
|
+
|
|
1493
|
+
### Breaking Changes
|
|
1494
|
+
- Renamed from `ccboot-mcp-server` to `rebar-mcp`
|
|
1495
|
+
- All tool names changed from `ccboot_*` to `rebar_*`
|
|
1496
|
+
- Package name changed to `rebar-mcp`
|
|
1497
|
+
- Binary name changed to `rebar`
|
|
1498
|
+
|
|
1499
|
+
### Added
|
|
1500
|
+
- **Multi-platform support:** Generates configurations for Claude Code, Cursor, Windsurf, and Codex CLI
|
|
1501
|
+
- **Strictness profiles:** Standard (notify), Strict (block on test/lint failures), Paranoid (block on any types, file size, TODOs)
|
|
1502
|
+
- **`rebar doctor`:** 10-point health check for enforcement setup
|
|
1503
|
+
- **Standalone CLI:** `rebar init`, `rebar audit`, `rebar doctor`, `rebar metrics`, `rebar badge` commands
|
|
1504
|
+
- **CI/CD integration:** `rebar audit --threshold` exits with code 1 for pipeline gating
|
|
1505
|
+
- **Quality score tracking:** `.rebar/metrics.json` stores score history with trend analysis
|
|
1506
|
+
- **Quality score badge:** SVG badge generation for README embedding
|
|
1507
|
+
- **Custom rules engine:** `.rebar/rules.yaml` for project-specific quality rules
|
|
1508
|
+
- **`rebar_add_rule` tool:** Add custom rules via MCP or CLI
|
|
1509
|
+
- **`rebar_set_strictness` tool:** Change enforcement profile without re-initializing
|
|
1510
|
+
- **`rebar_metrics` tool:** View quality score trends and improvement rate
|
|
1511
|
+
|
|
1512
|
+
### Changed
|
|
1513
|
+
- `rebar_init_project` now generates config for all detected AI coding platforms
|
|
1514
|
+
- `rebar_audit` (formerly `ccboot_audit_code_quality`) now supports custom rules and auto-generates metrics snapshots
|
|
1515
|
+
- All templates updated to include platform-specific formatting for Cursor and Windsurf
|
|
1516
|
+
```
|
|
1517
|
+
|
|
1518
|
+
## 10.3 Publish
|
|
1519
|
+
|
|
1520
|
+
```bash
|
|
1521
|
+
npm run build
|
|
1522
|
+
npm run test
|
|
1523
|
+
# Verify: grep -r "ccboot" src/ templates/ tests/ returns ZERO results
|
|
1524
|
+
# Verify: node dist/index.js version prints "rebar-mcp v2.0.0"
|
|
1525
|
+
# Verify: node dist/index.js help prints help text
|
|
1526
|
+
# Verify: node dist/index.js audit --path . returns audit results
|
|
1527
|
+
npm publish
|
|
1528
|
+
```
|
|
1529
|
+
|
|
1530
|
+
Register on MCP registry:
|
|
1531
|
+
```bash
|
|
1532
|
+
# Update MCP registry listing from ccboot to rebar
|
|
1533
|
+
```
|
|
1534
|
+
|
|
1535
|
+
---
|
|
1536
|
+
|
|
1537
|
+
# FINAL CHECKLIST
|
|
1538
|
+
|
|
1539
|
+
Before marking v2.0.0 as complete, verify ALL of the following:
|
|
1540
|
+
|
|
1541
|
+
- [ ] `grep -r "ccboot" src/ templates/ tests/ package.json` returns ZERO results
|
|
1542
|
+
- [ ] Package name in package.json is `rebar-mcp`
|
|
1543
|
+
- [ ] Version is `2.0.0`
|
|
1544
|
+
- [ ] Binary name is `rebar`
|
|
1545
|
+
- [ ] All 15+ tools use `rebar_*` prefix
|
|
1546
|
+
- [ ] New tools registered: `rebar_set_strictness`, `rebar_doctor`, `rebar_metrics`, `rebar_badge`, `rebar_add_rule`
|
|
1547
|
+
- [ ] Strictness profiles: standard/strict/paranoid all generate correct hooks
|
|
1548
|
+
- [ ] Standard: only danger+secrets block. Strict: adds lint+test blocking. Paranoid: adds file size, any type, TODO blocking
|
|
1549
|
+
- [ ] `rebar_init_project` generates configs for Claude Code, Cursor, Windsurf, and Codex
|
|
1550
|
+
- [ ] `.cursor/rules/*.md` files have correct `alwaysApply: true` frontmatter
|
|
1551
|
+
- [ ] `.windsurf/rules/*.md` files have correct `trigger: always` frontmatter
|
|
1552
|
+
- [ ] `AGENTS.md` is generated for Codex with full mandatory practices
|
|
1553
|
+
- [ ] `rebar_doctor` performs all 10 health checks
|
|
1554
|
+
- [ ] CLI mode works: `rebar init`, `rebar audit`, `rebar doctor`, `rebar metrics`, `rebar badge`, `rebar set-strictness`, `rebar version`, `rebar help`
|
|
1555
|
+
- [ ] `rebar audit --threshold 70` exits with code 1 when score is below 70
|
|
1556
|
+
- [ ] `.rebar/metrics.json` is created/updated on every audit run
|
|
1557
|
+
- [ ] `rebar_metrics` shows score trend with ASCII chart
|
|
1558
|
+
- [ ] `rebar_badge` generates valid SVG with correct colors per score range
|
|
1559
|
+
- [ ] `.rebar/rules.yaml` custom rules are evaluated during audit
|
|
1560
|
+
- [ ] `rebar_add_rule` creates/appends to rules.yaml
|
|
1561
|
+
- [ ] `npm run build` passes with ZERO errors
|
|
1562
|
+
- [ ] `npm run test` passes with ALL tests green
|
|
1563
|
+
- [ ] README.md matches the structure in Section 10.1
|
|
1564
|
+
- [ ] CHANGELOG.md has the v2.0.0 entry
|
|
1565
|
+
- [ ] No TODO, FIXME, or placeholder text in any file
|
|
1566
|
+
|
|
1567
|
+
If ANY item above is not checked, v2.0.0 is NOT complete. Do not publish.
|