Skip to content

Commit f4efef2

Browse files
authored
Merge pull request #8 from stainless-api/release-please--branches--main--changes--next
release: 0.1.0-alpha.3
2 parents 1d616ec + 17bc80e commit f4efef2

File tree

11 files changed

+147
-147
lines changed

11 files changed

+147
-147
lines changed

.goreleaser.yml

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -55,3 +55,16 @@ nfpms:
5555
formats:
5656
- deb
5757
- rpm
58+
notarize:
59+
macos:
60+
enabled: '{{ isEnvSet "MACOS_SIGN_P12" }}'
61+
ids: [macos]
62+
63+
sign:
64+
certificate: "{{.Env.MACOS_SIGN_P12}}"
65+
password: "{{.Env.MACOS_SIGN_PASSWORD}}"
66+
67+
notarize:
68+
issuer_id: "{{.Env.MACOS_NOTARY_ISSUER_ID}}"
69+
key_id: "{{.Env.MACOS_NOTARY_KEY_ID}}"
70+
key: "{{.Env.MACOS_NOTARY_KEY}}"

.release-please-manifest.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,3 @@
11
{
2-
".": "0.1.0-alpha.2"
2+
".": "0.1.0-alpha.3"
33
}

.stats.yml

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
configured_endpoints: 14
2-
openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/stainless%2Fstainless-v0-5005d23980f589ea52eb1678ed620336b7c1172e3b1493a5c819c6b00f22203e.yml
3-
openapi_spec_hash: 2a29f55c69490ab4d0ee5eb32727ab46
4-
config_hash: c07d83d7b608ebebfa309e58b3bc15bb
1+
configured_endpoints: 15
2+
openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/stainless%2Fstainless-v0-475d7467c6365b48df46bee77ff6a07d22601f7c3a269a0383473e4ebce1146d.yml
3+
openapi_spec_hash: 4b9f1b89f983978e970133b5653fd0d8
4+
config_hash: 28c1ddd1e9bdba67e018459acdfafc5b

CHANGELOG.md

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,29 @@
11
# Changelog
22

3+
## 0.1.0-alpha.3 (2025-05-22)
4+
5+
Full Changelog: [v0.1.0-alpha.2...v0.1.0-alpha.3](https://github.com/stainless-api/stainless-api-cli/compare/v0.1.0-alpha.2...v0.1.0-alpha.3)
6+
7+
### Features
8+
9+
* add readme ([517510b](https://github.com/stainless-api/stainless-api-cli/commit/517510b292283dff91a6f6403a133200050a49b2))
10+
* **api:** add build compare to v0 ([ce9328e](https://github.com/stainless-api/stainless-api-cli/commit/ce9328e38387835ac55410e401194dc63d4e0fd9))
11+
* **api:** bump go sdk version ([8500bf3](https://github.com/stainless-api/stainless-api-cli/commit/8500bf36df104935d6f63e3fd6ef651f21a253df))
12+
* **api:** enable macos publishing ([c49364b](https://github.com/stainless-api/stainless-api-cli/commit/c49364b09ca3eb23f01ab254a1ec2c5b10a67a26))
13+
14+
15+
### Bug Fixes
16+
17+
* fix custom code ([7d5ba04](https://github.com/stainless-api/stainless-api-cli/commit/7d5ba043c02683f4cf75c09029d65c136e39692e))
18+
* update request schema for Postman webhook ([a9c5de3](https://github.com/stainless-api/stainless-api-cli/commit/a9c5de30d3ac155e9be266f29a35de13e7a84edc))
19+
20+
21+
### Chores
22+
23+
* **internal:** codegen related update ([81448ca](https://github.com/stainless-api/stainless-api-cli/commit/81448cab092f0f1b50e1613c100f2fc2c97770d3))
24+
* **internal:** codegen related update ([ac9557a](https://github.com/stainless-api/stainless-api-cli/commit/ac9557a75a32c0f838ab920648ef475969784cd8))
25+
* **internal:** codegen related update ([4a1d74a](https://github.com/stainless-api/stainless-api-cli/commit/4a1d74ae1856a1375dbf74699d80823e5b5fb0cd))
26+
327
## 0.1.0-alpha.2 (2025-04-30)
428

529
Full Changelog: [v0.1.0-alpha.1...v0.1.0-alpha.2](https://github.com/stainless-api/stainless-api-cli/compare/v0.1.0-alpha.1...v0.1.0-alpha.2)

README.md

Lines changed: 18 additions & 121 deletions
Original file line numberDiff line numberDiff line change
@@ -1,136 +1,33 @@
1-
# Stainless API CLI
1+
# Stainless V0 CLI
22

3-
A command-line interface for interacting with the Stainless API to manage projects, builds, and SDK generation.
3+
The official CLI for the Stainless V0 REST API.
44

5-
## Installation
6-
7-
```bash
8-
go install github.com/stainless-api/stainless-api-cli@latest
9-
```
10-
11-
## Authentication
12-
13-
Before using the CLI, you need to authenticate with the Stainless API.
14-
15-
```bash
16-
# Log in using OAuth device flow
17-
stainless-api-cli auth login
18-
19-
# Check authentication status
20-
stainless-api-cli auth status
21-
22-
# Log out and remove saved credentials
23-
stainless-api-cli auth logout
24-
```
25-
26-
You can also authenticate by setting the `STAINLESS_API_KEY` environment variable, which takes precedence over saved credentials.
27-
28-
## Projects
29-
30-
Manage your Stainless projects.
31-
32-
```bash
33-
# Retrieve a project
34-
stainless-api-cli projects retrieve --project-name <project-name>
35-
36-
# Update a project
37-
stainless-api-cli projects update --project-name <project-name> --display-name "New Project Name"
38-
```
39-
40-
### Project Branches
41-
42-
```bash
43-
# Create a new branch
44-
stainless-api-cli projects:branches create --project <project-name> --branch <branch-name> --branch-from main
45-
46-
# Retrieve a branch
47-
stainless-api-cli projects:branches retrieve --project <project-name> --branch <branch-name>
48-
```
49-
50-
### Project Configs
5+
It is generated with [Stainless](https://www.stainless.com/).
516

52-
```bash
53-
# Retrieve project configuration
54-
stainless-api-cli projects:configs retrieve --project <project-name> --branch <branch-name>
55-
56-
# Guess project configuration based on OpenAPI spec
57-
stainless-api-cli projects:configs guess --project <project-name> --spec <path-to-spec>
58-
```
59-
60-
## Builds
61-
62-
Create and manage builds for your projects.
63-
64-
```bash
65-
# Create a new build
66-
stainless-api-cli builds create --project <project-name> --revision <revision> --openapi-spec <path-to-spec> --stainless-config <path-to-config>
67-
68-
# Create a build and wait for completion
69-
stainless-api-cli builds create --project <project-name> --revision <revision> --openapi-spec <path-to-spec> --wait
70-
71-
# Create a build, wait for completion, and pull outputs
72-
stainless-api-cli builds create --project <project-name> --revision <revision> --openapi-spec <path-to-spec> --wait --pull
73-
74-
# Retrieve a build
75-
stainless-api-cli builds retrieve --build-id <build-id>
76-
77-
# List builds for a project
78-
stainless-api-cli builds list --project <project-name> --branch <branch-name>
79-
```
80-
81-
## Build Target Outputs
7+
## Installation
828

83-
Retrieve and pull build target outputs.
9+
### Installing with Go
8410

85-
```bash
86-
# Retrieve build target output
87-
stainless-api-cli build_target_outputs retrieve --build-id <build-id> --target <target> --type <type> --output <output>
11+
<!-- x-release-please-start-version -->
8812

89-
# Pull build target output
90-
stainless-api-cli build_target_outputs pull --build-id <build-id> --target <target> --type <type> --output <output>
13+
```sh
14+
go install 'github.com/stainless-api/stainless-api-cli'
9115
```
9216

93-
## Environment Variables
94-
95-
- `STAINLESS_API_KEY`: API key for authentication (takes precedence over saved credentials)
96-
- `NO_COLOR`: Disable colored output
97-
- `FORCE_COLOR`: Force colored output (`1` to enable, `0` to disable)
17+
<!-- x-release-please-end -->
9818

99-
## Examples
19+
## Usage
10020

101-
```bash
102-
# Generate a TypeScript SDK for your API
103-
stainless-api-cli builds create --project my-project --branch main --openapi-spec ./openapi.yml --wait --pull --targets typescript
21+
The CLI follows a resource-based command structure:
10422

105-
# Generate multiple SDKs at once
106-
stainless-api-cli builds create --project my-project --branch main --openapi-spec ./openapi.yml --wait --pull --targets typescript,python,go
23+
```sh
24+
stainless-api-cli [resource] [command] [flags]
10725
```
10826

109-
## Shell Completion
110-
111-
The CLI supports shell completion. To enable it:
112-
113-
```bash
114-
# For bash
115-
stainless-api-cli completion bash > /etc/bash_completion.d/stainless-api-cli
116-
117-
# For zsh
118-
stainless-api-cli completion zsh > "${fpath[1]}/_stainless-api-cli"
119-
120-
# For fish
121-
stainless-api-cli completion fish > ~/.config/fish/completions/stainless-api-cli.fish
27+
```sh
28+
stainless-api-cli builds create \
29+
--project project \
30+
--revision string
12231
```
12332

124-
## Available SDK Targets
125-
126-
The Stainless API CLI can generate SDKs for multiple languages:
127-
128-
- `typescript` - TypeScript SDK
129-
- `node` - Node.js SDK
130-
- `python` - Python SDK
131-
- `go` - Go SDK
132-
- `ruby` - Ruby SDK
133-
- `java` - Java SDK
134-
- `kotlin` - Kotlin SDK
135-
- `cli` - Command-line interface
136-
- `terraform` - Terraform provider
33+
For details about specific commands, use the `--help` flag.

SECURITY.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ before making any information public.
1616
## Reporting Non-SDK Related Security Issues
1717

1818
If you encounter security issues that are not directly related to SDKs but pertain to the services
19-
or products provided by Stainless V0 please follow the respective company's security reporting guidelines.
19+
or products provided by Stainless V0, please follow the respective company's security reporting guidelines.
2020

2121
---
2222

build.go

Lines changed: 72 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -27,55 +27,55 @@ func getCompletedTargets(buildRes stainlessv0.BuildObject) []targetInfo {
2727
targets := []targetInfo{}
2828

2929
// Check each target and add it to the list if it's completed or in postgen
30-
if buildRes.Targets.JSON.Node.IsPresent() {
30+
if buildRes.Targets.JSON.Node.Valid() {
3131
targets = append(targets, targetInfo{
3232
name: "node",
3333
status: buildRes.Targets.Node.Status,
3434
})
3535
}
36-
if buildRes.Targets.JSON.Typescript.IsPresent() {
36+
if buildRes.Targets.JSON.Typescript.Valid() {
3737
targets = append(targets, targetInfo{
3838
name: "typescript",
3939
status: buildRes.Targets.Typescript.Status,
4040
})
4141
}
42-
if buildRes.Targets.JSON.Python.IsPresent() {
42+
if buildRes.Targets.JSON.Python.Valid() {
4343
targets = append(targets, targetInfo{
4444
name: "python",
4545
status: buildRes.Targets.Python.Status,
4646
})
4747
}
48-
if buildRes.Targets.JSON.Go.IsPresent() {
48+
if buildRes.Targets.JSON.Go.Valid() {
4949
targets = append(targets, targetInfo{
5050
name: "go",
5151
status: buildRes.Targets.Go.Status,
5252
})
5353
}
54-
if buildRes.Targets.JSON.Cli.IsPresent() {
54+
if buildRes.Targets.JSON.Cli.Valid() {
5555
targets = append(targets, targetInfo{
5656
name: "cli",
5757
status: buildRes.Targets.Cli.Status,
5858
})
5959
}
60-
if buildRes.Targets.JSON.Kotlin.IsPresent() {
60+
if buildRes.Targets.JSON.Kotlin.Valid() {
6161
targets = append(targets, targetInfo{
6262
name: "kotlin",
6363
status: buildRes.Targets.Kotlin.Status,
6464
})
6565
}
66-
if buildRes.Targets.JSON.Java.IsPresent() {
66+
if buildRes.Targets.JSON.Java.Valid() {
6767
targets = append(targets, targetInfo{
6868
name: "java",
6969
status: buildRes.Targets.Java.Status,
7070
})
7171
}
72-
if buildRes.Targets.JSON.Ruby.IsPresent() {
72+
if buildRes.Targets.JSON.Ruby.Valid() {
7373
targets = append(targets, targetInfo{
7474
name: "ruby",
7575
status: buildRes.Targets.Ruby.Status,
7676
})
7777
}
78-
if buildRes.Targets.JSON.Terraform.IsPresent() {
78+
if buildRes.Targets.JSON.Terraform.Valid() {
7979
targets = append(targets, targetInfo{
8080
name: "terraform",
8181
status: buildRes.Targets.Terraform.Status,
@@ -188,6 +188,52 @@ var buildsList = cli.Command{
188188
HideHelpCommand: true,
189189
}
190190

191+
var buildsCompare = cli.Command{
192+
Name: "compare",
193+
Usage: "Creates two builds whose outputs can be compared directly",
194+
Flags: []cli.Flag{
195+
&cli.StringFlag{
196+
Name: "base.revision",
197+
Action: getAPIFlagAction[string]("body", "base.revision"),
198+
},
199+
&cli.StringFlag{
200+
Name: "base.branch",
201+
Action: getAPIFlagAction[string]("body", "base.branch"),
202+
},
203+
&cli.StringFlag{
204+
Name: "base.commit_message",
205+
Action: getAPIFlagAction[string]("body", "base.commit_message"),
206+
},
207+
&cli.StringFlag{
208+
Name: "head.revision",
209+
Action: getAPIFlagAction[string]("body", "head.revision"),
210+
},
211+
&cli.StringFlag{
212+
Name: "head.branch",
213+
Action: getAPIFlagAction[string]("body", "head.branch"),
214+
},
215+
&cli.StringFlag{
216+
Name: "head.commit_message",
217+
Action: getAPIFlagAction[string]("body", "head.commit_message"),
218+
},
219+
&cli.StringFlag{
220+
Name: "project",
221+
Action: getAPIFlagAction[string]("body", "project"),
222+
},
223+
&cli.StringFlag{
224+
Name: "targets",
225+
Action: getAPIFlagAction[string]("body", "targets.#"),
226+
},
227+
&cli.StringFlag{
228+
Name: "+target",
229+
Action: getAPIFlagAction[string]("body", "targets.-1"),
230+
},
231+
},
232+
Before: initAPICommand,
233+
Action: handleBuildsCompare,
234+
HideHelpCommand: true,
235+
}
236+
191237
func handleBuildsCreate(ctx context.Context, cmd *cli.Command) error {
192238
cc := getAPICommandContext(ctx, cmd)
193239

@@ -450,3 +496,20 @@ func handleBuildsList(ctx context.Context, cmd *cli.Command) error {
450496
fmt.Printf("%s\n", colorizeJSON(res.RawJSON(), os.Stdout))
451497
return nil
452498
}
499+
500+
func handleBuildsCompare(ctx context.Context, cmd *cli.Command) error {
501+
cc := getAPICommandContext(ctx, cmd)
502+
503+
res, err := cc.client.Builds.Compare(
504+
context.TODO(),
505+
stainlessv0.BuildCompareParams{},
506+
option.WithMiddleware(cc.AsMiddleware()),
507+
option.WithRequestBody("application/json", cc.body),
508+
)
509+
if err != nil {
510+
return err
511+
}
512+
513+
fmt.Printf("%s\n", colorizeJSON(res.RawJSON(), os.Stdout))
514+
return nil
515+
}

go.mod

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2,20 +2,20 @@ module github.com/stainless-api/stainless-api-cli
22

33
go 1.23.0
44

5-
toolchain go1.23.8
5+
toolchain go1.23.9
66

77
require (
88
github.com/logrusorgru/aurora/v4 v4.0.0
99
github.com/pkg/browser v0.0.0-20240102092130-5ac0b6a4141c
10-
github.com/stainless-api/stainless-api-go v0.3.0
10+
github.com/stainless-api/stainless-api-go v0.4.0
1111
github.com/tidwall/gjson v1.17.0
1212
github.com/tidwall/pretty v1.2.1
1313
github.com/tidwall/sjson v1.2.5
1414
github.com/urfave/cli/v3 v3.3.2
15-
golang.org/x/term v0.31.0
15+
golang.org/x/term v0.32.0
1616
)
1717

1818
require (
1919
github.com/tidwall/match v1.1.1 // indirect
20-
golang.org/x/sys v0.32.0 // indirect
20+
golang.org/x/sys v0.33.0 // indirect
2121
)

0 commit comments

Comments
 (0)