@trebired/git-host 0.1.0 → 1.0.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/CHANGELOG.md +14 -0
- package/README.md +95 -10
- package/dist/api/handler/action.d.ts +1 -1
- package/dist/api/handler/action.d.ts.map +1 -1
- package/dist/api/handler/action.js +45 -1
- package/dist/api/handler/action.js.map +1 -1
- package/dist/api/handler/route.d.ts +14 -1
- package/dist/api/handler/route.d.ts.map +1 -1
- package/dist/api/handler/route.js +19 -1
- package/dist/api/handler/route.js.map +1 -1
- package/dist/api/socket_events.d.ts +7 -0
- package/dist/api/socket_events.d.ts.map +1 -0
- package/dist/api/socket_events.js +7 -0
- package/dist/api/socket_events.js.map +1 -0
- package/dist/api/socket_server.d.ts +6 -0
- package/dist/api/socket_server.d.ts.map +1 -0
- package/dist/api/socket_server.js +156 -0
- package/dist/api/socket_server.js.map +1 -0
- package/dist/core/create_git_host/branch_methods.d.ts +1 -1
- package/dist/core/create_git_host/branch_methods.d.ts.map +1 -1
- package/dist/core/create_git_host/branch_methods.js +88 -2
- package/dist/core/create_git_host/branch_methods.js.map +1 -1
- package/dist/core/create_git_host/content_methods.d.ts +1 -1
- package/dist/core/create_git_host/content_methods.d.ts.map +1 -1
- package/dist/core/create_git_host/content_methods.js +17 -1
- package/dist/core/create_git_host/content_methods.js.map +1 -1
- package/dist/core/create_git_host/working_tree_methods.d.ts +1 -1
- package/dist/core/create_git_host/working_tree_methods.d.ts.map +1 -1
- package/dist/core/create_git_host/working_tree_methods.js +22 -1
- package/dist/core/create_git_host/working_tree_methods.js.map +1 -1
- package/dist/core/inspect/icon_theme.d.ts +4 -0
- package/dist/core/inspect/icon_theme.d.ts.map +1 -0
- package/dist/core/inspect/icon_theme.js +72 -0
- package/dist/core/inspect/icon_theme.js.map +1 -0
- package/dist/core/inspect/linguist_progress.d.ts +14 -0
- package/dist/core/inspect/linguist_progress.d.ts.map +1 -0
- package/dist/core/inspect/linguist_progress.js +92 -0
- package/dist/core/inspect/linguist_progress.js.map +1 -0
- package/dist/core/inspect.d.ts +27 -2
- package/dist/core/inspect.d.ts.map +1 -1
- package/dist/core/inspect.js +396 -8
- package/dist/core/inspect.js.map +1 -1
- package/dist/core/repository/parsers.d.ts +3 -2
- package/dist/core/repository/parsers.d.ts.map +1 -1
- package/dist/core/repository/parsers.js +24 -1
- package/dist/core/repository/parsers.js.map +1 -1
- package/dist/core/repository.d.ts +5 -3
- package/dist/core/repository.d.ts.map +1 -1
- package/dist/core/repository.js +60 -5
- package/dist/core/repository.js.map +1 -1
- package/dist/core/working_tree/mutate.d.ts +5 -2
- package/dist/core/working_tree/mutate.d.ts.map +1 -1
- package/dist/core/working_tree/mutate.js +108 -1
- package/dist/core/working_tree/mutate.js.map +1 -1
- package/dist/core/working_tree.d.ts +1 -1
- package/dist/core/working_tree.d.ts.map +1 -1
- package/dist/core/working_tree.js +1 -1
- package/dist/core/working_tree.js.map +1 -1
- package/dist/index.d.ts +4 -3
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +3 -2
- package/dist/index.js.map +1 -1
- package/dist/react/client/types.d.ts +72 -2
- package/dist/react/client/types.d.ts.map +1 -1
- package/dist/react/client.d.ts +1 -1
- package/dist/react/client.d.ts.map +1 -1
- package/dist/react/client.js +208 -0
- package/dist/react/client.js.map +1 -1
- package/dist/react/hooks/resources.d.ts +9 -3
- package/dist/react/hooks/resources.d.ts.map +1 -1
- package/dist/react/hooks/resources.js +122 -4
- package/dist/react/hooks/resources.js.map +1 -1
- package/dist/react/hooks/types.d.ts +29 -2
- package/dist/react/hooks/types.d.ts.map +1 -1
- package/dist/react/hooks.d.ts +2 -2
- package/dist/react/hooks.d.ts.map +1 -1
- package/dist/react/hooks.js +1 -1
- package/dist/react/hooks.js.map +1 -1
- package/dist/react/index.d.ts +3 -3
- package/dist/react/index.d.ts.map +1 -1
- package/dist/react/index.js +1 -1
- package/dist/react/index.js.map +1 -1
- package/dist/types/host.d.ts +66 -2
- package/dist/types/host.d.ts.map +1 -1
- package/dist/types/index.d.ts +3 -3
- package/dist/types/index.d.ts.map +1 -1
- package/dist/types/repository.d.ts +119 -1
- package/dist/types/repository.d.ts.map +1 -1
- package/dist/types/transports.d.ts +9 -3
- package/dist/types/transports.d.ts.map +1 -1
- package/package.json +5 -1
package/CHANGELOG.md
CHANGED
|
@@ -4,6 +4,20 @@ All notable changes to `@trebired/git-host` will be documented here.
|
|
|
4
4
|
|
|
5
5
|
This project follows semantic versioning once published.
|
|
6
6
|
|
|
7
|
+
## Unreleased
|
|
8
|
+
|
|
9
|
+
## 1.0.0
|
|
10
|
+
|
|
11
|
+
- Added repository linguist analysis through `readLinguist()` with ref-based text blob inspection powered by `linguist-js`.
|
|
12
|
+
- Added live linguist progress reporting through `readLinguist(..., { onProgress })`, plus Socket.IO delivery through `createGitApiSocketServer()` and the typed `openLinguistSocket()` client helper.
|
|
13
|
+
- Added optional tree entry enrichment for detected file languages and inline SVG icons from `material-icon-theme`.
|
|
14
|
+
- Added tag APIs for listing, reading, creating, and deleting tags.
|
|
15
|
+
- Added path- and ref-scoped commit history plus path-scoped diff filtering.
|
|
16
|
+
- Added blame, search, and archive reads for deeper repository inspection.
|
|
17
|
+
- Added merge, rebase, and cherry-pick start helpers to the core host API.
|
|
18
|
+
- Added JSON API routes, typed client methods, and React hooks for linguist, tags, blame, search, archive, and enriched tree reads.
|
|
19
|
+
- Added tests and README coverage for the expanded repository inspection surface.
|
|
20
|
+
|
|
7
21
|
## 0.1.0
|
|
8
22
|
|
|
9
23
|
- Added the initial `@trebired/git-host` package scaffold with publishable metadata, README, MIT license, contribution guide, and TypeScript build setup.
|
package/README.md
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
# @trebired/git-host
|
|
2
2
|
|
|
3
|
-
Embeddable Git host for Node.js and Bun apps.
|
|
3
|
+
Embeddable Git host for Node.js and Bun apps with real Git CLI execution, smart HTTP and SSH transports, repository inspection APIs, and optional React helpers.
|
|
4
4
|
|
|
5
5
|
`@trebired/git-host` gives your app real Git repository operations and real Git transports without making you adopt a full forge product. It runs the real Git CLI, helps you resolve repository paths safely, serializes mutations per repository, and exposes a reusable API for repository initialization, summary reads, content inspection, branch operations, working-tree changes, remote sync helpers, JSON API handlers, and smart HTTP and SSH hosting.
|
|
6
6
|
|
|
@@ -70,6 +70,38 @@ await gitHost.ensureRepository("demo", {
|
|
|
70
70
|
const summary = await gitHost.readSummary("demo");
|
|
71
71
|
console.log(summary.repository.current_branch);
|
|
72
72
|
|
|
73
|
+
const linguist = await gitHost.readLinguist("demo", {
|
|
74
|
+
ref: "main",
|
|
75
|
+
onProgress(event) {
|
|
76
|
+
console.log(event.stage, event.percent);
|
|
77
|
+
},
|
|
78
|
+
});
|
|
79
|
+
console.log(linguist.languages.results);
|
|
80
|
+
|
|
81
|
+
const tree = await gitHost.listTree("demo", {
|
|
82
|
+
ref: "main",
|
|
83
|
+
recursive: true,
|
|
84
|
+
linguist: true,
|
|
85
|
+
icons: true,
|
|
86
|
+
});
|
|
87
|
+
console.log(tree[0]?.language, Boolean(tree[0]?.icon));
|
|
88
|
+
|
|
89
|
+
const tags = await gitHost.listTags("demo");
|
|
90
|
+
const blame = await gitHost.readBlame("demo", {
|
|
91
|
+
ref: "main",
|
|
92
|
+
path: "src/app.ts",
|
|
93
|
+
});
|
|
94
|
+
const search = await gitHost.search("demo", {
|
|
95
|
+
ref: "main",
|
|
96
|
+
path: "src",
|
|
97
|
+
query: "value",
|
|
98
|
+
});
|
|
99
|
+
const archive = await gitHost.readArchive("demo", {
|
|
100
|
+
ref: "main",
|
|
101
|
+
format: "zip",
|
|
102
|
+
});
|
|
103
|
+
console.log(tags.length, blame.lines[0]?.author_name, search.match_count, archive.file_name);
|
|
104
|
+
|
|
73
105
|
const workingTree = await gitHost.readWorkingTree("demo");
|
|
74
106
|
console.log(workingTree.unstaged_entries);
|
|
75
107
|
|
|
@@ -171,7 +203,7 @@ JSON API hosting:
|
|
|
171
203
|
|
|
172
204
|
```ts
|
|
173
205
|
import { createServer } from "node:http";
|
|
174
|
-
import { createGitApiHandler, createGitHost } from "@trebired/git-host";
|
|
206
|
+
import { createGitApiHandler, createGitApiSocketServer, createGitHost } from "@trebired/git-host";
|
|
175
207
|
import { createLog } from "@trebired/logger";
|
|
176
208
|
|
|
177
209
|
const log = createLog({
|
|
@@ -198,6 +230,16 @@ const apiServer = createServer(createGitApiHandler({
|
|
|
198
230
|
},
|
|
199
231
|
}));
|
|
200
232
|
|
|
233
|
+
createGitApiSocketServer({
|
|
234
|
+
basePath: "/api/git",
|
|
235
|
+
gitHost,
|
|
236
|
+
httpServer: apiServer,
|
|
237
|
+
logger: log,
|
|
238
|
+
authorize({ action, repositoryId }) {
|
|
239
|
+
return canReadRepository(repositoryId, action);
|
|
240
|
+
},
|
|
241
|
+
});
|
|
242
|
+
|
|
201
243
|
apiServer.listen(3100);
|
|
202
244
|
```
|
|
203
245
|
|
|
@@ -206,17 +248,23 @@ Then apps can use routes like:
|
|
|
206
248
|
```txt
|
|
207
249
|
GET /api/git/repositories/demo/summary
|
|
208
250
|
GET /api/git/repositories/demo/branches
|
|
209
|
-
GET /api/git/repositories/demo/commits?limit=20
|
|
251
|
+
GET /api/git/repositories/demo/commits?limit=20&ref=main&path=src/app.ts
|
|
210
252
|
GET /api/git/repositories/demo/commits/<commit-ref>
|
|
211
|
-
GET /api/git/repositories/demo/
|
|
253
|
+
GET /api/git/repositories/demo/tags
|
|
254
|
+
GET /api/git/repositories/demo/tags/v1
|
|
255
|
+
GET /api/git/repositories/demo/tree?ref=HEAD&path=src&linguist=true&icons=true
|
|
256
|
+
GET /api/git/repositories/demo/linguist?ref=HEAD
|
|
257
|
+
GET /api/git/repositories/demo/blame?ref=HEAD&path=src/app.ts
|
|
258
|
+
GET /api/git/repositories/demo/search?ref=HEAD&path=src&query=value
|
|
259
|
+
GET /api/git/repositories/demo/archive?ref=HEAD&format=zip
|
|
212
260
|
GET /api/git/repositories/demo/blob?ref=HEAD&path=README.md
|
|
213
|
-
GET /api/git/repositories/demo/diff?baseRef=main&headRef=feature%2Fx
|
|
261
|
+
GET /api/git/repositories/demo/diff?baseRef=main&headRef=feature%2Fx&path=src
|
|
214
262
|
```
|
|
215
263
|
|
|
216
264
|
React companion:
|
|
217
265
|
|
|
218
266
|
```ts
|
|
219
|
-
import { createGitApiClient, GitApiClientProvider, useGitRepositorySummary } from "@trebired/git-host/react";
|
|
267
|
+
import { createGitApiClient, GitApiClientProvider, useGitLinguist, useGitRepositorySummary } from "@trebired/git-host/react";
|
|
220
268
|
|
|
221
269
|
const gitClient = createGitApiClient({
|
|
222
270
|
baseUrl: "/api/git",
|
|
@@ -224,12 +272,13 @@ const gitClient = createGitApiClient({
|
|
|
224
272
|
|
|
225
273
|
function RepositorySummaryCard() {
|
|
226
274
|
const summary = useGitRepositorySummary("demo");
|
|
275
|
+
const linguist = useGitLinguist("demo", { ref: "main" });
|
|
227
276
|
|
|
228
277
|
if (summary.loading) return "Loading...";
|
|
229
278
|
if (summary.error) return summary.error.message;
|
|
230
279
|
if (!summary.data) return "Missing repository";
|
|
231
280
|
|
|
232
|
-
return `${summary.data.repository.current_branch} @ ${summary.data.repository.head_short}`;
|
|
281
|
+
return `${summary.data.repository.current_branch} @ ${summary.data.repository.head_short} (${Object.keys(linguist.data?.languages.results || {}).length} languages)`;
|
|
233
282
|
}
|
|
234
283
|
|
|
235
284
|
function App() {
|
|
@@ -241,6 +290,22 @@ function App() {
|
|
|
241
290
|
}
|
|
242
291
|
```
|
|
243
292
|
|
|
293
|
+
For long-running repository scans, the typed client also exposes a live Socket.IO linguist stream:
|
|
294
|
+
|
|
295
|
+
```ts
|
|
296
|
+
const socket = gitClient.openLinguistSocket("demo", {
|
|
297
|
+
ref: "main",
|
|
298
|
+
onProgress(event) {
|
|
299
|
+
console.log(event.stage, event.percent);
|
|
300
|
+
},
|
|
301
|
+
onResult(event) {
|
|
302
|
+
console.log(event.data.languages.results);
|
|
303
|
+
},
|
|
304
|
+
});
|
|
305
|
+
|
|
306
|
+
await socket.completed;
|
|
307
|
+
```
|
|
308
|
+
|
|
244
309
|
The React entry is intentionally headless. It helps apps fetch and mutate Git data consistently, but it does not ship a bundled styled UI.
|
|
245
310
|
|
|
246
311
|
## Current API
|
|
@@ -253,6 +318,7 @@ The first public slice is intentionally small:
|
|
|
253
318
|
- `buildGitEnv()`
|
|
254
319
|
- `RepositoryLockManager`
|
|
255
320
|
- `createGitApiHandler()`
|
|
321
|
+
- `createGitApiSocketServer()`
|
|
256
322
|
- `createGitHttpHandler()`
|
|
257
323
|
- `generateSshKeyPair()`
|
|
258
324
|
- `normalizeSshPublicKey()`
|
|
@@ -267,21 +333,32 @@ And the main host instance methods:
|
|
|
267
333
|
- `readSummary()`
|
|
268
334
|
- `listBranches()`
|
|
269
335
|
- `listCommits()`
|
|
336
|
+
- `listTags()`
|
|
270
337
|
- `listTree()`
|
|
338
|
+
- `readLinguist()`
|
|
339
|
+
- `readBlame()`
|
|
340
|
+
- `search()`
|
|
341
|
+
- `readArchive()`
|
|
271
342
|
- `readBlob()`
|
|
272
343
|
- `readCommit()`
|
|
344
|
+
- `readTag()`
|
|
273
345
|
- `diff()`
|
|
274
346
|
- `readWorkingTree()`
|
|
275
347
|
- `readStagedFile()`
|
|
276
348
|
- `readUnstagedFile()`
|
|
277
349
|
- `createBranch()`
|
|
350
|
+
- `createTag()`
|
|
278
351
|
- `checkoutBranch()`
|
|
279
352
|
- `checkoutRef()`
|
|
280
353
|
- `deleteBranch()`
|
|
354
|
+
- `deleteTag()`
|
|
281
355
|
- `stagePaths()`
|
|
282
356
|
- `unstagePaths()`
|
|
283
357
|
- `discardPaths()`
|
|
284
358
|
- `commit()`
|
|
359
|
+
- `merge()`
|
|
360
|
+
- `rebase()`
|
|
361
|
+
- `cherryPick()`
|
|
285
362
|
- `continueOperation()`
|
|
286
363
|
- `abortOperation()`
|
|
287
364
|
- `fetch()`
|
|
@@ -293,11 +370,18 @@ The React entry currently exports:
|
|
|
293
370
|
|
|
294
371
|
- `createGitApiClient()`
|
|
295
372
|
- `GitApiClientProvider`
|
|
373
|
+
- `openLinguistSocket()` through the typed client instance
|
|
296
374
|
- `useGitRepositorySummary()`
|
|
297
375
|
- `useGitBranches()`
|
|
298
376
|
- `useGitCommits()`
|
|
299
377
|
- `useGitCommit()`
|
|
378
|
+
- `useGitTags()`
|
|
379
|
+
- `useGitTag()`
|
|
300
380
|
- `useGitTree()`
|
|
381
|
+
- `useGitLinguist()`
|
|
382
|
+
- `useGitBlame()`
|
|
383
|
+
- `useGitSearch()`
|
|
384
|
+
- `useGitArchive()`
|
|
301
385
|
- `useGitBlob()`
|
|
302
386
|
- `useGitDiff()`
|
|
303
387
|
- `useGitApiQuery()`
|
|
@@ -360,6 +444,7 @@ Hosted transports keep identity and permission policy in your app.
|
|
|
360
444
|
- `createGitHttpHandler()` supports host-owned repository resolution, optional identity resolution, permission checks, and request audit events.
|
|
361
445
|
- `createGitSshServer()` supports host-owned public key authentication, permission checks, and command audit events.
|
|
362
446
|
- `createGitApiHandler()` supports host-owned repository id mapping and per-route authorization.
|
|
447
|
+
- `createGitApiSocketServer()` supports host-owned Socket.IO progress delivery for long-running linguist scans with the same repository mapping and authorization hooks.
|
|
363
448
|
- `generateSshKeyPair()`, `normalizeSshPublicKey()`, `compareSshPublicKeys()`, and `fingerprintSshPublicKey()` help host apps manage SSH transport setup without owning the parsing details themselves.
|
|
364
449
|
|
|
365
450
|
## Platform Fit
|
|
@@ -370,8 +455,8 @@ The package is meant to replace or simplify:
|
|
|
370
455
|
|
|
371
456
|
- Git CLI execution and environment shaping
|
|
372
457
|
- repository locking and mutation coordination
|
|
373
|
-
- repository summary, tree, blob, commit, diff, and working-tree reads
|
|
374
|
-
- branch, checkout, commit, fetch, pull, and push operations
|
|
458
|
+
- repository summary, tree, linguist, blame, search, archive, blob, commit, diff, and working-tree reads
|
|
459
|
+
- branch, tag, checkout, commit, merge, rebase, cherry-pick, fetch, pull, and push operations
|
|
375
460
|
- smart HTTP and SSH Git transport handling
|
|
376
461
|
- thin JSON API route internals around those Git operations
|
|
377
462
|
|
|
@@ -403,7 +488,7 @@ log.info("git-host", "initializing repository", { repositoryId: "demo" });
|
|
|
403
488
|
|
|
404
489
|
comes from `@trebired/logger`.
|
|
405
490
|
|
|
406
|
-
You can pass that same `log` object into `createGitHost()`, `createGitHttpHandler()`, `createGitSshServer()`, and `
|
|
491
|
+
You can pass that same `log` object into `createGitHost()`, `createGitHttpHandler()`, `createGitSshServer()`, `createGitApiHandler()`, and `createGitApiSocketServer()` through their `logger` option.
|
|
407
492
|
|
|
408
493
|
If you do not pass a logger and `@trebired/logger` is installed in the host app, git-host will create a quiet console-only logger automatically before falling back to raw `console`.
|
|
409
494
|
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import type { CreateGitApiHandlerOptions } from "../../types.js";
|
|
2
2
|
import { parseGitApiRoute } from "./route.js";
|
|
3
|
-
declare function runGitApiAction(options: CreateGitApiHandlerOptions, route: ReturnType<typeof parseGitApiRoute>, repositoryId: string, searchParams: URLSearchParams): Promise<import("../../types.js").GitCommitDetail | import("../../types.js").GitCommitSummary[] | import("../../types.js").GitCompareSummary | import("../../types.js").GitBlob | import("../../types.js").GitBranchSummary[] | import("../../types.js").GitRepositorySummary | import("../../types.js").GitTreeEntry[]>;
|
|
3
|
+
declare function runGitApiAction(options: CreateGitApiHandlerOptions, route: ReturnType<typeof parseGitApiRoute>, repositoryId: string, searchParams: URLSearchParams): Promise<import("../../types.js").GitCommitDetail | import("../../types.js").GitCommitSummary[] | import("../../types.js").GitCompareSummary | import("../../types.js").GitTagDetail | import("../../types.js").GitBlame | import("../../types.js").GitSearchResult | import("../../types.js").GitBlob | import("../../types.js").GitArchive | import("../../types.js").GitBranchSummary[] | import("../../types.js").GitRepositorySummary | import("../../types.js").GitRepositoryLinguist | import("../../types.js").GitTagSummary[] | import("../../types.js").GitTreeEntry[]>;
|
|
4
4
|
export { runGitApiAction };
|
|
5
5
|
//# sourceMappingURL=action.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"action.d.ts","sourceRoot":"","sources":["../../../src/api/handler/action.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,0BAA0B,EAAE,MAAM,gBAAgB,CAAC;AAGjE,OAAO,EAAE,gBAAgB,EAAE,MAAM,YAAY,CAAC;AAE9C,iBAAe,eAAe,CAC5B,OAAO,EAAE,0BAA0B,EACnC,KAAK,EAAE,UAAU,CAAC,OAAO,gBAAgB,CAAC,EAC1C,YAAY,EAAE,MAAM,EACpB,YAAY,EAAE,eAAe,
|
|
1
|
+
{"version":3,"file":"action.d.ts","sourceRoot":"","sources":["../../../src/api/handler/action.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,0BAA0B,EAAE,MAAM,gBAAgB,CAAC;AAGjE,OAAO,EAAE,gBAAgB,EAAE,MAAM,YAAY,CAAC;AAE9C,iBAAe,eAAe,CAC5B,OAAO,EAAE,0BAA0B,EACnC,KAAK,EAAE,UAAU,CAAC,OAAO,gBAAgB,CAAC,EAC1C,YAAY,EAAE,MAAM,EACpB,YAAY,EAAE,eAAe,ojBAkF9B;AAED,OAAO,EAAE,eAAe,EAAE,CAAC"}
|
|
@@ -14,15 +14,55 @@ async function runGitApiAction(options, route, repositoryId, searchParams) {
|
|
|
14
14
|
case "commits":
|
|
15
15
|
return await options.gitHost.listCommits(repositoryId, {
|
|
16
16
|
limit: parsePositiveInt(searchParams.get("limit"), "limit"),
|
|
17
|
+
path: text(searchParams.get("path")),
|
|
18
|
+
ref: text(searchParams.get("ref")),
|
|
17
19
|
});
|
|
18
20
|
case "commit":
|
|
19
21
|
return await options.gitHost.readCommit(repositoryId, route.commitRef);
|
|
22
|
+
case "tags":
|
|
23
|
+
return await options.gitHost.listTags(repositoryId);
|
|
24
|
+
case "tag":
|
|
25
|
+
return await options.gitHost.readTag(repositoryId, route.tagName);
|
|
20
26
|
case "tree":
|
|
21
27
|
return await options.gitHost.listTree(repositoryId, {
|
|
28
|
+
icons: isTruthy(searchParams.get("icons")),
|
|
29
|
+
linguist: isTruthy(searchParams.get("linguist")),
|
|
22
30
|
path: text(searchParams.get("path")),
|
|
23
31
|
recursive: isTruthy(searchParams.get("recursive")),
|
|
24
32
|
ref: text(searchParams.get("ref")),
|
|
25
33
|
});
|
|
34
|
+
case "blame": {
|
|
35
|
+
const blamePath = text(searchParams.get("path"));
|
|
36
|
+
if (!blamePath)
|
|
37
|
+
throw new GitHostError("invalid_repository_path", "blame path is required.");
|
|
38
|
+
return await options.gitHost.readBlame(repositoryId, {
|
|
39
|
+
path: blamePath,
|
|
40
|
+
ref: text(searchParams.get("ref")),
|
|
41
|
+
});
|
|
42
|
+
}
|
|
43
|
+
case "search": {
|
|
44
|
+
const query = text(searchParams.get("query"));
|
|
45
|
+
if (!query)
|
|
46
|
+
throw new GitHostError("git_command_failed", "query is required.");
|
|
47
|
+
return await options.gitHost.search(repositoryId, {
|
|
48
|
+
caseSensitive: searchParams.has("caseSensitive") ? isTruthy(searchParams.get("caseSensitive")) : undefined,
|
|
49
|
+
limit: parsePositiveInt(searchParams.get("limit"), "limit"),
|
|
50
|
+
path: text(searchParams.get("path")),
|
|
51
|
+
query,
|
|
52
|
+
ref: text(searchParams.get("ref")),
|
|
53
|
+
regexp: searchParams.has("regexp") ? isTruthy(searchParams.get("regexp")) : undefined,
|
|
54
|
+
});
|
|
55
|
+
}
|
|
56
|
+
case "archive":
|
|
57
|
+
return await options.gitHost.readArchive(repositoryId, {
|
|
58
|
+
format: text(searchParams.get("format")) === "zip" ? "zip" : undefined,
|
|
59
|
+
prefix: text(searchParams.get("prefix")),
|
|
60
|
+
ref: text(searchParams.get("ref")),
|
|
61
|
+
});
|
|
62
|
+
case "linguist":
|
|
63
|
+
return await options.gitHost.readLinguist(repositoryId, {
|
|
64
|
+
ref: text(searchParams.get("ref")),
|
|
65
|
+
});
|
|
26
66
|
case "blob": {
|
|
27
67
|
const blobPath = text(searchParams.get("path"));
|
|
28
68
|
if (!blobPath)
|
|
@@ -37,7 +77,11 @@ async function runGitApiAction(options, route, repositoryId, searchParams) {
|
|
|
37
77
|
const headRef = text(searchParams.get("headRef"));
|
|
38
78
|
if (!baseRef || !headRef)
|
|
39
79
|
throw new GitHostError("git_command_failed", "baseRef and headRef are required.");
|
|
40
|
-
return await options.gitHost.diff(repositoryId, {
|
|
80
|
+
return await options.gitHost.diff(repositoryId, {
|
|
81
|
+
baseRef,
|
|
82
|
+
headRef,
|
|
83
|
+
path: text(searchParams.get("path")),
|
|
84
|
+
});
|
|
41
85
|
}
|
|
42
86
|
default:
|
|
43
87
|
throw new GitHostError("git_command_failed", "Unsupported Git API action.");
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"action.js","sourceRoot":"","sources":["../../../src/api/handler/action.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAAE,MAAM,iBAAiB,CAAC;AAE/C,OAAO,EAAE,QAAQ,EAAE,IAAI,EAAE,MAAM,qBAAqB,CAAC;AACrD,OAAO,EAAE,gBAAgB,EAAE,MAAM,eAAe,CAAC;AAGjD,KAAK,UAAU,eAAe,CAC5B,OAAmC,EACnC,KAA0C,EAC1C,YAAoB,EACpB,YAA6B;IAE7B,IAAI,CAAC,KAAK;QAAE,MAAM,IAAI,YAAY,CAAC,oBAAoB,EAAE,wBAAwB,CAAC,CAAC;IAEnF,QAAQ,KAAK,CAAC,MAAM,EAAE,CAAC;QACrB,KAAK,SAAS;YACZ,OAAO,MAAM,OAAO,CAAC,OAAO,CAAC,WAAW,CAAC,YAAY,EAAE;gBACrD,WAAW,EAAE,gBAAgB,CAAC,YAAY,CAAC,GAAG,CAAC,aAAa,CAAC,EAAE,aAAa,CAAC;aAC9E,CAAC,CAAC;QACL,KAAK,UAAU;YACb,OAAO,MAAM,OAAO,CAAC,OAAO,CAAC,YAAY,CAAC,YAAY,CAAC,CAAC;QAC1D,KAAK,SAAS;YACZ,OAAO,MAAM,OAAO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: unknown, basePathInput: unknown): {
|
|
2
|
-
action: "blob" | "branches" | "diff" | "summary" | "tree";
|
|
2
|
+
action: "archive" | "blame" | "blob" | "branches" | "diff" | "linguist" | "search" | "summary" | "tree";
|
|
3
3
|
repositoryKey: string;
|
|
4
4
|
commitRef?: undefined;
|
|
5
|
+
tagName?: undefined;
|
|
5
6
|
} | {
|
|
6
7
|
action: "commits";
|
|
7
8
|
repositoryKey: string;
|
|
8
9
|
commitRef?: undefined;
|
|
10
|
+
tagName?: undefined;
|
|
9
11
|
} | {
|
|
10
12
|
action: "commit";
|
|
11
13
|
commitRef: string;
|
|
12
14
|
repositoryKey: string;
|
|
15
|
+
tagName?: undefined;
|
|
16
|
+
} | {
|
|
17
|
+
action: "tags";
|
|
18
|
+
repositoryKey: string;
|
|
19
|
+
commitRef?: undefined;
|
|
20
|
+
tagName?: undefined;
|
|
21
|
+
} | {
|
|
22
|
+
action: "tag";
|
|
23
|
+
repositoryKey: string;
|
|
24
|
+
tagName: string;
|
|
25
|
+
commitRef?: undefined;
|
|
13
26
|
};
|
|
14
27
|
export { parseGitApiRoute };
|
|
15
28
|
//# sourceMappingURL=route.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"route.d.ts","sourceRoot":"","sources":["../../../src/api/handler/route.ts"],"names":[],"mappings":"AAiBA,iBAAS,gBAAgB,CAAC,aAAa,EAAE,OAAO,EAAE,aAAa,EAAE,OAAO
|
|
1
|
+
{"version":3,"file":"route.d.ts","sourceRoot":"","sources":["../../../src/api/handler/route.ts"],"names":[],"mappings":"AAiBA,iBAAS,gBAAgB,CAAC,aAAa,EAAE,OAAO,EAAE,aAAa,EAAE,OAAO;;;;;;;;;;;;;;;;;;;;;;;;;EAmDvE;AAED,OAAO,EAAE,gBAAgB,EAAE,CAAC"}
|
|
@@ -30,7 +30,15 @@ function parseGitApiRoute(pathnameInput, basePathInput) {
|
|
|
30
30
|
if (!repositoryKey)
|
|
31
31
|
return null;
|
|
32
32
|
const action = text(segments[2]);
|
|
33
|
-
if (action === "summary"
|
|
33
|
+
if (action === "summary"
|
|
34
|
+
|| action === "branches"
|
|
35
|
+
|| action === "tree"
|
|
36
|
+
|| action === "blob"
|
|
37
|
+
|| action === "diff"
|
|
38
|
+
|| action === "linguist"
|
|
39
|
+
|| action === "blame"
|
|
40
|
+
|| action === "search"
|
|
41
|
+
|| action === "archive") {
|
|
34
42
|
if (segments.length !== 3)
|
|
35
43
|
return null;
|
|
36
44
|
return { action, repositoryKey };
|
|
@@ -45,6 +53,16 @@ function parseGitApiRoute(pathnameInput, basePathInput) {
|
|
|
45
53
|
return { action: "commit", commitRef, repositoryKey };
|
|
46
54
|
}
|
|
47
55
|
}
|
|
56
|
+
if (action === "tags") {
|
|
57
|
+
if (segments.length === 3)
|
|
58
|
+
return { action, repositoryKey };
|
|
59
|
+
if (segments.length === 4) {
|
|
60
|
+
const tagName = decodeRouteSegment(segments[3] || "");
|
|
61
|
+
if (!tagName)
|
|
62
|
+
return null;
|
|
63
|
+
return { action: "tag", repositoryKey, tagName };
|
|
64
|
+
}
|
|
65
|
+
}
|
|
48
66
|
return null;
|
|
49
67
|
}
|
|
50
68
|
export { parseGitApiRoute };
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"route.js","sourceRoot":"","sources":["../../../src/api/handler/route.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,IAAI,EAAE,MAAM,qBAAqB,CAAC;AAE3C,SAAS,iBAAiB,CAAC,KAAc;IACvC,MAAM,IAAI,GAAG,IAAI,CAAC,KAAK,CAAC,CAAC,OAAO,CAAC,OAAO,EAAE,EAAE,CAAC,CAAC;IAC9C,IAAI,CAAC,IAAI,IAAI,IAAI,KAAK,GAAG;QAAE,OAAO,EAAE,CAAC;IACrC,OAAO,IAAI,CAAC,UAAU,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,IAAI,IAAI,EAAE,CAAC;AAClD,CAAC;AAED,SAA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AC5D,IAAI,QAAQ,CAAC,MAAM,KAAK,CAAC,EAAE,CAAC;YAC1B,MAAM,OAAO,GAAG,kBAAkB,CAAC,QAAQ,CAAC,CAAC,CAAC,IAAI,EAAE,CAAC,CAAC;YACtD,IAAI,CAAC,OAAO;gBAAE,OAAO,IAAI,CAAC;YAC1B,OAAO,EAAE,MAAM,EAAE,KAAc,EAAE,aAAa,EAAE,OAAO,EAAE,CAAC;QAC5D,CAAC;IACH,CAAC;IAED,OAAO,IAAI,CAAC;AACd,CAAC;AAED,OAAO,EAAE,gBAAgB,EAAE,CAAC"}
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
declare const LINGUIST_START_EVENT = "git:linguist:start";
|
|
2
|
+
declare const LINGUIST_PROGRESS_EVENT = "git:linguist:progress";
|
|
3
|
+
declare const LINGUIST_RESULT_EVENT = "git:linguist:result";
|
|
4
|
+
declare const LINGUIST_DONE_EVENT = "git:linguist:done";
|
|
5
|
+
declare const LINGUIST_ERROR_EVENT = "git:linguist:error";
|
|
6
|
+
export { LINGUIST_DONE_EVENT, LINGUIST_ERROR_EVENT, LINGUIST_PROGRESS_EVENT, LINGUIST_RESULT_EVENT, LINGUIST_START_EVENT, };
|
|
7
|
+
//# sourceMappingURL=socket_events.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"socket_events.d.ts","sourceRoot":"","sources":["../../src/api/socket_events.ts"],"names":[],"mappings":"AAAA,QAAA,MAAM,oBAAoB,uBAAuB,CAAC;AAClD,QAAA,MAAM,uBAAuB,0BAA0B,CAAC;AACxD,QAAA,MAAM,qBAAqB,wBAAwB,CAAC;AACpD,QAAA,MAAM,mBAAmB,sBAAsB,CAAC;AAChD,QAAA,MAAM,oBAAoB,uBAAuB,CAAC;AAElD,OAAO,EACL,mBAAmB,EACnB,oBAAoB,EACpB,uBAAuB,EACvB,qBAAqB,EACrB,oBAAoB,GACrB,CAAC"}
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
const LINGUIST_START_EVENT = "git:linguist:start";
|
|
2
|
+
const LINGUIST_PROGRESS_EVENT = "git:linguist:progress";
|
|
3
|
+
const LINGUIST_RESULT_EVENT = "git:linguist:result";
|
|
4
|
+
const LINGUIST_DONE_EVENT = "git:linguist:done";
|
|
5
|
+
const LINGUIST_ERROR_EVENT = "git:linguist:error";
|
|
6
|
+
export { LINGUIST_DONE_EVENT, LINGUIST_ERROR_EVENT, LINGUIST_PROGRESS_EVENT, LINGUIST_RESULT_EVENT, LINGUIST_START_EVENT, };
|
|
7
|
+
//# sourceMappingURL=socket_events.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"socket_events.js","sourceRoot":"","sources":["../../src/api/socket_events.ts"],"names":[],"mappings":"AAAA,MAAM,oBAAoB,GAAG,oBAAoB,CAAC;AAClD,MAAM,uBAAuB,GAAG,uBAAuB,CAAC;AACxD,MAAM,qBAAqB,GAAG,qBAAqB,CAAC;AACpD,MAAM,mBAAmB,GAAG,mBAAmB,CAAC;AAChD,MAAM,oBAAoB,GAAG,oBAAoB,CAAC;AAElD,OAAO,EACL,mBAAmB,EACnB,oBAAoB,EACpB,uBAAuB,EACvB,qBAAqB,EACrB,oBAAoB,GACrB,CAAC"}
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import { Server as SocketIoServer } from "socket.io";
|
|
2
|
+
import type { CreateGitApiSocketServerOptions } from "../types.js";
|
|
3
|
+
import { LINGUIST_DONE_EVENT, LINGUIST_ERROR_EVENT, LINGUIST_PROGRESS_EVENT, LINGUIST_RESULT_EVENT, LINGUIST_START_EVENT } from "./socket_events.js";
|
|
4
|
+
declare function createGitApiSocketServer(options: CreateGitApiSocketServerOptions): SocketIoServer<import("socket.io").DefaultEventsMap, import("socket.io").DefaultEventsMap, import("socket.io").DefaultEventsMap, any>;
|
|
5
|
+
export { createGitApiSocketServer, LINGUIST_DONE_EVENT, LINGUIST_ERROR_EVENT, LINGUIST_PROGRESS_EVENT, LINGUIST_RESULT_EVENT, LINGUIST_START_EVENT, };
|
|
6
|
+
//# sourceMappingURL=socket_server.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"socket_server.d.ts","sourceRoot":"","sources":["../../src/api/socket_server.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,IAAI,cAAc,EAAE,MAAM,WAAW,CAAC;AAGrD,OAAO,KAAK,EACV,+BAA+B,EAEhC,MAAM,aAAa,CAAC;AAErB,OAAO,EACL,mBAAmB,EACnB,oBAAoB,EACpB,uBAAuB,EACvB,qBAAqB,EACrB,oBAAoB,EACrB,MAAM,oBAAoB,CAAC;AAc5B,iBAAS,wBAAwB,CAAC,OAAO,EAAE,+BAA+B,yIAgJzE;AAED,OAAO,EACL,wBAAwB,EACxB,mBAAmB,EACnB,oBAAoB,EACpB,uBAAuB,EACvB,qBAAqB,EACrB,oBAAoB,GACrB,CAAC"}
|
|
@@ -0,0 +1,156 @@
|
|
|
1
|
+
import { Server as SocketIoServer } from "socket.io";
|
|
2
|
+
import { resolveLogger } from "../logging.js";
|
|
3
|
+
import { text } from "../utils/text.js";
|
|
4
|
+
import { LINGUIST_DONE_EVENT, LINGUIST_ERROR_EVENT, LINGUIST_PROGRESS_EVENT, LINGUIST_RESULT_EVENT, LINGUIST_START_EVENT, } from "./socket_events.js";
|
|
5
|
+
import { authorizationAllowed, serializeError, statusForError } from "./handler/response.js";
|
|
6
|
+
function normalizeSocketPath(basePathInput, socketPathInput) {
|
|
7
|
+
const socketPath = text(socketPathInput).replace(/\/+$/g, "");
|
|
8
|
+
if (socketPath) {
|
|
9
|
+
return socketPath.startsWith("/") ? socketPath : `/${socketPath}`;
|
|
10
|
+
}
|
|
11
|
+
const basePath = text(basePathInput).replace(/\/+$/g, "");
|
|
12
|
+
if (!basePath || basePath === "/")
|
|
13
|
+
return "/socket.io";
|
|
14
|
+
return `${basePath.startsWith("/") ? basePath : `/${basePath}`}/socket.io`;
|
|
15
|
+
}
|
|
16
|
+
function createGitApiSocketServer(options) {
|
|
17
|
+
if (!options || typeof options.gitHost !== "object") {
|
|
18
|
+
throw new TypeError("createGitApiSocketServer() requires a gitHost instance.");
|
|
19
|
+
}
|
|
20
|
+
if (!options.httpServer) {
|
|
21
|
+
throw new TypeError("createGitApiSocketServer() requires an httpServer.");
|
|
22
|
+
}
|
|
23
|
+
const logger = resolveLogger(options.logger);
|
|
24
|
+
const verbose = options.verbose === true;
|
|
25
|
+
const logGroup = "git-host.api.socket";
|
|
26
|
+
const basePath = text(options.basePath, "/api/git");
|
|
27
|
+
const path = normalizeSocketPath(basePath, options.socketPath);
|
|
28
|
+
const io = new SocketIoServer(options.httpServer, {
|
|
29
|
+
...(options.socketOptions || {}),
|
|
30
|
+
path,
|
|
31
|
+
});
|
|
32
|
+
io.on("connection", (socket) => {
|
|
33
|
+
socket.on(LINGUIST_START_EVENT, async (payload) => {
|
|
34
|
+
const repositoryKey = text(payload && payload.repositoryKey);
|
|
35
|
+
const ref = text(payload && payload.ref);
|
|
36
|
+
const pathname = `${basePath.replace(/\/+$/g, "") || ""}/repositories/${encodeURIComponent(repositoryKey)}/linguist/socket`;
|
|
37
|
+
if (!repositoryKey) {
|
|
38
|
+
socket.emit(LINGUIST_ERROR_EVENT, {
|
|
39
|
+
error: {
|
|
40
|
+
code: "repository_not_found",
|
|
41
|
+
message: "Repository key is required.",
|
|
42
|
+
},
|
|
43
|
+
status: 404,
|
|
44
|
+
});
|
|
45
|
+
socket.emit(LINGUIST_DONE_EVENT, { ok: false });
|
|
46
|
+
socket.disconnect();
|
|
47
|
+
return;
|
|
48
|
+
}
|
|
49
|
+
const repositoryId = text(options.resolveRepositoryId
|
|
50
|
+
? await options.resolveRepositoryId(repositoryKey, socket.request)
|
|
51
|
+
: repositoryKey);
|
|
52
|
+
if (!repositoryId) {
|
|
53
|
+
socket.emit(LINGUIST_ERROR_EVENT, {
|
|
54
|
+
error: {
|
|
55
|
+
code: "repository_not_found",
|
|
56
|
+
message: "Repository not found.",
|
|
57
|
+
},
|
|
58
|
+
status: 404,
|
|
59
|
+
});
|
|
60
|
+
socket.emit(LINGUIST_DONE_EVENT, { ok: false, repository_key: repositoryKey });
|
|
61
|
+
socket.disconnect();
|
|
62
|
+
return;
|
|
63
|
+
}
|
|
64
|
+
const searchParams = new URLSearchParams();
|
|
65
|
+
if (ref)
|
|
66
|
+
searchParams.set("ref", ref);
|
|
67
|
+
const auth = authorizationAllowed(options.authorize
|
|
68
|
+
? await options.authorize({
|
|
69
|
+
action: "linguist_socket",
|
|
70
|
+
method: "SOCKET",
|
|
71
|
+
pathname,
|
|
72
|
+
remoteAddress: text(socket.handshake.address),
|
|
73
|
+
repositoryId,
|
|
74
|
+
repositoryKey,
|
|
75
|
+
request: socket.request,
|
|
76
|
+
searchParams,
|
|
77
|
+
})
|
|
78
|
+
: undefined);
|
|
79
|
+
if (!auth.allowed) {
|
|
80
|
+
logger.warn(logGroup, "api socket permission denied", {
|
|
81
|
+
action: "linguist_socket",
|
|
82
|
+
pathname,
|
|
83
|
+
repositoryId,
|
|
84
|
+
repositoryKey,
|
|
85
|
+
status: auth.status || 403,
|
|
86
|
+
});
|
|
87
|
+
socket.emit(LINGUIST_ERROR_EVENT, {
|
|
88
|
+
error: {
|
|
89
|
+
code: "permission_denied",
|
|
90
|
+
message: auth.message || "Permission denied.",
|
|
91
|
+
},
|
|
92
|
+
status: auth.status || 403,
|
|
93
|
+
});
|
|
94
|
+
socket.emit(LINGUIST_DONE_EVENT, {
|
|
95
|
+
ok: false,
|
|
96
|
+
repository_id: repositoryId,
|
|
97
|
+
repository_key: repositoryKey,
|
|
98
|
+
});
|
|
99
|
+
socket.disconnect();
|
|
100
|
+
return;
|
|
101
|
+
}
|
|
102
|
+
try {
|
|
103
|
+
const data = await options.gitHost.readLinguist(repositoryId, {
|
|
104
|
+
onProgress(progressEvent) {
|
|
105
|
+
socket.emit(LINGUIST_PROGRESS_EVENT, progressEvent);
|
|
106
|
+
},
|
|
107
|
+
ref,
|
|
108
|
+
});
|
|
109
|
+
socket.emit(LINGUIST_RESULT_EVENT, {
|
|
110
|
+
action: "linguist",
|
|
111
|
+
data,
|
|
112
|
+
repository_id: repositoryId,
|
|
113
|
+
repository_key: repositoryKey,
|
|
114
|
+
});
|
|
115
|
+
socket.emit(LINGUIST_DONE_EVENT, {
|
|
116
|
+
ok: true,
|
|
117
|
+
repository_id: repositoryId,
|
|
118
|
+
repository_key: repositoryKey,
|
|
119
|
+
});
|
|
120
|
+
if (verbose) {
|
|
121
|
+
logger.info(logGroup, "api linguist socket completed", {
|
|
122
|
+
repositoryId,
|
|
123
|
+
repositoryKey,
|
|
124
|
+
socketId: socket.id,
|
|
125
|
+
});
|
|
126
|
+
}
|
|
127
|
+
}
|
|
128
|
+
catch (error) {
|
|
129
|
+
logger.error(logGroup, "api linguist socket failed", {
|
|
130
|
+
error: error instanceof Error ? error.message : String(error),
|
|
131
|
+
repositoryId,
|
|
132
|
+
repositoryKey,
|
|
133
|
+
socketId: socket.id,
|
|
134
|
+
});
|
|
135
|
+
socket.emit(LINGUIST_ERROR_EVENT, {
|
|
136
|
+
...serializeError(error),
|
|
137
|
+
ok: false,
|
|
138
|
+
repository_id: repositoryId,
|
|
139
|
+
repository_key: repositoryKey,
|
|
140
|
+
status: statusForError(error),
|
|
141
|
+
});
|
|
142
|
+
socket.emit(LINGUIST_DONE_EVENT, {
|
|
143
|
+
ok: false,
|
|
144
|
+
repository_id: repositoryId,
|
|
145
|
+
repository_key: repositoryKey,
|
|
146
|
+
});
|
|
147
|
+
}
|
|
148
|
+
finally {
|
|
149
|
+
socket.disconnect();
|
|
150
|
+
}
|
|
151
|
+
});
|
|
152
|
+
});
|
|
153
|
+
return io;
|
|
154
|
+
}
|
|
155
|
+
export { createGitApiSocketServer, LINGUIST_DONE_EVENT, LINGUIST_ERROR_EVENT, LINGUIST_PROGRESS_EVENT, LINGUIST_RESULT_EVENT, LINGUIST_START_EVENT, };
|
|
156
|
+
//# sourceMappingURL=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MAAM,CAAC,IAAI,CAAC,QAAQ,EAAE,+BAA+B,EAAE;wBACrD,YAAY;wBACZ,aAAa;wBACb,QAAQ,EAAE,MAAM,CAAC,EAAE;qBACpB,CAAC,CAAC;gBACL,CAAC;YACH,CAAC;YAAC,OAAO,KAAK,EAAE,CAAC;gBACf,MAAM,CAAC,KAAK,CAAC,QAAQ,EAAE,4BAA4B,EAAE;oBACnD,KAAK,EAAE,KAAK,YAAY,KAAK,CAAC,CAAC,CAAC,KAAK,CAAC,OAAO,CAAC,CAAC,CAAC,MAAM,CAAC,KAAK,CAAC;oBAC7D,YAAY;oBACZ,aAAa;oBACb,QAAQ,EAAE,MAAM,CAAC,EAAE;iBACpB,CAAC,CAAC;gBACH,MAAM,CAAC,IAAI,CAAC,oBAAoB,EAAE;oBAChC,GAAG,cAAc,CAAC,KAAK,CAAC;oBACxB,EAAE,EAAE,KAAK;oBACT,aAAa,EAAE,YAAY;oBAC3B,cAAc,EAAE,aAAa;oBAC7B,MAAM,EAAE,cAAc,CAAC,KAAK,CAAC;iBAC9B,CAAC,CAAC;gBACH,MAAM,CAAC,IAAI,CAAC,mBAAmB,EAAE;oBAC/B,EAAE,EAAE,KAAK;oBACT,aAAa,EAAE,YAAY;oBAC3B,cAAc,EAAE,aAAa;iBAC9B,CAAC,CAAC;YACL,CAAC;oBAAS,CAAC;gBACT,MAAM,CAAC,UAAU,EAAE,CAAC;YACtB,CAAC;QACH,CAAC,CAAC,CAAC;IACL,CAAC,CAAC,CAAC;IAEH,OAAO,EAAE,CAAC;AACZ,CAAC;AAED,OAAO,EACL,wBAAwB,EACxB,mBAAmB,EACnB,oBAAoB,EACpB,uBAAuB,EACvB,qBAAqB,EACrB,oBAAoB,GACrB,CAAC"}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import type { GitHost } from "../../types.js";
|
|
2
2
|
import type { GitHostMethodContext } from "./shared.js";
|
|
3
|
-
declare function createBranchMethods(context: GitHostMethodContext): Pick<GitHost, "checkoutBranch" | "checkoutRef" | "createBranch" | "deleteBranch" | "listBranches" | "listCommits">;
|
|
3
|
+
declare function createBranchMethods(context: GitHostMethodContext): Pick<GitHost, "checkoutBranch" | "checkoutRef" | "createBranch" | "createTag" | "deleteBranch" | "deleteTag" | "listBranches" | "listCommits" | "listTags" | "readTag">;
|
|
4
4
|
export { createBranchMethods };
|
|
5
5
|
//# sourceMappingURL=branch_methods.d.ts.map
|