Read the config file --config names - #19
Merged
Merged
Conversation
Program read the option off the Commander command rather than opts(), where Commander has kept parsed options since v7. The property is simply undefined, with no error, so --config and -c were ignored and the run used whichever .grenrc the directory happened to hold -- reporting that filename on stdout while the user believed another file was in effect. A missing custom config still stops the run, which is the behaviour getConfigFromFile always had and nothing could reach. Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
The bug
Programread the parsed option off the Commander command object:Commander has kept parsed options on
opts()since v7, and this project is on v15. Theproperty is simply
undefined, with no error and no warning, so--configand-cwereignored and the run used whichever
.grenrc*the directory happened to hold.The failure is quiet in the worst way: gren prints the filename it loaded, so a run with
-c my-config.cjsreportsGetting gren config from local file .../.grenrc.cjsandcarries on building a changelog from a configuration the user did not ask for.
The fix
Read the options from
this.program.opts(), once, and use them for both the configfilename and the option merge.
A
--confignaming a file that is not there now stops the run. That has always beengetConfigFromFile's behaviour; nothing could reach it before.Verification
Four tests, added first; three of them failed for the reported reason before the fix (the
fallback case passed, since falling back was all it ever did).
Run over this repository, generating to a scratch file with
-c .grenrc-custom.cjs, wherethe custom config sets a distinctive
template.changelogTitle:npm test135 passing;env -u GREN_GITHUB_TOKEN npx mocha96 passing, 39 pending;npm run lintclean apart from the pre-existingmocha/no-pending-testswarning intest/Gren.spec.js. No change tolib/_options.js, so the README tables are unaffected.🤖 Generated with Claude Code