Bug Description
The --base-dir / -b CLI flag on the generate command is silently ignored. The flag is accepted without error but has no effect on the output directory.
Root Cause
In src/cli/index.ts:180, the Commander.js option is defined as:
.option("-b, --base-dir <paths>", "Base directories to generate files (comma-separated for multiple paths)")
Commander.js camelCases --base-dir to baseDir, but the action handler at src/cli/index.ts:209 reads options.baseDirs (plural):
.action(async (options) => {
await generateCommand({
// ...
baseDirs: options.baseDirs, // ← always undefined, should be options.baseDir
// ...
});
});
Since options.baseDirs is always undefined, the value falls through to the config file's baseDirs or the default [process.cwd()] at src/config/config-resolver.ts:141:
baseDirs: baseDirs ?? configByFile.baseDirs ?? getDefaults().baseDirs,
Additional Issue
Even if the property name were fixed, the option at src/cli/index.ts:180 lacks a value parser to split comma-separated paths into an array (unlike --features which has one). So it would pass a single string instead of string[] to ConfigResolver.resolve().
Steps to Reproduce
rulesync generate --targets claudecode --features '*' --base-dir "./some-dir" --verbose
Observe in verbose output:
[rulesync] ℹ Base directories: /current/working/dir
The base directory is always cwd, regardless of what --base-dir is set to.
Expected Behavior
The --base-dir flag should override baseDirs from the config, and the specified directory should be used as the output base directory.
Suggested Fix
In src/cli/index.ts, change:
baseDirs: options.baseDirs,
to:
baseDirs: options.baseDir ? options.baseDir.split(",").map((p) => p.trim()) : undefined,
Environment
- rulesync: 7.6.3
- Node.js: v22.12.0
- OS: macOS (Darwin 25.2.0)
Bug Description
The
--base-dir/-bCLI flag on thegeneratecommand is silently ignored. The flag is accepted without error but has no effect on the output directory.Root Cause
In
src/cli/index.ts:180, the Commander.js option is defined as:Commander.js camelCases
--base-dirtobaseDir, but the action handler atsrc/cli/index.ts:209readsoptions.baseDirs(plural):Since
options.baseDirsis alwaysundefined, the value falls through to the config file'sbaseDirsor the default[process.cwd()]atsrc/config/config-resolver.ts:141:Additional Issue
Even if the property name were fixed, the option at
src/cli/index.ts:180lacks a value parser to split comma-separated paths into an array (unlike--featureswhich has one). So it would pass a single string instead ofstring[]toConfigResolver.resolve().Steps to Reproduce
Observe in verbose output:
The base directory is always
cwd, regardless of what--base-diris set to.Expected Behavior
The
--base-dirflag should overridebaseDirsfrom the config, and the specified directory should be used as the output base directory.Suggested Fix
In
src/cli/index.ts, change:to:
Environment