bktide 1.0.1755267617 → 1.0.1755559112

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 (93) hide show
  1. package/README.md +107 -1
  2. package/WORKFLOW_README.md +1 -1
  3. package/completions/bktide-dynamic.fish +171 -0
  4. package/completions/bktide.bash +124 -0
  5. package/completions/bktide.fish +107 -0
  6. package/completions/bktide.zsh +139 -0
  7. package/dist/commands/BaseCommand.js +7 -7
  8. package/dist/commands/BaseCommand.js.map +1 -1
  9. package/dist/commands/GenerateCompletions.js +238 -0
  10. package/dist/commands/GenerateCompletions.js.map +1 -0
  11. package/dist/commands/ListAnnotations.js +7 -0
  12. package/dist/commands/ListAnnotations.js.map +1 -1
  13. package/dist/commands/ListBuilds.js +67 -3
  14. package/dist/commands/ListBuilds.js.map +1 -1
  15. package/dist/commands/ListOrganizations.js +6 -0
  16. package/dist/commands/ListOrganizations.js.map +1 -1
  17. package/dist/commands/ListPipelines.js +87 -12
  18. package/dist/commands/ListPipelines.js.map +1 -1
  19. package/dist/commands/ManageToken.js +32 -9
  20. package/dist/commands/ManageToken.js.map +1 -1
  21. package/dist/commands/ShowBuild.js +88 -0
  22. package/dist/commands/ShowBuild.js.map +1 -0
  23. package/dist/commands/ShowViewer.js +7 -1
  24. package/dist/commands/ShowViewer.js.map +1 -1
  25. package/dist/commands/index.js +2 -0
  26. package/dist/commands/index.js.map +1 -1
  27. package/dist/formatters/FormatterFactory.js +4 -0
  28. package/dist/formatters/FormatterFactory.js.map +1 -1
  29. package/dist/formatters/annotations/PlainTextFormatter.js +37 -9
  30. package/dist/formatters/annotations/PlainTextFormatter.js.map +1 -1
  31. package/dist/formatters/build-detail/AlfredFormatter.js +113 -0
  32. package/dist/formatters/build-detail/AlfredFormatter.js.map +1 -0
  33. package/dist/formatters/build-detail/Formatter.js +3 -0
  34. package/dist/formatters/build-detail/Formatter.js.map +1 -0
  35. package/dist/formatters/build-detail/JsonFormatter.js +132 -0
  36. package/dist/formatters/build-detail/JsonFormatter.js.map +1 -0
  37. package/dist/formatters/build-detail/PlainTextFormatter.js +680 -0
  38. package/dist/formatters/build-detail/PlainTextFormatter.js.map +1 -0
  39. package/dist/formatters/build-detail/index.js +21 -0
  40. package/dist/formatters/build-detail/index.js.map +1 -0
  41. package/dist/formatters/builds/PlainTextFormatter.js +82 -60
  42. package/dist/formatters/builds/PlainTextFormatter.js.map +1 -1
  43. package/dist/formatters/errors/AlfredFormatter.js +20 -0
  44. package/dist/formatters/errors/AlfredFormatter.js.map +1 -1
  45. package/dist/formatters/errors/PlainTextFormatter.js +121 -23
  46. package/dist/formatters/errors/PlainTextFormatter.js.map +1 -1
  47. package/dist/formatters/organizations/PlainTextFormatter.js +37 -6
  48. package/dist/formatters/organizations/PlainTextFormatter.js.map +1 -1
  49. package/dist/formatters/pipelines/AlfredFormatter.js.map +1 -1
  50. package/dist/formatters/pipelines/Formatter.js.map +1 -1
  51. package/dist/formatters/pipelines/JsonFormatter.js.map +1 -1
  52. package/dist/formatters/pipelines/PlainTextFormatter.js +165 -19
  53. package/dist/formatters/pipelines/PlainTextFormatter.js.map +1 -1
  54. package/dist/formatters/token/AlfredFormatter.js +15 -2
  55. package/dist/formatters/token/AlfredFormatter.js.map +1 -1
  56. package/dist/formatters/token/PlainTextFormatter.js +56 -18
  57. package/dist/formatters/token/PlainTextFormatter.js.map +1 -1
  58. package/dist/formatters/viewer/PlainTextFormatter.js +8 -7
  59. package/dist/formatters/viewer/PlainTextFormatter.js.map +1 -1
  60. package/dist/graphql/queries.js +181 -0
  61. package/dist/graphql/queries.js.map +1 -1
  62. package/dist/index.js +67 -6
  63. package/dist/index.js.map +1 -1
  64. package/dist/services/BuildkiteClient.js +61 -1
  65. package/dist/services/BuildkiteClient.js.map +1 -1
  66. package/dist/services/CredentialManager.js +80 -10
  67. package/dist/services/CredentialManager.js.map +1 -1
  68. package/dist/ui/help.js +69 -0
  69. package/dist/ui/help.js.map +1 -0
  70. package/dist/ui/progress.js +356 -0
  71. package/dist/ui/progress.js.map +1 -0
  72. package/dist/ui/reporter.js +111 -0
  73. package/dist/ui/reporter.js.map +1 -0
  74. package/dist/ui/responsive-table.js +183 -0
  75. package/dist/ui/responsive-table.js.map +1 -0
  76. package/dist/ui/spinner.js +20 -0
  77. package/dist/ui/spinner.js.map +1 -0
  78. package/dist/ui/symbols.js +46 -0
  79. package/dist/ui/symbols.js.map +1 -0
  80. package/dist/ui/table.js +32 -0
  81. package/dist/ui/table.js.map +1 -0
  82. package/dist/ui/theme.js +280 -0
  83. package/dist/ui/theme.js.map +1 -0
  84. package/dist/ui/width.js +111 -0
  85. package/dist/ui/width.js.map +1 -0
  86. package/dist/utils/alfred.js +6 -0
  87. package/dist/utils/alfred.js.map +1 -0
  88. package/dist/utils/cli-error-handler.js +35 -20
  89. package/dist/utils/cli-error-handler.js.map +1 -1
  90. package/dist/utils/pagination.js +92 -0
  91. package/dist/utils/pagination.js.map +1 -0
  92. package/info.plist +51 -218
  93. package/package.json +24 -5
package/README.md CHANGED
@@ -1,6 +1,15 @@
1
1
  # bktide
2
2
 
3
- A command-line tool for interacting with Buildkite's GraphQL API.
3
+ Command-line interface for Buildkite CI/CD workflows with rich shell completions (Fish, Bash, Zsh) and Alfred workflow integration for macOS power users.
4
+
5
+ ## Features
6
+
7
+ - **🚀 Workflow Management**: View and manage builds, pipelines, organizations, and annotations
8
+ - **🔧 Smart Shell Completions**: Context-aware completions for Fish, Bash, and Zsh
9
+ - **🎯 Alfred Integration**: macOS Alfred workflow for quick access to Buildkite data
10
+ - **📊 Multiple Output Formats**: Plain text, JSON, or Alfred-compatible output
11
+ - **🔐 Secure Token Storage**: System keychain integration for API credentials
12
+ - **⚡ Performance**: Built-in caching for faster repeated operations
4
13
 
5
14
  ## Installation
6
15
 
@@ -10,8 +19,34 @@ npm install -g bktide
10
19
 
11
20
  Once installed, use the `bktide` binary directly from your shell.
12
21
 
22
+ ## Shell Completions
23
+
24
+ bktide supports auto-completion for Fish, Bash, and Zsh shells.
25
+
26
+ ### Quick Setup
27
+
28
+ ```bash
29
+ # Fish
30
+ bktide completions fish > ~/.config/fish/completions/bktide.fish
31
+
32
+ # Bash
33
+ echo 'source <(bktide completions bash)' >> ~/.bashrc
34
+
35
+ # Zsh
36
+ echo 'source <(bktide completions zsh)' >> ~/.zshrc
37
+ ```
38
+
39
+ Completions provide:
40
+ - Command suggestions (`bktide <Tab>`)
41
+ - Option completions (`bktide builds --<Tab>`)
42
+ - Value completions (`bktide --format <Tab>`)
43
+ - Dynamic completions for organizations and pipelines (Fish with jq installed)
44
+
45
+ See [Shell Completions Guide](docs/shell-completions.md) for detailed installation and troubleshooting.
46
+
13
47
  ## Documentation
14
48
 
49
+ - [Shell Completions](docs/shell-completions.md) - Complete guide for shell auto-completion setup
15
50
  - [Development Guide](docs/development.md) - Information about running and developing the CLI
16
51
  - [Authentication](docs/authentication.md) - How to authenticate with Buildkite
17
52
  - [Caching](docs/caching.md) - Information about the CLI's caching system
@@ -106,6 +141,18 @@ bktide annotations https://buildkite.com/gusto/zenpayroll/builds/1287418 --forma
106
141
  bktide annotations gusto/zenpayroll/1287418 --context build-resources --format json
107
142
  ```
108
143
 
144
+ ### Generate Shell Completions
145
+
146
+ ```bash
147
+ # Generate completions for your shell
148
+ bktide completions fish
149
+ bktide completions bash
150
+ bktide completions zsh
151
+
152
+ # Auto-detect your shell and generate completions
153
+ bktide completions
154
+ ```
155
+
109
156
  ## API Token
110
157
 
111
158
  You'll need a Buildkite API token with GraphQL scopes. Create one at:
@@ -126,6 +173,53 @@ bktide token --check # See if a token is stored
126
173
  bktide token --reset # Remove stored token
127
174
  ```
128
175
 
176
+ ## Visual Features
177
+
178
+ The CLI provides a modern visual experience with color-coded information and clear hierarchy:
179
+
180
+ ### Color-Coded Build Status
181
+ Build statuses are displayed with intuitive colors for quick scanning:
182
+ - **Blue** (✓) - Passed builds
183
+ - **Orange** (✖) - Failed builds
184
+ - **Cyan** (↻) - Running builds
185
+ - **Yellow** (⚠) - Blocked/warning states
186
+ - **Gray** (−) - Skipped/inactive states
187
+
188
+ ### Visual Hierarchy
189
+ - **Bold + underlined headers** for table columns
190
+ - **Cyan highlighting** for identifiers (#1234, IDs)
191
+ - **Magenta** for numeric counts
192
+ - **Dimmed text** for auxiliary information and tips
193
+ - **Arrow indicators** (→) for actionable tips
194
+
195
+ ### Accessibility
196
+ - **Colorblind-safe palette** - Uses blue/orange instead of green/red
197
+ - **NO_COLOR support** - Set `NO_COLOR=1` for no colors
198
+ - **ASCII mode** - Use `BKTIDE_ASCII=1` for screen reader compatibility
199
+ - **Symbols with text fallbacks** - Information never relies solely on color
200
+
201
+ ### Smart Empty States
202
+ When no results are found, helpful suggestions guide you:
203
+ ```
204
+ No builds found
205
+
206
+ Try specifying an organization with --org <name>
207
+ Use --count to increase the number of results
208
+ ```
209
+
210
+ ### Enhanced Error Messages
211
+ Errors provide clear context and actionable solutions:
212
+ ```
213
+ ✖ Error: Authentication Failed
214
+
215
+ The provided token is invalid or expired.
216
+
217
+ To fix this:
218
+ 1. Get a new token from Buildkite
219
+ 2. Run: bktide token --store
220
+ 3. Try your command again
221
+ ```
222
+
129
223
  ## Global Options
130
224
 
131
225
  These flags work with all commands:
@@ -138,6 +232,18 @@ These flags work with all commands:
138
232
  - `-t, --token <token>`: provide Buildkite API token (or use `BK_TOKEN`)
139
233
  - `--save-token`: save token to system keychain
140
234
  - `-f, --format <format>`: plain|json|alfred (affects output and errors)
235
+ - `--color <mode>`: auto|always|never (controls color in plain format)
236
+ - `-q, --quiet`: suppress non-error output (success messages, tips)
237
+ - `--tips`: show helpful tips after operations (default: true)
238
+ - `--no-tips`: hide helpful tips
239
+
240
+ ### Output Behavior
241
+
242
+ - Plain format (default): human-friendly output with color-coded statuses, bold headers, and visual hierarchy. Progress indicators (spinners for indeterminate operations, progress bars for operations with known totals) show during long operations only in interactive TTYs and are cleared on completion (no residual lines). Tips appear dimmed with arrow indicators (→) at the end of output.
243
+ - JSON/Alfred formats: strictly machine-readable; no extra lines, no colors, no spinners or confirmations.
244
+ - Streams: results go to stdout; errors go through the error formatter. When using `--format json|alfred`, only the formatted payload is printed.
245
+ - Colors: by default `--color auto` enables color in TTYs with semantic coloring (blue for success, orange for errors, etc.). Use `--color never` or `NO_COLOR=1` to disable. Use `--color always` to force color in plain output.
246
+ - Accessibility: Full functionality without colors - symbols provide visual cues (✓, ✖, ⚠, →) with ASCII fallbacks when `BKTIDE_ASCII=1` is set.
141
247
 
142
248
  # Logging System
143
249
 
@@ -1,6 +1,6 @@
1
1
  # bktide Alfred Workflow
2
2
 
3
- A powerful Alfred workflow for interacting with Buildkite builds, pipelines, and organizations.
3
+ Streamline your Buildkite CI/CD workflows directly from Alfred. Instantly access builds, pipelines, and organizations without leaving your keyboard.
4
4
 
5
5
  ## Quick Start
6
6
 
@@ -0,0 +1,171 @@
1
+ # Fish completions for bktide CLI with dynamic completions
2
+ # Install by copying to ~/.config/fish/completions/bktide.fish
3
+ # Or run: bktide completions fish > ~/.config/fish/completions/bktide.fish
4
+
5
+ # Disable file completions for all bktide commands by default
6
+ complete -c bktide -f
7
+ complete -c bin/bktide -f
8
+
9
+ # Helper function to get organizations dynamically
10
+ function __fish_bktide_orgs
11
+ # Try to get organizations, suppress errors
12
+ bktide orgs --format json --quiet 2>/dev/null | jq -r '.[].slug' 2>/dev/null
13
+ end
14
+
15
+ # Helper function to get pipelines dynamically
16
+ function __fish_bktide_pipelines
17
+ set -l org_arg
18
+ # Try to find the --org value from the command line
19
+ set -l cmd (commandline -opc)
20
+ set -l found_org 0
21
+ for i in (seq (count $cmd))
22
+ if test "$found_org" = "1"
23
+ set org_arg "--org $cmd[$i]"
24
+ break
25
+ end
26
+ if test "$cmd[$i]" = "--org" -o "$cmd[$i]" = "-o"
27
+ set found_org 1
28
+ end
29
+ end
30
+
31
+ # Get pipelines for the org (or all if no org specified)
32
+ if test -n "$org_arg"
33
+ bktide pipelines $org_arg --format json --quiet 2>/dev/null | jq -r '.[].slug' 2>/dev/null
34
+ else
35
+ bktide pipelines --format json --quiet 2>/dev/null | jq -r '.[].slug' 2>/dev/null
36
+ end
37
+ end
38
+
39
+ # Helper function to get branches (commonly used ones)
40
+ function __fish_bktide_branches
41
+ # Common branch names - you could enhance this to get from git if in a repo
42
+ echo main
43
+ echo master
44
+ echo develop
45
+ echo staging
46
+ echo production
47
+ # Try to get branches from current git repo if available
48
+ git branch -r 2>/dev/null | sed 's/.*origin\///' | grep -v HEAD 2>/dev/null
49
+ end
50
+
51
+ # Helper function to check if we're in the project directory for bin/bktide
52
+ function __fish_bktide_use_bin
53
+ # Check if bin/bktide exists in current or parent directories
54
+ if test -x ./bin/bktide
55
+ return 0
56
+ else if test -x ../bin/bktide
57
+ return 0
58
+ else if test -x ../../bin/bktide
59
+ return 0
60
+ end
61
+ return 1
62
+ end
63
+
64
+ # Main commands
65
+ complete -c bktide -n __fish_use_subcommand -a viewer -d "Show logged in user information"
66
+ complete -c bktide -n __fish_use_subcommand -a orgs -d "List organizations"
67
+ complete -c bktide -n __fish_use_subcommand -a pipelines -d "List pipelines for an organization"
68
+ complete -c bktide -n __fish_use_subcommand -a builds -d "List builds for the current user"
69
+ complete -c bktide -n __fish_use_subcommand -a token -d "Manage API tokens"
70
+ complete -c bktide -n __fish_use_subcommand -a annotations -d "Show annotations for a build"
71
+ complete -c bktide -n __fish_use_subcommand -a completions -d "Generate shell completions"
72
+ complete -c bktide -n __fish_use_subcommand -a boom -d "Test error handling"
73
+
74
+ # Global options (available for all commands)
75
+ complete -c bktide -l log-level -d "Set logging level" -xa "trace debug info warn error fatal"
76
+ complete -c bktide -s d -l debug -d "Show debug information for errors"
77
+ complete -c bktide -l no-cache -d "Disable caching of API responses"
78
+ complete -c bktide -l cache-ttl -d "Set cache time-to-live in milliseconds" -x
79
+ complete -c bktide -l clear-cache -d "Clear all cached data before executing command"
80
+ complete -c bktide -s t -l token -d "Buildkite API token" -x
81
+ complete -c bktide -l save-token -d "Save the token to system keychain for future use"
82
+ complete -c bktide -s f -l format -d "Output format" -xa "plain json alfred"
83
+ complete -c bktide -l color -d "Color output mode" -xa "auto always never"
84
+ complete -c bktide -s q -l quiet -d "Suppress non-error output (plain format only)"
85
+ complete -c bktide -l tips -d "Show helpful tips and suggestions"
86
+ complete -c bktide -l no-tips -d "Hide helpful tips and suggestions"
87
+ complete -c bktide -l ascii -d "Use ASCII symbols instead of Unicode"
88
+ complete -c bktide -s h -l help -d "Show help"
89
+ complete -c bktide -s V -l version -d "Show version"
90
+
91
+ # Pipelines command options with dynamic org completion
92
+ complete -c bktide -n "__fish_seen_subcommand_from pipelines" -s o -l org -d "Organization slug" -xa "(__fish_bktide_orgs)"
93
+ complete -c bktide -n "__fish_seen_subcommand_from pipelines" -s n -l count -d "Limit to specified number of pipelines" -x
94
+ complete -c bktide -n "__fish_seen_subcommand_from pipelines" -l filter -d "Filter pipelines by name (case insensitive)" -x
95
+
96
+ # Builds command options with dynamic completions
97
+ complete -c bktide -n "__fish_seen_subcommand_from builds" -s o -l org -d "Organization slug" -xa "(__fish_bktide_orgs)"
98
+ complete -c bktide -n "__fish_seen_subcommand_from builds" -s p -l pipeline -d "Filter by pipeline slug" -xa "(__fish_bktide_pipelines)"
99
+ complete -c bktide -n "__fish_seen_subcommand_from builds" -s b -l branch -d "Filter by branch name" -xa "(__fish_bktide_branches)"
100
+ complete -c bktide -n "__fish_seen_subcommand_from builds" -s s -l state -d "Filter by build state" -xa "running scheduled passed failing failed canceled blocked canceling skipped not_run"
101
+ complete -c bktide -n "__fish_seen_subcommand_from builds" -s n -l count -d "Number of builds per page" -x
102
+ complete -c bktide -n "__fish_seen_subcommand_from builds" -l page -d "Page number" -x
103
+ complete -c bktide -n "__fish_seen_subcommand_from builds" -l filter -d "Fuzzy filter builds" -x
104
+
105
+ # Token command options
106
+ complete -c bktide -n "__fish_seen_subcommand_from token" -l check -d "Check if a token is stored"
107
+ complete -c bktide -n "__fish_seen_subcommand_from token" -l store -d "Store a token in the system keychain"
108
+ complete -c bktide -n "__fish_seen_subcommand_from token" -l reset -d "Delete the stored token"
109
+
110
+ # Annotations command - build reference examples
111
+ complete -c bktide -n "__fish_seen_subcommand_from annotations" -a "org/pipeline/123" -d "Example: org/pipeline/build-number"
112
+ complete -c bktide -n "__fish_seen_subcommand_from annotations" -l context -d "Filter annotations by context" -x
113
+
114
+ # Completions command options
115
+ complete -c bktide -n "__fish_seen_subcommand_from completions" -a "fish bash zsh" -d "Shell type"
116
+
117
+ # Boom command options (for testing)
118
+ complete -c bktide -n "__fish_seen_subcommand_from boom" -l type -d "Type of error to throw" -xa "basic api object"
119
+
120
+ # Also support bin/bktide for local development
121
+ # Copy all the same completions for bin/bktide
122
+ complete -c bin/bktide -n __fish_use_subcommand -a viewer -d "Show logged in user information"
123
+ complete -c bin/bktide -n __fish_use_subcommand -a orgs -d "List organizations"
124
+ complete -c bin/bktide -n __fish_use_subcommand -a pipelines -d "List pipelines for an organization"
125
+ complete -c bin/bktide -n __fish_use_subcommand -a builds -d "List builds for the current user"
126
+ complete -c bin/bktide -n __fish_use_subcommand -a token -d "Manage API tokens"
127
+ complete -c bin/bktide -n __fish_use_subcommand -a annotations -d "Show annotations for a build"
128
+ complete -c bin/bktide -n __fish_use_subcommand -a completions -d "Generate shell completions"
129
+ complete -c bin/bktide -n __fish_use_subcommand -a boom -d "Test error handling"
130
+
131
+ # Global options for bin/bktide
132
+ complete -c bin/bktide -l log-level -d "Set logging level" -xa "trace debug info warn error fatal"
133
+ complete -c bin/bktide -s d -l debug -d "Show debug information for errors"
134
+ complete -c bin/bktide -l no-cache -d "Disable caching of API responses"
135
+ complete -c bin/bktide -l cache-ttl -d "Set cache time-to-live in milliseconds" -x
136
+ complete -c bin/bktide -l clear-cache -d "Clear all cached data before executing command"
137
+ complete -c bin/bktide -s t -l token -d "Buildkite API token" -x
138
+ complete -c bin/bktide -l save-token -d "Save the token to system keychain for future use"
139
+ complete -c bin/bktide -s f -l format -d "Output format" -xa "plain json alfred"
140
+ complete -c bin/bktide -l color -d "Color output mode" -xa "auto always never"
141
+ complete -c bin/bktide -s q -l quiet -d "Suppress non-error output (plain format only)"
142
+ complete -c bin/bktide -l tips -d "Show helpful tips and suggestions"
143
+ complete -c bin/bktide -l no-tips -d "Hide helpful tips and suggestions"
144
+ complete -c bin/bktide -l ascii -d "Use ASCII symbols instead of Unicode"
145
+ complete -c bin/bktide -s h -l help -d "Show help"
146
+ complete -c bin/bktide -s V -l version -d "Show version"
147
+
148
+ # Command-specific options for bin/bktide with dynamic completions
149
+ complete -c bin/bktide -n "__fish_seen_subcommand_from pipelines" -s o -l org -d "Organization slug" -xa "(__fish_bktide_orgs)"
150
+ complete -c bin/bktide -n "__fish_seen_subcommand_from pipelines" -s n -l count -d "Limit to specified number of pipelines" -x
151
+ complete -c bin/bktide -n "__fish_seen_subcommand_from pipelines" -l filter -d "Filter pipelines by name (case insensitive)" -x
152
+
153
+ complete -c bin/bktide -n "__fish_seen_subcommand_from builds" -s o -l org -d "Organization slug" -xa "(__fish_bktide_orgs)"
154
+ complete -c bin/bktide -n "__fish_seen_subcommand_from builds" -s p -l pipeline -d "Filter by pipeline slug" -xa "(__fish_bktide_pipelines)"
155
+ complete -c bin/bktide -n "__fish_seen_subcommand_from builds" -s b -l branch -d "Filter by branch name" -xa "(__fish_bktide_branches)"
156
+ complete -c bin/bktide -n "__fish_seen_subcommand_from builds" -s s -l state -d "Filter by build state" -xa "running scheduled passed failing failed canceled blocked canceling skipped not_run"
157
+ complete -c bin/bktide -n "__fish_seen_subcommand_from builds" -s n -l count -d "Number of builds per page" -x
158
+ complete -c bin/bktide -n "__fish_seen_subcommand_from builds" -l page -d "Page number" -x
159
+ complete -c bin/bktide -n "__fish_seen_subcommand_from builds" -l filter -d "Fuzzy filter builds" -x
160
+
161
+ complete -c bin/bktide -n "__fish_seen_subcommand_from token" -l check -d "Check if a token is stored"
162
+ complete -c bin/bktide -n "__fish_seen_subcommand_from token" -l store -d "Store a token in the system keychain"
163
+ complete -c bin/bktide -n "__fish_seen_subcommand_from token" -l reset -d "Delete the stored token"
164
+
165
+ complete -c bin/bktide -n "__fish_seen_subcommand_from annotations" -a "org/pipeline/123" -d "Example: org/pipeline/build-number"
166
+ complete -c bin/bktide -n "__fish_seen_subcommand_from annotations" -l context -d "Filter annotations by context" -x
167
+
168
+ complete -c bin/bktide -n "__fish_seen_subcommand_from completions" -a "fish bash zsh" -d "Shell type"
169
+
170
+ complete -c bin/bktide -n "__fish_seen_subcommand_from boom" -l type -d "Type of error to throw" -xa "basic api object"
171
+
@@ -0,0 +1,124 @@
1
+ #!/bin/bash
2
+ # Bash completions for bktide CLI
3
+ # Install by adding to ~/.bashrc: source <(bktide completions bash)
4
+ # Or copy to /etc/bash_completion.d/bktide
5
+
6
+ _bktide() {
7
+ local cur prev words cword
8
+ _init_completion || return
9
+
10
+ local commands="viewer orgs pipelines builds token annotations completions boom"
11
+ local global_opts="--log-level --debug --no-cache --cache-ttl --clear-cache --token --save-token --format --color --quiet --tips --no-tips --ascii --help --version"
12
+
13
+ # First argument - complete with commands
14
+ if [[ $cword -eq 1 ]]; then
15
+ COMPREPLY=( $(compgen -W "$commands" -- "$cur") )
16
+ return 0
17
+ fi
18
+
19
+ local cmd="${words[1]}"
20
+
21
+ # Handle global options
22
+ case "$prev" in
23
+ --log-level)
24
+ COMPREPLY=( $(compgen -W "trace debug info warn error fatal" -- "$cur") )
25
+ return 0
26
+ ;;
27
+ --format|-f)
28
+ COMPREPLY=( $(compgen -W "plain json alfred" -- "$cur") )
29
+ return 0
30
+ ;;
31
+ --color)
32
+ COMPREPLY=( $(compgen -W "auto always never" -- "$cur") )
33
+ return 0
34
+ ;;
35
+ esac
36
+
37
+ # Command-specific completions
38
+ case "$cmd" in
39
+ pipelines)
40
+ local opts="--org --count --filter $global_opts"
41
+ if [[ "$prev" == "--org" || "$prev" == "-o" ]]; then
42
+ # Dynamic org completion (if bktide is working)
43
+ local orgs=$(bktide orgs --format json --quiet 2>/dev/null | jq -r '.[].slug' 2>/dev/null)
44
+ if [[ -n "$orgs" ]]; then
45
+ COMPREPLY=( $(compgen -W "$orgs" -- "$cur") )
46
+ return 0
47
+ fi
48
+ fi
49
+ COMPREPLY=( $(compgen -W "$opts" -- "$cur") )
50
+ ;;
51
+
52
+ builds)
53
+ local opts="--org --pipeline --branch --state --count --page --filter $global_opts"
54
+ case "$prev" in
55
+ --org|-o)
56
+ # Dynamic org completion
57
+ local orgs=$(bktide orgs --format json --quiet 2>/dev/null | jq -r '.[].slug' 2>/dev/null)
58
+ if [[ -n "$orgs" ]]; then
59
+ COMPREPLY=( $(compgen -W "$orgs" -- "$cur") )
60
+ return 0
61
+ fi
62
+ ;;
63
+ --pipeline|-p)
64
+ # Dynamic pipeline completion
65
+ local pipelines=$(bktide pipelines --format json --quiet 2>/dev/null | jq -r '.[].slug' 2>/dev/null)
66
+ if [[ -n "$pipelines" ]]; then
67
+ COMPREPLY=( $(compgen -W "$pipelines" -- "$cur") )
68
+ return 0
69
+ fi
70
+ ;;
71
+ --branch|-b)
72
+ # Git branches if in a repo
73
+ local branches="main master develop staging production"
74
+ if git rev-parse --git-dir &>/dev/null; then
75
+ branches="$branches $(git branch -r 2>/dev/null | sed 's/.*origin\///' | grep -v HEAD)"
76
+ fi
77
+ COMPREPLY=( $(compgen -W "$branches" -- "$cur") )
78
+ return 0
79
+ ;;
80
+ --state|-s)
81
+ COMPREPLY=( $(compgen -W "running scheduled passed failing failed canceled blocked canceling skipped not_run" -- "$cur") )
82
+ return 0
83
+ ;;
84
+ esac
85
+ COMPREPLY=( $(compgen -W "$opts" -- "$cur") )
86
+ ;;
87
+
88
+ token)
89
+ local opts="--check --store --reset $global_opts"
90
+ COMPREPLY=( $(compgen -W "$opts" -- "$cur") )
91
+ ;;
92
+
93
+ annotations)
94
+ local opts="--context $global_opts"
95
+ COMPREPLY=( $(compgen -W "$opts" -- "$cur") )
96
+ ;;
97
+
98
+ completions)
99
+ if [[ $cword -eq 2 ]]; then
100
+ COMPREPLY=( $(compgen -W "fish bash zsh" -- "$cur") )
101
+ else
102
+ COMPREPLY=( $(compgen -W "$global_opts" -- "$cur") )
103
+ fi
104
+ ;;
105
+
106
+ boom)
107
+ local opts="--type $global_opts"
108
+ if [[ "$prev" == "--type" ]]; then
109
+ COMPREPLY=( $(compgen -W "basic api object" -- "$cur") )
110
+ return 0
111
+ fi
112
+ COMPREPLY=( $(compgen -W "$opts" -- "$cur") )
113
+ ;;
114
+
115
+ *)
116
+ COMPREPLY=( $(compgen -W "$global_opts" -- "$cur") )
117
+ ;;
118
+ esac
119
+ }
120
+
121
+ # Register completions for both bktide and bin/bktide
122
+ complete -F _bktide bktide
123
+ complete -F _bktide bin/bktide
124
+
@@ -0,0 +1,107 @@
1
+ # Fish completions for bktide CLI
2
+ # Install by copying to ~/.config/fish/completions/bktide.fish
3
+ # Or run: bktide completions fish > ~/.config/fish/completions/bktide.fish
4
+
5
+ # Disable file completions for all bktide commands by default
6
+ complete -c bktide -f
7
+ complete -c bin/bktide -f
8
+
9
+ # Main commands
10
+ complete -c bktide -n __fish_use_subcommand -a viewer -d "Show logged in user information"
11
+ complete -c bktide -n __fish_use_subcommand -a orgs -d "List organizations"
12
+ complete -c bktide -n __fish_use_subcommand -a pipelines -d "List pipelines for an organization"
13
+ complete -c bktide -n __fish_use_subcommand -a builds -d "List builds for the current user"
14
+ complete -c bktide -n __fish_use_subcommand -a token -d "Manage API tokens"
15
+ complete -c bktide -n __fish_use_subcommand -a annotations -d "Show annotations for a build"
16
+ complete -c bktide -n __fish_use_subcommand -a boom -d "Test error handling"
17
+
18
+ # Global options (available for all commands)
19
+ complete -c bktide -l log-level -d "Set logging level" -xa "trace debug info warn error fatal"
20
+ complete -c bktide -s d -l debug -d "Show debug information for errors"
21
+ complete -c bktide -l no-cache -d "Disable caching of API responses"
22
+ complete -c bktide -l cache-ttl -d "Set cache time-to-live in milliseconds" -x
23
+ complete -c bktide -l clear-cache -d "Clear all cached data before executing command"
24
+ complete -c bktide -s t -l token -d "Buildkite API token" -x
25
+ complete -c bktide -l save-token -d "Save the token to system keychain for future use"
26
+ complete -c bktide -s f -l format -d "Output format" -xa "plain json alfred"
27
+ complete -c bktide -l color -d "Color output mode" -xa "auto always never"
28
+ complete -c bktide -s q -l quiet -d "Suppress non-error output (plain format only)"
29
+ complete -c bktide -l tips -d "Show helpful tips and suggestions"
30
+ complete -c bktide -l no-tips -d "Hide helpful tips and suggestions"
31
+ complete -c bktide -l ascii -d "Use ASCII symbols instead of Unicode"
32
+ complete -c bktide -s h -l help -d "Show help"
33
+ complete -c bktide -s V -l version -d "Show version"
34
+
35
+ # Pipelines command options
36
+ complete -c bktide -n "__fish_seen_subcommand_from pipelines" -s o -l org -d "Organization slug" -x
37
+ complete -c bktide -n "__fish_seen_subcommand_from pipelines" -s n -l count -d "Limit to specified number of pipelines" -x
38
+ complete -c bktide -n "__fish_seen_subcommand_from pipelines" -l filter -d "Filter pipelines by name (case insensitive)" -x
39
+
40
+ # Builds command options
41
+ complete -c bktide -n "__fish_seen_subcommand_from builds" -s o -l org -d "Organization slug" -x
42
+ complete -c bktide -n "__fish_seen_subcommand_from builds" -s p -l pipeline -d "Filter by pipeline slug" -x
43
+ complete -c bktide -n "__fish_seen_subcommand_from builds" -s b -l branch -d "Filter by branch name" -x
44
+ complete -c bktide -n "__fish_seen_subcommand_from builds" -s s -l state -d "Filter by build state" -xa "running scheduled passed failing failed canceled blocked canceling skipped not_run"
45
+ complete -c bktide -n "__fish_seen_subcommand_from builds" -s n -l count -d "Number of builds per page" -x
46
+ complete -c bktide -n "__fish_seen_subcommand_from builds" -l page -d "Page number" -x
47
+ complete -c bktide -n "__fish_seen_subcommand_from builds" -l filter -d "Fuzzy filter builds" -x
48
+
49
+ # Token command options
50
+ complete -c bktide -n "__fish_seen_subcommand_from token" -l check -d "Check if a token is stored"
51
+ complete -c bktide -n "__fish_seen_subcommand_from token" -l store -d "Store a token in the system keychain"
52
+ complete -c bktide -n "__fish_seen_subcommand_from token" -l reset -d "Delete the stored token"
53
+
54
+ # Annotations command options
55
+ complete -c bktide -n "__fish_seen_subcommand_from annotations" -l context -d "Filter annotations by context" -x
56
+
57
+ # Boom command options (for testing)
58
+ complete -c bktide -n "__fish_seen_subcommand_from boom" -l type -d "Type of error to throw" -xa "basic api object"
59
+
60
+ # Also support bin/bktide for local development
61
+ # Copy all the same completions for bin/bktide
62
+ complete -c bin/bktide -n __fish_use_subcommand -a viewer -d "Show logged in user information"
63
+ complete -c bin/bktide -n __fish_use_subcommand -a orgs -d "List organizations"
64
+ complete -c bin/bktide -n __fish_use_subcommand -a pipelines -d "List pipelines for an organization"
65
+ complete -c bin/bktide -n __fish_use_subcommand -a builds -d "List builds for the current user"
66
+ complete -c bin/bktide -n __fish_use_subcommand -a token -d "Manage API tokens"
67
+ complete -c bin/bktide -n __fish_use_subcommand -a annotations -d "Show annotations for a build"
68
+ complete -c bin/bktide -n __fish_use_subcommand -a boom -d "Test error handling"
69
+
70
+ # Global options for bin/bktide
71
+ complete -c bin/bktide -l log-level -d "Set logging level" -xa "trace debug info warn error fatal"
72
+ complete -c bin/bktide -s d -l debug -d "Show debug information for errors"
73
+ complete -c bin/bktide -l no-cache -d "Disable caching of API responses"
74
+ complete -c bin/bktide -l cache-ttl -d "Set cache time-to-live in milliseconds" -x
75
+ complete -c bin/bktide -l clear-cache -d "Clear all cached data before executing command"
76
+ complete -c bin/bktide -s t -l token -d "Buildkite API token" -x
77
+ complete -c bin/bktide -l save-token -d "Save the token to system keychain for future use"
78
+ complete -c bin/bktide -s f -l format -d "Output format" -xa "plain json alfred"
79
+ complete -c bin/bktide -l color -d "Color output mode" -xa "auto always never"
80
+ complete -c bin/bktide -s q -l quiet -d "Suppress non-error output (plain format only)"
81
+ complete -c bin/bktide -l tips -d "Show helpful tips and suggestions"
82
+ complete -c bin/bktide -l no-tips -d "Hide helpful tips and suggestions"
83
+ complete -c bin/bktide -l ascii -d "Use ASCII symbols instead of Unicode"
84
+ complete -c bin/bktide -s h -l help -d "Show help"
85
+ complete -c bin/bktide -s V -l version -d "Show version"
86
+
87
+ # Command-specific options for bin/bktide
88
+ complete -c bin/bktide -n "__fish_seen_subcommand_from pipelines" -s o -l org -d "Organization slug" -x
89
+ complete -c bin/bktide -n "__fish_seen_subcommand_from pipelines" -s n -l count -d "Limit to specified number of pipelines" -x
90
+ complete -c bin/bktide -n "__fish_seen_subcommand_from pipelines" -l filter -d "Filter pipelines by name (case insensitive)" -x
91
+
92
+ complete -c bin/bktide -n "__fish_seen_subcommand_from builds" -s o -l org -d "Organization slug" -x
93
+ complete -c bin/bktide -n "__fish_seen_subcommand_from builds" -s p -l pipeline -d "Filter by pipeline slug" -x
94
+ complete -c bin/bktide -n "__fish_seen_subcommand_from builds" -s b -l branch -d "Filter by branch name" -x
95
+ complete -c bin/bktide -n "__fish_seen_subcommand_from builds" -s s -l state -d "Filter by build state" -xa "running scheduled passed failing failed canceled blocked canceling skipped not_run"
96
+ complete -c bin/bktide -n "__fish_seen_subcommand_from builds" -s n -l count -d "Number of builds per page" -x
97
+ complete -c bin/bktide -n "__fish_seen_subcommand_from builds" -l page -d "Page number" -x
98
+ complete -c bin/bktide -n "__fish_seen_subcommand_from builds" -l filter -d "Fuzzy filter builds" -x
99
+
100
+ complete -c bin/bktide -n "__fish_seen_subcommand_from token" -l check -d "Check if a token is stored"
101
+ complete -c bin/bktide -n "__fish_seen_subcommand_from token" -l store -d "Store a token in the system keychain"
102
+ complete -c bin/bktide -n "__fish_seen_subcommand_from token" -l reset -d "Delete the stored token"
103
+
104
+ complete -c bin/bktide -n "__fish_seen_subcommand_from annotations" -l context -d "Filter annotations by context" -x
105
+
106
+ complete -c bin/bktide -n "__fish_seen_subcommand_from boom" -l type -d "Type of error to throw" -xa "basic api object"
107
+