Skip to content

feat(plapi): stamp from_source=cli on authenticated app creation#192

Merged
mwickett merged 2 commits intomainfrom
cli-tier-1-attribution
Apr 21, 2026
Merged

feat(plapi): stamp from_source=cli on authenticated app creation#192
mwickett merged 2 commits intomainfrom
cli-tier-1-attribution

Conversation

@mwickett
Copy link
Copy Markdown
Member

Phase 2 of the CLI Tier 1 attribution plan. Phase 1 (clerk_go#18277) makes POST /v1/platform/applications accept an optional from_source field and persist it to applications.from_source. This PR is the CLI counterpart: every authenticated app the CLI creates now stamps from_source: "cli" so those apps are identifiable in BigQuery dim_applications for growth analytics.

Phase 1 PR: https://github.com/clerk/clerk_go/pull/18277

How

  • Export a single canonical CLI_FROM_SOURCE = "cli" constant from packages/cli-core/src/lib/plapi.ts.
  • createApplication() includes from_source: CLI_FROM_SOURCE on the POST body. Signature unchanged, so both call sites (clerk apps create and the create-new branch of clerk link) keep working without edits.

Canonical value matches what PR #157 (auto-claim keyless) already sends on its accountless POST body.

Test plan

  • Updated plapi.test.ts body-shape assertion.
  • Added guardrail test pinning the literal to the exported constant.
  • apps/create.test.ts and link/index.test.ts still pass (signature unchanged).
  • bun run test green (72 suites).
  • bun run format:check, bun run lint, bun run typecheck all clean.
  • bun changeset status --since=origin/main — clerk bumps minor.

Rollout

Backwards-compatible. If this ships before Phase 1 deploys, PLAPI silently ignores the unknown field. Once Phase 1 deploys, stamps start appearing in applications.from_source.

@changeset-bot
Copy link
Copy Markdown

changeset-bot Bot commented Apr 21, 2026

🦋 Changeset detected

Latest commit: cf7db71

The changes in this PR will be included in the next version bump.

This PR includes changesets to release 1 package
Name Type
clerk Minor

Not sure what this means? Click here to learn what changesets are.

Click here if you're a maintainer who wants to add another changeset to this PR

@coderabbitai
Copy link
Copy Markdown

coderabbitai Bot commented Apr 21, 2026

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro

Run ID: 7850390e-a57a-47b9-b01f-a3701489c5f5

📥 Commits

Reviewing files that changed from the base of the PR and between 20f0f41 and cf7db71.

📒 Files selected for processing (3)
  • .changeset/cli-attribution-stamp.md
  • packages/cli-core/src/lib/plapi.test.ts
  • packages/cli-core/src/lib/plapi.ts
✅ Files skipped from review due to trivial changes (2)
  • .changeset/cli-attribution-stamp.md
  • packages/cli-core/src/lib/plapi.test.ts
🚧 Files skipped from review as they are similar to previous changes (1)
  • packages/cli-core/src/lib/plapi.ts

📝 Walkthrough

Walkthrough

Adds CLI attribution for applications created via the Clerk CLI. Introduces and exports CLI_FROM_SOURCE = "cli" in packages/cli-core/src/lib/plapi.ts. Updates createApplication(name) to include from_source: CLI_FROM_SOURCE in the POST payload to /v1/platform/applications. Updates the test expectation in packages/cli-core/src/lib/plapi.test.ts to require the new field. Adds a changeset entry documenting the client-side change that requires server-side PLAPI support.

Estimated code review effort

🎯 2 (Simple) | ⏱️ ~10 minutes

🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 50.00% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (4 passed)
Check name Status Explanation
Title check ✅ Passed The title accurately summarizes the main change: exporting a CLI_FROM_SOURCE constant and including it in authenticated app creation requests to PLAPI for attribution purposes.
Description check ✅ Passed The description is comprehensive and directly related to the changeset, explaining the context (Phase 2 of attribution plan), implementation details, test coverage, and rollout strategy.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.


Comment @coderabbitai help to get the list of available commands and usage tips.

@mwickett mwickett force-pushed the cli-tier-1-attribution branch from dde1c6b to 9d45706 Compare April 21, 2026 12:33
Comment thread packages/cli-core/src/lib/plapi.ts Outdated
@mwickett mwickett force-pushed the cli-tier-1-attribution branch from 20f0f41 to cf7db71 Compare April 21, 2026 20:20
@mwickett mwickett requested a review from rafa-thayto April 21, 2026 20:32
@mwickett mwickett merged commit 6f4d3a7 into main Apr 21, 2026
10 checks passed
@mwickett mwickett deleted the cli-tier-1-attribution branch April 21, 2026 21:01
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants