Skip to content

Commit 7f1e3b2

Browse files
Kasper Jungeclaude
authored andcommitted
refactor: rename prompt_file/prompt_name/prompt_dir to ralph_file/ralph_name/ralph_dir
Aligns internal terminology with RALPH.md naming convention. The concept was renamed from "prompt" to "ralph" but these fields still used the old name. Keeps prompt_text and -p/--prompt unchanged since ad-hoc text is not a "ralph" (a named, persistent, file-based entity). Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
1 parent df32cf2 commit 7f1e3b2

22 files changed

Lines changed: 128 additions & 128 deletions

docs/api.md

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ from ralphify import run_loop, RunConfig, RunState
1616
config = RunConfig(
1717
command="claude",
1818
args=["-p", "--dangerously-skip-permissions"],
19-
prompt_file="RALPH.md",
19+
ralph_file="RALPH.md",
2020
max_iterations=3,
2121
)
2222
state = RunState(run_id="my-run")
@@ -43,9 +43,9 @@ Fields match the CLI options:
4343
config = RunConfig(
4444
command="claude",
4545
args=["-p", "--dangerously-skip-permissions"],
46-
prompt_file="RALPH.md",
47-
prompt_text=None, # Ad-hoc prompt (overrides prompt_file)
48-
prompt_name=None, # Named ralph from .ralphify/ralphs/
46+
ralph_file="RALPH.md",
47+
prompt_text=None, # Ad-hoc prompt (overrides ralph_file)
48+
ralph_name=None, # Named ralph from .ralphify/ralphs/
4949
max_iterations=10,
5050
delay=2.0,
5151
timeout=300,
@@ -98,7 +98,7 @@ class MyEmitter:
9898
print(f" Check '{event.data['name']}' failed")
9999

100100

101-
config = RunConfig(command="claude", args=["-p"], prompt_file="RALPH.md", max_iterations=3)
101+
config = RunConfig(command="claude", args=["-p"], ralph_file="RALPH.md", max_iterations=3)
102102
state = RunState(run_id="observed-run")
103103
run_loop(config, state, emitter=MyEmitter())
104104
```

docs/changelog.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,7 @@ Named ralphs, ralph-scoped primitives, and live agent activity streaming.
4444

4545
- **Named ralphs** — save reusable, task-focused ralphs in `.ralphify/ralphs/<name>/RALPH.md` and switch between them with `ralph run <name>`. Create with `ralph new ralph <name>`. The `ralph` field in `ralph.toml` also accepts a ralph name.
4646
- **`--ralph` flag on `ralph new`** — scope checks, contexts, and instructions to a named ralph with `ralph new check <name> --ralph <ralph>`. Creates the primitive inside `.ralphify/ralphs/<ralph>/` so it only applies when running that ralph.
47-
- **`--prompt-file` / `-f` flag** — point `ralph run` at any prompt file by path, overriding `ralph.toml`.
47+
- **`--ralph-file` / `-f` flag** — point `ralph run` at any prompt file by path, overriding `ralph.toml`.
4848
- **Live agent activity streaming** — when the agent command is Claude Code, the engine auto-detects it and uses `--output-format stream-json` with `subprocess.Popen` for line-by-line streaming. Other agents continue to use the standard `subprocess.run()` path.
4949
- **Codebase migration cookbook recipe** — step-by-step guide for automating JavaScript-to-TypeScript migrations, with adaptation tips for Python 2→3, CommonJS→ESM, and more.
5050
- **Contributor docs** — new `docs/contributing/` section with a codebase map, replacing the old `agent_docs/` directory.

docs/cli.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -96,7 +96,7 @@ ralph run --log-dir ralph_logs # Save output to log files
9696
| `[RALPH_NAME]` | | none | Name of a [named ralph](primitives.md#ralphs) in `.ralphify/ralphs/` |
9797
| `-n` | | unlimited | Max number of iterations |
9898
| `--prompt` | `-p` | none | Ad-hoc prompt text. Overrides the ralph file |
99-
| `--prompt-file` | `-f` | none | Path to a ralph file. Overrides `ralph.toml` |
99+
| `--ralph-file` | `-f` | none | Path to a ralph file. Overrides `ralph.toml` |
100100
| `--stop-on-error` | `-s` | off | Stop loop if agent exits non-zero or times out |
101101
| `--delay` | `-d` | `0` | Seconds to wait between iterations |
102102
| `--timeout` | `-t` | none | Max seconds per iteration |

docs/contributing/codebase-map.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -54,7 +54,7 @@ ralph run
5454
5555
├── cli.py:run() — parse options, print banner
5656
│ ├── Load config from ralph.toml
57-
│ ├── Resolve prompt via ralphs.resolve_ralph_source() (--prompt > name > --prompt-file > toml > root)
57+
│ ├── Resolve prompt via ralphs.resolve_ralph_source() (--prompt > name > --ralph-file > toml > root)
5858
│ └── Build RunConfig and call engine.run_loop()
5959
6060
└── engine.py:run_loop(config, state, emitter)

docs/primitives.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -202,7 +202,7 @@ When resolving the prompt (first match wins):
202202

203203
1. `-p` flag — inline ad-hoc prompt text
204204
2. Positional argument — `ralph run <name>` looks up `.ralphify/ralphs/<name>/RALPH.md`
205-
3. `--prompt-file` / `-f` flag — explicit path to a prompt file
205+
3. `--ralph-file` / `-f` flag — explicit path to a prompt file
206206
4. `ralph.toml` `ralph` field — can be a name or a file path
207207
5. Fallback — `RALPH.md` in the project root
208208

src/ralphify/__init__.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
88
from ralphify import run_loop, RunConfig, RunState, QueueEmitter
99
10-
config = RunConfig(command="claude", args=["-p"], prompt_file="RALPH.md")
10+
config = RunConfig(command="claude", args=["-p"], ralph_file="RALPH.md")
1111
state = RunState(run_id="my-run")
1212
emitter = QueueEmitter()
1313
run_loop(config, state, emitter)

src/ralphify/_discovery.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -118,19 +118,19 @@ def merge_by_name(global_list: list[_P], local_list: list[_P]) -> list[_P]:
118118

119119
def discover_enabled(
120120
root: Path,
121-
prompt_dir: Path | None,
121+
ralph_dir: Path | None,
122122
discover: Callable[[Path], list[_P]],
123123
discover_local: Callable[[Path], list[_P]],
124124
) -> list[_P]:
125125
"""Discover primitives, merge local overrides (if any), and return only enabled ones.
126126
127127
Encapsulates the three-step pattern shared by all primitive types:
128-
discover globals → merge with prompt-scoped locals → filter to enabled.
128+
discover globals → merge with ralph-scoped locals → filter to enabled.
129129
130130
Used by the engine's ``_discover_enabled_primitives`` to build the
131131
full set of primitives for a run.
132132
"""
133133
items = discover(root)
134-
if prompt_dir is not None:
135-
items = merge_by_name(items, discover_local(prompt_dir))
134+
if ralph_dir is not None:
135+
items = merge_by_name(items, discover_local(ralph_dir))
136136
return [item for item in items if item.enabled]

src/ralphify/_events.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,7 @@ class EventType(Enum):
4848

4949
# ── Run lifecycle ───────────────────────────────────────────
5050
# Data: checks/contexts/instructions (int counts), max_iterations,
51-
# timeout, delay, prompt_name
51+
# timeout, delay, ralph_name
5252
RUN_STARTED = "run_started"
5353
# Data: reason ("completed" | "user_requested" | "error"),
5454
# total, completed, failed, timed_out

src/ralphify/_run_types.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -47,9 +47,9 @@ class RunConfig:
4747

4848
command: str
4949
args: list[str]
50-
prompt_file: str
50+
ralph_file: str
5151
prompt_text: str | None = None
52-
prompt_name: str | None = None
52+
ralph_name: str | None = None
5353
max_iterations: int | None = None
5454
delay: float = 0
5555
timeout: float | None = None

src/ralphify/checks.py

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -100,22 +100,22 @@ def discover_checks(root: Path = Path(".")) -> list[Check]:
100100
return _checks_from_entries(discover_primitives(root, "checks", CHECK_MARKER))
101101

102102

103-
def discover_checks_local(prompt_dir: Path) -> list[Check]:
104-
"""Scan ``prompt_dir/checks/`` for prompt-scoped checks.
103+
def discover_checks_local(ralph_dir: Path) -> list[Check]:
104+
"""Scan ``ralph_dir/checks/`` for ralph-scoped checks.
105105
106106
Same construction logic as :func:`discover_checks` but reads from
107-
a prompt directory instead of the global ``.ralphify/checks/``.
107+
a ralph directory instead of the global ``.ralphify/checks/``.
108108
"""
109-
return _checks_from_entries(discover_local_primitives(prompt_dir, "checks", CHECK_MARKER))
109+
return _checks_from_entries(discover_local_primitives(ralph_dir, "checks", CHECK_MARKER))
110110

111111

112-
def discover_enabled_checks(root: Path, prompt_dir: Path | None = None) -> list[Check]:
112+
def discover_enabled_checks(root: Path, ralph_dir: Path | None = None) -> list[Check]:
113113
"""Discover checks, merge local overrides, and return only enabled ones.
114114
115115
Convenience wrapper over :func:`~ralphify._discovery.discover_enabled`
116116
so callers don't need to wire up the discover/discover_local callables.
117117
"""
118-
return discover_enabled(root, prompt_dir, discover_checks, discover_checks_local)
118+
return discover_enabled(root, ralph_dir, discover_checks, discover_checks_local)
119119

120120

121121
def run_check(check: Check, project_root: Path) -> CheckResult:

0 commit comments

Comments
 (0)