Interface: MdNamespace
Defined in: markdown/src/builders/md-namespace-contract.ts:11
Public builder namespace contract for @paraharness/markdown (md.*).
Exposes pure, side-effect-free builders compiling Markdown files and globs into passive MarkdownFrontmatterSourceNode and MarkdownSectionSourceNode AST descriptors.
Methods
frontmatter()
frontmatter<T>(pathOrGlob, kind?): MdFrontmatterSourceBuilder<T>;Defined in: markdown/src/builders/md-namespace-contract.ts:85
Loads raw or typed YAML frontmatter and Markdown body from pathOrGlob.
Compiles to a passive MarkdownFrontmatterSourceNode<T> with id: "md:${kind}:${pathOrGlob}".
Type Parameters
| Type Parameter | Default type | Description |
|---|---|---|
T | unknown | Resolved frontmatter payload type. |
Parameters
| Parameter | Type | Description |
|---|---|---|
pathOrGlob | string | Host-root-relative file path or glob pattern. |
kind? | NonNullable< | "global-rules" | "scoped-rule" | "scoped-rules" | "skill" | "skills" | "frontmatter" | undefined> | Optional loader kind discriminant ('frontmatter' default). |
Returns
Frozen frontmatter source builder.
globalRules()
globalRules(glob): MdFrontmatterSourceBuilder<readonly object[]>;Defined in: markdown/src/builders/md-namespace-contract.ts:21
Loads always-on GlobalRule[] records from Markdown files matching glob.
Resolves glob against the immutable host repository root and validates each file with GlobalRuleSchema.
Parameters
| Parameter | Type | Description |
|---|---|---|
glob | string | Host-root-relative path or glob pattern targeting global rule Markdown files. |
Returns
MdFrontmatterSourceBuilder<readonly object[]>
Frozen global rules source builder.
scopedRule()
scopedRule(path): MdFrontmatterSourceBuilder<{
checks: BuiltInCheckASTNode<unknown>[];
directive: string;
id: string;
when: {
effects?: FsGlobMatcherNode;
partitions: string[];
};
}>;Defined in: markdown/src/builders/md-namespace-contract.ts:33
Loads a single ScopedRule record from a Markdown file at path.
Translates YAML frontmatter globs: string[] into a passive FsGlobMatcherNode (mode: 'write') without importing @paraharness/fs and validates the rule with ScopedRuleSchema.
Parameters
| Parameter | Type | Description |
|---|---|---|
path | string | Host-root-relative path to the scoped rule Markdown file. |
Returns
MdFrontmatterSourceBuilder<{ checks: BuiltInCheckASTNode<unknown>[]; directive: string; id: string; when: { effects?: FsGlobMatcherNode; partitions: string[]; }; }>
Frozen single scoped rule source builder.
scopedRules()
scopedRules(glob): MdFrontmatterSourceBuilder<readonly object[]>;Defined in: markdown/src/builders/md-namespace-contract.ts:45
Loads ScopedRule[] records from all Markdown files matching glob.
Translates each file's YAML frontmatter globs: string[] into passive FsGlobMatcherNode descriptors and validates every rule against ScopedRuleSchema.
Parameters
| Parameter | Type | Description |
|---|---|---|
glob | string | Host-root-relative glob pattern targeting scoped rule Markdown files. |
Returns
MdFrontmatterSourceBuilder<readonly object[]>
Frozen scoped rules array source builder.
section()
section<T>(path, heading): MdSectionSourceBuilder<T>;Defined in: markdown/src/builders/md-namespace-contract.ts:102
Extracts the Markdown section under heading from the file at path.
Compiles to a passive MarkdownSectionSourceNode<T> resolved relative to the host repository root.
Type Parameters
| Type Parameter | Default type | Description |
|---|---|---|
T | string | Resolved section content type. |
Parameters
| Parameter | Type | Description |
|---|---|---|
path | string | Host-root-relative path to the Markdown document. |
heading | string | Target heading title to extract. |
Returns
Frozen section source builder.
skill()
skill<THandle>(path): MdFrontmatterSourceBuilder<SkillNode<THandle>>;Defined in: markdown/src/builders/md-namespace-contract.ts:58
Loads a single SkillNode definition from a Markdown file at path for P.skill(md.skill(path)).
Extracts id, description, optional partitions/globs trigger predicates, and Markdown body instructions.
Type Parameters
| Type Parameter | Default type | Description |
|---|---|---|
THandle | unknown | Runtime handle type of the active isolation scope. |
Parameters
| Parameter | Type | Description |
|---|---|---|
path | string | Host-root-relative path to the skill Markdown file. |
Returns
MdFrontmatterSourceBuilder<SkillNode<THandle>>
Frozen single skill source builder.
skills()
skills<THandle>(glob): MdFrontmatterSourceBuilder<readonly SkillNode<THandle>[]>;Defined in: markdown/src/builders/md-namespace-contract.ts:71
Loads SkillNode[] definitions from all Markdown files matching glob.
Allows mounting procedural skill bundles directly via P.agent(...).skills(md.skills(glob)).
Type Parameters
| Type Parameter | Default type | Description |
|---|---|---|
THandle | unknown | Runtime handle type of the active isolation scope. |
Parameters
| Parameter | Type | Description |
|---|---|---|
glob | string | Host-root-relative glob pattern targeting skill Markdown files. |
Returns
MdFrontmatterSourceBuilder<readonly SkillNode<THandle>[]>
Frozen skill bundle source builder.