/** * Artifact Index Builder * * Scans .aiwg/ directories, extracts metadata from artifact frontmatter, * computes checksums, extracts @-mention dependencies, and builds a * structured index at .aiwg/.index/. * * @implements #415 * @source @src/artifacts/types.ts * @tests @test/unit/artifacts/index-builder.test.ts */ import type { MetadataEntry, GraphType } from './types.js'; export interface BuildOptions { force?: boolean; verbose?: boolean; scope?: string; outputDir?: string; graph?: GraphType; explicit?: boolean; } /** * Parse YAML frontmatter from markdown content */ export declare function parseFrontmatter(content: string): { data: Record; body: string; }; /** * Extract @-mention references from content */ export declare function extractMentions(content: string): string[]; /** * Extract trigger phrases from a SKILL.md / agent body. * * Skills declare alternate activation phrases under a `## Triggers` * heading; the body typically lists them as bullet points. This * function pulls each bullet's leading phrase (the part before any * `→` arrow or em-dash explanation), lowercased and trimmed. * * Returns an empty array when no `## Triggers` section is found — * non-skill artifacts get `triggers: undefined` after this is wired. * * @implements #1214 */ export declare function extractTriggers(body: string, frontmatter?: Record): string[]; /** * Extract a capability summary for a skill/agent/command/rule. * * Prefers the frontmatter `description` field (used uniformly across * AIWG SKILL.md / agent files). Falls back to the first non-heading * paragraph of the body. Capped at 240 chars so the index stays * token-tight when surfaced via `aiwg index discover`. * * @implements #1214 */ export declare function extractCapability(data: Record, body: string): string | undefined; /** * Extract a SkillScriptSpec from skill frontmatter (#1227). * * The `script:` block is optional — only skills with a backing executable * declare it. Schema: * * script: * entrypoint: scripts/voice_loader.py # required, relative to skill dir * runtime: python3 # required (node|python3|bash|...) * cwd: project-root # optional, default project-root * argsHint: "--voice --input " # optional UX hint * * Returns undefined when the block is absent or malformed. Malformed * blocks are silently dropped — index builder logs a warning so authors * see it, but the artifact still indexes as a non-executable skill. */ export declare function extractSkillScript(data: Record): import('./types.js').SkillScriptSpec | undefined; /** * Convert Python-style named capture groups (?P...) to JS-style (?...) */ export declare function normalizeNamedCaptures(pattern: string): string; /** * Build a MetadataEntry from filename regex captures instead of file content. * Used when graphConfig.nodeStrategy === 'filename-metadata'. * * @implements #723 */ export declare function buildFilenameMetadataEntry(relativePath: string, fullPath: string, filenamePattern: string | undefined): MetadataEntry; /** * Build the artifact index */ /** * Detect an AIWG workflow "Flow" document — the declarative YAML metalanguage * (`apiVersion: workflow.aiwg.io/v1`, the legacy `ops.aiwg.io/v1` alias, and * domain-extension namespaces like `.workflow.aiwg.io/v1`). Pure-YAML * Flow docs carry no markdown frontmatter, so the standard frontmatter path * leaves them unclassified and invisible to discovery. This surfaces them as * `type: 'flow'` with discovery metadata drawn from `metadata.name`, * `spec.description`, and `metadata.labels` (#1540). Returns null for any file * that isn't a recognizable Flow document. */ export declare function parseFlowDoc(content: string, filePath: string): { name?: string; description?: string; tags: string[]; } | null; export declare function buildIndex(cwd: string, options?: BuildOptions): Promise; //# sourceMappingURL=index-builder.d.ts.map