Skip to content

Conversation

@bmthd
Copy link
Owner

@bmthd bmthd commented Jul 24, 2025

Summary

This PR adds a comprehensive demo application to showcase the Midashi library with GitHub Pages deployment.

What's Added

Demo Application (/demo/)

  • Interactive Examples: Three different usage patterns demonstrating Midashi features
    • Simple Example: Basic usage with automatic heading hierarchy
    • Website Example: Complete website layout with semantic structure
    • Hooks Example: Custom components using useCurrentLevel() and useNextLevel() hooks
  • Modern Tech Stack:
    • Vite + React + TypeScript
    • Tailwind CSS v4 with proper @tailwindcss/vite plugin integration
    • Responsive design with clean UI

Key Features

  • Automatic Heading Management: Demonstrates how Midashi eliminates manual h1/h2/h3 management
  • Semantic HTML Integration: Shows proper usage with <main>, <section>, <article>, etc.
  • TypeScript Support: Full type safety examples
  • Accessible: Proper heading hierarchy for screen readers

GitHub Pages Ready

  • Configured with proper base path (/midashi/) for GitHub Pages
  • Optimized build process
  • All examples work without JavaScript frameworks knowledge

Demo Preview

Once deployed, the demo will be available at: https://bmthd.github.io/midashi/

The demo includes:

  • Tab-based navigation between examples
  • Live code demonstrations
  • Links to GitHub repo and npm package
  • Responsive design for mobile/desktop

Testing

  • ✅ All examples build successfully
  • ✅ Tailwind CSS v4 integration working
  • ✅ TypeScript compilation passes
  • ✅ Components render correctly
  • ✅ Proper heading hierarchy generated

Fixes #12

🤖 Generated with Claude Code

Summary by CodeRabbit

  • New Features

    • Introduced a demo React application showcasing Midashi library usage, including multiple example components and a sample website layout.
    • Added Tailwind CSS integration and configuration for styling the demo app.
    • Added comprehensive ESLint configuration for TypeScript and React projects.
    • Provided TypeScript configuration files for both application and Node.js environments.
    • Added Vite configuration with React and Tailwind CSS plugins for efficient development and builds.
  • Documentation

    • Added a detailed README in the demo directory with setup instructions and linting guidance.
  • Chores

    • Added .gitignore for the demo to exclude environment-specific and build files.
    • Added GitHub Actions workflows for automatic deployment to GitHub Pages and live PR previews.
    • Updated package configuration to include Tailwind CSS Vite plugin as a development dependency.
  • Style

    • Created global CSS and utility classes for accessibility and consistent layout in the demo app.

- Create comprehensive demo app showcasing Midashi library usage
- Add three interactive examples: Simple, Website, and Hooks usage
- Configure Tailwind CSS v4 with proper Vite integration
- Include proper TypeScript configuration and build optimization

The demo will be ready for GitHub Pages deployment once workflows are added.

Fixes #12

🤖 Generated with [Claude Code](https://claude.ai/code)

Co-Authored-By: Claude <[email protected]>
@coderabbitai
Copy link

coderabbitai bot commented Jul 24, 2025

Walkthrough

A comprehensive demo application was added under the demo directory, featuring a React + TypeScript + Vite setup with Tailwind CSS and ESLint integration. The demo showcases the usage of the midashi library through multiple example components. Supporting configuration files, documentation, and workflows for building and deploying to GitHub Pages and PR previews were also introduced. Minor import order and type import changes were made in the main library.

Changes

File(s) / Path(s) Change Summary
demo/.gitignore, demo/README.md, demo/eslint.config.js, Added new project setup files: ignore patterns, documentation, ESLint config, HTML template, and package definition.
demo/index.html, demo/package.json
demo/src/App.tsx, demo/src/components/HooksExample.tsx, Added main demo app and example components demonstrating midashi usage.
demo/src/components/SimpleExample.tsx,
demo/src/components/WebsiteExample.tsx
demo/src/index.css, demo/src/main.tsx, Added global styles, React entry point, and Vite environment type declarations.
demo/src/vite-env.d.ts
demo/tsconfig.app.json, demo/tsconfig.json, Added TypeScript configuration files for app and Node environments.
demo/tsconfig.node.json
demo/vite.config.ts Added Vite configuration with React and Tailwind plugins, and base path for GitHub Pages.
.github/workflows/deploy-pages.yml, Added GitHub Actions workflow for building and deploying demo to GitHub Pages.
.github/workflows/pr-preview.yml Added workflow for building and deploying PR previews with unique base paths and auto-commenting on PRs.
.github/CODEOWNERS Added CODEOWNERS file assigning global repo ownership to user @bmthd.
lib/context.tsx Added explicit import of React type namespace.
lib/index.ts Reordered import statements; no logic changes.
package.json Added @tailwindcss/vite as a devDependency.

Sequence Diagram(s)

sequenceDiagram
    participant User
    participant Browser
    participant Vite
    participant ReactApp
    participant Midashi

    User->>Browser: Open demo site
    Browser->>Vite: Load index.html and assets
    Vite->>Browser: Serve bundled React app
    Browser->>ReactApp: Mount App component
    ReactApp->>Midashi: Render headings and sections
    ReactApp->>Browser: Display interactive demo UI
    User->>ReactApp: Interact with example selectors
    ReactApp->>Midashi: Update displayed example
    ReactApp->>Browser: Update UI accordingly
Loading

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~15–20 minutes

Poem

🐇
In the garden of code, a demo now grows,
With headings and sections, the hierarchy flows.
Tailwind and Vite make the styling a breeze,
While GitHub deploys with effortless ease.
Midashi shines bright in this sample display,
Hopping through pages the rabbit’s own way!

Note

⚡️ Unit Test Generation is now available in beta!

Learn more here, or try it out under "Finishing Touches" below.


📜 Recent review details

Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 9fcb8c6 and e527572.

📒 Files selected for processing (1)
  • .github/CODEOWNERS (1 hunks)
✅ Files skipped from review due to trivial changes (1)
  • .github/CODEOWNERS
✨ Finishing Touches
🧪 Generate unit tests
  • Create PR with unit tests
  • Post copyable unit tests in a comment
  • Commit unit tests in branch feature/github-pages-demo

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share
🪧 Tips

Chat

There are 3 ways to chat with CodeRabbit:

  • Review comments: Directly reply to a review comment made by CodeRabbit. Example:
    • I pushed a fix in commit <commit_id>, please review it.
    • Explain this complex logic.
    • Open a follow-up GitHub issue for this discussion.
  • Files and specific lines of code (under the "Files changed" tab): Tag @coderabbitai in a new review comment at the desired location with your query. Examples:
    • @coderabbitai explain this code block.
    • @coderabbitai modularize this function.
  • PR comments: Tag @coderabbitai in a new PR comment to ask questions about the PR branch. For the best results, please provide a very specific query, as very limited context is provided in this mode. Examples:
    • @coderabbitai gather interesting stats about this repository and render them as a table. Additionally, render a pie chart showing the language distribution in the codebase.
    • @coderabbitai read src/utils.ts and explain its main purpose.
    • @coderabbitai read the files in the src/scheduler package and generate a class diagram using mermaid and a README in the markdown format.
    • @coderabbitai help me debug CodeRabbit configuration file.

Support

Need help? Create a ticket on our support page for assistance with any issues or questions.

Note: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments.

CodeRabbit Commands (Invoked using PR comments)

  • @coderabbitai pause to pause the reviews on a PR.
  • @coderabbitai resume to resume the paused reviews.
  • @coderabbitai review to trigger an incremental review. This is useful when automatic reviews are disabled for the repository.
  • @coderabbitai full review to do a full review from scratch and review all the files again.
  • @coderabbitai summary to regenerate the summary of the PR.
  • @coderabbitai generate docstrings to generate docstrings for this PR.
  • @coderabbitai generate sequence diagram to generate a sequence diagram of the changes in this PR.
  • @coderabbitai generate unit tests to generate unit tests for this PR.
  • @coderabbitai resolve resolve all the CodeRabbit review comments.
  • @coderabbitai configuration to show the current CodeRabbit configuration for the repository.
  • @coderabbitai help to get help.

Other keywords and placeholders

  • Add @coderabbitai ignore anywhere in the PR description to prevent this PR from being reviewed.
  • Add @coderabbitai summary to generate the high-level summary at a specific location in the PR description.
  • Add @coderabbitai anywhere in the PR title to generate the title automatically.

CodeRabbit Configuration File (.coderabbit.yaml)

  • You can programmatically configure CodeRabbit by adding a .coderabbit.yaml file to the root of your repository.
  • Please see the configuration documentation for more information.
  • If your editor has YAML language server enabled, you can add the path at the top of this file to enable auto-completion and validation: # yaml-language-server: $schema=https://coderabbit.ai/integrations/schema.v2.json

Documentation and Community

  • Visit our Documentation for detailed information on how to use CodeRabbit.
  • Join our Discord Community to get help, request features, and share feedback.
  • Follow us on X/Twitter for updates and announcements.

- Main deployment workflow: deploys to GitHub Pages on main branch
- PR preview workflow: creates preview deployments for each PR
- PR previews available at: https://bmthd.github.io/midashi/pr-{number}/
- Automatic comment updates on PRs with preview links

🤖 Generated with [Claude Code](https://claude.ai/code)

Co-Authored-By: Claude <[email protected]>
Copy link

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

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

Actionable comments posted: 6

♻️ Duplicate comments (1)
demo/tsconfig.node.json (1)

16-22: Same unrecognised options as in the app config.

erasableSyntaxOnly and noUncheckedSideEffectImports will also fail the Node-side build. Keep the two configs consistent by removing or gating these flags.

🧹 Nitpick comments (10)
demo/.gitignore (2)

1-25: Consider consolidating ignore rules with the repo-root .gitignore.

A nested .gitignore is perfectly valid, but many of these patterns (logs, node_modules, editor folders, etc.) are usually already covered at the root. Duplicating rules in multiple places can cause drift when one list gets updated and the other doesn’t.
If the demo folder truly needs a dedicated ignore file (e.g., it’s published independently), keep it; otherwise, rely on the root file to reduce maintenance.


10-14: Add Vite/Tailwind cache & env patterns for a cleaner working tree.

Since the demo is built with Vite + Tailwind, you’ll quickly accumulate additional artefacts not yet ignored:

 dist-ssr
+# Build caches
+.vite
+.cache
+# Test coverage
+coverage
+# Local environment files (keep secrets out of the repo)
+.env*

These additions prevent accidental commits of large cache folders and sensitive environment files.

package.json (1)

41-44: Consider scoping the Vite + Tailwind plugin to the demo workspace only

@tailwindcss/vite is now a top-level devDependency, yet the library itself doesn’t use Tailwind—instead only the demo under /demo/ does. Keeping it here:

• increases install size for all consumers cloning the repo
• introduces a peer-dependency on tailwindcss that is unsatisfied at the root (npm will warn)

Moving the plugin (and Tailwind itself) to demo/package.json, or turning the repo into a multi-package workspace (e.g. pnpm / npm workspaces) would keep the core package lean.

demo/src/main.tsx (1)

6-10: Optional: fail fast if the root element is missing

In unlikely cases where #root isn’t present (mis-configured HTML, SSR, etc.) the non-null assertion will crash later with a less clear error. A tiny guard improves DX:

-const root = document.getElementById('root')!;
-createRoot(root).render(
+const container = document.getElementById('root');
+if (!container) throw new Error('Root element #root not found');
+createRoot(container).render(
demo/index.html (1)

5-6: Hard-coded /vite.svg path will 404 on GitHub Pages

Because the app is served under the /midashi/ base path, absolute URLs like /vite.svg resolve to https://<user>.github.io/vite.svg.
Let Vite rewrite the asset (import it) or prefix it with the base path:

-    <link rel="icon" type="image/svg+xml" href="/vite.svg" />
+    <link rel="icon" type="image/svg+xml" href="%BASE_URL%vite.svg" />

or

<link rel="icon" href="/midashi/vite.svg" />
demo/vite.config.ts (1)

6-9: Optional: cache busting & faster cold-starts

Consider enabling Vite’s cacheDir inside demo/node_modules/.vite to avoid polluting the repo root when users run the demo locally:

 export default defineConfig({
   plugins: [react(), tailwindcss()],
+  cacheDir: 'node_modules/.vite',
   base: '/midashi/',
 })
demo/tsconfig.app.json (1)

3-16: noEmit: true makes the preceding tsc -b in package.json redundant.

Because the build script runs:

tsc -b && vite build

and this config has "noEmit": true, the TypeScript step only produces a .tsbuildinfo file.
If that intentional type-check step is desired, consider adding a comment or renaming the npm script to type-check to avoid confusion for contributors expecting emitted d.ts files.

demo/eslint.config.js (1)

8-23: Consider marking this config as the project root to avoid config lookup up the directory tree.

Add root: true at the top-level of the exported object; this prevents ESLint from merging parent configs (handy when the repo root also has ESLint settings).

 export default tseslint.config([
   globalIgnores(['dist']),
   {
+    root: true,
     files: ['**/*.{ts,tsx}'],
demo/package.json (1)

7-10: Script name mismatch with actual behaviour.

"build": "tsc -b && vite build" only type-checks because all referenced tsconfig.*.json files have "noEmit": true.
Consider renaming to "type-check" or split the step:

"scripts": {
  "type-check": "tsc -b",
  "build": "vite build",
  ...
}
demo/README.md (1)

42-69: Minor doc typo: inconsistent plugin names.

eslint-plugin-react-x was renamed @eslint-react/eslint-plugin-react-x. Update the snippet to prevent copy-paste install errors.

📜 Review details

Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 4cc2af9 and d076788.

⛔ Files ignored due to path filters (5)
  • demo/package-lock.json is excluded by !**/package-lock.json
  • demo/pnpm-lock.yaml is excluded by !**/pnpm-lock.yaml
  • demo/public/vite.svg is excluded by !**/*.svg
  • demo/src/assets/react.svg is excluded by !**/*.svg
  • pnpm-lock.yaml is excluded by !**/pnpm-lock.yaml
📒 Files selected for processing (20)
  • demo/.gitignore (1 hunks)
  • demo/README.md (1 hunks)
  • demo/eslint.config.js (1 hunks)
  • demo/index.html (1 hunks)
  • demo/package.json (1 hunks)
  • demo/src/App.tsx (1 hunks)
  • demo/src/components/HooksExample.tsx (1 hunks)
  • demo/src/components/SimpleExample.tsx (1 hunks)
  • demo/src/components/WebsiteExample.tsx (1 hunks)
  • demo/src/index.css (1 hunks)
  • demo/src/main.tsx (1 hunks)
  • demo/src/vite-env.d.ts (1 hunks)
  • demo/tsconfig.app.json (1 hunks)
  • demo/tsconfig.json (1 hunks)
  • demo/tsconfig.node.json (1 hunks)
  • demo/vite.config.ts (1 hunks)
  • lib/components.tsx (1 hunks)
  • lib/context.tsx (1 hunks)
  • lib/index.ts (1 hunks)
  • package.json (2 hunks)
🧰 Additional context used
🧬 Code Graph Analysis (2)
demo/src/components/WebsiteExample.tsx (2)
lib/context.tsx (1)
  • H (67-71)
lib/components.tsx (7)
  • Header (25-29)
  • Nav (61-65)
  • Main (7-11)
  • Section (16-20)
  • Article (43-47)
  • Aside (52-56)
  • Footer (34-38)
demo/src/App.tsx (4)
demo/src/components/SimpleExample.tsx (1)
  • SimpleExample (3-37)
demo/src/components/WebsiteExample.tsx (1)
  • WebsiteExample (3-82)
demo/src/components/HooksExample.tsx (1)
  • HooksExample (21-72)
lib/context.tsx (1)
  • H (67-71)
🪛 GitHub Actions: Bun🥟 CI
lib/index.ts

[error] 1-1: Failed to resolve import "./components.ts" from "lib/index.ts". Does the file exist? (vite:import-analysis)

🔇 Additional comments (13)
lib/context.tsx (1)

3-3: Type-only React import is a clean addition

The import type React from "react"; correctly enables the React.JSX.Element reference without triggering a runtime dependency—nice catch.

demo/src/vite-env.d.ts (1)

1-1: LGTM – required Vite type shim is in place

This reference directive is all that’s needed for Vite globals. No action required.

demo/package.json (2)

30-32: Pinning to a future TypeScript version may block installs.

"typescript": "~5.8.3" is ahead of the latest stable (5.4.*). Either relax the range (e.g. ^5.4.0) or keep it unpinned (latest) until 5.8 is published.


12-16: No Action Needed: React 19.1.0 Is Published

Both [email protected] and [email protected] are available on npm, so the existing dependency declarations in demo/package.json (lines 12–16) are valid and will install successfully.

demo/src/components/WebsiteExample.tsx (2)

6-6: Excellent accessibility implementation.

The use of sr-only class for the main heading provides proper semantic structure for screen readers while keeping the visual design clean.


1-82: Well-structured component demonstrating Midashi's semantic capabilities.

The component effectively showcases a complete website layout using Midashi's semantic components (Header, Nav, Main, Section, Article, Aside, Footer) with proper nesting and automatic heading hierarchy.

demo/src/components/SimpleExample.tsx (1)

1-37: Excellent demonstration of Midashi's core functionality.

This component provides a clear, well-structured example of automatic heading hierarchy management. The nested sections with explanatory text effectively demonstrate how headings automatically adjust their levels based on component nesting.

demo/src/App.tsx (2)

84-99: Proper external link security implementation.

The external links correctly include target="_blank" with rel="noopener noreferrer" for security, preventing potential security vulnerabilities.


9-28: Well-structured state management and configuration.

The component uses proper TypeScript typing and maintains a clean configuration object for examples, making it easy to add or modify demo examples.

demo/src/components/HooksExample.tsx (3)

3-8: Excellent custom component implementation using Midashi hooks.

The CustomHeading component demonstrates proper usage of the useCurrentLevel hook with correct TypeScript typing. The type casting to keyof JSX.IntrinsicElements ensures type safety while enabling dynamic tag rendering.


10-19: Proper implementation of NextLevelButton component.

The component correctly uses the useNextLevel hook to demonstrate how to access the next heading level in the hierarchy. The implementation is clean and follows React best practices.


21-72: Clear demonstration of hook-based heading management.

The example effectively shows how custom components can leverage Midashi hooks to create flexible, reusable heading components. The nested structure clearly demonstrates automatic level adjustment.

demo/tsconfig.json (1)

1-7: Solution-level tsconfig is well-formed

The root config cleanly delegates to the two sub-projects and excludes source files, which is the recommended pattern for a composite project. ✅

Comment on lines +65 to +66
<h2 className="text-2xl font-semibold text-gray-800 mb-2">
{examples[activeExample].title}
Copy link

Choose a reason for hiding this comment

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

🛠️ Refactor suggestion

Replace hardcoded heading elements with H component.

The demo uses hardcoded h2 and h3 elements instead of the H component, which contradicts Midashi's purpose of automatic heading hierarchy management. This inconsistency in the demo could confuse users about best practices.

Apply these diffs to use the H component consistently:

-          <h2 className="text-2xl font-semibold text-gray-800 mb-2">
+          <H className="text-2xl font-semibold text-gray-800 mb-2">
             {examples[activeExample].title}
-          </h2>
+          </H>
-          <h3 className="text-lg font-semibold text-blue-800 mb-2">About Midashi</h3>
+          <H className="text-lg font-semibold text-blue-800 mb-2">About Midashi</H>

Also applies to: 78-78

🤖 Prompt for AI Agents
In demo/src/App.tsx at lines 65-66 and 78, replace the hardcoded h2 and h3
heading elements with the H component to maintain consistent use of Midashi's
automatic heading hierarchy management. Update the JSX to use <H> with
appropriate level props instead of raw h2 or h3 tags, ensuring the demo aligns
with best practices and the intended usage of the H component.

Comment on lines +36 to +50
<h4 className="font-semibold text-gray-800">Web Development</h4>
<p className="text-gray-600 text-sm mt-2">Modern, responsive websites</p>
</div>
<div className="bg-white p-4 rounded shadow">
<h4 className="font-semibold text-gray-800">Digital Marketing</h4>
<p className="text-gray-600 text-sm mt-2">Grow your online presence</p>
</div>
<div className="bg-white p-4 rounded shadow">
<h4 className="font-semibold text-gray-800">Graphic Design</h4>
<p className="text-gray-600 text-sm mt-2">Beautiful visual solutions</p>
</div>
<div className="bg-white p-4 rounded shadow">
<h4 className="font-semibold text-gray-800">Consulting</h4>
<p className="text-gray-600 text-sm mt-2">Strategic business guidance</p>
</div>
Copy link

Choose a reason for hiding this comment

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

🛠️ Refactor suggestion

Replace hardcoded h4 elements with H component for consistency.

The service cards use hardcoded h4 elements instead of the H component, which bypasses Midashi's automatic heading hierarchy management. This inconsistency could confuse users learning the library.

Apply this diff to use the H component consistently:

-                <h4 className="font-semibold text-gray-800">Web Development</h4>
+                <H className="font-semibold text-gray-800">Web Development</H>
-                <h4 className="font-semibold text-gray-800">Digital Marketing</h4>
+                <H className="font-semibold text-gray-800">Digital Marketing</H>
-                <h4 className="font-semibold text-gray-800">Graphic Design</h4>
+                <H className="font-semibold text-gray-800">Graphic Design</H>
-                <h4 className="font-semibold text-gray-800">Consulting</h4>
+                <H className="font-semibold text-gray-800">Consulting</H>
📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
<h4 className="font-semibold text-gray-800">Web Development</h4>
<p className="text-gray-600 text-sm mt-2">Modern, responsive websites</p>
</div>
<div className="bg-white p-4 rounded shadow">
<h4 className="font-semibold text-gray-800">Digital Marketing</h4>
<p className="text-gray-600 text-sm mt-2">Grow your online presence</p>
</div>
<div className="bg-white p-4 rounded shadow">
<h4 className="font-semibold text-gray-800">Graphic Design</h4>
<p className="text-gray-600 text-sm mt-2">Beautiful visual solutions</p>
</div>
<div className="bg-white p-4 rounded shadow">
<h4 className="font-semibold text-gray-800">Consulting</h4>
<p className="text-gray-600 text-sm mt-2">Strategic business guidance</p>
</div>
<H className="font-semibold text-gray-800">Web Development</H>
<p className="text-gray-600 text-sm mt-2">Modern, responsive websites</p>
</div>
<div className="bg-white p-4 rounded shadow">
<H className="font-semibold text-gray-800">Digital Marketing</H>
<p className="text-gray-600 text-sm mt-2">Grow your online presence</p>
</div>
<div className="bg-white p-4 rounded shadow">
<H className="font-semibold text-gray-800">Graphic Design</H>
<p className="text-gray-600 text-sm mt-2">Beautiful visual solutions</p>
</div>
<div className="bg-white p-4 rounded shadow">
<H className="font-semibold text-gray-800">Consulting</H>
<p className="text-gray-600 text-sm mt-2">Strategic business guidance</p>
</div>
🤖 Prompt for AI Agents
In demo/src/components/WebsiteExample.tsx between lines 36 and 50, replace all
hardcoded h4 elements with the H component to maintain consistent heading
hierarchy management by Midashi. Change each <h4> tag to <H> while preserving
the existing class names and content inside. This ensures uniform usage of the H
component across service cards.

Comment on lines +1 to +2
@import "tailwindcss";

Copy link

Choose a reason for hiding this comment

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

⚠️ Potential issue

Tailwind CSS is imported incorrectly

Tailwind v4 expects the directive form, not a plain @import. The current style sheet is never populated with base/utility layers.

-@import "tailwindcss";
+@tailwind base;
+@tailwind components;
+@tailwind utilities;

Without this, the demo will render unstyled on first load.

🤖 Prompt for AI Agents
In demo/src/index.css at lines 1 to 2, the Tailwind CSS is imported using a
plain @import statement, which is incorrect for Tailwind v4. Replace the @import
with the proper Tailwind directives: use @tailwind base; @tailwind components;
and @tailwind utilities; to ensure the stylesheet includes all necessary layers
and the demo renders styled on first load.

Comment on lines +18 to +24
/* Linting */
"strict": true,
"noUnusedLocals": true,
"noUnusedParameters": true,
"erasableSyntaxOnly": true,
"noFallthroughCasesInSwitch": true,
"noUncheckedSideEffectImports": true
Copy link

Choose a reason for hiding this comment

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

⚠️ Potential issue

Unknown compiler options will break tsc in CI.

erasableSyntaxOnly and noUncheckedSideEffectImports are not recognised by the latest published TypeScript (≤ 5.4). tsc -b will exit with error TS5023: Unknown compiler option. Drop them or guard behind a future-version comment.

-    "erasableSyntaxOnly": true,
-    "noUncheckedSideEffectImports": true
🤖 Prompt for AI Agents
In demo/tsconfig.app.json around lines 18 to 24, the compiler options
"erasableSyntaxOnly" and "noUncheckedSideEffectImports" are not recognized by
the current TypeScript version and cause tsc to fail in CI. Remove these two
options from the configuration or conditionally include them using a
future-version comment to avoid breaking the build.

bmthd and others added 3 commits July 24, 2025 15:12
- Remove .ts extension from relative imports
- Fix build errors in components.tsx and index.ts
- Ensure compatibility with TypeScript module resolution

🤖 Generated with [Claude Code](https://claude.ai/code)

Co-Authored-By: Claude <[email protected]>
- Fix JSX namespace issues in HooksExample.tsx
- Update demo pnpm-lock.yaml with correct midashi dependency
- Ensure builds work correctly for GitHub Actions

🤖 Generated with [Claude Code](https://claude.ai/code)

Co-Authored-By: Claude <[email protected]>
- Add additional permissions (contents: write, pages: write, actions: write)
- Use personal_token instead of github_token for gh-pages deployment
- Add fetch-depth: 0 and keep_files: true for better compatibility
- Set explicit user info for git commits

🤖 Generated with [Claude Code](https://claude.ai/code)

Co-Authored-By: Claude <[email protected]>
@github-actions
Copy link
Contributor

github-actions bot commented Jul 24, 2025

🚀 Preview deployed!

You can preview this PR at: https://bmthd.github.io/midashi/pr-58/

This preview will be updated with each push to this PR.

Copy link

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

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

Actionable comments posted: 1

🧹 Nitpick comments (4)
.github/workflows/pr-preview.yml (3)

47-48: Fragile sed pattern – could silently fail if the line changes.
Hard-coding the exact line contents means a future edit to vite.config.ts (extra whitespace, comments, different quotes, etc.) will leave the base path unmodified and the preview broken. A safer approach is a small Node/ts-node script that rewrites the base property via AST or JSON parse of defineConfig.


68-76: Only the first 30 comments are scanned – earlier preview comments may be missed.
issues.listComments paginates; if a PR has >30 comments, an old preview comment might live on page 2 and a second one will be created. Use paginate helper or set per_page: 100 and loop until exhausted.


22-79: Trailing whitespace & missing final newline (YAMLlint).
These won’t break the workflow but cleaning them keeps the repo tidy and silences automated linters.

.github/workflows/deploy-pages.yml (1)

23-46: House-keeping: trailing spaces and missing final newline (YAMLlint).
Purely cosmetic but keeps CI linters quiet.

📜 Review details

Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between d076788 and 9fcb8c6.

⛔ Files ignored due to path filters (1)
  • demo/pnpm-lock.yaml is excluded by !**/pnpm-lock.yaml
📒 Files selected for processing (4)
  • .github/workflows/deploy-pages.yml (1 hunks)
  • .github/workflows/pr-preview.yml (1 hunks)
  • demo/src/components/HooksExample.tsx (1 hunks)
  • lib/index.ts (1 hunks)
✅ Files skipped from review due to trivial changes (1)
  • lib/index.ts
🚧 Files skipped from review as they are similar to previous changes (1)
  • demo/src/components/HooksExample.tsx
🧰 Additional context used
🪛 YAMLlint (1.37.1)
.github/workflows/pr-preview.yml

[error] 22-22: trailing spaces

(trailing-spaces)


[error] 27-27: trailing spaces

(trailing-spaces)


[error] 33-33: trailing spaces

(trailing-spaces)


[error] 36-36: trailing spaces

(trailing-spaces)


[error] 39-39: trailing spaces

(trailing-spaces)


[error] 42-42: trailing spaces

(trailing-spaces)


[error] 49-49: trailing spaces

(trailing-spaces)


[error] 59-59: trailing spaces

(trailing-spaces)


[error] 66-66: trailing spaces

(trailing-spaces)


[error] 73-73: trailing spaces

(trailing-spaces)


[error] 74-74: trailing spaces

(trailing-spaces)


[error] 77-77: trailing spaces

(trailing-spaces)


[error] 79-79: trailing spaces

(trailing-spaces)


[error] 94-94: no new line character at the end of file

(new-line-at-end-of-file)

.github/workflows/deploy-pages.yml

[error] 23-23: trailing spaces

(trailing-spaces)


[error] 28-28: trailing spaces

(trailing-spaces)


[error] 34-34: trailing spaces

(trailing-spaces)


[error] 37-37: trailing spaces

(trailing-spaces)


[error] 40-40: trailing spaces

(trailing-spaces)


[error] 43-43: trailing spaces

(trailing-spaces)


[error] 46-46: trailing spaces

(trailing-spaces)


[error] 61-61: no new line character at the end of file

(new-line-at-end-of-file)

🔇 Additional comments (2)
.github/workflows/pr-preview.yml (1)

28-33: Consider sticking to the current LTS Node instead of 22.
Node 22 is still in “Current” status; GitHub-hosted runners expose it behind the node-version: 22 label, but many front-end toolchains (Vite/Tailwind) are validated against the active LTS (v20). Unless the project explicitly relies on 22-only features, use 20 to avoid unexpected breakage in the CI image roll-over.

.github/workflows/deploy-pages.yml (1)

29-34: Use the active LTS Node release unless 22 is required.
Same rationale as in the PR-preview workflow: defaulting to v20 reduces the risk of CI instability and aligns with most ecosystem test matrices.

Comment on lines +7 to +12
permissions:
contents: write
pull-requests: write
pages: write
actions: write

Copy link

Choose a reason for hiding this comment

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

🛠️ Refactor suggestion

Tighten permissions – drop the unnecessary actions: write.
actions: write is only required when a workflow programmatically creates/modifies other workflow runs. This job doesn’t do that, so leaving it out follows the principle of least privilege and improves repository security.

 permissions:
   contents: write
   pull-requests: write
   pages: write
-  actions: write
📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
permissions:
contents: write
pull-requests: write
pages: write
actions: write
permissions:
contents: write
pull-requests: write
pages: write
🤖 Prompt for AI Agents
In .github/workflows/pr-preview.yml lines 7 to 12, remove the 'actions: write'
permission from the permissions block because this workflow does not create or
modify other workflow runs. This reduces permissions to only what is necessary,
following the principle of least privilege and enhancing security.

Copy link

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

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

Actionable comments posted: 4

📜 Review details

Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between d076788 and 9fcb8c6.

⛔ Files ignored due to path filters (1)
  • demo/pnpm-lock.yaml is excluded by !**/pnpm-lock.yaml
📒 Files selected for processing (4)
  • .github/workflows/deploy-pages.yml (1 hunks)
  • .github/workflows/pr-preview.yml (1 hunks)
  • demo/src/components/HooksExample.tsx (1 hunks)
  • lib/index.ts (1 hunks)
🚧 Files skipped from review as they are similar to previous changes (2)
  • lib/index.ts
  • demo/src/components/HooksExample.tsx
🧰 Additional context used
🪛 YAMLlint (1.37.1)
.github/workflows/deploy-pages.yml

[error] 23-23: trailing spaces

(trailing-spaces)


[error] 28-28: trailing spaces

(trailing-spaces)


[error] 34-34: trailing spaces

(trailing-spaces)


[error] 37-37: trailing spaces

(trailing-spaces)


[error] 40-40: trailing spaces

(trailing-spaces)


[error] 43-43: trailing spaces

(trailing-spaces)


[error] 46-46: trailing spaces

(trailing-spaces)


[error] 61-61: no new line character at the end of file

(new-line-at-end-of-file)

.github/workflows/pr-preview.yml

[error] 22-22: trailing spaces

(trailing-spaces)


[error] 27-27: trailing spaces

(trailing-spaces)


[error] 33-33: trailing spaces

(trailing-spaces)


[error] 36-36: trailing spaces

(trailing-spaces)


[error] 39-39: trailing spaces

(trailing-spaces)


[error] 42-42: trailing spaces

(trailing-spaces)


[error] 49-49: trailing spaces

(trailing-spaces)


[error] 59-59: trailing spaces

(trailing-spaces)


[error] 66-66: trailing spaces

(trailing-spaces)


[error] 73-73: trailing spaces

(trailing-spaces)


[error] 74-74: trailing spaces

(trailing-spaces)


[error] 77-77: trailing spaces

(trailing-spaces)


[error] 79-79: trailing spaces

(trailing-spaces)


[error] 94-94: no new line character at the end of file

(new-line-at-end-of-file)

🔇 Additional comments (4)
.github/workflows/deploy-pages.yml (2)

23-46: Trim trailing whitespace to silence YAML lint

Multiple lines (23, 28, 34, 37, 40, 43, 46) contain stray spaces flagged by YAML-lint.
While harmless at runtime, cleaning them keeps lint pipelines green.

[ suggest_nitpick ]


48-61: Missing final newline

Add a \n at EOF to satisfy POSIX tools & linters.

[ suggest_nitpick ]

.github/workflows/pr-preview.yml (2)

50-58: Workflow writes to default branch without protection bypass

Publishing to gh-pages via peaceiris/actions-gh-pages commits with github-actions[bot].
Ensure the repository has branch-protections that allow this actor, otherwise the step will fail.


59-94: Trailing whitespace & missing EOF newline

Same lint concerns: lines 22, 27, 33, 36, 39, 42, 49, 59, 66, 73-79 contain trailing spaces; file lacks terminal newline.

[ suggest_nitpick ]

Comment on lines +29 to +34
- name: Setup Node.js
uses: actions/setup-node@v4
with:
node-version: '22'
cache: 'pnpm'

Copy link

Choose a reason for hiding this comment

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

⚠️ Potential issue

Node v22 is not yet a GA runner image – expect builds to fail

actions/setup-node@v4 supports only versions that exist on the hosted images (currently 20 LTS & 18 LTS).
Requesting an unreleased “22” will make the step error out.

-          node-version: '22'
+          # Use the latest LTS to ensure the image exists
+          node-version: '20'   # or  'lts/*'
🧰 Tools
🪛 YAMLlint (1.37.1)

[error] 34-34: trailing spaces

(trailing-spaces)

🤖 Prompt for AI Agents
In .github/workflows/deploy-pages.yml around lines 29 to 34, the Node.js version
is set to '22', which is not yet supported by the hosted runner images and will
cause build failures. Change the node-version value from '22' to a supported
version such as '20' or '18' to ensure compatibility with the available runner
images and prevent errors during setup.

Comment on lines +41 to +46
- name: Install demo dependencies
run: cd demo && pnpm install

- name: Build demo
run: cd demo && npx vite build

Copy link

Choose a reason for hiding this comment

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

🛠️ Refactor suggestion

Double-install wastes 1–2 min per run

Because demo/ is just another workspace package, a single root pnpm install already lays out all node-modules for every sub-package. The second install in demo adds no value but costs CI time.

-      - name: Install demo dependencies
-        run: cd demo && pnpm install
-
-      - name: Build demo
-        run: cd demo && npx vite build
+      - name: Build demo
+        run: pnpm --filter demo exec vite build
📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
- name: Install demo dependencies
run: cd demo && pnpm install
- name: Build demo
run: cd demo && npx vite build
- name: Build demo
run: pnpm --filter demo exec vite build
🧰 Tools
🪛 YAMLlint (1.37.1)

[error] 43-43: trailing spaces

(trailing-spaces)


[error] 46-46: trailing spaces

(trailing-spaces)

🤖 Prompt for AI Agents
In .github/workflows/deploy-pages.yml around lines 41 to 46, the workflow runs
`pnpm install` inside the demo directory after already running a root-level
`pnpm install`, causing redundant installation and wasting CI time. Remove the
step that runs `pnpm install` inside the demo directory to avoid double
installation, relying solely on the root `pnpm install` to set up all workspace
packages.

Comment on lines +28 to +33
- name: Setup Node.js
uses: actions/setup-node@v4
with:
node-version: '22'
cache: 'pnpm'

Copy link

Choose a reason for hiding this comment

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

⚠️ Potential issue

Same Node v22 problem as in deploy workflow

Use 20 or lts/* to match available runner images.

🧰 Tools
🪛 YAMLlint (1.37.1)

[error] 33-33: trailing spaces

(trailing-spaces)

🤖 Prompt for AI Agents
In .github/workflows/pr-preview.yml at lines 28 to 33, the Node.js version is
set to '22', which is not supported by the available runner images. Change the
node-version value from '22' to '20' or 'lts/*' to ensure compatibility with the
runner environment.

Comment on lines +43 to +49
- name: Build demo with PR base path
run: |
cd demo
# Update base path for PR preview
sed -i "s|base: '/midashi/',|base: '/midashi/pr-${{ github.event.number }}/',|" vite.config.ts
npx vite build
Copy link

Choose a reason for hiding this comment

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

🛠️ Refactor suggestion

Fragile sed mutation – prefer Vite’s --base flag

In-place string replacement can silently fail if the file format drifts. Vite already accepts a --base CLI parameter.

-          # Update base path for PR preview
-          sed -i "s|base: '/midashi/',|base: '/midashi/pr-${{ github.event.number }}/',|" vite.config.ts
-          npx vite build
+          npx vite build --base "/midashi/pr-${{ github.event.number }}/"

More robust & avoids committing a modified file to the artifact.

📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
- name: Build demo with PR base path
run: |
cd demo
# Update base path for PR preview
sed -i "s|base: '/midashi/',|base: '/midashi/pr-${{ github.event.number }}/',|" vite.config.ts
npx vite build
- name: Build demo with PR base path
run: |
cd demo
npx vite build --base "/midashi/pr-${{ github.event.number }}/"
🧰 Tools
🪛 YAMLlint (1.37.1)

[error] 49-49: trailing spaces

(trailing-spaces)

🤖 Prompt for AI Agents
In .github/workflows/pr-preview.yml around lines 43 to 49, replace the fragile
in-place sed command that modifies vite.config.ts with using Vite's built-in
--base CLI flag during the build step. Remove the sed command and instead pass
the base path dynamically to the vite build command using the --base option to
avoid modifying source files and improve robustness.

🤖 Generated with [Claude Code](https://claude.ai/code)

Co-Authored-By: Claude <[email protected]>
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.

Add sample repository

2 participants