MCPcopy Index your code
hub / github.com/deanishe/awgo

github.com/deanishe/awgo @v0.29.1

Chat with this repo
repository ↗ · DeepWiki ↗ · release v0.29.1 ↗ · + Follow
559 symbols 2,050 edges 60 files 419 documented · 75%
What it actually does AI analysis from the code graph — generated when you open this
loading…
README
<img src="https://raw.githubusercontent.com/deanishe/awgo/master/Icon.png" alt="AwGo Logo" title="AwGo Logo">

AwGo — A Go library for Alfred workflows

Build Status Go Report Card Coverage Status Go Reference

Full-featured library to build lightning-fast workflows in a jiffy.

Features

Installation & usage

Install AwGo with:

go get -u github.com/deanishe/awgo

Typically, you'd call your program's main entry point via Workflow.Run(). This way, the library will rescue any panic, log the stack trace and show an error message to the user in Alfred.

program.go:

package main

// Package is called aw
import "github.com/deanishe/awgo"

// Workflow is the main API
var wf *aw.Workflow

func init() {
    // Create a new Workflow using default settings.
    // Critical settings are provided by Alfred via environment variables,
    // so this *will* die in flames if not run in an Alfred-like environment.
    wf = aw.New()
}

// Your workflow starts here
func run() {
    // Add a "Script Filter" result
    wf.NewItem("First result!")
    // Send results to Alfred
    wf.SendFeedback()
}

func main() {
    // Wrap your entry point with Run() to catch and log panics and
    // show an error in Alfred instead of silently dying
    wf.Run(run)
}

In the Script Filter's Script box (Language = /bin/bash with input as argv):

./program "$1"

Documentation

Read the docs on pkg.go.dev.

Check out the example workflows (docs), which show how to use AwGo. Use one as a template to get your own workflow up and running quickly.

Requirements

The library (and therefore the unit tests) rely on being run in a minimally Alfred-like environment, as they pull configuration options from the environment variables set by Alfred.

This means that if you want to run AwGo-based code outside Alfred, e.g. in your shell, you must set at least the following environment variables to meaningful values, or the library will panic:

  • alfred_workflow_bundleid
  • alfred_workflow_cache
  • alfred_workflow_data

And if you're using the update API, also:

  • alfred_workflow_version
  • alfred_version (not needed for Alfred 4+)

Development

To create a sufficiently Alfred-like environment, you can source the env.sh script in the project root or run unit tests via the run-tests.sh script (which also sets up an appropriate environment before calling go test).

Licensing & thanks

This library is released under the MIT licence. It was built with neovim and GoLand by JetBrains.

The icon is based on the Go Gopher by Renee French.

Extension points exported contracts — how you extend this code

MagicAction (Interface)
* MagicAction is a command that is called directly by AwGo (i.e. your workflow code is not run) if its keyword is passe [9 …
magic.go
Source (Interface)
Source provides workflow files that can be downloaded. This is what concrete updaters (e.g. GitHub, Gitea) should implem [4 …
update/update.go
Updater (Interface)
Updater can check for and download & install newer versions of the workflow. There is a concrete implementation and docu [2 …
workflow_update.go
Runner (Interface)
Runner knows how to execute a file passed to it. It is used by Run to determine how to run a file. When Run is passed a [2 …
util/scripts.go
Env (Interface)
Env is the data source for configuration lookups. Pass a custom implementation to NewFromEnv() to provide a custom sour [1 …
env.go
Option (FuncType)
Option is a configuration option for Workflow. Pass one or more Options to New() or Workflow.Configure(). An Option ret
workflow_options.go

Core symbols most depended-on inside this repo

Run
called by 102
magic.go
PathExists
called by 36
util/files.go
NewItem
called by 24
feedback.go
Get
called by 23
config.go
Exists
called by 19
cache.go
Subtitle
called by 18
feedback.go
Configure
called by 15
workflow.go
Valid
called by 15
feedback.go

Shape

Method 255
Function 241
Struct 50
TypeAlias 6
Interface 5
FuncType 2

Languages

Go99%
Python1%
TypeScript1%

Modules by API surface

feedback.go60 symbols
magic.go50 symbols
cache.go25 symbols
util/scripts.go22 symbols
update/update.go20 symbols
workflow.go19 symbols
feedback_test.go19 symbols
workflow_test.go18 symbols
update/update_test.go17 symbols
update/semver.go17 symbols
workflow_options.go15 symbols
workflow_feedback.go14 symbols

For agents

$ claude mcp add awgo \
  -- python -m otcore.mcp_server <graph>

⬇ download graph artifact