Skip to content

Commit dcc6b2c

Browse files
committed
chore: import Speakeasy AI Control Plane CLI
1 parent fdf4fea commit dcc6b2c

349 files changed

Lines changed: 40933 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.

.changeset/README.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
# Changesets
2+
3+
Changesets drive npm package publishing and CLI release tagging.
4+
5+
Run `pnpm changeset` when a change should publish a new package version.

.changeset/config.json

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
{
2+
"$schema": "https://unpkg.com/@changesets/config@3.1.1/schema.json",
3+
"changelog": "@changesets/cli/changelog",
4+
"commit": [
5+
"@changesets/cli/commit",
6+
{
7+
"skipCI": false
8+
}
9+
],
10+
"fixed": [["@speakeasy-api/functions", "@speakeasy-api/create-function"]],
11+
"linked": [],
12+
"access": "public",
13+
"baseBranch": "origin/main",
14+
"updateInternalDependencies": "patch",
15+
"privatePackages": {
16+
"version": true,
17+
"tag": true
18+
}
19+
}

.github/filters.yaml

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
cli:
2+
- "go/cli/**"
3+
- "go/sdk/**"
4+
- "install-cli.ps1"
5+
- "install-cli.sh"
6+
7+
tsframework:
8+
- "package.json"
9+
- "pnpm-lock.yaml"
10+
- "pnpm-workspace.yaml"
11+
- "ts/**"
12+

.github/workflows/pr.yaml

Lines changed: 112 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,112 @@
1+
name: Pull Request
2+
3+
on:
4+
pull_request:
5+
branches:
6+
- main
7+
types: [opened, synchronize, reopened]
8+
push:
9+
branches:
10+
- main
11+
merge_group:
12+
13+
permissions:
14+
contents: read
15+
16+
jobs:
17+
changes:
18+
name: Tag branch changes
19+
runs-on: ubuntu-latest
20+
permissions:
21+
contents: read
22+
pull-requests: read
23+
outputs:
24+
cli: ${{ steps.gates.outputs.cli }}
25+
tsframework: ${{ steps.gates.outputs.tsframework }}
26+
steps:
27+
- name: Checkout
28+
uses: actions/checkout@ff7abcd0c3c05ccf6adc123a8cd1fd4fb30fb493 # v5.0.0
29+
30+
- name: Check for changed packages
31+
id: filter
32+
uses: dorny/paths-filter@fbd0ab8f3e69293af611ebaee6363fc25e6d187d # v4.0.1
33+
with:
34+
filters: .github/filters.yaml
35+
36+
- id: gates
37+
name: Set outputs
38+
run: |
39+
if [[ "${{ steps.filter.outputs.cli }}" == "true" || "${{ github.ref }}" == "refs/heads/main" || "${{ github.event_name }}" == "merge_group" ]]; then
40+
echo "cli=true" >> "$GITHUB_OUTPUT"
41+
else
42+
echo "cli=false" >> "$GITHUB_OUTPUT"
43+
fi
44+
45+
if [[ "${{ steps.filter.outputs.tsframework }}" == "true" || "${{ github.ref }}" == "refs/heads/main" || "${{ github.event_name }}" == "merge_group" ]]; then
46+
echo "tsframework=true" >> "$GITHUB_OUTPUT"
47+
else
48+
echo "tsframework=false" >> "$GITHUB_OUTPUT"
49+
fi
50+
51+
cli-build-lint:
52+
runs-on: ubuntu-latest
53+
needs: changes
54+
if: needs.changes.outputs.cli == 'true'
55+
steps:
56+
- name: Checkout
57+
uses: actions/checkout@ff7abcd0c3c05ccf6adc123a8cd1fd4fb30fb493 # v5.0.0
58+
59+
- name: Setup Go
60+
uses: actions/setup-go@4a3601121dd01d1626a1e23e37211e3254c1c06c # v6.4.0
61+
with:
62+
go-version-file: go/cli/go.mod
63+
cache-dependency-path: |
64+
go/cli/go.sum
65+
go/sdk/go.sum
66+
67+
- name: Build CLI
68+
run: go build ./...
69+
working-directory: go/cli
70+
71+
- name: Test CLI
72+
run: go test ./...
73+
working-directory: go/cli
74+
75+
- name: Lint CLI
76+
uses: golangci/golangci-lint-action@1e7e51e771db61008b38414a730f564565cf7c20 # v9.2.0
77+
with:
78+
install-mode: binary
79+
working-directory: go/cli
80+
81+
ts-framework-test:
82+
runs-on: ubuntu-latest
83+
needs: changes
84+
if: needs.changes.outputs.tsframework == 'true'
85+
steps:
86+
- name: Checkout
87+
uses: actions/checkout@ff7abcd0c3c05ccf6adc123a8cd1fd4fb30fb493 # v5.0.0
88+
89+
- name: Setup PNPM
90+
uses: pnpm/action-setup@7088e561eb65bb68695d245aa206f005ef30921d # v4.1.0
91+
with:
92+
run_install: false
93+
94+
- name: Setup Node
95+
uses: actions/setup-node@49933ea5288caeca8642d1e84afbd3f7d6820020 # v4.4.0
96+
with:
97+
node-version: 24
98+
cache: pnpm
99+
100+
- name: Install dependencies
101+
run: pnpm install --frozen-lockfile
102+
103+
- name: Test TypeScript framework
104+
run: pnpm test
105+
106+
- name: Build TypeScript framework
107+
run: pnpm build
108+
109+
- name: Prune PNPM store
110+
if: success()
111+
run: pnpm store prune
112+

.github/workflows/release.yaml

Lines changed: 112 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,112 @@
1+
name: Release
2+
3+
on:
4+
push:
5+
branches:
6+
- main
7+
8+
concurrency: ${{ github.workflow }}-${{ github.ref }}
9+
10+
jobs:
11+
release:
12+
name: Release
13+
runs-on: ubuntu-latest
14+
permissions:
15+
contents: write
16+
pull-requests: read
17+
issues: read
18+
id-token: write
19+
outputs:
20+
published: ${{ steps.changesets.outputs.published }}
21+
publishedPackages: ${{ steps.changesets.outputs.publishedPackages }}
22+
steps:
23+
- name: Checkout Repo
24+
uses: actions/checkout@ff7abcd0c3c05ccf6adc123a8cd1fd4fb30fb493 # v5.0.0
25+
26+
- name: Setup PNPM
27+
uses: pnpm/action-setup@7088e561eb65bb68695d245aa206f005ef30921d # v4.1.0
28+
with:
29+
run_install: false
30+
31+
- name: Setup Node
32+
uses: actions/setup-node@49933ea5288caeca8642d1e84afbd3f7d6820020 # v4.4.0
33+
with:
34+
node-version: 24
35+
cache: pnpm
36+
37+
- name: Install dependencies
38+
run: pnpm install --frozen-lockfile
39+
40+
- name: Generate a token
41+
id: generate-token
42+
uses: actions/create-github-app-token@1b10c78c7865c340bc4f6099eb2f838309f1e8c3 # v3.1.1
43+
with:
44+
app-id: ${{ vars.GRAM_BOT_APP_ID }}
45+
private-key: ${{ secrets.GRAM_BOT_PRIVATE_KEY }}
46+
47+
- name: Configure git for GitHub App
48+
run: |
49+
git config user.name "speakeasy-bot[bot]"
50+
git config user.email "speakeasy-bot[bot]@users.noreply.github.com"
51+
52+
- name: Create Release Pull Request or Publish to npm
53+
id: changesets
54+
uses: changesets/action@6a0a831ff30acef54f2c6aa1cbbc1096b066edaf # v1.7.0
55+
with:
56+
title: "chore: version packages"
57+
publish: pnpm changeset publish
58+
setupGitUser: false
59+
env:
60+
GITHUB_TOKEN: ${{ steps.generate-token.outputs.token }}
61+
62+
- name: Prune PNPM store
63+
run: pnpm store prune
64+
65+
release-cli:
66+
needs: [release]
67+
if: needs.release.outputs.published == 'true' && contains(fromJSON(needs.release.outputs.publishedPackages).*.name, 'cli')
68+
name: Release Speakeasy CLI
69+
runs-on: ubuntu-latest
70+
permissions:
71+
contents: write
72+
id-token: write
73+
steps:
74+
- name: Checkout repository
75+
uses: actions/checkout@ff7abcd0c3c05ccf6adc123a8cd1fd4fb30fb493 # v5.0.0
76+
with:
77+
fetch-depth: 0
78+
79+
- name: Setup Go
80+
uses: actions/setup-go@4a3601121dd01d1626a1e23e37211e3254c1c06c # v6.4.0
81+
with:
82+
go-version-file: go/cli/go.mod
83+
cache: false
84+
85+
- name: Install cosign
86+
uses: sigstore/cosign-installer@cad07c2e89fa2edd6e2d7bab4c1aa38e53f76003 # v4.1.1
87+
88+
- name: Generate GitHub App Token for Speakeasy Bot
89+
id: bot-token
90+
uses: actions/create-github-app-token@1b10c78c7865c340bc4f6099eb2f838309f1e8c3 # v3.1.1
91+
with:
92+
app-id: ${{ secrets.GRAM_BOT_APP_ID }}
93+
private-key: ${{ secrets.GRAM_BOT_PRIVATE_KEY }}
94+
owner: speakeasy-api
95+
repositories: gf,homebrew-tap
96+
97+
- name: Create release tag
98+
run: |
99+
version=$(jq -r .version go/cli/package.json)
100+
tag="cli@$version"
101+
git tag -f "$tag"
102+
echo "Created local tag $tag"
103+
104+
- name: GoReleaser
105+
uses: goreleaser/goreleaser-action@1a80836c5c9d9e5755a25cb59ec6f45a3b5f41a8 # v7.2.1
106+
with:
107+
distribution: goreleaser-pro
108+
version: "~> v2.14"
109+
args: release --clean
110+
env:
111+
GITHUB_TOKEN: ${{ steps.bot-token.outputs.token }}
112+
GORELEASER_KEY: ${{ secrets.GORELEASER_PRO_LICENSE_KEY }}

.gitignore

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
.DS_Store
2+
3+
# Go
4+
bin/
5+
coverage.out
6+
7+
# TypeScript
8+
node_modules/
9+
dist/
10+
*.tsbuildinfo
11+

.goreleaser.yaml

Lines changed: 68 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,68 @@
1+
# yaml-language-server: $schema=https://raw.githubusercontent.com/goreleaser/goreleaser/v2.12.5/www/docs/static/schema-pro.json
2+
3+
version: 2
4+
5+
project_name: speakeasy
6+
7+
builds:
8+
- dir: ./go/cli
9+
env:
10+
- CGO_ENABLED=0
11+
goos:
12+
- linux
13+
- windows
14+
- darwin
15+
flags:
16+
- -trimpath
17+
ldflags:
18+
- "-s -w -X github.com/speakeasy-api/cli/go/cli/internal/app.GitSHA={{.Commit}} -X github.com/speakeasy-api/cli/go/cli/internal/app.Version={{.Version}}"
19+
20+
archives:
21+
- name_template: "{{ .ProjectName }}_{{ .Os }}_{{ .Arch }}{{ if .Arm }}v{{ .Arm }}{{ end }}"
22+
format: zip
23+
24+
checksum:
25+
name_template: "checksums.txt"
26+
27+
signs:
28+
- cmd: cosign
29+
signature: "${artifact}.sigstore.json"
30+
artifacts: checksum
31+
args:
32+
- sign-blob
33+
- "--bundle=${signature}"
34+
- "${artifact}"
35+
- --yes
36+
37+
snapshot:
38+
version_template: "{{ incpatch .Version }}-next"
39+
40+
changelog:
41+
disable: true
42+
43+
release:
44+
mode: keep-existing
45+
46+
monorepo:
47+
tag_prefix: "cli@"
48+
49+
brews:
50+
- name: speakeasy
51+
repository:
52+
owner: speakeasy-api
53+
name: homebrew-tap
54+
homepage: https://app.speakeasy.com
55+
description: The Speakeasy CLI for interacting with the Speakeasy AI Control Plane
56+
license: Apache-2.0
57+
test: |
58+
system "#{bin}/speakeasy --version"
59+
60+
- name: speakeasy@{{ .Major }}.{{ .Minor }}.{{ .Patch }}
61+
repository:
62+
owner: speakeasy-api
63+
name: homebrew-tap
64+
homepage: https://app.speakeasy.com
65+
description: The Speakeasy CLI for interacting with the Speakeasy AI Control Plane
66+
license: Apache-2.0
67+
test: |
68+
system "#{bin}/speakeasy --version"

0 commit comments

Comments
 (0)