@sysprompthub/sdk
v2.0.1
Published
SDK for syncing system prompts from SysPromptHub
Readme
@sysprompthub/sdk
Node.js SDK for managing and syncing system prompts from SysPromptHub to your AI assistant configurations.
🌐 Please see @sysprompthub/cli for the command-line interface
🌐 For VS Code integration, see the SysPromptHub Extension
⏳ Jetbrains IDE integration coming soon!
Installation
npm install @sysprompthub/sdkQuick Start
import { SyncManager, NodeFileSystem, DefaultConfigManager } from '@sysprompthub/sdk';
const syncManager = new SyncManager();
const fs = new NodeFileSystem();
await syncManager.sync({
config: {
apiKey: 'your-api-key',
packs: [
{ type: 'copilot', pack: 'owner/pack-name/latest' },
{ type: 'claude', pack: 'owner/pack-name/latest' }
]
},
fs
});Features
- 🔄 Sync prompts to GitHub Copilot and Claude Desktop
- 🎯 Agent/Skill support - Configure multiple specialized agents
- 📁 Custom paths - Write prompts to any location
- 🌍 Environment support - Development, local, and production configs
- 💾 Project config management - Edit
.sysprompthub.jsonprogrammatically
Usage
Syncing Prompts
import { SyncManager, NodeFileSystem } from '@sysprompthub/sdk';
const syncManager = new SyncManager();
const fs = new NodeFileSystem();
// Sync multiple assistants
await syncManager.sync({
config: {
apiKey: process.env.SYSPROMPTHUB_API_KEY!,
packs: [
{ type: 'copilot', pack: 'company/general/v1.0.0' },
{ type: 'claude', pack: 'company/general/v1.0.0' },
{
type: 'copilot',
pack: 'company/python-expert/latest',
agent: {
name: 'python',
description: 'Python development expert'
}
}
]
},
fs
});Managing Project Configuration
import { DefaultConfigManager, ProjectConfigEditor, NodeFileSystem } from '@sysprompthub/sdk';
const fs = new NodeFileSystem();
const manager = new DefaultConfigManager();
// Load or create config
const editor = await manager.load(fs);
// Set primary assistant pack
await editor.set({
assistant: 'copilot',
pack: 'owner/pack/latest',
environment: 'development'
});
// Add an agent
await editor.addAgent({
assistant: 'copilot',
name: 'typescript',
pack: 'owner/typescript-pack/latest',
frontMatter: {
description: 'TypeScript expert',
model: 'gpt-4'
}
});
// Add custom path
await editor.addCustom({
path: 'docs/prompt.md',
pack: 'owner/docs-pack/latest'
});
// View current configuration
console.log(editor.packs);
// Remove an agent
await editor.removeAgent('copilot', 'typescript');
// Clear all packs for an assistant
await editor.clearAll('copilot');Working with Configurations
import { DefaultConfigManager, UserConfigManager, NodeFileSystem } from '@sysprompthub/sdk';
const fs = new NodeFileSystem();
// Project configuration (.sysprompthub.json)
const projectManager = new DefaultConfigManager();
const projectEditor = await projectManager.load(fs);
// User configuration (~/.sysprompthub/config.json)
const userManager = new UserConfigManager();
const userConfig = await userManager.load(fs);
if (userConfig) {
console.log('API Key:', userConfig.apiKey);
}Configuration Format
Project Config (.sysprompthub.json)
{
"packs": [
{
"type": "copilot",
"pack": "owner/pack-name/version"
},
{
"type": "copilot",
"pack": "owner/agent-pack/version",
"agent": {
"name": "python",
"description": "Python expert"
}
},
{
"type": "claude",
"pack": "owner/pack-name/version",
"environment": "development"
},
{
"type": "custom",
"pack": "owner/custom-pack/version",
"path": "docs/prompt.md"
}
]
}User Config (~/.sysprompthub/config.json)
{
"apiKey": "sph_..."
}API Reference
SyncManager
Syncs prompts from SysPromptHub to local files.
sync(workspace: Workspace): Promise<void>- Download and write prompts
ProjectConfigEditor
Manages project configuration with a fluent API.
set(options)- Set/replace assistant root packclear(type)- Remove assistant root packclearAll(type)- Remove all packs for an assistantfind(assistant)- Find root packaddAgent(options)- Add/replace agent packremoveAgent(assistant, name)- Remove agent packfindAgent(assistant, name)- Find agent packaddCustom(options)- Add/replace custom packremoveCustom(path)- Remove custom packfindCustom(path)- Find custom pack by path
ConfigManager
Interface for loading and saving configurations.
load(fs)- Load configuration, returns editorsave(fs, config)- Save configurationupdate(fs, config)- Update existing configurationexists(fs)- Check if configuration exists
TypeScript Support
This package includes full TypeScript definitions.
import type {
PackConfig,
ProjectConfig,
UserConfig,
AssistantType,
Environment
} from '@sysprompthub/sdk';CLI Alternative
For command-line usage, see @sysprompthub/cli.
License
ISC
