Skip to content

feat(multi-machine): instar join --dir targets a chosen home (§1.3 fix)#661

Open
JKHeadley wants to merge 1 commit into
mainfrom
echo/join-dir-flag
Open

feat(multi-machine): instar join --dir targets a chosen home (§1.3 fix)#661
JKHeadley wants to merge 1 commit into
mainfrom
echo/join-dir-flag

Conversation

@JKHeadley

Copy link
Copy Markdown
Owner

What

instar join can now join a mesh into a directory you choose (-d/--dir). The git-URL branch of joinMesh forced the clone target to <cwd>/<repo-name> and ignored --dir entirely — so a join could never land in a caller-chosen home. That's the directory-targeting half of the §1.3 init→join confusion flagged in MULTI-MACHINE-BOOTSTRAP-ROBUSTNESS-SPEC (approved 2026-05-27), and it blocks any orchestrator (the Track-E test-as-self two-machine harness) from joining a mesh into a specific throwaway home.

Fix

Extracted the directory-targeting decision into a pure, exported resolveJoinDir(repoUrl, options) in a new tiny module src/commands/joinDir.ts (so the decision is unit-testable without machine.ts's heavy import graph):

  • git URL + --dir → resolved --dir (NEW)
  • git URL + no --dir<cwd>/<repo-name> (historical default, UNCHANGED)
  • non-git (tunnel) URL + --dir → resolved --dir
  • non-git URL + no --dirprocess.cwd() (UNCHANGED)

joinMesh now calls it; -d, --dir added to the join CLI command. Non-breaking: every no---dir path is byte-identical to the prior behavior.

Tests

tests/unit/joinDir.test.ts (12) — both sides of the decision boundary (git/SSH/tunnel × --dir/no---dir, relative-dir → absolute, isGitCloneUrl discrimination). Each no---dir branch asserted unchanged. tsc --noEmit clean; full pre-commit + pre-push ship-gate green.

Scope

Foundational, independently-useful fix. The Track-E two-machine test-as-self harness (--join-mesh/--code/--teardown join-mode) that consumes instar join --dir is the next PR. No config/schema/migration — picked up by existing agents on the normal dist update.

Opened for review (not auto-merged): it executes an approved spec but changes a core mesh-join command, so a human merge is appropriate.

🤖 Generated with Claude Code

The git-URL branch of joinMesh forced the clone target to <cwd>/<repo-name>
and ignored --dir, so a join could never land in a caller-chosen home —
blocking an orchestrator (the Track-E test-as-self harness) from joining a
mesh into a specific throwaway home. Extract the decision into a pure,
unit-tested resolveJoinDir(); honor --dir for git URLs while preserving the
historical default when absent (non-breaking). Add -d/--dir to the join CLI.

Spec: MULTI-MACHINE-BOOTSTRAP-ROBUSTNESS-SPEC §1.3 (approved 2026-05-27).
Tests: tests/unit/joinDir.test.ts (12) — both sides of the boundary; tsc clean.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
@vercel

vercel Bot commented Jun 1, 2026

Copy link
Copy Markdown

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated (UTC)
instar Ready Ready Preview, Comment Jun 1, 2026 7:24am

Request Review

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant