Skip to content

Chore: vocs v2 migration#519

Open
scode2277 wants to merge 13 commits into
developfrom
chore/vocs-v2
Open

Chore: vocs v2 migration#519
scode2277 wants to merge 13 commits into
developfrom
chore/vocs-v2

Conversation

@scode2277

Copy link
Copy Markdown
Collaborator

vocs 2.0 is a ground-up rewrite on Waku (React Server Components) + Vite 8, so this spans config, routing, components, CSS, build scripts, and CI. pnpm docs:build passes in test environment. Here it doesn't because we need to update the outputs path on CF dashboard (see Follow-ups section)

How to review

Go commit by commit (13 themed commits). Each commit is one coherent step (ESM switch, deps bump, config + routing, RSC boundaries, native mermaid, theming, etc.), so the diffs read top to bottom.

Why one PR

Every change here is required for a green build. Splitting them would leave the site un-buildable at each step, so they ship together.

What changed, by area

Root (vocs.config.ts, package.json, pnpm-lock.yaml, .gitignore)

  • Config .tsx → .ts (vocs 2.0 only discovers .ts); head() JSX rewritten with createElement; added srcDir, renderStrategy: 'full-static', editLink.link, string ogImageUrl; dropped vite.define.
  • ESM package ("type": "module"), vocs 2.0.10 + waku, scripts repointed to .cjs (as required by ESM package).
  • .gitignore: ignore Waku's docs/pages.gen.ts; printable path moved to public/ (as static assets are now tracked in the public folder by vocs).

docs/pages/ (~300 files)

  • _layout.tsx (new): the global Waku layout that wraps every page. It provides the tag context once (<TagProvider>) for the whole site, instead of each MDX page wrapping itself.
  • _slots.tsx (new): vocs 2.0's slot file. Exports Footer (the license line, rendered inside after the article) and SidebarHeader (the tag filter, pinned at the top of the sidebar above the nav).
  • _root.css (new): vocs 2.0's global user stylesheet (replacing the old docs/styles.css)
  • Per-page <TagProvider>/<TagFilter /> removed from ~299 pages (now provided globally by the layout + slot above); TagList, AttributionList, and ContributeFooter kept.
  • opsec/control-domains/ route-collision moves (X.mdx → X/overview.mdx) + link fixes.
  • Mermaid component removed as vocs now handles mermaid code blocks correctly

docs/ (top level)

  • Deleted old styles.css (migrated into _root.css) and unused footer.tsx (migrated into _slots.tsx).

components/

  • added "use client" on interactive components; updated react-router-dom Link to vocs Link; attack-surface SSR coord rounding; DevOnly → process.env.CF_PAGES_BRANCH.
  • Dark mode .dark/prefers-color-scheme → [data-vocs-theme]; footer/attack-surface/governance use local theme tokens.
  • Moved certified-protocols/ under cert/; removed old MermaidRenderer and dead withTagFiltering.
  • Tag filter reworked for vocs 2.0's sidebar DOM + SidebarHeader slot.

utils/

  • All CommonJS build scripts renamed .js → .cjs.
  • Generators write to root public/ / dist/public; config parsers read vocs.config.ts.
  • tags-fetcher section-mapping fix + regenerated fetched-tags.json.

.github/workflows/

  • preview-build.yml: artifact docs/dist → dist/public.
  • vocs-config-reminder.yml: vocs.config.tsx → .ts.
  • s3-upload.yml: process-images.cjs.

Follow-ups

  • Cloudflare Pages dashboard (required for deploy): change build-output dir docs/dist → dist/public (external, not in repo).
  • Searchbar indexer: dropped from postdocs:build for now; needs a non-trivial rewrite for vocs 2.0's search index → separate PR.
  • just-install: its postinstall (GitHub binary download) 403s in CI, so it's temporarily in ignoredBuiltDependencies (no local just auto-install until fixed) → separate PR.

scode2277 added 13 commits June 12, 2026 18:20
… remove dead code

- Relocated components/certified-protocols/ to components/cert/certified-protocols/
since the component is cert-family and css
- Deleted the unused withTagFiltering HOC (tsx + css).
Vocs 2.0 / Waku require the package to be ESM. Without "type": "module", Waku's static generation crashes

- Add "type": "module" to package.json.
- Rename the CommonJS build scripts to .cjs (they use require/module.exports)
- Remove the mermaid-wrapper script invocation from docs:dev/docs:build and its script entry; native mermaid support lands in a later commit.
- Bump vocs 1.4.1 -> 2.0.10 (devDependency).
- Add waku 1.0.0-beta.1. vocs 2.0 declares waku as an optional peer, so pnpm does not install it, but vocs imports it unconditionally and crashes without it
- vocs 2.0 only discovers vocs.config.{ts,js,mjs,mts}; a .tsx config is silently ignored.
- Drop the vite.define __IS_MAIN_BRANCH__ block
- Add docs/pages/_layout.tsx (global layout, wraps every page in TagProvider)
-  _slots.tsx (Footer + SidebarHeader slots)
- new _root.css for global styles
- Waku forbids a file and folder sharing a path, so had to move the four control-domains landing pages X.mdx -> X/overview.mdx
The tag filter and its context are now set up once globally (in the page layout
and sidebar slot), so every page no longer needs to wrap itself in
<TagProvider>/<TagFilter />.

This updates ~299 pages to drop those wrappers while keeping the tag list,
attribution, and contribute footer. The page template is updated to match.
vocs 2.0 renders pages as server components by default, so anything using hooks,
context, event handlers, or browser APIs needs a "use client" marker, and a few
components needed other adjustments to render correctly.
vocs 2.0 serves static files from the root public/ directory, not docs/public/,
so anything fetched at /foo must live there. This fixes the certs Export and the Print button.
- Update .gitignore for the new printable path, and ignore Waku's generated docs/pages.gen.ts route types.
vocs 2.0 renders mermaid code blocks natively, so the old workaround is gone.
vocs 1.x couldn't parse them, so there was a custom MermaidRenderer component plus
a build step that rewrote raw blocks into <MermaidRenderer>.
Rework the sidebar tag filter for vocs 2.0's DOM and slot system.

- Remap the sidebar control logic to vocs 2.0's data attributes
- Move the filter into the SidebarHeader slot: drop the old fixed positioning
- Fix section mapping in tags-fetcher: key each section on the folder that directly contains its pages
Theming:
- Replace .dark / :root:not(.dark) and @media (prefers-color-scheme) with [data-vocs-theme]-driven selectors across the component stylesheets
- Delete the now-unused docs/footer.tsx.
- Attack-surface and governance: define their theme tokens locally on their root elements instead of borrowing from cert's control.css

CI / workflows:
- preview-build.yml: upload dist/public instead of docs/dist
- vocs-config-reminder.yml: reference vocs.config.ts instead of vocs.config.tsx.
@scode2277 scode2277 self-assigned this Jun 15, 2026
@scode2277 scode2277 added local setup Improvements or additions to the local setup dependencies Pull requests that update a dependency file enhancement Updates that improve or refine existing features, user experience, or system performance. labels Jun 15, 2026

@frameworks-volunteer frameworks-volunteer left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Model: z-ai/glm-5.1 Reasoning: medium Provider: openrouter

Review: Chore: vocs v2 migration

Reviewed all non-page infrastructure files (config, components, utils, workflows, CSS) and spot-checked MDX pages.

Security: No issues found

  • No hardcoded secrets, tokens, or API keys
  • No injection vectors -- querySelector selectors use vocs data attributes, not user input
  • DevOnly.tsx: process.env.CF_PAGES_BRANCH is equivalent to the old __IS_MAIN_BRANCH__ vite define (both resolved at build time on CF Pages). No exposure of env vars to client bundles since renderStrategy: 'full-static'.
  • Dependencies: vocs 2.0.10 + waku 1.0.0-beta.1 are the expected upgrade path.

QA: Looks good, with observations

Correctness:

  • extractUrlSegment in tags-fetcher.cjs now returns parts[parts.length - 2] instead of parts[0], giving nested sections their own identity instead of collapsing onto the parent. The fetched-tags.json diff confirms mappings were regenerated consistently (e.g., "Isolation and Sandboxing" -> "isolation" instead of "devsecops"). This aligns with vocs 2.0 sidebar structure.
  • loadSidebarConfig in generate-folder-indexes.cjs now strips ALL import lines (/(?:import[^\n]*\n)+/) instead of just the first -- correct since vocs.config.ts now has two imports.

CSS / Theming:

  • Dark mode selectors consistently migrated: .dark / :root:not(.dark) -> [data-vocs-theme='dark'] / :not([data-vocs-theme='dark']).
  • vocs CSS class names replaced with data-attribute selectors. Clean and consistent.
  • CSS custom properties used for theme tokens in GovernanceSDLC.css and ChecklistItem.css (replacing var(--vocs-color_background)). Good approach.

Components:

  • "use client" directives added to all interactive components. Correct for RSC boundaries.
  • react-router-dom Link -> vocs Link migration is consistent.
  • to prop type casting (as ComponentProps<typeof Link>["to"]) in AttackSurfaceDashboard and GovernanceSDLCPipeline is pragmatic; not ideal but the vocs Link type differs from react-router-dom.
  • AttackSurfaceDashboard: round2 helper for SSR coord rounding prevents hydration mismatches. Reasonable.
  • GovernanceSDLCPipeline: Link -> <a> for the "Jump to section" anchor is correct (same-page hash links do not need client-side routing).

MDX pages (~300):

  • Mechanical removal of TagProvider/TagFilter wrappers and imports, now provided globally by _layout.tsx + _slots.tsx. Spot-checked several -- all consistent.
  • Route-collision fix: opsec/control-domains subpages renamed from X.mdx to X/overview.mdx with matching link updates. Correct.

Follow-ups acknowledged:

  • Searchbar indexing dropped from postdocs:build (separate PR needed). Acceptable.
  • just-install in ignoredBuiltDependencies (CI 403 workaround, separate PR). Acceptable.
  • CF Pages build-output dir change is external (dashboard config, not repo). Noted in PR body.

CI: lint and sidebar-reminder pass. CF Pages deploy failure is expected (output path config change needed externally, not in this PR).

No blocking issues. Approving.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

dependencies Pull requests that update a dependency file enhancement Updates that improve or refine existing features, user experience, or system performance. local setup Improvements or additions to the local setup

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants