feat: add clgraph CLI with analyze, diff, and mcp commands#56
Merged
feat: add clgraph CLI with analyze, diff, and mcp commands#56
Conversation
Adds a Typer-based CLI so users can interact with lineage from the terminal without writing Python. Three subcommands wrap existing Pipeline methods: - clgraph analyze: parse SQL and display table/column/edge summary - clgraph diff: compare lineage between two pipeline versions - clgraph mcp: start MCP server for LLM integration Supports --format table (Rich), json, and dot output modes.
- Replace free-form string format params with AnalyzeFormat/DiffFormat enums so Typer rejects invalid values like --format xml at parse time - Add test for MCP ImportError path (missing fastmcp dependency) - Add test for diff with single SQL files (from_sql_string path) - Add tests for invalid format rejection on both analyze and diff
Rich/Typer inserts ANSI escape sequences around option names in help output (e.g. --pipeline becomes \e[1;36m-\e[0m\e[1;36m-pipeline\e[0m), causing string assertions to fail in CI where color is enabled. Add _strip_ansi() helper and use it in help output tests.
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
clgraphCLI with three subcommands:analyze,diff, andmcpPipelinemethods — no new library logic--format table(Rich),--format json, and--format dotoutput modesDetails
src/clgraph/cli.pytests/test_cli.pypyproject.tomltyper+richdeps,[project.scripts]entry pointuv.lockPost-review fixes (cd96f4a)
strformat params withAnalyzeFormat/DiffFormatenums — Typer now rejects invalid values (e.g.--format xml) at parse timeclgraph.mcpto verify graceful error whenfastmcpis not installedfrom_sql_stringpath through diff commandanalyzeanddiffrejecting unsupported formatsTest plan
clgraph --helpshows all three commandsclgraph analyzeworks with directories, single SQL files, and JSON pipeline filesclgraph diffdetects added/removed/modified columnsfastmcpdependency🤖 Generated with Claude Code