pub(in crate::cli) fn top_level_help() -> &'static str {
"codebase-graph native CLI\n\nUSAGE:\n codebase-graph <command> [options]\n\nCOMMANDS:\n install Perform first-time graph setup and write .codebaseGraph/config.json\n reinstall Remove existing graph state and run install again\n uninstall Remove repo graph state, instructions, and MCP registrations\n build Materialize a graph through the Rust native engine\n plan Preview files that would rebuild, delete, skip, or ignore\n watch Watch for file changes and refresh after a debounce window\n check-health Check whether the native graph database is readable\n schema Return ontology schema, indexes, profiles, and helpers\n query-helpers Return named read-only graph query helpers\n codebase-architecture-queries Return the architecture-discovery query catalog\n codebase-search Search the code graph with compact context\n codebase-context Return compact graph context\n graph-query Execute a restricted read-only graph query\n mcp Serve codebaseGraph MCP over stdio or HTTP\n\nRun `codebase-graph <command> --help` for command options."
}
pub(in crate::cli) fn mcp_help() -> &'static str {
"codebase-graph mcp\n\nUSAGE:\n codebase-graph mcp install [--client <client>] [--scope <scope>] [--config-path <path>] [--client-config-path <path>] [--dry-run] [--json]\n codebase-graph mcp start [--repo-root <path>] [--config <path>] [--db <path>] [--manifest <path>]\n codebase-graph mcp http [--repo-root <path>] [--config <path>] [--db <path>] [--manifest <path>] [--host <host>] [--port <port>] [--path <path>] [--allow-remote] [--auth-token <token>|--auth-token-env <name>]\n\nOPTIONS:\n --repo-root <path> Repository root override; auto-detected when omitted\n --config <path> Setup config path; defaults to .codebaseGraph/config.json\n --db <path> Ladybug database path override\n --manifest <path> Manifest path override\n --host <host> HTTP bind host; defaults to 127.0.0.1\n --port <port> HTTP bind port; defaults to 8765\n --path <path> HTTP endpoint path; defaults to /mcp\n --allow-remote Permit non-local HTTP bind when an auth token is supplied\n --auth-token <token> Bearer token required for HTTP requests\n --auth-token-env <name> Environment variable containing the bearer token"
}
pub(in crate::cli) fn mcp_install_help() -> &'static str {
"codebase-graph mcp install\n\nUSAGE:\n codebase-graph mcp install [--client <client>] [--scope local|user|project] [--name <name>] [--config-path <path>] [--client-config-path <path>] [--repo-root <path>] [--dry-run] [--verify] [--json]\n\nOPTIONS:\n --client <client> codex, claude, claude-project, lmstudio, github-copilot, hermes, openclaw, generic, copilot-studio, microsoft-copilot, or all\n --scope <scope> local, user, or project; defaults to local\n --name <name> MCP server name; defaults to codebase_graph_<repo>\n --config-path <path> Path to .codebaseGraph/config.json\n --client-config-path <path> Override the target MCP client config path\n --repo-root <path> Repository root override; auto-detected when omitted\n --dry-run Show install action without writing files or invoking CLIs\n --verify Accepted for compatibility\n --json Emit JSON output"
}
pub(in crate::cli) fn materialize_help() -> &'static str {
"codebase-graph build\n\nUSAGE:\n codebase-graph build [--source-root <path>|--repo-root <path>] [--db <path>] [--manifest <path>] [--mode full|changed] [--json]\n codebase-graph build --native-request <path> [--manifest <path>] [--json]\n\nOPTIONS:\n --source-root <path> Repository or source root override; auto-detected when omitted\n --repo-root <path> Alias for --source-root\n --db <path> Ladybug database path; defaults under .codebaseGraph\n --manifest <path> Manifest path; defaults under .codebaseGraph\n --mode <mode> full or changed; defaults to changed\n --no-git Disable Git file discovery and scan the filesystem\n --git-diff Materialize files from git diff plus untracked files\n --git-base <rev> Revision used by --git-diff; defaults to HEAD\n --include <glob> Include only paths matching the glob; repeatable\n --exclude <glob> Exclude paths matching the glob; repeatable\n --parallel Parse independent files concurrently; default behavior\n --single-thread Disable concurrent parsing and build partitions serially\n --progress Include progress events in JSON output\n --no-fts Skip FTS extension loading and index creation\n --no-semantic-enrichment Skip semantic enrichment\n --semantic-provider-mode local_only only; provider-backed modes are not supported by Rust-only production\n --native-request <path> JSON NativeSyntaxMaterializationRequest payload\n --json Emit JSON output"
}
pub(in crate::cli) fn plan_help() -> &'static str {
"codebase-graph plan\n\nUSAGE:\n codebase-graph plan [--source-root <path>|--repo-root <path>] [--manifest <path>] [--mode full|changed] [--json]\n\nOPTIONS:\n --source-root <path> Repository or source root override; auto-detected when omitted\n --repo-root <path> Alias for --source-root\n --manifest <path> Manifest path; defaults under .codebaseGraph\n --mode <mode> full or changed; defaults to changed\n --no-git Disable Git file discovery and scan the filesystem\n --git-diff Plan files from git diff plus untracked files\n --git-base <rev> Revision used by --git-diff; defaults to HEAD\n --include <glob> Include only paths matching the glob; repeatable\n --exclude <glob> Exclude paths matching the glob; repeatable\n --native-request <path> JSON NativeSyntaxMaterializationRequest payload\n --json Emit JSON output"
}
pub(in crate::cli) fn watch_help() -> &'static str {
"codebase-graph watch\n\nUSAGE:\n codebase-graph watch [--source-root <path>|--repo-root <path>] [--mode full|changed] [--watch-backend auto|native|poll] [--poll-ms <n>] [--debounce-ms <n>]\n\nOPTIONS:\n --source-root <path> Repository or source root override; auto-detected when omitted\n --repo-root <path> Alias for --source-root\n --mode <mode> full or changed; defaults to changed\n --watch-backend <backend> auto, native, or poll; defaults to auto\n --poll-ms <n> Poll interval for poll backend or auto fallback; defaults to 500\n --debounce-ms <n> Quiet-window debounce interval in milliseconds; defaults to 250\n --max-iterations <n> Stop after n refreshes, useful for tests\n --once Run one refresh immediately and exit\n --no-git Disable Git file discovery and scan the filesystem\n --git-diff Refresh files from git diff plus untracked files\n --git-base <rev> Revision used by --git-diff; defaults to HEAD\n --include <glob> Include only paths matching the glob; repeatable\n --exclude <glob> Exclude paths matching the glob; repeatable\n --parallel Parse independent files concurrently; default behavior\n --single-thread Disable concurrent parsing and build partitions serially\n --progress Include progress events in JSON output"
}
pub(in crate::cli) fn setup_help() -> &'static str {
"codebase-graph install\n\nUSAGE:\n codebase-graph install [--mode full|changed] [--mcp-client <client>] [--mcp-config-path <path>] [--skip-mcp-config] [--dry-run] [--instructions-target auto|agents|claude|skip] [--json]\n\nOPTIONS:\n --repo-root <path> Repository root override; auto-detected when omitted\n --mode <mode> full or changed; defaults to changed\n --mcp-client <client> codex, claude, claude-project, lmstudio, github-copilot, hermes, openclaw, generic, copilot-studio, microsoft-copilot, or none\n --mcp-config-path <path> Override MCP client config path\n --skip-mcp-config Do not write MCP client config\n --dry-run Report install changes without writing repo or client state\n --instructions-target <t> auto, agents, claude, or skip\n --no-fts Skip FTS extension loading and index creation\n --no-semantic-enrichment Skip semantic enrichment\n --semantic-provider-mode local_only only; provider-backed modes are not supported by Rust-only production\n --json Emit JSON output"
}
pub(in crate::cli) fn reinstall_help() -> &'static str {
"codebase-graph reinstall\n\nRemove existing graph state and run install again.\n\nUSAGE:\n codebase-graph reinstall [--mode full|changed] [--mcp-client <client>] [--mcp-config-path <path>] [--skip-mcp-config] [--dry-run] [--instructions-target auto|agents|claude|skip] [--json]\n\nOPTIONS:\n --repo-root <path> Repository root override; auto-detected when omitted\n --mode <mode> full or changed; defaults to changed\n --mcp-client <client> codex, claude, claude-project, lmstudio, github-copilot, hermes, openclaw, generic, copilot-studio, microsoft-copilot, or none\n --mcp-config-path <path> Override MCP client config path\n --skip-mcp-config Do not write MCP client config\n --dry-run Report reinstall changes without writing repo or client state\n --instructions-target <t> auto, agents, claude, or skip\n --no-fts Skip FTS extension loading and index creation\n --no-semantic-enrichment Skip semantic enrichment\n --semantic-provider-mode local_only only; provider-backed modes are not supported by Rust-only production\n --json Emit JSON output"
}
pub(in crate::cli) fn uninstall_help() -> &'static str {
"codebase-graph uninstall\n\nUSAGE:\n codebase-graph uninstall [--repo-root <path>] [--config <path>] [--mcp-client <client>|all] [--client-config-path <path>] [--dry-run] [--json]\n\nOPTIONS:\n --repo-root <path> Repository root override; auto-detected when omitted\n --config <path> Setup config path; defaults to .codebaseGraph/config.json\n --mcp-client <client|all> Client registration to remove; defaults to all supported clients\n --client-config-path <path> Override a single target MCP client config path\n --dry-run Report removals without deleting files or updating configs\n --json Emit JSON output"
}
pub(in crate::cli) fn graph_health_help() -> &'static str {
"codebase-graph check-health\n\nUSAGE:\n codebase-graph check-health [--repo-root <path>] [--config <path>] [--db <path>] [--manifest <path>] [--json]\n\nOPTIONS:\n --repo-root <path> Repository root override; auto-detected when omitted\n --config <path> Setup config path; defaults to .codebaseGraph/config.json\n --db <path> Ladybug database path override\n --manifest <path> Manifest path override\n --json Emit JSON output"
}
pub(in crate::cli) fn graph_schema_help() -> &'static str {
"codebase-graph schema\n\nUSAGE:\n codebase-graph schema [--format json|block] [--json] [--pretty]\n\nOPTIONS:\n --format <format> block or json; defaults to block\n --json Emit compact JSON output\n --pretty Pretty-print JSON output"
}
pub(in crate::cli) fn graph_query_helpers_help() -> &'static str {
"codebase-graph query-helpers\n\nUSAGE:\n codebase-graph query-helpers [--format json|block] [--json] [--pretty]\n\nOPTIONS:\n --format <format> block or json; defaults to block\n --json Emit compact JSON output\n --pretty Pretty-print JSON output"
}
pub(in crate::cli) fn graph_architecture_queries_help() -> &'static str {
"codebase-graph codebase-architecture-queries\n\nUSAGE:\n codebase-graph codebase-architecture-queries [--group <name>] [--format json|block] [--json] [--pretty]\n\nOPTIONS:\n --group <name> Optional architecture query group to return\n --format <format> block or json; defaults to block\n --json Emit compact JSON output\n --pretty Pretty-print JSON output"
}
pub(in crate::cli) fn graph_search_help() -> &'static str {
"codebase-graph codebase-search\n\nUSAGE:\n codebase-graph codebase-search <query> [--repo-root <path>] [--config <path>] [--db <path>] [--manifest <path>] [--limit <n>] [--profile <name>] [--detail standard|slim] [--format json|block] [--json]\n\nOPTIONS:\n <query> Search query\n --limit <n> Maximum search hits; defaults to 3\n --profile <name> Context profile label; defaults to brief\n --budget <n> Context budget retained in output payload; defaults to 600\n --context-limit <n> Context item limit retained for compatibility\n --detail <level> standard or slim; defaults to standard\n --repo-root <path> Repository root override; auto-detected when omitted\n --config <path> Setup config path; defaults to .codebaseGraph/config.json\n --db <path> Ladybug database path override\n --manifest <path> Manifest path override\n --format <format> block or json; defaults to block\n --json Emit compact JSON output"
}
pub(in crate::cli) fn graph_context_help() -> &'static str {
"codebase-graph codebase-context\n\nUSAGE:\n codebase-graph codebase-context [query] [--node-id <id> --node-type <type>] [--repo-root <path>] [--config <path>] [--db <path>] [--manifest <path>] [--limit <n>] [--context-limit <n>] [--profile <name>] [--detail standard|slim] [--format json|block] [--json]\n\nOPTIONS:\n [query] Search query used when explicit node lookup is not supplied\n --node-id <id> Explicit graph node id\n --node-type <type> Explicit graph node type\n --limit <n> Maximum search hits in query mode; defaults to 3\n --context-limit <n> Maximum explicit context rows; defaults to 3\n --profile <name> Context profile label; defaults to brief\n --budget <n> Context budget retained in output payload; defaults to 600\n --detail <level> standard or slim; defaults to standard\n --repo-root <path> Repository root override; auto-detected when omitted\n --config <path> Setup config path; defaults to .codebaseGraph/config.json\n --db <path> Ladybug database path override\n --manifest <path> Manifest path override\n --format <format> block or json; defaults to block\n --json Emit compact JSON output"
}
pub(in crate::cli) fn metadata_help(command_name: &str) -> &'static str {
match command_name {
"schema" => graph_schema_help(),
"query-helpers" => graph_query_helpers_help(),
"codebase-architecture-queries" => graph_architecture_queries_help(),
"codebase-search" => graph_search_help(),
"codebase-context" => graph_context_help(),
_ => "codebase-graph metadata command",
}
}
pub(in crate::cli) fn graph_query_help() -> &'static str {
"codebase-graph graph-query\n\nUSAGE:\n codebase-graph graph-query <statement> [--repo-root <path>] [--config <path>] [--db <path>] [--manifest <path>] [--limit <rows>] [--parameters <json>] [--json]\n\nOPTIONS:\n <statement> Restricted read-only Cypher statement\n --parameters <json> JSON object with named query parameters\n --limit <rows> Maximum rows to return; defaults to 100 and caps at 1000\n --repo-root <path> Repository root override; auto-detected when omitted\n --config <path> Setup config path; defaults to .codebaseGraph/config.json\n --db <path> Ladybug database path override\n --manifest <path> Manifest path override\n --json Emit JSON output"
}