Skip to content

Resolve Cursor merge conflict with main and preserve local-report integration#19

Closed
Miss-you with Copilot wants to merge 3 commits into
sgsnowfly1993/you-11-实现-cursor-报表集成与目录覆盖语义from
copilot/sub-pr-18
Closed

Resolve Cursor merge conflict with main and preserve local-report integration#19
Miss-you with Copilot wants to merge 3 commits into
sgsnowfly1993/you-11-实现-cursor-报表集成与目录覆盖语义from
copilot/sub-pr-18

Conversation

Copilot AI commented Mar 16, 2026

Copy link
Copy Markdown

This branch had diverged from main after 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

    • merges this PR’s local Cursor report discovery changes with main’s new codetok cursor command and supporting auth/sync implementation
    • preserves the separation between explicit Cursor API actions and local-only reporting paths
  • Cursor reporting contract

    • keeps daily / session local-file based
    • retains default Cursor discovery across:
      • ~/.codetok/cursor/*.csv
      • ~/.codetok/cursor/imports/**/*.csv
      • ~/.codetok/cursor/synced/**/*.csv
    • keeps --cursor-dir authoritative for scanning only the provided path
  • Test merge

    • resolves the only content conflict in provider/cursor/parser_test.go
    • keeps both sides’ coverage:
      • default-root + imports + synced merge behavior
      • nested synced/ directory discovery
  • Post-merge cleanup

    • adds small clarifying comments in Cursor client/storage code that came from main
    • simplifies the file replacement branch in storage without changing behavior
func resolveCursorCSVPaths(baseDir string) ([]string, error) {
	if baseDir != "" {
		return collectCSVPathsRecursive(baseDir)
	}

	root, err := defaultCursorDir()
	if err != nil {
		return nil, err
	}

	return collectDefaultCursorCSVPaths(root)
}

✨ Let Copilot coding agent set things up for you — coding agent works faster and does higher quality work when set up for your repo.

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
Copilot AI requested a review from Miss-you March 16, 2026 09:38
@Miss-you
Miss-you marked this pull request as ready for review March 16, 2026 10:20
Copilot AI review requested due to automatic review settings March 16, 2026 10:20

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

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 cursor subcommands (login/status/sync/logout) wired to a new cursor package 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.csv when 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 thread cursor/storage.go
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 thread cursor/storage.go
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
}
@Miss-you Miss-you closed this Mar 17, 2026
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.

3 participants