2.4 KiB
2.4 KiB
PLAN: notion-sql CLI
Goal
Build a publish-ready Rust CLI that parses SQL-style CRUD statements and translates them into typed Notion REST API calls.
Approach
Create a binary crate with a small modular core:
- SQL parser and statement mapper using
sqlparser - Notion schema model and case-insensitive property lookup
- Filter translation from SQL expressions into Notion filter JSON
- Value coercion from SQL literals into typed Notion property payloads
- Blocking Notion HTTP client with pagination and 429 retry handling
- CLI presentation for table, JSON, CSV, dry-run summaries, and
--apply
Mutating operations stay dry-run by default. Tests focus on filter translation and value coercion because those areas carry the most behavioral risk.
Files Affected
Cargo.toml- crate metadata, dependencies, and dist configsrc/main.rs- CLI entrypointsrc/lib.rs- module exportssrc/cli.rs- clap arguments and command dispatchsrc/sql.rs- SQL parsing and supported statement extractionsrc/schema.rs- Notion database schema model and lookup helperssrc/filter.rs- WHERE expression to Notion filter translationsrc/value.rs- SQL literal to typed Notion property value coercionsrc/notion.rs- Notion REST client, pagination, retries, schema resolutionsrc/output.rs- table, JSON, CSV rendering and mutation summariesREADME.md- setup, auth, examples, install notesRELEASING.md- cargo-dist and Homebrew release flow.github/workflows/release.yml- generated-style dist release workflow
Steps
- Scaffold Rust binary crate and metadata.
- Add planning/session continuity docs.
- Implement SQL statement parsing for SELECT, INSERT, UPDATE, DELETE.
- Implement schema lookup, property type modeling, and value coercion.
- Implement WHERE filter translation and focused unit tests.
- Implement Notion HTTP client with name resolution, pagination, and retry.
- Implement CLI execution, dry-run/apply behavior, and output formats.
- Add README, RELEASING, and dist/Homebrew configuration.
- Run
cargo fmt,cargo test, andcargo build --release.
Open Questions
- No GitHub issue is associated with this work by user direction.
- Homebrew tap owner is
KofTwentyTwo; release automation targetsKofTwentyTwo/homebrew-tap. HOMEBREW_TAP_TOKENmust be added toKofTwentyTwo/notion-sqlbefore the first public release tag.