@gitgov/core 1.7.0 → 1.8.3

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.
@@ -751,39 +751,39 @@ declare class GitGovError extends Error {
751
751
  constructor(message: string, code: string);
752
752
  }
753
753
 
754
- type index$k_ActorPayload = ActorPayload;
755
- type index$k_ActorRecord = ActorRecord;
756
- type index$k_AgentPayload = AgentPayload;
757
- type index$k_AgentRecord = AgentRecord;
758
- type index$k_ChangelogPayload = ChangelogPayload;
759
- type index$k_ChangelogRecord = ChangelogRecord;
760
- type index$k_CustomRecord = CustomRecord;
761
- type index$k_CyclePayload = CyclePayload;
762
- type index$k_CycleRecord = CycleRecord;
763
- type index$k_EmbeddedMetadataHeader = EmbeddedMetadataHeader;
764
- type index$k_EmbeddedMetadataRecord<T extends GitGovRecordPayload> = EmbeddedMetadataRecord<T>;
765
- type index$k_ExecutionPayload = ExecutionPayload;
766
- type index$k_ExecutionRecord = ExecutionRecord;
767
- type index$k_FeedbackPayload = FeedbackPayload;
768
- type index$k_FeedbackRecord = FeedbackRecord;
769
- type index$k_GitGovActorRecord = GitGovActorRecord;
770
- type index$k_GitGovAgentRecord = GitGovAgentRecord;
771
- type index$k_GitGovChangelogRecord = GitGovChangelogRecord;
772
- type index$k_GitGovCycleRecord = GitGovCycleRecord;
773
- type index$k_GitGovError = GitGovError;
774
- declare const index$k_GitGovError: typeof GitGovError;
775
- type index$k_GitGovExecutionRecord = GitGovExecutionRecord;
776
- type index$k_GitGovFeedbackRecord = GitGovFeedbackRecord;
777
- type index$k_GitGovRecord = GitGovRecord;
778
- type index$k_GitGovRecordPayload = GitGovRecordPayload;
779
- type index$k_GitGovRecordType = GitGovRecordType;
780
- type index$k_GitGovTaskRecord = GitGovTaskRecord;
781
- type index$k_Signature = Signature;
782
- type index$k_TaskPayload = TaskPayload;
783
- type index$k_TaskRecord = TaskRecord;
784
- type index$k_WorkflowMethodologyRecord = WorkflowMethodologyRecord;
785
- declare namespace index$k {
786
- export { type index$k_ActorPayload as ActorPayload, type index$k_ActorRecord as ActorRecord, type index$k_AgentPayload as AgentPayload, type index$k_AgentRecord as AgentRecord, type index$k_ChangelogPayload as ChangelogPayload, type index$k_ChangelogRecord as ChangelogRecord, type index$k_CustomRecord as CustomRecord, type index$k_CyclePayload as CyclePayload, type index$k_CycleRecord as CycleRecord, type index$k_EmbeddedMetadataHeader as EmbeddedMetadataHeader, type index$k_EmbeddedMetadataRecord as EmbeddedMetadataRecord, type index$k_ExecutionPayload as ExecutionPayload, type index$k_ExecutionRecord as ExecutionRecord, type index$k_FeedbackPayload as FeedbackPayload, type index$k_FeedbackRecord as FeedbackRecord, type index$k_GitGovActorRecord as GitGovActorRecord, type index$k_GitGovAgentRecord as GitGovAgentRecord, type index$k_GitGovChangelogRecord as GitGovChangelogRecord, type index$k_GitGovCycleRecord as GitGovCycleRecord, index$k_GitGovError as GitGovError, type index$k_GitGovExecutionRecord as GitGovExecutionRecord, type index$k_GitGovFeedbackRecord as GitGovFeedbackRecord, type index$k_GitGovRecord as GitGovRecord, type index$k_GitGovRecordPayload as GitGovRecordPayload, type index$k_GitGovRecordType as GitGovRecordType, type index$k_GitGovTaskRecord as GitGovTaskRecord, type index$k_Signature as Signature, type index$k_TaskPayload as TaskPayload, type index$k_TaskRecord as TaskRecord, type index$k_WorkflowMethodologyRecord as WorkflowMethodologyRecord };
754
+ type index$m_ActorPayload = ActorPayload;
755
+ type index$m_ActorRecord = ActorRecord;
756
+ type index$m_AgentPayload = AgentPayload;
757
+ type index$m_AgentRecord = AgentRecord;
758
+ type index$m_ChangelogPayload = ChangelogPayload;
759
+ type index$m_ChangelogRecord = ChangelogRecord;
760
+ type index$m_CustomRecord = CustomRecord;
761
+ type index$m_CyclePayload = CyclePayload;
762
+ type index$m_CycleRecord = CycleRecord;
763
+ type index$m_EmbeddedMetadataHeader = EmbeddedMetadataHeader;
764
+ type index$m_EmbeddedMetadataRecord<T extends GitGovRecordPayload> = EmbeddedMetadataRecord<T>;
765
+ type index$m_ExecutionPayload = ExecutionPayload;
766
+ type index$m_ExecutionRecord = ExecutionRecord;
767
+ type index$m_FeedbackPayload = FeedbackPayload;
768
+ type index$m_FeedbackRecord = FeedbackRecord;
769
+ type index$m_GitGovActorRecord = GitGovActorRecord;
770
+ type index$m_GitGovAgentRecord = GitGovAgentRecord;
771
+ type index$m_GitGovChangelogRecord = GitGovChangelogRecord;
772
+ type index$m_GitGovCycleRecord = GitGovCycleRecord;
773
+ type index$m_GitGovError = GitGovError;
774
+ declare const index$m_GitGovError: typeof GitGovError;
775
+ type index$m_GitGovExecutionRecord = GitGovExecutionRecord;
776
+ type index$m_GitGovFeedbackRecord = GitGovFeedbackRecord;
777
+ type index$m_GitGovRecord = GitGovRecord;
778
+ type index$m_GitGovRecordPayload = GitGovRecordPayload;
779
+ type index$m_GitGovRecordType = GitGovRecordType;
780
+ type index$m_GitGovTaskRecord = GitGovTaskRecord;
781
+ type index$m_Signature = Signature;
782
+ type index$m_TaskPayload = TaskPayload;
783
+ type index$m_TaskRecord = TaskRecord;
784
+ type index$m_WorkflowMethodologyRecord = WorkflowMethodologyRecord;
785
+ declare namespace index$m {
786
+ export { type index$m_ActorPayload as ActorPayload, type index$m_ActorRecord as ActorRecord, type index$m_AgentPayload as AgentPayload, type index$m_AgentRecord as AgentRecord, type index$m_ChangelogPayload as ChangelogPayload, type index$m_ChangelogRecord as ChangelogRecord, type index$m_CustomRecord as CustomRecord, type index$m_CyclePayload as CyclePayload, type index$m_CycleRecord as CycleRecord, type index$m_EmbeddedMetadataHeader as EmbeddedMetadataHeader, type index$m_EmbeddedMetadataRecord as EmbeddedMetadataRecord, type index$m_ExecutionPayload as ExecutionPayload, type index$m_ExecutionRecord as ExecutionRecord, type index$m_FeedbackPayload as FeedbackPayload, type index$m_FeedbackRecord as FeedbackRecord, type index$m_GitGovActorRecord as GitGovActorRecord, type index$m_GitGovAgentRecord as GitGovAgentRecord, type index$m_GitGovChangelogRecord as GitGovChangelogRecord, type index$m_GitGovCycleRecord as GitGovCycleRecord, index$m_GitGovError as GitGovError, type index$m_GitGovExecutionRecord as GitGovExecutionRecord, type index$m_GitGovFeedbackRecord as GitGovFeedbackRecord, type index$m_GitGovRecord as GitGovRecord, type index$m_GitGovRecordPayload as GitGovRecordPayload, type index$m_GitGovRecordType as GitGovRecordType, type index$m_GitGovTaskRecord as GitGovTaskRecord, type index$m_Signature as Signature, type index$m_TaskPayload as TaskPayload, type index$m_TaskRecord as TaskRecord, type index$m_WorkflowMethodologyRecord as WorkflowMethodologyRecord };
787
787
  }
788
788
 
789
789
  type StorablePayload$1 = Exclude<GitGovRecordPayload, CustomRecord>;
@@ -816,11 +816,11 @@ declare class RecordStore<T extends StorablePayload$1> {
816
816
  exists(recordId: string): Promise<boolean>;
817
817
  }
818
818
 
819
- type index$j_FsDependencies = FsDependencies;
820
- type index$j_RecordStore<T extends StorablePayload$1> = RecordStore<T>;
821
- declare const index$j_RecordStore: typeof RecordStore;
822
- declare namespace index$j {
823
- export { type index$j_FsDependencies as FsDependencies, index$j_RecordStore as RecordStore };
819
+ type index$l_FsDependencies = FsDependencies;
820
+ type index$l_RecordStore<T extends StorablePayload$1> = RecordStore<T>;
821
+ declare const index$l_RecordStore: typeof RecordStore;
822
+ declare namespace index$l {
823
+ export { type index$l_FsDependencies as FsDependencies, index$l_RecordStore as RecordStore };
824
824
  }
825
825
 
826
826
  /**
@@ -1180,31 +1180,31 @@ declare function publishEvent(event: GitGovEvent): void;
1180
1180
  */
1181
1181
  declare function subscribeToEvent<T extends GitGovEvent>(eventType: T['type'], handler: EventHandler<T>): EventSubscription;
1182
1182
 
1183
- type index$i_ActivityEvent = ActivityEvent;
1184
- type index$i_ActorCreatedEvent = ActorCreatedEvent;
1185
- type index$i_ActorRevokedEvent = ActorRevokedEvent;
1186
- type index$i_AgentRegisteredEvent = AgentRegisteredEvent;
1187
- type index$i_BaseEvent = BaseEvent;
1188
- type index$i_ChangelogCreatedEvent = ChangelogCreatedEvent;
1189
- type index$i_CycleCreatedEvent = CycleCreatedEvent;
1190
- type index$i_CycleStatusChangedEvent = CycleStatusChangedEvent;
1191
- type index$i_EventBus = EventBus;
1192
- declare const index$i_EventBus: typeof EventBus;
1193
- type index$i_EventHandler<T extends BaseEvent = BaseEvent> = EventHandler<T>;
1194
- type index$i_EventMetadata = EventMetadata;
1195
- type index$i_EventSubscription = EventSubscription;
1196
- type index$i_ExecutionCreatedEvent = ExecutionCreatedEvent;
1197
- type index$i_FeedbackCreatedEvent = FeedbackCreatedEvent;
1198
- type index$i_GitGovEvent = GitGovEvent;
1199
- type index$i_IEventStream = IEventStream;
1200
- type index$i_SystemDailyTickEvent = SystemDailyTickEvent;
1201
- type index$i_TaskCreatedEvent = TaskCreatedEvent;
1202
- type index$i_TaskStatusChangedEvent = TaskStatusChangedEvent;
1203
- declare const index$i_eventBus: typeof eventBus;
1204
- declare const index$i_publishEvent: typeof publishEvent;
1205
- declare const index$i_subscribeToEvent: typeof subscribeToEvent;
1206
- declare namespace index$i {
1207
- export { type index$i_ActivityEvent as ActivityEvent, type index$i_ActorCreatedEvent as ActorCreatedEvent, type index$i_ActorRevokedEvent as ActorRevokedEvent, type index$i_AgentRegisteredEvent as AgentRegisteredEvent, type index$i_BaseEvent as BaseEvent, type index$i_ChangelogCreatedEvent as ChangelogCreatedEvent, type index$i_CycleCreatedEvent as CycleCreatedEvent, type index$i_CycleStatusChangedEvent as CycleStatusChangedEvent, index$i_EventBus as EventBus, type index$i_EventHandler as EventHandler, type index$i_EventMetadata as EventMetadata, type index$i_EventSubscription as EventSubscription, type index$i_ExecutionCreatedEvent as ExecutionCreatedEvent, type index$i_FeedbackCreatedEvent as FeedbackCreatedEvent, type index$i_GitGovEvent as GitGovEvent, type index$i_IEventStream as IEventStream, type index$i_SystemDailyTickEvent as SystemDailyTickEvent, type index$i_TaskCreatedEvent as TaskCreatedEvent, type index$i_TaskStatusChangedEvent as TaskStatusChangedEvent, index$i_eventBus as eventBus, index$i_publishEvent as publishEvent, index$i_subscribeToEvent as subscribeToEvent };
1183
+ type index$k_ActivityEvent = ActivityEvent;
1184
+ type index$k_ActorCreatedEvent = ActorCreatedEvent;
1185
+ type index$k_ActorRevokedEvent = ActorRevokedEvent;
1186
+ type index$k_AgentRegisteredEvent = AgentRegisteredEvent;
1187
+ type index$k_BaseEvent = BaseEvent;
1188
+ type index$k_ChangelogCreatedEvent = ChangelogCreatedEvent;
1189
+ type index$k_CycleCreatedEvent = CycleCreatedEvent;
1190
+ type index$k_CycleStatusChangedEvent = CycleStatusChangedEvent;
1191
+ type index$k_EventBus = EventBus;
1192
+ declare const index$k_EventBus: typeof EventBus;
1193
+ type index$k_EventHandler<T extends BaseEvent = BaseEvent> = EventHandler<T>;
1194
+ type index$k_EventMetadata = EventMetadata;
1195
+ type index$k_EventSubscription = EventSubscription;
1196
+ type index$k_ExecutionCreatedEvent = ExecutionCreatedEvent;
1197
+ type index$k_FeedbackCreatedEvent = FeedbackCreatedEvent;
1198
+ type index$k_GitGovEvent = GitGovEvent;
1199
+ type index$k_IEventStream = IEventStream;
1200
+ type index$k_SystemDailyTickEvent = SystemDailyTickEvent;
1201
+ type index$k_TaskCreatedEvent = TaskCreatedEvent;
1202
+ type index$k_TaskStatusChangedEvent = TaskStatusChangedEvent;
1203
+ declare const index$k_eventBus: typeof eventBus;
1204
+ declare const index$k_publishEvent: typeof publishEvent;
1205
+ declare const index$k_subscribeToEvent: typeof subscribeToEvent;
1206
+ declare namespace index$k {
1207
+ export { type index$k_ActivityEvent as ActivityEvent, type index$k_ActorCreatedEvent as ActorCreatedEvent, type index$k_ActorRevokedEvent as ActorRevokedEvent, type index$k_AgentRegisteredEvent as AgentRegisteredEvent, type index$k_BaseEvent as BaseEvent, type index$k_ChangelogCreatedEvent as ChangelogCreatedEvent, type index$k_CycleCreatedEvent as CycleCreatedEvent, type index$k_CycleStatusChangedEvent as CycleStatusChangedEvent, index$k_EventBus as EventBus, type index$k_EventHandler as EventHandler, type index$k_EventMetadata as EventMetadata, type index$k_EventSubscription as EventSubscription, type index$k_ExecutionCreatedEvent as ExecutionCreatedEvent, type index$k_FeedbackCreatedEvent as FeedbackCreatedEvent, type index$k_GitGovEvent as GitGovEvent, type index$k_IEventStream as IEventStream, type index$k_SystemDailyTickEvent as SystemDailyTickEvent, type index$k_TaskCreatedEvent as TaskCreatedEvent, type index$k_TaskStatusChangedEvent as TaskStatusChangedEvent, index$k_eventBus as eventBus, index$k_publishEvent as publishEvent, index$k_subscribeToEvent as subscribeToEvent };
1208
1208
  }
1209
1209
 
1210
1210
  /**
@@ -1218,7 +1218,7 @@ interface IIdentityAdapter {
1218
1218
  resolveCurrentActorId(originalActorId: string): Promise<string>;
1219
1219
  getCurrentActor(): Promise<ActorRecord>;
1220
1220
  getEffectiveActorForAgent(agentId: string): Promise<ActorRecord | null>;
1221
- signRecord(record: GitGovRecord, actorId: string, role: string): Promise<GitGovRecord>;
1221
+ signRecord(record: GitGovRecord, actorId: string, role: string, notes: string): Promise<GitGovRecord>;
1222
1222
  rotateActorKey(actorId: string): Promise<{
1223
1223
  oldActor: ActorRecord;
1224
1224
  newActor: ActorRecord;
@@ -1249,7 +1249,7 @@ declare class IdentityAdapter implements IIdentityAdapter {
1249
1249
  createActor(payload: ActorPayload, _signerId: string): Promise<ActorRecord>;
1250
1250
  getActor(actorId: string): Promise<ActorRecord | null>;
1251
1251
  listActors(): Promise<ActorRecord[]>;
1252
- signRecord(record: GitGovRecord, actorId: string, role: string): Promise<GitGovRecord>;
1252
+ signRecord(record: GitGovRecord, actorId: string, role: string, notes: string): Promise<GitGovRecord>;
1253
1253
  /**
1254
1254
  * Resolves the current active ActorRecord ID by following the succession chain.
1255
1255
  * This is critical for AgentRecord operations after key rotation.
@@ -1284,12 +1284,12 @@ declare class IdentityAdapter implements IIdentityAdapter {
1284
1284
  listAgentRecords(): Promise<AgentRecord[]>;
1285
1285
  }
1286
1286
 
1287
- type index$h_IIdentityAdapter = IIdentityAdapter;
1288
- type index$h_IdentityAdapter = IdentityAdapter;
1289
- declare const index$h_IdentityAdapter: typeof IdentityAdapter;
1290
- type index$h_IdentityAdapterDependencies = IdentityAdapterDependencies;
1291
- declare namespace index$h {
1292
- export { type index$h_IIdentityAdapter as IIdentityAdapter, index$h_IdentityAdapter as IdentityAdapter, type index$h_IdentityAdapterDependencies as IdentityAdapterDependencies };
1287
+ type index$j_IIdentityAdapter = IIdentityAdapter;
1288
+ type index$j_IdentityAdapter = IdentityAdapter;
1289
+ declare const index$j_IdentityAdapter: typeof IdentityAdapter;
1290
+ type index$j_IdentityAdapterDependencies = IdentityAdapterDependencies;
1291
+ declare namespace index$j {
1292
+ export { type index$j_IIdentityAdapter as IIdentityAdapter, index$j_IdentityAdapter as IdentityAdapter, type index$j_IdentityAdapterDependencies as IdentityAdapterDependencies };
1293
1293
  }
1294
1294
 
1295
1295
  /**
@@ -1407,13 +1407,13 @@ declare class FeedbackAdapter implements IFeedbackAdapter {
1407
1407
  private buildThread;
1408
1408
  }
1409
1409
 
1410
- type index$g_FeedbackAdapter = FeedbackAdapter;
1411
- declare const index$g_FeedbackAdapter: typeof FeedbackAdapter;
1412
- type index$g_FeedbackAdapterDependencies = FeedbackAdapterDependencies;
1413
- type index$g_FeedbackThread = FeedbackThread;
1414
- type index$g_IFeedbackAdapter = IFeedbackAdapter;
1415
- declare namespace index$g {
1416
- export { index$g_FeedbackAdapter as FeedbackAdapter, type index$g_FeedbackAdapterDependencies as FeedbackAdapterDependencies, type index$g_FeedbackThread as FeedbackThread, type index$g_IFeedbackAdapter as IFeedbackAdapter };
1410
+ type index$i_FeedbackAdapter = FeedbackAdapter;
1411
+ declare const index$i_FeedbackAdapter: typeof FeedbackAdapter;
1412
+ type index$i_FeedbackAdapterDependencies = FeedbackAdapterDependencies;
1413
+ type index$i_FeedbackThread = FeedbackThread;
1414
+ type index$i_IFeedbackAdapter = IFeedbackAdapter;
1415
+ declare namespace index$i {
1416
+ export { index$i_FeedbackAdapter as FeedbackAdapter, type index$i_FeedbackAdapterDependencies as FeedbackAdapterDependencies, type index$i_FeedbackThread as FeedbackThread, type index$i_IFeedbackAdapter as IFeedbackAdapter };
1417
1417
  }
1418
1418
 
1419
1419
  /**
@@ -1501,12 +1501,12 @@ declare class ExecutionAdapter implements IExecutionAdapter {
1501
1501
  private isFirstExecutionForTask;
1502
1502
  }
1503
1503
 
1504
- type index$f_ExecutionAdapter = ExecutionAdapter;
1505
- declare const index$f_ExecutionAdapter: typeof ExecutionAdapter;
1506
- type index$f_ExecutionAdapterDependencies = ExecutionAdapterDependencies;
1507
- type index$f_IExecutionAdapter = IExecutionAdapter;
1508
- declare namespace index$f {
1509
- export { index$f_ExecutionAdapter as ExecutionAdapter, type index$f_ExecutionAdapterDependencies as ExecutionAdapterDependencies, type index$f_IExecutionAdapter as IExecutionAdapter };
1504
+ type index$h_ExecutionAdapter = ExecutionAdapter;
1505
+ declare const index$h_ExecutionAdapter: typeof ExecutionAdapter;
1506
+ type index$h_ExecutionAdapterDependencies = ExecutionAdapterDependencies;
1507
+ type index$h_IExecutionAdapter = IExecutionAdapter;
1508
+ declare namespace index$h {
1509
+ export { index$h_ExecutionAdapter as ExecutionAdapter, type index$h_ExecutionAdapterDependencies as ExecutionAdapterDependencies, type index$h_IExecutionAdapter as IExecutionAdapter };
1510
1510
  }
1511
1511
 
1512
1512
  /**
@@ -1599,13 +1599,13 @@ declare class ChangelogAdapter implements IChangelogAdapter {
1599
1599
  getChangelogsByEntity(entityId: string, _entityType?: string): Promise<ChangelogRecord[]>;
1600
1600
  }
1601
1601
 
1602
- type index$e_ChangelogAdapter = ChangelogAdapter;
1603
- declare const index$e_ChangelogAdapter: typeof ChangelogAdapter;
1604
- type index$e_ChangelogAdapterDependencies = ChangelogAdapterDependencies;
1605
- type index$e_ChangelogListOptions = ChangelogListOptions;
1606
- type index$e_IChangelogAdapter = IChangelogAdapter;
1607
- declare namespace index$e {
1608
- export { index$e_ChangelogAdapter as ChangelogAdapter, type index$e_ChangelogAdapterDependencies as ChangelogAdapterDependencies, type index$e_ChangelogListOptions as ChangelogListOptions, type index$e_IChangelogAdapter as IChangelogAdapter };
1602
+ type index$g_ChangelogAdapter = ChangelogAdapter;
1603
+ declare const index$g_ChangelogAdapter: typeof ChangelogAdapter;
1604
+ type index$g_ChangelogAdapterDependencies = ChangelogAdapterDependencies;
1605
+ type index$g_ChangelogListOptions = ChangelogListOptions;
1606
+ type index$g_IChangelogAdapter = IChangelogAdapter;
1607
+ declare namespace index$g {
1608
+ export { index$g_ChangelogAdapter as ChangelogAdapter, type index$g_ChangelogAdapterDependencies as ChangelogAdapterDependencies, type index$g_ChangelogListOptions as ChangelogListOptions, type index$g_IChangelogAdapter as IChangelogAdapter };
1609
1609
  }
1610
1610
 
1611
1611
  /**
@@ -1617,9 +1617,9 @@ type MetricsAdapterDependencies = {
1617
1617
  feedbackStore?: RecordStore<FeedbackRecord>;
1618
1618
  executionStore?: RecordStore<ExecutionRecord>;
1619
1619
  actorStore?: RecordStore<ActorRecord>;
1620
- platformApi?: IPlatformApi$1;
1620
+ platformApi?: IPlatformApi;
1621
1621
  };
1622
- interface IPlatformApi$1 {
1622
+ interface IPlatformApi {
1623
1623
  getTokenConsumption(timeframe: string): Promise<TokenConsumption[]>;
1624
1624
  }
1625
1625
  type TokenConsumption = {
@@ -1790,16 +1790,254 @@ declare class MetricsAdapter implements IMetricsAdapter {
1790
1790
  calculateAgentExecutionTime(_executions: ExecutionRecord[]): number;
1791
1791
  }
1792
1792
 
1793
- type index$d_CollaborationMetrics = CollaborationMetrics;
1794
- type index$d_IMetricsAdapter = IMetricsAdapter;
1795
- type index$d_MetricsAdapter = MetricsAdapter;
1796
- declare const index$d_MetricsAdapter: typeof MetricsAdapter;
1797
- type index$d_MetricsAdapterDependencies = MetricsAdapterDependencies;
1798
- type index$d_ProductivityMetrics = ProductivityMetrics;
1799
- type index$d_SystemStatus = SystemStatus;
1800
- type index$d_TaskHealthReport = TaskHealthReport;
1801
- declare namespace index$d {
1802
- export { type index$d_CollaborationMetrics as CollaborationMetrics, type index$d_IMetricsAdapter as IMetricsAdapter, index$d_MetricsAdapter as MetricsAdapter, type index$d_MetricsAdapterDependencies as MetricsAdapterDependencies, type index$d_ProductivityMetrics as ProductivityMetrics, type index$d_SystemStatus as SystemStatus, type index$d_TaskHealthReport as TaskHealthReport };
1793
+ type index$f_CollaborationMetrics = CollaborationMetrics;
1794
+ type index$f_IMetricsAdapter = IMetricsAdapter;
1795
+ type index$f_MetricsAdapter = MetricsAdapter;
1796
+ declare const index$f_MetricsAdapter: typeof MetricsAdapter;
1797
+ type index$f_MetricsAdapterDependencies = MetricsAdapterDependencies;
1798
+ type index$f_ProductivityMetrics = ProductivityMetrics;
1799
+ type index$f_SystemStatus = SystemStatus;
1800
+ type index$f_TaskHealthReport = TaskHealthReport;
1801
+ declare namespace index$f {
1802
+ export { type index$f_CollaborationMetrics as CollaborationMetrics, type index$f_IMetricsAdapter as IMetricsAdapter, index$f_MetricsAdapter as MetricsAdapter, type index$f_MetricsAdapterDependencies as MetricsAdapterDependencies, type index$f_ProductivityMetrics as ProductivityMetrics, type index$f_SystemStatus as SystemStatus, type index$f_TaskHealthReport as TaskHealthReport };
1803
+ }
1804
+
1805
+ /**
1806
+ * GitGovernance Configuration Types
1807
+ * Based on config_file.md blueprint
1808
+ */
1809
+ interface GitGovConfig {
1810
+ protocolVersion: string;
1811
+ projectId: string;
1812
+ projectName: string;
1813
+ rootCycle: string;
1814
+ state?: {
1815
+ branch?: string;
1816
+ sync?: {
1817
+ strategy?: "manual" | "immediate" | "batched";
1818
+ maxRetries?: number;
1819
+ pushIntervalSeconds?: number;
1820
+ batchIntervalSeconds?: number;
1821
+ };
1822
+ defaults?: {
1823
+ pullScheduler?: {
1824
+ defaultIntervalSeconds?: number;
1825
+ defaultEnabled?: boolean;
1826
+ defaultContinueOnNetworkError?: boolean;
1827
+ defaultStopOnConflict?: boolean;
1828
+ };
1829
+ fileWatcher?: {
1830
+ defaultDebounceMs?: number;
1831
+ defaultIgnoredPatterns?: string[];
1832
+ };
1833
+ };
1834
+ };
1835
+ }
1836
+ /**
1837
+ * GitGovernance Session State Types
1838
+ * Based on session_state.md blueprint
1839
+ */
1840
+ interface SyncStatus {
1841
+ lastSyncPush?: string;
1842
+ lastSyncPull?: string;
1843
+ status?: 'synced' | 'pending' | 'pulling' | 'pushing' | 'conflict';
1844
+ lastError?: string;
1845
+ }
1846
+ interface ActorState {
1847
+ activeTaskId?: string | undefined;
1848
+ activeCycleId?: string | undefined;
1849
+ lastSync?: string;
1850
+ syncStatus?: SyncStatus;
1851
+ [key: string]: any;
1852
+ }
1853
+ interface GitGovSession {
1854
+ cloud?: {
1855
+ sessionToken?: string;
1856
+ };
1857
+ lastSession?: {
1858
+ actorId: string;
1859
+ timestamp: string;
1860
+ };
1861
+ actorState?: Record<string, ActorState>;
1862
+ syncPreferences?: {
1863
+ pullScheduler?: {
1864
+ enabled?: boolean;
1865
+ pullIntervalSeconds?: number;
1866
+ continueOnNetworkError?: boolean;
1867
+ stopOnConflict?: boolean;
1868
+ };
1869
+ fileWatcher?: {
1870
+ enabled?: boolean;
1871
+ debounceMs?: number;
1872
+ ignoredPatterns?: string[];
1873
+ };
1874
+ };
1875
+ }
1876
+ /**
1877
+ * Configuration Manager Class
1878
+ * Provides typed access to GitGovernance configuration and session state
1879
+ */
1880
+ declare class ConfigManager {
1881
+ private configPath;
1882
+ private sessionPath;
1883
+ constructor(projectRootPath?: string);
1884
+ /**
1885
+ * Load GitGovernance configuration
1886
+ */
1887
+ loadConfig(): Promise<GitGovConfig | null>;
1888
+ /**
1889
+ * Load GitGovernance session state
1890
+ * [EARS-53] Auto-detects actor from .key files if no session or no actorId exists
1891
+ */
1892
+ loadSession(): Promise<GitGovSession | null>;
1893
+ /**
1894
+ * [EARS-53] Detect actor from .key files in .gitgov/actors/
1895
+ * Returns the actor ID if exactly one .key file exists, or the first one if multiple exist.
1896
+ * Private keys (.key files) indicate which actors can sign on this machine.
1897
+ */
1898
+ detectActorFromKeyFiles(): Promise<string | null>;
1899
+ /**
1900
+ * Get root cycle from configuration
1901
+ */
1902
+ getRootCycle(): Promise<string | null>;
1903
+ /**
1904
+ * Get project information from configuration
1905
+ */
1906
+ getProjectInfo(): Promise<{
1907
+ id: string;
1908
+ name: string;
1909
+ } | null>;
1910
+ /**
1911
+ * Get actor state for a specific actor
1912
+ */
1913
+ getActorState(actorId: string): Promise<ActorState | null>;
1914
+ /**
1915
+ * Update actor state for a specific actor
1916
+ */
1917
+ updateActorState(actorId: string, state: Partial<ActorState>): Promise<void>;
1918
+ /**
1919
+ * Get cloud session token
1920
+ */
1921
+ getCloudSessionToken(): Promise<string | null>;
1922
+ /**
1923
+ * Get complete context information for an actor
1924
+ * Useful for agents to understand current working context
1925
+ * Returns information from both config.json (project-level) and .session.json (actor-level)
1926
+ */
1927
+ getActorContext(actorId: string): Promise<{
1928
+ actorId: string;
1929
+ activeCycleId: string | null;
1930
+ activeTaskId: string | null;
1931
+ rootCycle: string | null;
1932
+ projectInfo: {
1933
+ id: string;
1934
+ name: string;
1935
+ } | null;
1936
+ syncStatus: SyncStatus | null;
1937
+ }>;
1938
+ /**
1939
+ * Get sync configuration from config.json
1940
+ * Returns sync strategy and related settings with defaults
1941
+ */
1942
+ getSyncConfig(): Promise<{
1943
+ strategy: "manual" | "immediate" | "batched";
1944
+ maxRetries: number;
1945
+ pushIntervalSeconds: number;
1946
+ batchIntervalSeconds: number;
1947
+ } | null>;
1948
+ /**
1949
+ * Get sync defaults from config.json
1950
+ * Returns recommended defaults for pullScheduler and fileWatcher
1951
+ */
1952
+ getSyncDefaults(): Promise<{
1953
+ pullScheduler: {
1954
+ defaultIntervalSeconds: number;
1955
+ defaultEnabled: boolean;
1956
+ defaultContinueOnNetworkError: boolean;
1957
+ defaultStopOnConflict: boolean;
1958
+ };
1959
+ fileWatcher: {
1960
+ defaultDebounceMs: number;
1961
+ defaultIgnoredPatterns: string[];
1962
+ };
1963
+ }>;
1964
+ /**
1965
+ * Resolve PullScheduler configuration with priority logic:
1966
+ * 1. Local preferences (.session.json syncPreferences)
1967
+ * 2. Project defaults (config.json state.defaults)
1968
+ * 3. Hardcoded fallbacks
1969
+ */
1970
+ resolvePullSchedulerConfig(): Promise<{
1971
+ enabled: boolean;
1972
+ pullIntervalSeconds: number;
1973
+ continueOnNetworkError: boolean;
1974
+ stopOnConflict: boolean;
1975
+ }>;
1976
+ /**
1977
+ * Resolve FileWatcher configuration with priority logic:
1978
+ * 1. Local preferences (.session.json syncPreferences)
1979
+ * 2. Project defaults (config.json state.defaults)
1980
+ * 3. Hardcoded fallbacks
1981
+ */
1982
+ resolveFileWatcherConfig(): Promise<{
1983
+ enabled: boolean;
1984
+ debounceMs: number;
1985
+ ignoredPatterns: string[];
1986
+ }>;
1987
+ /**
1988
+ * Update sync preferences in .session.json
1989
+ * These are local machine preferences that override project defaults
1990
+ */
1991
+ updateSyncPreferences(preferences: {
1992
+ pullScheduler?: Partial<{
1993
+ enabled: boolean;
1994
+ pullIntervalSeconds: number;
1995
+ continueOnNetworkError: boolean;
1996
+ stopOnConflict: boolean;
1997
+ }>;
1998
+ fileWatcher?: Partial<{
1999
+ enabled: boolean;
2000
+ debounceMs: number;
2001
+ ignoredPatterns: string[];
2002
+ }>;
2003
+ }): Promise<void>;
2004
+ /**
2005
+ * Finds the project root by searching upwards for a .git directory.
2006
+ * Caches the result for subsequent calls.
2007
+ * @param startPath The path to start searching from. Defaults to the current working directory.
2008
+ * @returns The absolute path to the project root, or null if not found.
2009
+ */
2010
+ static findProjectRoot(startPath?: string): string | null;
2011
+ /**
2012
+ * Finds the appropriate project root by searching upwards.
2013
+ * First looks for .gitgov (initialized project), then .git (for init).
2014
+ * @param startPath The path to start searching from. Defaults to the current working directory.
2015
+ * @returns The absolute path to the project root, or null if not found.
2016
+ */
2017
+ static findGitgovRoot(startPath?: string): string | null;
2018
+ /**
2019
+ * Gets the .gitgov directory path from project root
2020
+ */
2021
+ static getGitgovPath(): string;
2022
+ /**
2023
+ * Checks if current directory is a GitGovernance project
2024
+ */
2025
+ static isGitgovProject(): boolean;
2026
+ }
2027
+ /**
2028
+ * Create a ConfigManager instance for the current project
2029
+ */
2030
+ declare function createConfigManager(projectRoot?: string): ConfigManager;
2031
+
2032
+ type index$e_ActorState = ActorState;
2033
+ type index$e_ConfigManager = ConfigManager;
2034
+ declare const index$e_ConfigManager: typeof ConfigManager;
2035
+ type index$e_GitGovConfig = GitGovConfig;
2036
+ type index$e_GitGovSession = GitGovSession;
2037
+ type index$e_SyncStatus = SyncStatus;
2038
+ declare const index$e_createConfigManager: typeof createConfigManager;
2039
+ declare namespace index$e {
2040
+ export { type index$e_ActorState as ActorState, index$e_ConfigManager as ConfigManager, type index$e_GitGovConfig as GitGovConfig, type index$e_GitGovSession as GitGovSession, type index$e_SyncStatus as SyncStatus, index$e_createConfigManager as createConfigManager };
1803
2041
  }
1804
2042
 
1805
2043
  type TaskStatus = TaskRecord['status'];
@@ -1871,12 +2109,12 @@ declare class WorkflowMethodologyAdapter implements IWorkflowMethodology {
1871
2109
  getAvailableTransitions(from: TaskStatus): Promise<TransitionRule[]>;
1872
2110
  }
1873
2111
 
1874
- type index$c_IWorkflowMethodology = IWorkflowMethodology;
1875
- type index$c_WorkflowMethodologyAdapter = WorkflowMethodologyAdapter;
1876
- declare const index$c_WorkflowMethodologyAdapter: typeof WorkflowMethodologyAdapter;
1877
- type index$c_WorkflowMethodologyAdapterDependencies = WorkflowMethodologyAdapterDependencies;
1878
- declare namespace index$c {
1879
- export { type index$c_IWorkflowMethodology as IWorkflowMethodology, type ValidationContext$1 as ValidationContext, index$c_WorkflowMethodologyAdapter as WorkflowMethodologyAdapter, type index$c_WorkflowMethodologyAdapterDependencies as WorkflowMethodologyAdapterDependencies };
2112
+ type index$d_IWorkflowMethodology = IWorkflowMethodology;
2113
+ type index$d_WorkflowMethodologyAdapter = WorkflowMethodologyAdapter;
2114
+ declare const index$d_WorkflowMethodologyAdapter: typeof WorkflowMethodologyAdapter;
2115
+ type index$d_WorkflowMethodologyAdapterDependencies = WorkflowMethodologyAdapterDependencies;
2116
+ declare namespace index$d {
2117
+ export { type index$d_IWorkflowMethodology as IWorkflowMethodology, type ValidationContext$1 as ValidationContext, index$d_WorkflowMethodologyAdapter as WorkflowMethodologyAdapter, type index$d_WorkflowMethodologyAdapterDependencies as WorkflowMethodologyAdapterDependencies };
1880
2118
  }
1881
2119
 
1882
2120
  /**
@@ -1896,6 +2134,7 @@ type BacklogAdapterDependencies = {
1896
2134
  planningMethodologyAdapter?: IWorkflowMethodology;
1897
2135
  identity: IdentityAdapter;
1898
2136
  eventBus: IEventStream;
2137
+ configManager: ConfigManager;
1899
2138
  config?: BacklogAdapterConfig;
1900
2139
  };
1901
2140
  /**
@@ -1907,7 +2146,7 @@ interface IBacklogAdapter {
1907
2146
  getAllTasks(): Promise<TaskRecord[]>;
1908
2147
  submitTask(taskId: string, actorId: string): Promise<TaskRecord>;
1909
2148
  approveTask(taskId: string, actorId: string): Promise<TaskRecord>;
1910
- updateTask(taskId: string, payload: Partial<TaskRecord>): Promise<TaskRecord>;
2149
+ updateTask(taskId: string, payload: Partial<TaskRecord>, actorId: string): Promise<TaskRecord>;
1911
2150
  activateTask(taskId: string, actorId: string): Promise<TaskRecord>;
1912
2151
  completeTask(taskId: string, actorId: string): Promise<TaskRecord>;
1913
2152
  pauseTask(taskId: string, actorId: string, reason?: string): Promise<TaskRecord>;
@@ -1965,6 +2204,7 @@ declare class BacklogAdapter implements IBacklogAdapter {
1965
2204
  private workflowMethodologyAdapter;
1966
2205
  private identity;
1967
2206
  private eventBus;
2207
+ private configManager;
1968
2208
  private config;
1969
2209
  constructor(dependencies: BacklogAdapterDependencies);
1970
2210
  /**
@@ -2019,8 +2259,9 @@ declare class BacklogAdapter implements IBacklogAdapter {
2019
2259
  deleteTask(taskId: string, actorId: string): Promise<void>;
2020
2260
  /**
2021
2261
  * Updates a task with new payload
2262
+ * [EARS-28] Signs the updated record with the editor's signature
2022
2263
  */
2023
- updateTask(taskId: string, payload: Partial<TaskRecord>): Promise<TaskRecord>;
2264
+ updateTask(taskId: string, payload: Partial<TaskRecord>, actorId: string): Promise<TaskRecord>;
2024
2265
  /**
2025
2266
  * Gets tasks assigned to a specific actor
2026
2267
  */
@@ -2085,7 +2326,7 @@ declare class BacklogAdapter implements IBacklogAdapter {
2085
2326
  /**
2086
2327
  * Updates a cycle with new payload
2087
2328
  */
2088
- updateCycle(cycleId: string, payload: Partial<CycleRecord>): Promise<CycleRecord>;
2329
+ updateCycle(cycleId: string, payload: Partial<CycleRecord>, actorId?: string): Promise<CycleRecord>;
2089
2330
  /**
2090
2331
  * Creates bidirectional link between task and cycle
2091
2332
  */
@@ -2106,13 +2347,13 @@ declare class BacklogAdapter implements IBacklogAdapter {
2106
2347
  processChanges(_changes: unknown[]): Promise<ExecutionRecord[]>;
2107
2348
  }
2108
2349
 
2109
- type index$b_BacklogAdapter = BacklogAdapter;
2110
- declare const index$b_BacklogAdapter: typeof BacklogAdapter;
2111
- type index$b_BacklogAdapterConfig = BacklogAdapterConfig;
2112
- type index$b_BacklogAdapterDependencies = BacklogAdapterDependencies;
2113
- type index$b_IBacklogAdapter = IBacklogAdapter;
2114
- declare namespace index$b {
2115
- export { index$b_BacklogAdapter as BacklogAdapter, type index$b_BacklogAdapterConfig as BacklogAdapterConfig, type index$b_BacklogAdapterDependencies as BacklogAdapterDependencies, type index$b_IBacklogAdapter as IBacklogAdapter };
2350
+ type index$c_BacklogAdapter = BacklogAdapter;
2351
+ declare const index$c_BacklogAdapter: typeof BacklogAdapter;
2352
+ type index$c_BacklogAdapterConfig = BacklogAdapterConfig;
2353
+ type index$c_BacklogAdapterDependencies = BacklogAdapterDependencies;
2354
+ type index$c_IBacklogAdapter = IBacklogAdapter;
2355
+ declare namespace index$c {
2356
+ export { index$c_BacklogAdapter as BacklogAdapter, type index$c_BacklogAdapterConfig as BacklogAdapterConfig, type index$c_BacklogAdapterDependencies as BacklogAdapterDependencies, type index$c_IBacklogAdapter as IBacklogAdapter };
2116
2357
  }
2117
2358
 
2118
2359
  /**
@@ -2471,138 +2712,723 @@ declare class FileIndexerAdapter implements IIndexerAdapter {
2471
2712
  private getTimestampFromId;
2472
2713
  }
2473
2714
 
2474
- type index$a_AllRecords = AllRecords;
2475
- type index$a_DerivedStateSets = DerivedStateSets;
2476
- type index$a_DerivedStates = DerivedStates;
2477
- type index$a_EnrichedTaskRecord = EnrichedTaskRecord;
2478
- type index$a_FileIndexerAdapter = FileIndexerAdapter;
2479
- declare const index$a_FileIndexerAdapter: typeof FileIndexerAdapter;
2480
- type index$a_IIndexerAdapter = IIndexerAdapter;
2481
- type index$a_IndexData = IndexData;
2482
- type index$a_IndexGenerationReport = IndexGenerationReport;
2483
- type index$a_IndexerAdapterDependencies = IndexerAdapterDependencies;
2484
- type index$a_IntegrityError = IntegrityError;
2485
- type index$a_IntegrityReport = IntegrityReport;
2486
- type index$a_IntegrityWarning = IntegrityWarning;
2487
- declare namespace index$a {
2488
- export { type index$a_AllRecords as AllRecords, type index$a_DerivedStateSets as DerivedStateSets, type index$a_DerivedStates as DerivedStates, type index$a_EnrichedTaskRecord as EnrichedTaskRecord, index$a_FileIndexerAdapter as FileIndexerAdapter, type index$a_IIndexerAdapter as IIndexerAdapter, type index$a_IndexData as IndexData, type index$a_IndexGenerationReport as IndexGenerationReport, type index$a_IndexerAdapterDependencies as IndexerAdapterDependencies, type index$a_IntegrityError as IntegrityError, type index$a_IntegrityReport as IntegrityReport, type index$a_IntegrityWarning as IntegrityWarning };
2715
+ type index$b_AllRecords = AllRecords;
2716
+ type index$b_DerivedStateSets = DerivedStateSets;
2717
+ type index$b_DerivedStates = DerivedStates;
2718
+ type index$b_EnrichedTaskRecord = EnrichedTaskRecord;
2719
+ type index$b_FileIndexerAdapter = FileIndexerAdapter;
2720
+ declare const index$b_FileIndexerAdapter: typeof FileIndexerAdapter;
2721
+ type index$b_IIndexerAdapter = IIndexerAdapter;
2722
+ type index$b_IndexData = IndexData;
2723
+ type index$b_IndexGenerationReport = IndexGenerationReport;
2724
+ type index$b_IndexerAdapterDependencies = IndexerAdapterDependencies;
2725
+ type index$b_IntegrityError = IntegrityError;
2726
+ type index$b_IntegrityReport = IntegrityReport;
2727
+ type index$b_IntegrityWarning = IntegrityWarning;
2728
+ declare namespace index$b {
2729
+ export { type index$b_AllRecords as AllRecords, type index$b_DerivedStateSets as DerivedStateSets, type index$b_DerivedStates as DerivedStates, type index$b_EnrichedTaskRecord as EnrichedTaskRecord, index$b_FileIndexerAdapter as FileIndexerAdapter, type index$b_IIndexerAdapter as IIndexerAdapter, type index$b_IndexData as IndexData, type index$b_IndexGenerationReport as IndexGenerationReport, type index$b_IndexerAdapterDependencies as IndexerAdapterDependencies, type index$b_IntegrityError as IntegrityError, type index$b_IntegrityReport as IntegrityReport, type index$b_IntegrityWarning as IntegrityWarning };
2489
2730
  }
2490
2731
 
2491
2732
  /**
2492
- * GitGovernance Configuration Types
2493
- * Based on config_file.md blueprint
2733
+ * Type Definitions for GitModule
2734
+ *
2735
+ * These interfaces define the contracts for Git operations,
2736
+ * dependencies, and data structures used throughout the module.
2494
2737
  */
2495
- interface GitGovConfig {
2496
- protocolVersion: string;
2497
- projectId: string;
2498
- projectName: string;
2499
- rootCycle: string;
2500
- blueprints?: {
2501
- root?: string;
2502
- };
2503
- state?: {
2504
- branch?: string;
2505
- };
2506
- cloud?: {
2507
- projectId?: string;
2508
- providerMappings?: Record<string, string>;
2509
- };
2738
+ /**
2739
+ * Options for executing shell commands
2740
+ */
2741
+ interface ExecOptions {
2742
+ /** Working directory for the command */
2743
+ cwd?: string;
2744
+ /** Additional environment variables */
2745
+ env?: Record<string, string>;
2746
+ /** Timeout in milliseconds */
2747
+ timeout?: number;
2510
2748
  }
2511
2749
  /**
2512
- * GitGovernance Session State Types
2513
- * Based on session_state.md blueprint
2750
+ * Result of executing a shell command
2514
2751
  */
2515
- interface ActorState {
2516
- activeTaskId?: string;
2517
- activeCycleId?: string;
2518
- lastSync?: string;
2519
- [key: string]: any;
2752
+ interface ExecResult {
2753
+ /** Exit code (0 = success) */
2754
+ exitCode: number;
2755
+ /** Standard output */
2756
+ stdout: string;
2757
+ /** Standard error output */
2758
+ stderr: string;
2520
2759
  }
2521
- interface GitGovSession {
2522
- cloud?: {
2523
- sessionToken?: string;
2524
- };
2525
- lastSession?: {
2526
- actorId: string;
2527
- timestamp: string;
2528
- };
2529
- actorState?: Record<string, ActorState>;
2760
+ /**
2761
+ * Dependencies required by GitModule
2762
+ *
2763
+ * This module uses dependency injection to allow testing with mocks
2764
+ * and support different execution environments.
2765
+ */
2766
+ interface GitModuleDependencies {
2767
+ /** Path to the Git repository root (optional, auto-detected if not provided) */
2768
+ repoRoot?: string;
2769
+ /** Function to execute shell commands (required) */
2770
+ execCommand: (command: string, args: string[], options?: ExecOptions) => Promise<ExecResult>;
2530
2771
  }
2531
2772
  /**
2532
- * Configuration Manager Class
2533
- * Provides typed access to GitGovernance configuration and session state
2773
+ * Options for retrieving commit history
2534
2774
  */
2535
- declare class ConfigManager {
2536
- private configPath;
2537
- private sessionPath;
2538
- constructor(projectRootPath?: string);
2775
+ interface GetCommitHistoryOptions {
2776
+ /** Maximum number of commits to return */
2777
+ maxCount?: number;
2778
+ /** Path filter (e.g., ".gitgov/") */
2779
+ pathFilter?: string;
2780
+ /** Output format (default: "json") */
2781
+ format?: 'json' | 'text';
2782
+ }
2783
+ /**
2784
+ * Information about a commit in the history
2785
+ */
2786
+ interface CommitInfo {
2787
+ /** Commit hash */
2788
+ hash: string;
2789
+ /** Commit message */
2790
+ message: string;
2791
+ /** Commit author (name <email>) */
2792
+ author: string;
2793
+ /** Commit date (ISO 8601) */
2794
+ date: string;
2795
+ /** List of modified files (optional) */
2796
+ files?: string[];
2797
+ }
2798
+ /**
2799
+ * Information about a changed file
2800
+ */
2801
+ interface ChangedFile {
2802
+ /** Change status: A (Added), M (Modified), D (Deleted) */
2803
+ status: 'A' | 'M' | 'D';
2804
+ /** File path relative to repository root */
2805
+ file: string;
2806
+ }
2807
+ /**
2808
+ * Author information for commits
2809
+ */
2810
+ interface CommitAuthor {
2811
+ /** Author name */
2812
+ name: string;
2813
+ /** Author email */
2814
+ email: string;
2815
+ }
2816
+
2817
+ /**
2818
+ * GitModule - Low-level Git Operations
2819
+ *
2820
+ * This module provides a business-agnostic abstraction layer for interacting
2821
+ * with the local Git repository. It exposes semantic methods instead of raw
2822
+ * Git commands, with comprehensive error handling and type safety.
2823
+ *
2824
+ * @module git_module
2825
+ */
2826
+
2827
+ /**
2828
+ * GitModule class providing low-level Git operations
2829
+ *
2830
+ * All operations are async and use dependency injection for testability.
2831
+ * Errors are transformed into typed exceptions for better handling.
2832
+ */
2833
+ declare class GitModule {
2834
+ private repoRoot;
2835
+ private execCommand;
2539
2836
  /**
2540
- * Load GitGovernance configuration
2837
+ * Creates a new GitModule instance
2838
+ *
2839
+ * @param dependencies - Required dependencies (execCommand) and optional config (repoRoot)
2840
+ * @throws Error if execCommand is not provided
2541
2841
  */
2542
- loadConfig(): Promise<GitGovConfig | null>;
2842
+ constructor(dependencies: GitModuleDependencies);
2543
2843
  /**
2544
- * Load GitGovernance session state
2844
+ * Ensures that repoRoot is set, auto-detecting it if necessary
2845
+ *
2846
+ * @returns Path to repository root
2847
+ * @throws GitCommandError if not in a Git repository
2545
2848
  */
2546
- loadSession(): Promise<GitGovSession | null>;
2849
+ private ensureRepoRoot;
2547
2850
  /**
2548
- * Get root cycle from configuration
2851
+ * Executes a Git command with standardized error handling
2852
+ *
2853
+ * @param args - Git command arguments
2854
+ * @param options - Execution options
2855
+ * @returns Command result
2856
+ * @throws GitCommandError if command fails
2549
2857
  */
2550
- getRootCycle(): Promise<string | null>;
2858
+ private execGit;
2551
2859
  /**
2552
- * Get project information from configuration
2860
+ * Initializes a new Git repository in the current directory
2861
+ *
2862
+ * Creates the `.git/` directory structure and sets up initial configuration.
2863
+ * Useful for testing and for commands that require a fresh repository.
2864
+ *
2865
+ * @throws GitCommandError if directory is already a Git repository
2866
+ *
2867
+ * @example
2868
+ * await gitModule.init();
2869
+ * // Repository initialized with default branch (main or master)
2553
2870
  */
2554
- getProjectInfo(): Promise<{
2555
- id: string;
2556
- name: string;
2557
- } | null>;
2871
+ init(): Promise<void>;
2558
2872
  /**
2559
- * Get actor state for a specific actor
2873
+ * Returns the absolute path to the current Git repository root
2874
+ *
2875
+ * @returns Repository root path
2876
+ * @throws GitCommandError if not in a Git repository
2877
+ *
2878
+ * @example
2879
+ * const repoRoot = await gitModule.getRepoRoot();
2880
+ * // => "/home/user/my-project"
2560
2881
  */
2561
- getActorState(actorId: string): Promise<ActorState | null>;
2882
+ getRepoRoot(): Promise<string>;
2562
2883
  /**
2563
- * Update actor state for a specific actor
2884
+ * Returns the name of the current branch (HEAD)
2885
+ *
2886
+ * @returns Current branch name
2887
+ * @throws GitCommandError if in detached HEAD state or other error
2888
+ *
2889
+ * @example
2890
+ * const branch = await gitModule.getCurrentBranch();
2891
+ * // => "main"
2564
2892
  */
2565
- updateActorState(actorId: string, state: Partial<ActorState>): Promise<void>;
2893
+ getCurrentBranch(): Promise<string>;
2566
2894
  /**
2567
- * Get cloud session token
2895
+ * Get commit hash for a given reference (branch, tag, HEAD, etc.)
2896
+ *
2897
+ * Used by test helpers and sync operations to get commit SHAs.
2898
+ * Returns the full 40-character SHA-1 hash of the commit.
2899
+ *
2900
+ * @param ref Git reference (default: "HEAD"). Can be:
2901
+ * - "HEAD" for current commit
2902
+ * - Branch name (e.g., "main", "gitgov-state")
2903
+ * - Tag name (e.g., "v1.0.0")
2904
+ * - Commit hash (returns the same hash)
2905
+ * - Relative refs (e.g., "HEAD~1", "main^")
2906
+ * @returns Commit SHA hash (full 40-character hash)
2907
+ * @throws GitCommandError if ref does not exist
2908
+ *
2909
+ * @example
2910
+ * const headHash = await git.getCommitHash("HEAD");
2911
+ * // => "a1b2c3d4e5f6..."
2912
+ *
2913
+ * const mainHash = await git.getCommitHash("main");
2914
+ * // => "f6e5d4c3b2a1..."
2915
+ *
2916
+ * const parentHash = await git.getCommitHash("HEAD~1");
2917
+ * // => "9876543210ab..."
2568
2918
  */
2569
- getCloudSessionToken(): Promise<string | null>;
2919
+ getCommitHash(ref?: string): Promise<string>;
2570
2920
  /**
2571
- * Finds the project root by searching upwards for a .git directory.
2572
- * Caches the result for subsequent calls.
2573
- * @param startPath The path to start searching from. Defaults to the current working directory.
2574
- * @returns The absolute path to the project root, or null if not found.
2921
+ * Set a Git configuration value.
2922
+ * Used for configuring repository settings like user.name, core.editor, etc.
2923
+ *
2924
+ * [EARS-51, EARS-52]
2925
+ *
2926
+ * @param key - Configuration key (e.g., "user.name", "core.editor")
2927
+ * @param value - Configuration value
2928
+ * @param scope - Configuration scope: "local" (default), "global", or "system"
2929
+ * @throws GitCommandError if configuration fails
2930
+ *
2931
+ * @example
2932
+ * ```typescript
2933
+ * // Set local config (repository-specific)
2934
+ * await git.setConfig('core.editor', 'vim');
2935
+ *
2936
+ * // Set global config (user-wide)
2937
+ * await git.setConfig('user.name', 'John Doe', 'global');
2938
+ *
2939
+ * // Set system config (machine-wide, requires permissions)
2940
+ * await git.setConfig('credential.helper', 'cache', 'system');
2941
+ * ```
2575
2942
  */
2576
- static findProjectRoot(startPath?: string): string | null;
2943
+ setConfig(key: string, value: string, scope?: 'local' | 'global' | 'system'): Promise<void>;
2577
2944
  /**
2578
- * Finds the appropriate project root by searching upwards.
2579
- * First looks for .gitgov (initialized project), then .git (for init).
2580
- * @param startPath The path to start searching from. Defaults to the current working directory.
2581
- * @returns The absolute path to the project root, or null if not found.
2945
+ * Finds the most recent common ancestor between two branches
2946
+ *
2947
+ * @param branchA - First branch name
2948
+ * @param branchB - Second branch name
2949
+ * @returns Commit hash of the merge base
2950
+ * @throws BranchNotFoundError if either branch does not exist
2951
+ * @throws GitCommandError if operation fails
2952
+ *
2953
+ * @example
2954
+ * const mergeBase = await gitModule.getMergeBase("main", "feature");
2955
+ * // => "a1b2c3d4e5f6..."
2582
2956
  */
2583
- static findGitgovRoot(startPath?: string): string | null;
2957
+ getMergeBase(branchA: string, branchB: string): Promise<string>;
2584
2958
  /**
2585
- * Gets the .gitgov directory path from project root
2959
+ * Returns a list of files changed between two commits
2960
+ *
2961
+ * @param fromCommit - Source commit or reference
2962
+ * @param toCommit - Target commit or reference
2963
+ * @param pathFilter - Optional path filter (e.g., ".gitgov/")
2964
+ * @returns Array of changed files with their status
2965
+ * @throws GitCommandError if operation fails
2966
+ *
2967
+ * @example
2968
+ * const changes = await gitModule.getChangedFiles("HEAD~1", "HEAD", ".gitgov/");
2969
+ * // => [{ status: "M", file: ".gitgov/tasks/123.json" }]
2586
2970
  */
2587
- static getGitgovPath(): string;
2971
+ getChangedFiles(fromCommit: string, toCommit: string, pathFilter: string): Promise<ChangedFile[]>;
2588
2972
  /**
2589
- * Checks if current directory is a GitGovernance project
2973
+ * Get list of staged files (in staging area / index)
2974
+ *
2975
+ * Used during conflict resolution to identify which files the user resolved and staged.
2976
+ *
2977
+ * @returns Array of file paths that are currently staged
2978
+ * @throws GitCommandError if operation fails
2979
+ *
2980
+ * @example
2981
+ * // After user resolves conflict and does: git add .gitgov/tasks/123.json
2982
+ * const staged = await gitModule.getStagedFiles();
2983
+ * // => [".gitgov/tasks/123.json"]
2590
2984
  */
2591
- static isGitgovProject(): boolean;
2985
+ getStagedFiles(): Promise<string[]>;
2986
+ /**
2987
+ * Retrieves the content of a file at a specific point in history
2988
+ *
2989
+ * @param commitHash - Commit hash
2990
+ * @param filePath - File path relative to repository root
2991
+ * @returns File content as string
2992
+ * @throws FileNotFoundError if file doesn't exist in that commit
2993
+ * @throws GitCommandError if operation fails
2994
+ *
2995
+ * @example
2996
+ * const content = await gitModule.getFileContent("abc123", ".gitgov/config.json");
2997
+ * // => '{"version": "1.0.0"}'
2998
+ */
2999
+ getFileContent(commitHash: string, filePath: string): Promise<string>;
3000
+ /**
3001
+ * Retrieves the commit history for a branch
3002
+ *
3003
+ * @param branch - Branch name
3004
+ * @param options - Filtering and formatting options
3005
+ * @returns Array of commits ordered from newest to oldest
3006
+ * @throws GitCommandError if operation fails
3007
+ *
3008
+ * @example
3009
+ * const history = await gitModule.getCommitHistory("main", { maxCount: 10 });
3010
+ * // => [{ hash: "abc123", message: "Initial commit", author: "User <email>", date: "2025-01-01T00:00:00Z" }]
3011
+ */
3012
+ getCommitHistory(branch: string, options?: GetCommitHistoryOptions): Promise<CommitInfo[]>;
3013
+ /**
3014
+ * Retrieves commit history in a specific range
3015
+ *
3016
+ * @param fromHash - Starting commit hash (exclusive)
3017
+ * @param toHash - Ending commit hash (inclusive)
3018
+ * @param options - Filtering and formatting options
3019
+ * @returns Array of commits in the specified range
3020
+ * @throws GitCommandError if either commit doesn't exist
3021
+ *
3022
+ * @example
3023
+ * const commits = await gitModule.getCommitHistoryRange("abc123", "def456");
3024
+ * // => [{ hash: "def456", ... }, { hash: "cba321", ... }]
3025
+ */
3026
+ getCommitHistoryRange(fromHash: string, toHash: string, options?: GetCommitHistoryOptions): Promise<CommitInfo[]>;
3027
+ /**
3028
+ * Retrieves the full commit message for a specific commit
3029
+ *
3030
+ * @param commitHash - Commit hash
3031
+ * @returns Full commit message as string
3032
+ * @throws GitCommandError if commit doesn't exist
3033
+ *
3034
+ * @example
3035
+ * const message = await gitModule.getCommitMessage("abc123");
3036
+ * // => "feat: add new feature\n\nDetailed description..."
3037
+ */
3038
+ getCommitMessage(commitHash: string): Promise<string>;
3039
+ /**
3040
+ * Checks if there are uncommitted changes in the working directory
3041
+ *
3042
+ * @param pathFilter - Optional path filter (e.g., ".gitgov/")
3043
+ * @returns true if there are uncommitted changes, false otherwise
3044
+ * @throws GitCommandError if operation fails
3045
+ *
3046
+ * @example
3047
+ * const hasChanges = await gitModule.hasUncommittedChanges(".gitgov/");
3048
+ * // => true
3049
+ */
3050
+ hasUncommittedChanges(pathFilter?: string): Promise<boolean>;
3051
+ /**
3052
+ * Checks if a rebase operation is currently in progress
3053
+ *
3054
+ * @returns true if rebase is in progress, false otherwise
3055
+ *
3056
+ * @example
3057
+ * const inRebase = await gitModule.isRebaseInProgress();
3058
+ * // => false
3059
+ */
3060
+ isRebaseInProgress(): Promise<boolean>;
3061
+ /**
3062
+ * Checks if a branch exists locally
3063
+ *
3064
+ * @param branchName - Branch name to check
3065
+ * @returns true if branch exists, false otherwise
3066
+ *
3067
+ * @example
3068
+ * const exists = await gitModule.branchExists("feature-branch");
3069
+ * // => true
3070
+ */
3071
+ branchExists(branchName: string): Promise<boolean>;
3072
+ /**
3073
+ * Lists all remote branches for a given remote
3074
+ *
3075
+ * @param remoteName - Name of the remote (e.g., "origin")
3076
+ * @returns Array of remote branch names without the remote prefix
3077
+ * @throws GitCommandError if operation fails
3078
+ *
3079
+ * @example
3080
+ * const branches = await gitModule.listRemoteBranches("origin");
3081
+ * // => ["main", "develop", "gitgov-state"]
3082
+ *
3083
+ * @note This method only returns the branch names, not the full "origin/branch" format
3084
+ */
3085
+ listRemoteBranches(remoteName: string): Promise<string[]>;
3086
+ /**
3087
+ * Checks if a remote is configured in the git repository.
3088
+ *
3089
+ * @param remoteName - Name of the remote to check (e.g., "origin")
3090
+ * @returns true if the remote is configured, false otherwise
3091
+ *
3092
+ * @example
3093
+ * const hasOrigin = await gitModule.isRemoteConfigured("origin");
3094
+ * // => true
3095
+ */
3096
+ isRemoteConfigured(remoteName: string): Promise<boolean>;
3097
+ /**
3098
+ * Retrieves the tracking remote for a branch
3099
+ *
3100
+ * @param branchName - Branch name
3101
+ * @returns Remote name or null if not configured
3102
+ * @throws BranchNotFoundError if branch doesn't exist
3103
+ *
3104
+ * @example
3105
+ * const remote = await gitModule.getBranchRemote("main");
3106
+ * // => "origin"
3107
+ */
3108
+ getBranchRemote(branchName: string): Promise<string | null>;
3109
+ /**
3110
+ * Retrieves the list of conflicted files during a rebase or merge
3111
+ *
3112
+ * @returns Array of file paths in conflict
3113
+ * @throws GitCommandError if no rebase/merge in progress
3114
+ *
3115
+ * @example
3116
+ * const conflicts = await gitModule.getConflictedFiles();
3117
+ * // => [".gitgov/tasks/123.json", ".gitgov/tasks/456.json"]
3118
+ */
3119
+ getConflictedFiles(): Promise<string[]>;
3120
+ /**
3121
+ * Switches to the specified branch
3122
+ *
3123
+ * @param branchName - Branch name to checkout
3124
+ * @throws BranchNotFoundError if branch doesn't exist
3125
+ * @throws GitCommandError if operation fails
3126
+ *
3127
+ * @example
3128
+ * await gitModule.checkoutBranch("feature-branch");
3129
+ */
3130
+ checkoutBranch(branchName: string): Promise<void>;
3131
+ /**
3132
+ * Stash uncommitted changes
3133
+ *
3134
+ * @param message - Optional message for the stash
3135
+ * @returns Stash hash if changes were stashed, null if nothing to stash
3136
+ */
3137
+ stash(message?: string): Promise<string | null>;
3138
+ /**
3139
+ * Pop the most recent stash
3140
+ *
3141
+ * @returns true if stash was popped successfully, false if no stash exists
3142
+ */
3143
+ stashPop(): Promise<boolean>;
3144
+ /**
3145
+ * Drop a specific stash or the most recent one
3146
+ *
3147
+ * @param stashHash - Optional stash hash to drop, defaults to most recent
3148
+ */
3149
+ stashDrop(stashHash?: string): Promise<void>;
3150
+ /**
3151
+ * Creates an orphan branch (no history) and switches to it
3152
+ *
3153
+ * @param branchName - Orphan branch name to create
3154
+ * @throws GitCommandError if branch already exists or operation fails
3155
+ *
3156
+ * @example
3157
+ * await gitModule.checkoutOrphanBranch("gitgov-state");
3158
+ */
3159
+ checkoutOrphanBranch(branchName: string): Promise<void>;
3160
+ /**
3161
+ * Fetches the latest changes from a remote repository
3162
+ *
3163
+ * @param remote - Remote name (e.g., "origin")
3164
+ * @throws GitCommandError if operation fails
3165
+ *
3166
+ * @example
3167
+ * await gitModule.fetch("origin");
3168
+ */
3169
+ fetch(remote: string): Promise<void>;
3170
+ /**
3171
+ * Pulls and merges a remote branch
3172
+ *
3173
+ * @param remote - Remote name
3174
+ * @param branchName - Branch name
3175
+ * @throws MergeConflictError if merge conflicts occur
3176
+ * @throws GitCommandError if operation fails
3177
+ *
3178
+ * @example
3179
+ * await gitModule.pull("origin", "main");
3180
+ */
3181
+ pull(remote: string, branchName: string): Promise<void>;
3182
+ /**
3183
+ * Pulls and rebases a remote branch
3184
+ *
3185
+ * @param remote - Remote name
3186
+ * @param branchName - Branch name
3187
+ * @throws RebaseConflictError if rebase conflicts occur
3188
+ * @throws GitCommandError if operation fails
3189
+ *
3190
+ * @example
3191
+ * await gitModule.pullRebase("origin", "main");
3192
+ */
3193
+ pullRebase(remote: string, branchName: string): Promise<void>;
3194
+ /**
3195
+ * Resets the current branch to a specific commit, discarding all local changes
3196
+ *
3197
+ * @param target - Commit hash or branch name
3198
+ * @throws GitCommandError if operation fails
3199
+ *
3200
+ * @example
3201
+ * await gitModule.resetHard("HEAD~1");
3202
+ */
3203
+ resetHard(target: string): Promise<void>;
3204
+ /**
3205
+ * Checks out specific files from another branch into the current staging area
3206
+ *
3207
+ * @param sourceBranch - Source branch name
3208
+ * @param filePaths - Array of file paths to checkout
3209
+ * @throws BranchNotFoundError if source branch doesn't exist
3210
+ * @throws GitCommandError if operation fails
3211
+ *
3212
+ * @example
3213
+ * await gitModule.checkoutFilesFromBranch("main", [".gitgov/tasks/123.json"]);
3214
+ */
3215
+ checkoutFilesFromBranch(sourceBranch: string, filePaths: string[]): Promise<void>;
3216
+ /**
3217
+ * Adds files to the staging area
3218
+ *
3219
+ * @param filePaths - Array of file paths to add
3220
+ * @param options - Optional settings (force: add ignored files)
3221
+ * @throws GitCommandError if operation fails
3222
+ *
3223
+ * @example
3224
+ * await gitModule.add([".gitgov/tasks/123.json"]);
3225
+ * await gitModule.add([".gitgov"], { force: true }); // Add ignored files
3226
+ */
3227
+ add(filePaths: string[], options?: {
3228
+ force?: boolean;
3229
+ }): Promise<void>;
3230
+ /**
3231
+ * Removes files from both working directory and staging area
3232
+ *
3233
+ * @param filePaths - Array of file paths to remove
3234
+ * @throws GitCommandError if operation fails
3235
+ *
3236
+ * @example
3237
+ * await gitModule.rm([".gitgov/tasks/123.json"]);
3238
+ */
3239
+ rm(filePaths: string[]): Promise<void>;
3240
+ /**
3241
+ * Creates a new commit with staged files
3242
+ *
3243
+ * @param message - Commit message
3244
+ * @param author - Optional commit author
3245
+ * @returns Commit hash of the created commit
3246
+ * @throws GitCommandError if operation fails
3247
+ *
3248
+ * @example
3249
+ * const hash = await gitModule.commit("feat: add new task");
3250
+ * // => "abc123def456..."
3251
+ */
3252
+ commit(message: string, author?: CommitAuthor): Promise<string>;
3253
+ /**
3254
+ * Creates an empty commit (no changes required)
3255
+ *
3256
+ * @param message - Commit message
3257
+ * @param author - Optional commit author
3258
+ * @returns Commit hash of the created commit
3259
+ * @throws GitCommandError if operation fails
3260
+ *
3261
+ * @example
3262
+ * const hash = await gitModule.commitAllowEmpty("chore: initialize state branch");
3263
+ * // => "abc123def456..."
3264
+ */
3265
+ commitAllowEmpty(message: string, author?: CommitAuthor): Promise<string>;
3266
+ /**
3267
+ * Pushes a local branch to a remote repository
3268
+ *
3269
+ * @param remote - Remote name
3270
+ * @param branchName - Branch name
3271
+ * @throws GitCommandError if operation fails
3272
+ *
3273
+ * @example
3274
+ * await gitModule.push("origin", "main");
3275
+ */
3276
+ push(remote: string, branchName: string): Promise<void>;
3277
+ /**
3278
+ * Pushes a local branch to a remote repository and sets up tracking
3279
+ *
3280
+ * @param remote - Remote name
3281
+ * @param branchName - Branch name
3282
+ * @throws GitCommandError if operation fails
3283
+ *
3284
+ * @example
3285
+ * await gitModule.pushWithUpstream("origin", "feature-branch");
3286
+ */
3287
+ pushWithUpstream(remote: string, branchName: string): Promise<void>;
3288
+ /**
3289
+ * Configures tracking for a local branch with a remote branch
3290
+ *
3291
+ * @param branchName - Local branch name
3292
+ * @param remote - Remote name
3293
+ * @param remoteBranch - Remote branch name
3294
+ * @throws BranchNotFoundError if local branch doesn't exist
3295
+ * @throws GitCommandError if operation fails
3296
+ *
3297
+ * @example
3298
+ * await gitModule.setUpstream("feature-branch", "origin", "feature-branch");
3299
+ */
3300
+ setUpstream(branchName: string, remote: string, remoteBranch: string): Promise<void>;
3301
+ /**
3302
+ * Continues a rebase after resolving conflicts
3303
+ *
3304
+ * @returns Commit hash of the rebased commit
3305
+ * @throws RebaseNotInProgressError if no rebase is in progress
3306
+ * @throws GitCommandError if operation fails
3307
+ *
3308
+ * @example
3309
+ * const hash = await gitModule.rebaseContinue();
3310
+ * // => "abc123def456..."
3311
+ */
3312
+ rebaseContinue(): Promise<string>;
3313
+ /**
3314
+ * Aborts an ongoing rebase
3315
+ *
3316
+ * @throws RebaseNotInProgressError if no rebase is in progress
3317
+ * @throws GitCommandError if operation fails
3318
+ *
3319
+ * @example
3320
+ * await gitModule.rebaseAbort();
3321
+ */
3322
+ rebaseAbort(): Promise<void>;
3323
+ /**
3324
+ * Creates a new branch and switches to it (git checkout -b)
3325
+ *
3326
+ * @param branchName - Name of the branch to create
3327
+ * @param startPoint - Optional starting point (commit hash or branch name)
3328
+ * @throws GitCommandError if branch already exists or operation fails
3329
+ * @throws BranchAlreadyExistsError if the branch already exists locally
3330
+ */
3331
+ createBranch(branchName: string, startPoint?: string): Promise<void>;
3332
+ /**
3333
+ * Rebases current branch onto target branch (git rebase)
3334
+ *
3335
+ * @param targetBranch - Branch to rebase onto
3336
+ * @throws GitCommandError if rebase fails
3337
+ * @throws RebaseConflictError if conflicts are detected during rebase
3338
+ */
3339
+ rebase(targetBranch: string): Promise<void>;
3340
+ }
3341
+
3342
+ /**
3343
+ * Custom Error Classes for GitModule
3344
+ *
3345
+ * These errors provide typed exceptions for better error handling
3346
+ * and diagnostics in the Git module operations.
3347
+ */
3348
+ /**
3349
+ * Base error class for all Git-related errors
3350
+ */
3351
+ declare class GitError extends Error {
3352
+ constructor(message: string);
3353
+ }
3354
+ /**
3355
+ * Error thrown when a Git command fails
3356
+ */
3357
+ declare class GitCommandError extends GitError {
3358
+ readonly stderr: string;
3359
+ readonly stdout?: string | undefined;
3360
+ readonly command?: string | undefined;
3361
+ constructor(message: string, stderr?: string, command?: string | undefined, stdout?: string);
3362
+ }
3363
+ /**
3364
+ * Error thrown when a branch does not exist
3365
+ */
3366
+ declare class BranchNotFoundError extends GitError {
3367
+ readonly branchName: string;
3368
+ constructor(branchName: string);
3369
+ }
3370
+ /**
3371
+ * Error thrown when a file does not exist in a commit
3372
+ */
3373
+ declare class FileNotFoundError extends GitError {
3374
+ readonly filePath: string;
3375
+ readonly commitHash: string;
3376
+ constructor(filePath: string, commitHash: string);
3377
+ }
3378
+ /**
3379
+ * Error thrown when a merge conflict occurs
3380
+ */
3381
+ declare class MergeConflictError extends GitError {
3382
+ readonly conflictedFiles: string[];
3383
+ constructor(conflictedFiles: string[]);
3384
+ }
3385
+ /**
3386
+ * Error thrown when a rebase conflict occurs
3387
+ */
3388
+ declare class RebaseConflictError extends GitError {
3389
+ readonly conflictedFiles: string[];
3390
+ constructor(conflictedFiles: string[]);
2592
3391
  }
2593
3392
  /**
2594
- * Create a ConfigManager instance for the current project
3393
+ * Error thrown when trying to continue/abort a rebase that is not in progress
2595
3394
  */
2596
- declare function createConfigManager(projectRoot?: string): ConfigManager;
3395
+ declare class RebaseNotInProgressError extends GitError {
3396
+ constructor();
3397
+ }
2597
3398
 
2598
- type index$9_ActorState = ActorState;
2599
- type index$9_ConfigManager = ConfigManager;
2600
- declare const index$9_ConfigManager: typeof ConfigManager;
2601
- type index$9_GitGovConfig = GitGovConfig;
2602
- type index$9_GitGovSession = GitGovSession;
2603
- declare const index$9_createConfigManager: typeof createConfigManager;
2604
- declare namespace index$9 {
2605
- export { type index$9_ActorState as ActorState, index$9_ConfigManager as ConfigManager, type index$9_GitGovConfig as GitGovConfig, type index$9_GitGovSession as GitGovSession, index$9_createConfigManager as createConfigManager };
3399
+ /**
3400
+ * GitModule - Low-level Git Operations
3401
+ *
3402
+ * This module provides a business-agnostic abstraction layer for Git operations.
3403
+ *
3404
+ * @module git
3405
+ */
3406
+
3407
+ type index$a_BranchNotFoundError = BranchNotFoundError;
3408
+ declare const index$a_BranchNotFoundError: typeof BranchNotFoundError;
3409
+ type index$a_ChangedFile = ChangedFile;
3410
+ type index$a_CommitAuthor = CommitAuthor;
3411
+ type index$a_CommitInfo = CommitInfo;
3412
+ type index$a_ExecOptions = ExecOptions;
3413
+ type index$a_ExecResult = ExecResult;
3414
+ type index$a_FileNotFoundError = FileNotFoundError;
3415
+ declare const index$a_FileNotFoundError: typeof FileNotFoundError;
3416
+ type index$a_GetCommitHistoryOptions = GetCommitHistoryOptions;
3417
+ type index$a_GitCommandError = GitCommandError;
3418
+ declare const index$a_GitCommandError: typeof GitCommandError;
3419
+ type index$a_GitError = GitError;
3420
+ declare const index$a_GitError: typeof GitError;
3421
+ type index$a_GitModule = GitModule;
3422
+ declare const index$a_GitModule: typeof GitModule;
3423
+ type index$a_GitModuleDependencies = GitModuleDependencies;
3424
+ type index$a_MergeConflictError = MergeConflictError;
3425
+ declare const index$a_MergeConflictError: typeof MergeConflictError;
3426
+ type index$a_RebaseConflictError = RebaseConflictError;
3427
+ declare const index$a_RebaseConflictError: typeof RebaseConflictError;
3428
+ type index$a_RebaseNotInProgressError = RebaseNotInProgressError;
3429
+ declare const index$a_RebaseNotInProgressError: typeof RebaseNotInProgressError;
3430
+ declare namespace index$a {
3431
+ export { index$a_BranchNotFoundError as BranchNotFoundError, type index$a_ChangedFile as ChangedFile, type index$a_CommitAuthor as CommitAuthor, type index$a_CommitInfo as CommitInfo, type index$a_ExecOptions as ExecOptions, type index$a_ExecResult as ExecResult, index$a_FileNotFoundError as FileNotFoundError, type index$a_GetCommitHistoryOptions as GetCommitHistoryOptions, index$a_GitCommandError as GitCommandError, index$a_GitError as GitError, index$a_GitModule as GitModule, type index$a_GitModuleDependencies as GitModuleDependencies, index$a_MergeConflictError as MergeConflictError, index$a_RebaseConflictError as RebaseConflictError, index$a_RebaseNotInProgressError as RebaseNotInProgressError };
2606
3432
  }
2607
3433
 
2608
3434
  /**
@@ -2611,19 +3437,8 @@ declare namespace index$9 {
2611
3437
  interface ProjectAdapterDependencies {
2612
3438
  identityAdapter: IdentityAdapter;
2613
3439
  backlogAdapter: BacklogAdapter;
2614
- workflowMethodologyAdapter: WorkflowMethodologyAdapter;
3440
+ gitModule: GitModule;
2615
3441
  configManager: ConfigManager;
2616
- taskStore: RecordStore<TaskRecord>;
2617
- cycleStore: RecordStore<CycleRecord>;
2618
- eventBus?: IEventStream;
2619
- platformApi?: IPlatformApi;
2620
- userManagement?: IUserManagement;
2621
- }
2622
- interface IPlatformApi {
2623
- getProjectInfo(projectId: string): Promise<ProjectInfo>;
2624
- }
2625
- interface IUserManagement {
2626
- addUserToProject(projectId: string, userId: string, role: string): Promise<void>;
2627
3442
  }
2628
3443
  type ProjectInitOptions = {
2629
3444
  name: string;
@@ -2718,10 +3533,11 @@ interface IProjectAdapter {
2718
3533
  declare class ProjectAdapter implements IProjectAdapter {
2719
3534
  private identityAdapter;
2720
3535
  private backlogAdapter;
3536
+ private gitModule;
2721
3537
  private configManager;
2722
3538
  constructor(dependencies: ProjectAdapterDependencies);
2723
3539
  /**
2724
- * [EARS-1] Initializes complete GitGovernance project with 3-adapter orchestration and trust root Ed25519
3540
+ * [EARS-1] Initializes complete GitGovernance project with 4-module orchestration (Identity, Backlog, WorkflowMethodology, SyncModule) and trust root Ed25519
2725
3541
  */
2726
3542
  initializeProject(options: ProjectInitOptions): Promise<ProjectInitResult>;
2727
3543
  /**
@@ -2756,8 +3572,66 @@ declare class ProjectAdapter implements IProjectAdapter {
2756
3572
  private setupGitIntegration;
2757
3573
  }
2758
3574
 
3575
+ type index$9_EnvironmentValidation = EnvironmentValidation;
3576
+ type index$9_IProjectAdapter = IProjectAdapter;
3577
+ type index$9_ProjectAdapter = ProjectAdapter;
3578
+ declare const index$9_ProjectAdapter: typeof ProjectAdapter;
3579
+ type index$9_ProjectAdapterDependencies = ProjectAdapterDependencies;
3580
+ type index$9_ProjectContext = ProjectContext;
3581
+ type index$9_ProjectInfo = ProjectInfo;
3582
+ type index$9_ProjectInitOptions = ProjectInitOptions;
3583
+ type index$9_ProjectInitResult = ProjectInitResult;
3584
+ type index$9_ProjectReport = ProjectReport;
3585
+ type index$9_TemplateProcessingResult = TemplateProcessingResult;
3586
+ declare namespace index$9 {
3587
+ export { type index$9_EnvironmentValidation as EnvironmentValidation, type index$9_IProjectAdapter as IProjectAdapter, index$9_ProjectAdapter as ProjectAdapter, type index$9_ProjectAdapterDependencies as ProjectAdapterDependencies, type index$9_ProjectContext as ProjectContext, type index$9_ProjectInfo as ProjectInfo, type index$9_ProjectInitOptions as ProjectInitOptions, type index$9_ProjectInitResult as ProjectInitResult, type index$9_ProjectReport as ProjectReport, type index$9_TemplateProcessingResult as TemplateProcessingResult };
3588
+ }
3589
+
3590
+ type index$8_AllRecords = AllRecords;
3591
+ type index$8_BacklogAdapter = BacklogAdapter;
3592
+ declare const index$8_BacklogAdapter: typeof BacklogAdapter;
3593
+ type index$8_BacklogAdapterConfig = BacklogAdapterConfig;
3594
+ type index$8_BacklogAdapterDependencies = BacklogAdapterDependencies;
3595
+ type index$8_ChangelogAdapter = ChangelogAdapter;
3596
+ declare const index$8_ChangelogAdapter: typeof ChangelogAdapter;
3597
+ type index$8_ChangelogAdapterDependencies = ChangelogAdapterDependencies;
3598
+ type index$8_ChangelogListOptions = ChangelogListOptions;
3599
+ type index$8_CollaborationMetrics = CollaborationMetrics;
3600
+ type index$8_DerivedStateSets = DerivedStateSets;
3601
+ type index$8_DerivedStates = DerivedStates;
3602
+ type index$8_EnrichedTaskRecord = EnrichedTaskRecord;
2759
3603
  type index$8_EnvironmentValidation = EnvironmentValidation;
3604
+ type index$8_ExecutionAdapter = ExecutionAdapter;
3605
+ declare const index$8_ExecutionAdapter: typeof ExecutionAdapter;
3606
+ type index$8_ExecutionAdapterDependencies = ExecutionAdapterDependencies;
3607
+ type index$8_FeedbackAdapter = FeedbackAdapter;
3608
+ declare const index$8_FeedbackAdapter: typeof FeedbackAdapter;
3609
+ type index$8_FeedbackAdapterDependencies = FeedbackAdapterDependencies;
3610
+ type index$8_FeedbackThread = FeedbackThread;
3611
+ type index$8_FileIndexerAdapter = FileIndexerAdapter;
3612
+ declare const index$8_FileIndexerAdapter: typeof FileIndexerAdapter;
3613
+ type index$8_IBacklogAdapter = IBacklogAdapter;
3614
+ type index$8_IChangelogAdapter = IChangelogAdapter;
3615
+ type index$8_IExecutionAdapter = IExecutionAdapter;
3616
+ type index$8_IFeedbackAdapter = IFeedbackAdapter;
3617
+ type index$8_IIdentityAdapter = IIdentityAdapter;
3618
+ type index$8_IIndexerAdapter = IIndexerAdapter;
3619
+ type index$8_IMetricsAdapter = IMetricsAdapter;
2760
3620
  type index$8_IProjectAdapter = IProjectAdapter;
3621
+ type index$8_IWorkflowMethodology = IWorkflowMethodology;
3622
+ type index$8_IdentityAdapter = IdentityAdapter;
3623
+ declare const index$8_IdentityAdapter: typeof IdentityAdapter;
3624
+ type index$8_IdentityAdapterDependencies = IdentityAdapterDependencies;
3625
+ type index$8_IndexData = IndexData;
3626
+ type index$8_IndexGenerationReport = IndexGenerationReport;
3627
+ type index$8_IndexerAdapterDependencies = IndexerAdapterDependencies;
3628
+ type index$8_IntegrityError = IntegrityError;
3629
+ type index$8_IntegrityReport = IntegrityReport;
3630
+ type index$8_IntegrityWarning = IntegrityWarning;
3631
+ type index$8_MetricsAdapter = MetricsAdapter;
3632
+ declare const index$8_MetricsAdapter: typeof MetricsAdapter;
3633
+ type index$8_MetricsAdapterDependencies = MetricsAdapterDependencies;
3634
+ type index$8_ProductivityMetrics = ProductivityMetrics;
2761
3635
  type index$8_ProjectAdapter = ProjectAdapter;
2762
3636
  declare const index$8_ProjectAdapter: typeof ProjectAdapter;
2763
3637
  type index$8_ProjectAdapterDependencies = ProjectAdapterDependencies;
@@ -2766,72 +3640,14 @@ type index$8_ProjectInfo = ProjectInfo;
2766
3640
  type index$8_ProjectInitOptions = ProjectInitOptions;
2767
3641
  type index$8_ProjectInitResult = ProjectInitResult;
2768
3642
  type index$8_ProjectReport = ProjectReport;
3643
+ type index$8_SystemStatus = SystemStatus;
3644
+ type index$8_TaskHealthReport = TaskHealthReport;
2769
3645
  type index$8_TemplateProcessingResult = TemplateProcessingResult;
3646
+ type index$8_WorkflowMethodologyAdapter = WorkflowMethodologyAdapter;
3647
+ declare const index$8_WorkflowMethodologyAdapter: typeof WorkflowMethodologyAdapter;
3648
+ type index$8_WorkflowMethodologyAdapterDependencies = WorkflowMethodologyAdapterDependencies;
2770
3649
  declare namespace index$8 {
2771
- export { type index$8_EnvironmentValidation as EnvironmentValidation, type index$8_IProjectAdapter as IProjectAdapter, index$8_ProjectAdapter as ProjectAdapter, type index$8_ProjectAdapterDependencies as ProjectAdapterDependencies, type index$8_ProjectContext as ProjectContext, type index$8_ProjectInfo as ProjectInfo, type index$8_ProjectInitOptions as ProjectInitOptions, type index$8_ProjectInitResult as ProjectInitResult, type index$8_ProjectReport as ProjectReport, type index$8_TemplateProcessingResult as TemplateProcessingResult };
2772
- }
2773
-
2774
- type index$7_AllRecords = AllRecords;
2775
- type index$7_BacklogAdapter = BacklogAdapter;
2776
- declare const index$7_BacklogAdapter: typeof BacklogAdapter;
2777
- type index$7_BacklogAdapterConfig = BacklogAdapterConfig;
2778
- type index$7_BacklogAdapterDependencies = BacklogAdapterDependencies;
2779
- type index$7_ChangelogAdapter = ChangelogAdapter;
2780
- declare const index$7_ChangelogAdapter: typeof ChangelogAdapter;
2781
- type index$7_ChangelogAdapterDependencies = ChangelogAdapterDependencies;
2782
- type index$7_ChangelogListOptions = ChangelogListOptions;
2783
- type index$7_CollaborationMetrics = CollaborationMetrics;
2784
- type index$7_DerivedStateSets = DerivedStateSets;
2785
- type index$7_DerivedStates = DerivedStates;
2786
- type index$7_EnrichedTaskRecord = EnrichedTaskRecord;
2787
- type index$7_EnvironmentValidation = EnvironmentValidation;
2788
- type index$7_ExecutionAdapter = ExecutionAdapter;
2789
- declare const index$7_ExecutionAdapter: typeof ExecutionAdapter;
2790
- type index$7_ExecutionAdapterDependencies = ExecutionAdapterDependencies;
2791
- type index$7_FeedbackAdapter = FeedbackAdapter;
2792
- declare const index$7_FeedbackAdapter: typeof FeedbackAdapter;
2793
- type index$7_FeedbackAdapterDependencies = FeedbackAdapterDependencies;
2794
- type index$7_FeedbackThread = FeedbackThread;
2795
- type index$7_FileIndexerAdapter = FileIndexerAdapter;
2796
- declare const index$7_FileIndexerAdapter: typeof FileIndexerAdapter;
2797
- type index$7_IBacklogAdapter = IBacklogAdapter;
2798
- type index$7_IChangelogAdapter = IChangelogAdapter;
2799
- type index$7_IExecutionAdapter = IExecutionAdapter;
2800
- type index$7_IFeedbackAdapter = IFeedbackAdapter;
2801
- type index$7_IIdentityAdapter = IIdentityAdapter;
2802
- type index$7_IIndexerAdapter = IIndexerAdapter;
2803
- type index$7_IMetricsAdapter = IMetricsAdapter;
2804
- type index$7_IProjectAdapter = IProjectAdapter;
2805
- type index$7_IWorkflowMethodology = IWorkflowMethodology;
2806
- type index$7_IdentityAdapter = IdentityAdapter;
2807
- declare const index$7_IdentityAdapter: typeof IdentityAdapter;
2808
- type index$7_IdentityAdapterDependencies = IdentityAdapterDependencies;
2809
- type index$7_IndexData = IndexData;
2810
- type index$7_IndexGenerationReport = IndexGenerationReport;
2811
- type index$7_IndexerAdapterDependencies = IndexerAdapterDependencies;
2812
- type index$7_IntegrityError = IntegrityError;
2813
- type index$7_IntegrityReport = IntegrityReport;
2814
- type index$7_IntegrityWarning = IntegrityWarning;
2815
- type index$7_MetricsAdapter = MetricsAdapter;
2816
- declare const index$7_MetricsAdapter: typeof MetricsAdapter;
2817
- type index$7_MetricsAdapterDependencies = MetricsAdapterDependencies;
2818
- type index$7_ProductivityMetrics = ProductivityMetrics;
2819
- type index$7_ProjectAdapter = ProjectAdapter;
2820
- declare const index$7_ProjectAdapter: typeof ProjectAdapter;
2821
- type index$7_ProjectAdapterDependencies = ProjectAdapterDependencies;
2822
- type index$7_ProjectContext = ProjectContext;
2823
- type index$7_ProjectInfo = ProjectInfo;
2824
- type index$7_ProjectInitOptions = ProjectInitOptions;
2825
- type index$7_ProjectInitResult = ProjectInitResult;
2826
- type index$7_ProjectReport = ProjectReport;
2827
- type index$7_SystemStatus = SystemStatus;
2828
- type index$7_TaskHealthReport = TaskHealthReport;
2829
- type index$7_TemplateProcessingResult = TemplateProcessingResult;
2830
- type index$7_WorkflowMethodologyAdapter = WorkflowMethodologyAdapter;
2831
- declare const index$7_WorkflowMethodologyAdapter: typeof WorkflowMethodologyAdapter;
2832
- type index$7_WorkflowMethodologyAdapterDependencies = WorkflowMethodologyAdapterDependencies;
2833
- declare namespace index$7 {
2834
- export { type index$7_AllRecords as AllRecords, index$7_BacklogAdapter as BacklogAdapter, type index$7_BacklogAdapterConfig as BacklogAdapterConfig, type index$7_BacklogAdapterDependencies as BacklogAdapterDependencies, index$7_ChangelogAdapter as ChangelogAdapter, type index$7_ChangelogAdapterDependencies as ChangelogAdapterDependencies, type index$7_ChangelogListOptions as ChangelogListOptions, type index$7_CollaborationMetrics as CollaborationMetrics, type index$7_DerivedStateSets as DerivedStateSets, type index$7_DerivedStates as DerivedStates, type index$7_EnrichedTaskRecord as EnrichedTaskRecord, type index$7_EnvironmentValidation as EnvironmentValidation, index$7_ExecutionAdapter as ExecutionAdapter, type index$7_ExecutionAdapterDependencies as ExecutionAdapterDependencies, index$7_FeedbackAdapter as FeedbackAdapter, type index$7_FeedbackAdapterDependencies as FeedbackAdapterDependencies, type index$7_FeedbackThread as FeedbackThread, index$7_FileIndexerAdapter as FileIndexerAdapter, type index$7_IBacklogAdapter as IBacklogAdapter, type index$7_IChangelogAdapter as IChangelogAdapter, type index$7_IExecutionAdapter as IExecutionAdapter, type index$7_IFeedbackAdapter as IFeedbackAdapter, type index$7_IIdentityAdapter as IIdentityAdapter, type index$7_IIndexerAdapter as IIndexerAdapter, type index$7_IMetricsAdapter as IMetricsAdapter, type index$7_IProjectAdapter as IProjectAdapter, type index$7_IWorkflowMethodology as IWorkflowMethodology, index$7_IdentityAdapter as IdentityAdapter, type index$7_IdentityAdapterDependencies as IdentityAdapterDependencies, type index$7_IndexData as IndexData, type index$7_IndexGenerationReport as IndexGenerationReport, type index$7_IndexerAdapterDependencies as IndexerAdapterDependencies, type index$7_IntegrityError as IntegrityError, type index$7_IntegrityReport as IntegrityReport, type index$7_IntegrityWarning as IntegrityWarning, index$7_MetricsAdapter as MetricsAdapter, type index$7_MetricsAdapterDependencies as MetricsAdapterDependencies, type index$7_ProductivityMetrics as ProductivityMetrics, index$7_ProjectAdapter as ProjectAdapter, type index$7_ProjectAdapterDependencies as ProjectAdapterDependencies, type index$7_ProjectContext as ProjectContext, type index$7_ProjectInfo as ProjectInfo, type index$7_ProjectInitOptions as ProjectInitOptions, type index$7_ProjectInitResult as ProjectInitResult, type index$7_ProjectReport as ProjectReport, type index$7_SystemStatus as SystemStatus, type index$7_TaskHealthReport as TaskHealthReport, type index$7_TemplateProcessingResult as TemplateProcessingResult, type ValidationContext$1 as ValidationContext, index$7_WorkflowMethodologyAdapter as WorkflowMethodologyAdapter, type index$7_WorkflowMethodologyAdapterDependencies as WorkflowMethodologyAdapterDependencies };
3650
+ export { type index$8_AllRecords as AllRecords, index$8_BacklogAdapter as BacklogAdapter, type index$8_BacklogAdapterConfig as BacklogAdapterConfig, type index$8_BacklogAdapterDependencies as BacklogAdapterDependencies, index$8_ChangelogAdapter as ChangelogAdapter, type index$8_ChangelogAdapterDependencies as ChangelogAdapterDependencies, type index$8_ChangelogListOptions as ChangelogListOptions, type index$8_CollaborationMetrics as CollaborationMetrics, type index$8_DerivedStateSets as DerivedStateSets, type index$8_DerivedStates as DerivedStates, type index$8_EnrichedTaskRecord as EnrichedTaskRecord, type index$8_EnvironmentValidation as EnvironmentValidation, index$8_ExecutionAdapter as ExecutionAdapter, type index$8_ExecutionAdapterDependencies as ExecutionAdapterDependencies, index$8_FeedbackAdapter as FeedbackAdapter, type index$8_FeedbackAdapterDependencies as FeedbackAdapterDependencies, type index$8_FeedbackThread as FeedbackThread, index$8_FileIndexerAdapter as FileIndexerAdapter, type index$8_IBacklogAdapter as IBacklogAdapter, type index$8_IChangelogAdapter as IChangelogAdapter, type index$8_IExecutionAdapter as IExecutionAdapter, type index$8_IFeedbackAdapter as IFeedbackAdapter, type index$8_IIdentityAdapter as IIdentityAdapter, type index$8_IIndexerAdapter as IIndexerAdapter, type index$8_IMetricsAdapter as IMetricsAdapter, type index$8_IProjectAdapter as IProjectAdapter, type index$8_IWorkflowMethodology as IWorkflowMethodology, index$8_IdentityAdapter as IdentityAdapter, type index$8_IdentityAdapterDependencies as IdentityAdapterDependencies, type index$8_IndexData as IndexData, type index$8_IndexGenerationReport as IndexGenerationReport, type index$8_IndexerAdapterDependencies as IndexerAdapterDependencies, type index$8_IntegrityError as IntegrityError, type index$8_IntegrityReport as IntegrityReport, type index$8_IntegrityWarning as IntegrityWarning, index$8_MetricsAdapter as MetricsAdapter, type index$8_MetricsAdapterDependencies as MetricsAdapterDependencies, type index$8_ProductivityMetrics as ProductivityMetrics, index$8_ProjectAdapter as ProjectAdapter, type index$8_ProjectAdapterDependencies as ProjectAdapterDependencies, type index$8_ProjectContext as ProjectContext, type index$8_ProjectInfo as ProjectInfo, type index$8_ProjectInitOptions as ProjectInitOptions, type index$8_ProjectInitResult as ProjectInitResult, type index$8_ProjectReport as ProjectReport, type index$8_SystemStatus as SystemStatus, type index$8_TaskHealthReport as TaskHealthReport, type index$8_TemplateProcessingResult as TemplateProcessingResult, type ValidationContext$1 as ValidationContext, index$8_WorkflowMethodologyAdapter as WorkflowMethodologyAdapter, type index$8_WorkflowMethodologyAdapterDependencies as WorkflowMethodologyAdapterDependencies };
2835
3651
  }
2836
3652
 
2837
3653
  /**
@@ -2871,12 +3687,12 @@ declare function verifySignatures(record: {
2871
3687
  payload: GitGovRecordPayload;
2872
3688
  }, getActorPublicKey: (keyId: string) => Promise<string | null>): Promise<boolean>;
2873
3689
 
2874
- declare const index$6_calculatePayloadChecksum: typeof calculatePayloadChecksum;
2875
- declare const index$6_generateKeys: typeof generateKeys;
2876
- declare const index$6_signPayload: typeof signPayload;
2877
- declare const index$6_verifySignatures: typeof verifySignatures;
2878
- declare namespace index$6 {
2879
- export { index$6_calculatePayloadChecksum as calculatePayloadChecksum, index$6_generateKeys as generateKeys, index$6_signPayload as signPayload, index$6_verifySignatures as verifySignatures };
3690
+ declare const index$7_calculatePayloadChecksum: typeof calculatePayloadChecksum;
3691
+ declare const index$7_generateKeys: typeof generateKeys;
3692
+ declare const index$7_signPayload: typeof signPayload;
3693
+ declare const index$7_verifySignatures: typeof verifySignatures;
3694
+ declare namespace index$7 {
3695
+ export { index$7_calculatePayloadChecksum as calculatePayloadChecksum, index$7_generateKeys as generateKeys, index$7_signPayload as signPayload, index$7_verifySignatures as verifySignatures };
2880
3696
  }
2881
3697
 
2882
3698
  /**
@@ -3054,28 +3870,28 @@ declare function createTestSignature(keyId?: string, role?: string, notes?: stri
3054
3870
  */
3055
3871
  declare function createEmbeddedMetadataRecord<T extends GitGovRecordPayload>(payload: T, options?: CreateEmbeddedMetadataOptions): EmbeddedMetadataRecord<T>;
3056
3872
 
3057
- type index$5_CreateEmbeddedMetadataOptions = CreateEmbeddedMetadataOptions;
3058
- type index$5_SignatureConfig = SignatureConfig;
3059
- declare const index$5_createActorRecord: typeof createActorRecord;
3060
- declare const index$5_createAgentRecord: typeof createAgentRecord;
3061
- declare const index$5_createChangelogRecord: typeof createChangelogRecord;
3062
- declare const index$5_createCycleRecord: typeof createCycleRecord;
3063
- declare const index$5_createDefaultWorkflowMethodologyConfig: typeof createDefaultWorkflowMethodologyConfig;
3064
- declare const index$5_createEmbeddedMetadataRecord: typeof createEmbeddedMetadataRecord;
3065
- declare const index$5_createExecutionRecord: typeof createExecutionRecord;
3066
- declare const index$5_createFeedbackRecord: typeof createFeedbackRecord;
3067
- declare const index$5_createTaskRecord: typeof createTaskRecord;
3068
- declare const index$5_createTestSignature: typeof createTestSignature;
3069
- declare const index$5_createWorkflowMethodologyConfig: typeof createWorkflowMethodologyConfig;
3070
- declare const index$5_loadActorRecord: typeof loadActorRecord;
3071
- declare const index$5_loadAgentRecord: typeof loadAgentRecord;
3072
- declare const index$5_loadChangelogRecord: typeof loadChangelogRecord;
3073
- declare const index$5_loadCycleRecord: typeof loadCycleRecord;
3074
- declare const index$5_loadExecutionRecord: typeof loadExecutionRecord;
3075
- declare const index$5_loadFeedbackRecord: typeof loadFeedbackRecord;
3076
- declare const index$5_loadTaskRecord: typeof loadTaskRecord;
3077
- declare namespace index$5 {
3078
- export { type index$5_CreateEmbeddedMetadataOptions as CreateEmbeddedMetadataOptions, type index$5_SignatureConfig as SignatureConfig, index$5_createActorRecord as createActorRecord, index$5_createAgentRecord as createAgentRecord, index$5_createChangelogRecord as createChangelogRecord, index$5_createCycleRecord as createCycleRecord, index$5_createDefaultWorkflowMethodologyConfig as createDefaultWorkflowMethodologyConfig, index$5_createEmbeddedMetadataRecord as createEmbeddedMetadataRecord, index$5_createExecutionRecord as createExecutionRecord, index$5_createFeedbackRecord as createFeedbackRecord, index$5_createTaskRecord as createTaskRecord, index$5_createTestSignature as createTestSignature, index$5_createWorkflowMethodologyConfig as createWorkflowMethodologyConfig, index$5_loadActorRecord as loadActorRecord, index$5_loadAgentRecord as loadAgentRecord, index$5_loadChangelogRecord as loadChangelogRecord, index$5_loadCycleRecord as loadCycleRecord, index$5_loadExecutionRecord as loadExecutionRecord, index$5_loadFeedbackRecord as loadFeedbackRecord, index$5_loadTaskRecord as loadTaskRecord };
3873
+ type index$6_CreateEmbeddedMetadataOptions = CreateEmbeddedMetadataOptions;
3874
+ type index$6_SignatureConfig = SignatureConfig;
3875
+ declare const index$6_createActorRecord: typeof createActorRecord;
3876
+ declare const index$6_createAgentRecord: typeof createAgentRecord;
3877
+ declare const index$6_createChangelogRecord: typeof createChangelogRecord;
3878
+ declare const index$6_createCycleRecord: typeof createCycleRecord;
3879
+ declare const index$6_createDefaultWorkflowMethodologyConfig: typeof createDefaultWorkflowMethodologyConfig;
3880
+ declare const index$6_createEmbeddedMetadataRecord: typeof createEmbeddedMetadataRecord;
3881
+ declare const index$6_createExecutionRecord: typeof createExecutionRecord;
3882
+ declare const index$6_createFeedbackRecord: typeof createFeedbackRecord;
3883
+ declare const index$6_createTaskRecord: typeof createTaskRecord;
3884
+ declare const index$6_createTestSignature: typeof createTestSignature;
3885
+ declare const index$6_createWorkflowMethodologyConfig: typeof createWorkflowMethodologyConfig;
3886
+ declare const index$6_loadActorRecord: typeof loadActorRecord;
3887
+ declare const index$6_loadAgentRecord: typeof loadAgentRecord;
3888
+ declare const index$6_loadChangelogRecord: typeof loadChangelogRecord;
3889
+ declare const index$6_loadCycleRecord: typeof loadCycleRecord;
3890
+ declare const index$6_loadExecutionRecord: typeof loadExecutionRecord;
3891
+ declare const index$6_loadFeedbackRecord: typeof loadFeedbackRecord;
3892
+ declare const index$6_loadTaskRecord: typeof loadTaskRecord;
3893
+ declare namespace index$6 {
3894
+ export { type index$6_CreateEmbeddedMetadataOptions as CreateEmbeddedMetadataOptions, type index$6_SignatureConfig as SignatureConfig, index$6_createActorRecord as createActorRecord, index$6_createAgentRecord as createAgentRecord, index$6_createChangelogRecord as createChangelogRecord, index$6_createCycleRecord as createCycleRecord, index$6_createDefaultWorkflowMethodologyConfig as createDefaultWorkflowMethodologyConfig, index$6_createEmbeddedMetadataRecord as createEmbeddedMetadataRecord, index$6_createExecutionRecord as createExecutionRecord, index$6_createFeedbackRecord as createFeedbackRecord, index$6_createTaskRecord as createTaskRecord, index$6_createTestSignature as createTestSignature, index$6_createWorkflowMethodologyConfig as createWorkflowMethodologyConfig, index$6_loadActorRecord as loadActorRecord, index$6_loadAgentRecord as loadAgentRecord, index$6_loadChangelogRecord as loadChangelogRecord, index$6_loadCycleRecord as loadCycleRecord, index$6_loadExecutionRecord as loadExecutionRecord, index$6_loadFeedbackRecord as loadFeedbackRecord, index$6_loadTaskRecord as loadTaskRecord };
3079
3895
  }
3080
3896
 
3081
3897
  type StorablePayload = Exclude<GitGovRecordPayload, CustomRecord>;
@@ -3741,22 +4557,22 @@ declare class LintModule implements ILintModule {
3741
4557
  * ```
3742
4558
  */
3743
4559
 
3744
- type index$4_FileSystem = FileSystem;
3745
- type index$4_FixOptions = FixOptions;
3746
- type index$4_FixReport = FixReport;
3747
- type index$4_FixResult = FixResult;
3748
- type index$4_ILintModule = ILintModule;
3749
- type index$4_LintModule = LintModule;
3750
- declare const index$4_LintModule: typeof LintModule;
3751
- type index$4_LintModuleDependencies = LintModuleDependencies;
3752
- type index$4_LintOptions = LintOptions;
3753
- type index$4_LintReport = LintReport;
3754
- type index$4_LintResult = LintResult;
3755
- type index$4_LintSummary = LintSummary;
3756
- type index$4_ValidationContext = ValidationContext;
3757
- type index$4_ValidatorType = ValidatorType;
3758
- declare namespace index$4 {
3759
- export { type index$4_FileSystem as FileSystem, type index$4_FixOptions as FixOptions, type index$4_FixReport as FixReport, type index$4_FixResult as FixResult, type index$4_ILintModule as ILintModule, index$4_LintModule as LintModule, type index$4_LintModuleDependencies as LintModuleDependencies, type index$4_LintOptions as LintOptions, type index$4_LintReport as LintReport, type index$4_LintResult as LintResult, type index$4_LintSummary as LintSummary, type index$4_ValidationContext as ValidationContext, type index$4_ValidatorType as ValidatorType };
4560
+ type index$5_FileSystem = FileSystem;
4561
+ type index$5_FixOptions = FixOptions;
4562
+ type index$5_FixReport = FixReport;
4563
+ type index$5_FixResult = FixResult;
4564
+ type index$5_ILintModule = ILintModule;
4565
+ type index$5_LintModule = LintModule;
4566
+ declare const index$5_LintModule: typeof LintModule;
4567
+ type index$5_LintModuleDependencies = LintModuleDependencies;
4568
+ type index$5_LintOptions = LintOptions;
4569
+ type index$5_LintReport = LintReport;
4570
+ type index$5_LintResult = LintResult;
4571
+ type index$5_LintSummary = LintSummary;
4572
+ type index$5_ValidationContext = ValidationContext;
4573
+ type index$5_ValidatorType = ValidatorType;
4574
+ declare namespace index$5 {
4575
+ export { type index$5_FileSystem as FileSystem, type index$5_FixOptions as FixOptions, type index$5_FixReport as FixReport, type index$5_FixResult as FixResult, type index$5_ILintModule as ILintModule, index$5_LintModule as LintModule, type index$5_LintModuleDependencies as LintModuleDependencies, type index$5_LintOptions as LintOptions, type index$5_LintReport as LintReport, type index$5_LintResult as LintResult, type index$5_LintSummary as LintSummary, type index$5_ValidationContext as ValidationContext, type index$5_ValidatorType as ValidatorType };
3760
4576
  }
3761
4577
 
3762
4578
  type LogLevel = "debug" | "info" | "warn" | "error" | "silent";
@@ -3769,12 +4585,12 @@ interface Logger {
3769
4585
  declare function createLogger(prefix?: string, level?: LogLevel): Logger;
3770
4586
  declare const logger: Logger;
3771
4587
 
3772
- type index$3_LogLevel = LogLevel;
3773
- type index$3_Logger = Logger;
3774
- declare const index$3_createLogger: typeof createLogger;
3775
- declare const index$3_logger: typeof logger;
3776
- declare namespace index$3 {
3777
- export { type index$3_LogLevel as LogLevel, type index$3_Logger as Logger, index$3_createLogger as createLogger, index$3_logger as logger };
4588
+ type index$4_LogLevel = LogLevel;
4589
+ type index$4_Logger = Logger;
4590
+ declare const index$4_createLogger: typeof createLogger;
4591
+ declare const index$4_logger: typeof logger;
4592
+ declare namespace index$4 {
4593
+ export { type index$4_LogLevel as LogLevel, type index$4_Logger as Logger, index$4_createLogger as createLogger, index$4_logger as logger };
3778
4594
  }
3779
4595
 
3780
4596
  /**
@@ -7423,21 +8239,701 @@ declare class DetailedValidationError extends GitGovError {
7423
8239
  }>);
7424
8240
  }
7425
8241
 
7426
- type index$2_DetailedValidationError = DetailedValidationError;
7427
- declare const index$2_DetailedValidationError: typeof DetailedValidationError;
7428
- type index$2_GitGovError = GitGovError;
7429
- declare const index$2_GitGovError: typeof GitGovError;
7430
- type index$2_SchemaName = SchemaName;
7431
- type index$2_SchemaValidationCache = SchemaValidationCache;
7432
- declare const index$2_SchemaValidationCache: typeof SchemaValidationCache;
7433
- type index$2_SchemaValidationError = SchemaValidationError;
7434
- declare const index$2_SchemaValidationError: typeof SchemaValidationError;
7435
- declare const index$2_Schemas: typeof Schemas;
7436
- declare const index$2_getSchema: typeof getSchema;
7437
- declare const index$2_getSchemaNames: typeof getSchemaNames;
7438
- declare const index$2_hasSchema: typeof hasSchema;
8242
+ type index$3_DetailedValidationError = DetailedValidationError;
8243
+ declare const index$3_DetailedValidationError: typeof DetailedValidationError;
8244
+ type index$3_GitGovError = GitGovError;
8245
+ declare const index$3_GitGovError: typeof GitGovError;
8246
+ type index$3_SchemaName = SchemaName;
8247
+ type index$3_SchemaValidationCache = SchemaValidationCache;
8248
+ declare const index$3_SchemaValidationCache: typeof SchemaValidationCache;
8249
+ type index$3_SchemaValidationError = SchemaValidationError;
8250
+ declare const index$3_SchemaValidationError: typeof SchemaValidationError;
8251
+ declare const index$3_Schemas: typeof Schemas;
8252
+ declare const index$3_getSchema: typeof getSchema;
8253
+ declare const index$3_getSchemaNames: typeof getSchemaNames;
8254
+ declare const index$3_hasSchema: typeof hasSchema;
8255
+ declare namespace index$3 {
8256
+ export { index$3_DetailedValidationError as DetailedValidationError, index$3_GitGovError as GitGovError, type index$3_SchemaName as SchemaName, index$3_SchemaValidationCache as SchemaValidationCache, index$3_SchemaValidationError as SchemaValidationError, index$3_Schemas as Schemas, index$3_getSchema as getSchema, index$3_getSchemaNames as getSchemaNames, index$3_hasSchema as hasSchema };
8257
+ }
8258
+
8259
+ /**
8260
+ * SyncModule Dependencies
8261
+ */
8262
+ interface SyncModuleDependencies {
8263
+ /** Low-level Git module (required) */
8264
+ git: GitModule;
8265
+ /** Configuration manager (required) */
8266
+ config: ConfigManager;
8267
+ /** Identity adapter for signature verification and signing (required) */
8268
+ identity: IIdentityAdapter;
8269
+ /** Lint module for record validation (required) */
8270
+ lint: LintModule;
8271
+ /** Indexer adapter for automatic re-indexing after pull/resolve (required) */
8272
+ indexer: IIndexerAdapter;
8273
+ }
8274
+ /**
8275
+ * Options for pushState operation
8276
+ */
8277
+ interface SyncPushOptions {
8278
+ /** Branch to push from (default: current branch) */
8279
+ sourceBranch?: string;
8280
+ /** Actor ID publishing the state (required) */
8281
+ actorId: string;
8282
+ /** Simulate operation without making real changes */
8283
+ dryRun?: boolean;
8284
+ /** Force push even if there are unsynced remote changes */
8285
+ force?: boolean;
8286
+ }
8287
+ /**
8288
+ * Result of pushState operation
8289
+ */
8290
+ interface SyncPushResult {
8291
+ /** Indicates if the operation was successful */
8292
+ success: boolean;
8293
+ /** Number of files synced */
8294
+ filesSynced: number;
8295
+ /** Name of the branch pushed from */
8296
+ sourceBranch: string;
8297
+ /** Created commit hash (null if no changes or dry-run) */
8298
+ commitHash: string | null;
8299
+ /** Created commit message */
8300
+ commitMessage: string | null;
8301
+ /** Indicates if a conflict was detected during reconciliation */
8302
+ conflictDetected: boolean;
8303
+ /** Conflict information if detected */
8304
+ conflictInfo?: ConflictInfo;
8305
+ /** Error message if operation failed */
8306
+ error?: string;
8307
+ /** [EARS-54] Implicit pull results when push does reconciliation with remote */
8308
+ implicitPull?: {
8309
+ /** Whether changes were pulled from remote */
8310
+ hasChanges: boolean;
8311
+ /** Number of files updated from remote */
8312
+ filesUpdated: number;
8313
+ /** Whether index was regenerated */
8314
+ reindexed: boolean;
8315
+ };
8316
+ }
8317
+ /**
8318
+ * Options for pullState operation
8319
+ */
8320
+ interface SyncPullOptions {
8321
+ /** Force re-indexing even if there are no new changes */
8322
+ forceReindex?: boolean;
8323
+ /** [EARS-62] Force pull even if local changes would be overwritten */
8324
+ force?: boolean;
8325
+ }
8326
+ /**
8327
+ * Result of pullState operation
8328
+ */
8329
+ interface SyncPullResult {
8330
+ /** Indicates if the operation was successful */
8331
+ success: boolean;
8332
+ /** Indicates if there were new remote changes */
8333
+ hasChanges: boolean;
8334
+ /** Number of files updated */
8335
+ filesUpdated: number;
8336
+ /** Indicates if re-indexing was executed */
8337
+ reindexed: boolean;
8338
+ /** Indicates if a conflict was detected during pull */
8339
+ conflictDetected: boolean;
8340
+ /** Conflict information if detected */
8341
+ conflictInfo?: ConflictInfo;
8342
+ /** Error message if operation failed */
8343
+ error?: string;
8344
+ /** [EARS-62] Files that were forcefully overwritten (when force: true) */
8345
+ forcedOverwrites?: string[];
8346
+ }
8347
+ /**
8348
+ * Options for resolveConflict operation
8349
+ */
8350
+ interface SyncResolveOptions {
8351
+ /** Justification for the conflict resolution (required) */
8352
+ reason: string;
8353
+ /** Actor ID resolving the conflict (required) */
8354
+ actorId: string;
8355
+ }
8356
+ /**
8357
+ * Result of resolveConflict operation
8358
+ */
8359
+ interface SyncResolveResult {
8360
+ /** Indicates if the operation was successful */
8361
+ success: boolean;
8362
+ /** Commit hash of the created rebase commit */
8363
+ rebaseCommitHash: string;
8364
+ /** Commit hash of the signed resolution commit */
8365
+ resolutionCommitHash: string;
8366
+ /** Number of conflicts resolved */
8367
+ conflictsResolved: number;
8368
+ /** Actor ID who resolved the conflict */
8369
+ resolvedBy: string;
8370
+ /** Reason for resolution */
8371
+ reason: string;
8372
+ /** Error message if operation failed */
8373
+ error?: string;
8374
+ }
8375
+ /**
8376
+ * Detailed information about a detected conflict
8377
+ */
8378
+ interface ConflictInfo {
8379
+ /** Type of conflict detected */
8380
+ type: ConflictType;
8381
+ /** Files affected by the conflict */
8382
+ affectedFiles: string[];
8383
+ /** Descriptive message of the conflict */
8384
+ message: string;
8385
+ /** Instructions to resolve the conflict */
8386
+ resolutionSteps: string[];
8387
+ }
8388
+ /**
8389
+ * Auxiliary type to identify the conflict type
8390
+ *
8391
+ * Git-Native conflict model (post-refactor):
8392
+ * - rebase_conflict: Used for all Git-level conflicts during push/pull
8393
+ * - local_changes_conflict: Used when pull would overwrite local changes (EARS-61)
8394
+ * - integrity_violation: Used when resolution commits are missing
8395
+ */
8396
+ type ConflictType = "rebase_conflict" | "integrity_violation" | "local_changes_conflict";
8397
+ /**
8398
+ * Information about a detected integrity violation
8399
+ */
8400
+ interface IntegrityViolation {
8401
+ /** Commit hash of the rebase commit without resolution */
8402
+ rebaseCommitHash: string;
8403
+ /** Message of the rebase commit */
8404
+ commitMessage: string;
8405
+ /** Timestamp of the commit */
8406
+ timestamp: string;
8407
+ /** Author of the commit */
8408
+ author: string;
8409
+ }
8410
+ /**
8411
+ * Verification scope for state audit
8412
+ */
8413
+ type AuditScope = "current" | "state-branch" | "all";
8414
+ /**
8415
+ * Scope for expected files verification
8416
+ */
8417
+ type ExpectedFilesScope = "head" | "all-commits";
8418
+ /**
8419
+ * Options for state audit
8420
+ */
8421
+ interface AuditStateOptions {
8422
+ /** Verification scope: which Records to verify (default: "all") */
8423
+ scope?: AuditScope;
8424
+ /** Verify signatures in Records (default: true) */
8425
+ verifySignatures?: boolean;
8426
+ /** Verify checksums of Records (default: true) */
8427
+ verifyChecksums?: boolean;
8428
+ /** Verify that expected files exist (default: true) */
8429
+ verifyExpectedFiles?: boolean;
8430
+ /** Scope for expected files verification (default: "head") */
8431
+ expectedFilesScope?: ExpectedFilesScope;
8432
+ /** Path of specific files to audit (default: all in .gitgov/) */
8433
+ filePaths?: string[];
8434
+ }
8435
+ /**
8436
+ * Conflict diff information for a file
8437
+ */
8438
+ interface ConflictFileDiff {
8439
+ /** Path of the conflicted file */
8440
+ filePath: string;
8441
+ /** Content of the local version (ours) */
8442
+ localContent: string;
8443
+ /** Content of the remote version (theirs) */
8444
+ remoteContent: string;
8445
+ /** Base content (common ancestor) */
8446
+ baseContent: string | null;
8447
+ /** Lines with conflict markers (if they still exist) */
8448
+ conflictMarkers?: Array<{
8449
+ line: number;
8450
+ marker: string;
8451
+ }>;
8452
+ }
8453
+ /**
8454
+ * Structured conflict diff
8455
+ */
8456
+ interface ConflictDiff {
8457
+ /** Conflicted files with their diff */
8458
+ files: ConflictFileDiff[];
8459
+ /** Descriptive message of the conflict */
8460
+ message: string;
8461
+ /** Instructions to resolve */
8462
+ resolutionSteps: string[];
8463
+ }
8464
+ /**
8465
+ * Complete state audit report
8466
+ *
8467
+ * This report combines SyncModule-specific audits (rebase integrity, commits)
8468
+ * with structural validation from LintModule (signatures, checksums, schemas).
8469
+ */
8470
+ interface AuditStateReport {
8471
+ /** Indicates if the audit passed without violations */
8472
+ passed: boolean;
8473
+ /** Scope used for the audit */
8474
+ scope: AuditScope;
8475
+ /** Total commits analyzed */
8476
+ totalCommits: number;
8477
+ /** Rebase commits found */
8478
+ rebaseCommits: number;
8479
+ /** Resolution commits found */
8480
+ resolutionCommits: number;
8481
+ /** Integrity violations of resolutions (SyncModule-specific) */
8482
+ integrityViolations: IntegrityViolation[];
8483
+ /** Summary message of the audit */
8484
+ summary: string;
8485
+ /** Complete LintModule report for structural validation (signatures, checksums, schemas, etc.) */
8486
+ lintReport?: LintReport;
8487
+ }
8488
+ /**
8489
+ * Information of a changed file in the delta
8490
+ */
8491
+ interface StateDeltaFile {
8492
+ /** File status: Added, Modified, Deleted */
8493
+ status: "A" | "M" | "D";
8494
+ /** File path */
8495
+ file: string;
8496
+ }
8497
+
8498
+ /**
8499
+ * SyncModule - Manages state synchronization between local environment and gitgov-state branch
8500
+ *
8501
+ * Responsibilities:
8502
+ * - Create and maintain the gitgov-state branch (local and remote)
8503
+ * - Publish local changes (pushState)
8504
+ * - Pull remote changes (pullState)
8505
+ * - Resolve conflicts in a governed manner (resolveConflict)
8506
+ * - Audit state integrity (auditState)
8507
+ *
8508
+ * Philosophy:
8509
+ * - Pipeline Pattern: Sequential operations with validation at each phase
8510
+ * - Fail-Fast: Early verifications to avoid costly operations
8511
+ * - Strict Dependencies: All dependencies (git, config, identity, lint, indexer) are required for robust operations
8512
+ */
8513
+ declare class SyncModule {
8514
+ private git;
8515
+ private config;
8516
+ private identity;
8517
+ private lint;
8518
+ private indexer;
8519
+ /**
8520
+ * Constructor with dependency injection
8521
+ */
8522
+ constructor(dependencies: SyncModuleDependencies);
8523
+ /**
8524
+ * Static method to bootstrap .gitgov/ from gitgov-state branch.
8525
+ * Used when cloning a repo that has gitgov-state but .gitgov/ is not in the work branch.
8526
+ *
8527
+ * This method only requires GitModule and can be called before full SyncModule initialization.
8528
+ *
8529
+ * @param gitModule - GitModule instance for git operations
8530
+ * @param stateBranch - Name of the state branch (default: "gitgov-state")
8531
+ * @returns Promise<{ success: boolean; error?: string }>
8532
+ */
8533
+ static bootstrapFromStateBranch(gitModule: GitModule, stateBranch?: string): Promise<{
8534
+ success: boolean;
8535
+ error?: string;
8536
+ }>;
8537
+ /**
8538
+ * Gets the state branch name from configuration.
8539
+ * Default: "gitgov-state"
8540
+ *
8541
+ * [EARS-4]
8542
+ */
8543
+ getStateBranchName(): Promise<string>;
8544
+ /**
8545
+ * Ensures that the gitgov-state branch exists both locally and remotely.
8546
+ * If it doesn't exist, creates it as an orphan branch.
8547
+ *
8548
+ * Use cases (4 edge cases):
8549
+ * 1. Doesn't exist locally or remotely → Create orphan branch + initial commit + push
8550
+ * 2. Exists remotely, not locally → Fetch + create local + set tracking
8551
+ * 3. Exists locally, not remotely → Push + set tracking
8552
+ * 4. Exists both → Verify tracking
8553
+ *
8554
+ * [EARS-1, EARS-2, EARS-3]
8555
+ */
8556
+ ensureStateBranch(): Promise<void>;
8557
+ /**
8558
+ * Creates the gitgov-state orphan branch with an empty initial commit.
8559
+ * Used by ensureStateBranch when the branch doesn't exist locally or remotely.
8560
+ *
8561
+ * [EARS-1]
8562
+ */
8563
+ private createOrphanStateBranch;
8564
+ /**
8565
+ * Calculates the file delta in .gitgov/ between the current branch and gitgov-state.
8566
+ *
8567
+ * [EARS-5]
8568
+ */
8569
+ calculateStateDelta(sourceBranch: string): Promise<StateDeltaFile[]>;
8570
+ /**
8571
+ * [EARS-60] Detect file-level conflicts and identify remote-only changes.
8572
+ *
8573
+ * A conflict exists when:
8574
+ * 1. A file was modified by the remote during implicit pull
8575
+ * 2. AND the LOCAL USER also modified that same file (content in tempDir differs from what was in git before pull)
8576
+ *
8577
+ * This catches conflicts that git rebase can't detect because we copy files AFTER the pull.
8578
+ *
8579
+ * @param tempDir - Directory containing local .gitgov/ files (preserved before checkout)
8580
+ * @param repoRoot - Repository root path
8581
+ /**
8582
+ * Checks if a rebase is in progress.
8583
+ *
8584
+ * [EARS-22]
8585
+ */
8586
+ isRebaseInProgress(): Promise<boolean>;
8587
+ /**
8588
+ * Checks for absence of conflict markers in specified files.
8589
+ * Returns list of files that still have markers.
8590
+ *
8591
+ * [EARS-23]
8592
+ */
8593
+ checkConflictMarkers(filePaths: string[]): Promise<string[]>;
8594
+ /**
8595
+ * Gets the diff of conflicted files for manual analysis.
8596
+ * Useful so the actor can analyze conflicted changes before resolving.
8597
+ *
8598
+ * [EARS-31]
8599
+ */
8600
+ getConflictDiff(filePaths?: string[]): Promise<ConflictDiff>;
8601
+ /**
8602
+ * Verifies integrity of previous resolutions in gitgov-state history.
8603
+ * Returns list of violations if any exist.
8604
+ *
8605
+ * [EARS-24, EARS-25, EARS-26]
8606
+ */
8607
+ verifyResolutionIntegrity(): Promise<IntegrityViolation[]>;
8608
+ /**
8609
+ * Complete audit of gitgov-state status.
8610
+ * Verifies integrity of resolutions, signatures in Records, checksums and expected files.
8611
+ *
8612
+ * [EARS-27, EARS-28, EARS-29, EARS-30]
8613
+ */
8614
+ auditState(options?: AuditStateOptions): Promise<AuditStateReport>;
8615
+ /**
8616
+ * Publishes local state changes to gitgov-state.
8617
+ * Implements 3 phases: verification, reconciliation, publication.
8618
+ *
8619
+ * [EARS-6 through EARS-12]
8620
+ */
8621
+ pushState(options: SyncPushOptions): Promise<SyncPushResult>;
8622
+ /**
8623
+ * Pulls remote changes from gitgov-state to the local environment.
8624
+ * Includes automatic re-indexing if there are new changes.
8625
+ *
8626
+ * [EARS-13 through EARS-16]
8627
+ * [EARS-44] Requires remote to be configured (pull without remote makes no sense)
8628
+ */
8629
+ pullState(options?: SyncPullOptions): Promise<SyncPullResult>;
8630
+ /**
8631
+ * Resolves state conflicts in a governed manner (Git-Native).
8632
+ *
8633
+ * Git-Native Flow:
8634
+ * 1. User resolves conflicts using standard Git tools (edit files, remove markers)
8635
+ * 2. User stages resolved files: git add .gitgov/
8636
+ * 3. User runs: gitgov sync resolve --reason "reason"
8637
+ *
8638
+ * This method:
8639
+ * - Verifies that a rebase is in progress
8640
+ * - Checks that no conflict markers remain in staged files
8641
+ * - Updates resolved Records with new checksums and signatures
8642
+ * - Continues the git rebase (git rebase --continue)
8643
+ * - Creates a signed resolution commit
8644
+ * - Regenerates the index
8645
+ *
8646
+ * [EARS-17 through EARS-23]
8647
+ */
8648
+ resolveConflict(options: SyncResolveOptions): Promise<SyncResolveResult>;
8649
+ }
8650
+
8651
+ /**
8652
+ * PullScheduler - Periodic State Synchronization
8653
+ *
8654
+ * Background scheduler that automatically pulls state changes from remote
8655
+ * at configured intervals.
8656
+ *
8657
+ * @module sync/pull_scheduler
8658
+ */
8659
+
8660
+ /**
8661
+ * Result of a pull operation executed by the scheduler
8662
+ */
8663
+ interface PullSchedulerResult {
8664
+ /** Whether the operation was successful */
8665
+ success: boolean;
8666
+ /** Whether new changes were detected */
8667
+ hasChanges: boolean;
8668
+ /** Whether a conflict was detected */
8669
+ conflictDetected: boolean;
8670
+ /** Conflict information if applicable */
8671
+ conflictInfo?: {
8672
+ type: string;
8673
+ message: string;
8674
+ affectedFiles?: string[];
8675
+ };
8676
+ /** Timestamp of the operation */
8677
+ timestamp: string;
8678
+ /** Error if operation failed */
8679
+ error?: string;
8680
+ }
8681
+ /**
8682
+ * Configuration for the PullScheduler
8683
+ */
8684
+ interface PullSchedulerConfig {
8685
+ /** Whether the scheduler is enabled */
8686
+ enabled: boolean;
8687
+ /** Pull interval in seconds */
8688
+ pullIntervalSeconds: number;
8689
+ /** Whether to continue after network errors */
8690
+ continueOnNetworkError: boolean;
8691
+ /** Whether to stop if a conflict is detected */
8692
+ stopOnConflict: boolean;
8693
+ }
8694
+ /**
8695
+ * Dependencies required by PullScheduler
8696
+ */
8697
+ interface PullSchedulerDependencies {
8698
+ /** SyncModule for pull operations */
8699
+ syncModule: SyncModule;
8700
+ /** ConfigManager for loading configuration */
8701
+ configManager: ConfigManager;
8702
+ }
8703
+ /**
8704
+ * PullScheduler - Automatic background synchronization
8705
+ *
8706
+ * Periodically pulls state changes from remote to keep local state up-to-date.
8707
+ * Useful for collaboration scenarios where multiple actors are working simultaneously.
8708
+ *
8709
+ * [EARS-33 to EARS-40]
8710
+ *
8711
+ * @example
8712
+ * ```typescript
8713
+ * const scheduler = new PullScheduler({
8714
+ * syncModule,
8715
+ * configManager
8716
+ * });
8717
+ *
8718
+ * await scheduler.start(); // Start periodic pulling
8719
+ * // ... scheduler runs in background ...
8720
+ * scheduler.stop(); // Stop scheduler
8721
+ * ```
8722
+ */
8723
+ declare class PullScheduler {
8724
+ private syncModule;
8725
+ private configManager;
8726
+ private config;
8727
+ private intervalId?;
8728
+ private running;
8729
+ private pulling;
8730
+ constructor(dependencies: PullSchedulerDependencies);
8731
+ /**
8732
+ * Loads configuration from ConfigManager with cascade merge:
8733
+ * 1. Local preferences in .session.json (highest priority)
8734
+ * 2. Project defaults in config.json
8735
+ * 3. Hardcoded defaults (fallback)
8736
+ */
8737
+ private loadConfig;
8738
+ /**
8739
+ * Starts the scheduler with configured interval
8740
+ *
8741
+ * [EARS-33, EARS-34]
8742
+ *
8743
+ * @throws Error if scheduler fails to load configuration
8744
+ *
8745
+ * @example
8746
+ * ```typescript
8747
+ * await scheduler.start();
8748
+ * // Scheduler now pulls every N seconds
8749
+ * ```
8750
+ */
8751
+ start(): Promise<void>;
8752
+ /**
8753
+ * Stops the scheduler and cleans up resources
8754
+ *
8755
+ * [EARS-35]
8756
+ *
8757
+ * @example
8758
+ * ```typescript
8759
+ * scheduler.stop();
8760
+ * // Scheduler is now stopped
8761
+ * ```
8762
+ */
8763
+ stop(): void;
8764
+ /**
8765
+ * Checks if the scheduler is currently running
8766
+ *
8767
+ * [EARS-36]
8768
+ *
8769
+ * @returns true if running, false otherwise
8770
+ *
8771
+ * @example
8772
+ * ```typescript
8773
+ * if (scheduler.isRunning()) {
8774
+ * console.log("Scheduler is active");
8775
+ * }
8776
+ * ```
8777
+ */
8778
+ isRunning(): boolean;
8779
+ /**
8780
+ * Executes a pull operation immediately
8781
+ *
8782
+ * This method can be called manually or is automatically invoked by the scheduler.
8783
+ * Handles conflicts, network errors, and concurrent pull prevention.
8784
+ *
8785
+ * [EARS-37, EARS-38, EARS-39, EARS-40]
8786
+ *
8787
+ * @returns Result of the pull operation
8788
+ *
8789
+ * @example
8790
+ * ```typescript
8791
+ * const result = await scheduler.pullNow();
8792
+ * if (result.hasChanges) {
8793
+ * console.log("New changes detected");
8794
+ * }
8795
+ * ```
8796
+ */
8797
+ pullNow(): Promise<PullSchedulerResult>;
8798
+ }
8799
+
8800
+ /**
8801
+ * Base error class for all sync-related errors
8802
+ */
8803
+ declare class SyncError extends Error {
8804
+ constructor(message: string);
8805
+ }
8806
+ /**
8807
+ * Error thrown when attempting to push from gitgov-state branch
8808
+ */
8809
+ declare class PushFromStateBranchError extends SyncError {
8810
+ branch: string;
8811
+ constructor(branchName: string);
8812
+ }
8813
+ /**
8814
+ * Error thrown when integrity violations are detected during audit
8815
+ */
8816
+ declare class IntegrityViolationError extends SyncError {
8817
+ violations: Array<{
8818
+ type: "resolution" | "signature" | "checksum" | "missing_file";
8819
+ details: string;
8820
+ }>;
8821
+ constructor(violations: Array<{
8822
+ type: "resolution" | "signature" | "checksum" | "missing_file";
8823
+ details: string;
8824
+ }>);
8825
+ }
8826
+ /**
8827
+ * Error thrown when conflict markers are still present in files
8828
+ */
8829
+ declare class ConflictMarkersPresentError extends SyncError {
8830
+ filesWithMarkers: string[];
8831
+ constructor(filesWithMarkers: string[]);
8832
+ }
8833
+ /**
8834
+ * Error thrown when attempting to resolve conflict without rebase in progress
8835
+ */
8836
+ declare class NoRebaseInProgressError extends SyncError {
8837
+ constructor();
8838
+ }
8839
+ /**
8840
+ * Error thrown when CryptoModule is required but not available
8841
+ */
8842
+ declare class CryptoModuleRequiredError extends SyncError {
8843
+ constructor(operation: string);
8844
+ }
8845
+ /**
8846
+ * Error thrown when state branch cannot be created or configured
8847
+ */
8848
+ declare class StateBranchSetupError extends SyncError {
8849
+ reason: string;
8850
+ underlyingError?: Error | undefined;
8851
+ constructor(reason: string, underlyingError?: Error | undefined);
8852
+ }
8853
+ /**
8854
+ * Error thrown when uncommitted changes exist in state branch
8855
+ */
8856
+ declare class UncommittedChangesError extends SyncError {
8857
+ branch: string;
8858
+ constructor(branchName: string);
8859
+ }
8860
+ /**
8861
+ * Type guards for error handling
8862
+ *
8863
+ * These functions enable type-safe error handling by narrowing the error type.
8864
+ * They are additive and don't break any existing code.
8865
+ *
8866
+ * Example usage:
8867
+ * ```typescript
8868
+ * try {
8869
+ * await syncModule.pushState(options);
8870
+ * } catch (error) {
8871
+ * if (isPushFromStateBranchError(error)) {
8872
+ * // TypeScript knows error.branch exists here
8873
+ * console.log(`Cannot push from ${error.branch}`);
8874
+ * }
8875
+ * }
8876
+ * ```
8877
+ */
8878
+ declare function isSyncError(error: unknown): error is SyncError;
8879
+ declare function isPushFromStateBranchError(error: unknown): error is PushFromStateBranchError;
8880
+ declare function isIntegrityViolationError(error: unknown): error is IntegrityViolationError;
8881
+ declare function isConflictMarkersPresentError(error: unknown): error is ConflictMarkersPresentError;
8882
+ declare function isUncommittedChangesError(error: unknown): error is UncommittedChangesError;
8883
+ declare function isNoRebaseInProgressError(error: unknown): error is NoRebaseInProgressError;
8884
+ declare function isStateBranchSetupError(error: unknown): error is StateBranchSetupError;
8885
+ declare function isCryptoModuleRequiredError(error: unknown): error is CryptoModuleRequiredError;
8886
+
8887
+ type index$2_AuditScope = AuditScope;
8888
+ type index$2_AuditStateOptions = AuditStateOptions;
8889
+ type index$2_AuditStateReport = AuditStateReport;
8890
+ type index$2_ConflictDiff = ConflictDiff;
8891
+ type index$2_ConflictFileDiff = ConflictFileDiff;
8892
+ type index$2_ConflictInfo = ConflictInfo;
8893
+ type index$2_ConflictMarkersPresentError = ConflictMarkersPresentError;
8894
+ declare const index$2_ConflictMarkersPresentError: typeof ConflictMarkersPresentError;
8895
+ type index$2_ConflictType = ConflictType;
8896
+ type index$2_CryptoModuleRequiredError = CryptoModuleRequiredError;
8897
+ declare const index$2_CryptoModuleRequiredError: typeof CryptoModuleRequiredError;
8898
+ type index$2_ExpectedFilesScope = ExpectedFilesScope;
8899
+ type index$2_IntegrityViolation = IntegrityViolation;
8900
+ type index$2_IntegrityViolationError = IntegrityViolationError;
8901
+ declare const index$2_IntegrityViolationError: typeof IntegrityViolationError;
8902
+ type index$2_NoRebaseInProgressError = NoRebaseInProgressError;
8903
+ declare const index$2_NoRebaseInProgressError: typeof NoRebaseInProgressError;
8904
+ type index$2_PullScheduler = PullScheduler;
8905
+ declare const index$2_PullScheduler: typeof PullScheduler;
8906
+ type index$2_PullSchedulerConfig = PullSchedulerConfig;
8907
+ type index$2_PullSchedulerDependencies = PullSchedulerDependencies;
8908
+ type index$2_PullSchedulerResult = PullSchedulerResult;
8909
+ type index$2_PushFromStateBranchError = PushFromStateBranchError;
8910
+ declare const index$2_PushFromStateBranchError: typeof PushFromStateBranchError;
8911
+ type index$2_StateBranchSetupError = StateBranchSetupError;
8912
+ declare const index$2_StateBranchSetupError: typeof StateBranchSetupError;
8913
+ type index$2_StateDeltaFile = StateDeltaFile;
8914
+ type index$2_SyncError = SyncError;
8915
+ declare const index$2_SyncError: typeof SyncError;
8916
+ type index$2_SyncModule = SyncModule;
8917
+ declare const index$2_SyncModule: typeof SyncModule;
8918
+ type index$2_SyncModuleDependencies = SyncModuleDependencies;
8919
+ type index$2_SyncPullOptions = SyncPullOptions;
8920
+ type index$2_SyncPullResult = SyncPullResult;
8921
+ type index$2_SyncPushOptions = SyncPushOptions;
8922
+ type index$2_SyncPushResult = SyncPushResult;
8923
+ type index$2_SyncResolveOptions = SyncResolveOptions;
8924
+ type index$2_SyncResolveResult = SyncResolveResult;
8925
+ type index$2_UncommittedChangesError = UncommittedChangesError;
8926
+ declare const index$2_UncommittedChangesError: typeof UncommittedChangesError;
8927
+ declare const index$2_isConflictMarkersPresentError: typeof isConflictMarkersPresentError;
8928
+ declare const index$2_isCryptoModuleRequiredError: typeof isCryptoModuleRequiredError;
8929
+ declare const index$2_isIntegrityViolationError: typeof isIntegrityViolationError;
8930
+ declare const index$2_isNoRebaseInProgressError: typeof isNoRebaseInProgressError;
8931
+ declare const index$2_isPushFromStateBranchError: typeof isPushFromStateBranchError;
8932
+ declare const index$2_isStateBranchSetupError: typeof isStateBranchSetupError;
8933
+ declare const index$2_isSyncError: typeof isSyncError;
8934
+ declare const index$2_isUncommittedChangesError: typeof isUncommittedChangesError;
7439
8935
  declare namespace index$2 {
7440
- export { index$2_DetailedValidationError as DetailedValidationError, index$2_GitGovError as GitGovError, type index$2_SchemaName as SchemaName, index$2_SchemaValidationCache as SchemaValidationCache, index$2_SchemaValidationError as SchemaValidationError, index$2_Schemas as Schemas, index$2_getSchema as getSchema, index$2_getSchemaNames as getSchemaNames, index$2_hasSchema as hasSchema };
8936
+ export { type index$2_AuditScope as AuditScope, type index$2_AuditStateOptions as AuditStateOptions, type index$2_AuditStateReport as AuditStateReport, type index$2_ConflictDiff as ConflictDiff, type index$2_ConflictFileDiff as ConflictFileDiff, type index$2_ConflictInfo as ConflictInfo, index$2_ConflictMarkersPresentError as ConflictMarkersPresentError, type index$2_ConflictType as ConflictType, index$2_CryptoModuleRequiredError as CryptoModuleRequiredError, type index$2_ExpectedFilesScope as ExpectedFilesScope, type index$2_IntegrityViolation as IntegrityViolation, index$2_IntegrityViolationError as IntegrityViolationError, index$2_NoRebaseInProgressError as NoRebaseInProgressError, index$2_PullScheduler as PullScheduler, type index$2_PullSchedulerConfig as PullSchedulerConfig, type index$2_PullSchedulerDependencies as PullSchedulerDependencies, type index$2_PullSchedulerResult as PullSchedulerResult, index$2_PushFromStateBranchError as PushFromStateBranchError, index$2_StateBranchSetupError as StateBranchSetupError, type index$2_StateDeltaFile as StateDeltaFile, index$2_SyncError as SyncError, index$2_SyncModule as SyncModule, type index$2_SyncModuleDependencies as SyncModuleDependencies, type index$2_SyncPullOptions as SyncPullOptions, type index$2_SyncPullResult as SyncPullResult, type index$2_SyncPushOptions as SyncPushOptions, type index$2_SyncPushResult as SyncPushResult, type index$2_SyncResolveOptions as SyncResolveOptions, type index$2_SyncResolveResult as SyncResolveResult, index$2_UncommittedChangesError as UncommittedChangesError, index$2_isConflictMarkersPresentError as isConflictMarkersPresentError, index$2_isCryptoModuleRequiredError as isCryptoModuleRequiredError, index$2_isIntegrityViolationError as isIntegrityViolationError, index$2_isNoRebaseInProgressError as isNoRebaseInProgressError, index$2_isPushFromStateBranchError as isPushFromStateBranchError, index$2_isStateBranchSetupError as isStateBranchSetupError, index$2_isSyncError as isSyncError, index$2_isUncommittedChangesError as isUncommittedChangesError };
7441
8937
  }
7442
8938
 
7443
8939
  /**
@@ -7977,4 +9473,4 @@ declare namespace index {
7977
9473
  export { index_CircularDependencyError as CircularDependencyError, index_ContentSanitizer as ContentSanitizer, type index_DiagramEdge as DiagramEdge, index_DiagramGenerator as DiagramGenerator, index_DiagramMetrics as DiagramMetrics, type index_DiagramNode as DiagramNode, type index_DiagramOptions as DiagramOptions, index_MermaidRenderer as MermaidRenderer, index_MermaidValidator as MermaidValidator, index_RelationshipAnalyzer as RelationshipAnalyzer, type index_RelationshipGraph as RelationshipGraph, index_RenderingError as RenderingError };
7978
9474
  }
7979
9475
 
7980
- export { index$7 as Adapters, index$b as BacklogAdapter, index$e as ChangelogAdapter, index$9 as Config, index$6 as Crypto, index as DiagramGenerator, index$i as EventBus, index$f as ExecutionAdapter, index$5 as Factories, index$g as FeedbackAdapter, index$h as IdentityAdapter, index$a as IndexerAdapter, index$4 as Lint, index$3 as Logger, index$d as MetricsAdapter, index$8 as ProjectAdapter, index$k as Records, index$2 as Schemas, index$j as Store, index$1 as Validation, index$c as WorkflowMethodologyAdapter };
9476
+ export { index$8 as Adapters, index$c as BacklogAdapter, index$g as ChangelogAdapter, index$e as Config, index$7 as Crypto, index as DiagramGenerator, index$k as EventBus, index$h as ExecutionAdapter, index$6 as Factories, index$i as FeedbackAdapter, index$a as Git, index$j as IdentityAdapter, index$b as IndexerAdapter, index$5 as Lint, index$4 as Logger, index$f as MetricsAdapter, index$9 as ProjectAdapter, index$m as Records, index$3 as Schemas, index$l as Store, index$2 as Sync, index$1 as Validation, index$d as WorkflowMethodologyAdapter };