fix(core): auto-detect commit_docs from gitignore in loadConfig (#1250)
loadConfig() defaulted commit_docs to true regardless of whether .planning/ was gitignored. The documented auto-detection only existed inside cmdCommit, so init commands returned commit_docs: true even when .planning/ was in .gitignore. This caused LLM executors to bypass the cmdCommit gate and re-commit planning files with raw git. Now loadConfig() checks isGitIgnored(cwd, '.planning/') when no explicit commit_docs value is set in config.json. If .planning/ is gitignored, commit_docs defaults to false. An explicit commit_docs value in config.json is always respected. Added 5 regression tests covering auto-detection, explicit overrides, and the no-config-file edge case.
This commit is contained in:
@@ -232,7 +232,15 @@ function loadConfig(cwd) {
|
||||
|
||||
return {
|
||||
model_profile: get('model_profile') ?? defaults.model_profile,
|
||||
commit_docs: get('commit_docs', { section: 'planning', field: 'commit_docs' }) ?? defaults.commit_docs,
|
||||
commit_docs: (() => {
|
||||
const explicit = get('commit_docs', { section: 'planning', field: 'commit_docs' });
|
||||
// If explicitly set in config, respect the user's choice
|
||||
if (explicit !== undefined) return explicit;
|
||||
// Auto-detection: when no explicit value and .planning/ is gitignored,
|
||||
// default to false instead of true
|
||||
if (isGitIgnored(cwd, '.planning/')) return false;
|
||||
return defaults.commit_docs;
|
||||
})(),
|
||||
search_gitignored: get('search_gitignored', { section: 'planning', field: 'search_gitignored' }) ?? defaults.search_gitignored,
|
||||
branching_strategy: get('branching_strategy', { section: 'git', field: 'branching_strategy' }) ?? defaults.branching_strategy,
|
||||
phase_branch_template: get('phase_branch_template', { section: 'git', field: 'phase_branch_template' }) ?? defaults.phase_branch_template,
|
||||
|
||||
Reference in New Issue
Block a user