Clone

git clone git@git.secluded.site:go-lunatask.git

README

go-lunatask

Godocs.io Reference Pkg.go.dev Reference Go Report Card Test coverage REUSE compatibility Liberapay donation status

Go client library for Lunatask's public API.

lune, a CLI and MCP server for Lunatask, is this library's primary consumer.

Usage

Generate an access token in the Lunatask desktop app under SettingsAccess tokens.

go get git.secluded.site/go-lunatask@latest

See the module documentation on godocs.io or pkg.go.dev for more detail.

package main

import (
	"context"
	"log"
	"os"

	"git.secluded.site/go-lunatask"
)

func main() {
	client := lunatask.NewClient(os.Getenv("LUNATASK_TOKEN"), lunatask.UserAgent("MyApp/1.0"))

	// Verify credentials
	if _, err := client.Ping(context.Background()); err != nil {
		log.Fatal(err)
	}

	// Create a task
	task, err := client.NewTask("Review pull requests").Create(context.Background())
	if err != nil {
		log.Fatal(err)
	}
	if task == nil {
		log.Println("Task already exists")
	}
}

A note on duplicate handling

Create methods return (nil, nil) when a matching entity already exists. This is intentional API behavior on Lunatask's part because of its end-to-end encryption.

task, err := client.NewTask("Review PR").Create(ctx)
if err != nil {
    return err // actual error
}
if task == nil {
    // duplicate exists, not created
}

Contributions

Patch requests are in amolith/go-lunatask on pr.pico.sh. You don't need a new account to contribute, you don't need to fork this repo, you don't need to fiddle with git send-email, you don't need to faff with your email client to get git request-pull working...

You just need:

  • Git
  • SSH
  • An SSH key
# Clone this repo, make your changes, and commit them
# Create a new patch request with
git format-patch origin/main --stdout | ssh pr.pico.sh pr create amolith/go-lunatask
# After potential feedback, submit a revision to an existing patch request with
git format-patch origin/main --stdout | ssh pr.pico.sh pr add {prID}
# List patch requests
ssh pr.pico.sh pr ls amolith/go-lunatask

See "How do Patch Requests work?" on pr.pico.sh's home page for a more complete example workflow.

License

AGPL-3.0-or-later