thoughtleaders-cli 0.6.8__tar.gz → 0.6.10__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 (91) hide show
  1. {thoughtleaders_cli-0.6.8 → thoughtleaders_cli-0.6.10}/.claude-plugin/plugin.json +1 -1
  2. {thoughtleaders_cli-0.6.8 → thoughtleaders_cli-0.6.10}/PKG-INFO +7 -6
  3. {thoughtleaders_cli-0.6.8 → thoughtleaders_cli-0.6.10}/README.md +4 -3
  4. {thoughtleaders_cli-0.6.8 → thoughtleaders_cli-0.6.10}/agents/tl-analyst.md +1 -1
  5. {thoughtleaders_cli-0.6.8 → thoughtleaders_cli-0.6.10}/docs/architecture.md +9 -7
  6. {thoughtleaders_cli-0.6.8 → thoughtleaders_cli-0.6.10}/pyproject.toml +10 -3
  7. {thoughtleaders_cli-0.6.8 → thoughtleaders_cli-0.6.10}/skills/tl/SKILL.md +19 -29
  8. thoughtleaders_cli-0.6.10/skills/tl-report-builder/SKILL.md +1397 -0
  9. thoughtleaders_cli-0.6.10/skills/tl-report-builder/examples/e2e_findings.md +264 -0
  10. thoughtleaders_cli-0.6.10/skills/tl-report-builder/examples/golden_queries.md +150 -0
  11. thoughtleaders_cli-0.6.10/skills/tl-report-builder/references/columns_brands.md +106 -0
  12. thoughtleaders_cli-0.6.10/skills/tl-report-builder/references/columns_channels.md +131 -0
  13. thoughtleaders_cli-0.6.10/skills/tl-report-builder/references/columns_content.md +98 -0
  14. thoughtleaders_cli-0.6.10/skills/tl-report-builder/references/columns_sponsorships.md +116 -0
  15. thoughtleaders_cli-0.6.10/skills/tl-report-builder/references/intelligence_filterset_schema.json +392 -0
  16. thoughtleaders_cli-0.6.10/skills/tl-report-builder/references/intelligence_widget_schema.json +194 -0
  17. thoughtleaders_cli-0.6.10/skills/tl-report-builder/references/report_glossary.md +181 -0
  18. thoughtleaders_cli-0.6.10/skills/tl-report-builder/references/sortable_columns.json +64 -0
  19. thoughtleaders_cli-0.6.10/skills/tl-report-builder/references/sponsorship_filterset_schema.json +217 -0
  20. thoughtleaders_cli-0.6.10/skills/tl-report-builder/references/sponsorship_widget_schema.json +165 -0
  21. thoughtleaders_cli-0.6.10/skills/tl-report-builder/references/widgets.md +252 -0
  22. thoughtleaders_cli-0.6.10/skills/tl-report-builder/tools/column_builder.md +384 -0
  23. thoughtleaders_cli-0.6.10/skills/tl-report-builder/tools/database_query.md +210 -0
  24. thoughtleaders_cli-0.6.10/skills/tl-report-builder/tools/keyword_research.md +217 -0
  25. thoughtleaders_cli-0.6.10/skills/tl-report-builder/tools/name_resolver.md +162 -0
  26. thoughtleaders_cli-0.6.10/skills/tl-report-builder/tools/sample_judge.md +223 -0
  27. thoughtleaders_cli-0.6.10/skills/tl-report-builder/tools/similar_channels.md +61 -0
  28. thoughtleaders_cli-0.6.10/skills/tl-report-builder/tools/topic_matcher.md +269 -0
  29. thoughtleaders_cli-0.6.10/skills/tl-report-builder/tools/widget_builder.md +278 -0
  30. {thoughtleaders_cli-0.6.8 → thoughtleaders_cli-0.6.10}/src/tl_cli/__init__.py +1 -1
  31. {thoughtleaders_cli-0.6.8 → thoughtleaders_cli-0.6.10}/src/tl_cli/client/http.py +3 -0
  32. thoughtleaders_cli-0.6.10/src/tl_cli/commands/_comments_common.py +106 -0
  33. {thoughtleaders_cli-0.6.8 → thoughtleaders_cli-0.6.10}/src/tl_cli/commands/brands.py +2 -0
  34. {thoughtleaders_cli-0.6.8 → thoughtleaders_cli-0.6.10}/src/tl_cli/commands/channels.py +2 -0
  35. {thoughtleaders_cli-0.6.8 → thoughtleaders_cli-0.6.10}/src/tl_cli/commands/sponsorships.py +4 -0
  36. {thoughtleaders_cli-0.6.8 → thoughtleaders_cli-0.6.10}/src/tl_cli/commands/uploads.py +2 -0
  37. {thoughtleaders_cli-0.6.8 → thoughtleaders_cli-0.6.10}/src/tl_cli/main.py +0 -2
  38. thoughtleaders_cli-0.6.8/src/tl_cli/commands/comments.py +0 -63
  39. {thoughtleaders_cli-0.6.8 → thoughtleaders_cli-0.6.10}/.claude-plugin/marketplace.json +0 -0
  40. {thoughtleaders_cli-0.6.8 → thoughtleaders_cli-0.6.10}/.github/workflows/python-publish.yml +0 -0
  41. {thoughtleaders_cli-0.6.8 → thoughtleaders_cli-0.6.10}/.gitignore +0 -0
  42. {thoughtleaders_cli-0.6.8 → thoughtleaders_cli-0.6.10}/AGENTS.md +0 -0
  43. {thoughtleaders_cli-0.6.8 → thoughtleaders_cli-0.6.10}/CLAUDE.md +0 -0
  44. {thoughtleaders_cli-0.6.8 → thoughtleaders_cli-0.6.10}/LICENSE +0 -0
  45. {thoughtleaders_cli-0.6.8 → thoughtleaders_cli-0.6.10}/commands/tl-balance.md +0 -0
  46. {thoughtleaders_cli-0.6.8 → thoughtleaders_cli-0.6.10}/commands/tl-reports.md +0 -0
  47. {thoughtleaders_cli-0.6.8 → thoughtleaders_cli-0.6.10}/commands/tl-sponsorships.md +0 -0
  48. {thoughtleaders_cli-0.6.8 → thoughtleaders_cli-0.6.10}/commands/tl.md +0 -0
  49. {thoughtleaders_cli-0.6.8 → thoughtleaders_cli-0.6.10}/hooks/hooks.json +0 -0
  50. {thoughtleaders_cli-0.6.8 → thoughtleaders_cli-0.6.10}/hooks/scripts/post-usage.sh +0 -0
  51. {thoughtleaders_cli-0.6.8 → thoughtleaders_cli-0.6.10}/hooks/scripts/pre-check.sh +0 -0
  52. {thoughtleaders_cli-0.6.8 → thoughtleaders_cli-0.6.10}/skills/tl/references/business-glossary.md +0 -0
  53. {thoughtleaders_cli-0.6.8 → thoughtleaders_cli-0.6.10}/skills/tl/references/elasticsearch-schema.md +0 -0
  54. {thoughtleaders_cli-0.6.8 → thoughtleaders_cli-0.6.10}/skills/tl/references/firebolt-schema.md +0 -0
  55. {thoughtleaders_cli-0.6.8 → thoughtleaders_cli-0.6.10}/skills/tl/references/postgres-schema.md +0 -0
  56. {thoughtleaders_cli-0.6.8 → thoughtleaders_cli-0.6.10}/src/tl_cli/_completions.py +0 -0
  57. {thoughtleaders_cli-0.6.8 → thoughtleaders_cli-0.6.10}/src/tl_cli/auth/__init__.py +0 -0
  58. {thoughtleaders_cli-0.6.8 → thoughtleaders_cli-0.6.10}/src/tl_cli/auth/commands.py +0 -0
  59. {thoughtleaders_cli-0.6.8 → thoughtleaders_cli-0.6.10}/src/tl_cli/auth/login.py +0 -0
  60. {thoughtleaders_cli-0.6.8 → thoughtleaders_cli-0.6.10}/src/tl_cli/auth/pkce.py +0 -0
  61. {thoughtleaders_cli-0.6.8 → thoughtleaders_cli-0.6.10}/src/tl_cli/auth/token_store.py +0 -0
  62. {thoughtleaders_cli-0.6.8 → thoughtleaders_cli-0.6.10}/src/tl_cli/client/__init__.py +0 -0
  63. {thoughtleaders_cli-0.6.8 → thoughtleaders_cli-0.6.10}/src/tl_cli/client/errors.py +0 -0
  64. {thoughtleaders_cli-0.6.8 → thoughtleaders_cli-0.6.10}/src/tl_cli/commands/__init__.py +0 -0
  65. {thoughtleaders_cli-0.6.8 → thoughtleaders_cli-0.6.10}/src/tl_cli/commands/ask.py +0 -0
  66. {thoughtleaders_cli-0.6.8 → thoughtleaders_cli-0.6.10}/src/tl_cli/commands/balance.py +0 -0
  67. {thoughtleaders_cli-0.6.8 → thoughtleaders_cli-0.6.10}/src/tl_cli/commands/changelog.py +0 -0
  68. {thoughtleaders_cli-0.6.8 → thoughtleaders_cli-0.6.10}/src/tl_cli/commands/db.py +0 -0
  69. {thoughtleaders_cli-0.6.8 → thoughtleaders_cli-0.6.10}/src/tl_cli/commands/deals.py +0 -0
  70. {thoughtleaders_cli-0.6.8 → thoughtleaders_cli-0.6.10}/src/tl_cli/commands/describe.py +0 -0
  71. {thoughtleaders_cli-0.6.8 → thoughtleaders_cli-0.6.10}/src/tl_cli/commands/doctor.py +0 -0
  72. {thoughtleaders_cli-0.6.8 → thoughtleaders_cli-0.6.10}/src/tl_cli/commands/matches.py +0 -0
  73. {thoughtleaders_cli-0.6.8 → thoughtleaders_cli-0.6.10}/src/tl_cli/commands/proposals.py +0 -0
  74. {thoughtleaders_cli-0.6.8 → thoughtleaders_cli-0.6.10}/src/tl_cli/commands/recommender.py +0 -0
  75. {thoughtleaders_cli-0.6.8 → thoughtleaders_cli-0.6.10}/src/tl_cli/commands/reports.py +0 -0
  76. {thoughtleaders_cli-0.6.8 → thoughtleaders_cli-0.6.10}/src/tl_cli/commands/schema.py +0 -0
  77. {thoughtleaders_cli-0.6.8 → thoughtleaders_cli-0.6.10}/src/tl_cli/commands/setup.py +0 -0
  78. {thoughtleaders_cli-0.6.8 → thoughtleaders_cli-0.6.10}/src/tl_cli/commands/snapshots.py +0 -0
  79. {thoughtleaders_cli-0.6.8 → thoughtleaders_cli-0.6.10}/src/tl_cli/commands/whoami.py +0 -0
  80. {thoughtleaders_cli-0.6.8 → thoughtleaders_cli-0.6.10}/src/tl_cli/config.py +0 -0
  81. {thoughtleaders_cli-0.6.8 → thoughtleaders_cli-0.6.10}/src/tl_cli/filters.py +0 -0
  82. {thoughtleaders_cli-0.6.8 → thoughtleaders_cli-0.6.10}/src/tl_cli/hints.py +0 -0
  83. {thoughtleaders_cli-0.6.8 → thoughtleaders_cli-0.6.10}/src/tl_cli/output/__init__.py +0 -0
  84. {thoughtleaders_cli-0.6.8 → thoughtleaders_cli-0.6.10}/src/tl_cli/output/formatter.py +0 -0
  85. {thoughtleaders_cli-0.6.8 → thoughtleaders_cli-0.6.10}/src/tl_cli/self_update.py +0 -0
  86. {thoughtleaders_cli-0.6.8 → thoughtleaders_cli-0.6.10}/tests/__init__.py +0 -0
  87. {thoughtleaders_cli-0.6.8 → thoughtleaders_cli-0.6.10}/tests/test_auth.py +0 -0
  88. {thoughtleaders_cli-0.6.8 → thoughtleaders_cli-0.6.10}/tests/test_filters.py +0 -0
  89. {thoughtleaders_cli-0.6.8 → thoughtleaders_cli-0.6.10}/tests/test_output.py +0 -0
  90. {thoughtleaders_cli-0.6.8 → thoughtleaders_cli-0.6.10}/tests/test_sponsorships.py +0 -0
  91. {thoughtleaders_cli-0.6.8 → thoughtleaders_cli-0.6.10}/uv.lock +0 -0
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "tl-cli",
3
- "version": "0.6.8",
3
+ "version": "0.6.10",
4
4
  "description": "ThoughtLeaders CLI — query sponsorship deals, channels, brands, uploads, and intelligence from the terminal",
5
5
  "author": {
6
6
  "name": "ThoughtLeaders",
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: thoughtleaders-cli
3
- Version: 0.6.8
3
+ Version: 0.6.10
4
4
  Summary: ThoughtLeaders CLI — query sponsorship data, channels, brands, and intelligence
5
5
  Project-URL: Homepage, https://thoughtleaders.io
6
6
  Project-URL: Repository, https://github.com/ThoughtLeaders-io/thoughtleaders-cli
@@ -21,8 +21,8 @@ Requires-Dist: authlib>=1.3
21
21
  Requires-Dist: httpx>=0.27
22
22
  Requires-Dist: keyring>=25.0
23
23
  Requires-Dist: rich>=13.0
24
- Requires-Dist: toon-format>=0.9.0b1
25
- Requires-Dist: typer[all]>=0.12
24
+ Requires-Dist: toon-format==0.9.0b1
25
+ Requires-Dist: typer>=0.16
26
26
  Description-Content-Type: text/markdown
27
27
 
28
28
  # tl cli
@@ -125,9 +125,10 @@ tl brands show Nike
125
125
  # Run a saved report
126
126
  tl reports run 42
127
127
 
128
- # Comments on a sponsorship
129
- tl comments list 12345
130
- tl comments add 12345 "Looks good"
128
+ # Comments — available on sponsorships, channels, brands, and uploads
129
+ tl sponsorships comment-list 12345
130
+ tl sponsorships comment-add 12345 "Looks good"
131
+ tl channels comment-add 7890 "Strong recent winners"
131
132
 
132
133
  # Show information about the logged-in user
133
134
  tl whoami
@@ -98,9 +98,10 @@ tl brands show Nike
98
98
  # Run a saved report
99
99
  tl reports run 42
100
100
 
101
- # Comments on a sponsorship
102
- tl comments list 12345
103
- tl comments add 12345 "Looks good"
101
+ # Comments — available on sponsorships, channels, brands, and uploads
102
+ tl sponsorships comment-list 12345
103
+ tl sponsorships comment-add 12345 "Looks good"
104
+ tl channels comment-add 7890 "Strong recent winners"
104
105
 
105
106
  # Show information about the logged-in user
106
107
  tl whoami
@@ -64,7 +64,7 @@ tl db pg "SELECT a.id, a.send_date, a.publish_status, b.name AS brand, ch.channe
64
64
  ORDER BY a.send_date
65
65
  LIMIT 100 OFFSET 0"
66
66
  ```
67
- Then suggest `tl comments add <id> "..."` for each.
67
+ Then suggest `tl sponsorships comment-add <id> "..."` for each.
68
68
 
69
69
  ### Multi-step research (mix raw + similarity)
70
70
  "Find channels similar to the ones Nike sponsors and compare their pricing"
@@ -56,8 +56,9 @@ All data commands use explicit subcommands: `list`, `show`, `create`/`add`. Runn
56
56
  | `tl brands similar <brand>` | Find similar brands (similarity search, 25 credits) |
57
57
  | `tl snapshots channel <id>` | Channel metrics over time (Firebolt channel_metrics) |
58
58
  | `tl snapshots video <id> --channel <id>` | Video view curve (Firebolt article_metrics, --channel required) |
59
- | `tl comments list <adlink-id>` | List comments on a sponsorship (free) |
60
- | `tl comments add <adlink-id> "message"` | Add a comment (free) |
59
+ | `tl <entity> comment-list <id>` | List comments on a sponsorship/channel/brand/upload (free) |
60
+ | `tl <entity> comment-add <id> "message"` | Add a comment (free) |
61
+ | `tl <entity> comment-edit <comment-id> "message"` | Edit one of your own comments (author or superuser; free) |
61
62
 
62
63
  ### Raw database access (escape hatch for joins / aggregations / complex filters)
63
64
 
@@ -180,7 +181,7 @@ tools: [Bash, Read]
180
181
 
181
182
  What the agent does:
182
183
  - **Multi-step research**: "Find channels similar to the ones Nike sponsors and compare their pricing" → `tl brands show Nike --json` → extract initial channel IDs → `tl channels similar <initial-id> --json` for each (enriched with cpm) → union + dedupe → compile comparison table
183
- - **Cross-resource analysis**: "Show me deal slippage and add comments" → `tl sponsorships status:pending send-date-end:2026-03 --json` → identify slipping sponsorships → `tl comments add <id> "flagged for slippage"` for each
184
+ - **Cross-resource analysis**: "Show me deal slippage and add comments" → `tl sponsorships status:pending send-date-end:2026-03 --json` → identify slipping sponsorships → `tl sponsorships comment-add <id> "flagged for slippage"` for each
184
185
  - **Report comparison**: "Compare my Q1 report to Q4" → `tl reports run <id> --since 2026-01 --until 2026-03 --json` → `tl reports run <id> --since 2025-10 --until 2025-12 --json` → synthesize
185
186
  - **Discovery workflows**: "What's my best performing brand this quarter" → `tl sponsorships status:sold purchase-date-start:2026-01 --json` → aggregate by brand → `tl brands show <top_brand> --json` → full picture
186
187
  - **Credit-aware**: checks balance before multi-query workflows, estimates total cost, asks user to confirm if expensive
@@ -315,7 +316,7 @@ tl-cli/
315
316
  │ │ ├── brands.py # tl brands (show/history/similar)
316
317
  │ │ ├── snapshots.py # tl snapshots (Firebolt metrics)
317
318
  │ │ ├── reports.py # tl reports / tl reports run
318
- │ │ ├── comments.py # tl comments (list/add)
319
+ │ │ ├── _comments_common.py # comment-list/add/edit subcommands shared across entity apps
319
320
  │ │ ├── db.py # tl db pg|fb|es (raw read-only queries)
320
321
  │ │ ├── schema.py # tl schema pg|fb|es (live schema docs)
321
322
  │ │ ├── describe.py # tl describe list/show (schema/filter/pricing discovery)
@@ -394,8 +395,9 @@ Most CLI endpoints can reuse existing views/utilities rather than being built fr
394
395
  | **`GET /api/cli/v1/snapshots/video/<id>`** | `api/v2/article-history` (`ArticleHistoryView`) — already queries Firebolt `article_metrics` with pagination, enforces `channel_id:article_id` format. | Direct reuse — already enforces channel_id requirement |
395
396
  | **`GET /api/cli/v1/reports`** | `api/campaigns` (`CampaignViewSet.list`) — returns user's saved campaigns with ownership filtering | Filter to user's campaigns, add CLI envelope |
396
397
  | **`GET /api/cli/v1/reports/<id>/run`** | `api/campaigns/<id>` detail + the view's existing data loading via `load_campaign_data()` in `data_api_utils.py` — campaigns store their filter config, which gets passed to the appropriate data view (SponsorshipsView, ArticlesView, ThoughtleadersView) | Load campaign config → dispatch to appropriate existing view → wrap results |
397
- | **`GET /api/cli/v1/comments/<adlink_id>`** | `api/comments/adlink/<id>` (`CommentsView` GET) already paginated with read status | Add CLI envelope |
398
- | **`POST /api/cli/v1/comments/<adlink_id>`** | `api/comments/adlink/<id>` (`CommentsView` POST) creates comment | Pass through |
398
+ | **`GET /api/cli/v1/<entity_type>/<entity_id>/comments`** | Same query against the `Comment` table; entity_type {sponsorship, channel, brand, upload} | List comments scoped to caller's organization |
399
+ | **`POST /api/cli/v1/<entity_type>/<entity_id>/comments`** | Insert into `Comment` with the matching FK column | Create comment for the named entity |
400
+ | **`PATCH /api/cli/v1/comment/<comment_id>`** | Update `Comment.content` after author/superuser check | Edit a single comment by ID |
399
401
  | **`GET /api/cli/v1/whoami`** | New — reads Profile, Organization, brands M2M | New (joins Profile → User, Organization → Plan, Profile.brands → ChannelList) |
400
402
  | **`GET /api/cli/v1/balance`** | New — reads `CliCreditAccount` | New (simple model read) |
401
403
  | **`GET /api/cli/v1/describe`** | New — static metadata | New (hardcoded resource definitions) |
@@ -563,7 +565,7 @@ Build each command + its server endpoint together:
563
565
  11. `tl snapshots video abc --channel 12345` returns view curve
564
566
  12. `tl reports` lists saved reports (free)
565
567
  13. `tl reports run 789` executes saved report (credits based on results)
566
- 14. `tl comments list 12345` lists comments (free)
568
+ 14. `tl sponsorships comment-list 12345` lists comments (free) — same shape under `tl channels`, `tl brands`, `tl uploads`
567
569
  15. `tl sponsorships create --channel 1 --brand 2` creates proposal (free)
568
570
  16. `tl setup claude` installs plugin
569
571
  17. Claude Code skill triggers on data questions, uses `tl describe` for discovery
@@ -4,7 +4,7 @@ build-backend = "hatchling.build"
4
4
 
5
5
  [project]
6
6
  name = "thoughtleaders-cli"
7
- version = "0.6.8"
7
+ version = "0.6.10"
8
8
  description = "ThoughtLeaders CLI — query sponsorship data, channels, brands, and intelligence"
9
9
  readme = "README.md"
10
10
  license = "MIT"
@@ -23,12 +23,19 @@ classifiers = [
23
23
  "Topic :: Office/Business",
24
24
  ]
25
25
  dependencies = [
26
- "typer[all]>=0.12",
26
+ # `typer` >= 0.16 made click/rich/shellingham required — the `[all]` extra
27
+ # was removed and uv warns about it. Drop the extra to silence the warning;
28
+ # behaviour is identical because the bundled deps are pulled either way.
29
+ "typer>=0.16",
27
30
  "rich>=13.0",
28
31
  "httpx>=0.27",
29
32
  "keyring>=25.0",
30
33
  "authlib>=1.3",
31
- "toon-format>=0.9.0b1",
34
+ # `toon-format` only publishes pre-releases (0.9.0b1 is the only modern
35
+ # release; 0.1.0 is the lone stable). pip/pipx accept `>=0.9.0b1` and pull
36
+ # the beta, but uv refuses pre-releases under `>=` when a stable exists.
37
+ # An exact pin is the one form uv will resolve without `--prerelease=allow`.
38
+ "toon-format==0.9.0b1",
32
39
  ]
33
40
 
34
41
  [project.scripts]
@@ -5,24 +5,17 @@ description: Query and analyze ThoughtLeaders business data using the `tl` CLI.
5
5
 
6
6
  # ThoughtLeaders Data Analyst
7
7
 
8
- You have access to the `tl` CLI which queries ThoughtLeaders' sponsorship platform data. Run it to answer questions about deals, channels, brands, uploads, metrics, and more.
8
+ Run the `tl` CLI to query ThoughtLeaders' sponsorship platform data. Use it to answer questions about deals, channels, brands, uploads, metrics, etc.
9
9
 
10
10
  ## Core Principles
11
11
 
12
- **You are the intelligence layer.** Don't use `tl ask` that's a server-side LLM fallback for users without Claude. Translate the user's question into the right `tl` invocation yourself.
12
+ **Default to raw database queries.** For anything beyond a trivially simple lookup, reach for `tl db pg|fb|es`. Avoid the structured `tl <resource>` commands (`sponsorships list`, `channels show`, `brands history`, etc.).
13
13
 
14
- **Default to raw database queries.** For anything beyond a trivially simple lookup, reach for `tl db pg|fb|es` first. The structured `tl <resource>` commands (`sponsorships list`, `channels show`, `brands history`, etc.) are convenient shorthands for single-record lookups and plain filtered lists — but the moment the question involves joins, aggregations, multi-condition filtering, or anything you'd otherwise post-process client-side, the right tool is a single raw query. One server-side aggregation beats N paginated client-side roll-ups on cost, latency, and the `from+size = 10000` ES cap.
14
+ Always run `tl schema pg|fb|es` before writing a raw query.
15
15
 
16
- Decision rule:
16
+ **When you only need the schema of one table, you MUST call `tl schema pg <table>` (or `tl schema fb <table>`) — never the unscoped form**, to reduce token counts. ES has no per-table form (the index is a single document shape) — `tl schema es` is the only call there.
17
17
 
18
- - **Trivially simple** (use a structured command): "show sponsorship 12345", "list deals for Nike", "show channel 5607", "run report 42".
19
- - **Anything else** (use `tl db pg|fb|es`): aggregations, joins, conditions the structured filters don't expose, comparing across resources, computing rates / shares / percentiles, anything that would otherwise need a paginated walk + client-side reduce.
20
-
21
- Always run `tl describe show <resource>` before using a structured command, and `tl schema pg|fb|es` before writing a raw query.
22
-
23
- **When you only need the schema of one table, you MUST call `tl schema pg <table>` (or `tl schema fb <table>`) — never the unscoped form.** The unscoped `tl schema pg` returns *every* table visible to your role, which is dozens of tables and tens of thousands of tokens; the single-table form returns only the section you need, in the same markdown layout. Reaching for the unscoped form when you already know the table name is a tokens/latency tax with zero benefit. ES has no per-table form (the index is a single document shape) — `tl schema es` is the only call there.
24
-
25
- **Process data with shell tools, not your context window.** Don't pull large result sets into your reasoning context just to filter, sort, count, or extract a field — that wastes tokens and slows you down. Pipe `tl … --json` (or `--csv`) into `jq`, `yq`, `rg`, or `duckdb` and read only the answer back. Pick the tool by shape:
18
+ **Process data with shell tools, not your context window.** Don't pull large result sets into your reasoning context just to filter, sort, count, or extract a field — that wastes tokens and slows you down. Pipe `tl … --json` (or `--csv`, or `--toon`) into `jq`, `yq`, `rg`, or `duckdb`, as appropriate, and read only the answer back. Pick the tool by shape:
26
19
 
27
20
  - **`jq`** — filter, project, and transform JSON. The default for `tl … --json` post-processing.
28
21
  ```bash
@@ -68,6 +61,13 @@ Other key concepts:
68
61
  - **Reports** — saved report configurations that can be re-run
69
62
  - **Comments** — notes attached to sponsorships
70
63
  - **Adspots** — types of ads a channel carries (e.g. mention, dedicated video, product placement). Returned by `tl channels show`; each carries price/cost.
64
+ - **Profiles** — per-organization actors that own sponsorship records on behalf of either side of a deal. A profile is buyer-side or seller-side:
65
+ - *Buyer-side (brand) profiles* — represent a sponsoring brand. Each brand profile has an M2M link to at most one `Brand` record (which are the actual advertiser identities). On a sponsorship, `creator_profile` is the buyer-side profile.
66
+ - *Seller-side (publisher) profiles* — attached to a `Publication`, which in turn owns one or more `Channel` records. A channel's adspots therefore inherit ownership through `channel.publication.profile`.
67
+ - **How to tell them apart** — three signals on the `thoughtleaders_profile` row, used in this order:
68
+ 1. **`persona`** (canonical) — `1=Brand`, `4=Media Agency`, `3=Talent Manager` are buyer-side; `2=Creator`, `5=Creator Service` are seller-side. May be null on legacy rows.
69
+ 2. **`is_advertiser` / `is_publisher`** booleans — feature flags; either or both can be true for staff-style profiles, but on normal user profiles they reliably mark side.
70
+ - Org scoping for sponsorships is profile-mediated: a sponsorship belongs to your org if **either** `creator_profile.organization` (brand side) **or** `ad_spot.channel.publication.profile.organization` (publisher side) matches yours.
71
71
  - **MSN** (Media Selling Network) — the ~11k YouTube channels that have opted in to receive sponsorship offers. A channels is in the MSN group if the `channel.media_selling_network_join_date` field is not null.
72
72
  - **MBN** (Media Buying Network) — the brand-side counterpart to MSN: brand profiles that have opted in to receive proposed sponsorships. A profile is in the MBN group if the `profile.media_buying_network_join_date` field is not null.
73
73
  - **TPP** (ThoughtLeaders Partner Program, a.k.a. "TL channels") — the smaller, exclusive ~169 channels TL manages directly. A channel is in the TPP group if the `channel.is_tl_channel` is True.
@@ -169,26 +169,16 @@ tl recommender top-brands "<tag>" # Top brands (deduped from profiles) load
169
169
  tl recommender inspect-channel <ref> # Show a channel's similarity-profile breakdown (25 credits; Intelligence)
170
170
  tl recommender inspect-brand <ref> # Show a brand profile's ideal similarity-profile breakdown (25 credits; Intelligence)
171
171
  tl recommender similar-to-profile <id> # Channels closest to a brand profile's ideal profile (25 credits; Intelligence)
172
- tl snapshots channel <id> # Channel metrics over time — list curve, mult 1.2 (Firebolt-backed)
173
- tl snapshots video <id> --channel <id> # Video view curve — list curve, mult 1.2 (--channel required!)
174
- tl reports # List saved reports — list curve, mult 1.3
172
+ tl snapshots channel <id> # Channel metrics over time (Firebolt-backed)
173
+ tl snapshots video <id> --channel <id> # Video view curve (--channel required!)
174
+ tl reports # List saved reports
175
175
  tl reports run <id> # Run a saved report (credits vary)
176
- tl comments list <adlink-id> # List comments list curve, mult 1.0
177
- tl comments add <adlink-id> "msg" # Add comment (free)
176
+ tl <entity> comment-list <id> # List comments on a sponsorship/channel/brand/upload
177
+ tl <entity> comment-add <id> "msg" # Add a comment (free)
178
+ tl <entity> comment-edit <comment-id> "msg" # Edit own comment (author or superuser; free)
178
179
  ```
179
180
 
180
- **"List curve"** above means non-linear pricing: `cost = 1 + mult × 0.126 × n^1.2`. The flat 1-credit setup applies to every list call; the `mult` reflects per-resource complexity. `tl db {pg,fb,es}` shares the same curve at mult=1.4. Concrete totals:
181
-
182
- | Rows | mult=1.0 (comments, uploads, sponsorships) | mult=1.2 (snapshots) | mult=1.3 (reports) | mult=1.4 (db.pg / db.fb / db.es) |
183
- |---:|---:|---:|---:|---:|
184
- | 1 | 1 | 1 | 1 | 1 |
185
- | 10 | 3 | 3 | 4 | 4 |
186
- | 50 | 15 | 18 | 19 | 20 |
187
- | 100 | 33 | 39 | 42 | 45 |
188
- | 200 | 74 | 88 | 96 | 103 |
189
- | 500 | 219 | 263 | 285 | 307 |
190
-
191
- The marginal per-row cost is exactly proportional to `mult` — a 1.4× resource costs 1.4× the row part of a 1.0× resource at any size. Splitting a 500-row pull into ten 50-row calls saves ~30% but burns 10 setup floors instead of 1; "narrow the query" is almost always the better move than "fragment the pagination."
181
+ **Credit costs are server-authoritative run `tl describe` (overview) or `tl describe show <resource>` (one resource) to see the current rates and multipliers for every endpoint. Do not memorise rate values they change.**
192
182
 
193
183
  ### Updating records
194
184