Skip to content

feat(run): fall through to docker compose subcommands - #97

Merged
simensen merged 3 commits into
mainfrom
feat/run-compose-passthrough
Sep 16, 2026
Merged

simensen merged 3 commits into
mainfrom
feat/run-compose-passthrough

Conversation

@simensen

Copy link
Copy Markdown
Member

What

xcind-run <name> (and x-run <name>) now falls through to docker compose <name> <args…> when the name matches no declared bin or script but is a known compose top-level subcommand. x-run up now works next to x-run reup, with the app's resolved compose options.

Behavior

  • The fallthrough uses a static list of 29 compose subcommands. A typo like x-run tset keeps the clear xcind error and exit 1.
  • Declared bins and scripts take precedence. A script named up shadows compose up; @compose up bypasses the shadow.
  • -T does not apply on the fallthrough. Args go to docker compose verbatim, exactly like @compose.
  • Step-level @refs inside scripts do not fall through, so a .xcind.sh typo still fails loudly.
  • xcind-run --list opens with a compose: section above bins:. --list --names stays bins and scripts only, so --init-shell wrappers are unchanged.

Completion

  • bash: a bare x-run <TAB> shows only the project's bins and scripts. A typed prefix (x-run u<TAB>) adds matching compose subcommands. bash readline cannot group, so prefix gating keeps the bare list quiet.
  • zsh: compose subcommands appear as their own labeled group below the bins and scripts groups.
  • After a compose name (x-run up <TAB>), both shells re-seat into the compose completion. Docker's Cobra protocol then completes flags and service names.

Tests

  • Dispatch: fallthrough argv, -T ignored, precedence/shadowing, unchanged error paths, --list section order.
  • Completion: prefix gating, re-seat delegation (docker-gated), declared names do not re-seat, an x-run wrapper case, and a drift guard that keeps the passthrough word list identical across the runner library and both completion scripts.
  • The __xcind_compose_fallback lists stay narrow on purpose. The delegation tests prove Cobra delegation with words the fallback lacks (ls, watch, cp), so the fallback must not learn them.

make check passes: lint clean, 270 tests, 0 failed. Smoke-tested in examples/workspaceless/acmeapps: xcind-run ps runs compose, --list shows the new section, xcind-run nosuch still exits 1.

Known limitation (pre-existing, shared with xcind-compose): compose completion never injects XCIND_DOCKER_COMPOSE_OPTS, so service-name completion can be empty when compose files live under XCIND_COMPOSE_DIR.

A name given to xcind-run that matches no declared bin or script, but is
a known docker compose top-level subcommand (static list), now runs
`docker compose … <name> <args…>` with the app's resolved options —
`x-run up` works next to `x-run reup`.

- Declared bins and scripts take precedence; @compose bypasses a shadow.
- -T does not apply; args are forwarded verbatim, like @compose.
- Step-level @refs inside scripts do not fall through; a .xcind.sh typo
  still fails loudly.
- --list gains a compose: section above bins:; --names is unchanged.
- Completion: bash offers compose subcommands once a prefix is typed
  (bare TAB stays bins/scripts only); zsh shows them as their own
  labeled group; after a compose name both shells re-seat into the
  compose completion, so Docker's Cobra protocol completes flags and
  service names.
- A drift guard keeps the passthrough word list identical across the
  runner library and both completion scripts. The compose fallback
  lists stay narrow on purpose: the delegation tests prove Cobra
  delegation with words the fallback lacks (ls, watch, cp).
@simensen
simensen merged commit 4bda592 into main Sep 16, 2026
17 checks passed
@simensen
simensen deleted the feat/run-compose-passthrough branch September 16, 2026 17:19
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