Skip to content

fix(forge): templates screens under the fallow limits - #991

Merged
LinuxDevil merged 1 commit into
mainfrom
fix/forge-templates-fallow
Nov 8, 2026
Merged

LinuxDevil merged 1 commit into
mainfrom
fix/forge-templates-fallow

Conversation

@LinuxDevil

Copy link
Copy Markdown
Owner

Why

main's CI test job fails at npm run fallow because of the Templates screen from #985:

  • health: TemplateSheet (cognitive 18, cyclomatic 21) and TemplatesScreen (cognitive 18) in apps/agent-forge/src/screens/templates/ are over the limits.
  • dupes: AgentListScreen.tsx:50-67 repeats TemplatesScreen.tsx:46-63 (the loading grid and the error card), and agentCard.css:13-23 repeats templates.css:76-86 (the card surface).

This PR splits the components and shares the repeated code. Thresholds, ignores and the fallow config are unchanged. The other red merges in the last 10 (#984, #986) failed on LabelsDialog, which #988 already fixed.

Changes

Behaviour is unchanged:

  • TemplatesScreen.tsx: useTemplateList() holds the list fetch, its error and Retry. CategoryPills renders the category filter. TemplatesBody picks one of the error card, the loading grid, the empty state or the grid.
  • TemplateSheet.tsx: useTemplateDetail(templateId) holds the detail fetch, the stale-id guard and Retry. useCreateFromTemplate(templateId, title) holds the create, toast and navigate. TemplateSheetDetail renders the requirements and the README.
  • New screens/listStates.tsx with LoadingGrid (six skeletons plus the hidden status line) and LoadErrorCard (error card with Retry). Both screens now use them in place of their own copies.
  • New ui/tileCard.css with a .tile-card class: the surface, border, radius, shadow, hover and reduced-motion rules that .agent-card and .template-card both had. AgentCard and TemplateCard add the class and import the stylesheet. It still loads after agents.css, so the cascade is the same.

Testing

  • Two new cases in TemplatesScreen.test.tsx cover the behaviour that moved and had no test: an unknown ?category= falls back to All, and the All pill clears the filter; a template with no requirements shows the note; Cancel closes the sheet; an unknown id shows No template '<id>'. with the id as the title. Both passed on the old code before the refactor and still pass after it.
  • Forge client tests: 182 files / 3471 tests pass. typecheck and typecheck:server pass, and eslint has no errors.
  • fallow health --complexity with an empty coverage file: no templates or agent list function is listed. fallow dupes finds no duplication, and fallow dead-code finds no issues.

🤖 Generated with Claude Code

Split TemplatesScreen and TemplateSheet into hooks and subcomponents,
share the list loading grid and error card between the agents and
templates screens, and move the shared card surface CSS into one
tile-card stylesheet. No behaviour change.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@LinuxDevil
LinuxDevil merged commit 9ae487e into main Nov 8, 2026
6 checks passed
@LinuxDevil
LinuxDevil deleted the fix/forge-templates-fallow branch November 8, 2026 21:58
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