Skip to content

Creating Plugins

Build custom plugins for atlcli.

  • Node.js or Bun runtime
  • TypeScript knowledge
  • atlcli installed
my-plugin/
├── package.json
├── index.ts
└── README.md
{
"name": "@atlcli/plugin-example",
"version": "1.0.0",
"main": "index.ts",
"atlcli": {
"name": "example",
"description": "Example plugin"
}
}
import type { Plugin, PluginContext } from '@atlcli/core';
const plugin: Plugin = {
name: 'example',
version: '1.0.0',
// Called when plugin loads
async init(ctx: PluginContext) {
console.log('Example plugin loaded');
},
// Register commands
commands: [
{
name: 'hello',
description: 'Say hello',
async handler(args, flags, ctx) {
console.log('Hello from plugin!');
}
}
],
// Hook into existing commands
hooks: {
'docs:push:before': async (ctx) => {
console.log('About to push docs...');
},
'docs:push:after': async (ctx, result) => {
console.log('Docs pushed successfully');
}
}
};
export default plugin;

Plugins receive a context object:

interface PluginContext {
config: Config; // atlcli configuration
credentials: Credentials; // Auth credentials
logger: Logger; // Logging utilities
confluence: ConfluenceClient;
jira: JiraClient;
}

Register custom commands:

commands: [
{
name: 'my-command',
description: 'Does something',
options: [
{ name: 'verbose', alias: 'v', type: 'boolean' }
],
async handler(args, flags, ctx) {
if (flags.verbose) {
ctx.logger.debug('Verbose mode');
}
// Implementation
}
}
]

Hook into command lifecycle:

HookWhen
docs:pull:beforeBefore pulling docs
docs:pull:afterAfter pulling docs
docs:push:beforeBefore pushing docs
docs:push:afterAfter pushing docs
jira:create:beforeBefore creating issue
jira:create:afterAfter creating issue

Test your plugin locally:

Terminal window
# Install locally
atlcli plugin install ./my-plugin
# Enable
atlcli plugin enable example
# Test command
atlcli hello

Publish to npm:

Terminal window
npm publish --access public

Users can then install:

Terminal window
atlcli plugin install @atlcli/plugin-example
Jira and Confluence are trademarks of Atlassian Corporation Plc. atlcli is not affiliated with, endorsed by, or sponsored by Atlassian.