Fix VitePress base path for phenotype.space#837
Conversation
Drop GITHUB_ACTIONS-based subpath detection and resolve base via PHENOTYPE_CUSTOM_DOMAIN or explicit GITHUB_PAGES so assets serve from `/assets/` on subdomain roots. Co-authored-by: Cursor <cursoragent@cursor.com>
Use env-driven base resolution instead of GITHUB_ACTIONS heuristics so phenotype.space builds emit root-relative asset URLs. Co-authored-by: Cursor <cursoragent@cursor.com>
|
Warning You have reached your daily quota limit. Please wait up to 24 hours and I will start processing your requests again! |
|
CodeAnt AI is reviewing your PR. |
Thanks for using CodeAnt! 🎉We're free for open-source projects. if you're enjoying it, help us grow by sharing. Share on X · |
|
Warning Review limit reached
More reviews will be available in 59 minutes and 59 seconds. Learn how PR review limits work. Your organization has run out of usage credits. Purchase more credits in the billing tab to continue. ⌛ How to resolve this issue?After more reviews become available, a review can be triggered using the To avoid repeated limits, reduce automatic review volume by pausing incremental auto-reviews earlier, using label-based review opt-in, excluding WIP or generated PR titles, or requesting reviews manually when the PR is ready. If your team needs uninterrupted high-volume reviews, an organization admin can enable usage-based credits. 🚦 How do rate limits work?CodeRabbit enforces per-developer PR review limits for each organization. Most developers receive the normal plan review availability. For paid Pro and Pro+ PR reviews, CodeRabbit uses adaptive limits for sustained high-volume activity. When a developer's recent PR review activity reaches the 95th percentile or higher among CodeRabbit users, additional reviews become available more gradually as earlier reviews age out of the rolling window. Please see our Fair Usage Limits Policy for further information. ℹ️ Review info⚙️ Run configurationConfiguration used: Path: .coderabbit.yaml Review profile: CHILL Plan: Pro Run ID: 📒 Files selected for processing (2)
✨ Finishing Touches🧪 Generate unit tests (beta)
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. Comment |
🔍 Legacy Tooling Anti-Pattern ScanRepository: KooshaPari/AgilePlus
✅ No legacy tooling anti-patterns detected! |
Snyk Security Scan ResultsSnyk vulnerability scan completed. View results in GitHub Code Scanning dashboard. |
|
| @@ -0,0 +1,9 @@ | |||
| export function resolveDocsBase(repoName) { | |||
| const explicit = process.env.DOCS_BASE ?? process.env.VITEPRESS_BASE; | |||
There was a problem hiding this comment.
Suggestion: This resolver drops support for the existing GITHUB_PAGES_BASEURL environment contract, so builds that rely on that variable will silently fall back to repo-name-derived paths and can publish broken asset URLs. Include GITHUB_PAGES_BASEURL in explicit base resolution (with clear precedence) to preserve current CI/runtime behavior. [api mismatch]
Severity Level: Major ⚠️
- ❌ GitHub Pages docs builds ignore configured base URL.
- ⚠️ Env reference for GITHUB_PAGES_BASEURL becomes misleading documentation.
- ⚠️ Future deployments cannot override docs base via env.Steps of Reproduction ✅
1. Configure a docs build for GitHub Pages using the documented environment snippet at
`docs/reference/env-vars.md:23-35`, setting `GITHUB_PAGES="true"` and
`GITHUB_PAGES_BASEURL="/agileplus"` but not defining `DOCS_BASE` or `VITEPRESS_BASE`.
2. Run the docs build via VitePress using `npm run docs:build` from
`docs/package.json:5-13`, which loads `docs/.vitepress/config.mts:1-9` as the site
configuration.
3. In `docs/.vitepress/config.mts:5-6`, the config derives `repoName` from
`process.env.GITHUB_REPOSITORY` and calls `resolveDocsBase(repoName)` from
`docs/.vitepress/resolve-base.mjs:1-9`, which only checks `DOCS_BASE` and `VITEPRESS_BASE`
for an explicit base (`const explicit = process.env.DOCS_BASE ??
process.env.VITEPRESS_BASE;`) and never reads `GITHUB_PAGES_BASEURL`.
4. Because `GITHUB_PAGES_BASEURL` is ignored, the docs base is computed from `repoName`
and any deployments that relied on setting `GITHUB_PAGES_BASEURL` (per the reference table
at `docs/reference/env-vars.md:31-35`) silently fall back to the repo-name-derived base,
breaking the documented configuration contract and potentially asset paths when a
non-default base URL is configured.(Use Cmd/Ctrl + Click for best experience)
Prompt for AI Agent 🤖
This is a comment left during a code review.
**Path:** docs/.vitepress/resolve-base.mjs
**Line:** 2:2
**Comment:**
*Api Mismatch: This resolver drops support for the existing `GITHUB_PAGES_BASEURL` environment contract, so builds that rely on that variable will silently fall back to repo-name-derived paths and can publish broken asset URLs. Include `GITHUB_PAGES_BASEURL` in explicit base resolution (with clear precedence) to preserve current CI/runtime behavior.
Validate the correctness of the flagged issue. If correct, How can I resolve this? If you propose a fix, implement it and please make it concise.
Once fix is implemented, also check other comments on the same PR, and ask user if the user wants to fix the rest of the comments as well. if said yes, then fetch all the comments validate the correctness and implement a minimal fix| return explicit.endsWith('/') ? explicit : `${explicit}/`; | ||
| } | ||
| if (process.env.PHENOTYPE_CUSTOM_DOMAIN === 'true') return '/'; | ||
| if (process.env.GITHUB_PAGES === 'true') return `/${repoName}/`; |
There was a problem hiding this comment.
Suggestion: Always returning /${repoName}/ when GITHUB_PAGES is enabled is incorrect for user/organization Pages repositories (for example <owner>.github.io), which are served from /; this will generate wrong asset paths and 404s. Add a condition to return / for that repository type (or defer to an explicit base variable). [logic error]
Severity Level: Critical 🚨
- ❌ User GitHub Pages docs serve broken asset URLs.
- ❌ Homepage stylesheet requests 404 under root-served site.
- ⚠️ Template cannot safely reuse for user Pages repos.Steps of Reproduction ✅
1. Create or reuse a GitHub user or organization Pages repository named
`<owner>.github.io` so that the site is served from the root path `/` on
`https://<owner>.github.io/` (standard GitHub Pages behavior for such repos).
2. Build the docs site using `npm run docs:build` from `docs/package.json:5-13` with
`GITHUB_PAGES="true"` set as in the docs snippet at `docs/reference/env-vars.md:23-35`, so
VitePress loads `docs/.vitepress/config.mts:1-9`.
3. In `docs/.vitepress/config.mts:5-6`, the config derives `repoName` from
`process.env.GITHUB_REPOSITORY?.split('/')[1]` (which will be `<owner>.github.io` for this
repo) and passes it to `resolveDocsBase(repoName)`; inside
`docs/.vitepress/resolve-base.mjs:6-8`, the code `if (process.env.GITHUB_PAGES === 'true')
return \`/${repoName}/\`;` computes a base of `/<owner>.github.io/`.
4. `createSiteMeta` in `docs/.vitepress/site-meta.mjs:1-8` receives this base and, with
`PHENOTYPE_CUSTOM_DOMAIN` unset, uses `resolvedBase = base`, causing all navigation links
(e.g., Home at line 13) and VitePress asset URLs to be generated under
`/<owner>.github.io/`; when the site is actually served from `/`, these URLs (such as
`/<owner>.github.io/assets/...`) 404, breaking stylesheets and other static assets for
user/organization GitHub Pages deployments.(Use Cmd/Ctrl + Click for best experience)
Prompt for AI Agent 🤖
This is a comment left during a code review.
**Path:** docs/.vitepress/resolve-base.mjs
**Line:** 7:7
**Comment:**
*Logic Error: Always returning `/${repoName}/` when `GITHUB_PAGES` is enabled is incorrect for user/organization Pages repositories (for example `<owner>.github.io`), which are served from `/`; this will generate wrong asset paths and 404s. Add a condition to return `/` for that repository type (or defer to an explicit base variable).
Validate the correctness of the flagged issue. If correct, How can I resolve this? If you propose a fix, implement it and please make it concise.
Once fix is implemented, also check other comments on the same PR, and ask user if the user wants to fix the rest of the comments as well. if said yes, then fetch all the comments validate the correctness and implement a minimal fix|
CodeAnt AI finished reviewing your PR. |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 29cd0d22ff
ℹ️ About Codex in GitHub
Codex has been enabled to automatically review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
When you sign up for Codex through ChatGPT, Codex can also answer questions or update the PR, like "@codex address that feedback".
| if (process.env.GITHUB_PAGES === 'true') return `/${repoName}/`; | ||
| return '/'; |
There was a problem hiding this comment.
Keep the Pages subpath for Actions builds
For the existing Pages workflow that calls the shared deploy job without setting the new GITHUB_PAGES env (.github/workflows/vitepress-deploy.yml only passes concurrency_group), this resolver now falls through to / even though GitHub Actions only guarantees GITHUB_ACTIONS=true. That makes non-custom-domain project Pages builds emit root-relative assets instead of /AgilePlus/..., so the default github.io/AgilePlus deployment will 404 its CSS/JS unless every caller is updated to pass GITHUB_PAGES/DOCS_BASE or this keeps the old Actions fallback when no custom domain is requested.
Useful? React with 👍 / 👎.



User description
Summary
docs/.vitepress/resolve-base.mjsshared resolverGITHUB_ACTIONS-based subpath detection from VitePress configRoot cause
Builds set
base: '/AgilePlus/'whileagileplus.phenotype.spaceserves at/, so CSS loaded from/AgilePlus/assets/...404s.Test plan
agileplus.phenotype.space/assets/...and returns 200Made with Cursor
CodeAnt-AI Description
Fix docs asset URLs on custom-domain and GitHub Pages builds
What Changed
/assets/...Impact
✅ Fewer broken styles on custom-domain docs sites✅ Fewer 404s for docs assets✅ Correct asset loading on GitHub Pages and local builds💡 Usage Guide
Checking Your Pull Request
Every time you make a pull request, our system automatically looks through it. We check for security issues, mistakes in how you're setting up your infrastructure, and common code problems. We do this to make sure your changes are solid and won't cause any trouble later.
Talking to CodeAnt AI
Got a question or need a hand with something in your pull request? You can easily get in touch with CodeAnt AI right here. Just type the following in a comment on your pull request, and replace "Your question here" with whatever you want to ask:
This lets you have a chat with CodeAnt AI about your pull request, making it easier to understand and improve your code.
Example
Preserve Org Learnings with CodeAnt
You can record team preferences so CodeAnt AI applies them in future reviews. Reply directly to the specific CodeAnt AI suggestion (in the same thread) and replace "Your feedback here" with your input:
This helps CodeAnt AI learn and adapt to your team's coding style and standards.
Example
Retrigger review
Ask CodeAnt AI to review the PR again, by typing:
Check Your Repository Health
To analyze the health of your code repository, visit our dashboard at https://app.codeant.ai. This tool helps you identify potential issues and areas for improvement in your codebase, ensuring your repository maintains high standards of code health.