Skip to content

js: fix CLI model config flag mapping#1405

Open
fallintoplace wants to merge 1 commit into
google:mainfrom
fallintoplace:fix/js-cli-model-config-flags
Open

js: fix CLI model config flag mapping#1405
fallintoplace wants to merge 1 commit into
google:mainfrom
fallintoplace:fix/js-cli-model-config-flags

Conversation

@fallintoplace

Copy link
Copy Markdown

Summary

Fix the JS CLI so --model-config-url and --model-config-path are forwarded to Magika.create() correctly.

Fixes #1404.

Root Cause

The CLI defines --model-config-url and --model-config-path, but Commander exposes those options as flags.modelConfigUrl and flags.modelConfigPath.

The CLI was still reading the old flags.configUrl and flags.configPath names, so custom model config flags were ignored and the default config was used instead.

Changes

  • route CLI flags through a dedicated helper that maps parsed Commander flags to MagikaOptions
  • fix the modelConfigURL / modelConfigPath wiring to use modelConfigUrl / modelConfigPath
  • add a regression test that locks the mapping in place

Validation

  • corepack yarn build
  • node ./node_modules/jest/bin/jest.js test/magika-cli.test.ts --runInBand --modulePathIgnorePatterns dist
  • corepack yarn test still hits an unrelated existing failure in test/magika.test.ts on my machine (dirent.parentPath is undefined), while the CLI test file passes

@google-cla

google-cla Bot commented May 23, 2026

Copy link
Copy Markdown

Thanks for your pull request! It looks like this may be your first contribution to a Google open source project. Before we can look at your pull request, you'll need to sign a Contributor License Agreement (CLA).

View this failed invocation of the CLA check for more information.

For the most up to date status, view the checks section at the bottom of the pull request.

@fallintoplace fallintoplace marked this pull request as ready for review May 23, 2026 22:04
@fallintoplace fallintoplace requested a review from invernizzi as a code owner May 23, 2026 22:05
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

JS CLI ignores --model-config-url and --model-config-path

1 participant