@trebired/git-host 1.4.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 +15 -0
- package/README.md +347 -21
- package/dist/browser/index.d.ts +36 -15
- package/dist/browser/index.d.ts.map +1 -1
- package/dist/browser/index.js +602 -591
- package/dist/browser/index.js.map +1 -1
- package/dist/browser/styles.css +75 -0
- 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.map +1 -1
- package/dist/react/hooks/query.js +30 -5
- package/dist/react/hooks/query.js.map +1 -1
- package/dist/react/index.d.ts +3 -0
- package/dist/react/index.d.ts.map +1 -1
- package/dist/react/index.js +2 -0
- 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/package.json +1 -1
package/CHANGELOG.md
CHANGED
|
@@ -4,6 +4,21 @@ 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
|
+
|
|
7
22
|
## 1.4.0
|
|
8
23
|
|
|
9
24
|
- Added a new forge layer through `createGitForge()` with host-owned storage adapters for releases, forks, stars, watching, and repository activity timelines.
|
package/README.md
CHANGED
|
@@ -310,38 +310,316 @@ GET /api/git/repositories/demo/blob?ref=HEAD&path=README.md
|
|
|
310
310
|
GET /api/git/repositories/demo/diff?baseRef=main&headRef=feature%2Fx&path=src
|
|
311
311
|
```
|
|
312
312
|
|
|
313
|
-
|
|
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.
|
|
314
340
|
|
|
315
341
|
```ts
|
|
316
|
-
import {
|
|
342
|
+
import {
|
|
343
|
+
GitRepositoryOverviewPage,
|
|
344
|
+
createGitRepositoryRouteAdapter,
|
|
345
|
+
} from "@trebired/git-host/browser";
|
|
317
346
|
|
|
318
|
-
const
|
|
319
|
-
|
|
347
|
+
const routeAdapter = createGitRepositoryRouteAdapter({
|
|
348
|
+
repositoryBasePath: "/workspaces",
|
|
320
349
|
});
|
|
321
350
|
|
|
322
|
-
function
|
|
323
|
-
|
|
324
|
-
|
|
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
|
|
390
|
+
|
|
391
|
+
Use `@trebired/git-host/react` when your app owns the outer chrome but git-host should own the repository section UI patterns:
|
|
392
|
+
|
|
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
|
+
});
|
|
325
409
|
|
|
326
|
-
|
|
327
|
-
|
|
328
|
-
|
|
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
|
+
});
|
|
329
415
|
|
|
330
|
-
return
|
|
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
|
+
);
|
|
331
431
|
}
|
|
332
432
|
|
|
333
433
|
function App() {
|
|
334
434
|
return (
|
|
335
|
-
<GitApiClientProvider client={
|
|
336
|
-
<
|
|
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>
|
|
337
450
|
</GitApiClientProvider>
|
|
338
451
|
);
|
|
339
452
|
}
|
|
340
453
|
```
|
|
341
454
|
|
|
342
|
-
|
|
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:
|
|
343
458
|
|
|
344
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:
|
|
582
|
+
|
|
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
|
+
|
|
345
623
|
const socket = gitClient.openLinguistSocket("demo", {
|
|
346
624
|
ref: "main",
|
|
347
625
|
onProgress(event) {
|
|
@@ -355,18 +633,18 @@ const socket = gitClient.openLinguistSocket("demo", {
|
|
|
355
633
|
await socket.completed;
|
|
356
634
|
```
|
|
357
635
|
|
|
358
|
-
The React entry is intentionally headless. It helps apps fetch and mutate Git data consistently, but it does not ship a bundled styled UI.
|
|
359
|
-
|
|
360
636
|
## Current API
|
|
361
637
|
|
|
362
|
-
The
|
|
638
|
+
The package now exposes three main frontend/backend layers:
|
|
363
639
|
|
|
364
640
|
- `createGitHost()`
|
|
641
|
+
- `createGitForge()`
|
|
365
642
|
- `resolveRepositoryPath()`
|
|
366
643
|
- `runGit()`
|
|
367
644
|
- `buildGitEnv()`
|
|
368
645
|
- `RepositoryLockManager`
|
|
369
646
|
- `createGitApiHandler()`
|
|
647
|
+
- `createGitForgeApiHandler()`
|
|
370
648
|
- `createGitApiSocketServer()`
|
|
371
649
|
- `createGitHttpHandler()`
|
|
372
650
|
- `generateSshKeyPair()`
|
|
@@ -375,6 +653,7 @@ The first public slice is intentionally small:
|
|
|
375
653
|
- `fingerprintSshPublicKey()`
|
|
376
654
|
- `createGitSshServer()`
|
|
377
655
|
- `@trebired/git-host/react`
|
|
656
|
+
- `@trebired/git-host/browser`
|
|
378
657
|
|
|
379
658
|
And the main host instance methods:
|
|
380
659
|
|
|
@@ -415,12 +694,16 @@ And the main host instance methods:
|
|
|
415
694
|
- `push()`
|
|
416
695
|
- `withRepositoryLock()`
|
|
417
696
|
|
|
418
|
-
The React entry
|
|
697
|
+
The React entry now exports:
|
|
419
698
|
|
|
420
699
|
- `createGitApiClient()`
|
|
421
700
|
- `GitApiClientProvider`
|
|
701
|
+
- `GitRepositoryUiProvider`
|
|
702
|
+
- `createGitRepositoryRouteAdapter()`
|
|
422
703
|
- `openLinguistSocket()` through the typed client instance
|
|
423
704
|
- `useGitRepositorySummary()`
|
|
705
|
+
- `useGitOverview()`
|
|
706
|
+
- `useGitSocialState()`
|
|
424
707
|
- `useGitBranches()`
|
|
425
708
|
- `useGitCommits()`
|
|
426
709
|
- `useGitCommit()`
|
|
@@ -434,6 +717,48 @@ The React entry currently exports:
|
|
|
434
717
|
- `useGitBlob()`
|
|
435
718
|
- `useGitDiff()`
|
|
436
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`
|
|
437
762
|
|
|
438
763
|
## Repository Model
|
|
439
764
|
|
|
@@ -441,7 +766,7 @@ This package does not own your app database.
|
|
|
441
766
|
|
|
442
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.
|
|
443
768
|
|
|
444
|
-
The
|
|
769
|
+
The repository runtime is still worktree-first, but the frontend surface is intentionally much broader now so host apps can stay thin.
|
|
445
770
|
|
|
446
771
|
Private remotes are still host-owned. The package now helps with the transport plumbing by supporting:
|
|
447
772
|
|
|
@@ -462,10 +787,11 @@ Most alternatives fall into one of three buckets:
|
|
|
462
787
|
Use it when you want:
|
|
463
788
|
|
|
464
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
|
|
465
791
|
- real Git behavior from the system `git` binary
|
|
466
792
|
- clone, fetch, pull, and push over smart HTTP and SSH
|
|
467
793
|
- a reusable Git runtime instead of spreading Git shell calls all over your platform code
|
|
468
|
-
-
|
|
794
|
+
- full browser-ready repository pages or reusable React repository primitives without rebuilding the same repository shell in every host app
|
|
469
795
|
|
|
470
796
|
Do not use it when you want:
|
|
471
797
|
|
|
@@ -515,7 +841,7 @@ The host platform should still own:
|
|
|
515
841
|
- permission checks and route authorization policy
|
|
516
842
|
- access token issuance, revocation, and storage
|
|
517
843
|
- SSH key ownership, private key storage, and known-host persistence
|
|
518
|
-
-
|
|
844
|
+
- top-level product chrome, auth flows, branding decisions, and any product-specific features outside the repository area
|
|
519
845
|
|
|
520
846
|
That boundary is where the package simplifies a platform the most without turning into a forge product of its own.
|
|
521
847
|
|
package/dist/browser/index.d.ts
CHANGED
|
@@ -1,44 +1,65 @@
|
|
|
1
1
|
import { type ReactNode } from "react";
|
|
2
2
|
import type { GitApiClient, GitApiClientHeaders } from "../react/client.js";
|
|
3
|
-
import type
|
|
4
|
-
type
|
|
3
|
+
import { type GitRepositoryUiProviderProps } from "../react/index.js";
|
|
4
|
+
import type { GitRepositoryFrontEndInitialData, GitRepositoryRouteAdapter } from "../react/ui/context.js";
|
|
5
|
+
type GitBrowserProviderProps = GitRepositoryUiProviderProps & {
|
|
5
6
|
baseUrl?: string;
|
|
6
7
|
children?: ReactNode;
|
|
7
8
|
client?: GitApiClient;
|
|
8
9
|
headers?: GitApiClientHeaders;
|
|
10
|
+
unstyled?: boolean;
|
|
9
11
|
};
|
|
10
|
-
type GitBrowserPageProps
|
|
12
|
+
type GitBrowserPageProps = GitRepositoryUiProviderProps & {
|
|
11
13
|
baseUrl?: string;
|
|
12
14
|
className?: string;
|
|
13
15
|
client?: GitApiClient;
|
|
14
16
|
headers?: GitApiClientHeaders;
|
|
15
|
-
initialData?:
|
|
16
|
-
navigate?: (to: string) => void;
|
|
17
|
+
initialData?: GitRepositoryFrontEndInitialData | null;
|
|
17
18
|
repositoryKey: string;
|
|
19
|
+
unstyled?: boolean;
|
|
18
20
|
};
|
|
19
|
-
type GitRepositoryCodePageProps = GitBrowserPageProps
|
|
21
|
+
type GitRepositoryCodePageProps = GitBrowserPageProps & {
|
|
20
22
|
path?: string;
|
|
21
23
|
refName?: string;
|
|
22
24
|
};
|
|
23
|
-
type GitRepositoryCommitsPageProps = GitBrowserPageProps
|
|
25
|
+
type GitRepositoryCommitsPageProps = GitBrowserPageProps & {
|
|
24
26
|
path?: string;
|
|
25
27
|
refName?: string;
|
|
26
28
|
};
|
|
27
|
-
type GitRepositoryCommitPageProps = GitBrowserPageProps
|
|
29
|
+
type GitRepositoryCommitPageProps = GitBrowserPageProps & {
|
|
28
30
|
commitRef: string;
|
|
29
31
|
};
|
|
30
|
-
type GitRepositoryReleasePageProps = GitBrowserPageProps
|
|
32
|
+
type GitRepositoryReleasePageProps = GitBrowserPageProps & {
|
|
31
33
|
releaseId: string;
|
|
32
34
|
};
|
|
35
|
+
type GitRepositoryBlamePageProps = GitBrowserPageProps & {
|
|
36
|
+
path: string;
|
|
37
|
+
refName?: string;
|
|
38
|
+
};
|
|
39
|
+
type GitRepositoryComparePageProps = GitBrowserPageProps & {
|
|
40
|
+
baseRef: string;
|
|
41
|
+
headRef: string;
|
|
42
|
+
path?: string;
|
|
43
|
+
};
|
|
44
|
+
type GitRepositorySearchPageProps = GitBrowserPageProps & {
|
|
45
|
+
path?: string;
|
|
46
|
+
query?: string;
|
|
47
|
+
refName?: string;
|
|
48
|
+
};
|
|
33
49
|
declare function GitBrowserProvider(props: GitBrowserProviderProps): import("react").FunctionComponentElement<import("../react/hooks.js").GitApiClientProviderProps>;
|
|
34
|
-
declare function GitRepositoryOverviewPage(props: GitBrowserPageProps
|
|
50
|
+
declare function GitRepositoryOverviewPage(props: GitBrowserPageProps): ReactNode;
|
|
35
51
|
declare function GitRepositoryCodePage(props: GitRepositoryCodePageProps): ReactNode;
|
|
36
52
|
declare function GitRepositoryCommitsPage(props: GitRepositoryCommitsPageProps): ReactNode;
|
|
37
53
|
declare function GitRepositoryCommitPage(props: GitRepositoryCommitPageProps): ReactNode;
|
|
38
|
-
declare function GitRepositoryReleasesPage(props: GitBrowserPageProps
|
|
54
|
+
declare function GitRepositoryReleasesPage(props: GitBrowserPageProps): ReactNode;
|
|
39
55
|
declare function GitRepositoryReleasePage(props: GitRepositoryReleasePageProps): ReactNode;
|
|
40
|
-
declare function GitRepositoryForksPage(props: GitBrowserPageProps
|
|
41
|
-
declare function GitRepositoryActivityPage(props: GitBrowserPageProps
|
|
42
|
-
|
|
43
|
-
|
|
56
|
+
declare function GitRepositoryForksPage(props: GitBrowserPageProps): ReactNode;
|
|
57
|
+
declare function GitRepositoryActivityPage(props: GitBrowserPageProps): ReactNode;
|
|
58
|
+
declare function GitRepositoryBranchesPage(props: GitBrowserPageProps): ReactNode;
|
|
59
|
+
declare function GitRepositoryTagsPage(props: GitBrowserPageProps): ReactNode;
|
|
60
|
+
declare function GitRepositorySearchPage(props: GitRepositorySearchPageProps): ReactNode;
|
|
61
|
+
declare function GitRepositoryBlamePage(props: GitRepositoryBlamePageProps): ReactNode;
|
|
62
|
+
declare function GitRepositoryComparePage(props: GitRepositoryComparePageProps): ReactNode;
|
|
63
|
+
export { GitBrowserProvider, GitRepositoryActivityPage, GitRepositoryBlamePage, GitRepositoryBranchesPage, GitRepositoryCodePage, GitRepositoryCommitPage, GitRepositoryCommitsPage, GitRepositoryComparePage, GitRepositoryForksPage, GitRepositoryOverviewPage, GitRepositoryReleasePage, GitRepositoryReleasesPage, GitRepositorySearchPage, GitRepositoryTagsPage, };
|
|
64
|
+
export type { GitBrowserPageProps, GitBrowserProviderProps, GitRepositoryBlamePageProps, GitRepositoryCodePageProps, GitRepositoryCommitPageProps, GitRepositoryCommitsPageProps, GitRepositoryComparePageProps, GitRepositoryReleasePageProps, GitRepositoryRouteAdapter, GitRepositorySearchPageProps, };
|
|
44
65
|
//# sourceMappingURL=index.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/browser/index.ts"],"names":[],"mappings":"AAAA,OAAO,
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/browser/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAIL,KAAK,SAAS,EACf,MAAM,OAAO,CAAC;AAGf,OAAO,KAAK,EAAE,YAAY,EAAE,mBAAmB,EAAE,MAAM,oBAAoB,CAAC;AAC5E,OAAO,EAyCL,KAAK,4BAA4B,EAElC,MAAM,mBAAmB,CAAC;AAC3B,OAAO,KAAK,EAAE,gCAAgC,EAAE,yBAAyB,EAAE,MAAM,wBAAwB,CAAC;AAM1G,KAAK,uBAAuB,GAAG,4BAA4B,GAAG;IAC5D,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,QAAQ,CAAC,EAAE,SAAS,CAAC;IACrB,MAAM,CAAC,EAAE,YAAY,CAAC;IACtB,OAAO,CAAC,EAAE,mBAAmB,CAAC;IAC9B,QAAQ,CAAC,EAAE,O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