feat(quickstart): prune build file to subscription before generating#296
Merged
Conversation
…294) * feat(quickstart): prune the build file to the subscription before generating 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> * feat(quickstart): only offer SDK languages included in the plan 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> * chore(copilot): simplify default welcome example prompt 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> * feat(quickstart): stop on the free plan when no SDK languages are available 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> * fix(quickstart): check the plan before importing or pruning a spec 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> * refactor(quickstart): extract shared plan resolution to remove duplication 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> * Revert "refactor(quickstart): extract shared plan resolution to remove duplication" This reverts commit 2d383c5. * wrap link in to f.link * refactor(quickstart): return a rich BuildConfig from the prune service 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> * feat(prune): consume the build-config prune zip response 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> * refactor(prune): read the prune zip via ZipService 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> * update msg * refactor(prune): route the prune path through BuildContext 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> * chore: stop tracking scratchpad directory Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com> * feat(quickstart): gate portal quickstart on on-prem generation 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> * rename * refactor(prune): extract the prune zip to disk instead of reading it 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> * badrequest->serverError --------- 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 14, 2026 07:23
|
saeedjamshaid
approved these changes
Jul 14, 2026
|
🎉 This PR is included in version 1.2.0 🎉 The release is available on: Your semantic-release bot 📦🚀 |
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.


No description provided.