Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
42 commits
Select commit Hold shift + click to select a range
3401966
Update release workflow to always mark as prerelease
Jordonbc Dec 27, 2025
64207e8
Improve
Jordonbc Dec 28, 2025
f5efecd
Fixed compile issue
Jordonbc Dec 28, 2025
ed80217
Update ci.yml
Jordonbc Dec 28, 2025
7872f44
Fix compile issues
Jordonbc Dec 28, 2025
373d585
Fix compile issues
Jordonbc Dec 28, 2025
6c603bf
Update ci.yml
Jordonbc Dec 28, 2025
4ae51c3
Update Cargo.toml
Jordonbc Dec 28, 2025
3f036c4
Fixed issue
Jordonbc Dec 28, 2025
82965c0
Update ci.yml
Jordonbc Dec 28, 2025
0bdd548
Update backend_descriptor.rs
Jordonbc Dec 28, 2025
e803769
Added helpers
Jordonbc Dec 28, 2025
011dfc4
Update plugin_stdio.rs
Jordonbc Dec 28, 2025
3601da1
Update plugin_stdio.rs
Jordonbc Dec 28, 2025
bd61a77
Added logger
Jordonbc Dec 28, 2025
7d58052
Update plugin_stdio.rs
Jordonbc Dec 28, 2025
9c952d1
Improve core
Jordonbc Dec 28, 2025
0c74263
Improvements
Jordonbc Dec 28, 2025
dca4e78
Improved core
Jordonbc Dec 28, 2025
d2f51f7
Update lib.rs
Jordonbc Dec 31, 2025
0d31500
Create AGENTS.md
Jordonbc Dec 31, 2025
4628205
Update Cargo.toml
Jordonbc Dec 31, 2025
cf1a654
Update Cargo.toml
Jordonbc Dec 31, 2025
455b248
Added fmt requirement
Jordonbc Dec 31, 2025
5573461
Improved core
Jordonbc Dec 31, 2025
ab8249f
Update README.md
Jordonbc Dec 31, 2025
dc8a7f1
Update README.md
Jordonbc Dec 31, 2025
5e6cab0
Update
Jordonbc Dec 31, 2025
fa560c2
Version bump
Jordonbc Dec 31, 2025
e547092
Improved workflows
Jordonbc Dec 31, 2025
9fac442
Update plugin_runtime.rs
Jordonbc Dec 31, 2025
9d1977a
Update Justfile
Jordonbc Dec 31, 2025
5a8a6fb
Version bump
Jordonbc Dec 31, 2025
03c1c8f
Update release.yml
Jordonbc Dec 31, 2025
08ffa2e
Update release.yml
Jordonbc Dec 31, 2025
371276d
Version Bump
Jordonbc Dec 31, 2025
b833211
Remove duplicated cfg attribute from backend_descriptor.rs
Jordonbc Dec 31, 2025
e034c0d
Update AGENTS.md
Jordonbc Dec 31, 2025
7d281f0
agents: require 72-char commit title in AGENTS.md
Jordonbc Dec 31, 2025
dbaa322
docs: note sandbox requirements for and cargo commands in AGENTS.md
Jordonbc Dec 31, 2025
fd5e913
Update Cargo.lock
Jordonbc Jan 7, 2026
e9e0d64
Update version
Jordonbc Jan 7, 2026
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
9 changes: 6 additions & 3 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -41,16 +41,19 @@ jobs:
- name: Install Rust (stable)
uses: dtolnay/rust-toolchain@5d458579430fc14a04a08a1e7d3694f545e91ce6 # stable
with:
components: rustfmt
components: rustfmt, clippy

- name: Setup sccache
uses: mozilla-actions/sccache-action@7d986dd989559c6ecdb630a3fd2557667be217ad # v0.0.9

- name: Rust cache
uses: Swatinem/rust-cache@779680da715d629ac1d338a641029a2f4372abb5 # v2.8.2

- name: Format
run: cargo fmt --all --check
- name: Rustfmt (check)
run: cargo fmt --all -- --check

- name: Cargo clippy (all features)
run: cargo clippy --all-targets --all-features -- -D warnings

- name: Cargo check (all features)
run: cargo check --all-targets --all-features
Expand Down
8 changes: 8 additions & 0 deletions .github/workflows/nightly.yml
Original file line number Diff line number Diff line change
Expand Up @@ -133,13 +133,21 @@ jobs:

- name: Install Rust (stable)
uses: dtolnay/rust-toolchain@5d458579430fc14a04a08a1e7d3694f545e91ce6 # stable
with:
components: rustfmt, clippy

- name: Setup sccache
uses: mozilla-actions/sccache-action@7d986dd989559c6ecdb630a3fd2557667be217ad # v0.0.9

- name: Rust cache
uses: Swatinem/rust-cache@779680da715d629ac1d338a641029a2f4372abb5 # v2.8.2

- name: Rustfmt (check)
run: cargo fmt --all -- --check

- name: Cargo clippy (all features)
run: cargo clippy --all-targets --all-features -- -D warnings

- name: Cargo package
run: cargo package

Expand Down
33 changes: 26 additions & 7 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,12 +10,6 @@ on:
description: "Release tag (default: core-v<Cargo.toml version>)"
required: false
type: string
prerelease:
description: "Mark as pre-release"
required: false
type: boolean
default: false

permissions:
contents: read

Expand All @@ -42,16 +36,41 @@ jobs:

- name: Install Rust (stable)
uses: dtolnay/rust-toolchain@5d458579430fc14a04a08a1e7d3694f545e91ce6 # stable
with:
components: rustfmt, clippy

- name: Setup sccache
uses: mozilla-actions/sccache-action@7d986dd989559c6ecdb630a3fd2557667be217ad # v0.0.9

- name: Rust cache
uses: Swatinem/rust-cache@779680da715d629ac1d338a641029a2f4372abb5 # v2.8.2

- name: Rustfmt (check)
run: cargo fmt --all -- --check

- name: Cargo clippy (all features)
run: cargo clippy --all-targets --all-features -- -D warnings

- name: Cargo package
run: cargo package

- name: Require crates.io token
env:
CARGO_REGISTRY_TOKEN: ${{ secrets.CARGO_REGISTRY_TOKEN }}
run: |
set -euo pipefail
if [ -z "${CARGO_REGISTRY_TOKEN:-}" ]; then
echo 'Error: secrets.CARGO_REGISTRY_TOKEN is not set. Aborting release.'
exit 1
fi

- name: Publish to crates.io
env:
CARGO_REGISTRY_TOKEN: ${{ secrets.CARGO_REGISTRY_TOKEN }}
run: |
set -euo pipefail
cargo publish --token "$CARGO_REGISTRY_TOKEN"

- name: Determine tag
id: tag
shell: bash
Expand All @@ -78,7 +97,7 @@ jobs:
with:
tag_name: ${{ steps.tag.outputs.tag }}
name: ${{ steps.tag.outputs.tag }}
prerelease: ${{ github.event_name == 'workflow_dispatch' && inputs.prerelease || false }}
prerelease: true
generate_release_notes: true
files: |
target/package/*.crate
43 changes: 43 additions & 0 deletions AGENTS.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
# Repository Guidelines

## Project Structure & Module Organization

- `src/`: Single Rust crate (`openvcs-core`) providing shared types/traits for the OpenVCS client and plugins.
- Feature-gated modules: `plugin_protocol`, `plugin_stdio`, `plugin_runtime`, `events`, `host`.
- VCS surface area lives behind the `vcs` feature (see `src/lib.rs`).
- `.github/workflows/`: CI, CodeQL, nightly packaging/release automation.
- `target/`: Cargo build artifacts (do not commit).

## Build, Test, and Development Commands

- `cargo check --all-targets --all-features`: Fast compile check matching CI’s broadest configuration.
- `cargo test`: Run default-feature unit tests.
- `cargo test --no-default-features --features plugin-protocol,vcs,backend-registry`: Validate feature combinations used in CI.
- `cargo package`: Ensure the crate packages cleanly (used by nightly automation).

## Coding Style & Naming Conventions

- Format with Rustfmt: `cargo fmt`.
- Prefer Clippy-clean code: `cargo clippy --all-targets --all-features -D warnings`.
- Naming: `snake_case` (functions/modules), `CamelCase` (types), `SCREAMING_SNAKE_CASE` (constants).
- Preserve feature gates (`#[cfg(feature = "...")]`) when adding new APIs; keep the default feature set lightweight.

## Testing Guidelines

- Uses Rust’s built-in test harness (`#[test]`) with unit tests colocated in modules (e.g., `src/models.rs`).
- Add tests next to the code they cover; keep tests deterministic and free of network/file-system assumptions unless required.

## Commit & Pull Request Guidelines

- Before committing, run `cargo fmt` (CI enforces `cargo fmt --all -- --check`).
- Commit messages in this repo are short and imperative (e.g., “Update lib.rs”, “Fix compile issues”). Follow that pattern and mention the touched area.
- Commit message format: agents must format commit messages with a short
title of at most 72 characters, followed by a blank line and any
additional explanatory text in the body.
- Open PRs against the `Dev` branch; include a clear description, rationale, and any relevant issue links.
- Ensure CI passes locally where possible (at minimum `cargo test`, ideally the full-feature test command above).

- After making changes, run `just fix` to automatically apply formatting and simple fixes before committing.
- Commit changes locally with a clear, conventional message, but do NOT push to remotes or create PRs—leave pushing and PR creation to a human maintainer.

**Sandbox note**: Running `just fix` and some `cargo` commands (for example `cargo build` or commands that fetch dependencies or build native binaries) may require network access or host-level tooling and therefore should be run outside a restricted sandbox or container. If operating with sandboxing or restricted network access, request approval before executing these commands or run them on the host machine.
22 changes: 11 additions & 11 deletions Cargo.lock

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

30 changes: 25 additions & 5 deletions Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,7 +1,27 @@
[package]
name = "openvcs-core"
version = "0.1.0"
version = "0.1.5"
edition = "2024"
description = "Core types and traits for OpenVCS."
license = "GPL-3.0-or-later"
homepage = "https://bbgames.dev/"
repository = "https://github.com/Open-VCS/OpenVCS-Core"
readme = "README.md"

keywords = [
"openvcs",
"vcs",
"version-control",
"plugin",
"rpc"
]


categories = [
"development-tools",
"development-tools::build-utils",
"api-bindings"
]

[features]
# Keep the default lightweight for non-VCS plugins; enable what you need.
Expand All @@ -11,17 +31,17 @@ default = ["plugin-protocol"]
plugin-protocol = ["dep:serde_json"]

# The VCS trait and VCS-related error type.
vcs = ["dep:thiserror"]
vcs = ["dep:thiserror", "backend-registry"]

# Static + dynamic backend registry (linkme + logging).
backend-registry = ["vcs", "dep:linkme", "dep:log"]
# Backend discovery via the `BACKENDS` registry (link-time registration).
backend-registry = ["dep:linkme"]
Comment on lines 33 to +37

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2 Badge Make backend-registry imply vcs again

backend_descriptor.rs imports crate::{Result, Vcs}, which are only defined under feature = "vcs" (see src/lib.rs). After this change, backend-registry no longer enables vcs, so cargo build --no-default-features --features backend-registry will now fail with unresolved imports. This is a regression from the previous feature graph. Consider restoring vcs as a dependency of backend-registry or gating backend_descriptor behind both features.

Useful? React with 👍 / 👎.


[dependencies]
serde = { version = "1", features = ["derive"] }
serde_json = { version = "1", optional = true }
thiserror = { version = "2", optional = true }
linkme = { version = "0.3", optional = true }
log = { version = "0.4", optional = true }
log = "0.4"

[dev-dependencies]
serde_json = "1"
9 changes: 9 additions & 0 deletions Justfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
set shell := ["bash", "-eu", "-o", "pipefail", "-c"]

default:
@just --list

fix:
cargo fmt --all
cargo clippy --fix --all-targets --all-features --allow-dirty --allow-staged

59 changes: 54 additions & 5 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,8 +1,57 @@
# OpenVCS-Core
# OpenVCS Core (`openvcs-core`)

Shared Rust crate for OpenVCS plugins and the OpenVCS client.
[![Dev CI (fast)](https://github.com/Open-VCS/OpenVCS-Core/actions/workflows/ci.yml/badge.svg)](https://github.com/Open-VCS/OpenVCS-Core/actions/workflows/ci.yml)

Shared Rust crate for:
- OpenVCS plugins (JSON-RPC over stdio)
- The OpenVCS client/host (shared models + backend trait surface)

## Cargo features
- `plugin-protocol` (default): JSON RPC message types for plugin stdio communication.
- `vcs`: the `Vcs` trait + `VcsError`.
- `backend-registry`: backend registry helpers (requires `vcs`).

- `plugin-protocol` (default): JSON-RPC wire types + plugin helper modules:
- `openvcs_core::plugin_protocol` (`PluginMessage`, `RpcRequest`, `RpcResponse`)
- `openvcs_core::plugin_stdio` (read/write helpers, `respond_shared`, host calls)
- `openvcs_core::plugin_runtime` (simple request dispatch loop + handler registry)
- `openvcs_core::events` (host event subscribe/emit helpers)
- `openvcs_core::host` (bridge for calling the host over stdio)
- `vcs`: the backend trait surface:
- `openvcs_core::Vcs`, `openvcs_core::VcsError`, `openvcs_core::Result`
- `openvcs_core::models` (shared request/response/event types)
- enables `backend-registry`
- `backend-registry`: link-time backend discovery via `openvcs_core::backend_descriptor::BACKENDS`
- intended to be enabled together with `vcs`
- on `wasm32`, the registry is always empty (no `linkme` support)

## Plugin quickstart (stdio JSON-RPC)

Register one or more RPC handlers and run the dispatch loop:

```rust
use openvcs_core::plugin_runtime::{register_delegate, run_registered};
use openvcs_core::plugin_stdio::ok;

fn main() -> std::io::Result<()> {
register_delegate("ping", |_ctx, _req| ok(serde_json::json!({ "pong": true })));
run_registered()
}
```

Notes:
- `openvcs_core::{trace, debug, info, warn, error}` forward logs to the OpenVCS host when available (and also emit normal `log` records).
- Host calls from plugins go through `openvcs_core::host::call(...)` (the runtime initializes the host bridge for stdio).
- `OPENVCS_PLUGIN_HOST_TIMEOUT_MS` controls host call timeouts (default: 60000ms).

## Development

Common checks (matches CI):
- `just fix` (runs rustfmt + clippy)
- `cargo fmt --all -- --check`
- `cargo clippy --all-targets --all-features -- -D warnings`
- `cargo check --all-targets --all-features`
- `cargo test`
- `cargo test --no-default-features --features plugin-protocol,vcs,backend-registry`
- `cargo package`

## License

GPL-3.0-or-later (see `LICENSE`).
Loading
Loading