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
100 lines • 4.25 kB
TypeScript
/**
* Project-local .gitignore management.
*
* AIWG-managed projects historically `.gitignore` the whole `.aiwg/` tree
* because most of it is generated state (working scratch, ralph state,
* research corpora, etc.). With #1033's project-local artifact lifecycle,
* `.aiwg/{addons,extensions,frameworks,plugins}/` is now also operator-
* authored source — and a blanket ignore silently drops it from version
* control.
*
* This module provides:
*
* - `detectAiwgBlanketIgnore()` — read .gitignore, classify the rules
* - `appendAiwgSourceTrackBlock()` — append the canonical un-ignore
* block (sentinel-marked, idempotent)
* - `checkBundleManifestIgnored()` — per-bundle: is its manifest.json
* git-ignored right now?
*
* @implements #1085
*/
/**
* Sentinel comment that marks the AIWG-managed un-ignore block.
*
* We detect existing blocks by this exact line so re-running new-bundle
* never produces duplicate blocks.
*/
export declare const AIWG_GITIGNORE_SENTINEL = "# AIWG project-local bundle source \u2014 track these (managed by AIWG)";
/**
* The canonical block we append when a project blanket-ignores `.aiwg/`
* but doesn't yet un-ignore the source directories.
*/
export declare const AIWG_GITIGNORE_BLOCK: string;
export interface BlanketIgnoreReport {
/** True when `.gitignore` contains a rule that ignores `.aiwg/` wholesale. */
blanketIgnore: boolean;
/**
* True when `.gitignore` already explicitly un-ignores at least one of
* the project-local source directories (addons/extensions/frameworks/
* plugins). Treated as "operator already configured this — don't touch".
*/
hasExistingNegation: boolean;
/**
* True when our sentinel-marked block is already present (in any form,
* even if the operator edited individual lines). Used for idempotency.
*/
hasManagedBlock: boolean;
/** `.gitignore` exists at the project root. False means "no git project here". */
gitignoreExists: boolean;
}
/**
* Inspect a project's `.gitignore` and classify it for our purposes.
*
* Detection rules — only the patterns we actually need:
*
* blanket ignore: a non-negation, non-comment line that matches the
* `.aiwg/` directory directly. Specifically: `.aiwg`, `.aiwg/`,
* `.aiwg/*`, `.aiwg/**`, or path-anchored variants thereof.
*
* existing negation: a line beginning with `!` that points into one of
* our four source directories. e.g. `!.aiwg/addons/` or
* `!.aiwg/extensions/foo/`.
*/
export declare function detectAiwgBlanketIgnore(projectDir: string): Promise<BlanketIgnoreReport>;
export interface AppendResult {
/** True when we appended the un-ignore block. */
added: boolean;
/**
* Brief reason, for printing. e.g.
* "appended .aiwg/{addons,extensions,frameworks,plugins} un-ignore block"
* "no .gitignore — skipped"
* "no blanket .aiwg ignore — already tracking sources"
* "block already present — no change"
* "operator has explicit !.aiwg negation — no change"
*/
reason: string;
}
/**
* Append the canonical un-ignore block to `.gitignore` if and only if:
*
* - `.gitignore` exists, AND
* - it blanket-ignores `.aiwg/`, AND
* - it does NOT already have any source-directory negation, AND
* - it does NOT already have our sentinel-marked block.
*
* The function is idempotent in all four conditions. No-op when the
* project doesn't blanket-ignore (operator has presumably configured a
* selective ignore already).
*/
export declare function appendAiwgSourceTrackBlock(projectDir: string): Promise<AppendResult>;
/**
* Per-bundle: is its `manifest.json` currently ignored by git?
*
* Uses `git check-ignore` which is authoritative — it reflects every
* `.gitignore` precedence rule, including negations and core.excludesFile.
*
* Returns `null` when git isn't installed or the project isn't a git
* repo. Caller should treat null as "skip the check".
*/
export declare function checkBundleManifestIgnored(projectDir: string, manifestRelPath: string): Promise<boolean | null>;
//# sourceMappingURL=project-local-gitignore.d.ts.map