Command
other
Is this a regression?
The previous version in which this bug was not present was
No response
Description
When a built-in boolean CLI option gets an inline value (--dry-run=false, --debug=false, --force=false, --interactive=false, ...), the value is parsed as the string 'false' not the boolean false.
In packages/angular_devkit/schematics_cli/bin/schematics.ts, parseOptions calls parseArgs with strict: false.
In non-strict mode, Node doesn't validate inline values for type: 'boolean' options. It returns them as raw strings:
const { parseArgs } = require('node:util');
parseArgs({
args: ['--dry-run=false', '--debug=true'],
strict: false, allowPositionals: true, allowNegative: true,
options: { 'dry-run': { type: 'boolean' }, debug: { type: 'boolean' } },
}).values;
// => { 'dry-run': 'false', debug: 'true' } <-- strings, not booleans
The token loop in parseOptions skips these options (if (name in CLI_OPTION_DEFINITIONS) continue;). That means the 'true'/'false' conversion added in #32362 never runs for them, and values is returned unchanged as cliOptions. Then in main:
const debug = cliOptions.debug ?? isLocalCollection; // 'false' -> truthy
const dryRun = cliOptions['dry-run'] ?? debug; // 'false' -> truthy
Minimal Reproduction
// package.json
{
"name": "repro",
"dependencies": {
"@angular-devkit/schematics-cli": "22.2.0"
}
}
// my-schematics/collection.json
{
"schematics": {
"hello": {
"description": "x", "factory": "./index.js#hello"
}
}
}
// my-schematics/index.js
exports.hello = () => (tree) => {
tree.create('hello.txt', 'hi');
return tree;
};
npx schematics ./my-schematics/collection.json:hello --dry-run=false
Debug mode enabled by default for local collections.
CREATE hello.txt (2 bytes)
Dry run enabled. No files written to disk.
Exception or Error
`Dry run enabled. No files written to disk.`
Your Environment
@angular-devkit/schematics-cli: 22.2.0
Node: v22.22.3
OS: macOS
Anything else relevant?
No response
Command
other
Is this a regression?
The previous version in which this bug was not present was
No response
Description
When a built-in boolean CLI option gets an inline value (
--dry-run=false,--debug=false,--force=false,--interactive=false, ...), the value is parsed as the string'false'not the booleanfalse.In
packages/angular_devkit/schematics_cli/bin/schematics.ts,parseOptionscallsparseArgswithstrict: false.In non-strict mode, Node doesn't validate inline values for
type: 'boolean'options. It returns them as raw strings:The token loop in
parseOptionsskips these options (if (name in CLI_OPTION_DEFINITIONS) continue;). That means the'true'/'false'conversion added in #32362 never runs for them, andvaluesis returned unchanged ascliOptions. Then inmain:Minimal Reproduction
Exception or Error
Your Environment
Anything else relevant?
No response