anytype-gh

module
v0.1.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Apr 9, 2026 License: Apache-2.0

README

anytype-gh

Go Report Card Go Reference codecov

anytype-gh is an interactive CLI that syncs a GitHub repository README.md (including private repos) into an Anytype page.

What it does

  • lists repositories visible to your GitHub token (archived repositories are skipped)
  • fetches the selected repository README from GitHub
  • creates, updates, or recreates an Anytype page for that README
  • persists local state so repeated runs are idempotent (SHA-based skip/update)

Requirements

  • Go 1.26+
  • Anytype desktop app installed and running
  • GitHub token with access to your target repos (GH_TOKEN)

Create a token at https://github.com/settings/personal-access-tokens with permission to read repositories.

Install

go install github.com/alesr/anytype-gh/cmd/anytype-gh@latest

macOS prebuilt binaries

  • anytype-gh-darwin-arm64 (Apple Silicon)
  • anytype-gh-darwin-amd64 (Intel)

Download the right asset for your Mac, then:

chmod +x anytype-gh-darwin-<arch>
mv anytype-gh-darwin-<arch> anytype-gh
xattr -d com.apple.quarantine ./anytype-gh
./anytype-gh

Configuration

The CLI supports two configuration files:

  • ~/.config/anytype-gh/config.yaml (created automatically on first run if GH_TOKEN is missing)
  • .env.local (optional fallback)

config.yaml format:

github:
  token: github_pat_xxx
anytype:
  base_url: http://localhost:31009 # optional

.env.local format:

GH_TOKEN=github_pat_xxx
ANYTYPE_BASE_URL=http://localhost:31009 # optional

Configuration precedence:

  • process environment variables (highest priority)
  • config.yaml values
  • .env.local file values as fallback

.env.local lookup order:

  1. current working directory
  2. ~/.config/anytype-gh/.env.local
  3. executable directory

State is persisted at ~/.config/anytype-gh/state.json with restrictive file permissions (0600).

Run

Run the interactive CLI:

anytype-gh

First, authenticate (Anytype app must be running). Then choose the repository you want to fetch the README from, and sync it with Anytype to create or update a page with the README content.

Sync behavior

For the selected repository:

  • target page title is README - <owner>/<repo>
  • if README SHA is unchanged and mapping exists, sync is skipped
  • if SHA changed, existing page is updated
  • if mapped object no longer exists, page is recreated
  • state is updated with object ID, SHA, sync timestamp, and space ID

Directories

Path Synopsis
cmd
anytype-gh command
internal
cli
cli package provides the command-line interface for the anytype-gh tool.
cli package provides the command-line interface for the anytype-gh tool.
config
Package config centralizes runtime configuration rules so startup behavior stays predictable across local runs and installed binaries.
Package config centralizes runtime configuration rules so startup behavior stays predictable across local runs and installed binaries.
repositories/state
Package state persists local sync decisions so repeated runs can update the same Anytype objects instead of duplicating content.
Package state persists local sync decisions so repeated runs can update the same Anytype objects instead of duplicating content.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL