feat(cli): interactive credit-gate notice UX [VOL-354]#55
Draft
tkkhq wants to merge 4 commits into
Draft
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Finishes the CLI-side of the billing/credit gate (VOL-354) by turning the placeholder
low_credit_warning/not_enough_creditnotices ininternal/cmd/upgradeinto the designed interactive UX. Server-side work (volcano-hosting) and its billing-service integration design are out of scope here and tracked separately — this change stays dormant until the API emits the header.Design decisions:
not_enough_creditis non-zero only when the underlying command already failed for its own reasons; real enforcement stays server-side.config.WebURL()(VOLCANO_WEB_URLoverrides) —https://volcano.dev/billing?source=cli. No speculative API-provided-URL wire contract is introduced.CIis unset, and both stdin and stderr are terminals. On consent it opens the browser; on decline, prompt error, or open failure it prints the URL. Scripts/CI/pipes are never affected.Changes
internal/confirm: genericConfirm(r, w, message)prompt primitive.internal/api:WebBillingURLhelper (mirrorsWebSignupURL).internal/cmd/upgrade/credit.go: notice rendering,CreditPromptSafeAnnotationopt-in gate, TTY/CI checks, browser open, URL fallback.cmd/volcano/main.go:root.ExecuteC()to pass the executed leaf command so its prompt-safe annotation can be read; 426 short-circuit + error-first ordering unchanged.docs/credit-gating.md(+ README link).Audience
Test
go build ./...go test ./...(40 packages OK)go tool golangci-lint run ./...(0 issues)Notes / follow-ups (out of scope)
creditgate.Provider+ billing integration (volcano-hosting).deploy) prompt-safe once the server contract lands.