Skip to content

Add navigation rules#1949

Merged
dan-lee merged 7 commits intomainfrom
feat/navigation-rules
Feb 13, 2026
Merged

Add navigation rules#1949
dan-lee merged 7 commits intomainfrom
feat/navigation-rules

Conversation

@dan-lee
Copy link
Contributor

@dan-lee dan-lee commented Feb 10, 2026

  • Add navigationRules config for declaratively transforming navigation items
  • Supported rule types: insert, modify, remove, sort, 'move'
  • Rules match items by label or index path (e.g. Shipments/Domestic)

Docs preview

Supersedes: #1904

@dan-lee dan-lee requested review from Copilot and mosch February 10, 2026 15:33
@dan-lee dan-lee added the feature Feature label Feb 10, 2026
@vercel
Copy link

vercel bot commented Feb 10, 2026

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated (UTC)
zudoku-cosmo-cargo Ready Ready Preview, Comment Feb 13, 2026 3:58pm
zudoku-dev Ready Ready Preview, Comment Feb 13, 2026 3:58pm

Request Review

@github-actions
Copy link

github-actions bot commented Feb 10, 2026

Preview build of published Zudoku package for commit 1a7b616.

See the deployment at: https://0bb54732.cosmocargo-public-package.pages.dev

Note

This is a preview of the Cosmo Cargo example using the Zudoku package published to a local registry to ensure it'll be working when published to the public NPM registry.

Last updated: 2026-02-13T16:00:29.985Z

Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

Adds a declarative navigationRules configuration to transform generated navigation (especially OpenAPI-derived sidebars) without changing source schemas, and wires those rules through the Vite virtual module into the runtime navigation context.

Changes:

  • Introduces navigationRules config schema/types and Vite virtual module export for resolved rules.
  • Adds rule application utilities (pathMatcher, applyRules) with Vitest coverage.
  • Updates runtime navigation + a few UI components to consume rule-modified navigation and reuse shared navigation helpers.

Reviewed changes

Copilot reviewed 22 out of 26 changed files in this pull request and generated 6 comments.

Show a summary per file
File Description
packages/zudoku/src/vite/plugin-navigation.ts Resolves navigation + navigation rules and exports both via virtual:zudoku-navigation.
packages/zudoku/src/types.d.ts Updates virtual module typings to include configuredNavigationRules.
packages/zudoku/src/lib/plugins/openapi/OperationList.tsx Uses usePrevNext for pagination fallback based on navigation order.
packages/zudoku/src/lib/navigation/pathMatcher.ts Adds path parsing/matching for rule targets (label/index paths).
packages/zudoku/src/lib/navigation/pathMatcher.test.ts Adds unit tests for path matching behavior (incl. negative indices).
packages/zudoku/src/lib/navigation/applyRules.ts Applies insert/modify/remove/sort rules to navigation trees with warnings.
packages/zudoku/src/lib/navigation/applyRules.test.ts Adds extensive unit tests for rule application and scoping.
packages/zudoku/src/lib/core/ZudokuContext.ts Adds navigationRules to context options/state.
packages/zudoku/src/lib/components/navigation/utils.ts Adds getItemPath/getFirstMatchingPath, tweaks list item spacing, updates shouldShowItem signature.
packages/zudoku/src/lib/components/navigation/NavigationWrapper.tsx Adjusts wrapper layout classes (gap removal).
packages/zudoku/src/lib/components/navigation/NavigationItem.tsx Updates shouldShowItem call site; doc-item label/badge rendering tweak.
packages/zudoku/src/lib/components/context/ZudokuContext.ts Applies navigationRules to the computed sidebar navigation (with dev warnings).
packages/zudoku/src/lib/components/TopNavigation.tsx Uses shared helpers and updated shouldShowItem signature.
packages/zudoku/src/lib/components/MobileTopNavigation.tsx Updates shouldShowItem call site for mobile top nav.
packages/zudoku/src/config/validators/validate.ts Adds navigationRules to config validation/types.
packages/zudoku/src/config/validators/NavigationSchema.ts Adds resolved rule types + NavigationResolver.resolveRules() and initialization caching.
packages/zudoku/src/config/validators/InputNavigationSchema.ts Adds Zod schemas/types for navigation rules (insert/modify/remove/sort).
packages/zudoku/src/app/main.tsx Passes configuredNavigationRules into app options.
examples/cosmo-cargo/zudoku.config.tsx Demonstrates navigationRules usage in an example config.
examples/cosmo-cargo/pages/api-shipments/getting-started.mdx Adds example doc content referenced by rules.
docs/sidebar.ts Adds the new Navigation Rules guide to docs sidebar.
docs/public/docs/navigation-rules/insert-doc-end.png Adds screenshot asset for the guide.
docs/pages/docs/guides/navigation-rules.mdx Adds a practical guide for using navigation rules.
docs/pages/docs/configuration/navigation.mdx Adds configuration reference section for navigation rules and updates code fence.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

@dan-lee dan-lee force-pushed the feat/navigation-rules branch from 3de66ac to 1a7b616 Compare February 13, 2026 15:56
@dan-lee dan-lee merged commit 0da44d3 into main Feb 13, 2026
12 checks passed
@dan-lee dan-lee deleted the feat/navigation-rules branch February 13, 2026 16:41
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

feature Feature

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants