From 84c5c948f556142cdd43375622927118fb56dadf Mon Sep 17 00:00:00 2001 From: Chris Huber Date: Tue, 28 Jul 2026 14:06:35 -0400 Subject: [PATCH] fix: configure targeted DMC path resolution --- lib/homeboy.sh | 6 +++++- tests/homeboy-dmc-provider.sh | 4 ++++ 2 files changed, 9 insertions(+), 1 deletion(-) diff --git a/lib/homeboy.sh b/lib/homeboy.sh index 29da7a9..6aec6fd 100644 --- a/lib/homeboy.sh +++ b/lib/homeboy.sh @@ -111,6 +111,9 @@ homeboy_dmc_command_json() { resolve) homeboy_json_array bash "$SCRIPT_DIR/scripts/homeboy-dmc-resolve.sh" "${wp_argv[@]}" datamachine-code workspace worktree get '{handle}' --format=json "${wp_flags[@]}" ;; + resolve_path) + homeboy_json_array bash "$SCRIPT_DIR/scripts/homeboy-dmc-resolve.sh" "${wp_argv[@]}" datamachine-code workspace worktree get '{path}' --format=json "${wp_flags[@]}" + ;; ensure) # DMC derives the canonical handle from repo + branch and validates the # task/base intent before returning the checkout to Homeboy. @@ -129,8 +132,9 @@ homeboy_dmc_command_json() { } homeboy_dmc_worktree_provider_json() { - printf '{"enabled":true,"kind":"command","apply_enabled":true,"commands":{"resolve":%s,"resolve_not_found_exit_codes":[42],"ensure":%s,"list":%s,"cleanup_preview":%s,"cleanup_apply":%s},"list_result_mapping":{"items":"$","handle":"$.handle","path":"$.path","branch":"$.branch","dirty":"$.safety.dirty","unpushed":"$.safety.unpushed","primary":"$.safety.primary"}}' \ + printf '{"enabled":true,"kind":"command","apply_enabled":true,"commands":{"resolve":%s,"resolve_path":%s,"resolve_not_found_exit_codes":[42],"ensure":%s,"list":%s,"cleanup_preview":%s,"cleanup_apply":%s},"list_result_mapping":{"items":"$","handle":"$.handle","path":"$.path","branch":"$.branch","dirty":"$.safety.dirty","unpushed":"$.safety.unpushed","primary":"$.safety.primary"}}' \ "$(homeboy_dmc_command_json resolve)" \ + "$(homeboy_dmc_command_json resolve_path)" \ "$(homeboy_dmc_command_json ensure)" \ "$(homeboy_dmc_command_json list)" \ "$(homeboy_dmc_command_json cleanup_preview)" \ diff --git a/tests/homeboy-dmc-provider.sh b/tests/homeboy-dmc-provider.sh index 2151081..73da521 100644 --- a/tests/homeboy-dmc-provider.sh +++ b/tests/homeboy-dmc-provider.sh @@ -78,11 +78,14 @@ line = open(sys.argv[1], encoding="utf-8").read().strip() _, payload = line.split("|", 1) commands = json.loads(payload)["commands"] expected_resolve = ["bash", f"{sys.argv[2]}/scripts/homeboy-dmc-resolve.sh", "studio", "wp", "datamachine-code", "workspace", "worktree", "get", "{handle}", "--format=json", f"--path={sys.argv[3]}"] +expected_resolve_path = ["bash", f"{sys.argv[2]}/scripts/homeboy-dmc-resolve.sh", "studio", "wp", "datamachine-code", "workspace", "worktree", "get", "{path}", "--format=json", f"--path={sys.argv[3]}"] expected_ensure = ["studio", "wp", "datamachine-code", "workspace", "worktree", "add", "{repo}", "{head}", "--base-branch={base}", "--task-url={task_url}", "--format=json", f"--path={sys.argv[3]}"] if commands.get("resolve_not_found_exit_codes") != [42]: raise SystemExit("FAIL: DMC typed-not-found classification must be exactly [42]") if commands.get("resolve") != expected_resolve: raise SystemExit(f"FAIL: DMC resolve adapter mapping mismatch: {commands.get('resolve')!r}") +if commands.get("resolve_path") != expected_resolve_path: + raise SystemExit(f"FAIL: DMC path resolve adapter mapping mismatch: {commands.get('resolve_path')!r}") if commands.get("ensure") != expected_ensure: raise SystemExit(f"FAIL: DMC ensure mapping mismatch: {commands.get('ensure')!r}") PY @@ -185,6 +188,7 @@ configure_homeboy_dmc_worktree_provider > "$TMP/dry-run.log" assert_contains "homeboy config set /worktree_providers/dmc '{\"enabled\":true,\"kind\":\"command\",\"apply_enabled\":true" "$TMP/dry-run.log" assert_contains "\"resolve\":[\"bash\",\"$SCRIPT_DIR/scripts/homeboy-dmc-resolve.sh\",\"studio\",\"wp\",\"datamachine-code\",\"workspace\",\"worktree\",\"get\",\"{handle}\",\"--format=json\",\"--path=$SITE_PATH\"]" "$TMP/dry-run.log" +assert_contains "\"resolve_path\":[\"bash\",\"$SCRIPT_DIR/scripts/homeboy-dmc-resolve.sh\",\"studio\",\"wp\",\"datamachine-code\",\"workspace\",\"worktree\",\"get\",\"{path}\",\"--format=json\",\"--path=$SITE_PATH\"]" "$TMP/dry-run.log" assert_contains "\"resolve_not_found_exit_codes\":[42]" "$TMP/dry-run.log" assert_contains "\"ensure\":[\"studio\",\"wp\",\"datamachine-code\",\"workspace\",\"worktree\",\"add\",\"{repo}\",\"{head}\",\"--base-branch={base}\",\"--task-url={task_url}\",\"--format=json\",\"--path=$SITE_PATH\"]" "$TMP/dry-run.log" assert_contains "\"list\":[\"studio\",\"wp\",\"datamachine-code\",\"workspace\",\"worktree\",\"list\",\"--with-status\",\"--format=json\",\"--path=$SITE_PATH\"]" "$TMP/dry-run.log"