refactor: normalize project paths across database and service modules

This commit is contained in:
Haileyesus
2026-04-29 18:02:33 +03:00
parent 0f93ef2781
commit f175d20c4e
13 changed files with 113 additions and 60 deletions

View File

@@ -7,7 +7,7 @@ import type {
ProjectRepositoryRow,
WorkspacePathValidationResult,
} from '@/shared/types.js';
import { AppError, validateWorkspacePath } from '@/shared/utils.js';
import { AppError, normalizeProjectPath, validateWorkspacePath } from '@/shared/utils.js';
type CreateProjectInput = {
projectPath: string;
@@ -95,7 +95,7 @@ export async function createProject(
input: CreateProjectInput,
dependencies: CreateProjectDependencies = defaultDependencies,
): Promise<CreateProjectServiceResult> {
const normalizedPath = (input.projectPath || '').trim();
const normalizedPath = normalizeProjectPath(input.projectPath || '');
if (!normalizedPath) {
throw new AppError('path is required', {
code: 'PROJECT_PATH_REQUIRED',
@@ -112,7 +112,7 @@ export async function createProject(
});
}
const resolvedProjectPath = pathValidation.resolvedPath;
const resolvedProjectPath = normalizeProjectPath(pathValidation.resolvedPath);
await dependencies.ensureWorkspaceDirectory(resolvedProjectPath);
const normalizedCustomName = resolveDisplayName(input.customName ?? null, resolvedProjectPath);