Skip to content

Conversation

@kingston
Copy link
Collaborator

@kingston kingston commented Jul 16, 2025

Summary by CodeRabbit

  • New Features

    • Added support for a .baseplateignore file to exclude files and directories from diff and sync operations using gitignore-style patterns.
    • Introduced a --no-ignore-file flag for the diff command to disable ignore pattern filtering.
    • Added a --force-overwrite flag for the sync command to enable direct overwriting of files while respecting ignore patterns.
    • Replaced the previous build command with a new sync command for project synchronization.
  • Improvements

    • Diff operations now load ignore patterns from each app directory for finer control.
    • Sync operations skip overwriting files matching ignore patterns when forced overwrite is enabled.
    • File preparation logic updated to bypass merging when force overwrite is active, except for ignored files.
  • Bug Fixes

    • Graceful fallback to default ignore patterns when .baseplateignore is missing or unreadable.
  • Tests

    • Added and enhanced tests covering ignore pattern handling and force overwrite behavior.
  • Chores

    • Updated dependencies to include the ignore package.

@vercel
Copy link

vercel bot commented Jul 16, 2025

The latest updates on your projects. Learn more about Vercel for Git ↗︎

Name Status Preview Comments Updated (UTC)
baseplate-project-builder-web ✅ Ready (Inspect) Visit Preview 💬 Add feedback Jul 16, 2025 8:03pm

@changeset-bot
Copy link

changeset-bot bot commented Jul 16, 2025

🦋 Changeset detected

Latest commit: 2d7e723

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

This PR includes changesets to release 17 packages
Name Type
@baseplate-dev/project-builder-server Patch
@baseplate-dev/project-builder-cli Patch
@baseplate-dev/sync Patch
@baseplate-dev/project-builder-common Patch
@baseplate-dev/project-builder-test Patch
@baseplate-dev/project-builder-web Patch
@baseplate-dev/core-generators Patch
@baseplate-dev/fastify-generators Patch
@baseplate-dev/project-builder-lib Patch
@baseplate-dev/react-generators Patch
@baseplate-dev/plugin-auth Patch
@baseplate-dev/plugin-storage Patch
@baseplate-dev/code-morph Patch
@baseplate-dev/create-project Patch
@baseplate-dev/tools Patch
@baseplate-dev/ui-components Patch
@baseplate-dev/utils 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 Jul 16, 2025

Walkthrough

This change introduces support for .baseplateignore files, enabling users to specify ignore patterns for both diff and sync operations. It also adds a --force-overwrite flag to the sync command, allowing files to be overwritten unless excluded by ignore patterns. The build command is replaced by sync, and relevant logic, tests, and utilities are updated accordingly.

Changes

Files/Groups Change Summary
.changeset/add-baseplateignore-support.md, .changeset/force-overwrite-mode.md Documents the addition of .baseplateignore support and the --force-overwrite sync mode.
packages/project-builder-cli/src/commands/build.ts, .../index.ts Removes the build command and its registration from the CLI entry point.
packages/project-builder-cli/src/commands/diff.ts Adds --no-ignore-file option to diff command, allowing users to disable ignore file filtering.
packages/project-builder-cli/src/commands/sync.ts Adds a new sync command with --force-overwrite option to the CLI.
packages/project-builder-server/package.json, packages/sync/package.json Adds the ignore package as a dependency.
packages/project-builder-server/src/diff/diff-project.ts, .../diff-utils.ts, .../types.ts Adds support for loading and applying .baseplateignore patterns during diff operations; updates interfaces/types.
packages/project-builder-server/src/service/builder-service.ts Switches from buildProject to syncProject in service logic.
packages/project-builder-server/src/sync/generate-for-directory.ts, .../sync-project.ts, .../index.ts Renames build terminology to sync, adds forceOverwrite support, updates interfaces and main sync logic.
packages/project-builder-test/src/runner/generate.ts Updates test runner to use syncProject instead of buildProject.
packages/sync/src/output/prepare-generator-files/prepare-generator-file.ts, .../files.ts, .../types.ts Adds forceOverwrite and overwriteIgnorePatterns support to file preparation logic and types.
packages/sync/src/output/write-generator-output.ts Updates to pass forceOverwrite and ignore patterns to file preparation logic.
packages/sync/src/utils/ignore-patterns.ts, .../index.ts, .../ignore-patterns.unit.test.ts Introduces utility for loading and applying ignore patterns, with accompanying unit tests and index export.
packages/sync/src/output/prepare-generator-files/prepare-generator-file.unit.test.ts, .../files.unit.test.ts Adds and updates tests for force overwrite and ignore pattern handling in file preparation logic.

Sequence Diagram(s)

sequenceDiagram
    participant User
    participant CLI
    participant Server
    participant FS as Filesystem

    User->>CLI: baseplate sync --force-overwrite
    CLI->>Server: syncProject({forceOverwrite: true})
    Server->>FS: Load .baseplateignore (if present)
    Server->>FS: For each file:
    alt File matches ignore patterns
        Server->>FS: Skip overwriting
    else File not ignored
        Server->>FS: Overwrite file without merge
    end
    Server-->>CLI: Sync result
    CLI-->>User: Output sync status
Loading
sequenceDiagram
    participant User
    participant CLI
    participant Server
    participant FS as Filesystem

    User->>CLI: baseplate diff [--no-ignore-file]
    CLI->>Server: diffProject({useIgnoreFile: !--no-ignore-file})
    alt useIgnoreFile == true
        Server->>FS: Load .baseplateignore per app directory
        Server->>FS: Filter files using ignore patterns
    else
        Server->>FS: Diff all files
    end
    Server-->>CLI: Diff summary
    CLI-->>User: Output diff result
Loading

Possibly related PRs

  • halfdomelabs/baseplate#600: Introduced the original diff command and core diffing logic, which is directly extended here with .baseplateignore support and ignore pattern filtering.

📜 Recent review details

Configuration used: .coderabbit.yaml
Review profile: CHILL
Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between ffdc947 and 2d7e723.

📒 Files selected for processing (4)
  • .changeset/add-baseplateignore-support.md (1 hunks)
  • packages/project-builder-server/src/diff/diff-project.ts (6 hunks)
  • packages/project-builder-server/src/diff/diff-utils.ts (3 hunks)
  • packages/sync/src/utils/ignore-patterns.unit.test.ts (1 hunks)
🚧 Files skipped from review as they are similar to previous changes (4)
  • packages/project-builder-server/src/diff/diff-project.ts
  • packages/project-builder-server/src/diff/diff-utils.ts
  • .changeset/add-baseplateignore-support.md
  • packages/sync/src/utils/ignore-patterns.unit.test.ts
✨ Finishing Touches
  • 📝 Generate Docstrings

🪧 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.
    • Explain this complex logic.
    • 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 explain this code block.
    • @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 explain its main purpose.
    • @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.

Support

Need help? Create a ticket on our support page for assistance with any issues or questions.

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 docstrings to generate docstrings for this 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.

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.

@socket-security
Copy link

socket-security bot commented Jul 16, 2025

Review the following changes in direct dependencies. Learn more about Socket for GitHub.

Diff Package Supply Chain
Security
Vulnerability Quality Maintenance License
Addedignore@​7.0.510010010085100

View full report

Copy link

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

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

Actionable comments posted: 2

🧹 Nitpick comments (2)
.changeset/add-baseplateignore-support.md (1)

13-13: Fix escape character in pattern example.

The backslash before the asterisk should be removed as it's not needed in changeset documentation.

-- Includes sensible default patterns (.env, \*.log, node_modules/, dist/, build/, .DS_Store, Thumbs.db)
+- Includes sensible default patterns (.env, *.log, node_modules/, dist/, build/, .DS_Store, Thumbs.db)
packages/sync/src/utils/ignore-patterns.unit.test.ts (1)

8-16: Redundant vol.reset() calls in beforeEach and afterEach.

Both hooks call vol.reset(), which is redundant since afterEach cleanup would be sufficient.

  beforeEach(() => {
-    vol.reset();
  });

@kingston kingston merged commit e0d690c into main Jul 16, 2025
10 checks passed
@kingston kingston deleted the kingston/eng-807-add-baseplateignore-support-to-diff-command branch July 16, 2025 20:15
@github-actions github-actions bot mentioned this pull request Jul 16, 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