@danielstyle/featflow 0.0.0-stage → 0.6.3

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (61) hide show
  1. package/LICENSE +21 -0
  2. package/README.md +206 -2
  3. package/README.zh-CN.md +163 -0
  4. package/bin/featflow.mjs +113 -0
  5. package/package.json +62 -4
  6. package/skills/featflow/SKILL.md +127 -0
  7. package/skills/featflow-issues/SKILL.md +104 -0
  8. package/skills/featflow-regression/SKILL.md +63 -0
  9. package/src/agent-docs.mjs +143 -0
  10. package/src/changed-files.mjs +204 -0
  11. package/src/commands/cleanup.mjs +221 -0
  12. package/src/commands/codegraph.mjs +110 -0
  13. package/src/commands/doctor.mjs +265 -0
  14. package/src/commands/finish.mjs +249 -0
  15. package/src/commands/hook-cmd.mjs +78 -0
  16. package/src/commands/hooks-cmd.mjs +238 -0
  17. package/src/commands/init.mjs +382 -0
  18. package/src/commands/issue.mjs +434 -0
  19. package/src/commands/new.mjs +311 -0
  20. package/src/commands/plan-check.mjs +75 -0
  21. package/src/commands/policy-cmd.mjs +51 -0
  22. package/src/commands/pr-cleanup.mjs +194 -0
  23. package/src/commands/regression.mjs +206 -0
  24. package/src/commands/setup.mjs +343 -0
  25. package/src/commands/size-check.mjs +137 -0
  26. package/src/commands/status.mjs +100 -0
  27. package/src/commands/sync.mjs +407 -0
  28. package/src/commands/verify.mjs +206 -0
  29. package/src/commands/worktree.mjs +205 -0
  30. package/src/config.mjs +295 -0
  31. package/src/detect.mjs +314 -0
  32. package/src/git.mjs +331 -0
  33. package/src/hook-adapters.mjs +218 -0
  34. package/src/hooks-core.mjs +420 -0
  35. package/src/index.mjs +13 -0
  36. package/src/init-args.mjs +282 -0
  37. package/src/init-hooks.mjs +312 -0
  38. package/src/init-prompts.mjs +191 -0
  39. package/src/issues-helpers.mjs +463 -0
  40. package/src/issues.mjs +521 -0
  41. package/src/plan.mjs +202 -0
  42. package/src/policy.mjs +143 -0
  43. package/src/regression.mjs +338 -0
  44. package/src/size-check.mjs +203 -0
  45. package/src/tui-select.mjs +378 -0
  46. package/templates/adapters/antigravity/hooks.json +42 -0
  47. package/templates/adapters/claude-code/settings.json +46 -0
  48. package/templates/adapters/codex/config.toml +19 -0
  49. package/templates/adapters/cursor/hooks.json +27 -0
  50. package/templates/agents/codex/codebase-locator.toml +28 -0
  51. package/templates/agents/codex/implementation-scout.toml +28 -0
  52. package/templates/agents/codex/regression-guard-planner.toml +20 -0
  53. package/templates/features/README.md +56 -0
  54. package/templates/features/_program_template.md +79 -0
  55. package/templates/features/_template.md +120 -0
  56. package/templates/features/current-feature.md +18 -0
  57. package/templates/githooks/post-merge +7 -0
  58. package/templates/githooks/pre-commit +11 -0
  59. package/templates/githooks/pre-push +10 -0
  60. package/templates/regression/regression-ledger.yml +23 -0
  61. package/templates/snippets/AGENTS-workflow.md +21 -0
@@ -0,0 +1,205 @@
1
+ import { spawnSync } from "node:child_process";
2
+ import { existsSync, mkdirSync } from "node:fs";
3
+ import path from "node:path";
4
+
5
+ import { loadConfig, resolveWorktreeParent } from "../config.mjs";
6
+ import {
7
+ fail,
8
+ findWorktreeForBranch,
9
+ formatCommand,
10
+ gitConfigGet,
11
+ gitWorktrees,
12
+ localBranchExists,
13
+ runWrite,
14
+ sanitizeBranchForDir,
15
+ validateTaskBranchName,
16
+ } from "../git.mjs";
17
+ import { setupInstructions } from "../policy.mjs";
18
+
19
+ const usage = `
20
+ Usage:
21
+ featflow worktree <branch> [worktree-path] [base]
22
+ featflow worktree <branch> --path <worktree-path> --base <base>
23
+
24
+ Creates a dedicated Git worktree for a typed task branch and runs any
25
+ configured postWorktreeCreate commands.
26
+
27
+ Options:
28
+ --path <path> Worktree directory path. Defaults to <worktreeParent>/<sanitized-branch>.
29
+ --base <ref> Base ref for a new branch. Defaults to developer branch or baseBranch.
30
+ --skip-post-create Skip running configured postWorktreeCreate commands.
31
+ --dry-run Print commands without executing them.
32
+ -h, --help Show this help.
33
+ `.trim();
34
+
35
+ function parseArgs(argv) {
36
+ const options = {
37
+ branch: "",
38
+ path: "",
39
+ base: "",
40
+ baseProvided: false,
41
+ skipPostCreate: false,
42
+ dryRun: false,
43
+ };
44
+ const positional = [];
45
+
46
+ for (let i = 0; i < argv.length; i += 1) {
47
+ const arg = argv[i];
48
+ if (arg === "-h" || arg === "--help") {
49
+ console.log(usage);
50
+ process.exit(0);
51
+ }
52
+ if (arg === "--skip-post-create") {
53
+ options.skipPostCreate = true;
54
+ continue;
55
+ }
56
+ if (arg === "--dry-run") {
57
+ options.dryRun = true;
58
+ continue;
59
+ }
60
+ if (arg === "--path" || arg === "--base") {
61
+ const value = argv[++i] ?? "";
62
+ if (!value) {
63
+ fail(`Missing value for ${arg}.`, usage);
64
+ }
65
+ options[arg.slice(2)] = value;
66
+ if (arg === "--base") {
67
+ options.baseProvided = true;
68
+ }
69
+ continue;
70
+ }
71
+ if (arg.startsWith("--path=") || arg.startsWith("--base=")) {
72
+ const idx = arg.indexOf("=");
73
+ const key = arg.slice(2, idx);
74
+ const value = arg.slice(idx + 1);
75
+ if (!value) {
76
+ fail(`Missing value for --${key}.`, usage);
77
+ }
78
+ options[key] = value;
79
+ if (key === "base") {
80
+ options.baseProvided = true;
81
+ }
82
+ continue;
83
+ }
84
+ if (arg.startsWith("-")) {
85
+ fail(`Unknown option: ${arg}`, usage);
86
+ }
87
+ positional.push(arg);
88
+ }
89
+
90
+ if (positional.length > 3) {
91
+ fail(`Unexpected extra argument: ${positional[3]}`, usage);
92
+ }
93
+ options.branch = positional[0] ?? "";
94
+ options.path = options.path || positional[1] || "";
95
+ if (positional[2]) {
96
+ options.base = positional[2];
97
+ options.baseProvided = true;
98
+ }
99
+
100
+ if (!options.branch) {
101
+ fail("Missing branch name.", usage);
102
+ }
103
+
104
+ return options;
105
+ }
106
+
107
+ function runCapturedWrite(command, args, cwd, options = {}) {
108
+ if (options.dryRun) {
109
+ return;
110
+ }
111
+ const result = spawnSync(command, args, {
112
+ cwd,
113
+ encoding: "utf8",
114
+ stdio: ["ignore", "pipe", "pipe"],
115
+ shell: options.shell ?? false,
116
+ env: options.env ? { ...process.env, ...options.env } : process.env,
117
+ });
118
+ if (result.error) {
119
+ throw new Error(`${formatCommand(command, args)} failed: ${result.error.message}`);
120
+ }
121
+ if (result.status !== 0) {
122
+ const detail = (result.stderr || result.stdout || `exit code ${String(result.status)}`).trim();
123
+ throw new Error(`${formatCommand(command, args)} failed:\n${detail}`);
124
+ }
125
+ }
126
+
127
+ export function preflightTaskWorktree(repoRoot, config, options = {}) {
128
+ const branch = String(options.branch ?? "").trim();
129
+ if (!branch) {
130
+ throw new Error("Missing branch name.");
131
+ }
132
+
133
+ validateTaskBranchName(branch, repoRoot, new Set(config.protectedBranches));
134
+
135
+ let baseRef = options.base || "";
136
+ if (!options.baseProvided) {
137
+ if (config.mode === "developer-branch") {
138
+ baseRef = gitConfigGet(config.developerBranchConfigKey, repoRoot);
139
+ if (!baseRef) {
140
+ throw new Error(setupInstructions(config));
141
+ }
142
+ } else {
143
+ baseRef = config.baseBranch;
144
+ }
145
+ }
146
+
147
+ const existingWorktree = findWorktreeForBranch(gitWorktrees(repoRoot), branch);
148
+ if (existingWorktree) {
149
+ throw new Error(`Branch "${branch}" is already checked out in worktree: ${existingWorktree.path}`);
150
+ }
151
+
152
+ const worktreeParent = resolveWorktreeParent(repoRoot, config);
153
+ const worktreePath = path.resolve(
154
+ options.path || path.join(worktreeParent, sanitizeBranchForDir(branch)),
155
+ );
156
+ if (existsSync(worktreePath)) {
157
+ throw new Error(`Target worktree path already exists: ${worktreePath}`);
158
+ }
159
+
160
+ const branchExists = localBranchExists(branch, repoRoot);
161
+ return { branch, baseRef, worktreePath, branchExists };
162
+ }
163
+
164
+ export function createTaskWorktree(repoRoot, config, options = {}, preflighted = null) {
165
+ const plan = preflighted ?? preflightTaskWorktree(repoRoot, config, options);
166
+ const execWrite = options.captureOutput ? runCapturedWrite : runWrite;
167
+
168
+ if (!options.dryRun) {
169
+ mkdirSync(path.dirname(plan.worktreePath), { recursive: true });
170
+ }
171
+
172
+ const addArgs = plan.branchExists
173
+ ? ["worktree", "add", plan.worktreePath, plan.branch]
174
+ : ["worktree", "add", "-b", plan.branch, plan.worktreePath, plan.baseRef];
175
+
176
+ execWrite("git", addArgs, repoRoot, { dryRun: options.dryRun });
177
+
178
+ if (!options.skipPostCreate && config.postWorktreeCreate.length > 0) {
179
+ for (const cmd of config.postWorktreeCreate) {
180
+ execWrite(cmd, [], plan.worktreePath, { dryRun: options.dryRun, shell: true });
181
+ }
182
+ }
183
+
184
+ return {
185
+ branch: plan.branch,
186
+ baseRef: plan.branchExists ? "existing" : plan.baseRef,
187
+ worktreePath: plan.worktreePath,
188
+ branchExists: plan.branchExists,
189
+ };
190
+ }
191
+
192
+ export async function runWorktree(argv) {
193
+ const options = parseArgs(argv);
194
+ const { config, repoRoot } = loadConfig(process.cwd());
195
+
196
+ let result;
197
+ try {
198
+ result = createTaskWorktree(repoRoot, config, options);
199
+ } catch (error) {
200
+ fail(error instanceof Error ? error.message : String(error));
201
+ }
202
+
203
+ console.log(`Worktree ready: ${result.worktreePath}`);
204
+ console.log(`Branch: ${result.branch} (base: ${result.baseRef})`);
205
+ }
package/src/config.mjs ADDED
@@ -0,0 +1,295 @@
1
+ import { existsSync, readFileSync } from "node:fs";
2
+ import { basename, dirname, resolve } from "node:path";
3
+ import { fileURLToPath } from "node:url";
4
+
5
+ import { findMainRepoRoot, findRepoRoot } from "./git.mjs";
6
+
7
+ export const CONFIG_FILENAME = ".featflow.json";
8
+
9
+ export const DEFAULT_PREFIXES = [
10
+ "feat",
11
+ "fix",
12
+ "chore",
13
+ "docs",
14
+ "test",
15
+ "refactor",
16
+ "perf",
17
+ "security",
18
+ ];
19
+
20
+ export const DEFAULT_PRODUCT_PATHS = ["src/", "apps/", "services/", "packages/", "lib/"];
21
+
22
+ export const DEFAULT_ISSUES_CONFIG = {
23
+ provider: "github",
24
+ repo: null,
25
+ assetsRepo: null,
26
+ assetsBranch: "main",
27
+ assetsPrefix: "assets",
28
+ inProgressLabel: "status:in-progress",
29
+ inReviewLabel: "status:in-review",
30
+ blockedLabel: "status:blocked",
31
+ autoWorktree: true,
32
+ };
33
+
34
+ export const DEFAULT_FILE_SIZE_BUDGET = {
35
+ production: 600,
36
+ style: 700,
37
+ test: 900,
38
+ extensions: [".ts", ".tsx", ".js", ".jsx", ".mjs", ".cjs", ".py", ".css"],
39
+ ignore: [],
40
+ baselineFile: ".featflow-size-baseline.json",
41
+ enforceInPostToolUse: true,
42
+ enforceInStopGate: true,
43
+ enforceInPreCommit: true,
44
+ };
45
+
46
+ export const DEFAULT_REGRESSION_CONFIG = {
47
+ ledgerFile: "context/regression-ledger.yml",
48
+ enforceInStopGate: false,
49
+ };
50
+
51
+ export const packageRoot = resolve(dirname(fileURLToPath(import.meta.url)), "..");
52
+
53
+ export function presetConfig(mode = "trunk") {
54
+ if (mode === "developer-branch") {
55
+ return {
56
+ mode: "developer-branch",
57
+ remote: "origin",
58
+ requireRemote: true,
59
+ baseBranch: "dev",
60
+ integrationBranch: "dev",
61
+ releaseBranch: "main",
62
+ protectedBranches: ["main", "dev"],
63
+ finishTarget: "developer-branch",
64
+ developerBranchConfigKey: "featflow.developerBranch",
65
+ worktreeParent: null,
66
+ featuresDir: "features",
67
+ trackFeaturesInGit: true,
68
+ trackCurrentFeaturePointer: false,
69
+ prefixes: [...DEFAULT_PREFIXES],
70
+ productPaths: [...DEFAULT_PRODUCT_PATHS],
71
+ postWorktreeCreate: [],
72
+ verifyCommands: {},
73
+ dangerousCommands: {
74
+ blockDestructiveGit: true,
75
+ blockForcePush: true,
76
+ blockEnvWrite: true,
77
+ blockedPackageManagers: [],
78
+ },
79
+ };
80
+ }
81
+
82
+ if (mode === "trunk") {
83
+ return {
84
+ mode: "trunk",
85
+ remote: "origin",
86
+ requireRemote: false,
87
+ baseBranch: "main",
88
+ integrationBranch: "main",
89
+ releaseBranch: "main",
90
+ protectedBranches: ["main"],
91
+ finishTarget: "merge",
92
+ developerBranchConfigKey: "featflow.developerBranch",
93
+ worktreeParent: null,
94
+ featuresDir: "features",
95
+ trackFeaturesInGit: true,
96
+ trackCurrentFeaturePointer: false,
97
+ prefixes: [...DEFAULT_PREFIXES],
98
+ productPaths: [...DEFAULT_PRODUCT_PATHS],
99
+ postWorktreeCreate: [],
100
+ verifyCommands: {},
101
+ dangerousCommands: {
102
+ blockDestructiveGit: true,
103
+ blockForcePush: true,
104
+ blockEnvWrite: true,
105
+ blockedPackageManagers: [],
106
+ },
107
+ };
108
+ }
109
+
110
+ throw new Error(`Unsupported featflow mode "${mode}". Expected "trunk" or "developer-branch".`);
111
+ }
112
+
113
+ function isPlainObject(value) {
114
+ return value !== null && typeof value === "object" && !Array.isArray(value);
115
+ }
116
+
117
+ export function normalizeIssuesConfig(rawIssues) {
118
+ if (!isPlainObject(rawIssues)) {
119
+ return null;
120
+ }
121
+ const provider =
122
+ typeof rawIssues.provider === "string" && rawIssues.provider.trim()
123
+ ? rawIssues.provider.trim().toLowerCase()
124
+ : DEFAULT_ISSUES_CONFIG.provider;
125
+ if (provider !== "github") {
126
+ throw new Error(`Unsupported issues.provider "${provider}". Expected "github".`);
127
+ }
128
+ const cleanStr = (val, fallback = null) => {
129
+ if (typeof val === "string" && val.trim()) {
130
+ return val.trim();
131
+ }
132
+ return fallback;
133
+ };
134
+ const prefix = cleanStr(rawIssues.assetsPrefix, DEFAULT_ISSUES_CONFIG.assetsPrefix).replace(/^\/+|\/+$/g, "") || "assets";
135
+ return {
136
+ provider,
137
+ repo: cleanStr(rawIssues.repo, null),
138
+ assetsRepo: cleanStr(rawIssues.assetsRepo, null),
139
+ assetsBranch: cleanStr(rawIssues.assetsBranch, DEFAULT_ISSUES_CONFIG.assetsBranch),
140
+ assetsPrefix: prefix,
141
+ inProgressLabel: cleanStr(rawIssues.inProgressLabel, DEFAULT_ISSUES_CONFIG.inProgressLabel),
142
+ inReviewLabel: cleanStr(rawIssues.inReviewLabel, DEFAULT_ISSUES_CONFIG.inReviewLabel),
143
+ blockedLabel: cleanStr(rawIssues.blockedLabel, DEFAULT_ISSUES_CONFIG.blockedLabel),
144
+ autoWorktree: rawIssues.autoWorktree !== false,
145
+ };
146
+ }
147
+
148
+ export function resolveIssuesConfig(config) {
149
+ if (config && isPlainObject(config.issues)) {
150
+ return normalizeIssuesConfig(config.issues);
151
+ }
152
+ return { ...DEFAULT_ISSUES_CONFIG };
153
+ }
154
+
155
+ export function normalizeFileSizeBudget(rawBudget) {
156
+ if (!isPlainObject(rawBudget)) {
157
+ return null;
158
+ }
159
+ const positiveInt = (val, fallback) =>
160
+ typeof val === "number" && Number.isFinite(val) && val > 0 ? Math.floor(val) : fallback;
161
+ const extensions = Array.isArray(rawBudget.extensions)
162
+ ? rawBudget.extensions
163
+ .filter((item) => typeof item === "string" && item.trim().length > 0)
164
+ .map((item) => (item.trim().startsWith(".") ? item.trim().toLowerCase() : `.${item.trim().toLowerCase()}`))
165
+ : [...DEFAULT_FILE_SIZE_BUDGET.extensions];
166
+ const ignore = Array.isArray(rawBudget.ignore)
167
+ ? rawBudget.ignore.filter((item) => typeof item === "string" && item.trim().length > 0).map((item) => item.trim())
168
+ : [];
169
+ const baselineFile =
170
+ rawBudget.baselineFile === null
171
+ ? null
172
+ : typeof rawBudget.baselineFile === "string" && rawBudget.baselineFile.trim()
173
+ ? rawBudget.baselineFile.trim()
174
+ : DEFAULT_FILE_SIZE_BUDGET.baselineFile;
175
+
176
+ return {
177
+ production: positiveInt(rawBudget.production, DEFAULT_FILE_SIZE_BUDGET.production),
178
+ style: positiveInt(rawBudget.style ?? rawBudget.css, DEFAULT_FILE_SIZE_BUDGET.style),
179
+ test: positiveInt(rawBudget.test, DEFAULT_FILE_SIZE_BUDGET.test),
180
+ extensions,
181
+ ignore,
182
+ baselineFile,
183
+ enforceInPostToolUse: rawBudget.enforceInPostToolUse !== false,
184
+ enforceInStopGate: rawBudget.enforceInStopGate !== false,
185
+ enforceInPreCommit: rawBudget.enforceInPreCommit !== false,
186
+ };
187
+ }
188
+
189
+ export function resolveFileSizeBudget(config) {
190
+ if (config && isPlainObject(config.fileSizeBudget)) {
191
+ return normalizeFileSizeBudget(config.fileSizeBudget);
192
+ }
193
+ return { ...DEFAULT_FILE_SIZE_BUDGET };
194
+ }
195
+
196
+ export function normalizeRegressionConfig(rawRegression) {
197
+ if (!isPlainObject(rawRegression)) {
198
+ return null;
199
+ }
200
+ const ledgerFile =
201
+ typeof rawRegression.ledgerFile === "string" && rawRegression.ledgerFile.trim()
202
+ ? rawRegression.ledgerFile.trim()
203
+ : DEFAULT_REGRESSION_CONFIG.ledgerFile;
204
+ return {
205
+ ledgerFile,
206
+ enforceInStopGate: Boolean(rawRegression.enforceInStopGate),
207
+ };
208
+ }
209
+
210
+ export function resolveRegressionConfig(config) {
211
+ if (config && isPlainObject(config.regression)) {
212
+ return normalizeRegressionConfig(config.regression);
213
+ }
214
+ return { ...DEFAULT_REGRESSION_CONFIG };
215
+ }
216
+
217
+ export function resolveWorktreeParent(repoRoot, config) {
218
+ const mainRoot = findMainRepoRoot(repoRoot) ?? repoRoot;
219
+ if (config.worktreeParent) {
220
+ return resolve(mainRoot, config.worktreeParent);
221
+ }
222
+ const defaultName = `${basename(mainRoot)}-worktrees`;
223
+ const parentDir = dirname(mainRoot);
224
+ if (basename(parentDir) === defaultName) {
225
+ return parentDir;
226
+ }
227
+ return resolve(mainRoot, "..", defaultName);
228
+ }
229
+
230
+ export function loadConfig(startCwd = process.cwd()) {
231
+ const repoRoot = findRepoRoot(startCwd);
232
+ const configPath = repoRoot ? resolve(repoRoot, CONFIG_FILENAME) : resolve(startCwd, CONFIG_FILENAME);
233
+
234
+ let raw = {};
235
+ let hasConfigFile = false;
236
+
237
+ if (existsSync(configPath)) {
238
+ hasConfigFile = true;
239
+ try {
240
+ const parsed = JSON.parse(readFileSync(configPath, "utf8"));
241
+ if (!isPlainObject(parsed)) {
242
+ throw new Error(`${CONFIG_FILENAME} must contain a JSON object.`);
243
+ }
244
+ raw = parsed;
245
+ } catch (error) {
246
+ throw new Error(
247
+ `Failed to parse ${configPath}: ${error instanceof Error ? error.message : String(error)}`,
248
+ );
249
+ }
250
+ }
251
+
252
+ const mode = typeof raw.mode === "string" ? raw.mode : "trunk";
253
+ const base = presetConfig(mode);
254
+ const dangerousCommands = {
255
+ ...base.dangerousCommands,
256
+ ...(isPlainObject(raw.dangerousCommands) ? raw.dangerousCommands : {}),
257
+ };
258
+
259
+ const merged = {
260
+ ...base,
261
+ ...raw,
262
+ dangerousCommands,
263
+ issues: normalizeIssuesConfig(raw.issues),
264
+ fileSizeBudget: normalizeFileSizeBudget(raw.fileSizeBudget),
265
+ regression: normalizeRegressionConfig(raw.regression),
266
+ protectedBranches: Array.isArray(raw.protectedBranches)
267
+ ? raw.protectedBranches.filter((item) => typeof item === "string" && item.trim().length > 0)
268
+ : base.protectedBranches,
269
+ prefixes: Array.isArray(raw.prefixes)
270
+ ? raw.prefixes.filter((item) => typeof item === "string" && item.trim().length > 0)
271
+ : base.prefixes,
272
+ productPaths: Array.isArray(raw.productPaths)
273
+ ? raw.productPaths.filter((item) => typeof item === "string" && item.trim().length > 0)
274
+ : base.productPaths,
275
+ postWorktreeCreate: Array.isArray(raw.postWorktreeCreate)
276
+ ? raw.postWorktreeCreate.filter((item) => typeof item === "string" && item.trim().length > 0)
277
+ : base.postWorktreeCreate,
278
+ verifyCommands: isPlainObject(raw.verifyCommands) ? raw.verifyCommands : base.verifyCommands,
279
+ };
280
+
281
+ if (merged.mode === "trunk" && !["merge", "pr"].includes(merged.finishTarget)) {
282
+ throw new Error(`Invalid finishTarget "${merged.finishTarget}" for trunk mode. Expected "merge" or "pr".`);
283
+ }
284
+ if (merged.mode === "developer-branch" && merged.finishTarget !== "developer-branch") {
285
+ merged.finishTarget = "developer-branch";
286
+ }
287
+
288
+ return {
289
+ config: merged,
290
+ configPath,
291
+ hasConfigFile,
292
+ repoRoot: repoRoot ?? resolve(startCwd),
293
+ mainRepoRoot: repoRoot ? (findMainRepoRoot(repoRoot) ?? repoRoot) : resolve(startCwd),
294
+ };
295
+ }