autoworkflow 1.0.0 → 1.1.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/README.md CHANGED
@@ -24,6 +24,9 @@ npm install autoworkflow
24
24
  │ ✓ Creates .husky/pre-commit │
25
25
  │ ✓ Creates .husky/commit-msg │
26
26
  │ ✓ Creates enforce.config.json │
27
+ │ ✓ Creates CLAUDE.md │
28
+ │ ✓ Creates .vscode/settings.json │
29
+ │ ✓ Creates .vscode/tasks.json │
27
30
  │ ✓ Adds prepare script │
28
31
  └──────────────────────────────────┘
29
32
 
@@ -31,27 +34,32 @@ npm install autoworkflow
31
34
  Every "git commit" runs checks automatically
32
35
  ```
33
36
 
37
+ **Note:** Existing files are never overwritten.
38
+
34
39
  ## Default Checks
35
40
 
36
- | Check | Blocking | Auto-Fix |
37
- |-------|----------|----------|
38
- | No TODO/FIXME comments | ✅ | - |
39
- | No console.log | ✅ | - |
40
- | TypeScript errors | ✅ | - |
41
- | ESLint errors | ✅ | ✅ |
42
- | Circular dependencies | ✅ | - |
43
- | Commit message format | ✅ | - |
41
+ | Check | Blocking | Auto-Fix |
42
+ | ---------------------- | -------- | -------- |
43
+ | No TODO/FIXME comments | ✅ | - |
44
+ | No console.log | ✅ | - |
45
+ | TypeScript errors | ✅ | - |
46
+ | ESLint errors | ✅ | ✅ |
47
+ | Circular dependencies | ✅ | - |
48
+ | Commit message format | ✅ | - |
44
49
 
45
50
  ## How It Works
46
51
 
47
52
  ### Pre-Commit Hook
53
+
48
54
  Every time you run `git commit`, autoworkflow:
55
+
49
56
  1. Runs all enabled checks
50
57
  2. If ESLint fails, auto-fixes and retries (up to 5 attempts)
51
58
  3. Blocks commit if any blocking check fails
52
59
  4. Allows commit if all checks pass
53
60
 
54
61
  ### Commit Message Validation
62
+
55
63
  Enforces [Conventional Commits](https://www.conventionalcommits.org/):
56
64
 
57
65
  ```bash
@@ -113,13 +121,13 @@ Edit `enforce.config.json` in your project root:
113
121
 
114
122
  ### Rule Options
115
123
 
116
- | Option | Type | Description |
117
- |--------|------|-------------|
118
- | `enabled` | boolean | Enable/disable the rule |
119
- | `blocking` | boolean | If true, fails the commit on violation |
120
- | `autoFix` | boolean | Enable auto-fix for this rule |
121
- | `command` | string | Custom check command |
122
- | `fixCommand` | string | Custom fix command |
124
+ | Option | Type | Description |
125
+ | ------------ | ------- | -------------------------------------- |
126
+ | `enabled` | boolean | Enable/disable the rule |
127
+ | `blocking` | boolean | If true, fails the commit on violation |
128
+ | `autoFix` | boolean | Enable auto-fix for this rule |
129
+ | `command` | string | Custom check command |
130
+ | `fixCommand` | string | Custom fix command |
123
131
 
124
132
  ### Disable a Rule
125
133
 
@@ -193,12 +201,49 @@ Use sparingly. All skipped commits are your responsibility.
193
201
  - TypeScript >= 5.0.0 (for TypeScript checks)
194
202
  - ESLint >= 8.0.0 (for ESLint checks)
195
203
 
204
+ ## VSCode Integration
205
+
206
+ ### Auto-Fix on Save
207
+
208
+ The generated `.vscode/settings.json` enables:
209
+
210
+ - **Format on save** with Prettier
211
+ - **ESLint auto-fix** on save
212
+ - **Organize imports** on save
213
+ - **Remove unused imports** on save
214
+ - **Tailwind CSS** class sorting (clsx/cn support)
215
+
216
+ ### Quick Tasks (Cmd+Shift+B)
217
+
218
+ The generated `.vscode/tasks.json` provides:
219
+
220
+ | Task | Description |
221
+ |------|-------------|
222
+ | Autoworkflow: Run Checks | Run all enforcement checks |
223
+ | Autoworkflow: TypeScript Check | TypeScript only |
224
+ | Autoworkflow: ESLint Fix | Fix all ESLint issues |
225
+ | Autoworkflow: List Rules | Show rule status |
226
+ | Dev Server | Start npm run dev |
227
+ | Quick Commit | Stage all + commit with prompt |
228
+
229
+ ## AI Integration (CLAUDE.md)
230
+
231
+ The generated `CLAUDE.md` instructs Claude/AI assistants to:
232
+
233
+ - Follow a structured workflow (Analyze → Plan → Confirm → Implement)
234
+ - Show 3-tier suggestions (Required/Recommended/Optional)
235
+ - Ask for confirmation before implementing
236
+ - Use conventional commit messages
237
+ - Respect all enforcement rules
238
+
196
239
  ## Uninstall
197
240
 
198
241
  ```bash
199
242
  npm uninstall autoworkflow
200
243
  rm -rf .husky
201
244
  rm enforce.config.json
245
+ rm CLAUDE.md
246
+ rm -rf .vscode # Only if you want to remove VSCode settings
202
247
  ```
203
248
 
204
249
  ## License
package/lib/index.js CHANGED
@@ -5,5 +5,5 @@
5
5
  */
6
6
 
7
7
  module.exports = {
8
- version: '1.0.0',
8
+ version: '1.1.0',
9
9
  };
package/lib/install.js CHANGED
@@ -192,6 +192,343 @@ function updatePackageJson(projectRoot) {
192
192
  }
193
193
  }
194
194
 
195
+ function createClaudeMd(projectRoot) {
196
+ const claudePath = path.join(projectRoot, 'CLAUDE.md');
197
+
198
+ if (fs.existsSync(claudePath)) {
199
+ log(c.yellow, ' ⚠ CLAUDE.md already exists, skipping...');
200
+ return;
201
+ }
202
+
203
+ const claudeContent = `# CLAUDE.md - AI Workflow Instructions
204
+
205
+ > **MANDATORY**: Follow this workflow for ALL coding tasks.
206
+
207
+ ## Workflow
208
+
209
+ \`\`\`
210
+ 1. ANALYZE → Read relevant files first
211
+ 2. PLAN → Show plan + suggestions
212
+ 3. CONFIRM → "Should I proceed?" (wait for approval)
213
+ 4. IMPLEMENT → Make changes (after approval)
214
+ 5. VERIFY → Run checks (autoworkflow handles this on commit)
215
+ 6. COMMIT → Conventional commit format required
216
+ \`\`\`
217
+
218
+ ---
219
+
220
+ ## Blocking Rules (Enforced by autoworkflow)
221
+
222
+ These rules are **automatically enforced** on every commit:
223
+
224
+ | Rule | Blocking | Auto-Fix |
225
+ |------|----------|----------|
226
+ | No TODO/FIXME comments | ⛔ YES | NO |
227
+ | No console.log statements | ⛔ YES | NO |
228
+ | TypeScript errors | ⛔ YES | NO |
229
+ | ESLint errors | ⛔ YES | YES (auto-fix loop) |
230
+ | Circular dependencies | ⛔ YES | NO |
231
+ | Conventional commits | ⛔ YES | NO |
232
+
233
+ ---
234
+
235
+ ## Suggestions System
236
+
237
+ For EVERY new feature, include suggestions after your plan:
238
+
239
+ \`\`\`
240
+ 💡 **Suggestions for Feature Completeness:**
241
+
242
+ 🔴 **Required** (must implement):
243
+ - [ ] Error handling for [specific case]
244
+ - [ ] Loading state for [async operation]
245
+ - [ ] Input validation for [field]
246
+
247
+ 🟡 **Recommended** (improves quality):
248
+ - [ ] Handle edge case: [scenario]
249
+ - [ ] Add accessibility: [aria labels]
250
+
251
+ 🟢 **Optional** (nice to have):
252
+ - [ ] Add tests
253
+ - [ ] Performance optimization
254
+
255
+ **Which suggestions should I include?** (all/required/none)
256
+ \`\`\`
257
+
258
+ ---
259
+
260
+ ## Confirmation Checkpoints
261
+
262
+ ### Before Implementation
263
+ \`\`\`
264
+ ## Task: [description]
265
+
266
+ ### Plan
267
+ 1. [Change 1]
268
+ 2. [Change 2]
269
+
270
+ 💡 Suggestions: [list]
271
+
272
+ **Should I proceed?**
273
+ \`\`\`
274
+
275
+ ### Before Commit
276
+ \`\`\`
277
+ ✅ All checks will run automatically via autoworkflow.
278
+ **Should I commit with message: "type: description"?**
279
+ \`\`\`
280
+
281
+ ---
282
+
283
+ ## Commit Message Format
284
+
285
+ Must follow conventional commits:
286
+
287
+ \`\`\`bash
288
+ # Valid formats
289
+ feat: add user authentication
290
+ fix(api): resolve timeout issue
291
+ docs: update readme
292
+
293
+ # Types: feat, fix, docs, style, refactor, perf, test, build, ci, chore, revert
294
+ \`\`\`
295
+
296
+ ---
297
+
298
+ ## Rules
299
+
300
+ 1. **Ask before implementing** - Plan first, wait for approval
301
+ 2. **No console.log** - Use proper logging or remove
302
+ 3. **No TODO comments** - Complete the work or create an issue
303
+ 4. **Fix all errors** - TypeScript and ESLint must pass
304
+ 5. **One feature at a time** - Complete fully before next
305
+ 6. **Use conventional commits** - type(scope): description
306
+ `;
307
+
308
+ fs.writeFileSync(claudePath, claudeContent);
309
+ log(c.green, ' ✓ Created CLAUDE.md');
310
+ }
311
+
312
+ function createVSCodeSettings(projectRoot) {
313
+ const vscodeDir = path.join(projectRoot, '.vscode');
314
+ const settingsPath = path.join(vscodeDir, 'settings.json');
315
+
316
+ // Create .vscode directory if it doesn't exist
317
+ if (!fs.existsSync(vscodeDir)) {
318
+ fs.mkdirSync(vscodeDir, { recursive: true });
319
+ }
320
+
321
+ if (fs.existsSync(settingsPath)) {
322
+ log(c.yellow, ' ⚠ .vscode/settings.json already exists, skipping...');
323
+ return;
324
+ }
325
+
326
+ const settings = {
327
+ // Editor - Format & Fix on Save
328
+ "editor.formatOnSave": true,
329
+ "editor.formatOnPaste": true,
330
+ "editor.codeActionsOnSave": {
331
+ "source.fixAll.eslint": "explicit",
332
+ "source.organizeImports": "explicit",
333
+ "source.removeUnusedImports": "explicit"
334
+ },
335
+ "editor.defaultFormatter": "esbenp.prettier-vscode",
336
+ "editor.tabSize": 2,
337
+ "editor.insertSpaces": true,
338
+ "editor.detectIndentation": false,
339
+ "editor.bracketPairColorization.enabled": true,
340
+ "editor.guides.bracketPairs": true,
341
+ "editor.linkedEditing": true,
342
+ "editor.suggest.preview": true,
343
+ "editor.inlineSuggest.enabled": true,
344
+
345
+ // TypeScript - Use workspace version, strict checking
346
+ "typescript.tsdk": "node_modules/typescript/lib",
347
+ "typescript.enablePromptUseWorkspaceTsdk": true,
348
+ "typescript.validate.enable": true,
349
+ "typescript.suggestionActions.enabled": true,
350
+ "typescript.preferences.importModuleSpecifier": "relative",
351
+ "typescript.updateImportsOnFileMove.enabled": "always",
352
+ "typescript.suggest.completeFunctionCalls": true,
353
+
354
+ // JavaScript
355
+ "javascript.updateImportsOnFileMove.enabled": "always",
356
+ "javascript.suggest.completeFunctionCalls": true,
357
+
358
+ // ESLint
359
+ "eslint.validate": ["javascript", "javascriptreact", "typescript", "typescriptreact"],
360
+ "eslint.codeActionsOnSave.mode": "all",
361
+ "eslint.run": "onType",
362
+
363
+ // Prettier
364
+ "[typescript]": { "editor.defaultFormatter": "esbenp.prettier-vscode" },
365
+ "[typescriptreact]": { "editor.defaultFormatter": "esbenp.prettier-vscode" },
366
+ "[javascript]": { "editor.defaultFormatter": "esbenp.prettier-vscode" },
367
+ "[javascriptreact]": { "editor.defaultFormatter": "esbenp.prettier-vscode" },
368
+ "[json]": { "editor.defaultFormatter": "esbenp.prettier-vscode" },
369
+ "[jsonc]": { "editor.defaultFormatter": "esbenp.prettier-vscode" },
370
+ "[markdown]": { "editor.defaultFormatter": "esbenp.prettier-vscode" },
371
+ "[css]": { "editor.defaultFormatter": "esbenp.prettier-vscode" },
372
+ "[scss]": { "editor.defaultFormatter": "esbenp.prettier-vscode" },
373
+ "[html]": { "editor.defaultFormatter": "esbenp.prettier-vscode" },
374
+
375
+ // Files
376
+ "files.autoSave": "onFocusChange",
377
+ "files.trimTrailingWhitespace": true,
378
+ "files.insertFinalNewline": true,
379
+ "files.trimFinalNewlines": true,
380
+ "files.associations": {
381
+ "*.css": "tailwindcss"
382
+ },
383
+ "files.exclude": {
384
+ "**/node_modules": true,
385
+ "**/.git": true,
386
+ "**/dist": true,
387
+ "**/.next": true,
388
+ "**/coverage": true
389
+ },
390
+
391
+ // Search
392
+ "search.exclude": {
393
+ "**/node_modules": true,
394
+ "**/dist": true,
395
+ "**/coverage": true,
396
+ "**/.next": true,
397
+ "**/package-lock.json": true
398
+ },
399
+
400
+ // Tailwind CSS
401
+ "tailwindCSS.experimental.classRegex": [
402
+ ["clsx\\(([^)]*)\\)", "(?:'|\"|`)([^']*)(?:'|\"|`)"],
403
+ ["cn\\(([^)]*)\\)", "(?:'|\"|`)([^']*)(?:'|\"|`)"],
404
+ ["cva\\(([^)]*)\\)", "[\"'`]([^\"'`]*).*?[\"'`]"]
405
+ ],
406
+ "tailwindCSS.includeLanguages": {
407
+ "typescript": "javascript",
408
+ "typescriptreact": "javascript"
409
+ },
410
+
411
+ // Terminal
412
+ "terminal.integrated.defaultProfile.osx": "zsh",
413
+ "terminal.integrated.scrollback": 10000,
414
+
415
+ // Git
416
+ "git.enableSmartCommit": true,
417
+ "git.confirmSync": false,
418
+ "git.autofetch": true,
419
+
420
+ // Explorer
421
+ "explorer.confirmDelete": false,
422
+ "explorer.confirmDragAndDrop": false,
423
+ "explorer.compactFolders": false
424
+ };
425
+
426
+ fs.writeFileSync(settingsPath, JSON.stringify(settings, null, 2));
427
+ log(c.green, ' ✓ Created .vscode/settings.json');
428
+ }
429
+
430
+ function createVSCodeTasks(projectRoot) {
431
+ const vscodeDir = path.join(projectRoot, '.vscode');
432
+ const tasksPath = path.join(vscodeDir, 'tasks.json');
433
+
434
+ // Create .vscode directory if it doesn't exist
435
+ if (!fs.existsSync(vscodeDir)) {
436
+ fs.mkdirSync(vscodeDir, { recursive: true });
437
+ }
438
+
439
+ if (fs.existsSync(tasksPath)) {
440
+ log(c.yellow, ' ⚠ .vscode/tasks.json already exists, skipping...');
441
+ return;
442
+ }
443
+
444
+ const tasks = {
445
+ "version": "2.0.0",
446
+ "tasks": [
447
+ {
448
+ "label": "Autoworkflow: Run Checks",
449
+ "type": "shell",
450
+ "command": "npx autoworkflow run",
451
+ "group": {
452
+ "kind": "build",
453
+ "isDefault": true
454
+ },
455
+ "presentation": {
456
+ "reveal": "always",
457
+ "panel": "shared",
458
+ "clear": true
459
+ },
460
+ "problemMatcher": ["$tsc", "$eslint-stylish"]
461
+ },
462
+ {
463
+ "label": "Autoworkflow: TypeScript Check",
464
+ "type": "shell",
465
+ "command": "npx tsc --noEmit",
466
+ "group": "build",
467
+ "presentation": {
468
+ "reveal": "always",
469
+ "panel": "shared"
470
+ },
471
+ "problemMatcher": "$tsc"
472
+ },
473
+ {
474
+ "label": "Autoworkflow: ESLint Fix",
475
+ "type": "shell",
476
+ "command": "npx eslint . --fix",
477
+ "group": "build",
478
+ "presentation": {
479
+ "reveal": "always",
480
+ "panel": "shared"
481
+ },
482
+ "problemMatcher": "$eslint-stylish"
483
+ },
484
+ {
485
+ "label": "Autoworkflow: List Rules",
486
+ "type": "shell",
487
+ "command": "npx autoworkflow list",
488
+ "group": "build",
489
+ "presentation": {
490
+ "reveal": "always",
491
+ "panel": "shared"
492
+ },
493
+ "problemMatcher": []
494
+ },
495
+ {
496
+ "label": "Dev Server",
497
+ "type": "shell",
498
+ "command": "npm run dev",
499
+ "group": "build",
500
+ "isBackground": true,
501
+ "presentation": {
502
+ "reveal": "always",
503
+ "panel": "dedicated"
504
+ },
505
+ "problemMatcher": []
506
+ },
507
+ {
508
+ "label": "Quick Commit",
509
+ "type": "shell",
510
+ "command": "git add -A && git commit -m '${input:commitMessage}'",
511
+ "group": "build",
512
+ "presentation": {
513
+ "reveal": "always",
514
+ "panel": "shared"
515
+ },
516
+ "problemMatcher": []
517
+ }
518
+ ],
519
+ "inputs": [
520
+ {
521
+ "id": "commitMessage",
522
+ "type": "promptString",
523
+ "description": "Commit message (e.g., 'feat: add dark mode')"
524
+ }
525
+ ]
526
+ };
527
+
528
+ fs.writeFileSync(tasksPath, JSON.stringify(tasks, null, 2));
529
+ log(c.green, ' ✓ Created .vscode/tasks.json');
530
+ }
531
+
195
532
  function main() {
196
533
  console.log('');
197
534
  log(c.blue, '━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━');
@@ -231,6 +568,13 @@ function main() {
231
568
  // Update package.json
232
569
  updatePackageJson(projectRoot);
233
570
 
571
+ // Create CLAUDE.md for AI workflow
572
+ createClaudeMd(projectRoot);
573
+
574
+ // Create VSCode settings and tasks
575
+ createVSCodeSettings(projectRoot);
576
+ createVSCodeTasks(projectRoot);
577
+
234
578
  console.log('');
235
579
  log(c.green, '━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━');
236
580
  log(c.green, '✅ Setup complete!');
@@ -240,7 +584,12 @@ function main() {
240
584
  console.log(' git add .');
241
585
  console.log(' git commit -m "feat: your feature"');
242
586
  console.log('');
243
- log(c.blue, 'Configuration: enforce.config.json');
587
+ log(c.blue, 'Files created:');
588
+ console.log(' • enforce.config.json - Rule configuration');
589
+ console.log(' • CLAUDE.md - AI workflow instructions');
590
+ console.log(' • .vscode/settings.json - Editor settings');
591
+ console.log(' • .vscode/tasks.json - Quick tasks (Cmd+Shift+B)');
592
+ console.log('');
244
593
  log(c.blue, 'CLI commands: npx autoworkflow --help');
245
594
  console.log('');
246
595
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "autoworkflow",
3
- "version": "1.0.0",
3
+ "version": "1.1.0",
4
4
  "description": "Automatic code quality enforcement with fix loops, configurable rules, and Git hook integration",
5
5
  "keywords": [
6
6
  "git-hooks",