This is a starter template to build a plugin for HugeTicket. It provides:
- A local
PLUGIN_HOOKSconstant for autocomplete - Fully typed
example:eventhook payload - Plugin-local models, utils, and handlers
- No core modifications required
- Rename the plugin folder and update
plugin.json - Replace
example:eventwith your own hook name - Define payload types in
types/hooks.d.ts - Register new handlers inside
handlers/
- Add the event to
constants/hooks.ts:
export const PLUGIN_HOOKS = {
EXAMPLE_EVENT: "example:event",
NEW_EVENT: "ticket:extra_action",
} as const;- Extend the type in
types/hooks.d.ts:
interface HookTypes {
"ticket:extra_action": {
ticketId: string;
note: string;
};
}- Add a handler in
handlers/onExtraAction.ts:
on(PLUGIN_HOOKS.NEW_EVENT, async ({ ticketId, note }) => {
console.log("New action received:", ticketId, note);
});- Import it in
index.ts.
Use PLUGIN_HOOKS.YOUR_EVENT instead of raw strings like "your:event". This gives autocomplete and avoids typos.
Just zip this folder or publish it as a git repo. No need to use npm for private plugins.