Skip to main content

Two-way sync between Linear/Notion and local Markdown files — Docs-as-Code for developers

Project description

Sovereign Sync (svgn)

svgn is a professional developer utility that synchronizes your Linear backlog and Notion documentation with local Markdown files. It enables a "Docs-as-Code" and "Dev-as-Code" workflow, allowing you to manage project execution and technical specifications directly from your code editor.


📂 Project Structure

The codebase is organized into a modular package for scalability and reliability:

src/svgn/
├── api/             # Low-level API wrappers for Linear & Notion
├── engines/         # Sync logic and state management
├── utils/           # Markdown parsing and Notion block conversion
└── main.py          # CLI Entry point

🛠 Command Reference

1. Core Lifecycle Commands

svgn init

Run this first.

  • Discovers Linear teams and sets your Team ID if not provided.
  • Automatically detects Notion credentials if present in .env.
  • Creates linear_tickets/ and docs/ directories.

svgn sync

Linear Master Pull.

  • Fetches all active tickets from Linear and populates your local folders.
  • Updates local "fingerprints" to ensure subsequent updates are efficient.

svgn update

Local ➡ Linear.

  • Scans linear_tickets/ for local changes (status moves or text edits).
  • Pushes changes to Linear. Uses .svgn_state to skip unchanged files.

2. Documentation (Notion) Commands

svgn docs sync

Notion ➡ Local.

  • Downloads your Notion root page and all sub-pages as Markdown files into the docs/ folder.
  • Converts Notion blocks (headings, code, lists) into clean local Markdown.

svgn docs update

Local ➡ Notion.

  • Detects edits in your docs/ folder.
  • Clears the corresponding Notion page and re-uploads the fresh Markdown content as blocks.
  • Note: Only modifies pages that have changed locally.

3. Utility Commands

svgn inspect

  • Prints valid Assignee Emails, Labels, and Projects from Linear. Use this to ensure your Markdown frontmatter is accurate.

svgn logs

  • Displays a timestamped history of local-to-remote sync operations.

📋 Full Setup Workflow

  1. Install: Run uv pip install -e . (or pip install -e .) from the root directory.
  2. Environment: Ensure your .env contains the following :
    LINEAR_API_KEY=...
    LINEAR_TEAM_ID=...
    NOTION_TOKEN=...
    NOTION_ROOT_PAGE_ID=...
    
  3. Notion Permission: Open your Notion page, click ... -> Connect to -> and select your Integration.
    • Each page should be given access explicitly in the integrations.
  4. Initialize:
    svgn init
    svgn sync        # Pull tickets from Linear
    svgn docs sync   # Pull documentation
    

🧠 Using with AI (Cursor / Copilot)

The generated .cursorrules file instructs AI agents to respect the svgn workflow.

Example Prompts:

Planning with Docs:

"Read @architecture.md from the docs folder and create three implementation tasks in the todo folder. Assign them to me and run svgn update."

Executing a Task:

"Help me implement the logic described in @setup-database-migration.md. Once done, move the file to the done folder and run svgn sync."


📄 Metadata Examples

Linear Ticket (linear_tickets/todo/task.md)

---
linear_id: "uuid"
title: "Fix Auth Bug"
assignee: "dev@company.com"
labels: ["bug", "security"]
priority: "urgent"
---
## Description
...

Notion Document (docs/api-spec.md)

---
notion_id: "uuid"
title: "API Specification v2"
---
# API v2
This document tracks our REST endpoints...

🛠 Troubleshooting

  • 400 Bad Request (Notion): Ensure you have duplicated the Notion page to your private workspace and added the "Connection" via the page settings.
  • Sync Loops: svgn uses .svgn_state and .svgn_docs_state to store fingerprints. If a file is reverting unexpectedly, run svgn pull or svgn docs sync to refresh the local state.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

svgn-0.2.0.tar.gz (16.8 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

svgn-0.2.0-py3-none-any.whl (17.2 kB view details)

Uploaded Python 3

File details

Details for the file svgn-0.2.0.tar.gz.

File metadata

  • Download URL: svgn-0.2.0.tar.gz
  • Upload date:
  • Size: 16.8 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: uv/0.9.4

File hashes

Hashes for svgn-0.2.0.tar.gz
Algorithm Hash digest
SHA256 7e4968665b6f4af50778fb108abeceb00c9ad39d163ed8e7a55f7d950970b022
MD5 79c2f0ba51941bc899c06dc2bf59e791
BLAKE2b-256 1b53e9b2a8cad748902c80690c55c07d41f4423b89d4111c8f57f5e2ba32249c

See more details on using hashes here.

File details

Details for the file svgn-0.2.0-py3-none-any.whl.

File metadata

  • Download URL: svgn-0.2.0-py3-none-any.whl
  • Upload date:
  • Size: 17.2 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: uv/0.9.4

File hashes

Hashes for svgn-0.2.0-py3-none-any.whl
Algorithm Hash digest
SHA256 56f00b22de1f07a27e295b61b9a65139b21aa1c5ab4a953551755dba30ec1717
MD5 5827a35007e5f9703e336d24ce5b0286
BLAKE2b-256 2985efa27e90e94e5e23ea50ad0b0539f3f8a1040dcacc8872e8d633aba23954

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page