Skip to content

Add circleci open command to next#1229

Open
parkuman wants to merge 1 commit intonextfrom
parker/next/open-command
Open

Add circleci open command to next#1229
parkuman wants to merge 1 commit intonextfrom
parker/next/open-command

Conversation

@parkuman
Copy link
Copy Markdown

@parkuman parkuman commented Apr 24, 2026

Checklist

=========

  • I have performed a self-review of my own code
  • I have commented my code, particularly in hard-to-understand areas
  • I have checked for similar issues and haven't found anything relevant.
  • This is not a security issue (which should be reported here: https://circleci.com/security/)
  • I have read Contribution Guidelines.

Internal Checklist

  • I am requesting a review from my own team as well as the owning team
  • I have a plan in place for the monitoring of the changes that I am making (this can include new monitors, logs to be aware of, etc...)

Changes

=======

  • Add circleci open command in internal/cmd/open/
  • Register open command in internal/cmd/root/root.go
  • Add github.com/pkg/browser dependency for opening URLs in the default browser
  • Add tests for ProjectURL covering GitHub, Bitbucket, GitLab, and invalid slug cases

Rationale

=========

The circleci open command existed on the main branch (cmd/open.go) but was
not carried over during the migration to the next branch. I missed it! This restores the
feature, adapted to the new project structure and conventions (structured errors
via clierrors, git remote detection via internal/gitremote, gotest.tools
for tests).

Considerations

==============

  • Reused the existing internal/gitremote.Detect() package rather than
    reimplementing git remote parsing. This is the same package used by
    circleci project follow.
  • The old implementation only supported GitHub and Bitbucket. This version
    also supports GitLab since gitremote.Detect() already handles it.
  • url.PathEscape is applied to slug segments as a safety net, though in
    practice VCS hosts restrict org/repo names to characters that don't need
    escaping.

Screenshots

============

After

Screen.Recording.2026-04-24.at.11.35.46.AM.mov

@parkuman parkuman marked this pull request as draft April 27, 2026 14:00
@parkuman parkuman changed the title Add 'circleci open' command Add 'circleci open' command to next Apr 27, 2026
@parkuman
Copy link
Copy Markdown
Author

Internal discussions ongoing here: https://circleci.slack.com/archives/C0AUWSGBFQD/p1777045015516229

@parkuman parkuman force-pushed the parker/next/open-command branch from baa85c9 to 3fd4a53 Compare April 27, 2026 18:28
@parkuman parkuman marked this pull request as ready for review April 27, 2026 18:28
@parkuman parkuman changed the title Add 'circleci open' command to next Add circleci open command to next Apr 27, 2026
The open command was present in the legacy (main) branch but was missed
during the migration to the next branch. This restores the feature,
adapted to the new project structure:

- Detects the project from the git remote (GitHub, Bitbucket, GitLab)
- Opens the CircleCI pipelines page in the default browser
- Uses structured error handling consistent with the new CLI conventions
@parkuman parkuman force-pushed the parker/next/open-command branch from 3fd4a53 to 7553022 Compare April 27, 2026 18:35
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.

1 participant