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

70 lines 3.08 kB
/** * Project-Local Bundle Remove * * Reverts a project-local bundle's deployed artifacts from provider paths * per the case table in `.aiwg/architecture/design-aiwg-remove-revert.md` * (#1048). Reads artifactHashes from the registry to detect pristine vs * mutated vs replaced files. * * Source under `.aiwg/<type>/<name>/` is NEVER deleted (load-bearing * invariant — `--force` does not change this). * * @design @.aiwg/architecture/design-aiwg-remove-revert.md * @implements #1037 */ import type { AiwgConfig } from '../config/aiwg-config.js'; export type RemoveCase = 'pristine' | 'mutated' | 'missing' | 'replaced' | 'permission' | 'unhashed'; export interface ArtifactRevertOutcome { provider: string; /** Source-relative path (the key in artifactHashes). */ artifactPath: string; /** Absolute path the deploy targeted. */ deployedAbsPath: string; case: RemoveCase; /** Did we actually delete the file (or skip it)? */ reverted: boolean; /** Free-form one-line message for output. */ message: string; } export interface RemoveOptions { /** Skip case-2 mutation prompt; revert mutated files. Never deletes source. */ force?: boolean; /** Limit revert to this provider only. */ provider?: string; /** Print plan; no filesystem changes, no registry mutation. */ dryRun?: boolean; /** Revert files but leave the registry entry. */ keepRegistry?: boolean; /** Programmatic confirmation hook for case 2; defaults to "abort". */ confirmMutation?: (info: ArtifactRevertOutcome) => Promise<boolean> | boolean; } export interface RemoveResult { /** Was a project-local entry found in `installed`? */ found: boolean; /** Per-artifact outcomes across all providers. */ outcomes: ArtifactRevertOutcome[]; /** Providers fully reverted (registry entry removed for each). */ revertedProviders: string[]; /** Providers with at least one skipped artifact (registry entry preserved for each). */ partialProviders: string[]; /** True when the bundle id matched a project-local entry, false when it should fall through to upstream remove. */ isProjectLocal: boolean; } /** * Compute hashes for every artifact under a project-local bundle, keyed by * source-relative path (e.g., "rules/my-rule.md", "skills/x/SKILL.md"). * * Artifact dirs scanned: agents/, commands/, skills/, rules/. Skill entries * use the SKILL.md inside the per-skill subdirectory; everything else is a * top-level .md file. */ export declare function hashBundleArtifacts(bundleAbsPath: string): Promise<Record<string, string>>; /** * Remove a project-local bundle's deploys per the design at * `.aiwg/architecture/design-aiwg-remove-revert.md`. * * Pure function over (config, projectDir, opts). The caller is responsible * for persisting the returned (mutated) config. */ export declare function removeProjectLocalBundle(config: AiwgConfig, projectDir: string, bundleId: string, opts?: RemoveOptions): Promise<RemoveResult>; //# sourceMappingURL=project-local-remove.d.ts.map