@trebired/git-host 1.3.0 → 1.6.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 +23 -0
- package/README.md +359 -27
- package/dist/api/forge/handler.d.ts +6 -0
- package/dist/api/forge/handler.d.ts.map +1 -0
- package/dist/api/forge/handler.js +260 -0
- package/dist/api/forge/handler.js.map +1 -0
- package/dist/api/forge/route.d.ts +34 -0
- package/dist/api/forge/route.d.ts.map +1 -0
- package/dist/api/forge/route.js +94 -0
- package/dist/api/forge/route.js.map +1 -0
- package/dist/api/handler/response.d.ts +6 -2
- package/dist/api/handler/response.d.ts.map +1 -1
- package/dist/api/handler/response.js +5 -0
- package/dist/api/handler/response.js.map +1 -1
- package/dist/browser/index.d.ts +65 -0
- package/dist/browser/index.d.ts.map +1 -0
- package/dist/browser/index.js +778 -0
- package/dist/browser/index.js.map +1 -0
- package/dist/browser/styles.css +317 -0
- package/dist/core/create_git_forge.d.ts +4 -0
- package/dist/core/create_git_forge.d.ts.map +1 -0
- package/dist/core/create_git_forge.js +481 -0
- package/dist/core/create_git_forge.js.map +1 -0
- package/dist/core/git_forge/storage_memory.d.ts +4 -0
- package/dist/core/git_forge/storage_memory.d.ts.map +1 -0
- package/dist/core/git_forge/storage_memory.js +140 -0
- package/dist/core/git_forge/storage_memory.js.map +1 -0
- package/dist/index.d.ts +4 -1
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +3 -0
- package/dist/index.js.map +1 -1
- package/dist/react/client/types.d.ts +45 -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 +135 -2
- package/dist/react/client.js.map +1 -1
- package/dist/react/components.d.ts +44407 -0
- package/dist/react/components.d.ts.map +1 -0
- package/dist/react/components.js +733 -0
- package/dist/react/components.js.map +1 -0
- package/dist/react/hooks/query.d.ts +6 -2
- package/dist/react/hooks/query.d.ts.map +1 -1
- package/dist/react/hooks/query.js +71 -6
- package/dist/react/hooks/query.js.map +1 -1
- package/dist/react/hooks/resources.d.ts +50 -3
- package/dist/react/hooks/resources.d.ts.map +1 -1
- package/dist/react/hooks/resources.js +209 -2
- package/dist/react/hooks/resources.js.map +1 -1
- package/dist/react/hooks/types.d.ts +15 -2
- package/dist/react/hooks/types.d.ts.map +1 -1
- package/dist/react/hooks.d.ts +3 -3
- package/dist/react/hooks.d.ts.map +1 -1
- package/dist/react/hooks.js +2 -2
- package/dist/react/hooks.js.map +1 -1
- package/dist/react/index.d.ts +5 -2
- package/dist/react/index.d.ts.map +1 -1
- package/dist/react/index.js +3 -1
- package/dist/react/index.js.map +1 -1
- package/dist/react/ui/context.d.ts +1907 -0
- package/dist/react/ui/context.d.ts.map +1 -0
- package/dist/react/ui/context.js +186 -0
- package/dist/react/ui/context.js.map +1 -0
- package/dist/types/forge.d.ts +220 -0
- package/dist/types/forge.d.ts.map +1 -0
- package/dist/types/forge.js +2 -0
- package/dist/types/forge.js.map +1 -0
- package/dist/types/index.d.ts +1 -0
- package/dist/types/index.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 +11 -4
package/CHANGELOG.md
CHANGED
|
@@ -4,6 +4,29 @@ 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
|
+
## 1.6.0
|
|
8
|
+
|
|
9
|
+
- Made package styling optional instead of required for frontend integration by adding `unstyled` support across the shared repository UI provider and browser pages.
|
|
10
|
+
- Added slot-based frontend skinning through `theme.classNames`, `theme.slots`, stable `data-slot` markers, and exported slot helpers so host apps can keep their own design system while reusing git-host structure.
|
|
11
|
+
- Added render-state component overrides for loading, error, and empty states through `GitRepositoryUiProvider`.
|
|
12
|
+
- Updated the README with explicit package structure plus app styling guidance and examples that do not depend on `@trebired/git-host/browser/styles.css`.
|
|
13
|
+
|
|
14
|
+
## 1.5.0
|
|
15
|
+
|
|
16
|
+
- Expanded the frontend ownership model across `@trebired/git-host/browser` and `@trebired/git-host/react` with a package-owned repository shell, route adapter system, diagnostics hooks, theme/token support, and shared UI provider state.
|
|
17
|
+
- Added reusable React repository components and action primitives such as `GitRepositoryShell`, `GitRepositoryHeader`, `GitRepositoryTabs`, `GitCommitList`, `GitReleaseList`, `GitForkList`, `GitTreeView`, `GitBlobView`, `GitBranchSelector`, `GitTagSelector`, and repository action buttons.
|
|
18
|
+
- Extended the browser entry to ship a broader first-class repository page surface including branches, tags, search, blame, compare, and richer release flows in addition to the existing overview/code/commits/releases/forks/activity pages.
|
|
19
|
+
- Added query dedupe/caching plus frontend diagnostics hooks for fetch, action, render, empty-state, and navigation observation.
|
|
20
|
+
- Updated the README with explicit frontend integration modes and thinner host-app examples.
|
|
21
|
+
|
|
22
|
+
## 1.4.0
|
|
23
|
+
|
|
24
|
+
- Added a new forge layer through `createGitForge()` with host-owned storage adapters for releases, forks, stars, watching, and repository activity timelines.
|
|
25
|
+
- Added `createGitForgeApiHandler()` plus new repository routes for overview, social state, releases, forks, fork sync, and activity while keeping the existing read-only JSON API stable.
|
|
26
|
+
- Extended the typed React client and hooks with forge reads and mutations, including optimistic star and watch helpers.
|
|
27
|
+
- Added `@trebired/git-host/browser` with reusable SSR-safe repository pages and bundled browser styles for overview, code, commits, releases, forks, and activity views.
|
|
28
|
+
- Added an in-memory forge storage adapter for tests, prototypes, and local embedding.
|
|
29
|
+
|
|
7
30
|
## 1.3.0
|
|
8
31
|
|
|
9
32
|
- Added a first-class repository inspection layer with `resolveInspectionTarget()`, `readTree()`, `readDirectory()`, `readFile()`, and `readRepositoryAnalysis()`.
|
package/README.md
CHANGED
|
@@ -1,19 +1,19 @@
|
|
|
1
1
|
# @trebired/git-host
|
|
2
2
|
|
|
3
|
-
Embeddable Git
|
|
3
|
+
Embeddable Git forge for Node.js and Bun apps with real Git CLI execution, smart HTTP and SSH transports, repository inspection APIs, forge features such as releases and forks, and optional React/browser companions.
|
|
4
4
|
|
|
5
|
-
`@trebired/git-host` gives your app real Git repository operations and real Git transports without
|
|
5
|
+
`@trebired/git-host` gives your app real Git repository operations, forge-style repository metadata, and real Git transports without forcing you into a monolithic hosted product. It runs the real Git CLI, helps you resolve repository paths safely, serializes mutations per repository, and exposes reusable APIs for repository initialization, summary reads, content inspection, branch operations, working-tree changes, releases, forks, stars, watching, activity feeds, JSON API handlers, browser-ready pages, and smart HTTP and SSH hosting.
|
|
6
6
|
|
|
7
7
|
It is aimed at platforms and products that already own users, permissions, tokens, repository records, and UI, but want to stop hand-rolling the Git layer underneath all of that.
|
|
8
8
|
|
|
9
|
-
The package keeps auth, permission, and persistence decisions host-owned while giving you reusable Git behavior and
|
|
9
|
+
The package keeps auth, permission, and persistence decisions host-owned while giving you reusable Git behavior, forge adapters, and browser integration.
|
|
10
10
|
|
|
11
|
-
It also exposes an optional React companion at `@trebired/git-host/react` for typed API clients, providers, and headless data hooks
|
|
11
|
+
It also exposes an optional React companion at `@trebired/git-host/react` for typed API clients, providers, and headless data hooks, plus an optional browser UI entry at `@trebired/git-host/browser` for full repository pages.
|
|
12
12
|
|
|
13
13
|
In plain terms:
|
|
14
14
|
|
|
15
|
-
- it is a Git hosting layer you embed into your app
|
|
16
|
-
- it is not a full
|
|
15
|
+
- it is a Git hosting and lightweight forge layer you embed into your app
|
|
16
|
+
- it is not a full hosted SaaS product with built-in accounts, billing, or platform ownership
|
|
17
17
|
- it is not a reimplementation of Git
|
|
18
18
|
- it uses the real `git` binary for the hard parts
|
|
19
19
|
|
|
@@ -35,6 +35,12 @@ Optional React companion:
|
|
|
35
35
|
npm install react
|
|
36
36
|
```
|
|
37
37
|
|
|
38
|
+
Optional browser pages:
|
|
39
|
+
|
|
40
|
+
```sh
|
|
41
|
+
npm install react
|
|
42
|
+
```
|
|
43
|
+
|
|
38
44
|
```ts
|
|
39
45
|
import { createGitHost, resolveRepositoryPath } from "@trebired/git-host";
|
|
40
46
|
import { createLog } from "@trebired/logger";
|
|
@@ -304,38 +310,316 @@ GET /api/git/repositories/demo/blob?ref=HEAD&path=README.md
|
|
|
304
310
|
GET /api/git/repositories/demo/diff?baseRef=main&headRef=feature%2Fx&path=src
|
|
305
311
|
```
|
|
306
312
|
|
|
307
|
-
|
|
313
|
+
## Frontend Integration
|
|
314
|
+
|
|
315
|
+
The package now supports three frontend integration modes.
|
|
316
|
+
|
|
317
|
+
### 1. Full Browser Pages
|
|
318
|
+
|
|
319
|
+
Use `@trebired/git-host/browser` when you want git-host to own the whole repository area:
|
|
320
|
+
|
|
321
|
+
- repository shell
|
|
322
|
+
- tabs and navigation behavior
|
|
323
|
+
- stats, actions, and social controls
|
|
324
|
+
- loading, error, retry, and empty states
|
|
325
|
+
- code browsing, blame, compare, releases, forks, activity, branches, tags, and search pages
|
|
326
|
+
|
|
327
|
+
Host apps mostly provide:
|
|
328
|
+
|
|
329
|
+
- auth
|
|
330
|
+
- API base URL
|
|
331
|
+
- repository key
|
|
332
|
+
- route adapter
|
|
333
|
+
- theme tokens
|
|
334
|
+
- optional policy and diagnostics hooks
|
|
335
|
+
|
|
336
|
+
Default styling is optional.
|
|
337
|
+
|
|
338
|
+
- If you want the package look, import `@trebired/git-host/browser/styles.css`.
|
|
339
|
+
- If you want package-owned structure with your own design system, skip that stylesheet and pass theme slots/classes.
|
|
308
340
|
|
|
309
341
|
```ts
|
|
310
|
-
import {
|
|
342
|
+
import {
|
|
343
|
+
GitRepositoryOverviewPage,
|
|
344
|
+
createGitRepositoryRouteAdapter,
|
|
345
|
+
} from "@trebired/git-host/browser";
|
|
311
346
|
|
|
312
|
-
const
|
|
313
|
-
|
|
347
|
+
const routeAdapter = createGitRepositoryRouteAdapter({
|
|
348
|
+
repositoryBasePath: "/workspaces",
|
|
314
349
|
});
|
|
315
350
|
|
|
316
|
-
function
|
|
317
|
-
|
|
318
|
-
|
|
351
|
+
function RepositoryScreen() {
|
|
352
|
+
return (
|
|
353
|
+
<GitRepositoryOverviewPage
|
|
354
|
+
baseUrl="/api/git"
|
|
355
|
+
repositoryKey="demo"
|
|
356
|
+
routeAdapter={routeAdapter}
|
|
357
|
+
branding={{
|
|
358
|
+
getCloneUrl(repositoryKey) {
|
|
359
|
+
return `https://git.example.com/${repositoryKey}.git`;
|
|
360
|
+
},
|
|
361
|
+
}}
|
|
362
|
+
unstyled
|
|
363
|
+
theme={{
|
|
364
|
+
classNames: {
|
|
365
|
+
page: "repo-page",
|
|
366
|
+
header: "repo-header",
|
|
367
|
+
title: "repo-title",
|
|
368
|
+
tabs: "repo-tabs",
|
|
369
|
+
"tab-link": "repo-tab",
|
|
370
|
+
card: "repo-card",
|
|
371
|
+
button: "repo-button",
|
|
372
|
+
},
|
|
373
|
+
slots: {
|
|
374
|
+
page: {
|
|
375
|
+
attributes: {
|
|
376
|
+
"data-repository-surface": "git-host",
|
|
377
|
+
},
|
|
378
|
+
},
|
|
379
|
+
},
|
|
380
|
+
variables: {
|
|
381
|
+
"--git-browser-accent": "#0a7f5a",
|
|
382
|
+
},
|
|
383
|
+
}}
|
|
384
|
+
/>
|
|
385
|
+
);
|
|
386
|
+
}
|
|
387
|
+
```
|
|
388
|
+
|
|
389
|
+
### 2. Hybrid Shell + Package Sections
|
|
319
390
|
|
|
320
|
-
|
|
321
|
-
if (summary.error) return summary.error.message;
|
|
322
|
-
if (!summary.data) return "Missing repository";
|
|
391
|
+
Use `@trebired/git-host/react` when your app owns the outer chrome but git-host should own the repository section UI patterns:
|
|
323
392
|
|
|
324
|
-
|
|
393
|
+
```ts
|
|
394
|
+
import {
|
|
395
|
+
GitApiClientProvider,
|
|
396
|
+
GitCommitList,
|
|
397
|
+
GitRepositoryShell,
|
|
398
|
+
GitRepositoryUiProvider,
|
|
399
|
+
createGitApiClient,
|
|
400
|
+
createGitRepositoryRouteAdapter,
|
|
401
|
+
useGitCommits,
|
|
402
|
+
useGitOverview,
|
|
403
|
+
} from "@trebired/git-host/react";
|
|
404
|
+
|
|
405
|
+
const client = createGitApiClient({ baseUrl: "/api/git" });
|
|
406
|
+
const routes = createGitRepositoryRouteAdapter({
|
|
407
|
+
repositoryBasePath: "/app/repos",
|
|
408
|
+
});
|
|
409
|
+
|
|
410
|
+
function RepositoryCommitsSection({ repositoryKey }: { repositoryKey: string }) {
|
|
411
|
+
const overview = useGitOverview(repositoryKey);
|
|
412
|
+
const commits = useGitCommits(repositoryKey, {
|
|
413
|
+
ref: overview.data?.repository.repository.current_branch,
|
|
414
|
+
});
|
|
415
|
+
|
|
416
|
+
return (
|
|
417
|
+
<GitRepositoryShell
|
|
418
|
+
page="commits"
|
|
419
|
+
repositoryKey={repositoryKey}
|
|
420
|
+
loading={overview.loading || commits.loading}
|
|
421
|
+
error={overview.error || commits.error}
|
|
422
|
+
social={overview.data?.social}
|
|
423
|
+
stats={[
|
|
424
|
+
{ label: "Branch", value: overview.data?.repository.repository.current_branch || "-" },
|
|
425
|
+
{ label: "Forks", value: String(overview.data?.fork_count || 0) },
|
|
426
|
+
]}
|
|
427
|
+
>
|
|
428
|
+
<GitCommitList commits={commits.data || []} repositoryKey={repositoryKey} />
|
|
429
|
+
</GitRepositoryShell>
|
|
430
|
+
);
|
|
325
431
|
}
|
|
326
432
|
|
|
327
433
|
function App() {
|
|
328
434
|
return (
|
|
329
|
-
<GitApiClientProvider client={
|
|
330
|
-
<
|
|
435
|
+
<GitApiClientProvider client={client}>
|
|
436
|
+
<GitRepositoryUiProvider
|
|
437
|
+
routeAdapter={routes}
|
|
438
|
+
theme={{
|
|
439
|
+
unstyled: true,
|
|
440
|
+
classNames: {
|
|
441
|
+
page: "repo-surface",
|
|
442
|
+
header: "repo-shell-header",
|
|
443
|
+
card: "repo-panel",
|
|
444
|
+
button: "repo-action",
|
|
445
|
+
},
|
|
446
|
+
}}
|
|
447
|
+
>
|
|
448
|
+
<RepositoryCommitsSection repositoryKey="demo" />
|
|
449
|
+
</GitRepositoryUiProvider>
|
|
331
450
|
</GitApiClientProvider>
|
|
332
451
|
);
|
|
333
452
|
}
|
|
334
453
|
```
|
|
335
454
|
|
|
336
|
-
|
|
455
|
+
### 3. Fully Custom Layout
|
|
456
|
+
|
|
457
|
+
Use the typed client, hooks, diagnostics, route adapter, and low-level models when you want full control over the page structure:
|
|
458
|
+
|
|
459
|
+
```ts
|
|
460
|
+
import {
|
|
461
|
+
GitApiClientProvider,
|
|
462
|
+
createGitApiClient,
|
|
463
|
+
useGitOverview,
|
|
464
|
+
useGitSearch,
|
|
465
|
+
} from "@trebired/git-host/react";
|
|
466
|
+
|
|
467
|
+
const client = createGitApiClient({ baseUrl: "/api/git" });
|
|
468
|
+
|
|
469
|
+
function CustomRepositorySearch({ repositoryKey }: { repositoryKey: string }) {
|
|
470
|
+
const overview = useGitOverview(repositoryKey);
|
|
471
|
+
const search = useGitSearch(repositoryKey, {
|
|
472
|
+
query: "value",
|
|
473
|
+
ref: overview.data?.repository.repository.current_branch,
|
|
474
|
+
});
|
|
475
|
+
|
|
476
|
+
if (search.loading) return "Searching...";
|
|
477
|
+
if (search.error) return search.error.message;
|
|
478
|
+
return JSON.stringify(search.data?.files || []);
|
|
479
|
+
}
|
|
480
|
+
```
|
|
481
|
+
|
|
482
|
+
## Frontend Surface
|
|
483
|
+
|
|
484
|
+
`@trebired/git-host/browser` ships package-owned repository pages for:
|
|
485
|
+
|
|
486
|
+
- overview
|
|
487
|
+
- code/tree/blob
|
|
488
|
+
- commits
|
|
489
|
+
- commit detail
|
|
490
|
+
- releases
|
|
491
|
+
- release detail
|
|
492
|
+
- forks
|
|
493
|
+
- activity
|
|
494
|
+
- blame
|
|
495
|
+
- diff/compare
|
|
496
|
+
- branches
|
|
497
|
+
- tags
|
|
498
|
+
- search
|
|
499
|
+
|
|
500
|
+
`@trebired/git-host/react` now ships reusable repository primitives such as:
|
|
501
|
+
|
|
502
|
+
- `GitRepositoryUiProvider`
|
|
503
|
+
- `GitRepositoryShell`
|
|
504
|
+
- `GitRepositoryHeader`
|
|
505
|
+
- `GitRepositoryTabs`
|
|
506
|
+
- `GitRepositoryStats`
|
|
507
|
+
- `GitRepositoryActionBar`
|
|
508
|
+
- `GitRepositorySocialButtons`
|
|
509
|
+
- `GitCommitList`
|
|
510
|
+
- `GitReleaseList`
|
|
511
|
+
- `GitForkList`
|
|
512
|
+
- `GitBranchList`
|
|
513
|
+
- `GitTagList`
|
|
514
|
+
- `GitTreeView`
|
|
515
|
+
- `GitBlobView`
|
|
516
|
+
- `GitBlameView`
|
|
517
|
+
- `GitDiffView`
|
|
518
|
+
- `GitSearchResults`
|
|
519
|
+
- `GitBranchSelector`
|
|
520
|
+
- `GitTagSelector`
|
|
521
|
+
- `GitEmptyState`
|
|
522
|
+
- `GitErrorState`
|
|
523
|
+
- `GitLoadingState`
|
|
524
|
+
|
|
525
|
+
### Styling And Skinning
|
|
526
|
+
|
|
527
|
+
The package is designed around three frontend ownership levels:
|
|
528
|
+
|
|
529
|
+
- full package UI: import `@trebired/git-host/browser/styles.css` and use the browser pages directly
|
|
530
|
+
- package structure + app styling: skip the stylesheet and pass `theme.unstyled`, `theme.classNames`, and `theme.slots`
|
|
531
|
+
- package logic + app rendering: use the typed hooks, mutations, diagnostics, and route adapter with fully custom host rendering
|
|
532
|
+
|
|
533
|
+
The package now treats styling as optional rather than required:
|
|
534
|
+
|
|
535
|
+
- no browser page requires `@trebired/git-host/browser/styles.css` to function
|
|
536
|
+
- structural components expose stable `data-slot` markers for host CSS targeting
|
|
537
|
+
- `GitRepositoryUiProvider` accepts `theme.classNames` and `theme.slots` for slot-level class and attribute overrides
|
|
538
|
+
- `GitBrowserProvider` and browser pages accept `unstyled` as a shortcut for `theme.unstyled: true`
|
|
539
|
+
- render-state components can be replaced through `components.LoadingState`, `components.ErrorState`, and `components.EmptyState`
|
|
540
|
+
|
|
541
|
+
```ts
|
|
542
|
+
import {
|
|
543
|
+
GitRepositoryUiProvider,
|
|
544
|
+
GitRepositoryShell,
|
|
545
|
+
GitCommitList,
|
|
546
|
+
} from "@trebired/git-host/react";
|
|
547
|
+
|
|
548
|
+
<GitRepositoryUiProvider
|
|
549
|
+
theme={{
|
|
550
|
+
unstyled: true,
|
|
551
|
+
classNames: {
|
|
552
|
+
page: "nativeRepoPage",
|
|
553
|
+
header: "nativeRepoHeader",
|
|
554
|
+
card: "nativeCard",
|
|
555
|
+
list: "nativeList",
|
|
556
|
+
"list-item": "nativeListItem",
|
|
557
|
+
button: "nativeButton",
|
|
558
|
+
},
|
|
559
|
+
slots: {
|
|
560
|
+
page: {
|
|
561
|
+
attributes: {
|
|
562
|
+
"data-app-surface": "repository",
|
|
563
|
+
},
|
|
564
|
+
},
|
|
565
|
+
},
|
|
566
|
+
}}
|
|
567
|
+
components={{
|
|
568
|
+
EmptyState({ title, message }) {
|
|
569
|
+
return <section className="nativeEmpty">{title}: {message}</section>;
|
|
570
|
+
},
|
|
571
|
+
}}
|
|
572
|
+
>
|
|
573
|
+
<GitRepositoryShell page="commits" repositoryKey="demo">
|
|
574
|
+
<GitCommitList commits={commits} repositoryKey="demo" />
|
|
575
|
+
</GitRepositoryShell>
|
|
576
|
+
</GitRepositoryUiProvider>;
|
|
577
|
+
```
|
|
578
|
+
|
|
579
|
+
### Route Adapter
|
|
580
|
+
|
|
581
|
+
Both `browser` and `react` use a package-owned route adapter:
|
|
337
582
|
|
|
338
583
|
```ts
|
|
584
|
+
import { createGitRepositoryRouteAdapter } from "@trebired/git-host/react";
|
|
585
|
+
|
|
586
|
+
const routes = createGitRepositoryRouteAdapter({
|
|
587
|
+
repositoryBasePath: "/repos",
|
|
588
|
+
});
|
|
589
|
+
|
|
590
|
+
routes.overview("demo");
|
|
591
|
+
routes.code("demo", "src/app.ts", "main");
|
|
592
|
+
routes.commit("demo", "abc123");
|
|
593
|
+
routes.release("demo", "release-1");
|
|
594
|
+
routes.compare("demo", "main", "feature/x");
|
|
595
|
+
```
|
|
596
|
+
|
|
597
|
+
### Diagnostics Hooks
|
|
598
|
+
|
|
599
|
+
Repository UIs are brittle, so the package also exposes lifecycle diagnostics through `GitRepositoryUiProvider`:
|
|
600
|
+
|
|
601
|
+
- `onNavigate`
|
|
602
|
+
- `onViewMount`
|
|
603
|
+
- `onFetchStart`
|
|
604
|
+
- `onFetchSuccess`
|
|
605
|
+
- `onFetchError`
|
|
606
|
+
- `onActionStart`
|
|
607
|
+
- `onActionSuccess`
|
|
608
|
+
- `onActionError`
|
|
609
|
+
- `onEmptyState`
|
|
610
|
+
- `onRenderStateChange`
|
|
611
|
+
|
|
612
|
+
### Initial Data
|
|
613
|
+
|
|
614
|
+
Browser pages and hybrid sections can take a stable `initialData` shape through `GitRepositoryFrontEndInitialData`, so host apps do not need to invent per-page bootstrap payloads.
|
|
615
|
+
|
|
616
|
+
For long-running repository scans, the typed client still exposes a live Socket.IO linguist stream:
|
|
617
|
+
|
|
618
|
+
```ts
|
|
619
|
+
const gitClient = createGitApiClient({
|
|
620
|
+
baseUrl: "/api/git",
|
|
621
|
+
});
|
|
622
|
+
|
|
339
623
|
const socket = gitClient.openLinguistSocket("demo", {
|
|
340
624
|
ref: "main",
|
|
341
625
|
onProgress(event) {
|
|
@@ -349,18 +633,18 @@ const socket = gitClient.openLinguistSocket("demo", {
|
|
|
349
633
|
await socket.completed;
|
|
350
634
|
```
|
|
351
635
|
|
|
352
|
-
The React entry is intentionally headless. It helps apps fetch and mutate Git data consistently, but it does not ship a bundled styled UI.
|
|
353
|
-
|
|
354
636
|
## Current API
|
|
355
637
|
|
|
356
|
-
The
|
|
638
|
+
The package now exposes three main frontend/backend layers:
|
|
357
639
|
|
|
358
640
|
- `createGitHost()`
|
|
641
|
+
- `createGitForge()`
|
|
359
642
|
- `resolveRepositoryPath()`
|
|
360
643
|
- `runGit()`
|
|
361
644
|
- `buildGitEnv()`
|
|
362
645
|
- `RepositoryLockManager`
|
|
363
646
|
- `createGitApiHandler()`
|
|
647
|
+
- `createGitForgeApiHandler()`
|
|
364
648
|
- `createGitApiSocketServer()`
|
|
365
649
|
- `createGitHttpHandler()`
|
|
366
650
|
- `generateSshKeyPair()`
|
|
@@ -369,6 +653,7 @@ The first public slice is intentionally small:
|
|
|
369
653
|
- `fingerprintSshPublicKey()`
|
|
370
654
|
- `createGitSshServer()`
|
|
371
655
|
- `@trebired/git-host/react`
|
|
656
|
+
- `@trebired/git-host/browser`
|
|
372
657
|
|
|
373
658
|
And the main host instance methods:
|
|
374
659
|
|
|
@@ -409,12 +694,16 @@ And the main host instance methods:
|
|
|
409
694
|
- `push()`
|
|
410
695
|
- `withRepositoryLock()`
|
|
411
696
|
|
|
412
|
-
The React entry
|
|
697
|
+
The React entry now exports:
|
|
413
698
|
|
|
414
699
|
- `createGitApiClient()`
|
|
415
700
|
- `GitApiClientProvider`
|
|
701
|
+
- `GitRepositoryUiProvider`
|
|
702
|
+
- `createGitRepositoryRouteAdapter()`
|
|
416
703
|
- `openLinguistSocket()` through the typed client instance
|
|
417
704
|
- `useGitRepositorySummary()`
|
|
705
|
+
- `useGitOverview()`
|
|
706
|
+
- `useGitSocialState()`
|
|
418
707
|
- `useGitBranches()`
|
|
419
708
|
- `useGitCommits()`
|
|
420
709
|
- `useGitCommit()`
|
|
@@ -428,6 +717,48 @@ The React entry currently exports:
|
|
|
428
717
|
- `useGitBlob()`
|
|
429
718
|
- `useGitDiff()`
|
|
430
719
|
- `useGitApiQuery()`
|
|
720
|
+
- `GitRepositoryShell`
|
|
721
|
+
- `GitRepositoryHeader`
|
|
722
|
+
- `GitRepositoryTabs`
|
|
723
|
+
- `GitRepositoryStats`
|
|
724
|
+
- `GitRepositoryActionBar`
|
|
725
|
+
- `GitRepositorySocialButtons`
|
|
726
|
+
- `GitCommitList`
|
|
727
|
+
- `GitReleaseList`
|
|
728
|
+
- `GitForkList`
|
|
729
|
+
- `GitBranchList`
|
|
730
|
+
- `GitTagList`
|
|
731
|
+
- `GitTreeView`
|
|
732
|
+
- `GitBlobView`
|
|
733
|
+
- `GitBlameView`
|
|
734
|
+
- `GitDiffView`
|
|
735
|
+
- `GitSearchResults`
|
|
736
|
+
- `GitBranchSelector`
|
|
737
|
+
- `GitTagSelector`
|
|
738
|
+
- `GitStarButton`
|
|
739
|
+
- `GitWatchButton`
|
|
740
|
+
- `GitForkButton`
|
|
741
|
+
- `GitSyncForkButton`
|
|
742
|
+
- `GitCreateReleaseButton`
|
|
743
|
+
- `GitDeleteReleaseButton`
|
|
744
|
+
- `GitCopyCloneUrlButton`
|
|
745
|
+
- `GitDownloadArchiveButton`
|
|
746
|
+
|
|
747
|
+
The browser entry exports full-page repository surfaces such as:
|
|
748
|
+
|
|
749
|
+
- `GitRepositoryOverviewPage`
|
|
750
|
+
- `GitRepositoryCodePage`
|
|
751
|
+
- `GitRepositoryCommitsPage`
|
|
752
|
+
- `GitRepositoryCommitPage`
|
|
753
|
+
- `GitRepositoryReleasesPage`
|
|
754
|
+
- `GitRepositoryReleasePage`
|
|
755
|
+
- `GitRepositoryForksPage`
|
|
756
|
+
- `GitRepositoryActivityPage`
|
|
757
|
+
- `GitRepositoryBranchesPage`
|
|
758
|
+
- `GitRepositoryTagsPage`
|
|
759
|
+
- `GitRepositorySearchPage`
|
|
760
|
+
- `GitRepositoryBlamePage`
|
|
761
|
+
- `GitRepositoryComparePage`
|
|
431
762
|
|
|
432
763
|
## Repository Model
|
|
433
764
|
|
|
@@ -435,7 +766,7 @@ This package does not own your app database.
|
|
|
435
766
|
|
|
436
767
|
Your app resolves a repository id to an absolute repository path. The package then runs Git operations against that path. This keeps repository metadata, permissions, tokens, SSH keys, and UI decisions inside the host app where they belong.
|
|
437
768
|
|
|
438
|
-
The
|
|
769
|
+
The repository runtime is still worktree-first, but the frontend surface is intentionally much broader now so host apps can stay thin.
|
|
439
770
|
|
|
440
771
|
Private remotes are still host-owned. The package now helps with the transport plumbing by supporting:
|
|
441
772
|
|
|
@@ -456,10 +787,11 @@ Most alternatives fall into one of three buckets:
|
|
|
456
787
|
Use it when you want:
|
|
457
788
|
|
|
458
789
|
- your app to keep owning users, permissions, tokens, SSH keys, repository records, and UI
|
|
790
|
+
- your app to keep owning users, permissions, tokens, SSH keys, repository records, branding, auth, and top-level route mounting while git-host owns most repository UI
|
|
459
791
|
- real Git behavior from the system `git` binary
|
|
460
792
|
- clone, fetch, pull, and push over smart HTTP and SSH
|
|
461
793
|
- a reusable Git runtime instead of spreading Git shell calls all over your platform code
|
|
462
|
-
-
|
|
794
|
+
- full browser-ready repository pages or reusable React repository primitives without rebuilding the same repository shell in every host app
|
|
463
795
|
|
|
464
796
|
Do not use it when you want:
|
|
465
797
|
|
|
@@ -509,7 +841,7 @@ The host platform should still own:
|
|
|
509
841
|
- permission checks and route authorization policy
|
|
510
842
|
- access token issuance, revocation, and storage
|
|
511
843
|
- SSH key ownership, private key storage, and known-host persistence
|
|
512
|
-
-
|
|
844
|
+
- top-level product chrome, auth flows, branding decisions, and any product-specific features outside the repository area
|
|
513
845
|
|
|
514
846
|
That boundary is where the package simplifies a platform the most without turning into a forge product of its own.
|
|
515
847
|
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import type { IncomingMessage, ServerResponse } from "node:http";
|
|
2
|
+
import type { CreateGitForgeApiHandlerOptions } from "../../types.js";
|
|
3
|
+
import { parseGitForgeApiRoute } from "./route.js";
|
|
4
|
+
declare function createGitForgeApiHandler(options: CreateGitForgeApiHandlerOptions): (req: IncomingMessage, res: ServerResponse) => void;
|
|
5
|
+
export { createGitForgeApiHandler, parseGitForgeApiRoute };
|
|
6
|
+
//# sourceMappingURL=handler.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"handler.d.ts","sourceRoot":"","sources":["../../../src/api/forge/handler.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,eAAe,EAAE,cAAc,EAAE,MAAM,WAAW,CAAC;AAIjE,OAAO,KAAK,EAAE,+BAA+B,EAAoC,MAAM,gBAAgB,CAAC;AAUxG,OAAO,EAAE,qBAAqB,EAAyB,MAAM,YAAY,CAAC;AA0P1E,iBAAS,wBAAwB,CAAC,OAAO,EAAE,+BAA+B,IAarC,KAAK,eAAe,EAAE,KAAK,cAAc,UAK7E;AAED,OAAO,EAAE,wBAAwB,EAAE,qBAAqB,EAAE,CAAC"}
|