Files
get-shit-done/tests/scan-command.test.cjs
Tibsfox 4c8719d84a feat(commands): add /gsd-scan for rapid single-focus codebase assessment (#1808)
Lightweight alternative to /gsd-map-codebase that spawns a single
mapper agent for one focus area instead of four parallel agents.
Supports --focus flag with 5 options: tech, arch, quality, concerns,
and tech+arch (default). Checks for existing documents and prompts
before overwriting.

Closes #1733

Co-authored-by: Claude Opus 4.6 <noreply@anthropic.com>
2026-04-05 17:04:33 -04:00

53 lines
2.4 KiB
JavaScript

const { describe, test } = require('node:test');
const assert = require('node:assert/strict');
const fs = require('fs');
const path = require('path');
describe('scan command', () => {
test('command file exists with correct name and description', () => {
const p = path.join(__dirname, '..', 'commands', 'gsd', 'scan.md');
assert.ok(fs.existsSync(p), 'commands/gsd/scan.md should exist');
const content = fs.readFileSync(p, 'utf-8');
assert.ok(content.includes('name: gsd:scan'), 'Command must have name: gsd:scan');
assert.ok(content.includes('description:'), 'Command must have description frontmatter');
assert.ok(content.includes('Rapid codebase assessment') || content.includes('lightweight alternative'),
'Description should mention rapid/lightweight assessment');
});
test('workflow file exists', () => {
const p = path.join(__dirname, '..', 'get-shit-done', 'workflows', 'scan.md');
assert.ok(fs.existsSync(p), 'get-shit-done/workflows/scan.md should exist');
});
test('workflow has focus-to-document mapping table', () => {
const p = path.join(__dirname, '..', 'get-shit-done', 'workflows', 'scan.md');
const content = fs.readFileSync(p, 'utf-8');
assert.ok(content.includes('Focus-to-Document Mapping') || content.includes('Focus | Documents'),
'Workflow should contain a focus-to-document mapping table');
});
test('all 5 focus areas are documented', () => {
const p = path.join(__dirname, '..', 'get-shit-done', 'workflows', 'scan.md');
const content = fs.readFileSync(p, 'utf-8');
const focusAreas = ['tech', 'arch', 'quality', 'concerns', 'tech+arch'];
for (const area of focusAreas) {
assert.ok(content.includes(`\`${area}\``),
`Workflow should document the "${area}" focus area`);
}
});
test('overwrite prompt is mentioned', () => {
const p = path.join(__dirname, '..', 'get-shit-done', 'workflows', 'scan.md');
const content = fs.readFileSync(p, 'utf-8');
assert.ok(content.includes('Overwrite') || content.includes('overwrite'),
'Workflow should mention overwrite prompt for existing documents');
});
test('workflow references gsd-codebase-mapper', () => {
const p = path.join(__dirname, '..', 'get-shit-done', 'workflows', 'scan.md');
const content = fs.readFileSync(p, 'utf-8');
assert.ok(content.includes('gsd-codebase-mapper'),
'Workflow should reference the gsd-codebase-mapper agent');
});
});