@gitgov/core 1.8.0 → 1.8.3

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/README.md CHANGED
@@ -4,7 +4,7 @@
4
4
  [![License: MPL-2.0](https://img.shields.io/badge/License-MPL%202.0-brightgreen.svg)](https://opensource.org/licenses/MPL-2.0)
5
5
  [![TypeScript](https://img.shields.io/badge/TypeScript-strict-blue.svg)](./tsconfig.json)
6
6
 
7
- `@gitgov/core` is the **SDK** for the GitGovernance ecosystem. It provides a type-safe, local-first, and schema-driven API to manage identities, agents, and workflows in software projects.
7
+ `@gitgov/core` is the **SDK** for the GitGovernance ecosystem. It provides a type-safe, local-first, and schema-driven API to manage identities, agents, tasks, and workflows in software projects.
8
8
 
9
9
  ## 🚀 Quick Start
10
10
 
@@ -1218,7 +1218,7 @@ interface IIdentityAdapter {
1218
1218
  resolveCurrentActorId(originalActorId: string): Promise<string>;
1219
1219
  getCurrentActor(): Promise<ActorRecord>;
1220
1220
  getEffectiveActorForAgent(agentId: string): Promise<ActorRecord | null>;
1221
- signRecord(record: GitGovRecord, actorId: string, role: string): Promise<GitGovRecord>;
1221
+ signRecord(record: GitGovRecord, actorId: string, role: string, notes: string): Promise<GitGovRecord>;
1222
1222
  rotateActorKey(actorId: string): Promise<{
1223
1223
  oldActor: ActorRecord;
1224
1224
  newActor: ActorRecord;
@@ -1249,7 +1249,7 @@ declare class IdentityAdapter implements IIdentityAdapter {
1249
1249
  createActor(payload: ActorPayload, _signerId: string): Promise<ActorRecord>;
1250
1250
  getActor(actorId: string): Promise<ActorRecord | null>;
1251
1251
  listActors(): Promise<ActorRecord[]>;
1252
- signRecord(record: GitGovRecord, actorId: string, role: string): Promise<GitGovRecord>;
1252
+ signRecord(record: GitGovRecord, actorId: string, role: string, notes: string): Promise<GitGovRecord>;
1253
1253
  /**
1254
1254
  * Resolves the current active ActorRecord ID by following the succession chain.
1255
1255
  * This is critical for AgentRecord operations after key rotation.
@@ -1887,8 +1887,15 @@ declare class ConfigManager {
1887
1887
  loadConfig(): Promise<GitGovConfig | null>;
1888
1888
  /**
1889
1889
  * Load GitGovernance session state
1890
+ * [EARS-53] Auto-detects actor from .key files if no session or no actorId exists
1890
1891
  */
1891
1892
  loadSession(): Promise<GitGovSession | null>;
1893
+ /**
1894
+ * [EARS-53] Detect actor from .key files in .gitgov/actors/
1895
+ * Returns the actor ID if exactly one .key file exists, or the first one if multiple exist.
1896
+ * Private keys (.key files) indicate which actors can sign on this machine.
1897
+ */
1898
+ detectActorFromKeyFiles(): Promise<string | null>;
1892
1899
  /**
1893
1900
  * Get root cycle from configuration
1894
1901
  */
@@ -2139,7 +2146,7 @@ interface IBacklogAdapter {
2139
2146
  getAllTasks(): Promise<TaskRecord[]>;
2140
2147
  submitTask(taskId: string, actorId: string): Promise<TaskRecord>;
2141
2148
  approveTask(taskId: string, actorId: string): Promise<TaskRecord>;
2142
- updateTask(taskId: string, payload: Partial<TaskRecord>): Promise<TaskRecord>;
2149
+ updateTask(taskId: string, payload: Partial<TaskRecord>, actorId: string): Promise<TaskRecord>;
2143
2150
  activateTask(taskId: string, actorId: string): Promise<TaskRecord>;
2144
2151
  completeTask(taskId: string, actorId: string): Promise<TaskRecord>;
2145
2152
  pauseTask(taskId: string, actorId: string, reason?: string): Promise<TaskRecord>;
@@ -2252,8 +2259,9 @@ declare class BacklogAdapter implements IBacklogAdapter {
2252
2259
  deleteTask(taskId: string, actorId: string): Promise<void>;
2253
2260
  /**
2254
2261
  * Updates a task with new payload
2262
+ * [EARS-28] Signs the updated record with the editor's signature
2255
2263
  */
2256
- updateTask(taskId: string, payload: Partial<TaskRecord>): Promise<TaskRecord>;
2264
+ updateTask(taskId: string, payload: Partial<TaskRecord>, actorId: string): Promise<TaskRecord>;
2257
2265
  /**
2258
2266
  * Gets tasks assigned to a specific actor
2259
2267
  */
@@ -8296,6 +8304,15 @@ interface SyncPushResult {
8296
8304
  conflictInfo?: ConflictInfo;
8297
8305
  /** Error message if operation failed */
8298
8306
  error?: string;
8307
+ /** [EARS-54] Implicit pull results when push does reconciliation with remote */
8308
+ implicitPull?: {
8309
+ /** Whether changes were pulled from remote */
8310
+ hasChanges: boolean;
8311
+ /** Number of files updated from remote */
8312
+ filesUpdated: number;
8313
+ /** Whether index was regenerated */
8314
+ reindexed: boolean;
8315
+ };
8299
8316
  }
8300
8317
  /**
8301
8318
  * Options for pullState operation
@@ -8303,6 +8320,8 @@ interface SyncPushResult {
8303
8320
  interface SyncPullOptions {
8304
8321
  /** Force re-indexing even if there are no new changes */
8305
8322
  forceReindex?: boolean;
8323
+ /** [EARS-62] Force pull even if local changes would be overwritten */
8324
+ force?: boolean;
8306
8325
  }
8307
8326
  /**
8308
8327
  * Result of pullState operation
@@ -8322,6 +8341,8 @@ interface SyncPullResult {
8322
8341
  conflictInfo?: ConflictInfo;
8323
8342
  /** Error message if operation failed */
8324
8343
  error?: string;
8344
+ /** [EARS-62] Files that were forcefully overwritten (when force: true) */
8345
+ forcedOverwrites?: string[];
8325
8346
  }
8326
8347
  /**
8327
8348
  * Options for resolveConflict operation
@@ -8366,8 +8387,13 @@ interface ConflictInfo {
8366
8387
  }
8367
8388
  /**
8368
8389
  * Auxiliary type to identify the conflict type
8390
+ *
8391
+ * Git-Native conflict model (post-refactor):
8392
+ * - rebase_conflict: Used for all Git-level conflicts during push/pull
8393
+ * - local_changes_conflict: Used when pull would overwrite local changes (EARS-61)
8394
+ * - integrity_violation: Used when resolution commits are missing
8369
8395
  */
8370
- type ConflictType = "rebase_conflict" | "merge_conflict" | "integrity_violation" | "unresolved_markers";
8396
+ type ConflictType = "rebase_conflict" | "integrity_violation" | "local_changes_conflict";
8371
8397
  /**
8372
8398
  * Information about a detected integrity violation
8373
8399
  */
@@ -8541,6 +8567,17 @@ declare class SyncModule {
8541
8567
  * [EARS-5]
8542
8568
  */
8543
8569
  calculateStateDelta(sourceBranch: string): Promise<StateDeltaFile[]>;
8570
+ /**
8571
+ * [EARS-60] Detect file-level conflicts and identify remote-only changes.
8572
+ *
8573
+ * A conflict exists when:
8574
+ * 1. A file was modified by the remote during implicit pull
8575
+ * 2. AND the LOCAL USER also modified that same file (content in tempDir differs from what was in git before pull)
8576
+ *
8577
+ * This catches conflicts that git rebase can't detect because we copy files AFTER the pull.
8578
+ *
8579
+ * @param tempDir - Directory containing local .gitgov/ files (preserved before checkout)
8580
+ * @param repoRoot - Repository root path
8544
8581
  /**
8545
8582
  * Checks if a rebase is in progress.
8546
8583
  *
@@ -8591,9 +8628,20 @@ declare class SyncModule {
8591
8628
  */
8592
8629
  pullState(options?: SyncPullOptions): Promise<SyncPullResult>;
8593
8630
  /**
8594
- * Resolves state conflicts in a governed manner.
8595
- * Updates resolved Records (recalculates checksum and adds resolver signature),
8596
- * creates rebase and resolution commits signed according to protocol.
8631
+ * Resolves state conflicts in a governed manner (Git-Native).
8632
+ *
8633
+ * Git-Native Flow:
8634
+ * 1. User resolves conflicts using standard Git tools (edit files, remove markers)
8635
+ * 2. User stages resolved files: git add .gitgov/
8636
+ * 3. User runs: gitgov sync resolve --reason "reason"
8637
+ *
8638
+ * This method:
8639
+ * - Verifies that a rebase is in progress
8640
+ * - Checks that no conflict markers remain in staged files
8641
+ * - Updates resolved Records with new checksums and signatures
8642
+ * - Continues the git rebase (git rebase --continue)
8643
+ * - Creates a signed resolution commit
8644
+ * - Regenerates the index
8597
8645
  *
8598
8646
  * [EARS-17 through EARS-23]
8599
8647
  */