@thevinci/web 1.0.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/README.md +197 -0
- package/bin/cli-entry.js +55 -0
- package/bin/cli-output.js +145 -0
- package/bin/cli.js +4887 -0
- package/bin/cli.test.js +64 -0
- package/dist/apple-touch-icon-120x120.png +0 -0
- package/dist/apple-touch-icon-152x152.png +0 -0
- package/dist/apple-touch-icon-167x167.png +0 -0
- package/dist/apple-touch-icon-180x180.png +0 -0
- package/dist/apple-touch-icon.png +0 -0
- package/dist/apple-touch-icon.svg +528 -0
- package/dist/assets/JsonTreeView-CSm9OzXG.js +1 -0
- package/dist/assets/KaTeX_AMS-Regular-BQhdFMY1.woff2 +0 -0
- package/dist/assets/KaTeX_AMS-Regular-DMm9YOAa.woff +0 -0
- package/dist/assets/KaTeX_AMS-Regular-DRggAlZN.ttf +0 -0
- package/dist/assets/KaTeX_Caligraphic-Bold-ATXxdsX0.ttf +0 -0
- package/dist/assets/KaTeX_Caligraphic-Bold-BEiXGLvX.woff +0 -0
- package/dist/assets/KaTeX_Caligraphic-Bold-Dq_IR9rO.woff2 +0 -0
- package/dist/assets/KaTeX_Caligraphic-Regular-CTRA-rTL.woff +0 -0
- package/dist/assets/KaTeX_Caligraphic-Regular-Di6jR-x-.woff2 +0 -0
- package/dist/assets/KaTeX_Caligraphic-Regular-wX97UBjC.ttf +0 -0
- package/dist/assets/KaTeX_Fraktur-Bold-BdnERNNW.ttf +0 -0
- package/dist/assets/KaTeX_Fraktur-Bold-BsDP51OF.woff +0 -0
- package/dist/assets/KaTeX_Fraktur-Bold-CL6g_b3V.woff2 +0 -0
- package/dist/assets/KaTeX_Fraktur-Regular-CB_wures.ttf +0 -0
- package/dist/assets/KaTeX_Fraktur-Regular-CTYiF6lA.woff2 +0 -0
- package/dist/assets/KaTeX_Fraktur-Regular-Dxdc4cR9.woff +0 -0
- package/dist/assets/KaTeX_Main-Bold-Cx986IdX.woff2 +0 -0
- package/dist/assets/KaTeX_Main-Bold-Jm3AIy58.woff +0 -0
- package/dist/assets/KaTeX_Main-Bold-waoOVXN0.ttf +0 -0
- package/dist/assets/KaTeX_Main-BoldItalic-DxDJ3AOS.woff2 +0 -0
- package/dist/assets/KaTeX_Main-BoldItalic-DzxPMmG6.ttf +0 -0
- package/dist/assets/KaTeX_Main-BoldItalic-SpSLRI95.woff +0 -0
- package/dist/assets/KaTeX_Main-Italic-3WenGoN9.ttf +0 -0
- package/dist/assets/KaTeX_Main-Italic-BMLOBm91.woff +0 -0
- package/dist/assets/KaTeX_Main-Italic-NWA7e6Wa.woff2 +0 -0
- package/dist/assets/KaTeX_Main-Regular-B22Nviop.woff2 +0 -0
- package/dist/assets/KaTeX_Main-Regular-Dr94JaBh.woff +0 -0
- package/dist/assets/KaTeX_Main-Regular-ypZvNtVU.ttf +0 -0
- package/dist/assets/KaTeX_Math-BoldItalic-B3XSjfu4.ttf +0 -0
- package/dist/assets/KaTeX_Math-BoldItalic-CZnvNsCZ.woff2 +0 -0
- package/dist/assets/KaTeX_Math-BoldItalic-iY-2wyZ7.woff +0 -0
- package/dist/assets/KaTeX_Math-Italic-DA0__PXp.woff +0 -0
- package/dist/assets/KaTeX_Math-Italic-flOr_0UB.ttf +0 -0
- package/dist/assets/KaTeX_Math-Italic-t53AETM-.woff2 +0 -0
- package/dist/assets/KaTeX_SansSerif-Bold-CFMepnvq.ttf +0 -0
- package/dist/assets/KaTeX_SansSerif-Bold-D1sUS0GD.woff2 +0 -0
- package/dist/assets/KaTeX_SansSerif-Bold-DbIhKOiC.woff +0 -0
- package/dist/assets/KaTeX_SansSerif-Italic-C3H0VqGB.woff2 +0 -0
- package/dist/assets/KaTeX_SansSerif-Italic-DN2j7dab.woff +0 -0
- package/dist/assets/KaTeX_SansSerif-Italic-YYjJ1zSn.ttf +0 -0
- package/dist/assets/KaTeX_SansSerif-Regular-BNo7hRIc.ttf +0 -0
- package/dist/assets/KaTeX_SansSerif-Regular-CS6fqUqJ.woff +0 -0
- package/dist/assets/KaTeX_SansSerif-Regular-DDBCnlJ7.woff2 +0 -0
- package/dist/assets/KaTeX_Script-Regular-C5JkGWo-.ttf +0 -0
- package/dist/assets/KaTeX_Script-Regular-D3wIWfF6.woff2 +0 -0
- package/dist/assets/KaTeX_Script-Regular-D5yQViql.woff +0 -0
- package/dist/assets/KaTeX_Size1-Regular-C195tn64.woff +0 -0
- package/dist/assets/KaTeX_Size1-Regular-Dbsnue_I.ttf +0 -0
- package/dist/assets/KaTeX_Size1-Regular-mCD8mA8B.woff2 +0 -0
- package/dist/assets/KaTeX_Size2-Regular-B7gKUWhC.ttf +0 -0
- package/dist/assets/KaTeX_Size2-Regular-Dy4dx90m.woff2 +0 -0
- package/dist/assets/KaTeX_Size2-Regular-oD1tc_U0.woff +0 -0
- package/dist/assets/KaTeX_Size3-Regular-CTq5MqoE.woff +0 -0
- package/dist/assets/KaTeX_Size3-Regular-DgpXs0kz.ttf +0 -0
- package/dist/assets/KaTeX_Size4-Regular-BF-4gkZK.woff +0 -0
- package/dist/assets/KaTeX_Size4-Regular-DWFBv043.ttf +0 -0
- package/dist/assets/KaTeX_Size4-Regular-Dl5lxZxV.woff2 +0 -0
- package/dist/assets/KaTeX_Typewriter-Regular-C0xS9mPB.woff +0 -0
- package/dist/assets/KaTeX_Typewriter-Regular-CO6r4hn1.woff2 +0 -0
- package/dist/assets/KaTeX_Typewriter-Regular-D3Ib7_Hf.ttf +0 -0
- package/dist/assets/MarkdownRendererImpl-DensKOLc.js +6 -0
- package/dist/assets/MultiRunWindow-Bo7THayo.js +1 -0
- package/dist/assets/OnboardingScreen-BDqmzTVR.js +2 -0
- package/dist/assets/SettingsWindow-coz__Ykw.js +1 -0
- package/dist/assets/TerminalView-DrZ-i3Dr.js +1 -0
- package/dist/assets/ToolOutputDialog-Eglzslt3.js +16 -0
- package/dist/assets/es-4o9ciP61.js +15 -0
- package/dist/assets/ibm-plex-mono-latin-400-normal-CvHOgSBP.woff +0 -0
- package/dist/assets/ibm-plex-mono-latin-400-normal-DMJ8VG8y.woff2 +0 -0
- package/dist/assets/ibm-plex-mono-latin-500-normal-CB9ihrfo.woff +0 -0
- package/dist/assets/ibm-plex-mono-latin-500-normal-DSY6xOcd.woff2 +0 -0
- package/dist/assets/ibm-plex-mono-latin-600-normal-BgSNZQsw.woff2 +0 -0
- package/dist/assets/ibm-plex-mono-latin-600-normal-DWFSQ4vo.woff +0 -0
- package/dist/assets/ibm-plex-sans-latin-400-normal-CDDApCn2.woff2 +0 -0
- package/dist/assets/ibm-plex-sans-latin-400-normal-CYLoc0-x.woff +0 -0
- package/dist/assets/ibm-plex-sans-latin-500-normal-6ng42L7E.woff2 +0 -0
- package/dist/assets/ibm-plex-sans-latin-500-normal-BgVn5rGT.woff +0 -0
- package/dist/assets/ibm-plex-sans-latin-600-normal-Cu4Hd6ag.woff +0 -0
- package/dist/assets/ibm-plex-sans-latin-600-normal-CuJfVYMP.woff2 +0 -0
- package/dist/assets/index-DLTDToSP.css +1 -0
- package/dist/assets/index-DgiFEKGN.js +1 -0
- package/dist/assets/ko-B20imCHE.js +15 -0
- package/dist/assets/main-BV3KOtdA.css +1 -0
- package/dist/assets/main-CDKJj0sH.js +226 -0
- package/dist/assets/main-LC-PSNVM.js +2 -0
- package/dist/assets/miniChat-CQUiG_cr.js +2 -0
- package/dist/assets/modelPrefsAutoSave-Dm799vzR.js +6986 -0
- package/dist/assets/pl-DQJ7LSzj.js +15 -0
- package/dist/assets/pt-BR-OmjHUz9y.js +15 -0
- package/dist/assets/renderElectronMiniChatApp-CARbeW0G.js +2 -0
- package/dist/assets/uk-BNFxOlO4.js +15 -0
- package/dist/assets/vendor--DBfsbEis.css +1 -0
- package/dist/assets/vendor-.bun-B9l0ZNi2.js +4094 -0
- package/dist/assets/wasm-CG6Dc4jp.js +1 -0
- package/dist/assets/wasmSttWorker-Dtlxac_K.js +1 -0
- package/dist/assets/wasmSttWorker-oo7Dm_jy.js +1806 -0
- package/dist/assets/worker-CbT6TVo7.js +155 -0
- package/dist/assets/zh-CN-C6T-Ac7F.js +15 -0
- package/dist/favicon-16.png +0 -0
- package/dist/favicon-32.png +0 -0
- package/dist/favicon.png +0 -0
- package/dist/favicon.svg +528 -0
- package/dist/index.html +607 -0
- package/dist/logo-dark-192x192.png +0 -0
- package/dist/logo-dark-512x512.png +0 -0
- package/dist/logo-dark-512x512.svg +528 -0
- package/dist/logo-light-192x192.png +0 -0
- package/dist/logo-light-512x512.png +0 -0
- package/dist/logo-light-512x512.svg +528 -0
- package/dist/mini-chat.html +16 -0
- package/dist/pwa-192.png +0 -0
- package/dist/pwa-512.png +0 -0
- package/dist/pwa-maskable-192.png +0 -0
- package/dist/pwa-maskable-512.png +0 -0
- package/dist/site.webmanifest +21 -0
- package/dist/sw.js +1 -0
- package/package.json +118 -0
- package/public/apple-touch-icon-120x120.png +0 -0
- package/public/apple-touch-icon-152x152.png +0 -0
- package/public/apple-touch-icon-167x167.png +0 -0
- package/public/apple-touch-icon-180x180.png +0 -0
- package/public/apple-touch-icon.png +0 -0
- package/public/apple-touch-icon.svg +528 -0
- package/public/favicon-16.png +0 -0
- package/public/favicon-32.png +0 -0
- package/public/favicon.png +0 -0
- package/public/favicon.svg +528 -0
- package/public/logo-dark-192x192.png +0 -0
- package/public/logo-dark-512x512.png +0 -0
- package/public/logo-dark-512x512.svg +528 -0
- package/public/logo-light-192x192.png +0 -0
- package/public/logo-light-512x512.png +0 -0
- package/public/logo-light-512x512.svg +528 -0
- package/public/pwa-192.png +0 -0
- package/public/pwa-512.png +0 -0
- package/public/pwa-maskable-192.png +0 -0
- package/public/pwa-maskable-512.png +0 -0
- package/public/site.webmanifest +21 -0
- package/server/TERMINAL_WS_PROTOCOL.md +48 -0
- package/server/index.d.ts +39 -0
- package/server/index.js +1311 -0
- package/server/lib/cloudflare-tunnel.js +650 -0
- package/server/lib/event-stream/DOCUMENTATION.md +61 -0
- package/server/lib/event-stream/directory-ws-bridge.js +185 -0
- package/server/lib/event-stream/global-hub.js +158 -0
- package/server/lib/event-stream/global-hub.test.js +140 -0
- package/server/lib/event-stream/global-ws-bridge.js +206 -0
- package/server/lib/event-stream/index.js +25 -0
- package/server/lib/event-stream/protocol.js +131 -0
- package/server/lib/event-stream/protocol.test.js +182 -0
- package/server/lib/event-stream/runtime.js +180 -0
- package/server/lib/event-stream/runtime.test.js +512 -0
- package/server/lib/event-stream/upstream-reader.js +226 -0
- package/server/lib/event-stream/upstream-reader.test.js +276 -0
- package/server/lib/fs/DOCUMENTATION.md +36 -0
- package/server/lib/fs/routes.js +1040 -0
- package/server/lib/fs/search.js +238 -0
- package/server/lib/git/DOCUMENTATION.md +152 -0
- package/server/lib/git/credentials.js +74 -0
- package/server/lib/git/identity-storage.js +112 -0
- package/server/lib/git/index.js +6 -0
- package/server/lib/git/routes.js +972 -0
- package/server/lib/git/service.js +3432 -0
- package/server/lib/git/service.test.js +39 -0
- package/server/lib/github/DOCUMENTATION.md +171 -0
- package/server/lib/github/auth.js +307 -0
- package/server/lib/github/device-flow.js +50 -0
- package/server/lib/github/index.js +24 -0
- package/server/lib/github/octokit.js +10 -0
- package/server/lib/github/pr-status.js +519 -0
- package/server/lib/github/repo/fork-detection.js +102 -0
- package/server/lib/github/repo/index.js +55 -0
- package/server/lib/github/routes.js +1560 -0
- package/server/lib/magic-prompts/routes.js +63 -0
- package/server/lib/magic-prompts/runtime.js +119 -0
- package/server/lib/notifications/DOCUMENTATION.md +122 -0
- package/server/lib/notifications/emitter-runtime.js +102 -0
- package/server/lib/notifications/index.js +4 -0
- package/server/lib/notifications/message.js +52 -0
- package/server/lib/notifications/message.test.js +34 -0
- package/server/lib/notifications/push-runtime.js +304 -0
- package/server/lib/notifications/routes.js +315 -0
- package/server/lib/notifications/runtime.js +566 -0
- package/server/lib/notifications/template-runtime.js +349 -0
- package/server/lib/notifications/template-runtime.test.js +26 -0
- package/server/lib/opencode/DOCUMENTATION.md +362 -0
- package/server/lib/opencode/agents.js +634 -0
- package/server/lib/opencode/auth-state-runtime.js +88 -0
- package/server/lib/opencode/auth.js +83 -0
- package/server/lib/opencode/bootstrap-runtime.js +131 -0
- package/server/lib/opencode/cli-entry-runtime.js +43 -0
- package/server/lib/opencode/cli-options.js +128 -0
- package/server/lib/opencode/commands.js +339 -0
- package/server/lib/opencode/config-entity-routes.js +370 -0
- package/server/lib/opencode/core-routes.js +500 -0
- package/server/lib/opencode/core-routes.test.js +26 -0
- package/server/lib/opencode/env-config.js +74 -0
- package/server/lib/opencode/env-keys.js +68 -0
- package/server/lib/opencode/env-runtime.js +1162 -0
- package/server/lib/opencode/env-runtime.test.js +116 -0
- package/server/lib/opencode/feature-routes-runtime.js +244 -0
- package/server/lib/opencode/hmr-state-runtime.js +85 -0
- package/server/lib/opencode/index.js +66 -0
- package/server/lib/opencode/lifecycle.js +1019 -0
- package/server/lib/opencode/lifecycle.test.js +240 -0
- package/server/lib/opencode/mcp.js +278 -0
- package/server/lib/opencode/network-runtime.js +104 -0
- package/server/lib/opencode/network-runtime.test.js +37 -0
- package/server/lib/opencode/opencode-resolution-runtime.js +71 -0
- package/server/lib/opencode/path-utils.js +100 -0
- package/server/lib/opencode/path-utils.test.js +71 -0
- package/server/lib/opencode/project-directory-runtime.js +124 -0
- package/server/lib/opencode/project-icon-routes.js +399 -0
- package/server/lib/opencode/project-icon-routes.test.js +107 -0
- package/server/lib/opencode/providers.js +96 -0
- package/server/lib/opencode/proxy.js +445 -0
- package/server/lib/opencode/pwa-manifest-routes.js +257 -0
- package/server/lib/opencode/pwa-manifest-routes.test.js +133 -0
- package/server/lib/opencode/routes.js +541 -0
- package/server/lib/opencode/server-startup-runtime.js +156 -0
- package/server/lib/opencode/server-utils-runtime.js +168 -0
- package/server/lib/opencode/server-utils-runtime.test.js +135 -0
- package/server/lib/opencode/session-runtime.js +356 -0
- package/server/lib/opencode/session-runtime.test.js +151 -0
- package/server/lib/opencode/settings-helpers.js +770 -0
- package/server/lib/opencode/settings-helpers.test.js +109 -0
- package/server/lib/opencode/settings-normalization-runtime.js +428 -0
- package/server/lib/opencode/settings-runtime.js +826 -0
- package/server/lib/opencode/settings-runtime.test.js +85 -0
- package/server/lib/opencode/shared.js +615 -0
- package/server/lib/opencode/shutdown-runtime.js +139 -0
- package/server/lib/opencode/shutdown-runtime.test.js +58 -0
- package/server/lib/opencode/skill-routes.js +701 -0
- package/server/lib/opencode/skills.js +548 -0
- package/server/lib/opencode/startup-pipeline-runtime.js +130 -0
- package/server/lib/opencode/static-routes-runtime.js +65 -0
- package/server/lib/opencode/theme-runtime.js +167 -0
- package/server/lib/opencode/tunnel-auth.js +591 -0
- package/server/lib/opencode/tunnel-wiring-runtime.js +94 -0
- package/server/lib/opencode/vinci-routes.js +76 -0
- package/server/lib/opencode/watcher.js +115 -0
- package/server/lib/opencode/watcher.test.js +239 -0
- package/server/lib/preview/proxy-runtime.js +1333 -0
- package/server/lib/preview/proxy-runtime.test.js +144 -0
- package/server/lib/projects/project-config.js +567 -0
- package/server/lib/projects/project-config.test.js +175 -0
- package/server/lib/projects/project-id.js +13 -0
- package/server/lib/quota/DOCUMENTATION.md +58 -0
- package/server/lib/quota/index.js +25 -0
- package/server/lib/quota/providers/claude.js +107 -0
- package/server/lib/quota/providers/codex.js +113 -0
- package/server/lib/quota/providers/copilot.js +165 -0
- package/server/lib/quota/providers/google/api.js +92 -0
- package/server/lib/quota/providers/google/auth.js +108 -0
- package/server/lib/quota/providers/google/index.js +124 -0
- package/server/lib/quota/providers/google/transforms.js +109 -0
- package/server/lib/quota/providers/index.js +168 -0
- package/server/lib/quota/providers/interface.js +55 -0
- package/server/lib/quota/providers/kimi.js +108 -0
- package/server/lib/quota/providers/minimax-cn-coding-plan.js +140 -0
- package/server/lib/quota/providers/minimax-coding-plan.js +139 -0
- package/server/lib/quota/providers/nanogpt.js +124 -0
- package/server/lib/quota/providers/ollama-cloud.js +112 -0
- package/server/lib/quota/providers/openai.js +91 -0
- package/server/lib/quota/providers/openrouter.js +92 -0
- package/server/lib/quota/providers/zai.js +91 -0
- package/server/lib/quota/providers/zhipuai-coding-plan.js +133 -0
- package/server/lib/quota/providers/zhipuai.js +114 -0
- package/server/lib/quota/routes.js +27 -0
- package/server/lib/quota/utils/auth.js +50 -0
- package/server/lib/quota/utils/formatters.js +85 -0
- package/server/lib/quota/utils/formatters.test.js +54 -0
- package/server/lib/quota/utils/index.js +10 -0
- package/server/lib/quota/utils/transformers.js +55 -0
- package/server/lib/scheduled-tasks/DOCUMENTATION.md +44 -0
- package/server/lib/scheduled-tasks/routes.js +235 -0
- package/server/lib/scheduled-tasks/runtime.js +773 -0
- package/server/lib/scheduled-tasks/runtime.test.js +100 -0
- package/server/lib/security/request-security.js +115 -0
- package/server/lib/session-folders/routes.js +63 -0
- package/server/lib/session-folders/routes.test.js +102 -0
- package/server/lib/skills-catalog/DOCUMENTATION.md +178 -0
- package/server/lib/skills-catalog/cache.js +29 -0
- package/server/lib/skills-catalog/clawdhub/api.js +158 -0
- package/server/lib/skills-catalog/clawdhub/index.js +30 -0
- package/server/lib/skills-catalog/clawdhub/install.js +238 -0
- package/server/lib/skills-catalog/clawdhub/scan.js +113 -0
- package/server/lib/skills-catalog/curated-sources.js +21 -0
- package/server/lib/skills-catalog/git.js +77 -0
- package/server/lib/skills-catalog/index.js +42 -0
- package/server/lib/skills-catalog/install.js +294 -0
- package/server/lib/skills-catalog/scan.js +221 -0
- package/server/lib/skills-catalog/source.js +87 -0
- package/server/lib/terminal/DOCUMENTATION.md +76 -0
- package/server/lib/terminal/index.js +31 -0
- package/server/lib/terminal/output-replay-buffer.js +78 -0
- package/server/lib/terminal/output-replay-buffer.test.js +75 -0
- package/server/lib/terminal/runtime.js +850 -0
- package/server/lib/terminal/runtime.test.js +96 -0
- package/server/lib/terminal/terminal-ws-protocol.js +68 -0
- package/server/lib/terminal/terminal-ws-protocol.test.js +145 -0
- package/server/lib/text/DOCUMENTATION.md +35 -0
- package/server/lib/text/summarization.js +138 -0
- package/server/lib/text/summarization.test.js +34 -0
- package/server/lib/tts/DOCUMENTATION.md +146 -0
- package/server/lib/tts/base-url.js +62 -0
- package/server/lib/tts/capability-runtime.js +31 -0
- package/server/lib/tts/index.js +19 -0
- package/server/lib/tts/routes.js +261 -0
- package/server/lib/tts/routes.test.js +53 -0
- package/server/lib/tts/service.js +178 -0
- package/server/lib/tts/stt.js +75 -0
- package/server/lib/tunnels/DOCUMENTATION.md +18 -0
- package/server/lib/tunnels/index.js +166 -0
- package/server/lib/tunnels/managed-config.js +201 -0
- package/server/lib/tunnels/providers/cloudflare.js +260 -0
- package/server/lib/tunnels/registry.js +51 -0
- package/server/lib/tunnels/routes.js +605 -0
- package/server/lib/tunnels/types.js +219 -0
- package/server/lib/ui-auth/DOCUMENTATION.md +38 -0
- package/server/lib/ui-auth/ui-auth.js +673 -0
- package/server/lib/ui-auth/ui-passkeys.js +545 -0
- package/server/opencode-proxy.test.js +151 -0
- package/server/proxy-headers.js +61 -0
- package/server/proxy-headers.test.js +58 -0
- package/server/sse-routes.test.js +152 -0
|
@@ -0,0 +1,972 @@
|
|
|
1
|
+
export function registerGitRoutes(app) {
|
|
2
|
+
let gitLibraries = null;
|
|
3
|
+
const getGitLibraries = async () => {
|
|
4
|
+
if (!gitLibraries) {
|
|
5
|
+
gitLibraries = await import('./index.js');
|
|
6
|
+
}
|
|
7
|
+
return gitLibraries;
|
|
8
|
+
};
|
|
9
|
+
|
|
10
|
+
app.get('/api/git/identities', async (req, res) => {
|
|
11
|
+
const { getProfiles } = await getGitLibraries();
|
|
12
|
+
try {
|
|
13
|
+
const profiles = getProfiles();
|
|
14
|
+
res.json(profiles);
|
|
15
|
+
} catch (error) {
|
|
16
|
+
console.error('Failed to list git identity profiles:', error);
|
|
17
|
+
res.status(500).json({ error: 'Failed to list git identity profiles' });
|
|
18
|
+
}
|
|
19
|
+
});
|
|
20
|
+
|
|
21
|
+
app.post('/api/git/identities', async (req, res) => {
|
|
22
|
+
const { createProfile } = await getGitLibraries();
|
|
23
|
+
try {
|
|
24
|
+
const profile = createProfile(req.body);
|
|
25
|
+
console.log(`Created git identity profile: ${profile.name} (${profile.id})`);
|
|
26
|
+
res.json(profile);
|
|
27
|
+
} catch (error) {
|
|
28
|
+
console.error('Failed to create git identity profile:', error);
|
|
29
|
+
res.status(400).json({ error: error.message || 'Failed to create git identity profile' });
|
|
30
|
+
}
|
|
31
|
+
});
|
|
32
|
+
|
|
33
|
+
app.put('/api/git/identities/:id', async (req, res) => {
|
|
34
|
+
const { updateProfile } = await getGitLibraries();
|
|
35
|
+
try {
|
|
36
|
+
const profile = updateProfile(req.params.id, req.body);
|
|
37
|
+
console.log(`Updated git identity profile: ${profile.name} (${profile.id})`);
|
|
38
|
+
res.json(profile);
|
|
39
|
+
} catch (error) {
|
|
40
|
+
console.error('Failed to update git identity profile:', error);
|
|
41
|
+
res.status(400).json({ error: error.message || 'Failed to update git identity profile' });
|
|
42
|
+
}
|
|
43
|
+
});
|
|
44
|
+
|
|
45
|
+
app.delete('/api/git/identities/:id', async (req, res) => {
|
|
46
|
+
const { deleteProfile } = await getGitLibraries();
|
|
47
|
+
try {
|
|
48
|
+
deleteProfile(req.params.id);
|
|
49
|
+
console.log(`Deleted git identity profile: ${req.params.id}`);
|
|
50
|
+
res.json({ success: true });
|
|
51
|
+
} catch (error) {
|
|
52
|
+
console.error('Failed to delete git identity profile:', error);
|
|
53
|
+
res.status(400).json({ error: error.message || 'Failed to delete git identity profile' });
|
|
54
|
+
}
|
|
55
|
+
});
|
|
56
|
+
|
|
57
|
+
app.get('/api/git/global-identity', async (req, res) => {
|
|
58
|
+
const { getGlobalIdentity } = await getGitLibraries();
|
|
59
|
+
try {
|
|
60
|
+
const identity = await getGlobalIdentity();
|
|
61
|
+
res.json(identity);
|
|
62
|
+
} catch (error) {
|
|
63
|
+
console.error('Failed to get global git identity:', error);
|
|
64
|
+
res.status(500).json({ error: 'Failed to get global git identity' });
|
|
65
|
+
}
|
|
66
|
+
});
|
|
67
|
+
|
|
68
|
+
app.get('/api/git/discover-credentials', async (req, res) => {
|
|
69
|
+
try {
|
|
70
|
+
const { discoverGitCredentials } = await import('./index.js');
|
|
71
|
+
const credentials = discoverGitCredentials();
|
|
72
|
+
res.json(credentials);
|
|
73
|
+
} catch (error) {
|
|
74
|
+
console.error('Failed to discover git credentials:', error);
|
|
75
|
+
res.status(500).json({ error: 'Failed to discover git credentials' });
|
|
76
|
+
}
|
|
77
|
+
});
|
|
78
|
+
|
|
79
|
+
app.get('/api/git/check', async (req, res) => {
|
|
80
|
+
const { isGitRepository } = await getGitLibraries();
|
|
81
|
+
try {
|
|
82
|
+
const directory = req.query.directory;
|
|
83
|
+
if (!directory) {
|
|
84
|
+
return res.status(400).json({ error: 'directory parameter is required' });
|
|
85
|
+
}
|
|
86
|
+
|
|
87
|
+
const isRepo = await isGitRepository(directory);
|
|
88
|
+
res.json({ isGitRepository: isRepo });
|
|
89
|
+
} catch (error) {
|
|
90
|
+
console.error('Failed to check git repository:', error);
|
|
91
|
+
res.status(500).json({ error: 'Failed to check git repository' });
|
|
92
|
+
}
|
|
93
|
+
});
|
|
94
|
+
|
|
95
|
+
app.get('/api/git/remote-url', async (req, res) => {
|
|
96
|
+
const { getRemoteUrl } = await getGitLibraries();
|
|
97
|
+
try {
|
|
98
|
+
const directory = req.query.directory;
|
|
99
|
+
if (!directory) {
|
|
100
|
+
return res.status(400).json({ error: 'directory parameter is required' });
|
|
101
|
+
}
|
|
102
|
+
const remote = req.query.remote || 'origin';
|
|
103
|
+
|
|
104
|
+
const url = await getRemoteUrl(directory, remote);
|
|
105
|
+
res.json({ url });
|
|
106
|
+
} catch (error) {
|
|
107
|
+
console.error('Failed to get remote url:', error);
|
|
108
|
+
res.status(500).json({ error: 'Failed to get remote url' });
|
|
109
|
+
}
|
|
110
|
+
});
|
|
111
|
+
|
|
112
|
+
app.get('/api/git/current-identity', async (req, res) => {
|
|
113
|
+
const { getCurrentIdentity } = await getGitLibraries();
|
|
114
|
+
try {
|
|
115
|
+
const directory = req.query.directory;
|
|
116
|
+
if (!directory) {
|
|
117
|
+
return res.status(400).json({ error: 'directory parameter is required' });
|
|
118
|
+
}
|
|
119
|
+
|
|
120
|
+
const identity = await getCurrentIdentity(directory);
|
|
121
|
+
res.json(identity);
|
|
122
|
+
} catch (error) {
|
|
123
|
+
console.error('Failed to get current git identity:', error);
|
|
124
|
+
res.status(500).json({ error: 'Failed to get current git identity' });
|
|
125
|
+
}
|
|
126
|
+
});
|
|
127
|
+
|
|
128
|
+
app.get('/api/git/has-local-identity', async (req, res) => {
|
|
129
|
+
const { hasLocalIdentity } = await getGitLibraries();
|
|
130
|
+
try {
|
|
131
|
+
const directory = req.query.directory;
|
|
132
|
+
if (!directory) {
|
|
133
|
+
return res.status(400).json({ error: 'directory parameter is required' });
|
|
134
|
+
}
|
|
135
|
+
|
|
136
|
+
const hasLocal = await hasLocalIdentity(directory);
|
|
137
|
+
res.json({ hasLocalIdentity: hasLocal });
|
|
138
|
+
} catch (error) {
|
|
139
|
+
console.error('Failed to check local git identity:', error);
|
|
140
|
+
res.status(500).json({ error: 'Failed to check local git identity' });
|
|
141
|
+
}
|
|
142
|
+
});
|
|
143
|
+
|
|
144
|
+
app.post('/api/git/set-identity', async (req, res) => {
|
|
145
|
+
const { getProfile, setLocalIdentity, getGlobalIdentity } = await getGitLibraries();
|
|
146
|
+
try {
|
|
147
|
+
const directory = req.query.directory;
|
|
148
|
+
if (!directory) {
|
|
149
|
+
return res.status(400).json({ error: 'directory parameter is required' });
|
|
150
|
+
}
|
|
151
|
+
|
|
152
|
+
const { profileId } = req.body;
|
|
153
|
+
if (!profileId) {
|
|
154
|
+
return res.status(400).json({ error: 'profileId is required' });
|
|
155
|
+
}
|
|
156
|
+
|
|
157
|
+
let profile = null;
|
|
158
|
+
|
|
159
|
+
if (profileId === 'global') {
|
|
160
|
+
const globalIdentity = await getGlobalIdentity();
|
|
161
|
+
if (!globalIdentity?.userName || !globalIdentity?.userEmail) {
|
|
162
|
+
return res.status(404).json({ error: 'Global identity is not configured' });
|
|
163
|
+
}
|
|
164
|
+
profile = {
|
|
165
|
+
id: 'global',
|
|
166
|
+
name: 'Global Identity',
|
|
167
|
+
userName: globalIdentity.userName,
|
|
168
|
+
userEmail: globalIdentity.userEmail,
|
|
169
|
+
sshKey: globalIdentity.sshCommand
|
|
170
|
+
? globalIdentity.sshCommand.replace('ssh -i ', '')
|
|
171
|
+
: null,
|
|
172
|
+
};
|
|
173
|
+
} else {
|
|
174
|
+
profile = getProfile(profileId);
|
|
175
|
+
if (!profile) {
|
|
176
|
+
return res.status(404).json({ error: 'Profile not found' });
|
|
177
|
+
}
|
|
178
|
+
}
|
|
179
|
+
|
|
180
|
+
await setLocalIdentity(directory, profile);
|
|
181
|
+
res.json({ success: true, profile });
|
|
182
|
+
} catch (error) {
|
|
183
|
+
console.error('Failed to set git identity:', error);
|
|
184
|
+
res.status(500).json({ error: error.message || 'Failed to set git identity' });
|
|
185
|
+
}
|
|
186
|
+
});
|
|
187
|
+
|
|
188
|
+
app.get('/api/git/status', async (req, res) => {
|
|
189
|
+
const { getStatus, isGitRepository } = await getGitLibraries();
|
|
190
|
+
|
|
191
|
+
const extractGitErrorText = (error) => {
|
|
192
|
+
const message = typeof error?.message === 'string' ? error.message : '';
|
|
193
|
+
const stderr = typeof error?.stderr === 'string' ? error.stderr : '';
|
|
194
|
+
const stdout = typeof error?.stdout === 'string' ? error.stdout : '';
|
|
195
|
+
return [message, stderr, stdout]
|
|
196
|
+
.map((value) => String(value || '').trim())
|
|
197
|
+
.filter(Boolean)
|
|
198
|
+
.join('\n');
|
|
199
|
+
};
|
|
200
|
+
|
|
201
|
+
try {
|
|
202
|
+
const directory = req.query.directory;
|
|
203
|
+
if (!directory) {
|
|
204
|
+
return res.status(400).json({ error: 'directory parameter is required' });
|
|
205
|
+
}
|
|
206
|
+
|
|
207
|
+
const isRepo = await isGitRepository(directory);
|
|
208
|
+
if (!isRepo) {
|
|
209
|
+
return res.json({ isGitRepository: false, files: [], branch: null, ahead: 0, behind: 0 });
|
|
210
|
+
}
|
|
211
|
+
|
|
212
|
+
const mode = req.query.mode === 'light' ? 'light' : undefined;
|
|
213
|
+
const status = await getStatus(directory, { mode });
|
|
214
|
+
res.json(status);
|
|
215
|
+
} catch (error) {
|
|
216
|
+
const errorText = extractGitErrorText(error);
|
|
217
|
+
if (/not a git repository/i.test(errorText)) {
|
|
218
|
+
return res.json({ isGitRepository: false, files: [], branch: null, ahead: 0, behind: 0 });
|
|
219
|
+
}
|
|
220
|
+
console.error('Failed to get git status:', error);
|
|
221
|
+
res.status(500).json({ error: error.message || 'Failed to get git status' });
|
|
222
|
+
}
|
|
223
|
+
});
|
|
224
|
+
|
|
225
|
+
app.get('/api/git/diff', async (req, res) => {
|
|
226
|
+
const { getDiff } = await getGitLibraries();
|
|
227
|
+
try {
|
|
228
|
+
const directory = req.query.directory;
|
|
229
|
+
if (!directory) {
|
|
230
|
+
return res.status(400).json({ error: 'directory parameter is required' });
|
|
231
|
+
}
|
|
232
|
+
|
|
233
|
+
const path = req.query.path;
|
|
234
|
+
if (!path || typeof path !== 'string') {
|
|
235
|
+
return res.status(400).json({ error: 'path parameter is required' });
|
|
236
|
+
}
|
|
237
|
+
|
|
238
|
+
const staged = req.query.staged === 'true';
|
|
239
|
+
const context = req.query.context ? parseInt(String(req.query.context), 10) : undefined;
|
|
240
|
+
|
|
241
|
+
const diff = await getDiff(directory, {
|
|
242
|
+
path,
|
|
243
|
+
staged,
|
|
244
|
+
contextLines: Number.isFinite(context) ? context : 3,
|
|
245
|
+
});
|
|
246
|
+
|
|
247
|
+
res.json({ diff });
|
|
248
|
+
} catch (error) {
|
|
249
|
+
console.error('Failed to get git diff:', error);
|
|
250
|
+
res.status(500).json({ error: error.message || 'Failed to get git diff' });
|
|
251
|
+
}
|
|
252
|
+
});
|
|
253
|
+
|
|
254
|
+
app.get('/api/git/file-diff', async (req, res) => {
|
|
255
|
+
const { getFileDiff } = await getGitLibraries();
|
|
256
|
+
try {
|
|
257
|
+
const directory = req.query.directory;
|
|
258
|
+
if (!directory || typeof directory !== 'string') {
|
|
259
|
+
return res.status(400).json({ error: 'directory parameter is required' });
|
|
260
|
+
}
|
|
261
|
+
|
|
262
|
+
const pathParam = req.query.path;
|
|
263
|
+
if (!pathParam || typeof pathParam !== 'string') {
|
|
264
|
+
return res.status(400).json({ error: 'path parameter is required' });
|
|
265
|
+
}
|
|
266
|
+
|
|
267
|
+
const staged = req.query.staged === 'true';
|
|
268
|
+
|
|
269
|
+
const result = await getFileDiff(directory, {
|
|
270
|
+
path: pathParam,
|
|
271
|
+
staged,
|
|
272
|
+
});
|
|
273
|
+
|
|
274
|
+
res.json({
|
|
275
|
+
original: result.original,
|
|
276
|
+
modified: result.modified,
|
|
277
|
+
path: result.path,
|
|
278
|
+
isBinary: Boolean(result.isBinary),
|
|
279
|
+
});
|
|
280
|
+
} catch (error) {
|
|
281
|
+
console.error('Failed to get git file diff:', error);
|
|
282
|
+
res.status(500).json({ error: error.message || 'Failed to get git file diff' });
|
|
283
|
+
}
|
|
284
|
+
});
|
|
285
|
+
|
|
286
|
+
app.post('/api/git/revert', async (req, res) => {
|
|
287
|
+
const { revertFile } = await getGitLibraries();
|
|
288
|
+
try {
|
|
289
|
+
const directory = req.query.directory;
|
|
290
|
+
if (!directory) {
|
|
291
|
+
return res.status(400).json({ error: 'directory parameter is required' });
|
|
292
|
+
}
|
|
293
|
+
|
|
294
|
+
const { path } = req.body || {};
|
|
295
|
+
if (!path || typeof path !== 'string') {
|
|
296
|
+
return res.status(400).json({ error: 'path parameter is required' });
|
|
297
|
+
}
|
|
298
|
+
|
|
299
|
+
await revertFile(directory, path);
|
|
300
|
+
res.json({ success: true });
|
|
301
|
+
} catch (error) {
|
|
302
|
+
console.error('Failed to revert git file:', error);
|
|
303
|
+
res.status(500).json({ error: error.message || 'Failed to revert git file' });
|
|
304
|
+
}
|
|
305
|
+
});
|
|
306
|
+
|
|
307
|
+
app.post('/api/git/pull', async (req, res) => {
|
|
308
|
+
const { pull } = await getGitLibraries();
|
|
309
|
+
try {
|
|
310
|
+
const directory = req.query.directory;
|
|
311
|
+
if (!directory) {
|
|
312
|
+
return res.status(400).json({ error: 'directory parameter is required' });
|
|
313
|
+
}
|
|
314
|
+
|
|
315
|
+
const result = await pull(directory, req.body);
|
|
316
|
+
res.json(result);
|
|
317
|
+
} catch (error) {
|
|
318
|
+
console.error('Failed to pull:', error);
|
|
319
|
+
res.status(500).json({ error: error.message || 'Failed to pull from remote' });
|
|
320
|
+
}
|
|
321
|
+
});
|
|
322
|
+
|
|
323
|
+
app.post('/api/git/push', async (req, res) => {
|
|
324
|
+
const { push } = await getGitLibraries();
|
|
325
|
+
try {
|
|
326
|
+
const directory = req.query.directory;
|
|
327
|
+
if (!directory) {
|
|
328
|
+
return res.status(400).json({ error: 'directory parameter is required' });
|
|
329
|
+
}
|
|
330
|
+
|
|
331
|
+
const result = await push(directory, req.body);
|
|
332
|
+
res.json(result);
|
|
333
|
+
} catch (error) {
|
|
334
|
+
console.error('Failed to push:', error);
|
|
335
|
+
res.status(500).json({ error: error.message || 'Failed to push to remote' });
|
|
336
|
+
}
|
|
337
|
+
});
|
|
338
|
+
|
|
339
|
+
app.get('/api/git/stashes', async (req, res) => {
|
|
340
|
+
const { listStashes } = await getGitLibraries();
|
|
341
|
+
try {
|
|
342
|
+
const directory = req.query.directory;
|
|
343
|
+
if (!directory) return res.status(400).json({ error: 'directory parameter is required' });
|
|
344
|
+
res.json({ stashes: await listStashes(directory) });
|
|
345
|
+
} catch (error) {
|
|
346
|
+
console.error('Failed to list stashes:', error);
|
|
347
|
+
res.status(500).json({ error: error.message || 'Failed to list stashes' });
|
|
348
|
+
}
|
|
349
|
+
});
|
|
350
|
+
|
|
351
|
+
app.post('/api/git/stashes/file-counts', async (req, res) => {
|
|
352
|
+
const { countStashFiles } = await getGitLibraries();
|
|
353
|
+
try {
|
|
354
|
+
const directory = req.query.directory;
|
|
355
|
+
if (!directory) return res.status(400).json({ error: 'directory parameter is required' });
|
|
356
|
+
res.json({ counts: await countStashFiles(directory, req.body?.refs) });
|
|
357
|
+
} catch (error) {
|
|
358
|
+
console.error('Failed to count stash files:', error);
|
|
359
|
+
res.status(500).json({ error: error.message || 'Failed to count stash files' });
|
|
360
|
+
}
|
|
361
|
+
});
|
|
362
|
+
|
|
363
|
+
app.post('/api/git/stash', async (req, res) => {
|
|
364
|
+
const { stashPush } = await getGitLibraries();
|
|
365
|
+
try {
|
|
366
|
+
const directory = req.query.directory;
|
|
367
|
+
if (!directory) return res.status(400).json({ error: 'directory parameter is required' });
|
|
368
|
+
res.json(await stashPush(directory, req.body));
|
|
369
|
+
} catch (error) {
|
|
370
|
+
console.error('Failed to stash changes:', error);
|
|
371
|
+
res.status(500).json({ error: error.message || 'Failed to stash changes' });
|
|
372
|
+
}
|
|
373
|
+
});
|
|
374
|
+
|
|
375
|
+
app.post('/api/git/stash/apply', async (req, res) => {
|
|
376
|
+
const { stashApply } = await getGitLibraries();
|
|
377
|
+
try {
|
|
378
|
+
const directory = req.query.directory;
|
|
379
|
+
if (!directory) return res.status(400).json({ error: 'directory parameter is required' });
|
|
380
|
+
res.json(await stashApply(directory, req.body));
|
|
381
|
+
} catch (error) {
|
|
382
|
+
console.error('Failed to apply stash:', error);
|
|
383
|
+
res.status(500).json({ error: error.message || 'Failed to apply stash' });
|
|
384
|
+
}
|
|
385
|
+
});
|
|
386
|
+
|
|
387
|
+
app.post('/api/git/stash/pop', async (req, res) => {
|
|
388
|
+
const { stashPop } = await getGitLibraries();
|
|
389
|
+
try {
|
|
390
|
+
const directory = req.query.directory;
|
|
391
|
+
if (!directory) return res.status(400).json({ error: 'directory parameter is required' });
|
|
392
|
+
res.json(await stashPop(directory, req.body));
|
|
393
|
+
} catch (error) {
|
|
394
|
+
console.error('Failed to pop stash:', error);
|
|
395
|
+
res.status(500).json({ error: error.message || 'Failed to pop stash' });
|
|
396
|
+
}
|
|
397
|
+
});
|
|
398
|
+
|
|
399
|
+
app.post('/api/git/stash/drop', async (req, res) => {
|
|
400
|
+
const { stashDrop } = await getGitLibraries();
|
|
401
|
+
try {
|
|
402
|
+
const directory = req.query.directory;
|
|
403
|
+
if (!directory) return res.status(400).json({ error: 'directory parameter is required' });
|
|
404
|
+
res.json(await stashDrop(directory, req.body));
|
|
405
|
+
} catch (error) {
|
|
406
|
+
console.error('Failed to drop stash:', error);
|
|
407
|
+
res.status(500).json({ error: error.message || 'Failed to drop stash' });
|
|
408
|
+
}
|
|
409
|
+
});
|
|
410
|
+
|
|
411
|
+
app.post('/api/git/fetch', async (req, res) => {
|
|
412
|
+
const { fetch: gitFetch } = await getGitLibraries();
|
|
413
|
+
try {
|
|
414
|
+
const directory = req.query.directory;
|
|
415
|
+
if (!directory) {
|
|
416
|
+
return res.status(400).json({ error: 'directory parameter is required' });
|
|
417
|
+
}
|
|
418
|
+
|
|
419
|
+
const result = await gitFetch(directory, req.body);
|
|
420
|
+
res.json(result);
|
|
421
|
+
} catch (error) {
|
|
422
|
+
console.error('Failed to fetch:', error);
|
|
423
|
+
res.status(500).json({ error: error.message || 'Failed to fetch from remote' });
|
|
424
|
+
}
|
|
425
|
+
});
|
|
426
|
+
|
|
427
|
+
app.get('/api/git/remotes', async (req, res) => {
|
|
428
|
+
const { getRemotes } = await getGitLibraries();
|
|
429
|
+
try {
|
|
430
|
+
const directory = req.query.directory;
|
|
431
|
+
if (!directory) {
|
|
432
|
+
return res.status(400).json({ error: 'directory parameter is required' });
|
|
433
|
+
}
|
|
434
|
+
|
|
435
|
+
const remotes = await getRemotes(directory);
|
|
436
|
+
res.json(remotes);
|
|
437
|
+
} catch (error) {
|
|
438
|
+
console.error('Failed to get remotes:', error);
|
|
439
|
+
res.status(500).json({ error: error.message || 'Failed to get remotes' });
|
|
440
|
+
}
|
|
441
|
+
});
|
|
442
|
+
|
|
443
|
+
app.delete('/api/git/remotes', async (req, res) => {
|
|
444
|
+
const { removeRemote } = await getGitLibraries();
|
|
445
|
+
try {
|
|
446
|
+
const directory = req.query.directory;
|
|
447
|
+
if (!directory) {
|
|
448
|
+
return res.status(400).json({ error: 'directory parameter is required' });
|
|
449
|
+
}
|
|
450
|
+
|
|
451
|
+
const remote = String(req.body?.remote || '').trim();
|
|
452
|
+
if (!remote) {
|
|
453
|
+
return res.status(400).json({ error: 'remote is required' });
|
|
454
|
+
}
|
|
455
|
+
|
|
456
|
+
const result = await removeRemote(directory, { remote });
|
|
457
|
+
res.json(result);
|
|
458
|
+
} catch (error) {
|
|
459
|
+
console.error('Failed to remove remote:', error);
|
|
460
|
+
res.status(500).json({ error: error.message || 'Failed to remove remote' });
|
|
461
|
+
}
|
|
462
|
+
});
|
|
463
|
+
|
|
464
|
+
app.post('/api/git/rebase', async (req, res) => {
|
|
465
|
+
const { rebase } = await getGitLibraries();
|
|
466
|
+
try {
|
|
467
|
+
const directory = req.query.directory;
|
|
468
|
+
if (!directory) {
|
|
469
|
+
return res.status(400).json({ error: 'directory parameter is required' });
|
|
470
|
+
}
|
|
471
|
+
|
|
472
|
+
const result = await rebase(directory, req.body);
|
|
473
|
+
res.json(result);
|
|
474
|
+
} catch (error) {
|
|
475
|
+
console.error('Failed to rebase:', error);
|
|
476
|
+
res.status(500).json({ error: error.message || 'Failed to rebase' });
|
|
477
|
+
}
|
|
478
|
+
});
|
|
479
|
+
|
|
480
|
+
app.post('/api/git/rebase/abort', async (req, res) => {
|
|
481
|
+
const { abortRebase } = await getGitLibraries();
|
|
482
|
+
try {
|
|
483
|
+
const directory = req.query.directory;
|
|
484
|
+
if (!directory) {
|
|
485
|
+
return res.status(400).json({ error: 'directory parameter is required' });
|
|
486
|
+
}
|
|
487
|
+
|
|
488
|
+
const result = await abortRebase(directory);
|
|
489
|
+
res.json(result);
|
|
490
|
+
} catch (error) {
|
|
491
|
+
console.error('Failed to abort rebase:', error);
|
|
492
|
+
res.status(500).json({ error: error.message || 'Failed to abort rebase' });
|
|
493
|
+
}
|
|
494
|
+
});
|
|
495
|
+
|
|
496
|
+
app.post('/api/git/merge', async (req, res) => {
|
|
497
|
+
const { merge } = await getGitLibraries();
|
|
498
|
+
try {
|
|
499
|
+
const directory = req.query.directory;
|
|
500
|
+
if (!directory) {
|
|
501
|
+
return res.status(400).json({ error: 'directory parameter is required' });
|
|
502
|
+
}
|
|
503
|
+
|
|
504
|
+
const result = await merge(directory, req.body);
|
|
505
|
+
res.json(result);
|
|
506
|
+
} catch (error) {
|
|
507
|
+
console.error('Failed to merge:', error);
|
|
508
|
+
res.status(500).json({ error: error.message || 'Failed to merge' });
|
|
509
|
+
}
|
|
510
|
+
});
|
|
511
|
+
|
|
512
|
+
app.post('/api/git/merge/abort', async (req, res) => {
|
|
513
|
+
const { abortMerge } = await getGitLibraries();
|
|
514
|
+
try {
|
|
515
|
+
const directory = req.query.directory;
|
|
516
|
+
if (!directory) {
|
|
517
|
+
return res.status(400).json({ error: 'directory parameter is required' });
|
|
518
|
+
}
|
|
519
|
+
|
|
520
|
+
const result = await abortMerge(directory);
|
|
521
|
+
res.json(result);
|
|
522
|
+
} catch (error) {
|
|
523
|
+
console.error('Failed to abort merge:', error);
|
|
524
|
+
res.status(500).json({ error: error.message || 'Failed to abort merge' });
|
|
525
|
+
}
|
|
526
|
+
});
|
|
527
|
+
|
|
528
|
+
app.post('/api/git/rebase/continue', async (req, res) => {
|
|
529
|
+
const { continueRebase } = await getGitLibraries();
|
|
530
|
+
try {
|
|
531
|
+
const directory = req.query.directory;
|
|
532
|
+
if (!directory) {
|
|
533
|
+
return res.status(400).json({ error: 'directory parameter is required' });
|
|
534
|
+
}
|
|
535
|
+
|
|
536
|
+
const result = await continueRebase(directory);
|
|
537
|
+
res.json(result);
|
|
538
|
+
} catch (error) {
|
|
539
|
+
console.error('Failed to continue rebase:', error);
|
|
540
|
+
res.status(500).json({ error: error.message || 'Failed to continue rebase' });
|
|
541
|
+
}
|
|
542
|
+
});
|
|
543
|
+
|
|
544
|
+
app.post('/api/git/merge/continue', async (req, res) => {
|
|
545
|
+
const { continueMerge } = await getGitLibraries();
|
|
546
|
+
try {
|
|
547
|
+
const directory = req.query.directory;
|
|
548
|
+
if (!directory) {
|
|
549
|
+
return res.status(400).json({ error: 'directory parameter is required' });
|
|
550
|
+
}
|
|
551
|
+
|
|
552
|
+
const result = await continueMerge(directory);
|
|
553
|
+
res.json(result);
|
|
554
|
+
} catch (error) {
|
|
555
|
+
console.error('Failed to continue merge:', error);
|
|
556
|
+
res.status(500).json({ error: error.message || 'Failed to continue merge' });
|
|
557
|
+
}
|
|
558
|
+
});
|
|
559
|
+
|
|
560
|
+
app.get('/api/git/conflict-details', async (req, res) => {
|
|
561
|
+
const { getConflictDetails } = await getGitLibraries();
|
|
562
|
+
try {
|
|
563
|
+
const directory = req.query.directory;
|
|
564
|
+
if (!directory) {
|
|
565
|
+
return res.status(400).json({ error: 'directory parameter is required' });
|
|
566
|
+
}
|
|
567
|
+
|
|
568
|
+
const result = await getConflictDetails(directory);
|
|
569
|
+
res.json(result);
|
|
570
|
+
} catch (error) {
|
|
571
|
+
console.error('Failed to get conflict details:', error);
|
|
572
|
+
res.status(500).json({ error: error.message || 'Failed to get conflict details' });
|
|
573
|
+
}
|
|
574
|
+
});
|
|
575
|
+
|
|
576
|
+
app.post('/api/git/commit', async (req, res) => {
|
|
577
|
+
const { commit } = await getGitLibraries();
|
|
578
|
+
try {
|
|
579
|
+
const directory = req.query.directory;
|
|
580
|
+
if (!directory) {
|
|
581
|
+
return res.status(400).json({ error: 'directory parameter is required' });
|
|
582
|
+
}
|
|
583
|
+
|
|
584
|
+
const { message, addAll, files } = req.body;
|
|
585
|
+
if (!message) {
|
|
586
|
+
return res.status(400).json({ error: 'message is required' });
|
|
587
|
+
}
|
|
588
|
+
|
|
589
|
+
const result = await commit(directory, message, {
|
|
590
|
+
addAll,
|
|
591
|
+
files,
|
|
592
|
+
});
|
|
593
|
+
res.json(result);
|
|
594
|
+
} catch (error) {
|
|
595
|
+
console.error('Failed to commit:', error);
|
|
596
|
+
res.status(500).json({ error: error.message || 'Failed to create commit' });
|
|
597
|
+
}
|
|
598
|
+
});
|
|
599
|
+
|
|
600
|
+
app.get('/api/git/branches', async (req, res) => {
|
|
601
|
+
const { getBranches } = await getGitLibraries();
|
|
602
|
+
try {
|
|
603
|
+
const directory = req.query.directory;
|
|
604
|
+
if (!directory) {
|
|
605
|
+
return res.status(400).json({ error: 'directory parameter is required' });
|
|
606
|
+
}
|
|
607
|
+
|
|
608
|
+
const branches = await getBranches(directory);
|
|
609
|
+
res.json(branches);
|
|
610
|
+
} catch (error) {
|
|
611
|
+
console.error('Failed to get branches:', error);
|
|
612
|
+
res.status(500).json({ error: error.message || 'Failed to get branches' });
|
|
613
|
+
}
|
|
614
|
+
});
|
|
615
|
+
|
|
616
|
+
app.post('/api/git/branches', async (req, res) => {
|
|
617
|
+
const { createBranch } = await getGitLibraries();
|
|
618
|
+
try {
|
|
619
|
+
const directory = req.query.directory;
|
|
620
|
+
if (!directory) {
|
|
621
|
+
return res.status(400).json({ error: 'directory parameter is required' });
|
|
622
|
+
}
|
|
623
|
+
|
|
624
|
+
const { name, startPoint } = req.body;
|
|
625
|
+
if (!name) {
|
|
626
|
+
return res.status(400).json({ error: 'name is required' });
|
|
627
|
+
}
|
|
628
|
+
|
|
629
|
+
const result = await createBranch(directory, name, { startPoint });
|
|
630
|
+
res.json(result);
|
|
631
|
+
} catch (error) {
|
|
632
|
+
console.error('Failed to create branch:', error);
|
|
633
|
+
res.status(500).json({ error: error.message || 'Failed to create branch' });
|
|
634
|
+
}
|
|
635
|
+
});
|
|
636
|
+
|
|
637
|
+
app.delete('/api/git/branches', async (req, res) => {
|
|
638
|
+
const { deleteBranch } = await getGitLibraries();
|
|
639
|
+
try {
|
|
640
|
+
const directory = req.query.directory;
|
|
641
|
+
if (!directory) {
|
|
642
|
+
return res.status(400).json({ error: 'directory parameter is required' });
|
|
643
|
+
}
|
|
644
|
+
|
|
645
|
+
const { branch, force } = req.body;
|
|
646
|
+
if (!branch) {
|
|
647
|
+
return res.status(400).json({ error: 'branch is required' });
|
|
648
|
+
}
|
|
649
|
+
|
|
650
|
+
const result = await deleteBranch(directory, branch, { force });
|
|
651
|
+
res.json(result);
|
|
652
|
+
} catch (error) {
|
|
653
|
+
console.error('Failed to delete branch:', error);
|
|
654
|
+
res.status(500).json({ error: error.message || 'Failed to delete branch' });
|
|
655
|
+
}
|
|
656
|
+
});
|
|
657
|
+
|
|
658
|
+
|
|
659
|
+
app.put('/api/git/branches/rename', async (req, res) => {
|
|
660
|
+
const { renameBranch } = await getGitLibraries();
|
|
661
|
+
try {
|
|
662
|
+
const directory = req.query.directory;
|
|
663
|
+
if (!directory) {
|
|
664
|
+
return res.status(400).json({ error: 'directory parameter is required' });
|
|
665
|
+
}
|
|
666
|
+
|
|
667
|
+
const { oldName, newName } = req.body;
|
|
668
|
+
if (!oldName) {
|
|
669
|
+
return res.status(400).json({ error: 'oldName is required' });
|
|
670
|
+
}
|
|
671
|
+
if (!newName) {
|
|
672
|
+
return res.status(400).json({ error: 'newName is required' });
|
|
673
|
+
}
|
|
674
|
+
|
|
675
|
+
const result = await renameBranch(directory, oldName, newName);
|
|
676
|
+
res.json(result);
|
|
677
|
+
} catch (error) {
|
|
678
|
+
console.error('Failed to rename branch:', error);
|
|
679
|
+
res.status(500).json({ error: error.message || 'Failed to rename branch' });
|
|
680
|
+
}
|
|
681
|
+
});
|
|
682
|
+
app.delete('/api/git/remote-branches', async (req, res) => {
|
|
683
|
+
const { deleteRemoteBranch } = await getGitLibraries();
|
|
684
|
+
try {
|
|
685
|
+
const directory = req.query.directory;
|
|
686
|
+
if (!directory) {
|
|
687
|
+
return res.status(400).json({ error: 'directory parameter is required' });
|
|
688
|
+
}
|
|
689
|
+
|
|
690
|
+
const { branch, remote } = req.body;
|
|
691
|
+
if (!branch) {
|
|
692
|
+
return res.status(400).json({ error: 'branch is required' });
|
|
693
|
+
}
|
|
694
|
+
|
|
695
|
+
const result = await deleteRemoteBranch(directory, { branch, remote });
|
|
696
|
+
res.json(result);
|
|
697
|
+
} catch (error) {
|
|
698
|
+
console.error('Failed to delete remote branch:', error);
|
|
699
|
+
res.status(500).json({ error: error.message || 'Failed to delete remote branch' });
|
|
700
|
+
}
|
|
701
|
+
});
|
|
702
|
+
|
|
703
|
+
app.post('/api/git/checkout', async (req, res) => {
|
|
704
|
+
const { checkoutBranch } = await getGitLibraries();
|
|
705
|
+
try {
|
|
706
|
+
const directory = req.query.directory;
|
|
707
|
+
if (!directory) {
|
|
708
|
+
return res.status(400).json({ error: 'directory parameter is required' });
|
|
709
|
+
}
|
|
710
|
+
|
|
711
|
+
const { branch } = req.body;
|
|
712
|
+
if (!branch) {
|
|
713
|
+
return res.status(400).json({ error: 'branch is required' });
|
|
714
|
+
}
|
|
715
|
+
|
|
716
|
+
const result = await checkoutBranch(directory, branch);
|
|
717
|
+
res.json(result);
|
|
718
|
+
} catch (error) {
|
|
719
|
+
console.error('Failed to checkout branch:', error);
|
|
720
|
+
res.status(500).json({ error: error.message || 'Failed to checkout branch' });
|
|
721
|
+
}
|
|
722
|
+
});
|
|
723
|
+
|
|
724
|
+
app.get('/api/git/worktrees', async (req, res) => {
|
|
725
|
+
const { getWorktrees } = await getGitLibraries();
|
|
726
|
+
try {
|
|
727
|
+
const directory = req.query.directory;
|
|
728
|
+
if (!directory) {
|
|
729
|
+
return res.status(400).json({ error: 'directory parameter is required' });
|
|
730
|
+
}
|
|
731
|
+
|
|
732
|
+
const worktrees = await getWorktrees(directory);
|
|
733
|
+
res.json(worktrees);
|
|
734
|
+
} catch (error) {
|
|
735
|
+
// Worktrees are an optional feature. Avoid repeated 500s (and repeated client retries)
|
|
736
|
+
// when the directory isn't a git repo or uses shell shorthand like "~/".
|
|
737
|
+
console.warn('Failed to get worktrees, returning empty list:', error?.message || error);
|
|
738
|
+
res.setHeader('X-Vinci-Warning', 'git worktrees unavailable');
|
|
739
|
+
res.json([]);
|
|
740
|
+
}
|
|
741
|
+
});
|
|
742
|
+
|
|
743
|
+
app.post('/api/git/worktrees/validate', async (req, res) => {
|
|
744
|
+
const { validateWorktreeCreate } = await getGitLibraries();
|
|
745
|
+
if (typeof validateWorktreeCreate !== 'function') {
|
|
746
|
+
return res.status(501).json({ error: 'Worktree validation is not available' });
|
|
747
|
+
}
|
|
748
|
+
|
|
749
|
+
try {
|
|
750
|
+
const directory = req.query.directory;
|
|
751
|
+
if (!directory || typeof directory !== 'string') {
|
|
752
|
+
return res.status(400).json({ error: 'directory parameter is required' });
|
|
753
|
+
}
|
|
754
|
+
|
|
755
|
+
const result = await validateWorktreeCreate(directory, req.body || {});
|
|
756
|
+
res.json(result);
|
|
757
|
+
} catch (error) {
|
|
758
|
+
console.error('Failed to validate worktree creation:', error);
|
|
759
|
+
res.status(500).json({ error: error.message || 'Failed to validate worktree creation' });
|
|
760
|
+
}
|
|
761
|
+
});
|
|
762
|
+
|
|
763
|
+
app.post('/api/git/worktrees', async (req, res) => {
|
|
764
|
+
const { createWorktree } = await getGitLibraries();
|
|
765
|
+
if (typeof createWorktree !== 'function') {
|
|
766
|
+
return res.status(501).json({ error: 'Worktree creation is not available' });
|
|
767
|
+
}
|
|
768
|
+
|
|
769
|
+
try {
|
|
770
|
+
const directory = req.query.directory;
|
|
771
|
+
if (!directory || typeof directory !== 'string') {
|
|
772
|
+
return res.status(400).json({ error: 'directory parameter is required' });
|
|
773
|
+
}
|
|
774
|
+
|
|
775
|
+
const created = await createWorktree(directory, req.body || {});
|
|
776
|
+
res.json(created);
|
|
777
|
+
} catch (error) {
|
|
778
|
+
console.error('Failed to create worktree:', error);
|
|
779
|
+
res.status(500).json({ error: error.message || 'Failed to create worktree' });
|
|
780
|
+
}
|
|
781
|
+
});
|
|
782
|
+
|
|
783
|
+
app.post('/api/git/worktrees/preview', async (req, res) => {
|
|
784
|
+
const { previewWorktreeCreate } = await getGitLibraries();
|
|
785
|
+
if (typeof previewWorktreeCreate !== 'function') {
|
|
786
|
+
return res.status(501).json({ error: 'Worktree preview is not available' });
|
|
787
|
+
}
|
|
788
|
+
|
|
789
|
+
try {
|
|
790
|
+
const directory = req.query.directory;
|
|
791
|
+
if (!directory || typeof directory !== 'string') {
|
|
792
|
+
return res.status(400).json({ error: 'directory parameter is required' });
|
|
793
|
+
}
|
|
794
|
+
|
|
795
|
+
const preview = await previewWorktreeCreate(directory, req.body || {});
|
|
796
|
+
res.json(preview);
|
|
797
|
+
} catch (error) {
|
|
798
|
+
console.error('Failed to preview worktree:', error);
|
|
799
|
+
res.status(500).json({ error: error.message || 'Failed to preview worktree' });
|
|
800
|
+
}
|
|
801
|
+
});
|
|
802
|
+
|
|
803
|
+
app.get('/api/git/worktrees/bootstrap-status', async (req, res) => {
|
|
804
|
+
const { getWorktreeBootstrapStatus } = await getGitLibraries();
|
|
805
|
+
if (typeof getWorktreeBootstrapStatus !== 'function') {
|
|
806
|
+
return res.status(501).json({ error: 'Worktree bootstrap status is not available' });
|
|
807
|
+
}
|
|
808
|
+
|
|
809
|
+
try {
|
|
810
|
+
const directory = req.query.directory;
|
|
811
|
+
if (!directory || typeof directory !== 'string') {
|
|
812
|
+
return res.status(400).json({ error: 'directory parameter is required' });
|
|
813
|
+
}
|
|
814
|
+
|
|
815
|
+
const status = await getWorktreeBootstrapStatus(directory);
|
|
816
|
+
res.json(status);
|
|
817
|
+
} catch (error) {
|
|
818
|
+
console.error('Failed to get worktree bootstrap status:', error);
|
|
819
|
+
res.status(500).json({ error: error.message || 'Failed to get worktree bootstrap status' });
|
|
820
|
+
}
|
|
821
|
+
});
|
|
822
|
+
|
|
823
|
+
app.delete('/api/git/worktrees', async (req, res) => {
|
|
824
|
+
const { removeWorktree } = await getGitLibraries();
|
|
825
|
+
if (typeof removeWorktree !== 'function') {
|
|
826
|
+
return res.status(501).json({ error: 'Worktree removal is not available' });
|
|
827
|
+
}
|
|
828
|
+
|
|
829
|
+
try {
|
|
830
|
+
const directory = req.query.directory;
|
|
831
|
+
if (!directory || typeof directory !== 'string') {
|
|
832
|
+
return res.status(400).json({ error: 'directory parameter is required' });
|
|
833
|
+
}
|
|
834
|
+
|
|
835
|
+
const worktreeDirectory = typeof req.body?.directory === 'string' ? req.body.directory : '';
|
|
836
|
+
if (!worktreeDirectory) {
|
|
837
|
+
return res.status(400).json({ error: 'worktree directory is required' });
|
|
838
|
+
}
|
|
839
|
+
|
|
840
|
+
const result = await removeWorktree(directory, {
|
|
841
|
+
directory: worktreeDirectory,
|
|
842
|
+
deleteLocalBranch: req.body?.deleteLocalBranch === true,
|
|
843
|
+
});
|
|
844
|
+
res.json({ success: Boolean(result) });
|
|
845
|
+
} catch (error) {
|
|
846
|
+
console.error('Failed to remove worktree:', error);
|
|
847
|
+
res.status(500).json({ error: error.message || 'Failed to remove worktree' });
|
|
848
|
+
}
|
|
849
|
+
});
|
|
850
|
+
|
|
851
|
+
app.get('/api/git/worktree-type', async (req, res) => {
|
|
852
|
+
const { isLinkedWorktree } = await getGitLibraries();
|
|
853
|
+
try {
|
|
854
|
+
const { directory } = req.query;
|
|
855
|
+
if (!directory || typeof directory !== 'string') {
|
|
856
|
+
return res.status(400).json({ error: 'directory parameter is required' });
|
|
857
|
+
}
|
|
858
|
+
const linked = await isLinkedWorktree(directory);
|
|
859
|
+
res.json({ linked });
|
|
860
|
+
} catch (error) {
|
|
861
|
+
console.error('Failed to determine worktree type:', error);
|
|
862
|
+
res.status(500).json({ error: error.message || 'Failed to determine worktree type' });
|
|
863
|
+
}
|
|
864
|
+
});
|
|
865
|
+
|
|
866
|
+
app.post('/api/git/validate-directory', async (req, res) => {
|
|
867
|
+
const { validateWorktreeDirectory } = await getGitLibraries();
|
|
868
|
+
if (typeof validateWorktreeDirectory !== 'function') {
|
|
869
|
+
return res.status(501).json({ error: 'validateWorktreeDirectory is not available' });
|
|
870
|
+
}
|
|
871
|
+
try {
|
|
872
|
+
const { directory, worktreeRoot } = req.body || {};
|
|
873
|
+
if (!directory || typeof directory !== 'string') {
|
|
874
|
+
return res.status(400).json({ error: 'directory is required' });
|
|
875
|
+
}
|
|
876
|
+
if (!worktreeRoot || typeof worktreeRoot !== 'string') {
|
|
877
|
+
return res.status(400).json({ error: 'worktreeRoot is required' });
|
|
878
|
+
}
|
|
879
|
+
const result = await validateWorktreeDirectory(directory, worktreeRoot);
|
|
880
|
+
res.json(result);
|
|
881
|
+
} catch (error) {
|
|
882
|
+
console.error('Failed to validate worktree directory:', error);
|
|
883
|
+
res.status(500).json({ error: error.message || 'Failed to validate worktree directory' });
|
|
884
|
+
}
|
|
885
|
+
});
|
|
886
|
+
|
|
887
|
+
app.post('/api/git/canonicalize-worktree-state', async (req, res) => {
|
|
888
|
+
const { canonicalizeWorktreeState } = await getGitLibraries();
|
|
889
|
+
if (typeof canonicalizeWorktreeState !== 'function') {
|
|
890
|
+
return res.status(501).json({ error: 'canonicalizeWorktreeState is not available' });
|
|
891
|
+
}
|
|
892
|
+
try {
|
|
893
|
+
const { directory } = req.body || {};
|
|
894
|
+
if (!directory || typeof directory !== 'string') {
|
|
895
|
+
return res.status(400).json({ error: 'directory is required' });
|
|
896
|
+
}
|
|
897
|
+
const result = await canonicalizeWorktreeState(directory);
|
|
898
|
+
res.json(result);
|
|
899
|
+
} catch (error) {
|
|
900
|
+
console.error('Failed to canonicalize worktree state:', error);
|
|
901
|
+
res.status(500).json({ error: error.message || 'Failed to canonicalize worktree state' });
|
|
902
|
+
}
|
|
903
|
+
});
|
|
904
|
+
|
|
905
|
+
app.get('/api/git/log', async (req, res) => {
|
|
906
|
+
const { getLog } = await getGitLibraries();
|
|
907
|
+
try {
|
|
908
|
+
const directory = req.query.directory;
|
|
909
|
+
if (!directory) {
|
|
910
|
+
return res.status(400).json({ error: 'directory parameter is required' });
|
|
911
|
+
}
|
|
912
|
+
|
|
913
|
+
const { maxCount, from, to, file } = req.query;
|
|
914
|
+
const log = await getLog(directory, {
|
|
915
|
+
maxCount: maxCount ? parseInt(maxCount) : undefined,
|
|
916
|
+
from,
|
|
917
|
+
to,
|
|
918
|
+
file
|
|
919
|
+
});
|
|
920
|
+
res.json(log);
|
|
921
|
+
} catch (error) {
|
|
922
|
+
console.error('Failed to get log:', error);
|
|
923
|
+
res.status(500).json({ error: error.message || 'Failed to get commit log' });
|
|
924
|
+
}
|
|
925
|
+
});
|
|
926
|
+
|
|
927
|
+
app.get('/api/git/commit-files', async (req, res) => {
|
|
928
|
+
const { getCommitFiles } = await getGitLibraries();
|
|
929
|
+
try {
|
|
930
|
+
const { directory, hash } = req.query;
|
|
931
|
+
if (!directory) {
|
|
932
|
+
return res.status(400).json({ error: 'directory parameter is required' });
|
|
933
|
+
}
|
|
934
|
+
if (!hash) {
|
|
935
|
+
return res.status(400).json({ error: 'hash parameter is required' });
|
|
936
|
+
}
|
|
937
|
+
|
|
938
|
+
const result = await getCommitFiles(directory, hash);
|
|
939
|
+
res.json(result);
|
|
940
|
+
} catch (error) {
|
|
941
|
+
console.error('Failed to get commit files:', error);
|
|
942
|
+
res.status(500).json({ error: error.message || 'Failed to get commit files' });
|
|
943
|
+
}
|
|
944
|
+
});
|
|
945
|
+
|
|
946
|
+
app.get('/api/git/commit-file-diff', async (req, res) => {
|
|
947
|
+
const { getCommitFileDiff } = await getGitLibraries();
|
|
948
|
+
try {
|
|
949
|
+
const { directory, hash, path: filePath } = req.query;
|
|
950
|
+
if (!directory || typeof directory !== 'string') {
|
|
951
|
+
return res.status(400).json({ error: 'directory parameter is required' });
|
|
952
|
+
}
|
|
953
|
+
if (!hash || typeof hash !== 'string') {
|
|
954
|
+
return res.status(400).json({ error: 'hash parameter is required' });
|
|
955
|
+
}
|
|
956
|
+
if (!/^[0-9a-fA-F]{7,40}$/.test(hash)) {
|
|
957
|
+
return res.status(400).json({ error: 'hash must be a valid commit SHA' });
|
|
958
|
+
}
|
|
959
|
+
if (!filePath || typeof filePath !== 'string') {
|
|
960
|
+
return res.status(400).json({ error: 'path parameter is required' });
|
|
961
|
+
}
|
|
962
|
+
|
|
963
|
+
const isBinary = req.query.binary === 'true';
|
|
964
|
+
const result = await getCommitFileDiff(directory, hash, filePath, isBinary);
|
|
965
|
+
res.json(result);
|
|
966
|
+
} catch (error) {
|
|
967
|
+
console.error('Failed to get commit file diff:', error);
|
|
968
|
+
res.status(500).json({ error: error.message || 'Failed to get commit file diff' });
|
|
969
|
+
}
|
|
970
|
+
});
|
|
971
|
+
|
|
972
|
+
}
|