autoworkflow 3.1.4 → 3.5.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.
Files changed (123) hide show
  1. package/.claude/commands/analyze.md +19 -0
  2. package/.claude/commands/audit.md +174 -11
  3. package/.claude/commands/build.md +39 -0
  4. package/.claude/commands/commit.md +25 -0
  5. package/.claude/commands/fix.md +23 -0
  6. package/.claude/commands/plan.md +18 -0
  7. package/.claude/commands/suggest.md +23 -0
  8. package/.claude/commands/verify.md +18 -0
  9. package/.claude/hooks/post-bash-router.sh +20 -0
  10. package/.claude/hooks/post-commit.sh +140 -0
  11. package/.claude/hooks/pre-edit.sh +129 -0
  12. package/.claude/hooks/session-check.sh +79 -0
  13. package/.claude/settings.json +40 -6
  14. package/.claude/settings.local.json +3 -1
  15. package/.claude/skills/actix.md +337 -0
  16. package/.claude/skills/alembic.md +504 -0
  17. package/.claude/skills/angular.md +237 -0
  18. package/.claude/skills/api-design.md +187 -0
  19. package/.claude/skills/aspnet-core.md +377 -0
  20. package/.claude/skills/astro.md +245 -0
  21. package/.claude/skills/auth-clerk.md +327 -0
  22. package/.claude/skills/auth-firebase.md +367 -0
  23. package/.claude/skills/auth-nextauth.md +359 -0
  24. package/.claude/skills/auth-supabase.md +368 -0
  25. package/.claude/skills/axum.md +386 -0
  26. package/.claude/skills/blazor.md +456 -0
  27. package/.claude/skills/chi.md +348 -0
  28. package/.claude/skills/code-review.md +133 -0
  29. package/.claude/skills/csharp.md +296 -0
  30. package/.claude/skills/css-modules.md +325 -0
  31. package/.claude/skills/cypress.md +343 -0
  32. package/.claude/skills/debugging.md +133 -0
  33. package/.claude/skills/diesel.md +392 -0
  34. package/.claude/skills/django.md +301 -0
  35. package/.claude/skills/docker.md +319 -0
  36. package/.claude/skills/doctrine.md +473 -0
  37. package/.claude/skills/documentation.md +182 -0
  38. package/.claude/skills/dotnet.md +409 -0
  39. package/.claude/skills/drizzle.md +293 -0
  40. package/.claude/skills/echo.md +321 -0
  41. package/.claude/skills/eloquent.md +256 -0
  42. package/.claude/skills/emotion.md +426 -0
  43. package/.claude/skills/entity-framework.md +370 -0
  44. package/.claude/skills/express.md +316 -0
  45. package/.claude/skills/fastapi.md +329 -0
  46. package/.claude/skills/fastify.md +299 -0
  47. package/.claude/skills/fiber.md +315 -0
  48. package/.claude/skills/flask.md +322 -0
  49. package/.claude/skills/gin.md +342 -0
  50. package/.claude/skills/git.md +116 -0
  51. package/.claude/skills/github-actions.md +353 -0
  52. package/.claude/skills/go.md +377 -0
  53. package/.claude/skills/gorm.md +409 -0
  54. package/.claude/skills/graphql.md +478 -0
  55. package/.claude/skills/hibernate.md +379 -0
  56. package/.claude/skills/hono.md +306 -0
  57. package/.claude/skills/java.md +400 -0
  58. package/.claude/skills/jest.md +313 -0
  59. package/.claude/skills/jpa.md +282 -0
  60. package/.claude/skills/kotlin.md +347 -0
  61. package/.claude/skills/kubernetes.md +363 -0
  62. package/.claude/skills/laravel.md +414 -0
  63. package/.claude/skills/mcp-browser.md +320 -0
  64. package/.claude/skills/mcp-database.md +219 -0
  65. package/.claude/skills/mcp-fetch.md +241 -0
  66. package/.claude/skills/mcp-filesystem.md +204 -0
  67. package/.claude/skills/mcp-github.md +217 -0
  68. package/.claude/skills/mcp-memory.md +240 -0
  69. package/.claude/skills/mcp-search.md +218 -0
  70. package/.claude/skills/mcp-slack.md +262 -0
  71. package/.claude/skills/micronaut.md +388 -0
  72. package/.claude/skills/mongodb.md +319 -0
  73. package/.claude/skills/mongoose.md +355 -0
  74. package/.claude/skills/mysql.md +281 -0
  75. package/.claude/skills/nestjs.md +335 -0
  76. package/.claude/skills/nextjs-app-router.md +260 -0
  77. package/.claude/skills/nextjs-pages.md +172 -0
  78. package/.claude/skills/nuxt.md +202 -0
  79. package/.claude/skills/openapi.md +489 -0
  80. package/.claude/skills/performance.md +199 -0
  81. package/.claude/skills/php.md +398 -0
  82. package/.claude/skills/playwright.md +371 -0
  83. package/.claude/skills/postgresql.md +257 -0
  84. package/.claude/skills/prisma.md +293 -0
  85. package/.claude/skills/pydantic.md +304 -0
  86. package/.claude/skills/pytest.md +313 -0
  87. package/.claude/skills/python.md +272 -0
  88. package/.claude/skills/quarkus.md +377 -0
  89. package/.claude/skills/react.md +230 -0
  90. package/.claude/skills/redis.md +391 -0
  91. package/.claude/skills/refactoring.md +143 -0
  92. package/.claude/skills/remix.md +246 -0
  93. package/.claude/skills/rest-api.md +490 -0
  94. package/.claude/skills/rocket.md +366 -0
  95. package/.claude/skills/rust.md +341 -0
  96. package/.claude/skills/sass.md +380 -0
  97. package/.claude/skills/sea-orm.md +382 -0
  98. package/.claude/skills/security.md +167 -0
  99. package/.claude/skills/sequelize.md +395 -0
  100. package/.claude/skills/spring-boot.md +416 -0
  101. package/.claude/skills/sqlalchemy.md +269 -0
  102. package/.claude/skills/sqlx-rust.md +408 -0
  103. package/.claude/skills/state-jotai.md +346 -0
  104. package/.claude/skills/state-mobx.md +353 -0
  105. package/.claude/skills/state-pinia.md +431 -0
  106. package/.claude/skills/state-redux.md +337 -0
  107. package/.claude/skills/state-tanstack-query.md +434 -0
  108. package/.claude/skills/state-zustand.md +340 -0
  109. package/.claude/skills/styled-components.md +403 -0
  110. package/.claude/skills/svelte.md +238 -0
  111. package/.claude/skills/sveltekit.md +207 -0
  112. package/.claude/skills/symfony.md +437 -0
  113. package/.claude/skills/tailwind.md +279 -0
  114. package/.claude/skills/terraform.md +394 -0
  115. package/.claude/skills/testing-library.md +371 -0
  116. package/.claude/skills/trpc.md +426 -0
  117. package/.claude/skills/typeorm.md +368 -0
  118. package/.claude/skills/vitest.md +330 -0
  119. package/.claude/skills/vue.md +202 -0
  120. package/.claude/skills/warp.md +365 -0
  121. package/README.md +135 -52
  122. package/package.json +1 -1
  123. package/system/triggers.md +152 -11
@@ -1,3 +1,22 @@
1
+ ---
2
+ role: Technical Analyst
3
+ skills_required: []
4
+ output_schema:
5
+ task_description: string
6
+ classification: {type: enum[feature,fix,refactor,style,docs,test,query], workflow: array, gates: array}
7
+ relevant_files: [{path: string, reason: string}]
8
+ existing_patterns: array
9
+ blueprint_requirements: array
10
+ dependencies: array
11
+ notes: array
12
+ guardrails:
13
+ - Always read BLUEPRINT.md if it exists
14
+ - Always classify task type using system/router.md
15
+ - Never skip to implementation without analysis
16
+ - Identify all relevant files before planning
17
+ - Note existing patterns to maintain consistency
18
+ ---
19
+
1
20
  # /analyze - Analyze Command
2
21
 
3
22
  Analyze the codebase for a given task or question.
@@ -1,7 +1,33 @@
1
+ ---
2
+ role: Senior Code Reviewer
3
+ skills_required:
4
+ - security.md
5
+ - code-review.md
6
+ output_schema:
7
+ feature_name: string
8
+ issues: [{severity: enum[critical,high,medium,low], category: enum[security,performance,maintainability,correctness], file: string, line: number, message: string, suggestion: string}]
9
+ summary: string
10
+ score: number (0-100)
11
+ approval: boolean
12
+ blocking_issues: number
13
+ guardrails:
14
+ - Prioritize security issues above all else
15
+ - Fail immediately on critical issues
16
+ - Always provide actionable fix suggestions
17
+ - ONE FEATURE AT A TIME - never audit multiple features simultaneously
18
+ - Complete full cycle before moving to next feature
19
+ - Require user confirmation before proceeding to next feature
20
+ ---
21
+
1
22
  # /audit - Audit Command
2
23
 
3
24
  Run code quality, security, and architecture audits.
4
25
 
26
+ ## Prerequisites (LOAD FIRST)
27
+ **Before executing this command, READ these skill files:**
28
+ 1. `.claude/skills/security.md` - Security patterns and vulnerabilities
29
+ 2. `.claude/skills/code-review.md` - Code review checklist and feedback
30
+
5
31
  ## Trigger
6
32
  - User invokes `/audit`
7
33
  - User invokes `/audit project` (full project scan)
@@ -19,10 +45,34 @@ Per `system/router.md`, audit is required for:
19
45
  ## Arguments
20
46
  - `/audit` - Run standard checks (UI + cycles)
21
47
  - `/audit project` - Full project scan (generates BLUEPRINT.md)
48
+ - `/audit sync` - Compare BLUEPRINT vs code, one feature at a time
22
49
  - `/audit [feature name]` - Deep audit of specific feature
23
50
 
24
51
  ---
25
52
 
53
+ ## Core Principle: ONE FEATURE AT A TIME
54
+
55
+ **NEVER audit multiple features simultaneously.** This prevents:
56
+ - Information overload
57
+ - Multiple incomplete features
58
+ - User confusion
59
+
60
+ ```
61
+ ❌ WRONG: "Here are 15 features with gaps across your codebase..."
62
+ ✅ RIGHT: "Feature 1: User Auth. Here's what's missing. Fix now? → Done → Next feature..."
63
+ ```
64
+
65
+ **Serial workflow:**
66
+ ```
67
+ Feature 1 → Audit → Fix → Verify → ✅ Complete
68
+
69
+ Feature 2 → Audit → Fix → Verify → ✅ Complete
70
+
71
+ Feature 3 → ...
72
+ ```
73
+
74
+ ---
75
+
26
76
  ## Audit Types
27
77
 
28
78
  ### Type 1: Feature Audit (`/audit [feature]`)
@@ -207,7 +257,99 @@ Update both files with discovered information.
207
257
 
208
258
  ---
209
259
 
210
- ### Type 3: Standard Audit (`/audit`)
260
+ ### Type 3: Blueprint Sync (`/audit sync`)
261
+
262
+ Compare BLUEPRINT.md against actual code, **one feature at a time**.
263
+
264
+ #### Step 1: Parse BLUEPRINT.md
265
+ Extract features list from the Features section.
266
+
267
+ #### Step 2: For EACH Feature (Serial)
268
+
269
+ ```
270
+ Feature 1: [Name]
271
+
272
+ Read BLUEPRINT requirements for this feature
273
+
274
+ Scan code for this feature's implementation
275
+
276
+ Compare: BLUEPRINT ↔ Code
277
+
278
+ Report gaps (one feature only)
279
+
280
+ Offer fixes
281
+
282
+ Wait for user
283
+
284
+ Fix if approved
285
+
286
+ THEN → Feature 2
287
+ ```
288
+
289
+ #### Step 3: Report Format (Per Feature)
290
+
291
+ ```
292
+ ## Blueprint Sync: Feature 1 of 5
293
+
294
+ ### 📘 User Authentication
295
+
296
+ **BLUEPRINT says:**
297
+ - Login with email/password
298
+ - OAuth (Google, GitHub)
299
+ - Password reset flow
300
+ - Session management
301
+
302
+ **Code has:**
303
+ - ✅ Login with email/password (`src/auth/login.ts`)
304
+ - ✅ OAuth Google (`src/auth/oauth.ts`)
305
+ - ❌ OAuth GitHub - NOT FOUND
306
+ - ⚠️ Password reset - Partial (no email sending)
307
+ - ✅ Session management (`src/auth/session.ts`)
308
+
309
+ **Sync Status:** 75% aligned
310
+
311
+ ---
312
+
313
+ ### Gap Analysis
314
+
315
+ | Gap | Direction | Action |
316
+ |-----|-----------|--------|
317
+ | OAuth GitHub | 📘→💻 | In BLUEPRINT, not in code |
318
+ | Password reset email | 📘→💻 | Incomplete implementation |
319
+
320
+ ### Suggested Actions
321
+
322
+ 1. **Implement OAuth GitHub** - Add GitHub provider to oauth.ts
323
+ 2. **Complete password reset** - Add email sending to reset flow
324
+
325
+ ---
326
+
327
+ **Options:**
328
+ - `implement` - Build missing code
329
+ - `remove` - Remove from BLUEPRINT (if not needed)
330
+ - `skip` - Move to next feature
331
+ - `1` - Only action 1
332
+ ```
333
+
334
+ #### Step 4: After User Action
335
+ - If `implement`: Build the missing parts, verify, re-check
336
+ - If `remove`: Update BLUEPRINT.md to remove the item
337
+ - If `skip`: Log as skipped, move to next feature
338
+
339
+ #### Step 5: Next Feature
340
+ Only after current feature is resolved (fixed/skipped/removed), show next:
341
+
342
+ ```
343
+ ✅ Feature 1: User Authentication - SYNCED
344
+
345
+ ## Blueprint Sync: Feature 2 of 5
346
+
347
+ ### 📘 Dashboard...
348
+ ```
349
+
350
+ ---
351
+
352
+ ### Type 4: Standard Audit (`/audit`)
211
353
 
212
354
  Quick check for UI enforcement and circular dependencies.
213
355
 
@@ -275,21 +417,42 @@ Ready to proceed to COMMIT.
275
417
 
276
418
  ---
277
419
 
278
- ## Critical Rule: Always Offer to Fix
420
+ ## Critical Rule: Complete Cycle Per Feature
279
421
 
280
- **NEVER** just report issues and move on. The workflow is:
422
+ **NEVER** move to the next feature until the current one is FULLY resolved.
281
423
 
424
+ **Complete cycle for ONE feature:**
425
+ ```
426
+ 1. AUDIT → Find issues in Feature X
427
+ 2. REPORT → Show issues with severity
428
+ 3. SUGGEST → Offer specific fixes
429
+ 4. WAIT → Get user approval
430
+ 5. IMPLEMENT → Make the approved changes
431
+ 6. VERIFY → Run npm run verify
432
+ 7. RE-AUDIT → Check Feature X again
433
+ 8. CONFIRM → Feature X is now complete? ✅
434
+ 9. THEN → Move to Feature X+1
282
435
  ```
283
- 1. AUDIT → Find issues
284
- 2. REPORT → Show issues with severity
285
- 3. SUGGEST Offer specific fixes
286
- 4. WAIT Get user approval
287
- 5. FIX Implement approved fixes
288
- 6. RE-AUDIT Verify fixes worked
289
- 7. THEN → Proceed to next item
436
+
437
+ **What "complete" means:**
438
+ - All approved fixes implemented
439
+ - Verification passes (no TS/ESLint errors)
440
+ - Re-audit shows no remaining issues
441
+ - User confirms ready to move on
442
+
443
+ **If user says "skip":**
444
+ - Log as skipped with reason
445
+ - Mark feature as incomplete in tracking
446
+ - Move to next feature
447
+ - DO NOT leave silently
448
+
290
449
  ```
450
+ ❌ WRONG:
451
+ "Found 3 issues in Auth. Found 2 issues in Dashboard. Found 5 issues in Settings..."
291
452
 
292
- If user says "no" to fixes, log it and proceed. But ALWAYS offer.
453
+ RIGHT:
454
+ "Found 3 issues in Auth. Fix? → [fixes] → Verify → Pass → Auth complete ✅ → Dashboard?"
455
+ ```
293
456
 
294
457
  ---
295
458
 
@@ -1,7 +1,46 @@
1
+ ---
2
+ role: Senior Full-Stack Engineer
3
+ skills_required: []
4
+ dynamic_skills:
5
+ - Detect project tech stack and load relevant skills
6
+ - React projects: react.md, nextjs-app-router.md or nextjs-pages.md
7
+ - Vue projects: vue.md, nuxt.md
8
+ - Backend: express.md, fastapi.md, etc.
9
+ - Database: prisma.md, postgresql.md, mongodb.md
10
+ output_schema:
11
+ feature_name: string
12
+ workflow_phases: [analyze, plan, confirm, implement, verify, audit, commit]
13
+ current_phase: string
14
+ phase_outputs: object
15
+ final_status: enum[completed,blocked,pending_approval]
16
+ guardrails:
17
+ - Execute FULL workflow: ANALYZE → PLAN → CONFIRM → IMPLEMENT → VERIFY → AUDIT → COMMIT
18
+ - NEVER skip the CONFIRM phase - always wait for user approval
19
+ - Handle loading, error, and empty states for all UI components
20
+ - Use TypeScript with proper type definitions
21
+ - Ensure accessibility (WCAG 2.1 AA minimum)
22
+ - Follow existing code patterns in the project
23
+ ---
24
+
1
25
  # /build - Build Feature Command
2
26
 
3
27
  Execute the full workflow to build a feature from start to finish.
4
28
 
29
+ ## Prerequisites (LOAD FIRST - Dynamic)
30
+ **Before executing, detect project tech stack and load relevant skills:**
31
+
32
+ 1. **Check package.json** for dependencies
33
+ 2. **Load matching skills from `.claude/skills/`:**
34
+ - React → `react.md`
35
+ - Next.js (app router) → `nextjs-app-router.md`
36
+ - Next.js (pages) → `nextjs-pages.md`
37
+ - Vue → `vue.md`
38
+ - Prisma → `prisma.md`
39
+ - Express → `express.md`
40
+ - TypeScript → Check `tsconfig.json` patterns
41
+
42
+ 3. **Always load:** `security.md` for security awareness
43
+
5
44
  ## Trigger
6
45
  - User invokes `/build [feature description]`
7
46
 
@@ -1,7 +1,32 @@
1
+ ---
2
+ role: Git Operations Specialist
3
+ skills_required:
4
+ - git.md
5
+ output_schema:
6
+ files_changed: array
7
+ commit_type: enum[feat,fix,docs,style,refactor,perf,test,build,ci,chore,revert]
8
+ commit_scope: string
9
+ commit_message: string
10
+ gate_status: {typescript: boolean, eslint: boolean, todo_check: boolean, console_check: boolean, format_valid: boolean}
11
+ commit_hash: string
12
+ guardrails:
13
+ - ALWAYS use conventional commit format: type(scope): description
14
+ - NEVER commit with failing TypeScript or ESLint checks
15
+ - NEVER commit files containing TODO/FIXME comments
16
+ - NEVER commit files containing console.log statements
17
+ - NEVER force push to main/master branch
18
+ - ALWAYS run verification before committing
19
+ - ALWAYS ask for confirmation before executing commit
20
+ ---
21
+
1
22
  # /commit - Commit Command
2
23
 
3
24
  Run pre-commit gate and create a conventional commit.
4
25
 
26
+ ## Prerequisites (LOAD FIRST)
27
+ **Before executing this command, READ these skill files:**
28
+ 1. `.claude/skills/git.md` - Git conventions, commit formats, and best practices
29
+
5
30
  ## Trigger
6
31
  - User invokes `/commit [message]`
7
32
  - Or: After AUDIT phase passes
@@ -1,7 +1,30 @@
1
+ ---
2
+ role: Senior Debug Engineer
3
+ skills_required:
4
+ - debugging.md
5
+ output_schema:
6
+ diagnosis: {root_cause: string, error_type: string, affected_files: array}
7
+ fix: {approach: string, changes: [{file: string, description: string}], verification_steps: array}
8
+ prevention: {regression_test: string, recommendations: array}
9
+ iteration: number
10
+ status: enum[fixed,in_progress,stuck]
11
+ guardrails:
12
+ - Make minimal, targeted changes only
13
+ - Always verify fix with npm run verify
14
+ - Never make destructive changes without confirmation
15
+ - Add regression test recommendation for each fix
16
+ - Follow systematic debugging: REPRODUCE → ISOLATE → IDENTIFY → FIX → VERIFY
17
+ - Max 10 fix iterations before asking for help
18
+ ---
19
+
1
20
  # /fix - Fix Command
2
21
 
3
22
  Fix verification errors and re-verify.
4
23
 
24
+ ## Prerequisites (LOAD FIRST)
25
+ **Before executing this command, READ these skill files:**
26
+ 1. `.claude/skills/debugging.md` - Systematic debugging approach and techniques
27
+
5
28
  ## Trigger
6
29
  - User invokes `/fix`
7
30
  - Or: Automatically when `verify_loop` detects errors
@@ -1,3 +1,21 @@
1
+ ---
2
+ role: Senior Technical Project Manager
3
+ skills_required: []
4
+ output_schema:
5
+ feature_name: string
6
+ classification: {type: string, workflow: string}
7
+ phases: [{name: string, tasks: array}]
8
+ tasks: [{id: string, description: string, effort: enum[S,M,L,XL], depends_on: array}]
9
+ risks: [{risk: string, mitigation: string}]
10
+ definition_of_done: array
11
+ guardrails:
12
+ - Maximum 10 tasks per phase
13
+ - Always include effort estimates (S/M/L/XL)
14
+ - Always identify task dependencies
15
+ - Never implement without explicit user approval
16
+ - Break complex tasks into smaller steps
17
+ ---
18
+
1
19
  # /plan - Plan Command
2
20
 
3
21
  Create an implementation plan with suggestions.
@@ -1,7 +1,30 @@
1
+ ---
2
+ role: Technical Advisor
3
+ skills_required:
4
+ - code-review.md
5
+ output_schema:
6
+ task_name: string
7
+ suggestions:
8
+ required: [{description: string, reason: string}]
9
+ recommended: [{description: string, reason: string}]
10
+ optional: [{description: string, reason: string}]
11
+ user_selection: array
12
+ guardrails:
13
+ - Categorize all suggestions by priority (required/recommended/optional)
14
+ - Always explain the "why" for each suggestion
15
+ - Required items are non-negotiable for feature completeness
16
+ - Let user select which suggestions to implement
17
+ - Never implement suggestions without user approval
18
+ ---
19
+
1
20
  # /suggest - Suggest Command
2
21
 
3
22
  Generate feature completeness suggestions for a task.
4
23
 
24
+ ## Prerequisites (LOAD FIRST)
25
+ **Before executing this command, READ these skill files:**
26
+ 1. `.claude/skills/code-review.md` - Code review patterns and feedback templates
27
+
5
28
  ## Trigger
6
29
  - User invokes `/suggest [task]`
7
30
  - Or: Automatically during PLAN phase for features
@@ -1,3 +1,21 @@
1
+ ---
2
+ role: Quality Assurance Engineer
3
+ skills_required: []
4
+ output_schema:
5
+ typescript: {status: enum[pass,fail], error_count: number, errors: array}
6
+ eslint: {status: enum[pass,fail], warning_count: number, warnings: array}
7
+ gate_passed: boolean
8
+ iteration: number
9
+ max_iterations: 10
10
+ guardrails:
11
+ - Always run full verification (typecheck + lint)
12
+ - Report every error with file path and line number
13
+ - Auto-enter fix loop on any failure
14
+ - Maximum 10 fix iterations before escalating to user
15
+ - Never skip verification steps
16
+ - Clear reporting of gate status
17
+ ---
18
+
1
19
  # /verify - Verify Command
2
20
 
3
21
  Run TypeScript and ESLint verification with fix loop.
@@ -0,0 +1,20 @@
1
+ #!/bin/bash
2
+ # AutoWorkflow Post-Bash Router Hook
3
+ # Runs on: PostToolUse for Bash
4
+ # Purpose: Route bash commands to appropriate post-action hooks
5
+ #
6
+ # Routes:
7
+ # - git commit → post-commit.sh (BLUEPRINT update reminder)
8
+
9
+ # Get the command that was executed
10
+ TOOL_INPUT="$1"
11
+
12
+ # Check if this was a git commit command
13
+ if echo "$TOOL_INPUT" | grep -qE "git\s+commit"; then
14
+ # Route to post-commit hook
15
+ ./.claude/hooks/post-commit.sh
16
+ exit $?
17
+ fi
18
+
19
+ # No routing needed for other commands
20
+ exit 0
@@ -0,0 +1,140 @@
1
+ #!/bin/bash
2
+ # AutoWorkflow Post-Commit Hook
3
+ # Runs on: PostToolUse for Bash (when git commit detected)
4
+ # Purpose: Trigger BLUEPRINT.md update reminder after feature commits
5
+ #
6
+ # This hook implements the on:feature_complete trigger
7
+ # It reminds Claude to update BLUEPRINT.md after successful commits
8
+
9
+ # Colors
10
+ RED='\033[0;31m'
11
+ GREEN='\033[0;32m'
12
+ YELLOW='\033[1;33m'
13
+ CYAN='\033[0;36m'
14
+ BOLD='\033[1m'
15
+ DIM='\033[2m'
16
+ NC='\033[0m'
17
+
18
+ # State directory
19
+ STATE_DIR=".claude/.autoworkflow"
20
+
21
+ # State files
22
+ PHASE_FILE="$STATE_DIR/phase"
23
+ TASK_TYPE_FILE="$STATE_DIR/task-type"
24
+
25
+ # Get task type
26
+ get_task_type() {
27
+ if [ -f "$TASK_TYPE_FILE" ]; then
28
+ cat "$TASK_TYPE_FILE"
29
+ else
30
+ echo "unknown"
31
+ fi
32
+ }
33
+
34
+ # Check if task type requires BLUEPRINT update
35
+ requires_blueprint_update() {
36
+ local task_type="$1"
37
+ case "$task_type" in
38
+ feature|refactor)
39
+ return 0
40
+ ;;
41
+ *)
42
+ return 1
43
+ ;;
44
+ esac
45
+ }
46
+
47
+ # Reset workflow state after commit
48
+ reset_workflow() {
49
+ echo "IDLE" > "$PHASE_FILE"
50
+ rm -f "$STATE_DIR/verify-iteration" 2>/dev/null
51
+ rm -f "$STATE_DIR/verify-status" 2>/dev/null
52
+ rm -f "$STATE_DIR/plan-approved" 2>/dev/null
53
+ rm -f "$STATE_DIR/changed-files" 2>/dev/null
54
+ rm -f "$STATE_DIR/session-resumed" 2>/dev/null
55
+ }
56
+
57
+ # Get last commit info
58
+ get_commit_info() {
59
+ local commit_type=$(git log -1 --pretty=%s 2>/dev/null | cut -d'(' -f1 | cut -d':' -f1)
60
+ local commit_scope=$(git log -1 --pretty=%s 2>/dev/null | sed -n 's/.*(\([^)]*\)).*/\1/p')
61
+ local commit_msg=$(git log -1 --pretty=%s 2>/dev/null)
62
+ local commit_hash=$(git log -1 --pretty=%h 2>/dev/null)
63
+ local files_changed=$(git diff-tree --no-commit-id --name-only -r HEAD 2>/dev/null | wc -l | tr -d ' ')
64
+
65
+ echo "$commit_type|$commit_scope|$commit_msg|$commit_hash|$files_changed"
66
+ }
67
+
68
+ # Main execution
69
+ main() {
70
+ local task_type=$(get_task_type)
71
+ local commit_info=$(get_commit_info)
72
+ local commit_type=$(echo "$commit_info" | cut -d'|' -f1)
73
+ local commit_scope=$(echo "$commit_info" | cut -d'|' -f2)
74
+ local commit_msg=$(echo "$commit_info" | cut -d'|' -f3)
75
+ local commit_hash=$(echo "$commit_info" | cut -d'|' -f4)
76
+ local files_changed=$(echo "$commit_info" | cut -d'|' -f5)
77
+
78
+ echo ""
79
+ echo "━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━"
80
+ echo -e "${GREEN}${BOLD}✅ AUTOWORKFLOW: COMMIT COMPLETE${NC}"
81
+ echo "━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━"
82
+ echo ""
83
+ echo -e " ${CYAN}Hash:${NC} $commit_hash"
84
+ echo -e " ${CYAN}Message:${NC} $commit_msg"
85
+ echo -e " ${CYAN}Files:${NC} $files_changed changed"
86
+ echo ""
87
+
88
+ # Check if BLUEPRINT update is needed
89
+ if requires_blueprint_update "$task_type" || [ "$commit_type" = "feat" ] || [ "$commit_type" = "refactor" ]; then
90
+ echo "━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━"
91
+ echo -e "${YELLOW}${BOLD}📘 AUTOWORKFLOW: UPDATE PHASE${NC}"
92
+ echo "━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━"
93
+ echo ""
94
+ echo "This commit may have added new features/routes/APIs."
95
+ echo ""
96
+ echo -e "${BOLD}Check if BLUEPRINT.md needs updating:${NC}"
97
+ echo ""
98
+ echo " 1. New routes/pages added?"
99
+ echo " 2. New API endpoints added?"
100
+ echo " 3. New features/components added?"
101
+ echo " 4. Existing features modified?"
102
+ echo ""
103
+
104
+ # Check what might have changed
105
+ local new_routes=$(git diff-tree --no-commit-id --name-only -r HEAD 2>/dev/null | grep -E "(pages|app|routes)" | head -3)
106
+ local new_apis=$(git diff-tree --no-commit-id --name-only -r HEAD 2>/dev/null | grep -E "(api|endpoints|routes)" | head -3)
107
+ local new_components=$(git diff-tree --no-commit-id --name-only -r HEAD 2>/dev/null | grep -E "components" | head -3)
108
+
109
+ if [ -n "$new_routes" ]; then
110
+ echo -e "${DIM}Potential new routes:${NC}"
111
+ echo "$new_routes" | while read f; do echo -e " ${DIM}- $f${NC}"; done
112
+ echo ""
113
+ fi
114
+
115
+ if [ -n "$new_apis" ]; then
116
+ echo -e "${DIM}Potential new APIs:${NC}"
117
+ echo "$new_apis" | while read f; do echo -e " ${DIM}- $f${NC}"; done
118
+ echo ""
119
+ fi
120
+
121
+ if [ -n "$new_components" ]; then
122
+ echo -e "${DIM}Potential new components:${NC}"
123
+ echo "$new_components" | while read f; do echo -e " ${DIM}- $f${NC}"; done
124
+ echo ""
125
+ fi
126
+
127
+ echo -e "${BOLD}Action:${NC} Review and update instructions/BLUEPRINT.md if needed."
128
+ echo ""
129
+ echo "━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━"
130
+ fi
131
+
132
+ # Reset workflow state
133
+ reset_workflow
134
+
135
+ echo ""
136
+ echo -e "${GREEN}Workflow complete. Ready for next task.${NC}"
137
+ echo ""
138
+ }
139
+
140
+ main