Summary
The JS CLI accepts --model-config-url and --model-config-path, but those values are not forwarded to Magika.create().
In js/magika-cli.ts, Commander defines these flags:
--model-config-url <model-config-url>
--model-config-path <model-config-path>
With Commander, those options are exposed as flags.modelConfigUrl and flags.modelConfigPath.
However, the CLI currently passes flags.configUrl and flags.configPath into Magika.create(), so the custom config flags are ignored and the default config is used instead.
Evidence
Current CLI wiring on main:
const magika = await Magika.create({
modelURL: flags.modelUrl,
modelPath: flags.modelPath,
modelConfigURL: flags.configUrl,
modelConfigPath: flags.configPath,
});
Commander exposes the parsed option names as modelConfigUrl / modelConfigPath for these flags. Minimal repro:
const { program } = require("commander");
program.option("--model-config-url <model-config-url>");
program.option("--model-config-path <model-config-path>");
program.parse([
"node",
"test",
"--model-config-url",
"https://example.invalid/config.json",
"--model-config-path",
"/tmp/config.json",
]);
console.log(program.opts());
This prints:
{
modelConfigUrl: 'https://example.invalid/config.json',
modelConfigPath: '/tmp/config.json'
}
The JS library itself expects modelConfigURL / modelConfigPath and reads those exact fields in the loader.
Regression history
This looks like a regression introduced during the JS CLI/config rename work:
a3c4f6b added JS CLI support for custom model/config loading.
aa62093 renamed the JS API fields from config* to modelConfig*.
2be21b1 renamed the CLI flags to --model-config-*, but the code still reads flags.configUrl / flags.configPath.
I also confirmed the bug is present in js-v0.3.1, js-v0.3.2, and current main.
Expected behavior
Passing either --model-config-url or --model-config-path should override the default model config.
Suggested fix
const magika = await Magika.create({
modelURL: flags.modelUrl,
modelPath: flags.modelPath,
modelConfigURL: flags.modelConfigUrl,
modelConfigPath: flags.modelConfigPath,
});
Testing gap
js/test/magika-cli.test.ts currently covers help/basic execution, but it does not exercise either custom model config flag.
Summary
The JS CLI accepts
--model-config-urland--model-config-path, but those values are not forwarded toMagika.create().In
js/magika-cli.ts, Commander defines these flags:--model-config-url <model-config-url>--model-config-path <model-config-path>With Commander, those options are exposed as
flags.modelConfigUrlandflags.modelConfigPath.However, the CLI currently passes
flags.configUrlandflags.configPathintoMagika.create(), so the custom config flags are ignored and the default config is used instead.Evidence
Current CLI wiring on
main:Commander exposes the parsed option names as
modelConfigUrl/modelConfigPathfor these flags. Minimal repro:This prints:
The JS library itself expects
modelConfigURL/modelConfigPathand reads those exact fields in the loader.Regression history
This looks like a regression introduced during the JS CLI/config rename work:
a3c4f6badded JS CLI support for custom model/config loading.aa62093renamed the JS API fields fromconfig*tomodelConfig*.2be21b1renamed the CLI flags to--model-config-*, but the code still readsflags.configUrl/flags.configPath.I also confirmed the bug is present in
js-v0.3.1,js-v0.3.2, and currentmain.Expected behavior
Passing either
--model-config-urlor--model-config-pathshould override the default model config.Suggested fix
Testing gap
js/test/magika-cli.test.tscurrently covers help/basic execution, but it does not exercise either custom model config flag.