worklane --version exited 2: the Cli derive set name and about but never
version, so clap generated no flag. Nothing could say what a given binary
was, which matters here because the opencode tools shell out to whatever
worklane is on PATH, so an agent can be driving a stale build with no way
to notice.
The crate version alone would not have answered it. Cargo.toml is pinned
at 0.1.0 and nobody bumps it per install, so a stale install and a fresh
build both claim the same thing. A build script stamps the short sha
alongside it, giving "worklane 0.1.0 (df97b06)", and falls back to
"unknown" where there is no git directory, as when installing from a
published crate.
propagate_version lets subcommands answer too. This overrides the ticket's
own plan step, which said to skip the sha if it needed a build script.
Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
None of the five tools could report why a command failed. mv and comment
spawned without stderr set, and Bun defaults it to inherit, so the text
went to the plugin host and never to the model. show, ls and init used
Bun.$, whose ShellError message is only "Failed with exit code 1", and
each of them interpolated just that message. The CLI explained itself
every time and nothing carried the explanation.
Replace all four spawn and Bun.$ blocks with one run() helper that pipes
both streams and throws with stderr, and strip anyhow's "Error: " prefix
so a relayed message does not read "Error adding comment: Error: ...".
Verified against the real binary with a Bun.spawn shim over node's
child_process, since bun is not installed here: an ambiguous show, mv and
comment now each return the candidate list to the caller. The file is
twenty lines shorter than the duplication it replaces.
Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
resolve_ticket printed the candidate list to stdout and called
process::exit(1) from inside a helper. That combination is the one thing
the opencode wrapper cannot relay: it throws on the non-zero exit and
keeps stderr, so the list was thrown away and the agent saw a bare exit
code with nothing to choose from.
Return an error carrying the rendered list instead. It reaches stderr the
way every other error does, the exit code stays non-zero so `show x && ...`
still fails, and no process::exit remains in util.rs.
The wrapper half, which was dropping stderr on the floor regardless,
follows in 3e8b6fa.
Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
Three places sliced strings by byte offset on values that come from a
filename or a file field, neither of which is validated.
The disambiguation list took &short_id[..7], so two tickets whose names
were shorter than that aborted the process while printing the options.
collect_ticket_items guarded on length but still cut at byte 7, so a
multibyte character straddling the cut panicked. format_created_at read
four fixed offsets after a length check that a multibyte value passes.
Add short_id, which counts characters, and use it in both display paths.
Parse the timestamp with chrono instead of slicing, dropping the column
when the value will not parse. The format string it writes and the one it
reads are now the same constant, so they cannot drift.
Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
cmd_mv spliced the metadata line by byte offset and wrote the field name
as **-Status**, because the format string re-added the "- " prefix that
the preceding slice already carried. parse_ticket_field could never read
Status back, and the next move failed to find "- **Status**" so it
silently skipped the rewrite, leaving the ticket in one status directory
while its metadata claimed another.
Replace the splicing with set_status_field, a line based rewrite that
keeps every other line verbatim, inserts no stray newline, and errors
when the Metadata section has no Status field. It also accepts the
**-Status** spelling so tickets damaged by the old code are repaired as
they move.
The content is now computed before the rename, so a ticket without a
Status field is never half-moved.
Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>