Line

You are reading the unreleased docs (next). See latest (v0.9)

ui/server/src/storyFrontMatter

A minimal, targeted reader/writer for ONLY the sources: [{url, parse}] front matter shape documented in docs/design/ia-five-screens.md section 9.2.

Cockpit server, next. Source: ui/server/src/storyFrontMatter.mjs.

Classes#

StoryFrontMatterError#

Defined in: ui/server/src/storyFrontMatter.mjs:25

Extends#

  • Error

Constructors#

Constructor

new StoryFrontMatterError(message?): StoryFrontMatterError

Defined in: ../../../home/runner/work/construct/construct/node_modules/typescript/lib/lib.es5.d.ts:1082

Parameters
message?

string

Returns

StoryFrontMatterError

Inherited from

Error.constructor

Constructor

new StoryFrontMatterError(message?, options?): StoryFrontMatterError

Defined in: ../../../home/runner/work/construct/construct/node_modules/typescript/lib/lib.es5.d.ts:1082

Parameters
message?

string

options?

ErrorOptions

Returns

StoryFrontMatterError

Inherited from

Error.constructor

Functions#

mergeStorySource()#

mergeStorySource(text, __namedParameters): object

Defined in: ui/server/src/storyFrontMatter.mjs:30

Merges one proposed {url, parse} into sources: updates the parse of an existing entry with the same url, or appends a new entry. Never touches body (user text) or any other front-matter key. Returns {before, after, changed} so the caller can show a diff; after is the full file text.

Parameters#

text

any

__namedParameters
parse

any

url

any

Returns#

object

after

after: string

before

before: any

changed

changed: boolean


mergeStoryValues()#

mergeStoryValues(text, __namedParameters): object

Defined in: ui/server/src/storyFrontMatter.mjs:49

-- the same merge as mergeStorySource, but for one AI-extracted "values" result (design 9.6, "extraction on every use") instead of a proposed parse. Stored alongside parse on the matching sources entry as values, so a reviewer can see both the selector pattern (if any) and the last verified extraction for the same url. Never touches body or any other front-matter key; refuses to merge onto a url with no existing sources entry (there is nothing to attach the values to).

Parameters#

text

any

__namedParameters
url

any

values

any

Returns#

object

after

after: string

before

before: any

changed

changed: boolean


readStoryFile()#

readStoryFile(text): object

Defined in: ui/server/src/storyFrontMatter.mjs:12

{frontMatter: object, body: string, hadFrontMatter: boolean} -- frontMatter is {} when the file has none.

Parameters#

text

any

Returns#

object

body

body: any

frontMatter

frontMatter: any

hadFrontMatter

hadFrontMatter: boolean = true