import { type ArchiveYamlDoc, type ManifestDoc, type VerifyReport } from "./archive-reader.js"; import { type MergeDecision } from "./merge-strategy.js"; /** * v0.8.1 — `solosquad import `. * * Per docs/plan/v0.8.1-security-lifecycle-pair.md §4. The orchestration here * is intentionally thin: archive verify (archive-reader) + per-file merge * decisions (merge-strategy) + a journal for resume safety. CLI argument * parsing + user-facing prompts live in `src/cli/import.ts`. * * Mapping summary (per §4.2): * * archive.yaml/manifest.tsv/REVOKE-CHECKLIST.md/PII-NOTICE.md → stored on * disk under `/.solosquad/import-meta//` for audit. * workspace/AGENTS.md → /AGENTS.md * workspace//.solosquad/ * orgs//// * orgs//repos//repo.yaml → guidance only (logged, not extracted) * credentials/env.template → /.solosquad/.env.template * manual-revoke-required/ → import-meta//manual-revoke-required/ */ export interface ImportOptions { archivePath: string; workspace: string; cliVersion: string; /** Bias `` mapping — if set, the archive's orgs// rewrites to ///... unless equal. */ into?: string; /** No disk changes; produces a report only. */ dryRun: boolean; /** "merge" is default, "replace" overwrites without renaming siblings. */ mode: "merge" | "replace"; /** Optional override of "now" — set by tests. */ nowIso?: string; } export interface PlannedAction { /** Path inside the archive zip. */ archivePath: string; /** Decision returned by merge-strategy. */ decision: MergeDecision; /** Final destination path relative to workspace root, forward-slashed. */ workspaceRelPath: string; cls: string; } export interface ImportReport { runId: string; archivePath: string; workspace: string; archiveYaml: ArchiveYamlDoc; manifest: ManifestDoc; verify: VerifyReport; /** Per-entry plan — populated for both dry-run and real apply. */ actions: PlannedAction[]; /** id collisions (workflows/goals) — surfaced before any disk write. */ idConflicts: { org: string; workflowConflicts: string[]; goalConflicts: string[]; }[]; /** Org slugs included by the archive. */ includedOrgs: string[]; /** Repo paths user must `git clone` separately (Class A* repo.yaml entries). */ repoCloneTargets: { org: string; repo: string; repoYamlPath: string; }[]; /** Counts by decision kind. */ summary: Record; /** True if no fatal errors were detected. */ ok: boolean; /** Fatal errors (verify failure, id conflicts without --replace). */ errors: string[]; } export declare function importArchive(opts: ImportOptions): Promise;