fix(deps): update dependency clibuilder to v10 - #32
Conversation
|
29749a7 to
aab568e
Compare
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #32 +/- ##
=========================================
Coverage 100.00% 100.00%
=========================================
Files 3 3
Lines 75 75
Branches 25 25
=========================================
Hits 75 75
Flags with carried forward coverage won't be shown. Click here to find out more. ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
aab568e to
a4d128c
Compare
a4d128c to
f34f940
Compare
This PR contains the following updates:
^9.1.0→^10.0.0Release Notes
clibuilder/clibuilder (clibuilder)
v10.1.0Compare Source
Minor Changes
c71f536: Report usage errors and exit non-zero.A clibuilder cli could not fail.
lookupCommandalready built a typed list of everything wrong withan invocation — unknown option, missing argument, extra arguments, a value of the wrong type — and
builderthrew it away and printed the help message with an exit code of0. A command that knewit had failed had no way to say so either.
unknown option --bogus,missing required argument <target>) ahead of the help message, and the cli exits2.1.CliError, which carries anexitCodeand optionalhelplines.
parse()still resolves rather than rejecting, so the failure is reported instead ofsurfacing as an unhandled rejection.
CliError,exitCodes(success/error/usage— 0/1/2), andisCliError().testCommand()returns theexitCodealongsideresultandmessages, so a test can assert afailure without ending the test run.
--helpand--versionare accepted by every command, including sub-commands that declare nooptions of their own, and both still exit
0.The exit code is recorded on
process.exitCoderather than applied withprocess.exit(), sopending stdout writes are not truncated.
This changes the behavior of every cli built with clibuilder: an invocation with a typo used to
exit
0and now exits2. The TypeScript surface is additive, which is why this is a minor ratherthan a major, but a caller downstream of your cli that ignored the exit code will now see it fail.
2f4afde: Add--formattoplugins list.plugins list --format <toon|text|json>picks how the installed plugins are rendered,matching
plugins search. The default istoon, following the Agent eXperienceInterface — a cli's plugin list is read by an agent far more often than by a person:
Nothing installed is stated as the answer rather than left as silence, and it says
installedbecause that is the whole difference from whatsearchreports — nothinginstalled here says nothing about what exists on npm:
--format textis the previous human-readable prose, unchanged, including its separatewording for none, one, and several.
toonandjsonreport one shape whatever thecount.
--format jsonemits{ "plugins": [...] }alone, with no help line, so itsurvives a pipe into
jq. The command still returns the plugin names to its caller.4925f20: Matchplugins searchkeywords disjunctively, and add--formatto its output.A cli declaring several keywords used to find only packages carrying all of them, so
a plugin tagged with one of the cli's keywords was never listed. Each keyword is now
searched on its own and the results are unioned, deduped, in keyword order.
plugins search --format <toon|text|json>picks how that result is rendered. The defaultis
toon, following the Agent eXperience Interface — a cli's plugin search is read by anagent far more often than by a person, and toon is the cheaper read for one:
--format textis the previous human-readable prose, unchanged.--format jsonemits{ "packages": [...] }alone, with no help line, so it survives a pipe intojq.--fields keywordsadds which of the cli's keywords found each package — the questiondisjunctive matching makes worth asking, since one over-broad keyword can now pull in a
package that is not a plugin at all. It is off by default: a cli with a single keyword
would spend the column on a value every row repeats.
Patch Changes
033a38a: Reject an option value the option'stypedoes not accept.A value that failed the option's schema used to be dropped and replaced by the option's
default, so--format yamlquietly renderedtoonand the caller had no way to tell.It is now reported as a usage error and the cli exits with
2, the same as an unknownoption. An enum lists what it would have accepted, so the invocation can be fixed in one
step:
This applies to every option whose
typeclibuilder does not convert itself —z.enumabove all. Booleans and numbers already reported their own conversion errors and are
unchanged.
v10.0.0Compare Source
Major Changes
7b17641: Require Node.js >= 20.19 and updatefind-installed-packagesto^4.0.0.engines.nodemoves from>= 18to>= 20.19, matching whatfind-installed-packages@4supports. Node 18 and 19 reached end of life, sothere is no supported runtime left below that floor.
v4 also changes how plugins are discovered. It walks the declared dependency
graph and asks the runtime's module resolver where each package lives, instead
of scanning
node_modules. That fixes discovery under pnpm, Yarn Plug'n'Play,and workspaces where the tree is hoisted to the repo root. The trade-off: only
declared dependencies are reported, so a plugin sitting in
node_modulesthatnothing depends on is no longer found — add it to your
package.jsondependencies if you were relying on that.
v9.2.0Compare Source
Minor Changes
8703dcc: Add a typed plugin registry for content contributions and cross-plugin capabilities.d709f62: Coerce argument and untyped-option values to match their declared types.Both fixes close a gap where the type system and the runtime disagreed about what
run(args)receives.
type: z.number()yields anumber,type: z.array(z.number())yieldsnumber[], and a valuethat fails its schema is a usage error instead of being silently dropped. An array argument is
variadic: it consumes the remaining positionals. Previously every argument arrived as a raw string,
and
z.array(z.number())ended upundefined.typenow defaults toz.optional(z.boolean())instead ofz.optional(z.string()), so a flag yields a realtruerather than the string'true'.RunArgshas always inferred this case asboolean | undefined.Note two behavior changes for code that relied on the old runtime values:
--flag=somevalueon an option with no declaredtypeis now a usage error. Declaretype: z.string()to keep accepting a string value.z.enum,z.literal) now has theraw argv string handed to its schema, which accepts or rejects it. It is no longer passed through
unvalidated.
9b629d0: Config subsystem: jsonc support, a public lookup/load API, and--show-config.JSONC config (#341)
.jsoncand.jsonc-suffixed rc files are now searched for, and.jsonfiles may contain commentsand trailing commas. Parsing goes through
jsonc-parser, so comment-like sequences inside stringsare left alone —
"http://example.com"is no longer at risk of being truncated at the//.The format is now chosen by extension rather than by trying every parser in turn. Extension-less
candidates such as
.apprcstill infer their format from content (JSONC, then YAML, then module).One consequence: a
.jsonfile that is not valid JSON now reports a parse error naming the file,where before it was silently retried as YAML and could load as something unintended.
Config lookup/load API (#488)
clibuildernow exports its config resolution, so plugins and tools can ask where a config camefrom, not just what it holds:
lookupConfig({ cwd }, name)— resolve the origin without reading the fileresolveConfig({ cwd, ui }, name)— the config plus its provenanceloadConfig,readConfigFile,getConfigFilenames,getConfigFormat,describeConfigSourceA resolved
sourceis{ type: 'file', path, format },{ type: 'package.json', path, property },or
{ type: 'none' }. These are read-only; writing config back to disk is not supported yet.--show-config(#317)A cli declaring
confignow accepts--show-config, which prints the resolved config and where itwas loaded from — the matching file path, the
package.jsonproperty, or that nothing was found.Clis without config do not advertise the option.
Patch Changes
2efd5dc: Fix optional and variadic arguments in the help output.The
Arguments:section tested theisOptionalmethod instead of calling it, so a typed requiredargument rendered as
[name]and an optional one as<name>, exactly backwards. Arguments now usethe same notation as options:
<name>when required,[name]when optional, with the declared type(
=string,=number,=boolean) and a...variadic marker.3fda89f: Resolve command aliases such asplugins lswhen parsing CLI input.Configuration
📅 Schedule: (UTC)
🚦 Automerge: Disabled by config. Please merge this manually once you are satisfied.
♻ Rebasing: Whenever PR becomes conflicted, or you tick the rebase/retry checkbox.
🔕 Ignore: Close this PR and you won't be reminded about this update again.
This PR was generated by Mend Renovate. View the repository job log.