@gitgov/core 2.7.2 → 2.9.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,7 +1,7 @@
1
1
  import { S as SessionStore } from './session_store-I4Z6PW2c.js';
2
2
  import { k as ISessionManager, a as GitGovSession, A as ActorState, S as SyncPreferencesUpdate, K as KeyProvider, h as FileLister, F as FsFileListerOptions, i as FileListOptions, j as FileStats, G as GitGovConfig } from './index-LULVRsCZ.js';
3
- import { q as IIdentityAdapter, u as IdentityAdapterDependencies, S as SyncStateModuleDependencies, p as IEventStream } from './sync_state-C2a2RuBQ.js';
4
- import { A as ActorPayload, d as ActorRecord, G as GitGovRecord, l as ExecutionRecord, y as RecordStores, f as AgentRecord } from './record_projection.types-D9NkQbL_.js';
3
+ import { p as IIdentityAdapter, t as IdentityAdapterDependencies, J as SyncStateModuleDependencies, o as IEventStream } from './sync_state-B8X4NDKF.js';
4
+ import { A as ActorPayload, d as ActorRecord, G as GitGovRecord, k as ExecutionRecord, y as RecordStores, f as AgentRecord } from './record_projection.types-CFsl44em.js';
5
5
 
6
6
  /**
7
7
  * SessionManager - Local Session State Manager
package/dist/src/fs.d.ts CHANGED
@@ -1,11 +1,11 @@
1
- import { R as RecordStore, I as IdEncoder, a as IRecordProjector, G as GitGovRecord, b as IRecordProjection, c as IndexData, P as ProjectionContext } from './record_projection.types-D9NkQbL_.js';
2
- export { D as DEFAULT_ID_ENCODER } from './record_projection.types-D9NkQbL_.js';
1
+ import { R as RecordStore, I as IdEncoder, a as IRecordProjector, G as GitGovRecord, b as IRecordProjection, c as IndexData, P as ProjectionContext } from './record_projection.types-CFsl44em.js';
2
+ export { D as DEFAULT_ID_ENCODER } from './record_projection.types-CFsl44em.js';
3
3
  import { C as ConfigStore, G as GitGovConfig, a as GitGovSession, I as IGitModule, b as GitModuleDependencies, E as ExecOptions, c as ExecResult, d as ChangedFile, e as GetCommitHistoryOptions, f as CommitInfo, g as CommitAuthor } from './index-LULVRsCZ.js';
4
4
  export { F as FsFileListerOptions } from './index-LULVRsCZ.js';
5
- import { C as ConfigManager, I as ILintModule, L as LintOptions, a as LintReport, F as FixRecordOptions, b as FixReport, R as RecordStores, c as LintRecordContext, d as LintResult, e as ISyncStateModule, S as SyncStateModuleDependencies, f as StateDeltaFile, g as ConflictDiff, h as IntegrityViolation, A as AuditStateOptions, i as AuditStateReport, j as SyncStatePushOptions, k as SyncStatePushResult, l as SyncStatePullOptions, m as SyncStatePullResult, n as SyncStateResolveOptions, o as SyncStateResolveResult, p as IEventStream } from './sync_state-C2a2RuBQ.js';
5
+ import { C as ConfigManager, I as ILintModule, L as LintOptions, a as LintReport, F as FixRecordOptions, b as FixReport, R as RecordStores, c as LintRecordContext, d as LintResult, e as ISyncStateModule, S as SyncStatePushOptions, f as SyncStatePushResult, g as SyncStatePullOptions, h as SyncStatePullResult, i as SyncStateResolveOptions, j as SyncStateResolveResult, k as StateDeltaFile, l as ConflictDiff, m as IntegrityViolation, A as AuditStateOptions, n as AuditStateReport, o as IEventStream } from './sync_state-B8X4NDKF.js';
6
6
  import { S as SessionStore } from './session_store-I4Z6PW2c.js';
7
- import { S as SessionManager, I as IProjectInitializer, E as EnvironmentValidation, F as FsWorktreeSyncStateDependencies, a as FsWorktreeSyncStateConfig, b as IAgentRunner, P as ProtocolHandlerRegistry, A as AgentRunnerDependencies, R as RunOptions, c as AgentResponse } from './agent_runner-DijNVjaF.js';
8
- export { f as FsFileLister, d as FsKeyProvider, e as FsKeyProviderOptions } from './agent_runner-DijNVjaF.js';
7
+ import { S as SessionManager, I as IProjectInitializer, E as EnvironmentValidation, F as FsWorktreeSyncStateDependencies, a as FsWorktreeSyncStateConfig, b as IAgentRunner, P as ProtocolHandlerRegistry, A as AgentRunnerDependencies, R as RunOptions, c as AgentResponse } from './agent_runner-Cgle_zVX.js';
8
+ export { f as FsFileLister, d as FsKeyProvider, e as FsKeyProviderOptions } from './agent_runner-Cgle_zVX.js';
9
9
 
10
10
  /**
11
11
  * Serializer for FsRecordStore - allows custom serialization
@@ -314,7 +314,7 @@ declare class FsLintModule implements IFsLintModule {
314
314
  */
315
315
  lintRecord(record: GitGovRecord, context: LintRecordContext): LintResult[];
316
316
  /**
317
- * Delegates to LintModule.lintRecordReferences() for prefix validation.
317
+ * Delegates to LintModule.lintRecordReferences() for reference validation.
318
318
  */
319
319
  lintRecordReferences(record: GitGovRecord, context: LintRecordContext): LintResult[];
320
320
  /**
@@ -1049,184 +1049,23 @@ declare class LocalGitModule implements IGitModule {
1049
1049
  * @returns Path to project root, or null if not found
1050
1050
  */
1051
1051
  declare function findProjectRoot(startPath?: string): string | null;
1052
- /**
1053
- * Finds the project root by searching upwards.
1054
- * First looks for .gitgov (initialized project), then .git (for init).
1055
- *
1056
- * @param startPath - Starting path (default: process.cwd())
1057
- * @returns Path to project root, or null if not found
1058
- */
1059
- declare function findGitgovRoot(startPath?: string): string | null;
1060
- /**
1061
- * Gets the .gitgov directory path from project root.
1062
- *
1063
- * @throws Error if not inside a GitGovernance project
1064
- */
1065
- declare function getGitgovPath(): string;
1066
- /**
1067
- * Checks if current directory is inside a GitGovernance project.
1068
- */
1069
- declare function isGitgovProject(): boolean;
1070
1052
  /**
1071
1053
  * Reset the project root cache.
1072
1054
  * Useful for testing when switching between project contexts.
1073
1055
  */
1074
1056
  declare function resetDiscoveryCache(): void;
1075
-
1076
1057
  /**
1077
- * FsSyncStateModule - Manages state synchronization between local environment and gitgov-state branch
1058
+ * Compute the worktree base path for a given repo root.
1078
1059
  *
1079
- * Responsibilities:
1080
- * - Create and maintain the gitgov-state branch (local and remote)
1081
- * - Publish local changes (pushState)
1082
- * - Pull remote changes (pullState)
1083
- * - Resolve conflicts in a governed manner (resolveConflict)
1084
- * - Audit state integrity (auditState)
1060
+ * The CLI stores .gitgov/ state in ~/.gitgov/worktrees/<hash>/ — NOT inside
1061
+ * the repo directory. The hash is SHA-256(realpathSync(repoRoot))[0:12].
1062
+ *
1063
+ * Uses realpathSync to resolve symlinks (macOS /tmp/ → /private/tmp/).
1085
1064
  *
1086
- * Philosophy:
1087
- * - Pipeline Pattern: Sequential operations with validation at each phase
1088
- * - Fail-Fast: Early verifications to avoid costly operations
1089
- * - Strict Dependencies: All dependencies (git, config, identity, lint, indexer) are required for robust operations
1065
+ * @param repoRoot - Absolute path to the git repo root
1066
+ * @returns Path under ~/.gitgov/worktrees/{hash}
1090
1067
  */
1091
- declare class FsSyncStateModule implements ISyncStateModule {
1092
- private git;
1093
- private config;
1094
- private identity;
1095
- private lint;
1096
- private indexer;
1097
- /**
1098
- * Constructor with dependency injection
1099
- */
1100
- constructor(dependencies: SyncStateModuleDependencies);
1101
- /**
1102
- * Static method to bootstrap .gitgov/ from gitgov-state branch.
1103
- * Used when cloning a repo that has gitgov-state but .gitgov/ is not in the work branch.
1104
- *
1105
- * This method only requires GitModule and can be called before full SyncStateModule initialization.
1106
- *
1107
- * @param gitModule - GitModule instance for git operations
1108
- * @param stateBranch - Name of the state branch (default: "gitgov-state")
1109
- * @returns Promise<{ success: boolean; error?: string }>
1110
- */
1111
- static bootstrapFromStateBranch(gitModule: IGitModule, stateBranch?: string): Promise<{
1112
- success: boolean;
1113
- error?: string;
1114
- }>;
1115
- /**
1116
- * Gets the state branch name from configuration.
1117
- * Default: "gitgov-state"
1118
- *
1119
- * [EARS-A4]
1120
- */
1121
- getStateBranchName(): Promise<string>;
1122
- /**
1123
- * Ensures that the gitgov-state branch exists both locally and remotely.
1124
- * If it doesn't exist, creates it as an orphan branch.
1125
- *
1126
- * Use cases (4 edge cases):
1127
- * 1. Doesn't exist locally or remotely → Create orphan branch + initial commit + push
1128
- * 2. Exists remotely, not locally → Fetch + create local + set tracking
1129
- * 3. Exists locally, not remotely → Push + set tracking
1130
- * 4. Exists both → Verify tracking
1131
- *
1132
- * [EARS-A1, EARS-A2, EARS-A3]
1133
- */
1134
- ensureStateBranch(): Promise<void>;
1135
- /**
1136
- * Creates the gitgov-state orphan branch with an empty initial commit.
1137
- * Used by ensureStateBranch when the branch doesn't exist locally or remotely.
1138
- *
1139
- * [EARS-A1]
1140
- */
1141
- private createOrphanStateBranch;
1142
- /** Returns pending local changes not yet synced (delegates to calculateStateDelta) */
1143
- getPendingChanges(): Promise<StateDeltaFile[]>;
1144
- /**
1145
- * Calculates the file delta in .gitgov/ between the current branch and gitgov-state.
1146
- *
1147
- * [EARS-A5]
1148
- */
1149
- calculateStateDelta(sourceBranch: string): Promise<StateDeltaFile[]>;
1150
- /**
1151
- * [EARS-B23] Detect file-level conflicts and identify remote-only changes.
1152
- *
1153
- * A conflict exists when:
1154
- * 1. A file was modified by the remote during implicit pull
1155
- * 2. AND the LOCAL USER also modified that same file (content in tempDir differs from what was in git before pull)
1156
- *
1157
- * This catches conflicts that git rebase can't detect because we copy files AFTER the pull.
1158
- *
1159
- * @param tempDir - Directory containing local .gitgov/ files (preserved before checkout)
1160
- * @param repoRoot - Repository root path
1161
- /**
1162
- * Checks if a rebase is in progress.
1163
- *
1164
- * [EARS-D6]
1165
- */
1166
- isRebaseInProgress(): Promise<boolean>;
1167
- /**
1168
- * Checks for absence of conflict markers in specified files.
1169
- * Returns list of files that still have markers.
1170
- *
1171
- * [EARS-D7]
1172
- */
1173
- checkConflictMarkers(filePaths: string[]): Promise<string[]>;
1174
- /**
1175
- * Gets the diff of conflicted files for manual analysis.
1176
- * Useful so the actor can analyze conflicted changes before resolving.
1177
- *
1178
- * [EARS-E8]
1179
- */
1180
- getConflictDiff(filePaths?: string[]): Promise<ConflictDiff>;
1181
- /**
1182
- * Verifies integrity of previous resolutions in gitgov-state history.
1183
- * Returns list of violations if any exist.
1184
- *
1185
- * [EARS-E1, EARS-E2, EARS-E3]
1186
- */
1187
- verifyResolutionIntegrity(): Promise<IntegrityViolation[]>;
1188
- /**
1189
- * Complete audit of gitgov-state status.
1190
- * Verifies integrity of resolutions, signatures in Records, checksums and expected files.
1191
- *
1192
- * [EARS-E4, EARS-E5, EARS-E6, EARS-E7]
1193
- */
1194
- auditState(options?: AuditStateOptions): Promise<AuditStateReport>;
1195
- /**
1196
- * Publishes local state changes to gitgov-state.
1197
- * Implements 3 phases: verification, reconciliation, publication.
1198
- *
1199
- * [EARS-B1 through EARS-B7]
1200
- */
1201
- pushState(options: SyncStatePushOptions): Promise<SyncStatePushResult>;
1202
- /**
1203
- * Pulls remote changes from gitgov-state to the local environment.
1204
- * Includes automatic re-indexing if there are new changes.
1205
- *
1206
- * [EARS-C1 through EARS-C4]
1207
- * [EARS-C5] Requires remote to be configured (pull without remote makes no sense)
1208
- */
1209
- pullState(options?: SyncStatePullOptions): Promise<SyncStatePullResult>;
1210
- /**
1211
- * Resolves state conflicts in a governed manner (Git-Native).
1212
- *
1213
- * Git-Native Flow:
1214
- * 1. User resolves conflicts using standard Git tools (edit files, remove markers)
1215
- * 2. User stages resolved files: git add .gitgov/
1216
- * 3. User runs: gitgov sync resolve --reason "reason"
1217
- *
1218
- * This method:
1219
- * - Verifies that a rebase is in progress
1220
- * - Checks that no conflict markers remain in staged files
1221
- * - Updates resolved Records with new checksums and signatures
1222
- * - Continues the git rebase (git rebase --continue)
1223
- * - Creates a signed resolution commit
1224
- * - Regenerates the index
1225
- *
1226
- * [EARS-D1 through EARS-D7]
1227
- */
1228
- resolveConflict(options: SyncStateResolveOptions): Promise<SyncStateResolveResult>;
1229
- }
1068
+ declare function getWorktreeBasePath(repoRoot: string): string;
1230
1069
 
1231
1070
  /**
1232
1071
  * Worktree-based implementation of ISyncStateModule.
@@ -1466,4 +1305,4 @@ declare class FsRecordProjection implements IRecordProjection {
1466
1305
  clear(_context: ProjectionContext): Promise<void>;
1467
1306
  }
1468
1307
 
1469
- export { type FileSystem, FsAgentRunner, AgentRunnerDependencies as FsAgentRunnerDependencies, FsConfigStore, type FsFixOptions, FsLintModule, type FsLintModuleDependencies, type FsLintOptions, FsProjectInitializer, FsRecordProjection, type FsRecordProjectionOptions, FsRecordStore, FsSessionStore, FsSyncStateModule, FsWatcherStateModule, FsWorktreeSyncStateModule, LocalGitModule as GitModule, GitModuleDependencies, type IFsLintModule, IGitModule, LocalGitModule, createAgentRunner, createConfigManager, createSessionManager, findGitgovRoot, findProjectRoot, getGitgovPath, isGitgovProject, resetDiscoveryCache };
1308
+ export { type FileSystem, FsAgentRunner, AgentRunnerDependencies as FsAgentRunnerDependencies, FsConfigStore, type FsFixOptions, FsLintModule, type FsLintModuleDependencies, type FsLintOptions, FsProjectInitializer, FsRecordProjection, type FsRecordProjectionOptions, FsRecordStore, FsSessionStore, FsWatcherStateModule, FsWorktreeSyncStateModule, LocalGitModule as GitModule, GitModuleDependencies, type IFsLintModule, IGitModule, LocalGitModule, createAgentRunner, createConfigManager, createSessionManager, findProjectRoot, getWorktreeBasePath, resetDiscoveryCache };