@kamleshsk/claude-qa 1.0.1 → 1.0.3

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (3) hide show
  1. package/README.md +276 -0
  2. package/bin/install.js +82 -14
  3. package/package.json +1 -1
package/README.md ADDED
@@ -0,0 +1,276 @@
1
+ # @kamleshsk/claude-qa
2
+
3
+ > One command to install a complete Claude Code QA automation framework into any project.
4
+
5
+ [![npm](https://img.shields.io/npm/v/@kamleshsk/claude-qa)](https://www.npmjs.com/package/@kamleshsk/claude-qa)
6
+ [![license](https://img.shields.io/npm/l/@kamleshsk/claude-qa)](./LICENSE)
7
+
8
+ ---
9
+
10
+ ## What it does
11
+
12
+ Drops a full Playwright-based QA framework powered by Claude Code into any project in seconds — commands, skills, and docs included. Then automatically installs all Node dependencies so you can start writing tests immediately.
13
+
14
+ ```
15
+ .claude/
16
+ ├── commands/
17
+ │ ├── qa.md ← /qa generate a test module for any feature
18
+ │ └── qa-setup.md ← /qa-setup scaffold the entire framework
19
+ └── skills/
20
+ └── playwright-cli/
21
+ ├── SKILL.md
22
+ └── references/ (10 reference files)
23
+
24
+ docs/
25
+ └── qa-setup/
26
+ └── module-guide.md
27
+ ```
28
+
29
+ After copying the files, the installer automatically:
30
+ - Adds `"type": "module"`, `playwright`, `dotenv`, and QA scripts to your `package.json`
31
+ - Runs `npm install`
32
+ - Runs `npx playwright install chromium`
33
+
34
+ No manual Node setup needed.
35
+
36
+ ---
37
+
38
+ ## Install
39
+
40
+ ```bash
41
+ npx @kamleshsk/claude-qa
42
+ ```
43
+
44
+ Run this from your **project root** — the folder that contains `composer.json` (or your app root). It creates all folders if they don't exist and skips files that already exist, so it is safe to re-run.
45
+
46
+ ---
47
+
48
+ ## Full Setup — Step by Step
49
+
50
+ ### Step 1 — Run the installer
51
+
52
+ ```bash
53
+ cd /your/project
54
+ npx @kamleshsk/claude-qa
55
+ ```
56
+
57
+ You will see:
58
+
59
+ ```
60
+ 🚀 Installing @kamleshsk/claude-qa into:
61
+ /your/project
62
+
63
+ 📁 Copying skills and commands...
64
+
65
+ ✅ copied .claude/commands/qa.md
66
+ ✅ copied .claude/commands/qa-setup.md
67
+ ✅ copied .claude/skills/playwright-cli/SKILL.md
68
+ ✅ copied .claude/skills/playwright-cli/references/...
69
+ ✅ copied docs/qa-setup/module-guide.md
70
+
71
+ ⚙️ Setting up Node dependencies...
72
+
73
+ ✅ updated package.json
74
+
75
+ 📦 Running npm install...
76
+
77
+ 🎭 Installing Playwright Chromium...
78
+
79
+ ─────────────────────────────────────────────────────────
80
+ ✅ All done!
81
+
82
+ Open Claude Code in this project and
83
+ run /qa-setup to scaffold the QA framework.
84
+ ─────────────────────────────────────────────────────────
85
+ ```
86
+
87
+ ---
88
+
89
+ ### Step 2 — Add QA credentials to `.env`
90
+
91
+ ```dotenv
92
+ # QA Portal login
93
+ QA_EMAIL=qa@yourproject.local
94
+ QA_PASSWORD=Password@1
95
+ ```
96
+
97
+ The browser portal discovers roles from your database automatically and lets you enter per-role credentials from the UI when you run a test.
98
+
99
+ ---
100
+
101
+ ### Step 3 — Reload Claude Code and run `/qa-setup`
102
+
103
+ Reload Claude Code so it picks up the new commands:
104
+
105
+ - **VS Code extension:** `Cmd/Ctrl+Shift+P` → `Developer: Reload Window`
106
+ - **CLI:** `exit` then `claude` again
107
+
108
+ Then type:
109
+
110
+ ```
111
+ /qa-setup
112
+ ```
113
+
114
+ Claude scaffolds the entire framework — runner, config, portal controllers, views, routes, scripts, and registry. When it finishes, make the scripts executable:
115
+
116
+ ```bash
117
+ chmod +x scripts/qa scripts/qa-register
118
+ ```
119
+
120
+ ---
121
+
122
+ ### Step 4 — Verify middleware, run migrations, seed QA users
123
+
124
+ Paste these two prompts into Claude Code one at a time:
125
+
126
+ **Middleware check:**
127
+ ```
128
+ Verify and fix the qa.auth middleware alias registration for this Laravel version.
129
+ ```
130
+
131
+ **Database:**
132
+ ```
133
+ Check pending migrations and run them. Then create and run QAUserSeeder —
134
+ inspect the auth model and role structure first before writing anything.
135
+ ```
136
+
137
+ ---
138
+
139
+ ### Step 5 — Verify the portal
140
+
141
+ Start your server and open `<APP_URL>/qa` in the browser.
142
+ Log in with `QA_EMAIL` / `QA_PASSWORD` from your `.env`.
143
+ The dashboard should load.
144
+
145
+ ---
146
+
147
+ ### Step 6 — Generate your first test module
148
+
149
+ ```
150
+ /qa users "Admin can create, edit, and delete user accounts"
151
+ ```
152
+
153
+ Claude creates `tests/e2e/js/modules/users.js` and registers it automatically.
154
+ Update the CSS selectors in that file using F12 DevTools on your app.
155
+
156
+ ---
157
+
158
+ ### Step 7 — Run it
159
+
160
+ ```bash
161
+ # Watch the browser (first time — always start here)
162
+ ./scripts/qa users happy h
163
+
164
+ # Headless
165
+ ./scripts/qa users happy
166
+
167
+ # All modules
168
+ ./scripts/qa all
169
+ ```
170
+
171
+ ---
172
+
173
+ ## Quick Reference
174
+
175
+ ```
176
+ ╔══════════════════════════════════════════════════════════════╗
177
+ ║ SETUP (once per project) ║
178
+ ╠══════════════════════════════════════════════════════════════╣
179
+ ║ 1. npx @kamleshsk/claude-qa ← installs skills + deps ║
180
+ ║ 2. Add QA_EMAIL / QA_PASSWORD to .env ║
181
+ ║ 3. Reload Claude Code → /qa-setup ║
182
+ ║ 4. chmod +x scripts/qa scripts/qa-register ║
183
+ ║ 5. Middleware + migrations + QAUserSeeder (2 Claude prompts)║
184
+ ╠══════════════════════════════════════════════════════════════╣
185
+ ║ ADD A TEST MODULE ║
186
+ ╠══════════════════════════════════════════════════════════════╣
187
+ ║ /qa <feature> "<description>" → update selectors ║
188
+ ╠══════════════════════════════════════════════════════════════╣
189
+ ║ RUN TESTS ║
190
+ ╠══════════════════════════════════════════════════════════════╣
191
+ ║ ./scripts/qa <module> happy h headed (watch browser) ║
192
+ ║ ./scripts/qa <module> happy headless ║
193
+ ║ ./scripts/qa all all modules ║
194
+ ╠══════════════════════════════════════════════════════════════╣
195
+ ║ BROWSER PORTAL ║
196
+ ╠══════════════════════════════════════════════════════════════╣
197
+ ║ Visit <APP_URL>/qa → login → pick module → Run ║
198
+ ║ Roles auto-discovered from DB, credentials entered in UI ║
199
+ ╚══════════════════════════════════════════════════════════════╝
200
+ ```
201
+
202
+ ---
203
+
204
+ ## What `/qa-setup` creates
205
+
206
+ ```
207
+ tests/e2e/js/
208
+ ├── config.js reads .env credentials
209
+ ├── runner.js step engine, login, assertions
210
+ ├── main.js CLI entry point
211
+ ├── report.js pass/fail reports + screenshots
212
+ ├── register.js test registry tool
213
+ └── modules/
214
+ └── index.js module map
215
+
216
+ tests/e2e/registry.json
217
+
218
+ scripts/
219
+ ├── qa terminal shortcut
220
+ └── qa-register registry shortcut
221
+
222
+ app/Http/Controllers/QA/ (3 controllers)
223
+ resources/views/qa/ (portal UI)
224
+ routes/web.php (QA routes appended)
225
+ app/Http/Middleware/EnsureQAAuth.php
226
+ ```
227
+
228
+ ---
229
+
230
+ ## What `/qa` generates
231
+
232
+ For each feature you describe, Claude writes a complete test module with:
233
+
234
+ - **Happy path** — create, edit, delete with real browser interactions
235
+ - **Validation** — required fields rejected, handles both browser and server-side validation
236
+ - **Hierarchy** — parent-child relationship tests (or skipped if not applicable)
237
+
238
+ The module is auto-registered in `index.js` and `registry.json`.
239
+
240
+ ---
241
+
242
+ ## Troubleshooting
243
+
244
+ | Problem | Fix |
245
+ |---|---|
246
+ | `/qa-setup` says "unknown command" | Reload Claude Code after install (Step 3) |
247
+ | `Target class [qa.auth] does not exist` | Run the middleware verification prompt (Step 4) |
248
+ | `404` at `/qa` | Tell Claude: "Add the QA routes to routes/web.php" |
249
+ | Login fails on portal | Run `php artisan config:clear` — cached config may have old values |
250
+ | `./scripts/qa: Permission denied` | `chmod +x scripts/qa scripts/qa-register` |
251
+ | Test fails on Login step | QA users not in DB — re-run `QAUserSeeder` (Step 4) |
252
+ | Timeout on a locator | Wrong CSS selector — F12 the page and update the module file |
253
+
254
+ ---
255
+
256
+ ## Updating
257
+
258
+ When a new version is released, re-run in your project root:
259
+
260
+ ```bash
261
+ npx @kamleshsk/claude-qa@latest
262
+ ```
263
+
264
+ Files that already exist are skipped. Only new or updated files are added.
265
+
266
+ ---
267
+
268
+ ## Author
269
+
270
+ Created by **Kamlesh Kasambe** at [infotech.works](https://infotech.works), under the guidance of **Pooja Kolte**.
271
+
272
+ ---
273
+
274
+ ## License
275
+
276
+ MIT
package/bin/install.js CHANGED
@@ -1,33 +1,33 @@
1
1
  #!/usr/bin/env node
2
2
 
3
- const fs = require('fs');
4
- const path = require('path');
3
+ const fs = require('fs');
4
+ const path = require('path');
5
+ const { spawnSync } = require('child_process');
5
6
 
6
7
  const SRC = path.join(__dirname, '..', 'templates');
7
8
  const DEST = process.cwd();
8
9
 
10
+ // ── file helpers ──────────────────────────────────────────────────────────────
11
+
9
12
  function copyFile(srcRel, destRel) {
10
13
  const src = path.join(SRC, srcRel);
11
14
  const dest = path.join(DEST, destRel);
12
-
13
15
  fs.mkdirSync(path.dirname(dest), { recursive: true });
14
-
15
16
  if (fs.existsSync(dest)) {
16
17
  console.log(` ⏭ skip ${destRel} (already exists)`);
17
18
  return;
18
19
  }
19
-
20
20
  fs.copyFileSync(src, dest);
21
21
  console.log(` ✅ copied ${destRel}`);
22
22
  }
23
23
 
24
24
  function copyDir(srcRel, destRel) {
25
- const srcDir = path.join(SRC, srcRel);
25
+ const srcDir = path.join(SRC, srcRel);
26
26
  const entries = fs.readdirSync(srcDir);
27
27
  for (const entry of entries) {
28
28
  const entrySrcRel = path.join(srcRel, entry);
29
29
  const entryDestRel = path.join(destRel, entry);
30
- const fullSrc = path.join(SRC, entrySrcRel);
30
+ const fullSrc = path.join(SRC, entrySrcRel);
31
31
  if (fs.statSync(fullSrc).isDirectory()) {
32
32
  copyDir(entrySrcRel, entryDestRel);
33
33
  } else {
@@ -36,21 +36,89 @@ function copyDir(srcRel, destRel) {
36
36
  }
37
37
  }
38
38
 
39
+ // ── node dependency setup ────────────────────────────────────────────────────
40
+
41
+ function setupNodeDeps() {
42
+ const pkgPath = path.join(DEST, 'package.json');
43
+
44
+ let pkg = {};
45
+ if (fs.existsSync(pkgPath)) {
46
+ try { pkg = JSON.parse(fs.readFileSync(pkgPath, 'utf8')); } catch {}
47
+ }
48
+
49
+ let changed = false;
50
+
51
+ if (pkg.type !== 'module') {
52
+ pkg.type = 'module';
53
+ changed = true;
54
+ }
55
+
56
+ pkg.devDependencies = pkg.devDependencies || {};
57
+ if (!pkg.devDependencies.playwright) {
58
+ pkg.devDependencies.playwright = 'latest';
59
+ changed = true;
60
+ }
61
+ if (!pkg.devDependencies.dotenv) {
62
+ pkg.devDependencies.dotenv = 'latest';
63
+ changed = true;
64
+ }
65
+
66
+ pkg.scripts = pkg.scripts || {};
67
+ if (!pkg.scripts.qa) {
68
+ pkg.scripts.qa = 'node tests/e2e/js/main.js';
69
+ changed = true;
70
+ }
71
+ if (!pkg.scripts['qa:register']) {
72
+ pkg.scripts['qa:register'] = 'node tests/e2e/js/register.js';
73
+ changed = true;
74
+ }
75
+
76
+ if (changed) {
77
+ fs.writeFileSync(pkgPath, JSON.stringify(pkg, null, 2) + '\n');
78
+ console.log(' ✅ updated package.json');
79
+ } else {
80
+ console.log(' ⏭ skip package.json (already configured)');
81
+ }
82
+
83
+ console.log('\n📦 Running npm install...\n');
84
+ const install = spawnSync('npm', ['install'], {
85
+ cwd: DEST, stdio: 'inherit',
86
+ });
87
+ if (install.status !== 0) {
88
+ console.log(' ⚠️ npm install failed — run manually: npm install');
89
+ return;
90
+ }
91
+
92
+ console.log('\n🎭 Installing Playwright Chromium...\n');
93
+ const pw = spawnSync('npx', ['playwright', 'install', 'chromium'], {
94
+ cwd: DEST, stdio: 'inherit',
95
+ });
96
+ if (pw.status !== 0) {
97
+ console.log(' ⚠️ Playwright install failed — run manually: npx playwright install chromium');
98
+ }
99
+ }
100
+
101
+ // ── main ──────────────────────────────────────────────────────────────────────
102
+
39
103
  console.log('\n🚀 Installing @kamleshsk/claude-qa into:');
40
104
  console.log(' ' + DEST + '\n');
41
105
 
42
- // Claude commands
106
+ console.log('📁 Copying skills and commands...\n');
107
+
43
108
  copyFile('commands/qa.md', '.claude/commands/qa.md');
44
109
  copyFile('commands/qa-setup.md', '.claude/commands/qa-setup.md');
45
110
 
46
- // Playwright skill (SKILL.md + all references)
47
111
  copyFile('skills/playwright-cli/SKILL.md', '.claude/skills/playwright-cli/SKILL.md');
48
112
  copyDir( 'skills/playwright-cli/references', '.claude/skills/playwright-cli/references');
49
113
 
50
- // Docs
51
114
  copyFile('docs/qa-setup/module-guide.md', 'docs/qa-setup/module-guide.md');
52
115
 
53
- console.log('\n─────────────────────────────────────────────');
54
- console.log(' Done! Open Claude Code in this project and');
55
- console.log(' run /qa-setup to scaffold the QA framework.');
56
- console.log('─────────────────────────────────────────────\n');
116
+ console.log('\n⚙️ Setting up Node dependencies...\n');
117
+ setupNodeDeps();
118
+
119
+ console.log('\n─────────────────────────────────────────────────────────');
120
+ console.log(' ✅ All done!');
121
+ console.log('');
122
+ console.log(' Open Claude Code in this project and');
123
+ console.log(' run /qa-setup to scaffold the QA framework.');
124
+ console.log('─────────────────────────────────────────────────────────\n');
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@kamleshsk/claude-qa",
3
- "version": "1.0.1",
3
+ "version": "1.0.3",
4
4
  "description": "Claude Code QA skills and commands installer — works with any project",
5
5
  "bin": {
6
6
  "claude-qa": "bin/install.js"