@nebulit/embuilder 0.1.39
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 +254 -0
- package/dist/cli.d.ts +2 -0
- package/dist/cli.js +138 -0
- package/package.json +49 -0
- package/templates/.claude/hooks/QUICKSTART.md +256 -0
- package/templates/.claude/hooks/README.md +533 -0
- package/templates/.claude/hooks/analyze-commit.sh +22 -0
- package/templates/.claude/hooks/analyze-commit.ts +518 -0
- package/templates/.claude/hooks/analyzers/README.md +198 -0
- package/templates/.claude/hooks/analyzers/code-quality-checker.ts +154 -0
- package/templates/.claude/hooks/analyzers/code-quality.md +54 -0
- package/templates/.claude/hooks/analyzers/commit-blocker-example.ts.disabled +110 -0
- package/templates/.claude/hooks/analyzers/commit-policy.md +49 -0
- package/templates/.claude/hooks/analyzers/event-model-validator.md +49 -0
- package/templates/.claude/hooks/analyzers/event-model-validator.ts +169 -0
- package/templates/.claude/hooks/analyzers/example-logger.ts +70 -0
- package/templates/.claude/hooks/analyzers/slice-scope-validator.md +81 -0
- package/templates/.claude/hooks/check-review-result.sh +47 -0
- package/templates/.claude/hooks/prepare-review.sh +34 -0
- package/templates/.claude/hooks/review-agent-prompt.md +42 -0
- package/templates/.claude/hooks/run-review-agent.sh +124 -0
- package/templates/.claude/settings.local.json +37 -0
- package/templates/.claude/skills/help/README.md +84 -0
- package/templates/.claude/skills/help/SKILL.md +393 -0
- package/templates/.claude/skills/help/templates/demo-config.json +6753 -0
- package/templates/.claude/skills/sample-slices/SKILL.md +8 -0
- package/templates/.claude/skills/sample-slices/templates/.slices/Library/addbook/code-slice.json +124 -0
- package/templates/.claude/skills/sample-slices/templates/.slices/Library/addbook/slice.json +255 -0
- package/templates/.claude/skills/sample-slices/templates/.slices/Library/availablebooks/slice.json +107 -0
- package/templates/.claude/skills/sample-slices/templates/.slices/index.json +20 -0
- package/templates/.claude/skills/sample-slices/templates/Cart/additem/slice.json +979 -0
- package/templates/.claude/skills/sample-slices/templates/Cart/archiveitem/slice.json +529 -0
- package/templates/.claude/skills/sample-slices/templates/Cart/cartitems/slice.json +1072 -0
- package/templates/.claude/skills/sample-slices/templates/Cart/cartwithproducts/slice.json +394 -0
- package/templates/.claude/skills/sample-slices/templates/Cart/changedprices/slice.json +88 -0
- package/templates/.claude/skills/sample-slices/templates/Cart/changeinventory/slice.json +264 -0
- package/templates/.claude/skills/sample-slices/templates/Cart/changeprice/slice.json +308 -0
- package/templates/.claude/skills/sample-slices/templates/Cart/clearcart/slice.json +358 -0
- package/templates/.claude/skills/sample-slices/templates/Cart/inventories/slice.json +203 -0
- package/templates/.claude/skills/sample-slices/templates/Cart/publishcart/slice.json +876 -0
- package/templates/.claude/skills/sample-slices/templates/Cart/removeitem/slice.json +560 -0
- package/templates/.claude/skills/sample-slices/templates/Cart/submitcart/slice.json +708 -0
- package/templates/.claude/skills/sample-slices/templates/Cart/submittedcartdata/slice.json +399 -0
- package/templates/.claude/skills/sample-slices/templates/index.json +108 -0
- package/templates/.claude/skills/slice-automation/SKILL.md +49 -0
- package/templates/.claude/skills/slice-state-change/SKILL.md +369 -0
- package/templates/.claude/skills/slice-state-change/templates/AddLocation/AddLocation.test.ts.sample +76 -0
- package/templates/.claude/skills/slice-state-change/templates/AddLocation/AddLocationCommand.ts.sample +84 -0
- package/templates/.claude/skills/slice-state-change/templates/AddLocation/routes.ts.sample +73 -0
- package/templates/.claude/skills/slice-state-change/templates/README.md +46 -0
- package/templates/.claude/skills/slice-state-view/SKILL.md +336 -0
- package/templates/.claude/skills/slice-state-view/templates/Locations/Locations.test.ts.sample +84 -0
- package/templates/.claude/skills/slice-state-view/templates/Locations/LocationsProjection.ts.sample +50 -0
- package/templates/.claude/skills/slice-state-view/templates/Locations/routes.ts.sample +46 -0
- package/templates/.claude/skills/slice-state-view/templates/README.md +109 -0
- package/templates/.claude/skills/slice-state-view/templates/Tables/Tables.test.ts.sample +104 -0
- package/templates/.claude/skills/slice-state-view/templates/Tables/TablesProjection.ts.sample +59 -0
- package/templates/.claude/skills/slice-state-view/templates/Tables/routes.ts.sample +46 -0
- package/templates/.claude/skills/slice-state-view/templates/V2__tables.sql +7 -0
- package/templates/.claude/skills/slice-state-view/templates/V8__locations.sql +7 -0
- package/templates/.claude/skills/test-analyzer/SKILL.md +373 -0
- package/templates/.claude/skills/test-analyzer/examples/specification-format.md +143 -0
- package/templates/.claude/skills/test-analyzer/examples/state-change-example.md +111 -0
- package/templates/.claude/skills/test-analyzer/examples/state-view-example.md +122 -0
- package/templates/AGENTS.md +110 -0
- package/templates/Claude.md +58 -0
- package/templates/README.md +178 -0
- package/templates/backend/.env +9 -0
- package/templates/backend/BACKEND_AUTH_SETUP.md +183 -0
- package/templates/backend/SWAGGER.md +213 -0
- package/templates/backend/eslint.config.mjs +31 -0
- package/templates/backend/flyway.conf +17 -0
- package/templates/backend/package.json +44 -0
- package/templates/backend/prd.json.example +64 -0
- package/templates/backend/public/assets/images/banner.png +0 -0
- package/templates/backend/public/assets/logo.png +0 -0
- package/templates/backend/public/file.svg +4 -0
- package/templates/backend/public/globe.svg +12 -0
- package/templates/backend/public/next.svg +6 -0
- package/templates/backend/public/vercel.svg +3 -0
- package/templates/backend/public/window.svg +5 -0
- package/templates/backend/server.ts +129 -0
- package/templates/backend/setup-env.sh +50 -0
- package/templates/backend/src/common/assertions.ts +6 -0
- package/templates/backend/src/common/db.ts +1 -0
- package/templates/backend/src/common/loadPostgresEventstore.ts +16 -0
- package/templates/backend/src/common/parseEndpoint.ts +51 -0
- package/templates/backend/src/common/replay.ts +9 -0
- package/templates/backend/src/common/routes.ts +19 -0
- package/templates/backend/src/common/testHelpers.ts +53 -0
- package/templates/backend/src/core/readmodel.ts +28 -0
- package/templates/backend/src/core/types.ts +26 -0
- package/templates/backend/src/process/process.ts +53 -0
- package/templates/backend/src/supabase/LoginHandler.ts +36 -0
- package/templates/backend/src/supabase/ProtectedPageProps.ts +21 -0
- package/templates/backend/src/supabase/README.md +171 -0
- package/templates/backend/src/supabase/api.ts +63 -0
- package/templates/backend/src/supabase/authMiddleware.ts +53 -0
- package/templates/backend/src/supabase/component.ts +12 -0
- package/templates/backend/src/supabase/requireUser.ts +72 -0
- package/templates/backend/src/supabase/serverProps.ts +25 -0
- package/templates/backend/src/supabase/staticProps.ts +10 -0
- package/templates/backend/src/swagger.ts +34 -0
- package/templates/backend/src/util/assertions.ts +6 -0
- package/templates/backend/supabase/config.toml +295 -0
- package/templates/backend/supabase/migrations/20260121155918593_catalogentries.sql.sample +23 -0
- package/templates/backend/supabase/seed.sql +1 -0
- package/templates/backend/tsconfig.json +31 -0
- package/templates/frontend/.env.development +3 -0
- package/templates/frontend/AGENTS.md +7 -0
- package/templates/frontend/README.md +73 -0
- package/templates/frontend/components.json +20 -0
- package/templates/frontend/eslint.config.js +26 -0
- package/templates/frontend/index.html +18 -0
- package/templates/frontend/package-lock.json +8347 -0
- package/templates/frontend/package.json +94 -0
- package/templates/frontend/postcss.config.js +6 -0
- package/templates/frontend/public/favicon.ico +0 -0
- package/templates/frontend/public/logo.png +0 -0
- package/templates/frontend/public/placeholder.svg +1 -0
- package/templates/frontend/public/robots.txt +14 -0
- package/templates/frontend/src/App.css +42 -0
- package/templates/frontend/src/App.tsx +47 -0
- package/templates/frontend/src/components/NavLink.tsx +28 -0
- package/templates/frontend/src/components/ProtectedRoute.tsx +24 -0
- package/templates/frontend/src/components/calendar/Calendar.tsx +302 -0
- package/templates/frontend/src/components/layout/DashboardLayout.tsx +21 -0
- package/templates/frontend/src/components/layout/Header.tsx +45 -0
- package/templates/frontend/src/components/layout/Sidebar.tsx +82 -0
- package/templates/frontend/src/components/tables/ReservationTemplates.tsx +189 -0
- package/templates/frontend/src/components/ui/accordion.tsx +52 -0
- package/templates/frontend/src/components/ui/alert-dialog.tsx +104 -0
- package/templates/frontend/src/components/ui/alert.tsx +43 -0
- package/templates/frontend/src/components/ui/aspect-ratio.tsx +5 -0
- package/templates/frontend/src/components/ui/avatar.tsx +38 -0
- package/templates/frontend/src/components/ui/badge.tsx +29 -0
- package/templates/frontend/src/components/ui/breadcrumb.tsx +90 -0
- package/templates/frontend/src/components/ui/button.tsx +47 -0
- package/templates/frontend/src/components/ui/calendar.tsx +54 -0
- package/templates/frontend/src/components/ui/card.tsx +43 -0
- package/templates/frontend/src/components/ui/carousel.tsx +224 -0
- package/templates/frontend/src/components/ui/chart.tsx +303 -0
- package/templates/frontend/src/components/ui/checkbox.tsx +26 -0
- package/templates/frontend/src/components/ui/collapsible.tsx +9 -0
- package/templates/frontend/src/components/ui/command.tsx +132 -0
- package/templates/frontend/src/components/ui/context-menu.tsx +178 -0
- package/templates/frontend/src/components/ui/dialog.tsx +95 -0
- package/templates/frontend/src/components/ui/drawer.tsx +87 -0
- package/templates/frontend/src/components/ui/dropdown-menu.tsx +179 -0
- package/templates/frontend/src/components/ui/form.tsx +129 -0
- package/templates/frontend/src/components/ui/hover-card.tsx +27 -0
- package/templates/frontend/src/components/ui/input-otp.tsx +61 -0
- package/templates/frontend/src/components/ui/input.tsx +22 -0
- package/templates/frontend/src/components/ui/label.tsx +17 -0
- package/templates/frontend/src/components/ui/menubar.tsx +207 -0
- package/templates/frontend/src/components/ui/navigation-menu.tsx +120 -0
- package/templates/frontend/src/components/ui/pagination.tsx +81 -0
- package/templates/frontend/src/components/ui/popover.tsx +29 -0
- package/templates/frontend/src/components/ui/progress.tsx +23 -0
- package/templates/frontend/src/components/ui/radio-group.tsx +36 -0
- package/templates/frontend/src/components/ui/resizable.tsx +37 -0
- package/templates/frontend/src/components/ui/scroll-area.tsx +38 -0
- package/templates/frontend/src/components/ui/select.tsx +143 -0
- package/templates/frontend/src/components/ui/separator.tsx +20 -0
- package/templates/frontend/src/components/ui/sheet.tsx +107 -0
- package/templates/frontend/src/components/ui/sidebar.tsx +637 -0
- package/templates/frontend/src/components/ui/skeleton.tsx +7 -0
- package/templates/frontend/src/components/ui/slider.tsx +23 -0
- package/templates/frontend/src/components/ui/sonner.tsx +27 -0
- package/templates/frontend/src/components/ui/stat-card.tsx +44 -0
- package/templates/frontend/src/components/ui/switch.tsx +27 -0
- package/templates/frontend/src/components/ui/table.tsx +72 -0
- package/templates/frontend/src/components/ui/tabs.tsx +53 -0
- package/templates/frontend/src/components/ui/textarea.tsx +21 -0
- package/templates/frontend/src/components/ui/toast.tsx +111 -0
- package/templates/frontend/src/components/ui/toaster.tsx +24 -0
- package/templates/frontend/src/components/ui/toggle-group.tsx +49 -0
- package/templates/frontend/src/components/ui/toggle.tsx +37 -0
- package/templates/frontend/src/components/ui/tooltip.tsx +28 -0
- package/templates/frontend/src/components/ui/use-toast.ts +3 -0
- package/templates/frontend/src/contexts/AuthContext.tsx +94 -0
- package/templates/frontend/src/contexts/RefreshContext.tsx +236 -0
- package/templates/frontend/src/hooks/api/index.ts +2 -0
- package/templates/frontend/src/hooks/api/useLocations.ts +15 -0
- package/templates/frontend/src/hooks/use-mobile.tsx +19 -0
- package/templates/frontend/src/hooks/use-toast.ts +186 -0
- package/templates/frontend/src/hooks/useApiContext.ts +11 -0
- package/templates/frontend/src/index.css +118 -0
- package/templates/frontend/src/integrations/supabase/client.ts +9 -0
- package/templates/frontend/src/lib/api-client.ts +136 -0
- package/templates/frontend/src/lib/api.ts +1028 -0
- package/templates/frontend/src/lib/utils.ts +6 -0
- package/templates/frontend/src/main.tsx +5 -0
- package/templates/frontend/src/pages/Auth.tsx +408 -0
- package/templates/frontend/src/pages/Dashboard.tsx +168 -0
- package/templates/frontend/src/pages/Menus.tsx +224 -0
- package/templates/frontend/src/pages/NotFound.tsx +24 -0
- package/templates/frontend/src/pages/Register.tsx +285 -0
- package/templates/frontend/src/test/example.test.ts +0 -0
- package/templates/frontend/src/test/setup.ts +15 -0
- package/templates/frontend/src/types/index.ts +8 -0
- package/templates/frontend/src/vite-env.d.ts +1 -0
- package/templates/frontend/tailwind.config.ts +101 -0
- package/templates/frontend/tsconfig.app.json +31 -0
- package/templates/frontend/tsconfig.json +16 -0
- package/templates/frontend/tsconfig.node.json +22 -0
- package/templates/frontend/vite.config.ts +21 -0
- package/templates/frontend/vitest.config.ts +16 -0
- package/templates/init.sh +1 -0
- package/templates/prompt.md +139 -0
- package/templates/ralph.sh +120 -0
- package/templates/server.mjs +505 -0
|
@@ -0,0 +1,81 @@
|
|
|
1
|
+
# Slice Scope Validator
|
|
2
|
+
|
|
3
|
+
## Configuration
|
|
4
|
+
|
|
5
|
+
```yaml
|
|
6
|
+
name: slice-scope-validator
|
|
7
|
+
blocking: false
|
|
8
|
+
priority: 3
|
|
9
|
+
```
|
|
10
|
+
|
|
11
|
+
## Prompt
|
|
12
|
+
|
|
13
|
+
You are reviewing commit changes in the context of a specific slice implementation.
|
|
14
|
+
|
|
15
|
+
If a **Current Slice** is specified (status: "in_progress"), validate that:
|
|
16
|
+
|
|
17
|
+
1. **File Scope** - Changes should primarily be in the slice's folder or related to the slice
|
|
18
|
+
2. **Cross-Slice Changes** - If files outside the slice folder are modified, they should be justified
|
|
19
|
+
3. **Focus** - The commit should be focused on the current slice, not mixing multiple unrelated changes
|
|
20
|
+
|
|
21
|
+
## Review Criteria
|
|
22
|
+
|
|
23
|
+
**If NO current slice** (not working on a specific slice):
|
|
24
|
+
- Skip this analyzer, return approved with "No active slice"
|
|
25
|
+
|
|
26
|
+
**If current slice exists:**
|
|
27
|
+
|
|
28
|
+
**WARN (approved: true) if:**
|
|
29
|
+
- Most changes are in the correct slice folder
|
|
30
|
+
- Some related files outside the folder are modified (utilities, types, tests)
|
|
31
|
+
- Changes are cohesive and related to the slice objective
|
|
32
|
+
|
|
33
|
+
**WARN MORE (approved: true) if:**
|
|
34
|
+
- Significant changes outside the slice folder
|
|
35
|
+
- Mixing slice work with unrelated changes
|
|
36
|
+
- Suggest splitting the commit or focusing on the slice
|
|
37
|
+
|
|
38
|
+
## Context Analysis
|
|
39
|
+
|
|
40
|
+
When a slice is active, consider:
|
|
41
|
+
- The slice title (e.g., "slice: remove item") describes the feature being implemented
|
|
42
|
+
- The context (e.g., "Cart") indicates the domain area
|
|
43
|
+
- The folder (e.g., "removeitem") is where most changes should occur
|
|
44
|
+
|
|
45
|
+
Example slice structure:
|
|
46
|
+
```
|
|
47
|
+
src/slices/removeitem/ ← Most changes should be here
|
|
48
|
+
├── Command.ts
|
|
49
|
+
├── Projection.ts
|
|
50
|
+
├── routes.ts
|
|
51
|
+
└── RemoveItem.test.ts
|
|
52
|
+
```
|
|
53
|
+
|
|
54
|
+
Acceptable related changes:
|
|
55
|
+
- Shared types in `src/types/`
|
|
56
|
+
- Utility functions in `src/utils/`
|
|
57
|
+
- Related test fixtures
|
|
58
|
+
- Configuration updates
|
|
59
|
+
|
|
60
|
+
## Response Format
|
|
61
|
+
|
|
62
|
+
```json
|
|
63
|
+
{
|
|
64
|
+
"approved": true,
|
|
65
|
+
"reason": "Changes are appropriately scoped to the slice",
|
|
66
|
+
"details": [
|
|
67
|
+
"✓ 8/10 files in removeitem folder",
|
|
68
|
+
"⚠️ 2 files outside slice folder - verify these are necessary"
|
|
69
|
+
]
|
|
70
|
+
}
|
|
71
|
+
```
|
|
72
|
+
|
|
73
|
+
## Input Data
|
|
74
|
+
|
|
75
|
+
You will receive:
|
|
76
|
+
- `current_slice.slice`: The slice title (e.g., "slice: remove item")
|
|
77
|
+
- `current_slice.folder`: Expected folder name (e.g., "removeitem")
|
|
78
|
+
- `current_slice.context`: Domain context (e.g., "Cart")
|
|
79
|
+
- `changed_files`: List of all files being committed
|
|
80
|
+
|
|
81
|
+
Use this information to validate commit scope.
|
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
#!/bin/bash
|
|
2
|
+
|
|
3
|
+
# Check Review Result - Step 3 of 3 in commit review process
|
|
4
|
+
# Reads the review result and approves/rejects the commit
|
|
5
|
+
|
|
6
|
+
# Find the temp directory from the last prepare-review run
|
|
7
|
+
# We need to look for recent temp directories
|
|
8
|
+
LATEST_TEMP=$(find /tmp -maxdepth 1 -name "tmp.*" -type d -newer /tmp -print 2>/dev/null | head -1)
|
|
9
|
+
|
|
10
|
+
if [ -z "$LATEST_TEMP" ]; then
|
|
11
|
+
# Fallback: look for any recent commit-review temp dir
|
|
12
|
+
LATEST_TEMP=$(find /tmp -maxdepth 1 -name "commit-review-*" -type d 2>/dev/null | sort -r | head -1)
|
|
13
|
+
fi
|
|
14
|
+
|
|
15
|
+
if [ -z "$LATEST_TEMP" ] || [ ! -f "$LATEST_TEMP/result-path.txt" ]; then
|
|
16
|
+
echo "⚠️ Could not find review result files (fail-safe: allowing commit)"
|
|
17
|
+
exit 0
|
|
18
|
+
fi
|
|
19
|
+
|
|
20
|
+
REVIEW_RESULT_FILE=$(cat "$LATEST_TEMP/result-path.txt")
|
|
21
|
+
REVIEW_TEMP_DIR=$(cat "$LATEST_TEMP/temp-dir.txt" 2>/dev/null || echo "$LATEST_TEMP")
|
|
22
|
+
|
|
23
|
+
# Check if review result exists
|
|
24
|
+
if [ ! -f "$REVIEW_RESULT_FILE" ]; then
|
|
25
|
+
echo "⚠️ Review agent did not create result file (fail-safe: allowing commit)"
|
|
26
|
+
rm -rf "$REVIEW_TEMP_DIR"
|
|
27
|
+
exit 0
|
|
28
|
+
fi
|
|
29
|
+
|
|
30
|
+
# Parse the result using the TypeScript script
|
|
31
|
+
SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
|
|
32
|
+
|
|
33
|
+
if command -v tsx &> /dev/null; then
|
|
34
|
+
tsx "$SCRIPT_DIR/analyze-commit.ts" check "$REVIEW_RESULT_FILE"
|
|
35
|
+
EXIT_CODE=$?
|
|
36
|
+
elif command -v ts-node &> /dev/null; then
|
|
37
|
+
ts-node "$SCRIPT_DIR/analyze-commit.ts" check "$REVIEW_RESULT_FILE"
|
|
38
|
+
EXIT_CODE=$?
|
|
39
|
+
else
|
|
40
|
+
echo "⚠️ Cannot check result (fail-safe: allowing commit)"
|
|
41
|
+
EXIT_CODE=0
|
|
42
|
+
fi
|
|
43
|
+
|
|
44
|
+
# Cleanup
|
|
45
|
+
rm -rf "$REVIEW_TEMP_DIR"
|
|
46
|
+
|
|
47
|
+
exit $EXIT_CODE
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
#!/bin/bash
|
|
2
|
+
|
|
3
|
+
# Prepare Review - Step 1 of 3 in commit review process
|
|
4
|
+
# Generates the review prompt and sets up file paths for the review agent
|
|
5
|
+
|
|
6
|
+
SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
|
|
7
|
+
|
|
8
|
+
# Create temp directory for review files
|
|
9
|
+
TEMP_DIR=$(mktemp -d)
|
|
10
|
+
export REVIEW_PROMPT_FILE="$TEMP_DIR/review-prompt.md"
|
|
11
|
+
export REVIEW_RESULT_FILE="$TEMP_DIR/review-result.json"
|
|
12
|
+
export REVIEW_TEMP_DIR="$TEMP_DIR"
|
|
13
|
+
|
|
14
|
+
# Store these in a file so check-review-result.sh can access them
|
|
15
|
+
echo "$REVIEW_PROMPT_FILE" > "$TEMP_DIR/prompt-path.txt"
|
|
16
|
+
echo "$REVIEW_RESULT_FILE" > "$TEMP_DIR/result-path.txt"
|
|
17
|
+
echo "$REVIEW_TEMP_DIR" > "$TEMP_DIR/temp-dir.txt"
|
|
18
|
+
|
|
19
|
+
# Run the TypeScript orchestrator to generate the review prompt
|
|
20
|
+
if command -v tsx &> /dev/null; then
|
|
21
|
+
tsx "$SCRIPT_DIR/analyze-commit.ts" prepare "$REVIEW_PROMPT_FILE" "$REVIEW_RESULT_FILE"
|
|
22
|
+
elif command -v ts-node &> /dev/null; then
|
|
23
|
+
ts-node "$SCRIPT_DIR/analyze-commit.ts" prepare "$REVIEW_PROMPT_FILE" "$REVIEW_RESULT_FILE"
|
|
24
|
+
else
|
|
25
|
+
echo "❌ Error: tsx or ts-node not found"
|
|
26
|
+
echo " Install with: npm install -g tsx"
|
|
27
|
+
exit 0 # Fail-safe: allow commit
|
|
28
|
+
fi
|
|
29
|
+
|
|
30
|
+
# Export for the prompt hook to use
|
|
31
|
+
echo "export REVIEW_PROMPT_FILE='$REVIEW_PROMPT_FILE'" >> "$TEMP_DIR/env.sh"
|
|
32
|
+
echo "export REVIEW_RESULT_FILE='$REVIEW_RESULT_FILE'" >> "$TEMP_DIR/env.sh"
|
|
33
|
+
|
|
34
|
+
exit 0
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
# Commit Review Agent
|
|
2
|
+
|
|
3
|
+
You are a dedicated code review agent analyzing git commits.
|
|
4
|
+
|
|
5
|
+
## Your Task
|
|
6
|
+
|
|
7
|
+
1. Read the review prompt from the file path provided
|
|
8
|
+
2. Analyze the commit according to ALL analyzers specified in the prompt
|
|
9
|
+
3. Go through each analyzer in priority order
|
|
10
|
+
4. Return a JSON decision
|
|
11
|
+
|
|
12
|
+
## Response Format
|
|
13
|
+
|
|
14
|
+
You MUST return ONLY valid JSON in exactly this format:
|
|
15
|
+
|
|
16
|
+
```json
|
|
17
|
+
{
|
|
18
|
+
"approved": boolean,
|
|
19
|
+
"reason": "Brief summary of the decision",
|
|
20
|
+
"analyzer_results": [
|
|
21
|
+
{
|
|
22
|
+
"analyzer": "analyzer-name",
|
|
23
|
+
"approved": boolean,
|
|
24
|
+
"details": ["finding 1", "finding 2"]
|
|
25
|
+
}
|
|
26
|
+
]
|
|
27
|
+
}
|
|
28
|
+
```
|
|
29
|
+
|
|
30
|
+
## Important Rules
|
|
31
|
+
|
|
32
|
+
- Work through analyzers in the order given (by priority)
|
|
33
|
+
- If ANY analyzer with `blocking: true` rejects, set `approved: false`
|
|
34
|
+
- If analyzer has `blocking: false`, it can only warn (still `approved: true`)
|
|
35
|
+
- Be thorough but concise
|
|
36
|
+
- Focus on the specific criteria each analyzer defines
|
|
37
|
+
- Consider the slice context if provided
|
|
38
|
+
|
|
39
|
+
## Output
|
|
40
|
+
|
|
41
|
+
Write your JSON response to the result file path provided.
|
|
42
|
+
Also output the JSON to stdout for immediate feedback.
|
|
@@ -0,0 +1,124 @@
|
|
|
1
|
+
#!/bin/bash
|
|
2
|
+
|
|
3
|
+
# Review Agent Runner
|
|
4
|
+
# Spawns a Claude Code agent to perform the code review
|
|
5
|
+
|
|
6
|
+
PROMPT_FILE="$1"
|
|
7
|
+
RESULT_FILE="$2"
|
|
8
|
+
|
|
9
|
+
if [ -z "$PROMPT_FILE" ] || [ -z "$RESULT_FILE" ]; then
|
|
10
|
+
echo "Usage: $0 <prompt-file> <result-file>"
|
|
11
|
+
exit 1
|
|
12
|
+
fi
|
|
13
|
+
|
|
14
|
+
# Read the review prompt
|
|
15
|
+
PROMPT=$(cat "$PROMPT_FILE")
|
|
16
|
+
|
|
17
|
+
# Create the agent task prompt with explicit instructions
|
|
18
|
+
AGENT_TASK=$(cat << EOF
|
|
19
|
+
$PROMPT
|
|
20
|
+
|
|
21
|
+
---
|
|
22
|
+
|
|
23
|
+
# Your Task
|
|
24
|
+
|
|
25
|
+
You are now acting as a code review agent.
|
|
26
|
+
|
|
27
|
+
1. Analyze this commit according to ALL the analyzers listed above
|
|
28
|
+
2. Work through each analyzer in priority order
|
|
29
|
+
3. Apply the criteria specified in each analyzer
|
|
30
|
+
|
|
31
|
+
After your analysis, you MUST use the Write tool to create this file:
|
|
32
|
+
|
|
33
|
+
**File path:** $RESULT_FILE
|
|
34
|
+
|
|
35
|
+
**File content:** Valid JSON in this EXACT format:
|
|
36
|
+
|
|
37
|
+
\`\`\`json
|
|
38
|
+
{
|
|
39
|
+
"approved": boolean,
|
|
40
|
+
"reason": "Brief summary of your overall decision",
|
|
41
|
+
"analyzer_results": [
|
|
42
|
+
{
|
|
43
|
+
"analyzer": "analyzer-name",
|
|
44
|
+
"approved": boolean,
|
|
45
|
+
"details": ["specific finding 1", "specific finding 2"]
|
|
46
|
+
}
|
|
47
|
+
]
|
|
48
|
+
}
|
|
49
|
+
\`\`\`
|
|
50
|
+
|
|
51
|
+
Critical Rules:
|
|
52
|
+
- If ANY analyzer with "blocking: true" fails → set approved: false
|
|
53
|
+
- If analyzer has "blocking: false" → can only warn (approved: true)
|
|
54
|
+
- Include ALL analyzers in analyzer_results array
|
|
55
|
+
- Be specific in details (file names, line numbers)
|
|
56
|
+
- Keep reason concise (1-2 sentences max)
|
|
57
|
+
|
|
58
|
+
**IMPORTANT:** Use the Write tool NOW to create $RESULT_FILE before you respond with anything else.
|
|
59
|
+
EOF
|
|
60
|
+
)
|
|
61
|
+
|
|
62
|
+
# Write the agent task to a temp file
|
|
63
|
+
AGENT_TASK_FILE=$(mktemp)
|
|
64
|
+
echo "$AGENT_TASK" > "$AGENT_TASK_FILE"
|
|
65
|
+
|
|
66
|
+
# Invoke Claude Code agent using the prompt hook approach
|
|
67
|
+
# The hook will be triggered and Claude will see this as a user message
|
|
68
|
+
echo ""
|
|
69
|
+
echo "📨 Sending task to Claude Code review agent..."
|
|
70
|
+
echo ""
|
|
71
|
+
|
|
72
|
+
# Output the task - this will be captured by Claude Code when running in hook context
|
|
73
|
+
cat "$AGENT_TASK_FILE"
|
|
74
|
+
|
|
75
|
+
# Cleanup task file
|
|
76
|
+
rm -f "$AGENT_TASK_FILE"
|
|
77
|
+
|
|
78
|
+
echo ""
|
|
79
|
+
echo ""
|
|
80
|
+
echo "⏳ Waiting for agent to write result to: $RESULT_FILE"
|
|
81
|
+
echo ""
|
|
82
|
+
|
|
83
|
+
# Wait for the result file with timeout
|
|
84
|
+
MAX_WAIT=120 # 2 minutes
|
|
85
|
+
WAIT_COUNT=0
|
|
86
|
+
|
|
87
|
+
while [ ! -f "$RESULT_FILE" ] && [ $WAIT_COUNT -lt $MAX_WAIT ]; do
|
|
88
|
+
sleep 1
|
|
89
|
+
WAIT_COUNT=$((WAIT_COUNT + 1))
|
|
90
|
+
|
|
91
|
+
# Show progress every 10 seconds
|
|
92
|
+
if [ $((WAIT_COUNT % 10)) -eq 0 ]; then
|
|
93
|
+
echo " Still waiting... (${WAIT_COUNT}s / ${MAX_WAIT}s)"
|
|
94
|
+
fi
|
|
95
|
+
done
|
|
96
|
+
|
|
97
|
+
# Check if result was written
|
|
98
|
+
if [ -f "$RESULT_FILE" ]; then
|
|
99
|
+
echo ""
|
|
100
|
+
echo "✅ Review agent completed successfully"
|
|
101
|
+
echo ""
|
|
102
|
+
echo "Result:"
|
|
103
|
+
cat "$RESULT_FILE"
|
|
104
|
+
echo ""
|
|
105
|
+
exit 0
|
|
106
|
+
else
|
|
107
|
+
echo ""
|
|
108
|
+
echo "⚠️ Timeout: Review agent did not write result file after ${MAX_WAIT}s"
|
|
109
|
+
echo " Expected: $RESULT_FILE"
|
|
110
|
+
echo ""
|
|
111
|
+
echo " Creating default approval (fail-safe mode)"
|
|
112
|
+
echo ""
|
|
113
|
+
|
|
114
|
+
# Write a default approval
|
|
115
|
+
cat > "$RESULT_FILE" << 'JSON_EOF'
|
|
116
|
+
{
|
|
117
|
+
"approved": true,
|
|
118
|
+
"reason": "Review agent timeout - allowing commit in fail-safe mode",
|
|
119
|
+
"analyzer_results": []
|
|
120
|
+
}
|
|
121
|
+
JSON_EOF
|
|
122
|
+
|
|
123
|
+
exit 0
|
|
124
|
+
fi
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
{
|
|
2
|
+
"permissions": {
|
|
3
|
+
"allow": [
|
|
4
|
+
"Bash(tsc:*)",
|
|
5
|
+
"Bash(npm pack:*)",
|
|
6
|
+
"Bash(npm run build:*)",
|
|
7
|
+
"Bash(npm view:*)",
|
|
8
|
+
"Bash(npm publish)",
|
|
9
|
+
"Bash(tee:*)",
|
|
10
|
+
"Bash(chmod:*)"
|
|
11
|
+
]
|
|
12
|
+
},
|
|
13
|
+
"hooks": {
|
|
14
|
+
"PreToolUse": [
|
|
15
|
+
{
|
|
16
|
+
"matcher": "Bash(*git commit*)",
|
|
17
|
+
"hooks": [
|
|
18
|
+
{
|
|
19
|
+
"type": "command",
|
|
20
|
+
"command": ".claude/hooks/prepare-review.sh",
|
|
21
|
+
"statusMessage": "Preparing commit review"
|
|
22
|
+
},
|
|
23
|
+
{
|
|
24
|
+
"type": "prompt",
|
|
25
|
+
"prompt": "You are a dedicated code review agent.\n\nFirst, find the most recent review prompt file by running:\nls -t /tmp/tmp.*/review-prompt.md 2>/dev/null | head -1\n\nThen read that file - it contains:\n- The git commit diff\n- Multiple analyzer prompts with review criteria\n- Instructions for your analysis\n\nAfter analyzing:\n1. Work through each analyzer in priority order\n2. Apply the specific criteria from each analyzer\n3. Use the Write tool to create the result JSON file at the path specified in the prompt\n4. The JSON must have: {\"approved\": boolean, \"reason\": string, \"analyzer_results\": [...]}\n\nIf any analyzer with blocking:true rejects, set approved:false.\n\nBe thorough and specific in your analysis.",
|
|
26
|
+
"statusMessage": "Running code review agent"
|
|
27
|
+
},
|
|
28
|
+
{
|
|
29
|
+
"type": "command",
|
|
30
|
+
"command": ".claude/hooks/check-review-result.sh",
|
|
31
|
+
"statusMessage": "Checking review result"
|
|
32
|
+
}
|
|
33
|
+
]
|
|
34
|
+
}
|
|
35
|
+
]
|
|
36
|
+
}
|
|
37
|
+
}
|
|
@@ -0,0 +1,84 @@
|
|
|
1
|
+
# Help Skill
|
|
2
|
+
|
|
3
|
+
A comprehensive step-by-step guide for getting started with event-driven development using this framework.
|
|
4
|
+
|
|
5
|
+
## Usage
|
|
6
|
+
|
|
7
|
+
```bash
|
|
8
|
+
/help
|
|
9
|
+
```
|
|
10
|
+
|
|
11
|
+
This will display the full getting started guide covering:
|
|
12
|
+
|
|
13
|
+
1. **Installation** - Verify tooling is set up
|
|
14
|
+
2. **Event Modeling** - Create your domain model (or use demo config)
|
|
15
|
+
3. **Generate Skeleton** - Scaffold your application
|
|
16
|
+
4. **Generate Slices** - Create commands, read models, and automations
|
|
17
|
+
5. **Ralph Loop** - Auto-implement slices with AI
|
|
18
|
+
6. **Run Application** - Start your event-sourced app
|
|
19
|
+
|
|
20
|
+
## Demo Config
|
|
21
|
+
|
|
22
|
+
A pre-built shopping cart demo is included for quick testing:
|
|
23
|
+
|
|
24
|
+
```bash
|
|
25
|
+
cp .claude/skills/help/templates/demo-config.json config.json
|
|
26
|
+
```
|
|
27
|
+
|
|
28
|
+
The demo includes:
|
|
29
|
+
- **3 State Change Slices**: Add Item, Remove Item, Checkout Cart
|
|
30
|
+
- **2 State View Slices**: Active Carts, Cart History
|
|
31
|
+
- **1 Automation Slice**: Abandoned Cart Reminder
|
|
32
|
+
|
|
33
|
+
## Files
|
|
34
|
+
|
|
35
|
+
```
|
|
36
|
+
.claude/skills/help/
|
|
37
|
+
├── SKILL.md # Main help content
|
|
38
|
+
├── README.md # This file
|
|
39
|
+
└── templates/
|
|
40
|
+
└── demo-config.json # Shopping cart demo
|
|
41
|
+
```
|
|
42
|
+
|
|
43
|
+
## What the Help Skill Covers
|
|
44
|
+
|
|
45
|
+
### For Beginners
|
|
46
|
+
- What is event-driven development
|
|
47
|
+
- Event modeling basics
|
|
48
|
+
- Step-by-step workflow
|
|
49
|
+
- Common patterns and architecture
|
|
50
|
+
|
|
51
|
+
### For Implementation
|
|
52
|
+
- How to use each generator skill
|
|
53
|
+
- Ralph agent workflow
|
|
54
|
+
- Slice structure and patterns
|
|
55
|
+
- Testing strategies
|
|
56
|
+
|
|
57
|
+
### For Troubleshooting
|
|
58
|
+
- Common issues and solutions
|
|
59
|
+
- How to debug Ralph
|
|
60
|
+
- Build and test errors
|
|
61
|
+
- Configuration problems
|
|
62
|
+
|
|
63
|
+
## Related Skills
|
|
64
|
+
|
|
65
|
+
- `/fetch-config` - Receive event model from modeling tool
|
|
66
|
+
- `/gen-skeleton` - Generate backend skeleton
|
|
67
|
+
- `/gen-state-change` - Generate command handlers
|
|
68
|
+
- `/gen-state-view` - Generate read models
|
|
69
|
+
- `/gen-automation` - Generate automation processors
|
|
70
|
+
- `/gen-ui` - Generate React UI
|
|
71
|
+
|
|
72
|
+
## Developer Notes
|
|
73
|
+
|
|
74
|
+
The help skill is designed to be:
|
|
75
|
+
- **Progressive** - Start simple, add detail as needed
|
|
76
|
+
- **Actionable** - Every section has clear commands to run
|
|
77
|
+
- **Self-contained** - Can be read without external docs
|
|
78
|
+
- **Searchable** - Clear headings for jumping to topics
|
|
79
|
+
|
|
80
|
+
When updating, consider:
|
|
81
|
+
- Keep code examples up to date with generator output
|
|
82
|
+
- Update troubleshooting based on common user issues
|
|
83
|
+
- Add new sections for new features
|
|
84
|
+
- Test demo config works with current generators
|