Skip to content

bug: codegraph watch does not accept --db, unlike other commands #984

@carlos-alm

Description

@carlos-alm

Found during dogfooding v3.9.4

Severity: Medium
Command: codegraph watch

Every other command that operates on the graph DB accepts --db <path> to point at a DB outside the current working directory (build, stats, query, fn-impact, impact, etc.). watch does not — it rejects the flag with error: unknown option '--db' and only supports the positional [dir].

Reproduction

npx codegraph watch --db /abs/path/to/graph.db
# error: unknown option '--db'

Expected behavior

watch --db <path> <dir> should start the watcher against <dir> and write incremental updates to <path>, matching the behavior of build --db.

Actual behavior

Flag is rejected.

Impact

Users running watch mode from one directory against a graph DB in another (common in monorepo setups and MCP multi-repo workflows) must cd to the repo root, which defeats the purpose of having the --db flag in the other commands.

Suggested fix

Wire --db <path> into the watch command in src/cli.ts the same way it's wired in build, and thread it down to the watcher's DB handle.

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions