Skip to content

feat(quickstart): prune build file to subscription before generating#296

Merged
sohail2721 merged 1 commit into
mainfrom
dev
Jul 14, 2026
Merged

feat(quickstart): prune build file to subscription before generating#296
sohail2721 merged 1 commit into
mainfrom
dev

Conversation

@sohail2721

@sohail2721 sohail2721 commented Jul 14, 2026

Copy link
Copy Markdown
Contributor

No description provided.

…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>
@sonarqubecloud

Copy link
Copy Markdown

Quality Gate Failed Quality Gate failed

Failed conditions
6.8% Duplication on New Code (required ≤ 3%)

See analysis details on SonarQube Cloud

@sohail2721 sohail2721 changed the title feat(quickstart): prune build file to subscription before generating … feat(quickstart): prune build file to subscription before generating Jul 14, 2026
@sohail2721
sohail2721 merged commit 5f90b2a into main Jul 14, 2026
1 of 2 checks passed
github-actions Bot pushed a commit that referenced this pull request Jul 14, 2026
# [1.2.0](v1.1.0...v1.2.0) (2026-07-14)

### Features

* **quickstart:** prune build file to subscription before generating ([#294](#294)) ([#296](#296)) ([5f90b2a](5f90b2a))
@github-actions

Copy link
Copy Markdown

🎉 This PR is included in version 1.2.0 🎉

The release is available on:

Your semantic-release bot 📦🚀

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants