Skip to content
cage1016Public

About

A generator for golang alfred workflow that helps you create boilerplate code.

Topics

Resources

Stars

13 stars

Watchers

1 watching

Forks

Repository files navigation

Go base Alfred workflow generator

GitHub

A generator for Go-based Alfred workflows (compatible with Alfred 6 and Alfred UI / .alfredui) that helps you create boilerplate code, CI/CD pipelines, and development Makefiles.

Why ?

As a Gopher, i want to create a Golang base workflow quickly than sketching it out by hand. I also want to be able to share my way of doing things with others.

Features

  1. Create a new workflow with three type of patterns:
    1. Simple workflow with Alfred variables and arguments
    2. leverage deanishe/awgo with Alfred items feedback
    3. leverage deanishe/awgo and spf13/cobra with Alfred items feedback
  2. Workflow development
    1. Build the workflow executable and output it into the .workflow subdirectory
    2. Display information about the workflow
    3. Link the .workflow subdirectory into Alfred's preferences directory, installing it.
    4. Package the workflow for distribution locally
    5. Unlink the .workflow subdirectory from Alfred's preferences directory, uninstalling it.
  3. Additional patterns (Alfred 6 & .alfredui compatible)
    1. Add GitHub Actions (ci.yml & release.yml) to project — auto-detects Go / Python stack, lints info.plist and *.alfredui/ui.json, packages arm64 & amd64 .alfredworkflow archives with SHA-256 checksums and release notes (-s to enable macOS code sign and notarize)
    2. Add license to project
    3. Add Alfred 6 compatible Makefile to project (lint, test, build-local, dev, pack-local, reload, release, push, etc.)
  4. Compatible with Alfred 6 & Alfred UI (*.alfredui validation, script permissions, and workflow reload)
  5. Support arm64 & amd64

Installation

With Go 1.20 or higher:

go install github.com/cage1016/ak@latest

Running the generator

A generator for awgo that helps you create boilerplate code

Usage:
  ak [flags]
  ak [command]

Available Commands:
  add         Used to add additional component to project
  alfred      Used to manage Go-based Alfred workflows
  completion  Generate the autocompletion script for the specified shell
  help        Help about any command
  init        Initiates a workflow
  new         Used to create workflow package

Flags:
  -d, --debug           If you want to se the debug logs.
      --folder string   If you want to specify the base folder of the workflow.
  -f, --force           Force overwrite existing files without asking.
  -h, --help            help for ak
      --testing         If testing the generator.
  -v, --version         version for ak

Use "ak [command] --help" for more information about a command.
  1. ak init to create a new workflow

  2. revise ak.json as your workflow's information (license.year defaults to the current year)

    {
        "go_mod_package": "github.com/xxx/ak-test",
        "workflow": {
            "folder": ".workflow",
            "name": "Ak Test",
            "description": "",
            "category_comment": "category: Tools, Internet, Productivity, Uncategorised",
            "category": "",
            "bundle_id": "com.xxx.aktest",
            "created_by": "",
            "web_address": "https://github.com/xxx/ak-test",
            "version": "0.1.0"
        },
        "update": {
            "github_repo": "https://github.com/xxx/ak-test"
        },
        "license": {
            "type_comment": "support license https://github.com/nishanths/license",
            "type": "mit",
            "year": "2026",
            "name": ""
        },
        "gon": {
            "application_identity": "Developer ID Application: KAI CHU CHUNG"
        }
    }
  3. Create a workflow pattern

    1. ak new cmd create cobra based workflow
  4. Add additional components to the workflow

    1. ak add githubAction (alias ga) add GitHub Actions (ci.yml & release.yml) to project
      1. -s to enable macOS code sign and notarize
    2. ak add license (alias l) add license to project
    3. ak add makefile (alias mf) add Alfred 6 compatible Makefile to project
  5. Workflow development (via generated Makefile)

    1. make lint to lint Go code, info.plist, and Alfred 6 UI bundle (*.alfredui)
    2. make test to run Go unit tests
    3. make build-local to build a lean Apple Silicon (arm64) binary into .workflow/exe
    4. make build to build a universal binary via ak alfred build
    5. make dev to rebuild the local arm64 binary and reload the workflow in Alfred 6
    6. make reload to reload the workflow in Alfred 6
    7. make pack-local to lint, build arm64 binary, and pack a clean .alfredworkflow archive
    8. make info to display information about the workflow
    9. make link / make unlink to link or unlink .workflow in Alfred's preferences directory
    10. make release TAG=0.2.0 / make push [TAG=0.2.0] to lint, test, tag, and push a release to trigger GitHub Actions

Examples

  1. ak/_example

License

This project is licensed under the MIT License. See LICENSE for details.

About

A generator for golang alfred workflow that helps you create boilerplate code.

Topics

Resources

Stars

13 stars

Watchers

1 watching

Forks

Releases

Packages

Used by

Contributors

Languages