@fonlan/dsh-gitmemo 0.1.5 → 0.3.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -0,0 +1,95 @@
1
+ /** One deduplicated entry planned for reimport. */
2
+ export interface MigrationPlanEntry {
3
+ title: string;
4
+ summary: string;
5
+ keywords: string[];
6
+ content: string;
7
+ date: string;
8
+ codeBranch: string;
9
+ codeCommit: string;
10
+ relatedBranches: string[];
11
+ relatedPaths: string[];
12
+ digest: string;
13
+ sourceBranch: string;
14
+ sourcePath: string;
15
+ }
16
+ /** Same entry path with different content across branch tips. */
17
+ export interface MigrationConflict {
18
+ path: string;
19
+ variants: Array<{
20
+ branch: string;
21
+ hash: string;
22
+ digest: string;
23
+ }>;
24
+ }
25
+ /** Serializable baseline produced by dry-run and consumed by apply. */
26
+ export interface MigrationBaseline {
27
+ format: "dsh-gitmemo-migration-baseline";
28
+ version: 1;
29
+ root: string;
30
+ memDir: string;
31
+ scannedAt: string;
32
+ tips: Record<string, string>;
33
+ entries: MigrationPlanEntry[];
34
+ conflicts: MigrationConflict[];
35
+ warnings: string[];
36
+ }
37
+ export interface MigrationDryRunReport {
38
+ legacy: boolean;
39
+ alreadyNewFormat?: boolean;
40
+ branches: string[];
41
+ tips: Record<string, string>;
42
+ oldEntryCount: number;
43
+ uniqueEntryCount: number;
44
+ conflictCount: number;
45
+ estimatedMainCommits: number;
46
+ baseline: MigrationBaseline;
47
+ warnings: string[];
48
+ }
49
+ export interface MigrationApplyReport {
50
+ migrated: boolean;
51
+ alreadyMigrated?: boolean;
52
+ entries: number;
53
+ newMain: string;
54
+ backupRefPrefix: string;
55
+ oldBranches: string[];
56
+ }
57
+ export interface MigrationOptions {
58
+ /** Legacy memory dir to migrate from (default `<root>/.mem`). */
59
+ source?: string;
60
+ gitTimeoutMs?: number;
61
+ lockTimeoutMs?: number;
62
+ }
63
+ /** Why automatic migration could not run (user-resolvable blocking conditions). */
64
+ export interface AutoMigrateBlock {
65
+ code: "no-repo" | "no-branches" | "conflicts" | "dirty" | "legacy-journal" | "other";
66
+ /** Human-readable detail; safe to surface to the user. */
67
+ detail: string;
68
+ }
69
+ /** Outcome of an automatic migration attempt (never throws for blocking conditions). */
70
+ export interface AutoMigrateOutcome {
71
+ migrated: boolean;
72
+ alreadyNewFormat?: boolean;
73
+ blocked?: AutoMigrateBlock;
74
+ report?: MigrationApplyReport;
75
+ }
76
+ /**
77
+ * Scan a legacy `.mem` repo and produce the migration plan. Read-only: no
78
+ * ref, index or worktree state is modified (the lock file is transient).
79
+ */
80
+ export declare function migrateDryRun(root: string, options?: MigrationOptions): Promise<MigrationDryRunReport>;
81
+ /**
82
+ * Execute a previously dry-run migration (plan 10.4). Verifies the baseline
83
+ * refs are unchanged, blocks on conflicts, creates backup refs, builds the
84
+ * new canonical main in a temp repo, then swaps directories atomically.
85
+ */
86
+ export declare function migrateApply(root: string, baseline: MigrationBaseline, options?: MigrationOptions): Promise<MigrationApplyReport>;
87
+ /**
88
+ * Fully automatic migration for engine use: dry-run + apply in one step,
89
+ * without taking the cross-process lock (the caller must already hold it).
90
+ *
91
+ * Never throws for user-resolvable blocking conditions — it returns
92
+ * `blocked` instead, so the caller can fall back to legacy read-only mode
93
+ * and retry automatically on a later operation.
94
+ */
95
+ export declare function migrateAutoUnlocked(root: string, options?: MigrationOptions): Promise<AutoMigrateOutcome>;