Skip to content

fix(cli): fix panic when using --config option #332

@beeman

Description

@beeman

Syncpack version

14.3.1

Operating system(s)

Mac

Steps to reproduce

A repo with the minimal repro can be found here.

cat > package.json <<'JSON'
{
  "name": "syncpack-config-panic-repro",
  "devDependencies": {
    "typescript": "6.0.3"
  }
}
JSON

cat > syncpack.config.ts <<'TS'
export default {
  semverGroups: [
    {
      dependencyTypes: ['dev'],
      packages: ['syncpack-config-panic-repro'],
      range: '',
    },
  ],
}
TS

bun x syncpack@14.3.1 lint --config syncpack.config.ts --source package.json --dependency-types dev

Expected behavior

Syncpack should load the config file and run lint, or report a normal CLI/config error.

Actual behavior

The native binary panics:

thread 'main' panicked at .../clap_builder-4.6.0/src/parser/error.rs:32:9:
Mismatch between definition and access of `config`. Could not downcast ...

The same command without --config syncpack.config.ts succeeds when the config file is discovered automatically.

Contents of syncpack configuration file

{
  "semverGroups": [
    {
      "dependencyTypes": ["dev"],
      "packages": ["syncpack-config-panic-repro"],
      "range": ""
    }
  ]
}

Optional comments

This looks like a type mismatch in the Clap arg handling introduced in 14.3.1. config_path is now read as PathBuf, but the config argument appears to still be declared without a PathBuf value parser.

Also, the JS launcher may mask this in automation because it exits with spawnSync(...).status || 0; if the native binary aborts and status is null, the wrapper can exit 0.

Code of Conduct

  • I agree to follow the Code of Conduct

Metadata

Metadata

Assignees

No one assigned

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions