feat: add tradingview-cli for composable CLI usage#44
Merged
Conversation
Add a standalone CLI interface alongside the existing MCP server, inspired by the argument that CLI tools are simpler, more composable, and more token-efficient than MCP servers. - New binary: `tradingview-cli` (same npm package, dual mode) - Commands: screen stocks/forex/crypto/etf, lookup, fields, preset(s) - Output formats: JSON (default), CSV, table - Preset support: --preset flag with automatic symbol-based detection - Zero new runtime dependencies (uses Node 18+ util.parseArgs) - 47 new tests covering arg parsing, formatters, and integration - MCP server remains 100% unchanged
Add coverage for: columns override, sort-order override, malformed JSON filters, all result shapes (pairs/crypto/etfs/symbols) in CSV/table, preset with columns+filters merge, empty filters array.
E2E tests verify full CLI dispatch via child process: help, version, presets, fields, screen help, and error handling for unknown commands, invalid asset types, missing symbols/preset names.
- Add CLI Usage section to README with commands, options, output formats - Update project description to mention CLI alongside MCP - Add CLI architecture docs to CLAUDE.md (dual entry points, cli/ helpers) - Update package.json description and add 'cli' keyword
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
tradingview-clibinary alongside existing MCP server — same npm package, dual modeutil.parseArgsCLI Commands
Output Formats
JSON (default, pipeable to
jq), CSV (-f csv), table (-f table)Architecture
src/cli.ts— entry point with dispatchsrc/cli/parseArgs.ts— argument parsing, preset mergingsrc/cli/formatters.ts— JSON/CSV/table outputsrc/cli/help.ts— help textTest plan
npm run buildcompiles cleannpm test— 164 tests pass (94 existing + 70 new CLI tests)