Add flows update + flows publish commands and flow placement audiences - #20
Draft
mlnchk wants to merge 5 commits into
Draft
Add flows update + flows publish commands and flow placement audiences#20mlnchk wants to merge 5 commits into
mlnchk wants to merge 5 commits into
Conversation
New `adapty flows update` renames a flow (PUT .../flows/<id>/, body {name}).
New `adapty flows publish` publishes a flow (POST .../flows/<id>/publish/, no
body); publish is async, so it reports status: publishing, not published.
`PlacementAudienceEntryDTO` becomes a paywall | flow discriminated union.
Paywall entry keeps content_type optional (additive — existing calls stay
valid); flow entry requires content_type: 'flow' and flow_id. placements
create/update surface the flow form in help; a draft flow returns 400 until
published.
…publish Rename src/lib/asa-confirm.ts to src/lib/confirm.ts (git mv, history preserved); the exports were already generic. Repoint all 15 importers to the new path and reorder the affected asa imports alphabetically. flows publish now gates on a confirmation: it fetches the flow to name it, then confirmMutation() previews the POST and requires --yes (refuses when piped or --json). Publishing goes live to end users, so it is high-stakes. Async messaging is unchanged (status stays 'publishing'). Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
mlnchk
force-pushed
the
cli-flow-cruds
branch
from
September 2, 2026 09:14
c8cceac to
67f6c11
Compare
Make content_type required on the paywall audience variant too, so PlacementAudienceEntryDTO now demands an explicit 'paywall' | 'flow' on every entry — no implicit paywall. The type alone cannot guard --audiences (JSON.parse yields unknown), so add a runtime check shared by placements create/update: each entry must be an object with content_type exactly 'paywall' or 'flow', a paywall entry must carry paywall_id and a flow entry flow_id, else exit 2 with a message that names the offending index and tells the caller to add content_type. Same for humans and agents; no prompting. Flag help and examples now always show content_type. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Publishing a flow with no valid config returns a 400 validation_error whose
bare message ("Flow has no current version.") does not tell the caller what
to do. Wrap the publish POST in flows publish: on a 400 / validation_error,
re-raise with the server reason plus the two ways to fix it — the builder UI
for this flow and the Adapty flows agent skill — then exit 1. Other statuses
(403/404/…) rethrow unchanged. Scoped to this command; errors.ts is untouched
because validation_error is generic.
Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
The Developer API now returns is_active on placements. Add it to PlacementSummaryDTO and PlacementDetailDTO (true = Live, false = Inactive). printResponse/printList render every field, so list and get surface it with no per-command change; tests assert "Is Active" appears in both. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
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.
Adds the CLI surface for renaming a flow, publishing a flow, and attaching a flow to a placement audience.
What's here
adapty flows update --app <uuid> <flow_id> --name <name>→PUT /apps/<app>/flows/<id>/with{name}.adapty flows publish --app <uuid> <flow_id>→POST /apps/<app>/flows/<id>/publish/(no body). Publish is async: the response reportsstatus: publishing, notpublished. The command says so and does not claim the flow is live.PlacementAudienceEntryDTOis now apaywall | flowdiscriminated union. Paywall entry keepscontent_typeoptional, so existing paywall-audience calls stay valid (additive). Flow entry requirescontent_type: 'flow'andflow_id.placements create/placements updatedocument the flow form in help; the parse logic is unchanged.flows update,flows publish, and flow audiences onplacements create/placements update.Behavior note
Attaching a draft flow returns 400 (
FlowNotPublishedError— "Flow must be published before placing in a placement"). Even afterflows publish, the flow is only attachable once it reachespublished, which happens asynchronously.Verification
pnpm build,pnpm test(178 passing),pnpm lint(clean; one pre-existing warning inauth/login.ts), andpnpm run check:agent-docsall pass.Land order — do not merge yet
This depends on the adapty-dashboard-api change (branch
cli-flow-cruds) landing first. Per the feature's land order (api → qa → cli), this PR must not merge before the APIpublishendpoint is released. Kept as a draft for that reason.