Skip to content

refactor(detail): split SkillDetail.jsx into focused modules - #10

Merged
Arismemo merged 5 commits into
mainfrom
refactor/split-skill-detail
Sep 29, 2026
Merged

Arismemo merged 5 commits into
mainfrom
refactor/split-skill-detail

Conversation

@Arismemo

Copy link
Copy Markdown
Owner

Summary

Pure move, no intended behaviour change. SkillDetail.jsx 987 → 401 lines, split in 5 independently green commits:

New file Lines Content
utils/markdownDoc.js 64 frontmatter split/parse, heading extraction, slugify
utils/highlight.js 143 marked/hljs setup, highlighting, render LRU
components/detail/FileTreeSidebar.jsx 176 file tree, filter, resizable width, collapsed rail
components/detail/DetailToolbar.jsx 129 breadcrumb, actions, overflow menu, mode switch
hooks/useDocOutline.js + components/detail/DocOutline.jsx 117 + 44 outline visibility, scroll-spy, jump

Draft / save / apiRef logic intentionally stays in SkillDetail.jsx.

Verification

  • npm run check: lint (same 4 pre-existing warnings, none in touched files), 38/38 tests (+9 new unit tests for moved pure helpers), build OK
  • Entry bundle unchanged (app 100.14 kB); hljs still only in the lazy SkillDetail chunk (167.4 → 168.2 kB)
  • oxlint -D no-undef -D no-unused-vars on all moved code: clean apart from browser globals
  • SSR render smoke of the 4 components (breadcrumb, dirty marker, dir-first sort, selected file inside collapsed dir, rail, outline hidden/visible)
  • Not verified: interactive browser run (login step blocked in the agent session)

ui-regression.test.mjs breadcrumb test now reads DetailToolbar.jsx; assertions unchanged.

🤖 Generated with Claude Code

Arismemo and others added 5 commits September 28, 2026 13:43
Pure move of splitFrontmatter / extractHeadings / slugifyHeading /
parseFrontmatterPairs out of SkillDetail.jsx, plus unit tests pinning
their current behaviour.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…ighlight

marked/hljs setup, languageForPath, highlightCode, splitHighlightedLines,
the render LRU and renderMarkdown move out of SkillDetail.jsx unchanged.
Only the lazily loaded detail chunk imports it, so the entry bundle size
is unchanged (app 100.14 kB before and after).

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
buildFileTree, FileTreeNode, the path filter, open-dir state and the
resizable width move into components/detail/FileTreeSidebar.jsx. The
auto-collapse ResizeObserver stays in SkillDetail (it watches the
detail scroll area) and drives the sidebar through collapsed /
onCollapse / onExpand. SkillDetail is keyed by skill id, so the moved
state still resets per skill exactly as before.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Breadcrumb, meta chips, copy/download/history buttons, the overflow menu
(with its outside-click / Escape handling) and the preview/edit switch
move to components/detail/DetailToolbar.jsx. Copy feedback, the version
modal and save/mode logic stay in SkillDetail and are passed in.

The breadcrumb regression test now reads the toolbar file; its
assertions are unchanged.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Outline visibility preference, the viewport-width gate, scroll-spy and
jumpToHeading move to hooks/useDocOutline.js; the outline nav / restore
button JSX moves to components/detail/DocOutline.jsx. The four-part
visibility condition that was repeated three times is now one
'visible' flag. The hook is called right after the heading-id DOM
patch effect so effect order is unchanged.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@Arismemo
Arismemo merged commit 566dabc into main Sep 29, 2026
2 checks passed
@Arismemo
Arismemo deleted the refactor/split-skill-detail branch September 29, 2026 02:21
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