Consolidate mirrored agent-type/ide-type tables into shared modules - #849
Merged
Conversation
AGENT_TYPES, CLI_AGENT_TYPES, and their predicates/sanitizers were duplicated verbatim between apps/server/src/agent-type-settings.ts and apps/web/src/lib/agent-types.ts; same for IDE_TYPES between apps/server/src/ide-settings.ts and apps/web/src/lib/ide-types.ts. Adding an agent type meant editing both copies. Move the pure constants and predicates into dependency-free apps/server/src/shared/agent-types.ts and shared/ide-types.ts, following the media-file-types.ts shape from #844: the server settings modules re-export so their importers are untouched, and the web lib modules re-export across the workspace boundary so web importers keep their "@/lib/..." specifiers. Pool-dependent getters stay on the server; display labels and web-only helpers stay in web. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
This was referenced Jul 30, 2026
This was referenced Aug 8, 2026
selfcontained
added a commit
that referenced
this pull request
Aug 10, 2026
Completes the errorMessage sweep started server-side in #914. apps/web carried a byte-identical reimplementation in jobs-helpers.tsx plus one inline copy in markdown.tsx; both now route through the canonical apps/server/src/shared/lib/error-message.ts. Web imports a VALUE here, so it follows the #844/#849 shape: a new dependency-free re-export module at apps/web/src/lib/errors.ts keeps call sites on "@/lib/..." instead of reaching across the boundary directly. Test coverage for the helper already exists in apps/server/test/error-message.test.ts and is a strict superset of the jobs-helpers.test.tsx block, which is dropped. Co-authored-by: Claude Opus 5 (1M context) <noreply@anthropic.com>
selfcontained
added a commit
that referenced
this pull request
Aug 13, 2026
apps/server/src/shared/agent-types.ts has been the single source of truth for the agent-type tables since PR #849, but three within-server hand-written copies survived that consolidation. Point them all at the shared tables. - agents/types.ts: the literal AgentType union becomes a re-export of the shared derived type (identical member set). - shared/mcp/crud-tools.ts: JOB_AGENT_TYPES / TEMPLATE_AGENT_TYPES become aliases of CLI_AGENT_TYPES / AGENT_TYPES. - shared/mcp/persona-interaction-tools.ts: LAUNCH_PERSONA_AGENT_TYPES / LaunchPersonaAgentType become aliases of CLI_AGENT_TYPES / CliAgentType. Co-authored-by: Claude Opus 5 (1M context) <noreply@anthropic.com>
selfcontained
added a commit
that referenced
this pull request
Aug 15, 2026
The eight-colour brand palette existed in three places, with the hexes
duplicated a fourth time:
1. apps/server/src/server/static-theme.ts — VALID_ICON_COLORS id tuple
2. apps/web/src/hooks/use-icon-color.ts — ICON_COLORS id tuple, plus
ICON_COLOR_OPTIONS re-listing the same hexes as `swatch`
3. scripts/generate-icon-colors.ts — the same ids with primary/dark hexes
Adding a colour meant editing three files in two TS programs. All three now
derive from a new dependency-free apps/server/src/shared/icon-colors.ts
(the #844/#849 shared-module pattern), which holds the ids and both hex
channels in one ordered table.
Behaviour is unchanged: the tuple order (teal, blue, purple, red, orange,
amber, pink, cyan) is preserved exactly, so the Appearance settings swatch
order and the server's `iconColor must be one of: ...` error string are
byte-identical. Re-running the icon generator produces zero git diff.
Co-authored-by: Claude Opus 5 (1M context) <noreply@anthropic.com>
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.
What
Moves the agent-type and IDE-type constants/predicates that were duplicated verbatim across the server/web boundary into two new dependency-free shared modules:
apps/server/src/shared/agent-types.ts—AGENT_TYPES,CLI_AGENT_TYPES,isAgentType,isCliAgentType,sanitizeEnabledAgentTypesapps/server/src/shared/ide-types.ts—IDE_TYPES,isIdeType,sanitizeEnabledIdesapps/server/src/agent-type-settings.tsandide-settings.tskeep their Pool-dependent getters and re-export the pure symbols, so no server importer changes.apps/web/src/lib/agent-types.tsandide-types.tsre-export across the workspace boundary (same shape asmedia-file-types.tsfrom #844) and keep the web-only labels/helpers (AGENT_TYPE_LABELS,sortAgentTypes,isNestedReviewAgent,IDE_LABELS), so no web importer changes either.Why it's tech debt
Adding an agent type today means editing two identical tables that have already started to drift in small ways (predicate signatures, comment wording). Same failure mode that produced the media file-type bugs fixed in #844.
Zero behavior change: only widening of
isAgentType/isCliAgentTypeweb signatures from(value: string)to(value: unknown), which is safe for all callers.Validation
pnpm run check✅pnpm run finalize:web✅pnpm run test— 2362 server + 499 web + 60 passed ✅pnpm run test:e2e— 174 passed, 12 skipped ✅Queued next
Top of the tech-debt backlog: deduplicating the verbatim server↔web wire types (
JobRecord/Job,TemplateRecord/Template,ReleaseJob), one file at a time.🤖 Generated with Claude Code