/** * Pack install, remove and upgrade. * * Uses the layer-install primitive with the **recorded-hash** detector, never the * bundled-body one. That choice is the whole reason the primitive takes a detector: * comparing a pack layer against the currently bundled body conflates "the user * edited this" with "we published a new version", which would make every layer read * as edited after any content update — so `remove` would refuse to delete anything * and corrected control text would never land. * * Three rules govern what happens to files: * * - **Install never overwrites.** A layer already on disk is left alone and * classified, exactly as framework install does. * - **Remove deletes only what it can prove it wrote.** Unmodified means the disk * hash matches the hash recorded at install. Anything else is the project's file * now, and stays. * - **A left-behind file loses its registration.** Keeping bytes is respect for the * user's edit; keeping the registration would keep feeding an uninstalled pack's * constraints to every agent. * * Requirements: compliance-packs/AC-9, AC-10, AC-11, AC-12, AC-13, AC-16, AC-54, * AC-68, AC-69, AC-70, AC-71, AC-72 */ import type { PackError } from './types.js'; /** Outcome of an install attempt. */ export type InstallResult = { ok: true; /** Layer names newly written. */ installed: string[]; /** Layer names already present and matching what we recorded. */ alreadyCurrent: string[]; /** Layer names present but changed since install — left untouched. */ locallyModified: string[]; /** True when this was a no-op because the pack was already installed. */ unchanged: boolean; warnings: string[]; } | { ok: false; error: PackError; }; /** * Install a pack into a project. * * Idempotent: a second run writes nothing new and reports `unchanged`. Validation * happens first and covers the whole pack, so a pack with one malformed control * installs nothing at all. */ export declare function installPack(projectRoot: string, id: string, opts?: { dryRun?: boolean; now?: Date; }): InstallResult; /** Outcome of a remove attempt. */ export type RemoveResult = { ok: true; /** Files deleted, repo-relative. */ deleted: string[]; /** * Files left on disk because they no longer match what we wrote, repo-relative. * Their registrations were still dropped, so they no longer reach any agent. */ keptPaths: string[]; /** Layer registrations dropped from the index. */ unregistered: string[]; warnings: string[]; } | { ok: false; error: PackError; }; /** * Remove an installed pack. * * Deletes only layers whose on-disk hash matches the hash recorded at install. * Every registration is dropped either way, so nothing an uninstalled pack owns * keeps influencing an agent. * * Resolution of the pack is **not** required: a pack must remain removable after the * content package stops shipping it, which is precisely when a user most wants it * gone. The config record alone is enough. */ export declare function removePack(projectRoot: string, id: string, opts?: { dryRun?: boolean; }): RemoveResult; /** What `aidlc compliance list` needs to say about one pack. */ export interface PackStatus { id: string; regime: string; /** Version available in the content package, or null when it no longer ships. */ available: string | null; /** Version recorded at install, or null when not installed. */ installed: string | null; /** Recorded version differs from the available one. */ stale: boolean; /** Whether the pack's control text has been reviewed by a practitioner. */ reviewed: boolean; /** * Installed layer files whose on-disk hash no longer matches the recorded one. * * Reported for every installed pack, not only when a notice is missing: in a cloned * repository an installed layer is content the repo author could have changed, and a * locally edited layer is preserved forever by design. */ drifted: string[]; /** Other names a buyer uses for this pack's request; `[]` when none (ssae-soc1-mapping/AC-9). */ asked_for_as: string[]; } /** Status of every available pack, plus any installed pack that no longer ships. */ export declare function packStatuses(projectRoot: string): { statuses: PackStatus[]; errors: PackError[]; }; /** Outcome of an upgrade attempt. */ export type UpgradeResult = { ok: true; from: string; to: string; replaced: string[]; keptPaths: string[]; warnings: string[]; } | { ok: false; error: PackError; }; /** * Upgrade an installed pack to the version the content package ships. * * Deliberately its own command. Neither `aidlc update` nor `aidlc doctor` may do * this: pack content is what a buyer is told they are being governed by, and * changing it under them without a word is not an upgrade, it is a substitution. * * A locally edited layer is never overwritten. It is left in place and reported, so * the user decides whether to discard their edit. */ export declare function upgradePack(projectRoot: string, id: string, opts?: { dryRun?: boolean; }): UpgradeResult; //# sourceMappingURL=install.d.ts.map