Skip to content

Turbocharge Claude Code, Cursor, Codex, Gemini & every coding agent: faster, cheaper, with contextual understanding specific to your codebase.

fix: propagate --include-dir to workspace child builds

Alex Matthews99124100036b
diff --git a/src/graph/workspace-cli.ts b/src/graph/workspace-cli.ts
index b098c52f..95fb87fd 100644
--- a/src/graph/workspace-cli.ts
+++ b/src/graph/workspace-cli.ts
@@ -7,6 +7,7 @@
*/
import { Graft } from "../engine.js";
import { contextDirFor, ensureGitignored } from "../context/node-file.js";
+import { writeBuildConfig } from "../util/state.js";
import type { EngineConfig } from "../ai/providers.js";
import { formatAsk } from "../ask/ask.js";
import type { Direction } from "./traverse.js";
@@ -30,6 +31,12 @@ export interface WorkspaceBuildOptions {
* override, so each child writes to its own `<child>/graft/`. */
childConfig: EngineConfig;
override?: string;
+ /** The CLI's `--include-dir` override, if any. Persisted into EACH CHILD's
+ * own state (not the parent's) before that child builds: children are
+ * independent repos with their own graft state, and the parent's `graft/`
+ * (including any state it briefly held) is deleted by `splitWorkspace`
+ * right after the children build — see `clearParentGraft`'s doc comment. */
+ includeDirs?: string[];
}
/** Build every git child into its own committable `graft/`, then replace the
@@ -37,6 +44,12 @@ export interface WorkspaceBuildOptions {
* first when migrating away from a mega-graph. */
export async function runWorkspaceBuild(root: string, opts: WorkspaceBuildOptions): Promise<void> {
const buildChild = async (childDir: string, childName: string): Promise<void> => {
+ // Persisted BEFORE the child build itself runs, same as the single-repo
+ // `graft build --include-dir` path in cli.ts — so this child's walks (and
+ // every later no-flag build of it) see the override identically.
+ if (opts.includeDirs && opts.includeDirs.length > 0) {
+ writeBuildConfig(childDir, { includeDirs: opts.includeDirs });
+ }
const engine = new Graft({ ...opts.childConfig, contextDir: undefined });
if (opts.deep) await engine.init(childDir, { extensions: opts.extensions });
const g = await engine.graph(childDir, { llm: opts.deep, concurrency: opts.concurrency });