bktide
Version:
Command-line interface for Buildkite CI/CD workflows with rich shell completions (Fish, Bash, Zsh) and Alfred workflow integration for macOS power users
42 lines • 1.75 kB
JavaScript
import { BaseFormatter } from './Formatter.js';
export class AlfredFormatter extends BaseFormatter {
name = 'alfred';
formatPipelines(pipelines, _organizations, _options) {
// Format pipelines as Alfred-compatible JSON items
const alfredItems = pipelines.map((pipeline) => {
// Generate web URL for the pipeline (if not already present)
const pipelineUrl = pipeline.url ||
`https://buildkite.com/${pipeline.organization}/${pipeline.slug}`;
const uid = pipeline.uuid;
const title = pipeline.slug;
const subtitle = pipeline.description || '';
const autocomplete = `${pipeline.organization}/${pipeline.name}`;
const match = `${pipeline.organization}/${pipeline.slug}`;
return {
uid: uid,
title: title,
subtitle: subtitle,
match: match,
arg: pipelineUrl,
autocomplete: autocomplete,
mods: {
alt: {
subtitle: `Organization: ${pipeline.organization}`,
arg: pipelineUrl
},
cmd: {
subtitle: `Name: ${pipeline.name}`,
arg: pipelineUrl
}
},
text: {
copy: pipelineUrl,
largetype: `${pipeline.name}\nOrganization: ${pipeline.organization}\nSlug: ${pipeline.slug}`
}
};
});
// Return formatted JSON for Alfred
return JSON.stringify({ items: alfredItems }, null, 2);
}
}
//# sourceMappingURL=AlfredFormatter.js.map