Skip to content

Git branches support#148

Merged
Friedrich482 merged 13 commits into
mainfrom
branching
Jul 15, 2026
Merged

Git branches support#148
Friedrich482 merged 13 commits into
mainfrom
branching

Conversation

@Friedrich482

Copy link
Copy Markdown
Owner

Commits

  • feat: git branches support

    • added a utility function get-current-git-branch that gets the git branch of the current workspace. The branch can be string | null
    • we don't have a git branch if: either the project is not version controlled or the file is not a part of the current workspace folder, which was already taken in account
    • updated the global state object type to also include the branch name
    • now remaining is to include the branches on the server side
  • feat: database migrations

    • added the branches table schema
    • updated the files schema to remove the project_id and replaced it by branch_id
    • generated and ran migrations scripts, adding necessary adjustments to safely put the branch table between projects and files, generated default branch main for each project, linked all files of a project to that main branch before safely deleting the project_id column from the files table
  • feat: branches api

    • generated the branches module with the basic functions in the branches.service: create, findOne and update
    • updated the files service to use the branchId instead of the projectId
    • updated the extension service upsertFiles method to take the branches in account: upsert the projects first, then the branches and finally the files
    • updated the vscode extension to use "N/A" when the branch is null (for a non-version controlled project), so the branch is always a string
    • updated the files impacted by that change in both the extension and in the extension.dto in the api
  • feat: analytics branches

    • updated the projects analytics methods to include the new relationship in consideration of the branches, with the proper joins between tables and calculations if necessary
    • updated all the files that were affected by the change of the endpoints schemas of projects analytics in the dashboard
    • used the nullish coalescing assignment to initialize updatedBranches[projectPath] while avoiding runtime errors in the extensionService
    • added tests files to the list of files to ignore during the api build in its tsconfig.build.json file
  • chore: backward compatibility

    • added a default value for branchName for backward compatibility reasons (a user still have an old version of the extension that doesn't send the branches to the server)
    • renamed back projectName to name for the same reasons to prevent an old version of the dashboard requests to be refused by the server
  • fix: branching

    • updated the general structure of the file sync data, which is also saved the global state of the extension and used as filesData in the extension, updated all affected functions to match that new shape
    • updated the getFilesForDay and upsertFiles methods of the extension.service to support that new data shape meanwhile keeping backward compatibility to avoid breaking the extension for consumers of old versions
    • updated the findAll method of the filesService to return an array instead of an object
  • feat: branching dashboard

    • added a new trpc procedure analytics.projects.getProjectBranchesOnPeriod
    • added a dropdown menu to select branches on projects
    • that dropdown only shows up if the project is version controlled
    • created a zustand store to keep track of projects selected
    • the store automatically updates the url to add the branches selected as search params
    • the branches state of the store is reset between navigations
  • feat: branching

    • pulled the selected branches from the store and added them to the queries in the dashboard for all trpc procedures where it can be passed
  • test: branchesService

    • added tests for the branchesService and updated the tests of the filesService
  • test: fix and update tests

    • updated and fixed all broken tests as well as added tests for new methods in the projects analytics and extension modules (router and service)
    • updated the vitest.config.ts file to generate the tests coverage report even if there are failing tests
  • test: projects analytics

    • tested both the presence and absence of the branches parameter for the projects analytics service methods using it
  • feat: web app

    • added the git branches tracking feature to the features section on the landing page
  • chore: extension version

    • bumped the extension version to v0.0.70

- added a utility function `get-current-git-branch` that gets the git branch of the current workspace. The branch can be string | null
- we don't have a git branch if: either the project is not version controlled or the file is not a part of the current workspace folder, which was already taken in account
- updated the global state object type to also include the branch name
- now remaining is to include the branches on the server side
- added the branches table schema
- updated the files schema to remove the project_id and replaced it by branch_id
- generated and ran migrations scripts, adding necessary adjustments to safely put the branch table between projects and files, generate default branch main for each project link all files of a project to that main branch before safely deleting the project_id column from the files table
- generated the branches module with the basic functions in the branches.service: create, findOne and update
- updated the files service to use the branchId instead of the projectId
- updated the extension service upsertFiles method to take the branches in account: upsert the projects first, then the branches and finally the files
- updated the vscode extension to use "N/A" when the branch is null (for a non-version controlled project), so the branch is always a string
- updated the files impacted by that change in both the extension and in the extension.dto in the api
- updated the projects analytics methods to include the new relationship in consideration of the branches, with the proper joins between tables and calculations if necessary
- updated all the files that were affected by the change of the endpoints schemas of projects analytics in the dashboard
- used the nullish coalescing assignment to initialize `updatedBranches[projectPath]` while avoiding runtime errors
- added tests files to the list of files to ignore during the api build in its `tsconfig.build.json` file
- added a default value for branchName for backward compatibility reasons (a user still have an old version of the extension that doesn't send the branches to the server)
- renamed back projectName to name for the same reasons to prevent an old version of the dashboard requests to be refused by the server
- updated the general structure of the file sync data, which is also saved the global state of the extension and used as filesData in the extension, updated all affected functions to match that new shape
- updated the `getFilesForDay` and `upsertFiles` methods of the extension.service to support that new data shape meanwhile keeping backward compatibility to avoid breaking the extension for consumers of old versions
- updated the `findAll` method of the filesService to return an array instead of an object
- added a new trpc procedure `analytics.projects.getProjectBranchesOnPeriod`
- added a dropdown menu to select branches on projects
- that dropdown only shows up if the project is version controlled
- created a zustand store to keep track of projects selected
- the store automatically updates the url to add the branches selected as search params
- the branches state of the store is reset between navigations
- pulled the selected branches from the store and added them to the queries in the dashboard for all trpc procedures where it can be passed
- added tests for the branchesService and updated the tests of the filesService
- updated and fixed all broken tests as well as added tests for new methods in the projects analytics and extension  modules (router and service)
- updated the `vitest.config.ts` file to generate the tests coverage report even if there are failing tests
- tested both the presence and absence of the branches parameter for the projects analytics service methods using it
- added the git branches tracking feature to the features section on the landing page
- bumped the extension version to `v0.0.70`
@coderabbitai

coderabbitai Bot commented Jul 15, 2026

Copy link
Copy Markdown

Important

Review skipped

Too many files!

This PR contains 62 files, which is 12 over the limit of 50.

To get a review, narrow the scope:
• coderabbit review --type committed # exclude uncommitted changes
• coderabbit review --dir # limit to a subdirectory
• coderabbit review --base # compare against a closer base

Upgrade to a paid plan to raise the limit.

⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro

Run ID: 2f8975d3-9d76-45c6-99c0-4add1ce5290f

📥 Commits

Reviewing files that changed from the base of the PR and between a2ca47a and 20d1cae.

📒 Files selected for processing (62)
  • apps/api/drizzle/0021_boring_chat.sql
  • apps/api/drizzle/0022_sparkling_mephisto.sql
  • apps/api/drizzle/meta/0021_snapshot.json
  • apps/api/drizzle/meta/0022_snapshot.json
  • apps/api/drizzle/meta/_journal.json
  • apps/api/src/analytics/analytics.module.ts
  • apps/api/src/analytics/dto/projects-analytics.dto.ts
  • apps/api/src/analytics/routers/projects-analytics.router.test.ts
  • apps/api/src/analytics/routers/projects-analytics.router.ts
  • apps/api/src/analytics/services/projects-analytics.service.test.ts
  • apps/api/src/analytics/services/projects-analytics.service.ts
  • apps/api/src/app.module.ts
  • apps/api/src/branches/branches.dto.ts
  • apps/api/src/branches/branches.module.ts
  • apps/api/src/branches/branches.service.test.ts
  • apps/api/src/branches/branches.service.ts
  • apps/api/src/drizzle/schema/branches.ts
  • apps/api/src/drizzle/schema/files.ts
  • apps/api/src/drizzle/schema/index.ts
  • apps/api/src/extension/extension.dto.ts
  • apps/api/src/extension/extension.module.ts
  • apps/api/src/extension/extension.router.test.ts
  • apps/api/src/extension/extension.service.test.ts
  • apps/api/src/extension/extension.service.ts
  • apps/api/src/files/files.dto.ts
  • apps/api/src/files/files.service.test.ts
  • apps/api/src/files/files.service.ts
  • apps/api/tsconfig.build.json
  • apps/api/vitest.config.ts
  • apps/dashboard/src/components/common/link-with-query.tsx
  • apps/dashboard/src/components/layout/navigation-reset-wrapper.tsx
  • apps/dashboard/src/features/files-circle-packing-chart/components/files-circle-packing-chart.tsx
  • apps/dashboard/src/features/files-list/hooks/use-files.tsx
  • apps/dashboard/src/features/files-list/hooks/use-languages-dropdown.tsx
  • apps/dashboard/src/features/project-day-languages-chart/components/project-day-languages-chart.tsx
  • apps/dashboard/src/features/project-general-stats-charts/components/project-general-stats-chart.tsx
  • apps/dashboard/src/features/project-languages-time-on-period-chart/hooks/use-suspense-query-projects-lang-chart.tsx
  • apps/dashboard/src/features/project-time-on-period-chart/components/project-time-on-period-chart.tsx
  • apps/dashboard/src/features/project-title/components/branches-dropdown.tsx
  • apps/dashboard/src/features/project-title/components/project-title.tsx
  • apps/dashboard/src/features/project-title/hooks/use-get-time-spent-on-project.tsx
  • apps/dashboard/src/stores/branches/branches-store.ts
  • apps/dashboard/src/stores/branches/types-schemas.ts
  • apps/dashboard/src/stores/branches/utils/get-branches-store-values-from-url.ts
  • apps/dashboard/src/stores/period/period-store.ts
  • apps/vscode-extension/package.json
  • apps/vscode-extension/src/types-schemas.ts
  • apps/vscode-extension/src/utils/branch/get-current-git-branch.ts
  • apps/vscode-extension/src/utils/branch/git.d.ts
  • apps/vscode-extension/src/utils/commands/init-extension-commands.ts
  • apps/vscode-extension/src/utils/fetch-initial-data.ts
  • apps/vscode-extension/src/utils/files/delete-files-data-content.ts
  • apps/vscode-extension/src/utils/files/get-current-file-properties.ts
  • apps/vscode-extension/src/utils/files/initialize-files.ts
  • apps/vscode-extension/src/utils/files/update-current-file-obj.ts
  • apps/vscode-extension/src/utils/files/update-files-data-after-sync.ts
  • apps/vscode-extension/src/utils/files/update-files-data-elapsed-time.ts
  • apps/vscode-extension/src/utils/files/update-files-data-frozen-states.ts
  • apps/vscode-extension/src/utils/periodic-sync-data.ts
  • apps/vscode-extension/src/utils/time/calculate-time.ts
  • apps/web/src/app/constants.ts
  • apps/web/src/constants.ts

You can disable this status message by setting the reviews.review_status to false in the CodeRabbit configuration file.

Use the checkbox below for a quick retry:

  • Review on demand using usage pricing
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch branching

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.

@Friedrich482
Friedrich482 merged commit b950ca5 into main Jul 15, 2026
4 checks passed
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