Merge pull request #1456 from Tibsfox/fix/worktree-disable-config-1451
feat(config): add workflow.use_worktrees toggle to disable worktree isolation
This commit is contained in:
@@ -232,6 +232,16 @@ describe('config-set command', () => {
|
||||
assert.strictEqual(config.workflow.text_mode, true);
|
||||
});
|
||||
|
||||
test('sets workflow.use_worktrees to disable worktree isolation', () => {
|
||||
writeConfig(tmpDir, {});
|
||||
|
||||
const result = runGsdTools('config-set workflow.use_worktrees false', tmpDir);
|
||||
assert.ok(result.success, `Command failed: ${result.error}`);
|
||||
|
||||
const config = readConfig(tmpDir);
|
||||
assert.strictEqual(config.workflow.use_worktrees, false);
|
||||
});
|
||||
|
||||
test('errors when no key path provided', () => {
|
||||
const result = runGsdTools('config-set', tmpDir);
|
||||
assert.strictEqual(result.success, false);
|
||||
@@ -765,3 +775,58 @@ describe('config-set workflow.skip_discuss', () => {
|
||||
assert.strictEqual(output, true);
|
||||
});
|
||||
});
|
||||
|
||||
// ─── config-set/config-get workflow.use_worktrees ────────────────────────────
|
||||
|
||||
describe('config-set/config-get workflow.use_worktrees', () => {
|
||||
let tmpDir;
|
||||
|
||||
beforeEach(() => {
|
||||
tmpDir = createTempProject();
|
||||
runGsdTools('config-ensure-section', tmpDir, { HOME: tmpDir, USERPROFILE: tmpDir });
|
||||
});
|
||||
|
||||
afterEach(() => {
|
||||
cleanup(tmpDir);
|
||||
});
|
||||
|
||||
test('config-get workflow.use_worktrees returns false after setting to false', () => {
|
||||
runGsdTools('config-set workflow.use_worktrees false', tmpDir);
|
||||
const result = runGsdTools('config-get workflow.use_worktrees', tmpDir);
|
||||
assert.ok(result.success, `Command failed: ${result.error}`);
|
||||
|
||||
const output = JSON.parse(result.output);
|
||||
assert.strictEqual(output, false);
|
||||
});
|
||||
|
||||
test('config-get workflow.use_worktrees errors when not set (default config)', () => {
|
||||
// config-ensure-section does NOT include use_worktrees in hardcoded defaults,
|
||||
// so config-get should error with "Key not found". This is the expected behavior
|
||||
// that workflows rely on: the shell fallback `|| echo "true"` provides the default.
|
||||
const result = runGsdTools('config-get workflow.use_worktrees', tmpDir);
|
||||
assert.strictEqual(result.success, false);
|
||||
assert.ok(
|
||||
result.error.includes('Key not found'),
|
||||
`Expected "Key not found" in error: ${result.error}`
|
||||
);
|
||||
});
|
||||
|
||||
test('config-get workflow.use_worktrees returns true after setting to true', () => {
|
||||
runGsdTools('config-set workflow.use_worktrees true', tmpDir);
|
||||
const result = runGsdTools('config-get workflow.use_worktrees', tmpDir);
|
||||
assert.ok(result.success, `Command failed: ${result.error}`);
|
||||
|
||||
const output = JSON.parse(result.output);
|
||||
assert.strictEqual(output, true);
|
||||
});
|
||||
|
||||
test('use_worktrees can be toggled back and forth', () => {
|
||||
runGsdTools('config-set workflow.use_worktrees false', tmpDir);
|
||||
runGsdTools('config-set workflow.use_worktrees true', tmpDir);
|
||||
const result = runGsdTools('config-get workflow.use_worktrees', tmpDir);
|
||||
assert.ok(result.success, `Command failed: ${result.error}`);
|
||||
|
||||
const output = JSON.parse(result.output);
|
||||
assert.strictEqual(output, true);
|
||||
});
|
||||
});
|
||||
|
||||
@@ -105,4 +105,80 @@ describe('execute-phase docs: user-facing wave flag', () => {
|
||||
'help.md should include wave-filter usage'
|
||||
);
|
||||
});
|
||||
|
||||
test('workflow supports use_worktrees config toggle', () => {
|
||||
const content = fs.readFileSync(WORKFLOW_PATH, 'utf-8');
|
||||
assert.ok(
|
||||
content.includes('USE_WORKTREES'),
|
||||
'workflow should reference USE_WORKTREES variable'
|
||||
);
|
||||
assert.ok(
|
||||
content.includes('config-get workflow.use_worktrees'),
|
||||
'workflow should read use_worktrees from config'
|
||||
);
|
||||
assert.ok(
|
||||
content.includes('Sequential mode'),
|
||||
'workflow should document sequential mode when worktrees disabled'
|
||||
);
|
||||
});
|
||||
});
|
||||
|
||||
describe('use_worktrees config: cross-workflow structural coverage', () => {
|
||||
const QUICK_PATH = path.join(__dirname, '..', 'get-shit-done', 'workflows', 'quick.md');
|
||||
const DIAGNOSE_PATH = path.join(__dirname, '..', 'get-shit-done', 'workflows', 'diagnose-issues.md');
|
||||
const EXECUTE_PLAN_PATH = path.join(__dirname, '..', 'get-shit-done', 'workflows', 'execute-plan.md');
|
||||
const PLANNING_CONFIG_PATH = path.join(__dirname, '..', 'get-shit-done', 'references', 'planning-config.md');
|
||||
const CONFIG_CJS_PATH = path.join(__dirname, '..', 'get-shit-done', 'bin', 'lib', 'config.cjs');
|
||||
|
||||
test('quick workflow reads USE_WORKTREES from config', () => {
|
||||
const content = fs.readFileSync(QUICK_PATH, 'utf-8');
|
||||
assert.ok(
|
||||
content.includes('config-get workflow.use_worktrees'),
|
||||
'quick.md should read use_worktrees from config'
|
||||
);
|
||||
assert.ok(
|
||||
content.includes('USE_WORKTREES'),
|
||||
'quick.md should reference USE_WORKTREES variable'
|
||||
);
|
||||
});
|
||||
|
||||
test('diagnose-issues workflow reads USE_WORKTREES from config', () => {
|
||||
const content = fs.readFileSync(DIAGNOSE_PATH, 'utf-8');
|
||||
assert.ok(
|
||||
content.includes('config-get workflow.use_worktrees'),
|
||||
'diagnose-issues.md should read use_worktrees from config'
|
||||
);
|
||||
assert.ok(
|
||||
content.includes('USE_WORKTREES'),
|
||||
'diagnose-issues.md should reference USE_WORKTREES variable'
|
||||
);
|
||||
});
|
||||
|
||||
test('execute-plan workflow references use_worktrees config', () => {
|
||||
const content = fs.readFileSync(EXECUTE_PLAN_PATH, 'utf-8');
|
||||
assert.ok(
|
||||
content.includes('workflow.use_worktrees'),
|
||||
'execute-plan.md should reference workflow.use_worktrees'
|
||||
);
|
||||
});
|
||||
|
||||
test('planning-config reference documents use_worktrees', () => {
|
||||
const content = fs.readFileSync(PLANNING_CONFIG_PATH, 'utf-8');
|
||||
assert.ok(
|
||||
content.includes('workflow.use_worktrees'),
|
||||
'planning-config.md should document workflow.use_worktrees'
|
||||
);
|
||||
assert.ok(
|
||||
content.includes('worktree'),
|
||||
'planning-config.md should describe worktree behavior'
|
||||
);
|
||||
});
|
||||
|
||||
test('config.cjs includes workflow.use_worktrees in VALID_CONFIG_KEYS', () => {
|
||||
const content = fs.readFileSync(CONFIG_CJS_PATH, 'utf-8');
|
||||
assert.ok(
|
||||
content.includes("'workflow.use_worktrees'"),
|
||||
'config.cjs VALID_CONFIG_KEYS should include workflow.use_worktrees'
|
||||
);
|
||||
});
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user