Skip to content

Commit 261b83e

Browse files
rclaude
andcommitted
Merge GitHub main (v0.48.2, v0.48.3) into v0.49.0
GitHub's main carried two releases this clone never had: absolute morph-mcp paths in setup (0.48.2) and a CI fix for the new cursor specs (0.48.3). Both are kept for Cursor and OpenCode. The Claude Code half of 0.48.2 is superseded: setup installs hooks only, and a re-run now also removes an mcpServers.morph entry that holds an absolute path. Restores the opencode_idempotent unit test, which the Claude Code cleanup had removed by mistake. Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
2 parents be82039 + 2d74868 commit 261b83e

7 files changed

Lines changed: 557 additions & 193 deletions

File tree

‎CHANGELOG.md‎

Lines changed: 97 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -138,6 +138,100 @@ format change.
138138
paths, and `morph-e2e` finds the `morph` binary without the
139139
deprecated `assert_cmd::Command::cargo_bin`, which fails under
140140
cargo's new build-directory layout.
141+
## [0.48.3] — 2026-05-06
142+
143+
Re-cuts v0.48.2 with a CI-only fix: the `setup_cursor` acceptance
144+
specs that v0.48.2 introduced asserted `mcp.json` contains an
145+
absolute path ending in `/morph-mcp`. They passed locally (where
146+
`morph-mcp` is on `PATH` for any active Morph user) but failed on
147+
the GitHub Actions runner because `cargo test --workspace` does
148+
**not** build the actual `morph-mcp` *binary* at
149+
`target/debug/morph-mcp` — only its unit-test binary in
150+
`target/debug/deps/`. With no `morph-mcp` on PATH and no sibling
151+
of `morph`, `resolve_mcp_command()` correctly fell back to the
152+
bare name and the spec `file_contains: '/morph-mcp"'` assertion
153+
flunked. Net effect: the v0.48.2 release pipeline never reached
154+
the `publish` / `update-tap` steps, so v0.48.2 has a tag but no
155+
Homebrew formula update. v0.48.3 carries the same user-visible
156+
behaviour and ships through the pipeline cleanly.
157+
158+
### Fixed
159+
160+
- **`morph-cli/build.rs`** plants a stub `morph-mcp` file in
161+
`OUT_DIR` and injects `MORPH_MCP_PATH=<OUT_DIR>/morph-mcp` into
162+
every generated spec-test invocation. The resolver's first
163+
resolution branch (env var, validated via `is_file()`) is now
164+
exercised deterministically across local and CI runs without
165+
depending on workspace build order or the runner's `PATH`. The
166+
production fallback chain (env → sibling → `PATH` → bare) is
167+
unchanged; only the test-harness path is pinned.
168+
169+
### Tests
170+
171+
- Same six `setup_cursor` cases as v0.48.2; now green on a
172+
runner with no installed morph-mcp and no `target/debug/morph-mcp`.
173+
Verified locally by running `cargo test --workspace --locked`
174+
with `PATH=/tmp/fake-bins:/usr/bin:/bin` (no morph-mcp anywhere)
175+
— 1220 tests passing across the workspace.
176+
- `morph-cli/tests/specs/version.yaml` updated to assert the new
177+
`0.48.3` version string in `--version`, `version`, and
178+
`version --json` output.
179+
180+
## [0.48.2] — 2026-05-06
181+
182+
User-visible bug fix: `morph setup cursor` (and the
183+
`claude-code` / `opencode` siblings, and the `aoe` delegator
184+
that calls them) now resolve `morph-mcp` to an **absolute path**
185+
before writing the IDE integration JSON. Cursor on macOS is a
186+
GUI-launched app that does not inherit the user's shell PATH,
187+
so the previous `command: "morph-mcp"` entry silently failed to
188+
spawn for Homebrew users on `/opt/homebrew/bin` — the agent saw
189+
the `morph-record.mdc` rule but had no `morph_record_session`
190+
tool to call. This release closes that gap.
191+
192+
### Fixed
193+
194+
- **`morph-cli/src/setup.rs`**: new `resolve_mcp_command()`
195+
helper writes an absolute path to `morph-mcp` into
196+
`.cursor/mcp.json`, `.claude/settings.json`, and
197+
`opencode.json`. Resolution order: `MORPH_MCP_PATH` env var
198+
(escape hatch for non-standard installs) → `morph-mcp`
199+
sibling of the running `morph` binary via
200+
`current_exe()` (the common case for Homebrew, `cargo
201+
install`, AUR, etc.) → manual `PATH` walk → bare-name
202+
fallback. The bare-name fallback emits a stderr warning so
203+
the user can fix it manually.
204+
- **`SetupReport` / `OpenCodeSetupReport` /
205+
`ClaudeCodeSetupReport`** now carry the resolved
206+
`mcp_command` string, and the `morph setup …` CLI summary
207+
prints it as `morph-mcp: <resolved path>` so a fresh setup
208+
immediately shows what got written into the IDE config.
209+
210+
### Tests
211+
212+
- **New spec:** `morph-cli/tests/specs/setup_cursor.yaml`
213+
covers `setup cursor`'s contract end-to-end: `.cursor/mcp.json`
214+
+ `.cursor/hooks.json` + the four hook scripts get written,
215+
the resolved command is an absolute path ending in
216+
`/morph-mcp`, the CLI prints the path, the operation is
217+
idempotent, existing user MCP servers are preserved, and a
218+
missing `.morph/` errors out cleanly. 6 cases, all passing.
219+
- **New unit tests:** `resolve_mcp_command_honours_env_override`
220+
and `resolve_mcp_command_ignores_env_when_path_does_not_exist`
221+
pin the env-var contract and the resolver's fallback
222+
behaviour against bogus overrides.
223+
- Existing `mcp_json_created`, `claude_code_settings_json_created`,
224+
and `opencode_json_created` tests now accept either the bare
225+
`morph-mcp` name or any absolute path ending in `morph-mcp`,
226+
matching the new resolver semantics. The setup_claude_code
227+
spec relaxes its `'"morph-mcp"'` assertion to `'morph-mcp"'`
228+
for the same reason.
229+
230+
### Total
231+
232+
493 morph-cli tests passing (41 doc + 8 setup + 432 spec +
233+
10 status + 2 status-merge). No other crate's behaviour
234+
changed.
141235

142236
## [0.48.1] — 2026-05-02
143237

@@ -1716,7 +1810,9 @@ Three coordinated changes to repo setup, adoption, and migration.
17161810
`init_at_latest:*` ×4, `init_in_git_dir:*` ×6, `upgrade:*` ×5.
17171811

17181812
[Unreleased]: https://github.com/r/morph/compare/v0.49.0...HEAD
1719-
[0.49.0]: https://github.com/r/morph/compare/v0.48.1...v0.49.0
1813+
[0.49.0]: https://github.com/r/morph/compare/v0.48.3...v0.49.0
1814+
[0.48.3]: https://github.com/r/morph/compare/v0.48.2...v0.48.3
1815+
[0.48.2]: https://github.com/r/morph/compare/v0.48.1...v0.48.2
17201816
[0.48.1]: https://github.com/r/morph/compare/v0.48.0...v0.48.1
17211817
[0.48.0]: https://github.com/r/morph/compare/v0.47.0...v0.48.0
17221818
[0.47.0]: https://github.com/r/morph/compare/v0.46.0...v0.47.0

‎morph-cli/build.rs‎

Lines changed: 26 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -409,12 +409,26 @@ fn emit_step(code: &mut String, step: &Step, idx: usize) {
409409
// unknown". Specs typically set repo-local `git config user.*`
410410
// in their shell setup, but treating this as a harness-level
411411
// default keeps a missing config from being a silent foot-gun.
412+
//
413+
// MORPH_MCP_PATH points at a stub file we plant in OUT_DIR (see
414+
// `main()` below). `cargo test --workspace` does NOT build the
415+
// `morph-mcp` binary at `target/debug/morph-mcp` (only its
416+
// *unit-test* binary in `target/debug/deps/`), so on a clean
417+
// CI runner with no globally-installed morph-mcp, the
418+
// `morph setup cursor` specs that assert mcp.json contains an
419+
// absolute path ending in `/morph-mcp` would fall back to the
420+
// bare-name branch of `resolve_mcp_command` and fail. The stub
421+
// gives the resolver a deterministic absolute path ending in
422+
// `/morph-mcp`, exercising the same code path users hit in
423+
// production (their real `morph-mcp` on disk) without the
424+
// build-order dependency.
412425
writeln!(
413426
code,
414427
" cmd.env(\"GIT_AUTHOR_NAME\", \"morph-test\")\n \
415428
.env(\"GIT_AUTHOR_EMAIL\", \"morph-test@example.com\")\n \
416429
.env(\"GIT_COMMITTER_NAME\", \"morph-test\")\n \
417-
.env(\"GIT_COMMITTER_EMAIL\", \"morph-test@example.com\");"
430+
.env(\"GIT_COMMITTER_EMAIL\", \"morph-test@example.com\")\n \
431+
.env(\"MORPH_MCP_PATH\", concat!(env!(\"OUT_DIR\"), \"/morph-mcp\"));"
418432
)
419433
.unwrap();
420434

@@ -695,6 +709,17 @@ fn main() {
695709
let out_dir = env::var("OUT_DIR").unwrap();
696710
let out_path = Path::new(&out_dir).join("spec_tests.rs");
697711

712+
// Plant a stub `morph-mcp` file in OUT_DIR. Generated specs set
713+
// `MORPH_MCP_PATH=<OUT_DIR>/morph-mcp` so `resolve_mcp_command`
714+
// returns this absolute path (ending in `/morph-mcp`) instead
715+
// of falling back to the bare name on CI runners that don't
716+
// have morph-mcp built or installed. See the long comment in
717+
// `emit_step` for why this matters.
718+
let stub_mcp_path = Path::new(&out_dir).join("morph-mcp");
719+
if !stub_mcp_path.exists() {
720+
fs::write(&stub_mcp_path, b"").expect("write stub morph-mcp");
721+
}
722+
698723
let mut all_code = String::from(
699724
"// Auto-generated from tests/specs/*.yaml -- do not edit.\n\
700725
use assert_cmd::cargo::cargo_bin_cmd;\n\

‎morph-cli/src/main.rs‎

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2353,6 +2353,12 @@ fn main() -> anyhow::Result<()> {
23532353
"unchanged"
23542354
}
23552355
);
2356+
println!(" morph-mcp: {}", report.mcp_command);
2357+
if !report.mcp_command.contains('/') && !report.mcp_command.contains('\\') {
2358+
eprintln!(
2359+
"warning: could not locate `morph-mcp` on disk; wrote bare command name into mcp.json. Cursor on macOS doesn't inherit shell PATH, so the MCP server may fail to start. Set MORPH_MCP_PATH or edit .cursor/mcp.json with the absolute path."
2360+
);
2361+
}
23562362
}
23572363
SetupCmd::Opencode { path } => {
23582364
let root = std::path::Path::new(&path)
@@ -2388,6 +2394,7 @@ fn main() -> anyhow::Result<()> {
23882394
"unchanged"
23892395
}
23902396
);
2397+
println!(" morph-mcp: {}", report.mcp_command);
23912398
}
23922399
SetupCmd::ClaudeCode { path, scope, mcp } => {
23932400
let root = std::path::Path::new(&path)

0 commit comments

Comments
 (0)