docs: generate each subsystem's cordis surface into its own page; delete the flat catalogs
Rebuild of the region machinery (PR3) on the post-#904 Typert projection: renderPageRegion/renderInheritedPage live in dsh-typert-generator beside the projection; scripts/gen-cordis-catalog.ts owns the curated SERVICE_PAGE / EVENT_SCOPE_PAGE / SERVICE_WALK_EXEMPTIONS / LINK_MAP partition (fail-loud in both directions, with the independent Context-merge scan backstopping the projection's blind spot), spliceRegion, and the guarded pair auto-record. docs/cordis-catalog/ is deleted: the flat events/services catalogs dissolve into per-page regions and docs/cordis-catalog/core moves to docs/cordis-api/ with the inherited tier as its own generated page. The partition absorbs the post-regrouping surface: ctx.typert → invariants.md, ctx.directoryPicker → workspace.md, skills/* events → skills.md, and the four launcher-provided tui accessor values join the named exemptions.
This commit is contained in:
@@ -12,11 +12,13 @@ import {
|
||||
translationPairPaths,
|
||||
} from './translation-pairing-record.ts'
|
||||
import {
|
||||
blobHash,
|
||||
isTranslationScopeFile,
|
||||
pairAnchorOfArgument,
|
||||
parseTranslationMarkdown,
|
||||
parseTranslationPairingCliArgs,
|
||||
parseTranslationPairingManifest,
|
||||
partitionGeneratedRegions,
|
||||
translationStructureDiff,
|
||||
translationStructureSignature,
|
||||
} from './translation-pairing.ts'
|
||||
@@ -292,3 +294,42 @@ describe('pair CLI arguments', () => {
|
||||
expect(() => parseTranslationPairingCliArgs(['--cached', '--write', 'docs/foo.md'])).toThrow('read-only')
|
||||
})
|
||||
})
|
||||
|
||||
describe('generated regions', () => {
|
||||
const BEGIN = '<!-- BEGIN GENERATED cordis-surface (gen-cordis-catalog.ts) — do not edit between markers -->'
|
||||
const END = '<!-- END GENERATED cordis-surface -->'
|
||||
|
||||
it('partitions marker-delimited regions from the hand-owned remainder', () => {
|
||||
const doc = `# T\n\nprose\n\n${BEGIN}\ninjected\n${END}\ntail\n`
|
||||
const { regions, stripped } = partitionGeneratedRegions(doc)
|
||||
expect(regions).toEqual([`${BEGIN}\ninjected\n${END}`])
|
||||
expect(stripped).toBe('# T\n\nprose\n\ntail\n')
|
||||
})
|
||||
|
||||
it('treats a document without markers as one hand-owned remainder', () => {
|
||||
const { regions, stripped } = partitionGeneratedRegions('# T\n\nprose\n')
|
||||
expect(regions).toEqual([])
|
||||
expect(stripped).toBe('# T\n\nprose\n')
|
||||
})
|
||||
|
||||
it('rejects unbalanced or nested markers', () => {
|
||||
expect(() => partitionGeneratedRegions(`${END}\n`)).toThrow('without a BEGIN')
|
||||
expect(() => partitionGeneratedRegions(`${BEGIN}\n`)).toThrow('without an END')
|
||||
expect(() => partitionGeneratedRegions(`${BEGIN}\n${BEGIN}\n${END}\n`)).toThrow('nested')
|
||||
})
|
||||
|
||||
it('rejects mismatched slugs and malformed marker lines', () => {
|
||||
expect(() => partitionGeneratedRegions('<!-- BEGIN GENERATED a -->\nx\n<!-- END GENERATED b -->\n'))
|
||||
.toThrow("END slug 'b' does not match its BEGIN slug 'a'")
|
||||
expect(() => partitionGeneratedRegions('<!-- BEGIN GENERATED a --> trailing\nx\n<!-- END GENERATED a -->\n'))
|
||||
.toThrow('malformed generated region marker line')
|
||||
expect(() => partitionGeneratedRegions('x\n<!-- END GENERATED a --> tail\n'))
|
||||
.toThrow('malformed generated region marker line')
|
||||
})
|
||||
|
||||
it('computes the exact git blob hash', () => {
|
||||
// `git hash-object` of the empty file and of "x\n" — pinned upstream values.
|
||||
expect(blobHash(Buffer.from(''))).toBe('e69de29bb2d1d6434b8b29ae775ad8c2e48c5391')
|
||||
expect(blobHash(Buffer.from('x\n'))).toBe('587be6b4c3f93f93c489c0111bba5596147a26cb')
|
||||
})
|
||||
})
|
||||
|
||||
Reference in New Issue
Block a user