cerber-core 1.1.8 → 1.1.10
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 +157 -1747
- package/package.json +18 -19
package/README.md
CHANGED
|
@@ -2,342 +2,151 @@
|
|
|
2
2
|
|
|
3
3
|
> **AI doesn't break your project. Lack of a contract does.**
|
|
4
4
|
|
|
5
|
-
|
|
6
|
-
|
|
5
|
+
Contract-first project guardian for AI-assisted development.
|
|
6
|
+
Enforces `CERBER.md` across pre-commit, CI, and optional post-deploy gates.
|
|
7
7
|
|
|
8
8
|
[](https://www.npmjs.com/package/cerber-core)
|
|
9
9
|
[](https://opensource.org/licenses/MIT)
|
|
10
10
|
[](https://github.com/Agaslez/cerber-core)
|
|
11
11
|
|
|
12
|
-
|
|
13
|
-
**Status:** Production-ready ✅
|
|
14
|
-
**License:** MIT
|
|
12
|
+
---
|
|
15
13
|
|
|
16
|
-
##
|
|
14
|
+
## How to use Cerber (the intended workflow)
|
|
17
15
|
|
|
18
|
-
Cerber is
|
|
19
|
-
It's not a CI tool.
|
|
20
|
-
It's a contract that everything else must obey.
|
|
16
|
+
Cerber is simple: **you write the rules once in `CERBER.md`**, Cerber enforces them forever (pre-commit + CI + optional post-deploy).
|
|
21
17
|
|
|
22
|
-
|
|
18
|
+
**Roadmap → translated into CERBER.md contract → enforced automatically on every commit/push.**
|
|
23
19
|
|
|
24
|
-
|
|
20
|
+
### 1) Install
|
|
21
|
+
```bash
|
|
22
|
+
npm i -D cerber-core
|
|
23
|
+
```
|
|
25
24
|
|
|
25
|
+
### 2) Generate CERBER.md
|
|
26
26
|
```bash
|
|
27
|
-
npm install cerber-core --save-dev
|
|
28
27
|
npx cerber init
|
|
29
|
-
# Follow prompts to generate CERBER.md contract + guardian hooks
|
|
30
28
|
```
|
|
31
29
|
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
---
|
|
35
|
-
|
|
36
|
-
## 🤖 For AI Agents (Copilot, Cursor, Windsurf, Claude, etc.)
|
|
37
|
-
|
|
38
|
-
**Cerber's one rule:** `CERBER.md` is the single source of truth.
|
|
30
|
+
If CERBER.md did not exist, Cerber creates a template and stops.
|
|
31
|
+
Now **YOU fill the contract** (ideally with an AI assistant).
|
|
39
32
|
|
|
40
|
-
|
|
41
|
-
- If `CERBER.md` exists → execute contract exactly as specified.
|
|
42
|
-
- **Never guess architecture.** Never invent rules. Never auto-design.
|
|
33
|
+
### 3) Teach Cerber using your roadmap (fastest way)
|
|
43
34
|
|
|
44
|
-
**
|
|
45
|
-
- `schema.mode: template_only` → Generate minimal starter with "NOT SOURCE OF TRUTH" header
|
|
46
|
-
- `schema.mode: strict` → Require existing schema file, never generate
|
|
47
|
-
|
|
48
|
-
**Three enforcement points:**
|
|
49
|
-
1. **Pre-commit** (Guardian) - Blocks violating commits
|
|
50
|
-
2. **CI** (GitHub Actions) - Validates on push
|
|
51
|
-
3. **Post-deploy** - Health gate checks production
|
|
52
|
-
|
|
53
|
-
**Working with Cerber:** Read `CERBER.md` first. It tells you what's allowed and what's protected.
|
|
54
|
-
|
|
55
|
-
### MUST (Non-Negotiable Rules for AI Agents)
|
|
56
|
-
|
|
57
|
-
**Rule 1: Schema Generation = Translation Only**
|
|
58
|
-
- Agent can **only translate** explicit rules from `CERBER.md` into `BACKEND_SCHEMA.*` format
|
|
59
|
-
- If a rule is **not in CERBER.md** → ask user / fail / leave empty
|
|
60
|
-
- **Never invent**, guess, or auto-generate architecture rules
|
|
61
|
-
|
|
62
|
-
**Rule 2: NO-HEREDOC for TS/JS Files**
|
|
63
|
-
- **Never** create TypeScript/JavaScript files using bash `cat <<EOF` or heredoc syntax
|
|
64
|
-
- Reason: Causes `${}` template literal corruption and UTF-8 encoding issues
|
|
65
|
-
- Use editor tools, `fs.writeFile`, or proper file generation utilities instead
|
|
66
|
-
|
|
67
|
-
---
|
|
35
|
+
Take your project roadmap + repo structure and paste it into ChatGPT/Claude/Cursor with the **Cerber Contract Translator prompt** (see below).
|
|
68
36
|
|
|
69
|
-
|
|
37
|
+
Then:
|
|
38
|
+
- Paste the generated contract into `CERBER.md`
|
|
39
|
+
- Run init again to generate hooks/workflows/templates:
|
|
40
|
+
```bash
|
|
41
|
+
npx cerber init
|
|
42
|
+
```
|
|
70
43
|
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
Time Saved: 4.5 hours in one session
|
|
75
|
-
Bugs Prevented: 43 issues caught before production
|
|
76
|
-
Architecture Violations: 6 caught & fixed
|
|
77
|
-
Commits Blocked: 2 (saved hours of debugging)
|
|
78
|
-
Production Incidents: 0 (vs 2-3/week before)
|
|
79
|
-
Bug Detection Rate: 95% pre-production
|
|
80
|
-
ROI: Break-even on Day 1
|
|
44
|
+
### 4) Verify everything (Doctor)
|
|
45
|
+
```bash
|
|
46
|
+
npx cerber doctor
|
|
81
47
|
```
|
|
82
48
|
|
|
83
|
-
**
|
|
49
|
+
**Exit codes:**
|
|
50
|
+
- `0` ✅ All checks pass
|
|
51
|
+
- `2` ❌ Missing CERBER.md
|
|
52
|
+
- `3` ❌ Missing schema (strict mode)
|
|
53
|
+
- `4` ❌ Missing hook/workflow
|
|
84
54
|
|
|
85
|
-
|
|
86
|
-
> — Senior Developer, Eliksir Team
|
|
55
|
+
### 5) Commit and push (Guardian + CI)
|
|
87
56
|
|
|
88
|
-
|
|
89
|
-
|
|
57
|
+
- `git commit` → Guardian validates staged changes (blocks violations)
|
|
58
|
+
- `git push` → GitHub Actions validates again in CI
|
|
90
59
|
|
|
91
60
|
---
|
|
92
61
|
|
|
93
|
-
##
|
|
62
|
+
## What Cerber enforces (in practice)
|
|
94
63
|
|
|
95
|
-
**
|
|
96
|
-
- **
|
|
97
|
-
- **
|
|
98
|
-
- **Speed up onboarding** - CERBER.md = instant project understanding for new hires
|
|
99
|
-
- **Enforce architecture** - Prevent technical debt before it enters codebase
|
|
100
|
-
|
|
101
|
-
**Cost Comparison:**
|
|
102
|
-
```
|
|
103
|
-
Manual Code Reviews: $150/hour × 2 hours/day = $300/day
|
|
104
|
-
Cerber Core: $0 (open source) + 4h one-time setup
|
|
105
|
-
Break-even: Day 1 ✅
|
|
106
|
-
Ongoing savings: $6,000/month per developer
|
|
107
|
-
```
|
|
108
|
-
|
|
109
|
-
**Who uses Cerber Core?**
|
|
110
|
-
- 🏢 **Startups** - Solo founders building fast with AI (SOLO layer)
|
|
111
|
-
- 👥 **Small teams** - 2-5 developers maintaining consistency (TEAM layer)
|
|
112
|
-
- 🚀 **Growing companies** - Enforcing architecture as team scales
|
|
113
|
-
- 🏭 **SaaS companies** - Production health monitoring (Cerber 2.1)
|
|
64
|
+
- **Pre-commit (Guardian):** Blocks committing obvious violations (secrets, forbidden patterns, missing required imports, etc.)
|
|
65
|
+
- **CI (GitHub Actions):** Re-validates on push/PR and protects the workflow itself (`cerber-integrity` job)
|
|
66
|
+
- **Optional post-deploy:** Can validate production health if enabled in contract
|
|
114
67
|
|
|
115
68
|
---
|
|
116
69
|
|
|
117
|
-
##
|
|
70
|
+
## Cerber Contract Translator (Copy/Paste Prompt)
|
|
118
71
|
|
|
119
|
-
|
|
72
|
+
> Use this to generate a production-ready `CERBER.md` from your roadmap.
|
|
73
|
+
> Cerber does NOT design your architecture. It enforces what you write.
|
|
120
74
|
|
|
121
|
-
**
|
|
75
|
+
**PROMPT:**
|
|
122
76
|
|
|
123
77
|
```
|
|
124
|
-
You
|
|
125
|
-
Cerber guards → enforces your decisions
|
|
126
|
-
```
|
|
78
|
+
You are a "Cerber Contract Translator". Convert my roadmap + repo structure into a `CERBER.md` contract.
|
|
127
79
|
|
|
128
|
-
|
|
80
|
+
RULES:
|
|
81
|
+
- Do NOT invent architecture or rules.
|
|
82
|
+
- Only translate what I explicitly provide.
|
|
83
|
+
- If something is missing, ask up to 10 questions in a `QUESTIONS` section and leave placeholders.
|
|
84
|
+
- Output must be a complete `CERBER.md` with:
|
|
85
|
+
1) CERBER_CONTRACT (YAML)
|
|
86
|
+
2) ROADMAP_AS_LAW (milestones)
|
|
87
|
+
3) AI_AGENT_RULES (no guessing)
|
|
88
|
+
4) PROTECTED_ASSETS
|
|
89
|
+
5) CERBER_OVERRIDE (TTL safety fuse)
|
|
90
|
+
6) QUESTIONS
|
|
129
91
|
|
|
130
|
-
|
|
131
|
-
-
|
|
132
|
-
-
|
|
133
|
-
-
|
|
134
|
-
-
|
|
135
|
-
-
|
|
136
|
-
|
|
137
|
-
**Cerber Core solution:**
|
|
138
|
-
```
|
|
139
|
-
✅ Architect defines rules once (CERBER.md contract)
|
|
140
|
-
✅ Cerber enforces automatically forever
|
|
141
|
-
✅ Every commit validates against your roadmap (<1 second)
|
|
142
|
-
✅ Architecture stays intact as team scales
|
|
143
|
-
```
|
|
92
|
+
INPUT I PROVIDE:
|
|
93
|
+
- Roadmap (what we are building, milestones, priorities)
|
|
94
|
+
- Repo structure (`tree -L 3` or folder list)
|
|
95
|
+
- Tech stack + commands for smoke/e2e/build
|
|
96
|
+
- Integrations (Stripe/Ghost/Cloudinary/etc.)
|
|
97
|
+
- What files/paths are "protected" from deletion
|
|
144
98
|
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
Instead of hoping developers "follow the docs" → **Guardian blocks commits that violate your architecture**
|
|
148
|
-
|
|
149
|
-
```typescript
|
|
150
|
-
// Your roadmap becomes code:
|
|
151
|
-
export const BACKEND_SCHEMA = {
|
|
152
|
-
rules: [
|
|
153
|
-
{
|
|
154
|
-
name: 'Protected routes must use authenticateToken',
|
|
155
|
-
pattern: /routes\/.*\.ts$/,
|
|
156
|
-
requiredImports: ['authenticateToken'],
|
|
157
|
-
severity: 'error' // Blocks violating commits
|
|
158
|
-
}
|
|
159
|
-
]
|
|
160
|
-
};
|
|
99
|
+
Now generate `CERBER.md`.
|
|
161
100
|
```
|
|
162
101
|
|
|
163
|
-
**Result:** $6,000/month saved per developer. Architecture that doesn't erode. Teams that scale without chaos.
|
|
164
|
-
|
|
165
|
-
**Four Layers:**
|
|
166
|
-
|
|
167
|
-
1. **🛡️ Guardian 1.0** - Pre-commit architecture validator
|
|
168
|
-
- Schema-as-Code (self-documenting architecture rules)
|
|
169
|
-
- Architect approval system for justified exceptions
|
|
170
|
-
- Forbidden pattern detection with exceptions
|
|
171
|
-
- Fast feedback (<1 second validation)
|
|
172
|
-
|
|
173
|
-
2. **🔍 Cerber 2.1** - Runtime health diagnostics
|
|
174
|
-
- Deployment quality gates
|
|
175
|
-
- Detailed diagnostics (diagnosis + rootCause + fix)
|
|
176
|
-
- Severity levels (critical/error/warning)
|
|
177
|
-
- Automatic rollback on critical issues
|
|
178
|
-
|
|
179
|
-
3. **⚡ SOLO** - Automation for solo developers
|
|
180
|
-
- Auto-repair (format, sync, changelog)
|
|
181
|
-
- Dependency health checks
|
|
182
|
-
- Performance budget enforcement
|
|
183
|
-
- Daily snapshots & dashboard
|
|
184
|
-
|
|
185
|
-
4. **👥 TEAM** - Collaboration tools for teams
|
|
186
|
-
- **Focus Mode** - Generate 500 LOC context (vs 10K LOC) ⭐
|
|
187
|
-
- Module boundaries enforcement
|
|
188
|
-
- Connection contracts between modules
|
|
189
|
-
- CERBER.md project mapping
|
|
190
|
-
|
|
191
|
-
---
|
|
192
|
-
|
|
193
|
-
## 🤔 Why Cerber Exists
|
|
194
|
-
|
|
195
|
-
AI tools don't understand your project boundaries.
|
|
196
|
-
They generate changes that cause:
|
|
197
|
-
- **Schema drift** - Models diverge from database reality
|
|
198
|
-
- **Architecture violations** - Security patterns bypassed
|
|
199
|
-
- **CI fail loops** - 2-3 hours wasted on fixes
|
|
200
|
-
- **Deployments without health validation** - Production incidents
|
|
201
|
-
|
|
202
|
-
**Cerber fixes this by enforcing a human-written contract:**
|
|
203
|
-
**CERBER.md is the only source of truth.**
|
|
204
|
-
|
|
205
102
|
---
|
|
206
103
|
|
|
207
|
-
##
|
|
104
|
+
## For AI Agents (Copilot / Cursor / Windsurf / Claude / etc.)
|
|
208
105
|
|
|
209
|
-
**
|
|
210
|
-
**Linters** check syntax.
|
|
211
|
-
**CI** runs pipelines.
|
|
106
|
+
**Single rule:** `CERBER.md` is the ONLY source of truth.
|
|
212
107
|
|
|
213
|
-
|
|
108
|
+
### Agent must follow this protocol
|
|
214
109
|
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
|
|
110
|
+
1) **If `CERBER.md` is missing:**
|
|
111
|
+
- Run `npx cerber init` to generate template
|
|
112
|
+
- STOP (user must provide contract content)
|
|
218
113
|
|
|
219
|
-
|
|
114
|
+
2) **If `CERBER.md` exists:**
|
|
115
|
+
- Read it first
|
|
116
|
+
- Execute exactly what it says
|
|
117
|
+
- Do NOT invent rules, do NOT infer architecture
|
|
220
118
|
|
|
221
|
-
|
|
119
|
+
3) **Schema policy (important):**
|
|
120
|
+
- If `schema.mode: strict` → DO NOT generate schema files
|
|
121
|
+
- If `schema.mode: template_only` → you may generate only the minimal template (NOT decisions)
|
|
222
122
|
|
|
223
|
-
**
|
|
224
|
-
-
|
|
225
|
-
-
|
|
226
|
-
-
|
|
227
|
-
-
|
|
123
|
+
4) **Safety rules:**
|
|
124
|
+
- Never disable or rename CI job id: `cerber-ci`
|
|
125
|
+
- Never remove: `CERBER.md`, `.github/workflows/cerber.yml`, `scripts/cerber-guardian.mjs`, `.husky/pre-commit`, `.github/CODEOWNERS`
|
|
126
|
+
- Never bypass checks using `continue-on-error`
|
|
127
|
+
- Never use `cat <<EOF` for TS/JS (corrupts `${}` template literals)
|
|
228
128
|
|
|
229
|
-
**
|
|
230
|
-
- ❌ You want the tool to design your architecture
|
|
231
|
-
- ❌ You don't want to maintain a contract (CERBER.md)
|
|
129
|
+
**If a required rule is not present in `CERBER.md` → ASK USER or FAIL FAST.**
|
|
232
130
|
|
|
233
131
|
---
|
|
234
132
|
|
|
235
|
-
##
|
|
236
|
-
|
|
237
|
-
**Critical principle:** Cerber does NOT design your system. Cerber enforces YOUR design.
|
|
238
|
-
|
|
239
|
-
### The Rule
|
|
240
|
-
|
|
241
|
-
```
|
|
242
|
-
📜 CERBER.md = Your roadmap (single source of truth)
|
|
243
|
-
🛡️ Guardian = Enforces CERBER.md rules
|
|
244
|
-
📋 Schema files = Optional mirrors of CERBER.md (NOT source of truth)
|
|
245
|
-
```
|
|
246
|
-
|
|
247
|
-
**What this means:**
|
|
248
|
-
|
|
249
|
-
✅ **CERBER.md defines everything** - architecture, rules, team mode
|
|
250
|
-
✅ **Cerber executes CERBER.md** - no assumptions, no magic
|
|
251
|
-
✅ **Schema files are user-owned** - Cerber helps, never decides
|
|
252
|
-
✅ **You design. Cerber guards.** - separation of concerns
|
|
253
|
-
|
|
254
|
-
❌ **Cerber does NOT guess your architecture**
|
|
255
|
-
❌ **Cerber does NOT infer folder structures**
|
|
256
|
-
❌ **Cerber does NOT auto-design systems**
|
|
257
|
-
|
|
258
|
-
### Schema Mode: Strict vs Template_Only
|
|
259
|
-
|
|
260
|
-
In `CERBER.md` contract, you control schema generation:
|
|
261
|
-
|
|
262
|
-
```yaml
|
|
263
|
-
schema:
|
|
264
|
-
enabled: true
|
|
265
|
-
file: BACKEND_SCHEMA.mjs
|
|
266
|
-
mode: strict # or template_only
|
|
267
|
-
```
|
|
268
|
-
|
|
269
|
-
**For mature teams → `mode: strict`**
|
|
270
|
-
- ✅ Cerber NEVER creates schema file
|
|
271
|
-
- ✅ You create schema based on YOUR architecture
|
|
272
|
-
- ✅ Full control, no helpers, no assumptions
|
|
273
|
-
- ✅ `npx cerber init` shows: "You must create BACKEND_SCHEMA.mjs"
|
|
274
|
-
|
|
275
|
-
**For beginners → `mode: template_only`**
|
|
276
|
-
- ✅ Cerber creates minimal template if file missing
|
|
277
|
-
- ⚠️ Template says: "NOT SOURCE OF TRUTH - Edit to match CERBER.md"
|
|
278
|
-
- ✅ Empty structures, commented examples only
|
|
279
|
-
- ✅ Helper scaffold, NOT design decision
|
|
280
|
-
|
|
281
|
-
**Default:** `template_only` (backward compatible)
|
|
133
|
+
## 🔗 Links
|
|
282
134
|
|
|
283
|
-
**
|
|
284
|
-
|
|
285
|
-
|
|
286
|
-
|
|
287
|
-
|
|
288
|
-
→ Assume folder structures
|
|
289
|
-
→ "Helpful" magic that creates chaos
|
|
290
|
-
|
|
291
|
-
Cerber Core:
|
|
292
|
-
→ Execute CERBER.md contract
|
|
293
|
-
→ Never assume architecture
|
|
294
|
-
→ One decision point (CERBER.md)
|
|
295
|
-
→ Works WITH AI agents, not against them
|
|
296
|
-
```
|
|
297
|
-
|
|
298
|
-
**Why this matters:**
|
|
299
|
-
|
|
300
|
-
When your team (or AI agents) follow ONE source of truth:
|
|
301
|
-
- ✅ No conflicts between "docs" and "reality"
|
|
302
|
-
- ✅ No drift between "schema" and "roadmap"
|
|
303
|
-
- ✅ Clear authority: CERBER.md decides, Cerber enforces
|
|
304
|
-
- ✅ Architecture stays intact as team/AI scales
|
|
305
|
-
|
|
306
|
-
**This is not "another tool". This is a control system.**
|
|
135
|
+
- **Repository:** https://github.com/Agaslez/cerber-core
|
|
136
|
+
- **Releases:** https://github.com/Agaslez/cerber-core/releases
|
|
137
|
+
- **Security Policy:** https://github.com/Agaslez/cerber-core/blob/main/SECURITY.md
|
|
138
|
+
- **Discussions:** https://github.com/Agaslez/cerber-core/discussions
|
|
139
|
+
- **Full Documentation:** [docs/README_LONG.md](docs/README_LONG.md)
|
|
307
140
|
|
|
308
141
|
---
|
|
309
142
|
|
|
310
|
-
##
|
|
311
|
-
|
|
312
|
-
### 30-Second Setup ⚡ (New in v1.1.0!)
|
|
313
|
-
|
|
314
|
-
```bash
|
|
315
|
-
npm install cerber-core --save-dev
|
|
316
|
-
npx cerber init
|
|
317
|
-
```
|
|
318
|
-
|
|
319
|
-
**How it works:**
|
|
320
|
-
|
|
321
|
-
**If CERBER.md is missing** → Cerber creates a template and exits.
|
|
322
|
-
|
|
323
|
-
1. Fill the contract (`CERBER_CONTRACT`) with your project settings
|
|
324
|
-
2. Choose mode: `solo` | `dev` | `team`
|
|
325
|
-
3. Enable features: `guardian`, `health`, `ci`
|
|
326
|
-
|
|
327
|
-
**Run `npx cerber init` again** to generate:
|
|
328
|
-
|
|
329
|
-
- ✅ **Guardian hook + runner** - Pre-commit validation
|
|
330
|
-
- ✅ **Health templates** - Production monitoring endpoints
|
|
331
|
-
- ✅ **GitHub Actions workflow** - CI/CD with stable check names
|
|
332
|
-
- ✅ **Team mode: CODEOWNERS** - Schema ownership enforcement
|
|
333
|
-
|
|
334
|
-
**Example CERBER.md:**
|
|
143
|
+
## 📋 Minimal CERBER.md Example
|
|
335
144
|
|
|
336
145
|
```yaml
|
|
337
146
|
## CERBER_CONTRACT
|
|
338
|
-
|
|
147
|
+
\```yaml
|
|
339
148
|
version: 1
|
|
340
|
-
mode:
|
|
149
|
+
mode: solo # solo | dev | team
|
|
341
150
|
|
|
342
151
|
guardian:
|
|
343
152
|
enabled: true
|
|
@@ -346,9 +155,7 @@ guardian:
|
|
|
346
155
|
schema:
|
|
347
156
|
enabled: true
|
|
348
157
|
file: BACKEND_SCHEMA.mjs
|
|
349
|
-
mode:
|
|
350
|
-
# strict = You create schema, Cerber never generates
|
|
351
|
-
# template_only = Cerber creates minimal helper if missing
|
|
158
|
+
mode: strict # Recommended: You create schema, Cerber never generates
|
|
352
159
|
|
|
353
160
|
health:
|
|
354
161
|
enabled: true
|
|
@@ -357,1272 +164,97 @@ health:
|
|
|
357
164
|
ci:
|
|
358
165
|
provider: github
|
|
359
166
|
branches: [main]
|
|
360
|
-
|
|
361
|
-
\`\`\`
|
|
362
|
-
```
|
|
363
|
-
|
|
364
|
-
**Error handling:**
|
|
365
|
-
|
|
366
|
-
If CERBER.md exists but is invalid → you'll get a **clear error message** with:
|
|
367
|
-
- Exact problem location
|
|
368
|
-
- Expected format
|
|
369
|
-
- Suggestion: `npx cerber init --print-template` to see valid example
|
|
370
|
-
|
|
371
|
-
**Useful flags:**
|
|
372
|
-
|
|
373
|
-
```bash
|
|
374
|
-
npx cerber init --dry-run # Preview without creating files
|
|
375
|
-
npx cerber init --force # Overwrite existing files
|
|
376
|
-
npx cerber init --print-template # Print template to stdout
|
|
377
|
-
```
|
|
378
|
-
|
|
379
|
-
**What happens:**
|
|
380
|
-
- ✅ Creates `CERBER.md` with your architecture contract
|
|
381
|
-
- ✅ Generates Guardian pre-commit hooks
|
|
382
|
-
- ✅ Sets up health check templates
|
|
383
|
-
- ✅ Configures GitHub Actions workflow
|
|
384
|
-
- ✅ Adapts to your mode: solo/dev/team
|
|
385
|
-
|
|
386
|
-
**Next step:** Just commit! Guardian now protects your architecture.
|
|
387
|
-
|
|
388
|
-
---
|
|
389
|
-
|
|
390
|
-
### Manual Setup (Alternative)
|
|
391
|
-
|
|
392
|
-
If you prefer manual configuration, follow the guides below.
|
|
393
|
-
|
|
394
|
-
### Installation
|
|
395
|
-
|
|
396
|
-
```bash
|
|
397
|
-
npm install cerber-core --save-dev
|
|
398
|
-
```
|
|
399
|
-
|
|
400
|
-
### Choose Your Path
|
|
401
|
-
|
|
402
|
-
> ⚠️ **Note:** Examples below show common patterns. Copy and **customize to YOUR architecture**. Schema files are templates, not decisions.
|
|
403
|
-
|
|
404
|
-
#### 🎨 **Frontend Developer (React/Vue/Angular)**
|
|
405
|
-
|
|
406
|
-
```bash
|
|
407
|
-
# 1. Initialize Cerber (generates CERBER.md + templates)
|
|
408
|
-
npx cerber init --mode=solo
|
|
409
|
-
|
|
410
|
-
# 2. Customize your schema for frontend
|
|
411
|
-
# Edit BACKEND_SCHEMA.mjs (rename to FRONTEND_SCHEMA.mjs if you prefer)
|
|
412
|
-
|
|
413
|
-
# 3. Test it!
|
|
414
|
-
git commit -m "test"
|
|
415
|
-
# Guardian will validate automatically (<1s)
|
|
416
|
-
```
|
|
417
|
-
|
|
418
|
-
**What Guardian will check:**
|
|
419
|
-
- ❌ No `console.log` in production code
|
|
420
|
-
- ❌ No direct DOM manipulation in React components
|
|
421
|
-
- ✅ Required imports (`react`, `react-dom`)
|
|
422
|
-
- ✅ Required files (`tsconfig.json`, `vite.config.ts`)
|
|
423
|
-
|
|
424
|
-
**Then customize:** Edit BACKEND_SCHEMA.mjs (rename to FRONTEND_SCHEMA.mjs if you prefer) to match YOUR folder structure, YOUR rules, YOUR tech stack.
|
|
425
|
-
|
|
426
|
-
#### ⚙️ **Backend Developer (Node.js/Express/NestJS)**
|
|
427
|
-
|
|
428
|
-
```bash
|
|
429
|
-
# 1. Initialize Cerber (generates CERBER.md + guardian + health templates)
|
|
430
|
-
npx cerber init --mode=dev
|
|
431
|
-
|
|
432
|
-
# 2. Customize BACKEND_SCHEMA.mjs
|
|
433
|
-
# Edit to match YOUR routes, YOUR layers, YOUR security rules
|
|
434
|
-
|
|
435
|
-
# 3. Add health endpoint (see example below)
|
|
436
|
-
```
|
|
437
|
-
|
|
438
|
-
**Then customize:** Edit BACKEND_SCHEMA.mjs to match YOUR routes, YOUR layers, YOUR security rules.
|
|
439
|
-
|
|
440
|
-
```javascript
|
|
441
|
-
// server.js (ESM)
|
|
442
|
-
import express from 'express';
|
|
443
|
-
import { Cerber } from 'cerber-core/cerber';
|
|
444
|
-
|
|
445
|
-
const app = express();
|
|
446
|
-
|
|
447
|
-
// Define health checks
|
|
448
|
-
const databaseCheck = async () => {
|
|
449
|
-
const isHealthy = await db.ping();
|
|
450
|
-
return isHealthy ? [] : [{
|
|
451
|
-
code: 'DB_DOWN',
|
|
452
|
-
severity: 'critical',
|
|
453
|
-
message: 'Database connection failed'
|
|
454
|
-
}];
|
|
455
|
-
};
|
|
456
|
-
|
|
457
|
-
// Create Cerber instance
|
|
458
|
-
const cerber = new Cerber([databaseCheck]);
|
|
459
|
-
|
|
460
|
-
// Health endpoint
|
|
461
|
-
app.get('/api/health', async (req, res) => {
|
|
462
|
-
const result = await cerber.runChecks();
|
|
463
|
-
const statusCode = result.status === 'healthy' ? 200 : 500;
|
|
464
|
-
res.status(statusCode).json(result);
|
|
465
|
-
});
|
|
466
|
-
|
|
467
|
-
app.listen(3000);
|
|
468
|
-
```
|
|
469
|
-
|
|
470
|
-
**What you get:**
|
|
471
|
-
- 🔍 `/api/health` endpoint for monitoring
|
|
472
|
-
- 🚨 Automatic rollback on critical issues
|
|
473
|
-
- 📊 Detailed diagnostics with root cause analysis
|
|
474
|
-
|
|
475
|
-
#### ⚡ **SOLO Developer (Automation Scripts)**
|
|
476
|
-
|
|
477
|
-
```bash
|
|
478
|
-
# Add to package.json
|
|
479
|
-
{
|
|
480
|
-
"scripts": {
|
|
481
|
-
"cerber:morning": "node node_modules/cerber-core/solo/scripts/cerber-morning.js",
|
|
482
|
-
"cerber:repair": "node node_modules/cerber-core/solo/scripts/cerber-auto-repair.js"
|
|
483
|
-
}
|
|
484
|
-
}
|
|
485
|
-
|
|
486
|
-
# Run daily dashboard
|
|
487
|
-
npm run cerber:morning
|
|
488
|
-
|
|
489
|
-
# Auto-fix issues
|
|
490
|
-
npm run cerber:repair --dry-run
|
|
491
|
-
```
|
|
492
|
-
|
|
493
|
-
**What you get:**
|
|
494
|
-
- 🌅 Daily dashboard (vulnerabilities, outdated deps, TODOs)
|
|
495
|
-
- 🔧 Auto-repair (format, sync package-lock, fix imports)
|
|
496
|
-
- 📈 Performance budget checks
|
|
497
|
-
|
|
498
|
-
#### 👥 **TEAM Lead (Focus Mode for Large Codebases)**
|
|
499
|
-
|
|
500
|
-
```bash
|
|
501
|
-
# 1. Setup .cerber structure
|
|
502
|
-
mkdir -p .cerber/modules
|
|
503
|
-
cp -r node_modules/cerber-core/.cerber-example/* .cerber/
|
|
504
|
-
|
|
505
|
-
# 2. Create module
|
|
506
|
-
bash node_modules/cerber-core/team/scripts/cerber-add-module.sh pricing-engine
|
|
507
|
-
|
|
508
|
-
# 3. Generate focus context (500 LOC instead of 10K LOC)
|
|
509
|
-
bash node_modules/cerber-core/team/scripts/cerber-focus.sh pricing-engine
|
|
510
|
-
|
|
511
|
-
# 4. Use with AI
|
|
512
|
-
cat .cerber/FOCUS_CONTEXT.md
|
|
513
|
-
# Share with ChatGPT/Claude - 10x faster responses!
|
|
514
|
-
```
|
|
515
|
-
|
|
516
|
-
**What you get:**
|
|
517
|
-
- 🎯 **500 LOC context** instead of 10,000 LOC (10x faster AI)
|
|
518
|
-
- 🗺️ Module boundaries (clear what belongs where)
|
|
519
|
-
- 🔗 Connection contracts (how modules communicate)
|
|
520
|
-
|
|
521
|
-
### Unified CLI
|
|
522
|
-
|
|
523
|
-
All features available through unified CLI:
|
|
524
|
-
|
|
525
|
-
```bash
|
|
526
|
-
# Doctor - Setup validation (new in v1.1.7)
|
|
527
|
-
npx cerber doctor # Validate CERBER.md, schema, hooks, CI
|
|
528
|
-
|
|
529
|
-
# Guardian - Pre-commit validation
|
|
530
|
-
cerber guardian --schema ./SCHEMA.ts
|
|
531
|
-
|
|
532
|
-
# Cerber - Health checks
|
|
533
|
-
cerber health --checks ./health-checks.ts
|
|
534
|
-
|
|
535
|
-
# SOLO - Daily dashboard
|
|
536
|
-
cerber morning
|
|
537
|
-
|
|
538
|
-
# SOLO - Auto-repair
|
|
539
|
-
cerber repair --dry-run
|
|
540
|
-
|
|
541
|
-
# TEAM - Focus mode
|
|
542
|
-
cerber focus pricing-engine
|
|
543
|
-
|
|
544
|
-
# Or use dedicated commands
|
|
545
|
-
cerber-guardian
|
|
546
|
-
cerber-health
|
|
547
|
-
cerber-morning
|
|
548
|
-
|
|
549
|
-
cerber-repair
|
|
550
|
-
cerber-focus
|
|
551
|
-
```
|
|
552
|
-
|
|
553
|
-
---
|
|
554
|
-
|
|
555
|
-
## 🩺 npx cerber doctor (New in v1.1.7)
|
|
556
|
-
|
|
557
|
-
Validate your Cerber setup before commits or deploys:
|
|
558
|
-
|
|
559
|
-
```bash
|
|
560
|
-
npx cerber doctor
|
|
561
|
-
```
|
|
562
|
-
|
|
563
|
-
**Exit codes:**
|
|
564
|
-
- `0` ✅ All checks pass
|
|
565
|
-
- `2` ❌ Missing CERBER.md
|
|
566
|
-
- `3` ❌ Missing schema (strict mode only)
|
|
567
|
-
- `4` ❌ Missing pre-commit hook or CI workflow
|
|
568
|
-
|
|
569
|
-
**What it checks:**
|
|
570
|
-
- CERBER.md present + valid YAML
|
|
571
|
-
- Schema file exists (if `schema.mode: strict`)
|
|
572
|
-
- `.husky/pre-commit` hook installed (if `guardian.enabled: true`)
|
|
573
|
-
- GitHub Actions workflow present (if `ci.provider: github`)
|
|
574
|
-
- Emergency override state (DISABLED | ACTIVE | EXPIRED | INVALID)
|
|
575
|
-
|
|
576
|
-
**Example output:**
|
|
577
|
-
|
|
578
|
-
```
|
|
579
|
-
🩺 Cerber Doctor - Setup Validation
|
|
580
|
-
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
|
|
581
|
-
|
|
582
|
-
✓ CERBER.md: Found and valid
|
|
583
|
-
✓ Schema: BACKEND_SCHEMA.mjs exists
|
|
584
|
-
✓ Pre-commit hook: Installed (.husky/pre-commit)
|
|
585
|
-
✓ CI workflow: Found (.github/workflows/cerber.yml)
|
|
586
|
-
Override: DISABLED
|
|
587
|
-
|
|
588
|
-
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
|
|
589
|
-
✅ All checks passed (exit 0)
|
|
590
|
-
```
|
|
591
|
-
|
|
592
|
-
**Use in CI:**
|
|
593
|
-
|
|
594
|
-
```yaml
|
|
595
|
-
- name: Validate Cerber setup
|
|
596
|
-
run: npx cerber doctor
|
|
167
|
+
\```
|
|
597
168
|
```
|
|
598
169
|
|
|
599
|
-
|
|
600
|
-
|
|
601
|
-
|
|
602
|
-
|
|
603
|
-
## ⚠️ Important: Schema Files Are NOT Source of Truth
|
|
604
|
-
|
|
605
|
-
Before diving into examples below, understand this:
|
|
606
|
-
|
|
607
|
-
**📋 Schema files (BACKEND_SCHEMA.mjs, FRONTEND_SCHEMA.mjs):**
|
|
608
|
-
- Are **examples** and **optional templates**
|
|
609
|
-
- Mirror YOUR architecture decisions from CERBER.md
|
|
610
|
-
- Are user-owned and user-created (in strict mode)
|
|
611
|
-
- Should be customized to YOUR project structure
|
|
612
|
-
|
|
613
|
-
**📜 CERBER.md:**
|
|
614
|
-
- Is the ONLY source of truth
|
|
615
|
-
- Defines your roadmap, rules, team mode
|
|
616
|
-
- Controls if/how Cerber helps with schema generation
|
|
617
|
-
|
|
618
|
-
**Cerber does NOT design your system. The examples below show patterns - YOU decide which patterns fit YOUR architecture.**
|
|
170
|
+
**Schema modes:**
|
|
171
|
+
- `strict` (recommended) → You design architecture, Cerber guards it
|
|
172
|
+
- `template_only` → Helper scaffold for beginners (NOT design decisions)
|
|
619
173
|
|
|
620
174
|
---
|
|
621
175
|
|
|
622
|
-
|
|
623
|
-
|
|
624
|
-
**1. Create architecture schema:**
|
|
625
|
-
|
|
626
|
-
```javascript
|
|
627
|
-
// BACKEND_SCHEMA.mjs
|
|
628
|
-
export const BACKEND_SCHEMA = {
|
|
629
|
-
version: '1.0.0',
|
|
630
|
-
rules: [
|
|
631
|
-
{
|
|
632
|
-
name: 'Route files must import Router from express',
|
|
633
|
-
pattern: /routes\/.*\.ts$/,
|
|
634
|
-
requiredImports: ['Router', 'express'],
|
|
635
|
-
severity: 'error'
|
|
636
|
-
},
|
|
637
|
-
{
|
|
638
|
-
name: 'Protected routes must use authenticateToken',
|
|
639
|
-
pattern: /routes\/.*\.ts$/,
|
|
640
|
-
requiredImports: ['authenticateToken'],
|
|
641
|
-
exceptions: ['routes/public.ts'],
|
|
642
|
-
severity: 'error'
|
|
643
|
-
}
|
|
644
|
-
]
|
|
645
|
-
};
|
|
646
|
-
```
|
|
647
|
-
|
|
648
|
-
**2. Add pre-commit hook:**
|
|
649
|
-
|
|
650
|
-
```bash
|
|
651
|
-
# Pre-commit hook is automatically installed by npx cerber init
|
|
652
|
-
# Or manually:
|
|
653
|
-
npx husky add .husky/pre-commit "npm run cerber:guardian"
|
|
654
|
-
```
|
|
655
|
-
|
|
656
|
-
**3. Done!** Guardian now blocks commits that violate architecture rules.
|
|
657
|
-
|
|
658
|
-
### Cerber Setup (2 minutes)
|
|
659
|
-
|
|
660
|
-
**1. Add health endpoint:**
|
|
661
|
-
|
|
662
|
-
```typescript
|
|
663
|
-
// server.ts
|
|
664
|
-
import { createHealthEndpoint } from 'cerber-core';
|
|
176
|
+
## 📚 Documentation
|
|
665
177
|
|
|
666
|
-
|
|
667
|
-
|
|
668
|
-
|
|
669
|
-
|
|
670
|
-
|
|
671
|
-
|
|
672
|
-
|
|
673
|
-
|
|
674
|
-
|
|
675
|
-
};
|
|
178
|
+
**Quick Links:**
|
|
179
|
+
- [📖 Full Documentation (Long README)](docs/README_LONG.md)
|
|
180
|
+
- [🛡️ Guardian API](docs/GUARDIAN.md) - Pre-commit validation
|
|
181
|
+
- [🔍 Cerber API](docs/CERBER.md) - Runtime health checks
|
|
182
|
+
- [⚡ SOLO Layer](docs/SOLO.md) - Automation for solo developers (666 LOC)
|
|
183
|
+
- [👥 TEAM Layer](docs/TEAM.md) - Focus Mode + module system (1861 LOC)
|
|
184
|
+
- [🏗️ Architecture](docs/ARCHITECTURE.md) - System design philosophy
|
|
185
|
+
- [🔐 Security Policy](SECURITY.md) - Supply-chain security, vulnerability reporting
|
|
186
|
+
- [🤝 Contributing](CONTRIBUTING.md) - How to contribute
|
|
676
187
|
|
|
677
|
-
|
|
678
|
-
|
|
679
|
-
|
|
680
|
-
|
|
681
|
-
|
|
682
|
-
```bash
|
|
683
|
-
curl https://your-api.com/api/health
|
|
684
|
-
```
|
|
188
|
+
**Workflows by Team Size:**
|
|
189
|
+
- [Solo Developer](docs/workflows/solo-developer.md) - 1 person, 15min setup
|
|
190
|
+
- [Small Team (2-5)](docs/workflows/small-team.md) - Module system, 1-2h setup
|
|
191
|
+
- [Growing Team (5-20)](docs/workflows/growing-team.md) - Architecture governance
|
|
685
192
|
|
|
686
|
-
|
|
687
|
-
|
|
688
|
-
|
|
689
|
-
|
|
690
|
-
|
|
691
|
-
|
|
692
|
-
"criticalIssues": 0,
|
|
693
|
-
"errorIssues": 0,
|
|
694
|
-
"warningIssues": 0
|
|
695
|
-
},
|
|
696
|
-
"components": [
|
|
697
|
-
{
|
|
698
|
-
"name": "database",
|
|
699
|
-
"status": "healthy",
|
|
700
|
-
"durationMs": 12.4
|
|
701
|
-
}
|
|
702
|
-
]
|
|
703
|
-
}
|
|
704
|
-
```
|
|
193
|
+
**Examples:**
|
|
194
|
+
- [Frontend Schema (React)](examples/frontend-schema.ts)
|
|
195
|
+
- [Backend Schema (Express)](examples/backend-schema.ts)
|
|
196
|
+
- [Health Checks](examples/health-checks.ts)
|
|
197
|
+
- [SOLO Integration](examples/solo-integration/)
|
|
198
|
+
- [TEAM Integration](examples/team-integration/)
|
|
705
199
|
|
|
706
200
|
---
|
|
707
201
|
|
|
708
|
-
## ✨ Features
|
|
202
|
+
## ✨ Key Features
|
|
709
203
|
|
|
710
204
|
### Guardian 1.0 (Pre-commit)
|
|
711
|
-
|
|
712
|
-
-
|
|
713
|
-
-
|
|
714
|
-
-
|
|
715
|
-
- ✅ **Architect approvals** - Traceable exceptions with justification
|
|
716
|
-
- ✅ **Framework-agnostic** - Works with Express, Fastify, NestJS
|
|
717
|
-
- ✅ **Zero CI waste** - No more failed pipelines from trivial errors
|
|
205
|
+
- Schema-as-Code (architecture rules in version control)
|
|
206
|
+
- Fast feedback (<1s validation vs 5min CI wait)
|
|
207
|
+
- Required imports + forbidden patterns
|
|
208
|
+
- Architect approvals (traceable exceptions)
|
|
718
209
|
|
|
719
210
|
### Cerber 2.1 (Runtime)
|
|
211
|
+
- Detailed diagnostics (diagnosis + rootCause + fix)
|
|
212
|
+
- Severity levels (critical/error/warning)
|
|
213
|
+
- Component-based health checks
|
|
214
|
+
- Performance tracking
|
|
720
215
|
|
|
721
|
-
|
|
722
|
-
-
|
|
723
|
-
-
|
|
724
|
-
-
|
|
725
|
-
-
|
|
726
|
-
- ✅ **Integration checks** - External APIs, Cloudinary, Redis, etc.
|
|
727
|
-
|
|
728
|
-
---
|
|
729
|
-
|
|
730
|
-
## 🏗️ Architecture
|
|
731
|
-
|
|
732
|
-
```
|
|
733
|
-
┌─────────────────────────────────────────────────────────┐
|
|
734
|
-
│ DEVELOPER │
|
|
735
|
-
└─────────────────┬───────────────────────────────────────┘
|
|
736
|
-
│
|
|
737
|
-
▼
|
|
738
|
-
┌────────────────┐
|
|
739
|
-
│ git commit │
|
|
740
|
-
└────────┬───────┘
|
|
741
|
-
│
|
|
742
|
-
▼
|
|
743
|
-
┌─────────────────────────┐
|
|
744
|
-
│ 🛡️ Guardian 1.0 │ ◄─── Pre-commit validation
|
|
745
|
-
│ Architecture Validator │
|
|
746
|
-
└─────────┬───────────────┘
|
|
747
|
-
│
|
|
748
|
-
├─ ✅ Pass → Continue
|
|
749
|
-
│
|
|
750
|
-
└─ ❌ Fail → Block commit
|
|
751
|
-
Show diagnostics
|
|
752
|
-
Developer fixes
|
|
753
|
-
|
|
754
|
-
┌────────────────┐
|
|
755
|
-
│ git push │
|
|
756
|
-
└────────┬───────┘
|
|
757
|
-
│
|
|
758
|
-
▼
|
|
759
|
-
┌────────────────┐
|
|
760
|
-
│ CI/CD │
|
|
761
|
-
│ (TypeScript, │
|
|
762
|
-
│ Tests, etc) │
|
|
763
|
-
└────────┬───────┘
|
|
764
|
-
│
|
|
765
|
-
▼
|
|
766
|
-
┌────────────────┐
|
|
767
|
-
│ Deploy │
|
|
768
|
-
└────────┬───────┘
|
|
769
|
-
│
|
|
770
|
-
▼
|
|
771
|
-
┌─────────────────────────┐
|
|
772
|
-
│ 🔍 Cerber 2.1 │ ◄─── Post-deploy validation
|
|
773
|
-
│ Health Diagnostics │
|
|
774
|
-
└─────────┬───────────────┘
|
|
775
|
-
│
|
|
776
|
-
├─ ✅ Healthy → Production OK
|
|
777
|
-
│
|
|
778
|
-
└─ ❌ Degraded → Alert + rollback option
|
|
779
|
-
```
|
|
780
|
-
|
|
781
|
-
---
|
|
782
|
-
|
|
783
|
-
## 📖 Guardian Examples
|
|
784
|
-
|
|
785
|
-
### Example 1: Enforce Express Router in routes
|
|
786
|
-
|
|
787
|
-
```javascript
|
|
788
|
-
// BACKEND_SCHEMA.mjs
|
|
789
|
-
{
|
|
790
|
-
name: 'Route files must import Router',
|
|
791
|
-
pattern: /routes\/.*\.ts$/,
|
|
792
|
-
requiredImports: [
|
|
793
|
-
'import { Router } from "express"',
|
|
794
|
-
'import express'
|
|
795
|
-
],
|
|
796
|
-
severity: 'error'
|
|
797
|
-
}
|
|
798
|
-
```
|
|
799
|
-
|
|
800
|
-
**Before Guardian:**
|
|
801
|
-
```typescript
|
|
802
|
-
// routes/users.ts ❌
|
|
803
|
-
const app = require('express')(); // Wrong pattern!
|
|
804
|
-
app.get('/users', ...);
|
|
805
|
-
```
|
|
806
|
-
|
|
807
|
-
**After Guardian:**
|
|
808
|
-
```typescript
|
|
809
|
-
// routes/users.ts ✅
|
|
810
|
-
import { Router } from 'express';
|
|
811
|
-
const router = Router();
|
|
812
|
-
router.get('/users', ...);
|
|
813
|
-
```
|
|
814
|
-
|
|
815
|
-
### Example 2: Protected routes must have auth middleware
|
|
816
|
-
|
|
817
|
-
```typescript
|
|
818
|
-
{
|
|
819
|
-
name: 'Protected routes require authenticateToken',
|
|
820
|
-
pattern: /routes\/admin\/.*\.ts$/,
|
|
821
|
-
requiredImports: ['authenticateToken'],
|
|
822
|
-
severity: 'error'
|
|
823
|
-
}
|
|
824
|
-
```
|
|
825
|
-
|
|
826
|
-
### Example 3: Architect approval for exceptions
|
|
827
|
-
|
|
828
|
-
```typescript
|
|
829
|
-
// routes/special-case.ts
|
|
830
|
-
// ARCHITECT_APPROVED: Legacy endpoint - migration planned Q2 2026 - Stefan
|
|
831
|
-
import legacyAuth from '../legacy/auth'; // Would normally be blocked
|
|
832
|
-
```
|
|
833
|
-
|
|
834
|
-
---
|
|
835
|
-
|
|
836
|
-
## 📖 Cerber Examples
|
|
837
|
-
|
|
838
|
-
### Example 1: Database health check
|
|
839
|
-
|
|
840
|
-
```typescript
|
|
841
|
-
import { makeIssue } from 'cerber-core';
|
|
842
|
-
|
|
843
|
-
export const databaseCheck = async () => {
|
|
844
|
-
try {
|
|
845
|
-
const result = await db.query('SELECT 1');
|
|
846
|
-
return []; // Healthy
|
|
847
|
-
} catch (err) {
|
|
848
|
-
return [
|
|
849
|
-
makeIssue({
|
|
850
|
-
code: 'DB_CONNECTION_FAILED',
|
|
851
|
-
component: 'database',
|
|
852
|
-
diagnosis: 'Cannot connect to PostgreSQL database',
|
|
853
|
-
rootCause: 'Connection string invalid or DB server down',
|
|
854
|
-
fix: 'Check DATABASE_URL env var and verify DB is running',
|
|
855
|
-
durationMs: 150.5,
|
|
856
|
-
details: { error: err.message }
|
|
857
|
-
})
|
|
858
|
-
];
|
|
859
|
-
}
|
|
860
|
-
};
|
|
861
|
-
```
|
|
862
|
-
|
|
863
|
-
**Response when unhealthy:**
|
|
864
|
-
|
|
865
|
-
```json
|
|
866
|
-
{
|
|
867
|
-
"status": "unhealthy",
|
|
868
|
-
"summary": {
|
|
869
|
-
"criticalIssues": 1,
|
|
870
|
-
"errorIssues": 0,
|
|
871
|
-
"warningIssues": 0
|
|
872
|
-
},
|
|
873
|
-
"components": [
|
|
874
|
-
{
|
|
875
|
-
"id": "DB_CONNECTION_FAILED",
|
|
876
|
-
"component": "database",
|
|
877
|
-
"status": "critical",
|
|
878
|
-
"message": "Cannot connect to PostgreSQL database",
|
|
879
|
-
"diagnosis": "Cannot connect to PostgreSQL database",
|
|
880
|
-
"rootCause": "Connection string invalid or DB server down",
|
|
881
|
-
"fix": "Check DATABASE_URL env var and verify DB is running",
|
|
882
|
-
"durationMs": 150.5,
|
|
883
|
-
"details": {
|
|
884
|
-
"error": "connect ECONNREFUSED 127.0.0.1:5432"
|
|
885
|
-
}
|
|
886
|
-
}
|
|
887
|
-
]
|
|
888
|
-
}
|
|
889
|
-
```
|
|
890
|
-
|
|
891
|
-
### Example 2: Integration check (Cloudinary)
|
|
892
|
-
|
|
893
|
-
```typescript
|
|
894
|
-
export const cloudinaryCheck = async () => {
|
|
895
|
-
if (!process.env.CLOUDINARY_API_KEY) {
|
|
896
|
-
return [
|
|
897
|
-
makeIssue({
|
|
898
|
-
code: 'CLOUDINARY_NOT_CONFIGURED',
|
|
899
|
-
component: 'cloudinary',
|
|
900
|
-
diagnosis: 'Cloudinary API key not set',
|
|
901
|
-
rootCause: 'Missing CLOUDINARY_API_KEY environment variable',
|
|
902
|
-
fix: 'Add CLOUDINARY_API_KEY to .env file',
|
|
903
|
-
severity: 'warning', // Non-blocking
|
|
904
|
-
durationMs: 0.5
|
|
905
|
-
})
|
|
906
|
-
];
|
|
907
|
-
}
|
|
908
|
-
|
|
909
|
-
const ping = await cloudinary.api.ping();
|
|
910
|
-
return ping.status === 'ok' ? [] : [/* error */];
|
|
911
|
-
};
|
|
912
|
-
```
|
|
913
|
-
|
|
914
|
-
---
|
|
915
|
-
|
|
916
|
-
## 🎛️ Configuration
|
|
917
|
-
|
|
918
|
-
### Guardian Configuration
|
|
919
|
-
|
|
920
|
-
```javascript
|
|
921
|
-
// BACKEND_SCHEMA.mjs
|
|
922
|
-
export const BACKEND_SCHEMA = {
|
|
923
|
-
version: '1.0.0',
|
|
924
|
-
|
|
925
|
-
// Forbidden patterns (will block commit)
|
|
926
|
-
forbiddenPatterns: [
|
|
927
|
-
{ pattern: /console\.log/gi, name: 'CONSOLE_LOG' },
|
|
928
|
-
{ pattern: /debugger;/gi, name: 'DEBUGGER' },
|
|
929
|
-
{ pattern: /TODO_REMOVE/gi, name: 'TODO_REMOVE' }
|
|
930
|
-
],
|
|
931
|
-
|
|
932
|
-
// Required imports per file pattern
|
|
933
|
-
requiredImports: {
|
|
934
|
-
'src/routes/**/*.ts': [
|
|
935
|
-
'import { Router } from "express"',
|
|
936
|
-
'import { authenticateToken }'
|
|
937
|
-
],
|
|
938
|
-
'src/cerber/**/*.ts': [
|
|
939
|
-
'import { makeIssue, CerberIssueInstance }'
|
|
940
|
-
]
|
|
941
|
-
},
|
|
942
|
-
|
|
943
|
-
// Architecture rules
|
|
944
|
-
rules: [
|
|
945
|
-
{
|
|
946
|
-
name: 'Cerber checks must use shared schema',
|
|
947
|
-
pattern: /cerber\/.*\.ts$/,
|
|
948
|
-
requiredImports: ['import.*shared/schema'],
|
|
949
|
-
forbiddenImports: ['import.*server/db/schema'],
|
|
950
|
-
severity: 'error'
|
|
951
|
-
}
|
|
952
|
-
],
|
|
953
|
-
|
|
954
|
-
// Architect approvals (tracked exceptions)
|
|
955
|
-
approvals: [
|
|
956
|
-
{
|
|
957
|
-
file: 'src/legacy/auth.ts',
|
|
958
|
-
reason: 'Legacy code - migration planned Q2 2026',
|
|
959
|
-
approvedBy: 'Stefan Pitek',
|
|
960
|
-
date: '2026-01-02'
|
|
961
|
-
}
|
|
962
|
-
]
|
|
963
|
-
};
|
|
964
|
-
```
|
|
216
|
+
### SOLO Layer
|
|
217
|
+
- Auto-repair (format, deps, changelog)
|
|
218
|
+
- Performance budget enforcement
|
|
219
|
+
- Daily dashboard
|
|
220
|
+
- Dependency health checks
|
|
965
221
|
|
|
966
|
-
###
|
|
967
|
-
|
|
968
|
-
|
|
969
|
-
|
|
970
|
-
|
|
971
|
-
|
|
972
|
-
export const checks: Record<string, CerberCheck> = {
|
|
973
|
-
database: async () => {
|
|
974
|
-
// Returns: CerberIssueInstance[] (empty if healthy)
|
|
975
|
-
},
|
|
976
|
-
|
|
977
|
-
redis: async () => {
|
|
978
|
-
// Your Redis health check
|
|
979
|
-
},
|
|
980
|
-
|
|
981
|
-
cloudinary: async () => {
|
|
982
|
-
// Your Cloudinary check
|
|
983
|
-
}
|
|
984
|
-
};
|
|
985
|
-
|
|
986
|
-
// Route
|
|
987
|
-
app.get('/api/health', async (req, res) => {
|
|
988
|
-
const results = await Promise.all(
|
|
989
|
-
Object.entries(checks).map(async ([name, check]) => ({
|
|
990
|
-
name,
|
|
991
|
-
issues: await check()
|
|
992
|
-
}))
|
|
993
|
-
);
|
|
994
|
-
|
|
995
|
-
const allIssues = results.flatMap(r => r.issues);
|
|
996
|
-
const critical = allIssues.filter(i => i.severity === 'critical').length;
|
|
997
|
-
const errors = allIssues.filter(i => i.severity === 'error').length;
|
|
998
|
-
const warnings = allIssues.filter(i => i.severity === 'warning').length;
|
|
999
|
-
|
|
1000
|
-
const status = critical > 0 ? 'unhealthy' :
|
|
1001
|
-
errors > 0 ? 'degraded' : 'healthy';
|
|
1002
|
-
|
|
1003
|
-
res.status(status === 'healthy' ? 200 : 503).json({
|
|
1004
|
-
status,
|
|
1005
|
-
summary: { criticalIssues: critical, errorIssues: errors, warningIssues: warnings },
|
|
1006
|
-
components: allIssues
|
|
1007
|
-
});
|
|
1008
|
-
});
|
|
1009
|
-
```
|
|
222
|
+
### TEAM Layer
|
|
223
|
+
- **Focus Mode** (500 LOC context vs 10K LOC for AI) ⭐
|
|
224
|
+
- Module boundaries enforcement
|
|
225
|
+
- Connection contracts between modules
|
|
226
|
+
- CERBER.md project mapping
|
|
1010
227
|
|
|
1011
228
|
---
|
|
1012
229
|
|
|
1013
|
-
##
|
|
230
|
+
## 🚨 Emergency Override
|
|
1014
231
|
|
|
1015
|
-
|
|
232
|
+
For **P0 production hotfixes only**, controlled safety fuse with strict TTL:
|
|
1016
233
|
|
|
1017
234
|
```yaml
|
|
1018
|
-
|
|
1019
|
-
|
|
1020
|
-
|
|
1021
|
-
|
|
1022
|
-
|
|
1023
|
-
- uses: actions/checkout@v4
|
|
1024
|
-
- uses: actions/setup-node@v4
|
|
1025
|
-
- run: npm ci
|
|
1026
|
-
- run: npm run build
|
|
1027
|
-
|
|
1028
|
-
# E2E tests must pass before deploy
|
|
1029
|
-
e2e:
|
|
1030
|
-
needs: build
|
|
1031
|
-
runs-on: ubuntu-latest
|
|
1032
|
-
steps:
|
|
1033
|
-
- run: npm test
|
|
1034
|
-
|
|
1035
|
-
# Deploy only if tests pass
|
|
1036
|
-
deploy:
|
|
1037
|
-
needs: [build, e2e] # ✅ Blocks deploy if E2E fails
|
|
1038
|
-
runs-on: ubuntu-latest
|
|
1039
|
-
steps:
|
|
1040
|
-
- run: echo "Deploying..."
|
|
1041
|
-
|
|
1042
|
-
# Cerber validates production health AFTER deploy
|
|
1043
|
-
cerber-gatekeeper:
|
|
1044
|
-
needs: deploy
|
|
1045
|
-
runs-on: ubuntu-latest
|
|
1046
|
-
steps:
|
|
1047
|
-
- name: Wait for deployment
|
|
1048
|
-
run: sleep 90
|
|
1049
|
-
|
|
1050
|
-
- name: Check production health
|
|
1051
|
-
run: |
|
|
1052
|
-
RESPONSE=$(curl -s https://api.example.com/api/health)
|
|
1053
|
-
ERRORS=$(echo "$RESPONSE" | jq '.summary.errorIssues')
|
|
1054
|
-
|
|
1055
|
-
if [[ "$ERRORS" != "0" ]]; then
|
|
1056
|
-
echo "❌ DEPLOYMENT BLOCKED - Health check failed"
|
|
1057
|
-
exit 1
|
|
1058
|
-
fi
|
|
1059
|
-
|
|
1060
|
-
echo "✅ Production healthy"
|
|
1061
|
-
```
|
|
1062
|
-
|
|
1063
|
-
---
|
|
1064
|
-
|
|
1065
|
-
## 📊 Real-world Impact
|
|
1066
|
-
|
|
1067
|
-
### Case Study: Eliksir Backend (January 2, 2026)
|
|
1068
|
-
|
|
1069
|
-
**Session timeline:**
|
|
1070
|
-
|
|
1071
|
-
```yaml
|
|
1072
|
-
Problems encountered:
|
|
1073
|
-
- 35 TypeScript compilation errors
|
|
1074
|
-
- Schema sync mismatch (shared vs server/db/schema)
|
|
1075
|
-
- node-fetch ESM compatibility issue
|
|
1076
|
-
- Missing is_active column in production
|
|
1077
|
-
- 14/19 E2E tests failing (cold start)
|
|
1078
|
-
- Workflow security gap (deploy before E2E)
|
|
1079
|
-
- Cloudinary blocking deployment
|
|
1080
|
-
- API format mismatch (Cerber 2.0 → 2.1)
|
|
1081
|
-
|
|
1082
|
-
Time to resolution:
|
|
1083
|
-
WITHOUT Guardian + Cerber: 80 minutes (estimated)
|
|
1084
|
-
WITH Guardian + Cerber: 32 minutes (actual)
|
|
1085
|
-
|
|
1086
|
-
Time saved: 48 minutes (60% reduction)
|
|
1087
|
-
|
|
1088
|
-
Issues caught pre-commit: 35 (TypeScript, imports, patterns)
|
|
1089
|
-
Issues caught post-deploy: 1 (Cloudinary severity)
|
|
1090
|
-
Production incidents prevented: 2 (schema mismatch, missing column)
|
|
1091
|
-
|
|
1092
|
-
ROI: 2.5x time saved on first day of use
|
|
1093
|
-
```
|
|
1094
|
-
|
|
1095
|
-
**Developer experience:**
|
|
1096
|
-
|
|
1097
|
-
```diff
|
|
1098
|
-
- ❌ Push → Wait 5 min → CI fails → Fix → Repeat 6x
|
|
1099
|
-
+ ✅ Commit blocked instantly → Fix → Commit passes → Deploy once
|
|
1100
|
-
```
|
|
1101
|
-
|
|
1102
|
-
---
|
|
1103
|
-
|
|
1104
|
-
## 🤝 Contributing
|
|
1105
|
-
|
|
1106
|
-
Contributions welcome! Please:
|
|
1107
|
-
|
|
1108
|
-
1. Fork the repo
|
|
1109
|
-
2. Create feature branch (`git checkout -b feature/amazing`)
|
|
1110
|
-
3. Commit with Guardian validation (`git commit -m 'feat: add amazing feature'`)
|
|
1111
|
-
4. Push (`git push origin feature/amazing`)
|
|
1112
|
-
5. Open Pull Request
|
|
1113
|
-
|
|
1114
|
-
**Development setup:**
|
|
1115
|
-
|
|
1116
|
-
```bash
|
|
1117
|
-
git clone https://github.com/Agaslez/cerber-core.git
|
|
1118
|
-
cd cerber-core
|
|
1119
|
-
npm install
|
|
1120
|
-
npm run test
|
|
1121
|
-
```
|
|
1122
|
-
|
|
1123
|
-
---
|
|
1124
|
-
|
|
1125
|
-
## 🗺️ Roadmap
|
|
1126
|
-
|
|
1127
|
-
### v1.1 (Q1 2026)
|
|
1128
|
-
- [ ] TypeScript full type definitions
|
|
1129
|
-
- [ ] Jest integration (run checks in tests)
|
|
1130
|
-
- [ ] VS Code extension (real-time validation)
|
|
1131
|
-
- [ ] npm package publication
|
|
1132
|
-
|
|
1133
|
-
### v1.2 (Q2 2026)
|
|
1134
|
-
- [ ] Slack/Discord notifications
|
|
1135
|
-
- [ ] Grafana dashboard integration
|
|
1136
|
-
- [ ] Auto-remediation for common issues
|
|
1137
|
-
- [ ] Multi-language support (Python, Go, Java)
|
|
1138
|
-
|
|
1139
|
-
### v2.0 (Q3 2026)
|
|
1140
|
-
- [ ] AI-powered diagnostics (suggest fixes)
|
|
1141
|
-
- [ ] Historical health trends
|
|
1142
|
-
- [ ] Load testing integration
|
|
1143
|
-
- [ ] Kubernetes operator
|
|
1144
|
-
|
|
1145
|
-
---
|
|
1146
|
-
|
|
1147
|
-
## 📚 Resources
|
|
1148
|
-
|
|
1149
|
-
- **Documentation:** https://github.com/Agaslez/cerber-core/wiki
|
|
1150
|
-
- **Examples:** https://github.com/Agaslez/cerber-core/tree/main/examples
|
|
1151
|
-
- **Issues:** https://github.com/Agaslez/cerber-core/issues
|
|
1152
|
-
- **Discussions:** https://github.com/Agaslez/cerber-core/discussions
|
|
1153
|
-
|
|
1154
|
-
---
|
|
1155
|
-
|
|
1156
|
-
## 📄 License
|
|
1157
|
-
|
|
1158
|
-
MIT © 2026 Stefan Pitek
|
|
1159
|
-
|
|
1160
|
-
---
|
|
1161
|
-
|
|
1162
|
-
## 🌟 Show Your Support
|
|
1163
|
-
|
|
1164
|
-
If Cerber Core saved you time, give it a ⭐ on GitHub!
|
|
1165
|
-
|
|
1166
|
-
**Built with ❤️ by Stefan Pitek**
|
|
1167
|
-
|
|
1168
|
-
---
|
|
1169
|
-
|
|
1170
|
-
## 🔗 Related Projects
|
|
1171
|
-
|
|
1172
|
-
- [Husky](https://github.com/typicode/husky) - Git hooks made easy
|
|
1173
|
-
- [lint-staged](https://github.com/okonet/lint-staged) - Run linters on staged files
|
|
1174
|
-
- [ArchUnit](https://www.archunit.org/) - Architecture testing (Java)
|
|
1175
|
-
- [express-healthcheck](https://github.com/lennym/express-healthcheck) - Basic health checks
|
|
1176
|
-
|
|
1177
|
-
**What makes Cerber Core unique?**
|
|
1178
|
-
|
|
1179
|
-
- 🆕 Dual-layer protection (pre-commit + runtime)
|
|
1180
|
-
- 🆕 Detailed diagnostics (not just status codes)
|
|
1181
|
-
- 🆕 Architect approval system
|
|
1182
|
-
- 🆕 Schema-as-Code architecture
|
|
1183
|
-
- 🆕 Framework-agnostic
|
|
1184
|
-
|
|
1185
|
-
---
|
|
1186
|
-
|
|
1187
|
-
## 🆕 Cerber SOLO - Automation for Solo Developers
|
|
1188
|
-
|
|
1189
|
-
**New in v2.0:** Cerber SOLO extends Guardian + Cerber with automation tools for solo developers.
|
|
1190
|
-
|
|
1191
|
-
### What's New
|
|
1192
|
-
|
|
1193
|
-
- **Auto-repair** - Fixes package.json, .env.example, CHANGELOG automatically
|
|
1194
|
-
- **Performance budget** - Enforces bundle size limits
|
|
1195
|
-
- **Dependency health** - Weekly security & deprecation checks
|
|
1196
|
-
- **Documentation sync** - Validates code vs docs
|
|
1197
|
-
- **Feature flags** - Toggle features without redeploy
|
|
1198
|
-
- **Daily dashboard** - Morning health overview
|
|
1199
|
-
- **Smart rollback** - Surgical file rollback
|
|
1200
|
-
|
|
1201
|
-
[📖 Read SOLO documentation](docs/SOLO.md)
|
|
1202
|
-
|
|
1203
|
-
### Quick Start (SOLO)
|
|
1204
|
-
|
|
1205
|
-
```bash
|
|
1206
|
-
# Install SOLO tools (already included in cerber-core)
|
|
1207
|
-
npm install cerber-core --save-dev
|
|
1208
|
-
|
|
1209
|
-
# Add SOLO scripts to package.json
|
|
1210
|
-
# (See examples/solo-integration/package.json)
|
|
1211
|
-
|
|
1212
|
-
# Daily workflow
|
|
1213
|
-
npm run cerber:morning # Start day (2 min)
|
|
1214
|
-
npm run cerber:repair # Auto-fix issues
|
|
1215
|
-
npm run cerber:pre-push # Before push (3 min)
|
|
1216
|
-
npm run cerber:snapshot # End of day
|
|
1217
|
-
```
|
|
1218
|
-
|
|
1219
|
-
### SOLO + Guardian Integration
|
|
1220
|
-
|
|
1221
|
-
Cerber SOLO works **alongside** your existing Guardian setup:
|
|
1222
|
-
|
|
1223
|
-
```
|
|
1224
|
-
Morning:
|
|
1225
|
-
npm run cerber:morning # SOLO dashboard
|
|
1226
|
-
|
|
1227
|
-
Development:
|
|
1228
|
-
git commit # Guardian validates (pre-commit)
|
|
1229
|
-
npm run cerber:repair # SOLO auto-fixes
|
|
1230
|
-
|
|
1231
|
-
Before Push:
|
|
1232
|
-
npm run cerber:pre-push # SOLO full check
|
|
1233
|
-
|
|
1234
|
-
Deploy:
|
|
1235
|
-
curl /api/health # Cerber 2.1 validates
|
|
1236
|
-
```
|
|
1237
|
-
|
|
1238
|
-
[See full integration guide →](examples/solo-integration)
|
|
1239
|
-
|
|
1240
|
-
---
|
|
1241
|
-
|
|
1242
|
-
## 🆕 Cerber TEAM - Team Collaboration Layer
|
|
1243
|
-
|
|
1244
|
-
**New in v2.0:** Cerber TEAM adds module system and focus mode for teams working on large codebases.
|
|
1245
|
-
|
|
1246
|
-
### What's New
|
|
1247
|
-
|
|
1248
|
-
- **Module System** - Clear boundaries between components
|
|
1249
|
-
- **Focus Mode** - AI gets 500 LOC context instead of 10,000 LOC (10x faster)
|
|
1250
|
-
- **Connection Contracts** - Explicit interfaces between modules
|
|
1251
|
-
- **BIBLE.md** - Master project map
|
|
1252
|
-
- **Module Validation** - Enforce boundaries, prevent cross-contamination
|
|
1253
|
-
|
|
1254
|
-
[📖 Read TEAM documentation](docs/TEAM.md)
|
|
1255
|
-
|
|
1256
|
-
### Quick Start (TEAM)
|
|
1257
|
-
|
|
1258
|
-
```bash
|
|
1259
|
-
# Create module
|
|
1260
|
-
bash team/scripts/cerber-add-module.sh pricing-engine
|
|
1261
|
-
|
|
1262
|
-
# Work on module (focus!)
|
|
1263
|
-
bash team/scripts/cerber-focus.sh pricing-engine
|
|
1264
|
-
cat .cerber/FOCUS_CONTEXT.md # Only 500 LOC!
|
|
1265
|
-
|
|
1266
|
-
# Validate
|
|
1267
|
-
bash team/scripts/cerber-module-check.sh pricing-engine
|
|
1268
|
-
bash team/scripts/cerber-connections-check.sh
|
|
1269
|
-
|
|
1270
|
-
# Commit
|
|
1271
|
-
git commit # Guardian validates
|
|
1272
|
-
```
|
|
1273
|
-
|
|
1274
|
-
---
|
|
1275
|
-
|
|
1276
|
-
## 🏆 Why Cerber Core?
|
|
1277
|
-
|
|
1278
|
-
### Unique Innovations
|
|
1279
|
-
|
|
1280
|
-
#### 1. Architect Approval System
|
|
1281
|
-
|
|
1282
|
-
The only pre-commit tool with inline approval tracking:
|
|
1283
|
-
|
|
1284
|
-
```typescript
|
|
1285
|
-
// ❌ Without approval - BLOCKED
|
|
1286
|
-
console.log('debug info');
|
|
1287
|
-
|
|
1288
|
-
// ✅ With approval - ALLOWED + TRACKED
|
|
1289
|
-
// ARCHITECT_APPROVED: Debugging cold start issue - 2026-01-02 - Stefan
|
|
1290
|
-
console.log('debug info');
|
|
1291
|
-
```
|
|
1292
|
-
|
|
1293
|
-
**Benefits:**
|
|
1294
|
-
- Flexibility when rules need exceptions
|
|
1295
|
-
- Inline documentation of why exceptions exist
|
|
1296
|
-
- Audit trail for architecture decisions
|
|
1297
|
-
- Easy cleanup when exceptions no longer needed
|
|
1298
|
-
|
|
1299
|
-
#### 2. Dual-Layer Validation
|
|
1300
|
-
|
|
1301
|
-
```
|
|
1302
|
-
Guardian (pre-commit) → catches 90% of issues
|
|
1303
|
-
↓
|
|
1304
|
-
Cerber (runtime) → catches remaining 10%
|
|
1305
|
-
↓
|
|
1306
|
-
Result: 95%+ detection rate
|
|
1307
|
-
```
|
|
1308
|
-
|
|
1309
|
-
#### 3. Focus Mode for AI ⭐
|
|
1310
|
-
|
|
1311
|
-
**Problem:** AI needs 10,000 LOC of context, making it slow and expensive.
|
|
1312
|
-
|
|
1313
|
-
**Solution:** Generate focused 500 LOC context for specific modules.
|
|
1314
|
-
|
|
1315
|
-
```bash
|
|
1316
|
-
cerber-focus pricing-engine
|
|
1317
|
-
# Generates: .cerber/FOCUS_CONTEXT.md
|
|
1318
|
-
|
|
1319
|
-
# Share with AI instead of entire codebase
|
|
1320
|
-
# Result: 10x faster responses, better accuracy
|
|
1321
|
-
```
|
|
1322
|
-
|
|
1323
|
-
**What's included:**
|
|
1324
|
-
- Module documentation (MODULE.md)
|
|
1325
|
-
- Public interface (contract.json)
|
|
1326
|
-
- Dependencies (dependencies.json)
|
|
1327
|
-
- Related connections
|
|
1328
|
-
- Recent changes
|
|
1329
|
-
|
|
1330
|
-
---
|
|
1331
|
-
|
|
1332
|
-
## � Real-World Examples
|
|
1333
|
-
|
|
1334
|
-
**Want to see Cerber in action?**
|
|
1335
|
-
|
|
1336
|
-
**[→ Real Workflows from Eliksir Project](docs/REAL_WORKFLOWS.md)** ⭐
|
|
1337
|
-
|
|
1338
|
-
Real production session (January 2, 2026) showing:
|
|
1339
|
-
|
|
1340
|
-
- ✅ **Morning routine** - 2 min → complete context (vs 8+ min manual)
|
|
1341
|
-
- ✅ **Auto-repair** - 30 sec → dependencies + format (vs 20 min manual)
|
|
1342
|
-
- ✅ **Focus Mode** - 8s AI response (vs 60s with full codebase)
|
|
1343
|
-
- ✅ **Guardian blocks** - 2 bugs prevented (debug code + missing import)
|
|
1344
|
-
- ✅ **Cerber gatekeeper** - 1 production incident prevented (DB config)
|
|
1345
|
-
- ✅ **Time saved** - 4.5 hours in one day
|
|
1346
|
-
- ✅ **ROI** - 230% on Day 1
|
|
1347
|
-
|
|
1348
|
-
```
|
|
1349
|
-
💰 COST-BENEFIT ANALYSIS
|
|
1350
|
-
|
|
1351
|
-
Setup: 4 hours (one-time)
|
|
1352
|
-
Saved: 1.2 hours + 12 hours (bugs prevented) = 13.2 hours
|
|
1353
|
-
|
|
1354
|
-
ROI = (13.2 - 4) / 4 = 230%
|
|
1355
|
-
Break-even: Day 1 ✅
|
|
1356
|
-
```
|
|
1357
|
-
|
|
1358
|
-
**Workflow Guides by Team Size:**
|
|
1359
|
-
|
|
1360
|
-
- [**Solo Developer**](docs/workflows/solo-developer.md) - 1 person, 15 min setup, 1+ hour saved/day
|
|
1361
|
-
- [**Small Team (2-5)**](docs/workflows/small-team.md) - Module system, 1-2 hours setup, 2-3 hours saved/dev/day
|
|
1362
|
-
- [**Growing Team (5-20)**](docs/workflows/growing-team.md) - Architecture governance, 1-2 days setup, 3-5 hours saved/dev/day
|
|
1363
|
-
|
|
1364
|
-
**Track Your Progress:**
|
|
1365
|
-
|
|
1366
|
-
- [**Monthly Report Template**](docs/MONTHLY_REPORT_TEMPLATE.md) - Track metrics, ROI, wins & learnings
|
|
1367
|
-
|
|
1368
|
-
---
|
|
1369
|
-
|
|
1370
|
-
## �📚 Documentation
|
|
1371
|
-
|
|
1372
|
-
- [**Guardian API Reference**](docs/GUARDIAN.md) - Complete Guardian documentation
|
|
1373
|
-
- [**Cerber API Reference**](docs/CERBER.md) - Runtime health checks guide
|
|
1374
|
-
- [**SOLO Documentation**](docs/SOLO.md) - Automation tools (666 LOC guide)
|
|
1375
|
-
- [**TEAM Documentation**](docs/TEAM.md) - Collaboration layer (1861 LOC guide)
|
|
1376
|
-
- [**Architecture Overview**](docs/ARCHITECTURE.md) - System design & philosophy
|
|
1377
|
-
- [**Contributing Guide**](CONTRIBUTING.md) - How to contribute
|
|
1378
|
-
|
|
1379
|
-
---
|
|
1380
|
-
|
|
1381
|
-
## 💡 Examples
|
|
1382
|
-
|
|
1383
|
-
> ⚠️ **Remember:** Examples show patterns, NOT decisions. Copy and customize to YOUR architecture defined in CERBER.md.
|
|
1384
|
-
|
|
1385
|
-
### Complete Examples in `/examples`
|
|
1386
|
-
|
|
1387
|
-
- [**Frontend (React + Guardian)**](examples/frontend-schema.ts) - React/Vue patterns (customize to your structure)
|
|
1388
|
-
- [**Backend (Express + Cerber)**](examples/backend-schema.ts) - Node.js/Express patterns (customize to your layers)
|
|
1389
|
-
- [**Health Checks**](examples/health-checks.ts) - 6 production-ready checks
|
|
1390
|
-
- [**SOLO Integration**](examples/solo-integration/) - Automation setup
|
|
1391
|
-
- [**TEAM Integration**](examples/team-integration/) - Module system setup
|
|
1392
|
-
|
|
1393
|
-
### Quick Example: Guardian Schema
|
|
1394
|
-
|
|
1395
|
-
```typescript
|
|
1396
|
-
// FRONTEND_SCHEMA.ts
|
|
1397
|
-
export const SCHEMA = {
|
|
1398
|
-
requiredFiles: [
|
|
1399
|
-
'src/lib/config.ts',
|
|
1400
|
-
'package.json',
|
|
1401
|
-
],
|
|
1402
|
-
|
|
1403
|
-
forbiddenPatterns: [
|
|
1404
|
-
{
|
|
1405
|
-
pattern: /console\.log\s*\(/gi,
|
|
1406
|
-
name: 'CONSOLE_LOG',
|
|
1407
|
-
exceptions: ['tests/', '.spec.'],
|
|
1408
|
-
severity: 'warning'
|
|
1409
|
-
},
|
|
1410
|
-
{
|
|
1411
|
-
pattern: /fetch\(/gi,
|
|
1412
|
-
name: 'DIRECT_FETCH',
|
|
1413
|
-
exceptions: ['src/lib/api.ts'],
|
|
1414
|
-
severity: 'error'
|
|
1415
|
-
},
|
|
1416
|
-
],
|
|
1417
|
-
|
|
1418
|
-
requiredImports: {
|
|
1419
|
-
'src/components/Calculator.tsx': [
|
|
1420
|
-
"import { API } from '../lib/config'",
|
|
1421
|
-
],
|
|
1422
|
-
},
|
|
1423
|
-
};
|
|
1424
|
-
```
|
|
1425
|
-
|
|
1426
|
-
### Quick Example: Cerber Health Checks
|
|
1427
|
-
|
|
1428
|
-
```typescript
|
|
1429
|
-
import { makeIssue, CerberCheck } from 'cerber-core/cerber';
|
|
1430
|
-
|
|
1431
|
-
export const checkDatabase: CerberCheck = async (ctx) => {
|
|
1432
|
-
try {
|
|
1433
|
-
await db.query('SELECT 1');
|
|
1434
|
-
return []; // No issues
|
|
1435
|
-
} catch (err) {
|
|
1436
|
-
return [makeIssue({
|
|
1437
|
-
code: 'DB_CONNECTION_FAILED',
|
|
1438
|
-
component: 'Database',
|
|
1439
|
-
severity: 'critical',
|
|
1440
|
-
message: `Cannot connect to database: ${err.message}`,
|
|
1441
|
-
rootCause: err.stack,
|
|
1442
|
-
fix: 'Verify DATABASE_URL and database server status',
|
|
1443
|
-
})];
|
|
1444
|
-
}
|
|
1445
|
-
};
|
|
1446
|
-
```
|
|
1447
|
-
|
|
1448
|
-
---
|
|
1449
|
-
|
|
1450
|
-
## 🚀 Advanced Usage
|
|
1451
|
-
|
|
1452
|
-
### SOLO - Daily Automation
|
|
1453
|
-
|
|
1454
|
-
```bash
|
|
1455
|
-
# Morning routine
|
|
1456
|
-
cerber-morning
|
|
1457
|
-
# Shows:
|
|
1458
|
-
# - Git status
|
|
1459
|
-
# - Dependency health
|
|
1460
|
-
# - Performance metrics
|
|
1461
|
-
# - TODO reminders
|
|
1462
|
-
|
|
1463
|
-
# Auto-repair issues
|
|
1464
|
-
cerber-repair --dry-run # Preview fixes
|
|
1465
|
-
cerber-repair # Apply fixes
|
|
1466
|
-
|
|
1467
|
-
# Dependency health
|
|
1468
|
-
cerber-deps-health
|
|
1469
|
-
# Checks:
|
|
1470
|
-
# - Outdated packages
|
|
1471
|
-
# - Security vulnerabilities
|
|
1472
|
-
# - License compliance
|
|
1473
|
-
|
|
1474
|
-
# Performance budget
|
|
1475
|
-
cerber-performance-budget
|
|
1476
|
-
# Enforces bundle size limits
|
|
1477
|
-
```
|
|
1478
|
-
|
|
1479
|
-
### TEAM - Module System
|
|
1480
|
-
|
|
1481
|
-
```bash
|
|
1482
|
-
# Create new module
|
|
1483
|
-
bash team/scripts/cerber-add-module.sh payment-gateway
|
|
1484
|
-
|
|
1485
|
-
# Work on module (Focus Mode)
|
|
1486
|
-
cerber-focus payment-gateway
|
|
1487
|
-
# Generates .cerber/FOCUS_CONTEXT.md (500 LOC)
|
|
1488
|
-
# Share with AI for 10x faster development
|
|
1489
|
-
|
|
1490
|
-
# Validate module
|
|
1491
|
-
bash team/scripts/cerber-module-check.sh payment-gateway
|
|
1492
|
-
|
|
1493
|
-
# Validate all connections
|
|
1494
|
-
bash team/scripts/cerber-connections-check.sh
|
|
1495
|
-
|
|
1496
|
-
# Morning team briefing
|
|
1497
|
-
bash team/scripts/cerber-team-morning.sh
|
|
1498
|
-
```
|
|
1499
|
-
|
|
1500
|
-
---
|
|
1501
|
-
|
|
1502
|
-
## � Support This Project
|
|
1503
|
-
|
|
1504
|
-
If Cerber Core saved you time, prevented bugs, or improved your codebase quality, consider supporting its development!
|
|
1505
|
-
|
|
1506
|
-
### 🌟 GitHub Sponsors
|
|
1507
|
-
|
|
1508
|
-
<a href="https://github.com/sponsors/Agaslez">
|
|
1509
|
-
<img src="https://img.shields.io/badge/Sponsor-❤️_Sponsor-ea4aaa?style=for-the-badge&logo=github-sponsors&logoColor=white" alt="GitHub Sponsors">
|
|
1510
|
-
</a>
|
|
1511
|
-
|
|
1512
|
-
**Why sponsor?**
|
|
1513
|
-
- ✅ Keeps the project actively maintained
|
|
1514
|
-
- ✅ Funds new features and improvements
|
|
1515
|
-
- ✅ Priority support for sponsors
|
|
1516
|
-
- ✅ Your logo in README (Silver+ tiers)
|
|
1517
|
-
- ✅ Influence development roadmap
|
|
1518
|
-
|
|
1519
|
-
**Sponsorship Tiers:**
|
|
1520
|
-
- **☕ Coffee ($5/month):** Sponsor badge, access to sponsor discussions
|
|
1521
|
-
- **🥉 Bronze ($25/month):** Everything above + small logo in README + priority support (24h)
|
|
1522
|
-
- **🥈 Silver ($100/month):** Everything above + medium logo + priority support (12h) + monthly consultation call
|
|
1523
|
-
- **🥇 Gold ($500/month):** Everything above + large logo (top position) + priority support (4h) + custom feature requests
|
|
1524
|
-
- **💎 Platinum ($2,500/month):** Everything above + dedicated support + weekly calls + custom integrations
|
|
1525
|
-
|
|
1526
|
-
### 💼 Professional Services
|
|
1527
|
-
|
|
1528
|
-
Need help integrating Cerber Core into your organization?
|
|
1529
|
-
|
|
1530
|
-
**Available Services:**
|
|
1531
|
-
- **🎓 Team Training** (5-10 developers): $2,500
|
|
1532
|
-
- Half-day workshop on Guardian, Cerber, and Focus Mode
|
|
1533
|
-
- Best practices for architecture enforcement
|
|
1534
|
-
- Custom schema creation for your stack
|
|
1535
|
-
|
|
1536
|
-
- **💼 Enterprise Integration** (custom pricing)
|
|
1537
|
-
- Full integration with your CI/CD pipeline
|
|
1538
|
-
- Custom health checks for your infrastructure
|
|
1539
|
-
- Team Focus Mode setup and training
|
|
1540
|
-
- Ongoing support and consultation
|
|
1541
|
-
|
|
1542
|
-
- **🚀 1-on-1 Consultation**: $200/hour
|
|
1543
|
-
- Schema design review
|
|
1544
|
-
- Architecture strategy session
|
|
1545
|
-
- Troubleshooting and optimization
|
|
1546
|
-
|
|
1547
|
-
**Contact:** st.pitek@gmail.com
|
|
1548
|
-
|
|
1549
|
-
### ☕ One-Time Donation
|
|
1550
|
-
|
|
1551
|
-
Prefer a one-time contribution? Buy me a coffee!
|
|
1552
|
-
|
|
1553
|
-
<a href="https://www.buymeacoffee.com/stefanpitek">
|
|
1554
|
-
<img src="https://cdn.buymeacoffee.com/buttons/v2/default-yellow.png" height="50" alt="Buy Me A Coffee">
|
|
1555
|
-
</a>
|
|
1556
|
-
|
|
1557
|
-
---
|
|
1558
|
-
|
|
1559
|
-
## 🏢 Sponsors
|
|
1560
|
-
|
|
1561
|
-
### 💎 Platinum Sponsors
|
|
1562
|
-
|
|
1563
|
-
**Become the first Platinum sponsor!** Your logo here + dedicated support.
|
|
1564
|
-
|
|
1565
|
-
### 🥇 Gold Sponsors
|
|
1566
|
-
|
|
1567
|
-
**Become the first Gold sponsor!** Your logo here + priority support + monthly calls.
|
|
1568
|
-
|
|
1569
|
-
### 🥈 Silver Sponsors
|
|
1570
|
-
|
|
1571
|
-
**Become the first Silver sponsor!** Your logo here + priority support.
|
|
1572
|
-
|
|
1573
|
-
### 🥉 Bronze Sponsors
|
|
1574
|
-
|
|
1575
|
-
*Your name here* - Support Cerber Core development!
|
|
1576
|
-
|
|
1577
|
-
---
|
|
1578
|
-
|
|
1579
|
-
## �🔧 Configuration
|
|
1580
|
-
|
|
1581
|
-
### Guardian Configuration
|
|
1582
|
-
|
|
1583
|
-
```typescript
|
|
1584
|
-
// SCHEMA.ts
|
|
1585
|
-
export interface GuardianSchema {
|
|
1586
|
-
requiredFiles?: string[];
|
|
1587
|
-
forbiddenPatterns?: ForbiddenPattern[];
|
|
1588
|
-
requiredImports?: Record<string, string[]>;
|
|
1589
|
-
packageJsonRules?: {
|
|
1590
|
-
requiredScripts?: string[];
|
|
1591
|
-
requiredDependencies?: string[];
|
|
1592
|
-
requiredDevDependencies?: string[];
|
|
1593
|
-
};
|
|
1594
|
-
}
|
|
235
|
+
## CERBER_OVERRIDE
|
|
236
|
+
enabled: true
|
|
237
|
+
reason: "P0 - Payment API down, emergency rollback"
|
|
238
|
+
expires: "2026-01-04T18:00:00Z" # 6-hour TTL
|
|
239
|
+
approvedBy: "CTO Name"
|
|
1595
240
|
```
|
|
1596
241
|
|
|
1597
|
-
|
|
242
|
+
**What Override DOES:**
|
|
243
|
+
- ✅ Allows pre-commit to pass WITH WARNING (audit trail logged)
|
|
244
|
+
- ✅ Can skip postDeploy gate if configured
|
|
1598
245
|
|
|
1599
|
-
|
|
1600
|
-
|
|
1601
|
-
|
|
246
|
+
**What Override NEVER DOES:**
|
|
247
|
+
- ❌ Disable `cerber-integrity` job (self-protection always runs)
|
|
248
|
+
- ❌ Disable entire CI pipeline (build/test/lint must pass)
|
|
249
|
+
- ❌ Disable CODEOWNERS enforcement (team mode)
|
|
1602
250
|
|
|
1603
|
-
|
|
1604
|
-
checkDatabase,
|
|
1605
|
-
checkRedis,
|
|
1606
|
-
checkExternalAPI,
|
|
1607
|
-
checkDiskSpace,
|
|
1608
|
-
checkMemory,
|
|
1609
|
-
];
|
|
1610
|
-
```
|
|
251
|
+
**Use sparingly.** After expiry, guardian proceeds with normal validation.
|
|
1611
252
|
|
|
1612
253
|
---
|
|
1613
254
|
|
|
1614
255
|
## 🤝 Contributing
|
|
1615
256
|
|
|
1616
|
-
|
|
1617
|
-
|
|
1618
|
-
1. **Read** [CONTRIBUTING.md](CONTRIBUTING.md)
|
|
1619
|
-
2. **Fork** the repository
|
|
1620
|
-
3. **Create** a feature branch
|
|
1621
|
-
4. **Make** your changes
|
|
1622
|
-
5. **Test** locally
|
|
1623
|
-
6. **Submit** a pull request
|
|
1624
|
-
|
|
1625
|
-
### Development Setup
|
|
257
|
+
Contributions welcome! Please read [CONTRIBUTING.md](CONTRIBUTING.md) first.
|
|
1626
258
|
|
|
1627
259
|
```bash
|
|
1628
260
|
git clone https://github.com/Agaslez/cerber-core.git
|
|
@@ -1634,260 +266,38 @@ npm test
|
|
|
1634
266
|
|
|
1635
267
|
---
|
|
1636
268
|
|
|
1637
|
-
## � Security
|
|
1638
|
-
|
|
1639
|
-
Security is a top priority for Cerber Core. We take the security of our users seriously.
|
|
1640
|
-
|
|
1641
|
-
### Reporting Security Issues
|
|
1642
|
-
|
|
1643
|
-
**⚠️ DO NOT create public issues for security vulnerabilities.**
|
|
1644
|
-
|
|
1645
|
-
If you discover a security issue, please email: **st.pitek@gmail.com**
|
|
1646
|
-
|
|
1647
|
-
Include:
|
|
1648
|
-
- Description of the vulnerability
|
|
1649
|
-
- Steps to reproduce
|
|
1650
|
-
- Potential impact
|
|
1651
|
-
- Your contact information
|
|
1652
|
-
|
|
1653
|
-
**Response time:** 24-48 hours acknowledgment, 7-14 days for fix.
|
|
1654
|
-
|
|
1655
|
-
---
|
|
1656
|
-
|
|
1657
|
-
## 🚨 Emergency Override (New in v1.1.7)
|
|
1658
|
-
|
|
1659
|
-
For **critical production hotfixes only** (P0 incidents), Cerber provides a **controlled safety fuse** with strict time limits.
|
|
1660
|
-
|
|
1661
|
-
### What Override DOES ✅
|
|
1662
|
-
|
|
1663
|
-
- Allows pre-commit to pass **WITH WARNING** (audit trail logged)
|
|
1664
|
-
- Can skip `postDeploy` gate if configured
|
|
1665
|
-
- Requires: reason, expiry timestamp (TTL), approver name
|
|
1666
|
-
- Automatically expires (guardian validates TTL)
|
|
1667
|
-
|
|
1668
|
-
### What Override NEVER DOES ❌
|
|
1669
|
-
|
|
1670
|
-
Override is a **safety fuse**, NOT a power switch. It **NEVER** disables:
|
|
1671
|
-
|
|
1672
|
-
- ❌ `cerber-integrity` job (self-protection always runs)
|
|
1673
|
-
- ❌ Entire CI pipeline (build, test, lint must pass)
|
|
1674
|
-
- ❌ `cerber-ci` workflow job (contract validation always runs)
|
|
1675
|
-
- ❌ CODEOWNERS enforcement (team mode protection)
|
|
1676
|
-
|
|
1677
|
-
### Example: P0 Hotfix
|
|
1678
|
-
|
|
1679
|
-
```yaml
|
|
1680
|
-
## CERBER_OVERRIDE
|
|
1681
|
-
enabled: true
|
|
1682
|
-
reason: "P0 - Payment API down, emergency rollback required"
|
|
1683
|
-
expires: "2026-01-04T18:00:00Z" # 6-hour TTL
|
|
1684
|
-
approvedBy: "CTO Stefan"
|
|
1685
|
-
```
|
|
1686
|
-
|
|
1687
|
-
**Guardian behavior:**
|
|
1688
|
-
|
|
1689
|
-
```bash
|
|
1690
|
-
git commit -m "fix: rollback payment API to v1.2.3"
|
|
1691
|
-
|
|
1692
|
-
⚠️ CERBER EMERGENCY OVERRIDE ACTIVE
|
|
1693
|
-
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
|
|
1694
|
-
Reason: P0 - Payment API down, emergency rollback required
|
|
1695
|
-
Expires: 2026-01-04T18:00:00Z (5h 23m remaining)
|
|
1696
|
-
Approved: CTO Stefan
|
|
1697
|
-
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
|
|
1698
|
-
Guardian checks: BYPASSED WITH WARNING
|
|
1699
|
-
Self-protection: STILL ACTIVE (cerber-integrity runs)
|
|
1700
|
-
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
|
|
1701
|
-
|
|
1702
|
-
[main 3a7f2e9] fix: rollback payment API to v1.2.3
|
|
1703
|
-
```
|
|
1704
|
-
|
|
1705
|
-
**CI behavior:**
|
|
1706
|
-
|
|
1707
|
-
- ✅ `cerber-integrity` job **runs** (validates CERBER.md, override metadata)
|
|
1708
|
-
- ✅ Build, test, lint jobs **run**
|
|
1709
|
-
- ✅ `cerber-ci` job **runs** (contract validation)
|
|
1710
|
-
- ⚠️ Override warning shown in CI logs (audit trail)
|
|
1711
|
-
|
|
1712
|
-
**After expiry:**
|
|
1713
|
-
|
|
1714
|
-
```bash
|
|
1715
|
-
git commit -m "feat: add new feature"
|
|
1716
|
-
|
|
1717
|
-
❌ CERBER EMERGENCY OVERRIDE EXPIRED
|
|
1718
|
-
Override expired at: 2026-01-04T18:00:00Z
|
|
1719
|
-
Proceeding with normal validation...
|
|
1720
|
-
|
|
1721
|
-
❌ Schema validation failed: Missing type annotation for handlePayment()
|
|
1722
|
-
```
|
|
1723
|
-
|
|
1724
|
-
### Verification
|
|
1725
|
-
|
|
1726
|
-
```bash
|
|
1727
|
-
npx cerber doctor
|
|
1728
|
-
# Shows: Override: ACTIVE (expires 2026-01-04T18:00:00Z)
|
|
1729
|
-
# Or: Override: EXPIRED (expired 2h ago)
|
|
1730
|
-
# Or: Override: DISABLED
|
|
1731
|
-
```
|
|
1732
|
-
|
|
1733
|
-
### Rules
|
|
1734
|
-
|
|
1735
|
-
1. **All fields required:** enabled, reason, expires, approvedBy (missing = invalid = disabled)
|
|
1736
|
-
2. **TTL enforced:** Guardian checks expiry timestamp (expired = proceeds with normal validation)
|
|
1737
|
-
3. **Audit trail:** All commits with active override logged with full metadata
|
|
1738
|
-
4. **No carte blanche:** Hard limits enforced (integrity, CI, CODEOWNERS never bypassed)
|
|
1739
|
-
|
|
1740
|
-
**Use sparingly.** Override is for emergencies, not convenience.
|
|
1741
|
-
|
|
1742
|
-
---
|
|
1743
|
-
|
|
1744
|
-
### Security Features
|
|
1745
|
-
|
|
1746
|
-
✅ **No External Calls:** Guardian and Cerber run locally, no data sent externally
|
|
1747
|
-
✅ **Open Source:** Full transparency - audit the code yourself
|
|
1748
|
-
✅ **No Telemetry:** No tracking, no analytics, no data collection
|
|
1749
|
-
✅ **MIT Licensed:** Safe for commercial use
|
|
1750
|
-
✅ **Supply-Chain Hardened:** 2FA, CI-only publishing, no risky lifecycle scripts (v1.1.7)
|
|
1751
|
-
✅ **Path Safety:** Generator writes only to repo root, whitelist-validated paths (v1.1.7)
|
|
1752
|
-
|
|
1753
|
-
### Best Practices
|
|
1754
|
-
|
|
1755
|
-
- Never commit secrets to schemas (use `process.env`)
|
|
1756
|
-
- Keep `.env` files in `.gitignore`
|
|
1757
|
-
- Update regularly: `npm update cerber-core`
|
|
1758
|
-
- Enable Dependabot for automated security updates
|
|
1759
|
-
- Run `npm audit` regularly
|
|
1760
|
-
- Review CERBER.md changes in PRs (protected by CODEOWNERS in team mode)
|
|
1761
|
-
- Use emergency override sparingly (P0 incidents only)
|
|
1762
|
-
|
|
1763
|
-
**Full security policy:** [SECURITY.md](SECURITY.md) (includes supply-chain security, vulnerability reporting, supported versions)
|
|
1764
|
-
|
|
1765
|
-
---
|
|
1766
|
-
|
|
1767
|
-
## 📄 License
|
|
1768
|
-
|
|
1769
|
-
MIT © 2026 Stefan Pitek
|
|
1770
|
-
|
|
1771
|
-
See [LICENSE](LICENSE) for details.
|
|
1772
|
-
|
|
1773
|
-
### Commercial Use
|
|
1774
|
-
|
|
1775
|
-
Cerber Core is free for commercial use under MIT License. No attribution required (but appreciated!).
|
|
1776
|
-
|
|
1777
|
-
**Need:**
|
|
1778
|
-
- Custom features or private fork support?
|
|
1779
|
-
- Dedicated SLA or priority bug fixes?
|
|
1780
|
-
- On-premises deployment assistance?
|
|
1781
|
-
- Enterprise training and integration?
|
|
1782
|
-
|
|
1783
|
-
**Contact:** st.pitek@gmail.com
|
|
1784
|
-
|
|
1785
|
-
---
|
|
1786
|
-
|
|
1787
|
-
## 🌟 Acknowledgments
|
|
1788
|
-
|
|
1789
|
-
- Inspired by pre-commit framework
|
|
1790
|
-
- Tested in production at Eliksir SaaS
|
|
1791
|
-
- Built with TypeScript + Node.js
|
|
1792
|
-
- Community feedback from 100+ developers
|
|
1793
|
-
|
|
1794
|
-
---
|
|
1795
|
-
|
|
1796
269
|
## 📞 Support
|
|
1797
270
|
|
|
1798
271
|
- 🐛 **Issues:** [GitHub Issues](https://github.com/Agaslez/cerber-core/issues)
|
|
1799
272
|
- 💡 **Discussions:** [GitHub Discussions](https://github.com/Agaslez/cerber-core/discussions)
|
|
273
|
+
- 📖 **Docs:** [Full Documentation](docs/README_LONG.md)
|
|
274
|
+
- 🔐 **Security:** Report vulnerabilities to st.pitek@gmail.com
|
|
1800
275
|
- ⭐ **Repository:** [cerber-core](https://github.com/Agaslez/cerber-core)
|
|
1801
276
|
|
|
1802
277
|
---
|
|
1803
278
|
|
|
1804
|
-
##
|
|
279
|
+
## 📄 License
|
|
1805
280
|
|
|
1806
|
-
|
|
1807
|
-
- [ ] VS Code Extension (visual dashboard)
|
|
1808
|
-
- [ ] GitHub Action (automated checks in CI)
|
|
1809
|
-
- [ ] Slack/Discord notifications
|
|
1810
|
-
- [ ] Web dashboard (React app)
|
|
281
|
+
MIT © 2026 Stefan Pitek
|
|
1811
282
|
|
|
1812
|
-
|
|
1813
|
-
- [ ] Playwright integration (E2E health checks)
|
|
1814
|
-
- [ ] Custom reporter plugins
|
|
1815
|
-
- [ ] Metrics export (Prometheus, DataDog)
|
|
1816
|
-
- [ ] Multi-language support (Python, Go)
|
|
283
|
+
Free for commercial use. See [LICENSE](LICENSE) for details.
|
|
1817
284
|
|
|
1818
285
|
---
|
|
1819
286
|
|
|
1820
|
-
##
|
|
1821
|
-
|
|
1822
|
-
If Cerber saved you time, please give us a star! ⭐
|
|
287
|
+
## 🌟 About
|
|
1823
288
|
|
|
1824
|
-
|
|
289
|
+
Founded by **Agata Ślęzak**, created by **Stefan Pitek**
|
|
1825
290
|
|
|
1826
|
-
|
|
1827
|
-
|
|
1828
|
-
### Integration
|
|
1829
|
-
|
|
1830
|
-
```
|
|
1831
|
-
Morning:
|
|
1832
|
-
npm run cerber:morning # SOLO + TEAM dashboard
|
|
1833
|
-
|
|
1834
|
-
Create module:
|
|
1835
|
-
bash team/scripts/cerber-add-module.sh payment
|
|
1836
|
-
|
|
1837
|
-
Focus mode:
|
|
1838
|
-
bash team/scripts/cerber-focus.sh payment
|
|
1839
|
-
# AI gets FOCUS_CONTEXT.md (500 LOC vs 10,000 LOC)
|
|
1840
|
-
|
|
1841
|
-
Validate:
|
|
1842
|
-
bash team/scripts/cerber-module-check.sh payment
|
|
1843
|
-
bash team/scripts/cerber-connections-check.sh
|
|
1844
|
-
|
|
1845
|
-
Commit:
|
|
1846
|
-
git commit # Guardian validates
|
|
1847
|
-
|
|
1848
|
-
Before push:
|
|
1849
|
-
npm run cerber:pre-push # SOLO checks
|
|
1850
|
-
|
|
1851
|
-
Deploy:
|
|
1852
|
-
curl /api/health # Cerber 2.1 validates
|
|
1853
|
-
```
|
|
291
|
+
Read the full story: [docs/STORY.md](docs/STORY.md)
|
|
1854
292
|
|
|
1855
|
-
|
|
293
|
+
**Support development:** [docs/SPONSORING.md](docs/SPONSORING.md)
|
|
1856
294
|
|
|
1857
295
|
---
|
|
1858
296
|
|
|
1859
297
|
<div align="center">
|
|
1860
298
|
|
|
1861
|
-
**
|
|
299
|
+
⭐ **If Cerber saved you time, give it a star!** ⭐
|
|
1862
300
|
|
|
1863
301
|
Made with 🛡️ by developers, for developers
|
|
1864
302
|
|
|
1865
|
-
---
|
|
1866
|
-
|
|
1867
|
-
## 👥 About the Project
|
|
1868
|
-
|
|
1869
|
-
**Founded by Agata Ślęzak**, created and developed by **Stefan Pitek**
|
|
1870
|
-
|
|
1871
|
-
### 🎯 The Story
|
|
1872
|
-
|
|
1873
|
-
**Stefan Pitek** - Career changer who started coding in May 2025
|
|
1874
|
-
- 30 years professional experience: 12 years banking, 8 years hospitality, 8 years business, 2 years as chef
|
|
1875
|
-
- Co-owned restaurant with Agata
|
|
1876
|
-
- First line of code: May 2025
|
|
1877
|
-
- 8 months later: 3 production SaaS apps + this open-source tool
|
|
1878
|
-
- Built entirely with AI assistance (Claude, ChatGPT, Copilot)
|
|
1879
|
-
|
|
1880
|
-
**Agata Ślęzak** - Business owner and project sponsor
|
|
1881
|
-
- Former restaurant co-owner
|
|
1882
|
-
- Provides business direction and funding
|
|
1883
|
-
- Handles legal and financial aspects
|
|
1884
|
-
- **Most importantly:** Believed in Stefan's potential when he had zero coding experience
|
|
1885
|
-
- Continues to support and encourage through every challenge
|
|
1886
|
-
|
|
1887
|
-
**Partnership:** 90/10 split reflecting business ownership and technical contribution.
|
|
1888
|
-
|
|
1889
|
-
> *"None of this would exist without Agata's unwavering belief and support. When I wrote my first `console.log`, she saw a future developer. Eight months later, here we are."* — Stefan
|
|
1890
|
-
|
|
1891
|
-
**From restaurants to SaaS** - bringing the same attention to quality and customer experience that we learned in hospitality.
|
|
1892
|
-
|
|
1893
303
|
</div>
|