buntralino

📁 jagritgumber/bunskills 📅 7 days ago
1
总安装量
1
周安装量
#48655
全站排名
安装命令
npx skills add https://github.com/jagritgumber/bunskills --skill buntralino

Agent 安装分布

amp 1
trae 1
trae-cn 1
opencode 1
codex 1

Skill 文档

Buntralino Integration Guide

Buntralino uses a Bun main process with Neutralino windows for UI, connected through WebSockets. Use this skill when building or diagnosing Buntralino apps that combine Bun backend logic with Neutralino frontend code.

When to Use

  • Building Buntralino apps that bridge Bun backend logic with Neutralino windows
  • Wiring client-to-server method calls, events, and multi-window routing
  • Troubleshooting connection, runtime, or platform-specific issues

What This Skill Covers

  • Buntralino architecture, CLI usage, and build/run workflows
  • Bun API window management and server-side method registration
  • Client API usage for method calls, events, and window lifecycle

Quick Start

Bun Side

import * as buntralino from 'buntralino';

buntralino.registerMethod('sayHello', async (payload) => {
  const name = payload?.name ?? 'world';
  return { message: `Hello, ${name}!` };
});

await buntralino.create('/', {
  name: 'main',
  title: 'My App',
  width: 800,
  height: 600,
  center: true
});

Neutralino Window

import * as buntralino from 'buntralino-client';

await buntralino.ready;
const response = await buntralino.run('sayHello', { name: 'Ada' });
displayMessage(response.message);

Communication Patterns

Method Calls With Result Contracts

import * as buntralino from 'buntralino';

buntralino.registerMethod('processData', async (payload) => {
  try {
    const result = await heavyProcessing(payload.input);
    return { ok: true, result };
  } catch (error) {
    return { ok: false, error: String(error) };
  }
});
import * as buntralino from 'buntralino-client';

await buntralino.ready;
const response = await buntralino.run('processData', { input: 'data' });
if (response.ok) {
  updateUI(response.result);
} else {
  showError(response.error);
}

Event Broadcasting

import * as buntralino from 'buntralino';

buntralino.broadcast('dataUpdated', { timestamp: Date.now() });
Neutralino.events.on('dataUpdated', (event) => {
  updateUI(event.detail);
});

Multi-Window Routing

import * as buntralino from 'buntralino';

await buntralino.create('/settings', { name: 'settings', width: 640, height: 480 });
await buntralino.sendEvent('settings', 'settingsLoaded', { ready: true });

Neutralino Integration Notes

  • Ensure required Neutralino namespaces and methods are allowlisted in neutralino.config.json for your app.
  • If you intentionally create windows with Neutralino.window.create, call buntralino.disableBunCheck in the window after importing buntralino-client.

Example Scripts

References

JavaScript references use the default filenames. TypeScript references use the same names with a -types suffix.