diff --git a/.github/workflows/publish-npm.yml b/.github/workflows/publish-npm.yml
new file mode 100644
index 0000000..45c2cfd
--- /dev/null
+++ b/.github/workflows/publish-npm.yml
@@ -0,0 +1,32 @@
+# This workflow is triggered when a GitHub release is created.
+# It can also be run manually to re-publish to NPM in case it failed for some reason.
+# You can run this workflow by navigating to https://www.github.com/onkernel/kernel-node-sdk/actions/workflows/publish-npm.yml
+name: Publish NPM
+on:
+ workflow_dispatch:
+
+ release:
+ types: [published]
+
+jobs:
+ publish:
+ name: publish
+ runs-on: ubuntu-latest
+
+ steps:
+ - uses: actions/checkout@v4
+
+ - name: Set up Node
+ uses: actions/setup-node@v3
+ with:
+ node-version: '20'
+
+ - name: Install dependencies
+ run: |
+ yarn install
+
+ - name: Publish to NPM
+ run: |
+ bash ./bin/publish-npm
+ env:
+ NPM_TOKEN: ${{ secrets.KERNEL_NPM_TOKEN || secrets.NPM_TOKEN }}
diff --git a/.github/workflows/release-doctor.yml b/.github/workflows/release-doctor.yml
new file mode 100644
index 0000000..56150c7
--- /dev/null
+++ b/.github/workflows/release-doctor.yml
@@ -0,0 +1,21 @@
+name: Release Doctor
+on:
+ pull_request:
+ branches:
+ - main
+ workflow_dispatch:
+
+jobs:
+ release_doctor:
+ name: release doctor
+ runs-on: ubuntu-latest
+ if: github.repository == 'onkernel/kernel-node-sdk' && (github.event_name == 'push' || github.event_name == 'workflow_dispatch' || startsWith(github.head_ref, 'release-please') || github.head_ref == 'next')
+
+ steps:
+ - uses: actions/checkout@v4
+
+ - name: Check release environment
+ run: |
+ bash ./bin/check-release-environment
+ env:
+ NPM_TOKEN: ${{ secrets.KERNEL_NPM_TOKEN || secrets.NPM_TOKEN }}
diff --git a/.release-please-manifest.json b/.release-please-manifest.json
new file mode 100644
index 0000000..d7a8735
--- /dev/null
+++ b/.release-please-manifest.json
@@ -0,0 +1,3 @@
+{
+ ".": "0.1.0-alpha.1"
+}
diff --git a/.stats.yml b/.stats.yml
index b59ce7c..b66a1bc 100644
--- a/.stats.yml
+++ b/.stats.yml
@@ -1,4 +1,4 @@
configured_endpoints: 4
-openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/kernel%2Fkernel-2a9a9232d72f52fc9b2404958857a1b744762356421cf1bffb99db2c24045378.yml
-openapi_spec_hash: ba3c6823319d99762e7e1c6a624bc2ed
-config_hash: e48b09ec26046e2b2ba98ad41ecbaf1c
+openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/kernel%2Fkernel-e642528081bcfbb78b52900cb9b8b1407a9c7a8653c57ab021a79d4d52585695.yml
+openapi_spec_hash: 8d91d1ac100906977531a93b9f4ae380
+config_hash: 49c38455e0bcb05feb11399f9da1fb4f
diff --git a/CHANGELOG.md b/CHANGELOG.md
new file mode 100644
index 0000000..71fc9fc
--- /dev/null
+++ b/CHANGELOG.md
@@ -0,0 +1,16 @@
+# Changelog
+
+## 0.1.0-alpha.1 (2025-05-08)
+
+Full Changelog: [v0.0.1-alpha.0...v0.1.0-alpha.1](https://github.com/onkernel/kernel-node-sdk/compare/v0.0.1-alpha.0...v0.1.0-alpha.1)
+
+### Features
+
+* **api:** update via SDK Studio ([68f457e](https://github.com/onkernel/kernel-node-sdk/commit/68f457eb0f66b5b243e682677b0fa34eee685853))
+
+
+### Chores
+
+* configure new SDK language ([bc19eee](https://github.com/onkernel/kernel-node-sdk/commit/bc19eeeb0eea066f8ad69fd1f03038f839108a31))
+* update SDK settings ([c9c482c](https://github.com/onkernel/kernel-node-sdk/commit/c9c482c8ae564005abe75f46300cebea44c26f8f))
+* update SDK settings ([25c177f](https://github.com/onkernel/kernel-node-sdk/commit/25c177ff56b479a6389c79a72d696b4b0bef8f69))
diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md
index d10d10f..679eb77 100644
--- a/CONTRIBUTING.md
+++ b/CONTRIBUTING.md
@@ -42,25 +42,25 @@ If you’d like to use the repository from source, you can either install from g
To install via git:
```sh
-$ npm install git+ssh://git@github.com:stainless-sdks/kernel-typescript.git
+$ npm install git+ssh://git@github.com:onkernel/kernel-node-sdk.git
```
Alternatively, to link a local copy of the repo:
```sh
# Clone
-$ git clone https://www.github.com/stainless-sdks/kernel-typescript
-$ cd kernel-typescript
+$ git clone https://www.github.com/onkernel/kernel-node-sdk
+$ cd kernel-node-sdk
# With yarn
$ yarn link
$ cd ../my-package
-$ yarn link kernel
+$ yarn link @onkernel/sdk
# With pnpm
$ pnpm link --global
$ cd ../my-package
-$ pnpm link -—global kernel
+$ pnpm link -—global @onkernel/sdk
```
## Running tests
@@ -91,3 +91,17 @@ To format and fix all lint issues automatically:
```sh
$ yarn fix
```
+
+## Publishing and releases
+
+Changes made to this repository via the automated release PR pipeline should publish to npm automatically. If
+the changes aren't made through the automated pipeline, you may want to make releases manually.
+
+### Publish with a GitHub workflow
+
+You can release to package managers by using [the `Publish NPM` GitHub action](https://www.github.com/onkernel/kernel-node-sdk/actions/workflows/publish-npm.yml). This requires a setup organization or repository secret to be set up.
+
+### Publish manually
+
+If you need to manually release a package, you can run the `bin/publish-npm` script with an `NPM_TOKEN` set on
+the environment.
diff --git a/README.md b/README.md
index 475e268..9c77768 100644
--- a/README.md
+++ b/README.md
@@ -1,6 +1,6 @@
# Kernel TypeScript API Library
-[](https://npmjs.org/package/kernel) 
+[](https://npmjs.org/package/@onkernel/sdk) 
This library provides convenient access to the Kernel REST API from server-side TypeScript or JavaScript.
@@ -11,19 +11,16 @@ It is generated with [Stainless](https://www.stainless.com/).
## Installation
```sh
-npm install git+ssh://git@github.com:stainless-sdks/kernel-typescript.git
+npm install @onkernel/sdk
```
-> [!NOTE]
-> Once this package is [published to npm](https://app.stainless.com/docs/guides/publish), this will become: `npm install kernel`
-
## Usage
The full API of this library can be found in [api.md](api.md).
```js
-import Kernel from 'kernel';
+import Kernel from '@onkernel/sdk';
const client = new Kernel({
apiKey: process.env['KERNEL_API_KEY'], // This is the default and can be omitted
@@ -48,7 +45,7 @@ This library includes TypeScript definitions for all request params and response
```ts
-import Kernel from 'kernel';
+import Kernel from '@onkernel/sdk';
const client = new Kernel({
apiKey: process.env['KERNEL_API_KEY'], // This is the default and can be omitted
@@ -79,7 +76,7 @@ Request parameters that correspond to file uploads can be passed in many differe
```ts
import fs from 'fs';
-import Kernel, { toFile } from 'kernel';
+import Kernel, { toFile } from '@onkernel/sdk';
const client = new Kernel();
@@ -238,7 +235,7 @@ The log level can be configured in two ways:
2. Using the `logLevel` client option (overrides the environment variable if set)
```ts
-import Kernel from 'kernel';
+import Kernel from '@onkernel/sdk';
const client = new Kernel({
logLevel: 'debug', // Show all log messages
@@ -266,7 +263,7 @@ When providing a custom logger, the `logLevel` option still controls which messa
below the configured level will not be sent to your logger.
```ts
-import Kernel from 'kernel';
+import Kernel from '@onkernel/sdk';
import pino from 'pino';
const logger = pino();
@@ -336,7 +333,7 @@ globalThis.fetch = fetch;
Or pass it to the client:
```ts
-import Kernel from 'kernel';
+import Kernel from '@onkernel/sdk';
import fetch from 'my-fetch';
const client = new Kernel({ fetch });
@@ -347,7 +344,7 @@ const client = new Kernel({ fetch });
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.)
```ts
-import Kernel from 'kernel';
+import Kernel from '@onkernel/sdk';
const client = new Kernel({
fetchOptions: {
@@ -364,7 +361,7 @@ options to requests:
**Node** [[docs](https://github.com/nodejs/undici/blob/main/docs/docs/api/ProxyAgent.md#example---proxyagent-with-fetch)]
```ts
-import Kernel from 'kernel';
+import Kernel from '@onkernel/sdk';
import * as undici from 'undici';
const proxyAgent = new undici.ProxyAgent('http://localhost:8888');
@@ -378,7 +375,7 @@ const client = new Kernel({
**Bun** [[docs](https://bun.sh/guides/http/proxy)]
```ts
-import Kernel from 'kernel';
+import Kernel from '@onkernel/sdk';
const client = new Kernel({
fetchOptions: {
@@ -390,7 +387,7 @@ const client = new Kernel({
**Deno** [[docs](https://docs.deno.com/api/deno/~/Deno.createHttpClient)]
```ts
-import Kernel from 'npm:kernel';
+import Kernel from 'npm:@onkernel/sdk';
const httpClient = Deno.createHttpClient({ proxy: { url: 'http://localhost:8888' } });
const client = new Kernel({
@@ -412,7 +409,7 @@ This package generally follows [SemVer](https://semver.org/spec/v2.0.0.html) con
We take backwards-compatibility seriously and work hard to ensure you can rely on a smooth upgrade experience.
-We are keen for your feedback; please open an [issue](https://www.github.com/stainless-sdks/kernel-typescript/issues) with questions, bugs, or suggestions.
+We are keen for your feedback; please open an [issue](https://www.github.com/onkernel/kernel-node-sdk/issues) with questions, bugs, or suggestions.
## Requirements
diff --git a/bin/check-release-environment b/bin/check-release-environment
new file mode 100644
index 0000000..530e853
--- /dev/null
+++ b/bin/check-release-environment
@@ -0,0 +1,22 @@
+#!/usr/bin/env bash
+
+errors=()
+
+if [ -z "${NPM_TOKEN}" ]; then
+ errors+=("The KERNEL_NPM_TOKEN secret has not been set. Please set it in either this repository's secrets or your organization secrets")
+fi
+
+lenErrors=${#errors[@]}
+
+if [[ lenErrors -gt 0 ]]; then
+ echo -e "Found the following errors in the release environment:\n"
+
+ for error in "${errors[@]}"; do
+ echo -e "- $error\n"
+ done
+
+ exit 1
+fi
+
+echo "The environment is ready to push releases!"
+
diff --git a/eslint.config.mjs b/eslint.config.mjs
index 0064bc5..4d61d87 100644
--- a/eslint.config.mjs
+++ b/eslint.config.mjs
@@ -25,7 +25,7 @@ export default tseslint.config(
{
patterns: [
{
- regex: '^kernel(/.*)?',
+ regex: '^@onkernel/sdk(/.*)?',
message: 'Use a relative import, not a package import.',
},
],
diff --git a/jest.config.ts b/jest.config.ts
index 5c1b4bd..a3ef35c 100644
--- a/jest.config.ts
+++ b/jest.config.ts
@@ -7,8 +7,8 @@ const config: JestConfigWithTsJest = {
'^.+\\.(t|j)sx?$': ['@swc/jest', { sourceMaps: 'inline' }],
},
moduleNameMapper: {
- '^kernel$': '/src/index.ts',
- '^kernel/(.*)$': '/src/$1',
+ '^@onkernel/sdk$': '/src/index.ts',
+ '^@onkernel/sdk/(.*)$': '/src/$1',
},
modulePathIgnorePatterns: [
'/ecosystem-tests/',
diff --git a/package.json b/package.json
index 5164065..054352c 100644
--- a/package.json
+++ b/package.json
@@ -1,12 +1,12 @@
{
- "name": "kernel",
- "version": "0.0.1-alpha.0",
+ "name": "@onkernel/sdk",
+ "version": "0.1.0-alpha.1",
"description": "The official TypeScript library for the Kernel API",
"author": "Kernel <>",
"types": "dist/index.d.ts",
"main": "dist/index.js",
"type": "commonjs",
- "repository": "github:stainless-sdks/kernel-typescript",
+ "repository": "github:onkernel/kernel-node-sdk",
"license": "Apache-2.0",
"packageManager": "yarn@1.22.22",
"files": [
@@ -50,8 +50,8 @@
"synckit": "0.8.8"
},
"imports": {
- "kernel": ".",
- "kernel/*": "./src/*"
+ "@onkernel/sdk": ".",
+ "@onkernel/sdk/*": "./src/*"
},
"exports": {
".": {
diff --git a/release-please-config.json b/release-please-config.json
new file mode 100644
index 0000000..1ebd0bd
--- /dev/null
+++ b/release-please-config.json
@@ -0,0 +1,64 @@
+{
+ "packages": {
+ ".": {}
+ },
+ "$schema": "https://raw.githubusercontent.com/stainless-api/release-please/main/schemas/config.json",
+ "include-v-in-tag": true,
+ "include-component-in-tag": false,
+ "versioning": "prerelease",
+ "prerelease": true,
+ "bump-minor-pre-major": true,
+ "bump-patch-for-minor-pre-major": false,
+ "pull-request-header": "Automated Release PR",
+ "pull-request-title-pattern": "release: ${version}",
+ "changelog-sections": [
+ {
+ "type": "feat",
+ "section": "Features"
+ },
+ {
+ "type": "fix",
+ "section": "Bug Fixes"
+ },
+ {
+ "type": "perf",
+ "section": "Performance Improvements"
+ },
+ {
+ "type": "revert",
+ "section": "Reverts"
+ },
+ {
+ "type": "chore",
+ "section": "Chores"
+ },
+ {
+ "type": "docs",
+ "section": "Documentation"
+ },
+ {
+ "type": "style",
+ "section": "Styles"
+ },
+ {
+ "type": "refactor",
+ "section": "Refactors"
+ },
+ {
+ "type": "test",
+ "section": "Tests",
+ "hidden": true
+ },
+ {
+ "type": "build",
+ "section": "Build System"
+ },
+ {
+ "type": "ci",
+ "section": "Continuous Integration",
+ "hidden": true
+ }
+ ],
+ "release-type": "node",
+ "extra-files": ["src/version.ts", "README.md"]
+}
diff --git a/scripts/build b/scripts/build
index 4513a5f..6a52f04 100755
--- a/scripts/build
+++ b/scripts/build
@@ -8,7 +8,7 @@ node scripts/utils/check-version.cjs
# Build into dist and will publish the package from there,
# so that src/resources/foo.ts becomes /resources/foo.js
-# This way importing from `"kernel/resources/foo"` works
+# This way importing from `"@onkernel/sdk/resources/foo"` works
# even with `"moduleResolution": "node"`
rm -rf dist; mkdir dist
@@ -44,8 +44,8 @@ node scripts/utils/postprocess-files.cjs
# make sure that nothing crashes when we require the output CJS or
# import the output ESM
-(cd dist && node -e 'require("kernel")')
-(cd dist && node -e 'import("kernel")' --input-type=module)
+(cd dist && node -e 'require("@onkernel/sdk")')
+(cd dist && node -e 'import("@onkernel/sdk")' --input-type=module)
if [ -e ./scripts/build-deno ]
then
diff --git a/src/version.ts b/src/version.ts
index 55a1a52..b0bfd9e 100644
--- a/src/version.ts
+++ b/src/version.ts
@@ -1 +1 @@
-export const VERSION = '0.0.1-alpha.0';
+export const VERSION = '0.1.0-alpha.1'; // x-release-please-version
diff --git a/tests/api-resources/apps.test.ts b/tests/api-resources/apps.test.ts
index 67b47ba..614eb1e 100644
--- a/tests/api-resources/apps.test.ts
+++ b/tests/api-resources/apps.test.ts
@@ -1,6 +1,6 @@
// File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
-import Kernel, { toFile } from 'kernel';
+import Kernel, { toFile } from '@onkernel/sdk';
const client = new Kernel({
apiKey: 'My API Key',
diff --git a/tests/api-resources/browser.test.ts b/tests/api-resources/browser.test.ts
index c7f40d7..6782448 100644
--- a/tests/api-resources/browser.test.ts
+++ b/tests/api-resources/browser.test.ts
@@ -1,6 +1,6 @@
// File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
-import Kernel from 'kernel';
+import Kernel from '@onkernel/sdk';
const client = new Kernel({
apiKey: 'My API Key',
diff --git a/tests/base64.test.ts b/tests/base64.test.ts
index 6a9cf51..2e2538e 100644
--- a/tests/base64.test.ts
+++ b/tests/base64.test.ts
@@ -1,4 +1,4 @@
-import { fromBase64, toBase64 } from 'kernel/internal/utils/base64';
+import { fromBase64, toBase64 } from '@onkernel/sdk/internal/utils/base64';
describe.each(['Buffer', 'atob'])('with %s', (mode) => {
let originalBuffer: BufferConstructor;
diff --git a/tests/buildHeaders.test.ts b/tests/buildHeaders.test.ts
index 62e52f6..039a800 100644
--- a/tests/buildHeaders.test.ts
+++ b/tests/buildHeaders.test.ts
@@ -1,5 +1,5 @@
import { inspect } from 'node:util';
-import { buildHeaders, type HeadersLike, type NullableHeaders } from 'kernel/internal/headers';
+import { buildHeaders, type HeadersLike, type NullableHeaders } from '@onkernel/sdk/internal/headers';
function inspectNullableHeaders(headers: NullableHeaders) {
return `NullableHeaders {${[
diff --git a/tests/form.test.ts b/tests/form.test.ts
index c5e1be2..56981ca 100644
--- a/tests/form.test.ts
+++ b/tests/form.test.ts
@@ -1,5 +1,5 @@
-import { multipartFormRequestOptions, createForm } from 'kernel/internal/uploads';
-import { toFile } from 'kernel/core/uploads';
+import { multipartFormRequestOptions, createForm } from '@onkernel/sdk/internal/uploads';
+import { toFile } from '@onkernel/sdk/core/uploads';
describe('form data validation', () => {
test('valid values do not error', async () => {
diff --git a/tests/index.test.ts b/tests/index.test.ts
index 589c1cd..3e6bf88 100644
--- a/tests/index.test.ts
+++ b/tests/index.test.ts
@@ -1,10 +1,10 @@
// File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
-import { APIPromise } from 'kernel/core/api-promise';
+import { APIPromise } from '@onkernel/sdk/core/api-promise';
import util from 'node:util';
-import Kernel from 'kernel';
-import { APIUserAbortError } from 'kernel';
+import Kernel from '@onkernel/sdk';
+import { APIUserAbortError } from '@onkernel/sdk';
const defaultFetch = fetch;
describe('instantiate client', () => {
diff --git a/tests/path.test.ts b/tests/path.test.ts
index c581f27..6d7177f 100644
--- a/tests/path.test.ts
+++ b/tests/path.test.ts
@@ -1,4 +1,4 @@
-import { createPathTagFunction, encodeURIPath } from 'kernel/internal/utils/path';
+import { createPathTagFunction, encodeURIPath } from '@onkernel/sdk/internal/utils/path';
import { inspect } from 'node:util';
describe('path template tag function', () => {
diff --git a/tests/stringifyQuery.test.ts b/tests/stringifyQuery.test.ts
index ce8b691..1170f01 100644
--- a/tests/stringifyQuery.test.ts
+++ b/tests/stringifyQuery.test.ts
@@ -1,6 +1,6 @@
// File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
-import { Kernel } from 'kernel';
+import { Kernel } from '@onkernel/sdk';
const { stringifyQuery } = Kernel.prototype as any;
diff --git a/tests/uploads.test.ts b/tests/uploads.test.ts
index d6fb8d3..ba84b0c 100644
--- a/tests/uploads.test.ts
+++ b/tests/uploads.test.ts
@@ -1,6 +1,6 @@
import fs from 'fs';
-import type { ResponseLike } from 'kernel/internal/to-file';
-import { toFile } from 'kernel/core/uploads';
+import type { ResponseLike } from '@onkernel/sdk/internal/to-file';
+import { toFile } from '@onkernel/sdk/core/uploads';
import { File } from 'node:buffer';
class MyClass {
@@ -97,7 +97,7 @@ describe('missing File error message', () => {
});
test('is thrown', async () => {
- const uploads = await import('kernel/core/uploads');
+ const uploads = await import('@onkernel/sdk/core/uploads');
await expect(
uploads.toFile(mockResponse({ url: 'https://example.com/my/audio.mp3' })),
).rejects.toMatchInlineSnapshot(
diff --git a/tsconfig.build.json b/tsconfig.build.json
index 291f7ad..7a7d5e0 100644
--- a/tsconfig.build.json
+++ b/tsconfig.build.json
@@ -5,8 +5,8 @@
"compilerOptions": {
"rootDir": "./dist/src",
"paths": {
- "kernel/*": ["dist/src/*"],
- "kernel": ["dist/src/index.ts"]
+ "@onkernel/sdk/*": ["dist/src/*"],
+ "@onkernel/sdk": ["dist/src/index.ts"]
},
"noEmit": false,
"declaration": true,
diff --git a/tsconfig.json b/tsconfig.json
index 67838cf..ffa2959 100644
--- a/tsconfig.json
+++ b/tsconfig.json
@@ -9,8 +9,8 @@
"esModuleInterop": true,
"baseUrl": "./",
"paths": {
- "kernel/*": ["src/*"],
- "kernel": ["src/index.ts"]
+ "@onkernel/sdk/*": ["src/*"],
+ "@onkernel/sdk": ["src/index.ts"]
},
"noEmit": true,