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
73 lines • 3.36 kB
TypeScript
/**
* AIWG.md and AGENTS.md generator.
*
* Per ADR-1: this module assembles the two project-root context files at the end of
* `aiwg use`. AIWG.md is CLAUDE.md-shaped framework context for non-Claude providers;
* AGENTS.md is a link-indexed bridge that points to AIWG.md and to deployed artifact
* files. See `.aiwg/architecture/adr-agents-md-aggregation.md` for the full spec.
*
* This file contains the public generator API. Callers are expected to have already
* deployed artifacts and to pass pre-aggregated `AgentsMdSection[]` describing what
* was deployed. The generator does not walk the filesystem to discover artifacts;
* that's the caller's responsibility (per ADR-1 §7 generator-runs-after-deploy
* invariant — the caller knows what landed).
*/
import type { ContextPipelineOptions, ContextPipelineResult, AgentsMdSection, IndexEntry } from './types.js';
/**
* Render a single link-index entry as markdown.
*
* Returns null if the entry is rejected by sanitizer or allowlist; the caller can
* accumulate warnings about dropped entries.
*/
export declare function renderEntry(entry: IndexEntry): {
markdown: string | null;
warning: string;
};
/**
* Render one section (e.g. ## Agents) of an AGENTS.md.
*/
export declare function renderSection(section: AgentsMdSection): {
markdown: string;
warnings: string[];
};
/**
* Build the full AGENTS.md content (in-memory; does not write).
*
* Per operator direction (#1239): AGENTS.md is a thin pointer to AIWG.md at
* project root. AIWG.md mirrors CLAUDE.md (ADR-1 §0.5) and contains the full
* framework guidance — including the kernel-skill discovery pattern
* (`aiwg discover` / `aiwg show`). Inlining a full link-index here pushed the
* file past Codex's 32KB cap on real deploys, triggered auto-split, and ran
* every artifact description through the sanitizer (rejecting any with
* backticks). The thin-pointer body sidesteps all of that: zero warnings on
* any provider, regardless of how many artifacts are deployed.
*
* `opts.sections` is accepted for backwards compatibility with callers that
* still aggregate a link-index (no internal use). `splitOccurred` is always
* false; `spilloverContent` is always empty. The `partitionForOverflow` /
* spillover utilities remain exported for any external consumer.
*/
export declare function buildAgentsMd(opts: ContextPipelineOptions): Promise<{
content: string;
warnings: string[];
spilloverContent: string;
splitOccurred: boolean;
}>;
/**
* Detect whether a pre-existing file at `filePath` carries the AIWG signature.
*
* Returns `true` if the file is missing or is AIWG-managed (safe to overwrite).
* Returns `false` if the file exists and does not carry the signature comment
* (operator-claimed).
*/
export declare function isOverwriteSafe(filePath: string): Promise<boolean>;
/**
* Generate AIWG.md and AGENTS.md at the project root.
*
* Skeleton implementation: emits AGENTS.md with link-index sections; AIWG.md
* generation is wired in commit 3 alongside the first issue closure (#1104).
* For now AIWG.md emission delegates to a copy of CLAUDE.md when the source
* is present; otherwise it is skipped with a warning.
*/
export declare function generate(opts: ContextPipelineOptions): Promise<ContextPipelineResult>;
//# sourceMappingURL=generator.d.ts.map