Add scripts/grunt + use it to ship settings nag banner#1088
Merged
Conversation
A small Bash wrapper that POSTs a one-shot prompt to https://opencode.ai/zen/go/v1/chat/completions, prints the assistant text, and is safe to background for parallel dispatch. Trims stray whitespace from OPENCODE_API_KEY (the env value here had a leading space, which silently broke chat completions while leaving /models working). Detects reasoning-only finishes and tells the caller to raise -t rather than returning an empty string. Defaults to deepseek-v4-flash; -m switches model, -f attaches files inline, -s sets a system prompt, --models lists what the account can reach.
Owners now see a banner above admin nav listing settings that need
attention: payment provider not chosen, business email not set, no
domain configured. The banner suppresses the domain item when neither
Bunny CDN nor Bunny DNS is enabled (admin can't fix it).
To distinguish "never saved" from "explicitly chose None" for payment
provider without breaking existing readers (isPaymentsEnabled and
friends already check for "stripe"/"square" explicitly), add a
PaymentProviderSetting type ("stripe" | "square" | "none") and a
parallel snapshot field/getter paymentProviderSetting that reads the
same DB key. The legacy paymentProvider getter still maps "none" to
null so every existing caller is untouched. Saving "None" in the form
now writes the literal string "none" via setPaymentProviderNone() —
clearPaymentProvider() (which deletes the row entirely) is preserved
for the existing test that asserts deletion.
Most of the new code was drafted by Kimi K2.6 via scripts/grunt:
the nag function, the banner template, and the test file. Type
plumbing and integration was edited directly to keep contracts tight.
Coverage gate is 100%; the items.length===0 (return null) branch isn't reliably exercised by route tests because the default test env has nag conditions true.
items[N] is T | undefined under the project's strict typecheck; match the codebase's existing non-null-assertion pattern.
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.
Two related commits on this branch:
1.
scripts/grunt— fan-out to opencode.ai Zen (Go) modelsA small Bash wrapper that POSTs a one-shot prompt to
https://opencode.ai/zen/go/v1/chat/completions, prints the assistanttext, and is safe to background for parallel dispatch. Trims stray
whitespace from
OPENCODE_API_KEY(the env value as provided had aleading space, which silently broke chat completions while leaving
/modelsworking). Detects reasoning-only finishes and exits 2 with aclear "raise -t and retry" message. Defaults to
deepseek-v4-flash;-mswitches model,-fattaches files inline,-ssets a systemprompt,
--modelslists what the account can reach.2. Settings nag banner — drafted by Kimi K2.6 via grunt
Owners now see a banner above admin nav listing settings that need
attention:
chose None" via a new
PaymentProviderSettingtype ("stripe" | "square" | "none") and a parallel snapshot fieldpaymentProviderSetting. The legacypaymentProvidergetter stillmaps
"none"→null, so every existing caller (isPaymentsEnabled,CSP builder, debug page, etc.) is untouched.
settings.businessEmail === "".customDomainandbunnySubdomainempty. Suppressed when neither Bunny CDN nor Bunny DNS is enabled
(the admin can't fix what they can't configure).
Saving "None" in the payment-provider form now writes the literal
string
"none"via the newsettings.update.setPaymentProviderNone().clearPaymentProvider()is preserved (it deletes the row, used onlyby an existing test that asserts deletion).
What the grunts produced
Three Kimi K2.6 calls in parallel produced:
src/shared/settings-nags.ts— pure nag function reading fromsettingsand the bunny env gates.src/ui/templates/admin/settings-nag-banner.tsx— JSX banner.test/shared/settings-nags.test.ts— 10 cases covering all 8 booleancombinations + the bunny-suppression case + payment-provider sentinel
values.
Type plumbing (the widening + snapshot wiring) was edited directly to
keep cross-file contracts tight. The banner had one bug to fix
(
item.text→item.label) before integration; everything elselanded as-emitted.
Validation
Local typecheck blocked by sandbox network restrictions on
jsr.io(
x-deny-reason: host_not_allowed). Relying on CI for verification.