@gitgov/core 1.6.4 → 1.8.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -751,42 +751,42 @@ declare class GitGovError extends Error {
751
751
  constructor(message: string, code: string);
752
752
  }
753
753
 
754
- type index$j_ActorPayload = ActorPayload;
755
- type index$j_ActorRecord = ActorRecord;
756
- type index$j_AgentPayload = AgentPayload;
757
- type index$j_AgentRecord = AgentRecord;
758
- type index$j_ChangelogPayload = ChangelogPayload;
759
- type index$j_ChangelogRecord = ChangelogRecord;
760
- type index$j_CustomRecord = CustomRecord;
761
- type index$j_CyclePayload = CyclePayload;
762
- type index$j_CycleRecord = CycleRecord;
763
- type index$j_EmbeddedMetadataHeader = EmbeddedMetadataHeader;
764
- type index$j_EmbeddedMetadataRecord<T extends GitGovRecordPayload> = EmbeddedMetadataRecord<T>;
765
- type index$j_ExecutionPayload = ExecutionPayload;
766
- type index$j_ExecutionRecord = ExecutionRecord;
767
- type index$j_FeedbackPayload = FeedbackPayload;
768
- type index$j_FeedbackRecord = FeedbackRecord;
769
- type index$j_GitGovActorRecord = GitGovActorRecord;
770
- type index$j_GitGovAgentRecord = GitGovAgentRecord;
771
- type index$j_GitGovChangelogRecord = GitGovChangelogRecord;
772
- type index$j_GitGovCycleRecord = GitGovCycleRecord;
773
- type index$j_GitGovError = GitGovError;
774
- declare const index$j_GitGovError: typeof GitGovError;
775
- type index$j_GitGovExecutionRecord = GitGovExecutionRecord;
776
- type index$j_GitGovFeedbackRecord = GitGovFeedbackRecord;
777
- type index$j_GitGovRecord = GitGovRecord;
778
- type index$j_GitGovRecordPayload = GitGovRecordPayload;
779
- type index$j_GitGovRecordType = GitGovRecordType;
780
- type index$j_GitGovTaskRecord = GitGovTaskRecord;
781
- type index$j_Signature = Signature;
782
- type index$j_TaskPayload = TaskPayload;
783
- type index$j_TaskRecord = TaskRecord;
784
- type index$j_WorkflowMethodologyRecord = WorkflowMethodologyRecord;
785
- declare namespace index$j {
786
- export { type index$j_ActorPayload as ActorPayload, type index$j_ActorRecord as ActorRecord, type index$j_AgentPayload as AgentPayload, type index$j_AgentRecord as AgentRecord, type index$j_ChangelogPayload as ChangelogPayload, type index$j_ChangelogRecord as ChangelogRecord, type index$j_CustomRecord as CustomRecord, type index$j_CyclePayload as CyclePayload, type index$j_CycleRecord as CycleRecord, type index$j_EmbeddedMetadataHeader as EmbeddedMetadataHeader, type index$j_EmbeddedMetadataRecord as EmbeddedMetadataRecord, type index$j_ExecutionPayload as ExecutionPayload, type index$j_ExecutionRecord as ExecutionRecord, type index$j_FeedbackPayload as FeedbackPayload, type index$j_FeedbackRecord as FeedbackRecord, type index$j_GitGovActorRecord as GitGovActorRecord, type index$j_GitGovAgentRecord as GitGovAgentRecord, type index$j_GitGovChangelogRecord as GitGovChangelogRecord, type index$j_GitGovCycleRecord as GitGovCycleRecord, index$j_GitGovError as GitGovError, type index$j_GitGovExecutionRecord as GitGovExecutionRecord, type index$j_GitGovFeedbackRecord as GitGovFeedbackRecord, type index$j_GitGovRecord as GitGovRecord, type index$j_GitGovRecordPayload as GitGovRecordPayload, type index$j_GitGovRecordType as GitGovRecordType, type index$j_GitGovTaskRecord as GitGovTaskRecord, type index$j_Signature as Signature, type index$j_TaskPayload as TaskPayload, type index$j_TaskRecord as TaskRecord, type index$j_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
- type StorablePayload = Exclude<GitGovRecordPayload, CustomRecord>;
789
+ type StorablePayload$1 = Exclude<GitGovRecordPayload, CustomRecord>;
790
790
  interface FsDependencies {
791
791
  mkdir: typeof promises.mkdir;
792
792
  writeFile: typeof promises.writeFile;
@@ -795,11 +795,14 @@ interface FsDependencies {
795
795
  unlink: typeof promises.unlink;
796
796
  access: typeof promises.access;
797
797
  }
798
- declare class RecordStore<T extends StorablePayload> {
798
+ declare class RecordStore<T extends StorablePayload$1> {
799
799
  private recordType;
800
800
  private recordsDir;
801
801
  private fs;
802
- constructor(recordType: string, rootPath?: string, fsDeps?: FsDependencies);
802
+ private loader;
803
+ constructor(recordType: string, loader: (data: unknown) => GitGovRecord & {
804
+ payload: T;
805
+ }, rootPath?: string, fsDeps?: FsDependencies);
803
806
  private getRecordPath;
804
807
  private ensureDirExists;
805
808
  write(record: GitGovRecord & {
@@ -813,11 +816,11 @@ declare class RecordStore<T extends StorablePayload> {
813
816
  exists(recordId: string): Promise<boolean>;
814
817
  }
815
818
 
816
- type index$i_FsDependencies = FsDependencies;
817
- type index$i_RecordStore<T extends StorablePayload> = RecordStore<T>;
818
- declare const index$i_RecordStore: typeof RecordStore;
819
- declare namespace index$i {
820
- export { type index$i_FsDependencies as FsDependencies, index$i_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 };
821
824
  }
822
825
 
823
826
  /**
@@ -1177,31 +1180,31 @@ declare function publishEvent(event: GitGovEvent): void;
1177
1180
  */
1178
1181
  declare function subscribeToEvent<T extends GitGovEvent>(eventType: T['type'], handler: EventHandler<T>): EventSubscription;
1179
1182
 
1180
- type index$h_ActivityEvent = ActivityEvent;
1181
- type index$h_ActorCreatedEvent = ActorCreatedEvent;
1182
- type index$h_ActorRevokedEvent = ActorRevokedEvent;
1183
- type index$h_AgentRegisteredEvent = AgentRegisteredEvent;
1184
- type index$h_BaseEvent = BaseEvent;
1185
- type index$h_ChangelogCreatedEvent = ChangelogCreatedEvent;
1186
- type index$h_CycleCreatedEvent = CycleCreatedEvent;
1187
- type index$h_CycleStatusChangedEvent = CycleStatusChangedEvent;
1188
- type index$h_EventBus = EventBus;
1189
- declare const index$h_EventBus: typeof EventBus;
1190
- type index$h_EventHandler<T extends BaseEvent = BaseEvent> = EventHandler<T>;
1191
- type index$h_EventMetadata = EventMetadata;
1192
- type index$h_EventSubscription = EventSubscription;
1193
- type index$h_ExecutionCreatedEvent = ExecutionCreatedEvent;
1194
- type index$h_FeedbackCreatedEvent = FeedbackCreatedEvent;
1195
- type index$h_GitGovEvent = GitGovEvent;
1196
- type index$h_IEventStream = IEventStream;
1197
- type index$h_SystemDailyTickEvent = SystemDailyTickEvent;
1198
- type index$h_TaskCreatedEvent = TaskCreatedEvent;
1199
- type index$h_TaskStatusChangedEvent = TaskStatusChangedEvent;
1200
- declare const index$h_eventBus: typeof eventBus;
1201
- declare const index$h_publishEvent: typeof publishEvent;
1202
- declare const index$h_subscribeToEvent: typeof subscribeToEvent;
1203
- declare namespace index$h {
1204
- export { type index$h_ActivityEvent as ActivityEvent, type index$h_ActorCreatedEvent as ActorCreatedEvent, type index$h_ActorRevokedEvent as ActorRevokedEvent, type index$h_AgentRegisteredEvent as AgentRegisteredEvent, type index$h_BaseEvent as BaseEvent, type index$h_ChangelogCreatedEvent as ChangelogCreatedEvent, type index$h_CycleCreatedEvent as CycleCreatedEvent, type index$h_CycleStatusChangedEvent as CycleStatusChangedEvent, index$h_EventBus as EventBus, type index$h_EventHandler as EventHandler, type index$h_EventMetadata as EventMetadata, type index$h_EventSubscription as EventSubscription, type index$h_ExecutionCreatedEvent as ExecutionCreatedEvent, type index$h_FeedbackCreatedEvent as FeedbackCreatedEvent, type index$h_GitGovEvent as GitGovEvent, type index$h_IEventStream as IEventStream, type index$h_SystemDailyTickEvent as SystemDailyTickEvent, type index$h_TaskCreatedEvent as TaskCreatedEvent, type index$h_TaskStatusChangedEvent as TaskStatusChangedEvent, index$h_eventBus as eventBus, index$h_publishEvent as publishEvent, index$h_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 };
1205
1208
  }
1206
1209
 
1207
1210
  /**
@@ -1270,7 +1273,7 @@ declare class IdentityAdapter implements IIdentityAdapter {
1270
1273
  * @returns Promise<ActorRecord | null> - The current active ActorRecord or null
1271
1274
  */
1272
1275
  getEffectiveActorForAgent(agentId: string): Promise<ActorRecord | null>;
1273
- rotateActorKey(_actorId: string): Promise<{
1276
+ rotateActorKey(actorId: string): Promise<{
1274
1277
  oldActor: ActorRecord;
1275
1278
  newActor: ActorRecord;
1276
1279
  }>;
@@ -1281,12 +1284,12 @@ declare class IdentityAdapter implements IIdentityAdapter {
1281
1284
  listAgentRecords(): Promise<AgentRecord[]>;
1282
1285
  }
1283
1286
 
1284
- type index$g_IIdentityAdapter = IIdentityAdapter;
1285
- type index$g_IdentityAdapter = IdentityAdapter;
1286
- declare const index$g_IdentityAdapter: typeof IdentityAdapter;
1287
- type index$g_IdentityAdapterDependencies = IdentityAdapterDependencies;
1288
- declare namespace index$g {
1289
- export { type index$g_IIdentityAdapter as IIdentityAdapter, index$g_IdentityAdapter as IdentityAdapter, type index$g_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 };
1290
1293
  }
1291
1294
 
1292
1295
  /**
@@ -1404,13 +1407,13 @@ declare class FeedbackAdapter implements IFeedbackAdapter {
1404
1407
  private buildThread;
1405
1408
  }
1406
1409
 
1407
- type index$f_FeedbackAdapter = FeedbackAdapter;
1408
- declare const index$f_FeedbackAdapter: typeof FeedbackAdapter;
1409
- type index$f_FeedbackAdapterDependencies = FeedbackAdapterDependencies;
1410
- type index$f_FeedbackThread = FeedbackThread;
1411
- type index$f_IFeedbackAdapter = IFeedbackAdapter;
1412
- declare namespace index$f {
1413
- export { index$f_FeedbackAdapter as FeedbackAdapter, type index$f_FeedbackAdapterDependencies as FeedbackAdapterDependencies, type index$f_FeedbackThread as FeedbackThread, type index$f_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 };
1414
1417
  }
1415
1418
 
1416
1419
  /**
@@ -1498,12 +1501,12 @@ declare class ExecutionAdapter implements IExecutionAdapter {
1498
1501
  private isFirstExecutionForTask;
1499
1502
  }
1500
1503
 
1501
- type index$e_ExecutionAdapter = ExecutionAdapter;
1502
- declare const index$e_ExecutionAdapter: typeof ExecutionAdapter;
1503
- type index$e_ExecutionAdapterDependencies = ExecutionAdapterDependencies;
1504
- type index$e_IExecutionAdapter = IExecutionAdapter;
1505
- declare namespace index$e {
1506
- export { index$e_ExecutionAdapter as ExecutionAdapter, type index$e_ExecutionAdapterDependencies as ExecutionAdapterDependencies, type index$e_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 };
1507
1510
  }
1508
1511
 
1509
1512
  /**
@@ -1596,13 +1599,13 @@ declare class ChangelogAdapter implements IChangelogAdapter {
1596
1599
  getChangelogsByEntity(entityId: string, _entityType?: string): Promise<ChangelogRecord[]>;
1597
1600
  }
1598
1601
 
1599
- type index$d_ChangelogAdapter = ChangelogAdapter;
1600
- declare const index$d_ChangelogAdapter: typeof ChangelogAdapter;
1601
- type index$d_ChangelogAdapterDependencies = ChangelogAdapterDependencies;
1602
- type index$d_ChangelogListOptions = ChangelogListOptions;
1603
- type index$d_IChangelogAdapter = IChangelogAdapter;
1604
- declare namespace index$d {
1605
- export { index$d_ChangelogAdapter as ChangelogAdapter, type index$d_ChangelogAdapterDependencies as ChangelogAdapterDependencies, type index$d_ChangelogListOptions as ChangelogListOptions, type index$d_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 };
1606
1609
  }
1607
1610
 
1608
1611
  /**
@@ -1614,9 +1617,9 @@ type MetricsAdapterDependencies = {
1614
1617
  feedbackStore?: RecordStore<FeedbackRecord>;
1615
1618
  executionStore?: RecordStore<ExecutionRecord>;
1616
1619
  actorStore?: RecordStore<ActorRecord>;
1617
- platformApi?: IPlatformApi$1;
1620
+ platformApi?: IPlatformApi;
1618
1621
  };
1619
- interface IPlatformApi$1 {
1622
+ interface IPlatformApi {
1620
1623
  getTokenConsumption(timeframe: string): Promise<TokenConsumption[]>;
1621
1624
  }
1622
1625
  type TokenConsumption = {
@@ -1787,20 +1790,251 @@ declare class MetricsAdapter implements IMetricsAdapter {
1787
1790
  calculateAgentExecutionTime(_executions: ExecutionRecord[]): number;
1788
1791
  }
1789
1792
 
1790
- type index$c_CollaborationMetrics = CollaborationMetrics;
1791
- type index$c_IMetricsAdapter = IMetricsAdapter;
1792
- type index$c_MetricsAdapter = MetricsAdapter;
1793
- declare const index$c_MetricsAdapter: typeof MetricsAdapter;
1794
- type index$c_MetricsAdapterDependencies = MetricsAdapterDependencies;
1795
- type index$c_ProductivityMetrics = ProductivityMetrics;
1796
- type index$c_SystemStatus = SystemStatus;
1797
- type index$c_TaskHealthReport = TaskHealthReport;
1798
- declare namespace index$c {
1799
- export { type index$c_CollaborationMetrics as CollaborationMetrics, type index$c_IMetricsAdapter as IMetricsAdapter, index$c_MetricsAdapter as MetricsAdapter, type index$c_MetricsAdapterDependencies as MetricsAdapterDependencies, type index$c_ProductivityMetrics as ProductivityMetrics, type index$c_SystemStatus as SystemStatus, type index$c_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
+ */
1891
+ loadSession(): Promise<GitGovSession | null>;
1892
+ /**
1893
+ * Get root cycle from configuration
1894
+ */
1895
+ getRootCycle(): Promise<string | null>;
1896
+ /**
1897
+ * Get project information from configuration
1898
+ */
1899
+ getProjectInfo(): Promise<{
1900
+ id: string;
1901
+ name: string;
1902
+ } | null>;
1903
+ /**
1904
+ * Get actor state for a specific actor
1905
+ */
1906
+ getActorState(actorId: string): Promise<ActorState | null>;
1907
+ /**
1908
+ * Update actor state for a specific actor
1909
+ */
1910
+ updateActorState(actorId: string, state: Partial<ActorState>): Promise<void>;
1911
+ /**
1912
+ * Get cloud session token
1913
+ */
1914
+ getCloudSessionToken(): Promise<string | null>;
1915
+ /**
1916
+ * Get complete context information for an actor
1917
+ * Useful for agents to understand current working context
1918
+ * Returns information from both config.json (project-level) and .session.json (actor-level)
1919
+ */
1920
+ getActorContext(actorId: string): Promise<{
1921
+ actorId: string;
1922
+ activeCycleId: string | null;
1923
+ activeTaskId: string | null;
1924
+ rootCycle: string | null;
1925
+ projectInfo: {
1926
+ id: string;
1927
+ name: string;
1928
+ } | null;
1929
+ syncStatus: SyncStatus | null;
1930
+ }>;
1931
+ /**
1932
+ * Get sync configuration from config.json
1933
+ * Returns sync strategy and related settings with defaults
1934
+ */
1935
+ getSyncConfig(): Promise<{
1936
+ strategy: "manual" | "immediate" | "batched";
1937
+ maxRetries: number;
1938
+ pushIntervalSeconds: number;
1939
+ batchIntervalSeconds: number;
1940
+ } | null>;
1941
+ /**
1942
+ * Get sync defaults from config.json
1943
+ * Returns recommended defaults for pullScheduler and fileWatcher
1944
+ */
1945
+ getSyncDefaults(): Promise<{
1946
+ pullScheduler: {
1947
+ defaultIntervalSeconds: number;
1948
+ defaultEnabled: boolean;
1949
+ defaultContinueOnNetworkError: boolean;
1950
+ defaultStopOnConflict: boolean;
1951
+ };
1952
+ fileWatcher: {
1953
+ defaultDebounceMs: number;
1954
+ defaultIgnoredPatterns: string[];
1955
+ };
1956
+ }>;
1957
+ /**
1958
+ * Resolve PullScheduler configuration with priority logic:
1959
+ * 1. Local preferences (.session.json syncPreferences)
1960
+ * 2. Project defaults (config.json state.defaults)
1961
+ * 3. Hardcoded fallbacks
1962
+ */
1963
+ resolvePullSchedulerConfig(): Promise<{
1964
+ enabled: boolean;
1965
+ pullIntervalSeconds: number;
1966
+ continueOnNetworkError: boolean;
1967
+ stopOnConflict: boolean;
1968
+ }>;
1969
+ /**
1970
+ * Resolve FileWatcher configuration with priority logic:
1971
+ * 1. Local preferences (.session.json syncPreferences)
1972
+ * 2. Project defaults (config.json state.defaults)
1973
+ * 3. Hardcoded fallbacks
1974
+ */
1975
+ resolveFileWatcherConfig(): Promise<{
1976
+ enabled: boolean;
1977
+ debounceMs: number;
1978
+ ignoredPatterns: string[];
1979
+ }>;
1980
+ /**
1981
+ * Update sync preferences in .session.json
1982
+ * These are local machine preferences that override project defaults
1983
+ */
1984
+ updateSyncPreferences(preferences: {
1985
+ pullScheduler?: Partial<{
1986
+ enabled: boolean;
1987
+ pullIntervalSeconds: number;
1988
+ continueOnNetworkError: boolean;
1989
+ stopOnConflict: boolean;
1990
+ }>;
1991
+ fileWatcher?: Partial<{
1992
+ enabled: boolean;
1993
+ debounceMs: number;
1994
+ ignoredPatterns: string[];
1995
+ }>;
1996
+ }): Promise<void>;
1997
+ /**
1998
+ * Finds the project root by searching upwards for a .git directory.
1999
+ * Caches the result for subsequent calls.
2000
+ * @param startPath The path to start searching from. Defaults to the current working directory.
2001
+ * @returns The absolute path to the project root, or null if not found.
2002
+ */
2003
+ static findProjectRoot(startPath?: string): string | null;
2004
+ /**
2005
+ * Finds the appropriate project root by searching upwards.
2006
+ * First looks for .gitgov (initialized project), then .git (for init).
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 findGitgovRoot(startPath?: string): string | null;
2011
+ /**
2012
+ * Gets the .gitgov directory path from project root
2013
+ */
2014
+ static getGitgovPath(): string;
2015
+ /**
2016
+ * Checks if current directory is a GitGovernance project
2017
+ */
2018
+ static isGitgovProject(): boolean;
2019
+ }
2020
+ /**
2021
+ * Create a ConfigManager instance for the current project
2022
+ */
2023
+ declare function createConfigManager(projectRoot?: string): ConfigManager;
2024
+
2025
+ type index$e_ActorState = ActorState;
2026
+ type index$e_ConfigManager = ConfigManager;
2027
+ declare const index$e_ConfigManager: typeof ConfigManager;
2028
+ type index$e_GitGovConfig = GitGovConfig;
2029
+ type index$e_GitGovSession = GitGovSession;
2030
+ type index$e_SyncStatus = SyncStatus;
2031
+ declare const index$e_createConfigManager: typeof createConfigManager;
2032
+ declare namespace index$e {
2033
+ 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 };
1800
2034
  }
1801
2035
 
1802
2036
  type TaskStatus = TaskRecord['status'];
1803
- type ValidationContext = {
2037
+ type ValidationContext$1 = {
1804
2038
  task: TaskRecord;
1805
2039
  actor?: ActorRecord;
1806
2040
  signatures?: Signature[];
@@ -1814,9 +2048,9 @@ type TransitionRule = {
1814
2048
  };
1815
2049
  type ViewConfig = NonNullable<WorkflowMethodologyRecord['view_configs']>[string];
1816
2050
  interface IWorkflowMethodology {
1817
- getTransitionRule(from: TaskStatus, to: TaskStatus, context: ValidationContext): Promise<TransitionRule | null>;
1818
- validateSignature(signature: Signature, context: ValidationContext): Promise<boolean>;
1819
- validateCustomRules(rules: string[], context: ValidationContext): Promise<boolean>;
2051
+ getTransitionRule(from: TaskStatus, to: TaskStatus, context: ValidationContext$1): Promise<TransitionRule | null>;
2052
+ validateSignature(signature: Signature, context: ValidationContext$1): Promise<boolean>;
2053
+ validateCustomRules(rules: string[], context: ValidationContext$1): Promise<boolean>;
1820
2054
  getViewConfig(viewName: string): Promise<ViewConfig | null>;
1821
2055
  getAvailableTransitions(from: TaskStatus): Promise<TransitionRule[]>;
1822
2056
  }
@@ -1852,11 +2086,11 @@ declare class WorkflowMethodologyAdapter implements IWorkflowMethodology {
1852
2086
  /**
1853
2087
  * Determines if a state transition is legal according to the methodology
1854
2088
  */
1855
- getTransitionRule(from: TaskStatus, to: TaskStatus, _context: ValidationContext): Promise<TransitionRule | null>;
2089
+ getTransitionRule(from: TaskStatus, to: TaskStatus, _context: ValidationContext$1): Promise<TransitionRule | null>;
1856
2090
  /**
1857
2091
  * Validates if an actor's signature meets the requirements for a transition
1858
2092
  */
1859
- validateSignature(signature: Signature, context: ValidationContext): Promise<boolean>;
2093
+ validateSignature(signature: Signature, context: ValidationContext$1): Promise<boolean>;
1860
2094
  /**
1861
2095
  * Gets view configuration for mapping states to visual columns
1862
2096
  */
@@ -1864,17 +2098,16 @@ declare class WorkflowMethodologyAdapter implements IWorkflowMethodology {
1864
2098
  /**
1865
2099
  * Validates custom rules for a given context
1866
2100
  */
1867
- validateCustomRules(rules: string[], context: ValidationContext): Promise<boolean>;
2101
+ validateCustomRules(rules: string[], context: ValidationContext$1): Promise<boolean>;
1868
2102
  getAvailableTransitions(from: TaskStatus): Promise<TransitionRule[]>;
1869
2103
  }
1870
2104
 
1871
- type index$b_IWorkflowMethodology = IWorkflowMethodology;
1872
- type index$b_ValidationContext = ValidationContext;
1873
- type index$b_WorkflowMethodologyAdapter = WorkflowMethodologyAdapter;
1874
- declare const index$b_WorkflowMethodologyAdapter: typeof WorkflowMethodologyAdapter;
1875
- type index$b_WorkflowMethodologyAdapterDependencies = WorkflowMethodologyAdapterDependencies;
1876
- declare namespace index$b {
1877
- export { type index$b_IWorkflowMethodology as IWorkflowMethodology, type index$b_ValidationContext as ValidationContext, index$b_WorkflowMethodologyAdapter as WorkflowMethodologyAdapter, type index$b_WorkflowMethodologyAdapterDependencies as WorkflowMethodologyAdapterDependencies };
2105
+ type index$d_IWorkflowMethodology = IWorkflowMethodology;
2106
+ type index$d_WorkflowMethodologyAdapter = WorkflowMethodologyAdapter;
2107
+ declare const index$d_WorkflowMethodologyAdapter: typeof WorkflowMethodologyAdapter;
2108
+ type index$d_WorkflowMethodologyAdapterDependencies = WorkflowMethodologyAdapterDependencies;
2109
+ declare namespace index$d {
2110
+ export { type index$d_IWorkflowMethodology as IWorkflowMethodology, type ValidationContext$1 as ValidationContext, index$d_WorkflowMethodologyAdapter as WorkflowMethodologyAdapter, type index$d_WorkflowMethodologyAdapterDependencies as WorkflowMethodologyAdapterDependencies };
1878
2111
  }
1879
2112
 
1880
2113
  /**
@@ -1894,6 +2127,7 @@ type BacklogAdapterDependencies = {
1894
2127
  planningMethodologyAdapter?: IWorkflowMethodology;
1895
2128
  identity: IdentityAdapter;
1896
2129
  eventBus: IEventStream;
2130
+ configManager: ConfigManager;
1897
2131
  config?: BacklogAdapterConfig;
1898
2132
  };
1899
2133
  /**
@@ -1927,7 +2161,7 @@ interface IBacklogAdapter {
1927
2161
  handleDailyTick(event: SystemDailyTickEvent): Promise<void>;
1928
2162
  getSystemStatus(): Promise<SystemStatus>;
1929
2163
  getTaskHealth(taskId: string): Promise<TaskHealthReport>;
1930
- lint(): Promise<LintReport>;
2164
+ lint(): Promise<LintReport$1>;
1931
2165
  audit(): Promise<AuditReport>;
1932
2166
  processChanges(changes: unknown[]): Promise<ExecutionRecord[]>;
1933
2167
  }
@@ -1939,7 +2173,7 @@ type BacklogAdapterConfig = {
1939
2173
  systemMinScore: number;
1940
2174
  };
1941
2175
  };
1942
- type LintReport = {
2176
+ type LintReport$1 = {
1943
2177
  status: 'success' | 'failed';
1944
2178
  issues: string[];
1945
2179
  };
@@ -1963,6 +2197,7 @@ declare class BacklogAdapter implements IBacklogAdapter {
1963
2197
  private workflowMethodologyAdapter;
1964
2198
  private identity;
1965
2199
  private eventBus;
2200
+ private configManager;
1966
2201
  private config;
1967
2202
  constructor(dependencies: BacklogAdapterDependencies);
1968
2203
  /**
@@ -2083,7 +2318,7 @@ declare class BacklogAdapter implements IBacklogAdapter {
2083
2318
  /**
2084
2319
  * Updates a cycle with new payload
2085
2320
  */
2086
- updateCycle(cycleId: string, payload: Partial<CycleRecord>): Promise<CycleRecord>;
2321
+ updateCycle(cycleId: string, payload: Partial<CycleRecord>, actorId?: string): Promise<CycleRecord>;
2087
2322
  /**
2088
2323
  * Creates bidirectional link between task and cycle
2089
2324
  */
@@ -2099,18 +2334,18 @@ declare class BacklogAdapter implements IBacklogAdapter {
2099
2334
  * All business logic and validation happens here in the adapter
2100
2335
  */
2101
2336
  moveTasksBetweenCycles(targetCycleId: string, taskIds: string[], sourceCycleId: string): Promise<void>;
2102
- lint(): Promise<LintReport>;
2337
+ lint(): Promise<LintReport$1>;
2103
2338
  audit(): Promise<AuditReport>;
2104
2339
  processChanges(_changes: unknown[]): Promise<ExecutionRecord[]>;
2105
2340
  }
2106
2341
 
2107
- type index$a_BacklogAdapter = BacklogAdapter;
2108
- declare const index$a_BacklogAdapter: typeof BacklogAdapter;
2109
- type index$a_BacklogAdapterConfig = BacklogAdapterConfig;
2110
- type index$a_BacklogAdapterDependencies = BacklogAdapterDependencies;
2111
- type index$a_IBacklogAdapter = IBacklogAdapter;
2112
- declare namespace index$a {
2113
- export { index$a_BacklogAdapter as BacklogAdapter, type index$a_BacklogAdapterConfig as BacklogAdapterConfig, type index$a_BacklogAdapterDependencies as BacklogAdapterDependencies, type index$a_IBacklogAdapter as IBacklogAdapter };
2342
+ type index$c_BacklogAdapter = BacklogAdapter;
2343
+ declare const index$c_BacklogAdapter: typeof BacklogAdapter;
2344
+ type index$c_BacklogAdapterConfig = BacklogAdapterConfig;
2345
+ type index$c_BacklogAdapterDependencies = BacklogAdapterDependencies;
2346
+ type index$c_IBacklogAdapter = IBacklogAdapter;
2347
+ declare namespace index$c {
2348
+ export { index$c_BacklogAdapter as BacklogAdapter, type index$c_BacklogAdapterConfig as BacklogAdapterConfig, type index$c_BacklogAdapterDependencies as BacklogAdapterDependencies, type index$c_IBacklogAdapter as IBacklogAdapter };
2114
2349
  }
2115
2350
 
2116
2351
  /**
@@ -2128,10 +2363,50 @@ type AllRecords = {
2128
2363
  actors: GitGovActorRecord[];
2129
2364
  };
2130
2365
  /**
2131
- * Enhanced Task Record with calculated activity metadata
2132
- * Used by Dashboard for intelligent sorting and display
2366
+ * Enhanced Task Record with complete intelligence layer
2367
+ * Calculated by enrichTaskRecord() with relationships, metrics, and derived states
2368
+ *
2369
+ * @see indexer_adapter.md Section 3.6 - EnrichedTaskRecord Specification (EARS 25-48)
2133
2370
  */
2134
2371
  type EnrichedTaskRecord = TaskRecord & {
2372
+ derivedState: {
2373
+ isStalled: boolean;
2374
+ isAtRisk: boolean;
2375
+ needsClarification: boolean;
2376
+ isBlockedByDependency: boolean;
2377
+ healthScore: number;
2378
+ timeInCurrentStage: number;
2379
+ };
2380
+ relationships: {
2381
+ author?: {
2382
+ actorId: string;
2383
+ timestamp: number;
2384
+ };
2385
+ lastModifier?: {
2386
+ actorId: string;
2387
+ timestamp: number;
2388
+ };
2389
+ assignedTo: Array<{
2390
+ actorId: string;
2391
+ assignedAt?: number;
2392
+ }>;
2393
+ dependsOn: string[];
2394
+ blockedBy: string[];
2395
+ cycles: Array<{
2396
+ id: string;
2397
+ title: string;
2398
+ }>;
2399
+ };
2400
+ metrics: {
2401
+ executionCount: number;
2402
+ blockingFeedbackCount: number;
2403
+ openQuestionCount: number;
2404
+ timeToResolution?: number;
2405
+ };
2406
+ release: {
2407
+ isReleased: boolean;
2408
+ lastReleaseVersion?: string;
2409
+ };
2135
2410
  lastUpdated: number;
2136
2411
  lastActivityType: 'task_modified' | 'feedback_received' | 'execution_added' | 'changelog_created' | 'task_created';
2137
2412
  recentActivity?: string;
@@ -2163,11 +2438,50 @@ type IndexData = {
2163
2438
  generationTime: number;
2164
2439
  };
2165
2440
  metrics: SystemStatus & ProductivityMetrics & CollaborationMetrics;
2441
+ derivedStates: DerivedStates;
2166
2442
  activityHistory: ActivityEvent[];
2167
- tasks: TaskRecord[];
2443
+ /**
2444
+ * Raw task records with FULL headers (source of truth for signatures/checksums).
2445
+ * Mantener por backward compatibility - deprecar gradualmente en favor de enrichedTasks.
2446
+ */
2447
+ tasks: GitGovTaskRecord[];
2448
+ /**
2449
+ * Enriched tasks with intelligence layer (NEW - Phase 1A).
2450
+ * Payload + campos calculados (relationships, metrics, derivedState, release).
2451
+ * NO incluye headers (author/lastModifier ya extraídos en relationships).
2452
+ */
2168
2453
  enrichedTasks: EnrichedTaskRecord[];
2169
- cycles: CycleRecord[];
2170
- actors: ActorRecord[];
2454
+ /** Raw cycle records with FULL headers */
2455
+ cycles: GitGovCycleRecord[];
2456
+ /** Raw actor records with FULL headers */
2457
+ actors: GitGovActorRecord[];
2458
+ /** Raw feedback records with FULL headers (optional - Phase 1B+) */
2459
+ feedback: GitGovFeedbackRecord[];
2460
+ };
2461
+ /**
2462
+ * System-wide derived states for dashboard analytics and filtering.
2463
+ * Calculated by calculateDerivedStates() during index generation.
2464
+ *
2465
+ * @see derived_data_protocol.md for calculation algorithms
2466
+ */
2467
+ type DerivedStates = {
2468
+ stalledTasks: string[];
2469
+ atRiskTasks: string[];
2470
+ needsClarificationTasks: string[];
2471
+ blockedByDependencyTasks: string[];
2472
+ };
2473
+ /**
2474
+ * Optimized version of DerivedStates using Sets for O(1) lookup performance.
2475
+ * Used internally by enrichTaskRecord() to efficiently check task membership.
2476
+ *
2477
+ * Conversion from DerivedStates (arrays) to DerivedStateSets (Sets) happens once
2478
+ * in generateIndex() before processing multiple tasks, avoiding repeated O(n) lookups.
2479
+ */
2480
+ type DerivedStateSets = {
2481
+ stalledTasks: Set<string>;
2482
+ atRiskTasks: Set<string>;
2483
+ needsClarificationTasks: Set<string>;
2484
+ blockedByDependencyTasks: Set<string>;
2171
2485
  };
2172
2486
  type IntegrityReport = {
2173
2487
  status: "valid" | "warnings" | "errors";
@@ -2182,6 +2496,7 @@ type IndexGenerationReport = {
2182
2496
  success: boolean;
2183
2497
  recordsProcessed: number;
2184
2498
  metricsCalculated: number;
2499
+ derivedStatesApplied: number;
2185
2500
  generationTime: number;
2186
2501
  cacheSize: number;
2187
2502
  cacheStrategy: "json" | "sqlite" | "dual";
@@ -2209,13 +2524,14 @@ interface IIndexerAdapter {
2209
2524
  generateIndex(): Promise<IndexGenerationReport>;
2210
2525
  getIndexData(): Promise<IndexData | null>;
2211
2526
  validateIntegrity(): Promise<IntegrityReport>;
2527
+ calculateDerivedStates(allRecords: AllRecords): Promise<DerivedStates>;
2212
2528
  calculateActivityHistory(allRecords: AllRecords): Promise<ActivityEvent[]>;
2213
- calculateLastUpdated(task: TaskRecord, relatedRecords: AllRecords): Promise<{
2529
+ calculateLastUpdated(taskPayload: TaskRecord, relatedRecords: AllRecords): Promise<{
2214
2530
  lastUpdated: number;
2215
2531
  lastActivityType: EnrichedTaskRecord['lastActivityType'];
2216
2532
  recentActivity: string;
2217
2533
  }>;
2218
- enrichTaskRecord(task: GitGovTaskRecord, relatedRecords: AllRecords): Promise<EnrichedTaskRecord>;
2534
+ enrichTaskRecord(task: GitGovTaskRecord, relatedRecords: AllRecords, derivedStateSets: DerivedStateSets): Promise<EnrichedTaskRecord>;
2219
2535
  isIndexUpToDate(): Promise<boolean>;
2220
2536
  invalidateCache(): Promise<void>;
2221
2537
  }
@@ -2242,10 +2558,19 @@ declare class FileIndexerAdapter implements IIndexerAdapter {
2242
2558
  generateIndex(): Promise<IndexGenerationReport>;
2243
2559
  /**
2244
2560
  * [EARS-2] Gets data from local cache for fast CLI queries
2561
+ * [EARS-13] Returns null and logs warning if cache is corrupted
2245
2562
  */
2246
2563
  getIndexData(): Promise<IndexData | null>;
2247
2564
  /**
2248
- * [EARS-4] Validates integrity of Records without regenerating cache
2565
+ * [EARS-4, EARS-70 to EARS-76] Validates integrity of Records without regenerating cache
2566
+ *
2567
+ * PHASE 1A (IMPLEMENTED): Basic schema validation (required fields)
2568
+ * PHASE 1B (IMPLEMENTED): Cryptographic validation (checksums + signatures)
2569
+ * TODO FUTURE:
2570
+ * - Integrate ValidatorModule for comprehensive schema validation
2571
+ * - Compare cache consistency with Records
2572
+ * - Detect broken references between records
2573
+ * - Validate timestamp consistency
2249
2574
  */
2250
2575
  validateIntegrity(): Promise<IntegrityReport>;
2251
2576
  /**
@@ -2279,12 +2604,30 @@ declare class FileIndexerAdapter implements IIndexerAdapter {
2279
2604
  private readAllExecutions;
2280
2605
  /**
2281
2606
  * Reads all changelogs from changelogStore (graceful degradation) with full metadata.
2607
+ * Validates schema and filters out invalid records with warnings.
2282
2608
  */
2283
2609
  private readAllChangelogs;
2284
2610
  /**
2285
2611
  * Writes cache data to file (Phase 1: JSON)
2612
+ *
2613
+ * [EARS-14] Creates automatic backup of existing cache before writing.
2614
+ * If write fails, backup can be restored to preserve previous cache state.
2286
2615
  */
2287
2616
  private writeCacheFile;
2617
+ /**
2618
+ * [EARS-14] Creates a backup of the current cache file.
2619
+ * If cache doesn't exist, this is a no-op (nothing to backup).
2620
+ */
2621
+ private createCacheBackup;
2622
+ /**
2623
+ * [EARS-14] Restores cache from backup file.
2624
+ * Used when cache write operation fails to preserve previous state.
2625
+ */
2626
+ private restoreCacheFromBackup;
2627
+ /**
2628
+ * [EARS-14] Deletes backup file after successful cache write.
2629
+ */
2630
+ private deleteCacheBackup;
2288
2631
  /**
2289
2632
  * Checks if cache file exists
2290
2633
  */
@@ -2297,6 +2640,19 @@ declare class FileIndexerAdapter implements IIndexerAdapter {
2297
2640
  * Gets current git commit hash (simplified)
2298
2641
  */
2299
2642
  private getGitCommitHash;
2643
+ /**
2644
+ * [EARS-7 to EARS-10] Calculates system-wide derived states for analytics and filtering.
2645
+ *
2646
+ * Applies DerivedDataProtocol algorithms to categorize tasks:
2647
+ * - isStalled: Tasks en 'active' sin executions >7 días O en 'review' sin approval >3 días
2648
+ * - isAtRisk: Tasks con prioridad 'critical' + 'paused' O 2+ blocking feedbacks
2649
+ * - needsClarification: Tasks con feedback tipo 'question' abierto
2650
+ * - isBlockedByDependency: Tasks con referencias a tasks no completadas
2651
+ *
2652
+ * @see derived_data_protocol.md for detailed algorithms
2653
+ * @see EARS-7, EARS-8, EARS-9, EARS-10 for requirements
2654
+ */
2655
+ calculateDerivedStates(allRecords: AllRecords): Promise<DerivedStates>;
2300
2656
  /**
2301
2657
  * [EARS-19] Calculates activity history from Record timestamps for dashboard activity streams
2302
2658
  */
@@ -2304,8 +2660,9 @@ declare class FileIndexerAdapter implements IIndexerAdapter {
2304
2660
  /**
2305
2661
  * [EARS-21] Calculate lastUpdated timestamp and activity type for a task
2306
2662
  * Considers task file modification time and related records timestamps
2663
+ * @param taskPayload - Task payload (not full record with headers)
2307
2664
  */
2308
- calculateLastUpdated(task: TaskRecord, relatedRecords: AllRecords): Promise<{
2665
+ calculateLastUpdated(taskPayload: TaskRecord, relatedRecords: AllRecords): Promise<{
2309
2666
  lastUpdated: number;
2310
2667
  lastActivityType: EnrichedTaskRecord['lastActivityType'];
2311
2668
  recentActivity: string;
@@ -2315,7 +2672,28 @@ declare class FileIndexerAdapter implements IIndexerAdapter {
2315
2672
  * @param task - Full GitGovTaskRecord with header.signatures for author/lastModifier extraction
2316
2673
  * @param relatedRecords - All related records with full metadata
2317
2674
  */
2318
- enrichTaskRecord(task: GitGovTaskRecord, relatedRecords: AllRecords): Promise<EnrichedTaskRecord>;
2675
+ /**
2676
+ * Enriches a task with complete intelligence layer (EARS 25-48)
2677
+ *
2678
+ * 11-step algorithm:
2679
+ * 1. Activity metadata (lastUpdated, lastActivityType, recentActivity)
2680
+ * 2. Signatures (author, lastModifier with timestamps)
2681
+ * 3. Assignments (assignedTo from feedback)
2682
+ * 4. Dependencies (dependsOn, blockedBy with typed references)
2683
+ * 5. Cycles (all cycles as array with id+title)
2684
+ * 6. Metrics (executionCount, blockingFeedbackCount, openQuestionCount)
2685
+ * 7. Time to resolution (for done tasks)
2686
+ * 8. Release info (isReleased, lastReleaseVersion from changelogs)
2687
+ * 9. Derived states (EARS-43: REUTILIZA pre-calculated derivedStates con O(1) lookup)
2688
+ * 10. Health score (0-100 using multi-factor algorithm)
2689
+ * 11. Time in current stage (days)
2690
+ *
2691
+ * @param task - Full GitGovTaskRecord with header.signatures
2692
+ * @param relatedRecords - All records for cross-referencing
2693
+ * @param derivedStateSets - Pre-calculated system-wide derived states as Sets for O(1) lookup (EARS-43)
2694
+ * @returns Promise<EnrichedTaskRecord> - Task with complete intelligence layer
2695
+ */
2696
+ enrichTaskRecord(task: GitGovTaskRecord, relatedRecords: AllRecords, derivedStateSets: DerivedStateSets): Promise<EnrichedTaskRecord>;
2319
2697
  /**
2320
2698
  * Format timestamp as human-readable time ago
2321
2699
  */
@@ -2326,136 +2704,723 @@ declare class FileIndexerAdapter implements IIndexerAdapter {
2326
2704
  private getTimestampFromId;
2327
2705
  }
2328
2706
 
2329
- type index$9_AllRecords = AllRecords;
2330
- type index$9_EnrichedTaskRecord = EnrichedTaskRecord;
2331
- type index$9_FileIndexerAdapter = FileIndexerAdapter;
2332
- declare const index$9_FileIndexerAdapter: typeof FileIndexerAdapter;
2333
- type index$9_IIndexerAdapter = IIndexerAdapter;
2334
- type index$9_IndexData = IndexData;
2335
- type index$9_IndexGenerationReport = IndexGenerationReport;
2336
- type index$9_IndexerAdapterDependencies = IndexerAdapterDependencies;
2337
- type index$9_IntegrityError = IntegrityError;
2338
- type index$9_IntegrityReport = IntegrityReport;
2339
- type index$9_IntegrityWarning = IntegrityWarning;
2340
- declare namespace index$9 {
2341
- export { type index$9_AllRecords as AllRecords, type index$9_EnrichedTaskRecord as EnrichedTaskRecord, index$9_FileIndexerAdapter as FileIndexerAdapter, type index$9_IIndexerAdapter as IIndexerAdapter, type index$9_IndexData as IndexData, type index$9_IndexGenerationReport as IndexGenerationReport, type index$9_IndexerAdapterDependencies as IndexerAdapterDependencies, type index$9_IntegrityError as IntegrityError, type index$9_IntegrityReport as IntegrityReport, type index$9_IntegrityWarning as IntegrityWarning };
2707
+ type index$b_AllRecords = AllRecords;
2708
+ type index$b_DerivedStateSets = DerivedStateSets;
2709
+ type index$b_DerivedStates = DerivedStates;
2710
+ type index$b_EnrichedTaskRecord = EnrichedTaskRecord;
2711
+ type index$b_FileIndexerAdapter = FileIndexerAdapter;
2712
+ declare const index$b_FileIndexerAdapter: typeof FileIndexerAdapter;
2713
+ type index$b_IIndexerAdapter = IIndexerAdapter;
2714
+ type index$b_IndexData = IndexData;
2715
+ type index$b_IndexGenerationReport = IndexGenerationReport;
2716
+ type index$b_IndexerAdapterDependencies = IndexerAdapterDependencies;
2717
+ type index$b_IntegrityError = IntegrityError;
2718
+ type index$b_IntegrityReport = IntegrityReport;
2719
+ type index$b_IntegrityWarning = IntegrityWarning;
2720
+ declare namespace index$b {
2721
+ 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 };
2342
2722
  }
2343
2723
 
2344
2724
  /**
2345
- * GitGovernance Configuration Types
2346
- * Based on config_file.md blueprint
2725
+ * Type Definitions for GitModule
2726
+ *
2727
+ * These interfaces define the contracts for Git operations,
2728
+ * dependencies, and data structures used throughout the module.
2347
2729
  */
2348
- interface GitGovConfig {
2349
- protocolVersion: string;
2350
- projectId: string;
2351
- projectName: string;
2352
- rootCycle: string;
2353
- blueprints?: {
2354
- root?: string;
2355
- };
2356
- state?: {
2357
- branch?: string;
2358
- };
2359
- cloud?: {
2360
- projectId?: string;
2361
- providerMappings?: Record<string, string>;
2362
- };
2730
+ /**
2731
+ * Options for executing shell commands
2732
+ */
2733
+ interface ExecOptions {
2734
+ /** Working directory for the command */
2735
+ cwd?: string;
2736
+ /** Additional environment variables */
2737
+ env?: Record<string, string>;
2738
+ /** Timeout in milliseconds */
2739
+ timeout?: number;
2363
2740
  }
2364
2741
  /**
2365
- * GitGovernance Session State Types
2366
- * Based on session_state.md blueprint
2742
+ * Result of executing a shell command
2367
2743
  */
2368
- interface ActorState {
2369
- activeTaskId?: string;
2370
- activeCycleId?: string;
2371
- lastSync?: string;
2372
- [key: string]: any;
2744
+ interface ExecResult {
2745
+ /** Exit code (0 = success) */
2746
+ exitCode: number;
2747
+ /** Standard output */
2748
+ stdout: string;
2749
+ /** Standard error output */
2750
+ stderr: string;
2373
2751
  }
2374
- interface GitGovSession {
2375
- cloud?: {
2376
- sessionToken?: string;
2377
- };
2378
- lastSession?: {
2379
- actorId: string;
2380
- timestamp: string;
2381
- };
2382
- actorState?: Record<string, ActorState>;
2752
+ /**
2753
+ * Dependencies required by GitModule
2754
+ *
2755
+ * This module uses dependency injection to allow testing with mocks
2756
+ * and support different execution environments.
2757
+ */
2758
+ interface GitModuleDependencies {
2759
+ /** Path to the Git repository root (optional, auto-detected if not provided) */
2760
+ repoRoot?: string;
2761
+ /** Function to execute shell commands (required) */
2762
+ execCommand: (command: string, args: string[], options?: ExecOptions) => Promise<ExecResult>;
2383
2763
  }
2384
2764
  /**
2385
- * Configuration Manager Class
2386
- * Provides typed access to GitGovernance configuration and session state
2765
+ * Options for retrieving commit history
2387
2766
  */
2388
- declare class ConfigManager {
2389
- private configPath;
2390
- private sessionPath;
2391
- constructor(projectRootPath?: string);
2392
- /**
2393
- * Load GitGovernance configuration
2394
- */
2395
- loadConfig(): Promise<GitGovConfig | null>;
2396
- /**
2397
- * Load GitGovernance session state
2398
- */
2399
- loadSession(): Promise<GitGovSession | null>;
2400
- /**
2401
- * Get root cycle from configuration
2402
- */
2403
- getRootCycle(): Promise<string | null>;
2404
- /**
2405
- * Get project information from configuration
2406
- */
2407
- getProjectInfo(): Promise<{
2408
- id: string;
2409
- name: string;
2410
- } | null>;
2767
+ interface GetCommitHistoryOptions {
2768
+ /** Maximum number of commits to return */
2769
+ maxCount?: number;
2770
+ /** Path filter (e.g., ".gitgov/") */
2771
+ pathFilter?: string;
2772
+ /** Output format (default: "json") */
2773
+ format?: 'json' | 'text';
2774
+ }
2775
+ /**
2776
+ * Information about a commit in the history
2777
+ */
2778
+ interface CommitInfo {
2779
+ /** Commit hash */
2780
+ hash: string;
2781
+ /** Commit message */
2782
+ message: string;
2783
+ /** Commit author (name <email>) */
2784
+ author: string;
2785
+ /** Commit date (ISO 8601) */
2786
+ date: string;
2787
+ /** List of modified files (optional) */
2788
+ files?: string[];
2789
+ }
2790
+ /**
2791
+ * Information about a changed file
2792
+ */
2793
+ interface ChangedFile {
2794
+ /** Change status: A (Added), M (Modified), D (Deleted) */
2795
+ status: 'A' | 'M' | 'D';
2796
+ /** File path relative to repository root */
2797
+ file: string;
2798
+ }
2799
+ /**
2800
+ * Author information for commits
2801
+ */
2802
+ interface CommitAuthor {
2803
+ /** Author name */
2804
+ name: string;
2805
+ /** Author email */
2806
+ email: string;
2807
+ }
2808
+
2809
+ /**
2810
+ * GitModule - Low-level Git Operations
2811
+ *
2812
+ * This module provides a business-agnostic abstraction layer for interacting
2813
+ * with the local Git repository. It exposes semantic methods instead of raw
2814
+ * Git commands, with comprehensive error handling and type safety.
2815
+ *
2816
+ * @module git_module
2817
+ */
2818
+
2819
+ /**
2820
+ * GitModule class providing low-level Git operations
2821
+ *
2822
+ * All operations are async and use dependency injection for testability.
2823
+ * Errors are transformed into typed exceptions for better handling.
2824
+ */
2825
+ declare class GitModule {
2826
+ private repoRoot;
2827
+ private execCommand;
2411
2828
  /**
2412
- * Get actor state for a specific actor
2829
+ * Creates a new GitModule instance
2830
+ *
2831
+ * @param dependencies - Required dependencies (execCommand) and optional config (repoRoot)
2832
+ * @throws Error if execCommand is not provided
2413
2833
  */
2414
- getActorState(actorId: string): Promise<ActorState | null>;
2834
+ constructor(dependencies: GitModuleDependencies);
2415
2835
  /**
2416
- * Update actor state for a specific actor
2836
+ * Ensures that repoRoot is set, auto-detecting it if necessary
2837
+ *
2838
+ * @returns Path to repository root
2839
+ * @throws GitCommandError if not in a Git repository
2417
2840
  */
2418
- updateActorState(actorId: string, state: Partial<ActorState>): Promise<void>;
2841
+ private ensureRepoRoot;
2419
2842
  /**
2420
- * Get cloud session token
2843
+ * Executes a Git command with standardized error handling
2844
+ *
2845
+ * @param args - Git command arguments
2846
+ * @param options - Execution options
2847
+ * @returns Command result
2848
+ * @throws GitCommandError if command fails
2421
2849
  */
2422
- getCloudSessionToken(): Promise<string | null>;
2850
+ private execGit;
2423
2851
  /**
2424
- * Finds the project root by searching upwards for a .git directory.
2425
- * Caches the result for subsequent calls.
2426
- * @param startPath The path to start searching from. Defaults to the current working directory.
2427
- * @returns The absolute path to the project root, or null if not found.
2852
+ * Initializes a new Git repository in the current directory
2853
+ *
2854
+ * Creates the `.git/` directory structure and sets up initial configuration.
2855
+ * Useful for testing and for commands that require a fresh repository.
2856
+ *
2857
+ * @throws GitCommandError if directory is already a Git repository
2858
+ *
2859
+ * @example
2860
+ * await gitModule.init();
2861
+ * // Repository initialized with default branch (main or master)
2428
2862
  */
2429
- static findProjectRoot(startPath?: string): string | null;
2863
+ init(): Promise<void>;
2430
2864
  /**
2431
- * Finds the appropriate project root by searching upwards.
2432
- * First looks for .gitgov (initialized project), then .git (for init).
2433
- * @param startPath The path to start searching from. Defaults to the current working directory.
2434
- * @returns The absolute path to the project root, or null if not found.
2865
+ * Returns the absolute path to the current Git repository root
2866
+ *
2867
+ * @returns Repository root path
2868
+ * @throws GitCommandError if not in a Git repository
2869
+ *
2870
+ * @example
2871
+ * const repoRoot = await gitModule.getRepoRoot();
2872
+ * // => "/home/user/my-project"
2435
2873
  */
2436
- static findGitgovRoot(startPath?: string): string | null;
2874
+ getRepoRoot(): Promise<string>;
2437
2875
  /**
2438
- * Gets the .gitgov directory path from project root
2876
+ * Returns the name of the current branch (HEAD)
2877
+ *
2878
+ * @returns Current branch name
2879
+ * @throws GitCommandError if in detached HEAD state or other error
2880
+ *
2881
+ * @example
2882
+ * const branch = await gitModule.getCurrentBranch();
2883
+ * // => "main"
2439
2884
  */
2440
- static getGitgovPath(): string;
2885
+ getCurrentBranch(): Promise<string>;
2441
2886
  /**
2442
- * Checks if current directory is a GitGovernance project
2887
+ * Get commit hash for a given reference (branch, tag, HEAD, etc.)
2888
+ *
2889
+ * Used by test helpers and sync operations to get commit SHAs.
2890
+ * Returns the full 40-character SHA-1 hash of the commit.
2891
+ *
2892
+ * @param ref Git reference (default: "HEAD"). Can be:
2893
+ * - "HEAD" for current commit
2894
+ * - Branch name (e.g., "main", "gitgov-state")
2895
+ * - Tag name (e.g., "v1.0.0")
2896
+ * - Commit hash (returns the same hash)
2897
+ * - Relative refs (e.g., "HEAD~1", "main^")
2898
+ * @returns Commit SHA hash (full 40-character hash)
2899
+ * @throws GitCommandError if ref does not exist
2900
+ *
2901
+ * @example
2902
+ * const headHash = await git.getCommitHash("HEAD");
2903
+ * // => "a1b2c3d4e5f6..."
2904
+ *
2905
+ * const mainHash = await git.getCommitHash("main");
2906
+ * // => "f6e5d4c3b2a1..."
2907
+ *
2908
+ * const parentHash = await git.getCommitHash("HEAD~1");
2909
+ * // => "9876543210ab..."
2443
2910
  */
2444
- static isGitgovProject(): boolean;
2911
+ getCommitHash(ref?: string): Promise<string>;
2912
+ /**
2913
+ * Set a Git configuration value.
2914
+ * Used for configuring repository settings like user.name, core.editor, etc.
2915
+ *
2916
+ * [EARS-51, EARS-52]
2917
+ *
2918
+ * @param key - Configuration key (e.g., "user.name", "core.editor")
2919
+ * @param value - Configuration value
2920
+ * @param scope - Configuration scope: "local" (default), "global", or "system"
2921
+ * @throws GitCommandError if configuration fails
2922
+ *
2923
+ * @example
2924
+ * ```typescript
2925
+ * // Set local config (repository-specific)
2926
+ * await git.setConfig('core.editor', 'vim');
2927
+ *
2928
+ * // Set global config (user-wide)
2929
+ * await git.setConfig('user.name', 'John Doe', 'global');
2930
+ *
2931
+ * // Set system config (machine-wide, requires permissions)
2932
+ * await git.setConfig('credential.helper', 'cache', 'system');
2933
+ * ```
2934
+ */
2935
+ setConfig(key: string, value: string, scope?: 'local' | 'global' | 'system'): Promise<void>;
2936
+ /**
2937
+ * Finds the most recent common ancestor between two branches
2938
+ *
2939
+ * @param branchA - First branch name
2940
+ * @param branchB - Second branch name
2941
+ * @returns Commit hash of the merge base
2942
+ * @throws BranchNotFoundError if either branch does not exist
2943
+ * @throws GitCommandError if operation fails
2944
+ *
2945
+ * @example
2946
+ * const mergeBase = await gitModule.getMergeBase("main", "feature");
2947
+ * // => "a1b2c3d4e5f6..."
2948
+ */
2949
+ getMergeBase(branchA: string, branchB: string): Promise<string>;
2950
+ /**
2951
+ * Returns a list of files changed between two commits
2952
+ *
2953
+ * @param fromCommit - Source commit or reference
2954
+ * @param toCommit - Target commit or reference
2955
+ * @param pathFilter - Optional path filter (e.g., ".gitgov/")
2956
+ * @returns Array of changed files with their status
2957
+ * @throws GitCommandError if operation fails
2958
+ *
2959
+ * @example
2960
+ * const changes = await gitModule.getChangedFiles("HEAD~1", "HEAD", ".gitgov/");
2961
+ * // => [{ status: "M", file: ".gitgov/tasks/123.json" }]
2962
+ */
2963
+ getChangedFiles(fromCommit: string, toCommit: string, pathFilter: string): Promise<ChangedFile[]>;
2964
+ /**
2965
+ * Get list of staged files (in staging area / index)
2966
+ *
2967
+ * Used during conflict resolution to identify which files the user resolved and staged.
2968
+ *
2969
+ * @returns Array of file paths that are currently staged
2970
+ * @throws GitCommandError if operation fails
2971
+ *
2972
+ * @example
2973
+ * // After user resolves conflict and does: git add .gitgov/tasks/123.json
2974
+ * const staged = await gitModule.getStagedFiles();
2975
+ * // => [".gitgov/tasks/123.json"]
2976
+ */
2977
+ getStagedFiles(): Promise<string[]>;
2978
+ /**
2979
+ * Retrieves the content of a file at a specific point in history
2980
+ *
2981
+ * @param commitHash - Commit hash
2982
+ * @param filePath - File path relative to repository root
2983
+ * @returns File content as string
2984
+ * @throws FileNotFoundError if file doesn't exist in that commit
2985
+ * @throws GitCommandError if operation fails
2986
+ *
2987
+ * @example
2988
+ * const content = await gitModule.getFileContent("abc123", ".gitgov/config.json");
2989
+ * // => '{"version": "1.0.0"}'
2990
+ */
2991
+ getFileContent(commitHash: string, filePath: string): Promise<string>;
2992
+ /**
2993
+ * Retrieves the commit history for a branch
2994
+ *
2995
+ * @param branch - Branch name
2996
+ * @param options - Filtering and formatting options
2997
+ * @returns Array of commits ordered from newest to oldest
2998
+ * @throws GitCommandError if operation fails
2999
+ *
3000
+ * @example
3001
+ * const history = await gitModule.getCommitHistory("main", { maxCount: 10 });
3002
+ * // => [{ hash: "abc123", message: "Initial commit", author: "User <email>", date: "2025-01-01T00:00:00Z" }]
3003
+ */
3004
+ getCommitHistory(branch: string, options?: GetCommitHistoryOptions): Promise<CommitInfo[]>;
3005
+ /**
3006
+ * Retrieves commit history in a specific range
3007
+ *
3008
+ * @param fromHash - Starting commit hash (exclusive)
3009
+ * @param toHash - Ending commit hash (inclusive)
3010
+ * @param options - Filtering and formatting options
3011
+ * @returns Array of commits in the specified range
3012
+ * @throws GitCommandError if either commit doesn't exist
3013
+ *
3014
+ * @example
3015
+ * const commits = await gitModule.getCommitHistoryRange("abc123", "def456");
3016
+ * // => [{ hash: "def456", ... }, { hash: "cba321", ... }]
3017
+ */
3018
+ getCommitHistoryRange(fromHash: string, toHash: string, options?: GetCommitHistoryOptions): Promise<CommitInfo[]>;
3019
+ /**
3020
+ * Retrieves the full commit message for a specific commit
3021
+ *
3022
+ * @param commitHash - Commit hash
3023
+ * @returns Full commit message as string
3024
+ * @throws GitCommandError if commit doesn't exist
3025
+ *
3026
+ * @example
3027
+ * const message = await gitModule.getCommitMessage("abc123");
3028
+ * // => "feat: add new feature\n\nDetailed description..."
3029
+ */
3030
+ getCommitMessage(commitHash: string): Promise<string>;
3031
+ /**
3032
+ * Checks if there are uncommitted changes in the working directory
3033
+ *
3034
+ * @param pathFilter - Optional path filter (e.g., ".gitgov/")
3035
+ * @returns true if there are uncommitted changes, false otherwise
3036
+ * @throws GitCommandError if operation fails
3037
+ *
3038
+ * @example
3039
+ * const hasChanges = await gitModule.hasUncommittedChanges(".gitgov/");
3040
+ * // => true
3041
+ */
3042
+ hasUncommittedChanges(pathFilter?: string): Promise<boolean>;
3043
+ /**
3044
+ * Checks if a rebase operation is currently in progress
3045
+ *
3046
+ * @returns true if rebase is in progress, false otherwise
3047
+ *
3048
+ * @example
3049
+ * const inRebase = await gitModule.isRebaseInProgress();
3050
+ * // => false
3051
+ */
3052
+ isRebaseInProgress(): Promise<boolean>;
3053
+ /**
3054
+ * Checks if a branch exists locally
3055
+ *
3056
+ * @param branchName - Branch name to check
3057
+ * @returns true if branch exists, false otherwise
3058
+ *
3059
+ * @example
3060
+ * const exists = await gitModule.branchExists("feature-branch");
3061
+ * // => true
3062
+ */
3063
+ branchExists(branchName: string): Promise<boolean>;
3064
+ /**
3065
+ * Lists all remote branches for a given remote
3066
+ *
3067
+ * @param remoteName - Name of the remote (e.g., "origin")
3068
+ * @returns Array of remote branch names without the remote prefix
3069
+ * @throws GitCommandError if operation fails
3070
+ *
3071
+ * @example
3072
+ * const branches = await gitModule.listRemoteBranches("origin");
3073
+ * // => ["main", "develop", "gitgov-state"]
3074
+ *
3075
+ * @note This method only returns the branch names, not the full "origin/branch" format
3076
+ */
3077
+ listRemoteBranches(remoteName: string): Promise<string[]>;
3078
+ /**
3079
+ * Checks if a remote is configured in the git repository.
3080
+ *
3081
+ * @param remoteName - Name of the remote to check (e.g., "origin")
3082
+ * @returns true if the remote is configured, false otherwise
3083
+ *
3084
+ * @example
3085
+ * const hasOrigin = await gitModule.isRemoteConfigured("origin");
3086
+ * // => true
3087
+ */
3088
+ isRemoteConfigured(remoteName: string): Promise<boolean>;
3089
+ /**
3090
+ * Retrieves the tracking remote for a branch
3091
+ *
3092
+ * @param branchName - Branch name
3093
+ * @returns Remote name or null if not configured
3094
+ * @throws BranchNotFoundError if branch doesn't exist
3095
+ *
3096
+ * @example
3097
+ * const remote = await gitModule.getBranchRemote("main");
3098
+ * // => "origin"
3099
+ */
3100
+ getBranchRemote(branchName: string): Promise<string | null>;
3101
+ /**
3102
+ * Retrieves the list of conflicted files during a rebase or merge
3103
+ *
3104
+ * @returns Array of file paths in conflict
3105
+ * @throws GitCommandError if no rebase/merge in progress
3106
+ *
3107
+ * @example
3108
+ * const conflicts = await gitModule.getConflictedFiles();
3109
+ * // => [".gitgov/tasks/123.json", ".gitgov/tasks/456.json"]
3110
+ */
3111
+ getConflictedFiles(): Promise<string[]>;
3112
+ /**
3113
+ * Switches to the specified branch
3114
+ *
3115
+ * @param branchName - Branch name to checkout
3116
+ * @throws BranchNotFoundError if branch doesn't exist
3117
+ * @throws GitCommandError if operation fails
3118
+ *
3119
+ * @example
3120
+ * await gitModule.checkoutBranch("feature-branch");
3121
+ */
3122
+ checkoutBranch(branchName: string): Promise<void>;
3123
+ /**
3124
+ * Stash uncommitted changes
3125
+ *
3126
+ * @param message - Optional message for the stash
3127
+ * @returns Stash hash if changes were stashed, null if nothing to stash
3128
+ */
3129
+ stash(message?: string): Promise<string | null>;
3130
+ /**
3131
+ * Pop the most recent stash
3132
+ *
3133
+ * @returns true if stash was popped successfully, false if no stash exists
3134
+ */
3135
+ stashPop(): Promise<boolean>;
3136
+ /**
3137
+ * Drop a specific stash or the most recent one
3138
+ *
3139
+ * @param stashHash - Optional stash hash to drop, defaults to most recent
3140
+ */
3141
+ stashDrop(stashHash?: string): Promise<void>;
3142
+ /**
3143
+ * Creates an orphan branch (no history) and switches to it
3144
+ *
3145
+ * @param branchName - Orphan branch name to create
3146
+ * @throws GitCommandError if branch already exists or operation fails
3147
+ *
3148
+ * @example
3149
+ * await gitModule.checkoutOrphanBranch("gitgov-state");
3150
+ */
3151
+ checkoutOrphanBranch(branchName: string): Promise<void>;
3152
+ /**
3153
+ * Fetches the latest changes from a remote repository
3154
+ *
3155
+ * @param remote - Remote name (e.g., "origin")
3156
+ * @throws GitCommandError if operation fails
3157
+ *
3158
+ * @example
3159
+ * await gitModule.fetch("origin");
3160
+ */
3161
+ fetch(remote: string): Promise<void>;
3162
+ /**
3163
+ * Pulls and merges a remote branch
3164
+ *
3165
+ * @param remote - Remote name
3166
+ * @param branchName - Branch name
3167
+ * @throws MergeConflictError if merge conflicts occur
3168
+ * @throws GitCommandError if operation fails
3169
+ *
3170
+ * @example
3171
+ * await gitModule.pull("origin", "main");
3172
+ */
3173
+ pull(remote: string, branchName: string): Promise<void>;
3174
+ /**
3175
+ * Pulls and rebases a remote branch
3176
+ *
3177
+ * @param remote - Remote name
3178
+ * @param branchName - Branch name
3179
+ * @throws RebaseConflictError if rebase conflicts occur
3180
+ * @throws GitCommandError if operation fails
3181
+ *
3182
+ * @example
3183
+ * await gitModule.pullRebase("origin", "main");
3184
+ */
3185
+ pullRebase(remote: string, branchName: string): Promise<void>;
3186
+ /**
3187
+ * Resets the current branch to a specific commit, discarding all local changes
3188
+ *
3189
+ * @param target - Commit hash or branch name
3190
+ * @throws GitCommandError if operation fails
3191
+ *
3192
+ * @example
3193
+ * await gitModule.resetHard("HEAD~1");
3194
+ */
3195
+ resetHard(target: string): Promise<void>;
3196
+ /**
3197
+ * Checks out specific files from another branch into the current staging area
3198
+ *
3199
+ * @param sourceBranch - Source branch name
3200
+ * @param filePaths - Array of file paths to checkout
3201
+ * @throws BranchNotFoundError if source branch doesn't exist
3202
+ * @throws GitCommandError if operation fails
3203
+ *
3204
+ * @example
3205
+ * await gitModule.checkoutFilesFromBranch("main", [".gitgov/tasks/123.json"]);
3206
+ */
3207
+ checkoutFilesFromBranch(sourceBranch: string, filePaths: string[]): Promise<void>;
3208
+ /**
3209
+ * Adds files to the staging area
3210
+ *
3211
+ * @param filePaths - Array of file paths to add
3212
+ * @param options - Optional settings (force: add ignored files)
3213
+ * @throws GitCommandError if operation fails
3214
+ *
3215
+ * @example
3216
+ * await gitModule.add([".gitgov/tasks/123.json"]);
3217
+ * await gitModule.add([".gitgov"], { force: true }); // Add ignored files
3218
+ */
3219
+ add(filePaths: string[], options?: {
3220
+ force?: boolean;
3221
+ }): Promise<void>;
3222
+ /**
3223
+ * Removes files from both working directory and staging area
3224
+ *
3225
+ * @param filePaths - Array of file paths to remove
3226
+ * @throws GitCommandError if operation fails
3227
+ *
3228
+ * @example
3229
+ * await gitModule.rm([".gitgov/tasks/123.json"]);
3230
+ */
3231
+ rm(filePaths: string[]): Promise<void>;
3232
+ /**
3233
+ * Creates a new commit with staged files
3234
+ *
3235
+ * @param message - Commit message
3236
+ * @param author - Optional commit author
3237
+ * @returns Commit hash of the created commit
3238
+ * @throws GitCommandError if operation fails
3239
+ *
3240
+ * @example
3241
+ * const hash = await gitModule.commit("feat: add new task");
3242
+ * // => "abc123def456..."
3243
+ */
3244
+ commit(message: string, author?: CommitAuthor): Promise<string>;
3245
+ /**
3246
+ * Creates an empty commit (no changes required)
3247
+ *
3248
+ * @param message - Commit message
3249
+ * @param author - Optional commit author
3250
+ * @returns Commit hash of the created commit
3251
+ * @throws GitCommandError if operation fails
3252
+ *
3253
+ * @example
3254
+ * const hash = await gitModule.commitAllowEmpty("chore: initialize state branch");
3255
+ * // => "abc123def456..."
3256
+ */
3257
+ commitAllowEmpty(message: string, author?: CommitAuthor): Promise<string>;
3258
+ /**
3259
+ * Pushes a local branch to a remote repository
3260
+ *
3261
+ * @param remote - Remote name
3262
+ * @param branchName - Branch name
3263
+ * @throws GitCommandError if operation fails
3264
+ *
3265
+ * @example
3266
+ * await gitModule.push("origin", "main");
3267
+ */
3268
+ push(remote: string, branchName: string): Promise<void>;
3269
+ /**
3270
+ * Pushes a local branch to a remote repository and sets up tracking
3271
+ *
3272
+ * @param remote - Remote name
3273
+ * @param branchName - Branch name
3274
+ * @throws GitCommandError if operation fails
3275
+ *
3276
+ * @example
3277
+ * await gitModule.pushWithUpstream("origin", "feature-branch");
3278
+ */
3279
+ pushWithUpstream(remote: string, branchName: string): Promise<void>;
3280
+ /**
3281
+ * Configures tracking for a local branch with a remote branch
3282
+ *
3283
+ * @param branchName - Local branch name
3284
+ * @param remote - Remote name
3285
+ * @param remoteBranch - Remote branch name
3286
+ * @throws BranchNotFoundError if local branch doesn't exist
3287
+ * @throws GitCommandError if operation fails
3288
+ *
3289
+ * @example
3290
+ * await gitModule.setUpstream("feature-branch", "origin", "feature-branch");
3291
+ */
3292
+ setUpstream(branchName: string, remote: string, remoteBranch: string): Promise<void>;
3293
+ /**
3294
+ * Continues a rebase after resolving conflicts
3295
+ *
3296
+ * @returns Commit hash of the rebased commit
3297
+ * @throws RebaseNotInProgressError if no rebase is in progress
3298
+ * @throws GitCommandError if operation fails
3299
+ *
3300
+ * @example
3301
+ * const hash = await gitModule.rebaseContinue();
3302
+ * // => "abc123def456..."
3303
+ */
3304
+ rebaseContinue(): Promise<string>;
3305
+ /**
3306
+ * Aborts an ongoing rebase
3307
+ *
3308
+ * @throws RebaseNotInProgressError if no rebase is in progress
3309
+ * @throws GitCommandError if operation fails
3310
+ *
3311
+ * @example
3312
+ * await gitModule.rebaseAbort();
3313
+ */
3314
+ rebaseAbort(): Promise<void>;
3315
+ /**
3316
+ * Creates a new branch and switches to it (git checkout -b)
3317
+ *
3318
+ * @param branchName - Name of the branch to create
3319
+ * @param startPoint - Optional starting point (commit hash or branch name)
3320
+ * @throws GitCommandError if branch already exists or operation fails
3321
+ * @throws BranchAlreadyExistsError if the branch already exists locally
3322
+ */
3323
+ createBranch(branchName: string, startPoint?: string): Promise<void>;
3324
+ /**
3325
+ * Rebases current branch onto target branch (git rebase)
3326
+ *
3327
+ * @param targetBranch - Branch to rebase onto
3328
+ * @throws GitCommandError if rebase fails
3329
+ * @throws RebaseConflictError if conflicts are detected during rebase
3330
+ */
3331
+ rebase(targetBranch: string): Promise<void>;
2445
3332
  }
3333
+
2446
3334
  /**
2447
- * Create a ConfigManager instance for the current project
3335
+ * Custom Error Classes for GitModule
3336
+ *
3337
+ * These errors provide typed exceptions for better error handling
3338
+ * and diagnostics in the Git module operations.
2448
3339
  */
2449
- declare function createConfigManager(projectRoot?: string): ConfigManager;
3340
+ /**
3341
+ * Base error class for all Git-related errors
3342
+ */
3343
+ declare class GitError extends Error {
3344
+ constructor(message: string);
3345
+ }
3346
+ /**
3347
+ * Error thrown when a Git command fails
3348
+ */
3349
+ declare class GitCommandError extends GitError {
3350
+ readonly stderr: string;
3351
+ readonly stdout?: string | undefined;
3352
+ readonly command?: string | undefined;
3353
+ constructor(message: string, stderr?: string, command?: string | undefined, stdout?: string);
3354
+ }
3355
+ /**
3356
+ * Error thrown when a branch does not exist
3357
+ */
3358
+ declare class BranchNotFoundError extends GitError {
3359
+ readonly branchName: string;
3360
+ constructor(branchName: string);
3361
+ }
3362
+ /**
3363
+ * Error thrown when a file does not exist in a commit
3364
+ */
3365
+ declare class FileNotFoundError extends GitError {
3366
+ readonly filePath: string;
3367
+ readonly commitHash: string;
3368
+ constructor(filePath: string, commitHash: string);
3369
+ }
3370
+ /**
3371
+ * Error thrown when a merge conflict occurs
3372
+ */
3373
+ declare class MergeConflictError extends GitError {
3374
+ readonly conflictedFiles: string[];
3375
+ constructor(conflictedFiles: string[]);
3376
+ }
3377
+ /**
3378
+ * Error thrown when a rebase conflict occurs
3379
+ */
3380
+ declare class RebaseConflictError extends GitError {
3381
+ readonly conflictedFiles: string[];
3382
+ constructor(conflictedFiles: string[]);
3383
+ }
3384
+ /**
3385
+ * Error thrown when trying to continue/abort a rebase that is not in progress
3386
+ */
3387
+ declare class RebaseNotInProgressError extends GitError {
3388
+ constructor();
3389
+ }
2450
3390
 
2451
- type index$8_ActorState = ActorState;
2452
- type index$8_ConfigManager = ConfigManager;
2453
- declare const index$8_ConfigManager: typeof ConfigManager;
2454
- type index$8_GitGovConfig = GitGovConfig;
2455
- type index$8_GitGovSession = GitGovSession;
2456
- declare const index$8_createConfigManager: typeof createConfigManager;
2457
- declare namespace index$8 {
2458
- export { type index$8_ActorState as ActorState, index$8_ConfigManager as ConfigManager, type index$8_GitGovConfig as GitGovConfig, type index$8_GitGovSession as GitGovSession, index$8_createConfigManager as createConfigManager };
3391
+ /**
3392
+ * GitModule - Low-level Git Operations
3393
+ *
3394
+ * This module provides a business-agnostic abstraction layer for Git operations.
3395
+ *
3396
+ * @module git
3397
+ */
3398
+
3399
+ type index$a_BranchNotFoundError = BranchNotFoundError;
3400
+ declare const index$a_BranchNotFoundError: typeof BranchNotFoundError;
3401
+ type index$a_ChangedFile = ChangedFile;
3402
+ type index$a_CommitAuthor = CommitAuthor;
3403
+ type index$a_CommitInfo = CommitInfo;
3404
+ type index$a_ExecOptions = ExecOptions;
3405
+ type index$a_ExecResult = ExecResult;
3406
+ type index$a_FileNotFoundError = FileNotFoundError;
3407
+ declare const index$a_FileNotFoundError: typeof FileNotFoundError;
3408
+ type index$a_GetCommitHistoryOptions = GetCommitHistoryOptions;
3409
+ type index$a_GitCommandError = GitCommandError;
3410
+ declare const index$a_GitCommandError: typeof GitCommandError;
3411
+ type index$a_GitError = GitError;
3412
+ declare const index$a_GitError: typeof GitError;
3413
+ type index$a_GitModule = GitModule;
3414
+ declare const index$a_GitModule: typeof GitModule;
3415
+ type index$a_GitModuleDependencies = GitModuleDependencies;
3416
+ type index$a_MergeConflictError = MergeConflictError;
3417
+ declare const index$a_MergeConflictError: typeof MergeConflictError;
3418
+ type index$a_RebaseConflictError = RebaseConflictError;
3419
+ declare const index$a_RebaseConflictError: typeof RebaseConflictError;
3420
+ type index$a_RebaseNotInProgressError = RebaseNotInProgressError;
3421
+ declare const index$a_RebaseNotInProgressError: typeof RebaseNotInProgressError;
3422
+ declare namespace index$a {
3423
+ 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 };
2459
3424
  }
2460
3425
 
2461
3426
  /**
@@ -2464,19 +3429,8 @@ declare namespace index$8 {
2464
3429
  interface ProjectAdapterDependencies {
2465
3430
  identityAdapter: IdentityAdapter;
2466
3431
  backlogAdapter: BacklogAdapter;
2467
- workflowMethodologyAdapter: WorkflowMethodologyAdapter;
3432
+ gitModule: GitModule;
2468
3433
  configManager: ConfigManager;
2469
- taskStore: RecordStore<TaskRecord>;
2470
- cycleStore: RecordStore<CycleRecord>;
2471
- eventBus?: IEventStream;
2472
- platformApi?: IPlatformApi;
2473
- userManagement?: IUserManagement;
2474
- }
2475
- interface IPlatformApi {
2476
- getProjectInfo(projectId: string): Promise<ProjectInfo>;
2477
- }
2478
- interface IUserManagement {
2479
- addUserToProject(projectId: string, userId: string, role: string): Promise<void>;
2480
3434
  }
2481
3435
  type ProjectInitOptions = {
2482
3436
  name: string;
@@ -2571,10 +3525,11 @@ interface IProjectAdapter {
2571
3525
  declare class ProjectAdapter implements IProjectAdapter {
2572
3526
  private identityAdapter;
2573
3527
  private backlogAdapter;
3528
+ private gitModule;
2574
3529
  private configManager;
2575
3530
  constructor(dependencies: ProjectAdapterDependencies);
2576
3531
  /**
2577
- * [EARS-1] Initializes complete GitGovernance project with 3-adapter orchestration and trust root Ed25519
3532
+ * [EARS-1] Initializes complete GitGovernance project with 4-module orchestration (Identity, Backlog, WorkflowMethodology, SyncModule) and trust root Ed25519
2578
3533
  */
2579
3534
  initializeProject(options: ProjectInitOptions): Promise<ProjectInitResult>;
2580
3535
  /**
@@ -2609,81 +3564,82 @@ declare class ProjectAdapter implements IProjectAdapter {
2609
3564
  private setupGitIntegration;
2610
3565
  }
2611
3566
 
2612
- type index$7_EnvironmentValidation = EnvironmentValidation;
2613
- type index$7_IProjectAdapter = IProjectAdapter;
2614
- type index$7_ProjectAdapter = ProjectAdapter;
2615
- declare const index$7_ProjectAdapter: typeof ProjectAdapter;
2616
- type index$7_ProjectAdapterDependencies = ProjectAdapterDependencies;
2617
- type index$7_ProjectContext = ProjectContext;
2618
- type index$7_ProjectInfo = ProjectInfo;
2619
- type index$7_ProjectInitOptions = ProjectInitOptions;
2620
- type index$7_ProjectInitResult = ProjectInitResult;
2621
- type index$7_ProjectReport = ProjectReport;
2622
- type index$7_TemplateProcessingResult = TemplateProcessingResult;
2623
- declare namespace index$7 {
2624
- export { type index$7_EnvironmentValidation as EnvironmentValidation, type index$7_IProjectAdapter as IProjectAdapter, 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_TemplateProcessingResult as TemplateProcessingResult };
3567
+ type index$9_EnvironmentValidation = EnvironmentValidation;
3568
+ type index$9_IProjectAdapter = IProjectAdapter;
3569
+ type index$9_ProjectAdapter = ProjectAdapter;
3570
+ declare const index$9_ProjectAdapter: typeof ProjectAdapter;
3571
+ type index$9_ProjectAdapterDependencies = ProjectAdapterDependencies;
3572
+ type index$9_ProjectContext = ProjectContext;
3573
+ type index$9_ProjectInfo = ProjectInfo;
3574
+ type index$9_ProjectInitOptions = ProjectInitOptions;
3575
+ type index$9_ProjectInitResult = ProjectInitResult;
3576
+ type index$9_ProjectReport = ProjectReport;
3577
+ type index$9_TemplateProcessingResult = TemplateProcessingResult;
3578
+ declare namespace index$9 {
3579
+ 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 };
2625
3580
  }
2626
3581
 
2627
- type index$6_AllRecords = AllRecords;
2628
- type index$6_BacklogAdapter = BacklogAdapter;
2629
- declare const index$6_BacklogAdapter: typeof BacklogAdapter;
2630
- type index$6_BacklogAdapterConfig = BacklogAdapterConfig;
2631
- type index$6_BacklogAdapterDependencies = BacklogAdapterDependencies;
2632
- type index$6_ChangelogAdapter = ChangelogAdapter;
2633
- declare const index$6_ChangelogAdapter: typeof ChangelogAdapter;
2634
- type index$6_ChangelogAdapterDependencies = ChangelogAdapterDependencies;
2635
- type index$6_ChangelogListOptions = ChangelogListOptions;
2636
- type index$6_CollaborationMetrics = CollaborationMetrics;
2637
- type index$6_EnrichedTaskRecord = EnrichedTaskRecord;
2638
- type index$6_EnvironmentValidation = EnvironmentValidation;
2639
- type index$6_ExecutionAdapter = ExecutionAdapter;
2640
- declare const index$6_ExecutionAdapter: typeof ExecutionAdapter;
2641
- type index$6_ExecutionAdapterDependencies = ExecutionAdapterDependencies;
2642
- type index$6_FeedbackAdapter = FeedbackAdapter;
2643
- declare const index$6_FeedbackAdapter: typeof FeedbackAdapter;
2644
- type index$6_FeedbackAdapterDependencies = FeedbackAdapterDependencies;
2645
- type index$6_FeedbackThread = FeedbackThread;
2646
- type index$6_FileIndexerAdapter = FileIndexerAdapter;
2647
- declare const index$6_FileIndexerAdapter: typeof FileIndexerAdapter;
2648
- type index$6_IBacklogAdapter = IBacklogAdapter;
2649
- type index$6_IChangelogAdapter = IChangelogAdapter;
2650
- type index$6_IExecutionAdapter = IExecutionAdapter;
2651
- type index$6_IFeedbackAdapter = IFeedbackAdapter;
2652
- type index$6_IIdentityAdapter = IIdentityAdapter;
2653
- type index$6_IIndexerAdapter = IIndexerAdapter;
2654
- type index$6_IMetricsAdapter = IMetricsAdapter;
2655
- type index$6_IProjectAdapter = IProjectAdapter;
2656
- type index$6_IWorkflowMethodology = IWorkflowMethodology;
2657
- type index$6_IdentityAdapter = IdentityAdapter;
2658
- declare const index$6_IdentityAdapter: typeof IdentityAdapter;
2659
- type index$6_IdentityAdapterDependencies = IdentityAdapterDependencies;
2660
- type index$6_IndexData = IndexData;
2661
- type index$6_IndexGenerationReport = IndexGenerationReport;
2662
- type index$6_IndexerAdapterDependencies = IndexerAdapterDependencies;
2663
- type index$6_IntegrityError = IntegrityError;
2664
- type index$6_IntegrityReport = IntegrityReport;
2665
- type index$6_IntegrityWarning = IntegrityWarning;
2666
- type index$6_MetricsAdapter = MetricsAdapter;
2667
- declare const index$6_MetricsAdapter: typeof MetricsAdapter;
2668
- type index$6_MetricsAdapterDependencies = MetricsAdapterDependencies;
2669
- type index$6_ProductivityMetrics = ProductivityMetrics;
2670
- type index$6_ProjectAdapter = ProjectAdapter;
2671
- declare const index$6_ProjectAdapter: typeof ProjectAdapter;
2672
- type index$6_ProjectAdapterDependencies = ProjectAdapterDependencies;
2673
- type index$6_ProjectContext = ProjectContext;
2674
- type index$6_ProjectInfo = ProjectInfo;
2675
- type index$6_ProjectInitOptions = ProjectInitOptions;
2676
- type index$6_ProjectInitResult = ProjectInitResult;
2677
- type index$6_ProjectReport = ProjectReport;
2678
- type index$6_SystemStatus = SystemStatus;
2679
- type index$6_TaskHealthReport = TaskHealthReport;
2680
- type index$6_TemplateProcessingResult = TemplateProcessingResult;
2681
- type index$6_ValidationContext = ValidationContext;
2682
- type index$6_WorkflowMethodologyAdapter = WorkflowMethodologyAdapter;
2683
- declare const index$6_WorkflowMethodologyAdapter: typeof WorkflowMethodologyAdapter;
2684
- type index$6_WorkflowMethodologyAdapterDependencies = WorkflowMethodologyAdapterDependencies;
2685
- declare namespace index$6 {
2686
- export { type index$6_AllRecords as AllRecords, index$6_BacklogAdapter as BacklogAdapter, type index$6_BacklogAdapterConfig as BacklogAdapterConfig, type index$6_BacklogAdapterDependencies as BacklogAdapterDependencies, index$6_ChangelogAdapter as ChangelogAdapter, type index$6_ChangelogAdapterDependencies as ChangelogAdapterDependencies, type index$6_ChangelogListOptions as ChangelogListOptions, type index$6_CollaborationMetrics as CollaborationMetrics, type index$6_EnrichedTaskRecord as EnrichedTaskRecord, type index$6_EnvironmentValidation as EnvironmentValidation, index$6_ExecutionAdapter as ExecutionAdapter, type index$6_ExecutionAdapterDependencies as ExecutionAdapterDependencies, index$6_FeedbackAdapter as FeedbackAdapter, type index$6_FeedbackAdapterDependencies as FeedbackAdapterDependencies, type index$6_FeedbackThread as FeedbackThread, index$6_FileIndexerAdapter as FileIndexerAdapter, type index$6_IBacklogAdapter as IBacklogAdapter, type index$6_IChangelogAdapter as IChangelogAdapter, type index$6_IExecutionAdapter as IExecutionAdapter, type index$6_IFeedbackAdapter as IFeedbackAdapter, type index$6_IIdentityAdapter as IIdentityAdapter, type index$6_IIndexerAdapter as IIndexerAdapter, type index$6_IMetricsAdapter as IMetricsAdapter, type index$6_IProjectAdapter as IProjectAdapter, type index$6_IWorkflowMethodology as IWorkflowMethodology, index$6_IdentityAdapter as IdentityAdapter, type index$6_IdentityAdapterDependencies as IdentityAdapterDependencies, type index$6_IndexData as IndexData, type index$6_IndexGenerationReport as IndexGenerationReport, type index$6_IndexerAdapterDependencies as IndexerAdapterDependencies, type index$6_IntegrityError as IntegrityError, type index$6_IntegrityReport as IntegrityReport, type index$6_IntegrityWarning as IntegrityWarning, index$6_MetricsAdapter as MetricsAdapter, type index$6_MetricsAdapterDependencies as MetricsAdapterDependencies, type index$6_ProductivityMetrics as ProductivityMetrics, index$6_ProjectAdapter as ProjectAdapter, type index$6_ProjectAdapterDependencies as ProjectAdapterDependencies, type index$6_ProjectContext as ProjectContext, type index$6_ProjectInfo as ProjectInfo, type index$6_ProjectInitOptions as ProjectInitOptions, type index$6_ProjectInitResult as ProjectInitResult, type index$6_ProjectReport as ProjectReport, type index$6_SystemStatus as SystemStatus, type index$6_TaskHealthReport as TaskHealthReport, type index$6_TemplateProcessingResult as TemplateProcessingResult, type index$6_ValidationContext as ValidationContext, index$6_WorkflowMethodologyAdapter as WorkflowMethodologyAdapter, type index$6_WorkflowMethodologyAdapterDependencies as WorkflowMethodologyAdapterDependencies };
3582
+ type index$8_AllRecords = AllRecords;
3583
+ type index$8_BacklogAdapter = BacklogAdapter;
3584
+ declare const index$8_BacklogAdapter: typeof BacklogAdapter;
3585
+ type index$8_BacklogAdapterConfig = BacklogAdapterConfig;
3586
+ type index$8_BacklogAdapterDependencies = BacklogAdapterDependencies;
3587
+ type index$8_ChangelogAdapter = ChangelogAdapter;
3588
+ declare const index$8_ChangelogAdapter: typeof ChangelogAdapter;
3589
+ type index$8_ChangelogAdapterDependencies = ChangelogAdapterDependencies;
3590
+ type index$8_ChangelogListOptions = ChangelogListOptions;
3591
+ type index$8_CollaborationMetrics = CollaborationMetrics;
3592
+ type index$8_DerivedStateSets = DerivedStateSets;
3593
+ type index$8_DerivedStates = DerivedStates;
3594
+ type index$8_EnrichedTaskRecord = EnrichedTaskRecord;
3595
+ type index$8_EnvironmentValidation = EnvironmentValidation;
3596
+ type index$8_ExecutionAdapter = ExecutionAdapter;
3597
+ declare const index$8_ExecutionAdapter: typeof ExecutionAdapter;
3598
+ type index$8_ExecutionAdapterDependencies = ExecutionAdapterDependencies;
3599
+ type index$8_FeedbackAdapter = FeedbackAdapter;
3600
+ declare const index$8_FeedbackAdapter: typeof FeedbackAdapter;
3601
+ type index$8_FeedbackAdapterDependencies = FeedbackAdapterDependencies;
3602
+ type index$8_FeedbackThread = FeedbackThread;
3603
+ type index$8_FileIndexerAdapter = FileIndexerAdapter;
3604
+ declare const index$8_FileIndexerAdapter: typeof FileIndexerAdapter;
3605
+ type index$8_IBacklogAdapter = IBacklogAdapter;
3606
+ type index$8_IChangelogAdapter = IChangelogAdapter;
3607
+ type index$8_IExecutionAdapter = IExecutionAdapter;
3608
+ type index$8_IFeedbackAdapter = IFeedbackAdapter;
3609
+ type index$8_IIdentityAdapter = IIdentityAdapter;
3610
+ type index$8_IIndexerAdapter = IIndexerAdapter;
3611
+ type index$8_IMetricsAdapter = IMetricsAdapter;
3612
+ type index$8_IProjectAdapter = IProjectAdapter;
3613
+ type index$8_IWorkflowMethodology = IWorkflowMethodology;
3614
+ type index$8_IdentityAdapter = IdentityAdapter;
3615
+ declare const index$8_IdentityAdapter: typeof IdentityAdapter;
3616
+ type index$8_IdentityAdapterDependencies = IdentityAdapterDependencies;
3617
+ type index$8_IndexData = IndexData;
3618
+ type index$8_IndexGenerationReport = IndexGenerationReport;
3619
+ type index$8_IndexerAdapterDependencies = IndexerAdapterDependencies;
3620
+ type index$8_IntegrityError = IntegrityError;
3621
+ type index$8_IntegrityReport = IntegrityReport;
3622
+ type index$8_IntegrityWarning = IntegrityWarning;
3623
+ type index$8_MetricsAdapter = MetricsAdapter;
3624
+ declare const index$8_MetricsAdapter: typeof MetricsAdapter;
3625
+ type index$8_MetricsAdapterDependencies = MetricsAdapterDependencies;
3626
+ type index$8_ProductivityMetrics = ProductivityMetrics;
3627
+ type index$8_ProjectAdapter = ProjectAdapter;
3628
+ declare const index$8_ProjectAdapter: typeof ProjectAdapter;
3629
+ type index$8_ProjectAdapterDependencies = ProjectAdapterDependencies;
3630
+ type index$8_ProjectContext = ProjectContext;
3631
+ type index$8_ProjectInfo = ProjectInfo;
3632
+ type index$8_ProjectInitOptions = ProjectInitOptions;
3633
+ type index$8_ProjectInitResult = ProjectInitResult;
3634
+ type index$8_ProjectReport = ProjectReport;
3635
+ type index$8_SystemStatus = SystemStatus;
3636
+ type index$8_TaskHealthReport = TaskHealthReport;
3637
+ type index$8_TemplateProcessingResult = TemplateProcessingResult;
3638
+ type index$8_WorkflowMethodologyAdapter = WorkflowMethodologyAdapter;
3639
+ declare const index$8_WorkflowMethodologyAdapter: typeof WorkflowMethodologyAdapter;
3640
+ type index$8_WorkflowMethodologyAdapterDependencies = WorkflowMethodologyAdapterDependencies;
3641
+ declare namespace index$8 {
3642
+ 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 };
2687
3643
  }
2688
3644
 
2689
3645
  /**
@@ -2723,63 +3679,133 @@ declare function verifySignatures(record: {
2723
3679
  payload: GitGovRecordPayload;
2724
3680
  }, getActorPublicKey: (keyId: string) => Promise<string | null>): Promise<boolean>;
2725
3681
 
2726
- declare const index$5_calculatePayloadChecksum: typeof calculatePayloadChecksum;
2727
- declare const index$5_generateKeys: typeof generateKeys;
2728
- declare const index$5_signPayload: typeof signPayload;
2729
- declare const index$5_verifySignatures: typeof verifySignatures;
2730
- declare namespace index$5 {
2731
- export { index$5_calculatePayloadChecksum as calculatePayloadChecksum, index$5_generateKeys as generateKeys, index$5_signPayload as signPayload, index$5_verifySignatures as verifySignatures };
3682
+ declare const index$7_calculatePayloadChecksum: typeof calculatePayloadChecksum;
3683
+ declare const index$7_generateKeys: typeof generateKeys;
3684
+ declare const index$7_signPayload: typeof signPayload;
3685
+ declare const index$7_verifySignatures: typeof verifySignatures;
3686
+ declare namespace index$7 {
3687
+ export { index$7_calculatePayloadChecksum as calculatePayloadChecksum, index$7_generateKeys as generateKeys, index$7_signPayload as signPayload, index$7_verifySignatures as verifySignatures };
2732
3688
  }
2733
3689
 
2734
3690
  /**
2735
3691
  * Creates a new, fully-formed ActorRecord with validation.
2736
3692
  */
2737
- declare function createActorRecord(payload: Partial<ActorRecord>): Promise<ActorRecord>;
3693
+ declare function createActorRecord(payload: Partial<ActorRecord>): ActorRecord;
3694
+ /**
3695
+ * Loads and validates an existing ActorRecord from untrusted data.
3696
+ * Used by RecordStore to validate records when reading from disk.
3697
+ * Validates both header (embedded metadata) and payload (ActorRecord).
3698
+ *
3699
+ * @param data - Unknown data to validate as GitGovActorRecord
3700
+ * @returns GitGovActorRecord - The validated complete record
3701
+ * @throws DetailedValidationError if validation fails
3702
+ */
3703
+ declare function loadActorRecord(data: unknown): GitGovActorRecord;
2738
3704
 
2739
3705
  /**
2740
3706
  * Creates a new, fully-formed AgentRecord with validation.
2741
3707
  */
2742
- declare function createAgentRecord(payload: Partial<AgentRecord>): Promise<AgentRecord>;
3708
+ declare function createAgentRecord(payload: Partial<AgentRecord>): AgentRecord;
3709
+ /**
3710
+ * Loads and validates an existing AgentRecord from untrusted data.
3711
+ * Used by RecordStore to validate records when reading from disk.
3712
+ * Validates both header (embedded metadata) and payload (AgentRecord).
3713
+ *
3714
+ * @param data - Unknown data to validate as GitGovAgentRecord
3715
+ * @returns GitGovAgentRecord - The validated complete record
3716
+ * @throws DetailedValidationError if validation fails
3717
+ */
3718
+ declare function loadAgentRecord(data: unknown): GitGovAgentRecord;
2743
3719
 
2744
3720
  /**
2745
3721
  * Creates a new, fully-formed TaskRecord with validation.
2746
3722
  */
2747
- declare function createTaskRecord(payload: Partial<TaskRecord>): Promise<TaskRecord>;
3723
+ declare function createTaskRecord(payload: Partial<TaskRecord>): TaskRecord;
3724
+ /**
3725
+ * Loads and validates an existing TaskRecord from untrusted data.
3726
+ * Used by RecordStore to validate records when reading from disk.
3727
+ * Validates both header (embedded metadata) and payload (TaskRecord).
3728
+ *
3729
+ * @param data - Unknown data to validate as GitGovTaskRecord
3730
+ * @returns GitGovTaskRecord - The validated complete record
3731
+ * @throws DetailedValidationError if validation fails
3732
+ */
3733
+ declare function loadTaskRecord(data: unknown): GitGovTaskRecord;
2748
3734
 
2749
3735
  /**
2750
3736
  * Creates a new, fully-formed CycleRecord with validation.
2751
3737
  */
2752
- declare function createCycleRecord(payload: Partial<CycleRecord>): Promise<CycleRecord>;
3738
+ declare function createCycleRecord(payload: Partial<CycleRecord>): CycleRecord;
3739
+ /**
3740
+ * Loads and validates an existing CycleRecord from untrusted data.
3741
+ * Used by RecordStore to validate records when reading from disk.
3742
+ * Validates both header (embedded metadata) and payload (CycleRecord).
3743
+ *
3744
+ * @param data - Unknown data to validate as GitGovCycleRecord
3745
+ * @returns GitGovCycleRecord - The validated complete record
3746
+ * @throws DetailedValidationError if validation fails
3747
+ */
3748
+ declare function loadCycleRecord(data: unknown): GitGovCycleRecord;
2753
3749
 
2754
3750
  /**
2755
3751
  * Creates a complete ExecutionRecord with validation
2756
3752
  *
2757
3753
  * @param payload - Partial ExecutionRecord payload
2758
- * @returns Promise<ExecutionRecord> - The validated ExecutionRecord
3754
+ * @returns ExecutionRecord - The validated ExecutionRecord
2759
3755
  */
2760
- declare function createExecutionRecord(payload: Partial<ExecutionRecord>): Promise<ExecutionRecord>;
3756
+ declare function createExecutionRecord(payload: Partial<ExecutionRecord>): ExecutionRecord;
3757
+ /**
3758
+ * Loads and validates an existing ExecutionRecord from untrusted data.
3759
+ * Used by RecordStore to validate records when reading from disk.
3760
+ * Validates both header (embedded metadata) and payload (ExecutionRecord).
3761
+ *
3762
+ * @param data - Unknown data to validate as GitGovExecutionRecord
3763
+ * @returns GitGovExecutionRecord - The validated complete record
3764
+ * @throws DetailedValidationError if validation fails
3765
+ */
3766
+ declare function loadExecutionRecord(data: unknown): GitGovExecutionRecord;
2761
3767
 
2762
3768
  /**
2763
3769
  * Creates a complete ChangelogRecord with validation (Protocol v2)
2764
3770
  *
2765
3771
  * @param payload - Partial ChangelogRecord payload
2766
- * @returns Promise<ChangelogRecord> - The validated ChangelogRecord
3772
+ * @returns ChangelogRecord - The validated ChangelogRecord
3773
+ */
3774
+ declare function createChangelogRecord(payload: Partial<ChangelogRecord>): ChangelogRecord;
3775
+ /**
3776
+ * Loads and validates an existing ChangelogRecord from untrusted data.
3777
+ * Used by RecordStore to validate records when reading from disk.
3778
+ * Validates both header (embedded metadata) and payload (ChangelogRecord).
3779
+ *
3780
+ * @param data - Unknown data to validate as GitGovChangelogRecord
3781
+ * @returns GitGovChangelogRecord - The validated complete record
3782
+ * @throws DetailedValidationError if validation fails
2767
3783
  */
2768
- declare function createChangelogRecord(payload: Partial<ChangelogRecord>): Promise<ChangelogRecord>;
3784
+ declare function loadChangelogRecord(data: unknown): GitGovChangelogRecord;
2769
3785
 
2770
3786
  /**
2771
3787
  * Creates a complete FeedbackRecord with validation
2772
3788
  *
2773
3789
  * @param payload - Partial FeedbackRecord payload
2774
- * @returns Promise<FeedbackRecord> - The validated FeedbackRecord
3790
+ * @returns FeedbackRecord - The validated FeedbackRecord
3791
+ */
3792
+ declare function createFeedbackRecord(payload: Partial<FeedbackRecord>): FeedbackRecord;
3793
+ /**
3794
+ * Loads and validates an existing FeedbackRecord from untrusted data.
3795
+ * Used by RecordStore to validate records when reading from disk.
3796
+ * Validates both header (embedded metadata) and payload (FeedbackRecord).
3797
+ *
3798
+ * @param data - Unknown data to validate as GitGovFeedbackRecord
3799
+ * @returns GitGovFeedbackRecord - The validated complete record
3800
+ * @throws DetailedValidationError if validation fails
2775
3801
  */
2776
- declare function createFeedbackRecord(payload: Partial<FeedbackRecord>): Promise<FeedbackRecord>;
3802
+ declare function loadFeedbackRecord(data: unknown): GitGovFeedbackRecord;
2777
3803
 
2778
3804
  /**
2779
3805
  * Creates a new, fully-formed WorkflowMethodologyConfig with validation.
2780
3806
  * Follows the same pattern as createTaskRecord, createActorRecord, etc.
2781
3807
  */
2782
- declare function createWorkflowMethodologyConfig(payload: Partial<WorkflowMethodologyRecord>): Promise<WorkflowMethodologyRecord>;
3808
+ declare function createWorkflowMethodologyConfig(payload: Partial<WorkflowMethodologyRecord>): WorkflowMethodologyRecord;
2783
3809
  /**
2784
3810
  * Creates a default GitGovernance workflow methodology configuration
2785
3811
  */
@@ -2805,52 +3831,740 @@ type CreateEmbeddedMetadataOptions = {
2805
3831
  signatures?: Signature[];
2806
3832
  };
2807
3833
  /**
2808
- * Creates a test signature for development/testing purposes (unsigned)
2809
- * Use this only for testing when you don't have a real private key
3834
+ * Creates a test signature for development/testing purposes (unsigned)
3835
+ * Use this only for testing when you don't have a real private key
3836
+ *
3837
+ * @param keyId - The key ID for the signature (default: 'human:test-user')
3838
+ * @param role - The role for the signature (default: 'author')
3839
+ * @param notes - Notes for the signature (default: 'Test signature - unsigned')
3840
+ * @returns Signature object (with dummy signature value)
3841
+ */
3842
+ declare function createTestSignature(keyId?: string, role?: string, notes?: string): Signature;
3843
+ /**
3844
+ * Creates a complete EmbeddedMetadataRecord with validation
3845
+ *
3846
+ * @param payload - The record payload (ActorRecord, TaskRecord, etc.)
3847
+ * @param options - Optional configuration for the embedded metadata
3848
+ * @returns Promise<EmbeddedMetadataRecord<T>> - The validated embedded metadata record
3849
+ *
3850
+ * @example
3851
+ * ```typescript
3852
+ * const actorPayload: ActorRecord = {
3853
+ * id: 'human:john-doe',
3854
+ * type: 'human',
3855
+ * displayName: 'John Doe',
3856
+ * publicKey: 'abc123...',
3857
+ * roles: ['developer']
3858
+ * };
3859
+ *
3860
+ * const embedded = createEmbeddedMetadataRecord(actorPayload);
3861
+ * ```
3862
+ */
3863
+ declare function createEmbeddedMetadataRecord<T extends GitGovRecordPayload>(payload: T, options?: CreateEmbeddedMetadataOptions): EmbeddedMetadataRecord<T>;
3864
+
3865
+ type index$6_CreateEmbeddedMetadataOptions = CreateEmbeddedMetadataOptions;
3866
+ type index$6_SignatureConfig = SignatureConfig;
3867
+ declare const index$6_createActorRecord: typeof createActorRecord;
3868
+ declare const index$6_createAgentRecord: typeof createAgentRecord;
3869
+ declare const index$6_createChangelogRecord: typeof createChangelogRecord;
3870
+ declare const index$6_createCycleRecord: typeof createCycleRecord;
3871
+ declare const index$6_createDefaultWorkflowMethodologyConfig: typeof createDefaultWorkflowMethodologyConfig;
3872
+ declare const index$6_createEmbeddedMetadataRecord: typeof createEmbeddedMetadataRecord;
3873
+ declare const index$6_createExecutionRecord: typeof createExecutionRecord;
3874
+ declare const index$6_createFeedbackRecord: typeof createFeedbackRecord;
3875
+ declare const index$6_createTaskRecord: typeof createTaskRecord;
3876
+ declare const index$6_createTestSignature: typeof createTestSignature;
3877
+ declare const index$6_createWorkflowMethodologyConfig: typeof createWorkflowMethodologyConfig;
3878
+ declare const index$6_loadActorRecord: typeof loadActorRecord;
3879
+ declare const index$6_loadAgentRecord: typeof loadAgentRecord;
3880
+ declare const index$6_loadChangelogRecord: typeof loadChangelogRecord;
3881
+ declare const index$6_loadCycleRecord: typeof loadCycleRecord;
3882
+ declare const index$6_loadExecutionRecord: typeof loadExecutionRecord;
3883
+ declare const index$6_loadFeedbackRecord: typeof loadFeedbackRecord;
3884
+ declare const index$6_loadTaskRecord: typeof loadTaskRecord;
3885
+ declare namespace index$6 {
3886
+ 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 };
3887
+ }
3888
+
3889
+ type StorablePayload = Exclude<GitGovRecordPayload, CustomRecord>;
3890
+ /**
3891
+ * Public interface for LintModule operations.
3892
+ *
3893
+ * Follows the same pattern as IBacklogAdapter, IFeedbackAdapter, etc.
3894
+ * Enables dependency injection and mocking for tests.
3895
+ *
3896
+ * @example
3897
+ * ```typescript
3898
+ * const lintModule: ILintModule = new LintModule({
3899
+ * recordStore: taskStore,
3900
+ * indexerAdapter: indexerAdapter
3901
+ * });
3902
+ *
3903
+ * const report = await lintModule.lint({ validateReferences: true });
3904
+ * ```
3905
+ */
3906
+ interface ILintModule {
3907
+ /**
3908
+ * Validates all records in the specified directory.
3909
+ *
3910
+ * Uses delegation pattern: calls recordStore.read() which internally uses loaders
3911
+ * to validate schema + embedded metadata. Then adds additional validations
3912
+ * (conventions, references).
3913
+ *
3914
+ * @param options - Configuration options
3915
+ * @returns {Promise<LintReport>} Consolidated report with all results
3916
+ */
3917
+ lint(options?: Partial<LintOptions>): Promise<LintReport>;
3918
+ /**
3919
+ * Validates a specific file and returns its results.
3920
+ * Ultra-fast validation for single records (target: <50ms).
3921
+ *
3922
+ * @param filePath - Path to the file to validate
3923
+ * @param options - Configuration options
3924
+ * @returns {Promise<LintReport>} Lint report for this single file
3925
+ */
3926
+ lintFile(filePath: string, options?: Partial<LintOptions>): Promise<LintReport>;
3927
+ /**
3928
+ * Applies automatic repairs to problems marked as fixable.
3929
+ *
3930
+ * @param lintReport - Lint report with detected problems
3931
+ * @param fixOptions - Options for the fix operation
3932
+ * @returns {Promise<FixReport>} Report of applied repairs
3933
+ */
3934
+ fix(lintReport: LintReport, fixOptions?: Partial<FixOptions>): Promise<FixReport>;
3935
+ }
3936
+ /**
3937
+ * Required and optional dependencies for the LintModule.
3938
+ *
3939
+ * The module uses dependency injection for maximum flexibility and testability.
3940
+ * Some dependencies are optional and the module gracefully degrades if they are not present.
3941
+ *
3942
+ * @example
3943
+ * ```typescript
3944
+ * const lintModule = new LintModule({
3945
+ * recordStore: taskStore,
3946
+ * indexerAdapter: new IndexerAdapter(), // optional
3947
+ * });
3948
+ * ```
3949
+ */
3950
+ interface LintModuleDependencies {
3951
+ /**
3952
+ * Store for filesystem access to records (REQUIRED)
3953
+ * Note: This project does not have a centralized ValidatorModule.
3954
+ * Validation is performed by recordStore.read() using type-specific loaders.
3955
+ */
3956
+ recordStore: RecordStore<StorablePayload>;
3957
+ /**
3958
+ * Indexing adapter for reference resolution (OPTIONAL)
3959
+ * If not present, reference validations will be limited.
3960
+ */
3961
+ indexerAdapter?: IIndexerAdapter;
3962
+ /**
3963
+ * File system for I/O operations (OPTIONAL)
3964
+ * Defaults to Node.js native fs.
3965
+ */
3966
+ fileSystem?: FileSystem;
3967
+ }
3968
+ /**
3969
+ * Interfaz simplificada del sistema de archivos para testing.
3970
+ */
3971
+ interface FileSystem {
3972
+ readFile(path: string, encoding: string): Promise<string>;
3973
+ writeFile(path: string, content: string): Promise<void>;
3974
+ exists(path: string): Promise<boolean>;
3975
+ unlink(path: string): Promise<void>;
3976
+ }
3977
+ /**
3978
+ * Opciones de configuración para la ejecución de lint.
3979
+ *
3980
+ * Controla qué validaciones se ejecutan y cómo se comporta el motor de lint.
3981
+ *
3982
+ * @example
3983
+ * ```typescript
3984
+ * const report = await lintModule.lint({
3985
+ * path: '.gitgov/',
3986
+ * validateReferences: true,
3987
+ * validateActors: true,
3988
+ * failFast: false,
3989
+ * concurrent: true
3990
+ * });
3991
+ * ```
3992
+ */
3993
+ interface LintOptions {
3994
+ /** Directorio o archivo a validar (default: '.gitgov/') */
3995
+ path?: string;
3996
+ /**
3997
+ * Validar referencias tipadas inteligentemente (default: false)
3998
+ * Requiere indexerModule presente.
3999
+ */
4000
+ validateReferences?: boolean;
4001
+ /**
4002
+ * Validar resolución de actorIds (default: false)
4003
+ * Verifica que los actorIds existen en .gitgov/actors/
4004
+ */
4005
+ validateActors?: boolean;
4006
+ /**
4007
+ * Validar checksums de embedded metadata (default: true)
4008
+ * Usa SHA256 sobre JSON canónico.
4009
+ */
4010
+ validateChecksums?: boolean;
4011
+ /**
4012
+ * Validar estructura de firmas (default: true)
4013
+ * Verifica formato Ed25519 y campos requeridos.
4014
+ */
4015
+ validateSignatures?: boolean;
4016
+ /**
4017
+ * Validar convenciones de nombres y directorios (default: true)
4018
+ * Valida que archivos estén en directorios correctos.
4019
+ */
4020
+ validateConventions?: boolean;
4021
+ /**
4022
+ * Modo fail-fast o acumular todos los errores (default: false)
4023
+ * Si true, detiene al primer error fatal.
4024
+ */
4025
+ failFast?: boolean;
4026
+ /**
4027
+ * Modo concurrente para repositorios grandes (default: true)
4028
+ * Procesa múltiples records en paralelo.
4029
+ */
4030
+ concurrent?: boolean;
4031
+ /**
4032
+ * Límite de concurrencia (default: 10)
4033
+ * Número máximo de records procesados simultáneamente.
4034
+ */
4035
+ concurrencyLimit?: number;
4036
+ }
4037
+ /**
4038
+ * Reporte consolidado de la ejecución de lint.
4039
+ *
4040
+ * Contiene resumen cuantitativo, resultados detallados y metadata de ejecución.
4041
+ *
4042
+ * @example
4043
+ * ```typescript
4044
+ * const report = await lintModule.lint(options);
4045
+ * console.log(`Errores: ${report.summary.errors}`);
4046
+ * console.log(`Warnings: ${report.summary.warnings}`);
4047
+ * console.log(`Tiempo: ${report.summary.executionTime}ms`);
4048
+ * ```
4049
+ */
4050
+ interface LintReport {
4051
+ /** Resumen cuantitativo de los resultados */
4052
+ summary: LintSummary;
4053
+ /** Lista detallada de cada problema encontrado */
4054
+ results: LintResult[];
4055
+ /** Metadata de la ejecución */
4056
+ metadata: {
4057
+ /** Timestamp ISO 8601 de ejecución */
4058
+ timestamp: string;
4059
+ /** Opciones utilizadas en esta ejecución */
4060
+ options: LintOptions;
4061
+ /** Versión del módulo lint */
4062
+ version: string;
4063
+ };
4064
+ }
4065
+ /**
4066
+ * Resumen cuantitativo de resultados de lint.
4067
+ *
4068
+ * Proporciona métricas agregadas para evaluación rápida del estado del repositorio.
4069
+ */
4070
+ interface LintSummary {
4071
+ /** Número total de archivos verificados en el directorio objetivo */
4072
+ filesChecked: number;
4073
+ /** Número total de errores fatales que requieren corrección */
4074
+ errors: number;
4075
+ /** Número total de advertencias que sugieren mejoras */
4076
+ warnings: number;
4077
+ /** Número de problemas auto-reparables con fix() */
4078
+ fixable: number;
4079
+ /** Tiempo de ejecución en milisegundos */
4080
+ executionTime: number;
4081
+ }
4082
+ /**
4083
+ * Resultado individual de validación para una entidad específica.
4084
+ *
4085
+ * Representa un problema detectado en un record, con contexto completo para debugging.
4086
+ *
4087
+ * @example
4088
+ * ```typescript
4089
+ * const result: LintResult = {
4090
+ * level: 'error',
4091
+ * filePath: '.gitgov/tasks/task-123.json',
4092
+ * validator: 'SCHEMA_VALIDATION',
4093
+ * message: 'Campo requerido "description" ausente',
4094
+ * entity: { type: 'task', id: 'task-123' },
4095
+ * fixable: false,
4096
+ * context: { field: 'description', expected: 'string' }
4097
+ * };
4098
+ * ```
4099
+ */
4100
+ interface LintResult {
4101
+ /** Nivel de severidad del problema detectado */
4102
+ level: "error" | "warning" | "info";
4103
+ /** Ruta relativa del archivo donde se detectó el problema */
4104
+ filePath: string;
4105
+ /** Tipo de validador que generó este resultado */
4106
+ validator: ValidatorType;
4107
+ /** Mensaje descriptivo del problema encontrado */
4108
+ message: string;
4109
+ /** Información de la entidad GitGovernance afectada */
4110
+ entity: {
4111
+ /**
4112
+ * Tipo de protocolo de la entidad.
4113
+ * Nota: Excluye "custom" que es solo para testing interno.
4114
+ */
4115
+ type: "actor" | "agent" | "task" | "cycle" | "execution" | "changelog" | "feedback";
4116
+ /** ID único de la entidad en el formato del protocolo */
4117
+ id: string;
4118
+ };
4119
+ /** Indica si el error es auto-reparable con fix() */
4120
+ fixable: boolean;
4121
+ /**
4122
+ * Indica si el error fue reparado automáticamente (post-fix)
4123
+ * Solo presente después de ejecutar fix().
4124
+ */
4125
+ fixed?: boolean;
4126
+ /**
4127
+ * Contexto adicional para debugging
4128
+ * Provee información específica del campo problemático.
4129
+ */
4130
+ context?: {
4131
+ /** Campo específico con problema (ej: 'description', 'payloadChecksum') */
4132
+ field?: string;
4133
+ /** Valor actual del campo */
4134
+ actual?: unknown;
4135
+ /** Valor esperado del campo */
4136
+ expected?: unknown;
4137
+ };
4138
+ }
4139
+ /**
4140
+ * Tipos de validadores disponibles en el pipeline.
4141
+ *
4142
+ * Cada tipo representa una categoría específica de validación.
4143
+ * Los validadores se ejecutan en orden y pueden ser habilitados/deshabilitados vía opciones.
4144
+ *
4145
+ * @example
4146
+ * ```typescript
4147
+ * const result: LintResult = {
4148
+ * validator: 'SCHEMA_VALIDATION',
4149
+ * // ...
4150
+ * };
4151
+ * ```
4152
+ */
4153
+ type ValidatorType =
4154
+ /** Validación de schema JSON usando AJV */
4155
+ "SCHEMA_VALIDATION"
4156
+ /** Validación de integridad referencial (referencias existen) */
4157
+ | "REFERENTIAL_INTEGRITY"
4158
+ /** Validación de referencias tipadas por prefijo (task:, file:, etc) */
4159
+ | "TYPED_REFERENCE"
4160
+ /** Validación de consistencia bidireccional (Task↔Cycle) */
4161
+ | "BIDIRECTIONAL_CONSISTENCY"
4162
+ /** Validación de estructura header/payload de embedded metadata */
4163
+ | "EMBEDDED_METADATA_STRUCTURE"
4164
+ /** Verificación de checksum SHA256 */
4165
+ | "CHECKSUM_VERIFICATION"
4166
+ /** Validación de estructura de firmas Ed25519 */
4167
+ | "SIGNATURE_STRUCTURE"
4168
+ /** Validación de convenciones de nombres de archivos */
4169
+ | "FILE_NAMING_CONVENTION"
4170
+ /** Validación de consistencia temporal (createdAt ≤ updatedAt) */
4171
+ | "TEMPORAL_CONSISTENCY"
4172
+ /** Validación de resolución de actorIds */
4173
+ | "ACTOR_RESOLUTION"
4174
+ /** Detección de referencias a entidades con status 'discarded' */
4175
+ | "SOFT_DELETE_DETECTION"
4176
+ /** Detección de records con schema obsoleto (requiere migración) */
4177
+ | "SCHEMA_VERSION_MISMATCH";
4178
+ /**
4179
+ * Contexto de ejecución para validación de un record individual.
4180
+ *
4181
+ * Proporciona información necesaria para validadores individuales.
4182
+ */
4183
+ interface ValidationContext {
4184
+ /** Path del archivo siendo validado */
4185
+ filePath: string;
4186
+ /** Configuración de validadores habilitados */
4187
+ enabledValidators: ValidatorType[];
4188
+ /**
4189
+ * Caché de records ya cargados (para referencias)
4190
+ * Evita cargar el mismo record múltiples veces.
4191
+ */
4192
+ recordCache?: Map<string, GitGovRecord>;
4193
+ /** Modo fail-fast habilitado */
4194
+ failFast: boolean;
4195
+ }
4196
+ /**
4197
+ * Options for auto-fix operation.
4198
+ *
4199
+ * Controls which problems to repair and how the repair is executed.
4200
+ * Includes configuration for backups and change signing.
4201
+ *
4202
+ * @example
4203
+ * ```typescript
4204
+ * const fixReport = await lintModule.fix(lintReport, {
4205
+ * fixTypes: ['SCHEMA_VERSION_MISMATCH', 'EMBEDDED_METADATA_STRUCTURE'],
4206
+ * createBackups: true,
4207
+ * keyId: 'system:migrator',
4208
+ * privateKey: systemPrivateKey,
4209
+ * dryRun: false
4210
+ * });
4211
+ * ```
4212
+ */
4213
+ interface FixOptions {
4214
+ /**
4215
+ * Types of problems to repair (default: all fixable)
4216
+ * If specified, only repairs the indicated types.
4217
+ */
4218
+ fixTypes?: ValidatorType[];
4219
+ /**
4220
+ * Create backups before modifying files (default: true)
4221
+ * Creates .backup-{timestamp} file before each modification.
4222
+ */
4223
+ createBackups?: boolean;
4224
+ /**
4225
+ * KeyId (actorId) for automatic change signing (default: 'system:migrator')
4226
+ * This value is used as the keyId parameter in signPayload().
4227
+ */
4228
+ keyId?: string;
4229
+ /**
4230
+ * Private key for signing fixed records (REQUIRED for legacy record fixes)
4231
+ * Used by signPayload() to create cryptographic signatures.
4232
+ */
4233
+ privateKey?: string;
4234
+ /**
4235
+ * Dry-run mode that reports without applying changes (default: false)
4236
+ * Useful for previewing what will be repaired.
4237
+ */
4238
+ dryRun?: boolean;
4239
+ }
4240
+ /**
4241
+ * Reporte de operación de auto-fix.
4242
+ *
4243
+ * Contiene resumen de reparaciones y detalles de cada fix aplicado.
4244
+ *
4245
+ * @example
4246
+ * ```typescript
4247
+ * const fixReport = await lintModule.fix(lintReport, fixOptions);
4248
+ * console.log(`Reparados: ${fixReport.summary.fixed}`);
4249
+ * console.log(`Fallidos: ${fixReport.summary.failed}`);
4250
+ * console.log(`Backups: ${fixReport.summary.backupsCreated}`);
4251
+ * ```
4252
+ */
4253
+ interface FixReport {
4254
+ /** Resumen de reparaciones aplicadas */
4255
+ summary: {
4256
+ /** Número de problemas reparados exitosamente */
4257
+ fixed: number;
4258
+ /** Número de problemas que fallaron al reparar */
4259
+ failed: number;
4260
+ /** Número de backups creados */
4261
+ backupsCreated: number;
4262
+ };
4263
+ /** Detalles de cada reparación */
4264
+ fixes: FixResult[];
4265
+ }
4266
+ /**
4267
+ * Resultado individual de reparación.
4268
+ *
4269
+ * Representa el resultado de intentar reparar un problema específico.
4270
+ */
4271
+ interface FixResult {
4272
+ /** Path del archivo reparado o intentado reparar */
4273
+ filePath: string;
4274
+ /** Tipo de problema reparado */
4275
+ validator: ValidatorType;
4276
+ /** Descripción de la reparación aplicada */
4277
+ action: string;
4278
+ /** Éxito de la reparación */
4279
+ success: boolean;
4280
+ /**
4281
+ * Error si falló la reparación
4282
+ * Solo presente si success = false.
4283
+ */
4284
+ error?: string;
4285
+ /**
4286
+ * Path del backup creado (si aplica)
4287
+ * Solo presente si createBackups = true y success = true.
4288
+ */
4289
+ backupPath?: string;
4290
+ }
4291
+
4292
+ /**
4293
+ * Structural validation module for GitGovernance records.
4294
+ *
4295
+ * Implements Quality Model Layer 1 with delegation to recordStore.read()
4296
+ * for base validation and adds additional validations for conventions and references.
4297
+ *
4298
+ * Implements ILintModule interface following the same pattern as all other adapters
4299
+ * (IBacklogAdapter, IFeedbackAdapter, etc.) for consistency and testability.
4300
+ *
4301
+ * @class LintModule
4302
+ * @implements {ILintModule}
4303
+ * @example
4304
+ * ```typescript
4305
+ * const lintModule: ILintModule = new LintModule({
4306
+ * recordStore: taskStore,
4307
+ * indexerAdapter: indexerAdapter // optional
4308
+ * });
4309
+ *
4310
+ * const report = await lintModule.lint({ validateReferences: true });
4311
+ * ```
4312
+ */
4313
+ declare class LintModule implements ILintModule {
4314
+ private readonly recordStore;
4315
+ private readonly indexerAdapter;
4316
+ private readonly fileSystem;
4317
+ private lastBackupPath;
4318
+ /**
4319
+ * Constructor for LintModule with graceful degradation.
4320
+ *
4321
+ * @param dependencies - Module dependencies (some optional)
4322
+ * @throws {Error} If recordStore is not present
4323
+ *
4324
+ * @example
4325
+ * ```typescript
4326
+ * const lintModule = new LintModule({
4327
+ * recordStore: taskStore, // REQUIRED
4328
+ * indexerAdapter: indexerAdapter, // optional
4329
+ * fileSystem: customFileSystem // optional (default: Node.js fs)
4330
+ * });
4331
+ * ```
4332
+ */
4333
+ constructor(dependencies: LintModuleDependencies);
4334
+ /**
4335
+ * Valida todos los records en el directorio especificado.
4336
+ *
4337
+ * Usa delegation pattern: llama a recordStore.read() que internamente usa loaders
4338
+ * para validar schema + embedded metadata. Luego agrega validaciones adicionales
4339
+ * (convenciones, referencias).
4340
+ *
4341
+ * @param options - Opciones de configuración
4342
+ * @returns {Promise<LintReport>} Reporte consolidado con todos los resultados
4343
+ *
4344
+ * @example
4345
+ * ```typescript
4346
+ * const report = await lintModule.lint({
4347
+ * path: '.gitgov/',
4348
+ * validateReferences: true,
4349
+ * validateActors: true,
4350
+ * concurrent: true
4351
+ * });
4352
+ *
4353
+ * console.log(`Errors: ${report.summary.errors}`);
4354
+ * console.log(`Warnings: ${report.summary.warnings}`);
4355
+ * ```
4356
+ */
4357
+ lint(options?: Partial<LintOptions>): Promise<LintReport>;
4358
+ /**
4359
+ * Validates a specific file and returns its results.
4360
+ * Ultra-fast validation for single records (target: <50ms).
4361
+ *
4362
+ * @param filePath - Path to the file to validate
4363
+ * @param options - Configuration options
4364
+ * @returns {Promise<LintReport>} Lint report for this single file
4365
+ *
4366
+ * @example
4367
+ * ```typescript
4368
+ * const report = await lintModule.lintFile('.gitgov/tasks/1234567890-task-example.json', {
4369
+ * validateReferences: true
4370
+ * });
4371
+ * ```
4372
+ */
4373
+ lintFile(filePath: string, options?: Partial<LintOptions>): Promise<LintReport>;
4374
+ /**
4375
+ * Valida un record individual y retorna sus resultados.
4376
+ *
4377
+ * @private
4378
+ * @param recordId - ID del record a validar
4379
+ * @param options - Opciones de configuración
4380
+ * @returns {Promise<LintResult[]>} Array de resultados para este record
4381
+ */
4382
+ private lintSingleRecord;
4383
+ /**
4384
+ * Valida un archivo específico.
4385
+ *
4386
+ * Útil para validación en vivo (ej: dashboard, IDE integration).
4387
+ *
4388
+ * @param filePath - Path del archivo a validar
4389
+ * @param options - Opciones de configuración
4390
+ * @returns {Promise<LintResult[]>} Resultados de validación para este archivo
4391
+ *
4392
+ * @example
4393
+ * ```typescript
4394
+ * const results = await lintModule.lintFile(
4395
+ * '.gitgov/tasks/task-123.json',
4396
+ * { validateReferences: true }
4397
+ * );
4398
+ * ```
4399
+ */
4400
+ /**
4401
+ * Applies automatic repairs to problems marked as fixable.
4402
+ *
4403
+ * @param lintReport - Lint report with detected problems
4404
+ * @param fixOptions - Options for the fix operation
4405
+ * @returns {Promise<FixReport>} Report of applied repairs
4406
+ *
4407
+ * @example
4408
+ * ```typescript
4409
+ * const lintReport = await lintModule.lint();
4410
+ * const fixReport = await lintModule.fix(lintReport, {
4411
+ * createBackups: true,
4412
+ * keyId: 'system:migrator'
4413
+ * });
4414
+ *
4415
+ * console.log(`Fixed: ${fixReport.summary.fixed}`);
4416
+ * ```
4417
+ */
4418
+ fix(lintReport: LintReport, fixOptions?: Partial<FixOptions>): Promise<FixReport>;
4419
+ /**
4420
+ * Splits an array into chunks of the specified size.
4421
+ * @private
4422
+ */
4423
+ private chunkArray;
4424
+ /**
4425
+ * Discovers all records with their types by scanning the filesystem.
4426
+ * This ensures we know the correct type for each record based on its directory.
4427
+ * @private
4428
+ */
4429
+ private discoverAllRecordsWithTypes;
4430
+ /**
4431
+ * Gets the file path for a given recordId.
4432
+ * Matches the format used by RecordStore.getRecordPath()
4433
+ * @private
4434
+ */
4435
+ private getFilePath;
4436
+ /**
4437
+ * Extracts the recordId from a filePath.
4438
+ * @private
4439
+ */
4440
+ private extractRecordId;
4441
+ /**
4442
+ * Detects the entity type from a recordId.
4443
+ * @private
4444
+ */
4445
+ private getEntityType;
4446
+ /**
4447
+ * Detects the validator type based on the error.
4448
+ * @private
4449
+ */
4450
+ private detectValidatorType;
4451
+ /**
4452
+ * Determines if an error is fixable.
4453
+ * @private
4454
+ */
4455
+ private isFixable;
4456
+ /**
4457
+ * Validates conventions (file naming, timestamps, etc).
4458
+ * Implements EARS-13 through EARS-16.
4459
+ * @private
4460
+ */
4461
+ private validateConventions;
4462
+ /**
4463
+ * Validates references (typed references, bidirectional consistency).
4464
+ * Implements EARS-17 through EARS-22.
4465
+ * Requires indexerAdapter to be present.
4466
+ * @private
4467
+ */
4468
+ private validateReferences;
4469
+ /**
4470
+ * Validates actorIds (resolution in .gitgov/actors/).
4471
+ * Implements EARS-19.
4472
+ * @private
4473
+ */
4474
+ private validateActors;
4475
+ /**
4476
+ * Applies a specific repair based on the problem type.
4477
+ * @private
4478
+ */
4479
+ private applyFix;
4480
+ /**
4481
+ * Repairs a legacy record by wrapping it in embedded metadata.
4482
+ * Implements EARS-24: Normalize legacy records with signature.
4483
+ * @private
4484
+ */
4485
+ private fixLegacyRecord;
4486
+ /**
4487
+ * Repairs bidirectional inconsistencies between Task and Cycle.
4488
+ * Implements EARS-25: Sync bidirectional references.
4489
+ * @private
4490
+ */
4491
+ private fixBidirectionalReference;
4492
+ /**
4493
+ * Recalculates the checksum of a record.
4494
+ * Implements checksum repair for corrupted checksums.
4495
+ * @private
4496
+ */
4497
+ private recalculateChecksum;
4498
+ /**
4499
+ * Creates a backup of a file.
4500
+ * @private
4501
+ */
4502
+ private createBackup;
4503
+ /**
4504
+ * Fixes signature structure errors by analyzing specific errors and applying targeted fixes.
4505
+ * Reads the record directly (bypassing validation), extracts payload, and fixes signature issues:
4506
+ * - Adds missing 'notes' field with a valid value
4507
+ * - Removes additional properties not allowed
4508
+ * - Regenerates invalid signatures
4509
+ * Works even when signatures have invalid format (e.g., "placeholder" instead of base64).
4510
+ * @private
4511
+ */
4512
+ private fixSignatureStructure;
4513
+ /**
4514
+ * Restores a file from its most recent backup.
4515
+ * Implements EARS-32: Restore backup if fix fails.
4516
+ * @private
4517
+ */
4518
+ private restoreBackup;
4519
+ }
4520
+
4521
+ /**
4522
+ * Lint Module - Structural Validation for GitGovernance Records
2810
4523
  *
2811
- * @param keyId - The key ID for the signature (default: 'human:test-user')
2812
- * @param role - The role for the signature (default: 'author')
2813
- * @param notes - Notes for the signature (default: 'Test signature - unsigned')
2814
- * @returns Signature object (with dummy signature value)
2815
- */
2816
- declare function createTestSignature(keyId?: string, role?: string, notes?: string): Signature;
2817
- /**
2818
- * Creates a complete EmbeddedMetadataRecord with validation
4524
+ * This module provides comprehensive validation capabilities for GitGovernance records,
4525
+ * implementing Quality Model Layer 1 (Structural + Referential Integrity).
2819
4526
  *
2820
- * @param payload - The record payload (ActorRecord, TaskRecord, etc.)
2821
- * @param options - Optional configuration for the embedded metadata
2822
- * @returns Promise<EmbeddedMetadataRecord<T>> - The validated embedded metadata record
4527
+ * Follows the same architectural pattern as all other adapters with public interface
4528
+ * (ILintModule) for dependency injection and testability.
2823
4529
  *
4530
+ * @module lint
2824
4531
  * @example
2825
4532
  * ```typescript
2826
- * const actorPayload: ActorRecord = {
2827
- * id: 'human:john-doe',
2828
- * type: 'human',
2829
- * displayName: 'John Doe',
2830
- * publicKey: 'abc123...',
2831
- * roles: ['developer']
2832
- * };
4533
+ * import { LintModule, type ILintModule } from '@gitgov/core/lint';
4534
+ *
4535
+ * const lintModule: ILintModule = new LintModule({
4536
+ * recordStore: taskStore,
4537
+ * indexerAdapter: indexerAdapter // optional
4538
+ * });
4539
+ *
4540
+ * // Validate all records
4541
+ * const report = await lintModule.lint({ validateReferences: true });
4542
+ * console.log(`Errors: ${report.summary.errors}`);
2833
4543
  *
2834
- * const embedded = await createEmbeddedMetadataRecord(actorPayload);
4544
+ * // Auto-fix problems
4545
+ * if (report.summary.fixable > 0) {
4546
+ * const fixReport = await lintModule.fix(report, { createBackups: true });
4547
+ * console.log(`Fixed: ${fixReport.summary.fixed}`);
4548
+ * }
2835
4549
  * ```
2836
4550
  */
2837
- declare function createEmbeddedMetadataRecord<T extends GitGovRecordPayload>(payload: T, options?: CreateEmbeddedMetadataOptions): Promise<EmbeddedMetadataRecord<T>>;
2838
4551
 
2839
- type index$4_CreateEmbeddedMetadataOptions = CreateEmbeddedMetadataOptions;
2840
- type index$4_SignatureConfig = SignatureConfig;
2841
- declare const index$4_createActorRecord: typeof createActorRecord;
2842
- declare const index$4_createAgentRecord: typeof createAgentRecord;
2843
- declare const index$4_createChangelogRecord: typeof createChangelogRecord;
2844
- declare const index$4_createCycleRecord: typeof createCycleRecord;
2845
- declare const index$4_createDefaultWorkflowMethodologyConfig: typeof createDefaultWorkflowMethodologyConfig;
2846
- declare const index$4_createEmbeddedMetadataRecord: typeof createEmbeddedMetadataRecord;
2847
- declare const index$4_createExecutionRecord: typeof createExecutionRecord;
2848
- declare const index$4_createFeedbackRecord: typeof createFeedbackRecord;
2849
- declare const index$4_createTaskRecord: typeof createTaskRecord;
2850
- declare const index$4_createTestSignature: typeof createTestSignature;
2851
- declare const index$4_createWorkflowMethodologyConfig: typeof createWorkflowMethodologyConfig;
2852
- declare namespace index$4 {
2853
- export { type index$4_CreateEmbeddedMetadataOptions as CreateEmbeddedMetadataOptions, type index$4_SignatureConfig as SignatureConfig, index$4_createActorRecord as createActorRecord, index$4_createAgentRecord as createAgentRecord, index$4_createChangelogRecord as createChangelogRecord, index$4_createCycleRecord as createCycleRecord, index$4_createDefaultWorkflowMethodologyConfig as createDefaultWorkflowMethodologyConfig, index$4_createEmbeddedMetadataRecord as createEmbeddedMetadataRecord, index$4_createExecutionRecord as createExecutionRecord, index$4_createFeedbackRecord as createFeedbackRecord, index$4_createTaskRecord as createTaskRecord, index$4_createTestSignature as createTestSignature, index$4_createWorkflowMethodologyConfig as createWorkflowMethodologyConfig };
4552
+ type index$5_FileSystem = FileSystem;
4553
+ type index$5_FixOptions = FixOptions;
4554
+ type index$5_FixReport = FixReport;
4555
+ type index$5_FixResult = FixResult;
4556
+ type index$5_ILintModule = ILintModule;
4557
+ type index$5_LintModule = LintModule;
4558
+ declare const index$5_LintModule: typeof LintModule;
4559
+ type index$5_LintModuleDependencies = LintModuleDependencies;
4560
+ type index$5_LintOptions = LintOptions;
4561
+ type index$5_LintReport = LintReport;
4562
+ type index$5_LintResult = LintResult;
4563
+ type index$5_LintSummary = LintSummary;
4564
+ type index$5_ValidationContext = ValidationContext;
4565
+ type index$5_ValidatorType = ValidatorType;
4566
+ declare namespace index$5 {
4567
+ 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 };
2854
4568
  }
2855
4569
 
2856
4570
  type LogLevel = "debug" | "info" | "warn" | "error" | "silent";
@@ -2863,12 +4577,12 @@ interface Logger {
2863
4577
  declare function createLogger(prefix?: string, level?: LogLevel): Logger;
2864
4578
  declare const logger: Logger;
2865
4579
 
2866
- type index$3_LogLevel = LogLevel;
2867
- type index$3_Logger = Logger;
2868
- declare const index$3_createLogger: typeof createLogger;
2869
- declare const index$3_logger: typeof logger;
2870
- declare namespace index$3 {
2871
- export { type index$3_LogLevel as LogLevel, type index$3_Logger as Logger, index$3_createLogger as createLogger, index$3_logger as logger };
4580
+ type index$4_LogLevel = LogLevel;
4581
+ type index$4_Logger = Logger;
4582
+ declare const index$4_createLogger: typeof createLogger;
4583
+ declare const index$4_logger: typeof logger;
4584
+ declare namespace index$4 {
4585
+ export { type index$4_LogLevel as LogLevel, type index$4_Logger as Logger, index$4_createLogger as createLogger, index$4_logger as logger };
2872
4586
  }
2873
4587
 
2874
4588
  /**
@@ -6517,21 +8231,661 @@ declare class DetailedValidationError extends GitGovError {
6517
8231
  }>);
6518
8232
  }
6519
8233
 
6520
- type index$2_DetailedValidationError = DetailedValidationError;
6521
- declare const index$2_DetailedValidationError: typeof DetailedValidationError;
6522
- type index$2_GitGovError = GitGovError;
6523
- declare const index$2_GitGovError: typeof GitGovError;
6524
- type index$2_SchemaName = SchemaName;
6525
- type index$2_SchemaValidationCache = SchemaValidationCache;
6526
- declare const index$2_SchemaValidationCache: typeof SchemaValidationCache;
6527
- type index$2_SchemaValidationError = SchemaValidationError;
6528
- declare const index$2_SchemaValidationError: typeof SchemaValidationError;
6529
- declare const index$2_Schemas: typeof Schemas;
6530
- declare const index$2_getSchema: typeof getSchema;
6531
- declare const index$2_getSchemaNames: typeof getSchemaNames;
6532
- declare const index$2_hasSchema: typeof hasSchema;
8234
+ type index$3_DetailedValidationError = DetailedValidationError;
8235
+ declare const index$3_DetailedValidationError: typeof DetailedValidationError;
8236
+ type index$3_GitGovError = GitGovError;
8237
+ declare const index$3_GitGovError: typeof GitGovError;
8238
+ type index$3_SchemaName = SchemaName;
8239
+ type index$3_SchemaValidationCache = SchemaValidationCache;
8240
+ declare const index$3_SchemaValidationCache: typeof SchemaValidationCache;
8241
+ type index$3_SchemaValidationError = SchemaValidationError;
8242
+ declare const index$3_SchemaValidationError: typeof SchemaValidationError;
8243
+ declare const index$3_Schemas: typeof Schemas;
8244
+ declare const index$3_getSchema: typeof getSchema;
8245
+ declare const index$3_getSchemaNames: typeof getSchemaNames;
8246
+ declare const index$3_hasSchema: typeof hasSchema;
8247
+ declare namespace index$3 {
8248
+ 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 };
8249
+ }
8250
+
8251
+ /**
8252
+ * SyncModule Dependencies
8253
+ */
8254
+ interface SyncModuleDependencies {
8255
+ /** Low-level Git module (required) */
8256
+ git: GitModule;
8257
+ /** Configuration manager (required) */
8258
+ config: ConfigManager;
8259
+ /** Identity adapter for signature verification and signing (required) */
8260
+ identity: IIdentityAdapter;
8261
+ /** Lint module for record validation (required) */
8262
+ lint: LintModule;
8263
+ /** Indexer adapter for automatic re-indexing after pull/resolve (required) */
8264
+ indexer: IIndexerAdapter;
8265
+ }
8266
+ /**
8267
+ * Options for pushState operation
8268
+ */
8269
+ interface SyncPushOptions {
8270
+ /** Branch to push from (default: current branch) */
8271
+ sourceBranch?: string;
8272
+ /** Actor ID publishing the state (required) */
8273
+ actorId: string;
8274
+ /** Simulate operation without making real changes */
8275
+ dryRun?: boolean;
8276
+ /** Force push even if there are unsynced remote changes */
8277
+ force?: boolean;
8278
+ }
8279
+ /**
8280
+ * Result of pushState operation
8281
+ */
8282
+ interface SyncPushResult {
8283
+ /** Indicates if the operation was successful */
8284
+ success: boolean;
8285
+ /** Number of files synced */
8286
+ filesSynced: number;
8287
+ /** Name of the branch pushed from */
8288
+ sourceBranch: string;
8289
+ /** Created commit hash (null if no changes or dry-run) */
8290
+ commitHash: string | null;
8291
+ /** Created commit message */
8292
+ commitMessage: string | null;
8293
+ /** Indicates if a conflict was detected during reconciliation */
8294
+ conflictDetected: boolean;
8295
+ /** Conflict information if detected */
8296
+ conflictInfo?: ConflictInfo;
8297
+ /** Error message if operation failed */
8298
+ error?: string;
8299
+ }
8300
+ /**
8301
+ * Options for pullState operation
8302
+ */
8303
+ interface SyncPullOptions {
8304
+ /** Force re-indexing even if there are no new changes */
8305
+ forceReindex?: boolean;
8306
+ }
8307
+ /**
8308
+ * Result of pullState operation
8309
+ */
8310
+ interface SyncPullResult {
8311
+ /** Indicates if the operation was successful */
8312
+ success: boolean;
8313
+ /** Indicates if there were new remote changes */
8314
+ hasChanges: boolean;
8315
+ /** Number of files updated */
8316
+ filesUpdated: number;
8317
+ /** Indicates if re-indexing was executed */
8318
+ reindexed: boolean;
8319
+ /** Indicates if a conflict was detected during pull */
8320
+ conflictDetected: boolean;
8321
+ /** Conflict information if detected */
8322
+ conflictInfo?: ConflictInfo;
8323
+ /** Error message if operation failed */
8324
+ error?: string;
8325
+ }
8326
+ /**
8327
+ * Options for resolveConflict operation
8328
+ */
8329
+ interface SyncResolveOptions {
8330
+ /** Justification for the conflict resolution (required) */
8331
+ reason: string;
8332
+ /** Actor ID resolving the conflict (required) */
8333
+ actorId: string;
8334
+ }
8335
+ /**
8336
+ * Result of resolveConflict operation
8337
+ */
8338
+ interface SyncResolveResult {
8339
+ /** Indicates if the operation was successful */
8340
+ success: boolean;
8341
+ /** Commit hash of the created rebase commit */
8342
+ rebaseCommitHash: string;
8343
+ /** Commit hash of the signed resolution commit */
8344
+ resolutionCommitHash: string;
8345
+ /** Number of conflicts resolved */
8346
+ conflictsResolved: number;
8347
+ /** Actor ID who resolved the conflict */
8348
+ resolvedBy: string;
8349
+ /** Reason for resolution */
8350
+ reason: string;
8351
+ /** Error message if operation failed */
8352
+ error?: string;
8353
+ }
8354
+ /**
8355
+ * Detailed information about a detected conflict
8356
+ */
8357
+ interface ConflictInfo {
8358
+ /** Type of conflict detected */
8359
+ type: ConflictType;
8360
+ /** Files affected by the conflict */
8361
+ affectedFiles: string[];
8362
+ /** Descriptive message of the conflict */
8363
+ message: string;
8364
+ /** Instructions to resolve the conflict */
8365
+ resolutionSteps: string[];
8366
+ }
8367
+ /**
8368
+ * Auxiliary type to identify the conflict type
8369
+ */
8370
+ type ConflictType = "rebase_conflict" | "merge_conflict" | "integrity_violation" | "unresolved_markers";
8371
+ /**
8372
+ * Information about a detected integrity violation
8373
+ */
8374
+ interface IntegrityViolation {
8375
+ /** Commit hash of the rebase commit without resolution */
8376
+ rebaseCommitHash: string;
8377
+ /** Message of the rebase commit */
8378
+ commitMessage: string;
8379
+ /** Timestamp of the commit */
8380
+ timestamp: string;
8381
+ /** Author of the commit */
8382
+ author: string;
8383
+ }
8384
+ /**
8385
+ * Verification scope for state audit
8386
+ */
8387
+ type AuditScope = "current" | "state-branch" | "all";
8388
+ /**
8389
+ * Scope for expected files verification
8390
+ */
8391
+ type ExpectedFilesScope = "head" | "all-commits";
8392
+ /**
8393
+ * Options for state audit
8394
+ */
8395
+ interface AuditStateOptions {
8396
+ /** Verification scope: which Records to verify (default: "all") */
8397
+ scope?: AuditScope;
8398
+ /** Verify signatures in Records (default: true) */
8399
+ verifySignatures?: boolean;
8400
+ /** Verify checksums of Records (default: true) */
8401
+ verifyChecksums?: boolean;
8402
+ /** Verify that expected files exist (default: true) */
8403
+ verifyExpectedFiles?: boolean;
8404
+ /** Scope for expected files verification (default: "head") */
8405
+ expectedFilesScope?: ExpectedFilesScope;
8406
+ /** Path of specific files to audit (default: all in .gitgov/) */
8407
+ filePaths?: string[];
8408
+ }
8409
+ /**
8410
+ * Conflict diff information for a file
8411
+ */
8412
+ interface ConflictFileDiff {
8413
+ /** Path of the conflicted file */
8414
+ filePath: string;
8415
+ /** Content of the local version (ours) */
8416
+ localContent: string;
8417
+ /** Content of the remote version (theirs) */
8418
+ remoteContent: string;
8419
+ /** Base content (common ancestor) */
8420
+ baseContent: string | null;
8421
+ /** Lines with conflict markers (if they still exist) */
8422
+ conflictMarkers?: Array<{
8423
+ line: number;
8424
+ marker: string;
8425
+ }>;
8426
+ }
8427
+ /**
8428
+ * Structured conflict diff
8429
+ */
8430
+ interface ConflictDiff {
8431
+ /** Conflicted files with their diff */
8432
+ files: ConflictFileDiff[];
8433
+ /** Descriptive message of the conflict */
8434
+ message: string;
8435
+ /** Instructions to resolve */
8436
+ resolutionSteps: string[];
8437
+ }
8438
+ /**
8439
+ * Complete state audit report
8440
+ *
8441
+ * This report combines SyncModule-specific audits (rebase integrity, commits)
8442
+ * with structural validation from LintModule (signatures, checksums, schemas).
8443
+ */
8444
+ interface AuditStateReport {
8445
+ /** Indicates if the audit passed without violations */
8446
+ passed: boolean;
8447
+ /** Scope used for the audit */
8448
+ scope: AuditScope;
8449
+ /** Total commits analyzed */
8450
+ totalCommits: number;
8451
+ /** Rebase commits found */
8452
+ rebaseCommits: number;
8453
+ /** Resolution commits found */
8454
+ resolutionCommits: number;
8455
+ /** Integrity violations of resolutions (SyncModule-specific) */
8456
+ integrityViolations: IntegrityViolation[];
8457
+ /** Summary message of the audit */
8458
+ summary: string;
8459
+ /** Complete LintModule report for structural validation (signatures, checksums, schemas, etc.) */
8460
+ lintReport?: LintReport;
8461
+ }
8462
+ /**
8463
+ * Information of a changed file in the delta
8464
+ */
8465
+ interface StateDeltaFile {
8466
+ /** File status: Added, Modified, Deleted */
8467
+ status: "A" | "M" | "D";
8468
+ /** File path */
8469
+ file: string;
8470
+ }
8471
+
8472
+ /**
8473
+ * SyncModule - Manages state synchronization between local environment and gitgov-state branch
8474
+ *
8475
+ * Responsibilities:
8476
+ * - Create and maintain the gitgov-state branch (local and remote)
8477
+ * - Publish local changes (pushState)
8478
+ * - Pull remote changes (pullState)
8479
+ * - Resolve conflicts in a governed manner (resolveConflict)
8480
+ * - Audit state integrity (auditState)
8481
+ *
8482
+ * Philosophy:
8483
+ * - Pipeline Pattern: Sequential operations with validation at each phase
8484
+ * - Fail-Fast: Early verifications to avoid costly operations
8485
+ * - Strict Dependencies: All dependencies (git, config, identity, lint, indexer) are required for robust operations
8486
+ */
8487
+ declare class SyncModule {
8488
+ private git;
8489
+ private config;
8490
+ private identity;
8491
+ private lint;
8492
+ private indexer;
8493
+ /**
8494
+ * Constructor with dependency injection
8495
+ */
8496
+ constructor(dependencies: SyncModuleDependencies);
8497
+ /**
8498
+ * Static method to bootstrap .gitgov/ from gitgov-state branch.
8499
+ * Used when cloning a repo that has gitgov-state but .gitgov/ is not in the work branch.
8500
+ *
8501
+ * This method only requires GitModule and can be called before full SyncModule initialization.
8502
+ *
8503
+ * @param gitModule - GitModule instance for git operations
8504
+ * @param stateBranch - Name of the state branch (default: "gitgov-state")
8505
+ * @returns Promise<{ success: boolean; error?: string }>
8506
+ */
8507
+ static bootstrapFromStateBranch(gitModule: GitModule, stateBranch?: string): Promise<{
8508
+ success: boolean;
8509
+ error?: string;
8510
+ }>;
8511
+ /**
8512
+ * Gets the state branch name from configuration.
8513
+ * Default: "gitgov-state"
8514
+ *
8515
+ * [EARS-4]
8516
+ */
8517
+ getStateBranchName(): Promise<string>;
8518
+ /**
8519
+ * Ensures that the gitgov-state branch exists both locally and remotely.
8520
+ * If it doesn't exist, creates it as an orphan branch.
8521
+ *
8522
+ * Use cases (4 edge cases):
8523
+ * 1. Doesn't exist locally or remotely → Create orphan branch + initial commit + push
8524
+ * 2. Exists remotely, not locally → Fetch + create local + set tracking
8525
+ * 3. Exists locally, not remotely → Push + set tracking
8526
+ * 4. Exists both → Verify tracking
8527
+ *
8528
+ * [EARS-1, EARS-2, EARS-3]
8529
+ */
8530
+ ensureStateBranch(): Promise<void>;
8531
+ /**
8532
+ * Creates the gitgov-state orphan branch with an empty initial commit.
8533
+ * Used by ensureStateBranch when the branch doesn't exist locally or remotely.
8534
+ *
8535
+ * [EARS-1]
8536
+ */
8537
+ private createOrphanStateBranch;
8538
+ /**
8539
+ * Calculates the file delta in .gitgov/ between the current branch and gitgov-state.
8540
+ *
8541
+ * [EARS-5]
8542
+ */
8543
+ calculateStateDelta(sourceBranch: string): Promise<StateDeltaFile[]>;
8544
+ /**
8545
+ * Checks if a rebase is in progress.
8546
+ *
8547
+ * [EARS-22]
8548
+ */
8549
+ isRebaseInProgress(): Promise<boolean>;
8550
+ /**
8551
+ * Checks for absence of conflict markers in specified files.
8552
+ * Returns list of files that still have markers.
8553
+ *
8554
+ * [EARS-23]
8555
+ */
8556
+ checkConflictMarkers(filePaths: string[]): Promise<string[]>;
8557
+ /**
8558
+ * Gets the diff of conflicted files for manual analysis.
8559
+ * Useful so the actor can analyze conflicted changes before resolving.
8560
+ *
8561
+ * [EARS-31]
8562
+ */
8563
+ getConflictDiff(filePaths?: string[]): Promise<ConflictDiff>;
8564
+ /**
8565
+ * Verifies integrity of previous resolutions in gitgov-state history.
8566
+ * Returns list of violations if any exist.
8567
+ *
8568
+ * [EARS-24, EARS-25, EARS-26]
8569
+ */
8570
+ verifyResolutionIntegrity(): Promise<IntegrityViolation[]>;
8571
+ /**
8572
+ * Complete audit of gitgov-state status.
8573
+ * Verifies integrity of resolutions, signatures in Records, checksums and expected files.
8574
+ *
8575
+ * [EARS-27, EARS-28, EARS-29, EARS-30]
8576
+ */
8577
+ auditState(options?: AuditStateOptions): Promise<AuditStateReport>;
8578
+ /**
8579
+ * Publishes local state changes to gitgov-state.
8580
+ * Implements 3 phases: verification, reconciliation, publication.
8581
+ *
8582
+ * [EARS-6 through EARS-12]
8583
+ */
8584
+ pushState(options: SyncPushOptions): Promise<SyncPushResult>;
8585
+ /**
8586
+ * Pulls remote changes from gitgov-state to the local environment.
8587
+ * Includes automatic re-indexing if there are new changes.
8588
+ *
8589
+ * [EARS-13 through EARS-16]
8590
+ * [EARS-44] Requires remote to be configured (pull without remote makes no sense)
8591
+ */
8592
+ pullState(options?: SyncPullOptions): Promise<SyncPullResult>;
8593
+ /**
8594
+ * Resolves state conflicts in a governed manner.
8595
+ * Updates resolved Records (recalculates checksum and adds resolver signature),
8596
+ * creates rebase and resolution commits signed according to protocol.
8597
+ *
8598
+ * [EARS-17 through EARS-23]
8599
+ */
8600
+ resolveConflict(options: SyncResolveOptions): Promise<SyncResolveResult>;
8601
+ }
8602
+
8603
+ /**
8604
+ * PullScheduler - Periodic State Synchronization
8605
+ *
8606
+ * Background scheduler that automatically pulls state changes from remote
8607
+ * at configured intervals.
8608
+ *
8609
+ * @module sync/pull_scheduler
8610
+ */
8611
+
8612
+ /**
8613
+ * Result of a pull operation executed by the scheduler
8614
+ */
8615
+ interface PullSchedulerResult {
8616
+ /** Whether the operation was successful */
8617
+ success: boolean;
8618
+ /** Whether new changes were detected */
8619
+ hasChanges: boolean;
8620
+ /** Whether a conflict was detected */
8621
+ conflictDetected: boolean;
8622
+ /** Conflict information if applicable */
8623
+ conflictInfo?: {
8624
+ type: string;
8625
+ message: string;
8626
+ affectedFiles?: string[];
8627
+ };
8628
+ /** Timestamp of the operation */
8629
+ timestamp: string;
8630
+ /** Error if operation failed */
8631
+ error?: string;
8632
+ }
8633
+ /**
8634
+ * Configuration for the PullScheduler
8635
+ */
8636
+ interface PullSchedulerConfig {
8637
+ /** Whether the scheduler is enabled */
8638
+ enabled: boolean;
8639
+ /** Pull interval in seconds */
8640
+ pullIntervalSeconds: number;
8641
+ /** Whether to continue after network errors */
8642
+ continueOnNetworkError: boolean;
8643
+ /** Whether to stop if a conflict is detected */
8644
+ stopOnConflict: boolean;
8645
+ }
8646
+ /**
8647
+ * Dependencies required by PullScheduler
8648
+ */
8649
+ interface PullSchedulerDependencies {
8650
+ /** SyncModule for pull operations */
8651
+ syncModule: SyncModule;
8652
+ /** ConfigManager for loading configuration */
8653
+ configManager: ConfigManager;
8654
+ }
8655
+ /**
8656
+ * PullScheduler - Automatic background synchronization
8657
+ *
8658
+ * Periodically pulls state changes from remote to keep local state up-to-date.
8659
+ * Useful for collaboration scenarios where multiple actors are working simultaneously.
8660
+ *
8661
+ * [EARS-33 to EARS-40]
8662
+ *
8663
+ * @example
8664
+ * ```typescript
8665
+ * const scheduler = new PullScheduler({
8666
+ * syncModule,
8667
+ * configManager
8668
+ * });
8669
+ *
8670
+ * await scheduler.start(); // Start periodic pulling
8671
+ * // ... scheduler runs in background ...
8672
+ * scheduler.stop(); // Stop scheduler
8673
+ * ```
8674
+ */
8675
+ declare class PullScheduler {
8676
+ private syncModule;
8677
+ private configManager;
8678
+ private config;
8679
+ private intervalId?;
8680
+ private running;
8681
+ private pulling;
8682
+ constructor(dependencies: PullSchedulerDependencies);
8683
+ /**
8684
+ * Loads configuration from ConfigManager with cascade merge:
8685
+ * 1. Local preferences in .session.json (highest priority)
8686
+ * 2. Project defaults in config.json
8687
+ * 3. Hardcoded defaults (fallback)
8688
+ */
8689
+ private loadConfig;
8690
+ /**
8691
+ * Starts the scheduler with configured interval
8692
+ *
8693
+ * [EARS-33, EARS-34]
8694
+ *
8695
+ * @throws Error if scheduler fails to load configuration
8696
+ *
8697
+ * @example
8698
+ * ```typescript
8699
+ * await scheduler.start();
8700
+ * // Scheduler now pulls every N seconds
8701
+ * ```
8702
+ */
8703
+ start(): Promise<void>;
8704
+ /**
8705
+ * Stops the scheduler and cleans up resources
8706
+ *
8707
+ * [EARS-35]
8708
+ *
8709
+ * @example
8710
+ * ```typescript
8711
+ * scheduler.stop();
8712
+ * // Scheduler is now stopped
8713
+ * ```
8714
+ */
8715
+ stop(): void;
8716
+ /**
8717
+ * Checks if the scheduler is currently running
8718
+ *
8719
+ * [EARS-36]
8720
+ *
8721
+ * @returns true if running, false otherwise
8722
+ *
8723
+ * @example
8724
+ * ```typescript
8725
+ * if (scheduler.isRunning()) {
8726
+ * console.log("Scheduler is active");
8727
+ * }
8728
+ * ```
8729
+ */
8730
+ isRunning(): boolean;
8731
+ /**
8732
+ * Executes a pull operation immediately
8733
+ *
8734
+ * This method can be called manually or is automatically invoked by the scheduler.
8735
+ * Handles conflicts, network errors, and concurrent pull prevention.
8736
+ *
8737
+ * [EARS-37, EARS-38, EARS-39, EARS-40]
8738
+ *
8739
+ * @returns Result of the pull operation
8740
+ *
8741
+ * @example
8742
+ * ```typescript
8743
+ * const result = await scheduler.pullNow();
8744
+ * if (result.hasChanges) {
8745
+ * console.log("New changes detected");
8746
+ * }
8747
+ * ```
8748
+ */
8749
+ pullNow(): Promise<PullSchedulerResult>;
8750
+ }
8751
+
8752
+ /**
8753
+ * Base error class for all sync-related errors
8754
+ */
8755
+ declare class SyncError extends Error {
8756
+ constructor(message: string);
8757
+ }
8758
+ /**
8759
+ * Error thrown when attempting to push from gitgov-state branch
8760
+ */
8761
+ declare class PushFromStateBranchError extends SyncError {
8762
+ branch: string;
8763
+ constructor(branchName: string);
8764
+ }
8765
+ /**
8766
+ * Error thrown when integrity violations are detected during audit
8767
+ */
8768
+ declare class IntegrityViolationError extends SyncError {
8769
+ violations: Array<{
8770
+ type: "resolution" | "signature" | "checksum" | "missing_file";
8771
+ details: string;
8772
+ }>;
8773
+ constructor(violations: Array<{
8774
+ type: "resolution" | "signature" | "checksum" | "missing_file";
8775
+ details: string;
8776
+ }>);
8777
+ }
8778
+ /**
8779
+ * Error thrown when conflict markers are still present in files
8780
+ */
8781
+ declare class ConflictMarkersPresentError extends SyncError {
8782
+ filesWithMarkers: string[];
8783
+ constructor(filesWithMarkers: string[]);
8784
+ }
8785
+ /**
8786
+ * Error thrown when attempting to resolve conflict without rebase in progress
8787
+ */
8788
+ declare class NoRebaseInProgressError extends SyncError {
8789
+ constructor();
8790
+ }
8791
+ /**
8792
+ * Error thrown when CryptoModule is required but not available
8793
+ */
8794
+ declare class CryptoModuleRequiredError extends SyncError {
8795
+ constructor(operation: string);
8796
+ }
8797
+ /**
8798
+ * Error thrown when state branch cannot be created or configured
8799
+ */
8800
+ declare class StateBranchSetupError extends SyncError {
8801
+ reason: string;
8802
+ underlyingError?: Error | undefined;
8803
+ constructor(reason: string, underlyingError?: Error | undefined);
8804
+ }
8805
+ /**
8806
+ * Error thrown when uncommitted changes exist in state branch
8807
+ */
8808
+ declare class UncommittedChangesError extends SyncError {
8809
+ branch: string;
8810
+ constructor(branchName: string);
8811
+ }
8812
+ /**
8813
+ * Type guards for error handling
8814
+ *
8815
+ * These functions enable type-safe error handling by narrowing the error type.
8816
+ * They are additive and don't break any existing code.
8817
+ *
8818
+ * Example usage:
8819
+ * ```typescript
8820
+ * try {
8821
+ * await syncModule.pushState(options);
8822
+ * } catch (error) {
8823
+ * if (isPushFromStateBranchError(error)) {
8824
+ * // TypeScript knows error.branch exists here
8825
+ * console.log(`Cannot push from ${error.branch}`);
8826
+ * }
8827
+ * }
8828
+ * ```
8829
+ */
8830
+ declare function isSyncError(error: unknown): error is SyncError;
8831
+ declare function isPushFromStateBranchError(error: unknown): error is PushFromStateBranchError;
8832
+ declare function isIntegrityViolationError(error: unknown): error is IntegrityViolationError;
8833
+ declare function isConflictMarkersPresentError(error: unknown): error is ConflictMarkersPresentError;
8834
+ declare function isUncommittedChangesError(error: unknown): error is UncommittedChangesError;
8835
+ declare function isNoRebaseInProgressError(error: unknown): error is NoRebaseInProgressError;
8836
+ declare function isStateBranchSetupError(error: unknown): error is StateBranchSetupError;
8837
+ declare function isCryptoModuleRequiredError(error: unknown): error is CryptoModuleRequiredError;
8838
+
8839
+ type index$2_AuditScope = AuditScope;
8840
+ type index$2_AuditStateOptions = AuditStateOptions;
8841
+ type index$2_AuditStateReport = AuditStateReport;
8842
+ type index$2_ConflictDiff = ConflictDiff;
8843
+ type index$2_ConflictFileDiff = ConflictFileDiff;
8844
+ type index$2_ConflictInfo = ConflictInfo;
8845
+ type index$2_ConflictMarkersPresentError = ConflictMarkersPresentError;
8846
+ declare const index$2_ConflictMarkersPresentError: typeof ConflictMarkersPresentError;
8847
+ type index$2_ConflictType = ConflictType;
8848
+ type index$2_CryptoModuleRequiredError = CryptoModuleRequiredError;
8849
+ declare const index$2_CryptoModuleRequiredError: typeof CryptoModuleRequiredError;
8850
+ type index$2_ExpectedFilesScope = ExpectedFilesScope;
8851
+ type index$2_IntegrityViolation = IntegrityViolation;
8852
+ type index$2_IntegrityViolationError = IntegrityViolationError;
8853
+ declare const index$2_IntegrityViolationError: typeof IntegrityViolationError;
8854
+ type index$2_NoRebaseInProgressError = NoRebaseInProgressError;
8855
+ declare const index$2_NoRebaseInProgressError: typeof NoRebaseInProgressError;
8856
+ type index$2_PullScheduler = PullScheduler;
8857
+ declare const index$2_PullScheduler: typeof PullScheduler;
8858
+ type index$2_PullSchedulerConfig = PullSchedulerConfig;
8859
+ type index$2_PullSchedulerDependencies = PullSchedulerDependencies;
8860
+ type index$2_PullSchedulerResult = PullSchedulerResult;
8861
+ type index$2_PushFromStateBranchError = PushFromStateBranchError;
8862
+ declare const index$2_PushFromStateBranchError: typeof PushFromStateBranchError;
8863
+ type index$2_StateBranchSetupError = StateBranchSetupError;
8864
+ declare const index$2_StateBranchSetupError: typeof StateBranchSetupError;
8865
+ type index$2_StateDeltaFile = StateDeltaFile;
8866
+ type index$2_SyncError = SyncError;
8867
+ declare const index$2_SyncError: typeof SyncError;
8868
+ type index$2_SyncModule = SyncModule;
8869
+ declare const index$2_SyncModule: typeof SyncModule;
8870
+ type index$2_SyncModuleDependencies = SyncModuleDependencies;
8871
+ type index$2_SyncPullOptions = SyncPullOptions;
8872
+ type index$2_SyncPullResult = SyncPullResult;
8873
+ type index$2_SyncPushOptions = SyncPushOptions;
8874
+ type index$2_SyncPushResult = SyncPushResult;
8875
+ type index$2_SyncResolveOptions = SyncResolveOptions;
8876
+ type index$2_SyncResolveResult = SyncResolveResult;
8877
+ type index$2_UncommittedChangesError = UncommittedChangesError;
8878
+ declare const index$2_UncommittedChangesError: typeof UncommittedChangesError;
8879
+ declare const index$2_isConflictMarkersPresentError: typeof isConflictMarkersPresentError;
8880
+ declare const index$2_isCryptoModuleRequiredError: typeof isCryptoModuleRequiredError;
8881
+ declare const index$2_isIntegrityViolationError: typeof isIntegrityViolationError;
8882
+ declare const index$2_isNoRebaseInProgressError: typeof isNoRebaseInProgressError;
8883
+ declare const index$2_isPushFromStateBranchError: typeof isPushFromStateBranchError;
8884
+ declare const index$2_isStateBranchSetupError: typeof isStateBranchSetupError;
8885
+ declare const index$2_isSyncError: typeof isSyncError;
8886
+ declare const index$2_isUncommittedChangesError: typeof isUncommittedChangesError;
6533
8887
  declare namespace index$2 {
6534
- 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 };
8888
+ 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 };
6535
8889
  }
6536
8890
 
6537
8891
  /**
@@ -6707,11 +9061,6 @@ declare function validateEmbeddedMetadataDetailed(data: unknown): ValidationResu
6707
9061
  * Full validation for EmbeddedMetadataRecord including schema, checksum, and signatures
6708
9062
  */
6709
9063
  declare function validateFullEmbeddedMetadataRecord<T extends GitGovRecordPayload>(record: EmbeddedMetadataRecord<T>, getActorPublicKey: (keyId: string) => Promise<string | null>): Promise<void>;
6710
- /**
6711
- * Business rules validation for EmbeddedMetadata
6712
- * Validates conditional requirements based on header.type
6713
- */
6714
- declare function validateEmbeddedMetadataBusinessRules<T extends GitGovRecordPayload>(data: EmbeddedMetadataRecord<T>): ValidationResult;
6715
9064
 
6716
9065
  declare function validateWorkflowMethodologyConfigSchema(data: unknown): [boolean, ValidateFunction["errors"]];
6717
9066
  /**
@@ -6762,7 +9111,6 @@ declare const index$1_validateChangelogRecordDetailed: typeof validateChangelogR
6762
9111
  declare const index$1_validateChangelogRecordSchema: typeof validateChangelogRecordSchema;
6763
9112
  declare const index$1_validateCycleRecordDetailed: typeof validateCycleRecordDetailed;
6764
9113
  declare const index$1_validateCycleRecordSchema: typeof validateCycleRecordSchema;
6765
- declare const index$1_validateEmbeddedMetadataBusinessRules: typeof validateEmbeddedMetadataBusinessRules;
6766
9114
  declare const index$1_validateEmbeddedMetadataDetailed: typeof validateEmbeddedMetadataDetailed;
6767
9115
  declare const index$1_validateEmbeddedMetadataSchema: typeof validateEmbeddedMetadataSchema;
6768
9116
  declare const index$1_validateExecutionRecordDetailed: typeof validateExecutionRecordDetailed;
@@ -6783,7 +9131,7 @@ declare const index$1_validateWorkflowMethodologyConfigBusinessRules: typeof val
6783
9131
  declare const index$1_validateWorkflowMethodologyConfigDetailed: typeof validateWorkflowMethodologyConfigDetailed;
6784
9132
  declare const index$1_validateWorkflowMethodologyConfigSchema: typeof validateWorkflowMethodologyConfigSchema;
6785
9133
  declare namespace index$1 {
6786
- export { type index$1_ValidationResult as ValidationResult, index$1_isActorRecord as isActorRecord, index$1_isAgentRecord as isAgentRecord, index$1_isChangelogRecord as isChangelogRecord, index$1_isCycleRecord as isCycleRecord, index$1_isEmbeddedMetadataRecord as isEmbeddedMetadataRecord, index$1_isExecutionRecord as isExecutionRecord, index$1_isFeedbackRecord as isFeedbackRecord, index$1_isTaskRecord as isTaskRecord, index$1_isWorkflowMethodologyConfig as isWorkflowMethodologyConfig, index$1_validateActorRecordDetailed as validateActorRecordDetailed, index$1_validateActorRecordSchema as validateActorRecordSchema, index$1_validateAgentActorRelationship as validateAgentActorRelationship, index$1_validateAgentRecordDetailed as validateAgentRecordDetailed, index$1_validateAgentRecordSchema as validateAgentRecordSchema, index$1_validateChangelogRecordDetailed as validateChangelogRecordDetailed, index$1_validateChangelogRecordSchema as validateChangelogRecordSchema, index$1_validateCycleRecordDetailed as validateCycleRecordDetailed, index$1_validateCycleRecordSchema as validateCycleRecordSchema, index$1_validateEmbeddedMetadataBusinessRules as validateEmbeddedMetadataBusinessRules, index$1_validateEmbeddedMetadataDetailed as validateEmbeddedMetadataDetailed, index$1_validateEmbeddedMetadataSchema as validateEmbeddedMetadataSchema, index$1_validateExecutionRecordDetailed as validateExecutionRecordDetailed, index$1_validateExecutionRecordSchema as validateExecutionRecordSchema, index$1_validateFeedbackRecordDetailed as validateFeedbackRecordDetailed, index$1_validateFeedbackRecordSchema as validateFeedbackRecordSchema, index$1_validateFullActorRecord as validateFullActorRecord, index$1_validateFullAgentRecord as validateFullAgentRecord, index$1_validateFullChangelogRecord as validateFullChangelogRecord, index$1_validateFullCycleRecord as validateFullCycleRecord, index$1_validateFullEmbeddedMetadataRecord as validateFullEmbeddedMetadataRecord, index$1_validateFullExecutionRecord as validateFullExecutionRecord, index$1_validateFullFeedbackRecord as validateFullFeedbackRecord, index$1_validateFullTaskRecord as validateFullTaskRecord, index$1_validateTaskRecordDetailed as validateTaskRecordDetailed, index$1_validateTaskRecordSchema as validateTaskRecordSchema, index$1_validateWorkflowMethodologyConfigBusinessRules as validateWorkflowMethodologyConfigBusinessRules, index$1_validateWorkflowMethodologyConfigDetailed as validateWorkflowMethodologyConfigDetailed, index$1_validateWorkflowMethodologyConfigSchema as validateWorkflowMethodologyConfigSchema };
9134
+ export { type index$1_ValidationResult as ValidationResult, index$1_isActorRecord as isActorRecord, index$1_isAgentRecord as isAgentRecord, index$1_isChangelogRecord as isChangelogRecord, index$1_isCycleRecord as isCycleRecord, index$1_isEmbeddedMetadataRecord as isEmbeddedMetadataRecord, index$1_isExecutionRecord as isExecutionRecord, index$1_isFeedbackRecord as isFeedbackRecord, index$1_isTaskRecord as isTaskRecord, index$1_isWorkflowMethodologyConfig as isWorkflowMethodologyConfig, index$1_validateActorRecordDetailed as validateActorRecordDetailed, index$1_validateActorRecordSchema as validateActorRecordSchema, index$1_validateAgentActorRelationship as validateAgentActorRelationship, index$1_validateAgentRecordDetailed as validateAgentRecordDetailed, index$1_validateAgentRecordSchema as validateAgentRecordSchema, index$1_validateChangelogRecordDetailed as validateChangelogRecordDetailed, index$1_validateChangelogRecordSchema as validateChangelogRecordSchema, index$1_validateCycleRecordDetailed as validateCycleRecordDetailed, index$1_validateCycleRecordSchema as validateCycleRecordSchema, index$1_validateEmbeddedMetadataDetailed as validateEmbeddedMetadataDetailed, index$1_validateEmbeddedMetadataSchema as validateEmbeddedMetadataSchema, index$1_validateExecutionRecordDetailed as validateExecutionRecordDetailed, index$1_validateExecutionRecordSchema as validateExecutionRecordSchema, index$1_validateFeedbackRecordDetailed as validateFeedbackRecordDetailed, index$1_validateFeedbackRecordSchema as validateFeedbackRecordSchema, index$1_validateFullActorRecord as validateFullActorRecord, index$1_validateFullAgentRecord as validateFullAgentRecord, index$1_validateFullChangelogRecord as validateFullChangelogRecord, index$1_validateFullCycleRecord as validateFullCycleRecord, index$1_validateFullEmbeddedMetadataRecord as validateFullEmbeddedMetadataRecord, index$1_validateFullExecutionRecord as validateFullExecutionRecord, index$1_validateFullFeedbackRecord as validateFullFeedbackRecord, index$1_validateFullTaskRecord as validateFullTaskRecord, index$1_validateTaskRecordDetailed as validateTaskRecordDetailed, index$1_validateTaskRecordSchema as validateTaskRecordSchema, index$1_validateWorkflowMethodologyConfigBusinessRules as validateWorkflowMethodologyConfigBusinessRules, index$1_validateWorkflowMethodologyConfigDetailed as validateWorkflowMethodologyConfigDetailed, index$1_validateWorkflowMethodologyConfigSchema as validateWorkflowMethodologyConfigSchema };
6787
9135
  }
6788
9136
 
6789
9137
  interface DiagramNode {
@@ -7077,4 +9425,4 @@ declare namespace index {
7077
9425
  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 };
7078
9426
  }
7079
9427
 
7080
- export { index$6 as Adapters, index$a as BacklogAdapter, index$d as ChangelogAdapter, index$8 as Config, index$5 as Crypto, index as DiagramGenerator, index$h as EventBus, index$e as ExecutionAdapter, index$4 as Factories, index$f as FeedbackAdapter, index$g as IdentityAdapter, index$9 as IndexerAdapter, index$3 as Logger, index$c as MetricsAdapter, index$7 as ProjectAdapter, index$j as Records, index$2 as Schemas, index$i as Store, index$1 as Validation, index$b as WorkflowMethodologyAdapter };
9428
+ 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 };