trident-git 0.2.0 → 0.2.1
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/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/i5Fy6fyWcq44ejS8h_y1c/_buildManifest.js +1 -0
- package/.next/static/i5Fy6fyWcq44ejS8h_y1c/_ssgManifest.js +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/package.json +7 -5
- 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
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
package/README.md
CHANGED
package/bin/trident-git.mjs
CHANGED
|
@@ -2,6 +2,7 @@
|
|
|
2
2
|
|
|
3
3
|
import { spawn } from "node:child_process";
|
|
4
4
|
import fs from "node:fs";
|
|
5
|
+
import { createRequire } from "node:module";
|
|
5
6
|
import net from "node:net";
|
|
6
7
|
import path from "node:path";
|
|
7
8
|
import { fileURLToPath } from "node:url";
|
|
@@ -9,7 +10,8 @@ import { fileURLToPath } from "node:url";
|
|
|
9
10
|
const __filename = fileURLToPath(import.meta.url);
|
|
10
11
|
const __dirname = path.dirname(__filename);
|
|
11
12
|
const APP_ROOT = path.resolve(__dirname, "..");
|
|
12
|
-
const
|
|
13
|
+
const require = createRequire(import.meta.url);
|
|
14
|
+
const NEXT_BIN = require.resolve("next/dist/bin/next");
|
|
13
15
|
const DEFAULT_PORT = 3100;
|
|
14
16
|
|
|
15
17
|
function printHelp() {
|
|
@@ -106,16 +108,12 @@ function runNext(args) {
|
|
|
106
108
|
});
|
|
107
109
|
}
|
|
108
110
|
|
|
109
|
-
|
|
111
|
+
function ensureBuildExists() {
|
|
110
112
|
const buildIdPath = path.join(APP_ROOT, ".next", "BUILD_ID");
|
|
111
|
-
if (fs.existsSync(buildIdPath)) {
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
console.log("No production build found. Building trident-git...");
|
|
116
|
-
const exitCode = await runNext(["build", "--webpack"]);
|
|
117
|
-
if (exitCode !== 0) {
|
|
118
|
-
process.exit(exitCode);
|
|
113
|
+
if (!fs.existsSync(buildIdPath)) {
|
|
114
|
+
throw new Error(
|
|
115
|
+
"No production build found in this package (.next/BUILD_ID is missing). The npm package must be published with prebuilt assets.",
|
|
116
|
+
);
|
|
119
117
|
}
|
|
120
118
|
}
|
|
121
119
|
|
|
@@ -140,7 +138,7 @@ async function main() {
|
|
|
140
138
|
process.exit(await runNext(["dev", "--webpack", "-p", String(port)]));
|
|
141
139
|
}
|
|
142
140
|
|
|
143
|
-
|
|
141
|
+
ensureBuildExists();
|
|
144
142
|
console.log(`Starting trident-git on http://localhost:${port}`);
|
|
145
143
|
process.exit(await runNext(["start", "-p", String(port)]));
|
|
146
144
|
} catch (error) {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "trident-git",
|
|
3
|
-
"version": "0.2.
|
|
3
|
+
"version": "0.2.1",
|
|
4
4
|
"private": false,
|
|
5
5
|
"description": "A modern, web-based Git client.",
|
|
6
6
|
"bin": {
|
|
@@ -8,17 +8,19 @@
|
|
|
8
8
|
},
|
|
9
9
|
"files": [
|
|
10
10
|
"bin",
|
|
11
|
-
"
|
|
11
|
+
".next/BUILD_ID",
|
|
12
|
+
".next/server",
|
|
13
|
+
".next/static",
|
|
14
|
+
".next/*.json",
|
|
15
|
+
".next/*.js",
|
|
12
16
|
"public",
|
|
13
17
|
"next.config.ts",
|
|
14
|
-
"postcss.config.mjs",
|
|
15
|
-
"tsconfig.json",
|
|
16
|
-
"eslint.config.mjs",
|
|
17
18
|
"README.md"
|
|
18
19
|
],
|
|
19
20
|
"scripts": {
|
|
20
21
|
"dev": "npx gfport 3100 -- next dev --webpack -p {PORT}",
|
|
21
22
|
"build": "next build --webpack",
|
|
23
|
+
"prepack": "rm -rf .next && npm run build",
|
|
22
24
|
"start": "next start -p 3100",
|
|
23
25
|
"lint": "eslint",
|
|
24
26
|
"cli": "node ./bin/trident-git.mjs",
|
package/eslint.config.mjs
DELETED
|
@@ -1,18 +0,0 @@
|
|
|
1
|
-
import { defineConfig, globalIgnores } from "eslint/config";
|
|
2
|
-
import nextVitals from "eslint-config-next/core-web-vitals";
|
|
3
|
-
import nextTs from "eslint-config-next/typescript";
|
|
4
|
-
|
|
5
|
-
const eslintConfig = defineConfig([
|
|
6
|
-
...nextVitals,
|
|
7
|
-
...nextTs,
|
|
8
|
-
// Override default ignores of eslint-config-next.
|
|
9
|
-
globalIgnores([
|
|
10
|
-
// Default ignores of eslint-config-next:
|
|
11
|
-
".next/**",
|
|
12
|
-
"out/**",
|
|
13
|
-
"build/**",
|
|
14
|
-
"next-env.d.ts",
|
|
15
|
-
]),
|
|
16
|
-
]);
|
|
17
|
-
|
|
18
|
-
export default eslintConfig;
|
package/postcss.config.mjs
DELETED
|
@@ -1,113 +0,0 @@
|
|
|
1
|
-
import { NextResponse } from 'next/server';
|
|
2
|
-
import { z } from 'zod';
|
|
3
|
-
import {
|
|
4
|
-
getAllCredentials,
|
|
5
|
-
createGitHubCredential,
|
|
6
|
-
createGitLabCredential,
|
|
7
|
-
updateCredential,
|
|
8
|
-
deleteCredential,
|
|
9
|
-
} from '@/lib/credentials';
|
|
10
|
-
|
|
11
|
-
// GET - List all credentials
|
|
12
|
-
export async function GET() {
|
|
13
|
-
try {
|
|
14
|
-
const credentials = await getAllCredentials();
|
|
15
|
-
return NextResponse.json(credentials);
|
|
16
|
-
} catch (error) {
|
|
17
|
-
console.error('Failed to get credentials:', error);
|
|
18
|
-
return NextResponse.json({ error: 'Failed to get credentials' }, { status: 500 });
|
|
19
|
-
}
|
|
20
|
-
}
|
|
21
|
-
|
|
22
|
-
// POST - Create a new credential
|
|
23
|
-
const createGitHubSchema = z.object({
|
|
24
|
-
type: z.literal('github'),
|
|
25
|
-
token: z.string().min(1, 'Token is required'),
|
|
26
|
-
});
|
|
27
|
-
|
|
28
|
-
const createGitLabSchema = z.object({
|
|
29
|
-
type: z.literal('gitlab'),
|
|
30
|
-
serverUrl: z.string().url('Invalid server URL'),
|
|
31
|
-
token: z.string().min(1, 'Token is required'),
|
|
32
|
-
});
|
|
33
|
-
|
|
34
|
-
const createSchema = z.discriminatedUnion('type', [createGitHubSchema, createGitLabSchema]);
|
|
35
|
-
|
|
36
|
-
export async function POST(request: Request) {
|
|
37
|
-
try {
|
|
38
|
-
const body = await request.json();
|
|
39
|
-
const data = createSchema.parse(body);
|
|
40
|
-
|
|
41
|
-
let result;
|
|
42
|
-
if (data.type === 'github') {
|
|
43
|
-
result = await createGitHubCredential(data.token);
|
|
44
|
-
} else {
|
|
45
|
-
result = await createGitLabCredential(data.serverUrl, data.token);
|
|
46
|
-
}
|
|
47
|
-
|
|
48
|
-
if (!result.success) {
|
|
49
|
-
return NextResponse.json({ error: result.error }, { status: 400 });
|
|
50
|
-
}
|
|
51
|
-
|
|
52
|
-
return NextResponse.json(result.credential);
|
|
53
|
-
} catch (error) {
|
|
54
|
-
if (error instanceof z.ZodError) {
|
|
55
|
-
return NextResponse.json({ error: error.issues[0].message }, { status: 400 });
|
|
56
|
-
}
|
|
57
|
-
console.error('Failed to create credential:', error);
|
|
58
|
-
return NextResponse.json({ error: 'Failed to create credential' }, { status: 500 });
|
|
59
|
-
}
|
|
60
|
-
}
|
|
61
|
-
|
|
62
|
-
// PUT - Update a credential
|
|
63
|
-
const updateSchema = z.object({
|
|
64
|
-
id: z.string().min(1, 'Credential ID is required'),
|
|
65
|
-
token: z.string().min(1, 'Token is required'),
|
|
66
|
-
});
|
|
67
|
-
|
|
68
|
-
export async function PUT(request: Request) {
|
|
69
|
-
try {
|
|
70
|
-
const body = await request.json();
|
|
71
|
-
const { id, token } = updateSchema.parse(body);
|
|
72
|
-
|
|
73
|
-
const result = await updateCredential(id, token);
|
|
74
|
-
|
|
75
|
-
if (!result.success) {
|
|
76
|
-
return NextResponse.json({ error: result.error }, { status: 400 });
|
|
77
|
-
}
|
|
78
|
-
|
|
79
|
-
return NextResponse.json(result.credential);
|
|
80
|
-
} catch (error) {
|
|
81
|
-
if (error instanceof z.ZodError) {
|
|
82
|
-
return NextResponse.json({ error: error.issues[0].message }, { status: 400 });
|
|
83
|
-
}
|
|
84
|
-
console.error('Failed to update credential:', error);
|
|
85
|
-
return NextResponse.json({ error: 'Failed to update credential' }, { status: 500 });
|
|
86
|
-
}
|
|
87
|
-
}
|
|
88
|
-
|
|
89
|
-
// DELETE - Delete a credential
|
|
90
|
-
const deleteSchema = z.object({
|
|
91
|
-
id: z.string().min(1, 'Credential ID is required'),
|
|
92
|
-
});
|
|
93
|
-
|
|
94
|
-
export async function DELETE(request: Request) {
|
|
95
|
-
try {
|
|
96
|
-
const body = await request.json();
|
|
97
|
-
const { id } = deleteSchema.parse(body);
|
|
98
|
-
|
|
99
|
-
const result = await deleteCredential(id);
|
|
100
|
-
|
|
101
|
-
if (!result.success) {
|
|
102
|
-
return NextResponse.json({ error: result.error }, { status: 400 });
|
|
103
|
-
}
|
|
104
|
-
|
|
105
|
-
return NextResponse.json({ success: true });
|
|
106
|
-
} catch (error) {
|
|
107
|
-
if (error instanceof z.ZodError) {
|
|
108
|
-
return NextResponse.json({ error: error.issues[0].message }, { status: 400 });
|
|
109
|
-
}
|
|
110
|
-
console.error('Failed to delete credential:', error);
|
|
111
|
-
return NextResponse.json({ error: 'Failed to delete credential' }, { status: 500 });
|
|
112
|
-
}
|
|
113
|
-
}
|
|
@@ -1,203 +0,0 @@
|
|
|
1
|
-
import { NextResponse } from 'next/server';
|
|
2
|
-
import { spawn, ChildProcessWithoutNullStreams } from 'node:child_process';
|
|
3
|
-
import fs from 'node:fs';
|
|
4
|
-
import { z } from 'zod';
|
|
5
|
-
import { GitService } from '@/lib/git';
|
|
6
|
-
|
|
7
|
-
export const runtime = 'nodejs';
|
|
8
|
-
|
|
9
|
-
type ExecutionStatus = 'running' | 'completed' | 'failed' | 'canceled';
|
|
10
|
-
|
|
11
|
-
interface ScriptExecution {
|
|
12
|
-
id: string;
|
|
13
|
-
status: ExecutionStatus;
|
|
14
|
-
cancelRequested: boolean;
|
|
15
|
-
output: string;
|
|
16
|
-
exitCode: number | null;
|
|
17
|
-
signal: NodeJS.Signals | null;
|
|
18
|
-
startedAt: string;
|
|
19
|
-
finishedAt: string | null;
|
|
20
|
-
process: ChildProcessWithoutNullStreams | null;
|
|
21
|
-
}
|
|
22
|
-
|
|
23
|
-
const executions = new Map<string, ScriptExecution>();
|
|
24
|
-
const MAX_OUTPUT_LENGTH = 500_000;
|
|
25
|
-
const FINISHED_EXECUTION_TTL_MS = 30 * 60 * 1000;
|
|
26
|
-
|
|
27
|
-
const startSchema = z.object({
|
|
28
|
-
command: z.literal('start'),
|
|
29
|
-
repoPath: z.string().min(1),
|
|
30
|
-
branchRef: z.string().min(1),
|
|
31
|
-
scriptContent: z.string(),
|
|
32
|
-
});
|
|
33
|
-
|
|
34
|
-
const statusSchema = z.object({
|
|
35
|
-
command: z.literal('status'),
|
|
36
|
-
executionId: z.string().min(1),
|
|
37
|
-
});
|
|
38
|
-
|
|
39
|
-
const cancelSchema = z.object({
|
|
40
|
-
command: z.literal('cancel'),
|
|
41
|
-
executionId: z.string().min(1),
|
|
42
|
-
});
|
|
43
|
-
|
|
44
|
-
const requestSchema = z.discriminatedUnion('command', [startSchema, statusSchema, cancelSchema]);
|
|
45
|
-
|
|
46
|
-
function normalizeBranchForCheckout(branchRef: string): string {
|
|
47
|
-
return branchRef.startsWith('remotes/') ? branchRef.slice('remotes/'.length) : branchRef;
|
|
48
|
-
}
|
|
49
|
-
|
|
50
|
-
function appendOutput(execution: ScriptExecution, text: string) {
|
|
51
|
-
execution.output += text;
|
|
52
|
-
if (execution.output.length > MAX_OUTPUT_LENGTH) {
|
|
53
|
-
execution.output = execution.output.slice(execution.output.length - MAX_OUTPUT_LENGTH);
|
|
54
|
-
}
|
|
55
|
-
}
|
|
56
|
-
|
|
57
|
-
function toResponsePayload(execution: ScriptExecution) {
|
|
58
|
-
return {
|
|
59
|
-
executionId: execution.id,
|
|
60
|
-
status: execution.status,
|
|
61
|
-
cancelRequested: execution.cancelRequested,
|
|
62
|
-
output: execution.output,
|
|
63
|
-
exitCode: execution.exitCode,
|
|
64
|
-
signal: execution.signal,
|
|
65
|
-
startedAt: execution.startedAt,
|
|
66
|
-
finishedAt: execution.finishedAt,
|
|
67
|
-
};
|
|
68
|
-
}
|
|
69
|
-
|
|
70
|
-
function cleanupFinishedExecutions() {
|
|
71
|
-
const now = Date.now();
|
|
72
|
-
for (const [id, execution] of executions.entries()) {
|
|
73
|
-
if (execution.status === 'running') continue;
|
|
74
|
-
if (!execution.finishedAt) continue;
|
|
75
|
-
const finishedAtMs = new Date(execution.finishedAt).getTime();
|
|
76
|
-
if (Number.isNaN(finishedAtMs)) continue;
|
|
77
|
-
if (now - finishedAtMs > FINISHED_EXECUTION_TTL_MS) {
|
|
78
|
-
executions.delete(id);
|
|
79
|
-
}
|
|
80
|
-
}
|
|
81
|
-
}
|
|
82
|
-
|
|
83
|
-
export async function POST(request: Request) {
|
|
84
|
-
try {
|
|
85
|
-
cleanupFinishedExecutions();
|
|
86
|
-
|
|
87
|
-
const body = await request.json();
|
|
88
|
-
const payload = requestSchema.parse(body);
|
|
89
|
-
|
|
90
|
-
if (payload.command === 'status') {
|
|
91
|
-
const execution = executions.get(payload.executionId);
|
|
92
|
-
if (!execution) {
|
|
93
|
-
return NextResponse.json({ error: 'Execution not found' }, { status: 404 });
|
|
94
|
-
}
|
|
95
|
-
|
|
96
|
-
return NextResponse.json({ success: true, ...toResponsePayload(execution) });
|
|
97
|
-
}
|
|
98
|
-
|
|
99
|
-
if (payload.command === 'cancel') {
|
|
100
|
-
const execution = executions.get(payload.executionId);
|
|
101
|
-
if (!execution) {
|
|
102
|
-
return NextResponse.json({ error: 'Execution not found' }, { status: 404 });
|
|
103
|
-
}
|
|
104
|
-
|
|
105
|
-
if (execution.status === 'running' && execution.process) {
|
|
106
|
-
execution.cancelRequested = true;
|
|
107
|
-
appendOutput(execution, '\n[info] Cancel requested...\n');
|
|
108
|
-
execution.process.kill('SIGTERM');
|
|
109
|
-
|
|
110
|
-
setTimeout(() => {
|
|
111
|
-
if (execution.process && execution.cancelRequested) {
|
|
112
|
-
execution.process.kill('SIGKILL');
|
|
113
|
-
}
|
|
114
|
-
}, 1500);
|
|
115
|
-
}
|
|
116
|
-
|
|
117
|
-
return NextResponse.json({ success: true, ...toResponsePayload(execution) });
|
|
118
|
-
}
|
|
119
|
-
|
|
120
|
-
const { repoPath, branchRef, scriptContent } = payload;
|
|
121
|
-
|
|
122
|
-
if (!fs.existsSync(repoPath)) {
|
|
123
|
-
return NextResponse.json({ error: `Path not found: ${repoPath}` }, { status: 404 });
|
|
124
|
-
}
|
|
125
|
-
|
|
126
|
-
if (!fs.statSync(repoPath).isDirectory()) {
|
|
127
|
-
return NextResponse.json({ error: 'Repository path must be a directory' }, { status: 400 });
|
|
128
|
-
}
|
|
129
|
-
|
|
130
|
-
const git = new GitService(repoPath);
|
|
131
|
-
const branches = await git.getBranches();
|
|
132
|
-
const checkoutBranch = normalizeBranchForCheckout(branchRef);
|
|
133
|
-
const currentBranch = branches.current;
|
|
134
|
-
|
|
135
|
-
if (!currentBranch || currentBranch !== checkoutBranch) {
|
|
136
|
-
await git.checkout(checkoutBranch);
|
|
137
|
-
}
|
|
138
|
-
|
|
139
|
-
const executionId = crypto.randomUUID();
|
|
140
|
-
const child = spawn('bash', ['-s'], {
|
|
141
|
-
cwd: repoPath,
|
|
142
|
-
env: process.env,
|
|
143
|
-
stdio: 'pipe',
|
|
144
|
-
});
|
|
145
|
-
|
|
146
|
-
const execution: ScriptExecution = {
|
|
147
|
-
id: executionId,
|
|
148
|
-
status: 'running',
|
|
149
|
-
cancelRequested: false,
|
|
150
|
-
output: '',
|
|
151
|
-
exitCode: null,
|
|
152
|
-
signal: null,
|
|
153
|
-
startedAt: new Date().toISOString(),
|
|
154
|
-
finishedAt: null,
|
|
155
|
-
process: child,
|
|
156
|
-
};
|
|
157
|
-
|
|
158
|
-
executions.set(executionId, execution);
|
|
159
|
-
|
|
160
|
-
const onData = (chunk: Buffer | string) => {
|
|
161
|
-
appendOutput(execution, typeof chunk === 'string' ? chunk : chunk.toString('utf-8'));
|
|
162
|
-
};
|
|
163
|
-
|
|
164
|
-
child.stdout.on('data', onData);
|
|
165
|
-
child.stderr.on('data', onData);
|
|
166
|
-
|
|
167
|
-
child.on('error', (error) => {
|
|
168
|
-
appendOutput(execution, `\n[error] ${error.message}\n`);
|
|
169
|
-
execution.status = execution.cancelRequested ? 'canceled' : 'failed';
|
|
170
|
-
execution.finishedAt = new Date().toISOString();
|
|
171
|
-
execution.process = null;
|
|
172
|
-
});
|
|
173
|
-
|
|
174
|
-
child.on('close', (code, signal) => {
|
|
175
|
-
execution.exitCode = code;
|
|
176
|
-
execution.signal = signal;
|
|
177
|
-
execution.finishedAt = new Date().toISOString();
|
|
178
|
-
execution.process = null;
|
|
179
|
-
|
|
180
|
-
if (execution.cancelRequested) {
|
|
181
|
-
execution.status = 'canceled';
|
|
182
|
-
return;
|
|
183
|
-
}
|
|
184
|
-
|
|
185
|
-
execution.status = code === 0 ? 'completed' : 'failed';
|
|
186
|
-
});
|
|
187
|
-
|
|
188
|
-
child.stdin.write(scriptContent);
|
|
189
|
-
child.stdin.end();
|
|
190
|
-
|
|
191
|
-
return NextResponse.json({
|
|
192
|
-
success: true,
|
|
193
|
-
...toResponsePayload(execution),
|
|
194
|
-
checkedOutBranch: checkoutBranch,
|
|
195
|
-
previousBranch: currentBranch,
|
|
196
|
-
});
|
|
197
|
-
} catch (error) {
|
|
198
|
-
if (error instanceof z.ZodError) {
|
|
199
|
-
return NextResponse.json({ error: error.issues }, { status: 400 });
|
|
200
|
-
}
|
|
201
|
-
return NextResponse.json({ error: (error as Error).message }, { status: 500 });
|
|
202
|
-
}
|
|
203
|
-
}
|
package/src/app/api/fs/route.ts
DELETED
|
@@ -1,75 +0,0 @@
|
|
|
1
|
-
import { NextResponse } from 'next/server';
|
|
2
|
-
import fs from 'fs';
|
|
3
|
-
import path from 'path';
|
|
4
|
-
import os from 'os';
|
|
5
|
-
|
|
6
|
-
export async function GET(request: Request) {
|
|
7
|
-
const { searchParams } = new URL(request.url);
|
|
8
|
-
const requestedPath = searchParams.get('path');
|
|
9
|
-
|
|
10
|
-
// Default to home directory
|
|
11
|
-
const currentPath = requestedPath ? requestedPath : os.homedir();
|
|
12
|
-
|
|
13
|
-
try {
|
|
14
|
-
// Security check: though this is local app, basic sanity check
|
|
15
|
-
// For now, allow reading anywhere as it's a dev tool/local tool.
|
|
16
|
-
|
|
17
|
-
const stats = await fs.promises.stat(currentPath);
|
|
18
|
-
if (!stats.isDirectory()) {
|
|
19
|
-
return NextResponse.json({ error: 'Not a directory' }, { status: 400 });
|
|
20
|
-
}
|
|
21
|
-
|
|
22
|
-
const items = await fs.promises.readdir(currentPath, { withFileTypes: true });
|
|
23
|
-
|
|
24
|
-
// Let's verify if they are git repos
|
|
25
|
-
const directories = items.filter(item => item.isDirectory());
|
|
26
|
-
|
|
27
|
-
const contents = [];
|
|
28
|
-
const BATCH_SIZE = 50;
|
|
29
|
-
|
|
30
|
-
for (let i = 0; i < directories.length; i += BATCH_SIZE) {
|
|
31
|
-
const batch = directories.slice(i, i + BATCH_SIZE);
|
|
32
|
-
const batchResults = await Promise.all(batch.map(async (item) => {
|
|
33
|
-
const itemPath = path.join(currentPath, item.name);
|
|
34
|
-
let isRepo = false;
|
|
35
|
-
try {
|
|
36
|
-
// Check for .git directory inside
|
|
37
|
-
await fs.promises.access(path.join(itemPath, '.git'), fs.constants.F_OK);
|
|
38
|
-
isRepo = true;
|
|
39
|
-
} catch (e) {}
|
|
40
|
-
|
|
41
|
-
return {
|
|
42
|
-
name: item.name,
|
|
43
|
-
path: itemPath,
|
|
44
|
-
isRepo
|
|
45
|
-
};
|
|
46
|
-
}));
|
|
47
|
-
contents.push(...batchResults);
|
|
48
|
-
}
|
|
49
|
-
|
|
50
|
-
// Sort: Visible folders first, then Repos first within that group, then alphabetical
|
|
51
|
-
contents.sort((a, b) => {
|
|
52
|
-
const aHidden = a.name.startsWith('.');
|
|
53
|
-
const bHidden = b.name.startsWith('.');
|
|
54
|
-
|
|
55
|
-
// Visible first
|
|
56
|
-
if (!aHidden && bHidden) return -1;
|
|
57
|
-
if (aHidden && !bHidden) return 1;
|
|
58
|
-
|
|
59
|
-
// Repos first
|
|
60
|
-
if (a.isRepo && !b.isRepo) return -1;
|
|
61
|
-
if (!a.isRepo && b.isRepo) return 1;
|
|
62
|
-
|
|
63
|
-
return a.name.localeCompare(b.name);
|
|
64
|
-
});
|
|
65
|
-
|
|
66
|
-
return NextResponse.json({
|
|
67
|
-
path: currentPath,
|
|
68
|
-
folders: contents,
|
|
69
|
-
parent: path.dirname(currentPath)
|
|
70
|
-
});
|
|
71
|
-
|
|
72
|
-
} catch (error) {
|
|
73
|
-
return NextResponse.json({ error: (error as Error).message }, { status: 500 });
|
|
74
|
-
}
|
|
75
|
-
}
|