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
1 change: 1 addition & 0 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

14 changes: 14 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -89,6 +89,20 @@ cargo check
cargo test
```

## Codra CLI (event protocol + GitHub context)

```bash
cargo build -p codra-cli

# JSONL agent run events (no AI provider keys required)
codra run --task review-pr --jsonl
codra run --task summarize-context

# Optional: GITHUB_TOKEN enriches PR/issue data via GitHub API
```

See [crates/codra-cli/README.md](crates/codra-cli/README.md).

## Roadmap

See [docs/ROADMAP.md](docs/ROADMAP.md) for the full phased roadmap.
Expand Down
5 changes: 5 additions & 0 deletions crates/codra-cli/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -3,11 +3,16 @@ name = "codra-cli"
version = "0.1.0"
edition = "2021"

[lib]
name = "codra_cli"
path = "src/lib.rs"

[[bin]]
name = "codra"
path = "src/main.rs"

[dependencies]
serde = { workspace = true, features = ["derive"] }
serde_json.workspace = true
codra-core = { path = "../codra-core" }
codra-protocol = { path = "../codra-protocol" }
Expand Down
53 changes: 53 additions & 0 deletions crates/codra-cli/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,53 @@
# codra-cli

Local-first Codra CLI with JSONL event protocol and GitHub context adapter.

## Usage

```bash
# Build
cargo build -p codra-cli

# JSONL event stream (no AI keys required)
codra run --task review-pr --jsonl
codra run --task explain-issue --jsonl
codra run --task summarize-context --jsonl

# Human-readable output
codra run --task summarize-context
codra run --task review-pr
```

## GitHub context

Reads GitHub Actions environment variables when present:

- `GITHUB_REPOSITORY`, `GITHUB_EVENT_NAME`, `GITHUB_EVENT_PATH`
- `GITHUB_SHA`, `GITHUB_REF`, `GITHUB_BASE_REF`, `GITHUB_HEAD_REF`
- `GITHUB_TOKEN` (optional — enables API enrichment)

Without `GITHUB_TOKEN`, the CLI still runs and emits warnings instead of failing.

## Event protocol

With `--jsonl`, each line is a JSON object:

| Type | When |
|------|------|
| `codra.run.started` | Run begins |
| `codra.context.loading` | Context load starts |
| `codra.context.loaded` | Context ready |
| `codra.task.started` | Task execution starts |
| `codra.task.summary` | Deterministic task output |
| `codra.task.completed` | Task finished |
| `codra.run.completed` | Success |
| `codra.run.failed` | Unrecoverable error |
| `codra.warning` | Non-fatal issue |

Fields: `type`, `runId`, `timestamp`, `task`, `source`, `data`.

## Extension points (Phase 3+)

- GitHub Action: `codra run --task review-pr --jsonl`
- PR comment upload from final `codra.task.summary`
- Desktop session viewer can tail JSONL events
Loading
Loading