Skip to content

schematics-cli: --dry-run=false, --debug=false and other built-in boolean flags are treated as true #34199

Closed

Description

@rsreimer

Command

other

Is this a regression?

  • Yes, this behavior used to work in the previous version

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

Activity

  1. added
    gemini-triaged
    on Sep 29, 2026
  2. added this to the needsTriage milestone on Sep 29, 2026
  3. added 2 commits that reference this issue on Sep 29, 2026
    e6350b6
    7085a6e
  4. angular-automatic-lock-bot commented on Oct 30, 2026

    @angular-automatic-lock-bot

    This issue has been automatically locked due to inactivity.
    Please file a new issue if you are encountering a similar or related problem.

    Read more about our automatic conversation locking policy.

    This action has been performed automatically by a bot.

  5. locked and limited conversation to collaborators on Oct 30, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    area: @angular-devkit/schematics-cligemini-triaged

    Type

    No type

    Projects

    No projects

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions