Skip to content

shinyonogi/mainichi

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

46 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

mainichi

A local-first CLI task manager. Tasks are stored in SQLite on your machine and optionally synced across devices via a self-hosted server on GCP.

Prerequisites

  • mise — manages Go, Rust, Terraform, and task runners

Install

git clone https://github.com/shinyonogi/mainichi.git
cd mainichi
mise install
mise run cli:install

This builds the CLI in release mode and installs it to ~/.cargo/bin/mainichi. Make sure ~/.cargo/bin is in your PATH.

Usage

Add a task

mainichi add "Write docs"
mainichi add "Ship v1" --note "release checklist" --tags work,release --priority high --due 2025-01-31

# Interactive mode (omit title)
mainichi add

List tasks

mainichi ls          # active tasks grouped by due date
mainichi ls --all    # include completed and deleted tasks

Complete a task

mainichi done <ID>   # ID prefix shown in ls
mainichi done        # interactive picker

Remove a task

mainichi rm <ID>
mainichi rm          # interactive picker

Edit a task

mainichi edit <ID> --title "New title"
mainichi edit <ID> --add-tags urgent --priority high
mainichi edit <ID> --clear-due-date
mainichi edit <ID>   # interactive mode

Priority values: high, medium, low


Online sync (optional)

By default, mainichi works entirely offline — tasks live in SQLite on your machine. If you want to sync across multiple devices, you can self-host the sync server on GCP using the infrastructure in this repo.

What you'll need

  • A GCP project with billing enabled
  • gcloud CLI installed and authenticated
  • Docker
  • A GCS bucket for Terraform state (create this manually before running Terraform)

Terraform and other tools are already managed by mise — just run mise install.

1. Authenticate with GCP

gcloud auth login
gcloud config set project your-gcp-project-id

3. Configure environment

cp .env.example .env.local

Edit .env.local with your values:

MAINICHI_PROJECT=your-gcp-project-id
MAINICHI_REGION=asia-northeast1          # or your preferred region
MAINICHI_AR_REPO=mainichi
MAINICHI_RUN_SERVICE=mainichi-api
MAINICHI_SERVER_URL=                     # fill in after deploy (step 4)

4. Provision infrastructure

cd infra/terraform
cp backend.hcl.example backend.hcl

Edit backend.hcl with your GCS bucket for Terraform state:

bucket = "your-terraform-state-bucket"
prefix = "terraform/state"

Then copy and fill in the environment variables:

cp envs/dev/terraform.example.tfvars envs/dev/terraform.tfvars

Edit envs/dev/terraform.tfvars:

project_id                        = "your-gcp-project-id"
cloud_run_service_name            = "mainichi-api"
artifact_registry_repository_name = "mainichi"
cloud_run_invoker_member          = "user:your-email@gmail.com"

Initialize and apply:

./terraform-init.sh backend.hcl
./terraform.sh plan dev
./terraform.sh apply dev

This provisions Cloud Run, Firestore, Artifact Registry, and the necessary service accounts.

5. Deploy the server

From the repo root:

mise run server:deploy:dev

This builds the Docker image, pushes it to Artifact Registry, and updates the Cloud Run service.

6. Configure the CLI

Get the server URL:

gcloud run services describe mainichi-api \
  --region asia-northeast1 \
  --format='value(status.url)'

Add it to .env.local:

MAINICHI_SERVER_URL=https://mainichi-api-xxxxxxxxxx-xx.a.run.app

Then source the file before running sync commands (or add it to your shell profile):

source .env.local
mainichi ping    # verify connectivity
mainichi sync    # push/pull events

Authentication is handled automatically via gcloud auth print-identity-token, so as long as you're logged in with gcloud auth login, no extra setup is needed.

About

Local-first CLI task manager with optional cross-device sync via self-hosted GCP backend

Resources

Stars

Watchers

Forks

Contributors