Skip to content

feat(connectors): implement push logic for syncing connectors#191

Merged
Paveltarno merged 2 commits intopavelta-connectors-1from
pavelta-connectors-push-logic
Feb 8, 2026
Merged

feat(connectors): implement push logic for syncing connectors#191
Paveltarno merged 2 commits intopavelta-connectors-1from
pavelta-connectors-push-logic

Conversation

@Paveltarno
Copy link
Contributor

@Paveltarno Paveltarno commented Feb 4, 2026

Note

Description

This PR implements the push synchronization logic for OAuth connectors in the Base44 CLI, enabling the base44 connectors push command. The implementation handles creating/updating connectors, removing upstream-only connectors, and managing OAuth authorization flows with browser redirect and polling. It includes comprehensive error handling for conflict scenarios like different-user connections.

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

Core Logic:

  • Added push.ts module with pushConnectors() function that syncs local connector configs to the API
  • Implemented sync logic that compares local connectors with upstream and performs create/update/delete operations
  • Added oauth.ts module with runOAuthFlow() function for handling browser-based OAuth authorization with polling
  • Created ConnectorSyncResult interface to track sync outcomes (synced, removed, needs_oauth, error)

API Updates:

  • Renamed syncConnector() to setConnector() and updated endpoint from POST to PUT
  • Updated response schema from SyncConnectorResponse to SetConnectorResponse
  • Enhanced error handling for different_user conflicts
  • Added OAuth status polling via getOAuthStatus()

CLI Command:

  • Created new connectors push command under src/cli/commands/connectors/
  • Interactive OAuth flow with user confirmation prompt (skips in CI environments)
  • Comprehensive summary display showing synced, added, removed, and failed connectors
  • Graceful error handling for individual connector operations

Project Integration:

  • Updated ProjectData interface to include connectors: ConnectorResource[]
  • Added connectorsDir field to project config schema (defaults to "connectors")
  • Integrated connector reading into readProjectConfig() function
  • Removed filename validation logic (no longer requires filename to match type)

Testing:

  • Added comprehensive CLI tests (connectors_push.spec.ts) covering success cases, errors, OAuth flows, and conflict detection
  • Added core unit tests (connectors.spec.ts) for pushConnectors() and runOAuthFlow() functions
  • Added API mock methods in testkit for connector endpoints (list, set, remove, OAuth status)
  • Removed obsolete connector-type-mismatch fixture

Testing

  • I have tested these changes locally
  • I have added/updated tests as needed
  • All tests pass (npm 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 implementation follows the Resource pattern established for entities, functions, and agents. The push logic handles three main scenarios: syncing local connectors to the API, removing upstream connectors not present locally, and managing OAuth authorization flows when needed. Error handling ensures graceful degradation when individual operations fail.

Key implementation details:

  • OAuth flow automatically opens browser and polls for authorization completion
  • In CI environments (detected via process.env.CI), OAuth prompt is skipped
  • Removed the strict filename-to-type validation that was previously enforced
  • Changed API endpoint from POST /external-auth/sync to PUT /external-auth/integrations/{type}

🤖 Generated by Claude | 2026-02-08 06:21 UTC

@github-actions
Copy link
Contributor

github-actions bot commented Feb 4, 2026

🚀 Package Preview Available!


Install this PR's preview build with npm:

npm i @base44-preview/cli@0.0.28-pr.191.545b03a

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.28-pr.191.545b03a"

Or add it to your package.json dependencies:

{
  "dependencies": {
    "base44": "npm:@base44-preview/cli@0.0.28-pr.191.545b03a"
  }
}

Preview published to npm registry — try new features instantly!

@claude
Copy link

claude bot commented Feb 4, 2026

Code review

No issues found. Checked for bugs and CLAUDE.md compliance.

@kfirstri kfirstri moved this from Backlog to In progress in CLI Development Feb 5, 2026
Base automatically changed from pavelta-connectors-api-client to pavelta-connectors-1 February 8, 2026 15:33
@Paveltarno
Copy link
Contributor Author

@claude rebase with pavelta-connectors-1 branch

@claude
Copy link

claude bot commented Feb 8, 2026

Claude finished @Paveltarno's task in 23s —— View job


Task: Rebase with pavelta-connectors-1 branch

  • Analyze request
  • Execute git operations

Analysis

I understand you want to rebase the pavelta-connectors-push-logic branch with pavelta-connectors-1. However, I need to clarify a limitation:

I cannot perform interactive rebase operations due to the complexity and potential need for conflict resolution that requires human decision-making.

Alternative Approaches

I can offer two alternatives:

  1. Merge approach: I can merge the latest changes from pavelta-connectors-1 into this branch

    • Command: git merge origin/pavelta-connectors-1
    • Creates a merge commit
    • Safer and automated
  2. Manual rebase instructions: I can provide you with the exact commands to rebase manually

    git fetch origin
    git rebase origin/pavelta-connectors-1
    # Resolve any conflicts if they occur
    git push --force-with-lease origin pavelta-connectors-push-logic

Would you like me to:

  • A) Proceed with merging pavelta-connectors-1 into this branch (automated)
  • B) Provide detailed manual rebase instructions

Please let me know which approach you prefer, or if you'd like me to attempt something else.


@Paveltarno
Copy link
Contributor Author

@claude rebase against branch pavelta-connectors-1

@claude
Copy link

claude bot commented Feb 8, 2026

Claude finished @Paveltarno's task in 37s —— View job


Task: Rebase against branch pavelta-connectors-1

  • Analyze request and check capabilities
  • Execute rebase operation

Analysis

I understand you want to rebase pavelta-connectors-push-logic against pavelta-connectors-1. However, I've encountered a limitation:

I cannot perform interactive git operations like rebase. According to my capabilities, I can only create and push commits, but cannot perform branch operations such as rebase or merge.

Additionally, I noticed that the pavelta-connectors-1 branch is not currently available in my local checkout. I would need to fetch it first, but even if I could fetch it, I cannot execute the rebase operation.

How to Rebase Manually

Here are the exact commands you can run to perform this rebase:

# Ensure you're on the correct branch
git checkout pavelta-connectors-push-logic

# Fetch the latest changes from the base branch
git fetch origin pavelta-connectors-1

# Rebase your branch onto pavelta-connectors-1
git rebase origin/pavelta-connectors-1

# If there are conflicts, resolve them, then:
# git add <resolved-files>
# git rebase --continue

# Once rebase is complete, force push (with lease for safety)
git push --force-with-lease origin pavelta-connectors-push-logic

Alternative: Merge Instead

If you'd prefer to avoid rebasing, I could perform a merge operation by creating a merge commit. This would:

  • Preserve the exact history of both branches
  • Not require force pushing
  • Be a simpler operation that I can perform

Would you like me to merge pavelta-connectors-1 into this branch instead?


Paveltarno and others added 2 commits February 8, 2026 17:49
Add pushConnectors function that:
- Syncs all local connectors via /sync endpoint
- Removes upstream-only connectors not in local config
- Returns typed results (synced, removed, needs_oauth, error)

Includes unit tests covering all scenarios.

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
…olling (#192)

* feat(connectors): add OAuth flow handling with browser redirect and polling

Add runOAuthFlow function that:
- Opens OAuth redirect URL in browser
- Polls getOAuthStatus until ACTIVE or FAILED
- Returns PENDING on timeout (5 minutes)

Uses p-wait-for TimeoutError for robust timeout detection.

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>

* connectors: base44 connectors push (#194)

* final connector work sofi 1

* scopes

---------

Co-authored-by: Claude Opus 4.5 <noreply@anthropic.com>
@Paveltarno Paveltarno force-pushed the pavelta-connectors-push-logic branch from 28ddeee to 067f194 Compare February 8, 2026 15:49
@Paveltarno Paveltarno merged commit c3543de into pavelta-connectors-1 Feb 8, 2026
3 checks passed
@Paveltarno Paveltarno deleted the pavelta-connectors-push-logic branch February 8, 2026 15:51
@github-project-automation github-project-automation bot moved this from In progress to Done in CLI Development Feb 8, 2026
Paveltarno added a commit that referenced this pull request Feb 8, 2026
* feat(connectors): implement push logic for syncing connectors

Add pushConnectors function that:
- Syncs all local connectors via /sync endpoint
- Removes upstream-only connectors not in local config
- Returns typed results (synced, removed, needs_oauth, error)

Includes unit tests covering all scenarios.

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>

* feat(connectors): add OAuth flow handling with browser redirect and polling (#192)

* feat(connectors): add OAuth flow handling with browser redirect and polling

Add runOAuthFlow function that:
- Opens OAuth redirect URL in browser
- Polls getOAuthStatus until ACTIVE or FAILED
- Returns PENDING on timeout (5 minutes)

Uses p-wait-for TimeoutError for robust timeout detection.

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>

* connectors: base44 connectors push (#194)

* final connector work sofi 1

* scopes

---------

Co-authored-by: Claude Opus 4.5 <noreply@anthropic.com>

---------

Co-authored-by: Claude Opus 4.5 <noreply@anthropic.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

Status: Done

Development

Successfully merging this pull request may close these issues.

1 participant