Skip to content

feat(connectors): add connectors list-available command - #367

Merged
Paveltarno merged 12 commits into
mainfrom
feat/connectors-list-available
Mar 9, 2026
Merged

feat(connectors): add connectors list-available command#367
Paveltarno merged 12 commits into
mainfrom
feat/connectors-list-available

Conversation

@Paveltarno

@Paveltarno Paveltarno commented Mar 5, 2026

Copy link
Copy Markdown
Collaborator

Note

Description

This PR adds a new connectors list-available subcommand that fetches and displays all available integration types from the Base44 API. Each integration is rendered in human-readable YAML format with a reusable formatYaml helper that strips empty/null values by default. The changes align with the existing connectors command pattern and include full test coverage for both the command and the YAML utility.

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 list-available command that calls GET /external-auth/available-integrations and prints each integration as YAML
  • Added listAvailableIntegrations() API function in core/resources/connector/api.ts with Zod validation and snake_case→camelCase transform
  • Added ListAvailableIntegrationsResponseSchema and ConnectionConfigFieldSchema to connector/schema.ts
  • Added formatYaml() helper in packages/cli/src/cli/utils/yaml.ts with configurable empty-value stripping using lodash.isEmpty
  • Registered list-available as a subcommand on the existing connectors command
  • Added yaml package dependency and updated bun.lock
  • Added integration tests for all edge cases (success, empty list, API error, invalid data, missing project)
  • Added unit tests for formatYaml covering null/undefined/empty stripping and nested objects
  • Removed packages/cli/plan.md (working notes, not needed in repo)
  • Added .claude/worktrees/ to .gitignore

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 docs/ (AGENTS.md) if I made architectural changes

Additional Notes

The AvailableIntegrationSchema intentionally uses z.string() instead of IntegrationTypeSchema so the command works with integration types not yet defined in the CLI's enum — this ensures forward compatibility as new integrations are added on the server side.


🤖 Generated by Claude | 2026-03-09 00:00 UTC

@github-actions

github-actions Bot commented Mar 5, 2026

Copy link
Copy Markdown
Contributor

🚀 Package Preview Available!


Install this PR's preview build with npm:

npm i @base44-preview/cli@0.0.41-pr.367.40b1ab1

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.41-pr.367.40b1ab1"

Or add it to your package.json dependencies:

{
  "dependencies": {
    "base44": "npm:@base44-preview/cli@0.0.41-pr.367.40b1ab1"
  }
}

Preview published to npm registry — try new features instantly!

@Paveltarno
Paveltarno force-pushed the feat/connectors-list-available branch from 5ab8c99 to 2d0b584 Compare March 8, 2026 07:29
Comment thread package.json Outdated
"tmp-promise": "^3.0.3",
"typescript": "^5.7.2",
"vitest": "^4.0.16",
"yaml": "^2.8.2",

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

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

added this yaml dep, i think it's worth it:

  1. we should probably just start formatting yaml as part of our regular clack output, it integrates pretty well and we don't need to manually fiddle with formatting our domain entities
  2. we might just add --output yaml with no extra cost

Comment thread packages/cli/src/cli/commands/connectors/list-available.ts Outdated
Comment thread packages/cli/src/cli/commands/connectors/list-available.ts Outdated
Comment thread packages/cli/src/cli/commands/connectors/list-available.ts Outdated
@Paveltarno
Paveltarno force-pushed the feat/connectors-list-available branch from d2f9ad9 to 8059d7d Compare March 9, 2026 12:46
Paveltarno and others added 9 commits March 9, 2026 17:34
Add a new CLI command to discover all available integration types from
the Base44 catalog endpoint (GET /external-auth/available-integrations).

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
- Wrapper key: `available_integrations` → `integrations`
- Remove `notes` and `usage_guide` fields (dropped from backend)
- Extract long template literal for readability

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Print the complete integration data (including connection_config_fields)
as JSON to stdout so LLMs and scripts can consume all fields.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
- Add yaml dep for pretty-printing integration details
- Display each integration as YAML (type, description, config fields)
- Keep connection_config_fields in snake_case (no transform)
- Remove temp fake fields

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Keep consistent with codebase convention — convert snake_case to
camelCase at the Zod boundary for all fields.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
- Use camelCase key `connectionConfigFields` in YAML output
- Strip null/undefined values from config fields before display
- Add comment explaining z.string() choice over IntegrationTypeSchema
- Add test for malformed API response (Zod validation)

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
- Rename loop variable `i` to `integration` (review #2)
- Use typed destructuring instead of Record<string, unknown> (review #3)
- Extract reusable formatYaml() utility with stripEmpty option (review #4)
- Use lodash isEmpty for null/empty stripping in YAML replacer
- Add formatYaml unit tests
- Update test assertions for integrationType key rename

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
@Paveltarno
Paveltarno force-pushed the feat/connectors-list-available branch from c79fcca to 16ea336 Compare March 9, 2026 15:37
Paveltarno and others added 2 commits March 9, 2026 17:41
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
@Paveltarno
Paveltarno force-pushed the feat/connectors-list-available branch from 9af8b32 to 2e5842d Compare March 9, 2026 15:45
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
@github-project-automation github-project-automation Bot moved this from Backlog to In review in CLI Development Mar 9, 2026
@Paveltarno
Paveltarno merged commit 45579ae into main Mar 9, 2026
9 of 10 checks passed
@Paveltarno
Paveltarno deleted the feat/connectors-list-available branch March 9, 2026 15:59
@github-project-automation github-project-automation Bot moved this from In review to Done in CLI Development Mar 9, 2026
for (const { displayName, ...rest } of integrations) {
const yaml = formatYaml(rest);
const pad = " ".repeat(YAML_INDENT);
log.info(`${displayName}\n${pad}${yaml.replace(/\n/g, `\n${pad}`)}`);

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

@Paveltarno why this part is not happening in formatYaml?

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

I'm referring to padding.

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

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

good question, this is because the yamlformatter only formats objects into yaml
but the whole output is indented because we also have the displayName as a header

Screenshot 2026-03-09 at 18 49 55

this is nothing to do with the yaml formatter, more with how the CLI decides to embed that format into it's output

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

I see, thank you for clarification

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.

3 participants