fix: resolve TypeScript errors in editor routes and git service imports

This commit is contained in:
plenarius
2026-04-21 00:08:10 -04:00
parent d64bf905d3
commit a8fa85416d
3 changed files with 8 additions and 5 deletions
+6 -3
View File
@@ -25,7 +25,8 @@ router.get("/tree/:repo", async (req, res) => {
router.get("/file/:repo/*path", async (req, res) => {
try {
const content = await readFile(req.params.repo, req.params.path);
const filePath = Array.isArray(req.params.path) ? req.params.path.join("/") : req.params.path;
const content = await readFile(req.params.repo, filePath);
res.json({ content });
} catch (err: unknown) {
const message = err instanceof Error ? err.message : "Unknown error";
@@ -35,7 +36,8 @@ router.get("/file/:repo/*path", async (req, res) => {
router.put("/file/:repo/*path", async (req, res) => {
try {
await writeFile(req.params.repo, req.params.path, req.body.content);
const filePath = Array.isArray(req.params.path) ? req.params.path.join("/") : req.params.path;
await writeFile(req.params.repo, filePath, req.body.content);
res.json({ ok: true });
} catch (err: unknown) {
const message = err instanceof Error ? err.message : "Unknown error";
@@ -45,7 +47,8 @@ router.put("/file/:repo/*path", async (req, res) => {
router.delete("/file/:repo/*path", async (req, res) => {
try {
await deleteFile(req.params.repo, req.params.path);
const filePath = Array.isArray(req.params.path) ? req.params.path.join("/") : req.params.path;
await deleteFile(req.params.repo, filePath);
res.json({ ok: true });
} catch (err: unknown) {
const message = err instanceof Error ? err.message : "Unknown error";
+1 -1
View File
@@ -143,7 +143,7 @@ router.get("/:repo/diff/*path", async (req, res) => {
res.status(400).json({ error: `Unknown repo: ${repoName}` });
return;
}
const filePath = req.params.path;
const filePath = Array.isArray(req.params.path) ? req.params.path.join("/") : req.params.path;
const repoPath = getRepoPath(repoName);
const diff = await getDiff(repoPath, filePath);
res.json({ diff });
+1 -1
View File
@@ -1,4 +1,4 @@
import simpleGit, { SimpleGit } from "simple-git";
import { simpleGit, SimpleGit } from "simple-git";
import fs from "fs/promises";
import { REPOS, GIT_PROVIDER_URL, type RepoName } from "../config/repos.js";
import { getRepoPath, readConfig } from "./workspace.service.js";