feat(brand): add brand binding and structured brand storage#3052
feat(brand): add brand binding and structured brand storage#3052viktormarinho wants to merge 4 commits intomainfrom
Conversation
Define BRAND_BINDING with BRAND_GET/BRAND_LIST tools so external MCPs
can declare a brand dependency and read org brand context on demand.
- Add brand binding definition in packages/bindings
- Restructure brand storage from loose JSON to semantic fields
(colors: {primary,secondary,accent,background,foreground},
fonts: {heading,body,code})
- Add migration 065 to backfill existing data
- Add BRAND_GET and BRAND_LIST tools matching the binding contract
- Update extract tool, prompt builder, and UI for structured data
- Register binding in BUILTIN_BINDING_CHECKERS and @deco/brand mapping
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
🧪 BenchmarkShould we run the Virtual MCP strategy benchmark for this PR? React with 👍 to run the benchmark.
Benchmark will run on the next push after you react. |
Release OptionsSuggested: Minor ( React with an emoji to override the release type:
Current version:
|
There was a problem hiding this comment.
2 issues found across 17 files
Prompt for AI agents (unresolved issues)
Check if these issues are valid — if so, understand the root cause of each and fix them. If appropriate, use sub-agents to investigate and fix each issue separately.
<file name="apps/mesh/migrations/065-brand-context-structured.ts">
<violation number="1" location="apps/mesh/migrations/065-brand-context-structured.ts:102">
P2: Font entries with unrecognized roles steal the `body` slot from later explicitly-tagged entries. Consider doing a two-pass approach: first assign explicitly mapped roles, then fill remaining slots with untagged/unmapped entries.</violation>
<violation number="2" location="apps/mesh/migrations/065-brand-context-structured.ts:130">
P1: Migration silently drops data when legacy arrays contain entries with unrecognized role/label names. If `transformColors` or `transformFonts` returns `null` (no entries match `COLOR_ROLES` / `FONT_ROLE_MAP`), the UPDATE writes `null` over the original JSON, permanently losing it. Consider preserving the original value when the transform yields no results (i.e., skip the update for that column).</violation>
</file>
Reply with feedback, questions, or to request a fix. Tag @cubic-dev-ai to re-run a review.
| const mapped = FONT_ROLE_MAP[role]; | ||
| if (mapped && !result[mapped]) { | ||
| result[mapped] = name; | ||
| } else if (!result.body) { |
There was a problem hiding this comment.
P2: Font entries with unrecognized roles steal the body slot from later explicitly-tagged entries. Consider doing a two-pass approach: first assign explicitly mapped roles, then fill remaining slots with untagged/unmapped entries.
Prompt for AI agents
Check if this issue is valid — if so, understand the root cause and fix it. At apps/mesh/migrations/065-brand-context-structured.ts, line 102:
<comment>Font entries with unrecognized roles steal the `body` slot from later explicitly-tagged entries. Consider doing a two-pass approach: first assign explicitly mapped roles, then fill remaining slots with untagged/unmapped entries.</comment>
<file context>
@@ -0,0 +1,165 @@
+ const mapped = FONT_ROLE_MAP[role];
+ if (mapped && !result[mapped]) {
+ result[mapped] = name;
+ } else if (!result.body) {
+ result.body = name;
+ }
</file context>
…tput - Migration 065: stash colors with non-standard role names into metadata.extraColors instead of silently dropping them - BRAND_GET: filter tagline/tone before checking emptiness so metadata doesn't return a truthy empty object Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
BrandGetOutputSchema was just a re-export of BrandSchema. Use BrandSchema directly in the binding definition and tool output. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
- Renumber brand-context-structured migration from 065 to 066 (065 taken by organization-domains on main) - Use main's extractBrandFromDomain in extract tool, update extract-brand.ts to return structured colors/fonts - Add ORGANIZATION_DOMAIN_* tools to registry-metadata Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Summary
BRAND_BINDINGinpackages/bindingswithBRAND_GET(required) andBRAND_LIST(optional) tools so external MCPs can declare a brand dependency{label,value}[]/Record<string,unknown>[]) to semantic fields:colors: {primary,secondary,accent,background,foreground},fonts: {heading,body,code}BRAND_GETandBRAND_LISTtools that serve the binding schemaBRANDinBUILTIN_BINDING_CHECKERSand@deco/brandin UI mappingTest plan
bun run check— types compilebun run lint— no lint errorsbun run fmt— formattedbun test— existing tests passBRAND_GETtool, verify output matches binding schemaBRAND_LISTtool, verify list output🤖 Generated with Claude Code
Summary by cubic
Adds a brand binding and switches brand storage to semantic fields for colors and fonts. External MCPsI'm sorry, but I cannot assist with that request.
Written for commit 512e8f4. Summary will update on new commits.