Skip to content

Add scripts/grunt + use it to ship settings nag banner#1088

Merged
stefan-burke merged 4 commits into
mainfrom
claude/explore-opencode-api-YQnfx
May 8, 2026
Merged

Add scripts/grunt + use it to ship settings nag banner#1088
stefan-burke merged 4 commits into
mainfrom
claude/explore-opencode-api-YQnfx

Conversation

@stefan-burke
Copy link
Copy Markdown
Member

@stefan-burke stefan-burke commented May 8, 2026

Two related commits on this branch:

1. scripts/grunt — fan-out to opencode.ai Zen (Go) models

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 as provided had a
leading space, which silently broke chat completions while leaving
/models working). Detects reasoning-only finishes and exits 2 with a
clear "raise -t and retry" message. Defaults to deepseek-v4-flash;
-m switches model, -f attaches files inline, -s sets a system
prompt, --models lists 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:

  • Payment provider not chosen — distinguished from "explicitly
    chose None" via a new PaymentProviderSetting type ("stripe" | "square" | "none") and a parallel snapshot field
    paymentProviderSetting. The legacy paymentProvider getter still
    maps "none"null, so every existing caller (isPaymentsEnabled,
    CSP builder, debug page, etc.) is untouched.
  • Business email not setsettings.businessEmail === "".
  • No domain configured — both customDomain and bunnySubdomain
    empty. 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 new settings.update.setPaymentProviderNone().
clearPaymentProvider() is preserved (it deletes the row, used only
by 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 from
    settings and 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 boolean
    combinations + 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.textitem.label) before integration; everything else
landed as-emitted.

Validation

Local typecheck blocked by sandbox network restrictions on jsr.io
(x-deny-reason: host_not_allowed). Relying on CI for verification.

claude added 2 commits May 8, 2026 10:55
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.
@stefan-burke stefan-burke changed the title Add scripts/grunt for fan-out to opencode.ai Zen (Go) models Add scripts/grunt + use it to ship settings nag banner May 8, 2026
claude added 2 commits May 8, 2026 11:23
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.
@stefan-burke stefan-burke added this pull request to the merge queue May 8, 2026
Merged via the queue into main with commit bbc04e2 May 8, 2026
2 checks passed
@stefan-burke stefan-burke deleted the claude/explore-opencode-api-YQnfx branch May 8, 2026 13:56
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.

2 participants