Skip to content

Conversation

@kingston
Copy link
Collaborator

@kingston kingston commented Apr 23, 2025

Summary by CodeRabbit

  • Bug Fixes
    • Fixed the global setup script path to ensure correct placement and referencing within the project structure.
    • Improved synchronization metadata updates when files are kept or deleted, ensuring status accuracy.
    • Enhanced handling of .conflict files by the conflict watcher for more reliable conflict detection and resolution.

@changeset-bot
Copy link

changeset-bot bot commented Apr 23, 2025

🦋 Changeset detected

Latest commit: 399c563

The changes in this PR will be included in the next version bump.

This PR includes changesets to release 8 packages
Name Type
@halfdomelabs/core-generators Patch
@halfdomelabs/project-builder-server Patch
@halfdomelabs/fastify-generators Patch
@halfdomelabs/react-generators Patch
@halfdomelabs/baseplate-plugin-storage Patch
@halfdomelabs/project-builder-cli Patch
@halfdomelabs/project-builder-common Patch
@halfdomelabs/project-builder-test Patch

Not sure what this means? Click here to learn what changesets are.

Click here if you're a maintainer who wants to add another changeset to this PR

@coderabbitai
Copy link

coderabbitai bot commented Apr 23, 2025

Walkthrough

The changes introduce three new changeset files documenting patch updates for the @halfdomelabs/core-generators and @halfdomelabs/project-builder-server packages. In the codebase, the global setup script path in the Vitest generator is updated to be relative to the src directory. The conflict file monitoring logic is improved to skip files ending with .conflict, and the builder service now recalculates and updates the package synchronization status when a conflict file is removed. No public API signatures are altered.

Changes

File(s) Change Summary
.changeset/all-shirts-move.md
.changeset/breezy-crabs-lie.md
.changeset/honest-mirrors-fix.md
Added changeset files documenting patch updates for @halfdomelabs/core-generators and @halfdomelabs/project-builder-server.
packages/core-generators/src/generators/node/vitest/vitest.generator.ts Updated the global setup script path to be relative to src, and changed the template rendering destination accordingly.
packages/project-builder-server/src/service/builder-service.ts Modified removeConflictFile to recalculate and update the package sync status after removing a conflict file.
packages/project-builder-server/src/sync/conflict-file-monitor.ts Updated checkFileForConflicts to immediately return false for files ending with .conflict.

Sequence Diagram(s)

sequenceDiagram
    participant User
    participant ProjectBuilderService
    participant ConflictFileMonitor

    User->>ProjectBuilderService: removeConflictFile(conflictFile)
    ProjectBuilderService->>ProjectBuilderService: Remove conflictFile from filesWithConflicts
    ProjectBuilderService->>ProjectBuilderService: Recalculate sync status
    ProjectBuilderService-->>User: Return updated package info with new status
Loading
sequenceDiagram
    participant FileSystem
    participant ConflictFileMonitor

    FileSystem->>ConflictFileMonitor: checkFileForConflicts(filePath)
    alt filePath ends with ".conflict"
        ConflictFileMonitor-->>FileSystem: return false
    else filePath does not end with ".conflict"
        ConflictFileMonitor->>FileSystem: read file contents
        ConflictFileMonitor->>ConflictFileMonitor: check for conflict markers
        ConflictFileMonitor-->>FileSystem: return result
    end
Loading
sequenceDiagram
    participant VitestGenerator
    participant FileSystem

    VitestGenerator->>FileSystem: Render global setup template to src/tests/scripts/global-setup.ts
    FileSystem-->>VitestGenerator: File written at new relative path
Loading

📜 Recent review details

Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Lite

📥 Commits

Reviewing files that changed from the base of the PR and between 6be368f and 399c563.

📒 Files selected for processing (6)
  • .changeset/all-shirts-move.md (1 hunks)
  • .changeset/breezy-crabs-lie.md (1 hunks)
  • .changeset/honest-mirrors-fix.md (1 hunks)
  • packages/core-generators/src/generators/node/vitest/vitest.generator.ts (2 hunks)
  • packages/project-builder-server/src/service/builder-service.ts (2 hunks)
  • packages/project-builder-server/src/sync/conflict-file-monitor.ts (1 hunks)
🧰 Additional context used
🧬 Code Graph Analysis (1)
packages/project-builder-server/src/service/builder-service.ts (1)
packages/project-builder-server/src/sync/utils.ts (1)
  • getPackageSyncStatusFromResult (8-30)
🔇 Additional comments (8)
.changeset/all-shirts-move.md (1)

1-6: Changeset documentation looks correct.

This changeset correctly documents the patch update to fix the global setup script path, making it relative to the src directory. The description matches the code changes made in the Vitest generator.

packages/core-generators/src/generators/node/vitest/vitest.generator.ts (2)

77-77: LGTM: Path update looks good.

The global setup path is now correctly defined as relative to the src directory, which is consistent with the changeset description.


86-86: Path correction properly implemented.

The destination path now correctly prepends src/ to the relative path, ensuring the file is generated in the correct location while maintaining proper references in the config.

packages/project-builder-server/src/sync/conflict-file-monitor.ts (1)

68-70: Optimization to skip conflict marker checks for .conflict files

Good addition! This check allows the function to immediately return false for files ending with .conflict, avoiding unnecessary content processing. This change properly aligns with the patch described in the .changeset/honest-mirrors-fix.md file.

packages/project-builder-server/src/service/builder-service.ts (2)

34-34: Good import addition for package status recalculation

Added the necessary import for the getPackageSyncStatusFromResult function that will be used in the enhanced removeConflictFile method.


456-478: Well-implemented status recalculation for conflict resolution

This refactoring properly updates the package sync status after removing a conflict file. The previous implementation only filtered out the conflict file but didn't update the overall status, leading to potentially stale metadata. Now, the package status is correctly recalculated using getPackageSyncStatusFromResult.

This change aligns with the description in .changeset/breezy-crabs-lie.md about updating sync metadata status when keeping or deleting files.

.changeset/breezy-crabs-lie.md (1)

1-5: Clear and concise changeset description

The changeset properly documents the patch update for updating the sync metadata status when keeping or deleting files. The description accurately reflects the code changes made in builder-service.ts.

.changeset/honest-mirrors-fix.md (1)

1-5: Appropriate changeset for conflict file handling improvement

The changeset accurately documents the fix for handling .conflict files in the conflict watcher component. This matches the code change in conflict-file-monitor.ts that skips content checks for files with the .conflict extension.


🪧 Tips

Chat

There are 3 ways to chat with CodeRabbit:

  • Review comments: Directly reply to a review comment made by CodeRabbit. Example:
    • I pushed a fix in commit <commit_id>, please review it.
    • Generate unit testing code for this file.
    • Open a follow-up GitHub issue for this discussion.
  • Files and specific lines of code (under the "Files changed" tab): Tag @coderabbitai in a new review comment at the desired location with your query. Examples:
    • @coderabbitai generate unit testing code for this file.
    • @coderabbitai modularize this function.
  • PR comments: Tag @coderabbitai in a new PR comment to ask questions about the PR branch. For the best results, please provide a very specific query, as very limited context is provided in this mode. Examples:
    • @coderabbitai gather interesting stats about this repository and render them as a table. Additionally, render a pie chart showing the language distribution in the codebase.
    • @coderabbitai read src/utils.ts and generate unit testing code.
    • @coderabbitai read the files in the src/scheduler package and generate a class diagram using mermaid and a README in the markdown format.
    • @coderabbitai help me debug CodeRabbit configuration file.

Note: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments.

CodeRabbit Commands (Invoked using PR comments)

  • @coderabbitai pause to pause the reviews on a PR.
  • @coderabbitai resume to resume the paused reviews.
  • @coderabbitai review to trigger an incremental review. This is useful when automatic reviews are disabled for the repository.
  • @coderabbitai full review to do a full review from scratch and review all the files again.
  • @coderabbitai summary to regenerate the summary of the PR.
  • @coderabbitai generate sequence diagram to generate a sequence diagram of the changes in this PR.
  • @coderabbitai resolve resolve all the CodeRabbit review comments.
  • @coderabbitai configuration to show the current CodeRabbit configuration for the repository.
  • @coderabbitai help to get help.

Other keywords and placeholders

  • Add @coderabbitai ignore anywhere in the PR description to prevent this PR from being reviewed.
  • Add @coderabbitai summary to generate the high-level summary at a specific location in the PR description.
  • Add @coderabbitai anywhere in the PR title to generate the title automatically.

CodeRabbit Configuration File (.coderabbit.yaml)

  • You can programmatically configure CodeRabbit by adding a .coderabbit.yaml file to the root of your repository.
  • Please see the configuration documentation for more information.
  • If your editor has YAML language server enabled, you can add the path at the top of this file to enable auto-completion and validation: # yaml-language-server: $schema=https://coderabbit.ai/integrations/schema.v2.json

Documentation and Community

  • Visit our Documentation for detailed information on how to use CodeRabbit.
  • Join our Discord Community to get help, request features, and share feedback.
  • Follow us on X/Twitter for updates and announcements.

@kingston kingston merged commit 145a80c into main Apr 23, 2025
8 checks passed
@kingston kingston deleted the kingston/bug-fixes branch April 23, 2025 19:05
@github-actions github-actions bot mentioned this pull request Apr 23, 2025
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.

2 participants