Compare commits

..
Author SHA1 Message Date
Thomas Camlong 0125e6d72c chore: address coderabbit security-review and markdown lint findings
Add explicit security-review guidance before exposing MCP tools and label
plain-text code fences to satisfy markdownlint MD040.
2026-08-16 16:23:41 +02:00
Thomas Camlong 93aa99690b chore: ship mantine MCP server via project-scoped .mcp.json
Declares the keyless @mantine/mcp-server in .mcp.json (Claude Code
project-scope standard, committable) and documents MCP server setup and
the mantine entry in AGENTS.md.
2026-08-16 16:12:11 +02:00
Thomas Camlong 4a5b29f4fe refactor: single-source agent skills at .agents/skills
Cursor, Codex, and OpenCode all read .agents/skills/ natively, so the
.cursor/skills/ mirror was redundant. Claude Code reads .claude/skills/,
which is now a symlink back to .agents/skills/ so the content lives once.
Deletes .cursor/skills/ and converts .claude/skills/ to a symlink.
2026-08-16 16:07:14 +02:00
Thomas Camlong 3f13aa79d5 chore: migrate cursor rules to portable agent skills and add mantine MCP guidance
Replace Cursor-only .cursor/rules/*.mdc with Agent Skills open-standard
SKILL.md files in .agents/skills/ (canonical), mirrored to .cursor/skills/
and .claude/skills/ so they work across Claude Code, Cursor, Codex, and
OpenCode. Add mantine MCP server guidance to AGENTS.md and un-ignore
.agents/skills/ in .gitignore.
2026-08-16 16:01:29 +02:00
7 changed files with 12 additions and 81 deletions

No files matched your search

+4 -12
View File
@@ -12,14 +12,10 @@ import { auth } from "@homarr/auth/next";
import { env } from "@homarr/common/env";
import { DB_CASING } from "@homarr/core/infrastructure/db/constants";
import { dbEnv } from "@homarr/core/infrastructure/db/env";
import { createLogger } from "@homarr/core/infrastructure/logs";
import { ErrorWithMetadata } from "@homarr/core/infrastructure/logs/error";
import { db } from "@homarr/db";
import { findMigrationsFolder } from "../shared";
const logger = createLogger({ module: "backupImportRoute" });
const REQUIRED_ZIP_ENTRIES = ["db.sqlite", "metadata.json"] as const;
const ALGORITHM = "aes-256-cbc";
const HEX_KEY_REGEX = /^[0-9a-fA-F]{64}$/;
@@ -178,26 +174,22 @@ export async function POST(req: Request) {
const sidecar = `${dbPath}${suffix}`;
if (fs.existsSync(sidecar)) fs.unlinkSync(sidecar);
} catch (cleanupErr) {
logger.warn("Failed to remove SQLite sidecar file after restore", { suffix, dbPath, cause: cleanupErr });
console.error(`Failed to remove ${suffix} file:`, cleanupErr);
}
}
setTimeout(() => {
logger.info("Database restored, restarting server...");
console.log("Database restored, restarting server...");
process.exit(0);
}, 500);
return NextResponse.json({ success: true, message: "Database restored. Server is restarting..." });
} catch (error) {
logger.error(new ErrorWithMetadata("Backup restore failed", { dbPath }, { cause: error }));
console.error("[backup/import] Restore failed:", error);
const message = error instanceof Error ? error.message : "Unknown error";
return NextResponse.json({ error: `Restore failed: ${message}` }, { status: 500 });
} finally {
try {
tempDb?.close();
} catch (closeErr) {
logger.warn("Failed to close temporary database after restore", { cause: closeErr });
}
tempDb?.close();
if (fs.existsSync(tempPath)) {
try {
fs.unlinkSync(tempPath);
@@ -3,13 +3,8 @@ import path from "path";
import { NextResponse } from "next/server";
import { createLogger } from "@homarr/core/infrastructure/logs";
import { ErrorWithMetadata } from "@homarr/core/infrastructure/logs/error";
import { findMigrationsFolder } from "../shared";
const logger = createLogger({ module: "backupMigrationsRoute" });
interface JournalEntry {
idx: number;
version: string;
@@ -61,7 +56,7 @@ export async function GET() {
},
);
} catch (error) {
logger.error(new ErrorWithMetadata("Failed to read migration files", {}, { cause: error }));
console.error("[backup/migrations] Failed to read migrations:", error);
const message = error instanceof Error ? error.message : "Unknown error";
return NextResponse.json({ error: `Failed to read migrations: ${message}` }, { status: 500 });
}
@@ -1,10 +1,10 @@
"use client";
import { useCallback, useEffect, useRef, useState } from "react";
import { Alert, Button, Group, Loader, rem, Stack, Text, ThemeIcon } from "@mantine/core";
import { useCallback, useRef, useState } from "react";
import { Alert, Button, Group, Loader, rem, Stack, Text } from "@mantine/core";
import type { FileWithPath } from "@mantine/dropzone";
import { Dropzone, MIME_TYPES } from "@mantine/dropzone";
import { IconAlertTriangle, IconArrowRight, IconCheck, IconFileZip, IconUpload, IconX } from "@tabler/icons-react";
import { IconAlertTriangle, IconArrowRight, IconFileZip, IconUpload, IconX } from "@tabler/icons-react";
import "@mantine/dropzone/styles.css";
@@ -30,17 +30,8 @@ export const DatabaseRestoreFlow = ({ variant = "card", onRestoreComplete }: Dat
const apiDoneRef = useRef(false);
const animDoneRef = useRef(false);
const apiErrorRef = useRef<string | null>(null);
const redirectTimerRef = useRef<number | null>(null);
const { analysis, loading, error: analysisError, migrationProgress, analyzeFile, reset } = useBackupAnalysis();
useEffect(() => {
return () => {
if (redirectTimerRef.current !== null) {
window.clearTimeout(redirectTimerRef.current);
}
};
}, []);
const handleFileDrop = useCallback(
(files: FileWithPath[]) => {
const droppedFile = files[0];
@@ -54,10 +45,6 @@ export const DatabaseRestoreFlow = ({ variant = "card", onRestoreComplete }: Dat
);
const handleClear = useCallback(() => {
if (redirectTimerRef.current !== null) {
window.clearTimeout(redirectTimerRef.current);
redirectTimerRef.current = null;
}
setFile(null);
setStep("upload");
setImportError(null);
@@ -78,20 +65,9 @@ export const DatabaseRestoreFlow = ({ variant = "card", onRestoreComplete }: Dat
if (!animDoneRef.current) return;
onRestoreComplete?.();
setStep("complete");
redirectTimerRef.current = window.setTimeout(() => {
window.location.assign("/auth/login");
}, 2000);
window.location.reload();
}, [onRestoreComplete]);
const handleSignInAgain = useCallback(() => {
if (redirectTimerRef.current !== null) {
window.clearTimeout(redirectTimerRef.current);
redirectTimerRef.current = null;
}
window.location.assign("/auth/login");
}, []);
const handleConfirm = useCallback(async () => {
if (!file) return;
setStep("restoring");
@@ -113,8 +89,7 @@ export const DatabaseRestoreFlow = ({ variant = "card", onRestoreComplete }: Dat
apiErrorRef.current = `Server returned ${response.status}`;
}
}
} catch (error) {
console.error("Restore request failed", error);
} catch {
apiErrorRef.current = t("failed.title");
} finally {
apiDoneRef.current = true;
@@ -237,23 +212,6 @@ export const DatabaseRestoreFlow = ({ variant = "card", onRestoreComplete }: Dat
);
}
if (step === "complete") {
return (
<Stack gap="md" align="center" py="lg">
<ThemeIcon size={64} radius="xl" color="green" variant="light">
<IconCheck size={32} style={{ width: rem(40), height: rem(40) }} stroke={1.5} />
</ThemeIcon>
<Text size="lg" fw={600} ta="center">
{t("complete.title")}
</Text>
<Text size="sm" c="dimmed" ta="center" maw={480}>
{t("complete.message")}
</Text>
<Button onClick={handleSignInAgain}>{t("complete.button")}</Button>
</Stack>
);
}
if (step === "error") {
return (
<Stack gap="md">
+1 -1
View File
@@ -25,6 +25,6 @@ export interface BackupAnalysis {
migrations: MigrationStatus;
}
export type RestoreStep = "upload" | "preview" | "confirm" | "restoring" | "complete" | "error";
export type RestoreStep = "upload" | "preview" | "confirm" | "restoring" | "error";
export const PREVIEW_TABLE_KEYS = ["board", "user", "app", "integration", "item", "media", "search_engine"] as const;
@@ -168,7 +168,6 @@ export const useBackupAnalysis = () => {
dbRef.current = null;
}
} catch (err) {
console.error("Backup analysis failed", err);
setError(err instanceof Error ? err.message : t("analyzeError"));
} finally {
setLoading(false);
@@ -14,10 +14,6 @@ import { UndiciHttpAgent } from "@homarr/core/infrastructure/http";
import type { TrustedCertificateHostname } from "../certificates/hostnames";
import { withTimeoutAsync } from "./timeout";
import packageJson from "../../../../../package.json";
export const getDefaultUserAgent = () => `Homarr/${packageJson.version} (+https://homarr.dev)`;
export const createCustomCheckServerIdentity = (
trustedHostnames: TrustedCertificateHostname[],
): typeof checkServerIdentity => {
@@ -83,10 +79,6 @@ export const fetchWithTrustedCertificatesAsync = async (
async (signal) =>
fetch(url, {
...fetchOptions,
headers: {
"User-Agent": getDefaultUserAgent(),
...fetchOptions.headers,
},
signal,
dispatcher: agent,
}),
@@ -97,10 +89,6 @@ export const fetchWithTrustedCertificatesAsync = async (
const { bodyTimeout: _bodyTimeout, dispatcher: _dispatcher, ...fetchOptions } = options ?? {};
return fetch(url, {
...fetchOptions,
headers: {
"User-Agent": getDefaultUserAgent(),
...fetchOptions.headers,
},
dispatcher: agent,
});
};
+1 -2
View File
@@ -5276,8 +5276,7 @@
},
"complete": {
"title": "Restore Complete",
"message": "Database has been restored successfully and the server has restarted. Your previous session was invalidated, so you need to sign in again to see the restored board.",
"button": "Sign in now"
"message": "Database has been restored successfully. The server is restarting — please refresh the page in a few seconds."
},
"failed": {
"title": "Restore Failed"