Skip to content

About

No description, website, or topics provided.

Resources

Stars

1 star

Watchers

0 watching

Forks

Latest commit

 

History

2 Commits

Folders and files

Repository files navigation

Taskwarrior ↔ Google Tasks Sync

A bidirectional synchronization tool between Taskwarrior and Google Tasks, written in Go.

THIS WHOLE THING IS VIBE CODED. USE AT YOUR OWN RISK.

Features

  • ✅ Bidirectional sync (Taskwarrior ↔ Google Tasks)
  • 🔄 Recurring task support (syncs current instances only)
  • 🏷️ Filter-based sync (e.g., only tasks with +remind tag)
  • ⚔️ Configurable conflict resolution strategies
  • 🔐 Secure OAuth 2.0 authentication
  • 💾 SQLite-based sync state tracking
  • 🎯 Field mapping: description, due date, status, project, tags, priority

Prerequisites

  • Go 1.21 or later
  • Taskwarrior 3.x installed and configured
  • Google Cloud project with Tasks API enabled

Installation

From Source

git clone https://github.com/Anaritus/taskwarrior-google-sync.git
cd taskwarrior-google-sync
go build -o tw-gsync ./cmd/tw-gsync
sudo mv tw-gsync /usr/local/bin/

Binary Download

Download the latest binary from the releases page.

Setup

1. Google Cloud Configuration

  1. Go to Google Cloud Console
  2. Create a new project (or select existing)
  3. Enable the Google Tasks API:
    • Go to "APIs & Services" > "Library"
    • Search for "Google Tasks API"
    • Click "Enable"
  4. Create OAuth 2.0 credentials:
    • Go to "APIs & Services" > "Credentials"
    • Click "Create Credentials" > "OAuth client ID"
    • Select "Desktop app" as application type
    • Note your Client ID and Client Secret

2. Initialize tw-gsync

Run the initialization command:

tw-gsync init

This will:

  • Prompt for your Google OAuth credentials
  • Create a configuration file at ~/.config/tw-gsync/config.yaml
  • Open a browser for Google authentication
  • Save the OAuth token

Usage

Basic Sync

tw-gsync sync

This performs bidirectional synchronization:

  • Creates Google Tasks for new Taskwarrior tasks (matching filter)
  • Updates Google Tasks when Taskwarrior tasks change
  • Imports new Google Tasks into Taskwarrior
  • Updates Taskwarrior tasks when Google Tasks change
  • Handles deletions in both directions

Dry Run

Preview changes without applying them:

tw-gsync sync --dry-run

Verbose Output

See detailed logging:

tw-gsync sync --verbose

Check Status

View sync statistics:

tw-gsync status

View Configuration

tw-gsync config

Reset Sync State

Clear all sync mappings (use with caution):

tw-gsync reset

Configuration

Edit ~/.config/tw-gsync/config.yaml:

google:
  client_id: "YOUR_CLIENT_ID.apps.googleusercontent.com"
  client_secret: "YOUR_CLIENT_SECRET"
  task_list_id: "@default" # or specific list ID

taskwarrior:
  data_location: "~/.task"
  task_bin: "task"
  filter:
    - "+remind" # Only sync tasks with +remind tag

sync:
  conflict_strategy: "last_write_wins" # or google_wins, taskwarrior_wins
  sync_completed: true
  max_completed_age_days: 30
  deleted_tasks_behavior: "delete" # or archive

Filter Examples

Sync only tasks with specific tag:

filter: ["+remind"]

Sync tasks from specific project:

filter: ["project:work"]

Sync multiple criteria:

filter: ["+remind", "project:personal"]

Conflict Resolution Strategies

  • last_write_wins (default): Use modification timestamp to determine winner
  • google_wins: Always prefer Google Tasks version in conflicts
  • taskwarrior_wins: Always prefer Taskwarrior version in conflicts

Field Mapping

Taskwarrior Google Tasks Notes
description title Task title
due due Due date (RFC 3339)
status status + completed pending/completed
uuid Stored in notes Internal tracking
project Stored in notes Project metadata
tags Stored in notes Tag list
priority Stored in notes H/M/L priority
annotations Appended to notes With timestamps
recur N/A See recurring tasks

Recurring Tasks

Google Tasks does not support recurring tasks natively. This tool handles recurrence as follows:

  1. Recurring parent templates (status=recurring) are not synced
  2. Only current pending instances are synced to Google Tasks
  3. When you complete a task in Google:
    • The instance is marked complete in Taskwarrior
    • Taskwarrior automatically generates the next instance
    • On next sync, the new instance is pushed to Google Tasks

Example workflow:

# Create recurring task in Taskwarrior
task add "Weekly review" due:friday recur:weekly +remind

# First sync - current instance appears in Google Tasks
tw-gsync sync

# Complete in Google Tasks (or Taskwarrior)
# Next sync detects completion and updates both systems
tw-gsync sync

# Taskwarrior has generated the next week's instance
# It will be synced on next run

Automated Sync

Using Cron

Add to your crontab (crontab -e):

# Sync every 15 minutes
*/15 * * * * /usr/local/bin/tw-gsync sync >> ~/.local/share/tw-gsync/sync.log 2>&1

Using systemd Timer

Create ~/.config/systemd/user/tw-gsync.service:

[Unit]
Description=Taskwarrior Google Tasks Sync

[Service]
Type=oneshot
ExecStart=/usr/local/bin/tw-gsync sync

Create ~/.config/systemd/user/tw-gsync.timer:

[Unit]
Description=Run tw-gsync every 15 minutes

[Timer]
OnBootSec=5min
OnUnitActiveSec=15min

[Install]
WantedBy=timers.target

Enable and start:

systemctl --user enable --now tw-gsync.timer

Troubleshooting

Authentication Errors

# Re-authenticate
rm ~/.config/tw-gsync/token.json
tw-gsync init

Taskwarrior Not Found

Ensure Taskwarrior is in your PATH or set the full path in config:

taskwarrior:
  task_bin: "/opt/homebrew/bin/task"

Sync State Issues

If tasks are duplicating or not syncing correctly:

# Reset sync state
tw-gsync reset

# Re-sync from scratch
tw-gsync sync

View Logs

Enable verbose mode to see detailed sync operations:

tw-gsync sync --verbose

Development

Build

go build -o tw-gsync ./cmd/tw-gsync

Run Tests

go test ./...

Project Structure

taskwarrior-google-sync/
├── cmd/tw-gsync/          # CLI application
├── internal/
│   ├── auth/              # OAuth 2.0 authentication
│   ├── config/            # Configuration management
│   ├── gtasks/            # Google Tasks API client
│   ├── storage/           # SQLite sync state
│   ├── sync/              # Sync engine
│   └── taskwarrior/       # Taskwarrior CLI wrapper
└── config/                # Example configs

Limitations

  • Google Tasks doesn't support native recurring tasks (see workaround above)
  • Google Tasks doesn't support priorities (stored in notes field)
  • Task dependencies are not synced
  • Taskwarrior UDAs (user-defined attributes) are not synced

License

MIT License - see LICENSE file

Contributing

Contributions welcome! Please open an issue or PR.

Acknowledgments

  • Built with emersion/go-webdav
  • Google Tasks API by Google
  • Taskwarrior by GothenburgBitFactory

Related Projects

About

No description, website, or topics provided.

Resources

Stars

1 star

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages