trident-git 0.2.0 → 0.2.2
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/.next/BUILD_ID +1 -0
- package/.next/app-path-routes-manifest.json +23 -0
- package/.next/build-manifest.json +20 -0
- package/.next/export-marker.json +6 -0
- package/.next/images-manifest.json +73 -0
- package/.next/next-minimal-server.js.nft.json +1 -0
- package/.next/next-server.js.nft.json +1 -0
- package/.next/package.json +1 -0
- package/.next/prerender-manifest.json +282 -0
- package/.next/react-loadable-manifest.json +1 -0
- package/.next/required-server-files.js +330 -0
- package/.next/required-server-files.json +330 -0
- package/.next/routes-manifest.json +170 -0
- package/.next/server/app/_global-error/page.js +3 -0
- package/.next/server/app/_global-error/page.js.nft.json +1 -0
- package/.next/server/app/_global-error/page_client-reference-manifest.js +1 -0
- package/.next/server/app/_global-error.html +2 -0
- package/.next/server/app/_global-error.meta +16 -0
- package/.next/server/app/_global-error.rsc +12 -0
- package/.next/server/app/_global-error.segments/_full.segment.rsc +12 -0
- package/.next/server/app/_global-error.segments/_global-error/__PAGE__.segment.rsc +5 -0
- package/.next/server/app/_global-error.segments/_global-error.segment.rsc +4 -0
- package/.next/server/app/_global-error.segments/_head.segment.rsc +5 -0
- package/.next/server/app/_global-error.segments/_index.segment.rsc +4 -0
- package/.next/server/app/_global-error.segments/_tree.segment.rsc +1 -0
- package/.next/server/app/_not-found/page.js +2 -0
- package/.next/server/app/_not-found/page.js.nft.json +1 -0
- package/.next/server/app/_not-found/page_client-reference-manifest.js +1 -0
- package/.next/server/app/_not-found.html +1 -0
- package/.next/server/app/_not-found.meta +16 -0
- package/.next/server/app/_not-found.rsc +19 -0
- package/.next/server/app/_not-found.segments/_full.segment.rsc +19 -0
- package/.next/server/app/_not-found.segments/_head.segment.rsc +6 -0
- package/.next/server/app/_not-found.segments/_index.segment.rsc +8 -0
- package/.next/server/app/_not-found.segments/_not-found/__PAGE__.segment.rsc +5 -0
- package/.next/server/app/_not-found.segments/_not-found.segment.rsc +4 -0
- package/.next/server/app/_not-found.segments/_tree.segment.rsc +6 -0
- package/.next/server/app/api/credentials/route.js +1 -0
- package/.next/server/app/api/credentials/route.js.nft.json +1 -0
- package/.next/server/app/api/credentials/route_client-reference-manifest.js +1 -0
- package/.next/server/app/api/custom-scripts/route.js +3 -0
- package/.next/server/app/api/custom-scripts/route.js.nft.json +1 -0
- package/.next/server/app/api/custom-scripts/route_client-reference-manifest.js +1 -0
- package/.next/server/app/api/fs/route.js +1 -0
- package/.next/server/app/api/fs/route.js.nft.json +1 -0
- package/.next/server/app/api/fs/route_client-reference-manifest.js +1 -0
- package/.next/server/app/api/git/action/route.js +1 -0
- package/.next/server/app/api/git/action/route.js.nft.json +1 -0
- package/.next/server/app/api/git/action/route_client-reference-manifest.js +1 -0
- package/.next/server/app/api/git/branches/route.js +1 -0
- package/.next/server/app/api/git/branches/route.js.nft.json +1 -0
- package/.next/server/app/api/git/branches/route_client-reference-manifest.js +1 -0
- package/.next/server/app/api/git/diff/route.js +1 -0
- package/.next/server/app/api/git/diff/route.js.nft.json +1 -0
- package/.next/server/app/api/git/diff/route_client-reference-manifest.js +1 -0
- package/.next/server/app/api/git/log/route.js +1 -0
- package/.next/server/app/api/git/log/route.js.nft.json +1 -0
- package/.next/server/app/api/git/log/route_client-reference-manifest.js +1 -0
- package/.next/server/app/api/git/status/route.js +1 -0
- package/.next/server/app/api/git/status/route.js.nft.json +1 -0
- package/.next/server/app/api/git/status/route_client-reference-manifest.js +1 -0
- package/.next/server/app/api/repos/route.js +1 -0
- package/.next/server/app/api/repos/route.js.nft.json +1 -0
- package/.next/server/app/api/repos/route_client-reference-manifest.js +1 -0
- package/.next/server/app/api/settings/route.js +1 -0
- package/.next/server/app/api/settings/route.js.nft.json +1 -0
- package/.next/server/app/api/settings/route_client-reference-manifest.js +1 -0
- package/.next/server/app/credentials/page.js +4 -0
- package/.next/server/app/credentials/page.js.nft.json +1 -0
- package/.next/server/app/credentials/page_client-reference-manifest.js +1 -0
- package/.next/server/app/credentials.html +1 -0
- package/.next/server/app/credentials.meta +15 -0
- package/.next/server/app/credentials.rsc +23 -0
- package/.next/server/app/credentials.segments/_full.segment.rsc +23 -0
- package/.next/server/app/credentials.segments/_head.segment.rsc +6 -0
- package/.next/server/app/credentials.segments/_index.segment.rsc +8 -0
- package/.next/server/app/credentials.segments/_tree.segment.rsc +6 -0
- package/.next/server/app/credentials.segments/credentials/__PAGE__.segment.rsc +9 -0
- package/.next/server/app/credentials.segments/credentials.segment.rsc +4 -0
- package/.next/server/app/icon.png/route.js +1 -0
- package/.next/server/app/icon.png/route.js.nft.json +1 -0
- package/.next/server/app/icon.png.meta +1 -0
- package/.next/server/app/index.html +1 -0
- package/.next/server/app/index.meta +14 -0
- package/.next/server/app/index.rsc +20 -0
- package/.next/server/app/index.segments/__PAGE__.segment.rsc +6 -0
- package/.next/server/app/index.segments/_full.segment.rsc +20 -0
- package/.next/server/app/index.segments/_head.segment.rsc +6 -0
- package/.next/server/app/index.segments/_index.segment.rsc +8 -0
- package/.next/server/app/index.segments/_tree.segment.rsc +6 -0
- package/.next/server/app/page.js +2 -0
- package/.next/server/app/page.js.nft.json +1 -0
- package/.next/server/app/page_client-reference-manifest.js +1 -0
- package/.next/server/app/workspace/changes/page.js +4 -0
- package/.next/server/app/workspace/changes/page.js.nft.json +1 -0
- package/.next/server/app/workspace/changes/page_client-reference-manifest.js +1 -0
- package/.next/server/app/workspace/changes.html +1 -0
- package/.next/server/app/workspace/changes.meta +16 -0
- package/.next/server/app/workspace/changes.rsc +26 -0
- package/.next/server/app/workspace/changes.segments/_full.segment.rsc +26 -0
- package/.next/server/app/workspace/changes.segments/_head.segment.rsc +6 -0
- package/.next/server/app/workspace/changes.segments/_index.segment.rsc +8 -0
- package/.next/server/app/workspace/changes.segments/_tree.segment.rsc +7 -0
- package/.next/server/app/workspace/changes.segments/workspace/changes/__PAGE__.segment.rsc +10 -0
- package/.next/server/app/workspace/changes.segments/workspace/changes.segment.rsc +4 -0
- package/.next/server/app/workspace/changes.segments/workspace.segment.rsc +7 -0
- package/.next/server/app/workspace/custom-scripts/page.js +2 -0
- package/.next/server/app/workspace/custom-scripts/page.js.nft.json +1 -0
- package/.next/server/app/workspace/custom-scripts/page_client-reference-manifest.js +1 -0
- package/.next/server/app/workspace/custom-scripts.html +1 -0
- package/.next/server/app/workspace/custom-scripts.meta +16 -0
- package/.next/server/app/workspace/custom-scripts.rsc +25 -0
- package/.next/server/app/workspace/custom-scripts.segments/_full.segment.rsc +25 -0
- package/.next/server/app/workspace/custom-scripts.segments/_head.segment.rsc +6 -0
- package/.next/server/app/workspace/custom-scripts.segments/_index.segment.rsc +8 -0
- package/.next/server/app/workspace/custom-scripts.segments/_tree.segment.rsc +6 -0
- package/.next/server/app/workspace/custom-scripts.segments/workspace/custom-scripts/__PAGE__.segment.rsc +9 -0
- package/.next/server/app/workspace/custom-scripts.segments/workspace/custom-scripts.segment.rsc +4 -0
- package/.next/server/app/workspace/custom-scripts.segments/workspace.segment.rsc +7 -0
- package/.next/server/app/workspace/history/page.js +2 -0
- package/.next/server/app/workspace/history/page.js.nft.json +1 -0
- package/.next/server/app/workspace/history/page_client-reference-manifest.js +1 -0
- package/.next/server/app/workspace/history.html +1 -0
- package/.next/server/app/workspace/history.meta +16 -0
- package/.next/server/app/workspace/history.rsc +26 -0
- package/.next/server/app/workspace/history.segments/_full.segment.rsc +26 -0
- package/.next/server/app/workspace/history.segments/_head.segment.rsc +6 -0
- package/.next/server/app/workspace/history.segments/_index.segment.rsc +8 -0
- package/.next/server/app/workspace/history.segments/_tree.segment.rsc +7 -0
- package/.next/server/app/workspace/history.segments/workspace/history/__PAGE__.segment.rsc +10 -0
- package/.next/server/app/workspace/history.segments/workspace/history.segment.rsc +4 -0
- package/.next/server/app/workspace/history.segments/workspace.segment.rsc +7 -0
- package/.next/server/app/workspace/page.js +2 -0
- package/.next/server/app/workspace/page.js.nft.json +1 -0
- package/.next/server/app/workspace/page_client-reference-manifest.js +1 -0
- package/.next/server/app/workspace/settings/page.js +2 -0
- package/.next/server/app/workspace/settings/page.js.nft.json +1 -0
- package/.next/server/app/workspace/settings/page_client-reference-manifest.js +1 -0
- package/.next/server/app/workspace/settings.html +1 -0
- package/.next/server/app/workspace/settings.meta +16 -0
- package/.next/server/app/workspace/settings.rsc +25 -0
- package/.next/server/app/workspace/settings.segments/_full.segment.rsc +25 -0
- package/.next/server/app/workspace/settings.segments/_head.segment.rsc +6 -0
- package/.next/server/app/workspace/settings.segments/_index.segment.rsc +8 -0
- package/.next/server/app/workspace/settings.segments/_tree.segment.rsc +6 -0
- package/.next/server/app/workspace/settings.segments/workspace/settings/__PAGE__.segment.rsc +9 -0
- package/.next/server/app/workspace/settings.segments/workspace/settings.segment.rsc +4 -0
- package/.next/server/app/workspace/settings.segments/workspace.segment.rsc +7 -0
- package/.next/server/app/workspace/stashes/page.js +2 -0
- package/.next/server/app/workspace/stashes/page.js.nft.json +1 -0
- package/.next/server/app/workspace/stashes/page_client-reference-manifest.js +1 -0
- package/.next/server/app/workspace/stashes.html +1 -0
- package/.next/server/app/workspace/stashes.meta +16 -0
- package/.next/server/app/workspace/stashes.rsc +26 -0
- package/.next/server/app/workspace/stashes.segments/_full.segment.rsc +26 -0
- package/.next/server/app/workspace/stashes.segments/_head.segment.rsc +6 -0
- package/.next/server/app/workspace/stashes.segments/_index.segment.rsc +8 -0
- package/.next/server/app/workspace/stashes.segments/_tree.segment.rsc +7 -0
- package/.next/server/app/workspace/stashes.segments/workspace/stashes/__PAGE__.segment.rsc +10 -0
- package/.next/server/app/workspace/stashes.segments/workspace/stashes.segment.rsc +4 -0
- package/.next/server/app/workspace/stashes.segments/workspace.segment.rsc +7 -0
- package/.next/server/app/workspace.html +1 -0
- package/.next/server/app/workspace.meta +15 -0
- package/.next/server/app/workspace.rsc +26 -0
- package/.next/server/app/workspace.segments/_full.segment.rsc +26 -0
- package/.next/server/app/workspace.segments/_head.segment.rsc +6 -0
- package/.next/server/app/workspace.segments/_index.segment.rsc +8 -0
- package/.next/server/app/workspace.segments/_tree.segment.rsc +7 -0
- package/.next/server/app/workspace.segments/workspace/__PAGE__.segment.rsc +10 -0
- package/.next/server/app/workspace.segments/workspace.segment.rsc +7 -0
- package/.next/server/app-paths-manifest.json +23 -0
- package/.next/server/chunks/116.js +1 -0
- package/.next/server/chunks/170.js +1 -0
- package/.next/server/chunks/309.js +6 -0
- package/.next/server/chunks/356.js +1 -0
- package/.next/server/chunks/392.js +1 -0
- package/.next/server/chunks/443.js +37 -0
- package/.next/server/chunks/445.js +22 -0
- package/.next/server/chunks/471.js +13 -0
- package/.next/server/chunks/557.js +5 -0
- package/.next/server/chunks/680.js +1 -0
- package/.next/server/chunks/739.js +5 -0
- package/.next/server/chunks/781.js +1 -0
- package/.next/server/chunks/813.js +1 -0
- package/.next/server/chunks/816.js +13 -0
- package/.next/server/functions-config-manifest.json +6 -0
- package/.next/server/interception-route-rewrite-manifest.js +1 -0
- package/.next/server/middleware-build-manifest.js +1 -0
- package/.next/server/middleware-manifest.json +6 -0
- package/.next/server/middleware-react-loadable-manifest.js +1 -0
- package/.next/server/next-font-manifest.js +1 -0
- package/.next/server/next-font-manifest.json +1 -0
- package/.next/server/pages/404.html +1 -0
- package/.next/server/pages/500.html +2 -0
- package/.next/server/pages-manifest.json +4 -0
- package/.next/server/server-reference-manifest.js +1 -0
- package/.next/server/server-reference-manifest.json +1 -0
- package/.next/server/webpack-runtime.js +1 -0
- package/.next/static/VTWJwhFJd5VcC6GP5bbli/_buildManifest.js +1 -0
- package/.next/static/VTWJwhFJd5VcC6GP5bbli/_ssgManifest.js +1 -0
- package/.next/static/chunks/131-6237c77d708182b1.js +1 -0
- package/.next/static/chunks/147-d4cb3e03218d75df.js +6 -0
- package/.next/static/chunks/176-b068120641913226.js +1 -0
- package/.next/static/chunks/200-3664e65687e716a2.js +1 -0
- package/.next/static/chunks/26-d93e82c9c09ff972.js +1 -0
- package/.next/static/chunks/4bd1b696-096d35a2bd1da3af.js +1 -0
- package/.next/static/chunks/500-5d45efbf86b8d36e.js +1 -0
- package/.next/static/chunks/772-b39107b40c31b6b6.js +3 -0
- package/.next/static/chunks/785-e6d755147ff87934.js +1 -0
- package/.next/static/chunks/790-3e8fa6e595d97940.js +6 -0
- package/.next/static/chunks/794-37dad9bbc14b04b8.js +2 -0
- package/.next/static/chunks/841-4d865378216d36eb.js +13 -0
- package/.next/static/chunks/app/_global-error/page-9eb8a19109bbd711.js +1 -0
- package/.next/static/chunks/app/_not-found/page-5bea07380837254f.js +1 -0
- package/.next/static/chunks/app/api/credentials/route-9eb8a19109bbd711.js +1 -0
- package/.next/static/chunks/app/api/custom-scripts/route-9eb8a19109bbd711.js +1 -0
- package/.next/static/chunks/app/api/fs/route-9eb8a19109bbd711.js +1 -0
- package/.next/static/chunks/app/api/git/action/route-9eb8a19109bbd711.js +1 -0
- package/.next/static/chunks/app/api/git/branches/route-9eb8a19109bbd711.js +1 -0
- package/.next/static/chunks/app/api/git/diff/route-9eb8a19109bbd711.js +1 -0
- package/.next/static/chunks/app/api/git/log/route-9eb8a19109bbd711.js +1 -0
- package/.next/static/chunks/app/api/git/status/route-9eb8a19109bbd711.js +1 -0
- package/.next/static/chunks/app/api/repos/route-9eb8a19109bbd711.js +1 -0
- package/.next/static/chunks/app/api/settings/route-9eb8a19109bbd711.js +1 -0
- package/.next/static/chunks/app/credentials/page-23c1807ad9f68a40.js +1 -0
- package/.next/static/chunks/app/layout-a06241c385e50ae0.js +1 -0
- package/.next/static/chunks/app/page-c8404790f5191fd7.js +1 -0
- package/.next/static/chunks/app/workspace/changes/page-8cca17f80e66f534.js +3 -0
- package/.next/static/chunks/app/workspace/custom-scripts/page-ee24b9dd7779244f.js +1 -0
- package/.next/static/chunks/app/workspace/history/page-b7017fea285c804c.js +1 -0
- package/.next/static/chunks/app/workspace/layout-cb86c00fdcd8db08.js +1 -0
- package/.next/static/chunks/app/workspace/page-21211acc90c08509.js +1 -0
- package/.next/static/chunks/app/workspace/settings/page-7ccb58ece31492e9.js +1 -0
- package/.next/static/chunks/app/workspace/stashes/page-0e1b8304c4b0f4f3.js +1 -0
- package/.next/static/chunks/framework-75892d61b920805f.js +1 -0
- package/.next/static/chunks/main-app-221e1b945693a142.js +1 -0
- package/.next/static/chunks/main-f1d55fffd3cc9809.js +5 -0
- package/.next/static/chunks/next/dist/client/components/builtin/app-error-9eb8a19109bbd711.js +1 -0
- package/.next/static/chunks/next/dist/client/components/builtin/forbidden-9eb8a19109bbd711.js +1 -0
- package/.next/static/chunks/next/dist/client/components/builtin/global-error-f2a2c324f3740ed8.js +1 -0
- package/.next/static/chunks/next/dist/client/components/builtin/not-found-9eb8a19109bbd711.js +1 -0
- package/.next/static/chunks/next/dist/client/components/builtin/unauthorized-9eb8a19109bbd711.js +1 -0
- package/.next/static/chunks/polyfills-42372ed130431b0a.js +1 -0
- package/.next/static/chunks/webpack-7dec27dc3bfe207a.js +1 -0
- package/.next/static/css/36968b90b2339533.css +1 -0
- package/.next/static/css/c56c0e57397a3a60.css +1 -0
- package/.next/static/css/de70bee13400563f.css +1 -0
- package/.next/static/media/4cf2300e9c8272f7-s.p.woff2 +0 -0
- package/.next/static/media/747892c23ea88013-s.woff2 +0 -0
- package/.next/static/media/8d697b304b401681-s.woff2 +0 -0
- package/.next/static/media/93f479601ee12b01-s.p.woff2 +0 -0
- package/.next/static/media/9610d9e46709d722-s.woff2 +0 -0
- package/.next/static/media/ba015fad6dcf6784-s.woff2 +0 -0
- package/README.md +2 -0
- package/bin/trident-git.mjs +9 -11
- package/{next.config.ts → next.config.mjs} +7 -8
- package/package.json +8 -6
- package/eslint.config.mjs +0 -18
- package/postcss.config.mjs +0 -7
- package/src/app/api/credentials/route.ts +0 -113
- package/src/app/api/custom-scripts/route.ts +0 -203
- package/src/app/api/fs/route.ts +0 -75
- package/src/app/api/git/action/route.ts +0 -383
- package/src/app/api/git/branches/route.ts +0 -20
- package/src/app/api/git/diff/route.ts +0 -104
- package/src/app/api/git/log/route.ts +0 -28
- package/src/app/api/git/status/route.ts +0 -28
- package/src/app/api/repos/route.ts +0 -84
- package/src/app/api/settings/route.ts +0 -37
- package/src/app/credentials/page.tsx +0 -408
- package/src/app/globals.css +0 -109
- package/src/app/layout.tsx +0 -38
- package/src/app/page.tsx +0 -10
- package/src/app/providers.tsx +0 -21
- package/src/app/workspace/changes/page.tsx +0 -27
- package/src/app/workspace/custom-scripts/page.tsx +0 -247
- package/src/app/workspace/history/page.tsx +0 -27
- package/src/app/workspace/layout.tsx +0 -26
- package/src/app/workspace/page.tsx +0 -27
- package/src/app/workspace/settings/page.tsx +0 -233
- package/src/app/workspace/stashes/page.tsx +0 -395
- package/src/components/command-palette.tsx +0 -178
- package/src/components/context-menu.tsx +0 -200
- package/src/components/fs-browser.tsx +0 -154
- package/src/components/git/diff-view.tsx +0 -137
- package/src/components/git/git-graph.tsx +0 -489
- package/src/components/git/grouped-diff-viewer.tsx +0 -332
- package/src/components/git/history-view.tsx +0 -4862
- package/src/components/git/image-diff-view.tsx +0 -342
- package/src/components/git/status-view.tsx +0 -597
- package/src/components/home-settings-modal.tsx +0 -192
- package/src/components/layout/sidebar.tsx +0 -256
- package/src/components/repo-list.tsx +0 -206
- package/src/components/theme-toggle.tsx +0 -37
- package/src/components/toaster.tsx +0 -36
- package/src/components/workspace-repo-open-tracker.tsx +0 -39
- package/src/hooks/use-credentials.ts +0 -123
- package/src/hooks/use-escape-dismiss.ts +0 -72
- package/src/hooks/use-git.ts +0 -448
- package/src/hooks/use-toast.ts +0 -280
- package/src/hooks/use-workspace-title.ts +0 -23
- package/src/lib/api-utils.ts +0 -24
- package/src/lib/branch-colors.ts +0 -98
- package/src/lib/credentials.ts +0 -404
- package/src/lib/git.ts +0 -1510
- package/src/lib/graph-utils.ts +0 -253
- package/src/lib/store.ts +0 -145
- package/src/lib/types.ts +0 -95
- package/src/lib/utils.ts +0 -266
- package/tsconfig.json +0 -34
- /package/{src/app/icon.png → .next/server/app/icon.png.body} +0 -0
package/src/lib/graph-utils.ts
DELETED
|
@@ -1,253 +0,0 @@
|
|
|
1
|
-
|
|
2
|
-
import { Commit } from './types';
|
|
3
|
-
import { getBranchGraphColor } from './branch-colors';
|
|
4
|
-
|
|
5
|
-
export interface GraphNode extends Commit {
|
|
6
|
-
x: number; // Lane index (0, 1, 2...)
|
|
7
|
-
y: number; // Row index
|
|
8
|
-
color: string;
|
|
9
|
-
paths: GraphPath[];
|
|
10
|
-
isMerge: boolean; // Helper to draw different dot
|
|
11
|
-
}
|
|
12
|
-
|
|
13
|
-
export interface GraphPath {
|
|
14
|
-
x1: number;
|
|
15
|
-
y1: number;
|
|
16
|
-
x2: number;
|
|
17
|
-
y2: number;
|
|
18
|
-
color: string;
|
|
19
|
-
type: 'straight' | 'merge' | 'fork';
|
|
20
|
-
}
|
|
21
|
-
|
|
22
|
-
function getLaneFallbackColor(lane: number): string {
|
|
23
|
-
const hue = (lane * 47) % 360;
|
|
24
|
-
return `hsl(${hue} 78% 56%)`;
|
|
25
|
-
}
|
|
26
|
-
|
|
27
|
-
function parseBranchRefs(refs?: string): string[] {
|
|
28
|
-
if (!refs) return [];
|
|
29
|
-
|
|
30
|
-
const normalizeDecoratedRef = (ref: string): string => {
|
|
31
|
-
if (ref.startsWith('refs/heads/')) {
|
|
32
|
-
return ref.slice('refs/heads/'.length);
|
|
33
|
-
}
|
|
34
|
-
if (ref.startsWith('refs/remotes/')) {
|
|
35
|
-
return ref.slice('refs/remotes/'.length);
|
|
36
|
-
}
|
|
37
|
-
if (ref.startsWith('remotes/')) {
|
|
38
|
-
return ref.slice('remotes/'.length);
|
|
39
|
-
}
|
|
40
|
-
return ref;
|
|
41
|
-
};
|
|
42
|
-
|
|
43
|
-
return refs
|
|
44
|
-
.replace(/^\s*\((.*)\)\s*$/, '$1')
|
|
45
|
-
.split(',')
|
|
46
|
-
.map((part) => part.trim())
|
|
47
|
-
.filter(Boolean)
|
|
48
|
-
.map((ref) => ref.replace(/^HEAD\s*->\s*/, '').trim())
|
|
49
|
-
.map(normalizeDecoratedRef)
|
|
50
|
-
.filter((ref) => !ref.startsWith('tag:'))
|
|
51
|
-
.filter((ref) => ref !== 'HEAD')
|
|
52
|
-
.filter((ref) => !/\/HEAD$/.test(ref));
|
|
53
|
-
}
|
|
54
|
-
|
|
55
|
-
function getRemoteShortName(ref: string): string | null {
|
|
56
|
-
const withoutPrefix = ref.startsWith('remotes/') ? ref.slice('remotes/'.length) : ref;
|
|
57
|
-
const slashIndex = withoutPrefix.indexOf('/');
|
|
58
|
-
if (slashIndex === -1) return null;
|
|
59
|
-
return withoutPrefix.slice(slashIndex + 1);
|
|
60
|
-
}
|
|
61
|
-
|
|
62
|
-
function normalizeRefForColor(ref: string, localBranches: Set<string>): string {
|
|
63
|
-
if (localBranches.has(ref)) return ref;
|
|
64
|
-
const shortName = getRemoteShortName(ref);
|
|
65
|
-
if (shortName && localBranches.has(shortName)) {
|
|
66
|
-
return shortName;
|
|
67
|
-
}
|
|
68
|
-
return ref;
|
|
69
|
-
}
|
|
70
|
-
|
|
71
|
-
function isLocalRef(ref: string, localBranches: Set<string>): boolean {
|
|
72
|
-
return localBranches.has(ref);
|
|
73
|
-
}
|
|
74
|
-
|
|
75
|
-
function choosePreferredRef(refs: string[], localBranches: Set<string>): string | null {
|
|
76
|
-
if (refs.length === 0) return null;
|
|
77
|
-
const localRef = refs.find((ref) => isLocalRef(ref, localBranches));
|
|
78
|
-
if (localRef) return localRef;
|
|
79
|
-
return refs[0];
|
|
80
|
-
}
|
|
81
|
-
|
|
82
|
-
function shouldReplaceLaneRef(nextRef: string, currentRef: string | null, localBranches: Set<string>): boolean {
|
|
83
|
-
if (!currentRef) return true;
|
|
84
|
-
return isLocalRef(nextRef, localBranches) && !isLocalRef(currentRef, localBranches);
|
|
85
|
-
}
|
|
86
|
-
|
|
87
|
-
interface GenerateGraphOptions {
|
|
88
|
-
localBranches?: string[];
|
|
89
|
-
}
|
|
90
|
-
|
|
91
|
-
export function generateGraphData(commits: Commit[], options: GenerateGraphOptions = {}): GraphNode[] {
|
|
92
|
-
const nodes: GraphNode[] = [];
|
|
93
|
-
const localBranches = new Set(options.localBranches ?? []);
|
|
94
|
-
|
|
95
|
-
// Mapping of which commit hash is currently "expected" at the bottom of a lane.
|
|
96
|
-
// lanes[i] = "hash123" means lane i is drawing a line downwards towards hash123.
|
|
97
|
-
const lanes: (string | null)[] = [];
|
|
98
|
-
|
|
99
|
-
// Mapping of generic colors to lanes to keep consistency if possible
|
|
100
|
-
const laneColors: (string | undefined)[] = [];
|
|
101
|
-
const laneBranchRefs: (string | null)[] = [];
|
|
102
|
-
|
|
103
|
-
function getNextFreeLane(): number {
|
|
104
|
-
for (let i = 0; i < lanes.length; i++) {
|
|
105
|
-
if (lanes[i] === null) return i;
|
|
106
|
-
}
|
|
107
|
-
return lanes.length;
|
|
108
|
-
}
|
|
109
|
-
|
|
110
|
-
function getColor(lane: number): string {
|
|
111
|
-
const laneRef = laneBranchRefs[lane];
|
|
112
|
-
const preferredColor = laneRef ? getBranchGraphColor(laneRef) : (laneColors[lane] ?? getLaneFallbackColor(lane));
|
|
113
|
-
laneColors[lane] = preferredColor;
|
|
114
|
-
return preferredColor;
|
|
115
|
-
}
|
|
116
|
-
|
|
117
|
-
commits.forEach((commit, index) => {
|
|
118
|
-
// 1. Identify which lane this commit belongs to.
|
|
119
|
-
// It belongs to a lane if that lane is currently "looking for" this commit hash.
|
|
120
|
-
let lane = lanes.indexOf(commit.hash);
|
|
121
|
-
|
|
122
|
-
// If no lane is looking for me, I am a new tip (e.g. a branch head).
|
|
123
|
-
if (lane === -1) {
|
|
124
|
-
lane = getNextFreeLane();
|
|
125
|
-
}
|
|
126
|
-
|
|
127
|
-
// Ensure lanes array is large enough
|
|
128
|
-
while (lanes.length <= lane) {
|
|
129
|
-
lanes.push(null);
|
|
130
|
-
laneBranchRefs.push(null);
|
|
131
|
-
laneColors.push(undefined);
|
|
132
|
-
}
|
|
133
|
-
|
|
134
|
-
const preferredRef = choosePreferredRef(parseBranchRefs(commit.refs), localBranches);
|
|
135
|
-
if (preferredRef) {
|
|
136
|
-
const normalizedRef = normalizeRefForColor(preferredRef, localBranches);
|
|
137
|
-
if (shouldReplaceLaneRef(normalizedRef, laneBranchRefs[lane], localBranches)) {
|
|
138
|
-
laneBranchRefs[lane] = normalizedRef;
|
|
139
|
-
}
|
|
140
|
-
}
|
|
141
|
-
|
|
142
|
-
// Update color for this lane if needed (though getNextFreeLane usually finds one)
|
|
143
|
-
const color = getColor(lane);
|
|
144
|
-
|
|
145
|
-
// 2. Prepare the Node
|
|
146
|
-
const node: GraphNode = {
|
|
147
|
-
...commit,
|
|
148
|
-
x: lane,
|
|
149
|
-
y: index,
|
|
150
|
-
color,
|
|
151
|
-
paths: [],
|
|
152
|
-
isMerge: commit.parents.length > 1
|
|
153
|
-
};
|
|
154
|
-
|
|
155
|
-
// 3. Draw Vertical "Rails" for ALL other active lanes
|
|
156
|
-
// These are connections from (lane, index) to (lane, index+1)
|
|
157
|
-
// for branches that just "pass through" this row.
|
|
158
|
-
for (let i = 0; i < lanes.length; i++) {
|
|
159
|
-
if (i !== lane && lanes[i] !== null) {
|
|
160
|
-
node.paths.push({
|
|
161
|
-
x1: i, y1: index,
|
|
162
|
-
x2: i, y2: index + 1,
|
|
163
|
-
color: getColor(i),
|
|
164
|
-
type: 'straight'
|
|
165
|
-
});
|
|
166
|
-
}
|
|
167
|
-
}
|
|
168
|
-
|
|
169
|
-
// 4. Process Parents & Update Lanes for next row
|
|
170
|
-
// We are consuming 'lane' (it was pointing to us).
|
|
171
|
-
// Now we need lanes to point to our parents.
|
|
172
|
-
|
|
173
|
-
// Clear current lane (we reached the node)
|
|
174
|
-
lanes[lane] = null;
|
|
175
|
-
|
|
176
|
-
const parents = commit.parents;
|
|
177
|
-
|
|
178
|
-
if (parents.length > 0) {
|
|
179
|
-
// Parent 0 takes the current lane (usually)
|
|
180
|
-
const p0 = parents[0];
|
|
181
|
-
|
|
182
|
-
// Check if Parent 0 is ALREADY active in another lane?
|
|
183
|
-
// (e.g. two branches merging into p0, and we are the second one processing)
|
|
184
|
-
const existingP0Lane = lanes.indexOf(p0);
|
|
185
|
-
|
|
186
|
-
if (existingP0Lane !== -1) {
|
|
187
|
-
// Merge TO existing lane
|
|
188
|
-
node.paths.push({
|
|
189
|
-
x1: lane, y1: index,
|
|
190
|
-
x2: existingP0Lane, y2: index + 1,
|
|
191
|
-
color: color,
|
|
192
|
-
type: 'merge'
|
|
193
|
-
});
|
|
194
|
-
// We don't set lanes[lane] = p0, because p0 is already "owned" by existingP0Lane.
|
|
195
|
-
// This lane effectively ends (merges in).
|
|
196
|
-
} else {
|
|
197
|
-
// Standard continuation
|
|
198
|
-
lanes[lane] = p0;
|
|
199
|
-
node.paths.push({
|
|
200
|
-
x1: lane, y1: index,
|
|
201
|
-
x2: lane, y2: index + 1,
|
|
202
|
-
color: color,
|
|
203
|
-
type: 'straight'
|
|
204
|
-
});
|
|
205
|
-
}
|
|
206
|
-
|
|
207
|
-
// Other Parents (Merge Heads)
|
|
208
|
-
// Other Parents (Merge Heads)
|
|
209
|
-
for (let i = 1; i < parents.length; i++) {
|
|
210
|
-
const p = parents[i];
|
|
211
|
-
const existingPLane = lanes.indexOf(p);
|
|
212
|
-
|
|
213
|
-
if (existingPLane !== -1) {
|
|
214
|
-
// Merge to existing
|
|
215
|
-
node.paths.push({
|
|
216
|
-
x1: lane, y1: index,
|
|
217
|
-
x2: existingPLane, y2: index + 1,
|
|
218
|
-
color: getColor(existingPLane),
|
|
219
|
-
type: 'fork'
|
|
220
|
-
});
|
|
221
|
-
} else {
|
|
222
|
-
// New lane for this parent
|
|
223
|
-
const newLane = getNextFreeLane();
|
|
224
|
-
while (lanes.length <= newLane) {
|
|
225
|
-
lanes.push(null);
|
|
226
|
-
laneBranchRefs.push(null);
|
|
227
|
-
laneColors.push(undefined);
|
|
228
|
-
}
|
|
229
|
-
|
|
230
|
-
lanes[newLane] = p;
|
|
231
|
-
|
|
232
|
-
// Draw connection
|
|
233
|
-
node.paths.push({
|
|
234
|
-
x1: lane, y1: index,
|
|
235
|
-
x2: newLane, y2: index + 1,
|
|
236
|
-
color: getColor(newLane),
|
|
237
|
-
type: 'fork'
|
|
238
|
-
});
|
|
239
|
-
}
|
|
240
|
-
}
|
|
241
|
-
|
|
242
|
-
}
|
|
243
|
-
|
|
244
|
-
if (lanes[lane] === null) {
|
|
245
|
-
laneBranchRefs[lane] = null;
|
|
246
|
-
laneColors[lane] = undefined;
|
|
247
|
-
}
|
|
248
|
-
|
|
249
|
-
nodes.push(node);
|
|
250
|
-
});
|
|
251
|
-
|
|
252
|
-
return nodes;
|
|
253
|
-
}
|
package/src/lib/store.ts
DELETED
|
@@ -1,145 +0,0 @@
|
|
|
1
|
-
|
|
2
|
-
import fs from 'fs';
|
|
3
|
-
import os from 'os';
|
|
4
|
-
import path from 'path';
|
|
5
|
-
import { Repository, AppSettings } from './types';
|
|
6
|
-
|
|
7
|
-
// Get cross-platform app data directory
|
|
8
|
-
function getAppDataDir(): string {
|
|
9
|
-
const platform = process.platform;
|
|
10
|
-
const homeDir = os.homedir();
|
|
11
|
-
|
|
12
|
-
if (platform === 'win32') {
|
|
13
|
-
// Windows: %APPDATA%\trident
|
|
14
|
-
return path.join(process.env.APPDATA || path.join(homeDir, 'AppData', 'Roaming'), 'trident');
|
|
15
|
-
} else if (platform === 'darwin') {
|
|
16
|
-
// macOS: ~/Library/Application Support/trident
|
|
17
|
-
return path.join(homeDir, 'Library', 'Application Support', 'trident');
|
|
18
|
-
} else {
|
|
19
|
-
// Linux/others: ~/.config/trident
|
|
20
|
-
return path.join(process.env.XDG_CONFIG_HOME || path.join(homeDir, '.config'), 'trident');
|
|
21
|
-
}
|
|
22
|
-
}
|
|
23
|
-
|
|
24
|
-
// Store the list of known repositories in a shared app data directory.
|
|
25
|
-
// This allows all instances of the app to share the same repository list.
|
|
26
|
-
const DATA_DIR = getAppDataDir();
|
|
27
|
-
const DATA_FILE = path.join(DATA_DIR, 'repos.json');
|
|
28
|
-
|
|
29
|
-
// Ensure data directory exists
|
|
30
|
-
if (!fs.existsSync(DATA_DIR)) {
|
|
31
|
-
fs.mkdirSync(DATA_DIR, { recursive: true });
|
|
32
|
-
}
|
|
33
|
-
|
|
34
|
-
export function getRepositories(): Repository[] {
|
|
35
|
-
if (!fs.existsSync(DATA_FILE)) {
|
|
36
|
-
return [];
|
|
37
|
-
}
|
|
38
|
-
try {
|
|
39
|
-
const data = fs.readFileSync(DATA_FILE, 'utf-8');
|
|
40
|
-
return JSON.parse(data);
|
|
41
|
-
} catch (error) {
|
|
42
|
-
console.error('Failed to parse repos.json', error);
|
|
43
|
-
return [];
|
|
44
|
-
}
|
|
45
|
-
}
|
|
46
|
-
|
|
47
|
-
function normalizeDisplayName(displayName?: string | null): string | null | undefined {
|
|
48
|
-
if (displayName === undefined) return undefined;
|
|
49
|
-
if (displayName === null) return null;
|
|
50
|
-
const normalized = displayName.trim();
|
|
51
|
-
return normalized.length > 0 ? normalized : null;
|
|
52
|
-
}
|
|
53
|
-
|
|
54
|
-
export function addRepository(repoPath: string, name?: string, displayName?: string | null): Repository {
|
|
55
|
-
const repos = getRepositories();
|
|
56
|
-
// Check if exists
|
|
57
|
-
if (repos.find(r => r.path === repoPath)) {
|
|
58
|
-
throw new Error('Repository already exists');
|
|
59
|
-
}
|
|
60
|
-
|
|
61
|
-
const normalizedDisplayName = normalizeDisplayName(displayName);
|
|
62
|
-
const newRepo: Repository = {
|
|
63
|
-
path: repoPath,
|
|
64
|
-
name: name || path.basename(repoPath),
|
|
65
|
-
...(normalizedDisplayName ? { displayName: normalizedDisplayName } : {}),
|
|
66
|
-
};
|
|
67
|
-
|
|
68
|
-
repos.push(newRepo);
|
|
69
|
-
fs.writeFileSync(DATA_FILE, JSON.stringify(repos, null, 2));
|
|
70
|
-
return newRepo;
|
|
71
|
-
}
|
|
72
|
-
|
|
73
|
-
export function updateRepository(repoPath: string, updates: Partial<Repository>): Repository {
|
|
74
|
-
const repos = getRepositories();
|
|
75
|
-
const repoIndex = repos.findIndex(r => r.path === repoPath);
|
|
76
|
-
|
|
77
|
-
if (repoIndex === -1) {
|
|
78
|
-
throw new Error('Repository not found');
|
|
79
|
-
}
|
|
80
|
-
|
|
81
|
-
const normalizedUpdates: Partial<Repository> = { ...updates };
|
|
82
|
-
if ('displayName' in normalizedUpdates) {
|
|
83
|
-
normalizedUpdates.displayName = normalizeDisplayName(normalizedUpdates.displayName);
|
|
84
|
-
}
|
|
85
|
-
|
|
86
|
-
const updatedRepo = { ...repos[repoIndex], ...normalizedUpdates };
|
|
87
|
-
repos[repoIndex] = updatedRepo;
|
|
88
|
-
|
|
89
|
-
fs.writeFileSync(DATA_FILE, JSON.stringify(repos, null, 2));
|
|
90
|
-
return updatedRepo;
|
|
91
|
-
}
|
|
92
|
-
|
|
93
|
-
export function removeRepository(repoPath: string): void {
|
|
94
|
-
let repos = getRepositories();
|
|
95
|
-
repos = repos.filter(r => r.path !== repoPath);
|
|
96
|
-
fs.writeFileSync(DATA_FILE, JSON.stringify(repos, null, 2));
|
|
97
|
-
}
|
|
98
|
-
|
|
99
|
-
// Settings management
|
|
100
|
-
const SETTINGS_FILE = path.join(DATA_DIR, 'settings.json');
|
|
101
|
-
|
|
102
|
-
export function getSettings(): AppSettings {
|
|
103
|
-
const defaults: AppSettings = {
|
|
104
|
-
defaultRootFolder: null, // null means use user's home directory
|
|
105
|
-
sidebarCollapsed: false,
|
|
106
|
-
};
|
|
107
|
-
|
|
108
|
-
if (!fs.existsSync(SETTINGS_FILE)) {
|
|
109
|
-
return defaults;
|
|
110
|
-
}
|
|
111
|
-
|
|
112
|
-
try {
|
|
113
|
-
const data = fs.readFileSync(SETTINGS_FILE, 'utf-8');
|
|
114
|
-
const saved = JSON.parse(data);
|
|
115
|
-
return { ...defaults, ...saved };
|
|
116
|
-
} catch (error) {
|
|
117
|
-
console.error('Failed to parse settings.json', error);
|
|
118
|
-
return defaults;
|
|
119
|
-
}
|
|
120
|
-
}
|
|
121
|
-
|
|
122
|
-
export function updateSettings(updates: Partial<AppSettings>): AppSettings {
|
|
123
|
-
const current = getSettings();
|
|
124
|
-
const updated = { ...current, ...updates };
|
|
125
|
-
fs.writeFileSync(SETTINGS_FILE, JSON.stringify(updated, null, 2));
|
|
126
|
-
return updated;
|
|
127
|
-
}
|
|
128
|
-
|
|
129
|
-
export function getDefaultRootFolder(): string {
|
|
130
|
-
const settings = getSettings();
|
|
131
|
-
|
|
132
|
-
// If a default folder is set, check if it still exists
|
|
133
|
-
if (settings.defaultRootFolder) {
|
|
134
|
-
try {
|
|
135
|
-
if (fs.existsSync(settings.defaultRootFolder) && fs.statSync(settings.defaultRootFolder).isDirectory()) {
|
|
136
|
-
return settings.defaultRootFolder;
|
|
137
|
-
}
|
|
138
|
-
} catch {
|
|
139
|
-
// Folder doesn't exist or can't be accessed, fall back to home
|
|
140
|
-
}
|
|
141
|
-
}
|
|
142
|
-
|
|
143
|
-
// Fall back to user's home directory
|
|
144
|
-
return os.homedir();
|
|
145
|
-
}
|
package/src/lib/types.ts
DELETED
|
@@ -1,95 +0,0 @@
|
|
|
1
|
-
export type RepositoryCustomScriptTarget = 'branch';
|
|
2
|
-
export type RepositoryCustomScriptAction = 'run-bash-script';
|
|
3
|
-
|
|
4
|
-
export interface RepositoryCustomScript {
|
|
5
|
-
id: string;
|
|
6
|
-
name: string;
|
|
7
|
-
target: RepositoryCustomScriptTarget;
|
|
8
|
-
action: RepositoryCustomScriptAction;
|
|
9
|
-
content: string;
|
|
10
|
-
}
|
|
11
|
-
|
|
12
|
-
export interface Repository {
|
|
13
|
-
path: string;
|
|
14
|
-
name: string;
|
|
15
|
-
displayName?: string | null;
|
|
16
|
-
lastOpenedAt?: string;
|
|
17
|
-
credentialId?: string | null;
|
|
18
|
-
customScripts?: RepositoryCustomScript[];
|
|
19
|
-
expandedFolders?: string[];
|
|
20
|
-
visibilityMap?: Record<string, 'visible' | 'hidden'>;
|
|
21
|
-
localGroupExpanded?: boolean;
|
|
22
|
-
remotesGroupExpanded?: boolean;
|
|
23
|
-
}
|
|
24
|
-
|
|
25
|
-
export interface AppSettings {
|
|
26
|
-
defaultRootFolder: string | null;
|
|
27
|
-
sidebarCollapsed?: boolean;
|
|
28
|
-
historyPanelHeight?: number;
|
|
29
|
-
}
|
|
30
|
-
|
|
31
|
-
export interface DiffImageSide {
|
|
32
|
-
mimeType: string;
|
|
33
|
-
base64: string;
|
|
34
|
-
}
|
|
35
|
-
|
|
36
|
-
export interface DiffImage {
|
|
37
|
-
left: DiffImageSide | null;
|
|
38
|
-
right: DiffImageSide | null;
|
|
39
|
-
}
|
|
40
|
-
|
|
41
|
-
export interface FileDiffPayload {
|
|
42
|
-
diff: string;
|
|
43
|
-
left: string;
|
|
44
|
-
right: string;
|
|
45
|
-
imageDiff?: DiffImage | null;
|
|
46
|
-
}
|
|
47
|
-
|
|
48
|
-
export interface GitStatus {
|
|
49
|
-
current: string | null;
|
|
50
|
-
tracking: string | null;
|
|
51
|
-
ahead: number;
|
|
52
|
-
behind: number;
|
|
53
|
-
conflicted: string[];
|
|
54
|
-
created: string[];
|
|
55
|
-
deleted: string[];
|
|
56
|
-
modified: string[];
|
|
57
|
-
not_added: string[];
|
|
58
|
-
renamed: Array<{ from: string; to: string }>;
|
|
59
|
-
staged: string[];
|
|
60
|
-
files: GitFileStatus[];
|
|
61
|
-
}
|
|
62
|
-
|
|
63
|
-
export interface GitFileStatus {
|
|
64
|
-
path: string;
|
|
65
|
-
index: string;
|
|
66
|
-
working_dir: string;
|
|
67
|
-
}
|
|
68
|
-
|
|
69
|
-
export interface Commit {
|
|
70
|
-
hash: string;
|
|
71
|
-
date: string;
|
|
72
|
-
message: string;
|
|
73
|
-
refs: string;
|
|
74
|
-
body: string;
|
|
75
|
-
author_name: string;
|
|
76
|
-
author_email: string;
|
|
77
|
-
parents: string[];
|
|
78
|
-
}
|
|
79
|
-
|
|
80
|
-
export interface GitLog {
|
|
81
|
-
all: Commit[];
|
|
82
|
-
total: number;
|
|
83
|
-
latest: Commit | null;
|
|
84
|
-
}
|
|
85
|
-
|
|
86
|
-
export interface GitError extends Error {
|
|
87
|
-
status?: number;
|
|
88
|
-
}
|
|
89
|
-
|
|
90
|
-
export interface BranchTrackingInfo {
|
|
91
|
-
upstream: string;
|
|
92
|
-
ahead: number;
|
|
93
|
-
behind: number;
|
|
94
|
-
}
|
|
95
|
-
|