@trebired/git-host 0.1.0 → 0.2.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 +13 -0
- package/README.md +59 -8
- 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/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.d.ts +25 -2
- package/dist/core/inspect.d.ts.map +1 -1
- package/dist/core/inspect.js +329 -7
- 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 +3 -3
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +2 -2
- package/dist/index.js.map +1 -1
- package/dist/react/client/types.d.ts +28 -1
- package/dist/react/client/types.d.ts.map +1 -1
- package/dist/react/client.d.ts.map +1 -1
- package/dist/react/client.js +61 -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 +2 -2
- 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 +64 -2
- package/dist/types/host.d.ts.map +1 -1
- package/dist/types/index.d.ts +2 -2
- package/dist/types/index.d.ts.map +1 -1
- package/dist/types/repository.d.ts +101 -1
- package/dist/types/repository.d.ts.map +1 -1
- package/dist/types/transports.d.ts +1 -1
- package/dist/types/transports.d.ts.map +1 -1
- package/package.json +3 -1
package/CHANGELOG.md
CHANGED
|
@@ -4,6 +4,19 @@ 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
|
+
## 0.2.0
|
|
10
|
+
|
|
11
|
+
- Added repository linguist analysis through `readLinguist()` with ref-based text blob inspection powered by `linguist-js`.
|
|
12
|
+
- Added optional tree entry enrichment for detected file languages and inline SVG icons from `material-icon-theme`.
|
|
13
|
+
- Added tag APIs for listing, reading, creating, and deleting tags.
|
|
14
|
+
- Added path- and ref-scoped commit history plus path-scoped diff filtering.
|
|
15
|
+
- Added blame, search, and archive reads for deeper repository inspection.
|
|
16
|
+
- Added merge, rebase, and cherry-pick start helpers to the core host API.
|
|
17
|
+
- Added JSON API routes, typed client methods, and React hooks for linguist, tags, blame, search, archive, and enriched tree reads.
|
|
18
|
+
- Added tests and README coverage for the expanded repository inspection surface.
|
|
19
|
+
|
|
7
20
|
## 0.1.0
|
|
8
21
|
|
|
9
22
|
- 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,33 @@ 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", { ref: "main" });
|
|
74
|
+
console.log(linguist.languages.results);
|
|
75
|
+
|
|
76
|
+
const tree = await gitHost.listTree("demo", {
|
|
77
|
+
ref: "main",
|
|
78
|
+
recursive: true,
|
|
79
|
+
linguist: true,
|
|
80
|
+
icons: true,
|
|
81
|
+
});
|
|
82
|
+
console.log(tree[0]?.language, Boolean(tree[0]?.icon));
|
|
83
|
+
|
|
84
|
+
const tags = await gitHost.listTags("demo");
|
|
85
|
+
const blame = await gitHost.readBlame("demo", {
|
|
86
|
+
ref: "main",
|
|
87
|
+
path: "src/app.ts",
|
|
88
|
+
});
|
|
89
|
+
const search = await gitHost.search("demo", {
|
|
90
|
+
ref: "main",
|
|
91
|
+
path: "src",
|
|
92
|
+
query: "value",
|
|
93
|
+
});
|
|
94
|
+
const archive = await gitHost.readArchive("demo", {
|
|
95
|
+
ref: "main",
|
|
96
|
+
format: "zip",
|
|
97
|
+
});
|
|
98
|
+
console.log(tags.length, blame.lines[0]?.author_name, search.match_count, archive.file_name);
|
|
99
|
+
|
|
73
100
|
const workingTree = await gitHost.readWorkingTree("demo");
|
|
74
101
|
console.log(workingTree.unstaged_entries);
|
|
75
102
|
|
|
@@ -206,17 +233,23 @@ Then apps can use routes like:
|
|
|
206
233
|
```txt
|
|
207
234
|
GET /api/git/repositories/demo/summary
|
|
208
235
|
GET /api/git/repositories/demo/branches
|
|
209
|
-
GET /api/git/repositories/demo/commits?limit=20
|
|
236
|
+
GET /api/git/repositories/demo/commits?limit=20&ref=main&path=src/app.ts
|
|
210
237
|
GET /api/git/repositories/demo/commits/<commit-ref>
|
|
211
|
-
GET /api/git/repositories/demo/
|
|
238
|
+
GET /api/git/repositories/demo/tags
|
|
239
|
+
GET /api/git/repositories/demo/tags/v1
|
|
240
|
+
GET /api/git/repositories/demo/tree?ref=HEAD&path=src&linguist=true&icons=true
|
|
241
|
+
GET /api/git/repositories/demo/linguist?ref=HEAD
|
|
242
|
+
GET /api/git/repositories/demo/blame?ref=HEAD&path=src/app.ts
|
|
243
|
+
GET /api/git/repositories/demo/search?ref=HEAD&path=src&query=value
|
|
244
|
+
GET /api/git/repositories/demo/archive?ref=HEAD&format=zip
|
|
212
245
|
GET /api/git/repositories/demo/blob?ref=HEAD&path=README.md
|
|
213
|
-
GET /api/git/repositories/demo/diff?baseRef=main&headRef=feature%2Fx
|
|
246
|
+
GET /api/git/repositories/demo/diff?baseRef=main&headRef=feature%2Fx&path=src
|
|
214
247
|
```
|
|
215
248
|
|
|
216
249
|
React companion:
|
|
217
250
|
|
|
218
251
|
```ts
|
|
219
|
-
import { createGitApiClient, GitApiClientProvider, useGitRepositorySummary } from "@trebired/git-host/react";
|
|
252
|
+
import { createGitApiClient, GitApiClientProvider, useGitLinguist, useGitRepositorySummary } from "@trebired/git-host/react";
|
|
220
253
|
|
|
221
254
|
const gitClient = createGitApiClient({
|
|
222
255
|
baseUrl: "/api/git",
|
|
@@ -224,12 +257,13 @@ const gitClient = createGitApiClient({
|
|
|
224
257
|
|
|
225
258
|
function RepositorySummaryCard() {
|
|
226
259
|
const summary = useGitRepositorySummary("demo");
|
|
260
|
+
const linguist = useGitLinguist("demo", { ref: "main" });
|
|
227
261
|
|
|
228
262
|
if (summary.loading) return "Loading...";
|
|
229
263
|
if (summary.error) return summary.error.message;
|
|
230
264
|
if (!summary.data) return "Missing repository";
|
|
231
265
|
|
|
232
|
-
return `${summary.data.repository.current_branch} @ ${summary.data.repository.head_short}`;
|
|
266
|
+
return `${summary.data.repository.current_branch} @ ${summary.data.repository.head_short} (${Object.keys(linguist.data?.languages.results || {}).length} languages)`;
|
|
233
267
|
}
|
|
234
268
|
|
|
235
269
|
function App() {
|
|
@@ -267,21 +301,32 @@ And the main host instance methods:
|
|
|
267
301
|
- `readSummary()`
|
|
268
302
|
- `listBranches()`
|
|
269
303
|
- `listCommits()`
|
|
304
|
+
- `listTags()`
|
|
270
305
|
- `listTree()`
|
|
306
|
+
- `readLinguist()`
|
|
307
|
+
- `readBlame()`
|
|
308
|
+
- `search()`
|
|
309
|
+
- `readArchive()`
|
|
271
310
|
- `readBlob()`
|
|
272
311
|
- `readCommit()`
|
|
312
|
+
- `readTag()`
|
|
273
313
|
- `diff()`
|
|
274
314
|
- `readWorkingTree()`
|
|
275
315
|
- `readStagedFile()`
|
|
276
316
|
- `readUnstagedFile()`
|
|
277
317
|
- `createBranch()`
|
|
318
|
+
- `createTag()`
|
|
278
319
|
- `checkoutBranch()`
|
|
279
320
|
- `checkoutRef()`
|
|
280
321
|
- `deleteBranch()`
|
|
322
|
+
- `deleteTag()`
|
|
281
323
|
- `stagePaths()`
|
|
282
324
|
- `unstagePaths()`
|
|
283
325
|
- `discardPaths()`
|
|
284
326
|
- `commit()`
|
|
327
|
+
- `merge()`
|
|
328
|
+
- `rebase()`
|
|
329
|
+
- `cherryPick()`
|
|
285
330
|
- `continueOperation()`
|
|
286
331
|
- `abortOperation()`
|
|
287
332
|
- `fetch()`
|
|
@@ -297,7 +342,13 @@ The React entry currently exports:
|
|
|
297
342
|
- `useGitBranches()`
|
|
298
343
|
- `useGitCommits()`
|
|
299
344
|
- `useGitCommit()`
|
|
345
|
+
- `useGitTags()`
|
|
346
|
+
- `useGitTag()`
|
|
300
347
|
- `useGitTree()`
|
|
348
|
+
- `useGitLinguist()`
|
|
349
|
+
- `useGitBlame()`
|
|
350
|
+
- `useGitSearch()`
|
|
351
|
+
- `useGitArchive()`
|
|
301
352
|
- `useGitBlob()`
|
|
302
353
|
- `useGitDiff()`
|
|
303
354
|
- `useGitApiQuery()`
|
|
@@ -370,8 +421,8 @@ The package is meant to replace or simplify:
|
|
|
370
421
|
|
|
371
422
|
- Git CLI execution and environment shaping
|
|
372
423
|
- 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
|
|
424
|
+
- repository summary, tree, linguist, blame, search, archive, blob, commit, diff, and working-tree reads
|
|
425
|
+
- branch, tag, checkout, commit, merge, rebase, cherry-pick, fetch, pull, and push operations
|
|
375
426
|
- smart HTTP and SSH Git transport handling
|
|
376
427
|
- thin JSON API route internals around those Git operations
|
|
377
428
|
|
|
@@ -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,CAAC,OAAO,CAAC,WAAW,CAAC,YAAY,EAAE;gBACrD,KAAK,EAAE,gBAAgB,CAAC,YAAY,CAAC,GAAG,CAAC,OAAO,CAAC,EAAE,OAAO,CAAC;
|
|
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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G,CAAC,KAAK,CAAC,CAAC;aACnC,CAAC,CAAC;QACL,CAAC;QACD,KAAK,MAAM,CAAC,CAAC,CAAC;YACZ,MAAM,OAAO,GAAG,IAAI,CAAC,YAAY,CAAC,GAAG,CAAC,SAAS,CAAC,CAAC,CAAC;YAClD,MAAM,OAAO,GAAG,IAAI,CAAC,YAAY,CAAC,GAAG,CAAC,SAAS,CAAC,CAAC,CAAC;YAClD,IAAI,CAAC,OAAO,IAAI,CAAC,OAAO;gBAAE,MAAM,IAAI,YAAY,CAAC,oBAAoB,EAAE,mCAAmC,CAAC,CAAC;YAC5G,OAAO,MAAM,OAAO,CAAC,OAAO,CAAC,IAAI,CAAC,YAAY,EAAE;gBAC9C,OAAO;gBACP,OAAO;gBACP,IAAI,EAAE,IAAI,CAAC,YAAY,CAAC,GAAG,CAAC,MAAM,CAAC,CAAC;aACrC,CAAC,CAAC;QACL,CAAC;QACD;YACE,MAAM,IAAI,YAAY,CAAC,oBAAoB,EAAE,6BAA6B,CAAC,CAAC;IAChF,CAAC;AACH,CAAC;AAED,OAAO,EAAE,eAAe,EAAE,CAAC"}
|
|
@@ -1,15 +1,28 @@
|
|
|
1
1
|
declare function parseGitApiRoute(pathnameInput: 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,SAAS,kBAAkB,CAAC,KAAa;IACvC,IAAI,CAAC;QACH,OAAO,kBAAkB,CAAC,KAAK,CAAC,CAAC;IACnC,CAAC;IAAC,MAAM,CAAC;QACP,OAAO,IAAI,CAAC;IACd,CAAC;AACH,CAAC;AAED,SAAS,gBAAgB,CAAC,aAAsB,EAAE,aAAsB;IACtE,MAAM,QAAQ,GAAG,IAAI,CAAC,aAAa,EAAE,GAAG,CAAC,CAAC;IAC1C,MAAM,QAAQ,GAAG,iBAAiB,CAAC,aAAa,CAAC,CAAC;IAClD,IAAI,QAAQ,IAAI,CAAC,QAAQ,CAAC,UAAU,CAAC,GAAG,QAAQ,GAAG,CAAC,IAAI,QAAQ,KAAK,QAAQ;QAAE,OAAO,IAAI,CAAC;IAE3F,MAAM,SAA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ranchMethods(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
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"branch_methods.d.ts","sourceRoot":"","sources":["../../../src/core/create_git_host/branch_methods.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"branch_methods.d.ts","sourceRoot":"","sources":["../../../src/core/create_git_host/branch_methods.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAOV,OAAO,EAER,MAAM,gBAAgB,CAAC;AAIxB,OAAO,KAAK,EAAE,oBAAoB,EAAE,MAAM,aAAa,CAAC;AAGxD,iBAAS,mBAAmB,CAAC,OAAO,EAAE,oBAAoB,GAAG,IAAI,CAC/D,OAAO,EACP,gBAAgB,GAAG,aAAa,GAAG,cAAc,GAAG,WAAW,GAAG,cAAc,GAAG,WAAW,GAAG,cAAc,GAAG,aAAa,GAAG,UAAU,GAAG,SAAS,CACzJ,CA6OA;AAED,OAAO,EAAE,mBAAmB,EAAE,CAAC"}
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import { GitHostError } from "../../errors.js";
|
|
2
|
+
import { buildGitEnv } from "../run_git.js";
|
|
2
3
|
import { isTruthy, text } from "../../utils/text.js";
|
|
3
|
-
import { readRepositoryBranches, readRepositoryCommits } from "../repository.js";
|
|
4
|
+
import { readRepositoryBranches, readRepositoryCommits, readRepositoryTag, readRepositoryTags } from "../repository.js";
|
|
4
5
|
import { repositoryExists, runGit } from "../run_git.js";
|
|
5
6
|
import { toGitHostError } from "./shared.js";
|
|
6
7
|
function createBranchMethods(context) {
|
|
@@ -32,12 +33,44 @@ function createBranchMethods(context) {
|
|
|
32
33
|
});
|
|
33
34
|
}
|
|
34
35
|
try {
|
|
35
|
-
return await readRepositoryCommits(repository.path, listOptions
|
|
36
|
+
return await readRepositoryCommits(repository.path, listOptions);
|
|
36
37
|
}
|
|
37
38
|
catch (error) {
|
|
38
39
|
throw toGitHostError(error, "git_command_failed", "Failed to list repository commits.");
|
|
39
40
|
}
|
|
40
41
|
},
|
|
42
|
+
async listTags(repositoryId) {
|
|
43
|
+
const repository = await resolveRepository(repositoryId);
|
|
44
|
+
const hasRepository = await repositoryExists(repository.path);
|
|
45
|
+
if (!hasRepository) {
|
|
46
|
+
throw new GitHostError("repository_not_initialized", `Repository "${repository.id}" is not initialized.`, {
|
|
47
|
+
path: repository.path,
|
|
48
|
+
repositoryId: repository.id,
|
|
49
|
+
});
|
|
50
|
+
}
|
|
51
|
+
try {
|
|
52
|
+
return await readRepositoryTags(repository.path);
|
|
53
|
+
}
|
|
54
|
+
catch (error) {
|
|
55
|
+
throw toGitHostError(error, "git_command_failed", "Failed to list repository tags.");
|
|
56
|
+
}
|
|
57
|
+
},
|
|
58
|
+
async readTag(repositoryId, tagName) {
|
|
59
|
+
const repository = await resolveRepository(repositoryId);
|
|
60
|
+
const hasRepository = await repositoryExists(repository.path);
|
|
61
|
+
if (!hasRepository) {
|
|
62
|
+
throw new GitHostError("repository_not_initialized", `Repository "${repository.id}" is not initialized.`, {
|
|
63
|
+
path: repository.path,
|
|
64
|
+
repositoryId: repository.id,
|
|
65
|
+
});
|
|
66
|
+
}
|
|
67
|
+
try {
|
|
68
|
+
return await readRepositoryTag(repository.path, tagName);
|
|
69
|
+
}
|
|
70
|
+
catch (error) {
|
|
71
|
+
throw toGitHostError(error, "git_command_failed", "Failed to read repository tag.");
|
|
72
|
+
}
|
|
73
|
+
},
|
|
41
74
|
async createBranch(repositoryId, input) {
|
|
42
75
|
return await lockManager.withLock(text(repositoryId), async () => {
|
|
43
76
|
const repository = await ensureRepositoryInner(repositoryId);
|
|
@@ -131,6 +164,59 @@ function createBranchMethods(context) {
|
|
|
131
164
|
return await readSummaryForRepository(repository);
|
|
132
165
|
});
|
|
133
166
|
},
|
|
167
|
+
async createTag(repositoryId, input = {}) {
|
|
168
|
+
return await lockManager.withLock(text(repositoryId), async () => {
|
|
169
|
+
const repository = await ensureRepositoryInner(repositoryId);
|
|
170
|
+
const tagName = text(input && input.name);
|
|
171
|
+
if (!tagName)
|
|
172
|
+
throw new GitHostError("invalid_branch_name", "Tag name is required.");
|
|
173
|
+
const formatRes = await runGit(["check-ref-format", `refs/tags/${tagName}`], { cwd: repository.path });
|
|
174
|
+
if (!formatRes.ok) {
|
|
175
|
+
throw new GitHostError("invalid_branch_name", text(formatRes.stderr, "Invalid tag name."), {
|
|
176
|
+
repositoryId: repository.id,
|
|
177
|
+
tag: tagName,
|
|
178
|
+
});
|
|
179
|
+
}
|
|
180
|
+
const ref = text(input && input.ref, "HEAD");
|
|
181
|
+
const verifyRes = await runGit(["rev-parse", "--verify", `${ref}^{object}`], { cwd: repository.path });
|
|
182
|
+
if (!verifyRes.ok) {
|
|
183
|
+
throw new GitHostError("git_command_failed", text(verifyRes.stderr, "That tag target does not exist."), {
|
|
184
|
+
ref,
|
|
185
|
+
repositoryId: repository.id,
|
|
186
|
+
tag: tagName,
|
|
187
|
+
});
|
|
188
|
+
}
|
|
189
|
+
const message = text(input && input.message);
|
|
190
|
+
const args = message ? ["tag", "-a", tagName, "-m", message, ref] : ["tag", tagName, ref];
|
|
191
|
+
const createRes = await runGit(args, {
|
|
192
|
+
cwd: repository.path,
|
|
193
|
+
env: buildGitEnv({ actor: input && input.actor ? input.actor : null }),
|
|
194
|
+
});
|
|
195
|
+
if (!createRes.ok) {
|
|
196
|
+
throw new GitHostError("git_command_failed", text(createRes.stderr, "Failed to create repository tag."), {
|
|
197
|
+
ref,
|
|
198
|
+
repositoryId: repository.id,
|
|
199
|
+
tag: tagName,
|
|
200
|
+
});
|
|
201
|
+
}
|
|
202
|
+
return await readRepositoryTag(repository.path, tagName);
|
|
203
|
+
});
|
|
204
|
+
},
|
|
205
|
+
async deleteTag(repositoryId, input = {}) {
|
|
206
|
+
return await lockManager.withLock(text(repositoryId), async () => {
|
|
207
|
+
const repository = await ensureRepositoryInner(repositoryId);
|
|
208
|
+
const tagName = text(input && input.name);
|
|
209
|
+
if (!tagName)
|
|
210
|
+
throw new GitHostError("invalid_branch_name", "Tag name is required.");
|
|
211
|
+
const deleteRes = await runGit(["tag", "-d", tagName], { cwd: repository.path });
|
|
212
|
+
if (!deleteRes.ok) {
|
|
213
|
+
throw new GitHostError("git_command_failed", text(deleteRes.stderr, "Failed to delete repository tag."), {
|
|
214
|
+
repositoryId: repository.id,
|
|
215
|
+
tag: tagName,
|
|
216
|
+
});
|
|
217
|
+
}
|
|
218
|
+
});
|
|
219
|
+
},
|
|
134
220
|
};
|
|
135
221
|
}
|
|
136
222
|
export { createBranchMethods };
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"branch_methods.js","sourceRoot":"","sources":["../../../src/core/create_git_host/branch_methods.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAAE,MAAM,iBAAiB,CAAC;
|
|
1
|
+
{"version":3,"file":"branch_methods.js","sourceRoot":"","sources":["../../../src/core/create_git_host/branch_methods.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAAE,MAAM,iBAAiB,CAAC;AAC/C,OAAO,EAAE,WAAW,EAAE,MAAM,eAAe,CAAC;AAW5C,OAAO,EAAE,QAAQ,EAAE,IAAI,EAAE,MAAM,qBAAqB,CAAC;AACrD,OAAO,EAAE,sBAAsB,EAAE,qBAAqB,EAAE,iBAAiB,EAAE,kBAAkB,EAAE,MAAM,kBAAkB,CAAC;AACxH,OAAO,EAAE,gBAAgB,EAAE,MAAM,EAAE,MAAM,eAAe,CAAC;AAEzD,OAAO,EAAE,cAAc,EAAE,MAAM,aAAa,CAAC;AAE7C,SAAS,mBA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CAAC,UAAU,CAAC,IAAI,EAAE,OAAO,CAAC,CAAC;YAC3D,CAAC,CAAC,CAAC;QACL,CAAC;QAED,KAAK,CAAC,SAAS,CAAC,YAAoB,EAAE,QAAwB,EAAE;YAC9D,OAAO,MAAM,WAAW,CAAC,QAAQ,CAAC,IAAI,CAAC,YAAY,CAAC,EAAE,KAAK,IAAI,EAAE;gBAC/D,MAAM,UAAU,GAAG,MAAM,qBAAqB,CAAC,YAAY,CAAC,CAAC;gBAC7D,MAAM,OAAO,GAAG,IAAI,CAAC,KAAK,IAAI,KAAK,CAAC,IAAI,CAAC,CAAC;gBAC1C,IAAI,CAAC,OAAO;oBAAE,MAAM,IAAI,YAAY,CAAC,qBAAqB,EAAE,uBAAuB,CAAC,CAAC;gBAErF,MAAM,SAAS,GAAG,MAAM,MAAM,CAAC,CAAC,KAAK,EAAE,IAAI,EAAE,OAAO,CAAC,EAAE,EAAE,GAAG,EAAE,UAAU,CAAC,IAAI,EAAE,CAAC,CAAC;gBACjF,IAAI,CAAC,SAAS,CAAC,EAAE,EAAE,CAAC;oBAClB,MAAM,IAAI,YAAY,CAAC,oBAAoB,EAAE,IAAI,CAAC,SAAS,CAAC,MAAM,EAAE,kCAAkC,CAAC,EAAE;wBACvG,YAAY,EAAE,UAAU,CAAC,EAAE;wBAC3B,GAAG,EAAE,OAAO;qBACb,CAAC,CAAC;gBACL,CAAC;YACH,CAAC,CAAC,CAAC;QACL,CAAC;KACF,CAAC;AACJ,CAAC;AAED,OAAO,EAAE,mBAAmB,EAAE,CAAC"}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import type { GitHost } from "../../types.js";
|
|
2
2
|
import type { GitHostMethodContext } from "./shared.js";
|
|
3
|
-
declare function createContentMethods(context: GitHostMethodContext): Pick<GitHost, "diff" | "listTree" | "readBlob" | "readCommit">;
|
|
3
|
+
declare function createContentMethods(context: GitHostMethodContext): Pick<GitHost, "diff" | "listTree" | "readArchive" | "readBlame" | "readBlob" | "readCommit" | "readLinguist" | "search">;
|
|
4
4
|
export { createContentMethods };
|
|
5
5
|
//# sourceMappingURL=content_methods.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"content_methods.d.ts","sourceRoot":"","sources":["../../../src/core/create_git_host/content_methods.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,
|
|
1
|
+
{"version":3,"file":"content_methods.d.ts","sourceRoot":"","sources":["../../../src/core/create_git_host/content_methods.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAEV,OAAO,EAOR,MAAM,gBAAgB,CAAC;AAWxB,OAAO,KAAK,EAAE,oBAAoB,EAAE,MAAM,aAAa,CAAC;AAExD,iBAAS,oBAAoB,CAAC,OAAO,EAAE,oBAAoB,GAAG,IAAI,CAChE,OAAO,EACP,MAAM,GAAG,UAAU,GAAG,aAAa,GAAG,WAAW,GAAG,UAAU,GAAG,YAAY,GAAG,cAAc,GAAG,QAAQ,CAC1G,CA4CA;AAED,OAAO,EAAE,oBAAoB,EAAE,CAAC"}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { listRepositoryTree, readRepositoryBlob, readRepositoryCommit, readRepositoryCompare } from "../inspect.js";
|
|
1
|
+
import { listRepositoryTree, readRepositoryArchive, readRepositoryBlame, readRepositoryBlob, readRepositoryCommit, readRepositoryCompare, readRepositoryLinguist, searchRepository, } from "../inspect.js";
|
|
2
2
|
function createContentMethods(context) {
|
|
3
3
|
const { resolveRepository } = context;
|
|
4
4
|
return {
|
|
@@ -14,10 +14,26 @@ function createContentMethods(context) {
|
|
|
14
14
|
const repository = await resolveRepository(repositoryId);
|
|
15
15
|
return await readRepositoryCommit(repository, commitRef);
|
|
16
16
|
},
|
|
17
|
+
async readBlame(repositoryId, blameOptions) {
|
|
18
|
+
const repository = await resolveRepository(repositoryId);
|
|
19
|
+
return await readRepositoryBlame(repository, blameOptions);
|
|
20
|
+
},
|
|
21
|
+
async readArchive(repositoryId, archiveOptions = {}) {
|
|
22
|
+
const repository = await resolveRepository(repositoryId);
|
|
23
|
+
return await readRepositoryArchive(repository, archiveOptions);
|
|
24
|
+
},
|
|
25
|
+
async readLinguist(repositoryId, linguistOptions = {}) {
|
|
26
|
+
const repository = await resolveRepository(repositoryId);
|
|
27
|
+
return await readRepositoryLinguist(repository, linguistOptions);
|
|
28
|
+
},
|
|
17
29
|
async diff(repositoryId, diffOptions) {
|
|
18
30
|
const repository = await resolveRepository(repositoryId);
|
|
19
31
|
return await readRepositoryCompare(repository, diffOptions);
|
|
20
32
|
},
|
|
33
|
+
async search(repositoryId, searchOptions) {
|
|
34
|
+
const repository = await resolveRepository(repositoryId);
|
|
35
|
+
return await searchRepository(repository, searchOptions);
|
|
36
|
+
},
|
|
21
37
|
};
|
|
22
38
|
}
|
|
23
39
|
export { createContentMethods };
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"content_methods.js","sourceRoot":"","sources":["../../../src/core/create_git_host/content_methods.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"content_methods.js","sourceRoot":"","sources":["../../../src/core/create_git_host/content_methods.ts"],"names":[],"mappings":"AAUA,OAAO,EACL,kBAAkB,EAClB,qBAAqB,EACrB,mBAAmB,EACnB,kBAAkB,EAClB,oBAAoB,EACpB,qBAAqB,EACrB,sBAAsB,EACtB,gBAAgB,GACjB,MAAM,eAAe,CAAC;AAGvB,SAAS,oBAAoB,CAAC,OAA6B;IAIzD,MAAM,EAAE,iBAAiB,EAAE,GAAG,OAAO,CAAC;IAEtC,OAAO;QACL,KAAK,CAAC,QAAQ,CAAC,YAAoB,EAAE,cAA+B,EAAE;YACpE,MAAM,UAAU,GAAG,MAAM,iBAAiB,CAAC,YAAY,CAAC,CAAC;YACzD,OAAO,MAAM,kBAAkB,CAAC,UAAU,EAAE,WAAW,CAAC,CAAC;QAC3D,CAAC;QAED,KAAK,CAAC,QAAQ,CAAC,YAAoB,EAAE,WAA4B;YAC/D,MAAM,UAAU,GAAG,MAAM,iBAAi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3D,CAAC;KACF,CAAC;AACJ,CAAC;AAED,OAAO,EAAE,oBAAoB,EAAE,CAAC"}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import type { GitHost } from "../../types.js";
|
|
2
2
|
import type { GitHostMethodContext } from "./shared.js";
|
|
3
|
-
declare function createWorkingTreeMethods(context: GitHostMethodContext): Pick<GitHost, "abortOperation" | "commit" | "continueOperation" | "discardPaths" | "readStagedFile" | "readUnstagedFile" | "readWorkingTree" | "stagePaths" | "unstagePaths">;
|
|
3
|
+
declare function createWorkingTreeMethods(context: GitHostMethodContext): Pick<GitHost, "abortOperation" | "cherryPick" | "commit" | "continueOperation" | "discardPaths" | "merge" | "readStagedFile" | "readUnstagedFile" | "readWorkingTree" | "rebase" | "stagePaths" | "unstagePaths">;
|
|
4
4
|
export { createWorkingTreeMethods };
|
|
5
5
|
//# sourceMappingURL=working_tree_methods.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"working_tree_methods.d.ts","sourceRoot":"","sources":["../../../src/core/create_git_host/working_tree_methods.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,
|
|
1
|
+
{"version":3,"file":"working_tree_methods.d.ts","sourceRoot":"","sources":["../../../src/core/create_git_host/working_tree_methods.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAKV,OAAO,EAMR,MAAM,gBAAgB,CAAC;AAgBxB,OAAO,KAAK,EAAE,oBAAoB,EAAE,MAAM,aAAa,CAAC;AAExD,iBAAS,wBAAwB,CAAC,OAAO,EAAE,oBAAoB,GAAG,IAAI,CACpE,OAAO,EACL,gBAAgB,GAChB,YAAY,GACZ,QAAQ,GACR,mBAAmB,GACnB,cAAc,GACd,OAAO,GACP,gBAAgB,GAChB,kBAAkB,GAClB,iBAAiB,GACjB,QAAQ,GACR,YAAY,GACZ,cAAc,CACjB,CA2FA;AAED,OAAO,EAAE,wBAAwB,EAAE,CAAC"}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { text } from "../../utils/text.js";
|
|
2
|
-
import { abortRepositoryOperation, commitRepository, continueRepositoryOperation, discardRepositoryPaths, readRepositoryStagedFile, readRepositoryUnstagedFile, readRepositoryWorkingTree, stageRepositoryPaths, unstageRepositoryPaths, } from "../working_tree.js";
|
|
2
|
+
import { abortRepositoryOperation, cherryPickRepository, commitRepository, continueRepositoryOperation, discardRepositoryPaths, mergeRepository, readRepositoryStagedFile, readRepositoryUnstagedFile, readRepositoryWorkingTree, rebaseRepository, stageRepositoryPaths, unstageRepositoryPaths, } from "../working_tree.js";
|
|
3
3
|
function createWorkingTreeMethods(context) {
|
|
4
4
|
const { ensureRepositoryInner, lockManager, readSummaryForRepository, resolveRepository } = context;
|
|
5
5
|
return {
|
|
@@ -43,6 +43,27 @@ function createWorkingTreeMethods(context) {
|
|
|
43
43
|
return await readSummaryForRepository(repository);
|
|
44
44
|
});
|
|
45
45
|
},
|
|
46
|
+
async merge(repositoryId, input = {}) {
|
|
47
|
+
return await lockManager.withLock(text(repositoryId), async () => {
|
|
48
|
+
const repository = await ensureRepositoryInner(repositoryId);
|
|
49
|
+
await mergeRepository(repository, input);
|
|
50
|
+
return await readSummaryForRepository(repository);
|
|
51
|
+
});
|
|
52
|
+
},
|
|
53
|
+
async rebase(repositoryId, input = {}) {
|
|
54
|
+
return await lockManager.withLock(text(repositoryId), async () => {
|
|
55
|
+
const repository = await ensureRepositoryInner(repositoryId);
|
|
56
|
+
await rebaseRepository(repository, input);
|
|
57
|
+
return await readSummaryForRepository(repository);
|
|
58
|
+
});
|
|
59
|
+
},
|
|
60
|
+
async cherryPick(repositoryId, input = {}) {
|
|
61
|
+
return await lockManager.withLock(text(repositoryId), async () => {
|
|
62
|
+
const repository = await ensureRepositoryInner(repositoryId);
|
|
63
|
+
await cherryPickRepository(repository, input);
|
|
64
|
+
return await readSummaryForRepository(repository);
|
|
65
|
+
});
|
|
66
|
+
},
|
|
46
67
|
async continueOperation(repositoryId, input = {}) {
|
|
47
68
|
return await lockManager.withLock(text(repositoryId), async () => {
|
|
48
69
|
const repository = await ensureRepositoryInner(repositoryId);
|