mirror of
https://github.com/QwenLM/qwen-code.git
synced 2026-05-02 05:31:02 +00:00
refactor(settings): sequential settings migration
This commit is contained in:
parent
ac5a0c68e5
commit
ae8c0d3d4e
18 changed files with 3527 additions and 944 deletions
|
|
@ -202,6 +202,25 @@ export function getProjectHash(projectRoot: string): string {
|
|||
return crypto.createHash('sha256').update(normalizedPath).digest('hex');
|
||||
}
|
||||
|
||||
/**
|
||||
* Sanitizes a directory path to create a safe project ID.
|
||||
*
|
||||
* - On Windows: normalizes to lowercase for case-insensitive matching
|
||||
* - Replaces all non-alphanumeric characters with hyphens
|
||||
*
|
||||
* This is used for:
|
||||
* - Creating project-specific directories
|
||||
* - Generating session IDs for debug logging during startup
|
||||
*
|
||||
* @param cwd - The directory path to sanitize
|
||||
* @returns A sanitized string safe for use as a project identifier
|
||||
*/
|
||||
export function sanitizeCwd(cwd: string): string {
|
||||
// On Windows, normalize to lowercase for case-insensitive matching
|
||||
const normalizedCwd = os.platform() === 'win32' ? cwd.toLowerCase() : cwd;
|
||||
return normalizedCwd.replace(/[^a-zA-Z0-9]/g, '-');
|
||||
}
|
||||
|
||||
/**
|
||||
* Checks if a path is a subpath of another path.
|
||||
* @param parentPath The parent path.
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue