{{ message }}
Repository navigation
feat: add clean URLs support for extensionless links - #727
Merged
Merged
Conversation
Implements clean URL resolution that automatically maps extensionless paths like '/about' to '/about.html', mimicking modern static hosting platforms like Vercel's cleanUrls feature. Features: - New --clean-urls CLI flag and cleanUrls config option - Automatically resolves /path to /path.html when file exists - Opt-in behavior (disabled by default for backward compatibility) - Maintains security with path traversal protection - Full test coverage with 11 new tests Changes: - src/server.ts: Add fallback logic to try .html extension - src/options.ts, src/config.ts: Add cleanUrls type definitions - src/cli.ts: Add CLI flag and help documentation - src/index.ts: Wire cleanUrls option to web server - README.md: Add comprehensive documentation - test/*: Add unit and integration tests Fixes #548 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <noreply@anthropic.com>
…tibility The integration tests were failing on Windows because the test fixtures used absolute paths starting with `/` which don't work properly in local server testing across different platforms. Changes: - Updated test fixtures to use relative paths (about, contact) instead of absolute paths (/about, /contact) - Updated test assertions to match the new relative URL structure - Tests now pass on both Unix and Windows platforms Fixes Windows CI test failures in PR #727 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <noreply@anthropic.com>
The tests were still failing on Windows because URLs don't always end with the exact pattern we were looking for. Updated to use more flexible matching that works across all platforms. Changes: - Match URLs that contain 'about' but exclude 'about.html' - Match URLs that contain 'contact' but exclude 'contact.html' - This works regardless of how the URL is constructed on different platforms 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.

Summary
Implements clean URL resolution that automatically maps extensionless paths like
/aboutto/about.html, mimicking modern static hosting platforms like Vercel's cleanUrls feature.Fixes #548
Changes
.htmlextension when file not foundcleanUrlstype definitions--clean-urlsCLI flag and help documentationcleanUrlsoption to web serverFeatures
✅ New
--clean-urlsCLI flag andcleanUrlsconfig option✅ Automatically resolves
/pathto/path.htmlwhen file exists✅ Opt-in behavior (disabled by default for backward compatibility)
✅ Maintains security with path traversal protection
✅ Full test coverage with 11 new tests
Usage Examples
CLI:
Config file:
{ "cleanUrls": true, "recurse": true }API:
Test plan
/about→about.html)🤖 Generated with Claude Code