Skip to content

feat: add tradingview-cli for composable CLI usage#44

Merged
bearmug merged 5 commits into
mainfrom
feature/tradingview-cli
Mar 27, 2026
Merged

feat: add tradingview-cli for composable CLI usage#44
bearmug merged 5 commits into
mainfrom
feature/tradingview-cli

Conversation

@bearmug

@bearmug bearmug commented Mar 27, 2026

Copy link
Copy Markdown
Contributor

Summary

  • Add tradingview-cli binary alongside existing MCP server — same npm package, dual mode
  • Inspired by mariozechner's post on CLI tools being simpler, more composable, and more token-efficient than MCP servers
  • Zero new runtime dependencies — uses Node 18+ built-in util.parseArgs
  • 70 new CLI tests (unit + end-to-end) on top of existing 94

CLI Commands

tradingview-cli screen stocks --preset quality_stocks --limit 10
tradingview-cli screen stocks --filters '[{"field":"RSI","operator":"in_range","value":[40,60]}]'
tradingview-cli lookup NASDAQ:AAPL TVC:SPX
tradingview-cli fields --asset-type stock --category fundamental
tradingview-cli presets

Output Formats

JSON (default, pipeable to jq), CSV (-f csv), table (-f table)

Architecture

  • src/cli.ts — entry point with dispatch
  • src/cli/parseArgs.ts — argument parsing, preset merging
  • src/cli/formatters.ts — JSON/CSV/table output
  • src/cli/help.ts — help text
  • All existing MCP code is untouched

Test plan

  • npm run build compiles clean
  • npm test — 164 tests pass (94 existing + 70 new CLI tests)
  • E2E tests: --help, --version, presets, fields, preset, screen help
  • E2E error tests: unknown command, invalid asset type, missing symbols, unknown preset
  • Smoke test: CSV, table, JSON output formats
  • Verify MCP mode unaffected (no changes to src/index.ts or existing files)

bearmug added 5 commits March 28, 2026 00:30
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
@bearmug bearmug enabled auto-merge (squash) March 27, 2026 23:57
@bearmug bearmug merged commit 0206352 into main Mar 27, 2026
3 of 4 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant