@gitgov/core 2.2.0 → 2.3.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';
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-D7JahEKk.js';
6
+ export { y as FsFileLister, w as FsKeyProvider, x as FsKeyProviderOptions } from './agent_runner-D7JahEKk.js';
5
7
  import { S as SessionStore, G as GitGovSession } from './key_provider-CRpHFGjN.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
@@ -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
  }
@@ -1357,4 +1360,22 @@ declare class FsAgentRunner implements IAgentRunner {
1357
1360
  */
1358
1361
  declare function createAgentRunner(deps: AgentRunnerDependencies): IAgentRunner;
1359
1362
 
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 };
1363
+ type FsRecordProjectionOptions = {
1364
+ basePath: string;
1365
+ };
1366
+ /**
1367
+ * FsRecordProjection - Filesystem IRecordProjection for CLI.
1368
+ *
1369
+ * Writes IndexData as JSON to .gitgov/index.json using atomic write
1370
+ * (write to temp file + rename) to prevent corruption on crash.
1371
+ */
1372
+ declare class FsRecordProjection implements IRecordProjection {
1373
+ private readonly indexPath;
1374
+ constructor(options: FsRecordProjectionOptions);
1375
+ persist(data: IndexData, _context: ProjectionContext): Promise<void>;
1376
+ read(_context: ProjectionContext): Promise<IndexData | null>;
1377
+ exists(_context: ProjectionContext): Promise<boolean>;
1378
+ clear(_context: ProjectionContext): Promise<void>;
1379
+ }
1380
+
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 };
package/dist/src/fs.js CHANGED
@@ -3519,25 +3519,25 @@ var FsLintModule = class {
3519
3519
  this.projectRoot = dependencies.projectRoot;
3520
3520
  this.lintModule = dependencies.lintModule;
3521
3521
  this.fileSystem = dependencies.fileSystem ?? {
3522
- readFile: async (path12, encoding) => {
3523
- return promises.readFile(path12, encoding);
3522
+ readFile: async (path13, encoding) => {
3523
+ return promises.readFile(path13, encoding);
3524
3524
  },
3525
- writeFile: async (path12, content) => {
3526
- await promises.writeFile(path12, content, "utf-8");
3525
+ writeFile: async (path13, content) => {
3526
+ await promises.writeFile(path13, content, "utf-8");
3527
3527
  },
3528
- exists: async (path12) => {
3528
+ exists: async (path13) => {
3529
3529
  try {
3530
- await promises.access(path12);
3530
+ await promises.access(path13);
3531
3531
  return true;
3532
3532
  } catch {
3533
3533
  return false;
3534
3534
  }
3535
3535
  },
3536
- unlink: async (path12) => {
3537
- await promises.unlink(path12);
3536
+ unlink: async (path13) => {
3537
+ await promises.unlink(path13);
3538
3538
  },
3539
- readdir: async (path12) => {
3540
- return readdir(path12);
3539
+ readdir: async (path13) => {
3540
+ return readdir(path13);
3541
3541
  }
3542
3542
  };
3543
3543
  }
@@ -5818,7 +5818,7 @@ var FsSyncStateModule = class {
5818
5818
  throw new Error("LintModule is required for SyncStateModule");
5819
5819
  }
5820
5820
  if (!dependencies.indexer) {
5821
- throw new Error("IndexerAdapter is required for SyncStateModule");
5821
+ throw new Error("RecordProjector is required for SyncStateModule");
5822
5822
  }
5823
5823
  this.git = dependencies.git;
5824
5824
  this.config = dependencies.config;
@@ -7307,7 +7307,7 @@ To avoid losing your changes, push first or use --force to overwrite.`,
7307
7307
  }
7308
7308
  }
7309
7309
  if (shouldReindex) {
7310
- logger6.info("Invoking IndexerAdapter.generateIndex() after pull...");
7310
+ logger6.info("Invoking RecordProjector.generateIndex() after pull...");
7311
7311
  try {
7312
7312
  await this.indexer.generateIndex();
7313
7313
  logger6.info("Index regenerated successfully");
@@ -7552,7 +7552,7 @@ Signed-off-by: ${actorId}`;
7552
7552
  log("Temp directory cleaned up");
7553
7553
  } catch {
7554
7554
  }
7555
- logger6.info("Invoking IndexerAdapter.generateIndex() after conflict resolution...");
7555
+ logger6.info("Invoking RecordProjector.generateIndex() after conflict resolution...");
7556
7556
  try {
7557
7557
  await this.indexer.generateIndex();
7558
7558
  logger6.info("Index regenerated successfully after conflict resolution");
@@ -8453,7 +8453,50 @@ var FsAgentRunner = class {
8453
8453
  function createAgentRunner(deps) {
8454
8454
  return new FsAgentRunner(deps);
8455
8455
  }
8456
+ var FsRecordProjection = class {
8457
+ indexPath;
8458
+ constructor(options) {
8459
+ this.indexPath = path9.join(options.basePath, "index.json");
8460
+ }
8461
+ async persist(data, _context) {
8462
+ const dir = path9.dirname(this.indexPath);
8463
+ await fs.mkdir(dir, { recursive: true });
8464
+ const tmpPath = `${this.indexPath}.tmp`;
8465
+ const content = JSON.stringify(data, null, 2);
8466
+ await fs.writeFile(tmpPath, content, "utf-8");
8467
+ await fs.rename(tmpPath, this.indexPath);
8468
+ }
8469
+ async read(_context) {
8470
+ try {
8471
+ const content = await fs.readFile(this.indexPath, "utf-8");
8472
+ return JSON.parse(content);
8473
+ } catch (error) {
8474
+ if (error.code === "ENOENT") {
8475
+ return null;
8476
+ }
8477
+ throw error;
8478
+ }
8479
+ }
8480
+ async exists(_context) {
8481
+ try {
8482
+ await fs.access(this.indexPath);
8483
+ return true;
8484
+ } catch {
8485
+ return false;
8486
+ }
8487
+ }
8488
+ async clear(_context) {
8489
+ try {
8490
+ await fs.unlink(this.indexPath);
8491
+ } catch (error) {
8492
+ if (error.code === "ENOENT") {
8493
+ return;
8494
+ }
8495
+ throw error;
8496
+ }
8497
+ }
8498
+ };
8456
8499
 
8457
- export { DEFAULT_ID_ENCODER, FsAgentRunner, FsConfigStore, FsFileLister, FsKeyProvider, FsLintModule, FsProjectInitializer, FsRecordStore, FsSessionStore, FsSyncStateModule, FsWatcherStateModule, LocalGitModule as GitModule, LocalGitModule, createAgentRunner, createConfigManager, createSessionManager, findGitgovRoot, findProjectRoot, getGitgovPath, isGitgovProject, resetDiscoveryCache };
8500
+ export { DEFAULT_ID_ENCODER, FsAgentRunner, FsConfigStore, FsFileLister, FsKeyProvider, FsLintModule, FsProjectInitializer, FsRecordProjection, FsRecordStore, FsSessionStore, FsSyncStateModule, FsWatcherStateModule, LocalGitModule as GitModule, LocalGitModule, createAgentRunner, createConfigManager, createSessionManager, findGitgovRoot, findProjectRoot, getGitgovPath, isGitgovProject, resetDiscoveryCache };
8458
8501
  //# sourceMappingURL=fs.js.map
8459
8502
  //# sourceMappingURL=fs.js.map