Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,10 @@
# changelog

## Unreleased
- TUI added to run all the commands interactively
- Results from commands are now send in string formats (easy for AI Agents to parse)

## 0.1.0-alpha.1
- scaffold changed to make it more modular
- expanded test coverage
- deployment script updated to perform based on artist and a subscription
Expand Down
7 changes: 4 additions & 3 deletions Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
[package]
name = "cite-cli"
authors = ["Binay Pradhan"]
version = "0.1.0-alpha.1"
version = "0.1.0-alpha.2"
edition = "2024"
readme = "README.md"

Expand All @@ -16,19 +16,20 @@ serde_json = "1.0"
serde_yaml = "0.9"
toml = "1.0"
tokio = { version = "1.44", features = ["full"] }
reqwest = { version = "0.12", features = ["json"], default-features = false }
reqwest = { version = "0.12", features = ["json", "rustls-tls"], default-features = false }
sha2 = "0.10"
percent-encoding = "2.3"
uuid = { version = "1.23", features = ["v4"] }
colored = "3.0"
thiserror = "2.0"
tracing = "0.1"
tracing-subscriber = { version = "0.3", features = ["env-filter"] }
regex = "1.13.0"
ratatui = { version = "0.30.2", features = ["crossterm"] }

[dev-dependencies]
tempfile = "3.19"
httpmock = "0.7"
regex = "1.13.0"

[[bin]]
name = "cite-cli"
Expand Down
21 changes: 13 additions & 8 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,11 +8,11 @@ CLI tool for scaffolding, validating, building, and deploying podcast content to

(MacOS/Linux only)
```bash
curl --proto '=https' --tlsv1.2 -LsSf https://github.com/VinayIN/cite-cli/releases/download/v0.1.0-alpha.1/cite-cli-installer.sh | sh
curl --proto '=https' --tlsv1.2 -LsSf https://github.com/VinayIN/cite-cli/releases/download/v0.1.0-alpha.2/cite-cli-installer.sh | sh
```
(Windows only)
```powershell
powershell -ExecutionPolicy Bypass -c "irm https://github.com/VinayIN/cite-cli/releases/download/v0.1.0-alpha.1/cite-cli-installer.ps1 | iex"
powershell -ExecutionPolicy Bypass -c "irm https://github.com/VinayIN/cite-cli/releases/download/v0.1.0-alpha.2/cite-cli-installer.ps1 | iex"
```

### From source
Expand All @@ -29,12 +29,15 @@ cargo build --release
```bash
cite-cli init my-project
# edit metadata.yml and add content files
cite-cli validate --path my-project
cite-cli doctor --path my-project
cite-cli build --path my-project
cite-cli status --path my-project
cite-cli deploy --path my-project
```

> TUI: Running `cite-cli` will open an interactive terminal UI for running the commands.
> NOTE: The editing of content files should still be done on your IDE.

## Tests

```bash
Expand All @@ -44,16 +47,18 @@ cargo test
## Commands

| Command | Description |
|---|---|
|---|---|---|
| `init <name>` | Scaffold a new project |
| `validate` | Check structure, metadata, file existence |
| `lint` | Word counts and content quality checks |
| `doctor` | Validate structure, metadata, file existence, asset formats, and config |
| `lint` | Word count checks |
| `build` | Incremental build -> `build/content.json` |
| `deploy` | Deploy to Supabase (full JSON to storage + table subset) |
| `status` | Project health overview |
| `doctor` | Diagnose config and structure issues |
| `clean` | Remove build artifacts and cache |
| `rollback <id>` | Undo a deployment by ID |
| `login` | Authenticate with Supabase for user-scoped deploys |
| `upgrade` | Self-update to the latest GitHub release |
| `uninstall` | Remove cite-cli binary and clean shell config |

All commands accept `--path <dir>` to target a specific directory.
Without `--path`, projects are auto-discovered in the current directory and subdirectories.
Expand All @@ -69,6 +74,6 @@ my-project/
│ └── article1.bib
├── assets/
│ ├── audio/ # Podcast audio files
│ └── images/ # Thumbnails and cover art
│ └── image/ # Thumbnails and cover art
└── build/ # Auto-Generated build output (gitignored)
```
37 changes: 21 additions & 16 deletions docs/PRD.md
Original file line number Diff line number Diff line change
Expand Up @@ -11,26 +11,25 @@

## 3. Core Concepts
- **Project**: A folder with `cite.toml`, `metadata.yml`, and content directories.
- **Artist**: A pre-existing Supabase user identified by UUID in `metadata.yml`. The CLI user is the content creator.
- **Artist**: A pre-existing Supabase user identified by UUID in `cite.toml` (`[project].artist_id`). The CLI user is the content creator.
- **Podcast**: A content item consisting of a markdown file, optional audio, optional source URL, optional thumbnail, and optional BibTeX citation.
- **Compiler Protocol**: Versioned process transforming source files into a `content.json` bundle.
- **Deployment**: Full `content.json` uploaded to Supabase Storage as `{deployment_id}.json`, plus a subset written to database tables for queryability.

## 4. Metadata Model (`metadata.yml`)

```yaml
artist_id: "11111111-1111-1111-1111-111111111111"
podcasts:
- title: "My Podcast"
file: content/my-article.md
source_url: "https://example.com"
category: "artificial intelligence"
audio: assets/audio/episode.mp3
thumbnail: assets/images/thumb.jpg
thumbnail: assets/image/thumb.jpg
citation: content/my-article.bib
```

- `artist_id` references an existing artist record in the database.
- `artist_id` references an existing artist record in the database (configured in `cite.toml` under `[project]`).
- `podcasts` is an array of content items. Each has a title, markdown file, and optional audio/thumbnail/citation.
- No slugs, no junction tables, no tier-based audio variants.

Expand All @@ -39,14 +38,16 @@ podcasts:
| Command | Description |
|---------|-------------|
| `init <name>` | Create project structure with starter files |
| `validate` | Check structure, metadata, file existence, asset formats |
| `doctor` | Validate structure, metadata, file existence, asset formats, and config |
| `lint` | Word count and content quality checks |
| `build` | Compile content → `build/content.json` with UUIDs and BibTeX timelines |
| `deploy` | Upload full bundle to storage; populate `news`, `podcasts`, `artists_news`, `timeline` tables |
| `deploy` | Upload full bundle to storage; populate `news`, `podcasts`, `artists_news`, `timeline`, `timeline_news`, `urls`, `categories`, `domains`, `metric` tables |
| `status` | Project health overview |
| `doctor` | Diagnose configuration and dependency issues |
| `clean` | Remove `build/` directory and cache |
| `rollback <id>` | Delete rows tagged with deployment_id from `podcasts`, `artists_news`, `news` |
| `rollback <id>` | Delete rows and storage objects associated with a deployment |
| `login` | Authenticate with Supabase and link artist account |
| `upgrade` | Self-update to the latest GitHub release |
| `uninstall` | Remove cite-cli binary and shell config references |

## 6. Build Pipeline

Expand All @@ -66,29 +67,33 @@ The compiler:
```
content.json → Upload full bundle to storage as {deployment_id}.json
→ For each podcast:
Resolve category by name
Create url record from source_url
Verify artist exists
Resolve/create category by name
Create url record (with domain lookup) from source_url
Insert news row
Auto-create artists_news junction
Create artists_news junction
Create metric row
Upload thumbnail → update news.thumbnail
Upload audio → insert podcasts row
Parse BibTeX timelines → insert timeline + timeline_news
```

- All rows tagged with `deployment_id` for rollback.
- Dry-run mode (`--dry-run`) shows what would happen without writing.
- Service key sourced from env var `CITE_STAGING_SERVICE_KEY` or `cite.toml`.
- Service key sourced from `backend.staging_service_key` in `cite.toml`.

## 8. Project Structure

```
my-project/
├── cite.toml # Project manifest
├── metadata.yml # Artist ID + podcast list
├── content/ # Markdown content files
├── metadata.yml # Podcast content metadata
├── .gitignore # Ignores build/ and cache
├── content/ # Markdown & BibTeX content files
├── assets/
│ ├── audio/ # MP3/WAV/M4A files
│ └── images/ # Thumbnails, cover art
└── build/ # Output (gitignored)
│ └── image/ # Thumbnails, cover art
└── build/ # Build output (gitignored)
```

## 9. Design Principles
Expand Down
Loading
Loading