Skip to content

Adds an 'ide' url parameter for gk.dev links#4934

Merged
sergeibbb merged 2 commits intomainfrom
4905-add-ide-parameter-to-gkdev-links
Feb 23, 2026
Merged

Adds an 'ide' url parameter for gk.dev links#4934
sergeibbb merged 2 commits intomainfrom
4905-add-ide-parameter-to-gkdev-links

Conversation

@sergeibbb
Copy link
Member

@sergeibbb sergeibbb commented Jan 27, 2026

Description

Solves #4905

Checklist

  • I have followed the guidelines in the Contributing document
  • My changes follow the coding style of this project
  • My changes build without any errors or warnings
  • My changes have been formatted and linted
  • My changes include any required corresponding changes to the documentation (including CHANGELOG.md and README.md)
  • My changes have been rebased and squashed to the minimal number (typically 1) of relevant commits
  • My changes have a descriptive commit message with a short title, including a Fixes $XXX - or Closes #XXX - prefix to auto-close the issue that your PR addresses

@sergeibbb sergeibbb linked an issue Jan 27, 2026 that may be closed by this pull request
2 tasks
@sergeibbb sergeibbb marked this pull request as ready for review January 27, 2026 16:35
@augmentcode
Copy link

augmentcode bot commented Jan 27, 2026

🤖 Augment PR Summary

Summary: This PR updates gk.dev link generation to include an ide query parameter so gk.dev can identify the originating editor.

Changes:

  • Makes UrlsProvider.getGkDevUrl async and appends ide=... based on the host app name
  • Centralizes automatic injection of source=gitlens into gk.dev URLs (removing duplicated/manual additions)
  • Updates call sites to await the new async URL builder (auth, subscriptions, integrations, launchpad)
  • Adds getGkDevUrlWithoutIdeArg for cases where ide should be omitted (e.g., drafts)

Technical Notes: The IDE identifier comes from getHostAppName() and defaults to unknown when it can’t be determined.

🤖 Was this summary useful? React with 👍 or 👎

Copy link

@augmentcode augmentcode bot left a comment

Choose a reason for hiding this comment

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

Review completed. 2 suggestions posted.

Fix All in Augment

Comment augment review to trigger a new review at any time.

@sergeibbb sergeibbb force-pushed the 4905-add-ide-parameter-to-gkdev-links branch from 936d004 to 0209c58 Compare January 27, 2026 16:54
@sergeibbb sergeibbb marked this pull request as draft January 27, 2026 16:57
@sergeibbb sergeibbb marked this pull request as ready for review January 27, 2026 16:57
Copy link

@augmentcode augmentcode bot left a comment

Choose a reason for hiding this comment

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

Review completed. No suggestions at this time.

Comment augment review to trigger a new review at any time.

sergeibbb added a commit that referenced this pull request Jan 27, 2026
Updates `getGkDevUrl` to asynchronously fetch and include the host IDE
(e.g., VS Code) as an `ide` query parameter.

It should be used for all  register, connect, and upgrade flows.

Introduces `getGkDevUrlWithoutIdeArg` for cases where the `ide`
parameter is not required, such as draft URLs.

Updates all existing call sites to `await` the now-asynchronous
`getGkDevUrl` method. Refactors query parameter generation for `source`
and `ide` into dedicated helper methods for improved consistency.
(#4905, #4934)
sergeibbb added a commit that referenced this pull request Jan 27, 2026
Cleans up GitKraken-related URLs by removing the `source=gitlens` query
parameter from authentication, referral, and subscription management
flows. This parameter is substituted by `getGkDevUrl()` automatically.

(#4905, #4934)
@sergeibbb sergeibbb force-pushed the 4905-add-ide-parameter-to-gkdev-links branch from 0209c58 to d24cb30 Compare January 27, 2026 19:03
Comment on lines +50 to +58
async getGkDevUrl(pathSegments?: string | string[], query?: string | URLSearchParams): Promise<string> {
const ide = (await getHostAppName()) ?? 'unknown';
query = this.provideQueryWithIdeArg(query, ide);
query = this.provideQueryWithSourceArg(query);
const uri = this.buildGkDevUri(pathSegments, query);
return uri.toString(true);
}

getGkDevUrlWithoutIdeArg(pathSegments?: string | string[], query?: string | URLSearchParams): string {
Copy link
Contributor

Choose a reason for hiding this comment

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

Why do we have two functions? Is there some technical reason we can't make it async in every case and just provide the option in the params to include IDE?

Copy link
Member Author

Choose a reason for hiding this comment

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

@axosoft-ramint

Yes, you're right.
ViewNode.getUrl supports both async and sync signatures, so I can just update it and it does not require massive changes.

Copy link
Member Author

Choose a reason for hiding this comment

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

@axosoft-ramint

Done

sergeibbb added a commit that referenced this pull request Feb 2, 2026
Updates `getGkDevUrl` to asynchronously fetch and include the host IDE
(e.g., VS Code) as an `ide` query parameter.

It should be used for all  register, connect, and upgrade flows.

Introduces `getGkDevUrlWithoutIdeArg` for cases where the `ide`
parameter is not required, such as draft URLs.

Updates all existing call sites to `await` the now-asynchronous
`getGkDevUrl` method. Refactors query parameter generation for `source`
and `ide` into dedicated helper methods for improved consistency.
(#4905, #4934)
sergeibbb added a commit that referenced this pull request Feb 2, 2026
Cleans up GitKraken-related URLs by removing the `source=gitlens` query
parameter from authentication, referral, and subscription management
flows. This parameter is substituted by `getGkDevUrl()` automatically.

(#4905, #4934)
@sergeibbb sergeibbb force-pushed the 4905-add-ide-parameter-to-gkdev-links branch from d24cb30 to 8d61774 Compare February 2, 2026 16:06
sergeibbb added a commit that referenced this pull request Feb 2, 2026
Updates `getGkDevUrl` to asynchronously fetch and include the host IDE
(e.g., VS Code) as an `ide` query parameter.

It should be used for all  register, connect, and upgrade flows.

Introduces `getGkDevUrlWithoutIdeArg` for cases where the `ide`
parameter is not required, such as draft URLs.

Updates all existing call sites to `await` the now-asynchronous
`getGkDevUrl` method. Refactors query parameter generation for `source`
and `ide` into dedicated helper methods for improved consistency.
(#4905, #4934)
@sergeibbb sergeibbb force-pushed the 4905-add-ide-parameter-to-gkdev-links branch from 8d61774 to c7b8c20 Compare February 2, 2026 16:08
sergeibbb added a commit that referenced this pull request Feb 2, 2026
Cleans up GitKraken-related URLs by removing the `source=gitlens` query
parameter from authentication, referral, and subscription management
flows. This parameter is substituted by `getGkDevUrl()` automatically.

(#4905, #4934)
sergeibbb added a commit that referenced this pull request Feb 2, 2026
Updates `getGkDevUrl` to asynchronously fetch and include the host IDE
(e.g., VS Code) as an `ide` query parameter.

It should be used for all  register, connect, and upgrade flows.

Introduces `getGkDevUrlWithoutIdeArg` for cases where the `ide`
parameter is not required, such as draft URLs.

Updates all existing call sites to `await` the now-asynchronous
`getGkDevUrl` method. Refactors query parameter generation for `source`
and `ide` into dedicated helper methods for improved consistency.
(#4905, #4934)
sergeibbb added a commit that referenced this pull request Feb 2, 2026
Cleans up GitKraken-related URLs by removing the `source=gitlens` query
parameter from authentication, referral, and subscription management
flows. This parameter is substituted by `getGkDevUrl()` automatically.

(#4905, #4934)
@sergeibbb sergeibbb force-pushed the 4905-add-ide-parameter-to-gkdev-links branch from c7b8c20 to fdf0658 Compare February 2, 2026 16:15
@sergeibbb sergeibbb requested a review from ramin-t February 2, 2026 16:15
@ramin-t
Copy link
Contributor

ramin-t commented Feb 13, 2026

@sergeibbb I just got back to this PR after a while off of it, and tried to follow the PR description, the GitHub issue description, and the Jira issue description to understand why this field is needed, and I still do not understand. What would this "ide" parameter encode that's not already a part of the scheme/protocol/completion link encoded in a deep link to GitLens?

@sergeibbb
Copy link
Member Author

Hi @axosoft-ramint It is a really good question. I'll ask Trevor.

Possible answers are:

These links do not contain redirect_uri:

image

These have different argument success_uri and redirect_uri:
imageimage

So, maybe having one unified argument for all links simplifies handling those on the server.

@sergeibbb
Copy link
Member Author

@axosoft-ramint
Here is some explanation: https://gitkraken.atlassian.net/jira/polaris/projects/PLG/ideas/view/9745072?selectedIssue=PLG-163&issueViewSection=comments&focusedCommentId=165957

(Unfortunately Jira has stopped focusing on the linked comment).

@sergeibbb
Copy link
Member Author

Hi @axosoft-ramint
Is here anything else that stops us from merging?

sergeibbb added a commit that referenced this pull request Feb 18, 2026
Updates `getGkDevUrl` to asynchronously fetch and include the host IDE
(e.g., VS Code) as an `ide` query parameter.

It should be used for all  register, connect, and upgrade flows.

Introduces `getGkDevUrlWithoutIdeArg` for cases where the `ide`
parameter is not required, such as draft URLs.

Updates all existing call sites to `await` the now-asynchronous
`getGkDevUrl` method. Refactors query parameter generation for `source`
and `ide` into dedicated helper methods for improved consistency.
(#4905, #4934)
sergeibbb added a commit that referenced this pull request Feb 18, 2026
Cleans up GitKraken-related URLs by removing the `source=gitlens` query
parameter from authentication, referral, and subscription management
flows. This parameter is substituted by `getGkDevUrl()` automatically.

(#4905, #4934)
@sergeibbb sergeibbb force-pushed the 4905-add-ide-parameter-to-gkdev-links branch from fdf0658 to 9fe1042 Compare February 18, 2026 16:53
Copy link
Contributor

@ramin-t ramin-t left a comment

Choose a reason for hiding this comment

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

LGTM after the explanation provided. I suggest confirming that the changelog entry is in the right place before merging, and confirm that always including the ide param in all gkdev urls we use doesn't pose any issues for url flows that are not yet ready for it (as long as it is ignored in those cases, I don't see any harm in including it).

let uri = pathSegments.length ? Uri.joinPath(this.baseGkDevUri, ...pathSegments) : this.baseGkDevUri;

query ??= 'source=gitlens';
const ide = (await getHostAppName()) ?? 'unknown';
Copy link
Contributor

@ramin-t ramin-t Feb 19, 2026

Choose a reason for hiding this comment

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

One other thought: are all possible outputs of getHostAppName url-friendly? If we put the string output of that function directly into the query, just confirming we won't have any issues downstream or upstream.

Copy link
Member Author

Choose a reason for hiding this comment

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

@axosoft-ramint

are all possible outputs of getHostAppName url-friendly?

No, because we can read it from env.appRoot, 'product.json' where everything can be contained.

If we put the string output of that function directly into the query

We should not put directly to the query string we should always wrap it:

??= `source=gitlens&ide=${encodeURIComponent(ide)}`

However if we put it to the query object, it's wrapped automatically:

query = new URLSearchParams(query);
query.set('ide', "co=de");

the output is:
ide=co%3Dde

sergeibbb added a commit that referenced this pull request Feb 23, 2026
Updates `getGkDevUrl` to asynchronously fetch and include the host IDE
(e.g., VS Code) as an `ide` query parameter.

It should be used for all  register, connect, and upgrade flows.

Introduces `getGkDevUrlWithoutIdeArg` for cases where the `ide`
parameter is not required, such as draft URLs.

Updates all existing call sites to `await` the now-asynchronous
`getGkDevUrl` method. Refactors query parameter generation for `source`
and `ide` into dedicated helper methods for improved consistency.
(#4905, #4934)
sergeibbb added a commit that referenced this pull request Feb 23, 2026
Cleans up GitKraken-related URLs by removing the `source=gitlens` query
parameter from authentication, referral, and subscription management
flows. This parameter is substituted by `getGkDevUrl()` automatically.

(#4905, #4934)
@sergeibbb sergeibbb force-pushed the 4905-add-ide-parameter-to-gkdev-links branch from 9fe1042 to 1e94c73 Compare February 23, 2026 17:30
Updates `getGkDevUrl` to asynchronously fetch and include the host IDE
(e.g., VS Code) as an `ide` query parameter.

It should be used for all  register, connect, and upgrade flows.

Introduces `getGkDevUrlWithoutIdeArg` for cases where the `ide`
parameter is not required, such as draft URLs.

Updates all existing call sites to `await` the now-asynchronous
`getGkDevUrl` method. Refactors query parameter generation for `source`
and `ide` into dedicated helper methods for improved consistency.
(#4905, #4934)
Cleans up GitKraken-related URLs by removing the `source=gitlens` query
parameter from authentication, referral, and subscription management
flows. This parameter is substituted by `getGkDevUrl()` automatically.

(#4905, #4934)
@sergeibbb sergeibbb force-pushed the 4905-add-ide-parameter-to-gkdev-links branch from 1e94c73 to 05b8bb2 Compare February 23, 2026 17:31
@sergeibbb sergeibbb merged commit b8ebfd3 into main Feb 23, 2026
6 checks passed
sergeibbb added a commit that referenced this pull request Feb 23, 2026
Updates `getGkDevUrl` to asynchronously fetch and include the host IDE
(e.g., VS Code) as an `ide` query parameter.

It should be used for all  register, connect, and upgrade flows.

Introduces `getGkDevUrlWithoutIdeArg` for cases where the `ide`
parameter is not required, such as draft URLs.

Updates all existing call sites to `await` the now-asynchronous
`getGkDevUrl` method. Refactors query parameter generation for `source`
and `ide` into dedicated helper methods for improved consistency.
(#4905, #4934)
@sergeibbb sergeibbb deleted the 4905-add-ide-parameter-to-gkdev-links branch February 23, 2026 17:42
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.

Add an 'ide' url parameter for gk.dev links

2 participants