@daonhan/ralph-core 0.1.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/Dockerfile ADDED
@@ -0,0 +1,49 @@
1
+ FROM node:22-bookworm
2
+
3
+ # System dependencies
4
+ RUN apt-get update && apt-get install -y \
5
+ git \
6
+ curl \
7
+ jq \
8
+ wget \
9
+ ca-certificates \
10
+ gnupg \
11
+ && rm -rf /var/lib/apt/lists/*
12
+
13
+ # .NET SDK 9 (Microsoft package feed for Debian 12 / Bookworm)
14
+ RUN wget -qO /tmp/ms.deb https://packages.microsoft.com/config/debian/12/packages-microsoft-prod.deb \
15
+ && dpkg -i /tmp/ms.deb \
16
+ && rm /tmp/ms.deb \
17
+ && apt-get update \
18
+ && apt-get install -y dotnet-sdk-9.0 \
19
+ && rm -rf /var/lib/apt/lists/*
20
+
21
+ # GitHub CLI
22
+ RUN curl -fsSL https://cli.github.com/packages/githubcli-archive-keyring.gpg \
23
+ | dd of=/usr/share/keyrings/githubcli-archive-keyring.gpg \
24
+ && echo "deb [arch=$(dpkg --print-architecture) signed-by=/usr/share/keyrings/githubcli-archive-keyring.gpg] https://cli.github.com/packages stable main" \
25
+ | tee /etc/apt/sources.list.d/github-cli.list > /dev/null \
26
+ && apt-get update \
27
+ && apt-get install -y gh \
28
+ && rm -rf /var/lib/apt/lists/*
29
+
30
+ RUN corepack enable
31
+
32
+ # Rename the base image's "node" user (UID 1000) to "agent".
33
+ # Keeps UID 1000 so --user 1000:1000 maps to the right home dir owner.
34
+ RUN usermod -d /home/agent -m -l agent node
35
+ USER agent
36
+
37
+ # Claude Code CLI
38
+ RUN curl -fsSL https://claude.ai/install.sh | bash
39
+
40
+ ENV PATH="/home/agent/.local/bin:$PATH" \
41
+ DOTNET_CLI_TELEMETRY_OPTOUT=1 \
42
+ DOTNET_NOLOGO=1
43
+
44
+ # main.ts bind-mounts the host workspace at /home/agent/workspace.
45
+ WORKDIR /home/agent/workspace
46
+
47
+ # Reset ENTRYPOINT so the orchestrator can pass a full `claude ...` argv.
48
+ ENTRYPOINT []
49
+ CMD ["claude"]
package/package.json ADDED
@@ -0,0 +1,43 @@
1
+ {
2
+ "name": "@daonhan/ralph-core",
3
+ "version": "0.1.0",
4
+ "description": "Claude Code AFK orchestration: iteration loop, docker runner, template renderer.",
5
+ "type": "module",
6
+ "main": "./dist/index.js",
7
+ "types": "./dist/index.d.ts",
8
+ "exports": {
9
+ ".": {
10
+ "types": "./dist/index.d.ts",
11
+ "import": "./dist/index.js"
12
+ },
13
+ "./loop": {
14
+ "types": "./dist/loop.d.ts",
15
+ "import": "./dist/loop.js"
16
+ },
17
+ "./runner": {
18
+ "types": "./dist/runner.d.ts",
19
+ "import": "./dist/runner.js"
20
+ },
21
+ "./stages": {
22
+ "types": "./dist/stages.d.ts",
23
+ "import": "./dist/stages.js"
24
+ }
25
+ },
26
+ "files": [
27
+ "dist",
28
+ "templates",
29
+ "Dockerfile",
30
+ "README.md"
31
+ ],
32
+ "engines": {
33
+ "node": ">=20"
34
+ },
35
+ "publishConfig": {
36
+ "access": "public"
37
+ },
38
+ "scripts": {
39
+ "build": "tsc -p tsconfig.json",
40
+ "clean": "node -e \"require('node:fs').rmSync('dist',{recursive:true,force:true})\"",
41
+ "typecheck": "tsc -p tsconfig.json --noEmit"
42
+ }
43
+ }
@@ -0,0 +1,13 @@
1
+ <commits>
2
+
3
+ !?`git log -n 5 --format="%H%n%ad%n%B---" --date=short|||No commits found`
4
+
5
+ </commits>
6
+
7
+ <inputs>
8
+
9
+ {{ INPUTS }}
10
+
11
+ </inputs>
12
+
13
+ @include:prompt.md
@@ -0,0 +1,13 @@
1
+ <commits>
2
+
3
+ !?`git log -n 5 --format="%H%n%ad%n%B---" --date=short|||No commits found`
4
+
5
+ </commits>
6
+
7
+ <issues>
8
+
9
+ !?`gh issue list --state open --json number,title,body,comments|||[]`
10
+
11
+ </issues>
12
+
13
+ @include:ghprompt.md
@@ -0,0 +1,67 @@
1
+ # ISSUES
2
+
3
+ GitHub issues are provided at start of context. Parse it to get open issues with their bodies and comments.
4
+
5
+ You will work on the AFK issues only, not the HITL ones.
6
+
7
+ You've also been passed a file containing the last few commits. Review these to understand what work has been done.
8
+
9
+ If all AFK tasks are complete, output <promise>NO MORE TASKS</promise>.
10
+
11
+ # TASK SELECTION
12
+
13
+ Pick the next task. Prioritize tasks in this order:
14
+
15
+ 1. Critical bugfixes
16
+ 2. Development infrastructure
17
+
18
+ Getting development infrastructure like tests and types and dev scripts ready is an important precursor to building features.
19
+
20
+ 3. Tracer bullets for new features
21
+
22
+ Tracer bullets are small slices of functionality that go through all layers of the system, allowing you to test and validate your approach early. This helps in identifying potential issues and ensures that the overall architecture is sound before investing significant time in development.
23
+
24
+ TL;DR - build a tiny, end-to-end slice of the feature first, then expand it out.
25
+
26
+ 4. Polish and quick wins
27
+ 5. Refactors
28
+
29
+ # EXPLORATION
30
+
31
+ Explore the repo.
32
+
33
+ # IMPLEMENTATION
34
+
35
+ Complete the task.
36
+
37
+ # FEEDBACK LOOPS
38
+
39
+ Before committing, run the feedback loops:
40
+
41
+ ### Frontend / Node
42
+
43
+ - `pnpm run test` to run the tests
44
+ - `pnpm run typecheck` to run the type checker
45
+
46
+ ### Backend / Dotnet
47
+
48
+ - `dotnet test` to run the tests
49
+ - `dotnet build` to type-check
50
+
51
+ # COMMIT
52
+
53
+ Make a single `git commit -am` with a short message:
54
+
55
+ - Subject line (≤72 chars): what changed
56
+ - Optional body (≤3 bullets): key decision, blocker for next iteration
57
+ - No file lists (git tracks them), no `Co-Authored-By`
58
+
59
+ # THE ISSUE
60
+
61
+ If the task is complete, close the original GitHub issue.
62
+
63
+ If the task is not complete, leave a comment on the GitHub issue with what was done.
64
+
65
+ # FINAL RULES
66
+
67
+ ONLY WORK ON A SINGLE TASK.
@@ -0,0 +1,80 @@
1
+ # ISSUES
2
+
3
+ GitHub issues are provided at start of context. Parse it to get open issues with their bodies and comments.
4
+
5
+ You will work on the AFK issues only, not the HITL ones.
6
+
7
+ You've also been passed a file containing the last few commits. Review these to understand what work has been done.
8
+
9
+ If all AFK tasks are complete, output <promise>NO MORE TASKS</promise>.
10
+
11
+ # TASK SELECTION
12
+
13
+ Pick the next task. Prioritize tasks in this order:
14
+
15
+ 1. Critical bugfixes
16
+ 2. Development infrastructure
17
+
18
+ Getting development infrastructure like tests and types and dev scripts ready is an important precursor to building features.
19
+
20
+ 3. Tracer bullets for new features
21
+
22
+ Tracer bullets are small slices of functionality that go through all layers of the system, allowing you to test and validate your approach early. This helps in identifying potential issues and ensures that the overall architecture is sound before investing significant time in development.
23
+
24
+ TL;DR - build a tiny, end-to-end slice of the feature first, then expand it out.
25
+
26
+ 4. Polish and quick wins
27
+ 5. Refactors
28
+
29
+ # EXPLORATION
30
+
31
+ Explore the repo.
32
+
33
+ # IMPLEMENTATION
34
+
35
+ Complete the task.
36
+
37
+ # FEEDBACK LOOPS
38
+
39
+ Before committing, run the feedback loops:
40
+
41
+ ### Frontend / Node
42
+
43
+ - `pnpm run test` to run the tests
44
+ - `pnpm run typecheck` to run the type checker
45
+
46
+ ### Backend / Dotnet
47
+
48
+ - `dotnet test` to run the tests
49
+ - `dotnet build` to type-check
50
+
51
+ **If `dotnet test` or `dotnet build` fails with MSB3248** ("Could not resolve assembly reference" / "file is corrupt") — this is a known virtiofs/9p I/O quirk when the repo is mounted from the Windows host. It is NOT a code defect. Do not defer verification. Re-run with build outputs redirected to `/tmp` and parallelism disabled:
52
+
53
+ ```bash
54
+ dotnet test <path-to-test-csproj> \
55
+ -m:1 \
56
+ /p:UseSharedCompilation=false \
57
+ /p:BuildInParallel=false \
58
+ /p:BaseIntermediateOutputPath=/tmp/ralph-obj/$(basename <path-to-test-csproj> .csproj)/ \
59
+ /p:BaseOutputPath=/tmp/ralph-bin/$(basename <path-to-test-csproj> .csproj)/
60
+ ```
61
+
62
+ Only if that second attempt also fails may you defer and record the blocker in the commit message.
63
+
64
+ # COMMIT
65
+
66
+ Make a single `git commit -am` with a short message:
67
+
68
+ - Subject line (≤72 chars): what changed
69
+ - Optional body (≤3 bullets): key decision, blocker for next iteration
70
+ - No file lists (git tracks them), no `Co-Authored-By`
71
+
72
+ # THE ISSUE
73
+
74
+ If the task is complete, close the original GitHub issue.
75
+
76
+ If the task is not complete, leave a comment on the GitHub issue with what was done.
77
+
78
+ # FINAL RULES
79
+
80
+ ONLY WORK ON A SINGLE TASK.
@@ -0,0 +1,51 @@
1
+ <head>
2
+
3
+ !?`git rev-parse HEAD|||(no commits)`
4
+
5
+ </head>
6
+
7
+ <recent-commits>
8
+
9
+ !?`git log -n 3 --format="%H%n%ad%n%B---" --date=short|||No commits found`
10
+
11
+ </recent-commits>
12
+
13
+ <latest-diff>
14
+
15
+ !?`git show --stat HEAD|||No diff`
16
+
17
+ !?`git show HEAD | head -c 200000|||No diff body`
18
+
19
+ </latest-diff>
20
+
21
+ # REVIEWER
22
+
23
+ You review the most recent commit (HEAD) produced by the implementer.
24
+
25
+ If `<head>` shows `(no commits)` or HEAD is unchanged from the previous iteration, output `<review>SKIP</review>` and stop without making any commit.
26
+
27
+ # CHECK
28
+
29
+ 1. Bugs and regressions
30
+ 2. Test coverage gaps for the changed code
31
+ 3. Style violations vs `CLAUDE.md` or project conventions
32
+ 4. Security issues (input validation, secrets, injection, auth bypass)
33
+ 5. Half-finished implementations, dead code, leftover TODO from this commit
34
+
35
+ # ACTION
36
+
37
+ If defects found:
38
+ - Fix them directly in the working tree.
39
+ - Run feedback loops:
40
+ - Frontend / Node: `pnpm run test`, `pnpm run typecheck`
41
+ - Backend / Dotnet: `dotnet test`, `dotnet build` (apply MSB3248 workaround from the implementer playbook if it triggers)
42
+ - Commit with `git commit -am "fix(review): <short reason>"`. Subject ≤72 chars. No `Co-Authored-By` line. No file lists.
43
+
44
+ If clean: output `<review>OK</review>` and stop. Do NOT commit.
45
+
46
+ # RULES
47
+
48
+ - Only review the latest commit. Do not touch unrelated code.
49
+ - Do not add new features or refactor beyond the defect fix.
50
+ - Never amend the implementer's commit — always a new `fix(review):` commit.
51
+ - Single review pass. Do not loop.