cerber-core 1.1.1 → 1.1.3

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.
@@ -1,132 +1,132 @@
1
- # PROJECT BIBLE - Master Map
2
-
3
- **Project:** Hotel Booking System Example
4
- **Owner:** Stefan Pitek
5
- **Last Updated:** 2026-01-02
6
-
7
- ## Architecture Overview
8
-
9
- ```
10
- ┌─────────────────────────────────────────┐
11
- │ Frontend (React/Next.js) │
12
- │ - Booking UI │
13
- │ - Price Calculator │
14
- └─────────────────┬───────────────────────┘
15
-
16
-
17
- ┌─────────────────────────────────────────┐
18
- │ API Layer (Express) │
19
- │ /api/bookings │
20
- │ /api/pricing │
21
- └─────────────────┬───────────────────────┘
22
-
23
- ┌─────────┼─────────┐
24
- ▼ ▼
25
- pricing-engine booking-calendar
26
- │ │
27
- └─────────┬─────────┘
28
-
29
- PostgreSQL Database
30
- ```
31
-
32
- ## Modules Index
33
-
34
- ### Core Modules
35
-
36
- 1. **pricing-engine** - Dynamic pricing calculation
37
- - Owner: Stefan Pitek
38
- - Status: Active
39
- - Files: `src/modules/pricing-engine/`
40
- - Purpose: Calculate room prices based on date, occupancy, season
41
-
42
- 2. **booking-calendar** - Room availability and reservations
43
- - Owner: Stefan Pitek
44
- - Status: Active
45
- - Files: `src/modules/booking-calendar/`
46
- - Purpose: Manage room bookings and availability
47
-
48
- ## Connections Map
49
-
50
- - `pricing-engine` → `booking-calendar`: checkAvailability()
51
- - `booking-calendar` → `pricing-engine`: calculatePrice()
52
-
53
- ## Team Responsibilities
54
-
55
- - **Stefan Pitek**: pricing-engine, booking-calendar
56
- - **Backend Team**: API layer, database schema
57
- - **Frontend Team**: Booking UI, integration
58
-
59
- ## Module Dependencies
60
-
61
- ```
62
- booking-calendar
63
-
64
- pricing-engine
65
-
66
- database
67
- ```
68
-
69
- ## Tech Stack
70
-
71
- - **Backend**: Node.js, Express, TypeScript
72
- - **Database**: PostgreSQL, Prisma ORM
73
- - **Testing**: Jest, Supertest
74
- - **Validation**: Cerber TEAM module system
75
-
76
- ## Development Workflow
77
-
78
- 1. **Focus Mode**: `bash team/scripts/cerber-focus.sh pricing-engine`
79
- 2. **Validate**: `bash team/scripts/cerber-module-check.sh pricing-engine`
80
- 3. **Check Connections**: `bash team/scripts/cerber-connections-check.sh`
81
- 4. **Commit**: Guardian validates architecture
82
- 5. **Deploy**: Cerber 2.1 validates health
83
-
84
- ## API Endpoints
85
-
86
- ### Pricing
87
- - `GET /api/pricing/calculate` - Calculate room price
88
- - Query: `roomType`, `checkIn`, `checkOut`, `guests`
89
- - Returns: `{ price: number, breakdown: {...} }`
90
-
91
- ### Booking
92
- - `POST /api/bookings` - Create reservation
93
- - Body: `{ roomId, checkIn, checkOut, guestInfo }`
94
- - Returns: `{ bookingId, confirmationCode }`
95
-
96
- - `GET /api/bookings/:id` - Get booking details
97
- - `DELETE /api/bookings/:id` - Cancel booking
98
-
99
- ## Database Schema
100
-
101
- ```sql
102
- -- Rooms
103
- CREATE TABLE rooms (
104
- id SERIAL PRIMARY KEY,
105
- room_number VARCHAR(10) UNIQUE,
106
- room_type VARCHAR(50),
107
- base_price DECIMAL(10,2)
108
- );
109
-
110
- -- Bookings
111
- CREATE TABLE bookings (
112
- id SERIAL PRIMARY KEY,
113
- room_id INTEGER REFERENCES rooms(id),
114
- check_in DATE,
115
- check_out DATE,
116
- guest_name VARCHAR(255),
117
- total_price DECIMAL(10,2),
118
- status VARCHAR(20)
119
- );
120
- ```
121
-
122
- ## Notes
123
-
124
- - Pricing engine uses dynamic pricing algorithm based on:
125
- - Seasonal multipliers (high/low season)
126
- - Day of week (weekends +20%)
127
- - Advance booking discount
128
- - Length of stay discount
129
-
130
- - Booking calendar ensures no double-bookings
131
- - All changes validated by Guardian pre-commit
132
- - Production health monitored by Cerber 2.1
1
+ # PROJECT CERBER - Master Map
2
+
3
+ **Project:** Hotel Booking System Example
4
+ **Owner:** Stefan Pitek
5
+ **Last Updated:** 2026-01-02
6
+
7
+ ## Architecture Overview
8
+
9
+ ```
10
+ ┌─────────────────────────────────────────┐
11
+ │ Frontend (React/Next.js) │
12
+ │ - Booking UI │
13
+ │ - Price Calculator │
14
+ └─────────────────┬───────────────────────┘
15
+
16
+
17
+ ┌─────────────────────────────────────────┐
18
+ │ API Layer (Express) │
19
+ │ /api/bookings │
20
+ │ /api/pricing │
21
+ └─────────────────┬───────────────────────┘
22
+
23
+ ┌─────────┼─────────┐
24
+ ▼ ▼
25
+ pricing-engine booking-calendar
26
+ │ │
27
+ └─────────┬─────────┘
28
+
29
+ PostgreSQL Database
30
+ ```
31
+
32
+ ## Modules Index
33
+
34
+ ### Core Modules
35
+
36
+ 1. **pricing-engine** - Dynamic pricing calculation
37
+ - Owner: Stefan Pitek
38
+ - Status: Active
39
+ - Files: `src/modules/pricing-engine/`
40
+ - Purpose: Calculate room prices based on date, occupancy, season
41
+
42
+ 2. **booking-calendar** - Room availability and reservations
43
+ - Owner: Stefan Pitek
44
+ - Status: Active
45
+ - Files: `src/modules/booking-calendar/`
46
+ - Purpose: Manage room bookings and availability
47
+
48
+ ## Connections Map
49
+
50
+ - `pricing-engine` → `booking-calendar`: checkAvailability()
51
+ - `booking-calendar` → `pricing-engine`: calculatePrice()
52
+
53
+ ## Team Responsibilities
54
+
55
+ - **Stefan Pitek**: pricing-engine, booking-calendar
56
+ - **Backend Team**: API layer, database schema
57
+ - **Frontend Team**: Booking UI, integration
58
+
59
+ ## Module Dependencies
60
+
61
+ ```
62
+ booking-calendar
63
+
64
+ pricing-engine
65
+
66
+ database
67
+ ```
68
+
69
+ ## Tech Stack
70
+
71
+ - **Backend**: Node.js, Express, TypeScript
72
+ - **Database**: PostgreSQL, Prisma ORM
73
+ - **Testing**: Jest, Supertest
74
+ - **Validation**: Cerber TEAM module system
75
+
76
+ ## Development Workflow
77
+
78
+ 1. **Focus Mode**: `bash team/scripts/cerber-focus.sh pricing-engine`
79
+ 2. **Validate**: `bash team/scripts/cerber-module-check.sh pricing-engine`
80
+ 3. **Check Connections**: `bash team/scripts/cerber-connections-check.sh`
81
+ 4. **Commit**: Guardian validates architecture
82
+ 5. **Deploy**: Cerber 2.1 validates health
83
+
84
+ ## API Endpoints
85
+
86
+ ### Pricing
87
+ - `GET /api/pricing/calculate` - Calculate room price
88
+ - Query: `roomType`, `checkIn`, `checkOut`, `guests`
89
+ - Returns: `{ price: number, breakdown: {...} }`
90
+
91
+ ### Booking
92
+ - `POST /api/bookings` - Create reservation
93
+ - Body: `{ roomId, checkIn, checkOut, guestInfo }`
94
+ - Returns: `{ bookingId, confirmationCode }`
95
+
96
+ - `GET /api/bookings/:id` - Get booking details
97
+ - `DELETE /api/bookings/:id` - Cancel booking
98
+
99
+ ## Database Schema
100
+
101
+ ```sql
102
+ -- Rooms
103
+ CREATE TABLE rooms (
104
+ id SERIAL PRIMARY KEY,
105
+ room_number VARCHAR(10) UNIQUE,
106
+ room_type VARCHAR(50),
107
+ base_price DECIMAL(10,2)
108
+ );
109
+
110
+ -- Bookings
111
+ CREATE TABLE bookings (
112
+ id SERIAL PRIMARY KEY,
113
+ room_id INTEGER REFERENCES rooms(id),
114
+ check_in DATE,
115
+ check_out DATE,
116
+ guest_name VARCHAR(255),
117
+ total_price DECIMAL(10,2),
118
+ status VARCHAR(20)
119
+ );
120
+ ```
121
+
122
+ ## Notes
123
+
124
+ - Pricing engine uses dynamic pricing algorithm based on:
125
+ - Seasonal multipliers (high/low season)
126
+ - Day of week (weekends +20%)
127
+ - Advance booking discount
128
+ - Length of stay discount
129
+
130
+ - Booking calendar ensures no double-bookings
131
+ - All changes validated by Guardian pre-commit
132
+ - Production health monitored by Cerber 2.1
@@ -1,200 +1,200 @@
1
- # CERBER LAW - Team Rules
2
-
3
- **Project:** Hotel Booking System
4
- **Version:** 2.0-team
5
- **Last Updated:** 2026-01-02
6
-
7
- ## Core Principles
8
-
9
- 1. **Module Boundaries Are Sacred**
10
- - Modules communicate only through declared contracts
11
- - No direct imports between modules (use public interface)
12
- - All connections must have documented contracts
13
-
14
- 2. **Focus Mode First**
15
- - Always use `cerber-focus.sh` before working on a module
16
- - Share FOCUS_CONTEXT.md with AI instead of entire codebase
17
- - Keep context small and focused
18
-
19
- 3. **Documentation Is Code**
20
- - MODULE.md must be updated with every public interface change
21
- - Connection contracts are versioned
22
- - Breaking changes must be documented
23
-
24
- ## Module Rules
25
-
26
- ### Creating Modules
27
-
28
- ```bash
29
- # Always use the official script
30
- bash team/scripts/cerber-add-module.sh <module-name>
31
-
32
- # Never create modules manually
33
- ```
34
-
35
- ### Module Structure
36
-
37
- Each module MUST have:
38
- - `MODULE.md` - Complete documentation
39
- - `contract.json` - Public interface definition
40
- - `dependencies.json` - List of dependencies
41
-
42
- ### Naming Conventions
43
-
44
- - Module names: `kebab-case` (e.g., `pricing-engine`)
45
- - File names: `camelCase.ts` or `kebab-case.ts`
46
- - Exports: Named exports only (no default exports)
47
-
48
- ## Connection Rules
49
-
50
- ### Creating Connections
51
-
52
- 1. Define interface in both modules
53
- 2. Create connection contract in `.cerber/connections/contracts/`
54
- 3. Version the contract (semver)
55
- 4. Document breaking changes
56
-
57
- ### Connection Contract Template
58
-
59
- ```json
60
- {
61
- "id": "module-a-to-module-b",
62
- "from": "module-a",
63
- "to": "module-b",
64
- "type": "function-call",
65
- "interface": { ... },
66
- "version": "1.0.0",
67
- "breaking_changes": []
68
- }
69
- ```
70
-
71
- ### Breaking Changes
72
-
73
- When making breaking changes:
74
- 1. Increment major version
75
- 2. Add to `breaking_changes` array
76
- 3. Update both modules
77
- 4. Notify team in PR description
78
-
79
- ## Validation Rules
80
-
81
- ### Before Commit
82
-
83
- ```bash
84
- # Validate module
85
- bash team/scripts/cerber-module-check.sh <module-name>
86
-
87
- # Validate all connections
88
- bash team/scripts/cerber-connections-check.sh
89
-
90
- # Guardian validates architecture
91
- git commit
92
- ```
93
-
94
- ### Before PR
95
-
96
- 1. All modules pass validation
97
- 2. All connections valid
98
- 3. BIBLE.md updated
99
- 4. FOCUS_CONTEXT.md generated
100
- 5. Tests pass
101
- 6. Guardian pre-commit passed
102
-
103
- ## Workflow
104
-
105
- ### Daily Start
106
-
107
- ```bash
108
- npm run cerber:morning
109
- # or
110
- bash team/scripts/cerber-team-morning.sh
111
- ```
112
-
113
- ### Working on Module
114
-
115
- ```bash
116
- # 1. Enter focus mode
117
- bash team/scripts/cerber-focus.sh pricing-engine
118
-
119
- # 2. Work on module (share FOCUS_CONTEXT.md with AI)
120
-
121
- # 3. Validate changes
122
- bash team/scripts/cerber-module-check.sh pricing-engine
123
-
124
- # 4. Commit (Guardian validates)
125
- git commit -m "feat(pricing-engine): add seasonal pricing"
126
- ```
127
-
128
- ### Adding Module
129
-
130
- ```bash
131
- # 1. Create module
132
- bash team/scripts/cerber-add-module.sh payment-gateway
133
-
134
- # 2. Edit MODULE.md, contract.json, dependencies.json
135
-
136
- # 3. Enter focus mode
137
- bash team/scripts/cerber-focus.sh payment-gateway
138
-
139
- # 4. Implement module
140
-
141
- # 5. Validate
142
- bash team/scripts/cerber-module-check.sh payment-gateway
143
- ```
144
-
145
- ## Forbidden Practices
146
-
147
- ❌ **DO NOT:**
148
- - Import directly from another module's internals
149
- - Skip module validation before committing
150
- - Modify MODULE.md without updating contract.json
151
- - Create modules without using `cerber-add-module.sh`
152
- - Make breaking changes without versioning
153
- - Work on entire codebase when you could use focus mode
154
-
155
- ✅ **DO:**
156
- - Use focus mode for every module
157
- - Validate before committing
158
- - Document all public interfaces
159
- - Version connection contracts
160
- - Update BIBLE.md with changes
161
- - Follow module boundaries strictly
162
-
163
- ## Integration with Guardian + Cerber
164
-
165
- Cerber TEAM works alongside existing tools:
166
-
167
- ```
168
- Morning:
169
- bash team/scripts/cerber-team-morning.sh (TEAM)
170
-
171
- Development:
172
- bash team/scripts/cerber-focus.sh <module> (TEAM)
173
- git commit (Guardian validates)
174
-
175
- Pre-push:
176
- npm run cerber:pre-push (SOLO checks)
177
-
178
- Deploy:
179
- curl /api/health (Cerber 2.1 validates)
180
- ```
181
-
182
- ## Enforcement
183
-
184
- - **Guardian**: Pre-commit validation of architecture
185
- - **Module Check**: Validates module compliance
186
- - **Connection Check**: Validates contracts
187
- - **Code Review**: Human review of module boundaries
188
- - **CI/CD**: Automated validation on PR
189
-
190
- ## Exceptions
191
-
192
- When you need to break the rules:
193
- 1. Document reason in MODULE.md
194
- 2. Add `ARCHITECT_APPROVED:` comment in code
195
- 3. Create issue to fix properly
196
- 4. Notify team in PR
197
-
198
- ## Contact
199
-
200
- Questions? Contact Stefan Pitek or see [docs/TEAM.md](../../docs/TEAM.md)
1
+ # CERBER LAW - Team Rules
2
+
3
+ **Project:** Hotel Booking System
4
+ **Version:** 2.0-team
5
+ **Last Updated:** 2026-01-02
6
+
7
+ ## Core Principles
8
+
9
+ 1. **Module Boundaries Are Sacred**
10
+ - Modules communicate only through declared contracts
11
+ - No direct imports between modules (use public interface)
12
+ - All connections must have documented contracts
13
+
14
+ 2. **Focus Mode First**
15
+ - Always use `cerber-focus.sh` before working on a module
16
+ - Share FOCUS_CONTEXT.md with AI instead of entire codebase
17
+ - Keep context small and focused
18
+
19
+ 3. **Documentation Is Code**
20
+ - MODULE.md must be updated with every public interface change
21
+ - Connection contracts are versioned
22
+ - Breaking changes must be documented
23
+
24
+ ## Module Rules
25
+
26
+ ### Creating Modules
27
+
28
+ ```bash
29
+ # Always use the official script
30
+ bash team/scripts/cerber-add-module.sh <module-name>
31
+
32
+ # Never create modules manually
33
+ ```
34
+
35
+ ### Module Structure
36
+
37
+ Each module MUST have:
38
+ - `MODULE.md` - Complete documentation
39
+ - `contract.json` - Public interface definition
40
+ - `dependencies.json` - List of dependencies
41
+
42
+ ### Naming Conventions
43
+
44
+ - Module names: `kebab-case` (e.g., `pricing-engine`)
45
+ - File names: `camelCase.ts` or `kebab-case.ts`
46
+ - Exports: Named exports only (no default exports)
47
+
48
+ ## Connection Rules
49
+
50
+ ### Creating Connections
51
+
52
+ 1. Define interface in both modules
53
+ 2. Create connection contract in `.cerber/connections/contracts/`
54
+ 3. Version the contract (semver)
55
+ 4. Document breaking changes
56
+
57
+ ### Connection Contract Template
58
+
59
+ ```json
60
+ {
61
+ "id": "module-a-to-module-b",
62
+ "from": "module-a",
63
+ "to": "module-b",
64
+ "type": "function-call",
65
+ "interface": { ... },
66
+ "version": "1.0.0",
67
+ "breaking_changes": []
68
+ }
69
+ ```
70
+
71
+ ### Breaking Changes
72
+
73
+ When making breaking changes:
74
+ 1. Increment major version
75
+ 2. Add to `breaking_changes` array
76
+ 3. Update both modules
77
+ 4. Notify team in PR description
78
+
79
+ ## Validation Rules
80
+
81
+ ### Before Commit
82
+
83
+ ```bash
84
+ # Validate module
85
+ bash team/scripts/cerber-module-check.sh <module-name>
86
+
87
+ # Validate all connections
88
+ bash team/scripts/cerber-connections-check.sh
89
+
90
+ # Guardian validates architecture
91
+ git commit
92
+ ```
93
+
94
+ ### Before PR
95
+
96
+ 1. All modules pass validation
97
+ 2. All connections valid
98
+ 3. CERBER.md updated
99
+ 4. FOCUS_CONTEXT.md generated
100
+ 5. Tests pass
101
+ 6. Guardian pre-commit passed
102
+
103
+ ## Workflow
104
+
105
+ ### Daily Start
106
+
107
+ ```bash
108
+ npm run cerber:morning
109
+ # or
110
+ bash team/scripts/cerber-team-morning.sh
111
+ ```
112
+
113
+ ### Working on Module
114
+
115
+ ```bash
116
+ # 1. Enter focus mode
117
+ bash team/scripts/cerber-focus.sh pricing-engine
118
+
119
+ # 2. Work on module (share FOCUS_CONTEXT.md with AI)
120
+
121
+ # 3. Validate changes
122
+ bash team/scripts/cerber-module-check.sh pricing-engine
123
+
124
+ # 4. Commit (Guardian validates)
125
+ git commit -m "feat(pricing-engine): add seasonal pricing"
126
+ ```
127
+
128
+ ### Adding Module
129
+
130
+ ```bash
131
+ # 1. Create module
132
+ bash team/scripts/cerber-add-module.sh payment-gateway
133
+
134
+ # 2. Edit MODULE.md, contract.json, dependencies.json
135
+
136
+ # 3. Enter focus mode
137
+ bash team/scripts/cerber-focus.sh payment-gateway
138
+
139
+ # 4. Implement module
140
+
141
+ # 5. Validate
142
+ bash team/scripts/cerber-module-check.sh payment-gateway
143
+ ```
144
+
145
+ ## Forbidden Practices
146
+
147
+ ❌ **DO NOT:**
148
+ - Import directly from another module's internals
149
+ - Skip module validation before committing
150
+ - Modify MODULE.md without updating contract.json
151
+ - Create modules without using `cerber-add-module.sh`
152
+ - Make breaking changes without versioning
153
+ - Work on entire codebase when you could use focus mode
154
+
155
+ ✅ **DO:**
156
+ - Use focus mode for every module
157
+ - Validate before committing
158
+ - Document all public interfaces
159
+ - Version connection contracts
160
+ - Update CERBER.md with changes
161
+ - Follow module boundaries strictly
162
+
163
+ ## Integration with Guardian + Cerber
164
+
165
+ Cerber TEAM works alongside existing tools:
166
+
167
+ ```
168
+ Morning:
169
+ bash team/scripts/cerber-team-morning.sh (TEAM)
170
+
171
+ Development:
172
+ bash team/scripts/cerber-focus.sh <module> (TEAM)
173
+ git commit (Guardian validates)
174
+
175
+ Pre-push:
176
+ npm run cerber:pre-push (SOLO checks)
177
+
178
+ Deploy:
179
+ curl /api/health (Cerber 2.1 validates)
180
+ ```
181
+
182
+ ## Enforcement
183
+
184
+ - **Guardian**: Pre-commit validation of architecture
185
+ - **Module Check**: Validates module compliance
186
+ - **Connection Check**: Validates contracts
187
+ - **Code Review**: Human review of module boundaries
188
+ - **CI/CD**: Automated validation on PR
189
+
190
+ ## Exceptions
191
+
192
+ When you need to break the rules:
193
+ 1. Document reason in MODULE.md
194
+ 2. Add `ARCHITECT_APPROVED:` comment in code
195
+ 3. Create issue to fix properly
196
+ 4. Notify team in PR
197
+
198
+ ## Contact
199
+
200
+ Questions? Contact Stefan Pitek or see [docs/TEAM.md](../../docs/TEAM.md)