Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
24 changes: 18 additions & 6 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -26,15 +26,27 @@ jobs:
if: ${{ steps.release.outputs.release_created }}
uses: oven-sh/setup-bun@v2

- name: Install Node
if: ${{ steps.release.outputs.release_created }}
uses: actions/setup-node@v4
with:
node-version: 22

- name: Install dependencies
if: ${{ steps.release.outputs.release_created }}
run: bun install

- name: Build and publish package
- name: Build package
if: ${{ steps.release.outputs.release_created }}
env:
NPM_TOKEN: ${{ secrets.NPM_TOKEN }}
run: bun run build

- name: Creating .npmrc
run: |
bun build
echo "//registry.npmjs.org/:_authToken=${NPM_TOKEN}" > .npmrc
bun publish --access=public
cat << EOF > "$HOME/.npmrc"
//registry.npmjs.org/:_authToken=$NPM_TOKEN
EOF
env:
NPM_TOKEN: ${{ secrets.NPM_CONFIG_TOKEN }}

- name: Publish package
run: npm publish --access public
3 changes: 2 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -174,4 +174,5 @@ dist
# Finder (MacOS) folder config
.DS_Store

.docs
.docs
.npmrc
2 changes: 1 addition & 1 deletion .release-please-config.json
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
"include-v-in-tag": true,
"packages": {
".": {
"package-name": "stackone-ai-node"
"package-name": "@stackone/ai"
}
},
"$schema": "https://raw.githubusercontent.com/googleapis/release-please/main/schemas/config.json"
Expand Down
44 changes: 22 additions & 22 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,13 +6,13 @@ StackOne AI provides a unified interface for accessing various SaaS tools throug

```bash
# Using npm
npm install stackone-ai-node
npm install @stackone/ai

# Using yarn
yarn add stackone-ai-node
yarn add @stackone/ai

# Using bun
bun add stackone-ai-node
bun add @stackone/ai
```

## Authentication
Expand All @@ -32,7 +32,7 @@ StackOne uses account IDs to identify different integrations. You can specify th
## Quickstart

```typescript
import { StackOneToolSet } from 'stackone-ai-node';
import { StackOneToolSet } from "@stackone/ai";

// Initialize with API key from environment variable
const toolset = new StackOneToolSet();
Expand All @@ -41,11 +41,11 @@ const toolset = new StackOneToolSet();
// const toolset = new StackOneToolSet('your-api-key');

// Get all HRIS-related tools
const accountId = '45072196112816593343';
const tools = toolset.getTools('hris_*', accountId);
const accountId = "45072196112816593343";
const tools = toolset.getTools("hris_*", accountId);

// Use a specific tool
const employeeTool = tools.getTool('hris_list_employees');
const employeeTool = tools.getTool("hris_list_employees");
if (employeeTool) {
const employees = await employeeTool.execute();
console.log(employees);
Expand All @@ -57,20 +57,20 @@ if (employeeTool) {
You can specify a custom base URL when initializing the SDK. This is useful for testing against development APIs or working with self-hosted StackOne instances.

```typescript
import { StackOneToolSet } from 'stackone-ai-node';
import { StackOneToolSet } from "@stackone/ai";

// Initialize with a custom base URL
const toolset = new StackOneToolSet(
process.env.STACKONE_API_KEY,
process.env.STACKONE_ACCOUNT_ID,
'https://api.example-dev.com'
"https://api.example-dev.com"
);

// Get tools with the custom base URL
const tools = toolset.getTools('hris_*');
const tools = toolset.getTools("hris_*");

// All API requests will use the custom base URL
const employeeTool = tools.getTool('hris_list_employees');
const employeeTool = tools.getTool("hris_list_employees");
if (employeeTool) {
const employees = await employeeTool.execute();
console.log(employees);
Expand All @@ -82,11 +82,11 @@ if (employeeTool) {
### OpenAI

```typescript
import { StackOneToolSet } from 'stackone-ai-node';
import OpenAI from 'openai';
import { StackOneToolSet } from "@stackone/ai";
import OpenAI from "openai";

const toolset = new StackOneToolSet();
const tools = toolset.getTools('hris_*', 'your-account-id');
const tools = toolset.getTools("hris_*", "your-account-id");

// Convert to OpenAI functions
const openAITools = tools.toOpenAI();
Expand All @@ -97,10 +97,10 @@ const openai = new OpenAI({
});

const response = await openai.chat.completions.create({
model: 'gpt-4-turbo',
model: "gpt-4-turbo",
messages: [
{ role: 'system', content: 'You are a helpful assistant.' },
{ role: 'user', content: 'List all employees' },
{ role: "system", content: "You are a helpful assistant." },
{ role: "user", content: "List all employees" },
],
tools: openAITools,
});
Expand All @@ -116,20 +116,20 @@ The SDK provides specific error classes for different types of errors:
- `ToolsetLoadError`: Raised when there is an error loading tools

```typescript
import { StackOneToolSet, StackOneAPIError } from 'stackone-ai-node';
import { StackOneToolSet, StackOneAPIError } from "@stackone/ai";

const toolset = new StackOneToolSet();
const tools = toolset.getTools('hris_*', 'your-account-id');
const tool = tools.getTool('hris_get_employee');
const tools = toolset.getTools("hris_*", "your-account-id");
const tool = tools.getTool("hris_get_employee");

try {
const result = await tool.execute({ id: 'employee-id' });
const result = await tool.execute({ id: "employee-id" });
console.log(result);
} catch (error) {
if (error instanceof StackOneAPIError) {
console.error(`API Error (${error.statusCode}):`, error.responseBody);
} else {
console.error('Error:', error);
console.error("Error:", error);
}
}
```
Expand Down
4 changes: 2 additions & 2 deletions bun.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

6 changes: 3 additions & 3 deletions examples/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,13 +3,13 @@
*
* ```bash
* # Using npm
* npm install stackone-ai-node
* npm install @stackone/ai
*
* # Using yarn
* yarn add stackone-ai-node
* yarn add @stackone/ai
*
* # Using bun
* bun add stackone-ai-node
* bun add @stackone/ai
* ```
*
* # Authentication
Expand Down
30 changes: 8 additions & 22 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,37 +1,32 @@
{
"name": "stackone-ai-node",
"version": "0.0.2",
"name": "@stackone/ai",
"version": "0.0.1",
"description": "Agents performing actions on your SaaS",
"module": "dist/index.js",
"main": "dist/index.js",
"types": "dist/index.d.ts",
"type": "module",
"files": [
"dist",
"README.md",
"LICENSE"
],
"files": ["dist", "README.md", "LICENSE"],
"scripts": {
"build": "bun build ./src/index.ts --outdir ./dist --target node",
"publish-package": "bun run build && bun publish --access=public",
"test": "bun test",
"prepublishOnly": "bun run build",
"fetch:specs": "bun run ./scripts/fetch-specs.ts",
"build:docs": "bun run ./scripts/build-docs.ts",
"docs:serve": "mkdocs serve",
"docs:build": "bun run build:docs && mkdocs build",
"docs:deploy": "bun run build:docs && mkdocs gh-deploy --force",
"lint": "biome check .",
"format": "biome format --write .",
"check": "biome check --write .",
"prepare": "husky install"
"check": "biome check --write ."
},
"devDependencies": {
"@biomejs/biome": "^1.5.3",
"@types/bun": "^1.2.4",
"@types/json-schema": "^7.0.15",
"@types/node": "^22.13.5",
"dotenv": "^16.3.1",
"husky": "^8.0.3",
"husky": "^9.1.7",
"json-schema": "^0.4.0",
"lint-staged": "^15.2.0",
"mkdocs": "^0.0.1",
Expand All @@ -51,23 +46,14 @@
"type": "git",
"url": "git+https://github.com/stackone-ai/stackone-ai-node.git"
},
"keywords": [
"stackone",
"ai",
"saas",
"tools",
"agents"
],
"keywords": ["stackone", "ai", "saas", "tools", "agents"],
"author": "StackOne",
"license": "MIT",
"bugs": {
"url": "https://github.com/stackone-ai/stackone-ai-node/issues"
},
"homepage": "https://github.com/stackone-ai/stackone-ai-node#readme",
"lint-staged": {
"*.{js,ts,jsx,tsx}": [
"biome check --write",
"biome format --write"
]
"*.{js,ts,jsx,tsx}": ["biome check --write", "biome format --write"]
}
}
4 changes: 2 additions & 2 deletions scripts/build-docs.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ describe('convertFileToMarkdown', () => {
*
* \`\`\`bash
* # Using npm
* npm install stackone-ai-node
* npm install @stackone/ai
* \`\`\`
*
* # Authentication
Expand All @@ -31,7 +31,7 @@ dotenv.config();`;

\`\`\`bash
# Using npm
npm install stackone-ai-node
npm install @stackone/ai
\`\`\`

# Authentication
Expand Down