feat(FN-4606): complete Step 1 — settings schema and types

Ref: Runfusion/Fusion#321
Fusion-Task-Id: FN-4606
Fusion-Task-Lineage: 94b23f37-944e-4bcd-bfa1-67d0a8c0a267
This commit is contained in:
Fusion
2026-05-15 08:05:34 -07:00
committed by gsxdsm
parent d197938967
commit e3cad24c41
3 changed files with 20 additions and 0 deletions

View File

@@ -37,6 +37,18 @@ describe("TaskStore", () => {
});
});
describe("worktreesDir setting", () => {
it("round-trips worktreesDir via updateSettings and project serialization", async () => {
await harness.store().updateSettings({ worktreesDir: "~/.fn-worktrees/{repo}" });
const settings = await harness.store().getSettings();
expect(settings.worktreesDir).toBe("~/.fn-worktrees/{repo}");
const configRaw = await readFile(join(harness.rootDir(), ".fusion", "config.json"), "utf-8");
const config = JSON.parse(configRaw);
expect(config.settings.worktreesDir).toBe("~/.fn-worktrees/{repo}");
});
});
describe("autoResolveConflicts setting", () => {
it("persists autoResolveConflicts and returns it via getSettings", async () => {
await harness.store().updateSettings({ autoResolveConflicts: false });

View File

@@ -192,6 +192,7 @@ export const DEFAULT_PROJECT_SETTINGS = {
recycleWorktrees: false,
executorAllowSiblingBranchRename: false,
worktreeNaming: "random",
worktreesDir: undefined,
taskPrefix: "FN",
includeTaskIdInCommit: true,
commitAuthorEnabled: true,

View File

@@ -2394,6 +2394,13 @@ export interface ProjectSettings {
* - "task-title": Use a slugified version of the task title (e.g., fix-login-bug)
* Default: "random". */
worktreeNaming?: "random" | "task-id" | "task-title";
/** Optional container directory for task worktrees.
* When unset, worktrees default to `<projectRoot>/.worktrees`.
* Supports leading `~` expansion and the `{repo}` token (basename of the project root).
* Accepts absolute paths or paths relative to the project root.
* Affects newly-created worktrees and pool/self-healing directory scans only;
* existing `task.worktree` absolute paths are honored as-is. */
worktreesDir?: string;
/** Prefix for generated task IDs (e.g. `"KB"` produces `KB-001`).
* Defaults to `"KB"`. Only affects new tasks — existing tasks retain
* their original IDs. */