Skip to content

feat(connectors): add pull command#214

Open
Paveltarno wants to merge 4 commits intomainfrom
task-1-connectors-pull
Open

feat(connectors): add pull command#214
Paveltarno wants to merge 4 commits intomainfrom
task-1-connectors-pull

Conversation

@Paveltarno
Copy link
Collaborator

@Paveltarno Paveltarno commented Feb 9, 2026

Note

Description

Adds a new connectors pull command that syncs connector configurations from the Base44 server to local files. This command fetches remote connectors via the API and intelligently writes/updates/deletes local connector files to match the server state, preserving custom file names and comments where possible.

Related Issue

None

Type of Change

  • Bug fix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to not work as expected)
  • Documentation update
  • Refactoring (no functional changes)
  • Other (please describe):

Changes Made

  • Added connectors pull CLI command that fetches connectors from Base44 and syncs to local files
  • Implemented writeConnectors() function in connector/config.ts with intelligent file management:
    • Creates/updates connector files based on remote state
    • Deletes local files for connectors that no longer exist remotely
    • Preserves existing file names (e.g., my-slack.jsonc) when updating connectors by type
    • Skips writing when data is unchanged to preserve comments and formatting using deep equality comparison
  • Refactored readAllConnectors() to track file paths alongside connector data for intelligent updates
  • Added fetchConnectors() API wrapper function as alias for listConnectors()
  • Added comprehensive unit tests (8 new test cases) covering edge cases: duplicate types, file preservation, empty lists, custom filenames
  • Added CLI integration tests (4 test cases) for the pull command

Testing

  • I have tested these changes locally
  • I have added/updated tests as needed
  • All tests pass (bun test)

Checklist

  • My code follows the project's style guidelines
  • I have performed a self-review of my own code
  • I have commented my code, particularly in hard-to-understand areas
  • I have made corresponding changes to the documentation (if applicable)
  • My changes generate no new warnings
  • I have updated AGENTS.md if I made architectural changes

Additional Notes

The writeConnectors() function uses isDeepStrictEqual() from Node's util module to detect actual data changes, ensuring local files are only rewritten when the connector configuration differs. This preserves user comments and custom formatting in connector config files. The function performs type-based file matching rather than filename-based matching, allowing users to name their connector files however they prefer (e.g., my-slack-integration.jsonc instead of slack.jsonc).

Command usage:

base44 connectors pull

🤖 Generated by Claude | 2026-02-12 14:29 UTC

@github-actions
Copy link
Contributor

github-actions bot commented Feb 9, 2026

🚀 Package Preview Available!


Install this PR's preview build with npm:

npm i @base44-preview/cli@0.0.31-pr.214.d023fbb

Prefer not to change any import paths? Install using npm alias so your code still imports base44:

npm i "base44@npm:@base44-preview/cli@0.0.31-pr.214.d023fbb"

Or add it to your package.json dependencies:

{
  "dependencies": {
    "base44": "npm:@base44-preview/cli@0.0.31-pr.214.d023fbb"
  }
}

Preview published to npm registry — try new features instantly!

@dor-chaouat dor-chaouat moved this from Backlog to In progress in CLI Development Feb 9, 2026
@Paveltarno Paveltarno force-pushed the task-1-connectors-pull branch from f4d2ac1 to 02d5fd7 Compare February 11, 2026 08:34
@base44 base44 deleted a comment from claude bot Feb 11, 2026
@Paveltarno Paveltarno force-pushed the pavelta-connectors-1 branch 2 times, most recently from 3fc2e0c to ec69f63 Compare February 12, 2026 12:04
Base automatically changed from pavelta-connectors-1 to main February 12, 2026 13:27
@Paveltarno Paveltarno force-pushed the task-1-connectors-pull branch from df772e3 to ffe1f67 Compare February 12, 2026 14:09
@claude
Copy link

claude bot commented Feb 12, 2026

README check ran. 10 issue(s) found and applied: Added missing connectors push and connectors pull commands; Updated eject command (uncommented and corrected description); Fixed descriptions for create, deploy, link, logout, whoami, agents pull, agents push, and entities push to match source code. README.md has been updated in this branch.

Comment on lines +89 to 103
for (const entry of entries) {
if (typeToEntry.has(entry.data.type)) {
throw new InvalidInputError(
`Duplicate connector type "${connector.type}"`,
`Duplicate connector type "${entry.data.type}"`,
{
hints: [
{
message: `Remove duplicate connectors with type "${connector.type}" - only one connector per type is allowed`,
message: `Remove duplicate connectors with type "${entry.data.type}" - only one connector per type is allowed`,
},
],
},
}
);
}
types.add(connector.type);
typeToEntry.set(entry.data.type, entry);
}
Copy link
Collaborator

Choose a reason for hiding this comment

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

This check happens twice, once here and once in readAllconnectors()

@github-project-automation github-project-automation bot moved this from In progress to In review in CLI Development Feb 12, 2026
Paveltarno and others added 4 commits February 12, 2026 18:21
Implements fetchConnectors() API, writeConnectors() for file sync,
and the CLI pull command following the agents pull pattern.

Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
@Paveltarno Paveltarno force-pushed the task-1-connectors-pull branch from ffe1f67 to d0530cc Compare February 12, 2026 16:21
@claude
Copy link

claude bot commented Feb 12, 2026

README check ran. 6 issues found and applied: (1) Added missing eject command, (2) Added missing connectors push command, (3) Added missing connectors pull command, (4) Updated command descriptions to match codebase exactly, (5) Removed vague phrasing for clarity. A commit has been created (39970a7) but automatic push requires approval - please approve or manually push.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

Status: In review

Development

Successfully merging this pull request may close these issues.

2 participants