Files
msd-core/tests/autonomous-allowed-tools.test.cjs
Jakub Zych a9a7a328e6 refactor: hard-fork GSD -> MSD (Make Software Done)
Mechanical rename produced by scripts/msd-rename.cjs: gsd/Gsd/GSD -> msd/Msd/MSD
across contents and paths, upstream package/repo coordinates -> @golem15/msd-core
and golem15com/msd-core. Deep links into upstream history, sibling upstream
packages, the GSD-2 import feature, CHANGELOG.md and .changeset/ are kept as-is.

Hand edits on top: MSD block-letter banner and logos, LICENSE copyright line,
package/plugin identity, regenerated lockfile, install-tree fixtures, derived
registries and benchmark baseline; migration checksum baseline re-locked
(MSD keeps its own install state, so no install had applied the old sums);
sort-order and regex-escaped expectations in tests adjusted.
2026-10-06 01:47:40 +02:00

42 lines
1.7 KiB
JavaScript

/**
* Regression test for #2043 — autonomous.md must include Agent in allowed-tools.
*
* The msd-autonomous skill spawns background agents via Agent(..., run_in_background=true).
* Without Agent in allowed-tools the runtime rejects those calls silently.
*/
'use strict';
const { describe, test } = require('node:test');
const assert = require('node:assert/strict');
const fs = require('fs');
const path = require('path');
// allow-test-rule: source-text-is-the-product
// commands/msd/autonomous.md is the installed command — its frontmatter is what Claude Code
// reads at runtime to enforce allowed-tools. Checking text content IS checking the contract.
describe('commands/msd/autonomous.md allowed-tools', () => {
test('includes Agent in allowed-tools list', () => {
const filePath = path.join(__dirname, '..', 'commands', 'msd', 'autonomous.md');
const content = fs.readFileSync(filePath, 'utf-8');
// Extract the YAML frontmatter block between the first pair of --- delimiters
// eslint-disable-next-line local/no-unbounded-quantifier -- parses this repo's own command .md frontmatter, fixed-size author-controlled content
const frontmatterMatch = content.match(/^---\r?\n([\s\S]*?)\r?\n---/);
assert.ok(frontmatterMatch, 'autonomous.md must have YAML frontmatter');
const frontmatter = frontmatterMatch[1];
// Parse the allowed-tools list items (lines starting with " - ")
const toolLines = frontmatter
.split(/\r?\n/)
.filter((line) => /^\s+-\s+/.test(line))
.map((line) => line.replace(/^\s+-\s+/, '').trim());
assert.ok(
toolLines.includes('Agent'),
`allowed-tools must include "Agent" but found: [${toolLines.join(', ')}]`
);
});
});