Skip to content

feat(repo): open a given page with repo view --web --path, or print its link for agents - #526

Merged
angeloashmore merged 4 commits into
mainfrom
feat/repo-view-path
Dec 2, 2026
Merged

angeloashmore merged 4 commits into
mainfrom
feat/repo-view-path

Conversation

@angeloashmore

@angeloashmore angeloashmore commented Dec 2, 2026 •

Copy link
Copy Markdown
Member

Resolves:

Description

Before this PR, prismic repo view --web always opened the repository home. For example, in the one-prompt onboarding, prismic init creates a guest account and the agent builds a first page in a release. The login link the agent gives the guest at the end lands on the Work tab, not on that page. A plain link to the release does not help: a guest has no browser session, so it shows the login screen.

After this PR, --path opens a given page of the repository. For a guest, the login link redirects to that page. For a signed-in user, the browser opens that page directly.

prismic repo view --web --path builder/upcoming/<release-id>

The path is always relative to the repository, so the link stays on the repository's host.

With --no-browser, the command only prints the link: a guest's login link works once, so an agent that gives the user the link must not also open it in a tab first.

Checklist

  • If my changes require tests, I added them.
  • If my changes affect backward compatibility, it has been discussed.
  • If my changes require an update to the CONTRIBUTING.md guide, I updated it.

Preview

How to QA 1

With no saved login, run prismic init, then prismic repo view --web --path builder/upcoming. Click "Open in Prismic": the Page Builder opens on the Planned tab, not on Work.

Summary by CodeRabbit

  • New Features
    • When opening a repository in the browser, you can now provide a path with --path alongside --web. Guest links will redirect to the specified page within the repository.
  • Bug Fixes
    • Browser links are now checked for valid URL formatting before they are opened.

Generated by Claude Code

Footnotes

  1. Please use these labels when submitting a review:
    ❓ #ask: Ask a question.
    💡 #idea: Suggest an idea.
    ⚠️ #issue: Strongly suggest a change.
    🎉 #nice: Share a compliment. ↩

Add the --path option to `prismic repo view --web`. It opens a page of
the repository, such as a release in the Page Builder, instead of its
home. For a guest account, the login link redirects to that page.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01L1dGD5PHF4jHVaf88Hg4z5
@coderabbitai

coderabbitai Bot commented Dec 2, 2026 •

Copy link
Copy Markdown

Explain Change →

Important

  • Trigger review

This repository does not receive automatic reviews because it has fewer than 10 stars.

Run configuration

  • Source mode: Auto
  • Repository: Unavailable
  • Branch: Unavailable
  • File: No configuration file from this repository applied
  • Commit: Unavailable
  • Layers: Organization UI
  • Review profile: CHILL
  • Plan: Advanced
  • Run ID: 3607995f-0506-4d14-913b-6abf3b09291c
Walkthrough

prismic repo view adds a web-only --path option. The command uses the path as the guest-link redirect target and validates links before opening them.

Changes: Repository page selection

Layer / File(s) Summary
Path option and browser redirect
src/commands/repo-view.ts, test/repo-view.test.ts
The command accepts --path with --web and appends the path, without leading slashes, to the browser target. Guest links redirect to that page. All links must match the allowed-character pattern and pass URL.canParse. A test checks the guest-account redirect path.

Estimated code review effort: 2 (Simple) | ~10 minutes

Change: Feature

Merge Risk: Low · previous review b20b1

Passing a --path value that contains percent-encoded characters can print a success message without opening the browser. The effect is limited to such paths, and the printed link can still be opened manually.

Pre-merge checks: Passed 4

Check name Status Explanation
Linked Issues check Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check Passed Check skipped because no linked issues were found for this pull request.
Description Check Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check Passed The title names the main change: a new --path option for prismic repo view --web that opens a given repository page. It also names the secondary behavior of printing the page link for agents. The …
Full details: Title check

Explanation

The title names the main change: a new --path option for prismic repo view --web that opens a given repository page. It also names the secondary behavior of printing the page link for agents. The raw summary confirms the --path option, its dependency on --web, and the guest-link redirect target, so the title matches the changeset.

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

Bring in the dependency update from main.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01L1dGD5PHF4jHVaf88Hg4z5

Copy link
Copy Markdown
Member Author

@coderabbitai review


Generated by Claude Code

@coderabbitai

coderabbitai Bot commented Dec 2, 2026 •

Copy link
Copy Markdown
Action performed

Review finished.

Note: CodeRabbit is an incremental review system and does not re-review already reviewed commits. This command is applicable only when automatic reviews are paused.

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

Actionable comments

Minor 1
  1. Handle valid encoded paths instead of reporting a browser launch that did not occur.
Nitpick 1
  1. Check the browser-launch effect as well as the reported redirect.
    test/repo-view.test.ts, lines 69–73 · 📐 Maintainability & Code Quality · ⚡ Quick win
    The fake server percent-encodes redirect_uri. The command rejects the resulting % characters and skips browser launch, but these assertions still pass because the command prints Opening … unconditionally.
    Add a harmless browser-launch probe and assert the destination it receives. Keep the existing redirect assertion. This will distinguish a completed browser workflow from the known no-op.
Review info

Run configuration

  • Source mode: Auto
  • Repository: Unavailable
  • Branch: Unavailable
  • File: No configuration file from this repository applied
  • Commit: Unavailable
  • Layers: Organization UI
  • Review profile: CHILL
  • Plan: Advanced
  • Run ID: a43c406d-7808-421d-b6ef-7480ed286060
Commits

Reviewing files that changed from the base of the PR and between 9e4a247 and b20b13c.

Files selected for processing: 2

  • src/commands/repo-view.ts
  • test/repo-view.test.ts

Included review availability: This review used your included allowance. Your plan provides up to 1 included review per hour; 0 remain after this review.

Comment thread src/commands/repo-view.ts
if (link === url || (/^https:\/\/[\w\-.:/?=&~+]+$/.test(link) && URL.canParse(link))) {
// openBrowser() runs a shell, so a link can't contain shell syntax,
// including cmd.exe's %NAME%.
if (/^https:\/\/[\w\-.:/?=&~+]+$/.test(link) && URL.canParse(link)) {

@coderabbitai coderabbitai Bot Dec 2, 2026 •

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Minor · Functional Correctness · Heavy lift

Handle valid encoded paths instead of reporting a browser launch that did not occur.

For a signed-in account, --path 'builder/upcoming/abc?label=a%20b' produces a valid destination, but this regex rejects %. The command skips openBrowser, prints Opening …, and exits successfully.

Support encoded destinations through shell-safe browser launching. If a destination cannot be opened safely, return an explicit error instead of reporting success. Do not simply remove the shell-safety check.

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

Leaving this as is, on purpose.

  • % stays out of the allowed characters because openBrowser() runs a shell, and cmd.exe expands %NAME% even inside quotes. Allowing encoded paths safely means changing how the browser is launched on every platform, which is out of scope here.
  • The pages this option is for (builder/upcoming/<release id> and similar) need no encoding.
  • When the link fails the check, the command still prints it, so the user can open it by hand. Guest links already behaved this way before this PR.

On the test nitpick: the tests do not launch a browser on purpose. They assert the printed link, which is what the user sees, and the redirect it carries.


Generated by Claude Code

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

@angeloashmore Thanks for explaining the scope and the shell-safety constraint. I won’t mark the finding as addressed.


Learnings added

Learnt from: angeloashmore
Repo: prismicio/cli PR: 526
File: src/commands/repo-view.ts:50-50
Timestamp: 2026-12-02T22:04:23.904Z
Learning: Within repository "prismicio/cli", only for files matching one of ["src/commands/repo-view.ts"]: In src/commands/repo-view.ts, `prismic repo view --web --path` targets pages such as `builder/upcoming/<release-id>` that do not need encoded paths. The command intentionally excludes `%` from links passed to `openBrowser()` because it runs a shell and Windows cmd.exe expands `%NAME%` even inside quotes. Links that fail the check are printed for manual use, as guest links were before this change. Do not broaden the allowed characters without addressing shell safety.

Note: Learnings are effective only in the context of similar code segments. To apply general coding guidelines, please configure review instructions. You can manage existing learnings in the app.


Learnings used

Learnt from: CR
Repo: prismicio/cli PR: 0
File: AGENTS.md:0-0
Timestamp: 2026-11-24T21:00:06.580Z
Learning: Source excerpt:
- Assert what a user would see, not the calls made to get there. A refactor should pass without editing tests.

You are interacting with an AI system.

Add --no-browser to `repo view --web`. With it, the command prints the
link and does not open a browser. On a guest account, the link is the
one-time login link. An agent can give this link to the user as the
only link to click, so the link is not used up by a browser tab first.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01L1dGD5PHF4jHVaf88Hg4z5
@angeloashmore angeloashmore changed the title feat(repo): open a given page with repo view --web --path feat(repo): open a given page with repo view --web --path, or print its link for agents Dec 2, 2026

Copy link
Copy Markdown
Member Author

@coderabbitai review


Generated by Claude Code

@coderabbitai

coderabbitai Bot commented Dec 2, 2026 •

Copy link
Copy Markdown
Action not completed

Review rate limited.

Note: CodeRabbit is an incremental review system and does not re-review already reviewed commits. This command is applicable only when automatic reviews are paused.

@angeloashmore
angeloashmore marked this pull request as ready for review December 2, 2026 22:58
@angeloashmore
angeloashmore merged commit 42d03b8 into main Dec 2, 2026
17 checks passed
@angeloashmore
angeloashmore deleted the feat/repo-view-path branch December 2, 2026 22:59
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