@paulduvall/claude-dev-toolkit 0.0.1-alpha.2 → 0.0.1-alpha.21
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/LICENSE +21 -0
- package/README.md +88 -37
- package/bin/claude-commands +307 -65
- package/commands/active/xarchitecture.md +393 -0
- package/commands/active/xconfig.md +127 -0
- package/commands/active/xcontinue.md +92 -0
- package/commands/active/xdebug.md +130 -0
- package/commands/active/xdocs.md +178 -0
- package/commands/active/xexplore.md +94 -0
- package/commands/active/xgit.md +149 -0
- package/commands/active/xpipeline.md +152 -0
- package/commands/active/xquality.md +96 -0
- package/commands/active/xrefactor.md +198 -0
- package/commands/active/xrelease.md +142 -0
- package/commands/active/xsecurity.md +92 -0
- package/commands/active/xspec.md +174 -0
- package/commands/active/xtdd.md +151 -0
- package/commands/active/xtest.md +89 -0
- package/commands/active/xverify.md +80 -0
- package/commands/experiments/xact.md +742 -0
- package/commands/experiments/xanalytics.md +113 -0
- package/commands/experiments/xanalyze.md +70 -0
- package/commands/experiments/xapi.md +161 -0
- package/commands/experiments/xatomic.md +112 -0
- package/commands/experiments/xaws.md +85 -0
- package/commands/experiments/xcicd.md +337 -0
- package/commands/experiments/xcommit.md +122 -0
- package/commands/experiments/xcompliance.md +182 -0
- package/commands/experiments/xconstraints.md +89 -0
- package/commands/experiments/xcoverage.md +90 -0
- package/commands/experiments/xdb.md +102 -0
- package/commands/experiments/xdesign.md +121 -0
- package/commands/experiments/xdevcontainer.md +238 -0
- package/commands/experiments/xevaluate.md +111 -0
- package/commands/experiments/xfootnote.md +12 -0
- package/commands/experiments/xgenerate.md +117 -0
- package/commands/experiments/xgovernance.md +149 -0
- package/commands/experiments/xgreen.md +66 -0
- package/commands/experiments/xiac.md +118 -0
- package/commands/experiments/xincident.md +137 -0
- package/commands/experiments/xinfra.md +115 -0
- package/commands/experiments/xknowledge.md +115 -0
- package/commands/experiments/xmaturity.md +120 -0
- package/commands/experiments/xmetrics.md +118 -0
- package/commands/experiments/xmonitoring.md +128 -0
- package/commands/experiments/xnew.md +903 -0
- package/commands/experiments/xobservable.md +114 -0
- package/commands/experiments/xoidc.md +165 -0
- package/commands/experiments/xoptimize.md +115 -0
- package/commands/experiments/xperformance.md +112 -0
- package/commands/experiments/xplanning.md +131 -0
- package/commands/experiments/xpolicy.md +115 -0
- package/commands/experiments/xproduct.md +98 -0
- package/commands/experiments/xreadiness.md +75 -0
- package/commands/experiments/xred.md +55 -0
- package/commands/experiments/xrisk.md +128 -0
- package/commands/experiments/xrules.md +124 -0
- package/commands/experiments/xsandbox.md +120 -0
- package/commands/experiments/xscan.md +102 -0
- package/commands/experiments/xsetup.md +123 -0
- package/commands/experiments/xtemplate.md +116 -0
- package/commands/experiments/xtrace.md +212 -0
- package/commands/experiments/xux.md +171 -0
- package/commands/experiments/xvalidate.md +104 -0
- package/commands/experiments/xworkflow.md +113 -0
- package/hooks/.smellrc.example.json +19 -0
- package/hooks/README.md +263 -0
- package/hooks/check-commit-signing.py +127 -0
- package/hooks/check-complexity.py +38 -0
- package/hooks/check-security.py +37 -0
- package/hooks/claude-wrapper.sh +29 -0
- package/hooks/config.py +110 -0
- package/hooks/file-logger.sh +100 -0
- package/hooks/lib/argument-parser.sh +427 -0
- package/hooks/lib/config-constants.sh +230 -0
- package/hooks/lib/context-manager.sh +560 -0
- package/hooks/lib/error-handler.sh +423 -0
- package/hooks/lib/execution-engine.sh +444 -0
- package/hooks/lib/execution-results.sh +113 -0
- package/hooks/lib/execution-simulation.sh +114 -0
- package/hooks/lib/field-validators.sh +104 -0
- package/hooks/lib/file-utils.sh +398 -0
- package/hooks/lib/subagent-discovery.sh +468 -0
- package/hooks/lib/subagent-validator.sh +407 -0
- package/hooks/lib/validation-reporter.sh +134 -0
- package/hooks/on-error-debug.sh +226 -0
- package/hooks/pre-commit-quality.sh +204 -0
- package/hooks/pre-commit-test-runner.sh +132 -0
- package/hooks/pre-write-security.sh +115 -0
- package/hooks/prevent-credential-exposure.sh +279 -0
- package/hooks/security_bandit.py +177 -0
- package/hooks/security_checks.py +97 -0
- package/hooks/security_secrets.py +81 -0
- package/hooks/security_trojan.py +61 -0
- package/hooks/settings.example.json +52 -0
- package/hooks/smell_checks.py +238 -0
- package/hooks/smell_javascript.py +231 -0
- package/hooks/smell_python.py +110 -0
- package/hooks/smell_ruff.py +70 -0
- package/hooks/smell_types.py +72 -0
- package/hooks/subagent-trigger-simple.sh +202 -0
- package/hooks/subagent-trigger.sh +253 -0
- package/hooks/suppression.py +82 -0
- package/hooks/tab-color.sh +70 -0
- package/hooks/verify-before-edit.sh +135 -0
- package/lib/backup-restore-command.js +140 -0
- package/lib/base/base-command.js +252 -0
- package/lib/base/command-result.js +184 -0
- package/lib/config/constants.js +255 -0
- package/lib/config.js +48 -6
- package/lib/configure-command.js +428 -0
- package/lib/dependency-validator.js +64 -5
- package/lib/hook-installer-core.js +2 -2
- package/lib/installation-instruction-generator.js +213 -495
- package/lib/installer.js +134 -56
- package/lib/oidc-command.js +740 -0
- package/lib/services/backup-list-service.js +226 -0
- package/lib/services/backup-service.js +230 -0
- package/lib/services/command-installer-service.js +217 -0
- package/lib/services/logger-service.js +201 -0
- package/lib/services/package-manager-service.js +319 -0
- package/lib/services/platform-instruction-service.js +294 -0
- package/lib/services/recovery-instruction-service.js +348 -0
- package/lib/services/restore-service.js +221 -0
- package/lib/setup-command.js +359 -0
- package/lib/setup-wizard.js +155 -262
- package/lib/uninstall-command.js +100 -0
- package/lib/utils/claude-path-config.js +184 -0
- package/lib/utils/file-system-utils.js +152 -0
- package/lib/utils.js +8 -4
- package/lib/verify-command.js +430 -0
- package/package.json +7 -3
- package/scripts/postinstall.js +172 -157
- package/subagents/debug-specialist.md +7 -0
- package/templates/README.md +115 -0
- package/templates/basic-settings.json +30 -0
- package/templates/comprehensive-settings.json +57 -0
- package/templates/global-claude.md +344 -0
- package/templates/hybrid-hook-config.yaml +132 -0
- package/templates/security-focused-settings.json +62 -0
- package/templates/subagent-hooks.yaml +188 -0
- package/lib/package-manager-service.js +0 -270
- package/subagents/debug-context.md +0 -197
|
@@ -0,0 +1,903 @@
|
|
|
1
|
+
---
|
|
2
|
+
description: "Initialize a new project with comprehensive CLAUDE.md and specification framework"
|
|
3
|
+
tags: ["project", "setup", "initialization"]
|
|
4
|
+
---
|
|
5
|
+
|
|
6
|
+
# Initialize repo with comprehensive CLAUDE.md + Specification-Driven Development
|
|
7
|
+
|
|
8
|
+
Initialize a new project with comprehensive CLAUDE.md and specification framework.
|
|
9
|
+
|
|
10
|
+
## Usage
|
|
11
|
+
```
|
|
12
|
+
/xnew <project_name> [stack]
|
|
13
|
+
```
|
|
14
|
+
|
|
15
|
+
## Examples
|
|
16
|
+
```
|
|
17
|
+
/xnew vibecoding-web node
|
|
18
|
+
/xnew ai-patterns python
|
|
19
|
+
/xnew microservice-api go
|
|
20
|
+
```
|
|
21
|
+
|
|
22
|
+
## Parameters
|
|
23
|
+
- **PROJECT_NAME**: First word in arguments (default: current folder name)
|
|
24
|
+
- **STACK**: Technology stack (choices: `python` | `node` | `go` | `java` | `mixed`; default: `mixed`)
|
|
25
|
+
|
|
26
|
+
## Execution
|
|
27
|
+
|
|
28
|
+
Perform the following steps in order:
|
|
29
|
+
|
|
30
|
+
### Step 1: Safety & Idempotence
|
|
31
|
+
- Check for existing files before overwriting
|
|
32
|
+
- Create timestamped backups for any existing files (format: `filename.bak-YYYYMMDD-HHMMSS`)
|
|
33
|
+
- Never overwrite without backup creation
|
|
34
|
+
|
|
35
|
+
### Step 2: Create Comprehensive CLAUDE.md
|
|
36
|
+
Generate CLAUDE.md with Specification-Driven Development methodology:
|
|
37
|
+
|
|
38
|
+
```markdown
|
|
39
|
+
# Project: $PROJECT_NAME
|
|
40
|
+
# Stack: $STACK
|
|
41
|
+
# Generated: $(date +%Y-%m-%d)
|
|
42
|
+
# Development Methodology: Specification-Driven Development (SDD)
|
|
43
|
+
|
|
44
|
+
This is the single source of truth for all development standards, conventions, rules, and specifications for this project. Claude Code and other AI assistants should read this file first and follow these guidelines for all operations.
|
|
45
|
+
|
|
46
|
+
## 📚 Specification-Driven Development
|
|
47
|
+
|
|
48
|
+
This project follows Specification-Driven Development (SDD) methodology. All features MUST have specifications before implementation.
|
|
49
|
+
|
|
50
|
+
### Specification Framework
|
|
51
|
+
specs/
|
|
52
|
+
├── README.md # Specification guide and navigation
|
|
53
|
+
├── requirements.md # EARS-formatted requirements
|
|
54
|
+
├── design.md # Technical architecture and design
|
|
55
|
+
├── tasks.md # Atomic, sequenced implementation tasks
|
|
56
|
+
├── mvp-summary.md # MVP vs Advanced feature separation
|
|
57
|
+
├── testing-requirements.md # Test coverage requirements
|
|
58
|
+
├── performance-benchmarks.md # Performance targets and metrics
|
|
59
|
+
├── user-testing-strategy.md # User validation approach
|
|
60
|
+
├── system-monitoring.md # Operational monitoring strategy
|
|
61
|
+
├── hooks.md # Development lifecycle automation
|
|
62
|
+
├── agents.md # Multi-agent orchestration
|
|
63
|
+
├── context.md # Data classification and context management
|
|
64
|
+
└── github-actions-requirements.md # CI/CD automation specs
|
|
65
|
+
|
|
66
|
+
### AWS Kiro EARS Requirements Pattern
|
|
67
|
+
All Requirements Now Follow Official EARS Syntax:
|
|
68
|
+
|
|
69
|
+
- **Event-Driven**: "When [trigger], the system shall [response]"
|
|
70
|
+
- **State-Driven**: "While [precondition], the system shall [response]"
|
|
71
|
+
- **Ubiquitous**: "The system shall [response]"
|
|
72
|
+
- **Optional Feature**: "Where [feature], the system shall [response]"
|
|
73
|
+
- **Unwanted Behavior**: "If [trigger], then the system shall [response]"
|
|
74
|
+
|
|
75
|
+
The validation tool now shows **100% EARS compliance**
|
|
76
|
+
|
|
77
|
+
### Specification Coverage Requirements
|
|
78
|
+
- Every feature must have corresponding specifications
|
|
79
|
+
- Every specification must have corresponding tests
|
|
80
|
+
- Minimum spec coverage: 95% of all features
|
|
81
|
+
- Spec-to-test mapping: Automated validation required
|
|
82
|
+
- **EARS compliance: 100% mandatory for all requirements**
|
|
83
|
+
|
|
84
|
+
### EARS Validation Rules
|
|
85
|
+
🚨 **MANDATORY COMPLIANCE**:
|
|
86
|
+
- All requirements MUST use exact AWS Kiro EARS syntax with brackets
|
|
87
|
+
- No exceptions allowed - 100% compliance required
|
|
88
|
+
- Validation tool enforces strict format checking
|
|
89
|
+
- Requirements failing EARS format are rejected automatically
|
|
90
|
+
|
|
91
|
+
**EARS Format Validation Examples**:
|
|
92
|
+
✅ CORRECT: "When [user clicks save], the system shall [persist data to database]"
|
|
93
|
+
✅ CORRECT: "While [backup is running], the system shall [display progress indicator]"
|
|
94
|
+
✅ CORRECT: "The system shall [authenticate users before access]"
|
|
95
|
+
✅ CORRECT: "Where [admin privileges], the system shall [allow user management]"
|
|
96
|
+
✅ CORRECT: "If [network timeout occurs], then the system shall [retry 3 times]"
|
|
97
|
+
|
|
98
|
+
❌ INCORRECT: "User can save data" (not EARS format)
|
|
99
|
+
❌ INCORRECT: "System should authenticate" (missing brackets)
|
|
100
|
+
❌ INCORRECT: "When user saves, validate" (incomplete structure)
|
|
101
|
+
|
|
102
|
+
## 🎯 Project Goals & Context
|
|
103
|
+
- Primary objective: [Define main goal and success metrics]
|
|
104
|
+
- Technical requirements: [Core technical needs and constraints]
|
|
105
|
+
- Business objectives: [Business value delivered]
|
|
106
|
+
- User value: [What users gain from this system]
|
|
107
|
+
- Development methodology: Specification-Driven Development (SDD)
|
|
108
|
+
|
|
109
|
+
## 📋 Requirements Management
|
|
110
|
+
|
|
111
|
+
### Requirements Framework (AWS Kiro EARS)
|
|
112
|
+
requirement_structure:
|
|
113
|
+
id: "REQ-XXX"
|
|
114
|
+
pattern: "Event-Driven|State-Driven|Ubiquitous|Optional|Unwanted"
|
|
115
|
+
requirement: "MUST follow exact EARS syntax with brackets"
|
|
116
|
+
ears_format_examples:
|
|
117
|
+
- "When [user submits form], the system shall [validate all fields]"
|
|
118
|
+
- "While [user is authenticated], the system shall [display user dashboard]"
|
|
119
|
+
- "The system shall [encrypt all data at rest]"
|
|
120
|
+
- "Where [premium feature enabled], the system shall [allow advanced analytics]"
|
|
121
|
+
- "If [invalid login attempt], then the system shall [lock account after 3 failures]"
|
|
122
|
+
rationale: "Why this requirement exists"
|
|
123
|
+
acceptance_criteria: "Testable criteria for validation"
|
|
124
|
+
priority: "MVP|ADVANCED"
|
|
125
|
+
ears_compliance: "MANDATORY - 100% compliance required"
|
|
126
|
+
|
|
127
|
+
### MVP vs Advanced Features
|
|
128
|
+
- MVP Features: Core functionality for initial release
|
|
129
|
+
- Advanced Features: Enhanced capabilities for future iterations
|
|
130
|
+
- Decision Framework:
|
|
131
|
+
- ✅ Include in MVP if: Essential for core workflow
|
|
132
|
+
- ⚠️ Move to Advanced if: Complex edge cases or optimizations
|
|
133
|
+
|
|
134
|
+
## 📁 Directory Structure
|
|
135
|
+
project/
|
|
136
|
+
├── src/ # Source code
|
|
137
|
+
├── tests/ # Test suites
|
|
138
|
+
│ └── specs/ # Specification compliance tests
|
|
139
|
+
├── specs/ # SPECIFICATIONS (CRITICAL)
|
|
140
|
+
│ ├── README.md # Specification navigation guide
|
|
141
|
+
│ ├── requirements.md # EARS-formatted requirements
|
|
142
|
+
│ ├── design.md # Technical architecture
|
|
143
|
+
│ ├── tasks.md # Implementation roadmap
|
|
144
|
+
│ └── [other specs] # Additional specifications
|
|
145
|
+
├── docs/ # Documentation
|
|
146
|
+
├── .claude/ # Claude Code configuration
|
|
147
|
+
│ ├── commands/ # Custom slash commands
|
|
148
|
+
│ ├── hooks/ # Pre/post task hooks
|
|
149
|
+
│ └── knowledge/ # Captured patterns
|
|
150
|
+
├── scripts/ # Build and deployment scripts
|
|
151
|
+
├── ci/ # CI/CD configuration
|
|
152
|
+
├── config/ # Application configuration
|
|
153
|
+
└── AI_INTERACTIONS.md # AI development log
|
|
154
|
+
|
|
155
|
+
## 🏷️ Naming Conventions
|
|
156
|
+
|
|
157
|
+
### Files and Directories
|
|
158
|
+
- Files: kebab-case (e.g., user-service.js, api-client.ts)
|
|
159
|
+
- Test files: *.test.js or *.spec.js
|
|
160
|
+
- Config files: dot-prefixed (e.g., .env, .eslintrc)
|
|
161
|
+
- Documentation: UPPER-CASE.md for root docs, kebab-case.md for others
|
|
162
|
+
|
|
163
|
+
### Code Conventions
|
|
164
|
+
- Classes: PascalCase (e.g., UserService, ApiController)
|
|
165
|
+
- Interfaces/Types: PascalCase with 'I' or 'T' prefix optional
|
|
166
|
+
- Functions/Methods: camelCase (e.g., getUserById, handleRequest)
|
|
167
|
+
- Constants: UPPER_SNAKE_CASE (e.g., MAX_RETRIES, API_TIMEOUT)
|
|
168
|
+
- Variables: camelCase (e.g., currentUser, isLoading)
|
|
169
|
+
- Private members: underscore prefix (e.g., _privateMethod)
|
|
170
|
+
- Database: snake_case for tables and columns
|
|
171
|
+
|
|
172
|
+
## 💻 Language/Framework Standards - $STACK
|
|
173
|
+
|
|
174
|
+
[Insert stack-specific standards based on $STACK parameter]
|
|
175
|
+
|
|
176
|
+
## 🧪 Testing Strategy
|
|
177
|
+
|
|
178
|
+
### Specification-Based Testing
|
|
179
|
+
# Every specification must have corresponding tests
|
|
180
|
+
def test_req_001_ticker_submission():
|
|
181
|
+
"""
|
|
182
|
+
Test REQ-001: Ticker Symbol Submission
|
|
183
|
+
Spec: specs/requirements.md#REQ-001
|
|
184
|
+
"""
|
|
185
|
+
pass
|
|
186
|
+
|
|
187
|
+
### Coverage Requirements
|
|
188
|
+
- Unit tests: Minimum 80% code coverage
|
|
189
|
+
- Specification tests: 100% requirement coverage
|
|
190
|
+
- Integration tests: All API endpoints and database operations
|
|
191
|
+
- E2E tests: Critical user journeys
|
|
192
|
+
- Performance tests: Meet targets from specs/performance-benchmarks.md
|
|
193
|
+
|
|
194
|
+
## 🔐 Security Standards
|
|
195
|
+
|
|
196
|
+
### Application Security
|
|
197
|
+
- Input validation on all user inputs
|
|
198
|
+
- Parameterized queries to prevent SQL injection
|
|
199
|
+
- HTTPS only for all endpoints
|
|
200
|
+
- Rate limiting on all APIs
|
|
201
|
+
- Authentication required for all non-public endpoints
|
|
202
|
+
- JWT tokens with short expiration
|
|
203
|
+
- CORS properly configured
|
|
204
|
+
- Security headers (CSP, HSTS, X-Frame-Options)
|
|
205
|
+
- Regular dependency vulnerability scanning
|
|
206
|
+
|
|
207
|
+
### Data Protection
|
|
208
|
+
- Encryption at rest (AES-256)
|
|
209
|
+
- Encryption in transit (TLS 1.2+)
|
|
210
|
+
- No secrets in code (use environment variables)
|
|
211
|
+
- Secure credential storage
|
|
212
|
+
- Audit logging for sensitive operations
|
|
213
|
+
|
|
214
|
+
## 🚀 CI/CD Pipeline
|
|
215
|
+
|
|
216
|
+
### Pipeline Stages
|
|
217
|
+
1. Specification Validation - Verify all features have specifications
|
|
218
|
+
2. Build Stage - Compile and generate artifacts
|
|
219
|
+
3. Test Stage - Run all tests including spec compliance
|
|
220
|
+
4. Quality Gates - All must pass including spec coverage
|
|
221
|
+
5. Documentation Validation - Verify specs are complete
|
|
222
|
+
6. Deployment Stage - Blue-green deployment
|
|
223
|
+
7. Post-Deployment - Monitor and verify
|
|
224
|
+
|
|
225
|
+
## 🔄 Git & Version Control
|
|
226
|
+
|
|
227
|
+
### Branching Strategy
|
|
228
|
+
- Trunk-Based Development with short-lived feature branches
|
|
229
|
+
- Feature branches: feature/REQ-XXX-description
|
|
230
|
+
- Main branch is always deployable
|
|
231
|
+
|
|
232
|
+
### Commit Standards
|
|
233
|
+
- Use Conventional Commits format
|
|
234
|
+
- Reference specifications: feat(REQ-001): implement requirement
|
|
235
|
+
- Atomic commits (one logical change)
|
|
236
|
+
|
|
237
|
+
## 🛠️ Development Workflow
|
|
238
|
+
|
|
239
|
+
### Specification-Driven Development Process
|
|
240
|
+
|
|
241
|
+
1. Specification Phase (ALWAYS FIRST)
|
|
242
|
+
- Check specs/requirements.md for existing requirements
|
|
243
|
+
- Write/update EARS-formatted requirements
|
|
244
|
+
- Update specs/design.md with technical approach
|
|
245
|
+
- Break down into tasks in specs/tasks.md
|
|
246
|
+
|
|
247
|
+
2. Implementation Phase
|
|
248
|
+
- Reference specification in code comments
|
|
249
|
+
- Implement according to specs/design.md
|
|
250
|
+
- Follow task sequence from specs/tasks.md
|
|
251
|
+
|
|
252
|
+
3. Validation Phase (MANDATORY GATE)
|
|
253
|
+
- Run specification compliance tests
|
|
254
|
+
- **CRITICAL**: ALL tests must pass (100%) before proceeding
|
|
255
|
+
- Validate performance against benchmarks
|
|
256
|
+
- Update specifications if gaps found
|
|
257
|
+
|
|
258
|
+
### Test-First Development Gate
|
|
259
|
+
⚠️ **BLOCKING REQUIREMENT**: Before proceeding to the next specification or feature:
|
|
260
|
+
|
|
261
|
+
1. **Run Tests**: Execute `./scripts/run.sh test`
|
|
262
|
+
2. **Verify 100% Pass Rate**: ALL tests must pass - zero failures allowed
|
|
263
|
+
3. **Check Coverage**: Ensure specification coverage meets requirements
|
|
264
|
+
4. **Document Results**: Log test results in AI_INTERACTIONS.md
|
|
265
|
+
|
|
266
|
+
**If ANY test fails:**
|
|
267
|
+
- ❌ STOP all development work immediately
|
|
268
|
+
- 🔧 Fix failing tests before any new work
|
|
269
|
+
- ✅ Re-run tests until 100% pass rate achieved
|
|
270
|
+
- 📝 Only then proceed to next specification
|
|
271
|
+
|
|
272
|
+
This gate ensures each specification is fully validated before moving forward.
|
|
273
|
+
|
|
274
|
+
### Code Review Checklist
|
|
275
|
+
- [ ] References correct specification (REQ-XXX)
|
|
276
|
+
- [ ] **100% EARS COMPLIANCE VERIFIED** (all requirements use AWS Kiro format)
|
|
277
|
+
- [ ] Specification tests added/updated
|
|
278
|
+
- [ ] **100% TEST PASS RATE VERIFIED** (blocking requirement)
|
|
279
|
+
- [ ] Implementation matches specs/design.md
|
|
280
|
+
- [ ] Performance meets specs/performance-benchmarks.md
|
|
281
|
+
- [ ] Documentation updated in specs/
|
|
282
|
+
- [ ] No unspecified functionality added
|
|
283
|
+
- [ ] Test results logged in AI_INTERACTIONS.md
|
|
284
|
+
- [ ] EARS validation tool shows 100% compliance
|
|
285
|
+
|
|
286
|
+
## 📝 Documentation Standards
|
|
287
|
+
|
|
288
|
+
### Required Documentation
|
|
289
|
+
- README.md: Project overview
|
|
290
|
+
- CLAUDE.md: This file - development standards
|
|
291
|
+
- specs/: All specifications (PRIMARY SOURCE)
|
|
292
|
+
- AI_INTERACTIONS.md: Clean log of AI-assisted development
|
|
293
|
+
|
|
294
|
+
### AI Interaction Logging
|
|
295
|
+
Keep a clean, readable log in AI_INTERACTIONS.md:
|
|
296
|
+
|
|
297
|
+
## 2024-01-15 14:30 - Implement ticker validation
|
|
298
|
+
**H:** Implement REQ-001 ticker validation from specs
|
|
299
|
+
**AI:** Created regex validation with special handling for BRK.A format
|
|
300
|
+
**Result:** ✅ Working validation function
|
|
301
|
+
**Spec Updated:** Added BRK.A edge case to REQ-001
|
|
302
|
+
**Commit:** abc123f
|
|
303
|
+
|
|
304
|
+
Guidelines:
|
|
305
|
+
- Only log significant interactions (not routine questions)
|
|
306
|
+
- Keep entries brief and scannable
|
|
307
|
+
- Focus on: What was asked → What was done → What changed
|
|
308
|
+
- Use ✅ for success, ❌ for failed attempts, ⚠️ for partial success
|
|
309
|
+
|
|
310
|
+
## 🤖 AI-Assisted Development
|
|
311
|
+
|
|
312
|
+
### Working with Claude Code
|
|
313
|
+
- ALWAYS start with specifications: Read specs/ before any work
|
|
314
|
+
- Reference specifications in prompts: "Implement REQ-001 from specs/requirements.md"
|
|
315
|
+
- Follow the methodology: This project uses Specification-Driven Development
|
|
316
|
+
- Validate against specs: All AI-generated code must meet specifications
|
|
317
|
+
- **ENFORCE TEST GATE**: AI assistants MUST run tests and verify 100% pass before proceeding
|
|
318
|
+
|
|
319
|
+
### AI Assistant Test Requirements
|
|
320
|
+
🚨 **MANDATORY FOR ALL AI ASSISTANTS**:
|
|
321
|
+
|
|
322
|
+
1. **Validate EARS compliance**: All requirements MUST use AWS Kiro EARS format with brackets
|
|
323
|
+
2. **Before implementing new specs**: Run `./scripts/run.sh test` to ensure current state is clean
|
|
324
|
+
3. **After any code changes**: Execute `./scripts/run.sh test` immediately
|
|
325
|
+
4. **Verify 100% success**: All tests must pass - no exceptions
|
|
326
|
+
5. **Block on failures**: If ANY test fails, stop all work and fix tests first
|
|
327
|
+
6. **Document results**: Log test outcomes in AI_INTERACTIONS.md
|
|
328
|
+
|
|
329
|
+
**AI assistants must refuse to proceed with new specifications if:**
|
|
330
|
+
- Requirements are not in proper AWS Kiro EARS format (100% compliance required)
|
|
331
|
+
- Current tests are failing
|
|
332
|
+
- Test coverage is insufficient
|
|
333
|
+
- Test gate has not been satisfied
|
|
334
|
+
- EARS validation shows any non-compliant requirements
|
|
335
|
+
|
|
336
|
+
### Effective Prompts
|
|
337
|
+
Template: "I'm implementing [REQ-XXX] from specs/requirements.md. This is an [MVP/ADVANCED] feature with [EARS-PATTERN] pattern. Please help me implement this following specs/design.md architecture. REQUIREMENTS: 1) Ensure requirement uses AWS Kiro EARS format with brackets, 2) Run tests and verify 100% pass before proceeding to next spec, 3) Validate EARS compliance shows 100%."
|
|
338
|
+
|
|
339
|
+
## ✅ Definition of Done
|
|
340
|
+
|
|
341
|
+
A feature is considered "done" when ALL criteria are met:
|
|
342
|
+
|
|
343
|
+
### Specification Compliance
|
|
344
|
+
- [ ] All requirements from specs/requirements.md implemented
|
|
345
|
+
- [ ] **100% EARS COMPLIANCE** - All requirements use AWS Kiro format with brackets
|
|
346
|
+
- [ ] Design follows specs/design.md architecture
|
|
347
|
+
- [ ] Performance meets specs/performance-benchmarks.md targets
|
|
348
|
+
- [ ] User testing passes per specs/user-testing-strategy.md
|
|
349
|
+
- [ ] EARS validation tool confirms 100% compliance
|
|
350
|
+
|
|
351
|
+
### Code Quality
|
|
352
|
+
- [ ] Code follows all standards in CLAUDE.md
|
|
353
|
+
- [ ] Specification tests written and passing (100% coverage)
|
|
354
|
+
- [ ] Unit tests written and passing (≥80% coverage)
|
|
355
|
+
- [ ] **ALL TESTS PASS (100%) - ZERO FAILURES ALLOWED**
|
|
356
|
+
- [ ] Test execution verified via `./scripts/run.sh test`
|
|
357
|
+
- [ ] Documentation updated in specs/ and code
|
|
358
|
+
- [ ] Code reviewed and approved
|
|
359
|
+
|
|
360
|
+
### Operational Readiness
|
|
361
|
+
- [ ] CI/CD pipeline passing all stages
|
|
362
|
+
- [ ] Security scan passing
|
|
363
|
+
- [ ] Deployed to staging environment
|
|
364
|
+
- [ ] Monitoring configured per specs/system-monitoring.md
|
|
365
|
+
|
|
366
|
+
## 🔄 Continuous Improvement
|
|
367
|
+
|
|
368
|
+
### Learning from Implementation
|
|
369
|
+
When implementation teaches us something new:
|
|
370
|
+
1. Log it - Brief entry in AI_INTERACTIONS.md
|
|
371
|
+
2. Update spec - Add to specs/ with date marker
|
|
372
|
+
3. Test it - Add test for new understanding
|
|
373
|
+
4. Commit it - Clear commit message with spec reference
|
|
374
|
+
|
|
375
|
+
### Review Cycles
|
|
376
|
+
- Daily: Review current task against specifications
|
|
377
|
+
- Weekly: Update specs based on implementation learnings
|
|
378
|
+
- Sprint: Comprehensive specification review
|
|
379
|
+
- Quarterly: Major specification refactoring
|
|
380
|
+
|
|
381
|
+
---
|
|
382
|
+
|
|
383
|
+
Last Updated: $(date +%Y-%m-%d)
|
|
384
|
+
Version: 1.0.0
|
|
385
|
+
Methodology: Specification-Driven Development (SDD)
|
|
386
|
+
|
|
387
|
+
⚠️ CRITICAL: This document enforces Specification-Driven Development. All features MUST have specifications in the specs/ directory BEFORE implementation. No code without specs!
|
|
388
|
+
```
|
|
389
|
+
|
|
390
|
+
### Step 3: Create Specifications Directory
|
|
391
|
+
Create specs/ directory with essential templates:
|
|
392
|
+
|
|
393
|
+
```bash
|
|
394
|
+
mkdir -p specs/
|
|
395
|
+
```
|
|
396
|
+
|
|
397
|
+
Create specs/README.md with specification guide.
|
|
398
|
+
Create specs/requirements.md with EARS template.
|
|
399
|
+
Create specs/design.md with architecture template.
|
|
400
|
+
Create specs/tasks.md with implementation roadmap template.
|
|
401
|
+
Create other specification files as needed.
|
|
402
|
+
|
|
403
|
+
### Step 4: Generate .gitignore
|
|
404
|
+
Create stack-specific .gitignore based on $STACK parameter.
|
|
405
|
+
|
|
406
|
+
### Step 5: Create Directory Structure & Scripts
|
|
407
|
+
```bash
|
|
408
|
+
mkdir -p src tests/unit tests/integration tests/e2e tests/specs
|
|
409
|
+
mkdir -p docs/api docs/architecture docs/guides
|
|
410
|
+
mkdir -p scripts config ci
|
|
411
|
+
mkdir -p .claude/commands .claude/hooks .claude/knowledge
|
|
412
|
+
touch AI_INTERACTIONS.md
|
|
413
|
+
```
|
|
414
|
+
|
|
415
|
+
Create stack-specific automation scripts in `scripts/` directory:
|
|
416
|
+
|
|
417
|
+
**For Python Stack:**
|
|
418
|
+
Create `scripts/run.sh` as the unified automation script:
|
|
419
|
+
```bash
|
|
420
|
+
#!/bin/bash
|
|
421
|
+
# Python Project Automation Script
|
|
422
|
+
# Usage: ./scripts/run.sh [command] [args...]
|
|
423
|
+
|
|
424
|
+
set -e
|
|
425
|
+
SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
|
|
426
|
+
PROJECT_ROOT="$(dirname "$SCRIPT_DIR")"
|
|
427
|
+
cd "$PROJECT_ROOT"
|
|
428
|
+
|
|
429
|
+
PYTHON_VERSION="3.11"
|
|
430
|
+
VENV_DIR=".venv"
|
|
431
|
+
|
|
432
|
+
# Colors for output
|
|
433
|
+
RED='\033[0;31m'
|
|
434
|
+
GREEN='\033[0;32m'
|
|
435
|
+
YELLOW='\033[1;33m'
|
|
436
|
+
BLUE='\033[0;34m'
|
|
437
|
+
NC='\033[0m' # No Color
|
|
438
|
+
|
|
439
|
+
log() {
|
|
440
|
+
echo -e "${BLUE}[$(date +'%H:%M:%S')]${NC} $1"
|
|
441
|
+
}
|
|
442
|
+
|
|
443
|
+
success() {
|
|
444
|
+
echo -e "${GREEN}✅ $1${NC}"
|
|
445
|
+
}
|
|
446
|
+
|
|
447
|
+
warn() {
|
|
448
|
+
echo -e "${YELLOW}⚠️ $1${NC}"
|
|
449
|
+
}
|
|
450
|
+
|
|
451
|
+
error() {
|
|
452
|
+
echo -e "${RED}❌ $1${NC}"
|
|
453
|
+
exit 1
|
|
454
|
+
}
|
|
455
|
+
|
|
456
|
+
# Check if Python 3.11 is available
|
|
457
|
+
check_python() {
|
|
458
|
+
if command -v python$PYTHON_VERSION >/dev/null 2>&1; then
|
|
459
|
+
PYTHON_CMD="python$PYTHON_VERSION"
|
|
460
|
+
elif command -v python3 >/dev/null 2>&1 && python3 --version | grep -q "3.11"; then
|
|
461
|
+
PYTHON_CMD="python3"
|
|
462
|
+
elif command -v python >/dev/null 2>&1 && python --version | grep -q "3.11"; then
|
|
463
|
+
PYTHON_CMD="python"
|
|
464
|
+
else
|
|
465
|
+
error "Python 3.11 not found. Please install Python 3.11"
|
|
466
|
+
fi
|
|
467
|
+
log "Using Python: $($PYTHON_CMD --version)"
|
|
468
|
+
}
|
|
469
|
+
|
|
470
|
+
# Setup virtual environment
|
|
471
|
+
setup_venv() {
|
|
472
|
+
log "Setting up virtual environment..."
|
|
473
|
+
|
|
474
|
+
if [ ! -d "$VENV_DIR" ]; then
|
|
475
|
+
log "Creating virtual environment with Python $PYTHON_VERSION"
|
|
476
|
+
$PYTHON_CMD -m venv "$VENV_DIR"
|
|
477
|
+
success "Virtual environment created"
|
|
478
|
+
fi
|
|
479
|
+
|
|
480
|
+
# Activate virtual environment
|
|
481
|
+
source "$VENV_DIR/bin/activate"
|
|
482
|
+
|
|
483
|
+
# Upgrade pip
|
|
484
|
+
log "Upgrading pip..."
|
|
485
|
+
pip install --upgrade pip
|
|
486
|
+
|
|
487
|
+
success "Virtual environment activated"
|
|
488
|
+
}
|
|
489
|
+
|
|
490
|
+
# Install dependencies
|
|
491
|
+
install_deps() {
|
|
492
|
+
log "Installing dependencies..."
|
|
493
|
+
|
|
494
|
+
if [ -f "requirements.txt" ]; then
|
|
495
|
+
pip install -r requirements.txt
|
|
496
|
+
success "Production dependencies installed"
|
|
497
|
+
fi
|
|
498
|
+
|
|
499
|
+
if [ -f "requirements-dev.txt" ]; then
|
|
500
|
+
pip install -r requirements-dev.txt
|
|
501
|
+
success "Development dependencies installed"
|
|
502
|
+
fi
|
|
503
|
+
|
|
504
|
+
if [ -f "pyproject.toml" ]; then
|
|
505
|
+
pip install -e ".[dev]"
|
|
506
|
+
success "Package installed in development mode"
|
|
507
|
+
fi
|
|
508
|
+
}
|
|
509
|
+
|
|
510
|
+
# Run tests
|
|
511
|
+
run_tests() {
|
|
512
|
+
log "Running tests..."
|
|
513
|
+
|
|
514
|
+
# Run pytest with coverage
|
|
515
|
+
if command -v pytest >/dev/null 2>&1; then
|
|
516
|
+
pytest tests/ --cov=src --cov-report=html --cov-report=term
|
|
517
|
+
success "Tests completed with coverage report"
|
|
518
|
+
else
|
|
519
|
+
warn "pytest not found, running with unittest"
|
|
520
|
+
python -m unittest discover tests/
|
|
521
|
+
fi
|
|
522
|
+
}
|
|
523
|
+
|
|
524
|
+
# Run linting and formatting
|
|
525
|
+
run_quality() {
|
|
526
|
+
log "Running code quality checks..."
|
|
527
|
+
|
|
528
|
+
# Black formatting
|
|
529
|
+
if command -v black >/dev/null 2>&1; then
|
|
530
|
+
black src/ tests/ --check --diff
|
|
531
|
+
success "Black formatting check passed"
|
|
532
|
+
fi
|
|
533
|
+
|
|
534
|
+
# isort import sorting
|
|
535
|
+
if command -v isort >/dev/null 2>&1; then
|
|
536
|
+
isort src/ tests/ --check-only --diff
|
|
537
|
+
success "isort import check passed"
|
|
538
|
+
fi
|
|
539
|
+
|
|
540
|
+
# flake8 linting
|
|
541
|
+
if command -v flake8 >/dev/null 2>&1; then
|
|
542
|
+
flake8 src/ tests/
|
|
543
|
+
success "flake8 linting passed"
|
|
544
|
+
fi
|
|
545
|
+
|
|
546
|
+
# mypy type checking
|
|
547
|
+
if command -v mypy >/dev/null 2>&1; then
|
|
548
|
+
mypy src/
|
|
549
|
+
success "mypy type checking passed"
|
|
550
|
+
fi
|
|
551
|
+
}
|
|
552
|
+
|
|
553
|
+
# Run security scan
|
|
554
|
+
run_security() {
|
|
555
|
+
log "Running security scan..."
|
|
556
|
+
|
|
557
|
+
if command -v bandit >/dev/null 2>&1; then
|
|
558
|
+
bandit -r src/ -f json -o security-report.json
|
|
559
|
+
bandit -r src/
|
|
560
|
+
success "Security scan completed"
|
|
561
|
+
else
|
|
562
|
+
warn "bandit not installed, skipping security scan"
|
|
563
|
+
fi
|
|
564
|
+
|
|
565
|
+
# Check for known vulnerabilities
|
|
566
|
+
if command -v safety >/dev/null 2>&1; then
|
|
567
|
+
safety check
|
|
568
|
+
success "Dependency vulnerability check passed"
|
|
569
|
+
fi
|
|
570
|
+
}
|
|
571
|
+
|
|
572
|
+
# Build the project
|
|
573
|
+
run_build() {
|
|
574
|
+
log "Building project..."
|
|
575
|
+
|
|
576
|
+
if [ -f "setup.py" ] || [ -f "pyproject.toml" ]; then
|
|
577
|
+
python -m build
|
|
578
|
+
success "Build completed"
|
|
579
|
+
else
|
|
580
|
+
warn "No build configuration found (setup.py or pyproject.toml)"
|
|
581
|
+
fi
|
|
582
|
+
}
|
|
583
|
+
|
|
584
|
+
# Run GitHub Actions locally with nektos/act
|
|
585
|
+
run_act() {
|
|
586
|
+
log "Running GitHub Actions locally with act..."
|
|
587
|
+
|
|
588
|
+
if ! command -v act >/dev/null 2>&1; then
|
|
589
|
+
error "act not installed. Install with: brew install act"
|
|
590
|
+
fi
|
|
591
|
+
|
|
592
|
+
# Setup virtual environment first
|
|
593
|
+
setup_venv
|
|
594
|
+
install_deps
|
|
595
|
+
|
|
596
|
+
# Run act with the specified event
|
|
597
|
+
local event=${1:-push}
|
|
598
|
+
act "$event" --artifact-server-path /tmp/artifacts
|
|
599
|
+
|
|
600
|
+
success "GitHub Actions simulation completed"
|
|
601
|
+
}
|
|
602
|
+
|
|
603
|
+
# Deploy the application
|
|
604
|
+
run_deploy() {
|
|
605
|
+
log "Deploying application..."
|
|
606
|
+
|
|
607
|
+
# Run quality checks first
|
|
608
|
+
run_quality
|
|
609
|
+
run_tests
|
|
610
|
+
run_security
|
|
611
|
+
|
|
612
|
+
# Build
|
|
613
|
+
run_build
|
|
614
|
+
|
|
615
|
+
# Add deployment logic here
|
|
616
|
+
warn "Deployment logic not implemented yet"
|
|
617
|
+
}
|
|
618
|
+
|
|
619
|
+
# Development server
|
|
620
|
+
run_dev() {
|
|
621
|
+
log "Starting development server..."
|
|
622
|
+
|
|
623
|
+
setup_venv
|
|
624
|
+
install_deps
|
|
625
|
+
|
|
626
|
+
# Look for common dev server patterns
|
|
627
|
+
if [ -f "app.py" ]; then
|
|
628
|
+
python app.py
|
|
629
|
+
elif [ -f "main.py" ]; then
|
|
630
|
+
python main.py
|
|
631
|
+
elif [ -f "src/main.py" ]; then
|
|
632
|
+
python src/main.py
|
|
633
|
+
elif command -v uvicorn >/dev/null 2>&1 && [ -f "src/app.py" ]; then
|
|
634
|
+
uvicorn src.app:app --reload
|
|
635
|
+
else
|
|
636
|
+
error "No development server entry point found"
|
|
637
|
+
fi
|
|
638
|
+
}
|
|
639
|
+
|
|
640
|
+
# Clean up generated files
|
|
641
|
+
run_clean() {
|
|
642
|
+
log "Cleaning up..."
|
|
643
|
+
|
|
644
|
+
rm -rf build/ dist/ *.egg-info/
|
|
645
|
+
rm -rf .pytest_cache/ __pycache__/ .coverage htmlcov/
|
|
646
|
+
rm -rf .mypy_cache/ .bandit/
|
|
647
|
+
find . -type d -name __pycache__ -exec rm -rf {} + 2>/dev/null || true
|
|
648
|
+
find . -type f -name "*.pyc" -delete
|
|
649
|
+
|
|
650
|
+
success "Cleanup completed"
|
|
651
|
+
}
|
|
652
|
+
|
|
653
|
+
# Show help
|
|
654
|
+
show_help() {
|
|
655
|
+
echo "Usage: ./scripts/run.sh [command] [args...]"
|
|
656
|
+
echo ""
|
|
657
|
+
echo "Available commands:"
|
|
658
|
+
echo " setup - Setup virtual environment and install dependencies"
|
|
659
|
+
echo " test - Run tests with coverage"
|
|
660
|
+
echo " quality - Run linting, formatting, and type checks"
|
|
661
|
+
echo " security - Run security scans"
|
|
662
|
+
echo " build - Build the project"
|
|
663
|
+
echo " deploy - Deploy the application (includes all checks)"
|
|
664
|
+
echo " dev - Start development server"
|
|
665
|
+
echo " act [event] - Run GitHub Actions locally (default: push)"
|
|
666
|
+
echo " clean - Clean up generated files"
|
|
667
|
+
echo " help - Show this help message"
|
|
668
|
+
echo ""
|
|
669
|
+
echo "Examples:"
|
|
670
|
+
echo " ./scripts/run.sh setup"
|
|
671
|
+
echo " ./scripts/run.sh test"
|
|
672
|
+
echo " ./scripts/run.sh act pull_request"
|
|
673
|
+
echo " ./scripts/run.sh deploy"
|
|
674
|
+
}
|
|
675
|
+
|
|
676
|
+
# Main command processing
|
|
677
|
+
main() {
|
|
678
|
+
check_python
|
|
679
|
+
|
|
680
|
+
case "${1:-help}" in
|
|
681
|
+
"setup")
|
|
682
|
+
setup_venv
|
|
683
|
+
install_deps
|
|
684
|
+
;;
|
|
685
|
+
"test")
|
|
686
|
+
setup_venv
|
|
687
|
+
install_deps
|
|
688
|
+
run_tests
|
|
689
|
+
;;
|
|
690
|
+
"quality")
|
|
691
|
+
setup_venv
|
|
692
|
+
install_deps
|
|
693
|
+
run_quality
|
|
694
|
+
;;
|
|
695
|
+
"security")
|
|
696
|
+
setup_venv
|
|
697
|
+
install_deps
|
|
698
|
+
run_security
|
|
699
|
+
;;
|
|
700
|
+
"build")
|
|
701
|
+
setup_venv
|
|
702
|
+
install_deps
|
|
703
|
+
run_build
|
|
704
|
+
;;
|
|
705
|
+
"deploy")
|
|
706
|
+
setup_venv
|
|
707
|
+
install_deps
|
|
708
|
+
run_deploy
|
|
709
|
+
;;
|
|
710
|
+
"dev")
|
|
711
|
+
run_dev
|
|
712
|
+
;;
|
|
713
|
+
"act")
|
|
714
|
+
run_act "${2:-push}"
|
|
715
|
+
;;
|
|
716
|
+
"clean")
|
|
717
|
+
run_clean
|
|
718
|
+
;;
|
|
719
|
+
"help"|*)
|
|
720
|
+
show_help
|
|
721
|
+
;;
|
|
722
|
+
esac
|
|
723
|
+
}
|
|
724
|
+
|
|
725
|
+
# Cleanup function for script exit
|
|
726
|
+
cleanup() {
|
|
727
|
+
if [ -n "$VIRTUAL_ENV" ]; then
|
|
728
|
+
deactivate 2>/dev/null || true
|
|
729
|
+
log "Virtual environment deactivated"
|
|
730
|
+
fi
|
|
731
|
+
}
|
|
732
|
+
|
|
733
|
+
# Set trap for cleanup
|
|
734
|
+
trap cleanup EXIT
|
|
735
|
+
|
|
736
|
+
# Run main function
|
|
737
|
+
main "$@"
|
|
738
|
+
```
|
|
739
|
+
|
|
740
|
+
**For Node.js Stack:**
|
|
741
|
+
Create `scripts/run.sh` with npm/yarn automation:
|
|
742
|
+
```bash
|
|
743
|
+
#!/bin/bash
|
|
744
|
+
# Node.js Project Automation Script
|
|
745
|
+
|
|
746
|
+
set -e
|
|
747
|
+
SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
|
|
748
|
+
PROJECT_ROOT="$(dirname "$SCRIPT_DIR")"
|
|
749
|
+
cd "$PROJECT_ROOT"
|
|
750
|
+
|
|
751
|
+
NODE_VERSION="18"
|
|
752
|
+
|
|
753
|
+
# Package manager detection
|
|
754
|
+
if [ -f "yarn.lock" ]; then
|
|
755
|
+
PKG_MANAGER="yarn"
|
|
756
|
+
elif [ -f "pnpm-lock.yaml" ]; then
|
|
757
|
+
PKG_MANAGER="pnpm"
|
|
758
|
+
else
|
|
759
|
+
PKG_MANAGER="npm"
|
|
760
|
+
fi
|
|
761
|
+
|
|
762
|
+
log() {
|
|
763
|
+
echo -e "\033[0;34m[$(date +'%H:%M:%S')]\033[0m $1"
|
|
764
|
+
}
|
|
765
|
+
|
|
766
|
+
success() {
|
|
767
|
+
echo -e "\033[0;32m✅ $1\033[0m"
|
|
768
|
+
}
|
|
769
|
+
|
|
770
|
+
check_node() {
|
|
771
|
+
if ! command -v node >/dev/null 2>&1; then
|
|
772
|
+
error "Node.js not found. Please install Node.js $NODE_VERSION+"
|
|
773
|
+
fi
|
|
774
|
+
log "Using Node.js: $(node --version)"
|
|
775
|
+
log "Using package manager: $PKG_MANAGER"
|
|
776
|
+
}
|
|
777
|
+
|
|
778
|
+
install_deps() {
|
|
779
|
+
log "Installing dependencies..."
|
|
780
|
+
$PKG_MANAGER install
|
|
781
|
+
success "Dependencies installed"
|
|
782
|
+
}
|
|
783
|
+
|
|
784
|
+
run_tests() {
|
|
785
|
+
log "Running tests..."
|
|
786
|
+
$PKG_MANAGER test
|
|
787
|
+
success "Tests completed"
|
|
788
|
+
}
|
|
789
|
+
|
|
790
|
+
run_build() {
|
|
791
|
+
log "Building project..."
|
|
792
|
+
$PKG_MANAGER run build
|
|
793
|
+
success "Build completed"
|
|
794
|
+
}
|
|
795
|
+
|
|
796
|
+
run_dev() {
|
|
797
|
+
log "Starting development server..."
|
|
798
|
+
$PKG_MANAGER run dev
|
|
799
|
+
}
|
|
800
|
+
|
|
801
|
+
run_act() {
|
|
802
|
+
log "Running GitHub Actions locally..."
|
|
803
|
+
if ! command -v act >/dev/null 2>&1; then
|
|
804
|
+
error "act not installed. Install with: brew install act"
|
|
805
|
+
fi
|
|
806
|
+
|
|
807
|
+
install_deps
|
|
808
|
+
act "${1:-push}" --artifact-server-path /tmp/artifacts
|
|
809
|
+
success "GitHub Actions simulation completed"
|
|
810
|
+
}
|
|
811
|
+
|
|
812
|
+
# Add main function and other commands...
|
|
813
|
+
main() {
|
|
814
|
+
check_node
|
|
815
|
+
case "${1:-help}" in
|
|
816
|
+
"setup") install_deps ;;
|
|
817
|
+
"test") install_deps && run_tests ;;
|
|
818
|
+
"build") install_deps && run_build ;;
|
|
819
|
+
"dev") install_deps && run_dev ;;
|
|
820
|
+
"act") run_act "${2:-push}" ;;
|
|
821
|
+
*) echo "Usage: $0 {setup|test|build|dev|act}" ;;
|
|
822
|
+
esac
|
|
823
|
+
}
|
|
824
|
+
|
|
825
|
+
main "$@"
|
|
826
|
+
```
|
|
827
|
+
|
|
828
|
+
Make scripts executable:
|
|
829
|
+
```bash
|
|
830
|
+
chmod +x scripts/run.sh
|
|
831
|
+
```
|
|
832
|
+
|
|
833
|
+
### Step 6: Create README.md
|
|
834
|
+
Generate project README with SDD focus and specification references.
|
|
835
|
+
|
|
836
|
+
### Step 7: Git Commit
|
|
837
|
+
```bash
|
|
838
|
+
git add -A
|
|
839
|
+
git commit -m "init: SDD framework with CLAUDE.md and specifications via /xnew"
|
|
840
|
+
```
|
|
841
|
+
|
|
842
|
+
### Step 8: Final Output
|
|
843
|
+
```
|
|
844
|
+
✅ Repository initialized with Specification-Driven Development framework
|
|
845
|
+
|
|
846
|
+
Created:
|
|
847
|
+
- CLAUDE.md with SDD methodology and stack-specific standards
|
|
848
|
+
- specs/ directory with EARS templates and starter content
|
|
849
|
+
- scripts/run.sh - unified automation script for all operations
|
|
850
|
+
- AI_INTERACTIONS.md for logging AI-assisted development
|
|
851
|
+
- tests/specs/ for specification compliance testing
|
|
852
|
+
- Complete directory structure with configurations
|
|
853
|
+
|
|
854
|
+
Key Features:
|
|
855
|
+
✓ Specification-Driven Development enforced
|
|
856
|
+
✓ **AWS Kiro EARS requirements format with 100% compliance**
|
|
857
|
+
✓ EARS validation tool ensures perfect format compliance
|
|
858
|
+
✓ AI interaction logging with timestamps
|
|
859
|
+
✓ Specification evolution from discoveries
|
|
860
|
+
✓ Unified automation via scripts/run.sh
|
|
861
|
+
✓ Stack-specific tooling and standards
|
|
862
|
+
|
|
863
|
+
Automation Commands (via scripts/run.sh):
|
|
864
|
+
📦 ./scripts/run.sh setup - Install venv, Python 3.11, dependencies
|
|
865
|
+
🧪 ./scripts/run.sh test - Run tests with coverage
|
|
866
|
+
✨ ./scripts/run.sh quality - Linting, formatting, type checking
|
|
867
|
+
🔒 ./scripts/run.sh security - Security scans with bandit/safety
|
|
868
|
+
🏗️ ./scripts/run.sh build - Build project artifacts
|
|
869
|
+
🚀 ./scripts/run.sh deploy - Full deployment pipeline
|
|
870
|
+
⚡ ./scripts/run.sh dev - Start development server
|
|
871
|
+
🎭 ./scripts/run.sh act [event] - Run GitHub Actions with nektos/act
|
|
872
|
+
🧹 ./scripts/run.sh clean - Clean generated files
|
|
873
|
+
|
|
874
|
+
Next steps:
|
|
875
|
+
1. Run: ./scripts/run.sh setup (installs everything you need)
|
|
876
|
+
2. Write initial requirements in specs/requirements.md
|
|
877
|
+
3. Create technical design in specs/design.md
|
|
878
|
+
4. Run: ./scripts/run.sh test (validates your setup)
|
|
879
|
+
5. Begin implementation following specifications
|
|
880
|
+
6. Use ./scripts/run.sh act to test GitHub Actions locally
|
|
881
|
+
|
|
882
|
+
Remember:
|
|
883
|
+
- ALWAYS check specs/ before implementing!
|
|
884
|
+
- **ENSURE 100% AWS Kiro EARS compliance with brackets!**
|
|
885
|
+
- USE ./scripts/run.sh for all operations!
|
|
886
|
+
- **RUN TESTS and verify 100% pass before next spec!**
|
|
887
|
+
- LOG significant AI interactions!
|
|
888
|
+
- UPDATE specs when you learn something new!
|
|
889
|
+
|
|
890
|
+
The scripts/run.sh is your single entry point for:
|
|
891
|
+
✅ Python 3.11 virtual environment management
|
|
892
|
+
✅ Dependency installation and updates
|
|
893
|
+
✅ Running tests, linting, security scans
|
|
894
|
+
✅ Building, deploying, and development workflows
|
|
895
|
+
✅ Local GitHub Actions testing with nektos/act
|
|
896
|
+
✅ Proper virtual environment cleanup
|
|
897
|
+
|
|
898
|
+
🚨 **CRITICAL TEST GATE**:
|
|
899
|
+
- Before implementing new specs: `./scripts/run.sh test`
|
|
900
|
+
- ALL tests must pass (100%) - zero failures allowed
|
|
901
|
+
- AI assistants MUST enforce this gate
|
|
902
|
+
- Block all work if tests fail until fixed
|
|
903
|
+
```
|