Skip to content

refactor(local-dev): unify the CLI surface for agent use - #6138

Merged
Yicong-Huang merged 1 commit into
apache:mainfrom
Yicong-Huang:unify-local-dev-cli
Jul 5, 2026
Merged

Yicong-Huang merged 1 commit into
apache:mainfrom
Yicong-Huang:unify-local-dev-cli

Conversation

@Yicong-Huang

Copy link
Copy Markdown
Contributor

What changes were proposed in this PR?

The local-dev CLI grew unevenly, which makes it awkward to drive from agent CLIs and scripts. This PR unifies the surface:

  1. --json on every one-shot subcommand. status/up/down already had it; auto and version now accept it too. The convention is unchanged: human progress goes to stderr, one machine-readable status JSON object goes to stdout.
  2. up <service> / down <service> replace start/stop. The single-service up uses the same build knob as the full-stack form: rebuild + bounce only if the service's source changed since the last build (default), --build forces it, --skip-build never builds. It also handles the amber-sibling dist sharing (texera-web / computing-unit-master bounce together) and runs the jOOQ postgres-readiness check before any sbt build (bin/local-dev.sh up / auto: sbt build precedes infra_up, jOOQ codegen fails before postgres is ready #6007). The old start/stop and the bare <service> shorthand now refuse with a pointer to the new spelling. In the TUI, u <svc>, d <svc>, s <svc>, and a bare <svc> map onto the new forms.
  3. --skip-build replaces --no-build (the old flag refuses with a rename hint).
  4. Every --json payload carries elapsed_seconds — the command's total wall-clock runtime, so agents can log how long an up/auto took without wrapping the call in their own timer.

One behavioral fix that falls out of (2): a full-stack up with no selector re-decides (and resets) the persisted deploy-source pointer, but up <service> is a scoped operation, so the startup peek now leaves the pointer alone when a positional service argument is present — a single-service bounce on a deployed PR worktree no longer silently re-points the deployment at the main checkout.

Any related issues, documentation, discussions?

Closes #6137. The --help header and the status footer hints are updated in place; bin/local-dev/README.md needed no changes.

How was this PR tested?

  • bash bin/local-dev/tests/test_local_dev_sh.sh — 45 passed, 0 failed. Updated/added cases: unknown subcommand and up <unknown-service> errors, start/stop refuse with the new spelling, --no-build refuses with the rename hint, full-stack-only knobs (--fresh, --skip, selectors) are rejected in the single-service form, at most one positional service, cmd_auto wires --json, version --json and status --json carry elapsed_seconds, and the startup peek guards the deploy-pointer reset (isolated TEXERA_LOCAL_DEV_DIR so the flag-error up invocations never touch a real deployment's state).
  • pytest bin/local-dev/tests/test_local_dev_tui.py — 43 passed.
  • Manual smoke on a live stack: version --json, status --json (14/14 running, elapsed_seconds present), --help renders through the new end-marker sed range.

Was this PR authored or co-authored using generative AI tooling?

Generated-by: Claude Code (Claude Fable 5)

- every one-shot subcommand (status/up/down/auto/version) accepts --json
- up <service> / down <service> replace start/stop; the single-service
  form builds-if-changed by default, --build forces, --skip-build skips,
  and it follows the active deployment instead of resetting the
  persisted worktree pointer
- --skip-build replaces --no-build
- every --json payload carries elapsed_seconds (total command runtime)

Closes apache#6137

Co-Authored-By: Claude Fable 5 <[email protected]>
@github-actions

github-actions Bot commented Jul 5, 2026

Copy link
Copy Markdown
Contributor

Automated Reviewer Suggestions

Based on the git blame history of the changed files, we recommend the following reviewers:

  • No candidates found from git blame history.

@Yicong-Huang
Yicong-Huang added this pull request to the merge queue Jul 5, 2026
Merged via the queue into apache:main with commit 37354af Jul 5, 2026
20 checks passed
@Yicong-Huang
Yicong-Huang deleted the unify-local-dev-cli branch July 5, 2026 07:17
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Unify local-dev CLI for agent use: --json everywhere, up/down <service>, --skip-build

2 participants