feat(quickstart): prune build file to subscription before generating#294
Merged
Conversation
…erating Fixes portal quickstart failing for Starter/Basic plans, whose scaffolded APIMATIC-BUILD.json enables AI features (API Copilot + AI context plugins) and SDK languages the plan doesn't include, causing codegen to reject the build. - Fail fast when a selected SDK language isn't on the plan (from the account's allowedLanguages), with an upgrade hint. - After writing the build file, POST it to the platform's /build-features/prune endpoint, overwrite it with the pruned result, and report what was removed. Fail closed: a prune failure aborts rather than serving an ungenerable build. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
sohail2721
requested review from
Shield-Jaguar,
aliasghar98 and
saeedjamshaid
as code owners
July 7, 2026 11:26
sohail2721
force-pushed
the
feat/prune-build-file-for-subscription
branch
from
July 8, 2026 10:47
4ce5be6 to
8736057
Compare
The quickstart language prompts now list only the SDK languages the account's subscription includes. Languages not on the plan are omitted from the choices, and a note listing them with an upgrade link is shown before the language selection — instead of failing after the fact. Both the portal (multi-select) and SDK (single-select) flows fetch account info before the language step and share a LANGUAGE_CHOICES list. Also defer the 'API Copilot is enabled' caution until after the build file is pruned, and only print it when Copilot survived the prune, so it is no longer shown for accounts whose plan doesn't include Copilot. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
sohail2721
force-pushed
the
feat/prune-build-file-for-subscription
branch
from
July 8, 2026 11:19
b1911c4 to
eaed4de
Compare
Change the second example prompt in the default API Copilot welcome message from 'What endpoints are available in this API?' to the more approachable 'What is this API about?'. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
…ilable When the account's plan includes no SDK languages (e.g. the Free plan), both quickstart flows now stop before the language step with a clear upgrade message instead of rendering an empty selection prompt. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Move the account-info fetch and free-plan guard to the start of both quickstart flows, before the spec import/validation/prune steps. A free-plan user is now stopped up front instead of first being told components will be removed 'before proceeding' and then cancelled. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
…ation Both quickstart flows repeated the same account-info fetch and free-plan guard. Extract it into resolveQuickstartPlan, which returns the resolved plan or the ActionResult to return, cutting the duplicated block from the portal and SDK actions. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
…e duplication" This reverts commit 2d383c5.
…-for-subscription # Conflicts: # src/infrastructure/services/validation-service.ts
The prune endpoint response was typed unknown and written back with a raw JSON.stringify. Convert it to BuildConfig at the service boundary via a new BuildConfig.from factory and persist it through BuildContext.updateBuildFileContents. The Copilot caution now checks hasApiCopilot() on the pruned config instead of the prune report. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
pruneBuildFile reads the endpoint's zip (APIMATIC-BUILD.json + report.json) via adm-zip instead of a JSON body, keeping the same PruneBuildFileResponse shape. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Add an in-memory readEntry to ZipService so adm-zip stays encapsulated there, and drop the direct adm-zip usage from ValidationService. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Reuse BuildContext.buildFilePath() instead of reconstructing the APIMATIC-BUILD.json FilePath in the action, removing the duplicated filename literal and leaked path knowledge. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Portal quickstart now exits early when the plan doesn't allow on-prem generation (isOnPremGenerationAllowed from /account/profile) instead of when the plan has no SDK languages. With zero SDK languages the language menu is skipped and the portal is generated with HTTP documentation only. SDK quickstart keeps its allowed-languages gate. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
…in-memory Stream the /build-features/prune response straight to a temp zip, extract it via ZipService.unArchive, then read APIMATIC-BUILD.json and report.json back off disk. Drops the in-memory Buffer/AdmZip handling and lets ZipService.readEntry go away entirely. The prune error parser now consumes the streamed body, matching the sibling strip flow. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
saeedjamshaid
approved these changes
Jul 14, 2026
|
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.


What
Fixes
apimatic quickstart(portal flow) failing for Starter/Basic plans. The scaffoldedAPIMATIC-BUILD.jsonenables AI features (API Copilot + AI context plugins) and all SDK languages, so codegen rejects the whole build for plans that don't include them.This is the CLI half of a cross-repo effort (apimatic-io exposes
POST /api/build-features/prune, delegating to a codegen pruner; the platform onboarding app calls the same endpoint). Tracking plan: apimatic-platform-app issue #471.Changes (
src/actions/portal/quickstart.ts,validation-service.ts,prompts/portal/quickstart.ts)allowedLanguages; if any isn't on the plan, prints a clear message (with an upgrade hint) and aborts before scaffolding./build-features/pruneendpoint (same auth + base-URL pattern asstripUnallowedFeatures), overwrites it with the pruned result, and reports what was removed (SDK languages / API Copilot / AI context plugins). Fail closed — a prune failure aborts rather than serving a build the plan can't generate.parseErrorResponseparam (wasany) to keep the file lint-clean.Verification
pnpm build(tsc -b): clean.pnpm eslinton changed files: clean.Rollout
Depends on the apimatic-io
/build-features/pruneendpoint being deployed (fail-closed), which in turn depends on the codegen pruner. Coordinate deploy order: codegen → io → CLI.🤖 Generated with Claude Code