UNPKG

aiwg

Version:

Deployment tool and support utility for AI context. Copies agents, skills, commands, rules, and behaviors into the paths each AI platform reads (Claude Code, Codex, Copilot, Cursor, Warp, OpenClaw, and 6 more) so one source of truth works across 10 platfo

89 lines 3.37 kB
/** * 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<string, unknown>; 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): 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<string, unknown>, 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 <name> --input <path>" # 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<string, unknown>): import('./types.js').SkillScriptSpec | undefined; /** * Convert Python-style named capture groups (?P<name>...) to JS-style (?<name>...) */ 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 */ export declare function buildIndex(cwd: string, options?: BuildOptions): Promise<void>; //# sourceMappingURL=index-builder.d.ts.map