Closed
Resolve Cursor merge conflict with main and preserve local-report integration#19
Conversation
7 tasks
Co-authored-by: Miss-you <[email protected]>
Co-authored-by: Miss-you <[email protected]>
Copilot
AI
changed the title
[WIP] Add integration of local Cursor report sources
Resolve Cursor merge conflict with main and preserve local-report integration
Mar 16, 2026
Miss-you
approved these changes
Mar 16, 2026
There was a problem hiding this comment.
Pull request overview
This PR resolves divergence with main by reintroducing local Cursor reporting/discovery on top of the newer explicit codetok cursor login|status|sync|logout command surface, keeping daily/session local-file based while adding a synced CSV cache.
Changes:
- Adds
codetok cursorsubcommands (login/status/sync/logout) wired to a newcursorpackage for credential handling and explicit dashboard sync. - Implements local credential + synced CSV storage with atomic write semantics and restricted permissions.
- Expands Cursor provider test coverage to ensure recursive discovery finds
synced/usage.csvwhen scanning an explicit base directory.
Reviewed changes
Copilot reviewed 12 out of 12 changed files in this pull request and generated 2 comments.
Show a summary per file
| File | Description |
|---|---|
| provider/cursor/parser_test.go | Adds regression coverage for nested synced/ CSV discovery when scanning an explicit directory. |
| docs/plans/2026-03-16-cursor-dashboard-sync-implementation.md | Adds an implementation plan documenting the explicit auth/sync architecture and validation steps. |
| cursor/auth.go | Introduces a service layer for login/status/logout using a local store + remote API client interface. |
| cursor/auth_test.go | Tests login/status/logout service behavior with a stub API client. |
| cursor/client.go | Implements the explicit Cursor dashboard HTTP client for session validation and CSV export. |
| cursor/client_test.go | Adds httptest coverage for validation, CSV fetching, and failure modes. |
| cursor/storage.go | Adds credential + synced CSV storage with atomic write/replace logic and secure permissions. |
| cursor/storage_test.go | Tests restricted permissions and atomic write/replace behavior (including Windows-specific rename handling). |
| cursor/sync.go | Implements the service sync flow: fetch CSV and update local cache. |
| cursor/sync_test.go | Tests successful sync writes and preservation of existing cache on fetch failure. |
| cmd/cursor.go | Adds the codetok cursor command group and subcommands, including stdin/flag token resolution. |
| cmd/cursor_test.go | Tests CLI surface and output behavior for login/status/sync/logout. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Comment on lines
+209
to
+218
| if !renameNeedsDestinationRemoval { | ||
| return err | ||
| } | ||
| if _, statErr := os.Stat(dstPath); statErr != nil { | ||
| return err | ||
| } | ||
| if removeErr := removeFile(dstPath); removeErr != nil && !os.IsNotExist(removeErr) { | ||
| return removeErr | ||
| } | ||
| return renameFile(srcPath, dstPath) |
Comment on lines
+186
to
+193
| if err := tmp.Chmod(perm); err != nil { | ||
| _ = tmp.Close() | ||
| return err | ||
| } | ||
| if _, err := tmp.Write(data); err != nil { | ||
| _ = tmp.Close() | ||
| return err | ||
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
This branch had diverged from
mainafter Cursor auth/sync support landed, leaving the PR in a conflicted state. This update rebases the local Cursor report integration onto the newer command surface without changing the reporting contract.Conflict resolution
main’s newcodetok cursorcommand and supporting auth/sync implementationCursor reporting contract
daily/sessionlocal-file based~/.codetok/cursor/*.csv~/.codetok/cursor/imports/**/*.csv~/.codetok/cursor/synced/**/*.csv--cursor-dirauthoritative for scanning only the provided pathTest merge
provider/cursor/parser_test.gosynced/directory discoveryPost-merge cleanup
main✨ Let Copilot coding agent set things up for you — coding agent works faster and does higher quality work when set up for your repo.