browser-git-ops 0.0.4 → 0.0.5

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/README.md CHANGED
@@ -1,119 +1,344 @@
1
- [![Ask DeepWiki](https://deepwiki.com/badge.svg)](https://deepwiki.com/nojaja/browser-git-ops)
1
+ [![Ask DeepWiki](https://deepwiki.com/badge.svg)](https://deepwiki.com/nojaja/browser-git-ops) [![日本語ドキュメント](https://img.shields.io/badge/docs-日本語-blue.svg)](https://github.com/nojaja/browser-git-ops/blob/main/README_ja.md)
2
2
 
3
3
  # browser-git-ops
4
4
 
5
5
  A browser-native Git operations library that provides a VirtualFS and platform adapters for GitHub and GitLab. It implements multiple persistent backends (OPFS, IndexedDB, and an in-memory backend) and abstracts them behind a common VirtualFS API.
6
6
 
7
- - Live Demo: https://nojaja.github.io/browser-git-ops/
7
+ - **Live Demo**: https://nojaja.github.io/browser-git-ops/
8
8
 
9
- **[日本語ドキュメント (Japanese)](README_ja.md)**
9
+ **[English](./README.md)** | **[日本語](./README_ja.md)**
10
10
 
11
- Key features
12
- - VirtualFS: local workspace snapshoting and change-set generation (create/update/delete).
13
- - Multiple backends: `OpfsStorage` (OPFS), `IndexedDatabaseStorage` (IndexedDB), and `InMemoryStorage` (testing).
14
- - Platform adapters: `GitHubAdapter` and `GitLabAdapter` implementing common push/fetch flows via Web APIs, enabling cross-origin operations without CORS proxy workarounds.
11
+ ## Overview
15
12
 
16
- Status summary
17
- - Core VirtualFS functionality implemented (delta generation, index management, local edits).
18
- - Persistence backends for OPFS and IndexedDB implemented.
19
- - GitHubAdapter includes primary push flow; GitLab adapter exists but may require extra environment verification.
13
+ ![Architecture Overview](docs/asset/browser-git-ops-overview.png)
20
14
 
21
- Quick Install via npm (library consumers)
15
+ ## Key Features
16
+
17
+ - **VirtualFS**: Local workspace snapshotting and change-set generation (create/update/delete)
18
+ - **Multiple Storage Backends**:
19
+ - `OpfsStorage` - Origin Private File System (OPFS)
20
+ - `IndexedDatabaseStorage` - IndexedDB for broader browser compatibility
21
+ - `InMemoryStorage` - In-memory storage for testing
22
+ - **Platform Adapters**: `GitHubAdapter` and `GitLabAdapter` implementing common push/pull flows via Web APIs
23
+ - **CORS-Free Operations**: Direct API integration without proxy workarounds
24
+ - **TypeScript Support**: Fully typed API with TypeScript definitions
25
+
26
+ ## v0.0.5: FS-compatible API
27
+
28
+ - Adds Node-like filesystem methods on `VirtualFS`: `stat`, `unlink`, `mkdir`, `rmdir`, `readdir`.
29
+ - `Stats` objects now include Git identifiers when available (`gitBlobSha`, `gitCommitSha`).
30
+ - `deleteFile` is removed from the public API; use `unlink` instead.
31
+
32
+ ## Status
33
+
34
+ - ✅ Core VirtualFS functionality (delta generation, index management, local edits)
35
+ - ✅ Persistence backends for OPFS and IndexedDB
36
+ - ✅ GitHubAdapter with primary push/pull flows
37
+ - ✅ GitLabAdapter with primary push/pull flows
38
+
39
+ ## Installation
40
+
41
+ ### For Library Consumers (npm)
22
42
 
23
43
  ```bash
24
- npm i browser-git-ops
44
+ npm install browser-git-ops
25
45
  ```
26
46
 
27
- Usage (basic)
47
+ ### For Development
48
+
49
+ ```bash
50
+ git clone https://github.com/nojaja/browser-git-ops.git
51
+ cd browser-git-ops
52
+ npm ci
53
+ ```
28
54
 
29
- ```ts
55
+ ## Usage
56
+
57
+ ### Basic Example
58
+
59
+ ```typescript
30
60
  import { VirtualFS, OpfsStorage, GitHubAdapter } from 'browser-git-ops'
31
61
 
32
62
  async function example() {
33
- const backend = new lib.OpfsStorage('test01')
63
+ // 1. Initialize VirtualFS with OPFS backend
64
+ const backend = new OpfsStorage('my-workspace')
34
65
  const vfs = new VirtualFS({ backend })
35
66
  await vfs.init()
36
- await vfs.setAdapter(null, { type: 'gitlab', opts: { projectId: 'ORG', host: 'HOST', token: 'token', branch: 'main' } })
37
67
 
68
+ // 2. Configure adapter (GitHub or GitLab)
69
+ await vfs.setAdapter(null, {
70
+ type: 'github',
71
+ opts: {
72
+ owner: 'your-username',
73
+ repo: 'your-repo',
74
+ token: 'your-github-token',
75
+ branch: 'main'
76
+ }
77
+ })
78
+
79
+ // 3. Pull latest content from remote
38
80
  await vfs.pull()
39
- const list = await vfs.listPaths()
40
- await vfs.writeFile('README.md', 'hello world')
41
- const changes = await vfs.getChangeSet()
42
81
 
43
- const idx = await vfs.getIndex()
44
- const pushInput = { parentSha: idx.head, message: 'Example push', changes: changes }
45
- const pushRes = await vfs.push(pushInput as any)
82
+ // 4. List files (use the FS-compatible API)
83
+ const files = await vfs.readdir('.')
84
+ console.log('Files:', files)
85
+
86
+ // 5. Make local changes
87
+ await vfs.writeFile('README.md', '# Hello World')
88
+ await vfs.writeFile('docs/guide.md', '## Getting Started')
89
+
90
+ // 6. Stat a file (Stats includes gitBlobSha/gitCommitSha when available)
91
+ const s = await vfs.stat('README.md')
92
+ console.log('size=', s.size, 'isFile=', s.isFile())
93
+
94
+ // 7. Delete a file (use unlink instead of deleteFile)
95
+ await vfs.unlink('docs/guide.md')
96
+
97
+ // 8. Create/remove directories
98
+ await vfs.mkdir('notes')
99
+ await vfs.rmdir('notes', { recursive: true })
100
+ // 9. Get change set and push
101
+ const changes = await vfs.getChangeSet()
102
+ console.log('Changes:', changes)
103
+
104
+ const index = await vfs.getIndex()
105
+ const result = await vfs.push({
106
+ parentSha: index.head,
107
+ message: 'Update documentation',
108
+ changes: changes
109
+ })
110
+ console.log('Push result:', result)
46
111
  }
47
112
  ```
48
113
 
49
- install
114
+ ### Using IndexedDB Backend
115
+
116
+ ```typescript
117
+ import { VirtualFS, IndexedDatabaseStorage } from 'browser-git-ops'
118
+
119
+ const backend = new IndexedDatabaseStorage('my-workspace')
120
+ const vfs = new VirtualFS({ backend })
121
+ await vfs.init()
122
+ ```
123
+
124
+ ### Using GitLab Adapter
125
+
126
+ ```typescript
127
+ await vfs.setAdapter(null, {
128
+ type: 'gitlab',
129
+ opts: {
130
+ projectId: 'username/project',
131
+ host: 'gitlab.com',
132
+ token: 'your-gitlab-token',
133
+ branch: 'main'
134
+ }
135
+ })
136
+ ```
137
+
138
+ ## Development
139
+
140
+ ### Build
50
141
 
51
142
  ```bash
52
- git clone https://github.com/nojaja/browser-git-ops.git
53
- cd browser-git-ops
54
- npm ci
143
+ npm run build # Build browser bundles and TypeScript definitions
55
144
  ```
56
145
 
57
- Build & test
146
+ This generates:
147
+ - `dist/index.js` - IIFE bundle for browser (global `APIGitLib`)
148
+ - `dist/index.mjs` - ESM bundle
149
+ - `dist/index.d.ts` - TypeScript definitions
150
+
151
+ ### Testing
58
152
 
59
153
  ```bash
60
- npm run build # build browser bundles and types
61
- npm run test # unit tests (Jest)
62
- npm run test:e2e # Playwright E2E (runs after build)
154
+ npm run test # Unit tests (Jest)
155
+ npm run test:spec # Specification tests only
156
+ npm run test:coverage # Tests with coverage report
157
+ npm run test:e2e # E2E tests (Playwright)
63
158
  npm run lint # ESLint
64
159
  ```
65
160
 
66
- Project layout (excerpt)
161
+ ### Documentation
67
162
 
68
- - `src/` — source
69
- - `virtualfs/virtualfs.ts` `VirtualFS` core
70
- - `virtualfs/opfsStorage.ts` — OPFS backend
71
- - `virtualfs/indexedDatabaseStorage.ts` — IndexedDB backend
72
- - `virtualfs/inmemoryStorage.ts` — In-memory backend (tests)
73
- - `git/githubAdapter.ts` — GitHub adapter
74
- - `git/gitlabAdapter.ts` — GitLab adapter
75
- - `examples/` — browser sample UI and Playwright scenarios
76
- - `test/` — Jest unit tests and Playwright E2E tests
163
+ ```bash
164
+ npm run docs # Generate TypeDoc documentation
165
+ ```
77
166
 
78
- Configuration
167
+ ## Project Structure
79
168
 
80
- - Set `GH_TOKEN` or appropriate credentials when using platform adapters.
81
- - OPFS availability depends on the browser; polyfills/mocks are used in tests.
169
+ ```
170
+ src/
171
+ ├── index.ts # Package entry point
172
+ ├── virtualfs/
173
+ │ ├── virtualfs.ts # VirtualFS core implementation
174
+ │ ├── opfsStorage.ts # OPFS storage backend
175
+ │ ├── indexedDatabaseStorage.ts # IndexedDB storage backend
176
+ │ ├── inmemoryStorage.ts # In-memory storage (for testing)
177
+ │ ├── changeTracker.ts # Change detection and tracking
178
+ │ ├── conflictManager.ts # Merge conflict resolution
179
+ │ ├── indexManager.ts # Index file management
180
+ │ └── types.ts # Type definitions
181
+ └── git/
182
+ ├── abstractAdapter.ts # Base adapter interface
183
+ ├── githubAdapter.ts # GitHub API adapter
184
+ └── gitlabAdapter.ts # GitLab API adapter
185
+
186
+ examples/ # Browser demo application
187
+ test/
188
+ ├── unit/ # Jest unit tests
189
+ └── e2e/ # Playwright E2E tests
190
+ ```
82
191
 
83
- Examples
192
+ ## Configuration
193
+
194
+ ### GitHub Adapter
195
+
196
+ To use the GitHub adapter, you need:
197
+ - **Personal Access Token** with `repo` scope
198
+ - Repository owner and name
199
+ - Target branch (default: `main`)
200
+
201
+ ### GitLab Adapter
202
+
203
+ To use the GitLab adapter, you need:
204
+ - **Personal Access Token** or **Project Access Token**
205
+ - Project ID (format: `username/project` or numeric ID)
206
+ - GitLab instance host (default: `gitlab.com`)
207
+ - Target branch (default: `main`)
208
+
209
+ ### Browser Compatibility
210
+
211
+ - **OPFS**: Requires modern browsers with OPFS support (Chrome 102+, Edge 102+)
212
+ - **IndexedDB**: Broader compatibility, works in most modern browsers
213
+ - **CORS**: No proxy required - uses direct API authentication
214
+
215
+ ## API Reference
216
+
217
+ - See [docs/typedoc-md/README.md](docs/typedoc-md/README.md).
218
+
219
+ ### VirtualFS
220
+
221
+ Main class for file system operations.
222
+
223
+ ```typescript
224
+ class VirtualFS {
225
+ constructor(options?: { backend?: StorageBackend; logger?: Logger })
226
+
227
+ // Initialization
228
+ async init(): Promise<void>
229
+
230
+ // File Operations
231
+ async writeFile(path: string, content: string): Promise<void>
232
+ async readFile(path: string): Promise<string>
233
+ async deleteFile(path: string): Promise<void>
234
+ async renameFile(fromPath: string, toPath: string): Promise<void>
235
+ async listPaths(): Promise<string[]>
236
+
237
+ // Change Management
238
+ async getChangeSet(): Promise<ChangeItem[]>
239
+ async revertChanges(): Promise<void>
240
+
241
+ // Remote Synchronization
242
+ async setAdapter(adapter: any, meta?: any): Promise<void>
243
+ async pull(reference?: string, baseSnapshot?: Record<string, string>): Promise<any>
244
+ async push(input: CommitInput): Promise<any>
245
+
246
+ // Conflict Resolution
247
+ async getConflicts(): Promise<ConflictItem[]>
248
+ async resolveConflict(path: string, resolution: 'local' | 'remote'): Promise<void>
249
+
250
+ // Index Management
251
+ async getIndex(): Promise<IndexFile>
252
+ async saveIndex(): Promise<void>
253
+ }
254
+ ```
84
255
 
85
- - See the `examples/` directory for a browser sample and Playwright scenarios.
256
+ ### Storage Backends
257
+
258
+ ```typescript
259
+ // OPFS Backend
260
+ class OpfsStorage implements StorageBackend {
261
+ constructor(rootName?: string)
262
+ }
263
+
264
+ // IndexedDB Backend
265
+ class IndexedDatabaseStorage implements StorageBackend {
266
+ constructor(rootName?: string)
267
+ }
268
+
269
+ // In-Memory Backend (for testing)
270
+ class InMemoryStorage implements StorageBackend {
271
+ constructor()
272
+ }
273
+ ```
274
+
275
+ ### Platform Adapters
276
+
277
+ ```typescript
278
+ // GitHub Adapter
279
+ class GitHubAdapter {
280
+ constructor(options: {
281
+ owner: string
282
+ repo: string
283
+ token: string
284
+ branch: string
285
+ })
286
+ }
287
+
288
+ // GitLab Adapter
289
+ class GitLabAdapter {
290
+ constructor(options: {
291
+ projectId: string
292
+ host: string
293
+ token: string
294
+ branch: string
295
+ })
296
+ }
297
+ ```
86
298
 
87
- API surface (overview)
299
+ ## Examples
88
300
 
89
- - `new VirtualFS(options?)` options: `{ storageDir?: string, backend?: StorageBackend }`
90
- - `init()` initialize backend and load index
91
- - `writeFile(path, content)`, `deleteFile(path)`, `renameFile(from,to)` — local edits
92
- - `getChangeSet()` returns list of create/update/delete changes
93
- - `applyBaseSnapshot(snapshot, headSha)` — apply remote snapshot, returns conflicts if any
301
+ See the [`examples/`](examples/) directory for:
302
+ - Interactive browser demo with UI
303
+ - Playwright E2E test scenarios
304
+ - Multiple storage backend examples
94
305
 
95
- Testing & CI
306
+ ## Contributing
96
307
 
97
- - Run unit tests locally with `npm run test`.
98
- - `npm run test:e2e` requires a build (`npm run build`) before execution.
308
+ Contributions are welcome! Please follow these guidelines:
99
309
 
100
- Contributing
310
+ 1. **Open an Issue**: For significant changes, please open an issue first to discuss your proposal
311
+ 2. **Follow Conventions**:
312
+ - Use TypeScript
313
+ - Follow ESLint rules (`npm run lint`)
314
+ - Write tests for new features
315
+ - Update documentation as needed
316
+ 3. **Testing**: Ensure all tests pass before submitting PR
317
+ ```bash
318
+ npm run lint
319
+ npm run build
320
+ npm run test
321
+ npm run test:e2e
322
+ ```
101
323
 
102
- - Issues and PRs are welcome. Please open an Issue first to discuss design when appropriate.
103
- - Follow TypeScript + ESLint conventions; include tests for new behavior.
324
+ ## Support
104
325
 
105
- Support / Getting help
326
+ - **Issues**: https://github.com/nojaja/browser-git-ops/issues
327
+ - **Discussions**: https://github.com/nojaja/browser-git-ops/discussions
328
+ - **Documentation**: https://nojaja.github.io/browser-git-ops/
106
329
 
107
- - Report issues at: https://github.com/nojaja/browser-git-ops/issues
330
+ ## License
108
331
 
109
- License
332
+ MIT License - see the [LICENSE](LICENSE) file for details.
110
333
 
111
- - Licensed under the MIT License — see the `LICENSE` file for details.
334
+ ## Author
112
335
 
113
- Maintainers
336
+ Maintained by [nojaja](https://github.com/nojaja) ([free.riccia@gmail.com](mailto:free.riccia@gmail.com))
114
337
 
115
- - Maintained by `nojaja` (https://github.com/nojaja). See repository for contributors and history.
338
+ ## Acknowledgments
116
339
 
117
- TODO
118
- - Add code examples that demonstrate push/pull flows end-to-end.
119
- - Add a CONTRIBUTING.md with contributor guidelines and PR checklist.
340
+ This project uses:
341
+ - OPFS (Origin Private File System) for persistent storage
342
+ - GitHub and GitLab Web APIs for remote synchronization
343
+ - Jest for unit testing
344
+ - Playwright for E2E testing
@@ -115,14 +115,6 @@ export declare abstract class AbstractGitAdapter {
115
115
  * @param args items to log
116
116
  */
117
117
  protected logError(..._messages: any[]): void;
118
- /**
119
- * Proxy to shared fetchWithRetry implementation
120
- * @param input RequestInfo
121
- * @param init RequestInit
122
- * @param attempts retry attempts
123
- * @param baseDelay base delay ms
124
- * @returns Promise resolving to Response
125
- */
126
118
  /**
127
119
  * Normalize different header-like shapes into a plain object.
128
120
  * @param headerLike headers in Headers, array, or plain object form
@@ -161,14 +153,6 @@ export declare abstract class AbstractGitAdapter {
161
153
  * @returns milliseconds to wait
162
154
  */
163
155
  protected backoffMs(attempt: number): number;
164
- /**
165
- * Delegate to shared mapWithConcurrency implementation
166
- * @template T,R
167
- * @param items items to map
168
- * @param mapper async mapper
169
- * @param concurrency concurrency limit
170
- * @returns Promise resolving to mapped results
171
- */
172
156
  /**
173
157
  * Map items with limited concurrency by delegating to the shared helper.
174
158
  * @template T,R
@@ -1 +1 @@
1
- {"version":3,"file":"abstractAdapter.d.ts","sourceRoot":"","sources":["../../src/git/abstractAdapter.ts"],"names":[],"mappings":"AACA,MAAM,MAAM,sBAAsB,GAAG,CAAC,MAAM,EAAE,WAAW,EAAE,KAAK,EAAE,WAAW,EAAE,SAAS,CAAC,EAAE,MAAM,EAAE,UAAU,CAAC,EAAE,MAAM,KAAK,OAAO,CAAC,QAAQ,CAAC,CAAA;AAK5I;;;;;GAKG;AACH,MAAM,WAAW,MAAM;IACrB,KAAK,EAAE,CAAC,GAAG,SAAS,EAAE,GAAG,EAAE,KAAK,IAAI,CAAA;IACpC,IAAI,EAAE,CAAC,GAAG,SAAS,EAAE,GAAG,EAAE,KAAK,IAAI,CAAA;IACnC,IAAI,EAAE,CAAC,GAAG,SAAS,EAAE,GAAG,EAAE,KAAK,IAAI,CAAA;IACnC,KAAK,EAAE,CAAC,GAAG,SAAS,EAAE,GAAG,EAAE,KAAK,IAAI,CAAA;CACrC;AACD;;;;GAIG;AACH,wBAAsB,KAAK,CAAC,OAAO,EAAE,MAAM,GAAG,OAAO,CAAC,MAAM,CAAC,CAK5D;AAED;;;;GAIG;AACH,wBAAgB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,SAAS,CAAC,OAAO,EAAE,MAAM;IAMnC;;;;;;;OAOG;IACH,SAAS,CAAC,kBAAkB,CAAC,CAAC,EAAE,CAAC,EAAE,KAAK,EAAE,CAAC,EAAE,EAAE,MAAM,EAAE,CAAC,EAAE,EAAE,CAAC,KAAK,OAAO,CAAC,CAAC,CAAC,EAAE,WAAW,SAAI;CAG9F;AAED,eAAe,kBAAkB,CAAA"}
@@ -7,8 +7,8 @@ type GHOptions = {
7
7
  host?: string;
8
8
  };
9
9
  /**
10
- * 指定ミリ秒だけ sleep するユーティリティ
11
- * @param ms ミリ秒
10
+ * GitHub 向けの `GitAdapter` 実装。
11
+ * GitHub API をラップしてリポジトリ操作(コミット作成、ブランチ一覧、ファイル取得等)を提供します。
12
12
  */
13
13
  export declare class GitHubAdapter extends AbstractGitAdapter implements GitAdapter {
14
14
  private _fetchWithRetry;
@@ -57,11 +57,6 @@ export declare class GitHubAdapter extends AbstractGitAdapter implements GitAdap
57
57
  * @returns {import('./adapter').CommitSummary}
58
58
  */
59
59
  private _mapGithubCommitToSummary;
60
- /**
61
- * コンテンツから sha1 を算出します。
62
- * @param {string} content コンテンツ
63
- * @returns {string} sha1 ハッシュ
64
- */
65
60
  /**
66
61
  * ブロブを作成またはキャッシュから取得します。
67
62
  * @param {any[]} changes 変更一覧(create/update を含む)
@@ -69,11 +64,6 @@ export declare class GitHubAdapter extends AbstractGitAdapter implements GitAdap
69
64
  * @returns {Promise<Record<string,string>>} パス→blobSha のマップ
70
65
  */
71
66
  createBlobs(changes: any[], concurrency?: number): Promise<Record<string, string>>;
72
- /**
73
- * ブロブ作成用のヘルパー(createBlobs から抽出)
74
- * @param {any} ch 変更エントリ
75
- * @returns {Promise<{path:string,sha:string}>}
76
- */
77
67
  /**
78
68
  * Create a blob for a change or return cached blobSha.
79
69
  * @param {any} ch change entry
@@ -163,10 +153,6 @@ export declare class GitHubAdapter extends AbstractGitAdapter implements GitAdap
163
153
  * @returns {Promise<string>} 参照先のコミット SHA
164
154
  */
165
155
  getRef(reference: string): Promise<string>;
166
- /**
167
- * Helper to fetch a ref URL and extract a SHA if present.
168
- * Returns null when SHA not found.
169
- */
170
156
  /**
171
157
  * Fetch a ref URL and extract a SHA if present.
172
158
  * @param {string} url API URL to fetch
@@ -207,18 +193,6 @@ export declare class GitHubAdapter extends AbstractGitAdapter implements GitAdap
207
193
  content: any;
208
194
  encoding: any;
209
195
  }>;
210
- /**
211
- * Resolve a commit-ish (branch, tag, or SHA) to a commit SHA.
212
- * Resolution order: branch -> tag -> commit endpoint -> treat as SHA
213
- * Throws if resolution fails.
214
- */
215
- /**
216
- * Resolve a commit-ish (branch, tag, or SHA) to a commit SHA.
217
- * Resolution order: branch -> tag -> commit endpoint -> treat as SHA
218
- * Throws if resolution fails.
219
- * @param {string} reference commit-ish to resolve
220
- * @returns {Promise<string>} resolved commit SHA
221
- */
222
196
  /**
223
197
  * Resolve a commit-ish (branch, tag, or SHA) to a commit SHA.
224
198
  * Resolution order: branch -> tag -> commit endpoint -> treat as SHA
@@ -234,44 +208,24 @@ export declare class GitHubAdapter extends AbstractGitAdapter implements GitAdap
234
208
  * @returns {Promise<string|null>} resolved sha or null
235
209
  */
236
210
  private _runResolvers;
237
- /**
238
- * Try to resolve reference as a branch and return its sha.
239
- * @param {string} reference branch name
240
- * @returns {Promise<string|null>} resolved sha or null
241
- */
242
211
  /**
243
212
  * Try to resolve a branch name to a commit SHA.
244
213
  * @param {string} reference branch name
245
214
  * @returns {Promise<string|null>}
246
215
  */
247
216
  private _tryResolveByBranch;
248
- /**
249
- * Try to resolve reference as a tag and return its sha.
250
- * @param {string} reference tag name
251
- * @returns {Promise<string|null>} resolved sha or null
252
- */
253
217
  /**
254
218
  * Try to resolve a tag name to a commit SHA.
255
219
  * @param {string} reference tag name
256
220
  * @returns {Promise<string|null>}
257
221
  */
258
222
  private _tryResolveByTag;
259
- /**
260
- * Try to resolve reference using commits endpoint (could be SHA or other form).
261
- * @param {string} reference commit-ish
262
- * @returns {Promise<string|null>} resolved sha or null
263
- */
264
223
  /**
265
224
  * Try to resolve via commits endpoint (may accept SHA or other forms).
266
225
  * @param {string} reference commit-ish
267
226
  * @returns {Promise<string|null>}
268
227
  */
269
228
  private _tryResolveByCommitEndpoint;
270
- /**
271
- * Blob を取得して content を返す。取得失敗時は content=null を返す。
272
- * @param {{sha:string,path:string}} f blob 情報
273
- * @returns {Promise<{path:string,content:string|null}>}
274
- */
275
229
  /**
276
230
  * Fetch a blob's content; return null content on failure.
277
231
  * @param {any} f blob metadata
@@ -284,16 +238,6 @@ export declare class GitHubAdapter extends AbstractGitAdapter implements GitAdap
284
238
  * @returns {string} decoded UTF-8 string
285
239
  */
286
240
  private _decodeBase64ToString;
287
- /**
288
- * Fetch a blob's content; return null content on failure.
289
- * @param {any} f blob metadata
290
- * @returns {Promise<{path:string,content:string|null}>}
291
- */
292
- /**
293
- * リポジトリのスナップショットを取得します。
294
- * @param {string} branch ブランチ名 (default: 'main')
295
- * @returns {Promise<{headSha:string,shas:Record<string,string>,fetchContent:Function,snapshot:Record<string,string>}>}
296
- */
297
241
  /**
298
242
  * Fetch repository snapshot: headSha, shas map and a fetchContent helper.
299
243
  * @param {string} branch branch name
@@ -337,22 +281,6 @@ export declare class GitHubAdapter extends AbstractGitAdapter implements GitAdap
337
281
  * @returns {Promise<null>}
338
282
  */
339
283
  private _mapperForFetch;
340
- /**
341
- * 指定パスのコンテンツを取得し、キャッシュと snapshot を更新します。
342
- * @param {Map<string, any>} fileMap ファイルメタ情報マップ
343
- * @param {Map<string, string>} contentCache キャッシュマップ
344
- * @param {Record<string,string>} snapshot スナップショット出力マップ
345
- * @param {string} p 取得対象パス
346
- * @returns {Promise<string|null>} ファイル内容または null
347
- */
348
- /**
349
- * Fetch single path content, update cache and snapshot.
350
- * @param {Map<string, any>} fileMap file map
351
- * @param {Map<string,string>} contentCache cache map
352
- * @param {Record<string,string>} snapshot snapshot map
353
- * @param {string} p path to fetch
354
- * @returns {Promise<string|null>} content or null
355
- */
356
284
  /**
357
285
  * Fetch single path content, update cache and snapshot.
358
286
  * @param {Map<string, any>} fileMap file map
@@ -1 +1 @@
1
- {"version":3,"file":"githubAdapter.d.ts","sourceRoot":"","sources":["../../src/git/githubAdapter.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,MAAM,cAAc,CAAA;AACzC,OAAO,kBAAkB,EAAE,EAAE,cAAc,EAAE,cAAc,EAAE,mBAAmB,EAAE,wBAAwB,EAAE,kBAAkB,EAAE,KAAK,EAAqB,MAAM,sBAAsB,CAAA;AAGtL,KAAK,SAAS,GAAG;IACf,KAAK,EAAE,MAAM,CAAA;IACb,IAAI,EAAE,MAAM,CAAA;IACZ,KAAK,EAAE,MAAM,CAAA;IACb,IAAI,CAAC,EAAE,MAAM,CAAA;CACd,CAAA;AAED;;;GAGG;AAGH,qBAAa,aAAc,SAAQ,kBAAmB,YAAW,UAAU;IACzE,OAAO,CAAC,eAAe,CAAqF;IAC5G,OAAO,CAAC,YAAY,CAAkE;IAEtF,OAAO,CAAC,SAAS,CAAiC;IAElD;;;OAGG;gBACS,OAAO,EAAE,SAAS;IAgB9B;;;;OAIG;IACG,WAAW,CAAC,KAAK,EAAE;QAAE,GAAG,EAAE,MAAM,CAAC;QAAC,OAAO,CAAC,EAAE,MAAM,CAAC;QAAC,IAAI,CAAC,EAAE,MAAM,CAAA;KAAE;;;;;;;;;;;IAgBzE;;;;OAIG;IACH,OAAO,CAAC,eAAe;IASvB;;;;OAIG;IACH,OAAO,CAAC,sBAAsB;IAc9B;;;;OAIG;IACH,OAAO,CAAC,yBAAyB;IAWjC;;;;OAIG;IAGH;;;;;OAKG;IACG,WAAW,CAAC,OAAO,EAAE,GAAG,EAAE,EAAE,WAAW,SAAI;IAQjD;;;;OAIG;IACH;;;;OAIG;YACW,oBAAoB;IAiBlC;;;;;OAKG;IACG,UAAU,CAAC,OAAO,EAAE,GAAG,EAAE,EAAE,WAAW,CAAC,EAAE,MAAM;IAkBrD;;;;;;O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