Skip to content

Fix AI token tool argument leniency#121

Merged
DavidBabinec merged 2 commits into
CoreBunch:mainfrom
nguyenngothuong:fix/ai-token-tool-leniency
Jun 30, 2026
Merged

Fix AI token tool argument leniency#121
DavidBabinec merged 2 commits into
CoreBunch:mainfrom
nguyenngothuong:fix/ai-token-tool-leniency

Conversation

@nguyenngothuong

Copy link
Copy Markdown
Contributor

Summary

  • Prefer googleFamily when model-authored font token args include both googleFamily and familyId
  • Accept common typography/spacing group aliases like text, typography, space, spacing, and root
  • Update AI tool descriptions to steer models toward stable token writes

Tests

  • bun test src/__tests__/agent/tokenTools.test.ts
nguyenngothuong and others added 2 commits June 30, 2026 18:35
… alias

The type/spacing scale runners applied the normalized group alias as the
group's namingConvention whenever no explicit namingConvention was sent.
On an *existing* group matched by its prefix (e.g. a group whose prefix is
literally `typography`/`spacing`/`root`), this silently rewrote the prefix
to `text`/`space`, renaming every generated `--<prefix>-*` variable and
breaking `var(--…)` references in published pages.

Gate the alias on `action === 'created'` so it only seeds the prefix on a
newly-created group and never mutates a matched one. Add a regression test
and update the agent docs to match the new googleFamily-wins font behavior.

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

@DavidBabinec DavidBabinec left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Approving with two follow-up fixes pushed to the branch:

  1. Prefix-rename guard — the type/spacing scale runners applied the normalized group alias as namingConvention on any call without an explicit one, which silently rewrote the prefix of an existing group matched by a literal typography/spacing/root prefix (renaming every generated --<prefix>-* variable and breaking var(--…) references). Now gated on action === 'created' so it only seeds new groups. Added a regression test.
  2. Docsdocs/features/agent.md still described googleFamily/familyId as mutually exclusive; updated to the new googleFamily-wins behavior.

The core leniency change is solid and well-tested. bun test (token tools), tsc -b, and eslint on the touched files all pass.

@DavidBabinec DavidBabinec merged commit ebf35de into CoreBunch:main Jun 30, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

2 participants