wakatime / macos-wakatime

Mac system tray app for automatic time tracking and metrics generated from your Xcode, Figma, Postman, etc. usage.
https://wakatime.com/mac
BSD 3-Clause "New" or "Revised" License
127 stars 22 forks source link

Detect project from url #227

Closed alanhamlett closed 3 months ago

alanhamlett commented 3 months ago

Same as https://github.com/wakatime/browser-wakatime/issues/47.

For ex: when url is https://github.com/wakatime/macos-wakatime/pull/224/files set project to macos-wakatime.

The project would be set to macos-wakatime if we had cloned and opened that repo locally, so match it in the browser.

We can do the same for browser-based IDEs like Figma's web editor, and other sites.

List of sites that we can detect project from url. These regex patterns all have a group, the parenthesis, to extract the project name from the url.

github.com/([^/]+/[^/]+)/?.*$
bitbucket.org/([^/]+/[^/]+)/?.*$
app.circleci.com/.*/?(github|bitbucket|gitlab)/([^/]+/[^/]+)/?.*$ [1]
app.travis-ci.com/(github|bitbucket|gitlab)/([^/]+/[^/]+)/?.*$ [2]
app.travis-ci.org/(github|bitbucket|gitlab)/([^/]+/[^/]+)/?.*$
jupyterlab [3]

[1] CircleCi has many project pages like:

[2] sites like circleci and travisci have the app subdomain, but might have other subdomains. We should match the domain ignoring the supdomain.

[3] not sure how to detect project because jupyterlab is commonly run locally? https://jupyterlab.readthedocs.io/en/latest/user/urls.html