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

49 lines 1.75 kB
/** * Field sanitization for AGENTS.md link-index entries. * * Per ADR-1 §2: AGENTS.md is loaded into model context every session, so a poisoned * link entry is a high-reach prompt-injection vector. The sanitizer rejects backticks, * code fences, control characters, absolute URLs (any scheme except relative paths), * and HTML at generation time, before the bytes are written. * * Description field is also length-capped at 120 chars. */ /** * Result of a sanitization attempt. */ export interface SanitizeResult { ok: boolean; value: string; /** Reason the input was rejected; empty when ok=true */ rejectedFor: string; } /** * Sanitize a description field for the AGENTS.md link index. * * Returns `ok: false` with a `rejectedFor` reason when the input contains * forbidden content. Caller decides whether to skip the entry or abort. * * On `ok: true`, the returned `value` is trimmed and length-capped. */ export declare function sanitizeDescription(input: string): SanitizeResult; /** * Sanitize a tag value. Tags are short identifiers (kebab-case typical). * No length cap, but same forbidden-pattern set as description. */ export declare function sanitizeTag(input: string): SanitizeResult; /** * Convenience: sanitize an array of tags. Drops invalid tags rather than rejecting * the whole array. Returns the kept tags and a list of rejection reasons for telemetry. */ export declare function sanitizeTags(inputs: ReadonlyArray<string>): { kept: string[]; rejected: string[]; }; export declare const SANITIZER_INTERNALS: { DESCRIPTION_MAX_LEN: number; FORBIDDEN_PATTERNS: readonly { pattern: RegExp; reason: string; }[]; }; //# sourceMappingURL=sanitizer.d.ts.map