Skip to content

fix(cli): docs command generates fallback URLs when registry has no m…#1782

Open
imlargo wants to merge 5 commits intounovue:devfrom
imlargo:fix/cli-docs
Open

fix(cli): docs command generates fallback URLs when registry has no m…#1782
imlargo wants to merge 5 commits intounovue:devfrom
imlargo:fix/cli-docs

Conversation

@imlargo
Copy link
Copy Markdown

@imlargo imlargo commented Apr 20, 2026

…eta.links

Agent-Logs-Url: https://github.com/imlargo/shadcn-vue/sessions/2ca0afaa-c518-4e5c-a1fe-1147f5797092

🔗 Linked issue

❓ Type of change

  • 📖 Documentation (updates to the documentation, readme or JSdoc annotations)
  • [x ] 🐞 Bug fix (a non-breaking change that fixes an issue)
  • 👌 Enhancement (improving an existing functionality like performance)
  • ✨ New feature (a non-breaking change that adds functionality)
  • 🧹 Chore (updates to the build process or auxiliary tools and libraries)
  • ⚠️ Breaking change (fix or feature that would cause existing functionality to change)

📚 Description

📸 Screenshots (if appropriate)

📝 Checklist

  • I have linked an issue or discussion.
  • I have updated the documentation accordingly.

Summary by CodeRabbit

  • Bug Fixes
    • The docs command now includes all components in results by generating fallback documentation links when registry references are missing or empty.
    • Fallback links point to the standard docs location for each component so components are not skipped.
    • Missing registry links now log at debug level with a fallback message instead of warning and skip.

@coderabbitai
Copy link
Copy Markdown

coderabbitai Bot commented Apr 20, 2026

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro

Run ID: 87eb0d40-32fe-4833-bbdc-a83703b0cb9e

📥 Commits

Reviewing files that changed from the base of the PR and between cad98fa and dc9c7a6.

📒 Files selected for processing (1)
  • packages/cli/src/commands/docs.ts

📝 Walkthrough

Walkthrough

The docs CLI command now falls back to a generated docs URL when item.meta?.links[base] is missing or empty; it logs a debug message (including base) and includes the component with a fallback docs link instead of skipping it.

Changes

Cohort / File(s) Summary
Documentation Link Fallback
packages/cli/src/commands/docs.ts
Imports SHADCN_VUE_URL. Reads item.meta?.links[base] into metaLinks; if absent/empty, builds fallback links with docs: {SHADCN_VUE_URL}/docs/components/{component} (logs debug with base) and still pushes the component into results instead of skipping it.

Sequence Diagram(s)

sequenceDiagram
    participant CLI as CLI Command
    participant Registry as Registry Metadata
    participant Docs as Docs Host (SHADCN_VUE_URL)
    CLI->>Registry: read item.meta?.links[base]
    alt links exist
        CLI->>CLI: use metaLinks.docs
    else links missing/empty
        CLI->>Docs: construct fallback URL {SHADCN_VUE_URL}/docs/components/{component}
        CLI->>CLI: log debug (include base) and include fallback link
    end
    CLI->>CLI: add component to results
Loading

Estimated code review effort

🎯 2 (Simple) | ⏱️ ~10 minutes

Poem

🐰 I hop through gaps where links are thin,
I stitch a trail so docs come in.
A quiet debug, a gentle shove—
Components found, and found with love. ✨

🚥 Pre-merge checks | ✅ 3
✅ Passed checks (3 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The PR title is concise and directly related to the main change: implementing fallback URL generation in the docs command when registry meta.links are unavailable. It accurately summarizes the primary change.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests

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

Comment @coderabbitai help to get the list of available commands and usage tips.

@imlargo imlargo marked this pull request as ready for review April 20, 2026 15:06
Copy link
Copy Markdown

@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.

🧹 Nitpick comments (1)
packages/cli/src/commands/docs.ts (1)

65-67: Fallback URL ignores base and doesn't validate existence.

The fallback hard-codes /docs/components/${component} regardless of the resolved base. This is acceptable today since only reka ships (per the comment on line 29-30), but if additional bases are introduced later the fallback will silently emit links that don't reflect the selected base. Also note that the generated URL is not verified against the docs site, so users may be pointed to a 404 when a component lacks a dedicated docs page. Consider either namespacing the fallback by base when multi-base support lands, or logging a debug/info note that the link is a best-effort fallback.

🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@packages/cli/src/commands/docs.ts` around lines 65 - 67, The fallback link
assignment for links currently hard-codes
`${SHADCN_VUE_URL}/docs/components/${component}` and ignores the selected base;
update the fallback to incorporate the resolved base (use the existing base
variable) e.g. `${SHADCN_VUE_URL}/${base}/docs/components/${component}` (or
otherwise namespace by base) when metaLinks is empty, and add a lightweight
existence check (HEAD/GET) against the constructed URL or emit a debug/info log
stating the URL is a best-effort fallback if the check fails; update the code
that computes links (the metaLinks/links branch) and use existing logging
utilities to report when the fallback is used or when the URL resolves to 404.
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.

Nitpick comments:
In `@packages/cli/src/commands/docs.ts`:
- Around line 65-67: The fallback link assignment for links currently hard-codes
`${SHADCN_VUE_URL}/docs/components/${component}` and ignores the selected base;
update the fallback to incorporate the resolved base (use the existing base
variable) e.g. `${SHADCN_VUE_URL}/${base}/docs/components/${component}` (or
otherwise namespace by base) when metaLinks is empty, and add a lightweight
existence check (HEAD/GET) against the constructed URL or emit a debug/info log
stating the URL is a best-effort fallback if the check fails; update the code
that computes links (the metaLinks/links branch) and use existing logging
utilities to report when the fallback is used or when the URL resolves to 404.

ℹ️ Review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro

Run ID: 81ce645c-85f2-41b0-abd9-cb8d0c9e2403

📥 Commits

Reviewing files that changed from the base of the PR and between 5a94ad2 and b88f628.

📒 Files selected for processing (1)
  • packages/cli/src/commands/docs.ts

Copilot AI and others added 2 commits April 20, 2026 15:51
…nment

fix(docs): incorporate base in fallback URL and add debug log
Copy link
Copy Markdown

@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 (1)
packages/cli/src/commands/docs.ts (1)

71-73: Consider logger.warn instead of logger.debug for the fallback notice.

Since the fallback is best-effort and may point to a non-existent page, users running the command at default log level will see a link without any indication it was synthesized. A warn (or at least info) would make the degraded behavior visible; debug effectively hides it unless the user opts in.

Proposed change
-          logger.debug(
+          logger.warn(
             `No registry links found for ${highlighter.info(component)} (base: ${highlighter.info(base)}). Using best-effort fallback: ${fallbackUrl}`,
           )
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@packages/cli/src/commands/docs.ts` around lines 71 - 73, The log currently
uses logger.debug when falling back to a synthesized registry link in the docs
command (see the logger.debug call that references highlighter.info(component),
highlighter.info(base) and fallbackUrl); change this to logger.warn (or
logger.info) so the fallback is visible at default log levels, and update the
message to clearly indicate the link is a best-effort/synthesized fallback
(e.g., include the word "fallback" or "synthesized" in the message) while
keeping the same context variables (component, base, fallbackUrl).
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.

Inline comments:
In `@packages/cli/src/commands/docs.ts`:
- Around line 70-74: The fallback URL built in the docs command includes an
extra `${base}/` path segment causing 404s; update the construction of
fallbackUrl (used where SHADCN_VUE_URL is combined, referenced along with
logger.debug and assigned into links) to omit the `${base}/` segment so it
becomes SHADCN_VUE_URL + "/docs/components/" + component, and keep the existing
debug message and assignment to links = { docs: fallbackUrl } intact.

---

Nitpick comments:
In `@packages/cli/src/commands/docs.ts`:
- Around line 71-73: The log currently uses logger.debug when falling back to a
synthesized registry link in the docs command (see the logger.debug call that
references highlighter.info(component), highlighter.info(base) and fallbackUrl);
change this to logger.warn (or logger.info) so the fallback is visible at
default log levels, and update the message to clearly indicate the link is a
best-effort/synthesized fallback (e.g., include the word "fallback" or
"synthesized" in the message) while keeping the same context variables
(component, base, fallbackUrl).
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro

Run ID: aa59e47a-8f19-4f67-8e08-c31beea8eaea

📥 Commits

Reviewing files that changed from the base of the PR and between b88f628 and cad98fa.

📒 Files selected for processing (1)
  • packages/cli/src/commands/docs.ts

Comment thread packages/cli/src/commands/docs.ts Outdated
Copilot AI and others added 2 commits April 20, 2026 16:33
The fallback URL was constructed as `${SHADCN_VUE_URL}/${base}/docs/components/${component}`
which produced URLs like `https://shadcn-vue.com/reka/docs/components/button`,
causing 404s. The correct URL pattern (matching all other docs links in the
codebase) is `https://shadcn-vue.com/docs/components/{component}`.

Agent-Logs-Url: https://github.com/imlargo/shadcn-vue/sessions/94840a9e-97bf-4ae1-8d83-0c93e3f07445
…uction

fix(cli): remove extra base path segment from docs fallback URL
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