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
69 lines • 2.89 kB
TypeScript
/**
* Project-Local Bundle Promotion (Graduate)
*
* Operationalizes the identical-form portability invariant from
* @.aiwg/architecture/adr-identical-form-portability.md (#1038): a
* project-local bundle should graduate to upstream (or to a private
* corpus path) by byte-identical copy.
*
* Per the design at @.aiwg/architecture/design-doctor-log-promote.md
* (#1049), promote performs:
* 1. Pre-flight checks (bundle exists, manifest valid, no project-
* local @-refs, destination doesn't exist, identical-form layout)
* 2. Hash snapshot of source files
* 3. Recursive copy to destination
* 4. Re-hash destination — roll back (delete) on any mismatch
* 5. Update registry source: project-local → bundled (or corpus)
* 6. Optional --cleanup: remove .aiwg/<type>/<name>/ source
* 7. Activity log entry
*
* @design @.aiwg/architecture/design-doctor-log-promote.md
* @implements #1037
*/
import type { AiwgConfig } from '../config/aiwg-config.js';
import type { ProjectLocalType } from './manifest.js';
export type PromoteDestinationKind = 'upstream' | 'corpus';
export interface PromoteOptions {
/** Where to copy: upstream tree or corpus path. Default: 'upstream'. */
to?: PromoteDestinationKind;
/** Required when to === 'corpus'. */
corpusPath?: string;
/** Print plan; no filesystem writes, no registry mutation. */
dryRun?: boolean;
/** Remove .aiwg/<type>/<name>/ source after a successful copy. */
cleanup?: boolean;
/**
* Bypass the safety-critical shadow / @-reference refusals.
* Does not bypass: destination-already-exists, hash-mismatch rollback.
*/
force?: boolean;
/** Override frameworkRoot for the upstream destination. */
frameworkRoot?: string;
}
export type PromoteFailureReason = 'bundle-not-found' | 'destination-required' | 'destination-exists' | 'project-local-references' | 'hash-mismatch' | 'copy-failed';
export interface PromotePlan {
bundleId: string;
type: ProjectLocalType;
source: string;
destination: string;
/** Source-relative file paths that would be copied. */
files: string[];
totalBytes: number;
}
export interface PromoteResult {
/** True when promotion (or its dry-run plan) succeeded. */
ok: boolean;
plan?: PromotePlan;
failureReason?: PromoteFailureReason;
message?: string;
/** Files actually copied (empty in dry-run / failure). */
copied?: string[];
}
/**
* Promote a project-local bundle to its upstream home or a corpus path.
*
* Pure function over (config, projectDir, bundleId, opts). Mutates
* config.installed when the operation succeeds (caller persists).
*/
export declare function promoteProjectLocalBundle(config: AiwgConfig, projectDir: string, bundleId: string, opts?: PromoteOptions): Promise<PromoteResult>;
//# sourceMappingURL=project-local-promote.d.ts.map