feat: integrations CLI + workflows step-delete#11
Open
chrisaddams wants to merge 1 commit into
Open
Conversation
Integrations ------------ - integrations list / get <provider>: catalog browsing - integrations connections list [--provider]: list active connections - integrations connect <provider>: API-key connection (Claude, OpenAI, etc.). Prompts for the key (hidden) by default, accepts --api-key, supports --user-connection for user-scoped connections. - integrations oauth status <provider>: shows OAuth client setup state - integrations oauth configure <provider>: stores OAuth client_id + secret for a tenant. --use-social-sign-in flags it for social login. - integrations oauth callback-url: prints the dashboard callback URL users need to add to their OAuth app's redirect URLs (the URL is also surfaced by oauth status / shown after a successful configure). - integrations oauth connect <provider>: full browser OAuth dance — binds a local listener on http://localhost:8745/callback, opens the browser, captures the code, exchanges for a connection. - integrations test <id> / enable <id> / disable <id> / disconnect <id>: connection lifecycle. - integrations execute <provider> <operation>: runs an integration operation (e.g. claude generate-text). Inputs via repeated --input k=v or --inputs '<json>'. Output is the response's content field, or full JSON with --json. Workflows --------- - workflows step-delete <workflow_id> <step_id>: deletes a step. Detects inbound links and warns before the delete. If the API rejects with a 500 (FK constraint when other steps still reference the target), translates the error into a clear message listing the offending steps and the step-link commands needed to fix them. Tests ----- - tests/IntegrationsTests.cs: 17 tests covering all integration client methods, snake_case wire format on POST/PUT bodies (the bug we hit during development), and IntegrationsCallbackUrl / DashboardUrl derivation. - tests/AnythinkClientExtendedTests.cs: DeleteWorkflowStepAsync happy path plus 500 propagation for the FK-violation case. - All 211 tests pass. Verified end-to-end against staging: - Slack OAuth dance: configure -> connect -> connection created with bot token - Slack send-message via integrations execute (response received in channel) - step-delete: deleted 3 orphans on workflow 36 (workout_completed_points) using the new command. Verified the FK-violation error translation by attempting to delete a step with inbound links.
3b62647 to
b408c6d
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Adds first-class integration management to the CLI plus a
workflows step-deletecommand for cleaning up orphaned workflow steps.Integrations
Auth flows
--api-key. Connection is created viaPOST /integrations/connections/api-key.oauth configurestores tenant client credentials.oauth callback-urlprints the dashboard's/settings/integrations/callbackURL that users need to add to the OAuth app's redirect-URL allow list.oauth connectruns the full browser flow: binds a listener onlocalhost:8745, opens the browser, captures the code, posts toPOST /integrations/connections. State validation prevents CSRF.executeRuns an operation on a connected provider:
Outputs the response's
contentfield by default;--jsonreturns the full response.workflows step-deleteDetects inbound links before the delete. If the API rejects with a 500 (FK violation when another step's
on_success_step_id/on_failure_step_idstill references the target), the CLI translates the error into something actionable:Tests (19 new, 211 total — all passing)
tests/IntegrationsTests.cs— every integration client method, snake_case wire-format checks on POST/PUT bodies (we hit camelCase-vs-snake_case mismatches during dev), andIntegrationsCallbackUrl/DashboardUrlderivation.tests/AnythinkClientExtendedTests.cs—DeleteWorkflowStepAsynchappy path + 500 propagation.Verified end-to-end against a live tenant
integrations oauth callback-url.oauth connect slackagainst the live API: localhost listener captured the code, POST to/integrations/connectionscreated the connection, bot token stored.Integrationworkflow action wired into a real workflow.workflows step-deleteto clean up 3 orphaned steps (get_user_badges_for_user,compute_new_badges,award_badges) on theworkout_completed_pointsworkflow. Verified the improved error translation by deliberately deleting a referenced step.Notes / follow-ups (separate PRs)
workflows triggerCLI has a payload-wrapping bug (wraps user JSON as{ data: parsed }instead of building the properTriggerWorkflowRequest). Not fixed in this PR — out of scope.Event-typed workflows can't be triggered via the platform's manual trigger endpoint (server-side rejection). Worth lifting that constraint for testing, but server-side change.feat/api-keysbranch (feat: api-keys list/create/revoke commands #10), not duplicated here.