Skip to content

Commit 23ff089

Browse files
initial commit
0 parents  commit 23ff089

188 files changed

Lines changed: 36470 additions & 0 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

.github/CODEOWNERS

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
# This file is used to automatically assign reviewers to PRs
2+
# For more information see: https://help.github.com/en/github/creating-cloning-and-archiving-repositories/about-code-owners
3+
4+
* @openai/sdks-team
Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
name: Setup Go
2+
description: 'Sets up Go environment with private modules'
3+
inputs:
4+
stainless-api-key:
5+
required: false
6+
description: the value of the STAINLESS_API_KEY secret
7+
runs:
8+
using: composite
9+
steps:
10+
- uses: stainless-api/retrieve-github-access-token@1f03f929b746c5b03dcdafa2bebbb18ca5672e1a # v1
11+
if: github.repository == 'stainless-sdks/openai-cli'
12+
id: get_token
13+
with:
14+
repo: stainless-sdks/openai-go
15+
stainless-api-key: ${{ inputs.stainless-api-key }}
16+
17+
- name: Configure Git for access to the Go SDK's staging repo
18+
if: github.repository == 'stainless-sdks/openai-cli'
19+
shell: bash
20+
run: git config --global url."https://x-access-token:${{ steps.get_token.outputs.github_access_token }}@github.com/stainless-sdks/openai-go".insteadOf "https://github.com/stainless-sdks/openai-go"
21+
22+
- name: Setup go
23+
uses: actions/setup-go@40f1582b2485089dde7abd97c1529aa768e1baff # v5
24+
with:
25+
go-version-file: ./go.mod
26+
27+
- name: Bootstrap
28+
shell: bash
29+
run: ./scripts/bootstrap

.github/workflows/ci.yml

Lines changed: 116 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,116 @@
1+
name: CI
2+
on:
3+
push:
4+
branches:
5+
- '**'
6+
- '!integrated/**'
7+
- '!stl-preview-head/**'
8+
- '!stl-preview-base/**'
9+
- '!generated'
10+
- '!codegen/**'
11+
- 'codegen/stl/**'
12+
pull_request:
13+
branches-ignore:
14+
- 'stl-preview-head/**'
15+
- 'stl-preview-base/**'
16+
17+
env:
18+
GOPRIVATE: github.com/openai/openai-go/v3,github.com/stainless-sdks/openai-go/v3
19+
20+
jobs:
21+
lint:
22+
timeout-minutes: 10
23+
name: lint
24+
runs-on: ${{ github.repository == 'stainless-sdks/openai-cli' && 'depot-ubuntu-24.04' || 'ubuntu-latest' }}
25+
if: (github.event_name == 'push' || github.event.pull_request.head.repo.fork) && (github.event_name != 'push' || github.event.head_commit.message != 'codegen metadata')
26+
27+
steps:
28+
- uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6
29+
30+
- uses: ./.github/actions/setup-go
31+
with:
32+
stainless-api-key: ${{ secrets.STAINLESS_API_KEY }}
33+
34+
- name: Link staging branch
35+
if: github.repository == 'stainless-sdks/openai-cli'
36+
run: |
37+
./scripts/link 'github.com/stainless-sdks/openai-go/v3@${{ github.ref_name }}' || true
38+
39+
- name: Bootstrap
40+
run: ./scripts/bootstrap
41+
42+
- name: Run lints
43+
run: ./scripts/lint
44+
45+
build:
46+
timeout-minutes: 10
47+
name: build
48+
permissions:
49+
contents: read
50+
id-token: write
51+
runs-on: ${{ github.repository == 'stainless-sdks/openai-cli' && 'depot-ubuntu-24.04' || 'ubuntu-latest' }}
52+
if: (github.event_name == 'push' || github.event.pull_request.head.repo.fork) && (github.event_name != 'push' || github.event.head_commit.message != 'codegen metadata')
53+
steps:
54+
- uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6
55+
56+
- uses: ./.github/actions/setup-go
57+
with:
58+
stainless-api-key: ${{ secrets.STAINLESS_API_KEY }}
59+
60+
- name: Link staging branch
61+
if: github.repository == 'stainless-sdks/openai-cli'
62+
run: |
63+
./scripts/link 'github.com/stainless-sdks/openai-go/v3@${{ github.ref_name }}' || true
64+
65+
- name: Bootstrap
66+
run: ./scripts/bootstrap
67+
68+
- name: Run goreleaser
69+
uses: goreleaser/goreleaser-action@9ed2f89a662bf1735a48bc8557fd212fa902bebf # v6.1.0
70+
with:
71+
version: latest
72+
args: release --snapshot --clean --skip=publish
73+
env:
74+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
75+
76+
- name: Get GitHub OIDC Token
77+
if: |-
78+
github.repository == 'stainless-sdks/openai-cli' &&
79+
!startsWith(github.ref, 'refs/heads/stl/')
80+
id: github-oidc
81+
uses: actions/github-script@ed597411d8f924073f98dfc5c65a23a2325f34cd # v8
82+
with:
83+
script: core.setOutput('github_token', await core.getIDToken());
84+
85+
- name: Upload tarball
86+
if: |-
87+
github.repository == 'stainless-sdks/openai-cli' &&
88+
!startsWith(github.ref, 'refs/heads/stl/')
89+
env:
90+
URL: https://pkg.stainless.com/s
91+
AUTH: ${{ steps.github-oidc.outputs.github_token }}
92+
SHA: ${{ github.sha }}
93+
run: ./scripts/utils/upload-artifact.sh
94+
95+
test:
96+
timeout-minutes: 10
97+
name: test
98+
runs-on: ${{ github.repository == 'stainless-sdks/openai-cli' && 'depot-ubuntu-24.04' || 'ubuntu-latest' }}
99+
if: github.event_name == 'push' || github.event.pull_request.head.repo.fork
100+
steps:
101+
- uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6
102+
103+
- uses: ./.github/actions/setup-go
104+
with:
105+
stainless-api-key: ${{ secrets.STAINLESS_API_KEY }}
106+
107+
- name: Link staging branch
108+
if: github.repository == 'stainless-sdks/openai-cli'
109+
run: |
110+
./scripts/link 'github.com/stainless-sdks/openai-go/v3@${{ github.ref_name }}' || true
111+
112+
- name: Bootstrap
113+
run: ./scripts/bootstrap
114+
115+
- name: Run tests
116+
run: ./scripts/test
Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
name: Create releases
2+
on:
3+
schedule:
4+
- cron: '0 5 * * *' # every day at 5am UTC
5+
push:
6+
branches:
7+
- main
8+
9+
jobs:
10+
release:
11+
name: release
12+
if: github.ref == 'refs/heads/main' && github.repository == 'openai/openai-cli'
13+
runs-on: ubuntu-latest
14+
environment: publish
15+
permissions:
16+
contents: write
17+
18+
steps:
19+
- uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6
20+
with:
21+
persist-credentials: false
22+
23+
- uses: stainless-api/trigger-release-please@bb6677c5a04578eec1ccfd9e1913b5b78ed64c61 # v1.4.0
24+
id: release
25+
with:
26+
repo: ${{ github.event.repository.full_name }}
27+
stainless-api-key: ${{ secrets.STAINLESS_API_KEY }}
Lines changed: 57 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,57 @@
1+
---
2+
name: Publish Release
3+
permissions:
4+
contents: read
5+
6+
concurrency:
7+
group: publish
8+
9+
on:
10+
push:
11+
tags:
12+
- "v*"
13+
workflow_dispatch: {}
14+
jobs:
15+
goreleaser:
16+
runs-on: ubuntu-latest
17+
environment: publish
18+
steps:
19+
- name: Checkout
20+
uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6
21+
with:
22+
fetch-depth: 0
23+
persist-credentials: false
24+
- name: Set up Go
25+
uses: actions/setup-go@40f1582b2485089dde7abd97c1529aa768e1baff # v5
26+
with:
27+
go-version-file: "go.mod"
28+
- name: Create release app token for this repo
29+
id: app-token
30+
uses: actions/create-github-app-token@1b10c78c7865c340bc4f6099eb2f838309f1e8c3 # v3.1.1
31+
with:
32+
app-id: ${{ secrets.RELEASE_APP_ID }}
33+
private-key: ${{ secrets.RELEASE_APP_PRIVATE_KEY }}
34+
permission-contents: write
35+
- name: Create release app token for homebrew-tools
36+
id: tap-token
37+
uses: actions/create-github-app-token@1b10c78c7865c340bc4f6099eb2f838309f1e8c3 # v3.1.1
38+
with:
39+
app-id: ${{ secrets.RELEASE_APP_ID }}
40+
private-key: ${{ secrets.RELEASE_APP_PRIVATE_KEY }}
41+
owner: openai
42+
repositories: homebrew-tools
43+
permission-contents: write
44+
permission-pull-requests: write
45+
- name: Run GoReleaser
46+
uses: goreleaser/goreleaser-action@9ed2f89a662bf1735a48bc8557fd212fa902bebf # v6.1.0
47+
with:
48+
version: latest
49+
args: release --clean
50+
env:
51+
GITHUB_TOKEN: ${{ steps.app-token.outputs.token }}
52+
HOMEBREW_TAP_GITHUB_TOKEN: ${{ steps.tap-token.outputs.token }}
53+
MACOS_SIGN_P12: ${{ secrets.MACOS_SIGN_P12 }}
54+
MACOS_SIGN_PASSWORD: ${{ secrets.MACOS_SIGN_PASSWORD }}
55+
MACOS_NOTARY_KEY: ${{ secrets.MACOS_NOTARY_KEY }}
56+
MACOS_NOTARY_KEY_ID: ${{ secrets.MACOS_NOTARY_KEY_ID }}
57+
MACOS_NOTARY_ISSUER_ID: ${{ secrets.MACOS_NOTARY_ISSUER_ID }}

.gitignore

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
.prism.log
2+
.stdy.log
3+
dist/
4+
/openai
5+
*.exe

.goreleaser.yml

Lines changed: 114 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,114 @@
1+
project_name: openai
2+
version: 2
3+
4+
before:
5+
hooks:
6+
- mkdir -p completions
7+
- sh -c "go run ./cmd/openai/main.go @completion bash > completions/openai.bash"
8+
- sh -c "go run ./cmd/openai/main.go @completion zsh > completions/openai.zsh"
9+
- sh -c "go run ./cmd/openai/main.go @completion fish > completions/openai.fish"
10+
- sh -c "go run ./cmd/openai/main.go @manpages -o man"
11+
12+
builds:
13+
- id: macos
14+
goos: [darwin]
15+
goarch: [amd64, arm64]
16+
binary: '{{ .ProjectName }}'
17+
main: ./cmd/openai/main.go
18+
mod_timestamp: '{{ .CommitTimestamp }}'
19+
ldflags:
20+
- '-s -w -X main.version={{.Version}} -X main.commit={{.Commit}}'
21+
22+
- id: linux
23+
goos: [linux]
24+
goarch: ['386', arm, amd64, arm64]
25+
env:
26+
- CGO_ENABLED=0
27+
binary: '{{ .ProjectName }}'
28+
main: ./cmd/openai/main.go
29+
mod_timestamp: '{{ .CommitTimestamp }}'
30+
ldflags:
31+
- '-s -w -X main.version={{.Version}} -X main.commit={{.Commit}}'
32+
33+
- id: windows
34+
goos: [windows]
35+
goarch: ['386', amd64, arm64]
36+
binary: '{{ .ProjectName }}'
37+
main: ./cmd/openai/main.go
38+
mod_timestamp: '{{ .CommitTimestamp }}'
39+
ldflags:
40+
- '-s -w -X main.version={{.Version}} -X main.commit={{.Commit}}'
41+
42+
archives:
43+
- id: linux-archive
44+
ids: [linux]
45+
name_template: '{{ .ProjectName }}_{{ .Version }}_linux_{{ .Arch }}{{ if .Arm }}v{{ .Arm }}{{ end }}'
46+
formats: [tar.gz]
47+
files:
48+
- completions/*
49+
- man/*/*
50+
- id: macos-archive
51+
ids: [macos]
52+
name_template: '{{ .ProjectName }}_{{ .Version }}_macos_{{ .Arch }}{{ if .Arm }}v{{ .Arm }}{{ end }}'
53+
formats: [zip]
54+
files:
55+
- completions/*
56+
- man/*/*
57+
- id: windows-archive
58+
ids: [windows]
59+
name_template: '{{ .ProjectName }}_{{ .Version }}_windows_{{ .Arch }}{{ if .Arm }}v{{ .Arm }}{{ end }}'
60+
formats: [zip]
61+
files:
62+
- completions/*
63+
- man/*/*
64+
65+
notarize:
66+
macos:
67+
- enabled: '{{ isEnvSet "MACOS_SIGN_P12" }}'
68+
ids: [macos]
69+
70+
sign:
71+
certificate: "{{.Env.MACOS_SIGN_P12}}"
72+
password: "{{.Env.MACOS_SIGN_PASSWORD}}"
73+
74+
notarize:
75+
issuer_id: "{{.Env.MACOS_NOTARY_ISSUER_ID}}"
76+
key_id: "{{.Env.MACOS_NOTARY_KEY_ID}}"
77+
key: "{{.Env.MACOS_NOTARY_KEY}}"
78+
79+
snapshot:
80+
version_template: '{{ .Tag }}-next'
81+
82+
nfpms:
83+
- license: Apache-2.0
84+
maintainer: support@openai.com
85+
bindir: /usr
86+
formats:
87+
- apk
88+
- deb
89+
- rpm
90+
- termux.deb
91+
- archlinux
92+
contents:
93+
- src: man/man1/*.1.gz
94+
dst: /usr/share/man/man1/
95+
homebrew_casks:
96+
- name: openai
97+
repository:
98+
owner: openai
99+
name: homebrew-tools
100+
token: "{{ .Env.HOMEBREW_TAP_GITHUB_TOKEN }}"
101+
branch: "openai-{{ .Version }}"
102+
pull_request:
103+
enabled: true
104+
homepage: https://developers.openai.com/api/docs
105+
description: The official CLI for the OpenAI API.
106+
license: Apache-2.0
107+
binaries:
108+
- "openai"
109+
completions:
110+
bash: "completions/openai.bash"
111+
zsh: "completions/openai.zsh"
112+
fish: "completions/openai.fish"
113+
manpages:
114+
- man/man1/openai.1.gz

.release-please-manifest.json

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
{
2+
".": "0.0.1"
3+
}

.stats.yml

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
configured_endpoints: 220
2+
openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/openai/openai-ea3c8bfb9cc34e798c5a473bb68ab5012344b1c99ab95377d0af4d908eb32a5d.yml
3+
openapi_spec_hash: dbab3fdd7781b449ba3e9e1b5180c6ed
4+
config_hash: 5d8a716125a61761563abbfc0d34e57c

CHANGELOG.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
# Changelog
2+
3+
## 0.0.1 (2026-05-01)
4+
5+
Initial release

0 commit comments

Comments
 (0)