fix(FN-2145): enforce absolute .fusion roots in core storage
- Default AgentStore rootDir to resolve(".fusion") so agent data paths are absolute by default
- Default ReflectionStore rootDir to resolve(".fusion") for consistent absolute root resolution
- Validate Database kbDir is absolute and throw a descriptive error when a relative path is provided
This commit is contained in:
@@ -9,7 +9,7 @@
|
||||
*/
|
||||
|
||||
import { DatabaseSync } from "node:sqlite";
|
||||
import { join } from "node:path";
|
||||
import { isAbsolute, join } from "node:path";
|
||||
import { mkdirSync, existsSync } from "node:fs";
|
||||
import { DEFAULT_PROJECT_SETTINGS } from "./types.js";
|
||||
import type { SteeringComment, TaskComment } from "./types.js";
|
||||
@@ -578,6 +578,10 @@ export class Database {
|
||||
constructor(kbDir: string) {
|
||||
this.dbPath = join(kbDir, "fusion.db");
|
||||
|
||||
if (!isAbsolute(kbDir)) {
|
||||
throw new Error(`[fusion] Database constructor requires an absolute kbDir path, got: ${kbDir}`);
|
||||
}
|
||||
|
||||
// Ensure .fusion directory exists
|
||||
if (!existsSync(kbDir)) {
|
||||
mkdirSync(kbDir, { recursive: true });
|
||||
|
||||
Reference in New Issue
Block a user