tlc-claude-code 1.5.2 → 1.5.4
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/.claude/commands/tlc/audit.md +129 -0
- package/.claude/commands/tlc/autofix.md +217 -0
- package/.claude/commands/tlc/bug.md +255 -0
- package/.claude/commands/tlc/build.md +731 -0
- package/.claude/commands/tlc/checklist.md +212 -0
- package/.claude/commands/tlc/ci.md +414 -0
- package/.claude/commands/tlc/claim.md +189 -0
- package/.claude/commands/tlc/cleanup.md +187 -0
- package/.claude/commands/tlc/complete.md +160 -0
- package/.claude/commands/tlc/config.md +395 -0
- package/.claude/commands/tlc/coverage.md +222 -0
- package/.claude/commands/tlc/deploy.md +723 -0
- package/.claude/commands/tlc/discuss.md +185 -0
- package/.claude/commands/tlc/docs.md +194 -0
- package/.claude/commands/tlc/edge-cases.md +241 -0
- package/.claude/commands/tlc/export.md +456 -0
- package/.claude/commands/tlc/help.md +169 -0
- package/.claude/commands/tlc/import-project.md +246 -0
- package/.claude/commands/tlc/init.md +443 -0
- package/.claude/commands/tlc/issues.md +376 -0
- package/.claude/commands/tlc/llm.md +111 -0
- package/.claude/commands/tlc/new-milestone.md +172 -0
- package/.claude/commands/tlc/new-project.md +399 -0
- package/.claude/commands/tlc/next.md +129 -0
- package/.claude/commands/tlc/outdated.md +200 -0
- package/.claude/commands/tlc/plan.md +224 -0
- package/.claude/commands/tlc/progress.md +153 -0
- package/.claude/commands/tlc/quality.md +185 -0
- package/.claude/commands/tlc/quick.md +52 -0
- package/.claude/commands/tlc/refactor.md +190 -0
- package/.claude/commands/tlc/release.md +135 -0
- package/.claude/commands/tlc/review-pr.md +184 -0
- package/.claude/commands/tlc/review.md +200 -0
- package/.claude/commands/tlc/security.md +195 -0
- package/.claude/commands/tlc/server.md +19 -0
- package/.claude/commands/tlc/start.md +137 -0
- package/.claude/commands/tlc/status.md +65 -0
- package/.claude/commands/tlc/sync.md +652 -0
- package/.claude/commands/tlc/tlc.md +279 -0
- package/.claude/commands/tlc/verify.md +159 -0
- package/.claude/commands/tlc/who.md +151 -0
- package/bin/install.js +11 -0
- package/bin/postinstall.js +54 -0
- package/package.json +3 -1
|
@@ -0,0 +1,190 @@
|
|
|
1
|
+
# /tlc:refactor - Step-by-Step Standards Refactoring
|
|
2
|
+
|
|
3
|
+
Fix coding standards violations one step at a time with previews and checkpoints.
|
|
4
|
+
|
|
5
|
+
## What This Does
|
|
6
|
+
|
|
7
|
+
Same fixes as `/tlc:cleanup` but:
|
|
8
|
+
- Shows preview before each change
|
|
9
|
+
- Waits for confirmation
|
|
10
|
+
- Can skip individual steps
|
|
11
|
+
- Can abort at any point
|
|
12
|
+
- Saves checkpoints for resume
|
|
13
|
+
|
|
14
|
+
## Usage
|
|
15
|
+
|
|
16
|
+
```
|
|
17
|
+
/tlc:refactor
|
|
18
|
+
```
|
|
19
|
+
|
|
20
|
+
## Process
|
|
21
|
+
|
|
22
|
+
### Step 1: Create or Resume Session
|
|
23
|
+
|
|
24
|
+
Check for existing checkpoint:
|
|
25
|
+
|
|
26
|
+
```javascript
|
|
27
|
+
const { loadCheckpoint, createRefactorSession } = require('./lib/standards/refactor-stepper');
|
|
28
|
+
|
|
29
|
+
let session = await loadCheckpoint(projectPath);
|
|
30
|
+
if (session) {
|
|
31
|
+
console.log('Found checkpoint from', session.savedAt);
|
|
32
|
+
console.log('Resume? [Y/n]');
|
|
33
|
+
// If yes, resume; if no, start fresh
|
|
34
|
+
} else {
|
|
35
|
+
const auditResults = await auditProject(projectPath);
|
|
36
|
+
session = await createRefactorSession(projectPath, auditResults);
|
|
37
|
+
}
|
|
38
|
+
```
|
|
39
|
+
|
|
40
|
+
### Step 2: Show Session Overview
|
|
41
|
+
|
|
42
|
+
```
|
|
43
|
+
TLC Refactor - Step-by-Step Standards Fix
|
|
44
|
+
═══════════════════════════════════════════════════════════════
|
|
45
|
+
|
|
46
|
+
Session: abc123
|
|
47
|
+
Steps: 11 total
|
|
48
|
+
- 4 config extractions
|
|
49
|
+
- 3 folder migrations
|
|
50
|
+
- 2 interface extractions
|
|
51
|
+
- 2 constant replacements
|
|
52
|
+
|
|
53
|
+
Press Enter to start, or 'q' to quit: _
|
|
54
|
+
```
|
|
55
|
+
|
|
56
|
+
### Step 3: For Each Step
|
|
57
|
+
|
|
58
|
+
#### Show Preview
|
|
59
|
+
|
|
60
|
+
```
|
|
61
|
+
Step 1/11: Extract hardcoded URL
|
|
62
|
+
═══════════════════════════════════════════════════════════════
|
|
63
|
+
|
|
64
|
+
File: src/api.ts
|
|
65
|
+
|
|
66
|
+
BEFORE:
|
|
67
|
+
15 │ fetch('http://localhost:3000/api/users');
|
|
68
|
+
|
|
69
|
+
AFTER:
|
|
70
|
+
15 │ fetch((process.env.API_URL || 'http://localhost:3000') + '/api/users');
|
|
71
|
+
|
|
72
|
+
Environment variable: API_URL
|
|
73
|
+
Default value: http://localhost:3000
|
|
74
|
+
|
|
75
|
+
───────────────────────────────────────────────────────────────
|
|
76
|
+
[Enter] Apply [s] Skip [q] Quit [?] Help: _
|
|
77
|
+
```
|
|
78
|
+
|
|
79
|
+
#### Handle User Input
|
|
80
|
+
|
|
81
|
+
| Key | Action |
|
|
82
|
+
|-----|--------|
|
|
83
|
+
| Enter | Apply the change |
|
|
84
|
+
| s | Skip this step |
|
|
85
|
+
| q | Quit and save checkpoint |
|
|
86
|
+
| ? | Show help |
|
|
87
|
+
|
|
88
|
+
#### After Apply
|
|
89
|
+
|
|
90
|
+
```
|
|
91
|
+
✓ Applied: Extracted API_URL
|
|
92
|
+
|
|
93
|
+
Commit this change? [Y/n]: y
|
|
94
|
+
✓ Committed: refactor(api): extract API_URL to environment
|
|
95
|
+
|
|
96
|
+
Continuing to step 2/11...
|
|
97
|
+
```
|
|
98
|
+
|
|
99
|
+
### Step 4: Handle Skip
|
|
100
|
+
|
|
101
|
+
```
|
|
102
|
+
Step 5/11: Migrate src/services/user.service.ts
|
|
103
|
+
═══════════════════════════════════════════════════════════════
|
|
104
|
+
|
|
105
|
+
Skip this step? Enter reason (optional): Not applicable - this is a shared utility
|
|
106
|
+
|
|
107
|
+
✓ Skipped: Migrate user.service.ts
|
|
108
|
+
Reason: Not applicable - this is a shared utility
|
|
109
|
+
|
|
110
|
+
Continuing to step 6/11...
|
|
111
|
+
```
|
|
112
|
+
|
|
113
|
+
### Step 5: Handle Abort
|
|
114
|
+
|
|
115
|
+
```
|
|
116
|
+
Aborting session...
|
|
117
|
+
|
|
118
|
+
Progress saved to: .planning/refactor-checkpoint.json
|
|
119
|
+
|
|
120
|
+
Completed: 4/11 steps
|
|
121
|
+
Skipped: 1 step
|
|
122
|
+
Remaining: 6 steps
|
|
123
|
+
|
|
124
|
+
Resume later with: /tlc:refactor
|
|
125
|
+
```
|
|
126
|
+
|
|
127
|
+
### Step 6: Completion
|
|
128
|
+
|
|
129
|
+
```
|
|
130
|
+
TLC Refactor Complete
|
|
131
|
+
═══════════════════════════════════════════════════════════════
|
|
132
|
+
|
|
133
|
+
Session: abc123
|
|
134
|
+
Duration: 12 minutes
|
|
135
|
+
|
|
136
|
+
Results:
|
|
137
|
+
✓ Applied: 9 steps
|
|
138
|
+
○ Skipped: 2 steps
|
|
139
|
+
|
|
140
|
+
Commits created: 5
|
|
141
|
+
- refactor(api): extract environment variables
|
|
142
|
+
- refactor(user): migrate to entity folder
|
|
143
|
+
- refactor(user): extract interfaces to types/
|
|
144
|
+
- refactor(product): migrate to entity folder
|
|
145
|
+
- refactor(shared): add JSDoc comments
|
|
146
|
+
|
|
147
|
+
All selected fixes applied. Run /tlc:audit to verify.
|
|
148
|
+
```
|
|
149
|
+
|
|
150
|
+
## Checkpoint Format
|
|
151
|
+
|
|
152
|
+
Saved to `.planning/refactor-checkpoint.json`:
|
|
153
|
+
|
|
154
|
+
```json
|
|
155
|
+
{
|
|
156
|
+
"id": "session-abc123",
|
|
157
|
+
"projectPath": "/path/to/project",
|
|
158
|
+
"savedAt": "2024-01-15T10:30:00Z",
|
|
159
|
+
"currentStep": 4,
|
|
160
|
+
"steps": [
|
|
161
|
+
{ "id": "1", "type": "extract-config", "status": "completed" },
|
|
162
|
+
{ "id": "2", "type": "extract-config", "status": "completed" },
|
|
163
|
+
{ "id": "3", "type": "migrate-folder", "status": "completed" },
|
|
164
|
+
{ "id": "4", "type": "migrate-folder", "status": "skipped", "skipReason": "Shared utility" },
|
|
165
|
+
{ "id": "5", "type": "extract-interface", "status": "pending" }
|
|
166
|
+
]
|
|
167
|
+
}
|
|
168
|
+
```
|
|
169
|
+
|
|
170
|
+
## Step Priority Order
|
|
171
|
+
|
|
172
|
+
Steps are ordered for safe execution:
|
|
173
|
+
|
|
174
|
+
1. **Extract config** - Environment variables first (no structural changes)
|
|
175
|
+
2. **Migrate folders** - Move files to entity structure
|
|
176
|
+
3. **Extract interfaces** - Pull types to separate files
|
|
177
|
+
4. **Replace constants** - Add constants files
|
|
178
|
+
5. **Add JSDoc** - Documentation last (doesn't affect imports)
|
|
179
|
+
|
|
180
|
+
## When to Use
|
|
181
|
+
|
|
182
|
+
- **Learning**: Understand what each change does
|
|
183
|
+
- **Selective fixes**: Skip changes that don't apply
|
|
184
|
+
- **Large codebase**: Take breaks, resume later
|
|
185
|
+
- **Review**: Want to approve each change
|
|
186
|
+
|
|
187
|
+
## See Also
|
|
188
|
+
|
|
189
|
+
- `/tlc:audit` - Check without fixing
|
|
190
|
+
- `/tlc:cleanup` - Fix everything automatically
|
|
@@ -0,0 +1,135 @@
|
|
|
1
|
+
# /tlc:release - Release a Task
|
|
2
|
+
|
|
3
|
+
Release a task you claimed so others can work on it.
|
|
4
|
+
|
|
5
|
+
## Usage
|
|
6
|
+
|
|
7
|
+
```
|
|
8
|
+
/tlc:release [task-number]
|
|
9
|
+
```
|
|
10
|
+
|
|
11
|
+
## When to Use
|
|
12
|
+
|
|
13
|
+
- Blocked and can't continue
|
|
14
|
+
- Switching to a different task
|
|
15
|
+
- End of day, won't finish
|
|
16
|
+
- Decided task approach needs rethinking
|
|
17
|
+
|
|
18
|
+
## Process
|
|
19
|
+
|
|
20
|
+
### Step 1: Identify User
|
|
21
|
+
|
|
22
|
+
Get current user identity (same as `/tlc:claim`):
|
|
23
|
+
|
|
24
|
+
```bash
|
|
25
|
+
if [ -n "$TLC_USER" ]; then
|
|
26
|
+
user=$TLC_USER
|
|
27
|
+
else
|
|
28
|
+
user=$(git config user.name | tr '[:upper:]' '[:lower:]' | tr ' ' '-')
|
|
29
|
+
fi
|
|
30
|
+
```
|
|
31
|
+
|
|
32
|
+
### Step 2: Find Your Claims
|
|
33
|
+
|
|
34
|
+
Parse current phase PLAN.md for tasks claimed by you:
|
|
35
|
+
|
|
36
|
+
```
|
|
37
|
+
Looking for tasks claimed by @alice...
|
|
38
|
+
|
|
39
|
+
Your claimed tasks:
|
|
40
|
+
2. Add validation [>@alice]
|
|
41
|
+
5. Error handling [>@alice]
|
|
42
|
+
```
|
|
43
|
+
|
|
44
|
+
### Step 3: Select Task to Release
|
|
45
|
+
|
|
46
|
+
If task-number provided:
|
|
47
|
+
- Verify you own that task
|
|
48
|
+
- If not yours, show error
|
|
49
|
+
|
|
50
|
+
If not provided:
|
|
51
|
+
- Show your claimed tasks
|
|
52
|
+
- Prompt to select one
|
|
53
|
+
|
|
54
|
+
### Step 4: Update Task Marker
|
|
55
|
+
|
|
56
|
+
Change from claimed to available:
|
|
57
|
+
|
|
58
|
+
```markdown
|
|
59
|
+
### Task 2: Add validation [>@alice]
|
|
60
|
+
```
|
|
61
|
+
|
|
62
|
+
becomes:
|
|
63
|
+
|
|
64
|
+
```markdown
|
|
65
|
+
### Task 2: Add validation [ ]
|
|
66
|
+
```
|
|
67
|
+
|
|
68
|
+
### Step 5: Commit and Push
|
|
69
|
+
|
|
70
|
+
```bash
|
|
71
|
+
git add .planning/phases/{N}-PLAN.md
|
|
72
|
+
git commit -m "release: task {N} - {title} (@{user})"
|
|
73
|
+
git push
|
|
74
|
+
```
|
|
75
|
+
|
|
76
|
+
## Example Session
|
|
77
|
+
|
|
78
|
+
```
|
|
79
|
+
> /tlc:release
|
|
80
|
+
|
|
81
|
+
Your claimed tasks in Phase 1:
|
|
82
|
+
2. Add validation [>@alice]
|
|
83
|
+
5. Error handling [>@alice]
|
|
84
|
+
|
|
85
|
+
Release which task? [2/5]: 2
|
|
86
|
+
|
|
87
|
+
Task 2: Add validation [>@alice] → [ ]
|
|
88
|
+
|
|
89
|
+
✓ Committed: release: task 2 - Add validation (@alice)
|
|
90
|
+
✓ Pushed
|
|
91
|
+
|
|
92
|
+
Task 2 is now available for others.
|
|
93
|
+
```
|
|
94
|
+
|
|
95
|
+
## With Task Number
|
|
96
|
+
|
|
97
|
+
```
|
|
98
|
+
> /tlc:release 2
|
|
99
|
+
|
|
100
|
+
Task 2: Add validation [>@alice] → [ ]
|
|
101
|
+
|
|
102
|
+
✓ Committed: release: task 2 - Add validation (@alice)
|
|
103
|
+
✓ Pushed
|
|
104
|
+
|
|
105
|
+
Task 2 is now available for others.
|
|
106
|
+
```
|
|
107
|
+
|
|
108
|
+
## Error Handling
|
|
109
|
+
|
|
110
|
+
**Not your task:**
|
|
111
|
+
```
|
|
112
|
+
Task 2 is claimed by @bob, not you.
|
|
113
|
+
You can only release your own tasks.
|
|
114
|
+
|
|
115
|
+
Your tasks: 5
|
|
116
|
+
```
|
|
117
|
+
|
|
118
|
+
**Task not claimed:**
|
|
119
|
+
```
|
|
120
|
+
Task 2 is not claimed (already available).
|
|
121
|
+
Nothing to release.
|
|
122
|
+
```
|
|
123
|
+
|
|
124
|
+
**No tasks claimed:**
|
|
125
|
+
```
|
|
126
|
+
You have no claimed tasks in Phase 1.
|
|
127
|
+
Use /tlc:claim to claim a task.
|
|
128
|
+
```
|
|
129
|
+
|
|
130
|
+
## Notes
|
|
131
|
+
|
|
132
|
+
- Releasing doesn't undo any work you've done
|
|
133
|
+
- Your commits remain in history
|
|
134
|
+
- Another teammate can claim and continue where you left off
|
|
135
|
+
- Consider adding a note to the task if you made partial progress
|
|
@@ -0,0 +1,184 @@
|
|
|
1
|
+
# /tlc:review-pr - Review a Pull Request
|
|
2
|
+
|
|
3
|
+
Review a GitHub/GitLab pull request for TLC compliance.
|
|
4
|
+
|
|
5
|
+
## What This Does
|
|
6
|
+
|
|
7
|
+
1. Fetches PR diff from GitHub/GitLab
|
|
8
|
+
2. Checks test coverage for all changed files
|
|
9
|
+
3. Analyzes commit order for TDD compliance
|
|
10
|
+
4. Scans for security issues
|
|
11
|
+
5. Posts review comment with verdict
|
|
12
|
+
|
|
13
|
+
## Usage
|
|
14
|
+
|
|
15
|
+
```
|
|
16
|
+
/tlc:review-pr <pr_number>
|
|
17
|
+
/tlc:review-pr <pr_url>
|
|
18
|
+
/tlc:review-pr # Review current PR (if on PR branch)
|
|
19
|
+
```
|
|
20
|
+
|
|
21
|
+
## Process
|
|
22
|
+
|
|
23
|
+
### Step 1: Fetch PR Information
|
|
24
|
+
|
|
25
|
+
```bash
|
|
26
|
+
# Get PR details
|
|
27
|
+
gh pr view <number> --json number,title,headRefName,baseRefName,additions,deletions
|
|
28
|
+
|
|
29
|
+
# Get changed files
|
|
30
|
+
gh pr diff <number> --name-only
|
|
31
|
+
```
|
|
32
|
+
|
|
33
|
+
### Step 2: Checkout PR Branch (if needed)
|
|
34
|
+
|
|
35
|
+
```bash
|
|
36
|
+
gh pr checkout <number>
|
|
37
|
+
```
|
|
38
|
+
|
|
39
|
+
### Step 3: Run Full Review
|
|
40
|
+
|
|
41
|
+
Same checks as `/tlc:review`:
|
|
42
|
+
- Test coverage for changed files
|
|
43
|
+
- TDD compliance (commit order)
|
|
44
|
+
- Security scan
|
|
45
|
+
|
|
46
|
+
### Step 4: Generate PR Comment
|
|
47
|
+
|
|
48
|
+
```markdown
|
|
49
|
+
## 🤖 TLC Code Review
|
|
50
|
+
|
|
51
|
+
| Check | Status |
|
|
52
|
+
|-------|--------|
|
|
53
|
+
| Test Coverage | ✅ All files covered |
|
|
54
|
+
| TDD Score | ✅ 75% |
|
|
55
|
+
| Security | ✅ No issues |
|
|
56
|
+
|
|
57
|
+
### Summary
|
|
58
|
+
|
|
59
|
+
- 8 files changed (5 impl, 3 tests)
|
|
60
|
+
- 4 commits analyzed
|
|
61
|
+
- No security vulnerabilities detected
|
|
62
|
+
|
|
63
|
+
### Verdict: ✅ APPROVED
|
|
64
|
+
|
|
65
|
+
---
|
|
66
|
+
*Automated review by [TLC](https://github.com/jurgencalleja/TLC)*
|
|
67
|
+
```
|
|
68
|
+
|
|
69
|
+
### Step 5: Post Review
|
|
70
|
+
|
|
71
|
+
```bash
|
|
72
|
+
# Post as PR comment
|
|
73
|
+
gh pr comment <number> --body "<review_markdown>"
|
|
74
|
+
|
|
75
|
+
# Or submit as review
|
|
76
|
+
gh pr review <number> --approve --body "<review_markdown>"
|
|
77
|
+
gh pr review <number> --request-changes --body "<review_markdown>"
|
|
78
|
+
```
|
|
79
|
+
|
|
80
|
+
## Example Output
|
|
81
|
+
|
|
82
|
+
### Reviewing PR #42
|
|
83
|
+
|
|
84
|
+
```
|
|
85
|
+
/tlc:review-pr 42
|
|
86
|
+
|
|
87
|
+
Fetching PR #42: "Add user authentication"
|
|
88
|
+
Branch: feature/auth → main
|
|
89
|
+
Author: @alice
|
|
90
|
+
|
|
91
|
+
Fetching diff...
|
|
92
|
+
Changed files: 6
|
|
93
|
+
├── src/auth/login.js (+120, -0)
|
|
94
|
+
├── src/auth/login.test.js (+85, -0) ✓
|
|
95
|
+
├── src/auth/session.js (+45, -0)
|
|
96
|
+
├── src/auth/session.test.js (+60, -0) ✓
|
|
97
|
+
├── src/middleware/auth.js (+30, -0)
|
|
98
|
+
└── src/middleware/auth.test.js (+40, -0) ✓
|
|
99
|
+
|
|
100
|
+
Running checks...
|
|
101
|
+
|
|
102
|
+
Test coverage: ✅ All implementation files have tests
|
|
103
|
+
TDD Score: 67% ✅
|
|
104
|
+
Security: ✅ No issues
|
|
105
|
+
|
|
106
|
+
Posting review...
|
|
107
|
+
|
|
108
|
+
─────────────────────────────────
|
|
109
|
+
✅ PR #42 APPROVED
|
|
110
|
+
|
|
111
|
+
Review posted: https://github.com/org/repo/pull/42#review-123456
|
|
112
|
+
─────────────────────────────────
|
|
113
|
+
```
|
|
114
|
+
|
|
115
|
+
### PR with Issues
|
|
116
|
+
|
|
117
|
+
```
|
|
118
|
+
/tlc:review-pr 43
|
|
119
|
+
|
|
120
|
+
Fetching PR #43: "Quick fix for login"
|
|
121
|
+
Branch: hotfix/login → main
|
|
122
|
+
|
|
123
|
+
Changed files: 2
|
|
124
|
+
├── src/auth/login.js (+15, -3)
|
|
125
|
+
└── src/config.js (+2, -0)
|
|
126
|
+
|
|
127
|
+
Running checks...
|
|
128
|
+
|
|
129
|
+
Test coverage: ❌ 2 files without tests
|
|
130
|
+
├── src/auth/login.js (modified, existing tests may not cover changes)
|
|
131
|
+
└── src/config.js (no test file found)
|
|
132
|
+
|
|
133
|
+
TDD Score: 0% ❌
|
|
134
|
+
Security: ⚠️ 1 medium severity issue
|
|
135
|
+
└── console.log with sensitive data
|
|
136
|
+
|
|
137
|
+
Posting review...
|
|
138
|
+
|
|
139
|
+
─────────────────────────────────
|
|
140
|
+
❌ PR #43 CHANGES REQUESTED
|
|
141
|
+
|
|
142
|
+
Review posted with requested changes.
|
|
143
|
+
See: https://github.com/org/repo/pull/43#review-123457
|
|
144
|
+
|
|
145
|
+
Required actions:
|
|
146
|
+
1. Add/update tests for modified files
|
|
147
|
+
2. Remove console.log with sensitive data
|
|
148
|
+
─────────────────────────────────
|
|
149
|
+
```
|
|
150
|
+
|
|
151
|
+
## Flags
|
|
152
|
+
|
|
153
|
+
| Flag | Description |
|
|
154
|
+
|------|-------------|
|
|
155
|
+
| `--no-post` | Generate review but don't post to PR |
|
|
156
|
+
| `--approve` | Force approve (skip checks) |
|
|
157
|
+
| `--comment-only` | Post as comment instead of review |
|
|
158
|
+
|
|
159
|
+
## GitHub Actions Integration
|
|
160
|
+
|
|
161
|
+
Add to your workflow:
|
|
162
|
+
|
|
163
|
+
```yaml
|
|
164
|
+
name: TLC Review
|
|
165
|
+
on: [pull_request]
|
|
166
|
+
|
|
167
|
+
jobs:
|
|
168
|
+
review:
|
|
169
|
+
runs-on: ubuntu-latest
|
|
170
|
+
steps:
|
|
171
|
+
- uses: actions/checkout@v4
|
|
172
|
+
with:
|
|
173
|
+
fetch-depth: 0
|
|
174
|
+
|
|
175
|
+
- name: TLC Review
|
|
176
|
+
run: |
|
|
177
|
+
npx tlc-claude-code review-pr ${{ github.event.pull_request.number }}
|
|
178
|
+
env:
|
|
179
|
+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
|
180
|
+
```
|
|
181
|
+
|
|
182
|
+
## ARGUMENTS
|
|
183
|
+
|
|
184
|
+
$ARGUMENTS
|
|
@@ -0,0 +1,200 @@
|
|
|
1
|
+
# /tlc:review - Review Current Branch
|
|
2
|
+
|
|
3
|
+
Review changes on current branch before pushing.
|
|
4
|
+
|
|
5
|
+
## What This Does
|
|
6
|
+
|
|
7
|
+
1. Compares current branch to main/master
|
|
8
|
+
2. Checks test coverage for all changed files
|
|
9
|
+
3. Analyzes commit order for TDD compliance
|
|
10
|
+
4. Scans for security issues
|
|
11
|
+
5. Generates verdict: APPROVED or CHANGES_REQUESTED
|
|
12
|
+
|
|
13
|
+
**This runs automatically at the end of `/tlc:build`.**
|
|
14
|
+
|
|
15
|
+
## Usage
|
|
16
|
+
|
|
17
|
+
```
|
|
18
|
+
/tlc:review # Review current branch vs main
|
|
19
|
+
/tlc:review --base dev # Review vs different base branch
|
|
20
|
+
```
|
|
21
|
+
|
|
22
|
+
## Process
|
|
23
|
+
|
|
24
|
+
### Step 1: Identify Changes
|
|
25
|
+
|
|
26
|
+
```bash
|
|
27
|
+
git diff --name-status main...HEAD
|
|
28
|
+
```
|
|
29
|
+
|
|
30
|
+
Categorize files:
|
|
31
|
+
- Implementation files (`.js`, `.ts`, `.py`, etc.)
|
|
32
|
+
- Test files (`*.test.*`, `test_*`, `*_test.*`)
|
|
33
|
+
- Other files (docs, config, etc.)
|
|
34
|
+
|
|
35
|
+
### Step 2: Check Test Coverage
|
|
36
|
+
|
|
37
|
+
For each implementation file, verify a corresponding test exists:
|
|
38
|
+
|
|
39
|
+
| Implementation | Expected Test |
|
|
40
|
+
|---------------|---------------|
|
|
41
|
+
| `src/auth.js` | `src/auth.test.js` or `test/auth.test.js` |
|
|
42
|
+
| `lib/utils.ts` | `lib/utils.test.ts` or `tests/utils.test.ts` |
|
|
43
|
+
| `pkg/main.go` | `pkg/main_test.go` |
|
|
44
|
+
| `src/login.py` | `tests/test_login.py` |
|
|
45
|
+
|
|
46
|
+
**Fail if:** Implementation files have no corresponding test (in changeset or on disk).
|
|
47
|
+
|
|
48
|
+
### Step 3: Analyze TDD Compliance
|
|
49
|
+
|
|
50
|
+
Check commit order to verify tests were written first:
|
|
51
|
+
|
|
52
|
+
```bash
|
|
53
|
+
git log --oneline --name-status main..HEAD
|
|
54
|
+
```
|
|
55
|
+
|
|
56
|
+
**Score calculation:**
|
|
57
|
+
- Test-only commits → +1 TDD point
|
|
58
|
+
- Implementation-only commits → -1 TDD point (except fix/refactor/chore)
|
|
59
|
+
- Mixed commits → neutral
|
|
60
|
+
|
|
61
|
+
**TDD Score = (test-first commits / total commits) × 100**
|
|
62
|
+
|
|
63
|
+
**Fail if:** TDD score < 50% with more than 2 commits.
|
|
64
|
+
|
|
65
|
+
### Step 4: Security Scan
|
|
66
|
+
|
|
67
|
+
Scan diff for common security issues:
|
|
68
|
+
|
|
69
|
+
| Pattern | Issue | Severity |
|
|
70
|
+
|---------|-------|----------|
|
|
71
|
+
| `password = "..."` | Hardcoded password | HIGH |
|
|
72
|
+
| `api_key = "..."` | Hardcoded API key | HIGH |
|
|
73
|
+
| `eval(...)` | Code injection risk | MEDIUM |
|
|
74
|
+
| `innerHTML =` | XSS risk | MEDIUM |
|
|
75
|
+
| `dangerouslySetInnerHTML` | React XSS risk | MEDIUM |
|
|
76
|
+
| `exec("..." + var)` | Command injection | HIGH |
|
|
77
|
+
| `SELECT...WHERE...+` | SQL injection | HIGH |
|
|
78
|
+
|
|
79
|
+
**Fail if:** Any HIGH severity issues found.
|
|
80
|
+
|
|
81
|
+
### Step 5: Generate Report
|
|
82
|
+
|
|
83
|
+
```markdown
|
|
84
|
+
# Code Review Report
|
|
85
|
+
|
|
86
|
+
**Date:** 2024-01-15T10:30:00Z
|
|
87
|
+
**Base:** main → **Head:** feature/auth
|
|
88
|
+
|
|
89
|
+
## ✅ Verdict: APPROVED
|
|
90
|
+
|
|
91
|
+
## Summary
|
|
92
|
+
|
|
93
|
+
- ✅ All changed files have tests
|
|
94
|
+
- ✅ TDD score: 75%
|
|
95
|
+
- ✅ No security issues detected
|
|
96
|
+
|
|
97
|
+
## Statistics
|
|
98
|
+
|
|
99
|
+
- Files changed: 8
|
|
100
|
+
- Implementation files: 5
|
|
101
|
+
- Test files: 3
|
|
102
|
+
- Commits: 4
|
|
103
|
+
- TDD Score: 75%
|
|
104
|
+
```
|
|
105
|
+
|
|
106
|
+
### Step 6: Return Verdict
|
|
107
|
+
|
|
108
|
+
**APPROVED** - All checks pass. Ready to push/merge.
|
|
109
|
+
|
|
110
|
+
**CHANGES_REQUESTED** - Issues found:
|
|
111
|
+
- Missing tests → Add tests for flagged files
|
|
112
|
+
- Low TDD score → Consider reordering commits or adding test commits
|
|
113
|
+
- Security issues → Fix flagged patterns
|
|
114
|
+
|
|
115
|
+
## Example Output
|
|
116
|
+
|
|
117
|
+
### Passing Review
|
|
118
|
+
|
|
119
|
+
```
|
|
120
|
+
/tlc:review
|
|
121
|
+
|
|
122
|
+
Reviewing current branch vs main...
|
|
123
|
+
|
|
124
|
+
Changed files: 6
|
|
125
|
+
├── src/auth/login.js (impl)
|
|
126
|
+
├── src/auth/login.test.js (test) ✓
|
|
127
|
+
├── src/auth/session.js (impl)
|
|
128
|
+
├── src/auth/session.test.js (test) ✓
|
|
129
|
+
└── README.md (docs)
|
|
130
|
+
|
|
131
|
+
Test coverage: ✅ All implementation files have tests
|
|
132
|
+
|
|
133
|
+
Commit analysis:
|
|
134
|
+
├── abc1234 test: add login tests
|
|
135
|
+
├── def5678 feat: implement login
|
|
136
|
+
├── ghi9012 test: add session tests
|
|
137
|
+
└── jkl3456 feat: implement session
|
|
138
|
+
|
|
139
|
+
TDD Score: 50% ✅
|
|
140
|
+
|
|
141
|
+
Security scan: ✅ No issues found
|
|
142
|
+
|
|
143
|
+
─────────────────────────────
|
|
144
|
+
✅ APPROVED - Ready to push
|
|
145
|
+
─────────────────────────────
|
|
146
|
+
```
|
|
147
|
+
|
|
148
|
+
### Failing Review
|
|
149
|
+
|
|
150
|
+
```
|
|
151
|
+
/tlc:review
|
|
152
|
+
|
|
153
|
+
Reviewing current branch vs main...
|
|
154
|
+
|
|
155
|
+
Changed files: 4
|
|
156
|
+
├── src/api/users.js (impl)
|
|
157
|
+
├── src/api/auth.js (impl)
|
|
158
|
+
└── src/utils.js (impl)
|
|
159
|
+
|
|
160
|
+
Test coverage: ❌ 3 files missing tests
|
|
161
|
+
├── src/api/users.js → needs src/api/users.test.js
|
|
162
|
+
├── src/api/auth.js → needs src/api/auth.test.js
|
|
163
|
+
└── src/utils.js → needs src/utils.test.js
|
|
164
|
+
|
|
165
|
+
Commit analysis:
|
|
166
|
+
└── abc1234 feat: add all features
|
|
167
|
+
|
|
168
|
+
TDD Score: 0% ❌ (target: 50%+)
|
|
169
|
+
|
|
170
|
+
Security scan: ❌ 1 high severity issue
|
|
171
|
+
└── src/api/auth.js: password = "admin123"
|
|
172
|
+
|
|
173
|
+
───────────────────────────────────
|
|
174
|
+
❌ CHANGES_REQUESTED
|
|
175
|
+
|
|
176
|
+
Action required:
|
|
177
|
+
1. Add tests for 3 implementation files
|
|
178
|
+
2. Fix hardcoded password in src/api/auth.js
|
|
179
|
+
3. Consider splitting into test-first commits
|
|
180
|
+
───────────────────────────────────
|
|
181
|
+
```
|
|
182
|
+
|
|
183
|
+
## Flags
|
|
184
|
+
|
|
185
|
+
| Flag | Description |
|
|
186
|
+
|------|-------------|
|
|
187
|
+
| `--base <branch>` | Compare against different base (default: main) |
|
|
188
|
+
| `--strict` | Fail on any TDD violation |
|
|
189
|
+
| `--no-security` | Skip security scan |
|
|
190
|
+
|
|
191
|
+
## Integration
|
|
192
|
+
|
|
193
|
+
This review runs automatically:
|
|
194
|
+
- At the end of `/tlc:build` (blocks completion if fails)
|
|
195
|
+
- Before `/tlc:verify` (informational)
|
|
196
|
+
- Can be run manually anytime
|
|
197
|
+
|
|
198
|
+
## ARGUMENTS
|
|
199
|
+
|
|
200
|
+
$ARGUMENTS
|