Merge pull request #1155 from gsd-build/Solvely/quick-task-branching

feat(quick): add quick-task branch support
This commit is contained in:
Tom Boucher
2026-03-19 12:03:58 -04:00
committed by GitHub
11 changed files with 144 additions and 15 deletions

View File

@@ -679,6 +679,7 @@ describe('cmdInitQuick', () => {
assert.ok(result.success, `Command failed: ${result.error}`);
const output = JSON.parse(result.output);
assert.strictEqual(output.branch_name, null);
assert.strictEqual(output.slug, 'fix-login-bug');
assert.strictEqual(output.description, 'Fix login bug');
@@ -736,6 +737,44 @@ describe('cmdInitQuick', () => {
const output = JSON.parse(result.output);
assert.ok(output.slug.length <= 40, `Slug should be <= 40 chars, got ${output.slug.length}: "${output.slug}"`);
});
test('returns quick branch name when quick_branch_template is configured', () => {
fs.writeFileSync(
path.join(tmpDir, '.planning', 'config.json'),
JSON.stringify({
git: {
quick_branch_template: 'gsd/quick-{num}-{slug}',
},
}, null, 2)
);
const result = runGsdTools('init quick "Fix login bug"', tmpDir);
assert.ok(result.success, `Command failed: ${result.error}`);
const output = JSON.parse(result.output);
assert.ok(output.branch_name, 'branch_name should be set');
assert.ok(output.branch_name.startsWith('gsd/quick-'));
assert.ok(output.branch_name.endsWith('-fix-login-bug'));
assert.ok(output.branch_name.includes(output.quick_id), 'branch_name should include quick_id');
});
test('uses fallback slug in quick branch name when description is omitted', () => {
fs.writeFileSync(
path.join(tmpDir, '.planning', 'config.json'),
JSON.stringify({
git: {
quick_branch_template: 'gsd/quick-{quick}-{slug}',
},
}, null, 2)
);
const result = runGsdTools('init quick', tmpDir);
assert.ok(result.success, `Command failed: ${result.error}`);
const output = JSON.parse(result.output);
assert.ok(output.branch_name, 'branch_name should be set');
assert.ok(output.branch_name.endsWith('-quick'), `Expected fallback slug in branch name, got "${output.branch_name}"`);
});
});
// ─────────────────────────────────────────────────────────────────────────────

View File

@@ -0,0 +1,39 @@
/**
* Quick task branching tests
*
* Validates that /gsd:quick exposes branch_name from init and that the
* workflow checks out a dedicated quick-task branch when configured.
*/
const { test, describe } = require('node:test');
const assert = require('node:assert');
const fs = require('fs');
const path = require('path');
describe('quick workflow: branching support', () => {
const workflowPath = path.join(__dirname, '..', 'get-shit-done', 'workflows', 'quick.md');
let content;
test('workflow file exists', () => {
assert.ok(fs.existsSync(workflowPath), 'workflows/quick.md should exist');
});
test('init parse list includes branch_name', () => {
content = fs.readFileSync(workflowPath, 'utf-8');
assert.ok(content.includes('branch_name'), 'quick workflow should parse branch_name from init JSON');
});
test('workflow includes quick-task branching step', () => {
content = fs.readFileSync(workflowPath, 'utf-8');
assert.ok(content.includes('Step 2.5: Handle quick-task branching'));
assert.ok(content.includes('git checkout -b "$branch_name" 2>/dev/null || git checkout "$branch_name"'));
});
test('branching step runs before task directory creation', () => {
content = fs.readFileSync(workflowPath, 'utf-8');
const branchingIndex = content.indexOf('Step 2.5: Handle quick-task branching');
const createDirIndex = content.indexOf('Step 3: Create task directory');
assert.ok(branchingIndex !== -1 && createDirIndex !== -1, 'workflow should contain both branching and directory steps');
assert.ok(branchingIndex < createDirIndex, 'branching should happen before quick task directories and commits');
});
});