buzzsprout-cli 0.1.1

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 (54) hide show
  1. checksums.yaml +7 -0
  2. data/LICENSE +21 -0
  3. data/README.md +271 -0
  4. data/bin/buzzsprout +6 -0
  5. data/lib/buzzsprout/animation/wordmark.rb +41 -0
  6. data/lib/buzzsprout/animation.rb +181 -0
  7. data/lib/buzzsprout/cli.rb +215 -0
  8. data/lib/buzzsprout/client.rb +306 -0
  9. data/lib/buzzsprout/color.rb +195 -0
  10. data/lib/buzzsprout/commands/base.rb +188 -0
  11. data/lib/buzzsprout/commands/brand_affiliations.rb +98 -0
  12. data/lib/buzzsprout/commands/chapters.rb +58 -0
  13. data/lib/buzzsprout/commands/contributors.rb +119 -0
  14. data/lib/buzzsprout/commands/downloads.rb +139 -0
  15. data/lib/buzzsprout/commands/episodes.rb +116 -0
  16. data/lib/buzzsprout/commands/fan_mail.rb +216 -0
  17. data/lib/buzzsprout/commands/feed_verifications.rb +74 -0
  18. data/lib/buzzsprout/commands/listings.rb +159 -0
  19. data/lib/buzzsprout/commands/login.rb +264 -0
  20. data/lib/buzzsprout/commands/podcasts.rb +85 -0
  21. data/lib/buzzsprout/commands/podrolls.rb +74 -0
  22. data/lib/buzzsprout/commands/skills.rb +144 -0
  23. data/lib/buzzsprout/commands/status.rb +64 -0
  24. data/lib/buzzsprout/commands/team.rb +75 -0
  25. data/lib/buzzsprout/commands/transcripts.rb +100 -0
  26. data/lib/buzzsprout/commands/update.rb +36 -0
  27. data/lib/buzzsprout/commands/uploads.rb +134 -0
  28. data/lib/buzzsprout/config.rb +125 -0
  29. data/lib/buzzsprout/formatter.rb +68 -0
  30. data/lib/buzzsprout/group_help.rb +74 -0
  31. data/lib/buzzsprout/oauth.rb +203 -0
  32. data/lib/buzzsprout/options.rb +155 -0
  33. data/lib/buzzsprout/podcast_picker.rb +328 -0
  34. data/lib/buzzsprout/redact.rb +65 -0
  35. data/lib/buzzsprout/updater.rb +230 -0
  36. data/lib/buzzsprout/version.rb +5 -0
  37. data/skills/README.md +62 -0
  38. data/skills/brand_affiliations/SKILL.md +52 -0
  39. data/skills/buzzsprout/SKILL.md +111 -0
  40. data/skills/chapters/SKILL.md +49 -0
  41. data/skills/contributors/SKILL.md +58 -0
  42. data/skills/episodes/SKILL.md +61 -0
  43. data/skills/fan_mail/SKILL.md +53 -0
  44. data/skills/feed_verifications/SKILL.md +51 -0
  45. data/skills/insertion_points/SKILL.md +50 -0
  46. data/skills/listings/SKILL.md +52 -0
  47. data/skills/podcasts/SKILL.md +57 -0
  48. data/skills/podrolls/SKILL.md +49 -0
  49. data/skills/soundbites/SKILL.md +51 -0
  50. data/skills/stats/SKILL.md +65 -0
  51. data/skills/team/SKILL.md +10 -0
  52. data/skills/transcripts/SKILL.md +60 -0
  53. data/skills/uploads/SKILL.md +68 -0
  54. metadata +102 -0
@@ -0,0 +1,65 @@
1
+ # frozen_string_literal: true
2
+
3
+ require 'uri'
4
+
5
+ module Buzzsprout
6
+ module Redact
7
+ PLACEHOLDER = '[REDACTED]'
8
+ MIN_LITERAL_LENGTH = 8
9
+ SECRET_KEYS = 'api_token|access_token|refresh_token|code_verifier|client_secret|code'
10
+ QUERY_KEYS = /\A(#{SECRET_KEYS})\z/i
11
+ AUTH_VALUE = /Token\s+token=\S+/i
12
+ QUERY_PAIR = /(?<![\w-])(?:#{SECRET_KEYS})=[^&\s"'\\]+/i
13
+ JSON_SECRET_KEY = /"(#{SECRET_KEYS})"\s*:\s*"(?:\\.|[^"\\])*"/i
14
+
15
+ module_function
16
+
17
+ def string(text, known: nil)
18
+ s = text.to_s.dup
19
+ secrets(known).each do |secret|
20
+ escaped = Regexp.escape(secret)
21
+ s.gsub!(/Token\s+token=#{escaped}/i, "Token token=#{PLACEHOLDER}")
22
+ s.gsub!(/(api_token|access_token|refresh_token|code_verifier|client_secret)=#{escaped}/i, "\\1=#{PLACEHOLDER}")
23
+ s.gsub!(secret, PLACEHOLDER) if secret.length >= MIN_LITERAL_LENGTH
24
+ end
25
+ s.gsub!(/Bearer\s+\S+/i, "Bearer #{PLACEHOLDER}")
26
+ s.gsub!(AUTH_VALUE, "Token token=#{PLACEHOLDER}")
27
+ s.gsub!(QUERY_PAIR) { |pair| "#{pair.split('=', 2).first}=#{PLACEHOLDER}" }
28
+ s.gsub!(JSON_SECRET_KEY, "\"\\1\": \"#{PLACEHOLDER}\"")
29
+ s
30
+ end
31
+
32
+ def uri(value, known: nil)
33
+ raw = value.is_a?(URI) ? value.dup : URI(value.to_s)
34
+ if raw.query
35
+ pairs = URI.decode_www_form(raw.query).map do |key, val|
36
+ QUERY_KEYS.match?(key) ? [key, PLACEHOLDER] : [key, val]
37
+ end
38
+ raw.query = URI.encode_www_form(pairs)
39
+ end
40
+ string(raw.to_s, known: known)
41
+ rescue URI::InvalidURIError
42
+ string(value.to_s, known: known)
43
+ end
44
+
45
+ def secrets(known)
46
+ list = []
47
+ Array(known).each do |value|
48
+ text = value.to_s
49
+ list << text unless text.empty?
50
+ end
51
+ env = ENV['BUZZSPROUT_API_TOKEN'].to_s
52
+ list << env unless env.empty?
53
+ if defined?(Config)
54
+ begin
55
+ list.concat(Array(Config.loaded[:oauth]&.values_at(:access_token, :refresh_token)).compact)
56
+ stored = Config.token.to_s
57
+ list << stored unless stored.empty?
58
+ rescue StandardError
59
+ nil
60
+ end
61
+ end
62
+ list.uniq.sort_by { |item| -item.length }
63
+ end
64
+ end
65
+ end
@@ -0,0 +1,230 @@
1
+ # frozen_string_literal: true
2
+
3
+ require 'net/http'
4
+ require 'open3'
5
+ require 'rbconfig'
6
+ require 'timeout'
7
+
8
+ module Buzzsprout
9
+ class Updater
10
+ REPOSITORY = 'https://github.com/buzzsprout/buzzsprout-cli.git'
11
+ LEGACY_REPOSITORY = 'https://github.com/higher-pixels/buzzsprout-cli.git'
12
+ ENDPOINT = 'https://api.github.com/repos/buzzsprout/buzzsprout-cli/commits/main'
13
+ RELEASE_ENDPOINT = 'https://api.github.com/repos/buzzsprout/buzzsprout-cli/releases/latest'
14
+ INTERVAL = 86_400
15
+
16
+ def initialize(root: File.expand_path('../..', __dir__), repository: REPOSITORY)
17
+ @root = File.realpath(root)
18
+ @repository = repository
19
+ end
20
+
21
+ def distribution
22
+ return :git if File.exist?(File.join(@root, '.git'))
23
+ return :homebrew if @root.match?(%r{(?:/|\\)Cellar(?:/|\\)})
24
+ return :mise if @root.include?("#{File::SEPARATOR}gem-buzzsprout-cli#{File::SEPARATOR}")
25
+ return :source if File.exist?(File.join(@root, 'buzzsprout-cli.gemspec'))
26
+
27
+ :gem
28
+ end
29
+
30
+ def validate!
31
+ case distribution
32
+ when :git then validate_git!
33
+ when :source then raise source_message
34
+ else raise packaged_message
35
+ end
36
+ end
37
+
38
+ def check
39
+ case distribution
40
+ when :git then check_git
41
+ when :source then raise source_message
42
+ else check_packaged
43
+ end
44
+ end
45
+
46
+ def update(io:, dir: nil)
47
+ case distribution
48
+ when :git then update_git(io: io, dir: dir)
49
+ when :source then raise source_message
50
+ else raise packaged_message
51
+ end
52
+ end
53
+
54
+ def notify(io:)
55
+ return if ENV['BUZZSPROUT_NO_UPDATE_CHECK'] == '1' || ENV['CI']
56
+
57
+ case distribution
58
+ when :git
59
+ validate!
60
+ latest = cached_value('latest_commit') { latest_commit }
61
+ if latest && update_available?(git('rev-parse', 'HEAD'), latest)
62
+ io.puts 'Buzzsprout CLI update available. Run `buzzsprout update` to update the CLI and agent skills.'
63
+ end
64
+ when :gem, :mise, :homebrew
65
+ latest = cached_value('latest_version') { latest_release_version }
66
+ if latest && Gem::Version.new(latest) > Gem::Version.new(VERSION)
67
+ io.puts "Buzzsprout CLI update available. Run `#{update_command}` to update. Then run `buzzsprout skills install` to refresh agent skills."
68
+ end
69
+ end
70
+ rescue StandardError
71
+ # Update discovery must never break an API command.
72
+ nil
73
+ end
74
+
75
+ private
76
+
77
+ def validate_git!
78
+ remote = git('remote', 'get-url', 'origin')
79
+ repositories = @repository == REPOSITORY ? [REPOSITORY, LEGACY_REPOSITORY] : [@repository]
80
+ accepted_remotes = repositories.flat_map do |repository|
81
+ [repository, repository.delete_suffix('.git'),
82
+ repository.sub('https://github.com/', 'git@github.com:')]
83
+ end
84
+ unless accepted_remotes.include?(remote)
85
+ raise 'Self-update requires the official buzzsprout/buzzsprout-cli repository.'
86
+ end
87
+ # get-url above expands url.<base>.insteadOf, but fetch uses @repository directly,
88
+ # so a rule matching only that spelling would redirect the fetch past the check.
89
+ unless git('ls-remote', '--get-url', @repository) == @repository
90
+ raise 'Git is rewriting the update URL (url.*.insteadOf). Remove the rewrite before updating.'
91
+ end
92
+ raise 'Self-update requires the main branch. Update development checkouts manually.' unless git('branch', '--show-current') == 'main'
93
+ raise 'Local changes found. Commit or move them before updating; nothing was overwritten.' unless git('status', '--porcelain').empty?
94
+ end
95
+
96
+ def check_git
97
+ validate!
98
+ current = git('rev-parse', 'HEAD')
99
+ latest = latest_commit
100
+ { current_commit: current, latest_commit: latest, update_available: update_available?(current, latest),
101
+ update_command: 'buzzsprout update', distribution: 'git' }
102
+ end
103
+
104
+ def update_git(io:, dir: nil)
105
+ validate!
106
+ before = git('rev-parse', 'HEAD')
107
+ io.puts 'Checking for updates…'
108
+ expected = latest_commit
109
+ git('fetch', '--no-tags', @repository, 'main')
110
+ target = git('rev-parse', 'FETCH_HEAD')
111
+ unless target == expected
112
+ raise 'Fetched commit does not match the published main commit. Nothing was merged; try again later.'
113
+ end
114
+ validate!
115
+ git('merge-base', '--is-ancestor', 'HEAD', target)
116
+ git('merge', '--ff-only', target)
117
+
118
+ # Run the new CLI in a fresh process so skill installation uses the updated code.
119
+ args = [RbConfig.ruby, File.join(@root, 'bin/buzzsprout'), 'skills', 'install']
120
+ args.concat(['--dir', dir]) if dir
121
+ destinations = Commands::Skills.destination_dirs(dir)
122
+ unless destinations.empty?
123
+ stdout, stderr, status = Open3.capture3({ 'BUZZSPROUT_NO_UPDATE_CHECK' => '1' }, *args)
124
+ io.print stdout
125
+ io.print stderr
126
+ raise 'CLI updated, but skills could not be refreshed. Run buzzsprout skills install to retry.' unless status.success?
127
+ end
128
+ { updated: before != target, current_commit: target, skills_refreshed: !destinations.empty? }
129
+ end
130
+
131
+ def check_packaged
132
+ latest = latest_release_version
133
+ current = VERSION
134
+ { current_version: current, latest_version: latest,
135
+ update_available: Gem::Version.new(latest) > Gem::Version.new(current),
136
+ update_command: update_command, distribution: distribution.to_s }
137
+ end
138
+
139
+ def update_command
140
+ case distribution
141
+ when :homebrew then 'brew upgrade buzzsprout-cli'
142
+ when :mise then 'mise upgrade gem:buzzsprout-cli'
143
+ else 'gem update buzzsprout-cli'
144
+ end
145
+ end
146
+
147
+ def distribution_label
148
+ case distribution
149
+ when :homebrew then 'Homebrew'
150
+ when :mise then 'mise'
151
+ else 'gem'
152
+ end
153
+ end
154
+
155
+ def packaged_message
156
+ "Self-update requires a Git installation. This #{distribution_label} installation is updated with its package manager. " \
157
+ "Run: #{update_command}. Then refresh agent skills with: buzzsprout skills install"
158
+ end
159
+
160
+ def source_message
161
+ 'Self-update requires a Git installation. Clone the official repository or install a packaged release.'
162
+ end
163
+
164
+ def cached_value(key)
165
+ path = "#{Config.config_file}.update-check.json"
166
+ FileUtils.mkdir_p(File.dirname(path))
167
+ File.open(path, File::RDWR | File::CREAT, 0o600) do |file|
168
+ return unless file.flock(File::LOCK_EX | File::LOCK_NB)
169
+
170
+ cached = JSON.parse(file.read) rescue {}
171
+ if Time.now.to_i - cached.fetch('checked_at', 0).to_i >= INTERVAL
172
+ cached = { 'checked_at' => Time.now.to_i }
173
+ begin
174
+ cached[key] = yield
175
+ rescue StandardError
176
+ # Cache failed attempts too, avoiding repeated offline delays.
177
+ end
178
+ file.rewind
179
+ file.truncate(0)
180
+ file.write(JSON.generate(cached))
181
+ end
182
+ cached[key]
183
+ end
184
+ end
185
+
186
+ def update_available?(current, latest)
187
+ return false if current == latest
188
+ # A cached main commit may already be an ancestor of a newer installation.
189
+ git('merge-base', '--is-ancestor', latest, current)
190
+ false
191
+ rescue RuntimeError
192
+ true
193
+ end
194
+
195
+ def latest_commit
196
+ sha = github_get(ENDPOINT).fetch('sha')
197
+ raise 'Invalid update response from GitHub.' unless sha.is_a?(String) && sha.match?(/\A[0-9a-f]{40}\z/)
198
+
199
+ sha
200
+ end
201
+
202
+ def latest_release_version
203
+ tag = github_get(RELEASE_ENDPOINT).fetch('tag_name')
204
+ raise 'Invalid update response from GitHub.' unless tag.is_a?(String) && tag.match?(/\Av\d+\.\d+\.\d+\z/)
205
+
206
+ tag.delete_prefix('v')
207
+ end
208
+
209
+ def github_get(url)
210
+ Timeout.timeout(3) do
211
+ uri = URI(url)
212
+ request = Net::HTTP::Get.new(uri)
213
+ request['User-Agent'] = Client::USER_AGENT
214
+ request['Accept'] = 'application/vnd.github+json'
215
+ response = Net::HTTP.start(uri.host, uri.port, use_ssl: true, open_timeout: 2, read_timeout: 2) { |http| http.request(request) }
216
+ raise "Could not check for updates (GitHub HTTP #{response.code}). Try again later." unless response.is_a?(Net::HTTPSuccess)
217
+
218
+ JSON.parse(response.body)
219
+ end
220
+ end
221
+
222
+ def git(*args)
223
+ stdout, stderr, status = Open3.capture3({ 'GIT_TERMINAL_PROMPT' => '0' }, 'git', '-C', @root, *args)
224
+ unless status.success?
225
+ raise "Cannot update this installation: #{stderr.strip.empty? ? 'local history cannot be fast-forwarded to main' : stderr.strip}"
226
+ end
227
+ stdout.strip
228
+ end
229
+ end
230
+ end
@@ -0,0 +1,5 @@
1
+ # frozen_string_literal: true
2
+
3
+ module Buzzsprout
4
+ VERSION = '0.1.1'
5
+ end
data/skills/README.md ADDED
@@ -0,0 +1,62 @@
1
+ # Skills for agents
2
+
3
+ This directory contains agent skills for the Buzzsprout API. Each folder is a skill an agent can load: when to use it, the HTTP endpoints, required headers, example requests, and the matching `buzzsprout` CLI command.
4
+
5
+ Layout matches [basecamp-cli](https://github.com/robzolkos/ruby-basecamp-cli) (`skills/<name>/SKILL.md`), with **one skill per major resource** plus an overview skill.
6
+
7
+ | Skill | Use it for |
8
+ | --- | --- |
9
+ | [`buzzsprout`](buzzsprout/SKILL.md) | Auth, first run, headers, rate limits, CLI map |
10
+ | [`podcasts`](podcasts/SKILL.md) | List / show / update shows |
11
+ | [`episodes`](episodes/SKILL.md) | Create, inspect, publish episodes |
12
+ | [`uploads`](uploads/SKILL.md) | Attach audio or video (start → PUT → complete) |
13
+ | [`stats`](stats/SKILL.md) | Download totals for one date (`buzzsprout downloads`) |
14
+ | [`team`](team/SKILL.md) | People with Buzzsprout login access |
15
+ | [`contributors`](contributors/SKILL.md) | On-show credits (Host, Guest, …) |
16
+ | [`brand_affiliations`](brand_affiliations/SKILL.md) | Sponsor / affiliate links |
17
+ | [`chapters`](chapters/SKILL.md) | Replace an episode chapter list |
18
+ | [`transcripts`](transcripts/SKILL.md) | Public and high-fidelity transcripts |
19
+ | [`listings`](listings/SKILL.md) | Directory status (`listings Apple url`) and one-click submit |
20
+ | [`podrolls`](podrolls/SKILL.md) | Recommended podcasts in RSS |
21
+ | [`feed_verifications`](feed_verifications/SKILL.md) | RSS feed verification values |
22
+ | [`fan_mail`](fan_mail/SKILL.md) | Listener messages |
23
+ | [`insertion_points`](insertion_points/SKILL.md) | Mid-roll timestamps |
24
+ | [`soundbites`](soundbites/SKILL.md) | Short video clips from episode audio |
25
+
26
+ API shapes follow [buzzsprout/buzzsprout-api#56](https://github.com/buzzsprout/buzzsprout-api/pull/56).
27
+
28
+ ## Install or refresh
29
+
30
+ ```bash
31
+ buzzsprout skills install
32
+ ```
33
+
34
+ Installs into `~/.cursor/skills` and `~/.claude/skills` when the corresponding agent directory exists. If neither exists, choose a directory explicitly. Local Claude Code reads these skills; Cowork and cloud sessions need skills configured separately in Claude.
35
+
36
+ ```bash
37
+ buzzsprout skills install --dir ~/.claude/skills
38
+ buzzsprout skills install --dir .claude/skills
39
+ ```
40
+
41
+ `--dir` takes precedence over `BUZZSPROUT_SKILLS_DIR`; either overrides automatic detection. Login offers installation when any detected destination is missing skills or has outdated content. `--install-skills` refreshes without prompting; `--no-skills` skips the offer. Noninteractive and JSON login skip the prompt.
42
+
43
+ Resource directories are namespaced, for example `buzzsprout-stats`. The overview remains `buzzsprout`. Previous owned folders, including old unprefixed installations, are archived in `buzzsprout-skill-backups` alongside the destination skills directory. Unrelated skills are preserved; conflicts in namespaced directories are reported instead of overwritten.
44
+
45
+ Load the `buzzsprout` overview first, followed by the resource skill needed for the task. `buzzsprout skills path` prints the bundled source location.
46
+
47
+ ## Conventions every skill assumes
48
+
49
+ Prefer `buzzsprout …` over raw HTTP. **Never** read `~/.buzzsprout.json` for the token, **never** echo `BUZZSPROUT_API_TOKEN`, and **never** paste a real token into curl or chat. Header shape for documentation only (`YOUR_API_TOKEN` is a placeholder):
50
+
51
+ ```text
52
+ Authorization: Token token=YOUR_API_TOKEN
53
+ User-Agent: BuzzsproutCLI/0.1.1
54
+ Accept: application/json
55
+ ```
56
+
57
+ - Base URL: `https://www.buzzsprout.com/api`
58
+ - Token from **Profile → API**, stored by `buzzsprout login` or the env var — never commit tokens.
59
+ - Identifiable `User-Agent` on every request (generic library defaults may be blocked).
60
+ - JSON writes: `Content-Type: application/json; charset=utf-8`
61
+ - Rate limit: 60 requests / minute; retry `429` with backoff.
62
+ - When a response has `ETag`, send it back as `If-None-Match`.
@@ -0,0 +1,52 @@
1
+ ---
2
+ name: buzzsprout-brand-affiliations
3
+ description: Manage Buzzsprout sponsor or affiliate links and assign them to episodes. Assigned links are appended to the episode description in RSS.
4
+ ---
5
+
6
+ # Brand affiliations
7
+
8
+ Sponsor and affiliate links for a podcast. Create on the show, then assign to episodes.
9
+
10
+ ## When to use
11
+
12
+ - Add a promo / affiliate headline + URL.
13
+ - Attach or remove a link on a single episode.
14
+
15
+ ## Endpoints
16
+
17
+ - `GET|POST /api/:podcast_id/brand_affiliations`
18
+ - `GET|PATCH|DELETE /api/:podcast_id/brand_affiliations/:id`
19
+ - `POST /api/:podcast_id/episodes/:episode_id/brand_affiliations` with `{ "brand_affiliation_id": 123 }`
20
+ - `DELETE /api/:podcast_id/episodes/:episode_id/brand_affiliations/:id`
21
+
22
+ Deleting an affiliation removes it from **every** episode. `artwork` is an optional image file on create/update (multipart).
23
+
24
+ ## Auth headers
25
+
26
+ ```text
27
+ Authorization: Token token=YOUR_API_TOKEN
28
+ User-Agent: BuzzsproutCLI/0.1.1
29
+ Accept: application/json
30
+ Content-Type: application/json; charset=utf-8
31
+ ```
32
+
33
+ ## Example requests
34
+
35
+ ```bash
36
+ curl -sS -X POST "https://www.buzzsprout.com/api/PODCAST_ID/brand_affiliations" \
37
+ -H "Authorization: Token token=YOUR_API_TOKEN" \
38
+ -H "User-Agent: BuzzsproutCLI/0.1.1" \
39
+ -H "Content-Type: application/json; charset=utf-8" \
40
+ -H "Accept: application/json" \
41
+ -d '{"headline":"Acme","description":"10% off with code PODCAST","url":"https://acme.example"}'
42
+ ```
43
+
44
+ Missing `headline` → `422` / `param: "headline"`.
45
+
46
+ ## CLI
47
+
48
+ ```bash
49
+ buzzsprout brand-affiliations list 10
50
+ buzzsprout brand-affiliations create 10 --headline Acme --url https://acme.example
51
+ buzzsprout brand-affiliations assign 10 788881 45
52
+ ```
@@ -0,0 +1,111 @@
1
+ ---
2
+ name: buzzsprout
3
+ description: Buzzsprout API CLI overview. Use for login, token auth headers, first-run, rate limits, ETags, and choosing a resource skill (podcasts, episodes, uploads, stats, team, …).
4
+ ---
5
+
6
+ # Buzzsprout CLI
7
+
8
+ Agent-friendly Ruby CLI for the Buzzsprout API. Prefer the `buzzsprout` executable over raw HTTP unless a flag is missing.
9
+
10
+ ## When to use
11
+
12
+ - The user mentions Buzzsprout, podcast hosting, RSS, episodes, or their API token.
13
+ - You need to list shows, publish an episode, or call a documented API resource.
14
+
15
+ ## Auth
16
+
17
+ Browser OAuth is the default: use `buzzsprout login`. API tokens remain supported through `buzzsprout login --api-token` or `BUZZSPROUT_API_TOKEN`. **You (the agent) must not load credentials into context.**
18
+
19
+ ### Agent rules
20
+
21
+ - Before changing podcast content, name the target podcast in your acknowledgment. Ask only if the target is unclear.
22
+ - Never read `~/.buzzsprout.json` (or `BUZZSPROUT_CONFIG`) to copy `api_token` into chat, logs, or curl.
23
+ - Never print, echo, or interpolate `BUZZSPROUT_API_TOKEN`.
24
+ - Authenticate with `buzzsprout login` (browser authorization) or assume env/config is already set.
25
+ - Prefer the `buzzsprout` CLI over constructing HTTP. If you must show a header shape, keep the placeholder `YOUR_API_TOKEN` — never a real token.
26
+ - `buzzsprout status --json` reports `token_set: true` or `false`, not the secret. `--dry-run` prints `Token token=[REDACTED]`.
27
+
28
+ The CLI sends `Authorization: Bearer …` for OAuth and `Authorization: Token token=…` for API tokens (never `?api_token=`). API-token header shape for docs only:
29
+
30
+ ```text
31
+ Authorization: Token token=YOUR_API_TOKEN
32
+ User-Agent: BuzzsproutCLI/0.1.1
33
+ Accept: application/json
34
+ ```
35
+
36
+ Resolution order inside the CLI (not for agents to read): env `BUZZSPROUT_API_TOKEN`, then the file written by `login`. `--token` on argv is login-only and can leak via process list/history — do not recommend it.
37
+
38
+ ```bash
39
+ buzzsprout login # browser authorization → GET /podcasts → picker → save
40
+ buzzsprout login --no-animation
41
+ buzzsprout login --install-skills # also copy agent skills (no prompt)
42
+ buzzsprout login --no-skills # skip the post-login skills offer
43
+ buzzsprout status
44
+ buzzsprout podcast use # picker to change the saved podcast (or pass an id / --podcast / --in)
45
+ buzzsprout logout
46
+ ```
47
+
48
+ First run with no args and no saved token starts login automatically. Config lives at `~/.buzzsprout.json` (mode `0600` on Unix). Do not open it for token values. After auth succeeds, login offers to install or refresh these skills in detected Claude Code and Cursor directories, or the destination selected by `BUZZSPROUT_SKILLS_DIR` / `--dir`.
49
+
50
+ ## Updates
51
+
52
+ - `buzzsprout update --check --json` reports `update_available` and `update_command` without changing code or skills.
53
+ - Git installations: the check compares the checkout with the latest `main`. `update_command` is `buzzsprout update`. When the user requests an update, run that command. It updates the CLI and refreshes skills in detected agent directories (or the explicit skills destination).
54
+ - Packaged installations use their package manager. `update_command` is `gem update buzzsprout-cli`, `mise upgrade gem:buzzsprout-cli`, or `brew upgrade buzzsprout-cli`. The check compares the installed version with the latest GitHub Release. When the user requests an update, run `update_command`, then `buzzsprout skills install`.
55
+ - Normal commands may print an update notice on stderr; their JSON stdout remains unchanged. Tell the user when an update is available. Do not update software merely to answer a data question.
56
+ - Start a new agent session after refreshing skills. Custom skill locations on a Git install use `buzzsprout update --dir PATH`. Packaged installs use `buzzsprout skills install --dir PATH`.
57
+ - Git updates require a clean checkout of the official repository on `main`. Never reset local edits or switch a development branch to bypass a refusal.
58
+ - Set `BUZZSPROUT_NO_UPDATE_CHECK=1` to disable automatic checks. An explicit `update --check` still works.
59
+
60
+ ## Base URL
61
+
62
+ - Account-level: `https://www.buzzsprout.com/api/podcasts`
63
+ - Podcast-scoped: `https://www.buzzsprout.com/api/:podcast_id/...`
64
+
65
+ Extensionless paths are canonical; `.json` is also accepted by the API.
66
+
67
+ ## Rate limits and caching
68
+
69
+ - 60 requests per minute per token. `429` is retried with exponential backoff (or `Retry-After`).
70
+ - Store `ETag` and send `If-None-Match` on repeat GETs. `304` means use the cached body.
71
+ - Retry transient `5xx` on GET. Do not retry validation (`4xx` other than `429`) unchanged.
72
+
73
+ ## Publish workflow
74
+
75
+ 1. `buzzsprout podcasts` — note numeric `id`
76
+ 2. `buzzsprout episodes create ID --title "…" --private`
77
+ 3. `buzzsprout uploads start ID EPISODE_ID --file ./episode.m4a` (complete is required)
78
+ 4. `buzzsprout episodes show ID EPISODE_ID` until `duration` is a positive integer
79
+ 5. Optional chapters / contributors
80
+ 6. `buzzsprout episodes publish ID EPISODE_ID`
81
+
82
+ ## CLI map
83
+
84
+ | Resource | Command prefix | Skill |
85
+ | --- | --- | --- |
86
+ | Podcasts | `buzzsprout podcasts` | `podcasts` |
87
+ | Episodes | `buzzsprout episodes` | `episodes` |
88
+ | Uploads | `buzzsprout uploads` | `uploads` |
89
+ | Stats | `buzzsprout downloads` | `stats` |
90
+ | Team | Direct the user to sign in and use the web app | `team` |
91
+ | Contributors | `buzzsprout contributors` | `contributors` |
92
+ | Brand affiliations | `buzzsprout brand-affiliations` | `brand_affiliations` |
93
+ | Chapters | `buzzsprout chapters` | `chapters` |
94
+ | Transcripts | `buzzsprout transcripts` | `transcripts` |
95
+ | Listings | `buzzsprout listings` | `listings` |
96
+ | Podrolls | `buzzsprout podrolls` | `podrolls` |
97
+ | Feed verifications | `buzzsprout feed-verifications` | `feed_verifications` |
98
+ | Fan mail | `buzzsprout fan-mail` | `fan_mail` |
99
+ | Insertion points | `buzzsprout insertion-points` | `insertion_points` |
100
+ | Soundbites | `buzzsprout soundbites` | `soundbites` |
101
+
102
+ `--json` prints the API payload. `--dry-run` prints the request without sending it. `--body '{…}'` supplies a JSON body. `--podcast ID` / `--in ID` selects a podcast for this invocation without the interactive picker. A saved `default_podcast_id` is reused until `buzzsprout podcast use`. `--json` and `BUZZSPROUT_NONINTERACTIVE=1` never open the picker.
103
+
104
+ ## Load this skill pack
105
+
106
+ ```bash
107
+ buzzsprout skills install --dir ~/.cursor/skills
108
+ # or accept the prompt after `buzzsprout login`
109
+ ```
110
+
111
+ See `skills/README.md` in the repo for Cursor / Claude Code paths.
@@ -0,0 +1,49 @@
1
+ ---
2
+ name: buzzsprout-chapters
3
+ description: Get or replace a Buzzsprout episode chapter list in one request. No single-chapter CRUD.
4
+ ---
5
+
6
+ # Chapters
7
+
8
+ Replace an episode's chapter list in one request. There is no single-chapter create/update/delete.
9
+
10
+ ## When to use
11
+
12
+ - Read current chapters, edit locally, PUT the replacement.
13
+ - Empty array deletes every non-ad chapter.
14
+
15
+ ## Endpoints
16
+
17
+ - `GET /api/:podcast_id/episodes/:episode_id/chapters`
18
+ - `PUT /api/:podcast_id/episodes/:episode_id/chapters`
19
+
20
+ Send `{ "chapters": [...] }` or a raw array. Omitting the array or sending another type → `422` without changing existing chapters.
21
+
22
+ `start_time` may be `HH:MM:SS`, `MM:SS`, or seconds. `url` and `link` are both accepted on write; the response always uses `url`.
23
+
24
+ ## Auth headers
25
+
26
+ ```text
27
+ Authorization: Token token=YOUR_API_TOKEN
28
+ User-Agent: BuzzsproutCLI/0.1.1
29
+ Accept: application/json
30
+ Content-Type: application/json; charset=utf-8
31
+ ```
32
+
33
+ ## Example requests
34
+
35
+ ```bash
36
+ curl -sS -X PUT "https://www.buzzsprout.com/api/PODCAST_ID/episodes/EPISODE_ID/chapters" \
37
+ -H "Authorization: Token token=YOUR_API_TOKEN" \
38
+ -H "User-Agent: BuzzsproutCLI/0.1.1" \
39
+ -H "Content-Type: application/json; charset=utf-8" \
40
+ -H "Accept: application/json" \
41
+ -d '{"chapters":[{"title":"Intro","start_time":"00:00:00"},{"title":"Main","start_time":"00:01:30"}]}'
42
+ ```
43
+
44
+ ## CLI
45
+
46
+ ```bash
47
+ buzzsprout chapters list 10 788881
48
+ buzzsprout chapters replace 10 788881 --body '[{"title":"Intro","start_time":"00:00:00"}]'
49
+ ```
@@ -0,0 +1,58 @@
1
+ ---
2
+ name: buzzsprout-contributors
3
+ description: Manage Buzzsprout on-show credits (Host, Guest, Producer, …) and assign them to episodes. Separate from team login access.
4
+ ---
5
+
6
+ # Contributors
7
+
8
+ On-show credits. They do **not** get a Buzzsprout login. Create on the podcast, then assign to episodes.
9
+
10
+ ## When to use
11
+
12
+ - Add a guest/host credit.
13
+ - Assign or unassign a credit on one episode without deleting the contributor.
14
+
15
+ ## Endpoints
16
+
17
+ - `GET|POST /api/:podcast_id/contributors`
18
+ - `GET|PATCH|DELETE /api/:podcast_id/contributors/:id`
19
+ - `POST /api/:podcast_id/episodes/:episode_id/contributors` with `{ "contributor_id": 123 }`
20
+ - `DELETE /api/:podcast_id/episodes/:episode_id/contributors/:id` — unassign only
21
+
22
+ Deleting a contributor removes them from **every** episode. Prefer unassign for a single episode.
23
+
24
+ ## Auth headers
25
+
26
+ ```text
27
+ Authorization: Token token=YOUR_API_TOKEN
28
+ User-Agent: BuzzsproutCLI/0.1.1
29
+ Accept: application/json
30
+ Content-Type: application/json; charset=utf-8
31
+ ```
32
+
33
+ ## Example requests
34
+
35
+ ```bash
36
+ curl -sS -X POST "https://www.buzzsprout.com/api/PODCAST_ID/contributors" \
37
+ -H "Authorization: Token token=YOUR_API_TOKEN" \
38
+ -H "User-Agent: BuzzsproutCLI/0.1.1" \
39
+ -H "Content-Type: application/json; charset=utf-8" \
40
+ -H "Accept: application/json" \
41
+ -d '{"name":"Guest Star","role":"Guest","url":"https://example.com"}'
42
+ ```
43
+
44
+ Roles: `Host`, `Co-Host`, `Producer`, `Editor`, `Guest` (case-insensitive on write). `bio` is HTML, 1000-character limit including tags.
45
+
46
+ Create or update with a headshot using multipart form data and the `headshot_file` file field. PNG, JPEG, and WebP images up to 15 MB are accepted. Contributor responses include `headshot_url` (or null when absent).
47
+
48
+ ## CLI
49
+
50
+ ```bash
51
+ buzzsprout contributors list 10
52
+ buzzsprout contributors create 10 --name "Guest Star" --role Guest
53
+ buzzsprout contributors create 10 --name "Guest Star" --role Guest --file ./headshot.jpg
54
+ buzzsprout contributors update 10 123 --file ./headshot.png
55
+ buzzsprout contributors show 10 123
56
+ buzzsprout contributors assign 10 788881 123
57
+ buzzsprout contributors unassign 10 788881 123
58
+ ```