@gitgov/core 2.3.0 → 2.5.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,4 +1,4 @@
1
- import { I as ISessionManager, S as SessionStore, G as GitGovSession, A as ActorState, a as SyncPreferencesUpdate, K as KeyProvider } from './key_provider-CRpHFGjN.js';
1
+ import { I as ISessionManager, S as SessionStore, G as GitGovSession, A as ActorState, a as SyncPreferencesUpdate, K as KeyProvider } from './key_provider-jjWek3w1.js';
2
2
  import { k as IConfigManager, C as ConfigStore, G as GitGovConfig, S as SyncConfig, l as SyncDefaults, A as AuditState, j as AuditStateUpdate, g as FileLister, F as FsFileListerOptions, h as FileListOptions, i as FileStats, I as IGitModule } from './index-Bhc341pf.js';
3
3
  import { R as RecordStore } from './record_store-BXKWqon5.js';
4
4
  import { Q as BaseEvent, X as EventHandler, Z as EventSubscription, a0 as GitGovEvent, G as GitGovRecord, v as GitGovRecordType, I as IRecordProjector, A as ActorPayload, c as ActorRecord, R as RecordStores$1, l as ExecutionRecord, e as AgentRecord } from './record_projection.types-B8AM7u8U.js';
@@ -152,7 +152,7 @@ declare class SessionManager implements ISessionManager {
152
152
  /**
153
153
  * FsKeyProvider - Filesystem-based KeyProvider implementation
154
154
  *
155
- * Stores private keys alongside actor records in .gitgov/actors/{actorId}.key
155
+ * Stores private keys in .gitgov/keys/{actorId}.key
156
156
  * Used in development and CLI environments.
157
157
  *
158
158
  * @module key_provider/fs/fs_key_provider
@@ -162,8 +162,8 @@ declare class SessionManager implements ISessionManager {
162
162
  * Options for FsKeyProvider.
163
163
  */
164
164
  interface FsKeyProviderOptions {
165
- /** Directory where key files are stored (same as actors: .gitgov/actors) */
166
- actorsDir: string;
165
+ /** Directory where key files are stored (e.g., .gitgov/keys) */
166
+ keysDir: string;
167
167
  /** File extension for key files (default: '.key') */
168
168
  extension?: string;
169
169
  /** File permissions for key files (default: 0o600 - owner read/write only) */
@@ -171,17 +171,17 @@ interface FsKeyProviderOptions {
171
171
  }
172
172
  /**
173
173
  * Filesystem-based KeyProvider implementation.
174
- * Keys are stored alongside actor records with .key extension.
174
+ * Keys are stored in a dedicated directory with .key extension.
175
175
  *
176
176
  * @example
177
177
  * ```typescript
178
- * const provider = new FsKeyProvider({ actorsDir: '.gitgov/actors' });
178
+ * const provider = new FsKeyProvider({ keysDir: '.gitgov/keys' });
179
179
  * await provider.setPrivateKey('actor:human:alice', 'base64PrivateKey...');
180
180
  * const key = await provider.getPrivateKey('actor:human:alice');
181
181
  * ```
182
182
  */
183
183
  declare class FsKeyProvider implements KeyProvider {
184
- private readonly actorsDir;
184
+ private readonly keysDir;
185
185
  private readonly extension;
186
186
  private readonly fileMode;
187
187
  constructor(options: FsKeyProviderOptions);
@@ -193,8 +193,8 @@ declare class FsKeyProvider implements KeyProvider {
193
193
  getPrivateKey(actorId: string): Promise<string | null>;
194
194
  /**
195
195
  * [EARS-KP03] Stores a private key for an actor.
196
- * [EARS-FKP01] Creates actorsDir if not exists.
197
- * [EARS-FKP02] Writes key to {actorsDir}/{actorId}.key.
196
+ * [EARS-FKP01] Creates keysDir if not exists.
197
+ * [EARS-FKP02] Writes key to {keysDir}/{actorId}.key.
198
198
  * [EARS-FKP03] Sets secure file permissions (0600).
199
199
  */
200
200
  setPrivateKey(actorId: string, privateKey: string): Promise<void>;
@@ -1132,6 +1132,8 @@ interface ISyncStateModule {
1132
1132
  ensureStateBranch(): Promise<void>;
1133
1133
  /** Calculates the file delta between source branch and state branch */
1134
1134
  calculateStateDelta(sourceBranch: string): Promise<StateDeltaFile[]>;
1135
+ /** Returns pending local changes not yet synced to the state branch */
1136
+ getPendingChanges(): Promise<StateDeltaFile[]>;
1135
1137
  /** Checks if a rebase operation is currently in progress */
1136
1138
  isRebaseInProgress(): Promise<boolean>;
1137
1139
  /** Returns list of files that still contain conflict markers */
package/dist/src/fs.d.ts CHANGED
@@ -2,9 +2,9 @@ import { R as RecordStore, I as IdEncoder } from './record_store-BXKWqon5.js';
2
2
  export { D as DEFAULT_ID_ENCODER } from './record_store-BXKWqon5.js';
3
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
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-D7JahEKk.js';
6
- export { y as FsFileLister, w as FsKeyProvider, x as FsKeyProviderOptions } from './agent_runner-D7JahEKk.js';
7
- import { S as SessionStore, G as GitGovSession } from './key_provider-CRpHFGjN.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
8
  import { I as IRecordProjector, G as GitGovRecord, a as IRecordProjection, b as IndexData, P as ProjectionContext } from './record_projection.types-B8AM7u8U.js';
9
9
 
10
10
  /**
@@ -138,7 +138,7 @@ declare function createConfigManager(projectRoot: string): ConfigManager;
138
138
  */
139
139
  declare class FsSessionStore implements SessionStore {
140
140
  private readonly sessionPath;
141
- private readonly actorsPath;
141
+ private readonly keysPath;
142
142
  constructor(projectRootPath: string);
143
143
  /**
144
144
  * Load local session from .gitgov/.session.json
@@ -158,12 +158,12 @@ declare class FsSessionStore implements SessionStore {
158
158
  */
159
159
  saveSession(session: GitGovSession): Promise<void>;
160
160
  /**
161
- * Detect actor from .key files in .gitgov/actors/
161
+ * Detect actor from .key files in .gitgov/keys/
162
162
  *
163
163
  * [EARS-C1] Returns actor ID from first .key file
164
164
  * [EARS-C2] Returns first .key file alphabetically if multiple exist
165
165
  * [EARS-C3] Returns null if no .key files exist
166
- * [EARS-C4] Returns null if actors directory doesn't exist
166
+ * [EARS-C4] Returns null if keys directory doesn't exist
167
167
  * [EARS-C5] Ignores non-.key files
168
168
  * [EARS-C6] Returns null for empty directory
169
169
  *
@@ -435,7 +435,8 @@ declare class FsLintModule implements IFsLintModule {
435
435
  */
436
436
  declare class FsProjectInitializer implements IProjectInitializer {
437
437
  private readonly projectRoot;
438
- constructor(projectRoot: string);
438
+ private readonly repoRoot;
439
+ constructor(projectRoot: string, repoRoot?: string);
439
440
  /**
440
441
  * Creates the .gitgov/ directory structure.
441
442
  */
@@ -1134,6 +1135,8 @@ declare class FsSyncStateModule implements ISyncStateModule {
1134
1135
  * [EARS-A1]
1135
1136
  */
1136
1137
  private createOrphanStateBranch;
1138
+ /** Returns pending local changes not yet synced (delegates to calculateStateDelta) */
1139
+ getPendingChanges(): Promise<StateDeltaFile[]>;
1137
1140
  /**
1138
1141
  * Calculates the file delta in .gitgov/ between the current branch and gitgov-state.
1139
1142
  *
@@ -1221,6 +1224,91 @@ declare class FsSyncStateModule implements ISyncStateModule {
1221
1224
  resolveConflict(options: SyncStateResolveOptions): Promise<SyncStateResolveResult>;
1222
1225
  }
1223
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
+
1224
1312
  interface WatcherStateModuleOptions {
1225
1313
  gitgovPath: string;
1226
1314
  debounceMs?: number;
@@ -1378,4 +1466,4 @@ declare class FsRecordProjection implements IRecordProjection {
1378
1466
  clear(_context: ProjectionContext): Promise<void>;
1379
1467
  }
1380
1468
 
1381
- export { type FileSystem, FsAgentRunner, AgentRunnerDependencies as FsAgentRunnerDependencies, FsConfigStore, type FsFixOptions, FsLintModule, type FsLintModuleDependencies, type FsLintOptions, FsProjectInitializer, FsRecordProjection, type FsRecordProjectionOptions, FsRecordStore, FsSessionStore, FsSyncStateModule, FsWatcherStateModule, LocalGitModule as GitModule, GitModuleDependencies, type IFsLintModule, IGitModule, LocalGitModule, createAgentRunner, createConfigManager, createSessionManager, findGitgovRoot, findProjectRoot, getGitgovPath, isGitgovProject, resetDiscoveryCache };
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 };