Skip to content

Commit 46e1a2b

Browse files
stainless-app[bot]yjp20
authored andcommitted
feat(api): manual updates
1 parent 19cc4e9 commit 46e1a2b

Some content is hidden

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

56 files changed

+172
-134
lines changed

.github/workflows/publish-npm.yml

Lines changed: 41 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,41 @@
1+
# This workflow is triggered when a GitHub release is created.
2+
# It can also be run manually to re-publish to NPM in case it failed for some reason.
3+
# You can run this workflow by navigating to https://www.github.com/stainless-api/stainless-api-typescript/actions/workflows/publish-npm.yml
4+
name: Publish NPM
5+
on:
6+
workflow_dispatch:
7+
inputs:
8+
path:
9+
description: The path to run the release in, e.g. '.' or 'packages/mcp-server'
10+
required: true
11+
12+
release:
13+
types: [published]
14+
15+
jobs:
16+
publish:
17+
name: publish
18+
runs-on: ubuntu-latest
19+
20+
steps:
21+
- uses: actions/checkout@v4
22+
23+
- name: Set up Node
24+
uses: actions/setup-node@v3
25+
with:
26+
node-version: '20'
27+
28+
- name: Install dependencies
29+
run: |
30+
yarn install
31+
32+
- name: Publish to NPM
33+
run: |
34+
if [ -n "${{ github.event.inputs.path }}" ]; then
35+
PATHS_RELEASED='[\"${{ github.event.inputs.path }}\"]'
36+
else
37+
PATHS_RELEASED='[\".\", \"packages/mcp-server\"]'
38+
fi
39+
yarn tsn scripts/publish-packages.ts "{ \"paths_released\": \"$PATHS_RELEASED\" }"
40+
env:
41+
NPM_TOKEN: ${{ secrets.STAINLESS_NPM_TOKEN || secrets.NPM_TOKEN }}

.github/workflows/release-doctor.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,3 +18,4 @@ jobs:
1818
run: |
1919
bash ./bin/check-release-environment
2020
env:
21+
NPM_TOKEN: ${{ secrets.STAINLESS_NPM_TOKEN || secrets.NPM_TOKEN }}

.stats.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
11
configured_endpoints: 17
22
openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/stainless%2Fstainless-v0-0eed0c3c47bb630ed692f2de1c5228e3e1a29f52489851aecc0b9f9f3b5bce61.yml
33
openapi_spec_hash: c62aa08b1662b81b6ede9e298e4f1882
4-
config_hash: 8a921dfc8d183e865a02718de6783412
4+
config_hash: 2161cb69f5b32b6423d993cc6746ecce

CONTRIBUTING.md

Lines changed: 16 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -55,12 +55,12 @@ $ cd stainless-api-typescript
5555
# With yarn
5656
$ yarn link
5757
$ cd ../my-package
58-
$ yarn link stainless-v0
58+
$ yarn link @stainless-api/sdk
5959

6060
# With pnpm
6161
$ pnpm link --global
6262
$ cd ../my-package
63-
$ pnpm link -—global stainless-v0
63+
$ pnpm link -—global @stainless-api/sdk
6464
```
6565

6666
## Running tests
@@ -91,3 +91,17 @@ To format and fix all lint issues automatically:
9191
```sh
9292
$ yarn fix
9393
```
94+
95+
## Publishing and releases
96+
97+
Changes made to this repository via the automated release PR pipeline should publish to npm automatically. If
98+
the changes aren't made through the automated pipeline, you may want to make releases manually.
99+
100+
### Publish with a GitHub workflow
101+
102+
You can release to package managers by using [the `Publish NPM` GitHub action](https://www.github.com/stainless-api/stainless-api-typescript/actions/workflows/publish-npm.yml). This requires a setup organization or repository secret to be set up.
103+
104+
### Publish manually
105+
106+
If you need to manually release a package, you can run the `bin/publish-npm` script with an `NPM_TOKEN` set on
107+
the environment.

README.md

Lines changed: 11 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
# Stainless TypeScript API Library
22

3-
[![NPM version](<https://img.shields.io/npm/v/stainless-v0.svg?label=npm%20(stable)>)](https://npmjs.org/package/stainless-v0) ![npm bundle size](https://img.shields.io/bundlephobia/minzip/stainless-v0)
3+
[![NPM version](<https://img.shields.io/npm/v/@stainless-api/sdk.svg?label=npm%20(stable)>)](https://npmjs.org/package/@stainless-api/sdk) ![npm bundle size](https://img.shields.io/bundlephobia/minzip/@stainless-api/sdk)
44

55
This library provides convenient access to the Stainless REST API from server-side TypeScript or JavaScript.
66

@@ -11,19 +11,16 @@ It is generated with [Stainless](https://www.stainless.com/).
1111
## Installation
1212

1313
```sh
14-
npm install git+ssh://[email protected]:stainless-api/stainless-api-typescript.git
14+
npm install @stainless-api/sdk
1515
```
1616

17-
> [!NOTE]
18-
> Once this package is [published to npm](https://www.stainless.com/docs/guides/publish), this will become: `npm install stainless-v0`
19-
2017
## Usage
2118

2219
The full API of this library can be found in [api.md](api.md).
2320

2421
<!-- prettier-ignore -->
2522
```js
26-
import Stainless from 'stainless-v0';
23+
import Stainless from '@stainless-api/sdk';
2724

2825
const client = new Stainless({
2926
apiKey: process.env['STAINLESS_API_KEY'], // This is the default and can be omitted
@@ -40,7 +37,7 @@ This library includes TypeScript definitions for all request params and response
4037

4138
<!-- prettier-ignore -->
4239
```ts
43-
import Stainless from 'stainless-v0';
40+
import Stainless from '@stainless-api/sdk';
4441

4542
const client = new Stainless({
4643
apiKey: process.env['STAINLESS_API_KEY'], // This is the default and can be omitted
@@ -167,7 +164,7 @@ The log level can be configured in two ways:
167164
2. Using the `logLevel` client option (overrides the environment variable if set)
168165

169166
```ts
170-
import Stainless from 'stainless-v0';
167+
import Stainless from '@stainless-api/sdk';
171168

172169
const client = new Stainless({
173170
logLevel: 'debug', // Show all log messages
@@ -195,7 +192,7 @@ When providing a custom logger, the `logLevel` option still controls which messa
195192
below the configured level will not be sent to your logger.
196193

197194
```ts
198-
import Stainless from 'stainless-v0';
195+
import Stainless from '@stainless-api/sdk';
199196
import pino from 'pino';
200197

201198
const logger = pino();
@@ -264,7 +261,7 @@ globalThis.fetch = fetch;
264261
Or pass it to the client:
265262

266263
```ts
267-
import Stainless from 'stainless-v0';
264+
import Stainless from '@stainless-api/sdk';
268265
import fetch from 'my-fetch';
269266

270267
const client = new Stainless({ fetch });
@@ -275,7 +272,7 @@ const client = new Stainless({ fetch });
275272
If you want to set custom `fetch` options without overriding the `fetch` function, you can provide a `fetchOptions` object when instantiating the client or making a request. (Request-specific options override client options.)
276273

277274
```ts
278-
import Stainless from 'stainless-v0';
275+
import Stainless from '@stainless-api/sdk';
279276

280277
const client = new Stainless({
281278
fetchOptions: {
@@ -292,7 +289,7 @@ options to requests:
292289
<img src="https://raw.githubusercontent.com/stainless-api/sdk-assets/refs/heads/main/node.svg" align="top" width="18" height="21"> **Node** <sup>[[docs](https://github.com/nodejs/undici/blob/main/docs/docs/api/ProxyAgent.md#example---proxyagent-with-fetch)]</sup>
293290

294291
```ts
295-
import Stainless from 'stainless-v0';
292+
import Stainless from '@stainless-api/sdk';
296293
import * as undici from 'undici';
297294

298295
const proxyAgent = new undici.ProxyAgent('http://localhost:8888');
@@ -306,7 +303,7 @@ const client = new Stainless({
306303
<img src="https://raw.githubusercontent.com/stainless-api/sdk-assets/refs/heads/main/bun.svg" align="top" width="18" height="21"> **Bun** <sup>[[docs](https://bun.sh/guides/http/proxy)]</sup>
307304

308305
```ts
309-
import Stainless from 'stainless-v0';
306+
import Stainless from '@stainless-api/sdk';
310307

311308
const client = new Stainless({
312309
fetchOptions: {
@@ -318,7 +315,7 @@ const client = new Stainless({
318315
<img src="https://raw.githubusercontent.com/stainless-api/sdk-assets/refs/heads/main/deno.svg" align="top" width="18" height="21"> **Deno** <sup>[[docs](https://docs.deno.com/api/deno/~/Deno.createHttpClient)]</sup>
319316

320317
```ts
321-
import Stainless from 'npm:stainless-v0';
318+
import Stainless from 'npm:@stainless-api/sdk';
322319

323320
const httpClient = Deno.createHttpClient({ proxy: { url: 'http://localhost:8888' } });
324321
const client = new Stainless({

bin/check-release-environment

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,10 @@
22

33
errors=()
44

5+
if [ -z "${NPM_TOKEN}" ]; then
6+
errors+=("The STAINLESS_NPM_TOKEN secret has not been set. Please set it in either this repository's secrets or your organization secrets")
7+
fi
8+
59
lenErrors=${#errors[@]}
610

711
if [[ lenErrors -gt 0 ]]; then

eslint.config.mjs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ export default tseslint.config(
2525
{
2626
patterns: [
2727
{
28-
regex: '^stainless-v0(/.*)?',
28+
regex: '^@stainless-api/sdk(/.*)?',
2929
message: 'Use a relative import, not a package import.',
3030
},
3131
],

jest.config.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,8 +7,8 @@ const config: JestConfigWithTsJest = {
77
'^.+\\.(t|j)sx?$': ['@swc/jest', { sourceMaps: 'inline' }],
88
},
99
moduleNameMapper: {
10-
'^stainless-v0$': '<rootDir>/src/index.ts',
11-
'^stainless-v0/(.*)$': '<rootDir>/src/$1',
10+
'^@stainless-api/sdk$': '<rootDir>/src/index.ts',
11+
'^@stainless-api/sdk/(.*)$': '<rootDir>/src/$1',
1212
},
1313
modulePathIgnorePatterns: [
1414
'<rootDir>/ecosystem-tests/',

package.json

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
{
2-
"name": "stainless-v0",
2+
"name": "@stainless-api/sdk",
33
"version": "0.1.0-alpha.5",
44
"description": "The official TypeScript library for the Stainless API",
55
"author": "Stainless <>",
@@ -47,8 +47,8 @@
4747
"typescript": "5.8.3"
4848
},
4949
"imports": {
50-
"stainless-v0": ".",
51-
"stainless-v0/*": "./src/*"
50+
"@stainless-api/sdk": ".",
51+
"@stainless-api/sdk/*": "./src/*"
5252
},
5353
"exports": {
5454
".": {

packages/mcp-server/README.md

Lines changed: 8 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -4,33 +4,18 @@ It is generated with [Stainless](https://www.stainless.com/).
44

55
## Installation
66

7-
### Building
7+
### Direct invocation
88

9-
Because it's not published yet, clone the repo and build it:
9+
You can run the MCP Server directly via `npx`:
1010

1111
```sh
12-
git clone [email protected]:stainless-api/stainless-api-typescript.git
13-
cd stainless-api-typescript
14-
./scripts/bootstrap
15-
./scripts/build
16-
```
17-
18-
### Running
19-
20-
```sh
21-
# set env vars as needed
2212
export STAINLESS_API_KEY="My API Key"
2313
export STAINLESS_PROJECT="example-project"
24-
node ./packages/mcp-server/dist/index.js
14+
npx -y @stainless-api/mcp@latest
2515
```
2616

27-
> [!NOTE]
28-
> Once this package is [published to npm](https://www.stainless.com/docs/guides/publish), this will become: `npx -y stainless-v0-mcp`
29-
3017
### Via MCP Client
3118

32-
[Build the project](#building) as mentioned above.
33-
3419
There is a partial list of existing clients at [modelcontextprotocol.io](https://modelcontextprotocol.io/clients). If you already
3520
have a client, consult their documentation to install the MCP server.
3621

@@ -39,13 +24,9 @@ For clients with a configuration JSON, it might look something like this:
3924
```json
4025
{
4126
"mcpServers": {
42-
"stainless_v0_api": {
43-
"command": "node",
44-
"args": [
45-
"/path/to/local/stainless-api-typescript/packages/mcp-server",
46-
"--client=claude",
47-
"--tools=all"
48-
],
27+
"stainless_api_sdk_api": {
28+
"command": "npx",
29+
"args": ["-y", "@stainless-api/mcp", "--client=claude", "--tools=all"],
4930
"env": {
5031
"STAINLESS_API_KEY": "My API Key",
5132
"STAINLESS_PROJECT": "example-project"
@@ -151,10 +132,10 @@ over time, you can manually enable or disable certain capabilities:
151132

152133
```js
153134
// Import the server, generated endpoints, or the init function
154-
import { server, endpoints, init } from "stainless-v0-mcp/server";
135+
import { server, endpoints, init } from "@stainless-api/mcp/server";
155136

156137
// import a specific tool
157-
import createProjects from "stainless-v0-mcp/tools/projects/create-projects";
138+
import createProjects from "@stainless-api/mcp/tools/projects/create-projects";
158139

159140
// initialize the server and all endpoints
160141
init({ server, endpoints });

0 commit comments

Comments
 (0)