autoworkflow 3.1.5 → 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.
- package/.claude/commands/analyze.md +19 -0
- package/.claude/commands/audit.md +26 -0
- package/.claude/commands/build.md +39 -0
- package/.claude/commands/commit.md +25 -0
- package/.claude/commands/fix.md +23 -0
- package/.claude/commands/plan.md +18 -0
- package/.claude/commands/suggest.md +23 -0
- package/.claude/commands/verify.md +18 -0
- package/.claude/hooks/post-bash-router.sh +20 -0
- package/.claude/hooks/post-commit.sh +140 -0
- package/.claude/hooks/pre-edit.sh +129 -0
- package/.claude/hooks/session-check.sh +79 -0
- package/.claude/settings.json +40 -6
- package/.claude/settings.local.json +3 -1
- package/.claude/skills/actix.md +337 -0
- package/.claude/skills/alembic.md +504 -0
- package/.claude/skills/angular.md +237 -0
- package/.claude/skills/api-design.md +187 -0
- package/.claude/skills/aspnet-core.md +377 -0
- package/.claude/skills/astro.md +245 -0
- package/.claude/skills/auth-clerk.md +327 -0
- package/.claude/skills/auth-firebase.md +367 -0
- package/.claude/skills/auth-nextauth.md +359 -0
- package/.claude/skills/auth-supabase.md +368 -0
- package/.claude/skills/axum.md +386 -0
- package/.claude/skills/blazor.md +456 -0
- package/.claude/skills/chi.md +348 -0
- package/.claude/skills/code-review.md +133 -0
- package/.claude/skills/csharp.md +296 -0
- package/.claude/skills/css-modules.md +325 -0
- package/.claude/skills/cypress.md +343 -0
- package/.claude/skills/debugging.md +133 -0
- package/.claude/skills/diesel.md +392 -0
- package/.claude/skills/django.md +301 -0
- package/.claude/skills/docker.md +319 -0
- package/.claude/skills/doctrine.md +473 -0
- package/.claude/skills/documentation.md +182 -0
- package/.claude/skills/dotnet.md +409 -0
- package/.claude/skills/drizzle.md +293 -0
- package/.claude/skills/echo.md +321 -0
- package/.claude/skills/eloquent.md +256 -0
- package/.claude/skills/emotion.md +426 -0
- package/.claude/skills/entity-framework.md +370 -0
- package/.claude/skills/express.md +316 -0
- package/.claude/skills/fastapi.md +329 -0
- package/.claude/skills/fastify.md +299 -0
- package/.claude/skills/fiber.md +315 -0
- package/.claude/skills/flask.md +322 -0
- package/.claude/skills/gin.md +342 -0
- package/.claude/skills/git.md +116 -0
- package/.claude/skills/github-actions.md +353 -0
- package/.claude/skills/go.md +377 -0
- package/.claude/skills/gorm.md +409 -0
- package/.claude/skills/graphql.md +478 -0
- package/.claude/skills/hibernate.md +379 -0
- package/.claude/skills/hono.md +306 -0
- package/.claude/skills/java.md +400 -0
- package/.claude/skills/jest.md +313 -0
- package/.claude/skills/jpa.md +282 -0
- package/.claude/skills/kotlin.md +347 -0
- package/.claude/skills/kubernetes.md +363 -0
- package/.claude/skills/laravel.md +414 -0
- package/.claude/skills/mcp-browser.md +320 -0
- package/.claude/skills/mcp-database.md +219 -0
- package/.claude/skills/mcp-fetch.md +241 -0
- package/.claude/skills/mcp-filesystem.md +204 -0
- package/.claude/skills/mcp-github.md +217 -0
- package/.claude/skills/mcp-memory.md +240 -0
- package/.claude/skills/mcp-search.md +218 -0
- package/.claude/skills/mcp-slack.md +262 -0
- package/.claude/skills/micronaut.md +388 -0
- package/.claude/skills/mongodb.md +319 -0
- package/.claude/skills/mongoose.md +355 -0
- package/.claude/skills/mysql.md +281 -0
- package/.claude/skills/nestjs.md +335 -0
- package/.claude/skills/nextjs-app-router.md +260 -0
- package/.claude/skills/nextjs-pages.md +172 -0
- package/.claude/skills/nuxt.md +202 -0
- package/.claude/skills/openapi.md +489 -0
- package/.claude/skills/performance.md +199 -0
- package/.claude/skills/php.md +398 -0
- package/.claude/skills/playwright.md +371 -0
- package/.claude/skills/postgresql.md +257 -0
- package/.claude/skills/prisma.md +293 -0
- package/.claude/skills/pydantic.md +304 -0
- package/.claude/skills/pytest.md +313 -0
- package/.claude/skills/python.md +272 -0
- package/.claude/skills/quarkus.md +377 -0
- package/.claude/skills/react.md +230 -0
- package/.claude/skills/redis.md +391 -0
- package/.claude/skills/refactoring.md +143 -0
- package/.claude/skills/remix.md +246 -0
- package/.claude/skills/rest-api.md +490 -0
- package/.claude/skills/rocket.md +366 -0
- package/.claude/skills/rust.md +341 -0
- package/.claude/skills/sass.md +380 -0
- package/.claude/skills/sea-orm.md +382 -0
- package/.claude/skills/security.md +167 -0
- package/.claude/skills/sequelize.md +395 -0
- package/.claude/skills/spring-boot.md +416 -0
- package/.claude/skills/sqlalchemy.md +269 -0
- package/.claude/skills/sqlx-rust.md +408 -0
- package/.claude/skills/state-jotai.md +346 -0
- package/.claude/skills/state-mobx.md +353 -0
- package/.claude/skills/state-pinia.md +431 -0
- package/.claude/skills/state-redux.md +337 -0
- package/.claude/skills/state-tanstack-query.md +434 -0
- package/.claude/skills/state-zustand.md +340 -0
- package/.claude/skills/styled-components.md +403 -0
- package/.claude/skills/svelte.md +238 -0
- package/.claude/skills/sveltekit.md +207 -0
- package/.claude/skills/symfony.md +437 -0
- package/.claude/skills/tailwind.md +279 -0
- package/.claude/skills/terraform.md +394 -0
- package/.claude/skills/testing-library.md +371 -0
- package/.claude/skills/trpc.md +426 -0
- package/.claude/skills/typeorm.md +368 -0
- package/.claude/skills/vitest.md +330 -0
- package/.claude/skills/vue.md +202 -0
- package/.claude/skills/warp.md +365 -0
- package/README.md +135 -52
- package/package.json +1 -1
- 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)
|
|
@@ -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
|
package/.claude/commands/fix.md
CHANGED
|
@@ -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
|
package/.claude/commands/plan.md
CHANGED
|
@@ -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
|
|
@@ -0,0 +1,129 @@
|
|
|
1
|
+
#!/bin/bash
|
|
2
|
+
# AutoWorkflow Pre-Edit Hook
|
|
3
|
+
# Runs on: PreToolUse for Write/Edit tools
|
|
4
|
+
# Purpose: Enforce plan approval before implementation
|
|
5
|
+
#
|
|
6
|
+
# This hook implements the plan_approval_gate enforcement
|
|
7
|
+
# It BLOCKS Write/Edit operations if plan hasn't been approved
|
|
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
|
+
PLAN_APPROVED_FILE="$STATE_DIR/plan-approved"
|
|
25
|
+
|
|
26
|
+
# Get current phase
|
|
27
|
+
get_phase() {
|
|
28
|
+
if [ -f "$PHASE_FILE" ]; then
|
|
29
|
+
cat "$PHASE_FILE"
|
|
30
|
+
else
|
|
31
|
+
echo "IDLE"
|
|
32
|
+
fi
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
# Get task type
|
|
36
|
+
get_task_type() {
|
|
37
|
+
if [ -f "$TASK_TYPE_FILE" ]; then
|
|
38
|
+
cat "$TASK_TYPE_FILE"
|
|
39
|
+
else
|
|
40
|
+
echo "unknown"
|
|
41
|
+
fi
|
|
42
|
+
}
|
|
43
|
+
|
|
44
|
+
# Check if plan is approved
|
|
45
|
+
is_plan_approved() {
|
|
46
|
+
if [ -f "$PLAN_APPROVED_FILE" ]; then
|
|
47
|
+
local status=$(cat "$PLAN_APPROVED_FILE")
|
|
48
|
+
[ "$status" = "true" ] && return 0
|
|
49
|
+
fi
|
|
50
|
+
return 1
|
|
51
|
+
}
|
|
52
|
+
|
|
53
|
+
# Check if task type requires approval
|
|
54
|
+
requires_approval() {
|
|
55
|
+
local task_type="$1"
|
|
56
|
+
case "$task_type" in
|
|
57
|
+
# These task types require plan approval
|
|
58
|
+
feature|fix|refactor|perf|security|test)
|
|
59
|
+
return 0
|
|
60
|
+
;;
|
|
61
|
+
# These can proceed without explicit approval
|
|
62
|
+
docs|style|config|query)
|
|
63
|
+
return 1
|
|
64
|
+
;;
|
|
65
|
+
# Unknown defaults to requiring approval
|
|
66
|
+
*)
|
|
67
|
+
return 0
|
|
68
|
+
;;
|
|
69
|
+
esac
|
|
70
|
+
}
|
|
71
|
+
|
|
72
|
+
# Main check
|
|
73
|
+
main() {
|
|
74
|
+
local phase=$(get_phase)
|
|
75
|
+
local task_type=$(get_task_type)
|
|
76
|
+
|
|
77
|
+
# Skip check if no task is active
|
|
78
|
+
if [ "$phase" = "IDLE" ]; then
|
|
79
|
+
exit 0
|
|
80
|
+
fi
|
|
81
|
+
|
|
82
|
+
# Skip check for task types that don't require approval
|
|
83
|
+
if ! requires_approval "$task_type"; then
|
|
84
|
+
exit 0
|
|
85
|
+
fi
|
|
86
|
+
|
|
87
|
+
# Skip check if already in IMPLEMENT or later phases
|
|
88
|
+
case "$phase" in
|
|
89
|
+
IMPLEMENT|VERIFY|FIX|AUDIT|PRE_COMMIT|COMMIT|UPDATE)
|
|
90
|
+
# Already past approval, allow edits
|
|
91
|
+
exit 0
|
|
92
|
+
;;
|
|
93
|
+
esac
|
|
94
|
+
|
|
95
|
+
# Check if we're in a pre-approval phase
|
|
96
|
+
if [ "$phase" = "ANALYZE" ] || [ "$phase" = "PLAN" ]; then
|
|
97
|
+
if ! is_plan_approved; then
|
|
98
|
+
echo ""
|
|
99
|
+
echo "━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━"
|
|
100
|
+
echo -e "${RED}${BOLD}⛔ AUTOWORKFLOW: PLAN APPROVAL REQUIRED${NC}"
|
|
101
|
+
echo "━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━"
|
|
102
|
+
echo ""
|
|
103
|
+
echo -e "${CYAN}Current Phase:${NC} $phase"
|
|
104
|
+
echo -e "${CYAN}Task Type:${NC} $task_type"
|
|
105
|
+
echo -e "${CYAN}Plan Approved:${NC} NO"
|
|
106
|
+
echo ""
|
|
107
|
+
echo "Cannot edit files before plan approval."
|
|
108
|
+
echo ""
|
|
109
|
+
echo -e "${BOLD}Required workflow:${NC}"
|
|
110
|
+
echo " 1. Complete ANALYZE phase (read relevant files)"
|
|
111
|
+
echo " 2. Present PLAN with suggestions"
|
|
112
|
+
echo " 3. Wait for user approval"
|
|
113
|
+
echo " 4. THEN implement"
|
|
114
|
+
echo ""
|
|
115
|
+
echo -e "${DIM}To approve, user must say: yes, proceed, approved, go ahead${NC}"
|
|
116
|
+
echo ""
|
|
117
|
+
echo "━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━"
|
|
118
|
+
echo ""
|
|
119
|
+
|
|
120
|
+
# Exit with error to BLOCK the edit
|
|
121
|
+
exit 1
|
|
122
|
+
fi
|
|
123
|
+
fi
|
|
124
|
+
|
|
125
|
+
# All checks passed, allow edit
|
|
126
|
+
exit 0
|
|
127
|
+
}
|
|
128
|
+
|
|
129
|
+
main
|
|
@@ -28,6 +28,78 @@ PHASE_FILE="$STATE_DIR/phase"
|
|
|
28
28
|
TASK_TYPE_FILE="$STATE_DIR/task-type"
|
|
29
29
|
BLUEPRINT_CHECK_FILE="$STATE_DIR/blueprint-checked"
|
|
30
30
|
TASK_DESCRIPTION_FILE="$STATE_DIR/task-description"
|
|
31
|
+
PLAN_APPROVED_FILE="$STATE_DIR/plan-approved"
|
|
32
|
+
CHANGED_FILES_FILE="$STATE_DIR/changed-files"
|
|
33
|
+
SESSION_RESUMED_FILE="$STATE_DIR/session-resumed"
|
|
34
|
+
|
|
35
|
+
# Check for resumable session state
|
|
36
|
+
check_session_resume() {
|
|
37
|
+
# Only show resume prompt once per session
|
|
38
|
+
if [ -f "$SESSION_RESUMED_FILE" ]; then
|
|
39
|
+
return 1
|
|
40
|
+
fi
|
|
41
|
+
|
|
42
|
+
# Check if there's a previous session with active state
|
|
43
|
+
if [ -f "$PHASE_FILE" ]; then
|
|
44
|
+
local phase=$(cat "$PHASE_FILE")
|
|
45
|
+
|
|
46
|
+
# Only prompt for non-idle, non-complete states
|
|
47
|
+
if [ "$phase" != "IDLE" ] && [ "$phase" != "" ] && [ "$phase" != "COMMIT" ]; then
|
|
48
|
+
local task_type=""
|
|
49
|
+
local verify_iter="0"
|
|
50
|
+
local plan_approved="false"
|
|
51
|
+
local changed_count="0"
|
|
52
|
+
|
|
53
|
+
[ -f "$TASK_TYPE_FILE" ] && task_type=$(cat "$TASK_TYPE_FILE")
|
|
54
|
+
[ -f "$STATE_DIR/verify-iteration" ] && verify_iter=$(cat "$STATE_DIR/verify-iteration")
|
|
55
|
+
[ -f "$PLAN_APPROVED_FILE" ] && plan_approved=$(cat "$PLAN_APPROVED_FILE")
|
|
56
|
+
[ -f "$CHANGED_FILES_FILE" ] && changed_count=$(wc -l < "$CHANGED_FILES_FILE" 2>/dev/null | tr -d ' ')
|
|
57
|
+
|
|
58
|
+
echo ""
|
|
59
|
+
echo "━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━"
|
|
60
|
+
echo -e "${CYAN}${BOLD}📍 AUTOWORKFLOW: SESSION RESUME${NC}"
|
|
61
|
+
echo "━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━"
|
|
62
|
+
echo ""
|
|
63
|
+
echo -e "${BOLD}Previous session state detected:${NC}"
|
|
64
|
+
echo ""
|
|
65
|
+
echo -e " ${CYAN}Phase:${NC} $phase"
|
|
66
|
+
[ -n "$task_type" ] && echo -e " ${CYAN}Task type:${NC} $task_type"
|
|
67
|
+
echo -e " ${CYAN}Plan approved:${NC} $plan_approved"
|
|
68
|
+
echo -e " ${CYAN}Verify attempts:${NC} $verify_iter/10"
|
|
69
|
+
[ "$changed_count" -gt 0 ] 2>/dev/null && echo -e " ${CYAN}Changed files:${NC} $changed_count"
|
|
70
|
+
echo ""
|
|
71
|
+
|
|
72
|
+
# Show changed files if any
|
|
73
|
+
if [ -f "$CHANGED_FILES_FILE" ] && [ "$changed_count" -gt 0 ] 2>/dev/null; then
|
|
74
|
+
echo -e "${DIM}Pending changes:${NC}"
|
|
75
|
+
head -5 "$CHANGED_FILES_FILE" | while read file; do
|
|
76
|
+
echo -e " ${DIM}- $file${NC}"
|
|
77
|
+
done
|
|
78
|
+
[ "$changed_count" -gt 5 ] 2>/dev/null && echo -e " ${DIM}... and $((changed_count - 5)) more${NC}"
|
|
79
|
+
echo ""
|
|
80
|
+
fi
|
|
81
|
+
|
|
82
|
+
# Show workflow position
|
|
83
|
+
local workflow=$(get_workflow "$task_type")
|
|
84
|
+
echo -e "${DIM}Workflow: $workflow${NC}"
|
|
85
|
+
echo -e "${DIM} ↑ Current: $phase${NC}"
|
|
86
|
+
echo ""
|
|
87
|
+
|
|
88
|
+
echo "Continue from $phase phase, or start fresh?"
|
|
89
|
+
echo ""
|
|
90
|
+
echo -e "${DIM}(Say 'continue' to resume, or describe new task to start fresh)${NC}"
|
|
91
|
+
echo ""
|
|
92
|
+
echo "━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━"
|
|
93
|
+
echo ""
|
|
94
|
+
|
|
95
|
+
# Mark that we've shown the resume prompt
|
|
96
|
+
touch "$SESSION_RESUMED_FILE"
|
|
97
|
+
return 0
|
|
98
|
+
fi
|
|
99
|
+
fi
|
|
100
|
+
|
|
101
|
+
return 1
|
|
102
|
+
}
|
|
31
103
|
|
|
32
104
|
# Generate session ID if new session
|
|
33
105
|
init_session() {
|
|
@@ -39,6 +111,8 @@ init_session() {
|
|
|
39
111
|
rm -f "$STATE_DIR/changed-files" 2>/dev/null
|
|
40
112
|
rm -f "$BLUEPRINT_CHECK_FILE" 2>/dev/null
|
|
41
113
|
rm -f "$TASK_TYPE_FILE" 2>/dev/null
|
|
114
|
+
rm -f "$PLAN_APPROVED_FILE" 2>/dev/null
|
|
115
|
+
rm -f "$SESSION_RESUMED_FILE" 2>/dev/null
|
|
42
116
|
return 0 # New session
|
|
43
117
|
fi
|
|
44
118
|
return 1 # Existing session
|
|
@@ -335,6 +409,11 @@ main() {
|
|
|
335
409
|
exit 0
|
|
336
410
|
fi
|
|
337
411
|
|
|
412
|
+
# Check for session resume (only on existing sessions)
|
|
413
|
+
if [ "$is_new_session" = false ]; then
|
|
414
|
+
check_session_resume
|
|
415
|
+
fi
|
|
416
|
+
|
|
338
417
|
# Check for missing blueprint (triggers auto-audit)
|
|
339
418
|
check_blueprint
|
|
340
419
|
|