@blundergoat/goat-flow
Version:
AI coding agent harness and local dashboard for Claude Code, OpenAI Codex, Google Antigravity, and GitHub Copilot - setup audits, guardrails, structured skills, deny hooks, and persistent learning loops.
60 lines • 3.67 kB
TypeScript
import { type QualityConfig } from "./quality-config.js";
import type { ArtifactEntry, ComposeOptions, ComposeResult, ReadContentResult } from "./skill-quality-types.js";
/**
* Build the synthetic path used when uploaded markdown is evaluated as a reference.
*
* @param name - user-supplied artifact name; used only to label the synthetic record, never to read disk.
* @returns a project-relative playbook path under `.goat-flow/skill-docs/playbooks/`; no file is created.
*/
export declare function uploadedSharedReferencePath(name: string): string;
export declare function discoverArtifacts(projectRoot: string, config?: QualityConfig): ArtifactEntry[];
export declare function findArtifact(projectRoot: string, artifactId: string, config?: QualityConfig): ArtifactEntry | null;
export declare function readArtifactContent(projectRoot: string, artifact: ArtifactEntry, config: QualityConfig): ReadContentResult;
/**
* Measure byte caps in UTF-8 so dashboard upload limits match HTTP body limits.
*
* @param content - text to measure; counted as encoded UTF-8 bytes, not JS string length (UTF-16 units).
* @returns the UTF-8 byte count - the unit every cap in this module is expressed in.
*/
export declare function utf8ByteLength(content: string): number;
/**
* Truncate without splitting multibyte characters in composed scoring surfaces.
*
* @param content - text to truncate, iterated by Unicode code point so multibyte chars stay intact.
* @param maxBytes - UTF-8 byte budget; negative or fractional values are floored to a non-negative cap.
* @returns the longest whole-character prefix that fits within `maxBytes`; "" when the budget is 0.
*/
export declare function truncateUtf8Bytes(content: string, maxBytes: number): string;
export declare function composeArtifactContent(projectRoot: string, artifact: ArtifactEntry, rawContent: string, config: QualityConfig, options?: ComposeOptions): ComposeResult;
/**
* Count exact Markdown heading levels so rubric section counts are deterministic.
*
* @param content - Markdown text; only lines beginning with the exact `#` run plus a space match.
* @param level - heading depth to count (1 for `# `, 2 for `## `); deeper or shallower headings are ignored.
* @returns the number of headings at exactly that level; 0 when none match (not an error).
*/
export declare function countHeadings(content: string, level: number): number;
/**
* Centralise section checks so rubric regexes stay scoped to Markdown content.
*
* @param content - artifact text to test the section pattern against.
* @param pattern - caller-owned regex; its flags (case, multiline) are respected as-is.
* @returns true when the pattern matches anywhere in the content.
*/
export declare function hasSection(content: string, pattern: RegExp): boolean;
/**
* Remove frontmatter before tool-keyword scoring so version metadata cannot earn credit.
*
* @param content - artifact text that may open with a `---` fenced YAML frontmatter block.
* @returns the content with a leading frontmatter block stripped; unchanged when there is none.
*/
export declare function stripYamlFrontmatter(content: string): string;
/**
* Estimate token load conservatively for budget scoring without invoking a tokenizer.
*
* @param content - text whose token cost is being approximated for the token-budget metric.
* @returns a rounded-up estimate using the ~4-chars-per-token heuristic; an over-estimate, not exact.
*/
export declare function estimateTokens(content: string): number;
export declare function countSubReferences(projectRoot: string, artifact: ArtifactEntry): number;
//# sourceMappingURL=skill-quality-content.d.ts.map