@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.
Files changed (212) hide show
  1. package/README.md +254 -0
  2. package/dist/cli.d.ts +2 -0
  3. package/dist/cli.js +138 -0
  4. package/package.json +49 -0
  5. package/templates/.claude/hooks/QUICKSTART.md +256 -0
  6. package/templates/.claude/hooks/README.md +533 -0
  7. package/templates/.claude/hooks/analyze-commit.sh +22 -0
  8. package/templates/.claude/hooks/analyze-commit.ts +518 -0
  9. package/templates/.claude/hooks/analyzers/README.md +198 -0
  10. package/templates/.claude/hooks/analyzers/code-quality-checker.ts +154 -0
  11. package/templates/.claude/hooks/analyzers/code-quality.md +54 -0
  12. package/templates/.claude/hooks/analyzers/commit-blocker-example.ts.disabled +110 -0
  13. package/templates/.claude/hooks/analyzers/commit-policy.md +49 -0
  14. package/templates/.claude/hooks/analyzers/event-model-validator.md +49 -0
  15. package/templates/.claude/hooks/analyzers/event-model-validator.ts +169 -0
  16. package/templates/.claude/hooks/analyzers/example-logger.ts +70 -0
  17. package/templates/.claude/hooks/analyzers/slice-scope-validator.md +81 -0
  18. package/templates/.claude/hooks/check-review-result.sh +47 -0
  19. package/templates/.claude/hooks/prepare-review.sh +34 -0
  20. package/templates/.claude/hooks/review-agent-prompt.md +42 -0
  21. package/templates/.claude/hooks/run-review-agent.sh +124 -0
  22. package/templates/.claude/settings.local.json +37 -0
  23. package/templates/.claude/skills/help/README.md +84 -0
  24. package/templates/.claude/skills/help/SKILL.md +393 -0
  25. package/templates/.claude/skills/help/templates/demo-config.json +6753 -0
  26. package/templates/.claude/skills/sample-slices/SKILL.md +8 -0
  27. package/templates/.claude/skills/sample-slices/templates/.slices/Library/addbook/code-slice.json +124 -0
  28. package/templates/.claude/skills/sample-slices/templates/.slices/Library/addbook/slice.json +255 -0
  29. package/templates/.claude/skills/sample-slices/templates/.slices/Library/availablebooks/slice.json +107 -0
  30. package/templates/.claude/skills/sample-slices/templates/.slices/index.json +20 -0
  31. package/templates/.claude/skills/sample-slices/templates/Cart/additem/slice.json +979 -0
  32. package/templates/.claude/skills/sample-slices/templates/Cart/archiveitem/slice.json +529 -0
  33. package/templates/.claude/skills/sample-slices/templates/Cart/cartitems/slice.json +1072 -0
  34. package/templates/.claude/skills/sample-slices/templates/Cart/cartwithproducts/slice.json +394 -0
  35. package/templates/.claude/skills/sample-slices/templates/Cart/changedprices/slice.json +88 -0
  36. package/templates/.claude/skills/sample-slices/templates/Cart/changeinventory/slice.json +264 -0
  37. package/templates/.claude/skills/sample-slices/templates/Cart/changeprice/slice.json +308 -0
  38. package/templates/.claude/skills/sample-slices/templates/Cart/clearcart/slice.json +358 -0
  39. package/templates/.claude/skills/sample-slices/templates/Cart/inventories/slice.json +203 -0
  40. package/templates/.claude/skills/sample-slices/templates/Cart/publishcart/slice.json +876 -0
  41. package/templates/.claude/skills/sample-slices/templates/Cart/removeitem/slice.json +560 -0
  42. package/templates/.claude/skills/sample-slices/templates/Cart/submitcart/slice.json +708 -0
  43. package/templates/.claude/skills/sample-slices/templates/Cart/submittedcartdata/slice.json +399 -0
  44. package/templates/.claude/skills/sample-slices/templates/index.json +108 -0
  45. package/templates/.claude/skills/slice-automation/SKILL.md +49 -0
  46. package/templates/.claude/skills/slice-state-change/SKILL.md +369 -0
  47. package/templates/.claude/skills/slice-state-change/templates/AddLocation/AddLocation.test.ts.sample +76 -0
  48. package/templates/.claude/skills/slice-state-change/templates/AddLocation/AddLocationCommand.ts.sample +84 -0
  49. package/templates/.claude/skills/slice-state-change/templates/AddLocation/routes.ts.sample +73 -0
  50. package/templates/.claude/skills/slice-state-change/templates/README.md +46 -0
  51. package/templates/.claude/skills/slice-state-view/SKILL.md +336 -0
  52. package/templates/.claude/skills/slice-state-view/templates/Locations/Locations.test.ts.sample +84 -0
  53. package/templates/.claude/skills/slice-state-view/templates/Locations/LocationsProjection.ts.sample +50 -0
  54. package/templates/.claude/skills/slice-state-view/templates/Locations/routes.ts.sample +46 -0
  55. package/templates/.claude/skills/slice-state-view/templates/README.md +109 -0
  56. package/templates/.claude/skills/slice-state-view/templates/Tables/Tables.test.ts.sample +104 -0
  57. package/templates/.claude/skills/slice-state-view/templates/Tables/TablesProjection.ts.sample +59 -0
  58. package/templates/.claude/skills/slice-state-view/templates/Tables/routes.ts.sample +46 -0
  59. package/templates/.claude/skills/slice-state-view/templates/V2__tables.sql +7 -0
  60. package/templates/.claude/skills/slice-state-view/templates/V8__locations.sql +7 -0
  61. package/templates/.claude/skills/test-analyzer/SKILL.md +373 -0
  62. package/templates/.claude/skills/test-analyzer/examples/specification-format.md +143 -0
  63. package/templates/.claude/skills/test-analyzer/examples/state-change-example.md +111 -0
  64. package/templates/.claude/skills/test-analyzer/examples/state-view-example.md +122 -0
  65. package/templates/AGENTS.md +110 -0
  66. package/templates/Claude.md +58 -0
  67. package/templates/README.md +178 -0
  68. package/templates/backend/.env +9 -0
  69. package/templates/backend/BACKEND_AUTH_SETUP.md +183 -0
  70. package/templates/backend/SWAGGER.md +213 -0
  71. package/templates/backend/eslint.config.mjs +31 -0
  72. package/templates/backend/flyway.conf +17 -0
  73. package/templates/backend/package.json +44 -0
  74. package/templates/backend/prd.json.example +64 -0
  75. package/templates/backend/public/assets/images/banner.png +0 -0
  76. package/templates/backend/public/assets/logo.png +0 -0
  77. package/templates/backend/public/file.svg +4 -0
  78. package/templates/backend/public/globe.svg +12 -0
  79. package/templates/backend/public/next.svg +6 -0
  80. package/templates/backend/public/vercel.svg +3 -0
  81. package/templates/backend/public/window.svg +5 -0
  82. package/templates/backend/server.ts +129 -0
  83. package/templates/backend/setup-env.sh +50 -0
  84. package/templates/backend/src/common/assertions.ts +6 -0
  85. package/templates/backend/src/common/db.ts +1 -0
  86. package/templates/backend/src/common/loadPostgresEventstore.ts +16 -0
  87. package/templates/backend/src/common/parseEndpoint.ts +51 -0
  88. package/templates/backend/src/common/replay.ts +9 -0
  89. package/templates/backend/src/common/routes.ts +19 -0
  90. package/templates/backend/src/common/testHelpers.ts +53 -0
  91. package/templates/backend/src/core/readmodel.ts +28 -0
  92. package/templates/backend/src/core/types.ts +26 -0
  93. package/templates/backend/src/process/process.ts +53 -0
  94. package/templates/backend/src/supabase/LoginHandler.ts +36 -0
  95. package/templates/backend/src/supabase/ProtectedPageProps.ts +21 -0
  96. package/templates/backend/src/supabase/README.md +171 -0
  97. package/templates/backend/src/supabase/api.ts +63 -0
  98. package/templates/backend/src/supabase/authMiddleware.ts +53 -0
  99. package/templates/backend/src/supabase/component.ts +12 -0
  100. package/templates/backend/src/supabase/requireUser.ts +72 -0
  101. package/templates/backend/src/supabase/serverProps.ts +25 -0
  102. package/templates/backend/src/supabase/staticProps.ts +10 -0
  103. package/templates/backend/src/swagger.ts +34 -0
  104. package/templates/backend/src/util/assertions.ts +6 -0
  105. package/templates/backend/supabase/config.toml +295 -0
  106. package/templates/backend/supabase/migrations/20260121155918593_catalogentries.sql.sample +23 -0
  107. package/templates/backend/supabase/seed.sql +1 -0
  108. package/templates/backend/tsconfig.json +31 -0
  109. package/templates/frontend/.env.development +3 -0
  110. package/templates/frontend/AGENTS.md +7 -0
  111. package/templates/frontend/README.md +73 -0
  112. package/templates/frontend/components.json +20 -0
  113. package/templates/frontend/eslint.config.js +26 -0
  114. package/templates/frontend/index.html +18 -0
  115. package/templates/frontend/package-lock.json +8347 -0
  116. package/templates/frontend/package.json +94 -0
  117. package/templates/frontend/postcss.config.js +6 -0
  118. package/templates/frontend/public/favicon.ico +0 -0
  119. package/templates/frontend/public/logo.png +0 -0
  120. package/templates/frontend/public/placeholder.svg +1 -0
  121. package/templates/frontend/public/robots.txt +14 -0
  122. package/templates/frontend/src/App.css +42 -0
  123. package/templates/frontend/src/App.tsx +47 -0
  124. package/templates/frontend/src/components/NavLink.tsx +28 -0
  125. package/templates/frontend/src/components/ProtectedRoute.tsx +24 -0
  126. package/templates/frontend/src/components/calendar/Calendar.tsx +302 -0
  127. package/templates/frontend/src/components/layout/DashboardLayout.tsx +21 -0
  128. package/templates/frontend/src/components/layout/Header.tsx +45 -0
  129. package/templates/frontend/src/components/layout/Sidebar.tsx +82 -0
  130. package/templates/frontend/src/components/tables/ReservationTemplates.tsx +189 -0
  131. package/templates/frontend/src/components/ui/accordion.tsx +52 -0
  132. package/templates/frontend/src/components/ui/alert-dialog.tsx +104 -0
  133. package/templates/frontend/src/components/ui/alert.tsx +43 -0
  134. package/templates/frontend/src/components/ui/aspect-ratio.tsx +5 -0
  135. package/templates/frontend/src/components/ui/avatar.tsx +38 -0
  136. package/templates/frontend/src/components/ui/badge.tsx +29 -0
  137. package/templates/frontend/src/components/ui/breadcrumb.tsx +90 -0
  138. package/templates/frontend/src/components/ui/button.tsx +47 -0
  139. package/templates/frontend/src/components/ui/calendar.tsx +54 -0
  140. package/templates/frontend/src/components/ui/card.tsx +43 -0
  141. package/templates/frontend/src/components/ui/carousel.tsx +224 -0
  142. package/templates/frontend/src/components/ui/chart.tsx +303 -0
  143. package/templates/frontend/src/components/ui/checkbox.tsx +26 -0
  144. package/templates/frontend/src/components/ui/collapsible.tsx +9 -0
  145. package/templates/frontend/src/components/ui/command.tsx +132 -0
  146. package/templates/frontend/src/components/ui/context-menu.tsx +178 -0
  147. package/templates/frontend/src/components/ui/dialog.tsx +95 -0
  148. package/templates/frontend/src/components/ui/drawer.tsx +87 -0
  149. package/templates/frontend/src/components/ui/dropdown-menu.tsx +179 -0
  150. package/templates/frontend/src/components/ui/form.tsx +129 -0
  151. package/templates/frontend/src/components/ui/hover-card.tsx +27 -0
  152. package/templates/frontend/src/components/ui/input-otp.tsx +61 -0
  153. package/templates/frontend/src/components/ui/input.tsx +22 -0
  154. package/templates/frontend/src/components/ui/label.tsx +17 -0
  155. package/templates/frontend/src/components/ui/menubar.tsx +207 -0
  156. package/templates/frontend/src/components/ui/navigation-menu.tsx +120 -0
  157. package/templates/frontend/src/components/ui/pagination.tsx +81 -0
  158. package/templates/frontend/src/components/ui/popover.tsx +29 -0
  159. package/templates/frontend/src/components/ui/progress.tsx +23 -0
  160. package/templates/frontend/src/components/ui/radio-group.tsx +36 -0
  161. package/templates/frontend/src/components/ui/resizable.tsx +37 -0
  162. package/templates/frontend/src/components/ui/scroll-area.tsx +38 -0
  163. package/templates/frontend/src/components/ui/select.tsx +143 -0
  164. package/templates/frontend/src/components/ui/separator.tsx +20 -0
  165. package/templates/frontend/src/components/ui/sheet.tsx +107 -0
  166. package/templates/frontend/src/components/ui/sidebar.tsx +637 -0
  167. package/templates/frontend/src/components/ui/skeleton.tsx +7 -0
  168. package/templates/frontend/src/components/ui/slider.tsx +23 -0
  169. package/templates/frontend/src/components/ui/sonner.tsx +27 -0
  170. package/templates/frontend/src/components/ui/stat-card.tsx +44 -0
  171. package/templates/frontend/src/components/ui/switch.tsx +27 -0
  172. package/templates/frontend/src/components/ui/table.tsx +72 -0
  173. package/templates/frontend/src/components/ui/tabs.tsx +53 -0
  174. package/templates/frontend/src/components/ui/textarea.tsx +21 -0
  175. package/templates/frontend/src/components/ui/toast.tsx +111 -0
  176. package/templates/frontend/src/components/ui/toaster.tsx +24 -0
  177. package/templates/frontend/src/components/ui/toggle-group.tsx +49 -0
  178. package/templates/frontend/src/components/ui/toggle.tsx +37 -0
  179. package/templates/frontend/src/components/ui/tooltip.tsx +28 -0
  180. package/templates/frontend/src/components/ui/use-toast.ts +3 -0
  181. package/templates/frontend/src/contexts/AuthContext.tsx +94 -0
  182. package/templates/frontend/src/contexts/RefreshContext.tsx +236 -0
  183. package/templates/frontend/src/hooks/api/index.ts +2 -0
  184. package/templates/frontend/src/hooks/api/useLocations.ts +15 -0
  185. package/templates/frontend/src/hooks/use-mobile.tsx +19 -0
  186. package/templates/frontend/src/hooks/use-toast.ts +186 -0
  187. package/templates/frontend/src/hooks/useApiContext.ts +11 -0
  188. package/templates/frontend/src/index.css +118 -0
  189. package/templates/frontend/src/integrations/supabase/client.ts +9 -0
  190. package/templates/frontend/src/lib/api-client.ts +136 -0
  191. package/templates/frontend/src/lib/api.ts +1028 -0
  192. package/templates/frontend/src/lib/utils.ts +6 -0
  193. package/templates/frontend/src/main.tsx +5 -0
  194. package/templates/frontend/src/pages/Auth.tsx +408 -0
  195. package/templates/frontend/src/pages/Dashboard.tsx +168 -0
  196. package/templates/frontend/src/pages/Menus.tsx +224 -0
  197. package/templates/frontend/src/pages/NotFound.tsx +24 -0
  198. package/templates/frontend/src/pages/Register.tsx +285 -0
  199. package/templates/frontend/src/test/example.test.ts +0 -0
  200. package/templates/frontend/src/test/setup.ts +15 -0
  201. package/templates/frontend/src/types/index.ts +8 -0
  202. package/templates/frontend/src/vite-env.d.ts +1 -0
  203. package/templates/frontend/tailwind.config.ts +101 -0
  204. package/templates/frontend/tsconfig.app.json +31 -0
  205. package/templates/frontend/tsconfig.json +16 -0
  206. package/templates/frontend/tsconfig.node.json +22 -0
  207. package/templates/frontend/vite.config.ts +21 -0
  208. package/templates/frontend/vitest.config.ts +16 -0
  209. package/templates/init.sh +1 -0
  210. package/templates/prompt.md +139 -0
  211. package/templates/ralph.sh +120 -0
  212. package/templates/server.mjs +505 -0
@@ -0,0 +1,31 @@
1
+ {
2
+ "compilerOptions": {
3
+ "types": ["vitest/globals"],
4
+ "target": "ES2020",
5
+ "useDefineForClassFields": true,
6
+ "lib": ["ES2020", "DOM", "DOM.Iterable"],
7
+ "module": "ESNext",
8
+ "skipLibCheck": true,
9
+
10
+ /* Bundler mode */
11
+ "moduleResolution": "bundler",
12
+ "allowImportingTsExtensions": true,
13
+ "isolatedModules": true,
14
+ "moduleDetection": "force",
15
+ "noEmit": true,
16
+ "jsx": "react-jsx",
17
+
18
+ /* Linting */
19
+ "strict": false,
20
+ "noUnusedLocals": false,
21
+ "noUnusedParameters": false,
22
+ "noImplicitAny": false,
23
+ "noFallthroughCasesInSwitch": false,
24
+
25
+ "baseUrl": ".",
26
+ "paths": {
27
+ "@/*": ["./src/*"]
28
+ }
29
+ },
30
+ "include": ["src"]
31
+ }
@@ -0,0 +1,16 @@
1
+ {
2
+ "files": [],
3
+ "references": [{ "path": "./tsconfig.app.json" }, { "path": "./tsconfig.node.json" }],
4
+ "compilerOptions": {
5
+ "baseUrl": ".",
6
+ "paths": {
7
+ "@/*": ["./src/*"]
8
+ },
9
+ "noImplicitAny": false,
10
+ "noUnusedParameters": false,
11
+ "skipLibCheck": true,
12
+ "allowJs": true,
13
+ "noUnusedLocals": false,
14
+ "strictNullChecks": false
15
+ }
16
+ }
@@ -0,0 +1,22 @@
1
+ {
2
+ "compilerOptions": {
3
+ "target": "ES2022",
4
+ "lib": ["ES2023"],
5
+ "module": "ESNext",
6
+ "skipLibCheck": true,
7
+
8
+ /* Bundler mode */
9
+ "moduleResolution": "bundler",
10
+ "allowImportingTsExtensions": true,
11
+ "isolatedModules": true,
12
+ "moduleDetection": "force",
13
+ "noEmit": true,
14
+
15
+ /* Linting */
16
+ "strict": true,
17
+ "noUnusedLocals": false,
18
+ "noUnusedParameters": false,
19
+ "noFallthroughCasesInSwitch": true
20
+ },
21
+ "include": ["vite.config.ts"]
22
+ }
@@ -0,0 +1,21 @@
1
+ import { defineConfig } from "vite";
2
+ import react from "@vitejs/plugin-react-swc";
3
+ import path from "path";
4
+ import { componentTagger } from "lovable-tagger";
5
+
6
+ // https://vitejs.dev/config/
7
+ export default defineConfig(({ mode }) => ({
8
+ server: {
9
+ host: "::",
10
+ port: 8080,
11
+ hmr: {
12
+ overlay: false,
13
+ },
14
+ },
15
+ plugins: [react(), mode === "development" && componentTagger()].filter(Boolean),
16
+ resolve: {
17
+ alias: {
18
+ "@": path.resolve(__dirname, "./src"),
19
+ },
20
+ },
21
+ }));
@@ -0,0 +1,16 @@
1
+ import { defineConfig } from "vitest/config";
2
+ import react from "@vitejs/plugin-react-swc";
3
+ import path from "path";
4
+
5
+ export default defineConfig({
6
+ plugins: [react()],
7
+ test: {
8
+ environment: "jsdom",
9
+ globals: true,
10
+ setupFiles: ["./src/test/setup.ts"],
11
+ include: ["src/**/*.{test,spec}.{ts,tsx}"],
12
+ },
13
+ resolve: {
14
+ alias: { "@": path.resolve(__dirname, "./src") },
15
+ },
16
+ });
@@ -0,0 +1 @@
1
+ docker run -v $PWD:/workspace nebulit/generators
@@ -0,0 +1,139 @@
1
+ # Ralph Agent Instructions
2
+
3
+ You are an autonomous coding agent working on a software project. You apply your skills to build software slices. You only work on one slice at a time.
4
+
5
+ The structure defined in the Project-Skills is relevant.
6
+
7
+ ## Your Task
8
+
9
+ 0. Do not read the entire code base. Focus on the tasks in this description.
10
+ 1. Read the description at `.slices/index.json` (in the same directory as this file). Every item in status "planned" is a task.
11
+ 2. Read the progress log at `progress.txt` (check Codebase Patterns section first)
12
+ 3. Make sure you are on the right branch "feature/<slicename>", if unsure, start from main.
13
+ 5. Pick the **highest priority** slice where status is "planned" ( case insensitive ). This becomes your PRD. Set the status "InProgress" in the index.json. If no slice has status planned, reply with:
14
+ <promise>NO_TASKS</promise> and stop. Do not work on other slices.
15
+ 6. Pick the slice definition from the project root /.slices in <folder> defined in the prd. Never work on more than one slice per iteration.
16
+ 7. A slice can define additional prompts as codegen/backendPrompt. any additional prompts defined in backend are hints for the implementation of the slice and have to be taken into account. If you use the additional prompt, add a line in progress.txt
17
+ 7. Define the slice type and load the matching skill. If the processors-array is not empty, it´s an automation slice.
18
+ 8. Write a short progress one liner after each step to progress.txt
19
+ 9. Analyze and Implement that single slice, make use of the skills in the skills directory, but also your previsously collected
20
+ knowledge. Make a list TODO list for what needs to be done. Also make sure to adjust the implementation according to the json definition. Carefully inspect events, fields and compare against the implemented slice. JSON is the desired state. ATTENTION: A "planned" task can also be just added specifications. So always look at the slice itself, but also the specifications. If specifications were added in json, which are not on code, you need to add them in code.
21
+ 10. The slice in the json is always true, the code follows what is defined in the json
22
+ 11. slice is only 'Done' if business logic is implemented as defined in the JSON, APIs are implemented, all scenarios in JSON are implemented in code and it
23
+ fulfills the slice.json. There must be no specification in json, that has no equivalent in code.
24
+ 12. make sure to write the ui-prompt.md as defined if defined in the skill
25
+ 13. Run quality checks ( npm run build, npm run test ) - Attention - it´s enough to run the tests for the slice. Do not run all tests.
26
+ 14. even if the slice is fully implemented, run your test-analyzer skill and provide the code-slice.json file as defined in the skill
27
+ 15. Update the Slice in the index.json to either `status: Done` for the completed, 'status: Planned' if rework is necessary.
28
+ 16. If checks pass, commit ALL changes with message: `feat: [Slice Name]` and merge back to main as FF merge ( update
29
+ first )
30
+ 17. Append your progress to `progress.txt` after each step in the iteration.
31
+ 18. append your new learnings to AGENTS.md in a compressed form, reusable for future iterations. Only add learnings if they are not already there.
32
+ 19. Finish the iteration.
33
+
34
+ ## Progress Report Format
35
+
36
+ APPEND to progress.txt (never replace, always append):
37
+
38
+ ```
39
+ ## [Date/Time] - [Slice]
40
+
41
+ - What was implemented
42
+ - Files changed
43
+ - **Learnings for future iterations:**
44
+ - Patterns discovered (e.g., "this codebase uses X for Y")
45
+ - Gotchas encountered (e.g., "don't forget to update Z when changing W")
46
+ - Useful context (e.g., "the evaluation panel is in component X")
47
+ ---
48
+ ```
49
+
50
+ The learnings section is critical - it helps future iterations avoid repeating mistakes and understand the codebase
51
+ better.
52
+
53
+ ## Consolidate Patterns
54
+
55
+ If you discover a **reusable pattern** that future iterations should know, add it to the `## Codebase Patterns` section
56
+ at the TOP of progress.txt (create it if it doesn't exist). This section should consolidate the most important
57
+ learnings:
58
+
59
+ ```
60
+ ## Codebase Patterns
61
+ - Example: Use `sql<number>` template for aggregations
62
+ - Example: Always use `IF NOT EXISTS` for migrations
63
+ - Example: Export types from actions.ts for UI components
64
+ ```
65
+
66
+ Only add patterns that are **general and reusable**, not story-specific details.
67
+
68
+ ## Update AGENTS.md Files
69
+
70
+ Before committing, check if any edited files have learnings worth preserving in nearby AGENTS.md files:
71
+
72
+ 1. **Identify directories with edited files** - Look at which directories you modified
73
+ 3. **Add valuable learnings that apply to all tasks** to the Agents.md - If you discovered something future developers/agents should know:
74
+ - API patterns or conventions specific to that module
75
+ - Gotchas or non-obvious requirements
76
+ - Dependencies between files
77
+ - Testing approaches for that area
78
+ - Configuration or environment requirements
79
+
80
+ **Examples of good AGENTS.md additions:**
81
+
82
+ - "When modifying X, also update Y to keep them in sync"
83
+ - "This module uses pattern Z for all API calls"
84
+ - "Tests require the dev server running on PORT 3000"
85
+ - "Field names must match the template exactly"
86
+
87
+ **Do NOT add:**
88
+
89
+ - Slice specific implementation details
90
+ - Story-specific implementation details
91
+ - Temporary debugging notes
92
+ - Information already in progress.txt
93
+ - Task speecific learnings like "- Timesheet approval requires: submitted=true, reverted=false, approved=false, declined=false"
94
+
95
+ Only update AGENTS.md if you have **genuinely reusable knowledge** that would help future work
96
+
97
+ ## Quality Requirements
98
+
99
+ - ALL commits must pass your project's quality checks (typecheck, lint, test)
100
+ - run 'npm run build'
101
+ - run 'npm run test'
102
+ - Do NOT commit broken code
103
+ - Keep changes focused and minimal
104
+ - Follow existing code patterns
105
+
106
+ ## Skills
107
+
108
+ Use the provided skills in the skills folder as guidance.
109
+ Update skill definitions if you find an improvement you can make.
110
+
111
+ ## Specifications
112
+
113
+ For every specification added to the Slice, you need to implement one use executable Specification in Code.
114
+
115
+ A Slice is not complete if specifications are missing or can´t be executed.
116
+
117
+ ## Stop Condition
118
+
119
+ After completing a user story, check if ALL slices have `status: Done`.
120
+
121
+ If ALL stories are complete and passing, reply with:
122
+ <promise>COMPLETE</promise>
123
+
124
+ If there are no stories with `status: Planned` (but not all are Done), reply with:
125
+ <promise>NO_TASKS</promise>
126
+
127
+ If there are still stories with `status: Planned`, end your response normally (another iteration will pick up the next
128
+ story).
129
+
130
+ ## Important
131
+
132
+ - Work on ONE slice per iteration
133
+ - Commit frequently
134
+ - update progress.txt frequently
135
+ - Read the Codebase Patterns section in progress.txt before starting
136
+
137
+ ## When an iteration completes
138
+
139
+ Use all the key learnings from the project.txt and update the Agends.md file with those learning.
@@ -0,0 +1,120 @@
1
+ #!/bin/bash
2
+ # Ralph - Long-running AI agent loop for event-model driven development
3
+ # Usage: ./ralph.sh [max_iterations]
4
+
5
+ set -euo pipefail
6
+
7
+ MAX_ITERATIONS=${1:-10}
8
+ SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
9
+
10
+ PROGRESS_FILE="$SCRIPT_DIR/progress.txt"
11
+ ARCHIVE_DIR="$SCRIPT_DIR/archive"
12
+
13
+ mkdir -p "$ARCHIVE_DIR"
14
+
15
+ # ------------------------------------------------------------
16
+ # Init progress file
17
+ # ------------------------------------------------------------
18
+ if [[ ! -f "$PROGRESS_FILE" ]]; then
19
+ echo "# Event Model Development Progress Log" > "$PROGRESS_FILE"
20
+ echo "Started: $(date)" >> "$PROGRESS_FILE"
21
+ echo "---" >> "$PROGRESS_FILE"
22
+ fi
23
+
24
+ echo "Starting Ralph – Max iterations: $MAX_ITERATIONS"
25
+
26
+ # ------------------------------------------------------------
27
+ # Main Ralph loop
28
+ # ------------------------------------------------------------
29
+ for i in $(seq 1 "$MAX_ITERATIONS"); do
30
+ echo
31
+ echo "═══════════════════════════════════════════════════════"
32
+ echo " Ralph Iteration $i of $MAX_ITERATIONS"
33
+ echo "═══════════════════════════════════════════════════════"
34
+
35
+ echo
36
+ echo ">>> Running Claude at $(date)"
37
+ echo ">>> Iteration $i" >> "$PROGRESS_FILE"
38
+
39
+ TMP_OUTPUT=$(mktemp)
40
+
41
+ # ---- Run Claude safely -----------------
42
+ CLAUDE_SKIP=false
43
+ while true; do
44
+ cat "$SCRIPT_DIR/prompt.md" \
45
+ | claude --dangerously-skip-permissions 2>&1 \
46
+ | tee "$TMP_OUTPUT" | tee -a "$PROGRESS_FILE"
47
+ CLAUDE_EXIT=${PIPESTATUS[1]} # exit code of 'claude', not 'tee'
48
+
49
+ if [[ $CLAUDE_EXIT -eq 0 ]]; then
50
+ # Success, break out of the retry loop
51
+ break
52
+ elif grep -q "No messages returned" "$TMP_OUTPUT" 2>/dev/null; then
53
+ # Transient error: no messages returned - skip iteration
54
+ echo
55
+ echo "⚠️ Claude returned no messages (transient). Skipping iteration..."
56
+ CLAUDE_SKIP=true
57
+ break
58
+ else
59
+ # Non-zero exit code: probably spending limit reached
60
+ echo
61
+ echo "⚠️ Claude exited with an error. Possibly spending limit reached."
62
+ echo "Waiting 5 minutes before retry..."
63
+ sleep 300 # 5 minutes
64
+ fi
65
+ done
66
+ if [[ "$CLAUDE_SKIP" == "true" ]]; then
67
+ continue
68
+ fi
69
+
70
+ OUTPUT=$(cat "$TMP_OUTPUT")
71
+ rm "$TMP_OUTPUT"
72
+
73
+ if [[ -z "$OUTPUT" ]]; then
74
+ echo "⚠️ Claude returned no output. Retrying in 1 minute..."
75
+ sleep 60
76
+ continue # retry
77
+ fi
78
+
79
+ # ---- Check for commit review failure -------------------
80
+ if echo "$OUTPUT" | grep -q "❌ COMMIT REVIEW FAILED"; then
81
+ echo
82
+ echo "⚠️ Commit review failed - workspace has been reset"
83
+ echo "📄 Review failure details recorded in progress.txt"
84
+ echo "🔄 Continuing to next iteration..."
85
+ echo
86
+ echo "Review failed at iteration $i - continuing loop" >> "$PROGRESS_FILE"
87
+ echo "Continuing: $(date)" >> "$PROGRESS_FILE"
88
+ echo "---" >> "$PROGRESS_FILE"
89
+ sleep 5 # Brief pause before continuing
90
+ continue # Continue to next iteration
91
+ fi
92
+
93
+ # ---- Completion check -----------------------------------
94
+ if echo "$OUTPUT" | grep -q "<promise>COMPLETE</promise>"; then
95
+ echo
96
+ echo "🎉 Ralph completed all tasks!"
97
+ echo "Completed at iteration $i of $MAX_ITERATIONS"
98
+
99
+ echo
100
+ echo "Completed: $(date)" >> "$PROGRESS_FILE"
101
+ exit 0
102
+ fi
103
+
104
+ # ---- No tasks available check ---------------------------
105
+ if echo "$OUTPUT" | grep -q "<promise>NO_TASKS</promise>"; then
106
+ echo
107
+ echo "⏳ No tasks available. Waiting 30 seconds before next check..."
108
+ sleep 30
109
+ continue
110
+ fi
111
+
112
+ echo
113
+ echo "Iteration $i complete. Continuing..."
114
+ sleep 2
115
+ done
116
+
117
+ echo
118
+ echo "⚠️ Ralph reached max iterations ($MAX_ITERATIONS) without completing all tasks."
119
+ echo "Check $PROGRESS_FILE for status."
120
+ exit 1