feat(cli): add --data-dir flag to store CodeGraph data in a custom directory#568
Open
kkvcrobatz wants to merge 1 commit into
Open
feat(cli): add --data-dir flag to store CodeGraph data in a custom directory#568kkvcrobatz wants to merge 1 commit into
kkvcrobatz wants to merge 1 commit into
Conversation
…rectory All CLI commands (init, uninit, index, sync, status, query, files, context, callers, callees, impact, affected, serve) now accept --data-dir <path> to store the .codegraph/ database and artefacts in a custom location instead of <projectRoot>/.codegraph/. The path can be absolute or relative to the project root. Default behavior (no flag) is unchanged — fully backward-compatible. Also exposes dataDir via InitOptions and OpenOptions in the library API, threads it through CodeGraph.init/open/openSync/uninitialize, and updates getDatabasePath, getDaemonSocketPath, getDaemonPidPath. Closes colbymchenry#304, colbymchenry#452.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
init,uninit,index,sync,status,query,files,context,callers,callees,impact,affected,serve) now accept--data-dir <path>to store CodeGraph data in a customdirectory instead of the default
<projectRoot>/.codegraph/directory tree (e.g.
knowledge/codegraph/)Closes #304, #452.
Changes
src/directory.ts—getCodeGraphDir()and all exported functions accept an optionaldataDir?parameter
src/db/index.ts—getDatabasePath()threadsdataDirthroughgetCodeGraphDir()src/mcp/daemon-paths.ts—getDaemonSocketPath()/getDaemonPidPath()acceptdataDir?src/index.ts—InitOptionsandOpenOptionsgaindataDir?: string; threaded throughinit,initSync,open,openSync,uninitializesrc/bin/codegraph.ts— all subcommands gain--data-dir <path>Test plan
__tests__/configurable-data-dir.test.tscoveringgetCodeGraphDirandisInitializedwith customdataDirEBUSYcleanup issues unrelatedto this change (reproduce on
main)