@gitgov/core 2.2.0 → 2.4.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.
package/dist/src/fs.d.ts CHANGED
@@ -1,8 +1,11 @@
1
- import { R as RecordStore, I as IdEncoder, C as ConfigStore, G as GitGovConfig, a 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-D1RVufxB.js';
2
- export { D as DEFAULT_ID_ENCODER, F as FsFileListerOptions } from './index-D1RVufxB.js';
3
- import { C as ConfigManager, S as SessionManager, I as ILintModule, L as LintOptions, a as LintReport, F as FixRecordOptions, b as FixReport, R as RecordStores, c as IIndexerAdapter, G as GitGovRecord, d as LintRecordContext, e as LintResult, f as IProjectInitializer, E as EnvironmentValidation, g as ISyncStateModule, h as SyncStateModuleDependencies, i as StateDeltaFile, j as ConflictDiff, k as IntegrityViolation, A as AuditStateOptions, l as AuditStateReport, m as SyncStatePushOptions, n as SyncStatePushResult, o as SyncStatePullOptions, p as SyncStatePullResult, q as SyncStateResolveOptions, r as SyncStateResolveResult, s as IEventStream, t as IAgentRunner, P as ProtocolHandlerRegistry, u as AgentRunnerDependencies, v as RunOptions, w as AgentResponse } from './agent_runner-Cs5HXt4h.js';
4
- export { z as FsFileLister, x as FsKeyProvider, y as FsKeyProviderOptions } from './agent_runner-Cs5HXt4h.js';
5
- import { S as SessionStore, G as GitGovSession } from './key_provider-CRpHFGjN.js';
1
+ import { R as RecordStore, I as IdEncoder } from './record_store-BXKWqon5.js';
2
+ export { D as DEFAULT_ID_ENCODER } from './record_store-BXKWqon5.js';
3
+ import { C as ConfigStore, G as GitGovConfig, I as IGitModule, a as GitModuleDependencies, E as ExecOptions, b as ExecResult, c as ChangedFile, d as GetCommitHistoryOptions, e as CommitInfo, f as CommitAuthor } from './index-Bhc341pf.js';
4
+ export { F as FsFileListerOptions } from './index-Bhc341pf.js';
5
+ import { C as ConfigManager, S as SessionManager, 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 IProjectInitializer, E as EnvironmentValidation, f as ISyncStateModule, g as SyncStateModuleDependencies, h as StateDeltaFile, i as ConflictDiff, j as IntegrityViolation, A as AuditStateOptions, k as AuditStateReport, l as SyncStatePushOptions, m as SyncStatePushResult, n as SyncStatePullOptions, o as SyncStatePullResult, p as SyncStateResolveOptions, q as SyncStateResolveResult, r as IEventStream, s as IAgentRunner, P as ProtocolHandlerRegistry, t as AgentRunnerDependencies, u as RunOptions, v as AgentResponse } from './agent_runner-pr7h-9cV.js';
6
+ export { y as FsFileLister, w as FsKeyProvider, x as FsKeyProviderOptions } from './agent_runner-pr7h-9cV.js';
7
+ import { S as SessionStore, G as GitGovSession } from './key_provider-jjWek3w1.js';
8
+ import { I as IRecordProjector, G as GitGovRecord, a as IRecordProjection, b as IndexData, P as ProjectionContext } from './record_projection.types-B8AM7u8U.js';
6
9
 
7
10
  /**
8
11
  * Serializer for FsRecordStore - allows custom serialization
@@ -135,7 +138,7 @@ declare function createConfigManager(projectRoot: string): ConfigManager;
135
138
  */
136
139
  declare class FsSessionStore implements SessionStore {
137
140
  private readonly sessionPath;
138
- private readonly actorsPath;
141
+ private readonly keysPath;
139
142
  constructor(projectRootPath: string);
140
143
  /**
141
144
  * Load local session from .gitgov/.session.json
@@ -155,12 +158,12 @@ declare class FsSessionStore implements SessionStore {
155
158
  */
156
159
  saveSession(session: GitGovSession): Promise<void>;
157
160
  /**
158
- * Detect actor from .key files in .gitgov/actors/
161
+ * Detect actor from .key files in .gitgov/keys/
159
162
  *
160
163
  * [EARS-C1] Returns actor ID from first .key file
161
164
  * [EARS-C2] Returns first .key file alphabetically if multiple exist
162
165
  * [EARS-C3] Returns null if no .key files exist
163
- * [EARS-C4] Returns null if actors directory doesn't exist
166
+ * [EARS-C4] Returns null if keys directory doesn't exist
164
167
  * [EARS-C5] Ignores non-.key files
165
168
  * [EARS-C6] Returns null for empty directory
166
169
  *
@@ -237,8 +240,8 @@ interface FsLintModuleDependencies {
237
240
  lintModule: ILintModule;
238
241
  /** Record stores for reference lookups (OPTIONAL) */
239
242
  stores?: RecordStores;
240
- /** Indexer adapter for reference resolution (OPTIONAL) */
241
- indexerAdapter?: IIndexerAdapter;
243
+ /** Record projector for reference resolution (OPTIONAL) */
244
+ projector?: IRecordProjector;
242
245
  /** FileSystem abstraction for I/O (OPTIONAL, default: Node.js fs) */
243
246
  fileSystem?: FileSystem;
244
247
  }
@@ -432,7 +435,8 @@ declare class FsLintModule implements IFsLintModule {
432
435
  */
433
436
  declare class FsProjectInitializer implements IProjectInitializer {
434
437
  private readonly projectRoot;
435
- constructor(projectRoot: string);
438
+ private readonly repoRoot;
439
+ constructor(projectRoot: string, repoRoot?: string);
436
440
  /**
437
441
  * Creates the .gitgov/ directory structure.
438
442
  */
@@ -1131,6 +1135,8 @@ declare class FsSyncStateModule implements ISyncStateModule {
1131
1135
  * [EARS-A1]
1132
1136
  */
1133
1137
  private createOrphanStateBranch;
1138
+ /** Returns pending local changes not yet synced (delegates to calculateStateDelta) */
1139
+ getPendingChanges(): Promise<StateDeltaFile[]>;
1134
1140
  /**
1135
1141
  * Calculates the file delta in .gitgov/ between the current branch and gitgov-state.
1136
1142
  *
@@ -1218,6 +1224,91 @@ declare class FsSyncStateModule implements ISyncStateModule {
1218
1224
  resolveConflict(options: SyncStateResolveOptions): Promise<SyncStateResolveResult>;
1219
1225
  }
1220
1226
 
1227
+ /**
1228
+ * Reutiliza las mismas dependencias que FsSyncStateModule.
1229
+ * No requiere dependencias adicionales.
1230
+ */
1231
+ type FsWorktreeSyncStateDependencies = SyncStateModuleDependencies;
1232
+ /**
1233
+ * Configuration for worktree-based sync module.
1234
+ */
1235
+ type FsWorktreeSyncStateConfig = {
1236
+ /** Root directory of the git repository */
1237
+ repoRoot: string;
1238
+ /** State branch name (default: "gitgov-state") */
1239
+ stateBranchName?: string;
1240
+ /** Absolute path to worktree. Default: path.join(repoRoot, '.gitgov-worktree') */
1241
+ worktreePath?: string;
1242
+ };
1243
+
1244
+ /**
1245
+ * Worktree-based implementation of ISyncStateModule.
1246
+ *
1247
+ * Uses a permanent git worktree at <repoRoot>/.gitgov-worktree/ to
1248
+ * sync state with the gitgov-state branch. Eliminates branch switching,
1249
+ * stash, and temp directories.
1250
+ *
1251
+ * @see fs_worktree_sync_state_module.md for EARS specifications
1252
+ */
1253
+ declare class FsWorktreeSyncStateModule implements ISyncStateModule {
1254
+ private readonly deps;
1255
+ private readonly repoRoot;
1256
+ private readonly stateBranchName;
1257
+ private readonly worktreePath;
1258
+ private readonly gitgovPath;
1259
+ constructor(deps: FsWorktreeSyncStateDependencies, config: FsWorktreeSyncStateConfig);
1260
+ /** [WTSYNC-A4] Returns the worktree path */
1261
+ getWorktreePath(): string;
1262
+ /** [WTSYNC-A1..A6] Ensures worktree exists and is healthy */
1263
+ ensureWorktree(): Promise<void>;
1264
+ /** Check worktree health */
1265
+ private checkWorktreeHealth;
1266
+ /** Remove worktree cleanly */
1267
+ private removeWorktree;
1268
+ /** [WTSYNC-B1..B14] Push local state to remote */
1269
+ pushState(options: SyncStatePushOptions): Promise<SyncStatePushResult>;
1270
+ /** [WTSYNC-C1..C8] Pull remote state */
1271
+ pullState(options?: SyncStatePullOptions): Promise<SyncStatePullResult>;
1272
+ /** [WTSYNC-D1..D7] Resolve rebase conflict */
1273
+ resolveConflict(options: SyncStateResolveOptions): Promise<SyncStateResolveResult>;
1274
+ /** [WTSYNC-E8] Get configured state branch name */
1275
+ getStateBranchName(): Promise<string>;
1276
+ /** [WTSYNC-A5/A6] Ensure state branch exists */
1277
+ ensureStateBranch(): Promise<void>;
1278
+ /** Returns pending syncable changes not yet pushed (filters by shouldSyncFile) */
1279
+ getPendingChanges(): Promise<StateDeltaFile[]>;
1280
+ /** Calculate delta between source and worktree state branch */
1281
+ calculateStateDelta(_sourceBranch: string): Promise<StateDeltaFile[]>;
1282
+ /** [WTSYNC-E6] Check if rebase is in progress in worktree */
1283
+ isRebaseInProgress(): Promise<boolean>;
1284
+ /** Check for conflict markers in files */
1285
+ checkConflictMarkers(filePaths: string[]): Promise<string[]>;
1286
+ /** [WTSYNC-E7] Get structured conflict diff */
1287
+ getConflictDiff(filePaths?: string[]): Promise<ConflictDiff>;
1288
+ /** [WTSYNC-E1] Verify resolution integrity */
1289
+ verifyResolutionIntegrity(): Promise<IntegrityViolation[]>;
1290
+ /** [WTSYNC-E1..E5] Audit state */
1291
+ auditState(options?: AuditStateOptions): Promise<AuditStateReport>;
1292
+ /** Execute git command in repo root (throws on non-zero exit) */
1293
+ private execGit;
1294
+ /** Execute git command in worktree context (throws on non-zero exit) */
1295
+ private execInWorktree;
1296
+ /** Calculate file delta (uncommitted changes in worktree) */
1297
+ private calculateFileDelta;
1298
+ /** [WTSYNC-B4/B9/B10/B11] Stage only syncable files from delta (adds, mods, and deletions) */
1299
+ private stageSyncableFiles;
1300
+ /** Get list of conflicted files during rebase */
1301
+ private getConflictedFiles;
1302
+ /** Re-sign records after conflict resolution */
1303
+ private resignResolvedRecords;
1304
+ /** Re-index records from worktree */
1305
+ private reindex;
1306
+ /** Parse git diff --name-status output */
1307
+ private parseDiffOutput;
1308
+ /** Parse git status --porcelain output */
1309
+ private parseStatusOutput;
1310
+ }
1311
+
1221
1312
  interface WatcherStateModuleOptions {
1222
1313
  gitgovPath: string;
1223
1314
  debounceMs?: number;
@@ -1357,4 +1448,22 @@ declare class FsAgentRunner implements IAgentRunner {
1357
1448
  */
1358
1449
  declare function createAgentRunner(deps: AgentRunnerDependencies): IAgentRunner;
1359
1450
 
1360
- export { type FileSystem, FsAgentRunner, AgentRunnerDependencies as FsAgentRunnerDependencies, FsConfigStore, type FsFixOptions, FsLintModule, type FsLintModuleDependencies, type FsLintOptions, FsProjectInitializer, FsRecordStore, FsSessionStore, FsSyncStateModule, FsWatcherStateModule, LocalGitModule as GitModule, GitModuleDependencies, type IFsLintModule, IGitModule, LocalGitModule, createAgentRunner, createConfigManager, createSessionManager, findGitgovRoot, findProjectRoot, getGitgovPath, isGitgovProject, resetDiscoveryCache };
1451
+ type FsRecordProjectionOptions = {
1452
+ basePath: string;
1453
+ };
1454
+ /**
1455
+ * FsRecordProjection - Filesystem IRecordProjection for CLI.
1456
+ *
1457
+ * Writes IndexData as JSON to .gitgov/index.json using atomic write
1458
+ * (write to temp file + rename) to prevent corruption on crash.
1459
+ */
1460
+ declare class FsRecordProjection implements IRecordProjection {
1461
+ private readonly indexPath;
1462
+ constructor(options: FsRecordProjectionOptions);
1463
+ persist(data: IndexData, _context: ProjectionContext): Promise<void>;
1464
+ read(_context: ProjectionContext): Promise<IndexData | null>;
1465
+ exists(_context: ProjectionContext): Promise<boolean>;
1466
+ clear(_context: ProjectionContext): Promise<void>;
1467
+ }
1468
+
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 };