Skip to content

Conversation

aaronsteers
Copy link
Collaborator

@aaronsteers aaronsteers commented Apr 22, 2025

Summary by CodeRabbit

  • New Features

    • Added a --with-generate option to the build command, allowing users to trigger AI-based generation of transform mappings as part of the build process.
    • Introduced a new clear command to remove generated build artifacts and related directories.
  • Bug Fixes

    • Improved error messages when a source table mapping cannot be found, providing clearer feedback to users.
  • Refactor

    • Unified AI mapping generation logic for easier maintenance and consistent behavior across commands.
    • Centralized resource path construction with a new helper function for better consistency.
  • Configuration

    • Updated project identifier in Hubspot transform configuration from "hubspot.fivetran-interop" to "hubspot.airbyte-interop".

Copy link

coderabbitai bot commented Apr 22, 2025

Walkthrough

The changes introduce improved error handling in the mapping logic by explicitly raising a descriptive error when a source table mapping is missing. Additionally, the CLI's build command now supports an optional --with-generate flag that triggers AI-based generation of transform mappings after the build process. The AI generation logic, previously contained within the generate command, is refactored into a new internal helper function, allowing code reuse between the build and generate commands. A new clear CLI command was added to delete generated artifacts for a given source and project. The GitHub Actions workflow was updated to run the build command with generation instead of the standalone generate command. A helper function was added to centralize path construction for source home directories. The HubSpot transform project identifier was updated in its config file.

Changes

File(s) Change Summary
src/morph/ai/map.py Enhanced error handling in populate_missing_mappings by catching missing source table mappings and raising a ValueError with message.
src/morph/cli/main.py Added --with-generate flag to build command; refactored AI generation logic into a new _generate helper function; added clear command to delete generated artifacts.
.github/workflows/generate-command.yml Changed workflow to run morph build --with-generate instead of morph generate with regeneration flags.
src/morph/resources.py Added get_source_home_dir helper function; refactored other path functions to use it for consistent source home directory resolution.
src/transforms/hubspot/config.yml Updated project identifier from "hubspot.fivetran-interop" to "hubspot.airbyte-interop".

Sequence Diagram(s)

sequenceDiagram
    participant User
    participant CLI
    participant BuildProcess
    participant AIGenerator

    User->>CLI: morph build [--with-generate]
    CLI->>BuildProcess: Run build steps
    BuildProcess-->>CLI: Build complete
    alt with-generate flag is set
        CLI->>AIGenerator: Run AI mapping generation
        AIGenerator-->>CLI: Generation complete
    end
    CLI-->>User: Done
Loading
sequenceDiagram
    participant User
    participant CLI
    participant AIGenerator

    User->>CLI: morph generate
    CLI->>AIGenerator: Run AI mapping generation
    AIGenerator-->>CLI: Generation complete
    CLI-->>User: Done
Loading

Poem

🐰
A hop and a skip, the CLI's grown wise,
With --with-generate, AI mapping flies!
Errors now clearer, no more silent fall,
Refactored and tidy, one function for all.
Clean commands to clear, and paths aligned,
HubSpot’s new name, in configs defined.
As rabbits we cheer, with code so refined—
Each build and each mapping, perfectly aligned!


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

@aaronsteers aaronsteers changed the title feat: one-step generate feat: one-step generate, add clear cli command Apr 22, 2025
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: 0

🧹 Nitpick comments (4)
.github/workflows/generate-command.yml (4)

112-112: Verify and refine the new build invocation
The workflow now invokes uv run morph build ... --with-generate instead of the previous morph generate command. Please confirm that:

  1. The build command internally handles the regeneration and confirmation flags (formerly --regenerate-all --auto-confirm).
  2. You no longer need the explicit flags, or if you do, add them back.
  3. Since source_name is marked required: true, the fallback || 'klaviyo' is redundant—consider removing it for clarity.

48-49: Update the comment to reflect the new command
The comment still reads “using morph generate command,” but the step now runs morph build --with-generate. Update this text to keep documentation in sync.


105-105: Rename the step for clarity
The step is named “Run generate command,” but it now performs a build + generate operation. Rename it to something like “Run build command with generation” to accurately describe the action.


111-111: Align the inline comment with the actual command
The inline comment above the command still says “# Run morph generate…”. Please update this to reflect that the workflow runs morph build … --with-generate.

📜 Review details

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

📥 Commits

Reviewing files that changed from the base of the PR and between 97ad919 and 3dc44b9.

📒 Files selected for processing (5)
  • .github/workflows/generate-command.yml (1 hunks)
  • src/morph/ai/map.py (2 hunks)
  • src/morph/cli/main.py (6 hunks)
  • src/morph/resources.py (3 hunks)
  • src/transforms/hubspot/config.yml (1 hunks)
✅ Files skipped from review due to trivial changes (2)
  • src/transforms/hubspot/config.yml
  • src/morph/resources.py
🚧 Files skipped from review as they are similar to previous changes (2)
  • src/morph/ai/map.py
  • src/morph/cli/main.py

@aaronsteers aaronsteers enabled auto-merge (squash) April 22, 2025 16:54
@aaronsteers aaronsteers merged commit 7c4671e into main Apr 22, 2025
9 checks passed
@aaronsteers aaronsteers deleted the aj/feat--one-step-generate branch April 22, 2025 16:54
@coderabbitai coderabbitai bot mentioned this pull request Apr 22, 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.

1 participant