feat(acr,yaml): v5.6 Foundation — load-pattern enumeration + block-seq parser

Foundation chunk of v5.6 "steering-model II" (internal plumbing for B/C;
no command-output change, so --json/--raw/SC-5/6/7 stay byte-stable, count
stays 13).

active-config-reader.mjs:
- deriveLoadPattern(kind,{scoped}) — pure helper mapping each source kind to
  loadPattern {always,on-demand,external} + survivesCompaction {yes,no,n/a}
  + derivationConfidence {confirmed,inferred}, traced to the published
  loading model (V-rows in docs/v5.5-steering-model-plan.md).
- enumerateRules / enumerateAgents / enumerateOutputStyles — the three
  source kinds previously unenumerated (mirror enumerateSkills). Output-style
  discovery is direct (not a new file-discovery type) to keep the discovery
  surface stable.
- readActiveConfig now exposes rules/agents/outputStyles arrays + totals
  counts/subtotals (folded into grandTotal).

yaml-parser.mjs:
- parseSimpleYaml now reads YAML block sequences (paths:\n  - a), not just
  inline paths:. An empty-valued key with no `- ` items stays null
  (backcompat). Resolves a pre-existing RUL false-positive (a block-seq-scoped
  rule was misread as unscoped) — fix flows through unchanged RUL code.

Tests +35 (961 -> 996): block-seq parser cases, RUL block-seq regression
(no-misflag + durability-fires), deriveLoadPattern table, three enumerators
(positive+negative). Amended two existing ACR asserts (top-level key shape +
grandTotal sum). self-audit A/A, readmeCheck passed, mismatches []. tests
badge 961+->996+; README testing prose de-staled (635/36 -> 996/56);
CLAUDE.md Foundation note.

B (manifest/tokens render + snapshot regen) and C (CA-OST, count->14)
deferred to their own sessions/GO.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01Ter3E2JSi1Khgmuf2kady8
This commit is contained in:
Kjell Tore Guttormsen 2026-06-20 16:57:52 +02:00
commit 62d910ed6d
8 changed files with 575 additions and 25 deletions

View file

@ -88,6 +88,65 @@ describe('parseSimpleYaml', () => {
});
});
describe('parseSimpleYaml — YAML block sequences', () => {
it('parses a block-sequence value for paths', () => {
const result = parseSimpleYaml('paths:\n - src/**/*.ts\n - tests/**');
assert.deepStrictEqual(result.paths, ['src/**/*.ts', 'tests/**']);
});
it('parses a block-sequence value for globs', () => {
const result = parseSimpleYaml('globs:\n - "*.md"\n - docs/**');
assert.deepStrictEqual(result.globs, ['*.md', 'docs/**']);
});
it('parses a block-sequence value for tools', () => {
const result = parseSimpleYaml('tools:\n - Read\n - Write');
assert.deepStrictEqual(result.tools, ['Read', 'Write']);
});
it('parses a block sequence for allowed-tools and normalizes the key', () => {
const result = parseSimpleYaml('allowed-tools:\n - Read\n - Bash');
assert.deepStrictEqual(result.allowed_tools, ['Read', 'Bash']);
});
it('terminates the sequence at the next key (mixed block + inline)', () => {
const result = parseSimpleYaml('paths:\n - a\n - b\nmodel: opus');
assert.deepStrictEqual(result.paths, ['a', 'b']);
assert.strictEqual(result.model, 'opus');
});
it('strips quotes from sequence items', () => {
const result = parseSimpleYaml("paths:\n - \"src/**/*.ts\"\n - 'tests/**'");
assert.deepStrictEqual(result.paths, ['src/**/*.ts', 'tests/**']);
});
it('skips a comment line inside the sequence', () => {
const result = parseSimpleYaml('paths:\n - a\n # skip me\n - b');
assert.deepStrictEqual(result.paths, ['a', 'b']);
});
it('treats an empty-valued key with no items as null (backcompat)', () => {
const result = parseSimpleYaml('paths:\n\nmodel: opus');
assert.strictEqual(result.paths, null);
assert.strictEqual(result.model, 'opus');
});
it('keeps inline array form unchanged (regression)', () => {
const result = parseSimpleYaml('tools: [Read, Write, Bash]');
assert.deepStrictEqual(result.tools, ['Read', 'Write', 'Bash']);
});
it('keeps comma-separated form unchanged (regression)', () => {
const result = parseSimpleYaml('allowed-tools: Read, Write, Bash');
assert.deepStrictEqual(result.allowed_tools, ['Read', 'Write', 'Bash']);
});
it('keeps a bare empty-valued key null (regression)', () => {
const result = parseSimpleYaml('value: null\ntilde: ~\nempty:');
assert.strictEqual(result.empty, null);
});
});
describe('parseJson', () => {
it('parses valid JSON', () => {
const result = parseJson('{"key": "value"}');