Skip to content

feat(skywire-cli): svc gains --testenv + URL overrides + fetch-chain flags; --jq/--shape parity - #4077

Merged
0pcom merged 1 commit into
skycoin:developfrom
0pcom:feat/svc-testenv-url-overrides-output-parity
Aug 22, 2026
Merged

0pcom merged 1 commit into
skycoin:developfrom
0pcom:feat/svc-testenv-url-overrides-output-parity

Conversation

@0pcom

@0pcom 0pcom commented Aug 21, 2026

Copy link
Copy Markdown
Collaborator

Converges the svc command group toward the deployment-selection and structured-output vocabulary the rest of the CLI already uses. Strictly backward-compatible (defaults are prod / empty).

D — deployment-service URL + fetch-flag unification (svc slice)

svc hardcoded deployment.Prod.* in every subcommand and exposed only --direct/--rpc — unlike sd/ut, which offer --testenv and per-service URL overrides, and unlike the fetch-chain flags (--no-cxo/--no-rpc/--no-dmsg) present on ut.

  • New persistent flags on svc RootCmd, inherited by every subcommand: --testenv (or SKYWIRETEST=1), --tpdurl/--dmsgdurl/--arurl, and the --no-cxo/--no-rpc/--no-dmsg/--sk/--config fetch-chain controls.
  • fetchViaVisorOrDirect resolves each subcommand's base URL via baseURLFor(service) (honors --testenv + overrides) instead of literal deployment.Prod.*.
  • svc health's direct queries use the same resolution.

E — structured-output parity

--jq/--shape were accepted but ignored on the svc pretty-print subs (output went through internal.PrintOutput; only ar check used the flag-aware cliout printer). emitPretty now routes --json/--jq/--shape through cliout.Print; the default human view stays pretty-indented JSON.

Validation (standalone + combined binaries built locally)

  • go build ./cmd/skywire-cli/ . clean.
  • New flags inherited by all svc subs (e.g. svc tpd stats --help, svc health --help show them as Global Flags under the combined binary).
  • svc tpd stats --json (compact when piped), --jq 'keys', --jq '.total_transports', --shape all work; bare command still prints pretty JSON.
  • svc tpd stats --direct --tpdurl http://127.0.0.1:9 reaches the override URL in the fetch (fails to map, as expected) — proving the override is threaded.

Deferred (design note)

  • --rpc/--direct are still registered per-subcommand rather than once on the svc root; left as-is to keep the diff focused and avoid duplicate-flag churn. Folding them onto the root persistent set is a safe follow-up.
  • The broader cross-group vocabulary convergence (e.g. sd's --sdurl/--uturl, ut's --url, hidden aliases so every group shares one spelling) is not attempted here — this PR brings svc up to parity as the highest-value slice.
  • DmsgURLForHTTP/cxoFeedForURL map only deployment.Prod.* prefixes, so a raw non-prod --*url override (or --testenv) is only fully effective on the --direct path when the target is already a dmsg:// URL. This is a pre-existing fetch-chain property shared with sd/ut, not introduced here; teaching the mapping about deployment.Test.* would be a separate change across the whole CLI.

@0pcom
0pcom force-pushed the feat/svc-testenv-url-overrides-output-parity branch from 0c383a5 to 472186d Compare August 22, 2026 23:53
…etch-chain flags; structured-output parity

The svc command group hardcoded deployment.Prod.* in every subcommand
and exposed only --direct/--rpc — unlike sd/ut, which offer --testenv and
per-service URL overrides. It also accepted --jq/--shape but ignored them
on the pretty-print subcommands (output went through internal.PrintOutput,
only 'ar check' routed through the flag-aware cliout printer).

Deployment / fetch-chain (item D):
- add persistent flags on svc RootCmd, inherited by every subcommand:
  --testenv (or SKYWIRETEST=1), --tpdurl/--dmsgdurl/--arurl overrides,
  and the --no-cxo/--no-rpc/--no-dmsg/--sk/--config fetch-chain controls.
- resolve each subcommand's base URL through baseURLFor(service), which
  honors --testenv and the overrides, instead of literal deployment.Prod.*.
- thread the same resolution through 'svc health' direct queries.

Structured output (item E):
- emitPretty now routes --json/--jq/--shape through cliout.Print so they
  work uniformly across the svc pretty-print subs; the default human view
  stays pretty-indented JSON (unchanged).

Backward-compatible: defaults are prod/empty, so existing invocations are
unchanged. Verified: new flags inherited by all svc subs (standalone +
combined binary); --json/--jq/--shape work on 'svc tpd stats'; --direct
--tpdurl override reaches the fetch URL.
@0pcom
0pcom force-pushed the feat/svc-testenv-url-overrides-output-parity branch from 472186d to e74cc62 Compare August 22, 2026 23:54
@0pcom
0pcom merged commit 0e48dc5 into skycoin:develop Aug 22, 2026
11 of 15 checks passed
@0pcom
0pcom deleted the feat/svc-testenv-url-overrides-output-parity branch August 22, 2026 23:54
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