Conversation
What the plugins that call the Core API repeated in their own base command, in one place: - the organization, domain and access token flags the CLI fills in from the current application (organizationFlag, domainFlag, accessTokenFlag for the plugins that change them); - the plugin update check, skipped with --blind, --silent or --quiet; - the application kind check (static applicationKinds); - quitting an interactive prompt; - clientOptions(), the options of the SDK client: cli-core stays independent of the SDK, the plugin creates the client; - handleApiError(): the 401 (login suggestion), 404 (missing resource) and other API errors. @oclif/core becomes a peer dependency, so the base command extends the plugin's own Command class. BREAKING CHANGE: @oclif/core is a peer dependency of cli-core. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
checkout, cleanups, exports, imports, links, metrics, microstore, orders, resources, tags, triggers and webhooks extend the base command of cli-core instead of repeating its flags, init, application check, client options and API errors; what is specific to a plugin stays in its base command. The command surfaces are unchanged (oclif manifests compared before and after). Also: - the update check is skipped with --blind, --silent or --quiet in all of them, not only in some; - cleanups: the API errors named exports instead of cleanups; - resources:count tested a --doc flag it doesn't have. Co-Authored-By: Claude Opus 5.5 <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.
The code the plugins repeated in their base commands moves into a base command of cli-core,
CLCommand. 12 plugins extend it, ahead of the oclif 5 major.cli-core:
CLCommandorganization,domainandaccessToken, the flags the CLI fills in from the current application.organizationFlag(),domainFlag()andaccessTokenFlag(options)serve the plugins that change them, e.g.-ain checkout, links, metrics and microstore.init().--blind,--silentor--quiet.static applicationKinds.catch(). Quitting an interactive prompt.clientOptions(flags). Organization, domain, access token and user agent for the SDK client. cli-core still doesn't depend on the SDK: the plugin creates the client (commercelayer(this.clientOptions(flags))). The SDK 8apiVersion(feat!: SDK 8 and provisioning-sdk 3 previews (draft, do not merge) #250) will be added here once, instead of in every plugin.handleApiError(error, { resource, id, idLabel, flags }). 401 with the login suggestion, 404 naming the resource, any other error as the API returned it.@oclif/corebecomes a peer dependency, so the base command extends the plugin's ownCommandclass (cli-ux already does the same).Plugins
Behaviour
applicationKindsproperty in the tags manifest.resources:counttested a--docflag it doesn't have, which was always undefined. The stricter flag typing showed it.cacheCommandcollects static properties only up to the first class that has none. Base commands left with no static property keep an explicitstatic baseFlags = { ...CLCommand.baseFlags }, otherwise the manifest loses the base flags andstrict.Tests
CLCommandtests (94 in total).release:trywith all 15 plugins: install,plugins, help of several commands, application kind refusal, real 401 handling.check-packages,labels --check, type checks.🤖 Generated with Claude Code