You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
* docs: add CLI composability roadmap item (3.17) and plugin system to remaining items
Add Phase 3.17 covering practical CLI cleanup: shared openGraph() helper,
thin CLI dispatcher, and universal output formatter. These close the gap
between the well-layered internal architecture (pure *Data() functions,
MCP/batch composition) and the monolithic CLI surface.
Also adds a plugin system for custom commands to 3.16 remaining items,
gated on user demand.
* fix(docs): address review feedback on 3.17 CLI Composability section
- Update context paragraph to reflect 3.6 refactor (cli.js is now an
8-line thin wrapper, not a 2K-line monolith)
- Remove "Thin CLI dispatcher" bullet (already done in 3.6), merge
remaining delta (openGraph helper extraction) into first bullet
- Fix stale path src/infrastructure/result-formatter.js to
src/presentation/result-formatter.js and update other affected paths
to reflect the src/cli/ directory structure from 3.6
@@ -987,6 +987,18 @@ These items from the original Phase 3 are still valid but less urgent:
987
987
-**Query result caching:** LRU/TTL cache between analysis layer and repository. More valuable now with 34 MCP tools.
988
988
-**Configuration profiles:**`--profile backend` for monorepos with multiple services.
989
989
-**Pagination standardization:** SQL-level LIMIT/OFFSET in repository + command runner shaping.
990
+
-**Plugin system for custom commands:** Drop a JS module into `~/.codegraph/plugins/` (or `.codegraph/plugins/`) and it becomes a CLI command. Plugin contract: `export function data(db, args) → object` + `export const meta = { name, description, args }`. Auto-discovered at startup. Low priority until there's user demand for extensibility beyond the 34 built-in commands.
991
+
992
+
### 3.17 -- CLI Composability
993
+
994
+
Practical cleanup to make the CLI surface match the internal composability that `*Data()` functions and MCP already provide. Not a philosophical overhaul -- just eliminating duplication and making the human CLI path as clean as the programmatic one.
995
+
996
+
**Context:** The internal architecture is already well-layered -- pure `*Data()` functions, read/write separation, NDJSON support. The 3.6 refactor split the former 1,525-line `cli.js` into `src/cli/` with 40 command modules and an 8-line thin wrapper, but individual commands still repeat DB open/close boilerplate, and output formatting is scattered across command files. MCP and `batch_query` already solve in-process composition for AI agents; these items fix the equivalent gaps on the CLI side.
997
+
998
+
-**Extract shared `openGraph()` helper.** The thin dispatcher is done (3.6), but each of the 40 `commands/*.js` files still inlines its own DB-open / config-load / cleanup sequence. A single `openGraph(opts)` helper returning `{ db, rootDir, config }` with engine selection, config loading, and cleanup eliminates ~200 lines of per-command duplication.
999
+
-**Universal output formatter.** Complete the existing `result-formatter.js` into a full presentation layer that handles `--json`, `--ndjson`, `--table`, `--csv` for any data function. Commands produce data; the formatter renders. Eliminates per-command format-switching logic.
0 commit comments