@eventmodelers/cli 1.0.45 → 1.0.46
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 +4 -1
- package/cli.js +53 -1
- package/package.json +2 -2
- package/shared/build-kit/lib/checks/README.md +59 -0
- package/shared/build-kit/lib/ralph.js +110 -28
- package/shared/build-kit/lib/util/find-slice.cjs +59 -0
- package/shared/build-kit/ralph-claude.js +6 -2
- package/stacks/blank/templates/build-kit/lib/backend-prompt.md +106 -102
- package/stacks/blank/templates/build-kit/lib/prompt.md +102 -106
- package/stacks/kurrent/templates/.claude/skills/build-automation/SKILL.md +422 -0
- package/stacks/kurrent/templates/.claude/skills/build-automation/references/feature-flag-patterns.md +19 -0
- package/stacks/kurrent/templates/.claude/skills/build-automation/references/idempotent-dispatch-patterns.md +65 -0
- package/stacks/kurrent/templates/.claude/skills/build-state-change/SKILL.md +418 -0
- package/stacks/kurrent/templates/.claude/skills/build-state-change/references/feature-flag-patterns.md +41 -0
- package/stacks/kurrent/templates/.claude/skills/build-state-change/references/integration-test-patterns.md +64 -0
- package/stacks/kurrent/templates/.claude/skills/build-state-view/SKILL.md +391 -0
- package/stacks/kurrent/templates/build-kit/CLAUDE.md +122 -0
- package/stacks/kurrent/templates/build-kit/lib/AGENT.md +73 -0
- package/stacks/kurrent/templates/build-kit/lib/backend-prompt.md +169 -0
- package/stacks/kurrent/templates/build-kit/lib/prompt.md +128 -0
- package/stacks/kurrent/templates/root/README.md +46 -0
- package/stacks/kurrent/templates/root/docker-compose.yml +45 -0
- package/stacks/kurrent/templates/root/mvnw +259 -0
- package/stacks/kurrent/templates/root/mvnw.cmd +149 -0
- package/stacks/kurrent/templates/root/pom.xml +152 -0
- package/stacks/kurrent/templates/root/src/main/java/com/example/quickstart/QuickstartApplication.java +12 -0
- package/stacks/kurrent/templates/root/src/main/java/com/example/quickstart/common/EventStore.java +91 -0
- package/stacks/kurrent/templates/root/src/main/java/com/example/quickstart/config/KurrentConfiguration.java +42 -0
- package/stacks/kurrent/templates/root/src/main/resources/application.properties +14 -0
- package/stacks/kurrent/templates/root/src/main/resources/static/index.html +11 -0
- package/stacks/node/templates/build-kit/CLAUDE.md +22 -0
- package/stacks/node/templates/build-kit/lib/check-commit-scope.cjs +123 -0
- package/stacks/node/templates/build-kit/lib/checks/00-blocked-paths.cjs +28 -0
- package/stacks/node/templates/build-kit/lib/checks/10-slice-scope.cjs +29 -0
- package/stacks/node/templates/build-kit/lib/checks/20-append-only-migrations.cjs +20 -0
- package/stacks/node/templates/build-kit/lib/checks/30-test-file-present.cjs +44 -0
- package/stacks/node/templates/build-kit/lib/checks/40-no-invented-fields.cjs +92 -0
- package/stacks/node/templates/build-kit/lib/checks/50-spec-coverage.cjs +50 -0
- package/stacks/node/templates/build-kit/lib/checks/90-tsc-build.cjs +22 -0
- package/stacks/node/templates/root/.githooks/pre-commit +11 -0
- package/stacks/node/templates/root/package.json +2 -1
- package/stacks/node/templates/root/setup-env.sh +7 -1
- package/stacks/opencqrs/templates/.claude/skills/build-automation/SKILL.md +434 -0
- package/stacks/opencqrs/templates/.claude/skills/build-automation/references/feature-flag-patterns.md +19 -0
- package/stacks/opencqrs/templates/.claude/skills/build-automation/references/idempotent-dispatch-patterns.md +62 -0
- package/stacks/opencqrs/templates/.claude/skills/build-state-change/SKILL.md +413 -0
- package/stacks/opencqrs/templates/.claude/skills/build-state-change/references/feature-flag-patterns.md +46 -0
- package/stacks/opencqrs/templates/.claude/skills/build-state-change/references/rest-api-patterns.md +145 -0
- package/stacks/opencqrs/templates/.claude/skills/build-state-change/references/test-fixture-patterns.md +85 -0
- package/stacks/opencqrs/templates/.claude/skills/build-state-view/SKILL.md +354 -0
- package/stacks/opencqrs/templates/build-kit/CLAUDE.md +101 -0
- package/stacks/opencqrs/templates/build-kit/lib/AGENT.md +58 -0
- package/stacks/opencqrs/templates/build-kit/lib/backend-prompt.md +169 -0
- package/stacks/opencqrs/templates/build-kit/lib/prompt.md +128 -0
- package/stacks/opencqrs/templates/root/README.md +42 -0
- package/stacks/opencqrs/templates/root/docker-compose.yml +37 -0
- package/stacks/opencqrs/templates/root/mvnw +259 -0
- package/stacks/opencqrs/templates/root/mvnw.cmd +149 -0
- package/stacks/opencqrs/templates/root/pom.xml +139 -0
- package/stacks/opencqrs/templates/root/src/main/java/com/example/quickstart/QuickstartApplication.java +12 -0
- package/stacks/opencqrs/templates/root/src/main/java/com/example/quickstart/config/CqrsConfiguration.java +74 -0
- package/stacks/opencqrs/templates/root/src/main/resources/application.properties +23 -0
- package/stacks/opencqrs/templates/root/src/main/resources/schema.sql +19 -0
- package/stacks/opencqrs/templates/root/src/main/resources/static/index.html +11 -0
- package/stacks/supabase/templates/build-kit/CLAUDE.md +25 -0
- package/stacks/supabase/templates/build-kit/lib/check-commit-scope.cjs +126 -0
- package/stacks/supabase/templates/build-kit/lib/checks/00-blocked-paths.cjs +28 -0
- package/stacks/supabase/templates/build-kit/lib/checks/10-slice-scope.cjs +34 -0
- package/stacks/supabase/templates/build-kit/lib/checks/20-append-only-migrations.cjs +21 -0
- package/stacks/supabase/templates/build-kit/lib/checks/30-test-file-present.cjs +44 -0
- package/stacks/supabase/templates/build-kit/lib/checks/40-no-invented-fields.cjs +92 -0
- package/stacks/supabase/templates/build-kit/lib/checks/50-spec-coverage.cjs +50 -0
- package/stacks/supabase/templates/build-kit/lib/checks/90-tsc-build.cjs +22 -0
- package/stacks/supabase/templates/root/.githooks/pre-commit +11 -0
- package/stacks/supabase/templates/root/package.json +2 -1
- package/stacks/supabase/templates/root/setup-env.sh +7 -1
- package/stacks/umadb/templates/.claude/skills/build-automation/SKILL.md +313 -0
- package/stacks/umadb/templates/.claude/skills/build-automation/references/feature-flag-patterns.md +42 -0
- package/stacks/umadb/templates/.claude/skills/build-state-change/SKILL.md +376 -0
- package/stacks/umadb/templates/.claude/skills/build-state-change/references/feature-flag-patterns.md +42 -0
- package/stacks/umadb/templates/.claude/skills/build-state-change/references/umadb-query-patterns.md +78 -0
- package/stacks/umadb/templates/.claude/skills/build-state-view/SKILL.md +338 -0
- package/stacks/umadb/templates/build-kit/CLAUDE.md +94 -0
- package/stacks/umadb/templates/build-kit/lib/AGENT.md +47 -0
- package/stacks/umadb/templates/build-kit/lib/backend-prompt.md +169 -0
- package/stacks/umadb/templates/build-kit/lib/prompt.md +128 -0
- package/stacks/umadb/templates/root/.mvn/wrapper/maven-wrapper.properties +19 -0
- package/stacks/umadb/templates/root/README.md +48 -0
- package/stacks/umadb/templates/root/docker-compose.yml +29 -0
- package/stacks/umadb/templates/root/mvnw +259 -0
- package/stacks/umadb/templates/root/mvnw.cmd +149 -0
- package/stacks/umadb/templates/root/pom.xml +151 -0
- package/stacks/umadb/templates/root/src/main/java/io/umadb/quickstart/QuickstartApplication.java +12 -0
- package/stacks/umadb/templates/root/src/main/java/io/umadb/quickstart/config/UmaDbConfig.java +39 -0
- package/stacks/umadb/templates/root/src/main/java/io/umadb/quickstart/eventstore/DecisionModelLoader.java +76 -0
- package/stacks/umadb/templates/root/src/main/java/io/umadb/quickstart/eventstore/EventCodec.java +40 -0
- package/stacks/umadb/templates/root/src/main/java/io/umadb/quickstart/eventstore/EventDispatcher.java +100 -0
- package/stacks/umadb/templates/root/src/main/java/io/umadb/quickstart/eventstore/OptimisticConcurrencyException.java +14 -0
- package/stacks/umadb/templates/root/src/main/java/io/umadb/quickstart/eventstore/SliceEventListener.java +23 -0
- package/stacks/umadb/templates/root/src/main/resources/application.properties +17 -0
- package/stacks/umadb/templates/root/src/test/java/io/umadb/quickstart/testsupport/InMemoryUmaDbClient.java +135 -0
- package/stacks/umadb/templates/root/src/test/resources/application.properties +8 -0
|
@@ -0,0 +1,169 @@
|
|
|
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
|
+
## Context Boundary (READ FIRST — NON-NEGOTIABLE)
|
|
8
|
+
|
|
9
|
+
You work within **exactly ONE context at a time** — the one named in `.build-kit/.slices/current_context.json`.
|
|
10
|
+
|
|
11
|
+
- **ONLY** look for and build slices inside `.build-kit/.slices/<currentContext>/`.
|
|
12
|
+
- **NEVER** read, scan, or build slices from any other context directory, even if it has "Planned" slices, and even if the current context has no work left.
|
|
13
|
+
- A "Planned" slice in a *different* context (e.g. "Rename organization" while you are in "Board Invitations") is **NOT yours to build**. Ignore it completely.
|
|
14
|
+
- If the current context has no "Planned" slice, you are **done for this iteration** — reply `<promise>NO_TASKS</promise>` and stop. Do not go looking elsewhere. The context is only ever changed on the board, never by you.
|
|
15
|
+
|
|
16
|
+
## Your Task
|
|
17
|
+
|
|
18
|
+
0. Do not read the entire code base. Focus on the tasks in this description.
|
|
19
|
+
1. Read `.build-kit/.slices/current_context.json` to find the active context name, then read `.build-kit/.slices/<contextName>/index.json`. Every item in status "planned" is a task.
|
|
20
|
+
2. Read the progress log at `progress.txt` (check Codebase Patterns section first)
|
|
21
|
+
3. Make sure you are on the right branch "feature/<slicename>", if unsure, start from main.
|
|
22
|
+
5. Pick the **highest priority** slice where status is **exactly** "Planned" (case insensitive). This becomes your PRD. Set the status "InProgress" in the index.json **and** update the slice status on the eventmodelers board using the `update-slice-status` skill (or MCP if available).
|
|
23
|
+
**IMPORTANT: Only work on slices with status "Planned" in the CURRENT context. Never pick up a slice that is "InProgress", "Done", "Blocked", "Created", or any other status — even if it looks incomplete. If no slice has status "Planned" in the current context, reply with:**
|
|
24
|
+
<promise>NO_TASKS</promise> and stop immediately. Do not work on other slices and do not switch to another context.
|
|
25
|
+
**Claim conflict**: the board rejects the status update if the slice is already in the target status — this is expected: another agent claimed it first, racing you for the same slice. This is NOT an error. Do not stop, do not retry the same slice. Re-read `index.json` (or re-fetch via `load-slice`), pick the next-highest-priority slice still "Planned", and try claiming that one instead. Repeat until a claim succeeds or no "Planned" slice remains, in which case reply `<promise>NO_TASKS</promise>`.
|
|
26
|
+
6. Pick the slice definition from `.build-kit/.slices/<contextName>/<folder>/slice.json` as defined in the prd. Never work on more than one slice per iteration.
|
|
27
|
+
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
|
|
28
|
+
7. Define the slice type and load the matching skill:
|
|
29
|
+
- Write slice (has commands, no processors) → `build-state-change`
|
|
30
|
+
- Read slice (has readModel / information flow) → `build-state-view`
|
|
31
|
+
- Translation slice (`sliceType === "TRANSLATION"`) → read `description` and `notes` from slice.json for hints; default to `build-automation` if nothing else is specified
|
|
32
|
+
- Automation slice (processors-array is not empty) → `build-automation`
|
|
33
|
+
8. Write a short progress one liner after each step to progress.txt
|
|
34
|
+
9. Analyze and Implement that single slice, make use of the skills in the skills directory, but also your previsously collected
|
|
35
|
+
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.
|
|
36
|
+
10. The slice in the json is always true, the code follows what is defined in the json
|
|
37
|
+
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
|
|
38
|
+
fulfills the slice.json. There must be no specification in json, that has no equivalent in code.
|
|
39
|
+
12. make sure to write the ui-prompt.md as defined if defined in the skill
|
|
40
|
+
13. Run quality checks — it is enough to run the tests for the slice only, not all tests:
|
|
41
|
+
- Compile: `./mvnw compile -q`
|
|
42
|
+
- Test: `./mvnw test -Dtest="<SliceName>*" -q`
|
|
43
|
+
If the tests for the slice are not yet named predictably, run `./mvnw test -q` and check for failures.
|
|
44
|
+
15. If checks pass, commit ALL changes with message: `feat: [Slice Name]` and merge back to main as FF merge ( update
|
|
45
|
+
first )
|
|
46
|
+
16. Update the PRD to set `status: Done` for the completed story in index.json **and** update the slice status on the eventmodelers board using the `update-slice-status` skill (or MCP if available).
|
|
47
|
+
17. Append your progress to `progress.txt` after each step in the iteration.
|
|
48
|
+
18. append your new learnings to `.build-kit/AGENTS.md` in a compressed form, reusable for future iterations. Only add learnings if they are not already there.
|
|
49
|
+
19. Finish the iteration.
|
|
50
|
+
|
|
51
|
+
## Escalating Ambiguity
|
|
52
|
+
|
|
53
|
+
**If the slice's requirements are genuinely ambiguous, contradictory, or missing a decision you need
|
|
54
|
+
in order to proceed — do not guess, and do not build anyway.** Invoke `/request-feedback` with the
|
|
55
|
+
specific question; it posts the question as a comment on the slice and marks it `Blocked` on the
|
|
56
|
+
board (overriding the `InProgress` set earlier), then stop this iteration without finishing the
|
|
57
|
+
build — reply `<promise>DONE</promise>` as if the iteration's work was to raise the question, not to
|
|
58
|
+
implement the slice. This is an escalation path, not a routine step — read the slice.json and the
|
|
59
|
+
matching build skill's own instructions fully first; most slices are fully specified and need none of
|
|
60
|
+
this.
|
|
61
|
+
|
|
62
|
+
## Progress Report Format
|
|
63
|
+
|
|
64
|
+
APPEND to progress.txt (never replace, always append):
|
|
65
|
+
|
|
66
|
+
```
|
|
67
|
+
## [Date/Time] - [Slice]
|
|
68
|
+
|
|
69
|
+
- What was implemented
|
|
70
|
+
- Files changed
|
|
71
|
+
- **Learnings for future iterations:**
|
|
72
|
+
- Patterns discovered (e.g., "this codebase uses X for Y")
|
|
73
|
+
- Gotchas encountered (e.g., "don't forget to update Z when changing W")
|
|
74
|
+
- Useful context (e.g., "the evaluation panel is in component X")
|
|
75
|
+
---
|
|
76
|
+
```
|
|
77
|
+
|
|
78
|
+
The learnings section is critical - it helps future iterations avoid repeating mistakes and understand the codebase
|
|
79
|
+
better.
|
|
80
|
+
|
|
81
|
+
## Consolidate Patterns
|
|
82
|
+
|
|
83
|
+
If you discover a **reusable pattern** that future iterations should know, add it to the `## Codebase Patterns`
|
|
84
|
+
section at the TOP of progress.txt (create it if it doesn't exist). This section should consolidate the most
|
|
85
|
+
important learnings:
|
|
86
|
+
|
|
87
|
+
```
|
|
88
|
+
## Codebase Patterns
|
|
89
|
+
- Example: Register every new event's type string in CqrsConfiguration.eventTypeResolver() as part of the slice
|
|
90
|
+
- Example: Automations must catch CommandSubjectAlreadyExistsException/CommandSubjectDoesNotExistException locally
|
|
91
|
+
- Example: Export write-model records as package-private unless another slice legitimately needs them
|
|
92
|
+
```
|
|
93
|
+
|
|
94
|
+
Only add patterns that are **general and reusable**, not story-specific details.
|
|
95
|
+
|
|
96
|
+
## Update AGENTS.md Files
|
|
97
|
+
|
|
98
|
+
Before committing, check if any edited files have learnings worth preserving in nearby AGENTS.md files:
|
|
99
|
+
|
|
100
|
+
1. **Identify directories with edited files** - Look at which directories you modified
|
|
101
|
+
3. **Add valuable learnings that apply to all tasks** to the Agents.md - If you discovered something future developers/agents should know:
|
|
102
|
+
- API patterns or conventions specific to that module
|
|
103
|
+
- Gotchas or non-obvious requirements
|
|
104
|
+
- Dependencies between files
|
|
105
|
+
- Testing approaches for that area
|
|
106
|
+
- Configuration or environment requirements
|
|
107
|
+
|
|
108
|
+
**Examples of good AGENTS.md additions:**
|
|
109
|
+
|
|
110
|
+
- "When modifying X, also update Y to keep them in sync"
|
|
111
|
+
- "This module uses pattern Z for all API calls"
|
|
112
|
+
- "Tests require the dev server running on PORT 3000"
|
|
113
|
+
- "Field names must match the template exactly"
|
|
114
|
+
|
|
115
|
+
**Do NOT add:**
|
|
116
|
+
|
|
117
|
+
- Slice specific implementation details
|
|
118
|
+
- Story-specific implementation details
|
|
119
|
+
- Temporary debugging notes
|
|
120
|
+
- Information already in progress.txt
|
|
121
|
+
- Task specific learnings
|
|
122
|
+
|
|
123
|
+
Only update AGENTS.md if you have **genuinely reusable knowledge** that would help future work
|
|
124
|
+
|
|
125
|
+
## Quality Requirements
|
|
126
|
+
|
|
127
|
+
- ALL commits must pass your project's quality checks
|
|
128
|
+
- Compile: `./mvnw compile -q`
|
|
129
|
+
- Test: `./mvnw test -Dtest="<SliceName>*" -q`
|
|
130
|
+
- Do NOT commit broken code
|
|
131
|
+
- Keep changes focused and minimal
|
|
132
|
+
- Follow existing code patterns
|
|
133
|
+
|
|
134
|
+
## Skills
|
|
135
|
+
|
|
136
|
+
Use the provided skills in the skills folder as guidance.
|
|
137
|
+
Update skill definitions if you find an improvement you can make.
|
|
138
|
+
|
|
139
|
+
## Specifications
|
|
140
|
+
|
|
141
|
+
For every specification added to the Slice, you need to implement one use executable Specification in Code.
|
|
142
|
+
|
|
143
|
+
A Slice is not complete if specifications are missing or can´t be executed.
|
|
144
|
+
|
|
145
|
+
## Stop Condition
|
|
146
|
+
|
|
147
|
+
**After completing ONE slice, always stop — regardless of whether more slices are Planned.** The ralph loop will invoke you again for the next slice. Never chain multiple slices in one iteration.
|
|
148
|
+
|
|
149
|
+
If the slice was completed and committed successfully, reply with:
|
|
150
|
+
<promise>DONE</promise>
|
|
151
|
+
|
|
152
|
+
If no slice has status "Planned" in the current context, reply with:
|
|
153
|
+
<promise>NO_TASKS</promise>
|
|
154
|
+
(Do NOT switch to another context to find work — stop here.)
|
|
155
|
+
|
|
156
|
+
If ALL slices in the current context are Done, reply with:
|
|
157
|
+
<promise>COMPLETE</promise>
|
|
158
|
+
|
|
159
|
+
## Important
|
|
160
|
+
|
|
161
|
+
- If `.build-kit/.eventmodelers/config.json` is absent, skip all platform communication (MCP calls, `update-slice-status`, board sync) and continue working locally.
|
|
162
|
+
- Work on ONE slice per iteration
|
|
163
|
+
- Commit frequently
|
|
164
|
+
- update progress.txt frequently
|
|
165
|
+
- Read the Codebase Patterns section in progress.txt before starting
|
|
166
|
+
|
|
167
|
+
## When an iteration completes
|
|
168
|
+
|
|
169
|
+
Use all the key learnings from the progress.txt and update the `.build-kit/AGENTS.md` file with those learnings.
|
|
@@ -0,0 +1,128 @@
|
|
|
1
|
+
# Agent Task Instructions
|
|
2
|
+
|
|
3
|
+
You are an autonomous agent reacting to slice status change events on an Eventmodelers board.
|
|
4
|
+
|
|
5
|
+
## Your Loop
|
|
6
|
+
|
|
7
|
+
1. Read `AGENT.md` to load accumulated learnings before doing anything else.
|
|
8
|
+
2. Read `.build-kit/tasks.json`.
|
|
9
|
+
3. If `tasks.json` is empty or missing, reply with:
|
|
10
|
+
<promise>IDLE</promise>
|
|
11
|
+
and stop.
|
|
12
|
+
4. Pick the **oldest task** (earliest `createdAt`).
|
|
13
|
+
5. Execute the task — see the Execution section below.
|
|
14
|
+
6. After execution, remove that task from the array and write `.build-kit/tasks.json` back.
|
|
15
|
+
7. Append a progress entry to `progress.txt` (create if missing).
|
|
16
|
+
8. Update `AGENT.md` with any new reusable learnings discovered this iteration.
|
|
17
|
+
9. Reply normally so the next iteration can pick up the next task.
|
|
18
|
+
|
|
19
|
+
## Execution
|
|
20
|
+
|
|
21
|
+
Each task has a single `payload` of type `SliceChangedPayload`:
|
|
22
|
+
|
|
23
|
+
```
|
|
24
|
+
{
|
|
25
|
+
event: "slice:changed"
|
|
26
|
+
organizationId: string | null
|
|
27
|
+
boardId: string
|
|
28
|
+
sliceId: string ← SLICE_BORDER node UUID
|
|
29
|
+
sliceTitle: string | null
|
|
30
|
+
sliceStatus: string | null ← e.g. "InProgress", "Done", "Blocked"
|
|
31
|
+
timestamp: number
|
|
32
|
+
}
|
|
33
|
+
```
|
|
34
|
+
|
|
35
|
+
### Step 1 — Load credentials
|
|
36
|
+
|
|
37
|
+
Run `/connect` to resolve `TOKEN`, `BOARD_ID`, `ORG_ID`, and `BASE_URL` from `.eventmodelers/config.json`.
|
|
38
|
+
|
|
39
|
+
### Step 2 — Load the slice
|
|
40
|
+
|
|
41
|
+
Run `/load-slice sliceId=<payload.sliceId>` to fetch full slice details (title, status, raw node record).
|
|
42
|
+
|
|
43
|
+
### Step 3 — Act on the change
|
|
44
|
+
|
|
45
|
+
Inspect the `sliceStatus` in the payload:
|
|
46
|
+
|
|
47
|
+
#### `Planned` — build the slice
|
|
48
|
+
|
|
49
|
+
This is the build trigger. Setting `InProgress` and building are one atomic step:
|
|
50
|
+
|
|
51
|
+
**If the slice's requirements are genuinely ambiguous, contradictory, or missing a decision you need in order to proceed — do not guess, and do not build anyway.** Invoke `/request-feedback` with the specific question; it posts the question as a comment on the slice and marks it `Blocked` (superseding the `InProgress` set in step 1), then drop this task without finishing the build. This is an escalation path, not a routine step — most slices are fully specified.
|
|
52
|
+
|
|
53
|
+
1. Immediately call `/update-slice-status` to set the slice to `InProgress` on the board.
|
|
54
|
+
|
|
55
|
+
**Claim conflict**: if this call reports the slice is already in `InProgress` (or any status other than `Planned`), another agent already claimed it first — this is expected, not an error. Log it in `progress.txt`, drop this task without building, and continue the loop (the next task will naturally cover the next slice). Do not retry.
|
|
56
|
+
|
|
57
|
+
2. Read the slice definition from `.build-kit/.slices/<contextSlug>/<sliceFolder>/slice.json` (written by `/load-slice`).
|
|
58
|
+
|
|
59
|
+
3. Determine the **slice type** from the slice.json:
|
|
60
|
+
- **Translation** — `sliceType === "TRANSLATION"` → read `description` and `notes` from slice.json for hints; default to `/build-automation` if nothing else is specified
|
|
61
|
+
- **Automation** — `processors` array is non-empty → invoke `/build-automation`
|
|
62
|
+
- **State-view** — `projections` or `queries` array is non-empty → invoke `/build-state-view`
|
|
63
|
+
- **State-change** — default (has `commands` / `events`) → invoke `/build-state-change`
|
|
64
|
+
|
|
65
|
+
4. Invoke the matching skill and follow its instructions **completely**. Do NOT implement the slice manually.
|
|
66
|
+
|
|
67
|
+
5. **Verify against slice.json**: Cross-check the implementation — every command field, event field, and specification in slice.json must appear in the code. No invented fields — if it is not in slice.json, it must not be in the code.
|
|
68
|
+
|
|
69
|
+
6. Run quality checks:
|
|
70
|
+
- Compile: `./mvnw compile -q`
|
|
71
|
+
- Test (slice only): `./mvnw test -Dtest="<SliceName>*" -q`
|
|
72
|
+
|
|
73
|
+
7. If checks pass, commit all changes with message: `feat: [Slice Name]`.
|
|
74
|
+
|
|
75
|
+
8. Call `/update-slice-status` to set the slice to `Done` on the board.
|
|
76
|
+
|
|
77
|
+
#### `InProgress`
|
|
78
|
+
Another agent is already building this slice. Log it and skip — do not build.
|
|
79
|
+
|
|
80
|
+
#### `Done`
|
|
81
|
+
Summarize what was completed and update `progress.txt`.
|
|
82
|
+
|
|
83
|
+
#### `Blocked`
|
|
84
|
+
Log the blocker in `progress.txt`.
|
|
85
|
+
|
|
86
|
+
#### `Review`
|
|
87
|
+
Fetch slice details and prepare a review summary in `progress.txt`.
|
|
88
|
+
|
|
89
|
+
#### Any other status (`Created`, etc.)
|
|
90
|
+
Load the slice and log the state transition in `progress.txt`. No build action.
|
|
91
|
+
|
|
92
|
+
Use the skills available in `.claude/skills/` to interact with the board.
|
|
93
|
+
|
|
94
|
+
## Updating tasks.json
|
|
95
|
+
|
|
96
|
+
After completing a task, remove it from the array and write the updated array back to `.build-kit/tasks.json`. If the array is now empty, write `[]`.
|
|
97
|
+
|
|
98
|
+
## Progress Report Format
|
|
99
|
+
|
|
100
|
+
APPEND to `progress.txt` (never replace):
|
|
101
|
+
```
|
|
102
|
+
## [ISO timestamp] — Task [task.id]
|
|
103
|
+
|
|
104
|
+
Slice: [sliceTitle] ([sliceId])
|
|
105
|
+
Status change: [sliceStatus]
|
|
106
|
+
|
|
107
|
+
Action taken:
|
|
108
|
+
- [what was done in response to the slice change]
|
|
109
|
+
|
|
110
|
+
Learnings:
|
|
111
|
+
- [any patterns, gotchas, or reusable knowledge discovered]
|
|
112
|
+
---
|
|
113
|
+
```
|
|
114
|
+
|
|
115
|
+
## Stop Condition
|
|
116
|
+
|
|
117
|
+
If `.build-kit/tasks.json` is empty (`[]`) or does not exist, reply with:
|
|
118
|
+
<promise>IDLE</promise>
|
|
119
|
+
|
|
120
|
+
## Updating AGENT.md
|
|
121
|
+
|
|
122
|
+
After completing a task, add any **reusable** learnings to `AGENT.md` — patterns, gotchas, API quirks, or skill behaviour that future iterations should know. Only add things that are general and applicable beyond this single task. Do not duplicate what is already there.
|
|
123
|
+
|
|
124
|
+
## Important
|
|
125
|
+
|
|
126
|
+
- Process **one task per iteration**.
|
|
127
|
+
- Read `AGENT.md` first — it contains patterns from previous iterations.
|
|
128
|
+
- Always start with `/connect` if credentials are not yet loaded.
|
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
# Kurrent Quickstart
|
|
2
|
+
|
|
3
|
+
A minimal event-sourced application backed by [KurrentDB](https://kurrent.io) (formerly EventStoreDB)
|
|
4
|
+
for events and PostgreSQL for read models. Plain Java (no Kotlin), Spring Boot, Maven.
|
|
5
|
+
|
|
6
|
+
Unlike the OpenCQRS or Axon kits, there is no CQRS framework layer here — KurrentDB is just the event
|
|
7
|
+
store, and this project's own `decide`/`evolve` convention (see `.build-kit/CLAUDE.md`) implements
|
|
8
|
+
command handling directly against the [KurrentDB Java client](https://docs.kurrent.io/clients/java/).
|
|
9
|
+
|
|
10
|
+
## Prerequisites
|
|
11
|
+
|
|
12
|
+
- Java 21 or higher
|
|
13
|
+
- Maven 3.9+ (or use the bundled `./mvnw`)
|
|
14
|
+
- Docker (for running KurrentDB and PostgreSQL)
|
|
15
|
+
|
|
16
|
+
## Getting Started
|
|
17
|
+
|
|
18
|
+
Start KurrentDB and PostgreSQL:
|
|
19
|
+
|
|
20
|
+
```bash
|
|
21
|
+
docker-compose up -d
|
|
22
|
+
```
|
|
23
|
+
|
|
24
|
+
Then run the application:
|
|
25
|
+
|
|
26
|
+
```bash
|
|
27
|
+
./mvnw spring-boot:run
|
|
28
|
+
```
|
|
29
|
+
|
|
30
|
+
Alternatively, run the `QuickstartApplication` class from your IDE.
|
|
31
|
+
|
|
32
|
+
## Using the Application
|
|
33
|
+
|
|
34
|
+
The app listens on [http://localhost:8080](http://localhost:8080). KurrentDB's Admin UI is at
|
|
35
|
+
[http://localhost:2113](http://localhost:2113) (insecure/no-auth local dev mode).
|
|
36
|
+
|
|
37
|
+
## Project Structure
|
|
38
|
+
|
|
39
|
+
Slices live under `src/main/java/{basePackage}/slices/{context}/{slicename}/` — see `.build-kit/CLAUDE.md`
|
|
40
|
+
for the conventions this project follows and how new slices get built from the event model board.
|
|
41
|
+
|
|
42
|
+
## Useful resources
|
|
43
|
+
|
|
44
|
+
- [KurrentDB Documentation](https://docs.kurrent.io)
|
|
45
|
+
- [KurrentDB Java Client](https://docs.kurrent.io/clients/java/)
|
|
46
|
+
- [KurrentDB Java Client — Persistent Subscriptions](https://docs.kurrent.io/clients/java/persistent-subscriptions.html)
|
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
services:
|
|
2
|
+
postgres:
|
|
3
|
+
image: postgres:17
|
|
4
|
+
ports:
|
|
5
|
+
- "5432:5432"
|
|
6
|
+
environment:
|
|
7
|
+
- POSTGRES_DB=quickstart
|
|
8
|
+
- POSTGRES_USER=quickstart
|
|
9
|
+
- POSTGRES_PASSWORD=quickstart
|
|
10
|
+
volumes:
|
|
11
|
+
- postgres-data:/var/lib/postgresql/data
|
|
12
|
+
healthcheck:
|
|
13
|
+
test: ["CMD-SHELL", "pg_isready -U quickstart"]
|
|
14
|
+
interval: 10s
|
|
15
|
+
timeout: 5s
|
|
16
|
+
retries: 10
|
|
17
|
+
|
|
18
|
+
kurrentdb:
|
|
19
|
+
image: docker.kurrent.io/kurrent-latest/kurrentdb:latest
|
|
20
|
+
environment:
|
|
21
|
+
- KURRENTDB_CLUSTER_SIZE=1
|
|
22
|
+
- KURRENTDB_RUN_PROJECTIONS=All
|
|
23
|
+
- KURRENTDB_START_STANDARD_PROJECTIONS=true
|
|
24
|
+
- KURRENTDB_NODE_PORT=2113
|
|
25
|
+
- KURRENTDB_INSECURE=true
|
|
26
|
+
- KURRENTDB_ENABLE_ATOM_PUB_OVER_HTTP=true
|
|
27
|
+
ports:
|
|
28
|
+
- "2113:2113"
|
|
29
|
+
volumes:
|
|
30
|
+
- kurrentdb-data:/var/lib/kurrentdb
|
|
31
|
+
- kurrentdb-logs:/var/log/kurrentdb
|
|
32
|
+
healthcheck:
|
|
33
|
+
test: ["CMD", "wget", "-qO-", "http://localhost:2113/health/live"]
|
|
34
|
+
interval: 10s
|
|
35
|
+
timeout: 5s
|
|
36
|
+
retries: 10
|
|
37
|
+
start_period: 15s
|
|
38
|
+
|
|
39
|
+
volumes:
|
|
40
|
+
postgres-data:
|
|
41
|
+
driver: local
|
|
42
|
+
kurrentdb-data:
|
|
43
|
+
driver: local
|
|
44
|
+
kurrentdb-logs:
|
|
45
|
+
driver: local
|
|
@@ -0,0 +1,259 @@
|
|
|
1
|
+
#!/bin/sh
|
|
2
|
+
# ----------------------------------------------------------------------------
|
|
3
|
+
# Licensed to the Apache Software Foundation (ASF) under one
|
|
4
|
+
# or more contributor license agreements. See the NOTICE file
|
|
5
|
+
# distributed with this work for additional information
|
|
6
|
+
# regarding copyright ownership. The ASF licenses this file
|
|
7
|
+
# to you under the Apache License, Version 2.0 (the
|
|
8
|
+
# "License"); you may not use this file except in compliance
|
|
9
|
+
# with the License. You may obtain a copy of the License at
|
|
10
|
+
#
|
|
11
|
+
# http://www.apache.org/licenses/LICENSE-2.0
|
|
12
|
+
#
|
|
13
|
+
# Unless required by applicable law or agreed to in writing,
|
|
14
|
+
# software distributed under the License is distributed on an
|
|
15
|
+
# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
|
|
16
|
+
# KIND, either express or implied. See the License for the
|
|
17
|
+
# specific language governing permissions and limitations
|
|
18
|
+
# under the License.
|
|
19
|
+
# ----------------------------------------------------------------------------
|
|
20
|
+
|
|
21
|
+
# ----------------------------------------------------------------------------
|
|
22
|
+
# Apache Maven Wrapper startup batch script, version 3.3.2
|
|
23
|
+
#
|
|
24
|
+
# Optional ENV vars
|
|
25
|
+
# -----------------
|
|
26
|
+
# JAVA_HOME - location of a JDK home dir, required when download maven via java source
|
|
27
|
+
# MVNW_REPOURL - repo url base for downloading maven distribution
|
|
28
|
+
# MVNW_USERNAME/MVNW_PASSWORD - user and password for downloading maven
|
|
29
|
+
# MVNW_VERBOSE - true: enable verbose log; debug: trace the mvnw script; others: silence the output
|
|
30
|
+
# ----------------------------------------------------------------------------
|
|
31
|
+
|
|
32
|
+
set -euf
|
|
33
|
+
[ "${MVNW_VERBOSE-}" != debug ] || set -x
|
|
34
|
+
|
|
35
|
+
# OS specific support.
|
|
36
|
+
native_path() { printf %s\\n "$1"; }
|
|
37
|
+
case "$(uname)" in
|
|
38
|
+
CYGWIN* | MINGW*)
|
|
39
|
+
[ -z "${JAVA_HOME-}" ] || JAVA_HOME="$(cygpath --unix "$JAVA_HOME")"
|
|
40
|
+
native_path() { cygpath --path --windows "$1"; }
|
|
41
|
+
;;
|
|
42
|
+
esac
|
|
43
|
+
|
|
44
|
+
# set JAVACMD and JAVACCMD
|
|
45
|
+
set_java_home() {
|
|
46
|
+
# For Cygwin and MinGW, ensure paths are in Unix format before anything is touched
|
|
47
|
+
if [ -n "${JAVA_HOME-}" ]; then
|
|
48
|
+
if [ -x "$JAVA_HOME/jre/sh/java" ]; then
|
|
49
|
+
# IBM's JDK on AIX uses strange locations for the executables
|
|
50
|
+
JAVACMD="$JAVA_HOME/jre/sh/java"
|
|
51
|
+
JAVACCMD="$JAVA_HOME/jre/sh/javac"
|
|
52
|
+
else
|
|
53
|
+
JAVACMD="$JAVA_HOME/bin/java"
|
|
54
|
+
JAVACCMD="$JAVA_HOME/bin/javac"
|
|
55
|
+
|
|
56
|
+
if [ ! -x "$JAVACMD" ] || [ ! -x "$JAVACCMD" ]; then
|
|
57
|
+
echo "The JAVA_HOME environment variable is not defined correctly, so mvnw cannot run." >&2
|
|
58
|
+
echo "JAVA_HOME is set to \"$JAVA_HOME\", but \"\$JAVA_HOME/bin/java\" or \"\$JAVA_HOME/bin/javac\" does not exist." >&2
|
|
59
|
+
return 1
|
|
60
|
+
fi
|
|
61
|
+
fi
|
|
62
|
+
else
|
|
63
|
+
JAVACMD="$(
|
|
64
|
+
'set' +e
|
|
65
|
+
'unset' -f command 2>/dev/null
|
|
66
|
+
'command' -v java
|
|
67
|
+
)" || :
|
|
68
|
+
JAVACCMD="$(
|
|
69
|
+
'set' +e
|
|
70
|
+
'unset' -f command 2>/dev/null
|
|
71
|
+
'command' -v javac
|
|
72
|
+
)" || :
|
|
73
|
+
|
|
74
|
+
if [ ! -x "${JAVACMD-}" ] || [ ! -x "${JAVACCMD-}" ]; then
|
|
75
|
+
echo "The java/javac command does not exist in PATH nor is JAVA_HOME set, so mvnw cannot run." >&2
|
|
76
|
+
return 1
|
|
77
|
+
fi
|
|
78
|
+
fi
|
|
79
|
+
}
|
|
80
|
+
|
|
81
|
+
# hash string like Java String::hashCode
|
|
82
|
+
hash_string() {
|
|
83
|
+
str="${1:-}" h=0
|
|
84
|
+
while [ -n "$str" ]; do
|
|
85
|
+
char="${str%"${str#?}"}"
|
|
86
|
+
h=$(((h * 31 + $(LC_CTYPE=C printf %d "'$char")) % 4294967296))
|
|
87
|
+
str="${str#?}"
|
|
88
|
+
done
|
|
89
|
+
printf %x\\n $h
|
|
90
|
+
}
|
|
91
|
+
|
|
92
|
+
verbose() { :; }
|
|
93
|
+
[ "${MVNW_VERBOSE-}" != true ] || verbose() { printf %s\\n "${1-}"; }
|
|
94
|
+
|
|
95
|
+
die() {
|
|
96
|
+
printf %s\\n "$1" >&2
|
|
97
|
+
exit 1
|
|
98
|
+
}
|
|
99
|
+
|
|
100
|
+
trim() {
|
|
101
|
+
# MWRAPPER-139:
|
|
102
|
+
# Trims trailing and leading whitespace, carriage returns, tabs, and linefeeds.
|
|
103
|
+
# Needed for removing poorly interpreted newline sequences when running in more
|
|
104
|
+
# exotic environments such as mingw bash on Windows.
|
|
105
|
+
printf "%s" "${1}" | tr -d '[:space:]'
|
|
106
|
+
}
|
|
107
|
+
|
|
108
|
+
# parse distributionUrl and optional distributionSha256Sum, requires .mvn/wrapper/maven-wrapper.properties
|
|
109
|
+
while IFS="=" read -r key value; do
|
|
110
|
+
case "${key-}" in
|
|
111
|
+
distributionUrl) distributionUrl=$(trim "${value-}") ;;
|
|
112
|
+
distributionSha256Sum) distributionSha256Sum=$(trim "${value-}") ;;
|
|
113
|
+
esac
|
|
114
|
+
done <"${0%/*}/.mvn/wrapper/maven-wrapper.properties"
|
|
115
|
+
[ -n "${distributionUrl-}" ] || die "cannot read distributionUrl property in ${0%/*}/.mvn/wrapper/maven-wrapper.properties"
|
|
116
|
+
|
|
117
|
+
case "${distributionUrl##*/}" in
|
|
118
|
+
maven-mvnd-*bin.*)
|
|
119
|
+
MVN_CMD=mvnd.sh _MVNW_REPO_PATTERN=/maven/mvnd/
|
|
120
|
+
case "${PROCESSOR_ARCHITECTURE-}${PROCESSOR_ARCHITEW6432-}:$(uname -a)" in
|
|
121
|
+
*AMD64:CYGWIN* | *AMD64:MINGW*) distributionPlatform=windows-amd64 ;;
|
|
122
|
+
:Darwin*x86_64) distributionPlatform=darwin-amd64 ;;
|
|
123
|
+
:Darwin*arm64) distributionPlatform=darwin-aarch64 ;;
|
|
124
|
+
:Linux*x86_64*) distributionPlatform=linux-amd64 ;;
|
|
125
|
+
*)
|
|
126
|
+
echo "Cannot detect native platform for mvnd on $(uname)-$(uname -m), use pure java version" >&2
|
|
127
|
+
distributionPlatform=linux-amd64
|
|
128
|
+
;;
|
|
129
|
+
esac
|
|
130
|
+
distributionUrl="${distributionUrl%-bin.*}-$distributionPlatform.zip"
|
|
131
|
+
;;
|
|
132
|
+
maven-mvnd-*) MVN_CMD=mvnd.sh _MVNW_REPO_PATTERN=/maven/mvnd/ ;;
|
|
133
|
+
*) MVN_CMD="mvn${0##*/mvnw}" _MVNW_REPO_PATTERN=/org/apache/maven/ ;;
|
|
134
|
+
esac
|
|
135
|
+
|
|
136
|
+
# apply MVNW_REPOURL and calculate MAVEN_HOME
|
|
137
|
+
# maven home pattern: ~/.m2/wrapper/dists/{apache-maven-<version>,maven-mvnd-<version>-<platform>}/<hash>
|
|
138
|
+
[ -z "${MVNW_REPOURL-}" ] || distributionUrl="$MVNW_REPOURL$_MVNW_REPO_PATTERN${distributionUrl#*"$_MVNW_REPO_PATTERN"}"
|
|
139
|
+
distributionUrlName="${distributionUrl##*/}"
|
|
140
|
+
distributionUrlNameMain="${distributionUrlName%.*}"
|
|
141
|
+
distributionUrlNameMain="${distributionUrlNameMain%-bin}"
|
|
142
|
+
MAVEN_USER_HOME="${MAVEN_USER_HOME:-${HOME}/.m2}"
|
|
143
|
+
MAVEN_HOME="${MAVEN_USER_HOME}/wrapper/dists/${distributionUrlNameMain-}/$(hash_string "$distributionUrl")"
|
|
144
|
+
|
|
145
|
+
exec_maven() {
|
|
146
|
+
unset MVNW_VERBOSE MVNW_USERNAME MVNW_PASSWORD MVNW_REPOURL || :
|
|
147
|
+
exec "$MAVEN_HOME/bin/$MVN_CMD" "$@" || die "cannot exec $MAVEN_HOME/bin/$MVN_CMD"
|
|
148
|
+
}
|
|
149
|
+
|
|
150
|
+
if [ -d "$MAVEN_HOME" ]; then
|
|
151
|
+
verbose "found existing MAVEN_HOME at $MAVEN_HOME"
|
|
152
|
+
exec_maven "$@"
|
|
153
|
+
fi
|
|
154
|
+
|
|
155
|
+
case "${distributionUrl-}" in
|
|
156
|
+
*?-bin.zip | *?maven-mvnd-?*-?*.zip) ;;
|
|
157
|
+
*) die "distributionUrl is not valid, must match *-bin.zip or maven-mvnd-*.zip, but found '${distributionUrl-}'" ;;
|
|
158
|
+
esac
|
|
159
|
+
|
|
160
|
+
# prepare tmp dir
|
|
161
|
+
if TMP_DOWNLOAD_DIR="$(mktemp -d)" && [ -d "$TMP_DOWNLOAD_DIR" ]; then
|
|
162
|
+
clean() { rm -rf -- "$TMP_DOWNLOAD_DIR"; }
|
|
163
|
+
trap clean HUP INT TERM EXIT
|
|
164
|
+
else
|
|
165
|
+
die "cannot create temp dir"
|
|
166
|
+
fi
|
|
167
|
+
|
|
168
|
+
mkdir -p -- "${MAVEN_HOME%/*}"
|
|
169
|
+
|
|
170
|
+
# Download and Install Apache Maven
|
|
171
|
+
verbose "Couldn't find MAVEN_HOME, downloading and installing it ..."
|
|
172
|
+
verbose "Downloading from: $distributionUrl"
|
|
173
|
+
verbose "Downloading to: $TMP_DOWNLOAD_DIR/$distributionUrlName"
|
|
174
|
+
|
|
175
|
+
# select .zip or .tar.gz
|
|
176
|
+
if ! command -v unzip >/dev/null; then
|
|
177
|
+
distributionUrl="${distributionUrl%.zip}.tar.gz"
|
|
178
|
+
distributionUrlName="${distributionUrl##*/}"
|
|
179
|
+
fi
|
|
180
|
+
|
|
181
|
+
# verbose opt
|
|
182
|
+
__MVNW_QUIET_WGET=--quiet __MVNW_QUIET_CURL=--silent __MVNW_QUIET_UNZIP=-q __MVNW_QUIET_TAR=''
|
|
183
|
+
[ "${MVNW_VERBOSE-}" != true ] || __MVNW_QUIET_WGET='' __MVNW_QUIET_CURL='' __MVNW_QUIET_UNZIP='' __MVNW_QUIET_TAR=v
|
|
184
|
+
|
|
185
|
+
# normalize http auth
|
|
186
|
+
case "${MVNW_PASSWORD:+has-password}" in
|
|
187
|
+
'') MVNW_USERNAME='' MVNW_PASSWORD='' ;;
|
|
188
|
+
has-password) [ -n "${MVNW_USERNAME-}" ] || MVNW_USERNAME='' MVNW_PASSWORD='' ;;
|
|
189
|
+
esac
|
|
190
|
+
|
|
191
|
+
if [ -z "${MVNW_USERNAME-}" ] && command -v wget >/dev/null; then
|
|
192
|
+
verbose "Found wget ... using wget"
|
|
193
|
+
wget ${__MVNW_QUIET_WGET:+"$__MVNW_QUIET_WGET"} "$distributionUrl" -O "$TMP_DOWNLOAD_DIR/$distributionUrlName" || die "wget: Failed to fetch $distributionUrl"
|
|
194
|
+
elif [ -z "${MVNW_USERNAME-}" ] && command -v curl >/dev/null; then
|
|
195
|
+
verbose "Found curl ... using curl"
|
|
196
|
+
curl ${__MVNW_QUIET_CURL:+"$__MVNW_QUIET_CURL"} -f -L -o "$TMP_DOWNLOAD_DIR/$distributionUrlName" "$distributionUrl" || die "curl: Failed to fetch $distributionUrl"
|
|
197
|
+
elif set_java_home; then
|
|
198
|
+
verbose "Falling back to use Java to download"
|
|
199
|
+
javaSource="$TMP_DOWNLOAD_DIR/Downloader.java"
|
|
200
|
+
targetZip="$TMP_DOWNLOAD_DIR/$distributionUrlName"
|
|
201
|
+
cat >"$javaSource" <<-END
|
|
202
|
+
public class Downloader extends java.net.Authenticator
|
|
203
|
+
{
|
|
204
|
+
protected java.net.PasswordAuthentication getPasswordAuthentication()
|
|
205
|
+
{
|
|
206
|
+
return new java.net.PasswordAuthentication( System.getenv( "MVNW_USERNAME" ), System.getenv( "MVNW_PASSWORD" ).toCharArray() );
|
|
207
|
+
}
|
|
208
|
+
public static void main( String[] args ) throws Exception
|
|
209
|
+
{
|
|
210
|
+
setDefault( new Downloader() );
|
|
211
|
+
java.nio.file.Files.copy( java.net.URI.create( args[0] ).toURL().openStream(), java.nio.file.Paths.get( args[1] ).toAbsolutePath().normalize() );
|
|
212
|
+
}
|
|
213
|
+
}
|
|
214
|
+
END
|
|
215
|
+
# For Cygwin/MinGW, switch paths to Windows format before running javac and java
|
|
216
|
+
verbose " - Compiling Downloader.java ..."
|
|
217
|
+
"$(native_path "$JAVACCMD")" "$(native_path "$javaSource")" || die "Failed to compile Downloader.java"
|
|
218
|
+
verbose " - Running Downloader.java ..."
|
|
219
|
+
"$(native_path "$JAVACMD")" -cp "$(native_path "$TMP_DOWNLOAD_DIR")" Downloader "$distributionUrl" "$(native_path "$targetZip")"
|
|
220
|
+
fi
|
|
221
|
+
|
|
222
|
+
# If specified, validate the SHA-256 sum of the Maven distribution zip file
|
|
223
|
+
if [ -n "${distributionSha256Sum-}" ]; then
|
|
224
|
+
distributionSha256Result=false
|
|
225
|
+
if [ "$MVN_CMD" = mvnd.sh ]; then
|
|
226
|
+
echo "Checksum validation is not supported for maven-mvnd." >&2
|
|
227
|
+
echo "Please disable validation by removing 'distributionSha256Sum' from your maven-wrapper.properties." >&2
|
|
228
|
+
exit 1
|
|
229
|
+
elif command -v sha256sum >/dev/null; then
|
|
230
|
+
if echo "$distributionSha256Sum $TMP_DOWNLOAD_DIR/$distributionUrlName" | sha256sum -c >/dev/null 2>&1; then
|
|
231
|
+
distributionSha256Result=true
|
|
232
|
+
fi
|
|
233
|
+
elif command -v shasum >/dev/null; then
|
|
234
|
+
if echo "$distributionSha256Sum $TMP_DOWNLOAD_DIR/$distributionUrlName" | shasum -a 256 -c >/dev/null 2>&1; then
|
|
235
|
+
distributionSha256Result=true
|
|
236
|
+
fi
|
|
237
|
+
else
|
|
238
|
+
echo "Checksum validation was requested but neither 'sha256sum' or 'shasum' are available." >&2
|
|
239
|
+
echo "Please install either command, or disable validation by removing 'distributionSha256Sum' from your maven-wrapper.properties." >&2
|
|
240
|
+
exit 1
|
|
241
|
+
fi
|
|
242
|
+
if [ $distributionSha256Result = false ]; then
|
|
243
|
+
echo "Error: Failed to validate Maven distribution SHA-256, your Maven distribution might be compromised." >&2
|
|
244
|
+
echo "If you updated your Maven version, you need to update the specified distributionSha256Sum property." >&2
|
|
245
|
+
exit 1
|
|
246
|
+
fi
|
|
247
|
+
fi
|
|
248
|
+
|
|
249
|
+
# unzip and move
|
|
250
|
+
if command -v unzip >/dev/null; then
|
|
251
|
+
unzip ${__MVNW_QUIET_UNZIP:+"$__MVNW_QUIET_UNZIP"} "$TMP_DOWNLOAD_DIR/$distributionUrlName" -d "$TMP_DOWNLOAD_DIR" || die "failed to unzip"
|
|
252
|
+
else
|
|
253
|
+
tar xzf${__MVNW_QUIET_TAR:+"$__MVNW_QUIET_TAR"} "$TMP_DOWNLOAD_DIR/$distributionUrlName" -C "$TMP_DOWNLOAD_DIR" || die "failed to untar"
|
|
254
|
+
fi
|
|
255
|
+
printf %s\\n "$distributionUrl" >"$TMP_DOWNLOAD_DIR/$distributionUrlNameMain/mvnw.url"
|
|
256
|
+
mv -- "$TMP_DOWNLOAD_DIR/$distributionUrlNameMain" "$MAVEN_HOME" || [ -d "$MAVEN_HOME" ] || die "fail to move MAVEN_HOME"
|
|
257
|
+
|
|
258
|
+
clean || :
|
|
259
|
+
exec_maven "$@"
|