@gitgov/core 2.7.2 → 2.9.0

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.
@@ -1,8 +1,121 @@
1
1
  import { Octokit } from '@octokit/rest';
2
2
  export { Octokit, RestEndpointMethodTypes } from '@octokit/rest';
3
+ import { C as ConfigManager, p as IIdentityAdapter, I as ILintModule, e as ISyncStateModule, S as SyncStatePushOptions, f as SyncStatePushResult, g as SyncStatePullOptions, h as SyncStatePullResult, k as StateDeltaFile, l as ConflictDiff, i as SyncStateResolveOptions, j as SyncStateResolveResult, m as IntegrityViolation, A as AuditStateOptions, n as AuditStateReport } from './sync_state-B8X4NDKF.js';
4
+ import { a as IRecordProjector, I as IdEncoder, R as RecordStore } from './record_projection.types-CFsl44em.js';
3
5
  import { h as FileLister, i as FileListOptions, j as FileStats, I as IGitModule, d as ChangedFile, e as GetCommitHistoryOptions, f as CommitInfo, g as CommitAuthor, E as ExecOptions, c as ExecResult, C as ConfigStore, G as GitGovConfig } from './index-LULVRsCZ.js';
4
- import { I as IdEncoder, R as RecordStore, a as IRecordProjector } from './record_projection.types-D9NkQbL_.js';
5
- import { C as ConfigManager, q as IIdentityAdapter, I as ILintModule, e as ISyncStateModule, j as SyncStatePushOptions, k as SyncStatePushResult, l as SyncStatePullOptions, m as SyncStatePullResult, f as StateDeltaFile, g as ConflictDiff, n as SyncStateResolveOptions, o as SyncStateResolveResult, h as IntegrityViolation, A as AuditStateOptions, i as AuditStateReport } from './sync_state-C2a2RuBQ.js';
6
+
7
+ /**
8
+ * Types for GithubSyncStateModule.
9
+ *
10
+ * Blueprint: github_sync_state_module.md §3.1
11
+ * @module sync_state/github_sync_state
12
+ */
13
+
14
+ /**
15
+ * Dependencies for GithubSyncStateModule.
16
+ *
17
+ * Uses Octokit directly (not IGitModule) because:
18
+ * - GitHubGitModule has a stateful staging buffer that complicates the flow
19
+ * - Tree API recursive operations (getTree, compare) are not exposed in IGitModule
20
+ * - Direct Octokit control is simpler for atomic tree+commit+ref operations
21
+ */
22
+ type GithubSyncStateDependencies = {
23
+ /** Octokit instance (authenticated) */
24
+ octokit: Octokit;
25
+ /** GitHub repo owner */
26
+ owner: string;
27
+ /** GitHub repo name */
28
+ repo: string;
29
+ /** Configuration manager (DI consistency — not actively used in initial implementation) */
30
+ config: ConfigManager;
31
+ /** Identity adapter (DI consistency — not actively used; lint handles validation internally) */
32
+ identity: IIdentityAdapter;
33
+ /** Lint module for record validation */
34
+ lint: ILintModule;
35
+ /** Record projector for re-indexing after pull */
36
+ indexer: IRecordProjector;
37
+ };
38
+
39
+ /**
40
+ * GithubSyncStateModule — ISyncStateModule via GitHub API (Octokit)
41
+ *
42
+ * Implements state synchronization between .gitgov/ records and a shared
43
+ * gitgov-state branch using the GitHub Trees/Commits/Refs API.
44
+ * No local filesystem or git CLI required.
45
+ *
46
+ * Blueprint: github_sync_state_module.md
47
+ * @module sync_state/github_sync_state
48
+ */
49
+
50
+ /**
51
+ * [EARS-GS-A1..F2] GithubSyncStateModule
52
+ *
53
+ * Synchronizes .gitgov/ state with a GitHub remote via API.
54
+ * Uses optimistic concurrency (SHA-based) instead of rebase.
55
+ */
56
+ declare class GithubSyncStateModule implements ISyncStateModule {
57
+ private readonly deps;
58
+ private lastKnownSha;
59
+ constructor(deps: GithubSyncStateDependencies);
60
+ /**
61
+ * [EARS-GS-A3] Returns the configured state branch name.
62
+ */
63
+ getStateBranchName(): Promise<string>;
64
+ /**
65
+ * [EARS-GS-A1] Creates gitgov-state branch if it does not exist.
66
+ * [EARS-GS-A2] Idempotent — no-op if branch already exists.
67
+ */
68
+ ensureStateBranch(): Promise<void>;
69
+ /**
70
+ * [EARS-GS-B1..B5] Push local .gitgov/ state to gitgov-state branch via API.
71
+ *
72
+ * Uses the 6-step atomic commit pattern:
73
+ * getRef → getCommit → createBlob → createTree → createCommit → updateRef
74
+ *
75
+ * Optimistic concurrency: if remote ref advanced since our read, updateRef
76
+ * fails with 422 → return conflictDetected: true.
77
+ */
78
+ pushState(options: SyncStatePushOptions): Promise<SyncStatePushResult>;
79
+ /**
80
+ * [EARS-GS-C1..C4] Pull remote state from gitgov-state branch.
81
+ *
82
+ * Fetches tree + blobs, updates lastKnownSha, triggers re-indexing.
83
+ */
84
+ pullState(options?: SyncStatePullOptions): Promise<SyncStatePullResult>;
85
+ /**
86
+ * [EARS-GS-D1..D3] Calculate file delta between known state and current remote.
87
+ */
88
+ calculateStateDelta(_sourceBranch: string): Promise<StateDeltaFile[]>;
89
+ /**
90
+ * Always empty — no local pending changes in API mode.
91
+ * In API mode there is no local filesystem; all state is remote.
92
+ */
93
+ getPendingChanges(): Promise<StateDeltaFile[]>;
94
+ /**
95
+ * Always false — no rebase in API mode.
96
+ */
97
+ isRebaseInProgress(): Promise<boolean>;
98
+ /**
99
+ * Always empty — no conflict markers in API mode.
100
+ */
101
+ checkConflictMarkers(_filePaths: string[]): Promise<string[]>;
102
+ /**
103
+ * Empty diff — no git-level conflict markers in API mode.
104
+ */
105
+ getConflictDiff(_filePaths?: string[]): Promise<ConflictDiff>;
106
+ /**
107
+ * [EARS-GS-E1..E2] Resolve conflict by pulling latest and retrying push.
108
+ */
109
+ resolveConflict(options: SyncStateResolveOptions): Promise<SyncStateResolveResult>;
110
+ /**
111
+ * No integrity violations in API mode (no rebase commits).
112
+ */
113
+ verifyResolutionIntegrity(): Promise<IntegrityViolation[]>;
114
+ /**
115
+ * [EARS-GS-F1..F2] Audit the remote gitgov-state branch.
116
+ */
117
+ auditState(options?: AuditStateOptions): Promise<AuditStateReport>;
118
+ }
6
119
 
7
120
  /**
8
121
  * Types for GitHubFileLister module.
@@ -423,119 +536,6 @@ declare class GitHubConfigStore implements ConfigStore<GitHubSaveResult> {
423
536
  saveConfig(config: GitGovConfig): Promise<GitHubSaveResult>;
424
537
  }
425
538
 
426
- /**
427
- * Types for GithubSyncStateModule.
428
- *
429
- * Blueprint: github_sync_state_module.md §3.1
430
- * @module sync_state/github_sync_state
431
- */
432
-
433
- /**
434
- * Dependencies for GithubSyncStateModule.
435
- *
436
- * Uses Octokit directly (not IGitModule) because:
437
- * - GitHubGitModule has a stateful staging buffer that complicates the flow
438
- * - Tree API recursive operations (getTree, compare) are not exposed in IGitModule
439
- * - Direct Octokit control is simpler for atomic tree+commit+ref operations
440
- */
441
- type GithubSyncStateDependencies = {
442
- /** Octokit instance (authenticated) */
443
- octokit: Octokit;
444
- /** GitHub repo owner */
445
- owner: string;
446
- /** GitHub repo name */
447
- repo: string;
448
- /** Configuration manager (DI consistency — not actively used in initial implementation) */
449
- config: ConfigManager;
450
- /** Identity adapter (DI consistency — not actively used; lint handles validation internally) */
451
- identity: IIdentityAdapter;
452
- /** Lint module for record validation */
453
- lint: ILintModule;
454
- /** Record projector for re-indexing after pull */
455
- indexer: IRecordProjector;
456
- };
457
-
458
- /**
459
- * GithubSyncStateModule — ISyncStateModule via GitHub API (Octokit)
460
- *
461
- * Implements state synchronization between .gitgov/ records and a shared
462
- * gitgov-state branch using the GitHub Trees/Commits/Refs API.
463
- * No local filesystem or git CLI required.
464
- *
465
- * Blueprint: github_sync_state_module.md
466
- * @module sync_state/github_sync_state
467
- */
468
-
469
- /**
470
- * [EARS-GS-A1..F2] GithubSyncStateModule
471
- *
472
- * Synchronizes .gitgov/ state with a GitHub remote via API.
473
- * Uses optimistic concurrency (SHA-based) instead of rebase.
474
- */
475
- declare class GithubSyncStateModule implements ISyncStateModule {
476
- private readonly deps;
477
- private lastKnownSha;
478
- constructor(deps: GithubSyncStateDependencies);
479
- /**
480
- * [EARS-GS-A3] Returns the configured state branch name.
481
- */
482
- getStateBranchName(): Promise<string>;
483
- /**
484
- * [EARS-GS-A1] Creates gitgov-state branch if it does not exist.
485
- * [EARS-GS-A2] Idempotent — no-op if branch already exists.
486
- */
487
- ensureStateBranch(): Promise<void>;
488
- /**
489
- * [EARS-GS-B1..B5] Push local .gitgov/ state to gitgov-state branch via API.
490
- *
491
- * Uses the 6-step atomic commit pattern:
492
- * getRef → getCommit → createBlob → createTree → createCommit → updateRef
493
- *
494
- * Optimistic concurrency: if remote ref advanced since our read, updateRef
495
- * fails with 422 → return conflictDetected: true.
496
- */
497
- pushState(options: SyncStatePushOptions): Promise<SyncStatePushResult>;
498
- /**
499
- * [EARS-GS-C1..C4] Pull remote state from gitgov-state branch.
500
- *
501
- * Fetches tree + blobs, updates lastKnownSha, triggers re-indexing.
502
- */
503
- pullState(options?: SyncStatePullOptions): Promise<SyncStatePullResult>;
504
- /**
505
- * [EARS-GS-D1..D3] Calculate file delta between known state and current remote.
506
- */
507
- calculateStateDelta(_sourceBranch: string): Promise<StateDeltaFile[]>;
508
- /**
509
- * Always empty — no local pending changes in API mode.
510
- * In API mode there is no local filesystem; all state is remote.
511
- */
512
- getPendingChanges(): Promise<StateDeltaFile[]>;
513
- /**
514
- * Always false — no rebase in API mode.
515
- */
516
- isRebaseInProgress(): Promise<boolean>;
517
- /**
518
- * Always empty — no conflict markers in API mode.
519
- */
520
- checkConflictMarkers(_filePaths: string[]): Promise<string[]>;
521
- /**
522
- * Empty diff — no git-level conflict markers in API mode.
523
- */
524
- getConflictDiff(_filePaths?: string[]): Promise<ConflictDiff>;
525
- /**
526
- * [EARS-GS-E1..E2] Resolve conflict by pulling latest and retrying push.
527
- */
528
- resolveConflict(options: SyncStateResolveOptions): Promise<SyncStateResolveResult>;
529
- /**
530
- * No integrity violations in API mode (no rebase commits).
531
- */
532
- verifyResolutionIntegrity(): Promise<IntegrityViolation[]>;
533
- /**
534
- * [EARS-GS-F1..F2] Audit the remote gitgov-state branch.
535
- */
536
- auditState(options?: AuditStateOptions): Promise<AuditStateReport>;
537
- }
538
-
539
539
  /**
540
540
  * GitHub API implementations for @gitgov/core/github
541
541
  *