mcp-ai-agent-guidelines
Version:
A comprehensive Model Context Protocol server providing advanced tools, resources, and prompts for implementing AI agent best practices
79 lines • 3.42 kB
TypeScript
import type { OutputOptions } from "./types/export-format.types.js";
import type { FrontmatterOptions } from "./types/index.js";
export type { FrontmatterOptions };
/**
* Escape a string value for safe use in YAML frontmatter.
* Handles special YAML characters, multiline strings, and YAML terminators.
*/
export declare function escapeYamlValue(value: string): string;
export declare function slugify(text: string, maxLength?: number): string;
export declare function buildFrontmatter({ mode, model, tools, description, }: FrontmatterOptions): string;
export declare function validateAndNormalizeFrontmatter(opts: FrontmatterOptions): FrontmatterOptions & {
comments?: string[];
};
export declare function buildFrontmatterWithPolicy(opts: FrontmatterOptions): string;
export declare function buildMetadataSection(opts: {
sourceTool: string;
inputFile?: string;
filenameHint?: string;
updatedDate?: Date;
}): string;
/**
* Builds a "Further Reading" section with a disclaimer about external references.
*
* The disclaimer clarifies that:
* - References are provided for informational purposes only
* - No endorsement or affiliation is implied
* - Information may change over time
* - Users should verify with official sources
*
* This approach follows open-source best practices for referencing external resources
* without creating legal liability or implying endorsement.
*/
export declare function buildFurtherReadingSection(refs: Array<{
title: string;
url: string;
description?: string;
} | string>): string;
/**
* Apply export format to content based on output options
*
* @param content - The markdown content to export
* @param options - Output options including format and headers
* @returns Formatted content according to the specified export format
*/
export declare function applyExportFormat(content: string, options?: OutputOptions): string;
/**
* Section builder definition for buildOptionalSections
*/
export interface SectionBuilder<T extends Record<string, unknown>> {
/** Config key to check (e.g., 'includeMetadata') */
key: keyof T;
/** Function to build the section when key is truthy */
builder: (config: T) => string;
}
/**
* Build optional sections based on config flags.
* Reduces repetitive conditional logic like:
* const metadata = config.includeMetadata ? buildMetadata(config) : "";
*
* @example
* const sections = buildOptionalSections(config, [
* { key: 'includeMetadata', builder: (c) => buildMetadata(c) },
* { key: 'includeReferences', builder: (c) => buildReferences(c) }
* ]);
*/
export declare function buildOptionalSections<T extends Record<string, unknown>>(config: T, sectionMap: Array<SectionBuilder<T>>): string[];
/**
* Build optional sections as an object with named keys.
* Similar to buildOptionalSections but returns an object instead of array,
* making it safer for destructuring with specific section names.
*
* @example
* const { metadata, references } = buildOptionalSectionsMap(config, {
* metadata: { key: 'includeMetadata', builder: (c) => buildMetadata(c) },
* references: { key: 'includeReferences', builder: (c) => buildReferences(c) }
* });
*/
export declare function buildOptionalSectionsMap<T extends Record<string, unknown>, K extends string>(config: T, sectionMap: Record<K, SectionBuilder<T>>): Record<K, string>;
//# sourceMappingURL=prompt-utils.d.ts.map