Skip to content

Autonomous development for real products. Governed agents build from specs you approve, follow the rules you set, and nothing merges until another agent proves it. Your decisions, judgement and taste are the bar that work must clear. Declare your vision and let agents build it.

feat(train): merge additive lists, discover formats [B3,R3,C7,A5]

Corey Olson9d95ecad69b0
diff --git a/bin/update-formats.js b/bin/update-formats.js
new file mode 100644
index 00000000..3d7fb28e
--- /dev/null
+++ b/bin/update-formats.js
@@ -0,0 +1,5 @@
+/** Refresh the source-discovered format table without changing any format/version declaration [A5,C7]. */
+import { fileURLToPath } from 'node:url';
+import { writeFormatTable } from '../src/format-registry.js';
+
+writeFormatTable(fileURLToPath(new URL('../', import.meta.url)));
diff --git a/src/format-registry.js b/src/format-registry.js
new file mode 100644
index 00000000..ef3a441c
--- /dev/null
+++ b/src/format-registry.js
@@ -0,0 +1,63 @@
+/** Discover format documentation from source-owned declarations, never a parallel hand-maintained table [A5,C7]. */
+import {
+ readFileSync,
+ readdirSync,
+ writeFileSync,
+} from 'node:fs';
+import { join } from 'node:path';
+
+/** Read one existing numeric version without loading board writers or executing a declaration. */
+function versionAt(root, source) {
+ if (source?.kind === 'engines') {
+ const values = readdirSync(join(root, 'src')).filter(file => /^[a-z][a-z0-9-]*-engine\.js$/u.test(file))
+ .flatMap(file => [...readFileSync(join(root, 'src', file), 'utf8').matchAll(/^export const [A-Z][A-Z0-9_]*_ENGINE = (\d+|unassignedEngine\(\));$/gmu)].map(match => match[1]));
+ const highest = Math.max(1, ...values.filter(value => /^\d+$/u.test(value)).map(Number));
+ return highest + (values.includes('unassignedEngine()') ? 1 : 0);
+ }
+ if (!/^src\/[a-z][a-z0-9-]*\.js$/u.test(source?.file ?? '')) throw new Error('format version source must name its source module');
+ const text = readFileSync(join(root, source.file), 'utf8');
+ const pattern = source.kind === 'catalog' ? /^ version: (\d+),$/gmu
+ : source.kind === 'constant' && /^[A-Z][A-Z0-9_]*$/u.test(source.constant ?? '')
+ ? new RegExp(`^export const ${source.constant} = (\\d+);$`, 'gmu') : null;
+ const matches = pattern ? [...text.matchAll(pattern)] : [];
+ if (matches.length !== 1) throw new Error(`format version is not one declared constant in ${source.file}`);
+ return Number(matches[0][1]);
+}
+
+/** Read strict, independently added format declarations in deterministic historical order. */
+export function discoverFormats(root) {
+ const files = readdirSync(join(root, 'src', 'formats')).filter(file => file.endsWith('.json')).sort();
+ const names = new Set();
+ const formats = files.map(file => {
+ if (!/^[a-z][a-z0-9-]*\.json$/u.test(file)) throw new Error(`invalid format declaration ${file}`);
+ const entry = JSON.parse(readFileSync(join(root, 'src', 'formats', file), 'utf8'));
+ if (!entry || typeof entry.name !== 'string' || !entry.name || entry.name.includes('`') || names.has(entry.name)
+ || !Number.isSafeInteger(entry.order) || entry.order < 0
+ || [entry.name, entry.source, entry.upgrade].some(value => typeof value !== 'string' || !value || /[\r\n|]/u.test(value))) {
+ throw new Error(`invalid or duplicate format declaration ${file}`);
+ }
+ names.add(entry.name);
+ const version = versionAt(root, entry.version);
+ if (!Number.isSafeInteger(version) || version < 1) throw new Error(`invalid format version in ${file}`);
+ return { ...entry, version };
+ });
+ return formats.sort((a, b) => a.order - b.order || (a.name < b.name ? -1 : a.name > b.name ? 1 : 0));
+}
+
+/** Generate the table from its actual version sources and adjacent format declarations. */
+export function formatTable(root) {
+ return ['| Format | Version | Version source | Upgrade rule |', '| --- | --- | --- | --- |',
+ ...discoverFormats(root).map(entry => `| \`${entry.name}\` | \`${entry.version}\` | ${entry.source} | ${entry.upgrade} |`)].join('\n');
+}
+
+/** Refresh only the documented generated region, retaining every surrounding documentation byte. */
+export function writeFormatTable(root) {
+ const path = join(root, 'docs', 'formats.md');
+ const before = readFileSync(path, 'utf8');
+ const pattern = /(<!-- format-versions:start -->\n)[\s\S]*?(\n<!-- format-versions:end -->)/u;
+ if (!pattern.test(before)) throw new Error('format guide needs its generated version-table markers');
+ const after = before.replace(pattern, (_, start, end) => start + formatTable(root) + end);
+ if (before === after) return false;
+ writeFileSync(path, after);
+ return true;
+}
diff --git a/src/formats/board-schema.json b/src/formats/board-schema.json
new file mode 100644
index 00000000..a828b7f9
--- /dev/null
+++ b/src/formats/board-schema.json
@@ -0,0 +1,11 @@
+{
+ "name": "board schema",
+ "order": 30,
+ "version": {
+ "kind": "constant",
+ "file": "src/board-schema-source.js",
+ "constant": "SCHEMA_VERSION"
+ },
+ "source": "`SCHEMA_VERSION` in `src/board.js`, persisted as `PRAGMA user_version`",
+ "upgrade": "On a write open of a board whose version is behind: create missing tables and indexes (version 3 adds the hot-path indexes), add missing columns in place with declared defaults, restore missing or changed triggers, and remove stale machine triggers without replacing rows. Read opens never migrate; a board at the current version whose shape differs is reported once on stderr and left as it is."
+}
diff --git a/src/formats/cli-json.json b/src/formats/cli-json.json
new file mode 100644
index 00000000..ed453201
--- /dev/null
+++ b/src/formats/cli-json.json
@@ -0,0 +1,10 @@
+{
+ "name": "CLI JSON envelope",
+ "order": 10,
+ "version": {
+ "kind": "catalog",
+ "file": "src/json.js"
+ },
+ "source": "`JSON_SHAPES.version` in `src/json.js`",
+ "upgrade": "Keep optional fields additive within version 1; bump the envelope version for incompatible command/export shapes."
+}
diff --git a/src/formats/event-log.json b/src/formats/event-log.json
new file mode 100644
index 00000000..88f1a06f
--- /dev/null
+++ b/src/formats/event-log.json
@@ -0,0 +1,11 @@
+{
+ "name": "event log",
+ "order": 40,
+ "version": {
+ "kind": "constant",
+ "file": "src/board-schema-source.js",
+ "constant": "EVENT_LOG_VERSION"
+ },
+ "source": "`EVENT_LOG_VERSION` in `src/board.js`, persisted in `board_meta` as `event_log_version`",
+ "upgrade": "Older event-log versions upgrade in place; newer versions are refused with `EVENT_LOG_VERSION`. Preserve event rows when the board schema changes."
+}
diff --git a/src/formats/move-engine.json b/src/formats/move-engine.json
new file mode 100644
index 00000000..873a3759
--- /dev/null
+++ b/src/formats/move-engine.json
@@ -0,0 +1,9 @@
+{
+ "name": "move engine",
+ "order": 50,
+ "version": {
+ "kind": "engines"
+ },
+ "source": "`ENGINE_VERSION` in `src/machine.js`, carried as `engine` in every sealed executable move",
+ "upgrade": "Bump when a move's meaning changes, independently of the event log and sealed envelope. A newer engine is refused with `ENGINE_VERSION`, naming both versions and asking you to upgrade Pullboard."
+}
diff --git a/src/formats/row-grammar.json b/src/formats/row-grammar.json
new file mode 100644
index 00000000..1d171e47
--- /dev/null
+++ b/src/formats/row-grammar.json
@@ -0,0 +1,11 @@
+{
+ "name": "row grammar",
+ "order": 20,
+ "version": {
+ "kind": "constant",
+ "file": "src/spec.js",
+ "constant": "SPEC_GRAMMAR_VERSION"
+ },
+ "source": "`SPEC_GRAMMAR_VERSION` in `src/spec.js`; optional `<!-- pullboard-grammar N -->` line in either file (absence means the current grammar)",
+ "upgrade": "Both files share the version. A declared version must match; an incompatible grammar change requires a coordinated version bump and compatible files. No automatic conversion occurs."
+}
diff --git a/src/land.js b/src/land.js
index 6a0c5943..5b3a25b8 100644
--- a/src/land.js
+++ b/src/land.js
@@ -5,6 +5,8 @@ import {
} from './land-collisions.js';
/** Coordinator landing batches retain exact Git and gate receipts across interruptions [B3,R3]. */
import { assignEngineNumbers } from './engine-numbers.js';
+import { resolveMechanicalMerge } from './train-mechanical-merge.js';
+import { writeFormatTable } from './format-registry.js';
import {
createHash,
randomUUID,
@@ -241,7 +243,9 @@ function candidates(board, root, base, maximum, { firstReady = false } = {}) {
/** Append a durable snapshot before or after each external side effect. */
async function save(state, patch) {
const conflicts = [...new Map([...(state.batch.conflicts ?? []), ...(patch.conflicts ?? [])].map((entry) => [entry.id, entry])).values()];
- state.batch = await state.write('recordLandingBatch', [{ agentId: 'coordinator', batch: { ...state.batch, ...patch, conflicts }, revision: state.batch.revision ?? 0 }]);
+ const resolutions = [...new Map([...(state.batch.resolutions ?? []), ...(patch.resolutions ?? [])]
+ .map(entry => [JSON.stringify(entry), entry])).values()];
+ state.batch = await state.write('recordLandingBatch', [{ agentId: 'coordinator', batch: { ...state.batch, ...patch, conflicts, resolutions }, revision: state.batch.revision ?? 0 }]);
return state.batch;
}
@@ -253,6 +257,7 @@ async function mergeGroup(state, items) {
git(batch.root, ['checkout', '--detach', batch.base]);
const merged = [];
const conflicts = [];
+ const resolutions = [];
for (const entry of items) {
await state.checkLease();
const item = store.getItem(state.board, entry.id ?? entry.item_id);
@@ -267,13 +272,23 @@ async function mergeGroup(state, items) {
if (result.status !== 0) {
const files = tryGit(batch.root, ['diff', '--name-only', '--diff-filter=U']).stdout.split('\n').filter(Boolean);
if (!files.length) throw new Refused('LAND_MERGE', `merge of #${item.item_id} failed outside a conflict: ${result.stderr || result.stdout}; inspect ${batch.root} and its hooks before adopting`);
- git(batch.root, ['merge', '--abort']);
- conflicts.push({ id: item.item_id, files });
- state.say(`conflict #${item.item_id}: ${files.join(', ')}`);
- continue;
+ const resolved = resolveMechanicalMerge(batch.root, files);
+ if (resolved) {
+ git(batch.root, ['add', '--', ...files]);
+ git(batch.root, ['commit', '--no-edit']);
+ resolutions.push({ id: item.item_id, files, entries: resolved });
+ state.say(`mechanical merge #${item.item_id}: ${files.join(', ')}`);
+ } else {
+ git(batch.root, ['merge', '--abort']);
+ conflicts.push({ id: item.item_id, files, commit: item.item_commit, reviewedCommit: checked });
+ state.say(`conflict #${item.item_id}: ${files.join(', ')}`);
+ continue;
+ }
}
// An engine the item added without a number gets the next one now, in landing order, inside its own merge (#1101).
const engines = assignEngineNumbers(batch.root);
+ if (existsSync(join(batch.root, 'src', 'formats')) && existsSync(join(batch.root, 'docs', 'formats.md'))
+ && writeFormatTable(batch.root) && !engines.files.includes('docs/formats.md')) engines.files.push('docs/formats.md');
if (engines.files.length) {
git(batch.root, ['add', '--', ...engines.files]);
git(batch.root, ['commit', '--amend', '--no-edit']);
@@ -308,7 +323,7 @@ async function mergeGroup(state, items) {
throw error;
}
for (const change of doctrineCounts) state.say(`doctrine ${change.id}: ${change.before} -> ${change.count}`);
- return { items: merged, conflicts, tip: headCommit(batch.root), doctrineCounts };
+ return { items: merged, conflicts, resolutions, tip: headCommit(batch.root), doctrineCounts };
}
/** Read positive TAP completion counts while rejecting the canonical runner's incomplete accounts. */
@@ -897,6 +912,17 @@ async function returnCulprits(state) {
}
}
+/** Reopen only exact saved conflicting submissions after candidate composition has completed. */
+async function returnMergeConflicts(state) {
+ for (const conflict of state.batch.conflicts ?? []) {
+ const item = store.getItem(state.board, conflict.id);
+ if (item.item_status !== 'verified' || item.item_merged_commit || item.item_commit !== conflict.commit
+ || store.checkedLandingCommit(state.board, item) !== conflict.reviewedCommit) continue;
+ await state.write('reopen', [item.item_id, { agentId: 'coordinator',
+ note: `landing conflict: ${conflict.files.join(', ')}; merge current main and resubmit`, conflict: conflict.files }]);
+ }
+}
+
/** File a flake once against its named test and leave the batch stopped. */
async function fileFlakes(state, gate, files) {
if (state.config.flakes?.rerun === true) {
@@ -1322,6 +1348,7 @@ export async function runLandingBatch({ root, board, config, write, say, owner,
if (!existsSync(state.batch.root)) throw new Refused('LAND_WORKTREE', `the recorded landing worktree is missing at ${state.batch.root}; restore it before adopting`);
if (state.config.landing?.parallel === true) {
await parallelLanding(state, initialItems);
+ await returnMergeConflicts(state);
return { batch: state.batch, landed: state.batch.state === 'landed' ? state.batch.items.map(entry => entry.id) : [],
conflicts: state.batch.conflicts ?? [], blocked: state.batch.blocked ?? [], culprits: state.culprits, flakes: state.batch.flakes ?? [] };
}
@@ -1372,6 +1399,7 @@ export async function runLandingBatch({ root, board, config, write, say, owner,
if (!(error instanceof Refused) || error.code !== 'LAND_GATE_TIMEOUT') throw error;
say(error.message);
}
+ await returnMergeConflicts(state);
return { batch: state.batch, landed: state.batch.state === 'landed' ? state.batch.items.map((entry) => entry.id) : [],
conflicts: state.batch.conflicts ?? [], blocked: state.batch.blocked ?? [], culprits: state.culprits, flakes: state.batch.flakes ?? [] };
}
diff --git a/src/train-mechanical-merge.js b/src/train-mechanical-merge.js
new file mode 100644
index 00000000..0e725745
--- /dev/null
+++ b/src/train-mechanical-merge.js
@@ -0,0 +1,106 @@
+/** Conservative additive-only resolution of explicitly known registry/table regions [B3,R3,C7]. */
+import { writeFileSync } from 'node:fs';
+import { spawnSync } from 'node:child_process';
+import { join } from 'node:path';
+import { cleanGitEnvironment } from './git.js';
+
+/** Locate a known keyed region without interpreting or executing candidate JavaScript. */
+function region(path, source) {
+ const lines = source.split('\n');
+ let start;
+ let end;
+ let key;
+ if (path === 'src/api-moves.js') {
+ start = lines.indexOf('const MOVES = {');
+ end = lines.indexOf('};', start + 1);
+ const field = "(?:[A-Za-z][A-Za-z0-9]*): (?:true|false|\\[(?:'[A-Za-z0-9-]+'(?:, '[A-Za-z0-9-]+')*)?\\])";
+ const entry = new RegExp(`^ (?:'([a-z][a-z0-9-]*)'|([A-Za-z][A-Za-z0-9]*)): \\{ ${field}(?:, ${field})* \\},$`, 'u');
+ key = line => entry.exec(line)?.slice(1).find(Boolean);
+ } else if (path === 'docs/formats.md') {
+ start = lines.indexOf('| Format | Version | Version source | Upgrade rule |');
+ if (lines[start + 1] !== '| --- | --- | --- | --- |') return null;
+ start += 1;
+ end = lines.indexOf('<!-- format-versions:end -->', start + 1);
+ key = line => /^\| `([^`|]+)` \| `\d+` \| .+ \| .+ \|$/u.exec(line)?.[1];
+ } else return null;
+ if (start < 0 || end <= start) return null;
+ const entries = lines.slice(start + 1, end).map(line => ({ key: key(line), line }));
+ if (entries.some(entry => !entry.key) || new Set(entries.map(entry => entry.key)).size !== entries.length) return null;
+ return { prefix: lines.slice(0, start + 1).join('\n'), suffix: lines.slice(end).join('\n'), entries };
+}
+
+/** Only insertions are admissible: every original entry and every surrounding byte stays unchanged. */
+function additions(base, side) {
+ if (!side || side.prefix !== base.prefix || side.suffix !== base.suffix) return null;
+ const original = new Map(base.entries.map(entry => [entry.key, entry.line]));
+ let position = 0;
+ const gaps = Array.from({ length: base.entries.length + 1 }, () => []);
+ for (const entry of side.entries) {
+ if (original.has(entry.key)) {
+ if (base.entries[position]?.key !== entry.key || original.get(entry.key) !== entry.line) return null;
+ position += 1;
+ } else gaps[position].push(entry);
+ }
+ return position === base.entries.length ? gaps : null;
+}
+
+/** Preserve both contributors' entry order, using the key only to break independent insertion ties. */
+function mergeGap(left, right) {
+ const entries = new Map();
+ const edges = new Map();
+ for (const side of [left, right]) {
+ for (const entry of side) {
+ if (entries.has(entry.key) && entries.get(entry.key) !== entry.line) return null;
+ entries.set(entry.key, entry.line);
+ if (!edges.has(entry.key)) edges.set(entry.key, new Set());
+ }
+ for (let index = 1; index < side.length; index += 1) edges.get(side[index - 1].key).add(side[index].key);
+ }
+ const result = [];
+ while (entries.size) {
+ const key = [...entries.keys()].sort().find(candidate => ![...edges.values()].some(next => next.has(candidate)));
+ if (key === undefined) return null;
+ result.push({ key, line: entries.get(key) });
+ entries.delete(key);
+ edges.delete(key);
+ }
+ return result;
+}
+
+/** Return a union only when all three exact sources differ solely by permitted keyed insertions. */
+export function mergeMechanicalSources(path, ancestor, ours, theirs) {
+ const base = region(path, ancestor);
+ if (!base) return null;
+ const left = additions(base, region(path, ours));
+ const right = additions(base, region(path, theirs));
+ if (!left || !right) return null;
+ const locations = new Map();
+ const entries = [];
+ for (let index = 0; index < left.length; index += 1) {
+ const gap = mergeGap(left[index], right[index]);
+ if (!gap) return null;
+ for (const entry of gap) {
+ if (locations.has(entry.key) && locations.get(entry.key) !== index) return null;
+ locations.set(entry.key, index);
+ entries.push(entry);
+ }
+ if (base.entries[index]) entries.push(base.entries[index]);
+ }
+ if (!locations.size) return null;
+ return { source: [base.prefix, ...entries.map(entry => entry.line), base.suffix].join('\n'), keys: [...locations.keys()] };
+}
+
+/** Resolve every unmerged file together, or leave the entire merge untouched for normal reopening. */
+export function resolveMechanicalMerge(root, files) {
+ const resolutions = [];
+ for (const path of files) {
+ const stages = [1, 2, 3].map(stage => spawnSync('git', ['--no-optional-locks', 'show', `:${stage}:${path}`],
+ { cwd: root, env: cleanGitEnvironment(), encoding: 'utf8' }));
+ if (stages.some(stage => stage.status !== 0)) return null;
+ const merged = mergeMechanicalSources(path, ...stages.map(stage => stage.stdout));
+ if (!merged) return null;
+ resolutions.push({ path, ...merged });
+ }
+ for (const entry of resolutions) writeFileSync(join(root, entry.path), entry.source);
+ return resolutions.map(({ path, keys }) => ({ path, keys }));
+}
diff --git a/test/train-mechanical-merge.test.js b/test/train-mechanical-merge.test.js
index 03607891..3a39a267 100644
--- a/test/train-mechanical-merge.test.js
+++ b/test/train-mechanical-merge.test.js
@@ -1,17 +1,30 @@
+/** @pullboard-test-input source-tree */
/** Real train merges retain additive registry changes and refuse edits [B3,R3,C7]. */
import assert from 'node:assert/strict';
import {
mkdirSync,
+ cpSync,
+ mkdtempSync,
readFileSync,
+ rmSync,
writeFileSync,
} from 'node:fs';
import { join } from 'node:path';
+import { tmpdir } from 'node:os';
+import { pathToFileURL } from 'node:url';
import {
after,
test,
} from 'node:test';
import { createE2eHelpers } from './e2e-helpers.js';
import { json } from './land-board-fixture.js';
+import { mergeMechanicalSources } from '../src/train-mechanical-merge.js';
+import {
+ discoverFormats,
+ formatTable,
+ writeFormatTable,
+} from '../src/format-registry.js';
+import { discoverMoves } from '../src/move-registry.js';
const e2e = createE2eHelpers();
after(e2e.cleanup);
@@ -86,3 +99,50 @@ test('a registry edit remains a conflict and reopens instead of being unioned [B
assert.equal(json(box, box.repo, 'show', String(second)).item_status, 'open');
assert.deepEqual(landed.landed, [first]);
});
+
+test('mechanical resolution refuses changed context, duplicate disagreements and unknown files [B3,R3,C7]', () => {
+ const alpha = BASE.replace(' base:', ' alpha: { item: true },\n base:');
+ const beta = BASE.replace(' base:', ' beta: { item: true },\n base:');
+ assert.ok(mergeMechanicalSources(FILE, BASE, alpha, beta));
+ for (const changed of [beta.replace('item: true', 'item: false'), beta + '// changed context\n',
+ BASE.replace(' base:', ' alpha: { item: false },\n base:'),
+ BASE.replace(' base:', ' beta: { item: true }; steal(); { item: true },\n base:')]) {
+ assert.equal(mergeMechanicalSources(FILE, BASE, alpha, changed), null);
+ }
+ assert.equal(mergeMechanicalSources('src/unknown.js', BASE, alpha, beta), null);
+ const header = '<!-- format-versions:start -->\n| Format | Version | Version source | Upgrade rule |\n| --- | --- | --- | --- |\n';
+ const table = header + '| `base` | `1` | source | preserve |\n<!-- format-versions:end -->\n';
+ const inserted = name => table.replace('| `base`', `| \`${name}\` | \`1\` | source | preserve |\n| \`base\``);
+ assert.match(mergeMechanicalSources('docs/formats.md', table, inserted('alpha'), inserted('beta')).source, /`alpha`[\s\S]*`beta`[\s\S]*`base`/u);
+ assert.equal(mergeMechanicalSources('docs/formats.md', table, inserted('alpha'), table.replace('`1`', '`2`')), null);
+});
+
+test('new format declarations and move files are discovered without a shared registry edit [A5,C7,V4]', async t => {
+ const root = mkdtempSync(join(tmpdir(), 'pullboard-format-discovery-'));
+ t.after(() => rmSync(root, { recursive: true, force: true }));
+ mkdirSync(join(root, 'src'));
+ cpSync(new URL('../src/formats/', import.meta.url), join(root, 'src', 'formats'), { recursive: true });
+ for (const file of ['json.js', 'spec.js', 'board-schema-source.js'])
+ cpSync(new URL('../src/' + file, import.meta.url), join(root, 'src', file));
+ writeFileSync(join(root, 'src', 'fixture-engine.js'), 'export const FIXTURE_ENGINE = 110;\n');
+ const original = discoverFormats(root);
+ assert.equal(original.length, 5);
+ writeFileSync(join(root, 'src', 'formats', 'fixture.json'), JSON.stringify({ name: 'fixture', order: 60,
+ version: { kind: 'constant', file: 'src/fixture.js', constant: 'FIXTURE_VERSION' }, source: '`FIXTURE_VERSION`', upgrade: 'preserve' }));
+ writeFileSync(join(root, 'src', 'fixture.js'), 'export const FIXTURE_VERSION = 7;\n');
+ assert.equal(discoverFormats(root).find(entry => entry.name === 'fixture').version, 7);
+ mkdirSync(join(root, 'docs'));
+ const guide = 'before\n<!-- format-versions:start -->\nstale\n<!-- format-versions:end -->\nafter\n';
+ writeFileSync(join(root, 'docs', 'formats.md'), guide);
+ assert.equal(writeFormatTable(root), true);
+ assert.equal(readFileSync(join(root, 'docs', 'formats.md'), 'utf8'), guide.replace('stale', formatTable(root)));
+ assert.equal(writeFormatTable(root), false);
+ writeFileSync(join(root, 'src', 'fixture.js'), 'export const FIXTURE_VERSION = 8;\n');
+ assert.equal(writeFormatTable(root), true);
+ assert.match(readFileSync(join(root, 'docs', 'formats.md'), 'utf8'), /`fixture` \| `8`/u);
+ const moves = join(root, 'moves');
+ mkdirSync(moves);
+ for (const operation of ['alpha', 'beta']) writeFileSync(join(moves, operation + '.js'),
+ `export default {operation: '${operation}', engine: 1, itemIdFirstArgument: false, minimumEngine: () => 1, actor: () => null, nextSteps: {}};\n`);
+ assert.deepEqual((await discoverMoves(pathToFileURL(moves + '/'))).operations, ['alpha', 'beta']);
+});