chati-dev 1.4.0 → 2.0.1
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 +3 -3
- package/framework/agents/build/dev.md +343 -0
- package/framework/agents/clarity/architect.md +112 -0
- package/framework/agents/clarity/brief.md +182 -0
- package/framework/agents/clarity/brownfield-wu.md +181 -0
- package/framework/agents/clarity/detail.md +110 -0
- package/framework/agents/clarity/greenfield-wu.md +153 -0
- package/framework/agents/clarity/ux.md +112 -0
- package/framework/config.yaml +3 -3
- package/framework/constitution.md +31 -1
- package/framework/context/governance.md +37 -0
- package/framework/context/protocols.md +34 -0
- package/framework/context/quality.md +27 -0
- package/framework/context/root.md +24 -0
- package/framework/domains/agents/architect.yaml +51 -0
- package/framework/domains/agents/brief.yaml +47 -0
- package/framework/domains/agents/brownfield-wu.yaml +49 -0
- package/framework/domains/agents/detail.yaml +47 -0
- package/framework/domains/agents/dev.yaml +49 -0
- package/framework/domains/agents/devops.yaml +43 -0
- package/framework/domains/agents/greenfield-wu.yaml +47 -0
- package/framework/domains/agents/orchestrator.yaml +49 -0
- package/framework/domains/agents/phases.yaml +47 -0
- package/framework/domains/agents/qa-implementation.yaml +43 -0
- package/framework/domains/agents/qa-planning.yaml +44 -0
- package/framework/domains/agents/tasks.yaml +48 -0
- package/framework/domains/agents/ux.yaml +50 -0
- package/framework/domains/constitution.yaml +77 -0
- package/framework/domains/global.yaml +64 -0
- package/framework/domains/workflows/brownfield-discovery.yaml +16 -0
- package/framework/domains/workflows/brownfield-fullstack.yaml +26 -0
- package/framework/domains/workflows/brownfield-service.yaml +22 -0
- package/framework/domains/workflows/brownfield-ui.yaml +22 -0
- package/framework/domains/workflows/greenfield-fullstack.yaml +26 -0
- package/framework/hooks/constitution-guard.js +101 -0
- package/framework/hooks/mode-governance.js +92 -0
- package/framework/hooks/model-governance.js +76 -0
- package/framework/hooks/prism-engine.js +89 -0
- package/framework/hooks/session-digest.js +60 -0
- package/framework/hooks/settings.json +44 -0
- package/framework/migrations/v1.4-to-v2.0.yaml +167 -0
- package/framework/migrations/v2.0-to-v2.0.1.yaml +132 -0
- package/framework/orchestrator/chati.md +284 -6
- package/framework/tasks/architect-api-design.md +63 -0
- package/framework/tasks/architect-consolidate.md +47 -0
- package/framework/tasks/architect-db-design.md +73 -0
- package/framework/tasks/architect-design.md +95 -0
- package/framework/tasks/architect-security-review.md +62 -0
- package/framework/tasks/architect-stack-selection.md +53 -0
- package/framework/tasks/brief-consolidate.md +249 -0
- package/framework/tasks/brief-constraint-identify.md +277 -0
- package/framework/tasks/brief-extract-requirements.md +339 -0
- package/framework/tasks/brief-stakeholder-map.md +176 -0
- package/framework/tasks/brief-validate-completeness.md +121 -0
- package/framework/tasks/brownfield-wu-architecture-map.md +394 -0
- package/framework/tasks/brownfield-wu-deep-discovery.md +312 -0
- package/framework/tasks/brownfield-wu-dependency-scan.md +359 -0
- package/framework/tasks/brownfield-wu-migration-plan.md +483 -0
- package/framework/tasks/brownfield-wu-report.md +325 -0
- package/framework/tasks/brownfield-wu-risk-assess.md +424 -0
- package/framework/tasks/detail-acceptance-criteria.md +372 -0
- package/framework/tasks/detail-consolidate.md +138 -0
- package/framework/tasks/detail-edge-case-analysis.md +300 -0
- package/framework/tasks/detail-expand-prd.md +389 -0
- package/framework/tasks/detail-nfr-extraction.md +223 -0
- package/framework/tasks/dev-code-review.md +404 -0
- package/framework/tasks/dev-consolidate.md +543 -0
- package/framework/tasks/dev-debug.md +322 -0
- package/framework/tasks/dev-implement.md +252 -0
- package/framework/tasks/dev-iterate.md +411 -0
- package/framework/tasks/dev-pr-prepare.md +497 -0
- package/framework/tasks/dev-refactor.md +342 -0
- package/framework/tasks/dev-test-write.md +306 -0
- package/framework/tasks/devops-ci-setup.md +412 -0
- package/framework/tasks/devops-consolidate.md +712 -0
- package/framework/tasks/devops-deploy-config.md +598 -0
- package/framework/tasks/devops-monitoring-setup.md +658 -0
- package/framework/tasks/devops-release-prepare.md +673 -0
- package/framework/tasks/greenfield-wu-analyze-empty.md +169 -0
- package/framework/tasks/greenfield-wu-report.md +266 -0
- package/framework/tasks/greenfield-wu-scaffold-detection.md +203 -0
- package/framework/tasks/greenfield-wu-tech-stack-assess.md +255 -0
- package/framework/tasks/orchestrator-deviation.md +260 -0
- package/framework/tasks/orchestrator-escalate.md +276 -0
- package/framework/tasks/orchestrator-handoff.md +243 -0
- package/framework/tasks/orchestrator-health.md +372 -0
- package/framework/tasks/orchestrator-mode-switch.md +262 -0
- package/framework/tasks/orchestrator-resume.md +189 -0
- package/framework/tasks/orchestrator-route.md +169 -0
- package/framework/tasks/orchestrator-spawn-terminal.md +358 -0
- package/framework/tasks/orchestrator-status.md +260 -0
- package/framework/tasks/orchestrator-suggest-mode.md +372 -0
- package/framework/tasks/phases-breakdown.md +91 -0
- package/framework/tasks/phases-dependency-mapping.md +67 -0
- package/framework/tasks/phases-mvp-scoping.md +94 -0
- package/framework/tasks/qa-impl-consolidate.md +522 -0
- package/framework/tasks/qa-impl-performance-test.md +487 -0
- package/framework/tasks/qa-impl-regression-check.md +413 -0
- package/framework/tasks/qa-impl-sast-scan.md +402 -0
- package/framework/tasks/qa-impl-test-execute.md +344 -0
- package/framework/tasks/qa-impl-verdict.md +339 -0
- package/framework/tasks/qa-planning-consolidate.md +309 -0
- package/framework/tasks/qa-planning-coverage-plan.md +338 -0
- package/framework/tasks/qa-planning-gate-define.md +339 -0
- package/framework/tasks/qa-planning-risk-matrix.md +631 -0
- package/framework/tasks/qa-planning-test-strategy.md +217 -0
- package/framework/tasks/tasks-acceptance-write.md +75 -0
- package/framework/tasks/tasks-consolidate.md +57 -0
- package/framework/tasks/tasks-decompose.md +80 -0
- package/framework/tasks/tasks-estimate.md +66 -0
- package/framework/tasks/ux-a11y-check.md +49 -0
- package/framework/tasks/ux-component-map.md +55 -0
- package/framework/tasks/ux-consolidate.md +46 -0
- package/framework/tasks/ux-user-flow.md +46 -0
- package/framework/tasks/ux-wireframe.md +76 -0
- package/package.json +1 -1
- package/scripts/bundle-framework.js +2 -0
- package/scripts/changelog-generator.js +222 -0
- package/scripts/codebase-mapper.js +728 -0
- package/scripts/commit-message-generator.js +167 -0
- package/scripts/coverage-analyzer.js +260 -0
- package/scripts/dependency-analyzer.js +280 -0
- package/scripts/framework-analyzer.js +308 -0
- package/scripts/generate-constitution-domain.js +253 -0
- package/scripts/health-check.js +481 -0
- package/scripts/ide-sync.js +327 -0
- package/scripts/performance-analyzer.js +325 -0
- package/scripts/plan-tracker.js +278 -0
- package/scripts/populate-entity-registry.js +481 -0
- package/scripts/pr-review.js +317 -0
- package/scripts/rollback-manager.js +310 -0
- package/scripts/stuck-detector.js +343 -0
- package/scripts/test-quality-assessment.js +257 -0
- package/scripts/validate-agents.js +367 -0
- package/scripts/validate-tasks.js +465 -0
- package/src/autonomy/autonomous-gate.js +293 -0
- package/src/autonomy/index.js +51 -0
- package/src/autonomy/mode-manager.js +225 -0
- package/src/autonomy/mode-suggester.js +283 -0
- package/src/autonomy/progress-reporter.js +268 -0
- package/src/autonomy/safety-net.js +320 -0
- package/src/context/bracket-tracker.js +79 -0
- package/src/context/domain-loader.js +107 -0
- package/src/context/engine.js +144 -0
- package/src/context/formatter.js +184 -0
- package/src/context/index.js +4 -0
- package/src/context/layers/l0-constitution.js +28 -0
- package/src/context/layers/l1-global.js +37 -0
- package/src/context/layers/l2-agent.js +39 -0
- package/src/context/layers/l3-workflow.js +42 -0
- package/src/context/layers/l4-task.js +24 -0
- package/src/decision/analyzer.js +167 -0
- package/src/decision/engine.js +270 -0
- package/src/decision/index.js +38 -0
- package/src/decision/registry-healer.js +450 -0
- package/src/decision/registry-updater.js +330 -0
- package/src/gates/circuit-breaker.js +119 -0
- package/src/gates/g1-planning-complete.js +153 -0
- package/src/gates/g2-qa-planning.js +153 -0
- package/src/gates/g3-implementation.js +188 -0
- package/src/gates/g4-qa-implementation.js +207 -0
- package/src/gates/g5-deploy-ready.js +180 -0
- package/src/gates/gate-base.js +144 -0
- package/src/gates/index.js +46 -0
- package/src/installer/brownfield-upgrader.js +249 -0
- package/src/installer/core.js +55 -3
- package/src/installer/file-hasher.js +51 -0
- package/src/installer/manifest.js +117 -0
- package/src/installer/templates.js +17 -15
- package/src/installer/transaction.js +229 -0
- package/src/installer/validator.js +18 -1
- package/src/memory/agent-memory.js +255 -0
- package/src/memory/gotchas-injector.js +72 -0
- package/src/memory/gotchas.js +361 -0
- package/src/memory/index.js +35 -0
- package/src/memory/search.js +233 -0
- package/src/memory/session-digest.js +239 -0
- package/src/merger/env-merger.js +112 -0
- package/src/merger/index.js +56 -0
- package/src/merger/replace-merger.js +51 -0
- package/src/merger/yaml-merger.js +127 -0
- package/src/orchestrator/agent-selector.js +285 -0
- package/src/orchestrator/deviation-handler.js +350 -0
- package/src/orchestrator/handoff-engine.js +271 -0
- package/src/orchestrator/index.js +67 -0
- package/src/orchestrator/intent-classifier.js +264 -0
- package/src/orchestrator/pipeline-manager.js +492 -0
- package/src/orchestrator/pipeline-state.js +223 -0
- package/src/orchestrator/session-manager.js +409 -0
- package/src/tasks/executor.js +195 -0
- package/src/tasks/handoff.js +226 -0
- package/src/tasks/index.js +4 -0
- package/src/tasks/loader.js +210 -0
- package/src/tasks/router.js +182 -0
- package/src/terminal/collector.js +216 -0
- package/src/terminal/index.js +30 -0
- package/src/terminal/isolation.js +129 -0
- package/src/terminal/monitor.js +277 -0
- package/src/terminal/spawner.js +269 -0
- package/src/upgrade/checker.js +1 -1
|
@@ -0,0 +1,497 @@
|
|
|
1
|
+
---
|
|
2
|
+
id: dev-pr-prepare
|
|
3
|
+
agent: dev
|
|
4
|
+
trigger: dev-code-review
|
|
5
|
+
phase: build
|
|
6
|
+
requires_input: false
|
|
7
|
+
parallelizable: false
|
|
8
|
+
outputs: [pr-description.md]
|
|
9
|
+
handoff_to: dev-iterate
|
|
10
|
+
autonomous_gate: true
|
|
11
|
+
criteria:
|
|
12
|
+
- Conventional commits
|
|
13
|
+
- PR description complete
|
|
14
|
+
---
|
|
15
|
+
# Prepare Pull Request
|
|
16
|
+
|
|
17
|
+
## Purpose
|
|
18
|
+
Create well-structured commits and comprehensive pull request description following conventional commit standards and project conventions.
|
|
19
|
+
|
|
20
|
+
## Prerequisites
|
|
21
|
+
- Code review complete
|
|
22
|
+
- All tests passing
|
|
23
|
+
- Review report available
|
|
24
|
+
- Changes ready to commit
|
|
25
|
+
- Git repository initialized
|
|
26
|
+
|
|
27
|
+
## Steps
|
|
28
|
+
|
|
29
|
+
### 1. Review Changes
|
|
30
|
+
Understand what will be committed:
|
|
31
|
+
```bash
|
|
32
|
+
git status
|
|
33
|
+
git diff
|
|
34
|
+
```
|
|
35
|
+
- List all modified files
|
|
36
|
+
- Review all changes
|
|
37
|
+
- Identify logical groupings
|
|
38
|
+
- Note breaking changes
|
|
39
|
+
- Check for unintended changes
|
|
40
|
+
|
|
41
|
+
### 2. Stage Files Strategically
|
|
42
|
+
Group related changes:
|
|
43
|
+
```bash
|
|
44
|
+
git add src/modules/chat/
|
|
45
|
+
git add src/lib/validators.ts
|
|
46
|
+
```
|
|
47
|
+
- Don't use `git add .` blindly
|
|
48
|
+
- Stage related files together
|
|
49
|
+
- Avoid staging generated files
|
|
50
|
+
- Exclude local config changes
|
|
51
|
+
- Check .gitignore compliance
|
|
52
|
+
|
|
53
|
+
### 3. Create Conventional Commits
|
|
54
|
+
Follow conventional commit format:
|
|
55
|
+
|
|
56
|
+
**Format**: `type(scope): subject`
|
|
57
|
+
|
|
58
|
+
**Types**:
|
|
59
|
+
- `feat`: New feature
|
|
60
|
+
- `fix`: Bug fix
|
|
61
|
+
- `docs`: Documentation only
|
|
62
|
+
- `style`: Code style (formatting, no logic change)
|
|
63
|
+
- `refactor`: Code restructuring (no feature change)
|
|
64
|
+
- `test`: Adding or updating tests
|
|
65
|
+
- `chore`: Build process, dependencies, tooling
|
|
66
|
+
|
|
67
|
+
**Examples**:
|
|
68
|
+
```bash
|
|
69
|
+
git commit -m "feat(chat): add real-time messaging with WebSocket"
|
|
70
|
+
git commit -m "test(chat): add unit tests for message validation"
|
|
71
|
+
git commit -m "refactor(chat): extract validation to separate module"
|
|
72
|
+
git commit -m "docs(chat): add API documentation and examples"
|
|
73
|
+
```
|
|
74
|
+
|
|
75
|
+
### 4. Write Detailed Commit Messages
|
|
76
|
+
For complex commits, add body:
|
|
77
|
+
```bash
|
|
78
|
+
git commit -m "feat(chat): add real-time messaging with WebSocket
|
|
79
|
+
|
|
80
|
+
- Implement ChatService for message handling
|
|
81
|
+
- Add WebSocket integration for real-time updates
|
|
82
|
+
- Create message validation with Zod schemas
|
|
83
|
+
- Add database persistence for chat messages
|
|
84
|
+
|
|
85
|
+
Resolves #123"
|
|
86
|
+
```
|
|
87
|
+
|
|
88
|
+
### 5. Check Commit History
|
|
89
|
+
Review commits before pushing:
|
|
90
|
+
```bash
|
|
91
|
+
git log --oneline -10
|
|
92
|
+
```
|
|
93
|
+
- Verify commit messages are clear
|
|
94
|
+
- Check for typos
|
|
95
|
+
- Ensure logical order
|
|
96
|
+
- Confirm no sensitive data
|
|
97
|
+
- Validate conventional format
|
|
98
|
+
|
|
99
|
+
### 6. Create PR Description
|
|
100
|
+
Write comprehensive PR description:
|
|
101
|
+
|
|
102
|
+
**Template**:
|
|
103
|
+
```markdown
|
|
104
|
+
## Summary
|
|
105
|
+
Brief overview of changes (2-3 sentences)
|
|
106
|
+
|
|
107
|
+
## Changes
|
|
108
|
+
- Bullet list of key changes
|
|
109
|
+
- Organized by category
|
|
110
|
+
- Clear and specific
|
|
111
|
+
|
|
112
|
+
## Motivation
|
|
113
|
+
Why these changes are needed
|
|
114
|
+
|
|
115
|
+
## Implementation Details
|
|
116
|
+
Technical approach taken
|
|
117
|
+
Architecture decisions made
|
|
118
|
+
Design patterns used
|
|
119
|
+
|
|
120
|
+
## Testing
|
|
121
|
+
How changes were tested
|
|
122
|
+
Coverage metrics
|
|
123
|
+
Manual testing performed
|
|
124
|
+
|
|
125
|
+
## Screenshots/Demos
|
|
126
|
+
(If UI changes)
|
|
127
|
+
|
|
128
|
+
## Breaking Changes
|
|
129
|
+
(If any)
|
|
130
|
+
|
|
131
|
+
## Deployment Notes
|
|
132
|
+
(If any special steps needed)
|
|
133
|
+
|
|
134
|
+
## Checklist
|
|
135
|
+
- [ ] Tests pass
|
|
136
|
+
- [ ] Documentation updated
|
|
137
|
+
- [ ] No security issues
|
|
138
|
+
- [ ] Follows code style
|
|
139
|
+
- [ ] Reviewed own code
|
|
140
|
+
```
|
|
141
|
+
|
|
142
|
+
### 7. Link Related Issues
|
|
143
|
+
Reference related work:
|
|
144
|
+
- Link to task/story
|
|
145
|
+
- Reference GitHub issues
|
|
146
|
+
- Note dependencies
|
|
147
|
+
- Link to design docs
|
|
148
|
+
- Reference discussions
|
|
149
|
+
|
|
150
|
+
### 8. Highlight Important Decisions
|
|
151
|
+
Call attention to key points:
|
|
152
|
+
- Architecture changes
|
|
153
|
+
- API modifications
|
|
154
|
+
- Breaking changes
|
|
155
|
+
- Security considerations
|
|
156
|
+
- Performance implications
|
|
157
|
+
|
|
158
|
+
### 9. Add Testing Information
|
|
159
|
+
Document testing performed:
|
|
160
|
+
- Unit test coverage
|
|
161
|
+
- Integration tests
|
|
162
|
+
- Manual testing steps
|
|
163
|
+
- Edge cases verified
|
|
164
|
+
- Performance testing
|
|
165
|
+
|
|
166
|
+
### 10. Create Changelog Entry
|
|
167
|
+
Update CHANGELOG.md (if exists):
|
|
168
|
+
```markdown
|
|
169
|
+
## [Unreleased]
|
|
170
|
+
|
|
171
|
+
### Added
|
|
172
|
+
- Real-time chat messaging with WebSocket support
|
|
173
|
+
- Message validation and sanitization
|
|
174
|
+
- Database persistence for messages
|
|
175
|
+
|
|
176
|
+
### Changed
|
|
177
|
+
- Refactored message handling into separate service
|
|
178
|
+
|
|
179
|
+
### Fixed
|
|
180
|
+
- (Any bugs fixed)
|
|
181
|
+
```
|
|
182
|
+
|
|
183
|
+
### 11. Prepare for Review
|
|
184
|
+
Make review easy:
|
|
185
|
+
- Clear commit messages
|
|
186
|
+
- Logical commit structure
|
|
187
|
+
- Comprehensive PR description
|
|
188
|
+
- Testing instructions
|
|
189
|
+
- Context for decisions
|
|
190
|
+
|
|
191
|
+
### 12. Document PR Preparation
|
|
192
|
+
Record PR details:
|
|
193
|
+
- Commit count
|
|
194
|
+
- Files changed
|
|
195
|
+
- Lines added/removed
|
|
196
|
+
- PR description saved
|
|
197
|
+
- Checklist completed
|
|
198
|
+
|
|
199
|
+
## Decision Points
|
|
200
|
+
|
|
201
|
+
### When to Squash Commits
|
|
202
|
+
Consider squashing if:
|
|
203
|
+
1. Many WIP commits
|
|
204
|
+
2. Commits fix previous commits
|
|
205
|
+
3. History is messy
|
|
206
|
+
4. Team prefers linear history
|
|
207
|
+
|
|
208
|
+
Keep separate if:
|
|
209
|
+
1. Logical progression of work
|
|
210
|
+
2. Each commit is meaningful
|
|
211
|
+
3. Easy to review incrementally
|
|
212
|
+
4. Team values detailed history
|
|
213
|
+
|
|
214
|
+
### When to Split PRs
|
|
215
|
+
If PR is too large:
|
|
216
|
+
1. Split by feature
|
|
217
|
+
2. Split by layer (backend/frontend)
|
|
218
|
+
3. Create prerequisite PRs
|
|
219
|
+
4. Keep PRs reviewable (<500 lines)
|
|
220
|
+
|
|
221
|
+
### When Breaking Changes Exist
|
|
222
|
+
If introducing breaking changes:
|
|
223
|
+
1. Clearly mark in PR title
|
|
224
|
+
2. Document in BREAKING CHANGES section
|
|
225
|
+
3. Provide migration guide
|
|
226
|
+
4. Discuss with team first
|
|
227
|
+
5. Consider deprecation period
|
|
228
|
+
|
|
229
|
+
## Error Handling
|
|
230
|
+
|
|
231
|
+
### Commit Message Mistakes
|
|
232
|
+
If commit message is wrong:
|
|
233
|
+
```bash
|
|
234
|
+
# Amend last commit message
|
|
235
|
+
git commit --amend -m "new message"
|
|
236
|
+
|
|
237
|
+
# Don't amend if already pushed
|
|
238
|
+
```
|
|
239
|
+
|
|
240
|
+
### Forgot to Stage Files
|
|
241
|
+
```bash
|
|
242
|
+
# Add to last commit
|
|
243
|
+
git add forgotten-file.ts
|
|
244
|
+
git commit --amend --no-edit
|
|
245
|
+
```
|
|
246
|
+
|
|
247
|
+
### Need to Reorder Commits
|
|
248
|
+
```bash
|
|
249
|
+
# Interactive rebase (use with caution)
|
|
250
|
+
git rebase -i HEAD~3
|
|
251
|
+
```
|
|
252
|
+
|
|
253
|
+
### Sensitive Data Committed
|
|
254
|
+
If secrets accidentally committed:
|
|
255
|
+
1. Don't push!
|
|
256
|
+
2. Remove from history
|
|
257
|
+
3. Rotate compromised secrets
|
|
258
|
+
4. Add to .gitignore
|
|
259
|
+
5. Review commit carefully
|
|
260
|
+
|
|
261
|
+
## Output Format
|
|
262
|
+
|
|
263
|
+
Create `.chati/artifacts/build/pr-description.md`:
|
|
264
|
+
|
|
265
|
+
```markdown
|
|
266
|
+
# Add Real-time Chat Messaging
|
|
267
|
+
|
|
268
|
+
## Summary
|
|
269
|
+
Implements real-time chat messaging functionality with WebSocket support,
|
|
270
|
+
including message persistence, validation, and broadcasting to connected
|
|
271
|
+
clients.
|
|
272
|
+
|
|
273
|
+
## Changes
|
|
274
|
+
|
|
275
|
+
### Features Added
|
|
276
|
+
- Real-time message sending and receiving via WebSocket
|
|
277
|
+
- Message validation using Zod schemas
|
|
278
|
+
- HTML sanitization for user-generated content
|
|
279
|
+
- Database persistence for chat history
|
|
280
|
+
- Message broadcasting to connected clients
|
|
281
|
+
|
|
282
|
+
### Code Quality
|
|
283
|
+
- Comprehensive unit tests (89.2% coverage)
|
|
284
|
+
- Integration tests for WebSocket flow
|
|
285
|
+
- Refactored for separation of concerns
|
|
286
|
+
- Security review completed
|
|
287
|
+
|
|
288
|
+
### Documentation
|
|
289
|
+
- JSDoc comments for public APIs
|
|
290
|
+
- README section for chat module
|
|
291
|
+
- Usage examples
|
|
292
|
+
|
|
293
|
+
## Motivation
|
|
294
|
+
Enables users to communicate in real-time within the application, a core
|
|
295
|
+
feature requirement from Phase 3 of the project roadmap.
|
|
296
|
+
|
|
297
|
+
## Implementation Details
|
|
298
|
+
|
|
299
|
+
### Architecture
|
|
300
|
+
- Repository pattern for data access
|
|
301
|
+
- Service layer for business logic
|
|
302
|
+
- Event-driven broadcasting using EventEmitter
|
|
303
|
+
- WebSocket integration for real-time updates
|
|
304
|
+
|
|
305
|
+
### Key Components
|
|
306
|
+
- `ChatService`: Core message handling
|
|
307
|
+
- `ChatRepository`: Database operations
|
|
308
|
+
- `ChatValidator`: Input validation
|
|
309
|
+
- `WebSocketService`: Real-time communication
|
|
310
|
+
|
|
311
|
+
### Technology Choices
|
|
312
|
+
- Zod for schema validation
|
|
313
|
+
- DOMPurify for HTML sanitization
|
|
314
|
+
- SQLite for message storage
|
|
315
|
+
- ws library for WebSocket
|
|
316
|
+
|
|
317
|
+
## Testing
|
|
318
|
+
|
|
319
|
+
### Unit Tests (12)
|
|
320
|
+
- Message validation (null, empty, max length)
|
|
321
|
+
- HTML sanitization
|
|
322
|
+
- Database persistence
|
|
323
|
+
- Event emission
|
|
324
|
+
- Error handling
|
|
325
|
+
|
|
326
|
+
### Integration Tests (8)
|
|
327
|
+
- End-to-end message flow
|
|
328
|
+
- WebSocket communication
|
|
329
|
+
- Database integration
|
|
330
|
+
- Error scenarios
|
|
331
|
+
|
|
332
|
+
### Manual Testing
|
|
333
|
+
- ✅ Send message via API
|
|
334
|
+
- ✅ Receive real-time updates
|
|
335
|
+
- ✅ HTML content sanitized
|
|
336
|
+
- ✅ Empty messages rejected
|
|
337
|
+
- ✅ Database persistence verified
|
|
338
|
+
|
|
339
|
+
### Coverage
|
|
340
|
+
- Statements: 87.5%
|
|
341
|
+
- Branches: 82.3%
|
|
342
|
+
- Functions: 91.2%
|
|
343
|
+
- Lines: 86.8%
|
|
344
|
+
|
|
345
|
+
## Security
|
|
346
|
+
|
|
347
|
+
### Measures Implemented
|
|
348
|
+
- ✅ Input validation on all messages
|
|
349
|
+
- ✅ HTML sanitization to prevent XSS
|
|
350
|
+
- ✅ SQL injection prevention (parameterized queries)
|
|
351
|
+
- ✅ Authentication required for message sending
|
|
352
|
+
- ✅ No hardcoded credentials
|
|
353
|
+
|
|
354
|
+
### Recommendations for Production
|
|
355
|
+
- Add rate limiting for message endpoints
|
|
356
|
+
- Configure CORS properly
|
|
357
|
+
- Implement message encryption for sensitive data
|
|
358
|
+
|
|
359
|
+
## Performance
|
|
360
|
+
- Database queries optimized with indexes
|
|
361
|
+
- Connection pooling implemented
|
|
362
|
+
- O(n) or better algorithm complexity
|
|
363
|
+
- Note: Pagination will be needed for large message volumes (planned for Phase 4)
|
|
364
|
+
|
|
365
|
+
## Breaking Changes
|
|
366
|
+
None
|
|
367
|
+
|
|
368
|
+
## Deployment Notes
|
|
369
|
+
- Run database migrations (if applicable)
|
|
370
|
+
- Configure WebSocket port in environment variables
|
|
371
|
+
- Ensure WebSocket support on hosting platform
|
|
372
|
+
|
|
373
|
+
## Checklist
|
|
374
|
+
- [x] All tests pass
|
|
375
|
+
- [x] Code coverage >80%
|
|
376
|
+
- [x] Documentation updated
|
|
377
|
+
- [x] No security issues
|
|
378
|
+
- [x] Code style consistent
|
|
379
|
+
- [x] Self-review completed
|
|
380
|
+
- [x] No breaking changes
|
|
381
|
+
- [x] Changelog updated
|
|
382
|
+
|
|
383
|
+
## Related
|
|
384
|
+
- Closes #123
|
|
385
|
+
- Part of Phase 3: Chat Module
|
|
386
|
+
- Task ID: 3.2.1
|
|
387
|
+
- Architecture Doc: `.chati/artifacts/architecture/chat-design.md`
|
|
388
|
+
|
|
389
|
+
## Screenshots
|
|
390
|
+
(Not applicable - backend feature)
|
|
391
|
+
|
|
392
|
+
## Reviewer Notes
|
|
393
|
+
- Main logic in `src/modules/chat/chat-service.ts`
|
|
394
|
+
- Tests in `src/modules/chat/*.test.ts`
|
|
395
|
+
- Review security validation in `validators.ts`
|
|
396
|
+
- Check WebSocket integration in `chat-integration.test.ts`
|
|
397
|
+
```
|
|
398
|
+
|
|
399
|
+
Also create `.chati/artifacts/build/commit-log.yaml`:
|
|
400
|
+
|
|
401
|
+
```yaml
|
|
402
|
+
task_id: "3.2.1"
|
|
403
|
+
agent: dev
|
|
404
|
+
action: pr-prepare
|
|
405
|
+
timestamp: "2026-02-13T14:15:00Z"
|
|
406
|
+
duration_minutes: 25
|
|
407
|
+
|
|
408
|
+
commits_created:
|
|
409
|
+
- hash: "abc1234"
|
|
410
|
+
type: feat
|
|
411
|
+
scope: chat
|
|
412
|
+
subject: "add real-time messaging with WebSocket"
|
|
413
|
+
body: |
|
|
414
|
+
- Implement ChatService for message handling
|
|
415
|
+
- Add WebSocket integration for real-time updates
|
|
416
|
+
- Create message validation with Zod schemas
|
|
417
|
+
- Add database persistence for chat messages
|
|
418
|
+
files_changed: 8
|
|
419
|
+
insertions: 342
|
|
420
|
+
deletions: 0
|
|
421
|
+
|
|
422
|
+
- hash: "def5678"
|
|
423
|
+
type: test
|
|
424
|
+
scope: chat
|
|
425
|
+
subject: "add comprehensive test suite"
|
|
426
|
+
body: |
|
|
427
|
+
- Unit tests for ChatService
|
|
428
|
+
- Integration tests for WebSocket flow
|
|
429
|
+
- Edge case testing (null, empty, max length)
|
|
430
|
+
- Error scenario coverage
|
|
431
|
+
files_changed: 2
|
|
432
|
+
insertions: 425
|
|
433
|
+
deletions: 0
|
|
434
|
+
|
|
435
|
+
- hash: "ghi9012"
|
|
436
|
+
type: refactor
|
|
437
|
+
scope: chat
|
|
438
|
+
subject: "extract validation to separate module"
|
|
439
|
+
body: |
|
|
440
|
+
- Create validators.ts utility module
|
|
441
|
+
- Move sanitization logic
|
|
442
|
+
- Improve separation of concerns
|
|
443
|
+
- Reduce code duplication
|
|
444
|
+
files_changed: 3
|
|
445
|
+
insertions: 87
|
|
446
|
+
deletions: 52
|
|
447
|
+
|
|
448
|
+
- hash: "jkl3456"
|
|
449
|
+
type: docs
|
|
450
|
+
scope: chat
|
|
451
|
+
subject: "add API documentation and README section"
|
|
452
|
+
body: |
|
|
453
|
+
- JSDoc comments for public APIs
|
|
454
|
+
- README section for chat module
|
|
455
|
+
- Usage examples
|
|
456
|
+
- WebSocket event documentation
|
|
457
|
+
files_changed: 2
|
|
458
|
+
insertions: 78
|
|
459
|
+
deletions: 3
|
|
460
|
+
|
|
461
|
+
total_commits: 4
|
|
462
|
+
total_files_changed: 15
|
|
463
|
+
total_insertions: 932
|
|
464
|
+
total_deletions: 55
|
|
465
|
+
|
|
466
|
+
pr_details:
|
|
467
|
+
title: "feat(chat): add real-time messaging with WebSocket"
|
|
468
|
+
description_file: "pr-description.md"
|
|
469
|
+
labels: ["feature", "chat", "phase-3"]
|
|
470
|
+
reviewers_suggested: ["qa-implementation"]
|
|
471
|
+
milestone: "Phase 3"
|
|
472
|
+
|
|
473
|
+
changelog_updated: true
|
|
474
|
+
breaking_changes: false
|
|
475
|
+
|
|
476
|
+
git_status:
|
|
477
|
+
branch: "feature/chat-messaging"
|
|
478
|
+
commits_ahead: 4
|
|
479
|
+
commits_behind: 0
|
|
480
|
+
ready_to_push: true
|
|
481
|
+
|
|
482
|
+
next_steps:
|
|
483
|
+
- "Review PR description for completeness"
|
|
484
|
+
- "Push branch to remote"
|
|
485
|
+
- "Create PR on GitHub"
|
|
486
|
+
- "Request code review"
|
|
487
|
+
```
|
|
488
|
+
|
|
489
|
+
## Success Criteria
|
|
490
|
+
- All commits follow conventional format
|
|
491
|
+
- Commit messages are clear and descriptive
|
|
492
|
+
- PR description is comprehensive
|
|
493
|
+
- Testing information included
|
|
494
|
+
- Related issues linked
|
|
495
|
+
- Changelog updated
|
|
496
|
+
- Ready to create PR
|
|
497
|
+
- PR preparation artifacts complete
|