@codefresh-io/gitops-release 0.1.0

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 (98) hide show
  1. package/README.md +397 -0
  2. package/dist/commands/cherry-pick.d.ts +14 -0
  3. package/dist/commands/cherry-pick.d.ts.map +1 -0
  4. package/dist/commands/cherry-pick.js +337 -0
  5. package/dist/commands/cherry-pick.js.map +1 -0
  6. package/dist/commands/cherry-pick.test.d.ts +2 -0
  7. package/dist/commands/cherry-pick.test.d.ts.map +1 -0
  8. package/dist/commands/cherry-pick.test.js +377 -0
  9. package/dist/commands/cherry-pick.test.js.map +1 -0
  10. package/dist/commands/completion.d.ts +11 -0
  11. package/dist/commands/completion.d.ts.map +1 -0
  12. package/dist/commands/completion.js +195 -0
  13. package/dist/commands/completion.js.map +1 -0
  14. package/dist/commands/completion.test.d.ts +2 -0
  15. package/dist/commands/completion.test.d.ts.map +1 -0
  16. package/dist/commands/completion.test.js +142 -0
  17. package/dist/commands/completion.test.js.map +1 -0
  18. package/dist/commands/create.d.ts +15 -0
  19. package/dist/commands/create.d.ts.map +1 -0
  20. package/dist/commands/create.js +107 -0
  21. package/dist/commands/create.js.map +1 -0
  22. package/dist/commands/create.test.d.ts +2 -0
  23. package/dist/commands/create.test.d.ts.map +1 -0
  24. package/dist/commands/create.test.js +274 -0
  25. package/dist/commands/create.test.js.map +1 -0
  26. package/dist/commands/list.d.ts +14 -0
  27. package/dist/commands/list.d.ts.map +1 -0
  28. package/dist/commands/list.js +69 -0
  29. package/dist/commands/list.js.map +1 -0
  30. package/dist/commands/notes.d.ts +15 -0
  31. package/dist/commands/notes.d.ts.map +1 -0
  32. package/dist/commands/notes.js +374 -0
  33. package/dist/commands/notes.js.map +1 -0
  34. package/dist/commands/publish.d.ts +14 -0
  35. package/dist/commands/publish.d.ts.map +1 -0
  36. package/dist/commands/publish.js +220 -0
  37. package/dist/commands/publish.js.map +1 -0
  38. package/dist/commands/publish.test.d.ts +2 -0
  39. package/dist/commands/publish.test.d.ts.map +1 -0
  40. package/dist/commands/publish.test.js +371 -0
  41. package/dist/commands/publish.test.js.map +1 -0
  42. package/dist/commands/status.d.ts +8 -0
  43. package/dist/commands/status.d.ts.map +1 -0
  44. package/dist/commands/status.js +258 -0
  45. package/dist/commands/status.js.map +1 -0
  46. package/dist/context.d.ts +35 -0
  47. package/dist/context.d.ts.map +1 -0
  48. package/dist/context.js +48 -0
  49. package/dist/context.js.map +1 -0
  50. package/dist/index.d.ts +4 -0
  51. package/dist/index.d.ts.map +1 -0
  52. package/dist/index.js +152 -0
  53. package/dist/index.js.map +1 -0
  54. package/dist/output/formatter.d.ts +161 -0
  55. package/dist/output/formatter.d.ts.map +1 -0
  56. package/dist/output/formatter.js +398 -0
  57. package/dist/output/formatter.js.map +1 -0
  58. package/dist/output/formatter.test.d.ts +2 -0
  59. package/dist/output/formatter.test.d.ts.map +1 -0
  60. package/dist/output/formatter.test.js +223 -0
  61. package/dist/output/formatter.test.js.map +1 -0
  62. package/dist/services/ai.d.ts +69 -0
  63. package/dist/services/ai.d.ts.map +1 -0
  64. package/dist/services/ai.js +235 -0
  65. package/dist/services/ai.js.map +1 -0
  66. package/dist/services/ai.test.d.ts +2 -0
  67. package/dist/services/ai.test.d.ts.map +1 -0
  68. package/dist/services/ai.test.js +101 -0
  69. package/dist/services/ai.test.js.map +1 -0
  70. package/dist/services/github.d.ts +200 -0
  71. package/dist/services/github.d.ts.map +1 -0
  72. package/dist/services/github.js +465 -0
  73. package/dist/services/github.js.map +1 -0
  74. package/dist/services/github.test.d.ts +2 -0
  75. package/dist/services/github.test.d.ts.map +1 -0
  76. package/dist/services/github.test.js +64 -0
  77. package/dist/services/github.test.js.map +1 -0
  78. package/dist/services/version.d.ts +106 -0
  79. package/dist/services/version.d.ts.map +1 -0
  80. package/dist/services/version.js +158 -0
  81. package/dist/services/version.js.map +1 -0
  82. package/dist/services/version.test.d.ts +2 -0
  83. package/dist/services/version.test.d.ts.map +1 -0
  84. package/dist/services/version.test.js +136 -0
  85. package/dist/services/version.test.js.map +1 -0
  86. package/dist/utils/errors.d.ts +66 -0
  87. package/dist/utils/errors.d.ts.map +1 -0
  88. package/dist/utils/errors.js +154 -0
  89. package/dist/utils/errors.js.map +1 -0
  90. package/dist/utils/errors.test.d.ts +2 -0
  91. package/dist/utils/errors.test.d.ts.map +1 -0
  92. package/dist/utils/errors.test.js +147 -0
  93. package/dist/utils/errors.test.js.map +1 -0
  94. package/dist/utils/prompts.d.ts +54 -0
  95. package/dist/utils/prompts.d.ts.map +1 -0
  96. package/dist/utils/prompts.js +108 -0
  97. package/dist/utils/prompts.js.map +1 -0
  98. package/package.json +70 -0
package/README.md ADDED
@@ -0,0 +1,397 @@
1
+ # GitOps Runtime Release CLI
2
+
3
+ A TypeScript CLI to automate the release lifecycle for Codefresh GitOps runtime helm chart. The CLI performs GitHub operations that trigger existing Argo Workflows pipelines automatically.
4
+
5
+ ## Installation
6
+
7
+ ```bash
8
+ # Using npx (no installation required)
9
+ npx @codefresh-io/gitops-release --help
10
+
11
+ # Or install globally
12
+ npm install -g @codefresh-io/gitops-release
13
+ gitops-release --help
14
+ ```
15
+
16
+ ### Manual Release Process
17
+
18
+ If you prefer not to use this CLI (or don't have an Anthropic API key for AI release notes), see the [Manual Release Guide](https://github.com/codefresh-io/gitops-runtime-helm/blob/main/docs/RELEASE_GUIDE.md) in the gitops-runtime-helm repository.
19
+
20
+ ## Requirements
21
+
22
+ - `GITHUB_TOKEN` environment variable with `repo` scope
23
+ - `ANTHROPIC_API_KEY` environment variable (only for `notes` command)
24
+
25
+ ## Usage
26
+
27
+ ```
28
+ gitops-release [global flags] <command> [command flags] [args]
29
+ ```
30
+
31
+ ### Global Flags
32
+
33
+ | Flag | Description |
34
+ |------|-------------|
35
+ | `--repo <owner/repo>` | Target repository (default: `codefresh-io/gitops-runtime-helm`) |
36
+ | `--json` | Output as JSON |
37
+ | `-q, --quiet` | Minimal output |
38
+ | `-v, --verbose` | Verbose output |
39
+ | `--no-color` | Disable colored output |
40
+ | `-h, --help` | Show help |
41
+ | `-V, --version` | Show version |
42
+
43
+ ## Commands
44
+
45
+ ### `create <major.minor>`
46
+
47
+ Create a new stable release branch. This triggers the prepare-release pipeline.
48
+
49
+ ```bash
50
+ # Create stable/0.27 from main HEAD
51
+ gitops-release create 0.27
52
+
53
+ # Create from a specific commit
54
+ gitops-release create 0.27 --from abc1234
55
+
56
+ # Preview without making changes
57
+ gitops-release create 0.27 --dry-run
58
+ ```
59
+
60
+ **Options:**
61
+ | Flag | Description |
62
+ |------|-------------|
63
+ | `--from <sha>` | Commit SHA to branch from (default: main HEAD) |
64
+ | `--dry-run` | Preview without making changes |
65
+ | `-f, --force` | Skip confirmation prompt |
66
+
67
+ **What happens next:**
68
+ 1. The prepare-release pipeline automatically creates a `prep/v0.27.0` branch
69
+ 2. Opens a prepare-release PR to `stable/0.27`
70
+ 3. Creates a draft GitHub release
71
+
72
+ ### `status [version]`
73
+
74
+ Show status of releases, open PRs, drafts, and pipelines.
75
+
76
+ ```bash
77
+ # Show overview of all active releases
78
+ gitops-release status
79
+
80
+ # Show detailed status for a specific version
81
+ gitops-release status 0.27
82
+
83
+ # JSON output for scripting
84
+ gitops-release status 0.27 --json
85
+ ```
86
+
87
+ ### `publish <version>`
88
+
89
+ Publish a release by merging the prepare-release PR.
90
+
91
+ ```bash
92
+ # Publish release 0.27.0
93
+ gitops-release publish 0.27.0
94
+
95
+ # Skip confirmation prompt
96
+ gitops-release publish 0.27.0 --force
97
+
98
+ # Preview without merging
99
+ gitops-release publish 0.27.0 --dry-run
100
+ ```
101
+
102
+ **Options:**
103
+ | Flag | Description |
104
+ |------|-------------|
105
+ | `-f, --force` | Skip confirmation prompt |
106
+ | `--dry-run` | Preview without merging |
107
+
108
+ **What happens next:**
109
+ 1. The promote pipeline publishes the chart to quay.io
110
+ 2. Publishes the GitHub release (draft → published)
111
+ 3. Signs container images
112
+
113
+ ### `list`
114
+
115
+ List releases and their states.
116
+
117
+ ```bash
118
+ # List recent releases (default: 10)
119
+ gitops-release list
120
+
121
+ # List more releases
122
+ gitops-release list --limit 20
123
+
124
+ # Include draft releases
125
+ gitops-release list --include-drafts
126
+
127
+ # JSON output
128
+ gitops-release list --json
129
+ ```
130
+
131
+ **Options:**
132
+ | Flag | Description |
133
+ |------|-------------|
134
+ | `-n, --limit <n>` | Number of releases to show (default: 10) |
135
+ | `--include-drafts` | Include draft releases |
136
+
137
+ ### `notes <version>`
138
+
139
+ Generate AI-powered release notes for ArtifactHub and GitHub releases.
140
+
141
+ ```bash
142
+ # Generate and display notes
143
+ gitops-release notes 0.27.0
144
+
145
+ # Open in editor for review
146
+ gitops-release notes 0.27.0 --edit
147
+
148
+ # Apply notes to draft release and Chart.yaml
149
+ gitops-release notes 0.27.0 --apply
150
+
151
+ # Preview changes without applying
152
+ gitops-release notes 0.27.0 --apply --dry-run
153
+ ```
154
+
155
+ **Options:**
156
+ | Flag | Description |
157
+ |------|-------------|
158
+ | `-e, --edit` | Open generated notes in `$EDITOR` for review |
159
+ | `-a, --apply` | Apply notes to draft release and Chart.yaml |
160
+ | `--dry-run` | Preview without making changes |
161
+
162
+ **Requirements:**
163
+ - `ANTHROPIC_API_KEY` environment variable
164
+
165
+ ### `cherry-pick <major.minor> <commits...>`
166
+
167
+ Cherry-pick commits to a stable branch and create a PR.
168
+
169
+ ```bash
170
+ # Backport a single commit
171
+ gitops-release cherry-pick 0.26 abc1234
172
+
173
+ # Backport multiple commits
174
+ gitops-release cherry-pick 0.26 abc1234 def5678 ghi9012
175
+
176
+ # Preview without making changes
177
+ gitops-release cherry-pick 0.26 abc1234 --dry-run
178
+ ```
179
+
180
+ **Options:**
181
+ | Flag | Description |
182
+ |------|-------------|
183
+ | `--dry-run` | Preview without making changes |
184
+ | `-f, --force` | Skip confirmation prompt |
185
+
186
+ **Requirements:**
187
+ - Must be run from within a local git checkout of the repository
188
+
189
+ ### `completion <shell>`
190
+
191
+ Generate shell completion script.
192
+
193
+ ```bash
194
+ # Bash completion
195
+ gitops-release completion bash > /etc/bash_completion.d/gitops-release
196
+ # Or
197
+ source <(gitops-release completion bash)
198
+
199
+ # Zsh completion
200
+ gitops-release completion zsh > ~/.zsh/completions/_gitops-release
201
+ # Then add to ~/.zshrc:
202
+ # fpath=(~/.zsh/completions $fpath)
203
+ # autoload -Uz compinit && compinit
204
+ ```
205
+
206
+ ## Example Workflows
207
+
208
+ ### Create and Publish a New Minor Release
209
+
210
+ ```bash
211
+ # 1. Create the stable branch
212
+ gitops-release create 0.27
213
+
214
+ # 2. Wait for pipeline, then check status
215
+ gitops-release status 0.27
216
+
217
+ # 3. Generate release notes (optional)
218
+ gitops-release notes 0.27.0 --edit --apply
219
+
220
+ # 4. When PR is ready, publish
221
+ gitops-release publish 0.27.0
222
+ ```
223
+
224
+ ### Patch Release Flow
225
+
226
+ ```bash
227
+ # 1. Check current status of existing stable branch
228
+ gitops-release status 0.26
229
+
230
+ # 2. If there's a pending prepare-release PR
231
+ gitops-release publish 0.26.6
232
+ ```
233
+
234
+ ### Backport a Fix
235
+
236
+ ```bash
237
+ # 1. Cherry-pick fix from main to stable/0.26
238
+ gitops-release cherry-pick 0.26 abc1234
239
+
240
+ # 2. Review and merge the created PR, then publish
241
+ gitops-release status 0.26
242
+ gitops-release publish 0.26.6
243
+ ```
244
+
245
+ ### CI/Scripted Usage
246
+
247
+ ```bash
248
+ # Non-interactive publish with JSON output
249
+ GITHUB_TOKEN=$TOKEN gitops-release publish 0.27.0 --force --json
250
+
251
+ # Check if ready to publish
252
+ gitops-release status 0.27 --json | jq '.ready_to_publish'
253
+ ```
254
+
255
+ ## Exit Codes
256
+
257
+ | Code | Meaning |
258
+ |------|---------|
259
+ | 0 | Success |
260
+ | 1 | Generic error |
261
+ | 2 | Invalid usage / bad arguments |
262
+ | 3 | Git/GitHub operation failed |
263
+ | 4 | Resource not found |
264
+ | 5 | Cancelled by user |
265
+ | 6 | AI generation failed |
266
+
267
+ ## Environment Variables
268
+
269
+ | Variable | Required | Description |
270
+ |----------|----------|-------------|
271
+ | `GITHUB_TOKEN` | Yes | GitHub API token with `repo` scope |
272
+ | `ANTHROPIC_API_KEY` | For `notes` | Anthropic API key for AI release notes |
273
+ | `NO_COLOR` | No | Disable colors when set |
274
+ | `EDITOR` | No | Editor for `notes --edit` (default: vim) |
275
+
276
+ ## Development
277
+
278
+ ```bash
279
+ # Clone the repository
280
+ git clone https://github.com/codefresh-io/gitops-release.git
281
+ cd gitops-release
282
+
283
+ # Install dependencies
284
+ npm install
285
+
286
+ # Build
287
+ npm run build
288
+
289
+ # Run locally
290
+ npm start -- status
291
+
292
+ # Watch mode
293
+ npm run dev
294
+
295
+ # Link globally for testing
296
+ npm link
297
+ gitops-release --help
298
+
299
+ # Run tests
300
+ npm test
301
+
302
+ # Run tests in watch mode
303
+ npm run test:watch
304
+
305
+ # Lint
306
+ npm run lint
307
+
308
+ # Format code
309
+ npm run format
310
+
311
+ # Type check
312
+ npm run typecheck
313
+ ```
314
+
315
+ ## Project Structure
316
+
317
+ ```
318
+ src/
319
+ ├── index.ts # CLI entry point
320
+ ├── context.ts # Shared command context
321
+ ├── commands/
322
+ │ ├── create.ts # Create stable branch
323
+ │ ├── status.ts # Show release status
324
+ │ ├── publish.ts # Merge prepare-release PR
325
+ │ ├── list.ts # List releases
326
+ │ ├── notes.ts # AI-powered release notes
327
+ │ ├── cherry-pick.ts # Cherry-pick commits
328
+ │ └── completion.ts # Shell completion
329
+ ├── services/
330
+ │ ├── github.ts # GitHub API wrapper (Octokit)
331
+ │ ├── version.ts # Version parsing/validation
332
+ │ └── ai.ts # Anthropic AI service
333
+ ├── output/
334
+ │ └── formatter.ts # Output formatting (human/JSON)
335
+ └── utils/
336
+ ├── errors.ts # Error classes with exit codes
337
+ └── prompts.ts # Interactive prompts
338
+ ```
339
+
340
+ ## Troubleshooting
341
+
342
+ ### "GITHUB_TOKEN environment variable is required"
343
+
344
+ Set the `GITHUB_TOKEN` environment variable:
345
+
346
+ ```bash
347
+ export GITHUB_TOKEN=ghp_xxxxxxxxxxxxxxxxxxxx
348
+ ```
349
+
350
+ Create a token at https://github.com/settings/tokens with `repo` scope.
351
+
352
+ ### "ANTHROPIC_API_KEY environment variable is required"
353
+
354
+ The `notes` command requires an Anthropic API key:
355
+
356
+ ```bash
357
+ export ANTHROPIC_API_KEY=sk-ant-xxxxxxxxxxxxxxxxxxxx
358
+ ```
359
+
360
+ ### "Not in a git repository"
361
+
362
+ The `cherry-pick` command requires a local git checkout. Clone the repository first:
363
+
364
+ ```bash
365
+ git clone https://github.com/codefresh-io/gitops-runtime-helm.git
366
+ cd gitops-runtime-helm
367
+ gitops-release cherry-pick 0.26 abc1234
368
+ ```
369
+
370
+ ### "Branch already exists"
371
+
372
+ The stable branch was already created. Check its status:
373
+
374
+ ```bash
375
+ gitops-release status 0.27
376
+ ```
377
+
378
+ ### "No prepare-release PR found"
379
+
380
+ Wait for the prepare-release pipeline to complete, or check if there's an issue:
381
+
382
+ ```bash
383
+ gitops-release status 0.27
384
+ ```
385
+
386
+ ### "CI checks not passing"
387
+
388
+ Fix the failing checks before publishing. View the PR for details:
389
+
390
+ ```bash
391
+ gitops-release status 0.27
392
+ # Check the PR URL in the output
393
+ ```
394
+
395
+ ## License
396
+
397
+ MIT
@@ -0,0 +1,14 @@
1
+ import { CommandContext } from "../context.js";
2
+ /**
3
+ * Options for the cherry-pick command.
4
+ */
5
+ export interface CherryPickOptions {
6
+ dryRun: boolean;
7
+ force?: boolean;
8
+ }
9
+ /**
10
+ * Executes the cherry-pick command.
11
+ * Cherry-picks commits to a stable branch and creates a PR.
12
+ */
13
+ export declare function cherryPickCommand(ctx: CommandContext, versionInput: string, commits: string[], options: CherryPickOptions): Promise<void>;
14
+ //# sourceMappingURL=cherry-pick.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"cherry-pick.d.ts","sourceRoot":"","sources":["../../src/commands/cherry-pick.ts"],"names":[],"mappings":"AAIA,OAAO,EAAE,cAAc,EAAE,MAAM,eAAe,CAAC;AAK/C;;GAEG;AACH,MAAM,WAAW,iBAAiB;IAChC,MAAM,EAAE,OAAO,CAAC;IAChB,KAAK,CAAC,EAAE,OAAO,CAAC;CACjB;AAiID;;;GAGG;AACH,wBAAsB,iBAAiB,CACrC,GAAG,EAAE,cAAc,EACnB,YAAY,EAAE,MAAM,EACpB,OAAO,EAAE,MAAM,EAAE,EACjB,OAAO,EAAE,iBAAiB,GACzB,OAAO,CAAC,IAAI,CAAC,CAiRf"}