@gitgov/core 1.6.3 → 1.7.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$k_ActorPayload = ActorPayload;
755
+ type index$k_ActorRecord = ActorRecord;
756
+ type index$k_AgentPayload = AgentPayload;
757
+ type index$k_AgentRecord = AgentRecord;
758
+ type index$k_ChangelogPayload = ChangelogPayload;
759
+ type index$k_ChangelogRecord = ChangelogRecord;
760
+ type index$k_CustomRecord = CustomRecord;
761
+ type index$k_CyclePayload = CyclePayload;
762
+ type index$k_CycleRecord = CycleRecord;
763
+ type index$k_EmbeddedMetadataHeader = EmbeddedMetadataHeader;
764
+ type index$k_EmbeddedMetadataRecord<T extends GitGovRecordPayload> = EmbeddedMetadataRecord<T>;
765
+ type index$k_ExecutionPayload = ExecutionPayload;
766
+ type index$k_ExecutionRecord = ExecutionRecord;
767
+ type index$k_FeedbackPayload = FeedbackPayload;
768
+ type index$k_FeedbackRecord = FeedbackRecord;
769
+ type index$k_GitGovActorRecord = GitGovActorRecord;
770
+ type index$k_GitGovAgentRecord = GitGovAgentRecord;
771
+ type index$k_GitGovChangelogRecord = GitGovChangelogRecord;
772
+ type index$k_GitGovCycleRecord = GitGovCycleRecord;
773
+ type index$k_GitGovError = GitGovError;
774
+ declare const index$k_GitGovError: typeof GitGovError;
775
+ type index$k_GitGovExecutionRecord = GitGovExecutionRecord;
776
+ type index$k_GitGovFeedbackRecord = GitGovFeedbackRecord;
777
+ type index$k_GitGovRecord = GitGovRecord;
778
+ type index$k_GitGovRecordPayload = GitGovRecordPayload;
779
+ type index$k_GitGovRecordType = GitGovRecordType;
780
+ type index$k_GitGovTaskRecord = GitGovTaskRecord;
781
+ type index$k_Signature = Signature;
782
+ type index$k_TaskPayload = TaskPayload;
783
+ type index$k_TaskRecord = TaskRecord;
784
+ type index$k_WorkflowMethodologyRecord = WorkflowMethodologyRecord;
785
+ declare namespace index$k {
786
+ export { type index$k_ActorPayload as ActorPayload, type index$k_ActorRecord as ActorRecord, type index$k_AgentPayload as AgentPayload, type index$k_AgentRecord as AgentRecord, type index$k_ChangelogPayload as ChangelogPayload, type index$k_ChangelogRecord as ChangelogRecord, type index$k_CustomRecord as CustomRecord, type index$k_CyclePayload as CyclePayload, type index$k_CycleRecord as CycleRecord, type index$k_EmbeddedMetadataHeader as EmbeddedMetadataHeader, type index$k_EmbeddedMetadataRecord as EmbeddedMetadataRecord, type index$k_ExecutionPayload as ExecutionPayload, type index$k_ExecutionRecord as ExecutionRecord, type index$k_FeedbackPayload as FeedbackPayload, type index$k_FeedbackRecord as FeedbackRecord, type index$k_GitGovActorRecord as GitGovActorRecord, type index$k_GitGovAgentRecord as GitGovAgentRecord, type index$k_GitGovChangelogRecord as GitGovChangelogRecord, type index$k_GitGovCycleRecord as GitGovCycleRecord, index$k_GitGovError as GitGovError, type index$k_GitGovExecutionRecord as GitGovExecutionRecord, type index$k_GitGovFeedbackRecord as GitGovFeedbackRecord, type index$k_GitGovRecord as GitGovRecord, type index$k_GitGovRecordPayload as GitGovRecordPayload, type index$k_GitGovRecordType as GitGovRecordType, type index$k_GitGovTaskRecord as GitGovTaskRecord, type index$k_Signature as Signature, type index$k_TaskPayload as TaskPayload, type index$k_TaskRecord as TaskRecord, type index$k_WorkflowMethodologyRecord as WorkflowMethodologyRecord };
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$j_FsDependencies = FsDependencies;
820
+ type index$j_RecordStore<T extends StorablePayload$1> = RecordStore<T>;
821
+ declare const index$j_RecordStore: typeof RecordStore;
822
+ declare namespace index$j {
823
+ export { type index$j_FsDependencies as FsDependencies, index$j_RecordStore as RecordStore };
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$i_ActivityEvent = ActivityEvent;
1184
+ type index$i_ActorCreatedEvent = ActorCreatedEvent;
1185
+ type index$i_ActorRevokedEvent = ActorRevokedEvent;
1186
+ type index$i_AgentRegisteredEvent = AgentRegisteredEvent;
1187
+ type index$i_BaseEvent = BaseEvent;
1188
+ type index$i_ChangelogCreatedEvent = ChangelogCreatedEvent;
1189
+ type index$i_CycleCreatedEvent = CycleCreatedEvent;
1190
+ type index$i_CycleStatusChangedEvent = CycleStatusChangedEvent;
1191
+ type index$i_EventBus = EventBus;
1192
+ declare const index$i_EventBus: typeof EventBus;
1193
+ type index$i_EventHandler<T extends BaseEvent = BaseEvent> = EventHandler<T>;
1194
+ type index$i_EventMetadata = EventMetadata;
1195
+ type index$i_EventSubscription = EventSubscription;
1196
+ type index$i_ExecutionCreatedEvent = ExecutionCreatedEvent;
1197
+ type index$i_FeedbackCreatedEvent = FeedbackCreatedEvent;
1198
+ type index$i_GitGovEvent = GitGovEvent;
1199
+ type index$i_IEventStream = IEventStream;
1200
+ type index$i_SystemDailyTickEvent = SystemDailyTickEvent;
1201
+ type index$i_TaskCreatedEvent = TaskCreatedEvent;
1202
+ type index$i_TaskStatusChangedEvent = TaskStatusChangedEvent;
1203
+ declare const index$i_eventBus: typeof eventBus;
1204
+ declare const index$i_publishEvent: typeof publishEvent;
1205
+ declare const index$i_subscribeToEvent: typeof subscribeToEvent;
1206
+ declare namespace index$i {
1207
+ export { type index$i_ActivityEvent as ActivityEvent, type index$i_ActorCreatedEvent as ActorCreatedEvent, type index$i_ActorRevokedEvent as ActorRevokedEvent, type index$i_AgentRegisteredEvent as AgentRegisteredEvent, type index$i_BaseEvent as BaseEvent, type index$i_ChangelogCreatedEvent as ChangelogCreatedEvent, type index$i_CycleCreatedEvent as CycleCreatedEvent, type index$i_CycleStatusChangedEvent as CycleStatusChangedEvent, index$i_EventBus as EventBus, type index$i_EventHandler as EventHandler, type index$i_EventMetadata as EventMetadata, type index$i_EventSubscription as EventSubscription, type index$i_ExecutionCreatedEvent as ExecutionCreatedEvent, type index$i_FeedbackCreatedEvent as FeedbackCreatedEvent, type index$i_GitGovEvent as GitGovEvent, type index$i_IEventStream as IEventStream, type index$i_SystemDailyTickEvent as SystemDailyTickEvent, type index$i_TaskCreatedEvent as TaskCreatedEvent, type index$i_TaskStatusChangedEvent as TaskStatusChangedEvent, index$i_eventBus as eventBus, index$i_publishEvent as publishEvent, index$i_subscribeToEvent as subscribeToEvent };
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$h_IIdentityAdapter = IIdentityAdapter;
1288
+ type index$h_IdentityAdapter = IdentityAdapter;
1289
+ declare const index$h_IdentityAdapter: typeof IdentityAdapter;
1290
+ type index$h_IdentityAdapterDependencies = IdentityAdapterDependencies;
1291
+ declare namespace index$h {
1292
+ export { type index$h_IIdentityAdapter as IIdentityAdapter, index$h_IdentityAdapter as IdentityAdapter, type index$h_IdentityAdapterDependencies as IdentityAdapterDependencies };
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$g_FeedbackAdapter = FeedbackAdapter;
1411
+ declare const index$g_FeedbackAdapter: typeof FeedbackAdapter;
1412
+ type index$g_FeedbackAdapterDependencies = FeedbackAdapterDependencies;
1413
+ type index$g_FeedbackThread = FeedbackThread;
1414
+ type index$g_IFeedbackAdapter = IFeedbackAdapter;
1415
+ declare namespace index$g {
1416
+ export { index$g_FeedbackAdapter as FeedbackAdapter, type index$g_FeedbackAdapterDependencies as FeedbackAdapterDependencies, type index$g_FeedbackThread as FeedbackThread, type index$g_IFeedbackAdapter as IFeedbackAdapter };
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$f_ExecutionAdapter = ExecutionAdapter;
1505
+ declare const index$f_ExecutionAdapter: typeof ExecutionAdapter;
1506
+ type index$f_ExecutionAdapterDependencies = ExecutionAdapterDependencies;
1507
+ type index$f_IExecutionAdapter = IExecutionAdapter;
1508
+ declare namespace index$f {
1509
+ export { index$f_ExecutionAdapter as ExecutionAdapter, type index$f_ExecutionAdapterDependencies as ExecutionAdapterDependencies, type index$f_IExecutionAdapter as IExecutionAdapter };
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$e_ChangelogAdapter = ChangelogAdapter;
1603
+ declare const index$e_ChangelogAdapter: typeof ChangelogAdapter;
1604
+ type index$e_ChangelogAdapterDependencies = ChangelogAdapterDependencies;
1605
+ type index$e_ChangelogListOptions = ChangelogListOptions;
1606
+ type index$e_IChangelogAdapter = IChangelogAdapter;
1607
+ declare namespace index$e {
1608
+ export { index$e_ChangelogAdapter as ChangelogAdapter, type index$e_ChangelogAdapterDependencies as ChangelogAdapterDependencies, type index$e_ChangelogListOptions as ChangelogListOptions, type index$e_IChangelogAdapter as IChangelogAdapter };
1606
1609
  }
1607
1610
 
1608
1611
  /**
@@ -1787,20 +1790,20 @@ 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$d_CollaborationMetrics = CollaborationMetrics;
1794
+ type index$d_IMetricsAdapter = IMetricsAdapter;
1795
+ type index$d_MetricsAdapter = MetricsAdapter;
1796
+ declare const index$d_MetricsAdapter: typeof MetricsAdapter;
1797
+ type index$d_MetricsAdapterDependencies = MetricsAdapterDependencies;
1798
+ type index$d_ProductivityMetrics = ProductivityMetrics;
1799
+ type index$d_SystemStatus = SystemStatus;
1800
+ type index$d_TaskHealthReport = TaskHealthReport;
1801
+ declare namespace index$d {
1802
+ export { type index$d_CollaborationMetrics as CollaborationMetrics, type index$d_IMetricsAdapter as IMetricsAdapter, index$d_MetricsAdapter as MetricsAdapter, type index$d_MetricsAdapterDependencies as MetricsAdapterDependencies, type index$d_ProductivityMetrics as ProductivityMetrics, type index$d_SystemStatus as SystemStatus, type index$d_TaskHealthReport as TaskHealthReport };
1800
1803
  }
1801
1804
 
1802
1805
  type TaskStatus = TaskRecord['status'];
1803
- type ValidationContext = {
1806
+ type ValidationContext$1 = {
1804
1807
  task: TaskRecord;
1805
1808
  actor?: ActorRecord;
1806
1809
  signatures?: Signature[];
@@ -1814,9 +1817,9 @@ type TransitionRule = {
1814
1817
  };
1815
1818
  type ViewConfig = NonNullable<WorkflowMethodologyRecord['view_configs']>[string];
1816
1819
  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>;
1820
+ getTransitionRule(from: TaskStatus, to: TaskStatus, context: ValidationContext$1): Promise<TransitionRule | null>;
1821
+ validateSignature(signature: Signature, context: ValidationContext$1): Promise<boolean>;
1822
+ validateCustomRules(rules: string[], context: ValidationContext$1): Promise<boolean>;
1820
1823
  getViewConfig(viewName: string): Promise<ViewConfig | null>;
1821
1824
  getAvailableTransitions(from: TaskStatus): Promise<TransitionRule[]>;
1822
1825
  }
@@ -1852,11 +1855,11 @@ declare class WorkflowMethodologyAdapter implements IWorkflowMethodology {
1852
1855
  /**
1853
1856
  * Determines if a state transition is legal according to the methodology
1854
1857
  */
1855
- getTransitionRule(from: TaskStatus, to: TaskStatus, _context: ValidationContext): Promise<TransitionRule | null>;
1858
+ getTransitionRule(from: TaskStatus, to: TaskStatus, _context: ValidationContext$1): Promise<TransitionRule | null>;
1856
1859
  /**
1857
1860
  * Validates if an actor's signature meets the requirements for a transition
1858
1861
  */
1859
- validateSignature(signature: Signature, context: ValidationContext): Promise<boolean>;
1862
+ validateSignature(signature: Signature, context: ValidationContext$1): Promise<boolean>;
1860
1863
  /**
1861
1864
  * Gets view configuration for mapping states to visual columns
1862
1865
  */
@@ -1864,17 +1867,16 @@ declare class WorkflowMethodologyAdapter implements IWorkflowMethodology {
1864
1867
  /**
1865
1868
  * Validates custom rules for a given context
1866
1869
  */
1867
- validateCustomRules(rules: string[], context: ValidationContext): Promise<boolean>;
1870
+ validateCustomRules(rules: string[], context: ValidationContext$1): Promise<boolean>;
1868
1871
  getAvailableTransitions(from: TaskStatus): Promise<TransitionRule[]>;
1869
1872
  }
1870
1873
 
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 };
1874
+ type index$c_IWorkflowMethodology = IWorkflowMethodology;
1875
+ type index$c_WorkflowMethodologyAdapter = WorkflowMethodologyAdapter;
1876
+ declare const index$c_WorkflowMethodologyAdapter: typeof WorkflowMethodologyAdapter;
1877
+ type index$c_WorkflowMethodologyAdapterDependencies = WorkflowMethodologyAdapterDependencies;
1878
+ declare namespace index$c {
1879
+ export { type index$c_IWorkflowMethodology as IWorkflowMethodology, type ValidationContext$1 as ValidationContext, index$c_WorkflowMethodologyAdapter as WorkflowMethodologyAdapter, type index$c_WorkflowMethodologyAdapterDependencies as WorkflowMethodologyAdapterDependencies };
1878
1880
  }
1879
1881
 
1880
1882
  /**
@@ -1927,7 +1929,7 @@ interface IBacklogAdapter {
1927
1929
  handleDailyTick(event: SystemDailyTickEvent): Promise<void>;
1928
1930
  getSystemStatus(): Promise<SystemStatus>;
1929
1931
  getTaskHealth(taskId: string): Promise<TaskHealthReport>;
1930
- lint(): Promise<LintReport>;
1932
+ lint(): Promise<LintReport$1>;
1931
1933
  audit(): Promise<AuditReport>;
1932
1934
  processChanges(changes: unknown[]): Promise<ExecutionRecord[]>;
1933
1935
  }
@@ -1939,7 +1941,7 @@ type BacklogAdapterConfig = {
1939
1941
  systemMinScore: number;
1940
1942
  };
1941
1943
  };
1942
- type LintReport = {
1944
+ type LintReport$1 = {
1943
1945
  status: 'success' | 'failed';
1944
1946
  issues: string[];
1945
1947
  };
@@ -2099,18 +2101,18 @@ declare class BacklogAdapter implements IBacklogAdapter {
2099
2101
  * All business logic and validation happens here in the adapter
2100
2102
  */
2101
2103
  moveTasksBetweenCycles(targetCycleId: string, taskIds: string[], sourceCycleId: string): Promise<void>;
2102
- lint(): Promise<LintReport>;
2104
+ lint(): Promise<LintReport$1>;
2103
2105
  audit(): Promise<AuditReport>;
2104
2106
  processChanges(_changes: unknown[]): Promise<ExecutionRecord[]>;
2105
2107
  }
2106
2108
 
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 };
2109
+ type index$b_BacklogAdapter = BacklogAdapter;
2110
+ declare const index$b_BacklogAdapter: typeof BacklogAdapter;
2111
+ type index$b_BacklogAdapterConfig = BacklogAdapterConfig;
2112
+ type index$b_BacklogAdapterDependencies = BacklogAdapterDependencies;
2113
+ type index$b_IBacklogAdapter = IBacklogAdapter;
2114
+ declare namespace index$b {
2115
+ export { index$b_BacklogAdapter as BacklogAdapter, type index$b_BacklogAdapterConfig as BacklogAdapterConfig, type index$b_BacklogAdapterDependencies as BacklogAdapterDependencies, type index$b_IBacklogAdapter as IBacklogAdapter };
2114
2116
  }
2115
2117
 
2116
2118
  /**
@@ -2128,10 +2130,50 @@ type AllRecords = {
2128
2130
  actors: GitGovActorRecord[];
2129
2131
  };
2130
2132
  /**
2131
- * Enhanced Task Record with calculated activity metadata
2132
- * Used by Dashboard for intelligent sorting and display
2133
+ * Enhanced Task Record with complete intelligence layer
2134
+ * Calculated by enrichTaskRecord() with relationships, metrics, and derived states
2135
+ *
2136
+ * @see indexer_adapter.md Section 3.6 - EnrichedTaskRecord Specification (EARS 25-48)
2133
2137
  */
2134
2138
  type EnrichedTaskRecord = TaskRecord & {
2139
+ derivedState: {
2140
+ isStalled: boolean;
2141
+ isAtRisk: boolean;
2142
+ needsClarification: boolean;
2143
+ isBlockedByDependency: boolean;
2144
+ healthScore: number;
2145
+ timeInCurrentStage: number;
2146
+ };
2147
+ relationships: {
2148
+ author?: {
2149
+ actorId: string;
2150
+ timestamp: number;
2151
+ };
2152
+ lastModifier?: {
2153
+ actorId: string;
2154
+ timestamp: number;
2155
+ };
2156
+ assignedTo: Array<{
2157
+ actorId: string;
2158
+ assignedAt?: number;
2159
+ }>;
2160
+ dependsOn: string[];
2161
+ blockedBy: string[];
2162
+ cycles: Array<{
2163
+ id: string;
2164
+ title: string;
2165
+ }>;
2166
+ };
2167
+ metrics: {
2168
+ executionCount: number;
2169
+ blockingFeedbackCount: number;
2170
+ openQuestionCount: number;
2171
+ timeToResolution?: number;
2172
+ };
2173
+ release: {
2174
+ isReleased: boolean;
2175
+ lastReleaseVersion?: string;
2176
+ };
2135
2177
  lastUpdated: number;
2136
2178
  lastActivityType: 'task_modified' | 'feedback_received' | 'execution_added' | 'changelog_created' | 'task_created';
2137
2179
  recentActivity?: string;
@@ -2163,11 +2205,50 @@ type IndexData = {
2163
2205
  generationTime: number;
2164
2206
  };
2165
2207
  metrics: SystemStatus & ProductivityMetrics & CollaborationMetrics;
2208
+ derivedStates: DerivedStates;
2166
2209
  activityHistory: ActivityEvent[];
2167
- tasks: TaskRecord[];
2210
+ /**
2211
+ * Raw task records with FULL headers (source of truth for signatures/checksums).
2212
+ * Mantener por backward compatibility - deprecar gradualmente en favor de enrichedTasks.
2213
+ */
2214
+ tasks: GitGovTaskRecord[];
2215
+ /**
2216
+ * Enriched tasks with intelligence layer (NEW - Phase 1A).
2217
+ * Payload + campos calculados (relationships, metrics, derivedState, release).
2218
+ * NO incluye headers (author/lastModifier ya extraídos en relationships).
2219
+ */
2168
2220
  enrichedTasks: EnrichedTaskRecord[];
2169
- cycles: CycleRecord[];
2170
- actors: ActorRecord[];
2221
+ /** Raw cycle records with FULL headers */
2222
+ cycles: GitGovCycleRecord[];
2223
+ /** Raw actor records with FULL headers */
2224
+ actors: GitGovActorRecord[];
2225
+ /** Raw feedback records with FULL headers (optional - Phase 1B+) */
2226
+ feedback: GitGovFeedbackRecord[];
2227
+ };
2228
+ /**
2229
+ * System-wide derived states for dashboard analytics and filtering.
2230
+ * Calculated by calculateDerivedStates() during index generation.
2231
+ *
2232
+ * @see derived_data_protocol.md for calculation algorithms
2233
+ */
2234
+ type DerivedStates = {
2235
+ stalledTasks: string[];
2236
+ atRiskTasks: string[];
2237
+ needsClarificationTasks: string[];
2238
+ blockedByDependencyTasks: string[];
2239
+ };
2240
+ /**
2241
+ * Optimized version of DerivedStates using Sets for O(1) lookup performance.
2242
+ * Used internally by enrichTaskRecord() to efficiently check task membership.
2243
+ *
2244
+ * Conversion from DerivedStates (arrays) to DerivedStateSets (Sets) happens once
2245
+ * in generateIndex() before processing multiple tasks, avoiding repeated O(n) lookups.
2246
+ */
2247
+ type DerivedStateSets = {
2248
+ stalledTasks: Set<string>;
2249
+ atRiskTasks: Set<string>;
2250
+ needsClarificationTasks: Set<string>;
2251
+ blockedByDependencyTasks: Set<string>;
2171
2252
  };
2172
2253
  type IntegrityReport = {
2173
2254
  status: "valid" | "warnings" | "errors";
@@ -2182,6 +2263,7 @@ type IndexGenerationReport = {
2182
2263
  success: boolean;
2183
2264
  recordsProcessed: number;
2184
2265
  metricsCalculated: number;
2266
+ derivedStatesApplied: number;
2185
2267
  generationTime: number;
2186
2268
  cacheSize: number;
2187
2269
  cacheStrategy: "json" | "sqlite" | "dual";
@@ -2209,13 +2291,14 @@ interface IIndexerAdapter {
2209
2291
  generateIndex(): Promise<IndexGenerationReport>;
2210
2292
  getIndexData(): Promise<IndexData | null>;
2211
2293
  validateIntegrity(): Promise<IntegrityReport>;
2294
+ calculateDerivedStates(allRecords: AllRecords): Promise<DerivedStates>;
2212
2295
  calculateActivityHistory(allRecords: AllRecords): Promise<ActivityEvent[]>;
2213
- calculateLastUpdated(task: TaskRecord, relatedRecords: AllRecords): Promise<{
2296
+ calculateLastUpdated(taskPayload: TaskRecord, relatedRecords: AllRecords): Promise<{
2214
2297
  lastUpdated: number;
2215
2298
  lastActivityType: EnrichedTaskRecord['lastActivityType'];
2216
2299
  recentActivity: string;
2217
2300
  }>;
2218
- enrichTaskRecord(task: GitGovTaskRecord, relatedRecords: AllRecords): Promise<EnrichedTaskRecord>;
2301
+ enrichTaskRecord(task: GitGovTaskRecord, relatedRecords: AllRecords, derivedStateSets: DerivedStateSets): Promise<EnrichedTaskRecord>;
2219
2302
  isIndexUpToDate(): Promise<boolean>;
2220
2303
  invalidateCache(): Promise<void>;
2221
2304
  }
@@ -2242,10 +2325,19 @@ declare class FileIndexerAdapter implements IIndexerAdapter {
2242
2325
  generateIndex(): Promise<IndexGenerationReport>;
2243
2326
  /**
2244
2327
  * [EARS-2] Gets data from local cache for fast CLI queries
2328
+ * [EARS-13] Returns null and logs warning if cache is corrupted
2245
2329
  */
2246
2330
  getIndexData(): Promise<IndexData | null>;
2247
2331
  /**
2248
- * [EARS-4] Validates integrity of Records without regenerating cache
2332
+ * [EARS-4, EARS-70 to EARS-76] Validates integrity of Records without regenerating cache
2333
+ *
2334
+ * PHASE 1A (IMPLEMENTED): Basic schema validation (required fields)
2335
+ * PHASE 1B (IMPLEMENTED): Cryptographic validation (checksums + signatures)
2336
+ * TODO FUTURE:
2337
+ * - Integrate ValidatorModule for comprehensive schema validation
2338
+ * - Compare cache consistency with Records
2339
+ * - Detect broken references between records
2340
+ * - Validate timestamp consistency
2249
2341
  */
2250
2342
  validateIntegrity(): Promise<IntegrityReport>;
2251
2343
  /**
@@ -2279,12 +2371,30 @@ declare class FileIndexerAdapter implements IIndexerAdapter {
2279
2371
  private readAllExecutions;
2280
2372
  /**
2281
2373
  * Reads all changelogs from changelogStore (graceful degradation) with full metadata.
2374
+ * Validates schema and filters out invalid records with warnings.
2282
2375
  */
2283
2376
  private readAllChangelogs;
2284
2377
  /**
2285
2378
  * Writes cache data to file (Phase 1: JSON)
2379
+ *
2380
+ * [EARS-14] Creates automatic backup of existing cache before writing.
2381
+ * If write fails, backup can be restored to preserve previous cache state.
2286
2382
  */
2287
2383
  private writeCacheFile;
2384
+ /**
2385
+ * [EARS-14] Creates a backup of the current cache file.
2386
+ * If cache doesn't exist, this is a no-op (nothing to backup).
2387
+ */
2388
+ private createCacheBackup;
2389
+ /**
2390
+ * [EARS-14] Restores cache from backup file.
2391
+ * Used when cache write operation fails to preserve previous state.
2392
+ */
2393
+ private restoreCacheFromBackup;
2394
+ /**
2395
+ * [EARS-14] Deletes backup file after successful cache write.
2396
+ */
2397
+ private deleteCacheBackup;
2288
2398
  /**
2289
2399
  * Checks if cache file exists
2290
2400
  */
@@ -2297,6 +2407,19 @@ declare class FileIndexerAdapter implements IIndexerAdapter {
2297
2407
  * Gets current git commit hash (simplified)
2298
2408
  */
2299
2409
  private getGitCommitHash;
2410
+ /**
2411
+ * [EARS-7 to EARS-10] Calculates system-wide derived states for analytics and filtering.
2412
+ *
2413
+ * Applies DerivedDataProtocol algorithms to categorize tasks:
2414
+ * - isStalled: Tasks en 'active' sin executions >7 días O en 'review' sin approval >3 días
2415
+ * - isAtRisk: Tasks con prioridad 'critical' + 'paused' O 2+ blocking feedbacks
2416
+ * - needsClarification: Tasks con feedback tipo 'question' abierto
2417
+ * - isBlockedByDependency: Tasks con referencias a tasks no completadas
2418
+ *
2419
+ * @see derived_data_protocol.md for detailed algorithms
2420
+ * @see EARS-7, EARS-8, EARS-9, EARS-10 for requirements
2421
+ */
2422
+ calculateDerivedStates(allRecords: AllRecords): Promise<DerivedStates>;
2300
2423
  /**
2301
2424
  * [EARS-19] Calculates activity history from Record timestamps for dashboard activity streams
2302
2425
  */
@@ -2304,8 +2427,9 @@ declare class FileIndexerAdapter implements IIndexerAdapter {
2304
2427
  /**
2305
2428
  * [EARS-21] Calculate lastUpdated timestamp and activity type for a task
2306
2429
  * Considers task file modification time and related records timestamps
2430
+ * @param taskPayload - Task payload (not full record with headers)
2307
2431
  */
2308
- calculateLastUpdated(task: TaskRecord, relatedRecords: AllRecords): Promise<{
2432
+ calculateLastUpdated(taskPayload: TaskRecord, relatedRecords: AllRecords): Promise<{
2309
2433
  lastUpdated: number;
2310
2434
  lastActivityType: EnrichedTaskRecord['lastActivityType'];
2311
2435
  recentActivity: string;
@@ -2315,7 +2439,28 @@ declare class FileIndexerAdapter implements IIndexerAdapter {
2315
2439
  * @param task - Full GitGovTaskRecord with header.signatures for author/lastModifier extraction
2316
2440
  * @param relatedRecords - All related records with full metadata
2317
2441
  */
2318
- enrichTaskRecord(task: GitGovTaskRecord, relatedRecords: AllRecords): Promise<EnrichedTaskRecord>;
2442
+ /**
2443
+ * Enriches a task with complete intelligence layer (EARS 25-48)
2444
+ *
2445
+ * 11-step algorithm:
2446
+ * 1. Activity metadata (lastUpdated, lastActivityType, recentActivity)
2447
+ * 2. Signatures (author, lastModifier with timestamps)
2448
+ * 3. Assignments (assignedTo from feedback)
2449
+ * 4. Dependencies (dependsOn, blockedBy with typed references)
2450
+ * 5. Cycles (all cycles as array with id+title)
2451
+ * 6. Metrics (executionCount, blockingFeedbackCount, openQuestionCount)
2452
+ * 7. Time to resolution (for done tasks)
2453
+ * 8. Release info (isReleased, lastReleaseVersion from changelogs)
2454
+ * 9. Derived states (EARS-43: REUTILIZA pre-calculated derivedStates con O(1) lookup)
2455
+ * 10. Health score (0-100 using multi-factor algorithm)
2456
+ * 11. Time in current stage (days)
2457
+ *
2458
+ * @param task - Full GitGovTaskRecord with header.signatures
2459
+ * @param relatedRecords - All records for cross-referencing
2460
+ * @param derivedStateSets - Pre-calculated system-wide derived states as Sets for O(1) lookup (EARS-43)
2461
+ * @returns Promise<EnrichedTaskRecord> - Task with complete intelligence layer
2462
+ */
2463
+ enrichTaskRecord(task: GitGovTaskRecord, relatedRecords: AllRecords, derivedStateSets: DerivedStateSets): Promise<EnrichedTaskRecord>;
2319
2464
  /**
2320
2465
  * Format timestamp as human-readable time ago
2321
2466
  */
@@ -2326,19 +2471,21 @@ declare class FileIndexerAdapter implements IIndexerAdapter {
2326
2471
  private getTimestampFromId;
2327
2472
  }
2328
2473
 
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 };
2474
+ type index$a_AllRecords = AllRecords;
2475
+ type index$a_DerivedStateSets = DerivedStateSets;
2476
+ type index$a_DerivedStates = DerivedStates;
2477
+ type index$a_EnrichedTaskRecord = EnrichedTaskRecord;
2478
+ type index$a_FileIndexerAdapter = FileIndexerAdapter;
2479
+ declare const index$a_FileIndexerAdapter: typeof FileIndexerAdapter;
2480
+ type index$a_IIndexerAdapter = IIndexerAdapter;
2481
+ type index$a_IndexData = IndexData;
2482
+ type index$a_IndexGenerationReport = IndexGenerationReport;
2483
+ type index$a_IndexerAdapterDependencies = IndexerAdapterDependencies;
2484
+ type index$a_IntegrityError = IntegrityError;
2485
+ type index$a_IntegrityReport = IntegrityReport;
2486
+ type index$a_IntegrityWarning = IntegrityWarning;
2487
+ declare namespace index$a {
2488
+ export { type index$a_AllRecords as AllRecords, type index$a_DerivedStateSets as DerivedStateSets, type index$a_DerivedStates as DerivedStates, type index$a_EnrichedTaskRecord as EnrichedTaskRecord, index$a_FileIndexerAdapter as FileIndexerAdapter, type index$a_IIndexerAdapter as IIndexerAdapter, type index$a_IndexData as IndexData, type index$a_IndexGenerationReport as IndexGenerationReport, type index$a_IndexerAdapterDependencies as IndexerAdapterDependencies, type index$a_IntegrityError as IntegrityError, type index$a_IntegrityReport as IntegrityReport, type index$a_IntegrityWarning as IntegrityWarning };
2342
2489
  }
2343
2490
 
2344
2491
  /**
@@ -2448,14 +2595,14 @@ declare class ConfigManager {
2448
2595
  */
2449
2596
  declare function createConfigManager(projectRoot?: string): ConfigManager;
2450
2597
 
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 };
2598
+ type index$9_ActorState = ActorState;
2599
+ type index$9_ConfigManager = ConfigManager;
2600
+ declare const index$9_ConfigManager: typeof ConfigManager;
2601
+ type index$9_GitGovConfig = GitGovConfig;
2602
+ type index$9_GitGovSession = GitGovSession;
2603
+ declare const index$9_createConfigManager: typeof createConfigManager;
2604
+ declare namespace index$9 {
2605
+ export { type index$9_ActorState as ActorState, index$9_ConfigManager as ConfigManager, type index$9_GitGovConfig as GitGovConfig, type index$9_GitGovSession as GitGovSession, index$9_createConfigManager as createConfigManager };
2459
2606
  }
2460
2607
 
2461
2608
  /**
@@ -2609,8 +2756,66 @@ declare class ProjectAdapter implements IProjectAdapter {
2609
2756
  private setupGitIntegration;
2610
2757
  }
2611
2758
 
2759
+ type index$8_EnvironmentValidation = EnvironmentValidation;
2760
+ type index$8_IProjectAdapter = IProjectAdapter;
2761
+ type index$8_ProjectAdapter = ProjectAdapter;
2762
+ declare const index$8_ProjectAdapter: typeof ProjectAdapter;
2763
+ type index$8_ProjectAdapterDependencies = ProjectAdapterDependencies;
2764
+ type index$8_ProjectContext = ProjectContext;
2765
+ type index$8_ProjectInfo = ProjectInfo;
2766
+ type index$8_ProjectInitOptions = ProjectInitOptions;
2767
+ type index$8_ProjectInitResult = ProjectInitResult;
2768
+ type index$8_ProjectReport = ProjectReport;
2769
+ type index$8_TemplateProcessingResult = TemplateProcessingResult;
2770
+ declare namespace index$8 {
2771
+ export { type index$8_EnvironmentValidation as EnvironmentValidation, type index$8_IProjectAdapter as IProjectAdapter, index$8_ProjectAdapter as ProjectAdapter, type index$8_ProjectAdapterDependencies as ProjectAdapterDependencies, type index$8_ProjectContext as ProjectContext, type index$8_ProjectInfo as ProjectInfo, type index$8_ProjectInitOptions as ProjectInitOptions, type index$8_ProjectInitResult as ProjectInitResult, type index$8_ProjectReport as ProjectReport, type index$8_TemplateProcessingResult as TemplateProcessingResult };
2772
+ }
2773
+
2774
+ type index$7_AllRecords = AllRecords;
2775
+ type index$7_BacklogAdapter = BacklogAdapter;
2776
+ declare const index$7_BacklogAdapter: typeof BacklogAdapter;
2777
+ type index$7_BacklogAdapterConfig = BacklogAdapterConfig;
2778
+ type index$7_BacklogAdapterDependencies = BacklogAdapterDependencies;
2779
+ type index$7_ChangelogAdapter = ChangelogAdapter;
2780
+ declare const index$7_ChangelogAdapter: typeof ChangelogAdapter;
2781
+ type index$7_ChangelogAdapterDependencies = ChangelogAdapterDependencies;
2782
+ type index$7_ChangelogListOptions = ChangelogListOptions;
2783
+ type index$7_CollaborationMetrics = CollaborationMetrics;
2784
+ type index$7_DerivedStateSets = DerivedStateSets;
2785
+ type index$7_DerivedStates = DerivedStates;
2786
+ type index$7_EnrichedTaskRecord = EnrichedTaskRecord;
2612
2787
  type index$7_EnvironmentValidation = EnvironmentValidation;
2788
+ type index$7_ExecutionAdapter = ExecutionAdapter;
2789
+ declare const index$7_ExecutionAdapter: typeof ExecutionAdapter;
2790
+ type index$7_ExecutionAdapterDependencies = ExecutionAdapterDependencies;
2791
+ type index$7_FeedbackAdapter = FeedbackAdapter;
2792
+ declare const index$7_FeedbackAdapter: typeof FeedbackAdapter;
2793
+ type index$7_FeedbackAdapterDependencies = FeedbackAdapterDependencies;
2794
+ type index$7_FeedbackThread = FeedbackThread;
2795
+ type index$7_FileIndexerAdapter = FileIndexerAdapter;
2796
+ declare const index$7_FileIndexerAdapter: typeof FileIndexerAdapter;
2797
+ type index$7_IBacklogAdapter = IBacklogAdapter;
2798
+ type index$7_IChangelogAdapter = IChangelogAdapter;
2799
+ type index$7_IExecutionAdapter = IExecutionAdapter;
2800
+ type index$7_IFeedbackAdapter = IFeedbackAdapter;
2801
+ type index$7_IIdentityAdapter = IIdentityAdapter;
2802
+ type index$7_IIndexerAdapter = IIndexerAdapter;
2803
+ type index$7_IMetricsAdapter = IMetricsAdapter;
2613
2804
  type index$7_IProjectAdapter = IProjectAdapter;
2805
+ type index$7_IWorkflowMethodology = IWorkflowMethodology;
2806
+ type index$7_IdentityAdapter = IdentityAdapter;
2807
+ declare const index$7_IdentityAdapter: typeof IdentityAdapter;
2808
+ type index$7_IdentityAdapterDependencies = IdentityAdapterDependencies;
2809
+ type index$7_IndexData = IndexData;
2810
+ type index$7_IndexGenerationReport = IndexGenerationReport;
2811
+ type index$7_IndexerAdapterDependencies = IndexerAdapterDependencies;
2812
+ type index$7_IntegrityError = IntegrityError;
2813
+ type index$7_IntegrityReport = IntegrityReport;
2814
+ type index$7_IntegrityWarning = IntegrityWarning;
2815
+ type index$7_MetricsAdapter = MetricsAdapter;
2816
+ declare const index$7_MetricsAdapter: typeof MetricsAdapter;
2817
+ type index$7_MetricsAdapterDependencies = MetricsAdapterDependencies;
2818
+ type index$7_ProductivityMetrics = ProductivityMetrics;
2614
2819
  type index$7_ProjectAdapter = ProjectAdapter;
2615
2820
  declare const index$7_ProjectAdapter: typeof ProjectAdapter;
2616
2821
  type index$7_ProjectAdapterDependencies = ProjectAdapterDependencies;
@@ -2619,71 +2824,14 @@ type index$7_ProjectInfo = ProjectInfo;
2619
2824
  type index$7_ProjectInitOptions = ProjectInitOptions;
2620
2825
  type index$7_ProjectInitResult = ProjectInitResult;
2621
2826
  type index$7_ProjectReport = ProjectReport;
2827
+ type index$7_SystemStatus = SystemStatus;
2828
+ type index$7_TaskHealthReport = TaskHealthReport;
2622
2829
  type index$7_TemplateProcessingResult = TemplateProcessingResult;
2830
+ type index$7_WorkflowMethodologyAdapter = WorkflowMethodologyAdapter;
2831
+ declare const index$7_WorkflowMethodologyAdapter: typeof WorkflowMethodologyAdapter;
2832
+ type index$7_WorkflowMethodologyAdapterDependencies = WorkflowMethodologyAdapterDependencies;
2623
2833
  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 };
2625
- }
2626
-
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 };
2834
+ export { type index$7_AllRecords as AllRecords, index$7_BacklogAdapter as BacklogAdapter, type index$7_BacklogAdapterConfig as BacklogAdapterConfig, type index$7_BacklogAdapterDependencies as BacklogAdapterDependencies, index$7_ChangelogAdapter as ChangelogAdapter, type index$7_ChangelogAdapterDependencies as ChangelogAdapterDependencies, type index$7_ChangelogListOptions as ChangelogListOptions, type index$7_CollaborationMetrics as CollaborationMetrics, type index$7_DerivedStateSets as DerivedStateSets, type index$7_DerivedStates as DerivedStates, type index$7_EnrichedTaskRecord as EnrichedTaskRecord, type index$7_EnvironmentValidation as EnvironmentValidation, index$7_ExecutionAdapter as ExecutionAdapter, type index$7_ExecutionAdapterDependencies as ExecutionAdapterDependencies, index$7_FeedbackAdapter as FeedbackAdapter, type index$7_FeedbackAdapterDependencies as FeedbackAdapterDependencies, type index$7_FeedbackThread as FeedbackThread, index$7_FileIndexerAdapter as FileIndexerAdapter, type index$7_IBacklogAdapter as IBacklogAdapter, type index$7_IChangelogAdapter as IChangelogAdapter, type index$7_IExecutionAdapter as IExecutionAdapter, type index$7_IFeedbackAdapter as IFeedbackAdapter, type index$7_IIdentityAdapter as IIdentityAdapter, type index$7_IIndexerAdapter as IIndexerAdapter, type index$7_IMetricsAdapter as IMetricsAdapter, type index$7_IProjectAdapter as IProjectAdapter, type index$7_IWorkflowMethodology as IWorkflowMethodology, index$7_IdentityAdapter as IdentityAdapter, type index$7_IdentityAdapterDependencies as IdentityAdapterDependencies, type index$7_IndexData as IndexData, type index$7_IndexGenerationReport as IndexGenerationReport, type index$7_IndexerAdapterDependencies as IndexerAdapterDependencies, type index$7_IntegrityError as IntegrityError, type index$7_IntegrityReport as IntegrityReport, type index$7_IntegrityWarning as IntegrityWarning, index$7_MetricsAdapter as MetricsAdapter, type index$7_MetricsAdapterDependencies as MetricsAdapterDependencies, type index$7_ProductivityMetrics as ProductivityMetrics, index$7_ProjectAdapter as ProjectAdapter, type index$7_ProjectAdapterDependencies as ProjectAdapterDependencies, type index$7_ProjectContext as ProjectContext, type index$7_ProjectInfo as ProjectInfo, type index$7_ProjectInitOptions as ProjectInitOptions, type index$7_ProjectInitResult as ProjectInitResult, type index$7_ProjectReport as ProjectReport, type index$7_SystemStatus as SystemStatus, type index$7_TaskHealthReport as TaskHealthReport, type index$7_TemplateProcessingResult as TemplateProcessingResult, type ValidationContext$1 as ValidationContext, index$7_WorkflowMethodologyAdapter as WorkflowMethodologyAdapter, type index$7_WorkflowMethodologyAdapterDependencies as WorkflowMethodologyAdapterDependencies };
2687
2835
  }
2688
2836
 
2689
2837
  /**
@@ -2723,63 +2871,133 @@ declare function verifySignatures(record: {
2723
2871
  payload: GitGovRecordPayload;
2724
2872
  }, getActorPublicKey: (keyId: string) => Promise<string | null>): Promise<boolean>;
2725
2873
 
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 };
2874
+ declare const index$6_calculatePayloadChecksum: typeof calculatePayloadChecksum;
2875
+ declare const index$6_generateKeys: typeof generateKeys;
2876
+ declare const index$6_signPayload: typeof signPayload;
2877
+ declare const index$6_verifySignatures: typeof verifySignatures;
2878
+ declare namespace index$6 {
2879
+ export { index$6_calculatePayloadChecksum as calculatePayloadChecksum, index$6_generateKeys as generateKeys, index$6_signPayload as signPayload, index$6_verifySignatures as verifySignatures };
2732
2880
  }
2733
2881
 
2734
2882
  /**
2735
2883
  * Creates a new, fully-formed ActorRecord with validation.
2736
2884
  */
2737
- declare function createActorRecord(payload: Partial<ActorRecord>): Promise<ActorRecord>;
2885
+ declare function createActorRecord(payload: Partial<ActorRecord>): ActorRecord;
2886
+ /**
2887
+ * Loads and validates an existing ActorRecord from untrusted data.
2888
+ * Used by RecordStore to validate records when reading from disk.
2889
+ * Validates both header (embedded metadata) and payload (ActorRecord).
2890
+ *
2891
+ * @param data - Unknown data to validate as GitGovActorRecord
2892
+ * @returns GitGovActorRecord - The validated complete record
2893
+ * @throws DetailedValidationError if validation fails
2894
+ */
2895
+ declare function loadActorRecord(data: unknown): GitGovActorRecord;
2738
2896
 
2739
2897
  /**
2740
2898
  * Creates a new, fully-formed AgentRecord with validation.
2741
2899
  */
2742
- declare function createAgentRecord(payload: Partial<AgentRecord>): Promise<AgentRecord>;
2900
+ declare function createAgentRecord(payload: Partial<AgentRecord>): AgentRecord;
2901
+ /**
2902
+ * Loads and validates an existing AgentRecord from untrusted data.
2903
+ * Used by RecordStore to validate records when reading from disk.
2904
+ * Validates both header (embedded metadata) and payload (AgentRecord).
2905
+ *
2906
+ * @param data - Unknown data to validate as GitGovAgentRecord
2907
+ * @returns GitGovAgentRecord - The validated complete record
2908
+ * @throws DetailedValidationError if validation fails
2909
+ */
2910
+ declare function loadAgentRecord(data: unknown): GitGovAgentRecord;
2743
2911
 
2744
2912
  /**
2745
2913
  * Creates a new, fully-formed TaskRecord with validation.
2746
2914
  */
2747
- declare function createTaskRecord(payload: Partial<TaskRecord>): Promise<TaskRecord>;
2915
+ declare function createTaskRecord(payload: Partial<TaskRecord>): TaskRecord;
2916
+ /**
2917
+ * Loads and validates an existing TaskRecord from untrusted data.
2918
+ * Used by RecordStore to validate records when reading from disk.
2919
+ * Validates both header (embedded metadata) and payload (TaskRecord).
2920
+ *
2921
+ * @param data - Unknown data to validate as GitGovTaskRecord
2922
+ * @returns GitGovTaskRecord - The validated complete record
2923
+ * @throws DetailedValidationError if validation fails
2924
+ */
2925
+ declare function loadTaskRecord(data: unknown): GitGovTaskRecord;
2748
2926
 
2749
2927
  /**
2750
2928
  * Creates a new, fully-formed CycleRecord with validation.
2751
2929
  */
2752
- declare function createCycleRecord(payload: Partial<CycleRecord>): Promise<CycleRecord>;
2930
+ declare function createCycleRecord(payload: Partial<CycleRecord>): CycleRecord;
2931
+ /**
2932
+ * Loads and validates an existing CycleRecord from untrusted data.
2933
+ * Used by RecordStore to validate records when reading from disk.
2934
+ * Validates both header (embedded metadata) and payload (CycleRecord).
2935
+ *
2936
+ * @param data - Unknown data to validate as GitGovCycleRecord
2937
+ * @returns GitGovCycleRecord - The validated complete record
2938
+ * @throws DetailedValidationError if validation fails
2939
+ */
2940
+ declare function loadCycleRecord(data: unknown): GitGovCycleRecord;
2753
2941
 
2754
2942
  /**
2755
2943
  * Creates a complete ExecutionRecord with validation
2756
2944
  *
2757
2945
  * @param payload - Partial ExecutionRecord payload
2758
- * @returns Promise<ExecutionRecord> - The validated ExecutionRecord
2946
+ * @returns ExecutionRecord - The validated ExecutionRecord
2947
+ */
2948
+ declare function createExecutionRecord(payload: Partial<ExecutionRecord>): ExecutionRecord;
2949
+ /**
2950
+ * Loads and validates an existing ExecutionRecord from untrusted data.
2951
+ * Used by RecordStore to validate records when reading from disk.
2952
+ * Validates both header (embedded metadata) and payload (ExecutionRecord).
2953
+ *
2954
+ * @param data - Unknown data to validate as GitGovExecutionRecord
2955
+ * @returns GitGovExecutionRecord - The validated complete record
2956
+ * @throws DetailedValidationError if validation fails
2759
2957
  */
2760
- declare function createExecutionRecord(payload: Partial<ExecutionRecord>): Promise<ExecutionRecord>;
2958
+ declare function loadExecutionRecord(data: unknown): GitGovExecutionRecord;
2761
2959
 
2762
2960
  /**
2763
2961
  * Creates a complete ChangelogRecord with validation (Protocol v2)
2764
2962
  *
2765
2963
  * @param payload - Partial ChangelogRecord payload
2766
- * @returns Promise<ChangelogRecord> - The validated ChangelogRecord
2964
+ * @returns ChangelogRecord - The validated ChangelogRecord
2767
2965
  */
2768
- declare function createChangelogRecord(payload: Partial<ChangelogRecord>): Promise<ChangelogRecord>;
2966
+ declare function createChangelogRecord(payload: Partial<ChangelogRecord>): ChangelogRecord;
2967
+ /**
2968
+ * Loads and validates an existing ChangelogRecord from untrusted data.
2969
+ * Used by RecordStore to validate records when reading from disk.
2970
+ * Validates both header (embedded metadata) and payload (ChangelogRecord).
2971
+ *
2972
+ * @param data - Unknown data to validate as GitGovChangelogRecord
2973
+ * @returns GitGovChangelogRecord - The validated complete record
2974
+ * @throws DetailedValidationError if validation fails
2975
+ */
2976
+ declare function loadChangelogRecord(data: unknown): GitGovChangelogRecord;
2769
2977
 
2770
2978
  /**
2771
2979
  * Creates a complete FeedbackRecord with validation
2772
2980
  *
2773
2981
  * @param payload - Partial FeedbackRecord payload
2774
- * @returns Promise<FeedbackRecord> - The validated FeedbackRecord
2982
+ * @returns FeedbackRecord - The validated FeedbackRecord
2775
2983
  */
2776
- declare function createFeedbackRecord(payload: Partial<FeedbackRecord>): Promise<FeedbackRecord>;
2984
+ declare function createFeedbackRecord(payload: Partial<FeedbackRecord>): FeedbackRecord;
2985
+ /**
2986
+ * Loads and validates an existing FeedbackRecord from untrusted data.
2987
+ * Used by RecordStore to validate records when reading from disk.
2988
+ * Validates both header (embedded metadata) and payload (FeedbackRecord).
2989
+ *
2990
+ * @param data - Unknown data to validate as GitGovFeedbackRecord
2991
+ * @returns GitGovFeedbackRecord - The validated complete record
2992
+ * @throws DetailedValidationError if validation fails
2993
+ */
2994
+ declare function loadFeedbackRecord(data: unknown): GitGovFeedbackRecord;
2777
2995
 
2778
2996
  /**
2779
2997
  * Creates a new, fully-formed WorkflowMethodologyConfig with validation.
2780
2998
  * Follows the same pattern as createTaskRecord, createActorRecord, etc.
2781
2999
  */
2782
- declare function createWorkflowMethodologyConfig(payload: Partial<WorkflowMethodologyRecord>): Promise<WorkflowMethodologyRecord>;
3000
+ declare function createWorkflowMethodologyConfig(payload: Partial<WorkflowMethodologyRecord>): WorkflowMethodologyRecord;
2783
3001
  /**
2784
3002
  * Creates a default GitGovernance workflow methodology configuration
2785
3003
  */
@@ -2831,26 +3049,714 @@ declare function createTestSignature(keyId?: string, role?: string, notes?: stri
2831
3049
  * roles: ['developer']
2832
3050
  * };
2833
3051
  *
2834
- * const embedded = await createEmbeddedMetadataRecord(actorPayload);
3052
+ * const embedded = createEmbeddedMetadataRecord(actorPayload);
3053
+ * ```
3054
+ */
3055
+ declare function createEmbeddedMetadataRecord<T extends GitGovRecordPayload>(payload: T, options?: CreateEmbeddedMetadataOptions): EmbeddedMetadataRecord<T>;
3056
+
3057
+ type index$5_CreateEmbeddedMetadataOptions = CreateEmbeddedMetadataOptions;
3058
+ type index$5_SignatureConfig = SignatureConfig;
3059
+ declare const index$5_createActorRecord: typeof createActorRecord;
3060
+ declare const index$5_createAgentRecord: typeof createAgentRecord;
3061
+ declare const index$5_createChangelogRecord: typeof createChangelogRecord;
3062
+ declare const index$5_createCycleRecord: typeof createCycleRecord;
3063
+ declare const index$5_createDefaultWorkflowMethodologyConfig: typeof createDefaultWorkflowMethodologyConfig;
3064
+ declare const index$5_createEmbeddedMetadataRecord: typeof createEmbeddedMetadataRecord;
3065
+ declare const index$5_createExecutionRecord: typeof createExecutionRecord;
3066
+ declare const index$5_createFeedbackRecord: typeof createFeedbackRecord;
3067
+ declare const index$5_createTaskRecord: typeof createTaskRecord;
3068
+ declare const index$5_createTestSignature: typeof createTestSignature;
3069
+ declare const index$5_createWorkflowMethodologyConfig: typeof createWorkflowMethodologyConfig;
3070
+ declare const index$5_loadActorRecord: typeof loadActorRecord;
3071
+ declare const index$5_loadAgentRecord: typeof loadAgentRecord;
3072
+ declare const index$5_loadChangelogRecord: typeof loadChangelogRecord;
3073
+ declare const index$5_loadCycleRecord: typeof loadCycleRecord;
3074
+ declare const index$5_loadExecutionRecord: typeof loadExecutionRecord;
3075
+ declare const index$5_loadFeedbackRecord: typeof loadFeedbackRecord;
3076
+ declare const index$5_loadTaskRecord: typeof loadTaskRecord;
3077
+ declare namespace index$5 {
3078
+ export { type index$5_CreateEmbeddedMetadataOptions as CreateEmbeddedMetadataOptions, type index$5_SignatureConfig as SignatureConfig, index$5_createActorRecord as createActorRecord, index$5_createAgentRecord as createAgentRecord, index$5_createChangelogRecord as createChangelogRecord, index$5_createCycleRecord as createCycleRecord, index$5_createDefaultWorkflowMethodologyConfig as createDefaultWorkflowMethodologyConfig, index$5_createEmbeddedMetadataRecord as createEmbeddedMetadataRecord, index$5_createExecutionRecord as createExecutionRecord, index$5_createFeedbackRecord as createFeedbackRecord, index$5_createTaskRecord as createTaskRecord, index$5_createTestSignature as createTestSignature, index$5_createWorkflowMethodologyConfig as createWorkflowMethodologyConfig, index$5_loadActorRecord as loadActorRecord, index$5_loadAgentRecord as loadAgentRecord, index$5_loadChangelogRecord as loadChangelogRecord, index$5_loadCycleRecord as loadCycleRecord, index$5_loadExecutionRecord as loadExecutionRecord, index$5_loadFeedbackRecord as loadFeedbackRecord, index$5_loadTaskRecord as loadTaskRecord };
3079
+ }
3080
+
3081
+ type StorablePayload = Exclude<GitGovRecordPayload, CustomRecord>;
3082
+ /**
3083
+ * Public interface for LintModule operations.
3084
+ *
3085
+ * Follows the same pattern as IBacklogAdapter, IFeedbackAdapter, etc.
3086
+ * Enables dependency injection and mocking for tests.
3087
+ *
3088
+ * @example
3089
+ * ```typescript
3090
+ * const lintModule: ILintModule = new LintModule({
3091
+ * recordStore: taskStore,
3092
+ * indexerAdapter: indexerAdapter
3093
+ * });
3094
+ *
3095
+ * const report = await lintModule.lint({ validateReferences: true });
3096
+ * ```
3097
+ */
3098
+ interface ILintModule {
3099
+ /**
3100
+ * Validates all records in the specified directory.
3101
+ *
3102
+ * Uses delegation pattern: calls recordStore.read() which internally uses loaders
3103
+ * to validate schema + embedded metadata. Then adds additional validations
3104
+ * (conventions, references).
3105
+ *
3106
+ * @param options - Configuration options
3107
+ * @returns {Promise<LintReport>} Consolidated report with all results
3108
+ */
3109
+ lint(options?: Partial<LintOptions>): Promise<LintReport>;
3110
+ /**
3111
+ * Validates a specific file and returns its results.
3112
+ * Ultra-fast validation for single records (target: <50ms).
3113
+ *
3114
+ * @param filePath - Path to the file to validate
3115
+ * @param options - Configuration options
3116
+ * @returns {Promise<LintReport>} Lint report for this single file
3117
+ */
3118
+ lintFile(filePath: string, options?: Partial<LintOptions>): Promise<LintReport>;
3119
+ /**
3120
+ * Applies automatic repairs to problems marked as fixable.
3121
+ *
3122
+ * @param lintReport - Lint report with detected problems
3123
+ * @param fixOptions - Options for the fix operation
3124
+ * @returns {Promise<FixReport>} Report of applied repairs
3125
+ */
3126
+ fix(lintReport: LintReport, fixOptions?: Partial<FixOptions>): Promise<FixReport>;
3127
+ }
3128
+ /**
3129
+ * Required and optional dependencies for the LintModule.
3130
+ *
3131
+ * The module uses dependency injection for maximum flexibility and testability.
3132
+ * Some dependencies are optional and the module gracefully degrades if they are not present.
3133
+ *
3134
+ * @example
3135
+ * ```typescript
3136
+ * const lintModule = new LintModule({
3137
+ * recordStore: taskStore,
3138
+ * indexerAdapter: new IndexerAdapter(), // optional
3139
+ * });
3140
+ * ```
3141
+ */
3142
+ interface LintModuleDependencies {
3143
+ /**
3144
+ * Store for filesystem access to records (REQUIRED)
3145
+ * Note: This project does not have a centralized ValidatorModule.
3146
+ * Validation is performed by recordStore.read() using type-specific loaders.
3147
+ */
3148
+ recordStore: RecordStore<StorablePayload>;
3149
+ /**
3150
+ * Indexing adapter for reference resolution (OPTIONAL)
3151
+ * If not present, reference validations will be limited.
3152
+ */
3153
+ indexerAdapter?: IIndexerAdapter;
3154
+ /**
3155
+ * File system for I/O operations (OPTIONAL)
3156
+ * Defaults to Node.js native fs.
3157
+ */
3158
+ fileSystem?: FileSystem;
3159
+ }
3160
+ /**
3161
+ * Interfaz simplificada del sistema de archivos para testing.
3162
+ */
3163
+ interface FileSystem {
3164
+ readFile(path: string, encoding: string): Promise<string>;
3165
+ writeFile(path: string, content: string): Promise<void>;
3166
+ exists(path: string): Promise<boolean>;
3167
+ unlink(path: string): Promise<void>;
3168
+ }
3169
+ /**
3170
+ * Opciones de configuración para la ejecución de lint.
3171
+ *
3172
+ * Controla qué validaciones se ejecutan y cómo se comporta el motor de lint.
3173
+ *
3174
+ * @example
3175
+ * ```typescript
3176
+ * const report = await lintModule.lint({
3177
+ * path: '.gitgov/',
3178
+ * validateReferences: true,
3179
+ * validateActors: true,
3180
+ * failFast: false,
3181
+ * concurrent: true
3182
+ * });
3183
+ * ```
3184
+ */
3185
+ interface LintOptions {
3186
+ /** Directorio o archivo a validar (default: '.gitgov/') */
3187
+ path?: string;
3188
+ /**
3189
+ * Validar referencias tipadas inteligentemente (default: false)
3190
+ * Requiere indexerModule presente.
3191
+ */
3192
+ validateReferences?: boolean;
3193
+ /**
3194
+ * Validar resolución de actorIds (default: false)
3195
+ * Verifica que los actorIds existen en .gitgov/actors/
3196
+ */
3197
+ validateActors?: boolean;
3198
+ /**
3199
+ * Validar checksums de embedded metadata (default: true)
3200
+ * Usa SHA256 sobre JSON canónico.
3201
+ */
3202
+ validateChecksums?: boolean;
3203
+ /**
3204
+ * Validar estructura de firmas (default: true)
3205
+ * Verifica formato Ed25519 y campos requeridos.
3206
+ */
3207
+ validateSignatures?: boolean;
3208
+ /**
3209
+ * Validar convenciones de nombres y directorios (default: true)
3210
+ * Valida que archivos estén en directorios correctos.
3211
+ */
3212
+ validateConventions?: boolean;
3213
+ /**
3214
+ * Modo fail-fast o acumular todos los errores (default: false)
3215
+ * Si true, detiene al primer error fatal.
3216
+ */
3217
+ failFast?: boolean;
3218
+ /**
3219
+ * Modo concurrente para repositorios grandes (default: true)
3220
+ * Procesa múltiples records en paralelo.
3221
+ */
3222
+ concurrent?: boolean;
3223
+ /**
3224
+ * Límite de concurrencia (default: 10)
3225
+ * Número máximo de records procesados simultáneamente.
3226
+ */
3227
+ concurrencyLimit?: number;
3228
+ }
3229
+ /**
3230
+ * Reporte consolidado de la ejecución de lint.
3231
+ *
3232
+ * Contiene resumen cuantitativo, resultados detallados y metadata de ejecución.
3233
+ *
3234
+ * @example
3235
+ * ```typescript
3236
+ * const report = await lintModule.lint(options);
3237
+ * console.log(`Errores: ${report.summary.errors}`);
3238
+ * console.log(`Warnings: ${report.summary.warnings}`);
3239
+ * console.log(`Tiempo: ${report.summary.executionTime}ms`);
3240
+ * ```
3241
+ */
3242
+ interface LintReport {
3243
+ /** Resumen cuantitativo de los resultados */
3244
+ summary: LintSummary;
3245
+ /** Lista detallada de cada problema encontrado */
3246
+ results: LintResult[];
3247
+ /** Metadata de la ejecución */
3248
+ metadata: {
3249
+ /** Timestamp ISO 8601 de ejecución */
3250
+ timestamp: string;
3251
+ /** Opciones utilizadas en esta ejecución */
3252
+ options: LintOptions;
3253
+ /** Versión del módulo lint */
3254
+ version: string;
3255
+ };
3256
+ }
3257
+ /**
3258
+ * Resumen cuantitativo de resultados de lint.
3259
+ *
3260
+ * Proporciona métricas agregadas para evaluación rápida del estado del repositorio.
3261
+ */
3262
+ interface LintSummary {
3263
+ /** Número total de archivos verificados en el directorio objetivo */
3264
+ filesChecked: number;
3265
+ /** Número total de errores fatales que requieren corrección */
3266
+ errors: number;
3267
+ /** Número total de advertencias que sugieren mejoras */
3268
+ warnings: number;
3269
+ /** Número de problemas auto-reparables con fix() */
3270
+ fixable: number;
3271
+ /** Tiempo de ejecución en milisegundos */
3272
+ executionTime: number;
3273
+ }
3274
+ /**
3275
+ * Resultado individual de validación para una entidad específica.
3276
+ *
3277
+ * Representa un problema detectado en un record, con contexto completo para debugging.
3278
+ *
3279
+ * @example
3280
+ * ```typescript
3281
+ * const result: LintResult = {
3282
+ * level: 'error',
3283
+ * filePath: '.gitgov/tasks/task-123.json',
3284
+ * validator: 'SCHEMA_VALIDATION',
3285
+ * message: 'Campo requerido "description" ausente',
3286
+ * entity: { type: 'task', id: 'task-123' },
3287
+ * fixable: false,
3288
+ * context: { field: 'description', expected: 'string' }
3289
+ * };
3290
+ * ```
3291
+ */
3292
+ interface LintResult {
3293
+ /** Nivel de severidad del problema detectado */
3294
+ level: "error" | "warning" | "info";
3295
+ /** Ruta relativa del archivo donde se detectó el problema */
3296
+ filePath: string;
3297
+ /** Tipo de validador que generó este resultado */
3298
+ validator: ValidatorType;
3299
+ /** Mensaje descriptivo del problema encontrado */
3300
+ message: string;
3301
+ /** Información de la entidad GitGovernance afectada */
3302
+ entity: {
3303
+ /**
3304
+ * Tipo de protocolo de la entidad.
3305
+ * Nota: Excluye "custom" que es solo para testing interno.
3306
+ */
3307
+ type: "actor" | "agent" | "task" | "cycle" | "execution" | "changelog" | "feedback";
3308
+ /** ID único de la entidad en el formato del protocolo */
3309
+ id: string;
3310
+ };
3311
+ /** Indica si el error es auto-reparable con fix() */
3312
+ fixable: boolean;
3313
+ /**
3314
+ * Indica si el error fue reparado automáticamente (post-fix)
3315
+ * Solo presente después de ejecutar fix().
3316
+ */
3317
+ fixed?: boolean;
3318
+ /**
3319
+ * Contexto adicional para debugging
3320
+ * Provee información específica del campo problemático.
3321
+ */
3322
+ context?: {
3323
+ /** Campo específico con problema (ej: 'description', 'payloadChecksum') */
3324
+ field?: string;
3325
+ /** Valor actual del campo */
3326
+ actual?: unknown;
3327
+ /** Valor esperado del campo */
3328
+ expected?: unknown;
3329
+ };
3330
+ }
3331
+ /**
3332
+ * Tipos de validadores disponibles en el pipeline.
3333
+ *
3334
+ * Cada tipo representa una categoría específica de validación.
3335
+ * Los validadores se ejecutan en orden y pueden ser habilitados/deshabilitados vía opciones.
3336
+ *
3337
+ * @example
3338
+ * ```typescript
3339
+ * const result: LintResult = {
3340
+ * validator: 'SCHEMA_VALIDATION',
3341
+ * // ...
3342
+ * };
3343
+ * ```
3344
+ */
3345
+ type ValidatorType =
3346
+ /** Validación de schema JSON usando AJV */
3347
+ "SCHEMA_VALIDATION"
3348
+ /** Validación de integridad referencial (referencias existen) */
3349
+ | "REFERENTIAL_INTEGRITY"
3350
+ /** Validación de referencias tipadas por prefijo (task:, file:, etc) */
3351
+ | "TYPED_REFERENCE"
3352
+ /** Validación de consistencia bidireccional (Task↔Cycle) */
3353
+ | "BIDIRECTIONAL_CONSISTENCY"
3354
+ /** Validación de estructura header/payload de embedded metadata */
3355
+ | "EMBEDDED_METADATA_STRUCTURE"
3356
+ /** Verificación de checksum SHA256 */
3357
+ | "CHECKSUM_VERIFICATION"
3358
+ /** Validación de estructura de firmas Ed25519 */
3359
+ | "SIGNATURE_STRUCTURE"
3360
+ /** Validación de convenciones de nombres de archivos */
3361
+ | "FILE_NAMING_CONVENTION"
3362
+ /** Validación de consistencia temporal (createdAt ≤ updatedAt) */
3363
+ | "TEMPORAL_CONSISTENCY"
3364
+ /** Validación de resolución de actorIds */
3365
+ | "ACTOR_RESOLUTION"
3366
+ /** Detección de referencias a entidades con status 'discarded' */
3367
+ | "SOFT_DELETE_DETECTION"
3368
+ /** Detección de records con schema obsoleto (requiere migración) */
3369
+ | "SCHEMA_VERSION_MISMATCH";
3370
+ /**
3371
+ * Contexto de ejecución para validación de un record individual.
3372
+ *
3373
+ * Proporciona información necesaria para validadores individuales.
3374
+ */
3375
+ interface ValidationContext {
3376
+ /** Path del archivo siendo validado */
3377
+ filePath: string;
3378
+ /** Configuración de validadores habilitados */
3379
+ enabledValidators: ValidatorType[];
3380
+ /**
3381
+ * Caché de records ya cargados (para referencias)
3382
+ * Evita cargar el mismo record múltiples veces.
3383
+ */
3384
+ recordCache?: Map<string, GitGovRecord>;
3385
+ /** Modo fail-fast habilitado */
3386
+ failFast: boolean;
3387
+ }
3388
+ /**
3389
+ * Options for auto-fix operation.
3390
+ *
3391
+ * Controls which problems to repair and how the repair is executed.
3392
+ * Includes configuration for backups and change signing.
3393
+ *
3394
+ * @example
3395
+ * ```typescript
3396
+ * const fixReport = await lintModule.fix(lintReport, {
3397
+ * fixTypes: ['SCHEMA_VERSION_MISMATCH', 'EMBEDDED_METADATA_STRUCTURE'],
3398
+ * createBackups: true,
3399
+ * keyId: 'system:migrator',
3400
+ * privateKey: systemPrivateKey,
3401
+ * dryRun: false
3402
+ * });
2835
3403
  * ```
2836
3404
  */
2837
- declare function createEmbeddedMetadataRecord<T extends GitGovRecordPayload>(payload: T, options?: CreateEmbeddedMetadataOptions): Promise<EmbeddedMetadataRecord<T>>;
3405
+ interface FixOptions {
3406
+ /**
3407
+ * Types of problems to repair (default: all fixable)
3408
+ * If specified, only repairs the indicated types.
3409
+ */
3410
+ fixTypes?: ValidatorType[];
3411
+ /**
3412
+ * Create backups before modifying files (default: true)
3413
+ * Creates .backup-{timestamp} file before each modification.
3414
+ */
3415
+ createBackups?: boolean;
3416
+ /**
3417
+ * KeyId (actorId) for automatic change signing (default: 'system:migrator')
3418
+ * This value is used as the keyId parameter in signPayload().
3419
+ */
3420
+ keyId?: string;
3421
+ /**
3422
+ * Private key for signing fixed records (REQUIRED for legacy record fixes)
3423
+ * Used by signPayload() to create cryptographic signatures.
3424
+ */
3425
+ privateKey?: string;
3426
+ /**
3427
+ * Dry-run mode that reports without applying changes (default: false)
3428
+ * Useful for previewing what will be repaired.
3429
+ */
3430
+ dryRun?: boolean;
3431
+ }
3432
+ /**
3433
+ * Reporte de operación de auto-fix.
3434
+ *
3435
+ * Contiene resumen de reparaciones y detalles de cada fix aplicado.
3436
+ *
3437
+ * @example
3438
+ * ```typescript
3439
+ * const fixReport = await lintModule.fix(lintReport, fixOptions);
3440
+ * console.log(`Reparados: ${fixReport.summary.fixed}`);
3441
+ * console.log(`Fallidos: ${fixReport.summary.failed}`);
3442
+ * console.log(`Backups: ${fixReport.summary.backupsCreated}`);
3443
+ * ```
3444
+ */
3445
+ interface FixReport {
3446
+ /** Resumen de reparaciones aplicadas */
3447
+ summary: {
3448
+ /** Número de problemas reparados exitosamente */
3449
+ fixed: number;
3450
+ /** Número de problemas que fallaron al reparar */
3451
+ failed: number;
3452
+ /** Número de backups creados */
3453
+ backupsCreated: number;
3454
+ };
3455
+ /** Detalles de cada reparación */
3456
+ fixes: FixResult[];
3457
+ }
3458
+ /**
3459
+ * Resultado individual de reparación.
3460
+ *
3461
+ * Representa el resultado de intentar reparar un problema específico.
3462
+ */
3463
+ interface FixResult {
3464
+ /** Path del archivo reparado o intentado reparar */
3465
+ filePath: string;
3466
+ /** Tipo de problema reparado */
3467
+ validator: ValidatorType;
3468
+ /** Descripción de la reparación aplicada */
3469
+ action: string;
3470
+ /** Éxito de la reparación */
3471
+ success: boolean;
3472
+ /**
3473
+ * Error si falló la reparación
3474
+ * Solo presente si success = false.
3475
+ */
3476
+ error?: string;
3477
+ /**
3478
+ * Path del backup creado (si aplica)
3479
+ * Solo presente si createBackups = true y success = true.
3480
+ */
3481
+ backupPath?: string;
3482
+ }
2838
3483
 
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;
3484
+ /**
3485
+ * Structural validation module for GitGovernance records.
3486
+ *
3487
+ * Implements Quality Model Layer 1 with delegation to recordStore.read()
3488
+ * for base validation and adds additional validations for conventions and references.
3489
+ *
3490
+ * Implements ILintModule interface following the same pattern as all other adapters
3491
+ * (IBacklogAdapter, IFeedbackAdapter, etc.) for consistency and testability.
3492
+ *
3493
+ * @class LintModule
3494
+ * @implements {ILintModule}
3495
+ * @example
3496
+ * ```typescript
3497
+ * const lintModule: ILintModule = new LintModule({
3498
+ * recordStore: taskStore,
3499
+ * indexerAdapter: indexerAdapter // optional
3500
+ * });
3501
+ *
3502
+ * const report = await lintModule.lint({ validateReferences: true });
3503
+ * ```
3504
+ */
3505
+ declare class LintModule implements ILintModule {
3506
+ private readonly recordStore;
3507
+ private readonly indexerAdapter;
3508
+ private readonly fileSystem;
3509
+ private lastBackupPath;
3510
+ /**
3511
+ * Constructor for LintModule with graceful degradation.
3512
+ *
3513
+ * @param dependencies - Module dependencies (some optional)
3514
+ * @throws {Error} If recordStore is not present
3515
+ *
3516
+ * @example
3517
+ * ```typescript
3518
+ * const lintModule = new LintModule({
3519
+ * recordStore: taskStore, // REQUIRED
3520
+ * indexerAdapter: indexerAdapter, // optional
3521
+ * fileSystem: customFileSystem // optional (default: Node.js fs)
3522
+ * });
3523
+ * ```
3524
+ */
3525
+ constructor(dependencies: LintModuleDependencies);
3526
+ /**
3527
+ * Valida todos los records en el directorio especificado.
3528
+ *
3529
+ * Usa delegation pattern: llama a recordStore.read() que internamente usa loaders
3530
+ * para validar schema + embedded metadata. Luego agrega validaciones adicionales
3531
+ * (convenciones, referencias).
3532
+ *
3533
+ * @param options - Opciones de configuración
3534
+ * @returns {Promise<LintReport>} Reporte consolidado con todos los resultados
3535
+ *
3536
+ * @example
3537
+ * ```typescript
3538
+ * const report = await lintModule.lint({
3539
+ * path: '.gitgov/',
3540
+ * validateReferences: true,
3541
+ * validateActors: true,
3542
+ * concurrent: true
3543
+ * });
3544
+ *
3545
+ * console.log(`Errors: ${report.summary.errors}`);
3546
+ * console.log(`Warnings: ${report.summary.warnings}`);
3547
+ * ```
3548
+ */
3549
+ lint(options?: Partial<LintOptions>): Promise<LintReport>;
3550
+ /**
3551
+ * Validates a specific file and returns its results.
3552
+ * Ultra-fast validation for single records (target: <50ms).
3553
+ *
3554
+ * @param filePath - Path to the file to validate
3555
+ * @param options - Configuration options
3556
+ * @returns {Promise<LintReport>} Lint report for this single file
3557
+ *
3558
+ * @example
3559
+ * ```typescript
3560
+ * const report = await lintModule.lintFile('.gitgov/tasks/1234567890-task-example.json', {
3561
+ * validateReferences: true
3562
+ * });
3563
+ * ```
3564
+ */
3565
+ lintFile(filePath: string, options?: Partial<LintOptions>): Promise<LintReport>;
3566
+ /**
3567
+ * Valida un record individual y retorna sus resultados.
3568
+ *
3569
+ * @private
3570
+ * @param recordId - ID del record a validar
3571
+ * @param options - Opciones de configuración
3572
+ * @returns {Promise<LintResult[]>} Array de resultados para este record
3573
+ */
3574
+ private lintSingleRecord;
3575
+ /**
3576
+ * Valida un archivo específico.
3577
+ *
3578
+ * Útil para validación en vivo (ej: dashboard, IDE integration).
3579
+ *
3580
+ * @param filePath - Path del archivo a validar
3581
+ * @param options - Opciones de configuración
3582
+ * @returns {Promise<LintResult[]>} Resultados de validación para este archivo
3583
+ *
3584
+ * @example
3585
+ * ```typescript
3586
+ * const results = await lintModule.lintFile(
3587
+ * '.gitgov/tasks/task-123.json',
3588
+ * { validateReferences: true }
3589
+ * );
3590
+ * ```
3591
+ */
3592
+ /**
3593
+ * Applies automatic repairs to problems marked as fixable.
3594
+ *
3595
+ * @param lintReport - Lint report with detected problems
3596
+ * @param fixOptions - Options for the fix operation
3597
+ * @returns {Promise<FixReport>} Report of applied repairs
3598
+ *
3599
+ * @example
3600
+ * ```typescript
3601
+ * const lintReport = await lintModule.lint();
3602
+ * const fixReport = await lintModule.fix(lintReport, {
3603
+ * createBackups: true,
3604
+ * keyId: 'system:migrator'
3605
+ * });
3606
+ *
3607
+ * console.log(`Fixed: ${fixReport.summary.fixed}`);
3608
+ * ```
3609
+ */
3610
+ fix(lintReport: LintReport, fixOptions?: Partial<FixOptions>): Promise<FixReport>;
3611
+ /**
3612
+ * Splits an array into chunks of the specified size.
3613
+ * @private
3614
+ */
3615
+ private chunkArray;
3616
+ /**
3617
+ * Discovers all records with their types by scanning the filesystem.
3618
+ * This ensures we know the correct type for each record based on its directory.
3619
+ * @private
3620
+ */
3621
+ private discoverAllRecordsWithTypes;
3622
+ /**
3623
+ * Gets the file path for a given recordId.
3624
+ * Matches the format used by RecordStore.getRecordPath()
3625
+ * @private
3626
+ */
3627
+ private getFilePath;
3628
+ /**
3629
+ * Extracts the recordId from a filePath.
3630
+ * @private
3631
+ */
3632
+ private extractRecordId;
3633
+ /**
3634
+ * Detects the entity type from a recordId.
3635
+ * @private
3636
+ */
3637
+ private getEntityType;
3638
+ /**
3639
+ * Detects the validator type based on the error.
3640
+ * @private
3641
+ */
3642
+ private detectValidatorType;
3643
+ /**
3644
+ * Determines if an error is fixable.
3645
+ * @private
3646
+ */
3647
+ private isFixable;
3648
+ /**
3649
+ * Validates conventions (file naming, timestamps, etc).
3650
+ * Implements EARS-13 through EARS-16.
3651
+ * @private
3652
+ */
3653
+ private validateConventions;
3654
+ /**
3655
+ * Validates references (typed references, bidirectional consistency).
3656
+ * Implements EARS-17 through EARS-22.
3657
+ * Requires indexerAdapter to be present.
3658
+ * @private
3659
+ */
3660
+ private validateReferences;
3661
+ /**
3662
+ * Validates actorIds (resolution in .gitgov/actors/).
3663
+ * Implements EARS-19.
3664
+ * @private
3665
+ */
3666
+ private validateActors;
3667
+ /**
3668
+ * Applies a specific repair based on the problem type.
3669
+ * @private
3670
+ */
3671
+ private applyFix;
3672
+ /**
3673
+ * Repairs a legacy record by wrapping it in embedded metadata.
3674
+ * Implements EARS-24: Normalize legacy records with signature.
3675
+ * @private
3676
+ */
3677
+ private fixLegacyRecord;
3678
+ /**
3679
+ * Repairs bidirectional inconsistencies between Task and Cycle.
3680
+ * Implements EARS-25: Sync bidirectional references.
3681
+ * @private
3682
+ */
3683
+ private fixBidirectionalReference;
3684
+ /**
3685
+ * Recalculates the checksum of a record.
3686
+ * Implements checksum repair for corrupted checksums.
3687
+ * @private
3688
+ */
3689
+ private recalculateChecksum;
3690
+ /**
3691
+ * Creates a backup of a file.
3692
+ * @private
3693
+ */
3694
+ private createBackup;
3695
+ /**
3696
+ * Fixes signature structure errors by analyzing specific errors and applying targeted fixes.
3697
+ * Reads the record directly (bypassing validation), extracts payload, and fixes signature issues:
3698
+ * - Adds missing 'notes' field with a valid value
3699
+ * - Removes additional properties not allowed
3700
+ * - Regenerates invalid signatures
3701
+ * Works even when signatures have invalid format (e.g., "placeholder" instead of base64).
3702
+ * @private
3703
+ */
3704
+ private fixSignatureStructure;
3705
+ /**
3706
+ * Restores a file from its most recent backup.
3707
+ * Implements EARS-32: Restore backup if fix fails.
3708
+ * @private
3709
+ */
3710
+ private restoreBackup;
3711
+ }
3712
+
3713
+ /**
3714
+ * Lint Module - Structural Validation for GitGovernance Records
3715
+ *
3716
+ * This module provides comprehensive validation capabilities for GitGovernance records,
3717
+ * implementing Quality Model Layer 1 (Structural + Referential Integrity).
3718
+ *
3719
+ * Follows the same architectural pattern as all other adapters with public interface
3720
+ * (ILintModule) for dependency injection and testability.
3721
+ *
3722
+ * @module lint
3723
+ * @example
3724
+ * ```typescript
3725
+ * import { LintModule, type ILintModule } from '@gitgov/core/lint';
3726
+ *
3727
+ * const lintModule: ILintModule = new LintModule({
3728
+ * recordStore: taskStore,
3729
+ * indexerAdapter: indexerAdapter // optional
3730
+ * });
3731
+ *
3732
+ * // Validate all records
3733
+ * const report = await lintModule.lint({ validateReferences: true });
3734
+ * console.log(`Errors: ${report.summary.errors}`);
3735
+ *
3736
+ * // Auto-fix problems
3737
+ * if (report.summary.fixable > 0) {
3738
+ * const fixReport = await lintModule.fix(report, { createBackups: true });
3739
+ * console.log(`Fixed: ${fixReport.summary.fixed}`);
3740
+ * }
3741
+ * ```
3742
+ */
3743
+
3744
+ type index$4_FileSystem = FileSystem;
3745
+ type index$4_FixOptions = FixOptions;
3746
+ type index$4_FixReport = FixReport;
3747
+ type index$4_FixResult = FixResult;
3748
+ type index$4_ILintModule = ILintModule;
3749
+ type index$4_LintModule = LintModule;
3750
+ declare const index$4_LintModule: typeof LintModule;
3751
+ type index$4_LintModuleDependencies = LintModuleDependencies;
3752
+ type index$4_LintOptions = LintOptions;
3753
+ type index$4_LintReport = LintReport;
3754
+ type index$4_LintResult = LintResult;
3755
+ type index$4_LintSummary = LintSummary;
3756
+ type index$4_ValidationContext = ValidationContext;
3757
+ type index$4_ValidatorType = ValidatorType;
2852
3758
  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 };
3759
+ export { type index$4_FileSystem as FileSystem, type index$4_FixOptions as FixOptions, type index$4_FixReport as FixReport, type index$4_FixResult as FixResult, type index$4_ILintModule as ILintModule, index$4_LintModule as LintModule, type index$4_LintModuleDependencies as LintModuleDependencies, type index$4_LintOptions as LintOptions, type index$4_LintReport as LintReport, type index$4_LintResult as LintResult, type index$4_LintSummary as LintSummary, type index$4_ValidationContext as ValidationContext, type index$4_ValidatorType as ValidatorType };
2854
3760
  }
2855
3761
 
2856
3762
  type LogLevel = "debug" | "info" | "warn" | "error" | "silent";
@@ -6707,11 +7613,6 @@ declare function validateEmbeddedMetadataDetailed(data: unknown): ValidationResu
6707
7613
  * Full validation for EmbeddedMetadataRecord including schema, checksum, and signatures
6708
7614
  */
6709
7615
  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
7616
 
6716
7617
  declare function validateWorkflowMethodologyConfigSchema(data: unknown): [boolean, ValidateFunction["errors"]];
6717
7618
  /**
@@ -6762,7 +7663,6 @@ declare const index$1_validateChangelogRecordDetailed: typeof validateChangelogR
6762
7663
  declare const index$1_validateChangelogRecordSchema: typeof validateChangelogRecordSchema;
6763
7664
  declare const index$1_validateCycleRecordDetailed: typeof validateCycleRecordDetailed;
6764
7665
  declare const index$1_validateCycleRecordSchema: typeof validateCycleRecordSchema;
6765
- declare const index$1_validateEmbeddedMetadataBusinessRules: typeof validateEmbeddedMetadataBusinessRules;
6766
7666
  declare const index$1_validateEmbeddedMetadataDetailed: typeof validateEmbeddedMetadataDetailed;
6767
7667
  declare const index$1_validateEmbeddedMetadataSchema: typeof validateEmbeddedMetadataSchema;
6768
7668
  declare const index$1_validateExecutionRecordDetailed: typeof validateExecutionRecordDetailed;
@@ -6783,7 +7683,7 @@ declare const index$1_validateWorkflowMethodologyConfigBusinessRules: typeof val
6783
7683
  declare const index$1_validateWorkflowMethodologyConfigDetailed: typeof validateWorkflowMethodologyConfigDetailed;
6784
7684
  declare const index$1_validateWorkflowMethodologyConfigSchema: typeof validateWorkflowMethodologyConfigSchema;
6785
7685
  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 };
7686
+ 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
7687
  }
6788
7688
 
6789
7689
  interface DiagramNode {
@@ -7077,4 +7977,4 @@ declare namespace index {
7077
7977
  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
7978
  }
7079
7979
 
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 };
7980
+ export { index$7 as Adapters, index$b as BacklogAdapter, index$e as ChangelogAdapter, index$9 as Config, index$6 as Crypto, index as DiagramGenerator, index$i as EventBus, index$f as ExecutionAdapter, index$5 as Factories, index$g as FeedbackAdapter, index$h as IdentityAdapter, index$a as IndexerAdapter, index$4 as Lint, index$3 as Logger, index$d as MetricsAdapter, index$8 as ProjectAdapter, index$k as Records, index$2 as Schemas, index$j as Store, index$1 as Validation, index$c as WorkflowMethodologyAdapter };