ai-spector 0.1.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.
Files changed (63) hide show
  1. package/README.md +169 -0
  2. package/_templates/basic_design/db-design-template.md +177 -0
  3. package/_templates/basic_design/detail-api-template.md +278 -0
  4. package/_templates/basic_design/detail-screen-template.md +281 -0
  5. package/_templates/basic_design/list-api-template.md +130 -0
  6. package/_templates/basic_design/list-screen-template.md +242 -0
  7. package/_templates/detail_design/common/architecture-overview-template.md +302 -0
  8. package/_templates/detail_design/common/deployment-infrastructure-template.md +461 -0
  9. package/_templates/detail_design/common/error-handling-patterns-template.md +460 -0
  10. package/_templates/detail_design/common/integration-patterns-template.md +410 -0
  11. package/_templates/detail_design/common/performance-standards-template.md +406 -0
  12. package/_templates/detail_design/common/security-patterns-template.md +395 -0
  13. package/_templates/detail_design/feature-detail-design-template.md +773 -0
  14. package/_templates/detail_design/feature-list-template.md +39 -0
  15. package/_templates/srs/1-introduction.md +58 -0
  16. package/_templates/srs/2-overall-description.md +91 -0
  17. package/_templates/srs/3-use-case-detail-template.md +142 -0
  18. package/_templates/srs/3-use-cases.md +53 -0
  19. package/_templates/srs/4-system-feature-detail-template.md +131 -0
  20. package/_templates/srs/4-system-features-list-template.md +39 -0
  21. package/_templates/srs/5-data-requirements.md +59 -0
  22. package/_templates/srs/6-external-interfaces.md +56 -0
  23. package/_templates/srs/7-quality-attributes.md +74 -0
  24. package/_templates/srs/8-internationalization.md +36 -0
  25. package/_templates/srs/9-other-requirements.md +46 -0
  26. package/assets/cursor/commands/analyze.md +39 -0
  27. package/assets/cursor/commands/generate-detail-design.md +35 -0
  28. package/assets/cursor/commands/generate-srs.md +38 -0
  29. package/assets/cursor/skills/spec-writer/SKILL.md +33 -0
  30. package/assets/workflow/config/analyze.graphify.json +36 -0
  31. package/assets/workflow/config/completeness-rules.detail-design.json +57 -0
  32. package/assets/workflow/config/completeness-rules.srs.json +72 -0
  33. package/assets/workflow/config/dag.detail-design.json +64 -0
  34. package/assets/workflow/config/dag.srs.json +87 -0
  35. package/assets/workflow/state/state.template.json +26 -0
  36. package/assets/workflow/templates/basic_design/db-design-template.md +177 -0
  37. package/assets/workflow/templates/basic_design/detail-api-template.md +278 -0
  38. package/assets/workflow/templates/basic_design/detail-screen-template.md +281 -0
  39. package/assets/workflow/templates/basic_design/list-api-template.md +130 -0
  40. package/assets/workflow/templates/basic_design/list-screen-template.md +242 -0
  41. package/assets/workflow/templates/detail_design/common/architecture-overview-template.md +302 -0
  42. package/assets/workflow/templates/detail_design/common/deployment-infrastructure-template.md +461 -0
  43. package/assets/workflow/templates/detail_design/common/error-handling-patterns-template.md +460 -0
  44. package/assets/workflow/templates/detail_design/common/integration-patterns-template.md +410 -0
  45. package/assets/workflow/templates/detail_design/common/performance-standards-template.md +406 -0
  46. package/assets/workflow/templates/detail_design/common/security-patterns-template.md +395 -0
  47. package/assets/workflow/templates/detail_design/feature-detail-design-template.md +773 -0
  48. package/assets/workflow/templates/detail_design/feature-list-template.md +39 -0
  49. package/assets/workflow/templates/srs/1-introduction.md +58 -0
  50. package/assets/workflow/templates/srs/2-overall-description.md +91 -0
  51. package/assets/workflow/templates/srs/3-use-case-detail-template.md +142 -0
  52. package/assets/workflow/templates/srs/3-use-cases.md +53 -0
  53. package/assets/workflow/templates/srs/4-system-feature-detail-template.md +131 -0
  54. package/assets/workflow/templates/srs/4-system-features-list-template.md +39 -0
  55. package/assets/workflow/templates/srs/5-data-requirements.md +59 -0
  56. package/assets/workflow/templates/srs/6-external-interfaces.md +56 -0
  57. package/assets/workflow/templates/srs/7-quality-attributes.md +74 -0
  58. package/assets/workflow/templates/srs/8-internationalization.md +36 -0
  59. package/assets/workflow/templates/srs/9-other-requirements.md +46 -0
  60. package/bin/spec-writer.js +56 -0
  61. package/package.json +25 -0
  62. package/src/cli/helpers/fs.js +50 -0
  63. package/src/cli/init.js +178 -0
@@ -0,0 +1,461 @@
1
+ # Deployment & Infrastructure: <Project Name>
2
+
3
+ > This document describes the deployment architecture, infrastructure design, CI/CD pipelines, and operational procedures for the system.
4
+
5
+ **Source Requirements:** SRS Section 2.3 (Operating Environment), Section 7 (Quality Attributes)
6
+
7
+ ---
8
+
9
+ ## 1. Overview
10
+
11
+ **Purpose:**
12
+ > This document defines the infrastructure architecture, deployment strategies, and operational procedures to ensure reliable, scalable, and maintainable system deployment.
13
+
14
+ **Infrastructure Principles:**
15
+ - Infrastructure as Code
16
+ - Automated deployments
17
+ - Environment parity
18
+ - Security by default
19
+ - Monitoring and observability
20
+
21
+ ---
22
+
23
+ ## 2. Infrastructure Architecture
24
+
25
+ ### 2.1 High-Level Architecture
26
+
27
+ ```mermaid
28
+ flowchart TB
29
+ Internet[Internet] --> LB[Load Balancer]
30
+ LB --> App1[App Server 1]
31
+ LB --> App2[App Server 2]
32
+ LB --> App3[App Server N]
33
+ App1 --> DB[(Primary DB)]
34
+ App2 --> DB
35
+ App3 --> DB
36
+ App1 --> Cache[(Cache)]
37
+ App2 --> Cache
38
+ App3 --> Cache
39
+ DB --> Replica[(Read Replica)]
40
+ App1 --> Queue[Message Queue]
41
+ App2 --> Queue
42
+ App3 --> Queue
43
+ ```
44
+
45
+ ### 2.2 Infrastructure Components
46
+
47
+ **Compute:**
48
+ - Application servers: <Type and configuration>
49
+ - Worker servers: <For background jobs>
50
+ - Auto-scaling groups: <Configuration>
51
+
52
+ **Storage:**
53
+ - Primary database: <Type and configuration>
54
+ - Read replicas: <Number and configuration>
55
+ - Cache: <Type and configuration>
56
+ - Object storage: <For files and assets>
57
+
58
+ **Networking:**
59
+ - Load balancer: <Type and configuration>
60
+ - CDN: <Configuration>
61
+ - VPC/Network: <Configuration>
62
+ - DNS: <Configuration>
63
+
64
+ **Monitoring:**
65
+ - Logging: <Tool and configuration>
66
+ - Metrics: <Tool and configuration>
67
+ - Tracing: <Tool and configuration>
68
+ - Alerting: <Configuration>
69
+
70
+ ---
71
+
72
+ ## 3. Containerization
73
+
74
+ ### 3.1 Docker Configuration
75
+
76
+ **Dockerfile Structure:**
77
+ ```dockerfile
78
+ FROM <base-image>
79
+ WORKDIR /app
80
+ COPY package*.json ./
81
+ RUN npm install
82
+ COPY . .
83
+ RUN npm run build
84
+ EXPOSE <port>
85
+ CMD ["npm", "start"]
86
+ ```
87
+
88
+ **Docker Best Practices:**
89
+ - Use multi-stage builds
90
+ - Minimize image size
91
+ - Use specific version tags
92
+ - Run as non-root user
93
+ - Use .dockerignore
94
+ - Optimize layer caching
95
+
96
+ ### 3.2 Container Orchestration
97
+
98
+ **Kubernetes (if used):**
99
+ - Deployment configurations
100
+ - Service definitions
101
+ - ConfigMaps and Secrets
102
+ - Ingress configuration
103
+ - Resource limits and requests
104
+ - Health checks
105
+
106
+ **Docker Compose (if used):**
107
+ - Service definitions
108
+ - Network configuration
109
+ - Volume mounts
110
+ - Environment variables
111
+
112
+ ---
113
+
114
+ ## 4. CI/CD Pipeline
115
+
116
+ ### 4.1 Pipeline Stages
117
+
118
+ **Pipeline Flow:**
119
+
120
+ ```mermaid
121
+ flowchart LR
122
+ Code[Code Commit] --> Build[Build]
123
+ Build --> Test[Test]
124
+ Test --> Security[Security Scan]
125
+ Security --> BuildImage[Build Image]
126
+ BuildImage --> DeployDev[Deploy Dev]
127
+ DeployDev --> IntegrationTest[Integration Tests]
128
+ IntegrationTest --> DeployStaging[Deploy Staging]
129
+ DeployStaging --> E2ETest[E2E Tests]
130
+ E2ETest --> DeployProd[Deploy Production]
131
+ ```
132
+
133
+ **Stages:**
134
+ 1. **Build:** Compile code, install dependencies
135
+ 2. **Test:** Run unit tests, integration tests
136
+ 3. **Security Scan:** Scan for vulnerabilities
137
+ 4. **Build Image:** Create Docker image
138
+ 5. **Deploy Dev:** Deploy to development environment
139
+ 6. **Integration Tests:** Run integration tests
140
+ 7. **Deploy Staging:** Deploy to staging environment
141
+ 8. **E2E Tests:** Run end-to-end tests
142
+ 9. **Deploy Production:** Deploy to production (with approval)
143
+
144
+ ### 4.2 CI/CD Configuration
145
+
146
+ **Build Configuration:**
147
+ - Build tool: <npm/yarn/maven/gradle>
148
+ - Build commands: <Commands>
149
+ - Artifact storage: <Location>
150
+
151
+ **Test Configuration:**
152
+ - Test framework: <Jest/Mocha/JUnit>
153
+ - Test coverage threshold: <Percentage>
154
+ - Test reports: <Location>
155
+
156
+ **Deployment Configuration:**
157
+ - Deployment tool: <Kubernetes/ECS/Heroku>
158
+ - Deployment strategy: <Blue-Green/Canary/Rolling>
159
+ - Rollback procedure: <Procedure>
160
+
161
+ ### 4.3 Branching Strategy
162
+
163
+ **Branch Types:**
164
+ - **main/master:** Production-ready code
165
+ - **develop:** Integration branch
166
+ - **feature/***: Feature branches
167
+ - **release/***: Release preparation
168
+ - **hotfix/***: Production fixes
169
+
170
+ **Deployment Triggers:**
171
+ - Push to main: Deploy to production
172
+ - Push to develop: Deploy to staging
173
+ - Pull request: Deploy to preview environment
174
+
175
+ ---
176
+
177
+ ## 5. Environments
178
+
179
+ ### 5.1 Environment Configuration
180
+
181
+ **Development:**
182
+ - Purpose: Local development and testing
183
+ - Infrastructure: <Minimal/Shared>
184
+ - Data: <Sample/Mock data>
185
+ - Access: <Open/Restricted>
186
+
187
+ **Staging:**
188
+ - Purpose: Pre-production testing
189
+ - Infrastructure: <Similar to production>
190
+ - Data: <Anonymized production data>
191
+ - Access: <Team access>
192
+
193
+ **Production:**
194
+ - Purpose: Live system
195
+ - Infrastructure: <Full scale>
196
+ - Data: <Real production data>
197
+ - Access: <Restricted>
198
+
199
+ ### 5.2 Environment Variables
200
+
201
+ **Configuration Management:**
202
+ - Use environment variables for configuration
203
+ - Store secrets in secure vault
204
+ - Use different configs per environment
205
+ - Document all environment variables
206
+
207
+ **Secrets Management:**
208
+ - Tool: <AWS Secrets Manager/HashiCorp Vault>
209
+ - Rotation: <Strategy>
210
+ - Access control: <Policy>
211
+
212
+ ---
213
+
214
+ ## 6. Deployment Strategies
215
+
216
+ ### 6.1 Blue-Green Deployment
217
+
218
+ **Process:**
219
+ 1. Deploy new version to green environment
220
+ 2. Test green environment
221
+ 3. Switch traffic from blue to green
222
+ 4. Monitor green environment
223
+ 5. Keep blue as rollback option
224
+
225
+ **Advantages:**
226
+ - Zero downtime
227
+ - Easy rollback
228
+ - Safe testing
229
+
230
+ ### 6.2 Canary Deployment
231
+
232
+ **Process:**
233
+ 1. Deploy new version to subset of servers
234
+ 2. Route small percentage of traffic to new version
235
+ 3. Monitor metrics
236
+ 4. Gradually increase traffic
237
+ 5. Full rollout or rollback based on metrics
238
+
239
+ **Advantages:**
240
+ - Gradual rollout
241
+ - Risk mitigation
242
+ - Real-world testing
243
+
244
+ ### 6.3 Rolling Deployment
245
+
246
+ **Process:**
247
+ 1. Deploy new version to one server at a time
248
+ 2. Wait for health check
249
+ 3. Deploy to next server
250
+ 4. Continue until all servers updated
251
+
252
+ **Advantages:**
253
+ - No additional infrastructure
254
+ - Gradual update
255
+ - Automatic rollback on failure
256
+
257
+ ---
258
+
259
+ ## 7. Infrastructure as Code
260
+
261
+ ### 7.1 IaC Tools
262
+
263
+ **Tool:** <Terraform/CloudFormation/Ansible>
264
+
265
+ **Infrastructure Components:**
266
+ - Compute resources
267
+ - Storage resources
268
+ - Networking resources
269
+ - Security groups
270
+ - Load balancers
271
+ - Databases
272
+
273
+ ### 7.2 Infrastructure Versioning
274
+
275
+ **Version Control:**
276
+ - Store IaC in version control
277
+ - Use branches for changes
278
+ - Review infrastructure changes
279
+ - Tag infrastructure versions
280
+
281
+ **Best Practices:**
282
+ - Modularize infrastructure code
283
+ - Use variables for configuration
284
+ - Document infrastructure
285
+ - Test infrastructure changes
286
+
287
+ ---
288
+
289
+ ## 8. Monitoring and Observability
290
+
291
+ ### 8.1 Logging
292
+
293
+ **Log Aggregation:**
294
+ - Tool: <ELK Stack/CloudWatch/Splunk>
295
+ - Log retention: <Duration>
296
+ - Log levels: <DEBUG/INFO/WARN/ERROR>
297
+
298
+ **Structured Logging:**
299
+ ```json
300
+ {
301
+ "timestamp": "2025-01-15T10:30:00Z",
302
+ "level": "INFO",
303
+ "service": "user-service",
304
+ "message": "User created",
305
+ "user_id": "user123",
306
+ "request_id": "req_123456789"
307
+ }
308
+ ```
309
+
310
+ ### 8.2 Metrics
311
+
312
+ **Application Metrics:**
313
+ - Response time
314
+ - Request rate
315
+ - Error rate
316
+ - Business metrics
317
+
318
+ **Infrastructure Metrics:**
319
+ - CPU utilization
320
+ - Memory utilization
321
+ - Disk I/O
322
+ - Network I/O
323
+
324
+ **Metrics Tool:** <Prometheus/CloudWatch/Datadog>
325
+
326
+ ### 8.3 Tracing
327
+
328
+ **Distributed Tracing:**
329
+ - Tool: <Jaeger/Zipkin/OpenTelemetry>
330
+ - Trace requests across services
331
+ - Identify performance bottlenecks
332
+ - Debug distributed systems
333
+
334
+ ### 8.4 Alerting
335
+
336
+ **Alert Rules:**
337
+ - High error rate
338
+ - Slow response times
339
+ - Resource exhaustion
340
+ - Service unavailability
341
+ - Security incidents
342
+
343
+ **Alert Channels:**
344
+ - Email
345
+ - Slack/Teams
346
+ - PagerDuty
347
+ - SMS
348
+
349
+ ---
350
+
351
+ ## 9. Disaster Recovery
352
+
353
+ ### 9.1 Backup Strategy
354
+
355
+ **Backup Types:**
356
+ - **Database backups:** <Frequency and retention>
357
+ - **File backups:** <Frequency and retention>
358
+ - **Configuration backups:** <Frequency and retention>
359
+ - **Infrastructure backups:** <IaC versioning>
360
+
361
+ **Backup Storage:**
362
+ - Location: <Region/Zone>
363
+ - Encryption: <Yes/No>
364
+ - Retention: <Duration>
365
+
366
+ ### 9.2 Recovery Procedures
367
+
368
+ **Recovery Time Objective (RTO):** <Target, e.g., 4 hours>
369
+ **Recovery Point Objective (RPO):** <Target, e.g., 1 hour>
370
+
371
+ **Recovery Procedures:**
372
+ 1. Identify failure
373
+ 2. Assess impact
374
+ 3. Execute recovery plan
375
+ 4. Verify recovery
376
+ 5. Document incident
377
+
378
+ ### 9.3 High Availability
379
+
380
+ **HA Configuration:**
381
+ - Multi-AZ deployment
382
+ - Database replication
383
+ - Load balancing
384
+ - Auto-scaling
385
+ - Health checks
386
+
387
+ ---
388
+
389
+ ## 10. Security
390
+
391
+ ### 10.1 Infrastructure Security
392
+
393
+ **Network Security:**
394
+ - VPC configuration
395
+ - Security groups
396
+ - Network ACLs
397
+ - DDoS protection
398
+
399
+ **Access Control:**
400
+ - IAM roles and policies
401
+ - Least privilege principle
402
+ - MFA for sensitive operations
403
+ - Audit logging
404
+
405
+ ### 10.2 Data Security
406
+
407
+ **Encryption:**
408
+ - Encryption at rest
409
+ - Encryption in transit
410
+ - Key management
411
+ - Certificate management
412
+
413
+ **Compliance:**
414
+ - <GDPR/PCI-DSS/HIPAA>
415
+ - Data residency requirements
416
+ - Audit trails
417
+
418
+ ---
419
+
420
+ ## 11. Cost Optimization
421
+
422
+ ### 11.1 Cost Management
423
+
424
+ **Strategies:**
425
+ - Right-size resources
426
+ - Use reserved instances
427
+ - Auto-scaling
428
+ - Spot instances for non-critical workloads
429
+ - Monitor and optimize costs
430
+
431
+ **Cost Monitoring:**
432
+ - Track costs by service
433
+ - Set budget alerts
434
+ - Regular cost reviews
435
+ - Optimize unused resources
436
+
437
+ ---
438
+
439
+ ## 12. References
440
+
441
+ **Related Documents:**
442
+ - [Architecture Overview](../common/architecture-overview-template.md)
443
+ - [Performance Standards](../common/performance-standards-template.md)
444
+ - [Security Patterns](../common/security-patterns-template.md)
445
+ - [Feature Detail Design Template](../feature-detail-design-template.md)
446
+
447
+ **SRS References:**
448
+ - SRS Section 2.3: Operating Environment
449
+ - SRS Section 7: Quality Attributes
450
+
451
+ ---
452
+
453
+ ## 13. Notes
454
+
455
+ **Infrastructure Considerations:**
456
+ - <Consideration 1>
457
+ - <Consideration 2>
458
+
459
+ **Future Enhancements:**
460
+ - <Enhancement 1>
461
+ - <Enhancement 2>