Refac: Centralize storage file management (#4078)

Co-authored-by: Taylor Mullen <ntaylormullen@google.com>
This commit is contained in:
Yuki Okita
2025-08-20 10:55:47 +09:00
committed by GitHub
parent 1049d38845
commit 21c6480b65
50 changed files with 889 additions and 532 deletions

View File

@@ -6,22 +6,22 @@
import * as fs from 'fs/promises';
import * as path from 'path';
import * as os from 'os';
import { isNodeError } from '../utils/errors.js';
import { exec } from 'node:child_process';
import { simpleGit, SimpleGit, CheckRepoActions } from 'simple-git';
import { getProjectHash, GEMINI_DIR } from '../utils/paths.js';
import { Storage } from '../config/storage.js';
export class GitService {
private projectRoot: string;
private storage: Storage;
constructor(projectRoot: string) {
constructor(projectRoot: string, storage: Storage) {
this.projectRoot = path.resolve(projectRoot);
this.storage = storage;
}
private getHistoryDir(): string {
const hash = getProjectHash(this.projectRoot);
return path.join(os.homedir(), GEMINI_DIR, 'history', hash);
return this.storage.getHistoryDir();
}
async initialize(): Promise<void> {