Using the Zhu Li SDK
The @untools/zhuli SDK is a type-safe TypeScript library that allows you to programmatically interact with your Zhu Li workspace. Use it to submit issues and features, track commits, or even chat with the agent from your own applications and scripts.
Installation
Install the SDK using your preferred package manager:
npm install @untools/zhuli
# or
yarn add @untools/zhuli
# or
pnpm add @untools/zhuli
Quick Start
To get started, initialize the ZhuLiSDK with your API key and the base URL of your Zhu Li instance.
import { ZhuLiSDK } from "@untools/zhuli";
const zhuli = new ZhuLiSDK({
apiKey: process.env.ZHULI_API_KEY!,
baseUrl: "https://zhuli.aevr.space",
});
// Submit a new issue
await zhuli.submitIssue({
title: "Checkout timeout",
description: "Payment hangs after card confirmation.",
severity: "high",
});
// List open issues
const { data } = await zhuli.listIssues({ status: "open" });
console.log(`There are ${data.issues.length} open issues.`);
API Methods
The SDK provides several methods for common tasks:
Issues and Features
submitIssue(payload): Create a new bug report in Notion.submitFeature(payload): Create a new feature request in Notion.listIssues(query?): Retrieve a list of issues.listFeatures(query?): Retrieve a list of features.
Git and Commits
submitCommit(payload): Record a git commit and map it to relevant issues.listChangelog(query?): Get a list of recent changes based on commits and issues.
AI Chat
chat(message, options?): Send a message to the Zhu Li agent and receive a Notion-aware response.
Example: GitHub Actions
You can use the SDK in GitHub Actions to automatically notify Zhu Li when a new release is created or a bug is reported in your GitHub issues.
import { ZhuLiSDK } from "@untools/zhuli";
async function run() {
const sdk = new ZhuLiSDK({
apiKey: process.env.ZHULI_API_KEY!,
baseUrl: "https://zhuli.aevr.space",
});
// Example: Map GitHub event to Zhu Li issue
await sdk.submitIssue({
title: github.context.payload.issue.title,
description: `GitHub Issue #${github.context.payload.issue.number}: ${github.context.payload.issue.body}`,
severity: "low",
});
}
run().catch(console.error);