claude-cli-advanced-starter-pack 1.0.16 → 1.8.0
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/OVERVIEW.md +5 -1
- package/README.md +241 -132
- package/bin/gtask.js +53 -0
- package/package.json +1 -1
- package/src/cli/menu.js +27 -0
- package/src/commands/explore-mcp/mcp-registry.js +99 -0
- package/src/commands/init.js +309 -80
- package/src/commands/install-panel-hook.js +108 -0
- package/src/commands/install-scripts.js +232 -0
- package/src/commands/install-skill.js +220 -0
- package/src/commands/panel.js +297 -0
- package/src/commands/setup-wizard.js +4 -3
- package/src/commands/test-setup.js +4 -5
- package/src/data/releases.json +209 -0
- package/src/panel/queue.js +188 -0
- package/templates/commands/ask-claude.template.md +118 -0
- package/templates/commands/ccasp-panel.template.md +72 -0
- package/templates/commands/ccasp-setup.template.md +470 -79
- package/templates/commands/create-smoke-test.template.md +186 -0
- package/templates/commands/project-impl.template.md +9 -113
- package/templates/commands/refactor-check.template.md +112 -0
- package/templates/commands/refactor-cleanup.template.md +144 -0
- package/templates/commands/refactor-prep.template.md +192 -0
- package/templates/docs/AI_ARCHITECTURE_CONSTITUTION.template.md +198 -0
- package/templates/docs/DETAILED_GOTCHAS.template.md +347 -0
- package/templates/docs/PHASE-DEV-CHECKLIST.template.md +241 -0
- package/templates/docs/PROGRESS_JSON_TEMPLATE.json +117 -0
- package/templates/docs/background-agent.template.md +264 -0
- package/templates/hooks/autonomous-decision-logger.template.js +207 -0
- package/templates/hooks/branch-merge-checker.template.js +272 -0
- package/templates/hooks/context-injector.template.js +261 -0
- package/templates/hooks/git-commit-tracker.template.js +267 -0
- package/templates/hooks/happy-mode-detector.template.js +214 -0
- package/templates/hooks/happy-title-generator.template.js +260 -0
- package/templates/hooks/issue-completion-detector.template.js +205 -0
- package/templates/hooks/panel-queue-reader.template.js +83 -0
- package/templates/hooks/phase-validation-gates.template.js +307 -0
- package/templates/hooks/session-id-generator.template.js +236 -0
- package/templates/hooks/token-budget-loader.template.js +234 -0
- package/templates/hooks/token-usage-monitor.template.js +193 -0
- package/templates/hooks/tool-output-cacher.template.js +219 -0
- package/templates/patterns/README.md +129 -0
- package/templates/patterns/l1-l2-orchestration.md +189 -0
- package/templates/patterns/multi-phase-orchestration.md +258 -0
- package/templates/patterns/two-tier-query-pipeline.md +192 -0
- package/templates/scripts/README.md +109 -0
- package/templates/scripts/analyze-delegation-log.js +299 -0
- package/templates/scripts/autonomous-decision-logger.js +277 -0
- package/templates/scripts/git-history-analyzer.py +269 -0
- package/templates/scripts/phase-validation-gates.js +307 -0
- package/templates/scripts/poll-deployment-status.js +260 -0
- package/templates/scripts/roadmap-scanner.js +263 -0
- package/templates/scripts/validate-deployment.js +293 -0
- package/templates/skills/agent-creator/skill.json +18 -0
- package/templates/skills/agent-creator/skill.md +335 -0
- package/templates/skills/hook-creator/skill.json +18 -0
- package/templates/skills/hook-creator/skill.md +318 -0
- package/templates/skills/panel/skill.json +18 -0
- package/templates/skills/panel/skill.md +90 -0
- package/templates/skills/rag-agent-creator/skill.json +18 -0
- package/templates/skills/rag-agent-creator/skill.md +307 -0
|
@@ -0,0 +1,186 @@
|
|
|
1
|
+
---
|
|
2
|
+
description: Auto-generate Playwright smoke tests for critical user flows
|
|
3
|
+
---
|
|
4
|
+
|
|
5
|
+
# Create Smoke Test
|
|
6
|
+
|
|
7
|
+
Generate Playwright E2E tests automatically by analyzing your application's routes and components.
|
|
8
|
+
|
|
9
|
+
## Usage
|
|
10
|
+
|
|
11
|
+
```
|
|
12
|
+
/create-smoke-test
|
|
13
|
+
/create-smoke-test --page login
|
|
14
|
+
/create-smoke-test --flow checkout
|
|
15
|
+
```
|
|
16
|
+
|
|
17
|
+
## What It Does
|
|
18
|
+
|
|
19
|
+
1. **Analyze Routes** - Discover pages from router configuration
|
|
20
|
+
2. **Identify Flows** - Map critical user journeys
|
|
21
|
+
3. **Generate Tests** - Create Playwright test files
|
|
22
|
+
4. **Add Selectors** - Include data-testid recommendations
|
|
23
|
+
|
|
24
|
+
## Smoke Test Categories
|
|
25
|
+
|
|
26
|
+
### Authentication
|
|
27
|
+
- Login flow
|
|
28
|
+
- Logout flow
|
|
29
|
+
- Password reset
|
|
30
|
+
- Session persistence
|
|
31
|
+
|
|
32
|
+
### Navigation
|
|
33
|
+
- Home page loads
|
|
34
|
+
- All routes accessible
|
|
35
|
+
- Navigation links work
|
|
36
|
+
- 404 handling
|
|
37
|
+
|
|
38
|
+
### Critical Paths
|
|
39
|
+
- User registration
|
|
40
|
+
- Core feature usage
|
|
41
|
+
- Payment flow (if applicable)
|
|
42
|
+
- Data submission forms
|
|
43
|
+
|
|
44
|
+
## Implementation
|
|
45
|
+
|
|
46
|
+
### Step 1: Discover Routes
|
|
47
|
+
|
|
48
|
+
**React Router:**
|
|
49
|
+
```typescript
|
|
50
|
+
// Analyze src/routes.tsx or src/App.tsx
|
|
51
|
+
// Extract route paths and components
|
|
52
|
+
```
|
|
53
|
+
|
|
54
|
+
**Next.js:**
|
|
55
|
+
```bash
|
|
56
|
+
# List pages directory
|
|
57
|
+
ls -la pages/ app/
|
|
58
|
+
```
|
|
59
|
+
|
|
60
|
+
### Step 2: Generate Test File
|
|
61
|
+
|
|
62
|
+
```typescript
|
|
63
|
+
// tests/smoke/navigation.spec.ts
|
|
64
|
+
import { test, expect } from '@playwright/test';
|
|
65
|
+
|
|
66
|
+
test.describe('Navigation Smoke Tests', () => {
|
|
67
|
+
test('home page loads', async ({ page }) => {
|
|
68
|
+
await page.goto('/');
|
|
69
|
+
await expect(page).toHaveTitle(/Your App/);
|
|
70
|
+
await expect(page.locator('main')).toBeVisible();
|
|
71
|
+
});
|
|
72
|
+
|
|
73
|
+
test('login page accessible', async ({ page }) => {
|
|
74
|
+
await page.goto('/login');
|
|
75
|
+
await expect(page.locator('[data-testid="login-form"]')).toBeVisible();
|
|
76
|
+
});
|
|
77
|
+
|
|
78
|
+
// Additional generated tests...
|
|
79
|
+
});
|
|
80
|
+
```
|
|
81
|
+
|
|
82
|
+
### Step 3: Add Test Helpers
|
|
83
|
+
|
|
84
|
+
```typescript
|
|
85
|
+
// tests/helpers/auth.ts
|
|
86
|
+
export async function loginAs(page, user) {
|
|
87
|
+
await page.goto('/login');
|
|
88
|
+
await page.fill('[data-testid="email"]', user.email);
|
|
89
|
+
await page.fill('[data-testid="password"]', user.password);
|
|
90
|
+
await page.click('[data-testid="submit"]');
|
|
91
|
+
await page.waitForURL('/dashboard');
|
|
92
|
+
}
|
|
93
|
+
```
|
|
94
|
+
|
|
95
|
+
## Output Structure
|
|
96
|
+
|
|
97
|
+
```
|
|
98
|
+
tests/
|
|
99
|
+
├── smoke/
|
|
100
|
+
│ ├── auth.spec.ts # Authentication flows
|
|
101
|
+
│ ├── navigation.spec.ts # Page accessibility
|
|
102
|
+
│ └── critical-paths.spec.ts # Core user journeys
|
|
103
|
+
├── helpers/
|
|
104
|
+
│ ├── auth.ts # Auth utilities
|
|
105
|
+
│ ├── fixtures.ts # Test data
|
|
106
|
+
│ └── selectors.ts # Shared selectors
|
|
107
|
+
└── playwright.config.ts # Test configuration
|
|
108
|
+
```
|
|
109
|
+
|
|
110
|
+
## Generated Test Example
|
|
111
|
+
|
|
112
|
+
```typescript
|
|
113
|
+
import { test, expect } from '@playwright/test';
|
|
114
|
+
import { loginAs } from '../helpers/auth';
|
|
115
|
+
import { testUser } from '../helpers/fixtures';
|
|
116
|
+
|
|
117
|
+
test.describe('Authentication Smoke Tests', () => {
|
|
118
|
+
test('user can log in with valid credentials', async ({ page }) => {
|
|
119
|
+
await page.goto('/login');
|
|
120
|
+
|
|
121
|
+
// Fill login form
|
|
122
|
+
await page.fill('[data-testid="email-input"]', testUser.email);
|
|
123
|
+
await page.fill('[data-testid="password-input"]', testUser.password);
|
|
124
|
+
|
|
125
|
+
// Submit and verify
|
|
126
|
+
await page.click('[data-testid="login-button"]');
|
|
127
|
+
await expect(page).toHaveURL('/dashboard');
|
|
128
|
+
await expect(page.locator('[data-testid="user-menu"]')).toBeVisible();
|
|
129
|
+
});
|
|
130
|
+
|
|
131
|
+
test('user sees error for invalid credentials', async ({ page }) => {
|
|
132
|
+
await page.goto('/login');
|
|
133
|
+
await page.fill('[data-testid="email-input"]', 'invalid@test.com');
|
|
134
|
+
await page.fill('[data-testid="password-input"]', 'wrongpassword');
|
|
135
|
+
await page.click('[data-testid="login-button"]');
|
|
136
|
+
|
|
137
|
+
await expect(page.locator('[data-testid="error-message"]')).toBeVisible();
|
|
138
|
+
});
|
|
139
|
+
});
|
|
140
|
+
```
|
|
141
|
+
|
|
142
|
+
## Selector Recommendations
|
|
143
|
+
|
|
144
|
+
For reliable tests, add these data-testid attributes to your components:
|
|
145
|
+
|
|
146
|
+
```html
|
|
147
|
+
<!-- Forms -->
|
|
148
|
+
<form data-testid="login-form">
|
|
149
|
+
<input data-testid="email-input" />
|
|
150
|
+
<input data-testid="password-input" />
|
|
151
|
+
<button data-testid="login-button">Login</button>
|
|
152
|
+
</form>
|
|
153
|
+
|
|
154
|
+
<!-- Navigation -->
|
|
155
|
+
<nav data-testid="main-nav">
|
|
156
|
+
<a data-testid="nav-home">Home</a>
|
|
157
|
+
<a data-testid="nav-dashboard">Dashboard</a>
|
|
158
|
+
</nav>
|
|
159
|
+
|
|
160
|
+
<!-- Content -->
|
|
161
|
+
<main data-testid="page-content">
|
|
162
|
+
<h1 data-testid="page-title">Welcome</h1>
|
|
163
|
+
</main>
|
|
164
|
+
```
|
|
165
|
+
|
|
166
|
+
## Configuration
|
|
167
|
+
|
|
168
|
+
Add to `playwright.config.ts`:
|
|
169
|
+
|
|
170
|
+
```typescript
|
|
171
|
+
export default {
|
|
172
|
+
testDir: './tests',
|
|
173
|
+
projects: [
|
|
174
|
+
{
|
|
175
|
+
name: 'smoke',
|
|
176
|
+
testMatch: /smoke\/.+\.spec\.ts/,
|
|
177
|
+
use: { baseURL: 'http://localhost:3000' },
|
|
178
|
+
},
|
|
179
|
+
],
|
|
180
|
+
};
|
|
181
|
+
```
|
|
182
|
+
|
|
183
|
+
## Related Commands
|
|
184
|
+
|
|
185
|
+
- `/e2e-test` - Run E2E tests
|
|
186
|
+
- `/refactor-check` - Pre-commit validation
|
|
@@ -14,7 +14,9 @@ allowed-tools:
|
|
|
14
14
|
|
|
15
15
|
# /project-impl - Project Implementation
|
|
16
16
|
|
|
17
|
-
|
|
17
|
+
Advanced project tools for CLAUDE.md management and codebase analysis.
|
|
18
|
+
|
|
19
|
+
**For initial setup**, use `/ccasp-setup` instead - it's a one-shot linear wizard that configures everything in a single pass.
|
|
18
20
|
|
|
19
21
|
## Quick Menu
|
|
20
22
|
|
|
@@ -23,13 +25,15 @@ Agent-powered project configuration, tech stack detection, and CLAUDE.md managem
|
|
|
23
25
|
| **1** | Audit CLAUDE.md | Analyze configuration against best practices |
|
|
24
26
|
| **2** | Enhance CLAUDE.md | Generate/improve documentation from codebase |
|
|
25
27
|
| **3** | Detect Tech Stack | Scan codebase and identify technologies |
|
|
26
|
-
| **
|
|
28
|
+
| **S** | Full Setup | Run `/ccasp-setup` linear wizard |
|
|
27
29
|
| **B** | Back to /menu | Return to main menu |
|
|
28
30
|
|
|
29
31
|
## Instructions for Claude
|
|
30
32
|
|
|
31
33
|
When invoked, display the menu above and use AskUserQuestion to get the user's selection.
|
|
32
34
|
|
|
35
|
+
**If user selects S**: Invoke `/ccasp-setup` skill for the linear setup wizard.
|
|
36
|
+
|
|
33
37
|
---
|
|
34
38
|
|
|
35
39
|
### Option 1: Audit CLAUDE.md
|
|
@@ -198,120 +202,14 @@ Deployment:
|
|
|
198
202
|
|
|
199
203
|
---
|
|
200
204
|
|
|
201
|
-
### Option 4: Project Settings
|
|
202
|
-
|
|
203
|
-
Use AskUserQuestion for interactive configuration:
|
|
204
|
-
|
|
205
|
-
**GitHub Project Board:**
|
|
206
|
-
```
|
|
207
|
-
Questions:
|
|
208
|
-
1. Do you have a GitHub Project Board? (Yes/No)
|
|
209
|
-
2. Repository owner (e.g., 'username' or 'org-name')
|
|
210
|
-
3. Repository name
|
|
211
|
-
4. Project number (from URL: /projects/NUMBER)
|
|
212
|
-
```
|
|
213
|
-
|
|
214
|
-
**Deployment Platforms:**
|
|
215
|
-
```
|
|
216
|
-
Questions:
|
|
217
|
-
1. Frontend deployment platform?
|
|
218
|
-
- Cloudflare Pages
|
|
219
|
-
- Vercel
|
|
220
|
-
- Netlify
|
|
221
|
-
- GitHub Pages
|
|
222
|
-
- None
|
|
223
|
-
2. Backend deployment platform?
|
|
224
|
-
- Railway
|
|
225
|
-
- Heroku
|
|
226
|
-
- Render
|
|
227
|
-
- AWS
|
|
228
|
-
- None
|
|
229
|
-
3. Project identifiers (IDs, names) for each platform
|
|
230
|
-
```
|
|
231
|
-
|
|
232
|
-
**Tunnel Services:**
|
|
233
|
-
```
|
|
234
|
-
Questions:
|
|
235
|
-
1. Tunnel service for mobile testing?
|
|
236
|
-
- ngrok
|
|
237
|
-
- localtunnel
|
|
238
|
-
- cloudflare-tunnel
|
|
239
|
-
- serveo
|
|
240
|
-
- None
|
|
241
|
-
2. Subdomain preference (optional)
|
|
242
|
-
```
|
|
243
|
-
|
|
244
|
-
**Token Management:**
|
|
245
|
-
```
|
|
246
|
-
Questions:
|
|
247
|
-
1. Enable token budget tracking? (Yes/No)
|
|
248
|
-
2. Daily budget limit (default: 200000)
|
|
249
|
-
3. Compact threshold (default: 75%)
|
|
250
|
-
```
|
|
251
|
-
|
|
252
|
-
**Happy Mode:**
|
|
253
|
-
```
|
|
254
|
-
Questions:
|
|
255
|
-
1. Enable Happy Mode integration? (Yes/No)
|
|
256
|
-
2. Checkpoint interval (default: 10 tasks)
|
|
257
|
-
3. Verbosity level (condensed/normal/verbose)
|
|
258
|
-
```
|
|
259
|
-
|
|
260
|
-
**Write selections to `.claude/config/tech-stack.json`:**
|
|
261
|
-
```json
|
|
262
|
-
{
|
|
263
|
-
"versionControl": {
|
|
264
|
-
"provider": "github",
|
|
265
|
-
"projectBoard": {
|
|
266
|
-
"type": "github-projects-v2",
|
|
267
|
-
"owner": "username",
|
|
268
|
-
"repo": "repo-name",
|
|
269
|
-
"projectNumber": 1
|
|
270
|
-
}
|
|
271
|
-
},
|
|
272
|
-
"deployment": {
|
|
273
|
-
"frontend": {
|
|
274
|
-
"platform": "cloudflare",
|
|
275
|
-
"projectName": "my-project"
|
|
276
|
-
},
|
|
277
|
-
"backend": {
|
|
278
|
-
"platform": "railway",
|
|
279
|
-
"projectId": "xxx",
|
|
280
|
-
"serviceId": "yyy"
|
|
281
|
-
}
|
|
282
|
-
},
|
|
283
|
-
"devEnvironment": {
|
|
284
|
-
"tunnel": {
|
|
285
|
-
"service": "ngrok",
|
|
286
|
-
"subdomain": "my-app"
|
|
287
|
-
}
|
|
288
|
-
},
|
|
289
|
-
"tokenManagement": {
|
|
290
|
-
"enabled": true,
|
|
291
|
-
"dailyBudget": 200000,
|
|
292
|
-
"thresholds": { "compact": 0.75 }
|
|
293
|
-
},
|
|
294
|
-
"happyMode": {
|
|
295
|
-
"enabled": true,
|
|
296
|
-
"checkpointInterval": 10
|
|
297
|
-
}
|
|
298
|
-
}
|
|
299
|
-
```
|
|
300
|
-
|
|
301
|
-
---
|
|
302
|
-
|
|
303
205
|
## Navigation
|
|
304
206
|
|
|
305
207
|
After completing any option, ask the user:
|
|
306
|
-
- "Would you like to perform another action? (1-
|
|
208
|
+
- "Would you like to perform another action? (1-3, S for setup, B to go back)"
|
|
307
209
|
|
|
308
210
|
## Mark Setup Complete
|
|
309
211
|
|
|
310
|
-
**IMPORTANT:** After the user successfully completes ANY option (1-
|
|
311
|
-
|
|
312
|
-
```bash
|
|
313
|
-
# Read current state, add projectImplCompleted: true, write back
|
|
314
|
-
```
|
|
212
|
+
**IMPORTANT:** After the user successfully completes ANY option (1-3), update the state file:
|
|
315
213
|
|
|
316
214
|
Use the Edit tool to update `.claude/config/ccasp-state.json`:
|
|
317
215
|
- Set `"projectImplCompleted": true`
|
|
@@ -320,10 +218,8 @@ This removes the "Run /project-impl" recommendation banner from `/menu`.
|
|
|
320
218
|
|
|
321
219
|
## Terminal Alternative
|
|
322
220
|
|
|
323
|
-
These operations can also be run from the terminal:
|
|
324
|
-
|
|
325
221
|
```bash
|
|
326
|
-
npx ccasp wizard #
|
|
222
|
+
npx ccasp wizard # Linear setup wizard (recommended)
|
|
327
223
|
npx ccasp detect-stack # Detect tech stack
|
|
328
224
|
npx ccasp claude-audit # Audit CLAUDE.md
|
|
329
225
|
```
|
|
@@ -0,0 +1,112 @@
|
|
|
1
|
+
---
|
|
2
|
+
description: Fast pre-commit quality gate - lint, type-check, test affected files
|
|
3
|
+
---
|
|
4
|
+
|
|
5
|
+
# Refactor Check
|
|
6
|
+
|
|
7
|
+
Quick quality validation before committing changes. Runs essential checks without full test suite.
|
|
8
|
+
|
|
9
|
+
## Checks Performed
|
|
10
|
+
|
|
11
|
+
1. **Linting** - ESLint/Pylint for code style issues
|
|
12
|
+
2. **Type Checking** - TypeScript/MyPy type validation
|
|
13
|
+
3. **Affected Tests** - Run tests for changed files only
|
|
14
|
+
4. **Import Validation** - Verify imports resolve correctly
|
|
15
|
+
|
|
16
|
+
## Usage
|
|
17
|
+
|
|
18
|
+
Run before committing to catch issues early:
|
|
19
|
+
|
|
20
|
+
```
|
|
21
|
+
/refactor-check
|
|
22
|
+
```
|
|
23
|
+
|
|
24
|
+
## Implementation
|
|
25
|
+
|
|
26
|
+
When invoked, execute these steps:
|
|
27
|
+
|
|
28
|
+
### Step 1: Detect Changed Files
|
|
29
|
+
|
|
30
|
+
```bash
|
|
31
|
+
git diff --name-only HEAD~1..HEAD
|
|
32
|
+
# OR for staged changes:
|
|
33
|
+
git diff --cached --name-only
|
|
34
|
+
```
|
|
35
|
+
|
|
36
|
+
### Step 2: Run Linting (Affected Files Only)
|
|
37
|
+
|
|
38
|
+
**JavaScript/TypeScript:**
|
|
39
|
+
```bash
|
|
40
|
+
npx eslint <changed-files>
|
|
41
|
+
```
|
|
42
|
+
|
|
43
|
+
**Python:**
|
|
44
|
+
```bash
|
|
45
|
+
pylint <changed-files>
|
|
46
|
+
# OR
|
|
47
|
+
ruff check <changed-files>
|
|
48
|
+
```
|
|
49
|
+
|
|
50
|
+
### Step 3: Type Checking
|
|
51
|
+
|
|
52
|
+
**TypeScript:**
|
|
53
|
+
```bash
|
|
54
|
+
npx tsc --noEmit
|
|
55
|
+
```
|
|
56
|
+
|
|
57
|
+
**Python:**
|
|
58
|
+
```bash
|
|
59
|
+
mypy <changed-files>
|
|
60
|
+
```
|
|
61
|
+
|
|
62
|
+
### Step 4: Run Affected Tests
|
|
63
|
+
|
|
64
|
+
**JavaScript/TypeScript:**
|
|
65
|
+
```bash
|
|
66
|
+
npx jest --findRelatedTests <changed-files>
|
|
67
|
+
# OR
|
|
68
|
+
npx vitest --run --reporter=verbose <changed-files>
|
|
69
|
+
```
|
|
70
|
+
|
|
71
|
+
**Python:**
|
|
72
|
+
```bash
|
|
73
|
+
pytest <changed-files> --collect-only -q
|
|
74
|
+
```
|
|
75
|
+
|
|
76
|
+
## Output Format
|
|
77
|
+
|
|
78
|
+
```
|
|
79
|
+
Refactor Check Results
|
|
80
|
+
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
|
|
81
|
+
Files Changed: 5
|
|
82
|
+
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
|
|
83
|
+
|
|
84
|
+
✅ Linting: Passed (0 errors, 2 warnings)
|
|
85
|
+
✅ Type Check: Passed
|
|
86
|
+
✅ Tests: 3 passed, 0 failed
|
|
87
|
+
⚠️ Imports: 1 unused import detected
|
|
88
|
+
|
|
89
|
+
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
|
|
90
|
+
Overall: PASS (ready to commit)
|
|
91
|
+
```
|
|
92
|
+
|
|
93
|
+
## Configuration
|
|
94
|
+
|
|
95
|
+
Add to `.claude/config/tech-stack.json`:
|
|
96
|
+
|
|
97
|
+
```json
|
|
98
|
+
{
|
|
99
|
+
"refactorCheck": {
|
|
100
|
+
"lint": true,
|
|
101
|
+
"typeCheck": true,
|
|
102
|
+
"testAffected": true,
|
|
103
|
+
"importCheck": true
|
|
104
|
+
}
|
|
105
|
+
}
|
|
106
|
+
```
|
|
107
|
+
|
|
108
|
+
## Related Commands
|
|
109
|
+
|
|
110
|
+
- `/refactor-analyze` - Deep code quality analysis
|
|
111
|
+
- `/refactor-cleanup` - Fix common issues automatically
|
|
112
|
+
- `/refactor-prep` - Pre-refactoring safety checklist
|
|
@@ -0,0 +1,144 @@
|
|
|
1
|
+
---
|
|
2
|
+
description: Daily maintenance automation - fix lint errors, remove unused imports, format code
|
|
3
|
+
---
|
|
4
|
+
|
|
5
|
+
# Refactor Cleanup
|
|
6
|
+
|
|
7
|
+
Automated maintenance to keep codebase clean. Fixes common issues without manual intervention.
|
|
8
|
+
|
|
9
|
+
## Cleanup Actions
|
|
10
|
+
|
|
11
|
+
1. **Auto-fix Lint Errors** - Apply ESLint/Ruff --fix
|
|
12
|
+
2. **Remove Unused Imports** - Clean up import statements
|
|
13
|
+
3. **Format Code** - Apply Prettier/Black formatting
|
|
14
|
+
4. **Sort Imports** - Organize import order
|
|
15
|
+
5. **Remove Dead Code** - Delete unused functions (optional)
|
|
16
|
+
|
|
17
|
+
## Usage
|
|
18
|
+
|
|
19
|
+
Run as part of daily maintenance:
|
|
20
|
+
|
|
21
|
+
```
|
|
22
|
+
/refactor-cleanup
|
|
23
|
+
```
|
|
24
|
+
|
|
25
|
+
Or target specific cleanup:
|
|
26
|
+
|
|
27
|
+
```
|
|
28
|
+
/refactor-cleanup --lint-only
|
|
29
|
+
/refactor-cleanup --format-only
|
|
30
|
+
/refactor-cleanup --imports-only
|
|
31
|
+
```
|
|
32
|
+
|
|
33
|
+
## Implementation
|
|
34
|
+
|
|
35
|
+
### Step 1: Auto-fix Lint Errors
|
|
36
|
+
|
|
37
|
+
**JavaScript/TypeScript:**
|
|
38
|
+
```bash
|
|
39
|
+
npx eslint . --fix --ext .js,.jsx,.ts,.tsx
|
|
40
|
+
```
|
|
41
|
+
|
|
42
|
+
**Python:**
|
|
43
|
+
```bash
|
|
44
|
+
ruff check --fix .
|
|
45
|
+
# OR
|
|
46
|
+
autopep8 --in-place --recursive .
|
|
47
|
+
```
|
|
48
|
+
|
|
49
|
+
### Step 2: Remove Unused Imports
|
|
50
|
+
|
|
51
|
+
**JavaScript/TypeScript:**
|
|
52
|
+
```bash
|
|
53
|
+
npx eslint . --fix --rule 'unused-imports/no-unused-imports: error'
|
|
54
|
+
# Requires: npm install -D eslint-plugin-unused-imports
|
|
55
|
+
```
|
|
56
|
+
|
|
57
|
+
**Python:**
|
|
58
|
+
```bash
|
|
59
|
+
autoflake --in-place --remove-all-unused-imports --recursive .
|
|
60
|
+
```
|
|
61
|
+
|
|
62
|
+
### Step 3: Format Code
|
|
63
|
+
|
|
64
|
+
**JavaScript/TypeScript:**
|
|
65
|
+
```bash
|
|
66
|
+
npx prettier --write "**/*.{js,jsx,ts,tsx,json,md}"
|
|
67
|
+
```
|
|
68
|
+
|
|
69
|
+
**Python:**
|
|
70
|
+
```bash
|
|
71
|
+
black .
|
|
72
|
+
# OR
|
|
73
|
+
ruff format .
|
|
74
|
+
```
|
|
75
|
+
|
|
76
|
+
### Step 4: Sort Imports
|
|
77
|
+
|
|
78
|
+
**JavaScript/TypeScript:**
|
|
79
|
+
```bash
|
|
80
|
+
npx eslint . --fix --rule 'import/order: error'
|
|
81
|
+
```
|
|
82
|
+
|
|
83
|
+
**Python:**
|
|
84
|
+
```bash
|
|
85
|
+
isort .
|
|
86
|
+
```
|
|
87
|
+
|
|
88
|
+
## Output Format
|
|
89
|
+
|
|
90
|
+
```
|
|
91
|
+
Refactor Cleanup Report
|
|
92
|
+
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
|
|
93
|
+
|
|
94
|
+
Lint Fixes Applied:
|
|
95
|
+
✓ 12 auto-fixable errors resolved
|
|
96
|
+
⚠️ 3 errors require manual fix (see below)
|
|
97
|
+
|
|
98
|
+
Unused Imports Removed:
|
|
99
|
+
✓ src/components/Button.tsx: removed 2 imports
|
|
100
|
+
✓ src/utils/helpers.ts: removed 1 import
|
|
101
|
+
|
|
102
|
+
Code Formatted:
|
|
103
|
+
✓ 45 files formatted
|
|
104
|
+
|
|
105
|
+
Imports Sorted:
|
|
106
|
+
✓ 23 files reorganized
|
|
107
|
+
|
|
108
|
+
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
|
|
109
|
+
Summary: 15 files modified
|
|
110
|
+
|
|
111
|
+
Manual Fixes Required:
|
|
112
|
+
1. src/api/client.ts:45 - no-explicit-any
|
|
113
|
+
2. src/hooks/useAuth.ts:12 - react-hooks/exhaustive-deps
|
|
114
|
+
3. src/pages/Home.tsx:78 - no-unused-vars
|
|
115
|
+
```
|
|
116
|
+
|
|
117
|
+
## Configuration
|
|
118
|
+
|
|
119
|
+
Add to `.claude/config/tech-stack.json`:
|
|
120
|
+
|
|
121
|
+
```json
|
|
122
|
+
{
|
|
123
|
+
"refactorCleanup": {
|
|
124
|
+
"autoFixLint": true,
|
|
125
|
+
"removeUnusedImports": true,
|
|
126
|
+
"formatCode": true,
|
|
127
|
+
"sortImports": true,
|
|
128
|
+
"removeDeadCode": false
|
|
129
|
+
}
|
|
130
|
+
}
|
|
131
|
+
```
|
|
132
|
+
|
|
133
|
+
## Safety Features
|
|
134
|
+
|
|
135
|
+
- **Git Check**: Warns if uncommitted changes exist
|
|
136
|
+
- **Backup**: Creates `.cleanup-backup` branch before major changes
|
|
137
|
+
- **Dry Run**: Use `--dry-run` to preview changes
|
|
138
|
+
- **Exclude**: Respects `.gitignore` and custom exclude patterns
|
|
139
|
+
|
|
140
|
+
## Related Commands
|
|
141
|
+
|
|
142
|
+
- `/refactor-check` - Pre-commit quality gate
|
|
143
|
+
- `/refactor-analyze` - Deep code analysis
|
|
144
|
+
- `/refactor-prep` - Pre-refactoring checklist
|