Skip to content

Refactor/toolrenderer - #108

Merged
divyeshio merged 17 commits into
mainfrom
refactor/toolrenderer
Mar 11, 2026
Merged

divyeshio merged 17 commits into
mainfrom
refactor/toolrenderer

Conversation

@divyeshio

Copy link
Copy Markdown
Owner

No description provided.

- Renamed the component from `RuntimePreview` to `ToolRenderer` across the codebase.
- Updated the registry configuration to reflect the new component name and path.
- Removed the old test file for `RuntimePreview` and added a new test suite for `ToolRenderer` with comprehensive tests for various parameter types.
- Introduced a new `renderer.ts` file to define types for parameter rendering.
- Updated the tool editor to use `ToolRenderer` instead of `RuntimePreview`.
- Updated the tool-renderer component to improve structure and readability.
- Introduced a new renderer type definition for parameter rendering context and entries.
- Adjusted the registry to include the new renderer type and removed obsolete entries.
…s with documentation

- Introduced ToolRenderer component for rendering CLI tool parameters interactively.
- Added GeneratedCommand component for displaying real-time generated CLI command strings.
- Implemented JSON Output component for displaying tool definitions in JSON format.
- Created comprehensive documentation for each component, including installation and usage examples.
- Updated navigation structure to include new documentation sections for the components.
- Enhanced the Tool Editor with improved state management and UI features.
- Integrated new components into the existing UI framework for seamless usage.
- Updated Vite configuration to support MDX files and improved code styling with rehype plugins.
…nderer

- Created a new demo entry file to manage demo components and their code.
- Implemented JSON output demo with sample tool definition.
- Added tool renderer demo with interactive parameter management.
- Updated MDX components to include new demos.
- Introduced navigation structure for documentation sections.
- Migrated existing tool renderer demo to new structure and removed old file.
- Updated API documentation for new components and their usage.
- Enhanced the main documentation layout to display demos alongside descriptions.
- Cleaned up unused styles and adjusted button sizes for better UI consistency.
- Introduced `useIsMobile` hook for mobile detection based on viewport width.
- Created `index.css` for global styles and theme variables using Tailwind CSS.
- Updated root layout to include a sticky header for better navigation.
- Refactored documentation routes to remove unnecessary scroll area and improve layout.
- Changed tool command examples in documentation from "subfinder" to "curl" for consistency.
- Enhanced tools index page with a sidebar for filtering tools by category and tag.
- Adjusted layout for tool editing and viewing pages to improve user experience.
Copilot AI review requested due to automatic review settings March 11, 2026 16:23

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Pull request overview

This PR refactors the CLI tool parameter preview into a new ToolRenderer API, adds an MDX-driven docs section with live demos + syntax highlighting, and updates navigation/layout to use a reusable sidebar shell.

Changes:

  • Add MDX support to Vite and implement /docs routes that render MDX pages with previews/demos.
  • Rename/refactor RuntimePreview to ToolRenderer with a pluggable renderer catalog (defaultComponents() + ParameterRendererEntry).
  • Introduce a reusable Sidebar UI system and update tools/docs layouts accordingly.

Reviewed changes

Copilot reviewed 60 out of 62 changed files in this pull request and generated 2 comments.

Show a summary per file
File Description
vite.config.ts Adds MDX pipeline (remark/rehype) and updates docs prerender + React plugin include.
src/vite-env.d.ts Adds TS module typing for importing *.mdx.
src/styles/app.css Tweaks Tailwind plugin ordering, theme vars, Shiki styling, and scrollbar behavior.
src/routes/tools/index.tsx Migrates tools list layout to the new Sidebar components.
src/routes/tools/$toolName/index.tsx Switches runtime preview usage to ToolRenderer + catalog.
src/routes/tools/$toolName/edit.tsx Wraps editor route content to account for sticky header spacing.
src/routes/index.tsx Minor CTA button padding tweak.
src/routes/docs/route.tsx Adds /docs layout route with sidebar navigation and outlet.
src/routes/docs/index.tsx Replaces registry listing with docs overview + embedded demos.
src/routes/docs/collection/ui.mdx Adds MDX doc page for the “Basic UI” block.
src/routes/docs/collection/tool-renderer.mdx Adds MDX doc page for ToolRenderer with API reference.
src/routes/docs/collection/tool-editor.mdx Adds MDX doc page for the Tool Editor block.
src/routes/docs/collection/json-output.mdx Adds MDX doc page for JsonOutput.
src/routes/docs/collection/generated-command.mdx Adds MDX doc page for GeneratedCommand.
src/routes/docs/$componentName.tsx Replaces registry detail page with MDX component rendering.
src/routes/__root.tsx Adjusts global CSS import and makes navbar sticky.
src/routeTree.gen.ts Regenerates route tree to include /docs as a layout route.
src/lib/api/docs.api.ts Adds isomorphic MDX module loader for docs pages.
src/hooks/use-mobile.ts Adds useIsMobile hook for responsive sidebar behavior.
src/components/ui/sidebar.tsx Introduces full sidebar component system (desktop + mobile sheet).
src/components/ui/sheet.tsx Adds sheet (dialog) UI primitives used by mobile sidebar.
src/components/tool-editor-ui/tool-card.tsx Makes tool cards clickable and adds external link + edit/delete actions.
src/components/square-card-skeleton.tsx Tweaks skeleton min-height utility class.
src/components/docs/steps.tsx Adds MDX-friendly Steps/Step components.
src/components/docs/nav.ts Defines docs navigation structure for sidebar + overview.
src/components/docs/mdx-components.tsx Adds MDX component mappings (tabs, previews, copyable code blocks, etc.).
src/components/docs/demos/tool-renderer-demo.tsx Adds live demo component for ToolRenderer.
src/components/docs/demos/json-output-demo.tsx Adds live demo component for JsonOutput.
src/components/docs/demos/index.ts Creates demo registry + raw-code imports for syntax view.
src/components/docs/demos/generated-command-demo.tsx Adds live demo component for GeneratedCommand.
src/components/docs/component-preview.tsx Adds preview/code tabs with Shiki code highlighting.
src/components/docs/component-preview-tabs.tsx Adds reusable tabs wrapper for preview vs code.
src/components/docs/code-block-command.tsx Adds multi-package-manager command block with copy support.
scripts/generate-tools-json.ts Changes tools summary output to include url instead of metadata.
registry/commandly/tool-editor/preview-tabs.tsx Updates tool editor preview to use ToolRenderer.
registry/commandly/runtime-preview.tsx Refactors runtime preview into ToolRenderer + renderer catalog.
registry/commandly/lib/types/renderer.ts Adds renderer types used by ToolRenderer catalog.
registry/commandly/tests/tool-renderer.test.tsx Adds coverage for new ToolRenderer behavior + catalog precedence.
registry/commandly/tests/runtime-preview.test.tsx Removes old RuntimePreview test.
registry.json Renames registry component entry from runtime-preview to tool-renderer and adds renderer types.
public/tools.json Updates tool summaries to now include url and drop metadata.
public/tools-collection/*.json Adds $schema and url fields to tool definitions.
public/r/ui.json Updates embedded registry content to new ToolRenderer + renderer types.
public/r/tool-renderer.json Adds registry item for tool-renderer.
public/r/tool-editor.json Updates embedded preview-tabs and renderer content references.
public/r/runtime-preview.json Removes old registry item JSON.
public/r/registry.json Updates registry index to tool-renderer and adds renderer types.
public/r/commandly-utils.json Removes registry item JSON (now excluded).
public/r/commandly-types.json Removes registry item JSON (now excluded).
package.json Adds MDX/shiki deps, bumps tooling deps, and changes build command.
mcp/index.ts Updates MCP tool registration API and schemas.
components.json Updates shadcn config to point to src/index.css.
.oxfmtrc.json Updates Tailwind stylesheet path for formatting.
Comments suppressed due to low confidence (6)

src/components/docs/component-preview.tsx:1

  • entry can be undefined for an unknown name, but preview={<entry.component />} will throw at runtime. Guard both preview and code (e.g., render a fallback UI or pass null for preview when !entry).
    src/routes/docs/$componentName.tsx:1
  • The loader stores a React component in a module-level Map, but that cache won’t be hydrated from server → browser on initial SSR render (the client will often see Component as undefined and render “Documentation not found”). Prefer loading the MDX module in the component on the client (e.g., via a Suspense pattern) or return only serializable data from the loader and resolve the MDX component in RouteComponent (client-side) instead of relying on a shared in-memory cache.
    src/components/ui/sidebar.tsx:1
  • The import source "radix-ui" is not a standard Radix package and is not listed in package.json. This will likely fail at build time. Use the appropriate Radix package (commonly @radix-ui/react-slot for Slot) or the project’s established Radix import path.
    src/components/ui/sheet.tsx:1
  • The import source "radix-ui" is not a standard Radix package and is not listed in package.json. This is likely to break compilation. Use the appropriate Radix dialog package (commonly @radix-ui/react-dialog) or the project’s established Radix import path.
    src/components/tool-editor-ui/tool-card.tsx:1
  • The whole card is clickable (onClick={handleCardClick}), but nested actions (notably the Edit <Link> button) don’t stop propagation. Clicking Edit will likely also trigger the card navigation and send users to the tool details route instead of the edit route. Add stopPropagation() (and typically preventDefault() only where needed) to the Edit button/link click handler, similar to what’s already done for the external-link button and delete button.
    src/routes/docs/index.tsx:1
  • section.section is optional in docsNav and is undefined for the first section, which can cause React key warnings and unstable rendering. Use a stable fallback key (e.g., array index or a derived key like section.section ?? "root").

Comment thread package.json
"module": "src/index.tsx",
"scripts": {
"build": "bun run tools:build && tsc -b && vite build",
"build": "bun run tools:build && tsgo -b && vite build",

Copilot AI Mar 11, 2026

Copy link

Choose a reason for hiding this comment

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

The build script switches from tsc -b to tsgo -b, but no tsgo dependency is added in this PR. Unless tsgo is guaranteed to exist in the build environment, this will break builds/CI. Either revert to tsc -b or add and document the required dependency/tooling for tsgo.

Suggested change
"build": "bun run tools:build && tsgo -b && vite build",
"build": "bun run tools:build && tsc -b && vite build",

Copilot uses AI. Check for mistakes.
Comment thread registry.json Outdated
Comment on lines 231 to 232
"title": "Runtime Preview",
"description": "A component that provides real-time preview of CLI command execution and output.",

Copilot AI Mar 11, 2026

Copy link

Choose a reason for hiding this comment

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

The registry entry is renamed to tool-renderer but the title/description still describe “Runtime Preview” and “command execution and output,” which no longer matches the current API/docs (it renders parameter inputs). Update the title/description to reflect ToolRenderer’s purpose to avoid confusing registry consumers.

Suggested change
"title": "Runtime Preview",
"description": "A component that provides real-time preview of CLI command execution and output.",
"title": "Tool Renderer",
"description": "A component that renders and manages tool parameter inputs and configuration.",

Copilot uses AI. Check for mistakes.
@divyeshio
divyeshio merged commit 2ff274f into main Mar 11, 2026
6 of 7 checks passed
@divyeshio
divyeshio deleted the refactor/toolrenderer branch March 11, 2026 16:39
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.

2 participants