Skip to content

feat: add service catalog presets to Add Service UI#96

Merged
dangtony98 merged 2 commits intomainfrom
feat/service-catalog-presets
Apr 21, 2026
Merged

feat: add service catalog presets to Add Service UI#96
dangtony98 merged 2 commits intomainfrom
feat/service-catalog-presets

Conversation

@dangtony98
Copy link
Copy Markdown
Contributor

Summary

  • When adding a new broker service, users can now pick from the built-in catalog (Stripe, GitHub, Anthropic, Linear, …) to pre-fill host, description, auth type, and the suggested credential key. "Custom (blank)" is still the default. Edit mode is unchanged.
  • Backend: catalog.Template gains optional Header / Prefix fields. Header is populated for the four api-key services (Anthropic x-api-key, Datadog DD-API-KEY, Postmark X-Postmark-Server-Token, Shopify X-Shopify-Access-Token) so the preset is usable without additional lookup.
  • Frontend: ServicesTab fetches /v1/service-catalog once on mount (in parallel with the services fetch) via the existing apiRequest helper; ServiceModal renders a Select-based preset picker above Host Pattern in add mode.

No changes to the HTTP API surface, the service save path, or the agent-facing skill docs — the catalog endpoint already existed and just gained two optional JSON fields.

Test plan

  • go test ./... — green
  • web$ npx tsc --noEmit — green
  • web$ npm run build — green
  • make web-dev → open vault → Services tab → Add service:
    • Pick "Anthropic" → host + description + auth type = api-key + credential key = ANTHROPIC_API_KEY + header = x-api-key all populate
    • Pick "Stripe" → bearer token key = STRIPE_KEY
    • Switch preset mid-flow → prior auth fields are cleared before new ones seed
    • Pick "Custom (blank)" → form resets to empty, matches pre-change behavior
    • Submit saves and the service appears in the list
  • Editing an existing service → preset picker is not shown

🤖 Generated with Claude Code

Comment thread web/src/pages/vault/ServicesTab.tsx Outdated
Comment thread web/src/pages/vault/ServicesTab.tsx
Comment thread web/src/pages/vault/ServicesTab.tsx
dangtony98 and others added 2 commits April 20, 2026 18:19
Selecting a preset from the built-in catalog pre-fills host, description,
auth type, and the suggested credential key, with header/prefix seeded for
api-key services. "Custom (blank)" remains the default and Edit mode is
unchanged.

Catalog entries for api-key services (Anthropic, Datadog, Postmark,
Shopify) now carry the required header (e.g. x-api-key) so the preset is
usable without additional lookup.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
… catalog

Three review-comment fixes on the preset picker in ServicesTab:

- Basic-auth credential routing: for Twilio and Jira the
  suggested_credential_key is the token that belongs in the password slot
  (username is the AccountSID / email, which is user-specific). Previously
  the preset always put it in the username slot, producing a misconfigured
  service that 401s at the proxy. Route basic-auth presets to password.
- Custom (blank) now resets all fields. Previously, selecting a preset and
  then switching back to Custom only changed the dropdown label while the
  seeded values stayed in form state, silently saving an unintended service
  on submit. Factored a resetFields() helper, called on every preset change.
- Catalog snapshot: the preset picker now freezes its catalog at modal-open
  time so a catalog fetch resolving while the user is already filling the
  form does not shift the picker into view above fields they are editing.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
@dangtony98 dangtony98 force-pushed the feat/service-catalog-presets branch from 0437020 to e7b637b Compare April 21, 2026 01:21
@dangtony98
Copy link
Copy Markdown
Contributor Author

Rebased onto latest main and addressed all three review comments (commit e7b637b):

  1. 🔴 Basic-auth credential routing (Twilio/Jira) — Catalogued basic-auth services carry a token that belongs in the password slot, not username. applyPreset now calls setPassword(tpl.suggested_credential_key) for auth_type === "basic" and leaves username for the operator to fill (AccountSID / email is user-specific, not something the catalog can supply). Inline WHY comment explains the asymmetry.
  2. 🔴 "Custom (blank)" leaving prior preset values — Factored a resetFields() helper and call it at the top of every applyPreset invocation, including the empty-id branch. Picking a preset and then switching back to Custom now fully clears host/description/auth/credentials/headers.
  3. 🟡 Mid-form layout shift when catalog arrives lateServiceModal now snapshots catalog at mount via useState(() => catalog) so a fetch resolving mid-form doesn't toggle showPresets into view above fields the user is already editing.

Typecheck + vite build green. Force-pushed after the rebase.

@dangtony98 dangtony98 merged commit 452a0de into main Apr 21, 2026
4 checks passed
@dangtony98 dangtony98 deleted the feat/service-catalog-presets branch April 21, 2026 01:26
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