Skip to content

hand spawn fails: treehouse v2 dropped --json from get --lease #41

Description

@alchemicwebstudio

Bug

`hand spawn ` fails immediately:

```
acquire treehouse worktree: treehouse get failed: exit status 1: unknown flag: --json
```

Cause

`internal/worktree/worktree.go`'s `Get()` calls:

```go
args := []string{"get", "--lease", "--json"}
```

and parses stdout as JSON (`{"path": "..."}`).

The locally installed treehouse CLI is v2.0.0. Its `get --lease` no longer
accepts `--json` at all (not in `treehouse get --help`'s flag list) and
instead prints the plain worktree path directly to stdout per its own
`--lease` help text:

Durably lease a worktree without opening a subshell; print only its path
to stdout

So `hand` is targeting an older treehouse contract that v2.0.0 no longer
implements. Every `hand spawn` is broken against current treehouse until
this is reconciled (either hand parses the plain-path output, or treehouse
pins/restores `--json`).

Repro

```
treehouse --version # v2.0.0
hand spawn rhb-product-page rockhardbeds

-> acquire treehouse worktree: treehouse get failed: exit status 1: unknown flag: --json

```

Suggested fix

Update `internal/worktree/worktree.go` `Get()` to read the plain path from
stdout (trim whitespace) instead of JSON-unmarshaling, matching treehouse
v2's documented `--lease` contract. Worth checking `internal/worktree/worktree_test.go`
and `cmd/spawn_test.go`'s fake treehouse script for the same JSON assumption.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions