Skip to content

mahata/polly

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

17 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

polly

A small Go CLI that helps you study English vocabulary and idioms.

Given a word or phrase as an argument, it:

  1. Uses the GitHub Copilot SDK to generate an example sentence, a Japanese translation, and a short explanation,
  2. Generates an .mp3 file of the example sentence read aloud by AWS Polly, and
  3. Saves the formatted example sentence, translation, and explanation to the clipboard (via macOS pbcopy).

Usage

polly "eager"
polly "look forward to"

Example output:

Audio file created: She_is_eager_to_learn_new_languages.mp3
Copied vocab card to clipboard.

The clipboard will contain text like the following:

- She is eager to learn new languages.
- 彼女は新しい言語を学ぶことに熱心だ。

- 「eager」は「熱心な」「強く望んでいる」という意味の形容詞。

The .mp3 filename is a sanitized version of the example sentence: whitespace, punctuation, and symbols are replaced with _, consecutive _ characters are collapsed to a single one, and leading/trailing _ characters are removed.

Prerequisites

  • A GitHub Copilot subscription. The bundled Copilot CLI authenticates via your existing gh auth login session; no separate copilot install is required (the matching CLI binary is embedded in each release).
  • The AWS CLI must be installed and configured with credentials that can access AWS Polly.
  • macOS is required (the clipboard integration uses pbcopy).

Development

The Copilot CLI binary is embedded at build time via the SDK's bundler. Generate the bundle for your current platform first, then build/test as usual:

go tool bundler        # downloads & embeds the matching Copilot CLI
go test ./...
go build .

go tool bundler writes large zcopilot_*.zst and zcopilot_*.go files into the project root; they are git-ignored and meant to be regenerated on demand. Re-run it whenever the github.com/github/copilot-sdk/go version changes.

To build for another platform, pass --platform:

go tool bundler --platform darwin/arm64
GOOS=darwin GOARCH=arm64 go build .

You can also run the app directly without building a binary (still requires running the bundler once):

go tool bundler
go run . "eager"

Running a released binary

Download the polly-<os>-<arch> binary (with .exe on Windows) that matches your OS and architecture from GitHub Releases.

macOS

chmod +x ./polly-darwin-arm64
xattr -d com.apple.quarantine ./polly-darwin-arm64
./polly-darwin-arm64 "eager"

The same steps work for the amd64 build. Alternatively, you can approve the binary in Finder by right-clicking and choosing "Open" → "Open".

About

No description, website, or topics provided.

Resources

License

Stars

Watchers

Forks

Packages

 
 
 

Contributors

Languages