Files
msd-core/tests/bug-14-progress-auto-flag-dropped.test.cjs
Tom Boucher d8b432da1e fix(#14): wire --auto flag through progress→next handoff (#148)
* fix(#14): document --auto in progress.md and wire chaining logic in next.md

The --auto flag was accepted by /gsd:progress --next --auto but silently
ignored: it was not documented in the <flags> section of progress.md and
had no handling in the next.md show_and_execute step, so it was dropped
at the handoff boundary and never produced step chaining.

- Add --auto and --next --auto entries to progress.md <flags>
- Update progress.md <process> to explicitly list --auto as a passthrough arg
- Add --auto chaining logic to next.md show_and_execute: after each step
  completes, re-invoke /gsd:progress --next --auto until milestone complete
  or a blocking decision is required
- Add regression test (4 assertions) covering all three fix points

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>

* fix(#14): bump lint-test-file-count progress ceiling for bug-14 test

bug-14-progress-auto-flag-dropped.test.cjs resolves to the "progress"
effective prefix and legitimately grows the cluster to 6.

Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>

* chore(#14): add changeset fragment

Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>

* fix(#14): address review feedback — differentiate duplicate tests, scope assertions to specific blocks

Test 2 now extracts the <process> block and asserts --auto within it,
distinguishing it from test 1's <flags>-level check. Remaining assertions
use semantic token matches (--auto, --next --auto) that are robust to
benign reformatting.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>

---------

Co-authored-by: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-05-23 18:10:19 -04:00

74 lines
2.4 KiB
JavaScript

// allow-test-rule: source-text-is-the-product
// The command markdown is loaded directly by runtime prompt assembly.
// This test verifies that --auto is documented in progress.md and handled in next.md.
'use strict';
const { test, describe } = require('node:test');
const assert = require('node:assert/strict');
const fs = require('node:fs');
const path = require('node:path');
const ROOT = path.join(__dirname, '..');
describe('#14: /gsd:progress --next --auto flag must be documented and propagated', () => {
test('progress.md <flags> section documents --auto flag', () => {
const command = fs.readFileSync(
path.join(ROOT, 'commands', 'gsd', 'progress.md'),
'utf8'
);
assert.ok(
command.includes('--auto'),
'progress.md must document the --auto flag in the <flags> section'
);
});
test('progress.md <process> block explicitly passes --auto through to next workflow', () => {
const command = fs.readFileSync(
path.join(ROOT, 'commands', 'gsd', 'progress.md'),
'utf8'
);
// Extract only the <process>…</process> block so this assertion is
// scoped to the handoff wiring, not just any occurrence in the file.
const processMatch = command.match(/<process>([\s\S]*?)<\/process>/);
assert.ok(
processMatch,
'progress.md must contain a <process> block'
);
const processBlock = processMatch[1];
assert.ok(
processBlock.includes('--auto'),
'progress.md <process> block must explicitly mention --auto so it is not silently stripped at the --next handoff'
);
});
test('next.md show_and_execute step handles --auto to chain steps', () => {
const workflow = fs.readFileSync(
path.join(ROOT, 'get-shit-done', 'workflows', 'next.md'),
'utf8'
);
assert.ok(
workflow.includes('--auto'),
'next.md must handle the --auto flag to chain step invocations automatically'
);
});
test('next.md --auto chaining re-invokes /gsd:progress --next after step completion', () => {
const workflow = fs.readFileSync(
path.join(ROOT, 'get-shit-done', 'workflows', 'next.md'),
'utf8'
);
// The workflow must contain instructions to re-invoke /gsd:progress --next --auto
// after the determined step completes, enabling the chain.
assert.ok(
workflow.includes('--next --auto'),
'next.md must instruct re-invocation of /gsd:progress --next --auto after step completion to enable chaining'
);
});
});