thoughtleaders-cli 0.5.0__tar.gz

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (69) hide show
  1. thoughtleaders_cli-0.5.0/.claude-plugin/marketplace.json +17 -0
  2. thoughtleaders_cli-0.5.0/.claude-plugin/plugin.json +12 -0
  3. thoughtleaders_cli-0.5.0/.github/workflows/python-publish.yml +54 -0
  4. thoughtleaders_cli-0.5.0/.gitignore +9 -0
  5. thoughtleaders_cli-0.5.0/AGENTS.md +106 -0
  6. thoughtleaders_cli-0.5.0/CLAUDE.md +1 -0
  7. thoughtleaders_cli-0.5.0/LICENSE +21 -0
  8. thoughtleaders_cli-0.5.0/PKG-INFO +215 -0
  9. thoughtleaders_cli-0.5.0/README.md +188 -0
  10. thoughtleaders_cli-0.5.0/agents/tl-analyst.md +66 -0
  11. thoughtleaders_cli-0.5.0/commands/tl-balance.md +10 -0
  12. thoughtleaders_cli-0.5.0/commands/tl-brands.md +16 -0
  13. thoughtleaders_cli-0.5.0/commands/tl-channels.md +31 -0
  14. thoughtleaders_cli-0.5.0/commands/tl-reports.md +16 -0
  15. thoughtleaders_cli-0.5.0/commands/tl-sponsorships.md +23 -0
  16. thoughtleaders_cli-0.5.0/commands/tl.md +28 -0
  17. thoughtleaders_cli-0.5.0/docs/architecture.md +551 -0
  18. thoughtleaders_cli-0.5.0/hooks/hooks.json +26 -0
  19. thoughtleaders_cli-0.5.0/hooks/scripts/post-usage.sh +26 -0
  20. thoughtleaders_cli-0.5.0/hooks/scripts/pre-check.sh +30 -0
  21. thoughtleaders_cli-0.5.0/pyproject.toml +60 -0
  22. thoughtleaders_cli-0.5.0/skills/tl/SKILL.md +413 -0
  23. thoughtleaders_cli-0.5.0/skills/tl/references/business-glossary.md +159 -0
  24. thoughtleaders_cli-0.5.0/skills/tl/references/elasticsearch-schema.md +259 -0
  25. thoughtleaders_cli-0.5.0/skills/tl/references/firebolt-schema.md +208 -0
  26. thoughtleaders_cli-0.5.0/skills/tl/references/postgres-schema.md +269 -0
  27. thoughtleaders_cli-0.5.0/src/tl_cli/__init__.py +3 -0
  28. thoughtleaders_cli-0.5.0/src/tl_cli/_completions.py +4 -0
  29. thoughtleaders_cli-0.5.0/src/tl_cli/auth/__init__.py +0 -0
  30. thoughtleaders_cli-0.5.0/src/tl_cli/auth/commands.py +49 -0
  31. thoughtleaders_cli-0.5.0/src/tl_cli/auth/login.py +328 -0
  32. thoughtleaders_cli-0.5.0/src/tl_cli/auth/pkce.py +21 -0
  33. thoughtleaders_cli-0.5.0/src/tl_cli/auth/token_store.py +98 -0
  34. thoughtleaders_cli-0.5.0/src/tl_cli/client/__init__.py +0 -0
  35. thoughtleaders_cli-0.5.0/src/tl_cli/client/errors.py +72 -0
  36. thoughtleaders_cli-0.5.0/src/tl_cli/client/http.py +109 -0
  37. thoughtleaders_cli-0.5.0/src/tl_cli/commands/__init__.py +0 -0
  38. thoughtleaders_cli-0.5.0/src/tl_cli/commands/ask.py +54 -0
  39. thoughtleaders_cli-0.5.0/src/tl_cli/commands/balance.py +68 -0
  40. thoughtleaders_cli-0.5.0/src/tl_cli/commands/brands.py +174 -0
  41. thoughtleaders_cli-0.5.0/src/tl_cli/commands/changelog.py +119 -0
  42. thoughtleaders_cli-0.5.0/src/tl_cli/commands/channels.py +291 -0
  43. thoughtleaders_cli-0.5.0/src/tl_cli/commands/comments.py +63 -0
  44. thoughtleaders_cli-0.5.0/src/tl_cli/commands/db.py +104 -0
  45. thoughtleaders_cli-0.5.0/src/tl_cli/commands/deals.py +52 -0
  46. thoughtleaders_cli-0.5.0/src/tl_cli/commands/describe.py +166 -0
  47. thoughtleaders_cli-0.5.0/src/tl_cli/commands/doctor.py +70 -0
  48. thoughtleaders_cli-0.5.0/src/tl_cli/commands/matches.py +69 -0
  49. thoughtleaders_cli-0.5.0/src/tl_cli/commands/proposals.py +69 -0
  50. thoughtleaders_cli-0.5.0/src/tl_cli/commands/reports.py +346 -0
  51. thoughtleaders_cli-0.5.0/src/tl_cli/commands/schema.py +55 -0
  52. thoughtleaders_cli-0.5.0/src/tl_cli/commands/setup.py +401 -0
  53. thoughtleaders_cli-0.5.0/src/tl_cli/commands/snapshots.py +93 -0
  54. thoughtleaders_cli-0.5.0/src/tl_cli/commands/sponsorships.py +193 -0
  55. thoughtleaders_cli-0.5.0/src/tl_cli/commands/uploads.py +84 -0
  56. thoughtleaders_cli-0.5.0/src/tl_cli/commands/whoami.py +206 -0
  57. thoughtleaders_cli-0.5.0/src/tl_cli/config.py +55 -0
  58. thoughtleaders_cli-0.5.0/src/tl_cli/filters.py +88 -0
  59. thoughtleaders_cli-0.5.0/src/tl_cli/hints.py +53 -0
  60. thoughtleaders_cli-0.5.0/src/tl_cli/main.py +209 -0
  61. thoughtleaders_cli-0.5.0/src/tl_cli/output/__init__.py +0 -0
  62. thoughtleaders_cli-0.5.0/src/tl_cli/output/formatter.py +436 -0
  63. thoughtleaders_cli-0.5.0/src/tl_cli/self_update.py +173 -0
  64. thoughtleaders_cli-0.5.0/tests/__init__.py +0 -0
  65. thoughtleaders_cli-0.5.0/tests/test_auth.py +45 -0
  66. thoughtleaders_cli-0.5.0/tests/test_filters.py +61 -0
  67. thoughtleaders_cli-0.5.0/tests/test_output.py +19 -0
  68. thoughtleaders_cli-0.5.0/tests/test_sponsorships.py +41 -0
  69. thoughtleaders_cli-0.5.0/uv.lock +443 -0
@@ -0,0 +1,17 @@
1
+ {
2
+ "name": "thoughtleaders-plugins",
3
+ "owner": {
4
+ "name": "ThoughtLeaders",
5
+ "email": "dev@thoughtleaders.io"
6
+ },
7
+ "metadata": {
8
+ "description": "ThoughtLeaders CLI plugin for Claude Code — query sponsorship data from the terminal"
9
+ },
10
+ "plugins": [
11
+ {
12
+ "name": "tl-cli",
13
+ "source": "./",
14
+ "description": "ThoughtLeaders CLI — query sponsorship deals, channels, brands, uploads, and intelligence"
15
+ }
16
+ ]
17
+ }
@@ -0,0 +1,12 @@
1
+ {
2
+ "name": "tl-cli",
3
+ "version": "0.5.0",
4
+ "description": "ThoughtLeaders CLI — query sponsorship deals, channels, brands, uploads, and intelligence from the terminal",
5
+ "author": {
6
+ "name": "ThoughtLeaders",
7
+ "email": "dev@thoughtleaders.io"
8
+ },
9
+ "homepage": "https://docs.thoughtleaders.io/cli",
10
+ "repository": "https://github.com/ThoughtLeaders-io/thoughtleaders-cli",
11
+ "keywords": ["thoughtleaders", "sponsorship", "influencer", "data", "cli"]
12
+ }
@@ -0,0 +1,54 @@
1
+ name: Publish to PyPI
2
+
3
+ on:
4
+ release:
5
+ types: [published]
6
+
7
+ permissions:
8
+ contents: read
9
+
10
+ jobs:
11
+ release-build:
12
+ runs-on: ubuntu-latest
13
+ steps:
14
+ - uses: actions/checkout@v4
15
+ - uses: actions/setup-python@v5
16
+ with:
17
+ python-version: "3.12"
18
+
19
+ - name: Verify tag matches pyproject.toml version
20
+ run: |
21
+ tag="${GITHUB_REF_NAME#v}"
22
+ version=$(python -c "import tomllib; print(tomllib.load(open('pyproject.toml','rb'))['project']['version'])")
23
+ if [ "$tag" != "$version" ]; then
24
+ echo "Tag $GITHUB_REF_NAME does not match pyproject version $version" >&2
25
+ exit 1
26
+ fi
27
+
28
+ - name: Build distributions
29
+ run: |
30
+ python -m pip install --upgrade build
31
+ python -m build
32
+
33
+ - uses: actions/upload-artifact@v4
34
+ with:
35
+ name: release-dists
36
+ path: dist/
37
+
38
+ pypi-publish:
39
+ runs-on: ubuntu-latest
40
+ needs: [release-build]
41
+ permissions:
42
+ id-token: write
43
+ environment:
44
+ name: pypi
45
+ url: https://pypi.org/project/thoughtleaders-cli/${{ github.event.release.name }}
46
+ steps:
47
+ - uses: actions/download-artifact@v4
48
+ with:
49
+ name: release-dists
50
+ path: dist/
51
+
52
+ - uses: pypa/gh-action-pypi-publish@release/v1
53
+ with:
54
+ packages-dir: dist/
@@ -0,0 +1,9 @@
1
+ .venv/
2
+ __pycache__/
3
+ *.pyc
4
+ *.egg-info/
5
+ dist/
6
+ build/
7
+ .pytest_cache/
8
+ .ruff_cache/
9
+ .vscode/
@@ -0,0 +1,106 @@
1
+ # Project Overview
2
+
3
+ **tl-cli** is a Python CLI for querying ThoughtLeaders sponsorship data (sponsorships, channels, brands, uploads, snapshots, reports). Built with Typer + Rich + httpx. Designed as an "agent-first tool" — the CLI handles structured commands and output, while the user's AI agent (Claude) provides intelligence.
4
+
5
+ # Architecture
6
+
7
+ ## Entry Point & Command Registration
8
+
9
+ `src/tl_cli/main.py` creates the root Typer app and registers all subcommands via `app.add_typer()`. The console script `tl` maps to `tl_cli.main:cli`, which wraps the Typer app with top-level error handling (respects `--debug`). System commands (`auth`, `setup`, `balance`, `doctor`, `whoami`) are free and don't cost credits.
10
+
11
+ ## Command Pattern (all data commands follow this)
12
+
13
+ Every data command in `src/tl_cli/commands/` uses explicit Typer subcommands:
14
+ - `list` — list/search with `key:value` filters as positional args
15
+ - `show` — detail view by ID
16
+ - `history` — historical data list
17
+ - `create` / `add` — create new records (where applicable)
18
+
19
+ When adding a new data command, follow this pattern. See `sponsorships.py` for the reference implementation.
20
+
21
+ `deals`, `matches`, and `proposals` are shortcut commands that delegate to sponsorships' `do_list`/`do_show`/`do_create` with a pre-set status filter. They reject explicit `status:` filters — users should use `tl sponsorships list` for finer-grained status filtering.
22
+
23
+ ## Filter Parsing (`filters.py`)
24
+
25
+ `parse_filters()` handles `key:value` and `key:"quoted value"` syntax. Returns `dict[str, str]` passed as query params. Date filter keys (listed in `DATE_FILTER_KEYS` — e.g. `since`, `created-at`, `created-at-start`, `publish-date-end`) accept keywords `today`, `yesterday`, `tomorrow`. Sponsorship date fields (`created-at`, `publish-date`, `purchase-date`, `send-date`) each expose three filter shapes: bare `<field>:<date>` matches within that date/period, and `<field>-start:` / `<field>-end:` give inclusive lower/upper bounds (both sides inclusive; partial dates expand to the whole period). Empty-string values result in `IS NULL` queries on the backend.
26
+
27
+ ## Auth Flow (`auth/`)
28
+
29
+ - **PKCE + Auth0**: Browser-based login with localhost callback server (`login.py`)
30
+ - **Token Storage** (`token_store.py`): OS keyring primary, `~/.config/tl/credentials.json` fallback (0o600)
31
+ - **Env override**: `TL_API_KEY` env var takes priority over keyring (for CI)
32
+ - **Auto-refresh**: `TLClient` refreshes expired tokens on 401
33
+
34
+ ## HTTP Client (`client/http.py`)
35
+
36
+ `TLClient` wraps httpx with auth header injection and automatic token refresh on 401. All API calls go through `_request()`.
37
+
38
+ Every request includes an `X-TL-Client: cli/<version>` header. This header is used server-side in a Cloudflare WAF rule to skip managed challenges (JS/CAPTCHA) for CLI traffic on `/api/cli/*` paths. The header is not a secret — Cloudflare bypass is safe because the API enforces its own auth via Bearer tokens. If Cloudflare starts blocking CLI requests again, verify the WAF rule matches the current header value.
39
+
40
+ ## Error Handling (`client/errors.py`)
41
+
42
+ Exit codes: 1 (forbidden/not-found), 2 (auth required), 3 (rate-limit/server-error), 4 (insufficient credits).
43
+
44
+ ## Output (`output/formatter.py`)
45
+
46
+ TTY-aware: Rich tables in terminal, JSON when piped. Flags: `--json`, `--csv`, `--md`. Usage footer (credits charged + balance) goes to stderr. Breadcrumbs suggest next commands.
47
+
48
+ ## AI Agent Integration
49
+
50
+ The CLI integrates with AI coding agents via skills, commands, agents, and hooks.
51
+
52
+ - **Claude Code** - `tl setup claude`
53
+ - **OpenCode** - `tl setup opencode`
54
+
55
+ This repo is also a Claude Code plugin, and can directly be installed as one.
56
+
57
+ ### Skill content boundaries
58
+
59
+ Skills under `skills/` are split into a `SKILL.md` and one or more `references/*.md` files. To prevent drift, each fact has exactly one home:
60
+
61
+ - **CLI-shaped facts live in `SKILL.md`** — command surface, flags, filter syntax, output shapes, workflow, credit-cost curve, status-label mapping the CLI emits.
62
+ - **Schema-shaped facts live in `references/`** — table/column catalogues, accepted-query rules for raw DB engines (PG/ES/Firebolt), index constraints, field types, ID formats.
63
+ - **Business-shaped facts live in `references/business-glossary.md`** (or the equivalent glossary file) — revenue/pipeline definitions, performance grades, ownership semantics, MSN/TPP meaning, team rosters.
64
+
65
+ When adding or updating skill content, place the fact in its single home and link from the others. Do not duplicate or "quick-recap" content across files — recaps are the highest drift surface.
66
+
67
+ ## API Response Envelope
68
+
69
+ All list endpoints return: `{ results, total, limit, offset, usage: { credits_charged, credit_rate, balance_remaining }, _breadcrumbs }`.
70
+
71
+ ### Key Environment Variables
72
+
73
+ - `TL_API_URL` — API base (default: `https://app.thoughtleaders.io`)
74
+ - `TL_API_KEY` — Bearer token override for CI/scripts
75
+ - `TL_AUTH0_DOMAIN`, `TL_AUTH0_CLIENT_ID`, `TL_AUTH0_AUDIENCE` — Auth0 config
76
+ - `TL_LLM_KEY` — User's own LLM key for `tl ask` (avoids surcharge)
77
+
78
+ ## Credit System
79
+
80
+ Every data query costs credits (rates vary by resource). `tl describe` shows rates, `tl balance` shows remaining. The `402` status means insufficient credits. Hooks automatically warn when balance drops below 500.
81
+
82
+ ## Version Bumps
83
+
84
+ The version string is defined in three files and all three must be updated together:
85
+ - `pyproject.toml` — `version = "x.y.z"`
86
+ - `.claude-plugin/plugin.json` — `"version": "x.y.z"`
87
+ - `src/tl_cli/__init__.py` — `__version__ = "x.y.z"`
88
+
89
+ ## Important Constraint
90
+
91
+ `tl snapshots video` requires `--channel` flag — Firebolt queries without a channel partition are unbounded.
92
+
93
+ ## Coding
94
+
95
+ * Do not reference internal architecture of the ThoughtLeaders app in comments or skills. Specifially: do not reference internal table names, field names, API endpoints, Python modules or functions (including the sanitizer).
96
+ * Place all imports at the start of the Python module file
97
+
98
+ # Git commit rules
99
+
100
+ Do not reference internal architecture of the ThoughtLeaders app in commit messages.
101
+
102
+ When a feature is purely server-side but changes the data the CLI receives (e.g. adding, removing, or renaming a field on a response, changing a credit rate, expanding an enum), make a forced empty commit on the tl-cli repo (`git commit --allow-empty`) describing the change. This keeps the CLI repo's history a complete log of what users see, even when no client code had to change.
103
+
104
+ # Be aware of tests
105
+
106
+ Be sure to check if tests need to be updated when changing any data structures or function names, in all repos involved in the change.
@@ -0,0 +1 @@
1
+ @AGENTS.md
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2026 ThoughtLeaders
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
@@ -0,0 +1,215 @@
1
+ Metadata-Version: 2.4
2
+ Name: thoughtleaders-cli
3
+ Version: 0.5.0
4
+ Summary: ThoughtLeaders CLI — query sponsorship data, channels, brands, and intelligence
5
+ Project-URL: Homepage, https://thoughtleaders.io
6
+ Project-URL: Repository, https://github.com/ThoughtLeaders-io/thoughtleaders-cli
7
+ Project-URL: Documentation, https://github.com/ThoughtLeaders-io/thoughtleaders-cli/blob/main/docs/architecture.md
8
+ Author-email: ThoughtLeaders <dev@thoughtleaders.io>
9
+ License-Expression: MIT
10
+ License-File: LICENSE
11
+ Keywords: cli,influencer,sponsorship,thoughtleaders
12
+ Classifier: Development Status :: 3 - Alpha
13
+ Classifier: Environment :: Console
14
+ Classifier: Intended Audience :: End Users/Desktop
15
+ Classifier: License :: OSI Approved :: MIT License
16
+ Classifier: Programming Language :: Python :: 3
17
+ Classifier: Programming Language :: Python :: 3.12
18
+ Classifier: Topic :: Office/Business
19
+ Requires-Python: >=3.12
20
+ Requires-Dist: authlib>=1.3
21
+ Requires-Dist: httpx>=0.27
22
+ Requires-Dist: keyring>=25.0
23
+ Requires-Dist: rich>=13.0
24
+ Requires-Dist: toon-format>=0.9.0b1
25
+ Requires-Dist: typer[all]>=0.12
26
+ Description-Content-Type: text/markdown
27
+
28
+ # tl cli
29
+
30
+ ThoughtLeaders CLI — query sponsorship data, channels, brands, and intelligence from the terminal.
31
+
32
+ ## Install
33
+
34
+ ### As a developer
35
+
36
+ ```bash
37
+ git clone https://github.com/ThoughtLeaders-io/thoughtleaders-cli.git
38
+ cd thoughtleaders-cli
39
+ python -m venv .venv
40
+ pip install -e .
41
+ ```
42
+
43
+ ### As a user
44
+
45
+ ```bash
46
+ pipx install git+https://github.com/ThoughtLeaders-io/thoughtleaders-cli.git
47
+ # or
48
+ uv tool install git+https://github.com/ThoughtLeaders-io/thoughtleaders-cli.git
49
+ # or (but try to avoid it because just "pip" will not create a new venv for the product - only "uv" and "pipx" will do that)
50
+ pip install git+https://github.com/ThoughtLeaders-io/thoughtleaders-cli.git
51
+ ```
52
+
53
+ Then set up:
54
+ ```bash
55
+ tl auth login # authenticate with ThoughtLeaders
56
+ tl setup claude # install Claude Code plugin (optional)
57
+ tl setup opencode # install OpenCode skill (optional)
58
+ ```
59
+
60
+ ## Quick Start
61
+
62
+ ```bash
63
+ # Login
64
+ tl auth login
65
+
66
+ # Query sponsorships
67
+ tl sponsorships list status:sold brand:"Nike" purchase-date:2026-01
68
+
69
+ # Shortcut commands for sponsorship types
70
+ tl deals list brand:"Nike" # Agreed-upon sponsorships
71
+ tl deals list created-at:today # Deals created today (date keywords: today, yesterday, tomorrow)
72
+ tl matches list # Possible brand-channel pairings
73
+ tl proposals list # Matches proposed to both sides
74
+
75
+ # Show a specific sponsorship
76
+ tl sponsorships show 12345
77
+
78
+ # Search videos (note: this only shows "your" videos)
79
+ tl uploads list q:code --csv
80
+
81
+ # Show upload details (supports colon-containing IDs)
82
+ tl uploads show 1174310:0BehkmVa7ak
83
+
84
+ # Search channels. msn and tpp are tri-state filters (yes/no/both; default 'both').
85
+ # msn = opted-in to receive sponsorship offers; tpp = exclusively TL-managed.
86
+ # Both are also returned as boolean fields on every channel response.
87
+ tl channels list category:cooking min-subs:100k
88
+ tl channels list msn:yes # MSN channels only (~11k)
89
+ tl channels list tpp:yes # TPP channels only (~169)
90
+ tl channels list msn:no min-subs:500k # big non-MSN channels
91
+
92
+ # Show channel detail — accepts numeric ID or channel name.
93
+ # Names that match more than one active channel print a candidate list
94
+ # and exit; retry with a specific ID.
95
+ tl channels show 12345
96
+ tl channels show "Economics Explained"
97
+
98
+ # Find similar channels (vector recommender, 50 credits, Intelligence plan).
99
+ # msn: is tri-state (default msn:yes): yes = MSN only, no = non-MSN only, both = no filter.
100
+ # tpp: is tri-state (default tpp:both): yes = TPP only, no = non-TPP only, both = no filter.
101
+ # Same ID-or-name resolution rules as `channels show`.
102
+ tl channels similar 12345 --limit 10
103
+ tl channels similar "Tremending girls" min-score:0.85 --limit 5
104
+
105
+ # Brand intelligence
106
+ tl brands show Nike
107
+
108
+ # Run a saved report
109
+ tl reports run 42
110
+
111
+ # Comments on a sponsorship
112
+ tl comments list 12345
113
+ tl comments add 12345 "Looks good"
114
+
115
+ # Show information about the logged-in user
116
+ tl whoami
117
+
118
+ # Check credits
119
+ tl balance
120
+ ```
121
+
122
+ ## Credits
123
+
124
+ Every data query costs credits based on the type and number of results. Use `tl describe` to see credit rates and `tl balance` to check your balance.
125
+
126
+ ```bash
127
+ tl describe # All resources + credit costs
128
+ tl describe show sponsorships --filters # Available filters for sponsorships
129
+ tl balance # Your credit balance
130
+ ```
131
+
132
+ # Terminology
133
+
134
+ ThoughtLeaders has its internal terminology that's exposed throughout this tool.
135
+
136
+ * **Brands** - Usually companies, sometimes individual products. Brands are the sponsors.
137
+ * **Channels** - Usually YouTube channels, sometimes podcasts. Channels are creators, they are being sponsored.
138
+ * **Sponsorships** - Either possible or realised business deals between brands and channels. There are several specific types of sponsorships:
139
+ * *Deals* - Contractually agreed-upon sponsorships. AKA sold sponsorships. They can be either in a production pipeline or already published / live.
140
+ * *Matches* - Possible matches between brands and channels, i.e. all pairings that ThoughtLeaders thinks could possibly be right for each other.
141
+ * *Proposals* - Matches that are actually proposed to both sides to consider.
142
+ - **Adspots** — types of ads a channel carries (e.g. mention, dedicated video, product placement). Returned by `tl channels show`; each carries price/cost and computed CPM.
143
+
144
+ Sponsorships are the centre of attention in ThoughtLeaders - all other analytics and operations serve to produce or optimise sponsorships.
145
+ Note that the term "Sponsorship" is wide, and can encompass deals that yet need to be approved by either side. There is a funnel of
146
+ sponsorship types: the pool of Sponsorships is large, the pool of Metches (considered from either Brand or Channel side) is smaller,
147
+ the pool of Proposals is yet smaller, and the pool of Deals is the smallest.
148
+
149
+ # Integrations
150
+
151
+ ## Claude Code Integration
152
+
153
+ If you use Claude Code, install the plugin for natural language access:
154
+
155
+ ```bash
156
+ tl setup claude
157
+ ```
158
+
159
+ This registers the ThoughtLeaders marketplace, installs the plugin, and copies skills to `~/.claude/` for short `/tl` invocation. If the `claude` binary isn't on PATH, it still installs the standalone skills and prints manual instructions for the plugin.
160
+
161
+ ### Using the skills
162
+
163
+ Talk naturally in Claude Code:
164
+
165
+ ```
166
+ /tl Which channels did we sponsor in Q1?
167
+ /tl sold sponsorships for Nike in Q1
168
+ /tl show me pending proposals with send dates in April
169
+ /tl what channels does Nike sponsor?
170
+ /tl check my balance
171
+ ```
172
+
173
+ Resource-specific slash commands:
174
+ ```
175
+ /tl-sponsorships pending with send dates in April
176
+ /tl-channels cooking channels over 100k subscribers
177
+ /tl-brands Nike
178
+ /tl-reports run my Q1 pipeline
179
+ /tl-balance
180
+ ```
181
+
182
+ ### Updating
183
+
184
+ ```bash
185
+ tl setup claude # re-installs skills and updates plugin
186
+ ```
187
+
188
+ ## OpenCode Integration
189
+
190
+ ```bash
191
+ tl setup opencode
192
+ ```
193
+
194
+ This copies the tl skill to `~/.config/opencode/skills/` where OpenCode discovers it automatically. The agent will use it when you ask about sponsorships, deals, channels, or brands.
195
+
196
+ ## Output Formats
197
+
198
+ By default, output is a styled table in the terminal and JSON when piped.
199
+
200
+ ```bash
201
+ tl sponsorships list status:sold # Pretty table
202
+ tl sponsorships list status:sold --json # JSON
203
+ tl sponsorships list status:sold --csv > sponsorships.csv # CSV
204
+ tl sponsorships list status:sold --json | jq '.results' # Pipe to jq
205
+ ```
206
+
207
+ ## Documentation
208
+
209
+ - [Architecture & Design](docs/architecture.md) — full design doc covering commands, data scoping, credit metering, and server-side API
210
+ - `tl describe` — discover available resources, fields, filters, and credit costs from the CLI itself
211
+ - `tl <command> --help` — detailed help for any command
212
+
213
+ # Notes
214
+
215
+ * Tested with OpenCode and the `nemotron-cascade-2-30b-a3b-i1` local model.
@@ -0,0 +1,188 @@
1
+ # tl cli
2
+
3
+ ThoughtLeaders CLI — query sponsorship data, channels, brands, and intelligence from the terminal.
4
+
5
+ ## Install
6
+
7
+ ### As a developer
8
+
9
+ ```bash
10
+ git clone https://github.com/ThoughtLeaders-io/thoughtleaders-cli.git
11
+ cd thoughtleaders-cli
12
+ python -m venv .venv
13
+ pip install -e .
14
+ ```
15
+
16
+ ### As a user
17
+
18
+ ```bash
19
+ pipx install git+https://github.com/ThoughtLeaders-io/thoughtleaders-cli.git
20
+ # or
21
+ uv tool install git+https://github.com/ThoughtLeaders-io/thoughtleaders-cli.git
22
+ # or (but try to avoid it because just "pip" will not create a new venv for the product - only "uv" and "pipx" will do that)
23
+ pip install git+https://github.com/ThoughtLeaders-io/thoughtleaders-cli.git
24
+ ```
25
+
26
+ Then set up:
27
+ ```bash
28
+ tl auth login # authenticate with ThoughtLeaders
29
+ tl setup claude # install Claude Code plugin (optional)
30
+ tl setup opencode # install OpenCode skill (optional)
31
+ ```
32
+
33
+ ## Quick Start
34
+
35
+ ```bash
36
+ # Login
37
+ tl auth login
38
+
39
+ # Query sponsorships
40
+ tl sponsorships list status:sold brand:"Nike" purchase-date:2026-01
41
+
42
+ # Shortcut commands for sponsorship types
43
+ tl deals list brand:"Nike" # Agreed-upon sponsorships
44
+ tl deals list created-at:today # Deals created today (date keywords: today, yesterday, tomorrow)
45
+ tl matches list # Possible brand-channel pairings
46
+ tl proposals list # Matches proposed to both sides
47
+
48
+ # Show a specific sponsorship
49
+ tl sponsorships show 12345
50
+
51
+ # Search videos (note: this only shows "your" videos)
52
+ tl uploads list q:code --csv
53
+
54
+ # Show upload details (supports colon-containing IDs)
55
+ tl uploads show 1174310:0BehkmVa7ak
56
+
57
+ # Search channels. msn and tpp are tri-state filters (yes/no/both; default 'both').
58
+ # msn = opted-in to receive sponsorship offers; tpp = exclusively TL-managed.
59
+ # Both are also returned as boolean fields on every channel response.
60
+ tl channels list category:cooking min-subs:100k
61
+ tl channels list msn:yes # MSN channels only (~11k)
62
+ tl channels list tpp:yes # TPP channels only (~169)
63
+ tl channels list msn:no min-subs:500k # big non-MSN channels
64
+
65
+ # Show channel detail — accepts numeric ID or channel name.
66
+ # Names that match more than one active channel print a candidate list
67
+ # and exit; retry with a specific ID.
68
+ tl channels show 12345
69
+ tl channels show "Economics Explained"
70
+
71
+ # Find similar channels (vector recommender, 50 credits, Intelligence plan).
72
+ # msn: is tri-state (default msn:yes): yes = MSN only, no = non-MSN only, both = no filter.
73
+ # tpp: is tri-state (default tpp:both): yes = TPP only, no = non-TPP only, both = no filter.
74
+ # Same ID-or-name resolution rules as `channels show`.
75
+ tl channels similar 12345 --limit 10
76
+ tl channels similar "Tremending girls" min-score:0.85 --limit 5
77
+
78
+ # Brand intelligence
79
+ tl brands show Nike
80
+
81
+ # Run a saved report
82
+ tl reports run 42
83
+
84
+ # Comments on a sponsorship
85
+ tl comments list 12345
86
+ tl comments add 12345 "Looks good"
87
+
88
+ # Show information about the logged-in user
89
+ tl whoami
90
+
91
+ # Check credits
92
+ tl balance
93
+ ```
94
+
95
+ ## Credits
96
+
97
+ Every data query costs credits based on the type and number of results. Use `tl describe` to see credit rates and `tl balance` to check your balance.
98
+
99
+ ```bash
100
+ tl describe # All resources + credit costs
101
+ tl describe show sponsorships --filters # Available filters for sponsorships
102
+ tl balance # Your credit balance
103
+ ```
104
+
105
+ # Terminology
106
+
107
+ ThoughtLeaders has its internal terminology that's exposed throughout this tool.
108
+
109
+ * **Brands** - Usually companies, sometimes individual products. Brands are the sponsors.
110
+ * **Channels** - Usually YouTube channels, sometimes podcasts. Channels are creators, they are being sponsored.
111
+ * **Sponsorships** - Either possible or realised business deals between brands and channels. There are several specific types of sponsorships:
112
+ * *Deals* - Contractually agreed-upon sponsorships. AKA sold sponsorships. They can be either in a production pipeline or already published / live.
113
+ * *Matches* - Possible matches between brands and channels, i.e. all pairings that ThoughtLeaders thinks could possibly be right for each other.
114
+ * *Proposals* - Matches that are actually proposed to both sides to consider.
115
+ - **Adspots** — types of ads a channel carries (e.g. mention, dedicated video, product placement). Returned by `tl channels show`; each carries price/cost and computed CPM.
116
+
117
+ Sponsorships are the centre of attention in ThoughtLeaders - all other analytics and operations serve to produce or optimise sponsorships.
118
+ Note that the term "Sponsorship" is wide, and can encompass deals that yet need to be approved by either side. There is a funnel of
119
+ sponsorship types: the pool of Sponsorships is large, the pool of Metches (considered from either Brand or Channel side) is smaller,
120
+ the pool of Proposals is yet smaller, and the pool of Deals is the smallest.
121
+
122
+ # Integrations
123
+
124
+ ## Claude Code Integration
125
+
126
+ If you use Claude Code, install the plugin for natural language access:
127
+
128
+ ```bash
129
+ tl setup claude
130
+ ```
131
+
132
+ This registers the ThoughtLeaders marketplace, installs the plugin, and copies skills to `~/.claude/` for short `/tl` invocation. If the `claude` binary isn't on PATH, it still installs the standalone skills and prints manual instructions for the plugin.
133
+
134
+ ### Using the skills
135
+
136
+ Talk naturally in Claude Code:
137
+
138
+ ```
139
+ /tl Which channels did we sponsor in Q1?
140
+ /tl sold sponsorships for Nike in Q1
141
+ /tl show me pending proposals with send dates in April
142
+ /tl what channels does Nike sponsor?
143
+ /tl check my balance
144
+ ```
145
+
146
+ Resource-specific slash commands:
147
+ ```
148
+ /tl-sponsorships pending with send dates in April
149
+ /tl-channels cooking channels over 100k subscribers
150
+ /tl-brands Nike
151
+ /tl-reports run my Q1 pipeline
152
+ /tl-balance
153
+ ```
154
+
155
+ ### Updating
156
+
157
+ ```bash
158
+ tl setup claude # re-installs skills and updates plugin
159
+ ```
160
+
161
+ ## OpenCode Integration
162
+
163
+ ```bash
164
+ tl setup opencode
165
+ ```
166
+
167
+ This copies the tl skill to `~/.config/opencode/skills/` where OpenCode discovers it automatically. The agent will use it when you ask about sponsorships, deals, channels, or brands.
168
+
169
+ ## Output Formats
170
+
171
+ By default, output is a styled table in the terminal and JSON when piped.
172
+
173
+ ```bash
174
+ tl sponsorships list status:sold # Pretty table
175
+ tl sponsorships list status:sold --json # JSON
176
+ tl sponsorships list status:sold --csv > sponsorships.csv # CSV
177
+ tl sponsorships list status:sold --json | jq '.results' # Pipe to jq
178
+ ```
179
+
180
+ ## Documentation
181
+
182
+ - [Architecture & Design](docs/architecture.md) — full design doc covering commands, data scoping, credit metering, and server-side API
183
+ - `tl describe` — discover available resources, fields, filters, and credit costs from the CLI itself
184
+ - `tl <command> --help` — detailed help for any command
185
+
186
+ # Notes
187
+
188
+ * Tested with OpenCode and the `nemotron-cascade-2-30b-a3b-i1` local model.